Quantcast

- added expose armor to rogue script and sunder armor to warrior script

Sidoine De Wispelaere [12-02-12 - 12:17]
- added expose armor to rogue script and sunder armor to warrior script
- fix warlock immolate (not a good fix but a better fix would be too much work)
- faerie fire with any=1
- fix for multiple targets with the same name

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@656 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleAura.lua
OvaleCondition.lua
OvaleFuture.lua
OvaleGUID.lua
OvaleState.lua
defaut/Demoniste.lua
defaut/Druide.lua
defaut/Guerrier.lua
defaut/Voleur.lua
diff --git a/OvaleAura.lua b/OvaleAura.lua
index 597c2c9..4614e35 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -278,6 +278,7 @@ end
 -- Public methods
 function OvaleAura:GetAuraByGUID(guid, spellId, mine, unitId)
 	if not guid then
+		Ovale:Log(tostring(guid) .. " does not exists in OvaleAura")
 		return nil
 	end
 	local auraTable = self.aura[guid]
@@ -286,12 +287,14 @@ function OvaleAura:GetAuraByGUID(guid, spellId, mine, unitId)
 			unitId = OvaleGUID:GetUnitId(guid)
 		end
 		if not unitId then
+			Ovale:Log("Unable to get unitId from " .. tostring(guid))
 			return nil
 		end
 		self:UpdateAuras(unitId, guid)
 		auraTable = self.aura[guid]
 		if not auraTable then
 			-- no aura on target
+			Ovale:Log("Target " .. guid .. " has no aura")
 			return nil
 		end
 	end
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 0f03eca..6204dd7 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -346,11 +346,11 @@ local function GetTargetAura(condition, target)

 	local aura = getAura(target, spellId, mine)
 	if not aura then
-		Ovale:Log("Aura "..spellId.." not found")
+		Ovale:Log("Aura "..spellId.." not found on " .. target .. " mine=" .. tostring(mine))
 		return 0,0,0,0
 	end
 	if Ovale.trace then
-		Ovale:Print("GetTargetAura = start=".. tostring(aura.start) .. " end="..tostring(aura.ending).." stacks=" ..tostring(aura.stacks).."/"..stacks)
+		Ovale:Print("GetTargetAura = start=".. tostring(aura.start) .. " end="..tostring(aura.ending).." stacks=" ..tostring(aura.stacks).."/"..stacks .. " target="..target)
 	end

 	if (not condition.mine or (aura.mine and condition.mine==1) or (not aura.mine and condition.mine==0)) and aura.stacks>=stacks then
diff --git a/OvaleFuture.lua b/OvaleFuture.lua
index 5a57a7b..d1135e8 100644
--- a/OvaleFuture.lua
+++ b/OvaleFuture.lua
@@ -99,10 +99,16 @@ end

 function OvaleFuture:UNIT_SPELLCAST_SENT(event, unit, spell, rank, target, lineId)
 	if unit == "player" then
-		local targetGUID = OvaleGUID.nameToGUID[target]
+		local targetGUID
+		--The UNIT_TARGET event may come a bit late
+		if target == UnitName("target") then
+			targetGUID = UnitGUID("target")
+		else
+			targetGUID = OvaleGUID.nameToGUID[target]
+		end
 		self.nextSpellTarget = targetGUID
 		self.nextSpellLineID = lineId
-		--Ovale:Print(target)
+		-- Ovale:Print("UNIT_SPELLCAST_SENT " .. lineId .. " targetGUID = " .. targetGUID)
 		for i,v in ipairs(self.lastSpell) do
 			if v.lineId == lineId then
 				v.target = targetGUID
