Fixed incorrect Hall of Fame time, fixed Shields Down showing too many messages, fixed target of Pluck still being able to consume its healing berry

This commit is contained in:
Maruno17
2023-03-04 23:37:50 +00:00
parent 6157c63fa2
commit 05f5d621b7
7 changed files with 24 additions and 9 deletions

View File

@@ -255,8 +255,6 @@ class Battle::Battler
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(newForm, _INTL("{1} deactivated!", abilityName))
elsif !endOfRound
@battle.pbDisplay(_INTL("{1} deactivated!", abilityName))
end
elsif @form < 7 # Turn into Core form
@battle.pbShowAbilitySplash(self, true)

View File

@@ -692,7 +692,10 @@ class Battle::Battler
end
# HP-healing held items (checks all battlers rather than just targets
# because Flame Burst's splash damage affects non-targets)
@battle.pbPriority(true).each { |b| b.pbItemHPHealCheck }
@battle.pbPriority(true).each do |b|
next if move.preventsBattlerConsumingHealingBerry?(b, targets)
b.pbItemHPHealCheck
end
# Animate battlers fainting (checks all battlers rather than just targets
# because Flame Burst's splash damage affects non-targets)
@battle.pbPriority(true).each { |b| b.pbFaint if b&.fainted? }

View File

@@ -144,6 +144,7 @@ class Battle::Move
def tramplesMinimize?; return @flags.any? { |f| f[/^TramplesMinimize$/i] }; end
def nonLethal?(_user, _target); return false; end # For False Swipe
def preventsBattlerConsumingHealingBerry?(battler, targets); return false; end # For Bug Bite/Pluck
def ignoresSubstitute?(user) # user is the Pokémon using this move
if Settings::MECHANICS_GENERATION >= 6

View File

@@ -375,6 +375,11 @@ end
# User consumes target's berry and gains its effect. (Bug Bite, Pluck)
#===============================================================================
class Battle::Move::UserConsumeTargetBerry < Battle::Move
def preventsBattlerConsumingHealingBerry?(battler, targets)
return targets.any? { |b| b.index == battler.index } &&
battler.item&.is_berry? && Battle::ItemEffects::HPHeal[battler.item]
end
def pbEffectAfterAllHits(user, target)
return if user.fainted? || target.fainted?
return if target.damageState.unaffected || target.damageState.substitute