Add ArmorSetBonus() script condition with SimC set_bonus semantics.
Johnny C. Lam [04-06-14 - 18:47]
Add ArmorSetBonus() script condition with SimC set_bonus semantics.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1279 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/conditions/ArmorSetBonus.lua b/conditions/ArmorSetBonus.lua
new file mode 100644
index 0000000..eeb7f53
--- /dev/null
+++ b/conditions/ArmorSetBonus.lua
@@ -0,0 +1,34 @@
+--[[--------------------------------------------------------------------
+ Ovale Spell Priority
+ Copyright (C) 2014 Johnny C. Lam
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License in the LICENSE
+ file accompanying this program.
+--]]--------------------------------------------------------------------
+
+local _, Ovale = ...
+
+do
+ local OvaleCondition = Ovale.OvaleCondition
+ local OvaleEquipement = Ovale.OvaleEquipement
+
+ --- Check whether the player currently has an armor set bonus.
+ -- @name ArmorSetBonus
+ -- @paramsig number
+ -- @param name The name of the armor set.
+ -- Valid names: T11, T12, T13, T14, T15, T16
+ -- Valid names for hybrid classes: append _caster, _heal, _melee, _tank.
+ -- @param count The number of pieces needed to activate the armor set bonus.
+ -- @return 1 if the set bonus is active, or 0 otherwise.
+ -- @usage
+ -- if ArmorSetBonus(T16_melee 2) == 1 Spell(unleash_elements)
+
+ local function ArmorSetBonus(condition)
+ local armorSet, count = condition[1], condition[2]
+ local value = (OvaleEquipement:GetArmorSetCount(armorSet) >= count) and 1 or 0
+ return 0, math.huge, value, 0, 0
+ end
+
+ OvaleCondition:RegisterCondition("armorsetbonus", false, ArmorSetBonus)
+end
diff --git a/conditions/files.xml b/conditions/files.xml
index 5e0d8bb..d73e298 100644
--- a/conditions/files.xml
+++ b/conditions/files.xml
@@ -1,5 +1,6 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Script file="AfterWhiteHit.lua" />
+ <Script file="ArmorSetBonus.lua" />
<Script file="ArmorSetParts.lua" />
<Script file="BuffAmount.lua" />
<Script file="BuffComboPoints.lua" />