Errors in the AI no longer cause it to do nothing

This commit is contained in:
Maruno17
2022-10-16 14:52:27 +01:00
parent 58a624060a
commit 43290c39a2
3 changed files with 12 additions and 5 deletions

View File

@@ -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