Parameter "if_stance" means "only if in the given stance".
Johnny C. Lam [10-12-12 - 00:46]
Parameter "if_stance" means "only if in the given stance".
Use if_stance parameter in the monk script instead of hard-coding the
extra Chi generated by Jab and Expel Harm for monks in Stance of the
Fierce Tiger.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@591 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/Ovale.lua b/Ovale.lua
index f78b662..6d8fb88 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -47,6 +47,7 @@ Ovale.score = 0
Ovale.maxScore = 0
Ovale.refreshNeeded = {}
Ovale.compileOnItems = false
+Ovale.compileOnStances = false
Ovale.combatStartTime = nil
Ovale.needCompile = false
Ovale.listes = {}
@@ -60,6 +61,16 @@ BINDING_NAME_OVALE_CHECKBOX2 = L["Inverser la boîte à cocher "].."(3)"
BINDING_NAME_OVALE_CHECKBOX3 = L["Inverser la boîte à cocher "].."(4)"
BINDING_NAME_OVALE_CHECKBOX4 = L["Inverser la boîte à cocher "].."(5)"
+--<private-static-methods>
+local function ShapeshiftEventHandler()
+ if Ovale.compileOnStances then
+ Ovale.needCompile = true
+ else
+ Ovale.refreshNeeded.player = true
+ end
+end
+--</private-static-methods>
+
--<public-static-methods>
function Ovale:Debug()
self:Print(OvaleCompile:DebugNode(self.masterNodes[1]))
@@ -117,6 +128,8 @@ function Ovale:OnEnable()
self:RegisterEvent("GLYPH_UPDATED")
self:RegisterEvent("GLYPH_ADDED")
self:RegisterEvent("UNIT_INVENTORY_CHANGED")
+ self:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
+ self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
self:UpdateVisibility()
end
@@ -130,6 +143,8 @@ function Ovale:OnDisable()
self:UnregisterEvent("GLYPH_UPDATED")
self:UnregisterEvent("GLYPH_ADDED")
self:UnregisterEvent("UNIT_INVENTORY_CHANGED")
+ self:UnregisterEvent("UPDATE_SHAPESHIFT_FORM")
+ self:UnregisterEvent("UPDATE_SHAPESHIFT_FORMS")
self.frame:Hide()
end
@@ -141,6 +156,14 @@ function Ovale:UNIT_INVENTORY_CHANGED()
end
end
+function Ovale:UPDATE_SHAPESHIFT_FORM()
+ ShapeshiftEventHandler()
+end
+
+function Ovale:UPDATE_SHAPESHIFT_FORMS()
+ ShapeshiftEventHandler()
+end
+
--Called when the player target change
--Used to update the visibility e.g. if the user chose
--to hide Ovale if a friendly unit is targeted
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 896e5f3..96048ce 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -90,6 +90,12 @@ local function TestConditions(paramList)
if paramList.mastery and paramList.mastery~=GetSpecialization() then
return false
end
+ if paramList.if_stance then
+ Ovale.compileOnStances = true
+ if paramList.if_stance ~= GetShapeshiftForm() then
+ return false
+ end
+ end
if paramList.talent and not HasTalent(paramList.talent) then
return false
end
@@ -534,6 +540,7 @@ end
function OvaleCompile:Compile(text)
Ovale.compileOnItems = false
+ Ovale.compileOnStances = false
Ovale.bug = false
node = {}
defines = {}
diff --git a/OvaleState.lua b/OvaleState.lua
index 1dcea2c..8c4dffc 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -163,15 +163,6 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
end
if newSpellInfo then
- -- Monks in Stance of the Fierce Tiger generate one extra Chi per Jab and Expel Harm.
- if OvaleData.className == "MONK" then
- if OvaleAura.stance == 2 or (OvaleAura.mastery ~= 2 and OvaleAura.stance == 1) then
- if spellId == 100780 or spellId == 115072 then
- self.state.chi = self.state.chi + 1
- end
- end
- end
-
-- Update power state, except for eclipse, combo, and runes.
for k,v in pairs(OvaleData.power) do
-- eclipse cost is on hit
diff --git a/defaut/Moine.lua b/defaut/Moine.lua
index 4a56bd8..feefce7 100644
--- a/defaut/Moine.lua
+++ b/defaut/Moine.lua
@@ -23,6 +23,8 @@ Define(invoke_xuen 123904)
SpellInfo(invoke_xuen duration=45 cd=180 )
Define(jab 100780)
SpellInfo(jab energy=40 chi=-1 )
+ SpellInfo(jab chi=-2 if_stance=1 mastery=3)
+ SpellInfo(jab chi=-2 if_stance=2)
Define(power_strikes 121817)
Define(rising_sun_kick 107428)
SpellInfo(rising_sun_kick chi=2 cd=8 )