Fixed Pokédex showing genders for the wrong species, fixed AI always switching sleeping/frozen Pokémon, fixed class PngAnimatedBitmap animating slowly

This commit is contained in:
Maruno17
2023-08-23 21:08:32 +01:00
parent ea7b5d56d2
commit efea53aa5a
5 changed files with 12 additions and 9 deletions

View File

@@ -408,8 +408,10 @@ Battle::AI::Handlers::ShouldSwitch.add(:asleep,
end
# Doesn't have sufficiently raised stats that would be lost by switching
next false if battler.stages.any? { |key, val| val >= 2 }
# 50% chance to not bother
next false if ai.pbAIRandom(100) < 50
# A reserve Pokémon is awake and not frozen
next false if reserves.none? { |pkmn| ![:SLEEP, :FROZEN].include?(pkmn.status) }
# 60% chance to not bother
next false if ai.pbAIRandom(100) < 60
PBDebug.log_ai("#{battler.name} wants to switch because it is asleep and can't do anything")
next true
}

View File

@@ -342,7 +342,8 @@ class Battle::AI
if @trainer.high_skill? && @user.can_switch_lax?
badMoves = false
if max_score <= MOVE_USELESS_SCORE
badMoves = true
badMoves = user_battler.can_attack?
badMoves = true if !badMoves && pbAIRandom(100) < 25
elsif max_score < MOVE_BASE_SCORE * move_score_threshold && user_battler.turnCount > 2
badMoves = true if pbAIRandom(100) < 80
end