From 04054978685586f9c29b46bef108860c23276bad Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Mon, 30 Aug 2021 00:38:06 +0100 Subject: [PATCH] Healing Wish/Lunar Dance now linger until they will do something, as per Gen 8 --- .../001_Battler/006_Battler_AbilityAndItem.rb | 34 +++++++++++++++++++ .../002_Move/007_Move_Effects_100-17F.rb | 1 + .../003_Battle/006_Battle_Action_Switching.rb | 19 ++--------- Data/Scripts/Gen 8 notes.txt | 6 ++-- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/Data/Scripts/011_Battle/001_Battler/006_Battler_AbilityAndItem.rb b/Data/Scripts/011_Battle/001_Battler/006_Battler_AbilityAndItem.rb index c3f5977da..307f715e2 100644 --- a/Data/Scripts/011_Battle/001_Battler/006_Battler_AbilityAndItem.rb +++ b/Data/Scripts/011_Battle/001_Battler/006_Battler_AbilityAndItem.rb @@ -24,6 +24,40 @@ class PokeBattle_Battler pbAbilityStatusCureCheck end + #============================================================================= + # Called when a Pokémon enters battle, and when Ally Switch is used. + #============================================================================= + def pbEffectsOnEnteringPosition + position = @battle.positions[@index] + # Healing Wish + if position.effects[PBEffects::HealingWish] + if canHeal? || self.status != :NONE + @battle.pbCommonAnimation("HealingWish", self) + @battle.pbDisplay(_INTL("The healing wish came true for {1}!", pbThis(true))) + pbRecoverHP(@totalhp) + pbCureStatus(false) + position.effects[PBEffects::HealingWish] = false + elsif Settings::MECHANICS_GENERATION < 8 + position.effects[PBEffects::HealingWish] = false + end + end + # Lunar Dance + if position.effects[PBEffects::LunarDance] + full_pp = true + eachMove { |m| full_pp = false if m.pp < m.total_pp } + if canHeal? || self.status != :NONE || !full_pp + @battle.pbCommonAnimation("LunarDance", self) + @battle.pbDisplay(_INTL("{1} became cloaked in mystical moonlight!", pbThis)) + pbRecoverHP(@totalhp) + pbCureStatus(false) + eachMove { |m| m.pp = m.total_pp } + position.effects[PBEffects::LunarDance] = false + elsif Settings::MECHANICS_GENERATION < 8 + position.effects[PBEffects::LunarDance] = false + end + end + end + #============================================================================= # Ability effects #============================================================================= diff --git a/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb b/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb index 4536ae544..59f47adf8 100644 --- a/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb +++ b/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb @@ -933,6 +933,7 @@ class PokeBattle_Move_120 < PokeBattle_Move if @battle.pbSwapBattlers(idxA,idxB) @battle.pbDisplay(_INTL("{1} and {2} switched places!", @battle.battlers[idxB].pbThis,@battle.battlers[idxA].pbThis(true))) + [idxA, idxB].each { |idx| @battle.battlers[idx].pbEffectsOnEnteringPosition } end end end diff --git a/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb b/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb index f7ad7fda6..06cd4ba33 100644 --- a/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb +++ b/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb @@ -327,23 +327,8 @@ class PokeBattle_Battle end # Update battlers' participants (who will gain Exp/EVs when a battler faints) eachBattler { |b| b.pbUpdateParticipants } - # Healing Wish - if @positions[battler.index].effects[PBEffects::HealingWish] - pbCommonAnimation("HealingWish",battler) - pbDisplay(_INTL("The healing wish came true for {1}!",battler.pbThis(true))) - battler.pbRecoverHP(battler.totalhp) - battler.pbCureStatus(false) - @positions[battler.index].effects[PBEffects::HealingWish] = false - end - # Lunar Dance - if @positions[battler.index].effects[PBEffects::LunarDance] - pbCommonAnimation("LunarDance",battler) - pbDisplay(_INTL("{1} became cloaked in mystical moonlight!",battler.pbThis)) - battler.pbRecoverHP(battler.totalhp) - battler.pbCureStatus(false) - battler.eachMove { |m| m.pp = m.total_pp } - @positions[battler.index].effects[PBEffects::LunarDance] = false - end + # Healing Wish/Lunar Dance + battler.pbEffectsOnEnteringPosition # Entry hazards # Stealth Rock if battler.pbOwnSide.effects[PBEffects::StealthRock] && battler.takesIndirectDamage? && diff --git a/Data/Scripts/Gen 8 notes.txt b/Data/Scripts/Gen 8 notes.txt index 4e463e889..18c64ac56 100644 --- a/Data/Scripts/Gen 8 notes.txt +++ b/Data/Scripts/Gen 8 notes.txt @@ -10,9 +10,6 @@ species because of this. This value is also shown in the Pokédex entry screen. (Will be implemented by me in the next PR) Some moves have changed properties/effects: -- Healing Wish's effect and Lunar Dance's effect are no longer used up if a - Pokémon that switches to the targeted position can't make use of it. Each - position can only have one of each effect applied at once. (Will be implemented by me in the next PR) - Parting Shot is able to make the user switch out if its effect is redirected by Mirror Armor. Throat Spray is triggered and applies before the switch. (The Throat Spray part is done by default) @@ -118,6 +115,9 @@ Move Effect Changes pbImmunityByAbility, but leaning towards yes; will Volt Absorb block an Electrified Howl?). Needs a new function code, since it now affects targets rather than the user. +- Healing Wish's effect and Lunar Dance's effect are no longer used up if a + Pokémon that switches to the targeted position can't make use of it. Each + position can only have one of each effect applied at once. Item Effect Changes - Escape Rope's code now supports both consumable and non-consumable versions,