Resolved all remaining TODO comments for AI (except testing), fixed effects of moves that can end the battle

This commit is contained in:
Maruno17
2023-05-13 22:49:09 +01:00
parent 7a8754c425
commit a4d74a9663
16 changed files with 866 additions and 440 deletions

View File

@@ -387,7 +387,7 @@ class Battle::Battler
#=============================================================================
# Item effects
#=============================================================================
def pbConfusionBerry(item_to_use, forced, flavor, confuse_msg)
def pbConfusionBerry(item_to_use, forced, confuse_stat, confuse_msg)
return false if !forced && !canHeal?
return false if !forced && !canConsumePinchBerry?(Settings::MECHANICS_GENERATION >= 7)
used_item_name = GameData::Item.get(item_to_use).name
@@ -415,12 +415,9 @@ class Battle::Battler
@battle.pbDisplay(_INTL("{1} restored its health using its {2}!", pbThis, used_item_name))
end
end
flavor_stat = [:ATTACK, :DEFENSE, :SPEED, :SPECIAL_ATTACK, :SPECIAL_DEFENSE][flavor]
self.nature.stat_changes.each do |change|
next if change[1] > 0 || change[0] != flavor_stat
if self.nature.stat_changes.any? { |val| val[0] == confuse_stat && val[1] < 0 }
@battle.pbDisplay(confuse_msg)
pbConfuse if pbCanConfuseSelf?(false)
break
end
return true
end