Quantcast

new demonology warlock script

Sidoine De Wispelaere [11-12-11 - 20:56]
new demonology warlock script
added spellPower, lastSpellPower, attackPower, and lastAttackPower functions

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@427 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
defaut/Demoniste.lua
diff --git a/Condition.lua b/Condition.lua
index 8411bf1..c1929ee 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -343,6 +343,9 @@ Ovale.conditions=
 		end
 		return compare(nombre, condition[2], condition[3])
 	end,
+	attackPower = function(condition)
+		return UnitAttackPower("player"), 0, 0
+	end,
 	BuffDuration = function(condition)
 		--local name, rank, icon, count, debuffType, duration = UnitBuff("player", Ovale:GetSpellInfoOrNil(condition[1]))
 		--if not name then
@@ -376,11 +379,12 @@ Ovale.conditions=
 	-- 2 : time since the buff gain
 	BuffGain = function(condition)
 		local spellId = condition[1]
+		local target = getTarget(condition.target)
 		if spellId then
-			if not Ovale.buff[spellId] then
+			if not Ovale.buff[target][spellId] then
 				return 0
 			end
-			local timeGain = Ovale.buff[spellId].gain
+			local timeGain = Ovale.buff[target][spellId].gain
 			if not timeGain then
 				timeGain = 0
 			end
@@ -686,6 +690,12 @@ Ovale.conditions=
 		end
 		return compare(Ovale.spellDamage[spellId], condition[2], condition[3])
 	end,
+	lastSpellAttackPower = function(condition)
+		return Ovale.lastSpellAP[condition[1]], 0, 0
+	end,
+	lastSpellSpellPower = function(condition)
+		return Ovale.lastSpellSP[condition[1]], 0, 0
+	end,
 	LastSwing = function(condition)
 		local ret = OvaleSwing:GetLast(condition[1])
 		if condition[2] and ret then
@@ -844,6 +854,10 @@ Ovale.conditions=
 		end
 		return nil
 	end,
+	Present = function(condition)
+		local present = UnitExists(getTarget(condition.target)) and not UnitIsDead(getTarget(condition.target))
+		return testbool(present, condition[1])
+	end,
 	-- Test if any player pet is present (or not)
 	-- 1 : "yes" or "no"
 	PetPresent = function(condition)
@@ -946,6 +960,9 @@ Ovale.conditions=
 		local actionCooldownStart, actionCooldownDuration, actionEnable = Ovale:GetComputedSpellCD(condition[1])
 		return actionCooldownDuration, actionCooldownStart, -1
 	end,
+	spellPower = function(condition)
+		return GetSpellBonusDamage("player", 0, 0)
+	end,
 	-- Test if the player is in a given stance
 	-- 1 : the stance
 	Stance = function(condition)
diff --git a/Ovale.lua b/Ovale.lua
index 42bcd87..7e66779 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -71,6 +71,9 @@ Ovale.counter = {}
 Ovale.lastSpell = {}
 --the damage of the last spell or dot (by id)
 Ovale.spellDamage = {}
+--the attack power of the last spell
+Ovale.lastSpellAP = {}
+Ovale.lastSpellSP = {}
 Ovale.numberOfEnemies = nil
 Ovale.enemies = {}
 Ovale.refreshNeeded = false
@@ -936,7 +939,7 @@ end
 --At this time it is not used to keep the aura list (may be used in the future for optimization)
 --It is only used to update haste
 function Ovale:UNIT_AURA(event, unit)
-	if (unit == "player") then
+	if unit == "player" or unit == "pet" then
 		local hateBase = GetCombatRatingBonus(18)
 		local hateCommune=0;
 		local hateSorts = 0;
@@ -945,45 +948,55 @@ function Ovale:UNIT_AURA(event, unit)
 		local hateClasse = 0
 		local i=1;

-		while (true) do
-			local name, rank, iconTexture, count, debuffType, duration, expirationTime, source, stealable, consolidate, spellId =  UnitBuff("player", i);
+		if not self.buff[unit] then
+			self.buff[unit] = {}
+		end
+
+		local buff = self.buff[unit]
+
+		while true do
+			local name, rank, iconTexture, count, debuffType, duration, expirationTime, source, stealable, consolidate, spellId =  UnitBuff(unit, i);
 			if (not name) then
 				break
 			end
