- 68
- Posts
- 5
- Years
- Seen Nov 9, 2023
I have no idea why, but for some reason, abilities that depend on the target's HP, like Moxie, Beast Boost, and Wimp Out, won't work in my game. Does anyone know why this could possibly be the case?
# Moxie
if user.hasWorkingAbility(:MOXIE) && target.fainted? #user.hp>0 && target.hp<=0
if user.pbIncreaseStatWithCause(PBStats::ATTACK,1,user,PBAbilities.getName(user.ability))
PBDebug.log("[Ability triggered] #{user.pbThis}'s Moxie")
end
end
# Battle Bond
if isConst?(user.species,PBSpecies,:GRENINJA) && user.hasWorkingAbility(:BATTLEBOND)
if target.fainted? && user.form!=1
user.form=1
pbUpdate(true)
@battle.scene.pbChangePokemon(user,user.pokemon)
@battle.pbDisplay(_INTL("{1} made a bond with his trainer!",user.pbThis))
PBDebug.log("[Ability triggered] #{user.pbThis}'s Battle Bond")
PBDebug.log("[Form changed] #{user.pbThis} changed to form #{self.form}")
end
end
# Beast Boost
if user.hasWorkingAbility(:BEASTBOOST) && user.hp>0 && target.hp<=0
if user.attack >= user.defense &&
user.attack >= user.spatk &&
user.attack >= user.spdef &&
user.attack >= user.speed
if user.pbIncreaseStatWithCause(PBStats::ATTACK,1,user,PBAbilities.getName(user.ability))
PBDebug.log("[Ability triggered] #{user.pbThis}'s Beast Boost (raising Attack)")
end
elsif user.defense >= user.spatk &&
user.defense >= user.spdef &&
user.defense >= user.speed &&
user.defense >= user.attack
if user.pbIncreaseStatWithCause(PBStats::DEFENSE,1,user,PBAbilities.getName(user.ability))
PBDebug.log("[Ability triggered] #{user.pbThis}'s Beast Boost (raising Defense)")
end
elsif user.spatk >= user.spdef &&
user.spatk >= user.speed &&
user.spatk >= user.attack &&
user.spatk >= user.defense
if user.pbIncreaseStatWithCause(PBStats::SPATK,1,user,PBAbilities.getName(user.ability))
PBDebug.log("[Ability triggered] #{user.pbThis}'s Beast Boost (raising Special Attack)")
end
elsif user.spdef >= user.speed &&
user.spdef >= user.spatk &&
user.spdef >= user.attack &&
user.spdef >= user.defense
if user.pbIncreaseStatWithCause(PBStats::SPDEF,1,user,PBAbilities.getName(user.ability))
PBDebug.log("[Ability triggered] #{user.pbThis}'s Beast Boost (raising Special Defense)")
end
elsif user.speed >= user.spdef &&
user.speed >= user.spatk &&
user.speed >= user.attack &&
user.speed >= user.defense
if user.pbIncreaseStatWithCause(PBStats::SPEED,1,user,PBAbilities.getName(user.ability))
PBDebug.log("[Ability triggered] #{user.pbThis}'s Beast Boost (raising Speed)")
end
end
end
# Power of Alchemy, Receiver
if (user.hasWorkingAbility(:POWEROFALCHEMY) ||
user.hasWorkingAbility(:RECEIVER)) && @battle.doublebattle &&
user.pbPartner.fainted?
usable=false
abil=user.pbPartner.ability
if abil>0 &&
!isConst?(abil,PBAbilities,:POWEROFALCHEMY) &&
!isConst?(abil,PBAbilities,:TRACE) &&
!isConst?(abil,PBAbilities,:MULTITYPE) &&
!isConst?(abil,PBAbilities,:ILLUSION) &&
!isConst?(abil,PBAbilities,:FLOWERGIFT) &&
!isConst?(abil,PBAbilities,:IMPOSTER) &&
!isConst?(abil,PBAbilities,:STANCECHANGE) &&
!isConst?(abil,PBAbilities,:COMATOSE) &&
!isConst?(abil,PBAbilities,:BATTLEBOND) &&
!isConst?(abil,PBAbilities,:POWERCONSTRUCT) &&
!isConst?(abil,PBAbilities,:RECEIVER) &&
!isConst?(abil,PBAbilities,:FORECAST) &&
!isConst?(abil,PBAbilities,:WONDERGUARD) &&
!isConst?(abil,PBAbilities,:DISGUISE) &&
!isConst?(abil,PBAbilities,:ZENMODE) &&
!isConst?(abil,PBAbilities,:SCHOOLING) &&
!isConst?(abil,PBAbilities,:SHIELDSDOWN) &&
!isConst?(abil,PBAbilities,:RKSSYSTEM)
usable=true
end
if usable
abilityname=PBAbilities.getName(abil)
PBDebug.log("[Ability triggered] #{user.pbThis}'s #{PBAbilities.getName(user.ability)} turned into #{abilityname} from #{user.pbPartner}")
user.ability=abil
@battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",user.pbThis,user.pbPartner,abilityname))
end
end
# Wimp Out/ Emergency Exit
if (target.hasWorkingAbility(:WIMPOUT) || target.hasWorkingAbility(:EMERGENCYEXIT)) &&
!target.effects[PBEffects::SkyDrop] && thismove.function!=0x0EC # Circle Throw, Dragon Tail
if target.hp+turneffects[PBEffects::TotalDamage]>(target.totalhp/2).floor &&
target.hp<=(target.totalhp/2).floor
PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
if [email protected]
pbSEPlay("Battle flee"); @battle.pbDisplay(_INTL("{1} fled!",target.pbThis))
for i in 0...4
@battle.choices[@battle.battlers[i].index][0]=-1
end
@battle.decision=3
PBDebug.log("[Escape] #{target.pbThis} fled")
else
if @battle.pbCanSwitch?(target.index,-1,false) && [email protected]?(@battle.pbParty(target.index))
newpoke=0
[email protected](target.index,true,false)
newpokename=newpoke
if isConst?(@battle.pbParty(target.index)[newpoke].ability,PBAbilities,:ILLUSION)
newpokename=pbGetLastPokeInTeam(target.index)
end
target.pbResetForm
@battle.pbRecallAndReplace(target.index,newpoke,newpokename)
@battle.choices[target.index]=[0,0,nil,-1] # Replacement Pokémon does nothing this round
target.pbAbilitiesOnSwitchIn(true)
end
end
end
end
end
I don't see anything wrong with these codes, so there must be a problem in methods checking the HP of Pokemon. Does this also affect items like with Sitrus Berry or is it only affecting abilities.
That's odd. Assuming Moxie, Beast Boost, etc. are in the pbEffectsAfterHit method and Wimp Out/Emergency Exit are in the pbProcessMoveAgainstTarget method, I'm not sure what would cause this. Though I'm not an expert on these scripts, so someone else might see something that I don't.