Add WildMushroomIsCharged() to test if healing mushroom is charged.
Johnny C. Lam [05-05-14 - 18:03]
Add WildMushroomIsCharged() to test if healing mushroom is charged.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1379 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/conditions/WildMushroomIsCharged.lua b/conditions/WildMushroomIsCharged.lua
new file mode 100644
index 0000000..d6cf092
--- /dev/null
+++ b/conditions/WildMushroomIsCharged.lua
@@ -0,0 +1,39 @@
+--[[--------------------------------------------------------------------
+ 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 API_IsSpellOverlayed = IsSpellOverlayed
+ local ParseCondition = OvaleCondition.ParseCondition
+ local TestBoolean = OvaleCondition.TestBoolean
+
+ local WILD_MUSHROOM_BLOOM = 102791
+
+ --- Test if the player's Wild Mushroom is fully charged for maximum healing.
+ -- @name WildMushroomIsCharged
+ -- @paramsig boolean
+ -- @param yesno Optional. If yes, then return true if the player's Wild Mushroom is fully charged. If no, then return true if it isn't fully charged.
+ -- Default is yes.
+ -- Valid values: yes, no.
+ -- @return A boolean value.
+ -- @usage
+ -- if WildMushroomIsCharged() Spell(wild_mushroom_bloom)
+
+ local function WildMushroomIsCharged(condition)
+ local yesno = condition[1]
+ local target = ParseCondition(condition)
+ local boolean = API_IsSpellOverlayed(WILD_MUSHROOM_BLOOM)
+ return TestBoolean(boolean, yesno)
+ end
+
+ OvaleCondition:RegisterCondition("wildmushroomischarged", false, WildMushroomIsCharged)
+end
diff --git a/conditions/files.xml b/conditions/files.xml
index 4f2b019..b6aadcb 100644
--- a/conditions/files.xml
+++ b/conditions/files.xml
@@ -109,4 +109,5 @@
<Script file="WeaponDamage.lua" />
<Script file="WeaponEnchantExpires.lua" />
<Script file="WildMushroomCount.lua" />
+ <Script file="WildMushroomIsCharged.lua" />
</Ui>