Quantcast

- added default for death knight

Sidoine De Wispelaere [04-19-09 - 16:39]
- added default for death knight
- bug fix for TargetDebuffPresent

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@35 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
defaut/Chevalier.lua
diff --git a/Condition.lua b/Condition.lua
index ddf6a6f..28443df 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -1,5 +1,13 @@
 local LBCT = LibStub("LibBabble-CreatureType-3.0"):GetLookupTable()

+local runeType =
+{
+	blood = 1,
+	unholy = 2,
+	frost = 3,
+	death = 4
+}
+
 local function avecHate(temps, hate)
 	if (not hate) then
 		return temps
@@ -211,6 +219,40 @@ Ovale.conditions=
 		local present = UnitExists("pet") and not UnitIsDead("pet")
 		return testbool(present, condition[1])
 	end,
+	Runes = function(condition)
+		local type = runeType[condition[1]]
+		local nombre = 0
+		local nombreCD = 0
+		local maxCD = nil
+		local minCD = nil
+		for i=1,6 do
+			if (GetRuneType(i) == type or GetRuneType(i) == 4) then
+				local start, duration, runeReady = GetRuneCooldown(i)
+				if (runeReady) then
+					nombre = nombre + 1
+				else
+					nombreCD = nombreCD + 1
+					if (maxCD == nil or start<maxCD) then
+						maxCD = start
+					end
+					if (minCD == nil or start>minCD) then
+						minCD = start
+					end
+				end
+			end
+		end
+		local wanted = condition[2]
+		if (nombre >= wanted) then
+			return 0
+		elseif (nombre + nombreCD < wanted) then
+			return nil
+		elseif (wanted == nombre + 1) then
+			return Ovale.maintenant - minCD
+		else
+			-- Il ne peut y avoir que deux runes sur CD de toute façon
+			return Ovale.maintenant - maxCD
+		end
+	end,
 	-- Test if the player is in a given stance
 	-- 1 : the stance
 	Stance = function(condition)
@@ -314,7 +356,7 @@ Ovale.conditions=
 			end
 			i = i + 1;
 		end
-		return 0
+		return nil
 	end,
 	-- Test if the target life is bellow/above a given value in percent
 	-- 1 : "less" or "more"
diff --git a/defaut/Chevalier.lua b/defaut/Chevalier.lua
index e69de29..1322163 100644
--- a/defaut/Chevalier.lua
+++ b/defaut/Chevalier.lua
@@ -0,0 +1,95 @@
+Ovale.defaut["DEATHKNIGHT"] = [[
+Define(FROSTPRESENCE 48263)
+Define(RUNESTRIKE 56815)
+Define(BONESHIELD 49222)
+Define(ICEBOUNDFORTITUDE 48792)
+Define(UNBREAKABLEARMOR 51271)
+Define(DEATHANDECAY 43265)
+Define(HOWLINGBLAST 49184)
+Define(OBLITERATE 49020)
+Define(BLOODSTRIKE 45902)
+Define(BLOODBOIL 48721)
+Define(BLOODPLAGUE 59879)
+Define(FROSTFEVER 59921)
+Define(PESTILENCE 50842)
+Define(ICYTOUCH 45477)
+Define(PLAGUESTRIKE 45462)
+Define(HEARTSTRIKE 55050)
+Define(DEATHSTRIKE 49998)
+Define(TALENTDEATSTRIKE 2259)
+Define(TALENTFROSTSTRIKE 1975)
+Define(TALENTHEARTSTRIKE 1957)
+Define(TALENTBLOODYSTRIKES 2015)
+Define(SCOURGESTRIKE 55090)
+Define(DEATHCOIL 52375)
+Define(ARMYOFTHEDEAD 42650)
+Define(DANCINGRUNEWEAPON 49028)
+Define(FROSTSTRIKE 49143)
+Define(SUMMONGARGOYLE 49206)
+
+AddIcon
+{
+	if Runes(unholy 1) and Runes(frost 1) Spell(HOWLINGBLAST)
+	if TargetDebuffPresent(FROSTFEVER mine=1) and TargetDebuffPresent(BLOODPLAGUE mine=1)
+	{
+		if TalentPoints(TALENTBLOODYSTRIKES more 0)
+		{
+			if Runes(blood 1)
+			{
+				Spell(HEARTSTRIKE)
+				Spell(BLOODSTRIKE)
+			}
+		}
+		if Runes(unholy 1) and Runes(frost 1)
+		{
+			if TalentPoints(TALENTDEATSTRIKE more 0) Spell(DEATHSTRIKE)
+			Spell(SCOURGESTRIKE)
+			Spell(OBLITERATE)
+		}
+		if Runes(blood 1)
+		{
+			Spell(HEARTSTRIKE)
+			Spell(BLOODSTRIKE)
+		}
+	}
+	if TargetDebuffExpires(FROSTFEVER 0 mine=1) and Runes(frost 1)
+		Spell(ICYTOUCH)
+	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and Runes(unholy 1)
+		Spell(PLAGUESTRIKE)
+	Spell(FROSTSTRIKE usable=1)
+	Spell(DEATHCOIL usable=1)
+}
+
+AddIcon
+{
+	if TargetDebuffPresent(BLOODPLAGUE) or TargetDebuffPresent(FROSTFEVER)
+		Spell(PESTILENCE usable=1)
+	Spell(DEATHANDECAY usable=1)
+	Spell(BLOODBOIL usable=1)
+}
+
+AddIcon size=small
+{
+	if BuffPresent(FROSTPRESENCE)
+	{
+		Spell(RUNESTRIKE usable=1)
+	}
+}
+
+AddIcon size=small
+{
+	if BuffPresent(FROSTPRESENCE)
+	{
+		Spell(BONESHIELD)
+		Spell(UNBREAKABLEARMOR)
+		Spell(ICEBOUNDFORTITUDE)
+	}
+	unless BuffPresent(FROSTPRESENCE)
+	{
+		Spell(SUMMONGARGOYLE)
+		Spell(DANCINGRUNEWEAPON)
+	}
+	Spell(ARMYOFTHEDEAD)
+}
+
+]]
\ No newline at end of file