added Belch to consideration for some function codes and fixed a typo (#199)

* added Belch to consideration for some AI function codes and fixed a typo
This commit is contained in:
Conmh
2023-02-04 16:22:22 -05:00
committed by GitHub
parent 7678a13e94
commit 5086f692df
2 changed files with 7 additions and 1 deletions

View File

@@ -1092,7 +1092,7 @@ class Battle::AI
:KEEBERRY => :DEFENSE,
:MARANGABERRY => :SPECIAL_DEFENSE
}[item]
ret += 8 if stat && ai.stat_raise_worthwhile?(battler, stat)
ret += 8 if stat && stat_raise_worthwhile?(battler, stat)
ret = ret * 3 / 2 if GameData::Item.get(item).is_berry? && battler.has_active_ability?(:RIPEN)
when :STARFBERRY
# Random stat raise

View File

@@ -202,6 +202,8 @@ Battle::AI::Handlers::MoveEffectScore.add("UserConsumeBerryRaiseDefense2",
user.has_move_with_function?("RestoreUserConsumedItem")
# Prefer if user couldn't normally consume the berry
score += 4 if !user.battler.canConsumeBerry?
# Prefer if user will become able to use Belch
score += 4 if !user.battler.belched? && user.has_move_with_function?("FailsIfUserNotConsumedBerry")
end
next score
}
@@ -229,6 +231,10 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("AllBattlersConsumeBerry"
target.has_move_with_function?("RestoreUserConsumedItem")
# Prefer if target couldn't normally consume the berry
score_change += 4 if !target.battler.canConsumeBerry?
# Prefer if target will become able to use Belch
ai.each_same_side_battler(user.side) do |b, i|
score += 4 if !b.battler.belched? && b.has_move_with_function?("FailsIfUserNotConsumedBerry")
end
end
score += (target.opposes?(user)) ? -score_change : score_change
next score