-			if (not self.buff[spellId]) then
-				self.buff[spellId] = {}
+			if (not buff[spellId]) then
+				buff[spellId] = {}
 			end
-			self.buff[spellId].icon = iconTexture
-			self.buff[spellId].count = count
-			self.buff[spellId].duration = duration
-			self.buff[spellId].expirationTime = expirationTime
-			self.buff[spellId].source = source
-			if (not self.buff[spellId].present) then
-				self.buff[spellId].gain = Ovale.maintenant
+			buff[spellId].icon = iconTexture
+			buff[spellId].count = count
+			buff[spellId].duration = duration
+			buff[spellId].expirationTime = expirationTime
+			buff[spellId].source = source
+			if (not buff[spellId].present) then
+				buff[spellId].gain = Ovale.maintenant
 			end
-			self.buff[spellId].lastSeen = Ovale.maintenant
-			self.buff[spellId].present = true
+			buff[spellId].lastSeen = Ovale.maintenant
+			buff[spellId].present = true

-			if self.buffSpellList.spellhaste[spellId] then --moonkin aura / wrath of air
-				hateSorts = 5 --add shadow form?
-			elseif self.buffSpellList.meleehaste[spellId] then
-				hateCaC = 10
-			elseif self.buffSpellList.heroism[spellId] then
-				hateHero = 30
-			elseif spellId == 53657 then --judgements of the pure
-				hateClasse = 9
+			if unit == "player" then
+				if self.buffSpellList.spellhaste[spellId] then --moonkin aura / wrath of air
+					hateSorts = 5 --add shadow form?
+				elseif self.buffSpellList.meleehaste[spellId] then
+					hateCaC = 10
+				elseif self.buffSpellList.heroism[spellId] then
+					hateHero = 30
+				elseif spellId == 53657 then --judgements of the pure
+					hateClasse = 9
+				end
 			end
 			i = i + 1;
 		end

-		for k,v in pairs(self.buff) do
+		for k,v in pairs(buff) do
 			if (v.lastSeen ~= Ovale.maintenant) then
 				v.present = false
 			end
 		end

-		self.spellHaste = 1 + (hateBase + hateCommune + hateSorts + hateHero + hateClasse)/100
-		self.meleeHaste = 1 + (hateBase + hateCommune + hateCaC + hateHero + hateClasse)/100
+		if unit == "player" then
+			self.spellHaste = 1 + (hateBase + hateCommune + hateSorts + hateHero + hateClasse)/100
+			self.meleeHaste = 1 + (hateBase + hateCommune + hateCaC + hateHero + hateClasse)/100
+		end

 		self.refreshNeeded = true
 --		self.rangedHaste = hateBase + hateCommune + hateHero + hateClasse -- TODO ajouter le bidule du chasseur en spé bête
