From 78f5530cbe584babac7c8ce978e4eeed38279ea3 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Tue, 13 Jul 2021 20:52:26 +0100 Subject: [PATCH] Added more Gen 8 code --- .../010_Data/001_Hardcoded data/017_Target.rb | 9 ++ .../001_Battler/001_PokeBattle_Battler.rb | 3 + .../001_Battler/002_Battler_Initialize.rb | 1 + .../001_Battler/003_Battler_ChangeSelf.rb | 13 ++- .../001_Battler/006_Battler_AbilityAndItem.rb | 2 +- .../008_Battler_UseMove_Targeting.rb | 5 + .../011_Battle/002_Move/002_Move_Usage.rb | 19 +++- .../002_Move/003_Move_Usage_Calculations.rb | 2 +- .../002_Move/007_Move_Effects_100-17F.rb | 1 - .../002_Move/008_Move_Effects_Gen8.rb | 101 +++++++++--------- .../003_Battle/001_PokeBattle_BattleCommon.rb | 4 + .../003_Battle/002_PokeBattle_Battle.rb | 2 + .../005_Battle_Action_AttacksPriority.rb | 3 + .../003_Battle/012_Battle_Phase_EndOfRound.rb | 3 +- .../004_AI/006_AI_Move_Utilities.rb | 2 + .../011_Battle/004_BattleHandlers_Items.rb | 5 +- .../003_PokeBattle_SceneConstants.rb | 2 +- .../011_Battle/007_PokeBattle_DamageState.rb | 2 + Data/Scripts/011_Battle/Gen 8 abilities.rb | 89 ++++++++++----- PBS/Gen 8/abilities.txt | 8 +- PBS/Gen 8/moves.txt | 2 +- PBS/Gen 8/pokemon_forms.txt | 4 +- PBS/abilities.txt | 8 +- PBS/moves.txt | 2 +- PBS/pokemon_forms.txt | 4 +- 25 files changed, 199 insertions(+), 97 deletions(-) diff --git a/Data/Scripts/010_Data/001_Hardcoded data/017_Target.rb b/Data/Scripts/010_Data/001_Hardcoded data/017_Target.rb index 78430bba0..b00c9a22b 100644 --- a/Data/Scripts/010_Data/001_Hardcoded data/017_Target.rb +++ b/Data/Scripts/010_Data/001_Hardcoded data/017_Target.rb @@ -75,6 +75,15 @@ GameData::Target.register({ :num_targets => 1 }) +# Coaching +GameData::Target.register({ + :id => :AllAllies, + :name => _INTL("All Allies"), + :num_targets => 2, + :targets_all => true, + :long_range => true +}) + # Aromatherapy, Gear Up, Heal Bell, Life Dew, Magnetic Flux, Howl (in Gen 8+) GameData::Target.register({ :id => :UserAndAllies, diff --git a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb index 44572473c..737fff015 100644 --- a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -42,6 +42,7 @@ class PokeBattle_Battler attr_accessor :tookPhysicalHit attr_accessor :statsRaised # Boolean for whether self's stat(s) raised this round attr_accessor :statsLowered # Boolean for whether self's stat(s) lowered this round + attr_accessor :canRestoreIceFace # Whether Hail started in the round attr_accessor :damageState attr_accessor :initialHP # Set at the start of each move's usage @@ -361,6 +362,7 @@ class PokeBattle_Battler :DISGUISE, # :FLOWERGIFT, # This can be stopped # :FORECAST, # This can be stopped + :ICEFACE, :MULTITYPE, :POWERCONSTRUCT, :SCHOOLING, @@ -385,6 +387,7 @@ class PokeBattle_Battler :DISGUISE, :FLOWERGIFT, :FORECAST, + :ICEFACE, :MULTITYPE, :POWERCONSTRUCT, :SCHOOLING, diff --git a/Data/Scripts/011_Battle/001_Battler/002_Battler_Initialize.rb b/Data/Scripts/011_Battle/001_Battler/002_Battler_Initialize.rb index c4c254d4f..486be11c6 100644 --- a/Data/Scripts/011_Battle/001_Battler/002_Battler_Initialize.rb +++ b/Data/Scripts/011_Battle/001_Battler/002_Battler_Initialize.rb @@ -152,6 +152,7 @@ class PokeBattle_Battler @tookPhysicalHit = false @statsRaised = false @statsLowered = false + @canRestoreIceFace = false @lastMoveUsed = nil @lastMoveUsedType = nil @lastRegularMoveUsed = nil diff --git a/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb b/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb index b6bd5eeba..71070ece1 100644 --- a/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb +++ b/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb @@ -163,7 +163,7 @@ class PokeBattle_Battler end end - def pbCheckFormOnWeatherChange + def pbCheckFormOnWeatherChange(ability_changed = false) return if fainted? || @effects[PBEffects::Transform] # Castform - Forecast if isSpecies?(:CASTFORM) @@ -197,6 +197,11 @@ class PokeBattle_Battler pbChangeForm(0,_INTL("{1} transformed!",pbThis)) end end + # Eiscue - Ice Face + if !ability_changed && isSpecies?(:EISCUE) && self.ability = :ICEFACE && + @form == 1 && @battle.pbWeather == :Hail + @canRestoreIceFace = true # Changed form at end of round + end end # Checks the Pokémon's form and updates it if necessary. Used for when a @@ -261,6 +266,12 @@ class PokeBattle_Battler pbChangeForm(newForm,_INTL("{1} transformed into its Complete Forme!",pbThis)) end end + # Morpeko - Hunger Switch + if isSpecies?(:MORPEKO) && hasActiveAbility?(:HUNGERSWITCH) && endOfRound + # Intentionally doesn't show the ability splash or a message + newForm = (@form + 1) % 2 + pbChangeForm(newForm, nil) + end end def pbTransform(target) 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 577773957..3db70f397 100644 --- a/Data/Scripts/011_Battle/001_Battler/006_Battler_AbilityAndItem.rb +++ b/Data/Scripts/011_Battle/001_Battler/006_Battler_AbilityAndItem.rb @@ -116,7 +116,7 @@ class PokeBattle_Battler @effects[PBEffects::GastroAcid] = false if unstoppableAbility? @effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART # Revert form if Flower Gift/Forecast was lost - pbCheckFormOnWeatherChange + pbCheckFormOnWeatherChange(true) # Check for end of primordial weather @battle.pbEndPrimordialWeather end diff --git a/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb b/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb index 368dd78ca..96031f63f 100644 --- a/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb +++ b/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb @@ -47,6 +47,10 @@ class PokeBattle_Battler if !pbAddTarget(targets,user,targetBattler,move,true,true) pbAddTarget(targets,user,user,move,true,true) end + when :AllAllies + @battle.eachSameSideBattler(user.index) do |b| + pbAddTarget(targets,user,b,move,false,true) if b.index != user.index + end when :UserAndAllies pbAddTarget(targets,user,user,move,true,true) @battle.eachSameSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move,false,true) } @@ -93,6 +97,7 @@ class PokeBattle_Battler return targets if @battle.switching # For Pursuit interrupting a switch return targets if move.cannotRedirect? || move.targetsPosition? return targets if !target_data.can_target_one_foe? || targets.length != 1 + return targets if user.hasActiveAbility?([:PROPELLERTAIL, :STALWART]) priority = @battle.pbPriority(true) nearOnly = !target_data.can_choose_distant_target? # Spotlight (takes priority over Follow Me/Rage Powder/Lightning Rod/Storm Drain) diff --git a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb index e0e1f793b..f7f0c9a05 100644 --- a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb +++ b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb @@ -163,6 +163,12 @@ class PokeBattle_Move target.damageState.substitute = true return end + # Ice Face will take the damage + if !@battle.moldBreaker && target.isSpecies?(:EISCUE) && + target.form == 0 && target.ability == :ICEFACE && physicalMove? + target.damageState.iceFace = true + return + end # Disguise will take the damage if !@battle.moldBreaker && target.isSpecies?(:MIMIKYU) && target.form==0 && target.ability == :DISGUISE @@ -181,7 +187,7 @@ class PokeBattle_Move return end # Disguise takes the damage - return if target.damageState.disguise + return if target.damageState.disguise || target.damageState.iceFace # Target takes the damage if damage>=target.hp damage = target.hp @@ -250,7 +256,7 @@ class PokeBattle_Move # Messages upon being hit #============================================================================= def pbEffectivenessMessage(user,target,numTargets=1) - return if target.damageState.disguise + return if target.damageState.disguise || target.damageState.iceFace if Effectiveness.super_effective?(target.damageState.typeMod) if numTargets>1 @battle.pbDisplay(_INTL("It's super effective on {1}!",target.pbThis(true))) @@ -267,7 +273,7 @@ class PokeBattle_Move end def pbHitEffectivenessMessages(user,target,numTargets=1) - return if target.damageState.disguise + return if target.damageState.disguise || target.damageState.iceFace if target.damageState.substitute @battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true))) end @@ -299,6 +305,13 @@ class PokeBattle_Move end @battle.pbHideAbilitySplash(target) target.pbChangeForm(1,_INTL("{1}'s disguise was busted!",target.pbThis)) + elsif target.damageState.iceFace + @battle.pbShowAbilitySplash(target) + if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH + @battle.pbDisplay(_INTL("{1}'s {2} activated!", target.pbThis, target.abilityName)) + end + target.pbChangeForm(1, _INTL("{1} transformed!", target.pbThis)) + @battle.pbHideAbilitySplash(target) elsif target.damageState.endured @battle.pbDisplay(_INTL("{1} endured the hit!",target.pbThis)) elsif target.damageState.sturdy diff --git a/Data/Scripts/011_Battle/002_Move/003_Move_Usage_Calculations.rb b/Data/Scripts/011_Battle/002_Move/003_Move_Usage_Calculations.rb index 5ebe46f1c..01d6d402e 100644 --- a/Data/Scripts/011_Battle/002_Move/003_Move_Usage_Calculations.rb +++ b/Data/Scripts/011_Battle/002_Move/003_Move_Usage_Calculations.rb @@ -226,7 +226,7 @@ class PokeBattle_Move def pbCalcDamage(user,target,numTargets=1) return if statusMove? - if target.damageState.disguise + if target.damageState.disguise || target.damageState.iceFace target.damageState.calcDamage = 1 return end 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 1d3915593..1a5107f9a 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 @@ -1124,7 +1124,6 @@ class PokeBattle_Move_137 < PokeBattle_Move return true end - def pbEffectAgainstTarget(user,target) showAnim = true if target.pbCanRaiseStatStage?(:DEFENSE,user,self) diff --git a/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb b/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb index cec3fcf14..f70344263 100644 --- a/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb +++ b/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb @@ -1,34 +1,3 @@ -=begin -Dynamax Cannon - 000 -Behemoth Blade - 000 -Behemoth Bash - 000 -Branch Poke - 000 -Overdrive - 000 -Glacial Lance - 000 -Astral Barrage - 000 -Pyro Ball - 00A -Scorching Sands - 00A -Freezing Glare - 00C -Fiery Wrath - 00F -Strange Steam - 013 -Breaking Swipe - 042 -Thunderous Kick - 043 -Drum Beating - 044 -Skitter Smack - 045 -Spirit Break - 045 -Apple Acid - 046 -Dragon Energy - 08B -Wicked Blow - 0A0 -False Surrender - 0A5 -Dual Wingbeat - 0BD -Triple Axel - 0BF -Meteor Assault - 0C2 -Eternabeam - 0C2 -Snap Trap - 0CF -Thunder Cage - 0CF -Flip Turn - 0EE -=end - #=============================================================================== # Poisons the target. This move becomes physical or special, whichever will deal # more damage (only considers stats, stat stages and Wonder Room). Makes contact @@ -47,8 +16,8 @@ class PokeBattle_Move_176 < PokeBattle_PoisonMove def pbOnStartUse(user, targets) target = targets[0] - stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8] - stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2] + stageMul = [2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8] + stageDiv = [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2] # Calculate user's effective attacking values attack_stage = user.stages[:ATTACK] + 6 real_attack = (user.attack.to_f * stageMul[attack_stage] / stageDiv[attack_stage]).floor @@ -79,11 +48,9 @@ end #=============================================================================== # Burns the target if any of its stats were increased this round. # (Burning Jealousy) -# TODO: Is the burn an effect or an additional effect? Regardless, I think this -# code is wrong as it's a damaging move. #=============================================================================== class PokeBattle_Move_177 < PokeBattle_BurnMove - def pbEffectAgainstTarget(user, target) + def pbAdditionalEffect(user, target) super if target.statsRaised end end @@ -171,8 +138,42 @@ end # Raises the Attack and Defense of all user's allies by 1 stage each. Bypasses # protections, including Crafty Shield. Fails if there is no ally. (Coaching) #=============================================================================== -class PokeBattle_Move_17B < PokeBattle_UnimplementedMove - # TODO: Needs a new targeting option. Otherwise, see Magnetic Flux. +class PokeBattle_Move_17B < PokeBattle_Move + def ignoresSubstitute?(user); return true; end + def canSnatch?; return true; end + + def pbMoveFailed?(user, targets) + @validTargets = [] + @battle.eachSameSideBattler(user) do |b| + next if b.index == user.index + next if !b.pbCanRaiseStatStage?(:ATTACK, user, self) && + !b.pbCanRaiseStatStage?(:DEFENSE, user, self) + @validTargets.push(b) + end + if @validTargets.length == 0 + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return false + end + + def pbFailsAgainstTarget?(user, target) + return false if @validTargets.any? { |b| b.index == target.index } + @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!", target.pbThis)) + return true + end + + def pbEffectAgainstTarget(user, target) + showAnim = true + if target.pbCanRaiseStatStage?(:ATTACK, user, self) + if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim) + showAnim = false + end + end + if target.pbCanRaiseStatStage?(:DEFENSE, user, self) + target.pbRaiseStatStage(:DEFENSE, 1, user, showAnim) + end + end end #=============================================================================== @@ -366,7 +367,7 @@ end # counter. (Obstruct) #=============================================================================== class PokeBattle_Move_186 < PokeBattle_ProtectMove - def initialize(battle,move) + def initialize(battle, move) super @effect = PBEffects::Obstruct end @@ -548,7 +549,6 @@ end # The target can no longer switch out or flee, while the user remains in battle. # At the end of each round, the target's Defense and Special Defense are lowered # by 1 stage each. (Octolock) -# TODO: Can the user lock multiple other Pokémon at once? #=============================================================================== class PokeBattle_Move_18F < PokeBattle_Move def pbFailsAgainstTarget?(user, target) @@ -576,7 +576,7 @@ end # fleeing. (Jaw Lock) #=============================================================================== class PokeBattle_Move_190 < PokeBattle_Move - def pbAdditionalEffect(user,target) + def pbAdditionalEffect(user, target) return if user.fainted? || target.fainted? || target.damageState.substitute return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST) return if user.trappedInBattle? || target.trappedInBattle? @@ -653,7 +653,7 @@ class PokeBattle_Move_192 < PokeBattle_Move return false end - def pbOnStartUse(user,targets) + def pbOnStartUse(user, targets) @battle.pbDisplay(_INTL("It's teatime! Everyone dug in to their Berries!")) end @@ -711,14 +711,17 @@ class PokeBattle_Move_193 < PokeBattle_Move end #=============================================================================== -# The user takes recoil damage equal to 1/2 of its total HP (rounded up, min. 1 -# damage). (Steel Beam) -# TODO: This recoil is not affected by Rock Head/Reckless. Damage is taken even -# if the move is protected against/misses. +# The user takes damage equal to 1/2 of its total HP, even if the target is +# unaffected (this is not recoil damage). (Steel Beam) #=============================================================================== -class PokeBattle_Move_194 < PokeBattle_RecoilMove - def pbRecoilDamage(user, target) - return (user.totalhp / 2.0).ceil +class PokeBattle_Move_194 < PokeBattle_Move + def pbEffectAfterAllHits(user, target) + return if !user.takesIndirectDamage? + amt = (user.totalhp / 2.0).ceil + amt = 1 if amt < 1 + user.pbReduceHP(amt, false) + @battle.pbDisplay(_INTL("{1} is damaged by recoil!", user.pbThis)) + user.pbItemHPHealCheck end end diff --git a/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb b/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb index 62cfb3108..e407d753d 100644 --- a/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb +++ b/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb @@ -153,6 +153,10 @@ module PokeBattle_BattleCommon # Save the Pokémon for storage at the end of battle @caughtPokemon.push(pkmn) end + if numShakes != 4 + @first_poke_ball = ball if !@poke_ball_failed + @poke_ball_failed = true + end end #============================================================================= diff --git a/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb b/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb index e7c108541..22fbd50f4 100644 --- a/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb +++ b/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb @@ -79,6 +79,8 @@ class PokeBattle_Battle attr_reader :successStates # Success states attr_accessor :lastMoveUsed # Last move used attr_accessor :lastMoveUser # Last move user + attr_accessor :first_poke_ball # ID of the first thrown Poké Ball that failed + attr_Accessor :poke_ball_failed # Set after first_poke_ball to prevent it being set again attr_reader :switching # True if during the switching phase of the round attr_reader :futureSight # True if Future Sight is hitting attr_reader :endOfRound # True during the end of round diff --git a/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb b/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb index 9487bf0af..324500c90 100644 --- a/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb +++ b/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb @@ -110,6 +110,9 @@ class PokeBattle_Battle return true if idxUser==idxTarget return false if opposes?(idxUser,idxTarget) return false if !nearBattlers?(idxUser,idxTarget) + when :AllAllies + return false if idxUser == idxTarget + return false if opposes?(idxUser, idxTarget) when :UserAndAllies return false if opposes?(idxUser,idxTarget) when :NearFoe, :RandomNearFoe, :AllNearFoes diff --git a/Data/Scripts/011_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb b/Data/Scripts/011_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb index deec25ddc..977010fa6 100644 --- a/Data/Scripts/011_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb +++ b/Data/Scripts/011_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb @@ -593,7 +593,7 @@ class PokeBattle_Battle BattleHandlers.triggerEOREffectAbility(b.ability,b,self) if b.abilityActive? # Flame Orb, Sticky Barb, Toxic Orb BattleHandlers.triggerEOREffectItem(b.item,b,self) if b.itemActive? - # Harvest, Pickup + # Harvest, Pickup, Ball Fetch BattleHandlers.triggerEORGainItemAbility(b.ability,b,self) if b.abilityActive? end pbGainExp @@ -650,6 +650,7 @@ class PokeBattle_Battle b.tookPhysicalHit = false b.statsRaised = false b.statsLowered = false + b.canRestoreIceFace = false b.lastRoundMoveFailed = b.lastMoveFailed b.lastAttacker.clear b.lastFoeAttacker.clear diff --git a/Data/Scripts/011_Battle/004_AI/006_AI_Move_Utilities.rb b/Data/Scripts/011_Battle/004_AI/006_AI_Move_Utilities.rb index f4f03036f..79f4ef43b 100644 --- a/Data/Scripts/011_Battle/004_AI/006_AI_Move_Utilities.rb +++ b/Data/Scripts/011_Battle/004_AI/006_AI_Move_Utilities.rb @@ -7,6 +7,8 @@ class PokeBattle_AI return false if target_data.num_targets <= 1 num_targets = 0 case target_data.id + when :AllAllies + @battle.eachSameSideBattler(user) { |b| num_targets += 1 if b.index != user.index } when :UserAndAllies @battle.eachSameSideBattler(user) { |_b| num_targets += 1 } when :AllNearFoes diff --git a/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb b/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb index 27ec8cabe..172578713 100644 --- a/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb +++ b/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb @@ -1023,7 +1023,8 @@ BattleHandlers::TargetItemOnHit.add(:CELLBATTERY, BattleHandlers::TargetItemOnHit.add(:ENIGMABERRY, proc { |item,user,target,move,battle| - next if target.damageState.substitute || target.damageState.disguise + next if target.damageState.substitute || + target.damageState.disguise || target.damageState.iceFace next if !Effectiveness.super_effective?(target.damageState.typeMod) if BattleHandlers.triggerTargetItemOnHitPositiveBerry(item,target,battle,false) target.pbHeldItemTriggered(item) @@ -1137,7 +1138,7 @@ BattleHandlers::TargetItemOnHit.add(:STICKYBARB, BattleHandlers::TargetItemOnHit.add(:WEAKNESSPOLICY, proc { |item,user,target,move,battle| - next if target.damageState.disguise + next if target.damageState.disguise || target.damageState.iceFace next if !Effectiveness.super_effective?(target.damageState.typeMod) next if !target.pbCanRaiseStatStage?(:ATTACK,target) && !target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target) diff --git a/Data/Scripts/011_Battle/005_Battle scene/003_PokeBattle_SceneConstants.rb b/Data/Scripts/011_Battle/005_Battle scene/003_PokeBattle_SceneConstants.rb index 389a0bbea..23f237531 100644 --- a/Data/Scripts/011_Battle/005_Battle scene/003_PokeBattle_SceneConstants.rb +++ b/Data/Scripts/011_Battle/005_Battle scene/003_PokeBattle_SceneConstants.rb @@ -1,5 +1,5 @@ module PokeBattle_SceneConstants - USE_ABILITY_SPLASH = true + USE_ABILITY_SPLASH = (Settings::MECHANICS_GENERATION >= 5) # Text colors MESSAGE_BASE_COLOR = Color.new(80, 80, 88) MESSAGE_SHADOW_COLOR = Color.new(160, 160, 168) diff --git a/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb b/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb index bac071529..0a3125c41 100644 --- a/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb +++ b/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb @@ -17,6 +17,7 @@ class PokeBattle_DamageState attr_accessor :focusSash # Focus Sash used attr_accessor :sturdy # Sturdy ability used attr_accessor :disguise # Disguise ability used + attr_accessor :iceFace # Ice Face ability used attr_accessor :endured # Damage was endured attr_accessor :berryWeakened # Whether a type-resisting berry was used @@ -44,6 +45,7 @@ class PokeBattle_DamageState @focusSash = false @sturdy = false @disguise = false + @iceFace = false @endured = false @berryWeakened = false end diff --git a/Data/Scripts/011_Battle/Gen 8 abilities.rb b/Data/Scripts/011_Battle/Gen 8 abilities.rb index b611db260..5d7a221d0 100644 --- a/Data/Scripts/011_Battle/Gen 8 abilities.rb +++ b/Data/Scripts/011_Battle/Gen 8 abilities.rb @@ -157,7 +157,9 @@ BattleHandlers::UserAbilityEndOfMove.add(:CHILLINGNEIGH, numFainted = 0 targets.each { |b| numFainted += 1 if b.damageState.fainted } next if numFainted == 0 || !user.pbCanRaiseStatStage?(:ATTACK, user) + user.ability_id = :CHILLINGNEIGH # So the As One abilities can just copy this user.pbRaiseStatStageByAbility(:ATTACK, 1, user) + user.ability_id = ability } ) @@ -167,7 +169,9 @@ BattleHandlers::UserAbilityEndOfMove.add(:GRIMNEIGH, numFainted = 0 targets.each { |b| numFainted += 1 if b.damageState.fainted } next if numFainted == 0 || !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user) + user.ability_id = :GRIMNEIGH # So the As One abilities can just copy this user.pbRaiseStatStageByAbility(:SPECIAL_ATTACK, 1, user) + user.ability_id = ability } ) @@ -263,44 +267,78 @@ BattleHandlers::PriorityBracketUseAbility.add(:QUICKDRAW, } ) +BattleHandlers::EORGainItemAbility.add(:BALLFETCH, + proc { |ability, battler, battle| + next if battler.item + next if battle.first_poke_ball.nil? + battle.pbShowAbilitySplash(battler) + battler.item = battle.first_poke_ball + battler.setInitialItem(battler.item) if !battler.initialItem + battle.first_poke_ball = nil + battle.pbDisplay(_INTL("{1} retrieved the thrown {2}!", battler.pbThis, battler.itemName)) + battle.pbHideAbilitySplash(battler) + battler.pbHeldItemTriggerCheck + } +) + +BattleHandlers::AbilityOnSwitchIn.add(:ASONECHILLINGNEIGH, + proc { |ability, battler, battle| + battle.pbShowAbilitySplash(battler) + battle.pbDisplay(_INTL("{1} has two Abilities!", battler.pbThis)) + battle.pbHideAbilitySplash(battler) + battler.ability_id = :UNNERVE + battle.pbShowAbilitySplash(battler) + battle.pbDisplay(_INTL("{1} is too nervous to eat Berries!", battler.pbOpposingTeam)) + battle.pbHideAbilitySplash(battler) + battler.ability_id = ability + } +) + +BattleHandlers::AbilityOnSwitchIn.copy(:ASONECHILLINGNEIGH, :ASONEGRIMNEIGH) +BattleHandlers::UserAbilityEndOfMove.copy(:CHILLINGNEIGH, :ASONECHILLINGNEIGH) +BattleHandlers::UserAbilityEndOfMove.copy(:GRIMNEIGH, :ASONEGRIMNEIGH) + +BattleHandlers::AbilityOnSwitchIn.add(:ICEFACE, + proc { |ability, battler, battle| + next if !battler.isSpecies?(:EISCUE) || battler.form != 1 + next if battle.pbWeather != :Hail + battle.pbShowAbilitySplash(battler) + if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("{1}'s {2} activated!", battler.pbThis, battler.abilityName)) + end + battler.pbChangeForm(0, _INTL("{1} transformed!", battler.pbThis)) + battle.pbHideAbilitySplash(battler) + } +) + +BattleHandlers::EORWeatherAbility.add(:ICEFACE, + proc { |ability, weather, battler, battle| + next if weather != :Hail + next if !battler.canRestoreIceFace || battler.form != 1 + battle.pbShowAbilitySplash(battler) + if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("{1}'s {2} activated!", battler.pbThis, battler.abilityName)) + end + battler.pbChangeForm(0, _INTL("{1} transformed!", battler.pbThis)) + battle.pbHideAbilitySplash(battler) + } +) + + =begin #=============================================================================== -Hunger Switch -At the end of each round, switches the bearer's form (if it is Morpeko). - -Ice Face -When bearer is hit by a physical move while in its initial form (including -hitting itself in confusion), it takes no damage and its form changes. At the -end of a round in which hail weather started, and immediately upon switching in -while hail weather exists, the bearer regains its initial form. - Gulp Missile After using Surf/Dive, changes the bearer's form depending on its HP. If hit by an attack while in one of these forms, damages the attacker and causes an effect depending on the form. -Ball Fetch -At the end of a round in which a thrown Poké Ball fails to catch a Pokémon, -bearer picks up that Poké Ball. Applies only to the first thrown Poké Ball, and -only triggers once. - Steam Engine When bearer is hit by a Fire- or Water-type move, bearer gets +6 Speed (after the effect of that move is applied). Outside of battle, makes eggs hatch twice as fast (doesn't stack with other such abilities). -As One (Chilling) -Combination of Unnerve and Chilling Neigh. Message upon entering battle says it -has two abilities; other triggers use the name of the appropriate ability rather -than "As One". - -As One (Grim) -Combination of Unnerve and Grim Neigh. Message upon entering battle says it has -two abilities; other triggers use the name of the appropriate ability rather -than "As One". - Gorilla Tactics Boosts bearer's Attack by 50%, but restricts bearer to one move (cf. Choice Band). Power boost stacks with Choice Band. @@ -321,9 +359,6 @@ Suppresses all other abilities. Once this ability stops applying, triggers all abilities that activate when gained (if this happens because bearer switches out, abilities trigger before the replacement switches in). -Propellor Tail, Stalwart -Bearer's moves cannot be redirected. - Mimicry The bearer's type changes depending on the terrain. Triggers upon entering battle and when terrain changes (and not when bearer's type is changed, e.g. diff --git a/PBS/Gen 8/abilities.txt b/PBS/Gen 8/abilities.txt index af8f1c89a..46fea2354 100644 --- a/PBS/Gen 8/abilities.txt +++ b/PBS/Gen 8/abilities.txt @@ -1060,6 +1060,10 @@ Description = When the Pokémon knocks out a target, it utters a chilling neigh, Name = Grim Neigh Description = When the Pokémon knocks out a target, it utters a terrifying neigh, which boosts its Sp. Atk stat. #------------------------------- -[ASONE] +[ASONECHILLINGNEIGH] Name = As One -Description = This Ability combines the effects of both Calyrex's Unnerve Ability and Glastrier's Chilling Neigh Ability/Spectrier's Grim Neigh Ability. \ No newline at end of file +Description = This Ability combines the effects of both Calyrex's Unnerve Ability and Glastrier's Chilling Neigh Ability. +#------------------------------- +[ASONEGRIMNEIGH] +Name = As One +Description = This Ability combines the effects of both Calyrex's Unnerve Ability and Spectrier's Grim Neigh Ability. \ No newline at end of file diff --git a/PBS/Gen 8/moves.txt b/PBS/Gen 8/moves.txt index e8623b516..5ec25c95c 100644 --- a/PBS/Gen 8/moves.txt +++ b/PBS/Gen 8/moves.txt @@ -2328,7 +2328,7 @@ Type = FIGHTING Category = Status Accuracy = 0 TotalPP = 10 -Target = UserAndAllies +Target = AllAllies FunctionCode = 17B Flags = CanMirrorMove Description = The user properly coaches its ally Pokémon, boosting their Attack and Defense stats. diff --git a/PBS/Gen 8/pokemon_forms.txt b/PBS/Gen 8/pokemon_forms.txt index 48f119a2a..c89e40bf4 100644 --- a/PBS/Gen 8/pokemon_forms.txt +++ b/PBS/Gen 8/pokemon_forms.txt @@ -2301,7 +2301,7 @@ Type1 = PSYCHIC Type2 = ICE BaseStats = 100,165,150,50,85,130 EVs = 0,3,0,0,0,0 -Abilities = ASONE +Abilities = ASONECHILLINGNEIGH Moves = 1,GLACIALLANCE,1,TACKLE,1,TAILWHIP,1,DOUBLEKICK,1,AVALANCHE,1,STOMP,1,TORMENT,1,MIST,1,ICICLECRASH,1,TAKEDOWN,1,IRONDEFENSE,1,THRASH,1,TAUNT,1,DOUBLEEDGE,1,SWORDSDANCE,1,POUND,1,MEGADRAIN,1,CONFUSION,1,GROWTH,8,LIFEDEW,16,GIGADRAIN,24,PSYSHOCK,32,HELPINGHAND,40,AROMATHERAPY,48,ENERGYBALL,56,PSYCHIC,64,LEECHSEED,72,HEALPULSE,80,SOLARBEAM,88,FUTURESIGHT TutorMoves = AGILITY,ALLYSWITCH,ASSURANCE,AVALANCHE,BATONPASS,BLIZZARD,BODYPRESS,BODYSLAM,BULLDOZE,BULLETSEED,CALMMIND,CLOSECOMBAT,CRUNCH,DRAININGKISS,ENCORE,ENDURE,ENERGYBALL,EXPANDINGFORCE,FACADE,FUTURESIGHT,GIGADRAIN,GIGAIMPACT,GRASSKNOT,GRASSYTERRAIN,GUARDSWAP,HAIL,HEAVYSLAM,HELPINGHAND,HIGHHORSEPOWER,HYPERBEAM,ICEBEAM,ICICLESPEAR,ICYWIND,IMPRISON,IRONDEFENSE,LASHOUT,LEAFSTORM,LIGHTSCREEN,MAGICALLEAF,MAGICROOM,MEGAHORN,METRONOME,MUDSHOT,OUTRAGE,PAYBACK,PAYDAY,POLLENPUFF,POWERSWAP,PROTECT,PSYCHIC,PSYCHICTERRAIN,PSYSHOCK,REFLECT,REST,ROUND,SAFEGUARD,SCARYFACE,SEEDBOMB,SKILLSWAP,SLEEPTALK,SMARTSTRIKE,SNARL,SNORE,SOLARBEAM,SOLARBLADE,SPEEDSWAP,STOMPINGTANTRUM,STOREDPOWER,SUBSTITUTE,SUNNYDAY,SUPERPOWER,SWIFT,SWORDSDANCE,TAUNT,THROATCHOP,TRIATTACK,TRICK,TRICKROOM,UPROAR,WONDERROOM,ZENHEADBUTT Height = 2.4 @@ -2317,7 +2317,7 @@ Type1 = PSYCHIC Type2 = GHOST BaseStats = 100,85,80,150,165,100 EVs = 0,0,0,0,3,0 -Abilities = ASONE +Abilities = ASONEGRIMNEIGH Moves = 1,ASTRALBARRAGE,1,TACKLE,1,TAILWHIP,1,DOUBLEKICK,1,HEX,1,STOMP,1,CONFUSERAY,1,HAZE,1,SHADOWBALL,1,TAKEDOWN,1,AGILITY,1,THRASH,1,DISABLE,1,DOUBLEEDGE,1,NASTYPLOT,1,POUND,1,MEGADRAIN,1,CONFUSION,1,GROWTH,8,LIFEDEW,16,GIGADRAIN,24,PSYSHOCK,32,HELPINGHAND,40,AROMATHERAPY,48,ENERGYBALL,56,PSYCHIC,64,LEECHSEED,72,HEALPULSE,80,SOLARBEAM,88,FUTURESIGHT TutorMoves = AGILITY,ALLYSWITCH,ASSURANCE,BATONPASS,BODYSLAM,BULLDOZE,BULLETSEED,CALMMIND,CRUNCH,DARKPULSE,DRAININGKISS,ENCORE,ENDURE,ENERGYBALL,EXPANDINGFORCE,FACADE,FOULPLAY,FUTURESIGHT,GIGADRAIN,GIGAIMPACT,GRASSKNOT,GRASSYTERRAIN,GUARDSWAP,HELPINGHAND,HEX,HYPERBEAM,IMPRISON,LASHOUT,LEAFSTORM,LIGHTSCREEN,MAGICALLEAF,MAGICROOM,METRONOME,MUDSHOT,NASTYPLOT,PAYBACK,PAYDAY,PHANTOMFORCE,POLLENPUFF,POWERSWAP,PROTECT,PSYCHIC,PSYCHICTERRAIN,PSYCHOCUT,PSYSHOCK,REFLECT,REST,ROUND,SAFEGUARD,SCARYFACE,SEEDBOMB,SHADOWBALL,SKILLSWAP,SLEEPTALK,SNARL,SNORE,SOLARBEAM,SOLARBLADE,SPEEDSWAP,STOMPINGTANTRUM,STOREDPOWER,SUBSTITUTE,SUNNYDAY,SWIFT,TAUNT,TRIATTACK,TRICK,TRICKROOM,UPROAR,WILLOWISP,WONDERROOM,ZENHEADBUTT Height = 2.4 diff --git a/PBS/abilities.txt b/PBS/abilities.txt index af8f1c89a..46fea2354 100644 --- a/PBS/abilities.txt +++ b/PBS/abilities.txt @@ -1060,6 +1060,10 @@ Description = When the Pokémon knocks out a target, it utters a chilling neigh, Name = Grim Neigh Description = When the Pokémon knocks out a target, it utters a terrifying neigh, which boosts its Sp. Atk stat. #------------------------------- -[ASONE] +[ASONECHILLINGNEIGH] Name = As One -Description = This Ability combines the effects of both Calyrex's Unnerve Ability and Glastrier's Chilling Neigh Ability/Spectrier's Grim Neigh Ability. \ No newline at end of file +Description = This Ability combines the effects of both Calyrex's Unnerve Ability and Glastrier's Chilling Neigh Ability. +#------------------------------- +[ASONEGRIMNEIGH] +Name = As One +Description = This Ability combines the effects of both Calyrex's Unnerve Ability and Spectrier's Grim Neigh Ability. \ No newline at end of file diff --git a/PBS/moves.txt b/PBS/moves.txt index e8623b516..5ec25c95c 100644 --- a/PBS/moves.txt +++ b/PBS/moves.txt @@ -2328,7 +2328,7 @@ Type = FIGHTING Category = Status Accuracy = 0 TotalPP = 10 -Target = UserAndAllies +Target = AllAllies FunctionCode = 17B Flags = CanMirrorMove Description = The user properly coaches its ally Pokémon, boosting their Attack and Defense stats. diff --git a/PBS/pokemon_forms.txt b/PBS/pokemon_forms.txt index 48f119a2a..c89e40bf4 100644 --- a/PBS/pokemon_forms.txt +++ b/PBS/pokemon_forms.txt @@ -2301,7 +2301,7 @@ Type1 = PSYCHIC Type2 = ICE BaseStats = 100,165,150,50,85,130 EVs = 0,3,0,0,0,0 -Abilities = ASONE +Abilities = ASONECHILLINGNEIGH Moves = 1,GLACIALLANCE,1,TACKLE,1,TAILWHIP,1,DOUBLEKICK,1,AVALANCHE,1,STOMP,1,TORMENT,1,MIST,1,ICICLECRASH,1,TAKEDOWN,1,IRONDEFENSE,1,THRASH,1,TAUNT,1,DOUBLEEDGE,1,SWORDSDANCE,1,POUND,1,MEGADRAIN,1,CONFUSION,1,GROWTH,8,LIFEDEW,16,GIGADRAIN,24,PSYSHOCK,32,HELPINGHAND,40,AROMATHERAPY,48,ENERGYBALL,56,PSYCHIC,64,LEECHSEED,72,HEALPULSE,80,SOLARBEAM,88,FUTURESIGHT TutorMoves = AGILITY,ALLYSWITCH,ASSURANCE,AVALANCHE,BATONPASS,BLIZZARD,BODYPRESS,BODYSLAM,BULLDOZE,BULLETSEED,CALMMIND,CLOSECOMBAT,CRUNCH,DRAININGKISS,ENCORE,ENDURE,ENERGYBALL,EXPANDINGFORCE,FACADE,FUTURESIGHT,GIGADRAIN,GIGAIMPACT,GRASSKNOT,GRASSYTERRAIN,GUARDSWAP,HAIL,HEAVYSLAM,HELPINGHAND,HIGHHORSEPOWER,HYPERBEAM,ICEBEAM,ICICLESPEAR,ICYWIND,IMPRISON,IRONDEFENSE,LASHOUT,LEAFSTORM,LIGHTSCREEN,MAGICALLEAF,MAGICROOM,MEGAHORN,METRONOME,MUDSHOT,OUTRAGE,PAYBACK,PAYDAY,POLLENPUFF,POWERSWAP,PROTECT,PSYCHIC,PSYCHICTERRAIN,PSYSHOCK,REFLECT,REST,ROUND,SAFEGUARD,SCARYFACE,SEEDBOMB,SKILLSWAP,SLEEPTALK,SMARTSTRIKE,SNARL,SNORE,SOLARBEAM,SOLARBLADE,SPEEDSWAP,STOMPINGTANTRUM,STOREDPOWER,SUBSTITUTE,SUNNYDAY,SUPERPOWER,SWIFT,SWORDSDANCE,TAUNT,THROATCHOP,TRIATTACK,TRICK,TRICKROOM,UPROAR,WONDERROOM,ZENHEADBUTT Height = 2.4 @@ -2317,7 +2317,7 @@ Type1 = PSYCHIC Type2 = GHOST BaseStats = 100,85,80,150,165,100 EVs = 0,0,0,0,3,0 -Abilities = ASONE +Abilities = ASONEGRIMNEIGH Moves = 1,ASTRALBARRAGE,1,TACKLE,1,TAILWHIP,1,DOUBLEKICK,1,HEX,1,STOMP,1,CONFUSERAY,1,HAZE,1,SHADOWBALL,1,TAKEDOWN,1,AGILITY,1,THRASH,1,DISABLE,1,DOUBLEEDGE,1,NASTYPLOT,1,POUND,1,MEGADRAIN,1,CONFUSION,1,GROWTH,8,LIFEDEW,16,GIGADRAIN,24,PSYSHOCK,32,HELPINGHAND,40,AROMATHERAPY,48,ENERGYBALL,56,PSYCHIC,64,LEECHSEED,72,HEALPULSE,80,SOLARBEAM,88,FUTURESIGHT TutorMoves = AGILITY,ALLYSWITCH,ASSURANCE,BATONPASS,BODYSLAM,BULLDOZE,BULLETSEED,CALMMIND,CRUNCH,DARKPULSE,DRAININGKISS,ENCORE,ENDURE,ENERGYBALL,EXPANDINGFORCE,FACADE,FOULPLAY,FUTURESIGHT,GIGADRAIN,GIGAIMPACT,GRASSKNOT,GRASSYTERRAIN,GUARDSWAP,HELPINGHAND,HEX,HYPERBEAM,IMPRISON,LASHOUT,LEAFSTORM,LIGHTSCREEN,MAGICALLEAF,MAGICROOM,METRONOME,MUDSHOT,NASTYPLOT,PAYBACK,PAYDAY,PHANTOMFORCE,POLLENPUFF,POWERSWAP,PROTECT,PSYCHIC,PSYCHICTERRAIN,PSYCHOCUT,PSYSHOCK,REFLECT,REST,ROUND,SAFEGUARD,SCARYFACE,SEEDBOMB,SHADOWBALL,SKILLSWAP,SLEEPTALK,SNARL,SNORE,SOLARBEAM,SOLARBLADE,SPEEDSWAP,STOMPINGTANTRUM,STOREDPOWER,SUBSTITUTE,SUNNYDAY,SWIFT,TAUNT,TRIATTACK,TRICK,TRICKROOM,UPROAR,WILLOWISP,WONDERROOM,ZENHEADBUTT Height = 2.4