From 4c399000f1b110cb5ec02716eae8aac83e6f9b22 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 15 May 2014 23:17:59 +0000 Subject: [PATCH] Activate runes as the proper type in the simulator. Some specializations cause death runes to reactivate in place of consumed runes, which needed to be modeled in the simulator. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1445 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleRunes.lua | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/OvaleRunes.lua b/OvaleRunes.lua index 6793db7..6ed1061 100644 --- a/OvaleRunes.lua +++ b/OvaleRunes.lua @@ -28,6 +28,7 @@ local ipairs = ipairs local pairs = pairs local API_GetRuneCooldown = GetRuneCooldown local API_GetRuneType = GetRuneType +local API_GetSpellInfo = GetSpellInfo local API_GetTime = GetTime local API_UnitClass = UnitClass @@ -81,6 +82,23 @@ local ANY_RUNE_PRIORITY = { 1, 2, 3, 4, 5, 6 } -- Improved Blood Presence increases rune regenerate rate by 20%. local IMPROVED_BLOOD_PRESENCE = 50371 + +-- Blood of the North (frost) permanently transforms Blood Runes into Death Runes. +local BLOOD_OF_THE_NORTH = 54637 +-- Blood Rites (blood) causes the Frost and Unholy runes consumed by Death Strike to reactivate as Death runes. +local BLOOD_RITES = 50034 +local BLOOD_RITES_ATTACK = { + [49998] = API_GetSpellInfo(49998), -- Death Strike +} +-- Reaping (unholy) causes the runes consumed by Blood Strike, Pestilence, Festering Strike, Icy Touch or Blood Boil to reactivate as Death Runes. +local REAPING = 56835 +local REAPING_ATTACK = { + [45477] = API_GetSpellInfo(45477), -- Icy Touch + [45902] = API_GetSpellInfo(45902), -- Blood Strike + [48721] = API_GetSpellInfo(48721), -- Blood Boil + [50842] = API_GetSpellInfo(50842), -- Pestilence + [85948] = API_GetSpellInfo(85948), -- Festering Strike +} -- -- @@ -241,7 +259,7 @@ function OvaleRunes:ApplySpellAfterCast(state, spellId, targetGUID, startCast, e local count = si[name] or 0 while count > 0 do local atTime = isChanneled and startCast or endCast - state:ConsumeRune(atTime, name, spellcast.snapshot) + state:ConsumeRune(atTime, spellId, name, spellcast.snapshot) count = count - 1 end end @@ -262,7 +280,7 @@ statePrototype.DebugRunes = function(state) end -- Consume a rune of the given type. Assume that the required runes are available. -statePrototype.ConsumeRune = function(state, atTime, name, snapshot) +statePrototype.ConsumeRune = function(state, spellId, atTime, name, snapshot) --[[ Find a usable rune, preferring a regular rune of that rune type over death runes of that rune type over death runes of any rune type. @@ -301,9 +319,9 @@ statePrototype.ConsumeRune = function(state, atTime, name, snapshot) end if consumedRune then -- Put that rune on cooldown, starting when the other rune of that slot type comes off cooldown. - local k = consumedRune.slotType + local slotType = consumedRune.slotType local start = atTime - for _, slot in ipairs(RUNE_SLOTS[consumedRune.slotType]) do + for _, slot in ipairs(RUNE_SLOTS[slotType]) do local rune = state.rune[slot] if rune.endCooldown > start then start = rune.endCooldown @@ -317,6 +335,22 @@ statePrototype.ConsumeRune = function(state, atTime, name, snapshot) consumedRune.startCooldown = start consumedRune.endCooldown = start + duration + -- Set the type of rune that this consumed rune will reactivate as. + if slotType == BLOOD_RUNE and OvaleSpellBook:IsKnownSpell(BLOOD_OF_THE_NORTH) then + -- Blood of the North (frost) permanently transforms Blood Runes into Death Runes. + consumedRune.type = DEATH_RUNE + elseif (slotType == FROST_RUNE or slotType == UNHOLY_RUNE) and BLOOD_RITES_ATTACK[spellId] and OvaleSpellBook:IsKnownSpell(BLOOD_RITES) then + -- Blood Rites (blood) causes the Frost and Unholy runes consumed by Death Strike to reactivate as Death runes. + consumedRune.type = DEATH_RUNE + elseif REAPING_ATTACK[spellId] and OvaleSpellBook:IsKnownSpell(REAPING) then + -- Reaping (unholy) causes the runes consumed by Blood Strike, Pestilence, Festering Strike, Icy Touch or + -- Blood Boil to reactivate as Death Runes. + consumedRune.type = DEATH_RUNE + else + -- In all other cases, runes reactivate according to their slot type. + consumedRune.type = slotType + end + -- Each rune consumed generates 10 (12, if in Frost Presence) runic power. local runicpower = state.runicpower if OvaleStance:IsStance("deathknight_frost_presence") then -- 1.7.9.5