@@ -221,6 +227,7 @@ function OvaleFuture:AddSpellToList(spellId, lineId, startTime, endTime, channel
 	newSpell.allowRemove = allowRemove
 	--TODO unable to know what is the real target
 	if lineId == self.nextSpellLineID and self.nextSpellTarget then
+		-- Ovale:Print("found lineId " .. lineId .. " target is " .. self.nextSpellTarget)
 		newSpell.target = self.nextSpellTarget
 	else
 		newSpell.target = UnitGUID("target")
diff --git a/OvaleGUID.lua b/OvaleGUID.lua
index e927799..1ea9648 100644
--- a/OvaleGUID.lua
+++ b/OvaleGUID.lua
@@ -50,6 +50,7 @@ function OvaleGUID:OnDisable()
 end

 function OvaleGUID:Update(unitId)
+	--self:Print("Update " .. unitId)
 	local guid = UnitGUID(unitId)
 	local previousGuid = self.guid[unitId]
 	if unitId == "player" then
@@ -70,12 +71,12 @@ function OvaleGUID:Update(unitId)
 			Ovale:debugPrint("guid", "GUID "..guid.." is ".. unitId)
 			self.unitId[guid][unitId] = true
 		end
-		local name = UnitName(unitId)
-		if name and (not self.nameToGUID[name] or unitId == "target"
-				or self.nameToUnit[name] == "mouseover") then
-			self.nameToGUID[name] = guid
-			self.nameToUnit[name] = unitId
-		end
+	end
+	local name = UnitName(unitId)
+	if name and (not self.nameToGUID[name] or unitId == "target"
+			or self.nameToUnit[name] == "mouseover") then
+		self.nameToGUID[name] = guid
+		self.nameToUnit[name] = unitId
 	end
 end

@@ -96,6 +97,9 @@ end

 function OvaleGUID:UNIT_TARGET(event, unitId)
 	self:Update(unitId .. "target")
+	if unitId == "player" then
+		self:Update("target")
+	end
 end

 function OvaleGUID:GROUP_ROSTER_UPDATE(event)
diff --git a/OvaleState.lua b/OvaleState.lua
index 41e49a3..5512eef 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -78,6 +78,7 @@ function OvaleState:Reset()
 	self.lastSpellId = OvaleFuture.lastSpellId
 	self.serial = self.serial + 1
 	self.currentTime = self.maintenant
+	Ovale:Log("Reset state with current time = " .. self.currentTime)
 	self.currentSpellId = nil
 	self.attenteFinCast = self.maintenant
 	self.state.combo = OvaleComboPoints.combo
@@ -141,7 +142,7 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
 	end

 	if Ovale.trace then
-		Ovale:Print("add spell "..spellId.." at "..startCast.." currentTime = "..self.currentTime.. " nextCast="..self.attenteFinCast .. " endCast="..endCast)
+		Ovale:Print("add spell "..spellId.." at "..startCast.." currentTime = "..self.currentTime.. " nextCast="..self.attenteFinCast .. " endCast="..endCast .. " targetGUID = " .. tostring(targetGUID))
 	end

 	--Effet du sort au moment du dbut du cast
@@ -344,7 +345,7 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
 										newAura.stacks = previousAura.stacks + stacks
 									end
 									newAura.start = previousAura.start
-									if isDoT then
+									if isDoT and previousAura.ending > newAura.start then
 										-- TODO: check that refreshed DoTs take a new snapshot of player stats.
 										local tickLength = OvaleData:GetTickLength(auraSpellId, previousAura.spellHaste)
 										local k = floor((previousAura.ending - endCast) / tickLength)
@@ -369,7 +370,7 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
 									end
 								end
 							else
-								Ovale:Log("New aura "..auraSpellId.." at " .. endCast)
+								Ovale:Log("New aura "..auraSpellId.." at " .. endCast .." on " .. target .. " " .. auraGUID)
 								newAura.stacks = stacks
 								newAura.start = endCast
 								newAura.ending = endCast + duration
@@ -435,8 +436,10 @@ end

 function OvaleState:GetAuraByGUID(guid, spellId, mine, target)
 	if self.aura[guid] and self.aura[guid][spellId] and self.aura[guid][spellId].serial == self.serial then
+		Ovale:Log("Found aura " .. spellId .. " on " .. tostring(guid))
 		return self.aura[guid][spellId]
 	else
+		Ovale:Log("Aura " .. spellId .. " not found in state for " .. tostring(guid))
 		return OvaleAura:GetAuraByGUID(guid, spellId, mine, target)
 	end
 end
diff --git a/defaut/Demoniste.lua b/defaut/Demoniste.lua
index 56bcd79..4b06c04 100644
--- a/defaut/Demoniste.lua
+++ b/defaut/Demoniste.lua
@@ -236,7 +236,7 @@ AddIcon mastery=3 help=main
 	if TalentPoints(grimoire_of_service_talent) Spell(service_felhunter)
 	if TalentPoints(grimoire_of_sacrifice_talent) and BuffExpires(grimoire_of_sacrifice) unless pet.CreatureFamily(Felhunter) Spell(summon_felhunter)
 	if BurningEmbers() if target.HealthPercent(less 20) Spell(shadowburn)
-	if target.TicksRemain(immolate) <Ticks(immolate) /2 and target.DeadIn() >=5 Spell(immolate)
+	if {target.TicksRemain(immolate) <Ticks(immolate) /2 or target.DebuffExpires(immolate) } and target.DeadIn() >=5 Spell(immolate)
 	if BurningEmbers() and {BuffStacks(backdraft) <3 or Level() <86 } and {BurningEmbers() >3.5 or BuffRemains(dark_soul) >CastTime(chaos_bolt) } and ManaPercent() <=80 Spell(chaos_bolt)
 	Spell(conflagrate)
 	Spell(incinerate)
diff --git a/defaut/Druide.lua b/defaut/Druide.lua
index a57a734..0df1fb6 100644
--- a/defaut/Druide.lua
+++ b/defaut/Druide.lua
@@ -161,7 +161,7 @@ AddIcon mastery=2 help=main
 		if TalentPoints(force_of_nature_talent) Spell(treants)
 	}

