Refactored AI switching code, added "UsePokemonInOrder" skill flag

This commit is contained in:
Maruno17
2023-02-14 16:40:52 +00:00
parent a8e024eb3e
commit 81d069eef1
16 changed files with 353 additions and 235 deletions

View File

@@ -381,7 +381,7 @@ Battle::AbilityEffects::OnHPDroppedBelowHalf.add(:EMERGENCYEXIT,
end
# In trainer battles
next false if battle.pbAllFainted?(battler.idxOpposingSide)
next false if !battle.pbCanSwitch?(battler.index) # Battler can't switch out
next false if !battle.pbCanSwitchOut?(battler.index) # Battler can't switch out
next false if !battle.pbCanChooseNonActive?(battler.index) # No Pokémon can switch in
battle.pbShowAbilitySplash(battler, true)
battle.pbHideAbilitySplash(battler)

View File

@@ -451,7 +451,7 @@ Battle::ItemEffects::OnStatLoss.add(:EJECTPACK,
battler.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") # Sky Drop
next false if battle.pbAllFainted?(battler.idxOpposingSide)
next false if battler.wild? # Wild Pokémon can't eject
next false if !battle.pbCanSwitch?(battler.index) # Battler can't switch out
next false if !battle.pbCanSwitchOut?(battler.index) # Battler can't switch out
next false if !battle.pbCanChooseNonActive?(battler.index) # No Pokémon can switch in
battle.pbCommonAnimation("UseItem", battler)
battle.pbDisplay(_INTL("{1} is switched out by the {2}!", battler.pbThis, battler.itemName))