From c7edc26a559ca05fa42b4297645d68c7acada9c0 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 6 Apr 2014 18:47:16 +0000 Subject: [PATCH] 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 --- conditions/ArmorSetBonus.lua | 34 ++++++++++++++++++++++++++++++++++ conditions/files.xml | 1 + 2 files changed, 35 insertions(+) create mode 100644 conditions/ArmorSetBonus.lua 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 @@