From d71a3d47e8577d7ed1b54a8e1aa26c1d72799689 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sat, 24 Jul 2021 21:19:01 +0100 Subject: [PATCH] Added effects of Gulp Missile and Unseen Fist, fixed typo with Ice Face --- .../001_Battler/001_PokeBattle_Battler.rb | 2 + .../001_Battler/003_Battler_ChangeSelf.rb | 2 +- .../009_Battler_UseMove_SuccessChecks.rb | 158 +++++++++--------- .../010_Battler_UseMove_TriggerEffects.rb | 29 ++++ .../002_Move/004_Move_Effects_Generic.rb | 4 +- Data/Scripts/011_Battle/Gen 8 abilities.rb | 9 - 6 files changed, 115 insertions(+), 89 deletions(-) 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 aeee17823..843c4c77e 100644 --- a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -362,6 +362,7 @@ class PokeBattle_Battler :DISGUISE, # :FLOWERGIFT, # This can be stopped # :FORECAST, # This can be stopped + :GULPMISSILE, :ICEFACE, :MULTITYPE, :POWERCONSTRUCT, @@ -387,6 +388,7 @@ class PokeBattle_Battler :DISGUISE, :FLOWERGIFT, :FORECAST, + :GULPMISSILE, :ICEFACE, :MULTITYPE, :POWERCONSTRUCT, 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 ef9b5bee4..82aa53879 100644 --- a/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb +++ b/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb @@ -198,7 +198,7 @@ class PokeBattle_Battler end end # Eiscue - Ice Face - if !ability_changed && isSpecies?(:EISCUE) && self.ability = :ICEFACE && + if !ability_changed && isSpecies?(:EISCUE) && self.ability == :ICEFACE && @form == 1 && effectiveWeather == :Hail @canRestoreIceFace = true # Changed form at end of round end diff --git a/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb b/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb index 5e9707953..91768c710 100644 --- a/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb +++ b/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb @@ -309,92 +309,94 @@ class PokeBattle_Battler @battle.successStates[user.index].protected = true return false end - # Wide Guard - if target.pbOwnSide.effects[PBEffects::WideGuard] && user.index!=target.index && - move.pbTarget(user).num_targets > 1 && - (Settings::MECHANICS_GENERATION >= 7 || move.damagingMove?) - @battle.pbCommonAnimation("WideGuard",target) - @battle.pbDisplay(_INTL("Wide Guard protected {1}!",target.pbThis(true))) - target.damageState.protected = true - @battle.successStates[user.index].protected = true - return false - end - if move.canProtectAgainst? - # Quick Guard - if target.pbOwnSide.effects[PBEffects::QuickGuard] && - @battle.choices[user.index][4]>0 # Move priority saved from pbCalculatePriority - @battle.pbCommonAnimation("QuickGuard",target) - @battle.pbDisplay(_INTL("Quick Guard protected {1}!",target.pbThis(true))) + if !(user.hasActiveAbility?(:UNSEENFIST) && move.contactMove?) + # Wide Guard + if target.pbOwnSide.effects[PBEffects::WideGuard] && user.index!=target.index && + move.pbTarget(user).num_targets > 1 && + (Settings::MECHANICS_GENERATION >= 7 || move.damagingMove?) + @battle.pbCommonAnimation("WideGuard",target) + @battle.pbDisplay(_INTL("Wide Guard protected {1}!",target.pbThis(true))) target.damageState.protected = true @battle.successStates[user.index].protected = true return false end - # Protect - if target.effects[PBEffects::Protect] - @battle.pbCommonAnimation("Protect",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) - target.damageState.protected = true - @battle.successStates[user.index].protected = true - return false - end - # King's Shield - if target.effects[PBEffects::KingsShield] && move.damagingMove? - @battle.pbCommonAnimation("KingsShield",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) - target.damageState.protected = true - @battle.successStates[user.index].protected = true - if move.pbContactMove?(user) && user.affectedByContactEffect? - if user.pbCanLowerStatStage?(:ATTACK) - user.pbLowerStatStage(:ATTACK, (Settings::MECHANICS_GENERATION >= 8) ? 1 : 2, nil) + if move.canProtectAgainst? + # Quick Guard + if target.pbOwnSide.effects[PBEffects::QuickGuard] && + @battle.choices[user.index][4]>0 # Move priority saved from pbCalculatePriority + @battle.pbCommonAnimation("QuickGuard",target) + @battle.pbDisplay(_INTL("Quick Guard protected {1}!",target.pbThis(true))) + target.damageState.protected = true + @battle.successStates[user.index].protected = true + return false + end + # Protect + if target.effects[PBEffects::Protect] + @battle.pbCommonAnimation("Protect",target) + @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + target.damageState.protected = true + @battle.successStates[user.index].protected = true + return false + end + # King's Shield + if target.effects[PBEffects::KingsShield] && move.damagingMove? + @battle.pbCommonAnimation("KingsShield",target) + @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + target.damageState.protected = true + @battle.successStates[user.index].protected = true + if move.pbContactMove?(user) && user.affectedByContactEffect? + if user.pbCanLowerStatStage?(:ATTACK) + user.pbLowerStatStage(:ATTACK, (Settings::MECHANICS_GENERATION >= 8) ? 1 : 2, nil) + end end + return false end - return false - end - # Spiky Shield - if target.effects[PBEffects::SpikyShield] - @battle.pbCommonAnimation("SpikyShield",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) - target.damageState.protected = true - @battle.successStates[user.index].protected = true - if move.pbContactMove?(user) && user.affectedByContactEffect? - @battle.scene.pbDamageAnimation(user) - user.pbReduceHP(user.totalhp/8,false) - @battle.pbDisplay(_INTL("{1} was hurt!",user.pbThis)) - user.pbItemHPHealCheck - end - return false - end - # Baneful Bunker - if target.effects[PBEffects::BanefulBunker] - @battle.pbCommonAnimation("BanefulBunker",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) - target.damageState.protected = true - @battle.successStates[user.index].protected = true - if move.pbContactMove?(user) && user.affectedByContactEffect? - user.pbPoison(target) if user.pbCanPoison?(target,false) - end - return false - end - # Obstruct - if target.effects[PBEffects::Obstruct] && move.damagingMove? - @battle.pbCommonAnimation("Obstruct",target) - @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) - target.damageState.protected = true - @battle.successStates[user.index].protected = true - if move.pbContactMove?(user) && user.affectedByContactEffect? - if user.pbCanLowerStatStage?(:DEFENSE) - user.pbLowerStatStage(:DEFENSE, 2, nil) + # Spiky Shield + if target.effects[PBEffects::SpikyShield] + @battle.pbCommonAnimation("SpikyShield",target) + @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + target.damageState.protected = true + @battle.successStates[user.index].protected = true + if move.pbContactMove?(user) && user.affectedByContactEffect? + @battle.scene.pbDamageAnimation(user) + user.pbReduceHP(user.totalhp/8,false) + @battle.pbDisplay(_INTL("{1} was hurt!",user.pbThis)) + user.pbItemHPHealCheck end + return false + end + # Baneful Bunker + if target.effects[PBEffects::BanefulBunker] + @battle.pbCommonAnimation("BanefulBunker",target) + @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + target.damageState.protected = true + @battle.successStates[user.index].protected = true + if move.pbContactMove?(user) && user.affectedByContactEffect? + user.pbPoison(target) if user.pbCanPoison?(target,false) + end + return false + end + # Obstruct + if target.effects[PBEffects::Obstruct] && move.damagingMove? + @battle.pbCommonAnimation("Obstruct",target) + @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) + target.damageState.protected = true + @battle.successStates[user.index].protected = true + if move.pbContactMove?(user) && user.affectedByContactEffect? + if user.pbCanLowerStatStage?(:DEFENSE) + user.pbLowerStatStage(:DEFENSE, 2, nil) + end + end + return false + end + # Mat Block + if target.pbOwnSide.effects[PBEffects::MatBlock] && move.damagingMove? + # NOTE: Confirmed no common animation for this effect. + @battle.pbDisplay(_INTL("{1} was blocked by the kicked-up mat!",move.name)) + target.damageState.protected = true + @battle.successStates[user.index].protected = true + return false end - return false - end - # Mat Block - if target.pbOwnSide.effects[PBEffects::MatBlock] && move.damagingMove? - # NOTE: Confirmed no common animation for this effect. - @battle.pbDisplay(_INTL("{1} was blocked by the kicked-up mat!",move.name)) - target.damageState.protected = true - @battle.successStates[user.index].protected = true - return false end end # Magic Coat/Magic Bounce diff --git a/Data/Scripts/011_Battle/001_Battler/010_Battler_UseMove_TriggerEffects.rb b/Data/Scripts/011_Battle/001_Battler/010_Battler_UseMove_TriggerEffects.rb index e6f729bc8..bc41b367c 100644 --- a/Data/Scripts/011_Battle/001_Battler/010_Battler_UseMove_TriggerEffects.rb +++ b/Data/Scripts/011_Battle/001_Battler/010_Battler_UseMove_TriggerEffects.rb @@ -10,6 +10,26 @@ class PokeBattle_Battler BattleHandlers.triggerTargetAbilityOnHit(target.ability,user,target,move,@battle) user.pbItemHPHealCheck if user.hp 0 && !target.effects[PBEffects::Transform] + oldHP = user.hp + # NOTE: Strictly speaking, an attack animation should be shown (the + # target Cramorant attacking the user) and the ability splash + # shouldn't be shown. + @battle.pbShowAbilitySplash(target) + if user.takesIndirectDamage?(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) + @battle.scene.pbDamageAnimation(user) + user.pbReduceHP(user.totalhp / 4, false) + end + if target.form == 1 # Gulping Form + user.pbLowerStatStageByAbility(:DEFENSE, 1, target, false) + elsif target.form == 2 # Gorging Form + target.pbParalyze(user) if target.pbCanParalyze?(user, false) + end + @battle.pbHideAbilitySplash(target) + user.pbItemHPHealCheck if user.hp < oldHP + end # User's ability if user.abilityActive?(true) BattleHandlers.triggerUserAbilityOnHit(user.ability,user,target,move,@battle) @@ -109,6 +129,15 @@ class PokeBattle_Battler end end end + # Cramorant = Gulp Missile + if !user.fainted? && !user.effects[PBEffects::Transform] && + user.isSpecies?(:CRAMORANT) && user.ability == :GULPMISSILE && user.form == 0 + if !@battle.pbAllFainted?(user.idxOpposingSide) && + ((move.id == :SURF && numHits > 0) || (move.id == :DIVE && move.chargingTurn)) + # NOTE: Intentionally no ability splash or message here. + user.pbChangeForm((user.hp > user.totalhp / 2) ? 1 : 2, nil) + end + end # Consume user's Gem if user.effects[PBEffects::GemConsumed] # NOTE: The consume animation and message for Gems are shown immediately diff --git a/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb b/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb index a9a1d43d0..19b90b916 100644 --- a/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb +++ b/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb @@ -427,6 +427,8 @@ end # Two turn move. #=============================================================================== class PokeBattle_TwoTurnMove < PokeBattle_Move + attr_reader :chargingTurn + def chargingTurnMove?; return true; end # user.effects[PBEffects::TwoTurnAttack] is set to the move's ID if this @@ -436,7 +438,7 @@ class PokeBattle_TwoTurnMove < PokeBattle_Move @powerHerb = false @chargingTurn = false # Assume damaging turn by default @damagingTurn = true - # 0 at start of charging turn, move's ID at start of damaging turn + # nil at start of charging turn, move's ID at start of damaging turn if !user.effects[PBEffects::TwoTurnAttack] @powerHerb = user.hasActiveItem?(:POWERHERB) @chargingTurn = true diff --git a/Data/Scripts/011_Battle/Gen 8 abilities.rb b/Data/Scripts/011_Battle/Gen 8 abilities.rb index e01757b91..e91c5a27b 100644 --- a/Data/Scripts/011_Battle/Gen 8 abilities.rb +++ b/Data/Scripts/011_Battle/Gen 8 abilities.rb @@ -329,11 +329,6 @@ BattleHandlers::EORWeatherAbility.add(:ICEFACE, #=============================================================================== -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. - 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 @@ -343,10 +338,6 @@ Gorilla Tactics Boosts bearer's Attack by 50%, but restricts bearer to one move (cf. Choice Band). Power boost stacks with Choice Band. -Unseen Fist -The bearer's moves will do damage with contact moves even if the target is -protected from it. (Does this mean it just bypasses the protection?) - Mirror Armor If a move/ability tries to lower the bearer's stat(s), the effect is reflected back at the causer.