-	if target.DebuffStacks(weakened_armor) <3 Spell(faerie_fire)
+	if target.DebuffStacks(weakened_armor any=1) <3 Spell(faerie_fire)
 	if BuffExpires(savage_roar) Spell(savage_roar)
 	if target.IsInterruptible() Spell(skull_bash_cat)
 	if TalentPoints(dream_of_cenarius_talent) and BuffPresent(predatory_swiftness) and ComboPoints() >=4 and BuffStacks(dream_of_cenarius_damage) <2 Spell(healing_touch)
diff --git a/defaut/Guerrier.lua b/defaut/Guerrier.lua
index a149f08..8c6ea27 100644
--- a/defaut/Guerrier.lua
+++ b/defaut/Guerrier.lua
@@ -94,6 +94,10 @@ Define(slam 1464)
 Define(storm_bolt 107570)
   SpellInfo(storm_bolt cd=30 )
   SpellAddBuff(storm_bolt storm_bolt=1)
+Define(sunder_armor 7386)
+  SpellInfo(sunder_armor rage=15 )
+  SpellAddTargetDebuff(sunder_armor weakened_armor=1)
+  AddCheckBox(sunder_armor_check SpellName(sunder_armor))
 Define(sweeping_strikes 12328)
   SpellInfo(sweeping_strikes duration=10 rage=30 cd=10 )
   SpellAddBuff(sweeping_strikes sweeping_strikes=1)
@@ -102,6 +106,9 @@ Define(thunder_clap 6343)
   SpellInfo(thunder_clap rage=20 cd=6 )
   SpellAddTargetDebuff(thunder_clap weakened_blows=1)
 Define(ultimatum 122509)
+Define(weakened_armor 113746)
+  SpellInfo(weakened_armor duration=30 )
+  SpellAddBuff(weakened_armor weakened_armor=1)
 Define(weakened_blows 115798)
   SpellInfo(weakened_blows duration=30 )
   SpellAddBuff(weakened_blows weakened_blows=1)
@@ -125,6 +132,7 @@ AddIcon mastery=1 help=main
 	{
 		unless Stance(1) Spell(battle_stance)
 	}
+	if target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 if CheckBoxOn(sunder_armor_check) Spell(sunder_armor)
 	Spell(mortal_strike)
 	if target.DebuffRemains(colossus_smash) <=1.5 Spell(colossus_smash)
 	if target.HealthPercent(less 20) Spell(execute)