@@ -1079,6 +1092,8 @@ function Ovale:AddSpellToList(spellId, lineId, startTime, endTime, channeled, al
 	newSpell.channeled = channeled
 	newSpell.allowRemove = allowRemove

+	self.lastSpellAP[spellId] = UnitAttackPower("player")
+	self.lastSpellSP[spellId] = GetSpellBonusDamage(2)
 	self.lastSpell[#self.lastSpell+1] = newSpell
 	--self:Print("on ajoute "..spellId..": ".. newSpell.start.." to "..newSpell.stop.." ("..self.maintenant..")" ..#self.lastSpell)

diff --git a/defaut/Demoniste.lua b/defaut/Demoniste.lua
index 2d03b98..de89c01 100644
--- a/defaut/Demoniste.lua
+++ b/defaut/Demoniste.lua
@@ -90,6 +90,8 @@ Define(UNSTABLEAFFLICTION 30108)
 	SpellInfo(UNSTABLEAFFLICTION duration=15)
 	SpellAddTargetDebuff(UNSTABLEAFFLICTION UNSTABLEAFFLICTION=15)

+#Pet spells
+Define(FELSTORM 89751)

 #Buff
 Define(DECIMATION 63167)
@@ -98,6 +100,7 @@ Define(EMPOWEREDIMP 47283)
 Define(IMPROVEDSOULFIREBUFF 85383)
 Define(SHADOWTRANCE 17941)
 Define(SHADOWANDFLAMEDEBUFF 17800)
+Define(DEMONSOULFELGUARD 79462)

 #Talent
 Define(IMPROVEDSOULFIRE 11197)
@@ -108,6 +111,7 @@ Define(EMBERSTORMTALENT 11181)
 #Glyph
 Define(GLYPHOFLASHOFPAIN 70947)
 Define(GLYPHOFIMP 56248)
+Define(GLYPHOFCORRUPTION 56218)

 AddListItem(curse elements SpellName(CURSEELEMENTS))
 AddListItem(curse tongues SpellName(CURSETONGUES))
@@ -117,6 +121,7 @@ AddListItem(bane agony SpellName(BANEOFAGONY))
 AddListItem(bane doom SpellName(BANEOFDOOM) default)
 AddListItem(bane havoc SpellName(BANEOFHAVOC) mastery=3)
 AddCheckBox(shadowflame SpellName(SHADOWFLAME) default)
+AddCheckBox(petswap SpellName(SUMMONFELGUARD))

 ScoreSpells(CURSEELEMENTS SHADOWBOLT HAUNT UNSTABLEAFFLICTION IMMOLATE CONFLAGRATE CURSEWEAKNESS
 	BANEOFAGONY CORRUPTION SOULFIRE DRAINSOUL INCINERATE SHADOWBOLT CHAOSBOLT)
@@ -201,49 +206,57 @@ AddIcon help=main mastery=2
 	if List(curse elements) and TargetDebuffExpires(magicaldamagetaken 2) and TargetDeadIn(more 8) Spell(CURSEELEMENTS)
 	if List(curse weakness) and TargetDebuffExpires(CURSEWEAKNESS 2) and TargetDeadIn(more 8) Spell(CURSEWEAKNESS)

-	#unless Glyph(GLYPHOFLASHOFPAIN) or Glyph(GLYPHOFIMP) Spell(DEMONSOUL)
-	#/immolation,if=buff.metamorphosis.remains>10
-	if BuffPresent(METAMORPHOSIS 10) and TargetInRange(DEATHCOIL) Spell(IMMOLATIONAURA)
-	#/bane_of_doom,if=!ticking&target.time_to_die>=15&miss_react
-	if TargetDebuffExpires(BANEOFDOOM 0 mine=1) and TargetDebuffExpires(BANEOFAGONY 0 mine=1)
+
+	#/immolate,if=!ticking&target.time_to_die>=4&miss_react
+	if TargetDebuffExpires(IMMOLATE 2 mine=1 haste=spell) and TargetDeadIn(more 4) Spell(IMMOLATE)
+
+	#/bane_of_doom,if=(!ticking|(buff.metamorphosis.up&remains<45))&target.time_to_die>=15&miss_react
+	if {TargetDebuffExpires(BANEOFDOOM 0 mine=1) or {BuffPresent(METAMORPHOSIS) and TargetDebuffExpires(BANEOFDOOM 45 mine=1)}} and TargetDebuffExpires(BANEOFAGONY 0 mine=1)
 	{
 		if List(bane doom) and TargetDeadIn(more 15) Spell(BANEOFDOOM)
 		if TargetDeadIn(more 10) Spell(BANEOFAGONY)
 	}
-	#/immolate,if=!ticking&target.time_to_die>=4&miss_react
-	if TargetDebuffExpires(IMMOLATE 2 mine=1 haste=spell) and TargetDeadIn(more 4) Spell(IMMOLATE)
 	#/corruption,if=(remains<tick_time|!ticking)&target.time_to_die>=6&miss_react
 	if TargetDebuffExpires(CORRUPTION 2 mine=1 haste=spell) and TargetDebuffExpires(SEEDOFCORRUPTION 0 mine=1) and TargetDeadIn(more 6) Spell(CORRUPTION)
 	#/fel_flame,if=buff.tier11_4pc_caster.react
 	if ArmorSetParts(T11 more 3) Spell(FELFLAME)
 	#/shadowflame
 	if CheckBoxOn(shadowflame) and TargetInRange(DEATHCOIL) Spell(SHADOWFLAME)
-	#/demon_soul
-	#if Glyph(GLYPHOFIMP) Spell(DEMONSOUL)
 	#/hand_of_guldan
 	if TargetDebuffPresent(IMMOLATE) Spell(HANDOFGULDAN)
+	#/immolation,if=buff.metamorphosis.remains>10
+	if BuffPresent(METAMORPHOSIS 10) and TargetInRange(DEATHCOIL) Spell(IMMOLATIONAURA)
+	#if ( glyphs.corruption -> ok() ) action_list_str += "/shadow_bolt,if=buff.shadow_trance.react";
+	if Glyph(GLYPHOFCORRUPTION) and BuffPresent(SHADOWTRANCE) Spell(SHADOWBOLT)
 	#/incinerate,if=buff.molten_core.react
 	if BuffPresent(MOLTENCORE) Spell(INCINERATE)
-	if TalentPoints(IMPROVEDSOULFIRE more 0)
-	{
-		#/soul_fire,if=buff.improved_soul_fire.cooldown_remains<(cast_time+travel_time)&buff.bloodlust.down&!in_flight&miss_react
-		if BuffExpires(IMPROVEDSOULFIREBUFF 4) and BuffExpires(heroism) Spell(SOULFIRE)
-	}
-	if TalentPoints(IMPROVEDSOULFIRE less 1)
-	{
-		#/soul_fire,if=buff.decimation.react|buff.soulburn.up
-		if BuffPresent(DECIMATION) or BuffPresent(SOULBURN) Spell(SOULFIRE)
-	}
-	#/life_tap,if=mana_pct<=50&buff.bloodlust.down&buff.metamorphosis.down
-	if ManaPercent(less 50) and BuffExpires(heroism) and BuffExpires(METAMORPHOSIS) and LifePercent(more 75) Spell(LIFETAP)
+	#/soul_fire,if=buff.decimation.up
+	if BuffPresent(DECIMATION) Spell(SOULFIRE)
+	#/life_tap,if=mana_pct<=30&buff.bloodlust.down&buff.metamorphosis.down&buff.demon_soul_felguard.down
+	if ManaPercent(less 30) and BuffExpires(heroism) and BuffExpires(METAMORPHOSIS) and BuffExpires(DEMONSOULFELGUARD) and LifePercent(more 75) Spell(LIFETAP)
+	if TalentPoints(BANETALENT more 0) Spell(INCINERATE)
 	Spell(SHADOWBOLT)
 }

 AddIcon help=cd mastery=2
 {
-	Spell(METAMORPHOSIS)
-	Spell(DEMONSOUL)
-	if BuffPresent(METAMORPHOSIS) Spell(SUMMONDOOMGUARD)
+	#/summon_felguard,if=cooldown.demon_soul.remains<5&cooldown.metamorphosis.remains<5&!pet.felguard.active
+	if {spell(DEMONSOUL)<5} and {spell(METAMORPHOSIS)<5} unless pet.CreatureFamily(Felguard) Spell(SUMMONFELGUARD)
+	#/metamorphosis,if=pet.felguard.active
+	if pet.Present() and pet.CreatureFamily(Felguard) Spell(METAMORPHOSIS)
+	#/demon_soul,if=buff.metamorphosis.up
+	if BuffPresent(METAMORPHOSIS) Spell(DEMONSOUL)
+	#/summon_doomguard,if=time>10
+	if TimeInCombat(more 10) Spell(SUMMONDOOMGUARD)
+	#/felguard:felstorm
+	if pet.Present() and pet.CreatureFamily(Felguard) Spell(FELSTORM)
+	if CheckBoxOn(petswap)
+	{
+		#/soulburn,if=pet.felguard.active&!pet.felguard.dot.felstorm.ticking
+		if pet.CreatureFamily(Felguard) and pet.BuffExpires(FELSTORM) Spell(SOULBURN)
+		#/summon_felhunter,if=!pet.felguard.dot.felstorm.ticking&pet.felguard.active
+		if pet.BuffExpires(FELSTORM) and pet.CreatureFamily(Felguard) Spell(SUMMONFELHUNTER)
+	}
 	Item(Trinket0Slot usable=1)
 	Item(Trinket1Slot usable=1)
 }