From 05f5d621b7d96b38d70a1bd36c3ae61c1ee66bc8 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sat, 4 Mar 2023 23:37:50 +0000 Subject: [PATCH] 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 --- Data/Scripts/004_Game classes/013_Game_Stats.rb | 2 +- .../002_Battler/003_Battler_ChangeSelf.rb | 2 -- .../002_Battler/007_Battler_UseMove.rb | 5 ++++- .../011_Battle/003_Move/001_Battle_Move.rb | 1 + .../011_Battle/003_Move/011_MoveEffects_Items.rb | 5 +++++ .../001_Non-interactive UI/006_UI_HallOfFame.rb | 16 ++++++++++++---- .../003_Debug menus/007_Debug_PokemonCommands.rb | 2 +- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Data/Scripts/004_Game classes/013_Game_Stats.rb b/Data/Scripts/004_Game classes/013_Game_Stats.rb index 5bf86f6fb..9098d58a2 100644 --- a/Data/Scripts/004_Game classes/013_Game_Stats.rb +++ b/Data/Scripts/004_Game classes/013_Game_Stats.rb @@ -165,7 +165,7 @@ class GameStats end def set_time_to_hall_of_fame - @time_to_enter_hall_of_fame = @play_time + @time_to_enter_hall_of_fame = @play_time if @time_to_enter_hall_of_fame == 0 end def play_time_per_session diff --git a/Data/Scripts/011_Battle/002_Battler/003_Battler_ChangeSelf.rb b/Data/Scripts/011_Battle/002_Battler/003_Battler_ChangeSelf.rb index e90b37d09..539e472ab 100644 --- a/Data/Scripts/011_Battle/002_Battler/003_Battler_ChangeSelf.rb +++ b/Data/Scripts/011_Battle/002_Battler/003_Battler_ChangeSelf.rb @@ -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) diff --git a/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb b/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb index 710103a1b..86d44b490 100644 --- a/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb +++ b/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb @@ -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? } diff --git a/Data/Scripts/011_Battle/003_Move/001_Battle_Move.rb b/Data/Scripts/011_Battle/003_Move/001_Battle_Move.rb index 3e5165ce2..0e7f1dfa8 100644 --- a/Data/Scripts/011_Battle/003_Move/001_Battle_Move.rb +++ b/Data/Scripts/011_Battle/003_Move/001_Battle_Move.rb @@ -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 diff --git a/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb b/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb index cf83b10ce..32788a612 100644 --- a/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb +++ b/Data/Scripts/011_Battle/003_Move/011_MoveEffects_Items.rb @@ -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 diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb b/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb index 862c6e219..eb6385f01 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb @@ -275,13 +275,21 @@ class HallOfFame_Scene end def writeTrainerData - totalsec = Graphics.frame_count / Graphics.frame_rate + if $PokemonGlobal.hallOfFameLastNumber == 1 + totalsec = $stats.time_to_enter_hall_of_fame.to_i + else + totalsec = $stats.play_time.to_i + end hour = totalsec / 60 / 60 min = totalsec / 60 % 60 pubid = sprintf("%05d", $player.public_ID) lefttext = _INTL("Name{1}
", $player.name) - lefttext += _INTL("IDNo.{1}
", pubid) - lefttext += _ISPRINTF("Time{1:02d}:{2:02d}
", hour, min) + lefttext += _INTL("ID No.{1}
", pubid) + if hour > 0 + lefttext += _INTL("Time{1}h {2}m
", hour, min) + else + lefttext += _INTL("Time{1}m
", min) + end lefttext += _INTL("Pokédex{1}/{2}
", $player.pokedex.owned_count, $player.pokedex.seen_count) @sprites["messagebox"] = Window_AdvancedTextPokemon.new(lefttext) @@ -315,7 +323,7 @@ class HallOfFame_Scene [pokename, Graphics.width - 192, Graphics.height - 74, 2, BASECOLOR, SHADOWCOLOR], [_INTL("Lv. {1}", pokemon.egg? ? "?" : pokemon.level), 64, Graphics.height - 42, 0, BASECOLOR, SHADOWCOLOR], - [_INTL("IDNo.{1}", pokemon.egg? ? "?????" : idno), + [_INTL("ID No. {1}", pokemon.egg? ? "?????" : idno), Graphics.width - 192, Graphics.height - 42, 2, BASECOLOR, SHADOWCOLOR] ] if hallNumber > -1 diff --git a/Data/Scripts/020_Debug/003_Debug menus/007_Debug_PokemonCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/007_Debug_PokemonCommands.rb index 242f3c8ba..597e878b1 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/007_Debug_PokemonCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/007_Debug_PokemonCommands.rb @@ -769,7 +769,7 @@ MenuHandlers.add(:pokemon_debug_menu, :species_and_form, { form_name = sprintf("%d: %s", sp.form, form_name) formcmds[0].push(sp.form) formcmds[1].push(form_name) - cmd2 = sp.form if pkmn.form == sp.form + cmd2 = formcmds[0].length - 1 if pkmn.form == sp.form end if formcmds[0].length <= 1 screen.pbDisplay(_INTL("Species {1} only has one form.", pkmn.speciesName))