- 79
- Posts
- 9
- Years
- Seen Jan 12, 2024
Hello, using the following script will successfully heal based on the opponent's attack, and then lower it 1 stage.
However, it doesn't appear to take stat changes into account, so using Strength Sap repeatedly doesn't decrease the amount of HP it heals. How do I go about fixing this?
Code:
class PokeBattle_Move_CF13 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
if attacker.effects[PBEffects::HealBlock]>0
bob="heal"
bob=_INTL("use {1}",name) if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
@battle.pbDisplay(_INTL("{1} can't {2} because of Heal Block!",attacker.pbThis,bob))
return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
elsif attacker.hp==attacker.totalhp
@battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
else
oatk=opponent.attack
attacker.pbRecoverHP(oatk,true)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
end
if opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
opponent.pbReduceStat(PBStats::ATTACK,1,true,true,false,attacker)
end
return 0
end
end
However, it doesn't appear to take stat changes into account, so using Strength Sap repeatedly doesn't decrease the amount of HP it heals. How do I go about fixing this?