From 43900dca8c49a6f53408e1afe5444655e280f0f9 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Mon, 21 Jun 2021 22:17:55 +0100 Subject: [PATCH] Added some Gen 8 move effects --- .../001_Battler/001_PokeBattle_Battler.rb | 6 + .../002_Move/005_Move_Effects_000-07F.rb | 2 +- .../002_Move/007_Move_Effects_100-17F.rb | 27 +- .../002_Move/008_Move_Effects_Gen8.rb | 385 +++++++++++++++--- 4 files changed, 355 insertions(+), 65 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 d1f8ade53..33bf48f8b 100644 --- a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -457,6 +457,12 @@ class PokeBattle_Battler return false end + def pbGetMoveWithID(move_id) + return nil if !move_id + eachMove { |m| return m if m.id == move_id } + return nil + end + def hasMoldBreaker? return hasActiveAbility?([:MOLDBREAKER, :TERAVOLT, :TURBOBLAZE]) end diff --git a/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb b/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb index 791c2b54e..a6b946b23 100644 --- a/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb +++ b/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb @@ -409,7 +409,7 @@ class PokeBattle_Move_019 < PokeBattle_Move failed = false break end - if !failed + if failed @battle.pbParty(user.index).each do |pkmn| next if !pkmn || !pkmn.able? || pkmn.status == :NONE failed = false 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 a6b515ae8..8ea217e87 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 @@ -324,30 +324,21 @@ end class PokeBattle_Move_10E < PokeBattle_Move def ignoresSubstitute?(user); return true; end - def pbFailsAgainstTarget?(user,target) - failed = true - if target.lastRegularMoveUsed - target.eachMove do |m| - next if m.id!=target.lastRegularMoveUsed || m.pp==0 || m.total_pp<=0 - failed = false; break - end - end - if failed + def pbFailsAgainstTarget?(user, target) + last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed) + if !last_move || last_move.pp == 0 || last_move.total_pp <= 0 @battle.pbDisplay(_INTL("But it failed!")) return true end return false end - def pbEffectAgainstTarget(user,target) - target.eachMove do |m| - next if m.id!=target.lastRegularMoveUsed - reduction = [4,m.pp].min - target.pbSetPP(m,m.pp-reduction) - @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!", - target.pbThis(true),m.name,reduction)) - break - end + def pbEffectAgainstTarget(user, target) + last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed) + reduction = [4, last_move.pp].min + target.pbSetPP(last_move, last_move.pp - reduction) + @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!", + target.pbThis(true), last_move.name, reduction)) end end 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 40c6c2217..0de1f5e08 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 @@ -13,6 +13,7 @@ Fiery Wrath - 00F Strange Steam - 013 Breaking Swipe - 042 Thunderous Kick - 043 +Drum Beating - 044 Skitter Smack - 045 Spirit Break - 045 Apple Acid - 046 @@ -49,7 +50,19 @@ end # form (Electric if Full Belly, Dark if Hangry). Fails if the user is not # Morpeko (works if transformed into Morpeko). (Aura Wheel) #=============================================================================== -class PokeBattle_Move_178 < PokeBattle_UnimplementedMove +class PokeBattle_Move_178 < PokeBattle_Move_01F + def pbMoveFailed?(user, targets) + if !user.isSpecies?(:MORPEKO) && user.effects[PBEffects::TransformSpecies] != :MORPEKO + @battle.pbDisplay(_INTL("But {1} can't use the move!", user.pbThis)) + return true + end + return false + end + + def pbBaseType(user) + return :DARK if user.form == 1 && GameData::Type.exists?(:DARK) + return @type + end end #=============================================================================== @@ -65,11 +78,35 @@ class PokeBattle_Move_179 < PokeBattle_UnimplementedMove end #=============================================================================== -# Reduces the user's HP by a third of its total HP, and increases the user's -# Attack, Defense, Speed, Special Attack and Special Defense by 1 stage each. -# Fails if it can't do both effects. (Clangorous Soul) +# Increases the user's Attack, Defense, Special Attack, Special Defense and +# Speed by 1 stage each, and reduces the user's HP by a third of its total HP. +# Fails if it can't do either effect. (Clangorous Soul) #=============================================================================== -class PokeBattle_Move_17A < PokeBattle_UnimplementedMove +class PokeBattle_Move_17A < PokeBattle_MultiStatUpMove + def initialize(battle, move) + super + @statUp = [ + :ATTACK, 1, + :DEFENSE, 1, + :SPECIAL_ATTACK, 1, + :SPECIAL_DEFENSE, 1, + :SPEED, 1 + ] + end + + def pbMoveFailed?(user, targets) + if user.hp <= [user.totalhp / 3, 1].max + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return super + end + + def pbEffectGeneral(user) + super + user.pbReduceHP([user.totalhp / 3, 1].max, false) + user.pbItemHPHealCheck + end end #=============================================================================== @@ -90,13 +127,11 @@ end # Decreases the target's Defense by 1 stage. Power is doubled if Gravity is in # effect. (Grav Apple) #=============================================================================== -class PokeBattle_Move_17D < PokeBattle_UnimplementedMove -end - -#=============================================================================== -# Decreases the target's Speed by 1 stage. (Drum Beating) -#=============================================================================== -class PokeBattle_Move_17E < PokeBattle_UnimplementedMove +class PokeBattle_Move_17D < PokeBattle_Move_043 + def pbBaseDamage(baseDmg, user, target) + baseDmg *= 2 if @battle.field.effects[PBEffects::Gravity] > 0 + return baseDmg + end end #=============================================================================== @@ -104,20 +139,38 @@ end # Fire moves used against the target (this effect does not stack). Fails if # neither of these effects can be applied. (Tar Shot) #=============================================================================== -class PokeBattle_Move_17F < PokeBattle_UnimplementedMove +class PokeBattle_Move_17E < PokeBattle_UnimplementedMove end #=============================================================================== # The target's types become Psychic. Fails if the target has the ability # Multitype/RKS System or has a substitute. (Magic Powder) #=============================================================================== -class PokeBattle_Move_180 < PokeBattle_UnimplementedMove +class PokeBattle_Move_17F < PokeBattle_Move + def pbFailsAgainstTarget?(user, target) + if !target.canChangeType? || !GameData::Type.exists?(:PSYCHIC) || + !target.pbHasOtherType?(:PSYCHIC) || !target.affectedByPowder? + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return false + end + + def pbEffectAgainstTarget(user, target) + target.pbChangeTypes(:PSYCHIC) + typeName = GameData::Type.get(:PSYCHIC).name + @battle.pbDisplay(_INTL("{1} transformed into the {2} type!", target.pbThis, typeName)) + end end #=============================================================================== # Power is doubled if Electric Terrain applies. (Rising Voltage) #=============================================================================== -class PokeBattle_Move_181 < PokeBattle_UnimplementedMove +class PokeBattle_Move_180 < PokeBattle_Move + def pbBaseDamage(baseDmg, user, target) + baseDmg *= 2 if @battle.field.terrain == :Electric + return baseDmg + end end #=============================================================================== @@ -125,33 +178,86 @@ end # 1.5 (in addition to Psychic Terrain's multiplier) and it targets all opposing # Pokémon. (Expanding Force) #=============================================================================== -class PokeBattle_Move_182 < PokeBattle_UnimplementedMove +class PokeBattle_Move_181 < PokeBattle_Move + def pbTarget(user) + if @battle.field.terrain == :Psychic && user.affectedByTerrain? + return GameData::Target.get(:AllNearFoes) + end + return super + end + + def pbBaseDamage(baseDmg, user, target) + if @battle.field.terrain == :Psychic && user.affectedByTerrain? + baseDmg = baseDmg * 3 / 2 + end + return baseDmg + end end #=============================================================================== # Power is doubled if a terrain applies and user is grounded; also, this move's # type and animation depends on the terrain. (Terrain Pulse) #=============================================================================== -class PokeBattle_Move_183 < PokeBattle_UnimplementedMove +class PokeBattle_Move_182 < PokeBattle_Move + def pbBaseDamage(baseDmg, user, target) + baseDmg *= 2 if @battle.field.terrain != :None && user.affectedByTerrain? + return baseDmg + end + + def pbBaseType(user) + ret = :NORMAL + case @battle.field.terrain + when :Electric + ret = :ELECTRIC if GameData::Type.exists?(:ELECTRIC) + when :Grassy + ret = :GRASS if GameData::Type.exists?(:GRASS) + when :Misty + ret = :FAIRY if GameData::Type.exists?(:FAIRY) + when :Psychic + ret = :PSYCHIC if GameData::Type.exists?(:PSYCHIC) + end + return ret + end + + def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true) + t = pbBaseType(user) + hitNum = 1 if t == :ELECTRIC # Type-specific anims + hitNum = 2 if t == :GRASS + hitNum = 3 if t == :FAIRY + hitNum = 4 if t == :PSYCHIC + super + end end #=============================================================================== # Power is doubled if the user moves before the target, or if the target # switched in this round. (Bolt Beak, Fishious Rend) #=============================================================================== -class PokeBattle_Move_184 < PokeBattle_UnimplementedMove +class PokeBattle_Move_183 < PokeBattle_Move + def pbBaseDamage(baseDmg, user, target) + if @battle.choices[target.index][0] == :None || # Switched in + ([:UseMove, :Shift].include?(@battle.choices[target.index][0]) && !target.movedThisRound?) + baseDmg *= 2 + end + return baseDmg + end end #=============================================================================== # Power is doubled if any of the user's stats were lowered this round. (Lash Out) #=============================================================================== -class PokeBattle_Move_185 < PokeBattle_UnimplementedMove +class PokeBattle_Move_184 < PokeBattle_UnimplementedMove end #=============================================================================== # If Grassy Terrain applies, priority is increased by 1. (Grassy Glide) #=============================================================================== -class PokeBattle_Move_186 < PokeBattle_UnimplementedMove +class PokeBattle_Move_185 < PokeBattle_Move + def priority + ret = super + ret += 1 if @battle.field.terrain == :Electric + return ret + end end #=============================================================================== @@ -160,13 +266,13 @@ end # Defense of the Pokémon using that move by 2 stages. Contributes to Protect's # counter. (Very similar to King's Shield.) (Obstruct) #=============================================================================== -class PokeBattle_Move_187 < PokeBattle_UnimplementedMove +class PokeBattle_Move_186 < PokeBattle_UnimplementedMove end #=============================================================================== # Unaffected by moves and abilities that would redirect this move. (Snipe Shot) #=============================================================================== -class PokeBattle_Move_188 < PokeBattle_UnimplementedMove +class PokeBattle_Move_187 < PokeBattle_UnimplementedMove end #=============================================================================== @@ -186,50 +292,130 @@ end # All Pokémon hit by this move will apply their Pressure ability to it. # (Dragon Darts) #=============================================================================== -class PokeBattle_Move_189 < PokeBattle_UnimplementedMove +class PokeBattle_Move_188 < PokeBattle_UnimplementedMove end #=============================================================================== # Hits 3 times in a row. If each hit could be a critical hit, it will definitely # be a critical hit. (Surging Strikes) #=============================================================================== -class PokeBattle_Move_18A < PokeBattle_UnimplementedMove +class PokeBattle_Move_189 < PokeBattle_Move + def multiHitMove?; return true; end + def pbNumHits(user, targets); return 3; end + def pbCritialOverride(user, target); return 1; end end #=============================================================================== # Hits 2-5 times in a row. If the move does not fail, increases the user's Speed # by 1 stage and decreases the user's Defense by 1 stage. (Scale Shot) #=============================================================================== -class PokeBattle_Move_18B < PokeBattle_UnimplementedMove +class PokeBattle_Move_18A < PokeBattle_UnimplementedMove end #=============================================================================== # Two-turn attack. On the first turn, increases the user's Special Attack by 1 -# stage. On the second turn, does damage. This attack is only considered to have -# been used after the second turn. (Meteor Beam) +# stage. On the second turn, does damage. (Meteor Beam) #=============================================================================== -class PokeBattle_Move_18C < PokeBattle_UnimplementedMove +class PokeBattle_Move_18B < PokeBattle_TwoTurnMove + def pbChargingTurnMessage(user, targets) + @battle.pbDisplay(_INTL("{1} is overflowing with space power!", user.pbThis)) + end + + def pbChargingTurnEffect(user, target) + if user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self) + user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user) + end + end end #=============================================================================== -# The user and its allies gain 25% of their total HP. (Works the same as -# Aromatherapy.) (Life Dew) +# The user and its allies gain 25% of their total HP. (Life Dew) #=============================================================================== -class PokeBattle_Move_18D < PokeBattle_UnimplementedMove +class PokeBattle_Move_18C < PokeBattle_Move + def healingMove?; return true; end + + def pbMoveFailed?(user, targets) + failed = true + @battle.eachSameSideBattler(user) do |b| + next if !b.canHeal? + failed = false + break + end + if failed + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return false + end + + def pbFailsAgainstTarget?(user, target) + return !target.canHeal? + end + + def pbEffectAgainstTarget(user, target) + target.pbRecoverHP(target.totalhp / 4) + @battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis)) + end end #=============================================================================== # The user and its allies gain 25% of their total HP and are cured of their -# permanent status problems. (Works the same as Aromatherapy.) (Jungle Healing) +# permanent status problems. (Jungle Healing) #=============================================================================== -class PokeBattle_Move_18E < PokeBattle_UnimplementedMove +class PokeBattle_Move_18D < PokeBattle_Move + def healingMove?; return true; end + + def pbMoveFailed?(user, targets) + failed = true + @battle.eachSameSideBattler(user) do |b| + next if b.status == :NONE && !b.canHeal? + failed = false + break + end + if failed + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return false + end + + def pbFailsAgainstTarget?(user, target) + return target.status == :NONE && !target.canHeal? + end + + def pbEffectAgainstTarget(user, target) + if target.canHeal? + target.pbRecoverHP(target.totalhp / 4) + @battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis)) + end + if target.status != :NONE + old_status = target.status + target.pbCureStatus(false) + case old_status + when :SLEEP + @battle.pbDisplay(_INTL("{1} was woken from sleep.", target.pbThis)) + when :POISON + @battle.pbDisplay(_INTL("{1} was cured of its poisoning.", target.pbThis)) + when :BURN + @battle.pbDisplay(_INTL("{1}'s burn was healed.", target.pbThis)) + when :PARALYSIS + @battle.pbDisplay(_INTL("{1} was cured of paralysis.", target.pbThis)) + when :FROZEN + @battle.pbDisplay(_INTL("{1} was thawed out.", target.pbThis)) + end + end + end end #=============================================================================== # User faints. If Misty Terrain applies, base power is multiplied by 1.5. # (Misty Explosion) #=============================================================================== -class PokeBattle_Move_18F < PokeBattle_UnimplementedMove +class PokeBattle_Move_18E < PokeBattle_Move_0E0 + def pbBaseDamage(baseDmg, user, target) + baseDmg = baseDmg * 3 / 2 if @battle.field.terrain == :Misty + return baseDmg + end end #=============================================================================== @@ -237,7 +423,7 @@ end # target's Defense and Special Defense are lowered by 1 stage each. (Does this # only apply while the user remains in battle?) (Octolock) #=============================================================================== -class PokeBattle_Move_190 < PokeBattle_UnimplementedMove +class PokeBattle_Move_18F < PokeBattle_UnimplementedMove end #=============================================================================== @@ -245,7 +431,7 @@ end # isn't applied if either Pokémon is already prevented from switching out or # fleeing. (Jaw Lock) #=============================================================================== -class PokeBattle_Move_191 < PokeBattle_UnimplementedMove +class PokeBattle_Move_190 < PokeBattle_UnimplementedMove end #=============================================================================== @@ -254,7 +440,7 @@ end # Room apply. Fails if the user is not holding a berry. This move cannot be # chosen to be used if the user is not holding a berry. (Stuff Cheeks) #=============================================================================== -class PokeBattle_Move_192 < PokeBattle_UnimplementedMove +class PokeBattle_Move_191 < PokeBattle_UnimplementedMove end #=============================================================================== @@ -266,7 +452,7 @@ end # and they will not consume their berry (how does this interact with the move # failing?). (Teatime) #=============================================================================== -class PokeBattle_Move_193 < PokeBattle_UnimplementedMove +class PokeBattle_Move_192 < PokeBattle_UnimplementedMove end #=============================================================================== @@ -275,49 +461,156 @@ end # item, the item is unlosable, the target has Sticky Hold, or the target is # behind a substitute. (Corrosive Gas) #=============================================================================== -class PokeBattle_Move_194 < PokeBattle_UnimplementedMove +class PokeBattle_Move_193 < PokeBattle_UnimplementedMove end #=============================================================================== # The user takes recoil damage equal to 1/2 of its total HP (rounded up, min. 1 # damage). (Steel Beam) #=============================================================================== -class PokeBattle_Move_195 < PokeBattle_UnimplementedMove +class PokeBattle_Move_194 < PokeBattle_RecoilMove + def pbRecoilDamage(user, target) + return (user.totalhp / 2.0).ceil + end end #=============================================================================== # Decreases the PP of the last attack used by the target by 3 (or as much as # possible). (Eerie Spell) #=============================================================================== -class PokeBattle_Move_196 < PokeBattle_UnimplementedMove +class PokeBattle_Move_195 < PokeBattle_Move + def pbFailsAgainstTarget?(user, target) + last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed) + if !last_move || last_move.pp == 0 || last_move.total_pp <= 0 + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return false + end + + def pbEffectAgainstTarget(user, target) + last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed) + reduction = [3, last_move.pp].min + target.pbSetPP(last_move, last_move.pp - reduction) + @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!", + target.pbThis(true), last_move.name, reduction)) + end end #=============================================================================== # Fails if the target is not holding an item, or if the target is affected by # Magic Room/Klutz. (Poltergeist) #=============================================================================== -class PokeBattle_Move_197 < PokeBattle_UnimplementedMove +class PokeBattle_Move_196 < PokeBattle_Move + def pbFailsAgainstTarget?(user, target) + if !target.item || !target.itemActive? + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + @battle.pbDisplay(_INTL("{1} is about to be attacked by its {2}!", target.pbThis, target.itemName)) + return false + end end #=============================================================================== # The user's Defense (and its Defense stat stages) are used instead of the # user's Attack (and Attack stat stages) to calculate damage. All other effects -# are applied normally, applying the user's Attack modofiers and not the user's +# are applied normally, applying the user's Attack modifiers and not the user's # Defence modifiers. (Body Press) #=============================================================================== -class PokeBattle_Move_198 < PokeBattle_UnimplementedMove +class PokeBattle_Move_197 < PokeBattle_Move + def pbGetAttackStats(user, target) + return user.defense, user.stages[:DEFENSE] + 6 + end end #=============================================================================== # All effects that apply to one side of the field are swapped to the opposite # side. (Court Change) #=============================================================================== -class PokeBattle_Move_199 < PokeBattle_UnimplementedMove +class PokeBattle_Move_198 < PokeBattle_Move + def initialize(battle, move) + super + @number_effects = [ + PBEffects::AuroraVeil, + PBEffects::LightScreen, + PBEffects::Mist, + PBEffects::Rainbow, + PBEffects::Reflect, + PBEffects::Safeguard, + PBEffects::SeaOfFire, + PBEffects::Spikes, + PBEffects::Swamp, + PBEffects::Tailwind, + PBEffects::ToxicSpikes + ] + @boolean_effects = [ + PBEffects::StealthRock, + PBEffects::StickyWeb + ] + end + + def pbMoveFailed?(user, targets) + has_effect = false + for side in 0...2 + effects = @battle.sides[side].effects + @number_effects.each do |e| + next if effects[e] == 0 + has_effect = true + break + end + break if has_effect + @boolean_effects.each do |e| + next if !effects[e] + has_effect = true + break + end + break if has_effect + end + if !has_effect + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return false + end + + def pbEffectGeneral(user) + side0 = @battle.sides[0] + side1 = @battle.sides[1] + @number_effects.each do |e| + side0.effects[e], side1.effects[e] = side1.effects[e], side0.effects[e] + end + @boolean_effects.each do |e| + side0.effects[e], side1.effects[e] = side1.effects[e], side0.effects[e] + end + @battle.pbDisplay(_INTL("{1} swapped the battle effects affecting each side of the field!", user.pbThis)) + end end #=============================================================================== # Removes the current terrain. Fails if there is no terrain in effect. # (Steel Roller) #=============================================================================== -class PokeBattle_Move_19A < PokeBattle_UnimplementedMove +class PokeBattle_Move_199 < PokeBattle_Move + def pbMoveFailed?(user, targets) + if @battle.field.terrain == :None + @battle.pbDisplay(_INTL("But it failed!")) + return true + end + return false + end + + def pbEffectGeneral(user) + case @battle.field.terrain + when :Electric + @battle.pbDisplay(_INTL("The electricity disappeared from the battlefield.")) + when :Grassy + @battle.pbDisplay(_INTL("The grass disappeared from the battlefield.")) + when :Misty + @battle.pbDisplay(_INTL("The mist disappeared from the battlefield.")) + when :Psychic + @battle.pbDisplay(_INTL("The weirdness disappeared from the battlefield.")) + end + @battle.field.terrain = :None + end end