mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user