- 288
- Posts
- 6
- Years
- Seen Feb 3, 2025
Strength Sap
Code:################################################################################ # Heals the user for an amount equal to the target's effective Attack stat # Lowers the target's Attack by 1 stage ################################################################################ class PokeBattle_Move_1B5 < 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
Hi, I was wondering if anyone has working code for Strength Sap, because I'm pretty sure this code is incorrect for the move. All versions of the move I have found make the same mistake this one does. On Bulbapedia, part of the description for the move is "Strength Sap lowers the target's Attack stat by one stage, then restores the user's HP by the same amount as the target's effective Attack stat before Strength Sap was used. The amount of HP restored depends on the Attack stat after applying stat stages." This means that if the target has increases/decreases in attack stat stages, an ability like Huge Power, etc. this will affect the amount healed. The code here (and where I could find it elsewhere) just takes the attack stat of the target instead of taking into consideration these important factors. Since the healing for this move is supposed to get weaker as you keep using it on the same Pokemon due to it decreasing the target's attack stage, this makes the move much more powerful than intended. (I verified that using the move multiple times against the same Pokemon, who successfully receives attack drops, heals the same exact amount each time).