@@ -172,6 +180,7 @@ AddIcon mastery=2 help=main
 	{
 		unless Stance(1) Spell(battle_stance)
 	}
+	if target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 if CheckBoxOn(sunder_armor_check) Spell(sunder_armor)
 	if not {target.HealthPercent() <20 and target.DebuffPresent(colossus_smash) and Rage() >=30 } Spell(bloodthirst)
 	if BuffStacks(bloodsurge) and target.HealthPercent() >=20 and SpellCooldown(bloodthirst) <=1 Spell(wild_strike)
 	if not {target.HealthPercent() <20 and target.DebuffPresent(colossus_smash) and Rage() >=30 } and SpellCooldown(bloodthirst) <=1 and SpellCooldown(bloodthirst) if CheckBoxOn(showwait) Texture(Spell_nature_timestop)
diff --git a/defaut/Voleur.lua b/defaut/Voleur.lua
index 9570fa6..1991e77 100644
--- a/defaut/Voleur.lua
+++ b/defaut/Voleur.lua
@@ -20,6 +20,9 @@ Define(envenom 32645)
   SpellAddBuff(envenom envenom=1)
 Define(eviscerate 2098)
   SpellInfo(eviscerate combo=0 energy=35 )
+Define(expose_armor 8647)
+  SpellInfo(expose_armor energy=25 combo=1 )
+  AddCheckBox(expose_armor_check SpellName(expose_armor))
 Define(find_weakness 91021)
   SpellInfo(find_weakness duration=10 )
   SpellAddBuff(find_weakness find_weakness=1)
@@ -68,6 +71,9 @@ Define(vanish 1856)
 Define(vendetta 79140)
   SpellInfo(vendetta duration=20 cd=120 )
   SpellAddBuff(vendetta vendetta=1)
+Define(weakened_armor 113746)
+  SpellInfo(weakened_armor duration=30 )
+  SpellAddBuff(weakened_armor weakened_armor=1)
 Define(preparation_talent 10)
 AddIcon mastery=1 help=main
 {
@@ -75,6 +81,7 @@ AddIcon mastery=1 help=main
 	{
 		if WeaponEnchantExpires(mainhand 300) Item(6497)
 	}
+	if {target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 } and ComboPoints() <5 if CheckBoxOn(expose_armor_check) Spell(expose_armor)
 	Spell(ambush usable=1)
 	if BuffRemains(slice_and_dice) <2 Spell(slice_and_dice)
 	if target.TicksRemain(rupture) <2 and Energy() >90 Spell(dispatch usable=1)
@@ -109,6 +116,7 @@ AddIcon mastery=2 help=main
 	{
 		if WeaponEnchantExpires(mainhand 300) Item(6497)
 	}
+	if {target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 } and ComboPoints() <5 if CheckBoxOn(expose_armor_check) Spell(expose_armor)
 	Spell(ambush usable=1)
 	if BuffRemains(slice_and_dice) <2 or {BuffRemains(slice_and_dice) <15 and BuffStacks(bandits_guile) ==11 and ComboPoints() >=4 } Spell(slice_and_dice)
 	if target.TicksRemain(rupture) <2 and ComboPoints() ==5 and BuffPresent(deep_insight) and target.DeadIn() >10 Spell(rupture)
@@ -143,6 +151,7 @@ AddIcon mastery=3 help=main
 		if WeaponEnchantExpires(mainhand 300) Item(6497)
 		Spell(slice_and_dice)
 	}
+	if {target.DebuffStacks(weakened_armor any=1) <3 or target.DebuffRemains(weakened_armor any=1) <3 } and ComboPoints() <5 if CheckBoxOn(expose_armor_check) Spell(expose_armor)
 	if ComboPoints() <=5 and BuffStacks(anticipation) ==0 Spell(ambush usable=1)
 	if BuffRemains(slice_and_dice) <3 and ComboPoints() ==5 Spell(slice_and_dice)
 	if ComboPoints() ==5 and target.DebuffRemains(rupture) <5 Spell(rupture)