I managed to get my ability Lucky Heal to work, but the way it functions is that it should only heal the user ONCE per battle if its HP is in red, but every time I test it out, it heals it multiple times! :(
Here's the code:
# Lucky Heal
if i.hasWorkingAbility(:LUCKYHEAL) && i.hp<=(i.totalhp/3).floor
if i.effects[PBEffects::LuckyHeal]==0 && i.effects[PBEffects::HealBlock]==0
PBDebug.log("[Ability triggered] #{i.pbThis}'s Lucky Heal")
hpgain=i.pbRecoverHP((i.totalhp/8).floor,true)
pbDisplay(_INTL("{1}'s {2} healed itself!",i.pbThis,PBAbilities.getName(i.ability))) if hpgain>0
elsif i.effects[PBEffects::LuckyHeal]==1
end
end
Please, what am I doing wrong?!
Here's the code:
# Lucky Heal
if i.hasWorkingAbility(:LUCKYHEAL) && i.hp<=(i.totalhp/3).floor
if i.effects[PBEffects::LuckyHeal]==0 && i.effects[PBEffects::HealBlock]==0
PBDebug.log("[Ability triggered] #{i.pbThis}'s Lucky Heal")
hpgain=i.pbRecoverHP((i.totalhp/8).floor,true)
pbDisplay(_INTL("{1}'s {2} healed itself!",i.pbThis,PBAbilities.getName(i.ability))) if hpgain>0
elsif i.effects[PBEffects::LuckyHeal]==1
end
end
Please, what am I doing wrong?!