diff --git a/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb b/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb index 740bcef1e..ffee02b2f 100644 --- a/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb +++ b/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb @@ -3,7 +3,9 @@ class Battle::AI # Decide whether the opponent should use an item on the Pokémon #============================================================================= def pbEnemyShouldUseItem? - item, idxTarget = pbEnemyItemToUse + item = nil + idxTarget = nil + PBDebug.logonerr { item, idxTarget = pbEnemyItemToUse } return false if !item # Determine target of item (always the Pokémon choosing the action) useType = GameData::Item.get(item).battle_use diff --git a/Data/Scripts/011_Battle/005_AI/003_AI_Switch.rb b/Data/Scripts/011_Battle/005_AI/003_AI_Switch.rb index 6c81ba459..92caaee9f 100644 --- a/Data/Scripts/011_Battle/005_AI/003_AI_Switch.rb +++ b/Data/Scripts/011_Battle/005_AI/003_AI_Switch.rb @@ -3,7 +3,9 @@ class Battle::AI # Decide whether the opponent should switch Pokémon #============================================================================= def pbEnemyShouldWithdraw? - return pbEnemyShouldWithdrawEx?(false) + ret = false + PBDebug.logonerr { ret = pbEnemyShouldWithdrawEx?(false) } + return ret end def pbEnemyShouldWithdrawEx?(forceSwitch) diff --git a/Data/Scripts/011_Battle/005_AI/004_AI_ChooseMove.rb b/Data/Scripts/011_Battle/005_AI/004_AI_ChooseMove.rb index f1bd2b13b..3ba761c26 100644 --- a/Data/Scripts/011_Battle/005_AI/004_AI_ChooseMove.rb +++ b/Data/Scripts/011_Battle/005_AI/004_AI_ChooseMove.rb @@ -54,7 +54,8 @@ class Battle::AI # If move has no targets, affects the user, a side or the whole field, or # specially affects multiple Pokémon and the AI calculates an overall # score at once instead of per target - score = pbGetMoveScore(move) + score = 100 + PBDebug.logonerr { score = pbGetMoveScore(move) } choices.push([idxMove, score, -1]) elsif target_data.num_targets > 1 # Includes: AllFoes, AllNearFoes, AllNearOthers @@ -65,7 +66,8 @@ class Battle::AI num_targets = 0 @battle.allBattlers.each do |b| next if !@battle.pbMoveCanTarget?(battler.index, b.index, target_data) - score = pbGetMoveScore(move, b) + score = 100 + PBDebug.logonerr { score = pbGetMoveScore(move, b) } total_score += ((battler.opposes?(b)) ? score : -score) num_targets += 1 end @@ -84,7 +86,8 @@ class Battle::AI # that the target can be immune to by an ability (you may want to # attack the ally anyway so it gains the effect of that ability). next if target_data.targets_foe && !battler.opposes?(b) - score = pbGetMoveScore(move, b) + score = 100 + PBDebug.logonerr { score = pbGetMoveScore(move, b) } choices.push([idxMove, score, b.index]) end end