Fixed AI not properly registering switches, fixed typo in def pbMessageOnRecall, fixed Synchronize bypassing type immunities

This commit is contained in:
Maruno17
2020-10-09 20:54:01 +01:00
parent 94a20e55f3
commit 5c4c0f4e35
3 changed files with 7 additions and 7 deletions

View File

@@ -171,7 +171,7 @@ class PokeBattle_Battler
return true return true
end end
def pbCanSynchronizeStatus?(status,target) def pbCanSynchronizeStatus?(newStatus,target)
return false if fainted? return false if fainted?
# Trying to replace a status problem with another one # Trying to replace a status problem with another one
return false if self.status!=PBStatuses::NONE return false if self.status!=PBStatuses::NONE
@@ -179,7 +179,7 @@ class PokeBattle_Battler
return false if @battle.field.terrain==PBBattleTerrains::Misty && affectedByTerrain? return false if @battle.field.terrain==PBBattleTerrains::Misty && affectedByTerrain?
# Type immunities # Type immunities
hasImmuneType = false hasImmuneType = false
case self.status case newStatus
when PBStatuses::POISON when PBStatuses::POISON
# NOTE: target will have Synchronize, so it can't have Corrosion. # NOTE: target will have Synchronize, so it can't have Corrosion.
if !(target && target.hasActiveAbility?(:CORROSION)) if !(target && target.hasActiveAbility?(:CORROSION))
@@ -193,15 +193,15 @@ class PokeBattle_Battler
end end
return false if hasImmuneType return false if hasImmuneType
# Ability immunity # Ability immunity
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,status) if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,newStatus)
return false return false
end end
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,status) if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,newStatus)
return false return false
end end
eachAlly do |b| eachAlly do |b|
next if !b.abilityActive? next if !b.abilityActive?
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,status) next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
return false return false
end end
# Safeguard immunity # Safeguard immunity

View File

@@ -245,7 +245,7 @@ class PokeBattle_Battle
pbDisplayBrief(_INTL("{1}, switch out! Come back!",battler.name)) pbDisplayBrief(_INTL("{1}, switch out! Come back!",battler.name))
end end
else else
owner = pbGetOwnerName(b.index) owner = pbGetOwnerName(battler.index)
pbDisplayBrief(_INTL("{1} withdrew {2}!",owner,battler.name)) pbDisplayBrief(_INTL("{1} withdrew {2}!",owner,battler.name))
end end
end end

View File

@@ -135,7 +135,7 @@ class PokeBattle_AI
if @battle.pbRegisterSwitch(idxBattler,list[0]) if @battle.pbRegisterSwitch(idxBattler,list[0])
PBDebug.log("[AI] #{battler.pbThis} (#{idxBattler}) will switch with " + PBDebug.log("[AI] #{battler.pbThis} (#{idxBattler}) will switch with " +
"#{@battle.pbParty(idxBattler)[list[0]].name}") "#{@battle.pbParty(idxBattler)[list[0]].name}")
return return true
end end
end end
end end