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

View File

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

View File

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