More Gen 9 move effects

This commit is contained in:
Maruno17
2024-06-24 21:51:49 +01:00
parent 8e9417c3b7
commit ff2d8e5f55
21 changed files with 673 additions and 55 deletions

View File

@@ -111,6 +111,33 @@ class Battle::Move::MaxUserAttackLoseHalfOfTotalHP < Battle::Move
end
end
#===============================================================================
# Reduces the user's HP by half of max, and raises its Attack, Special Attack
# and Speed by 2 stages each. (Fillet Away)
#===============================================================================
class Battle::Move::RaiseUserAtkSpAtkSpeed2LoseHalfOfTotalHP < Battle::Move::MultiStatUpMove
def initialize(battle, move)
super
@statUp = [:ATTACK, 2, :SPECIAL_ATTACK, 2, :SPEED, 2]
end
def pbMoveFailed?(user, targets)
hpLoss = [user.totalhp / 2, 1].max
if user.hp <= hpLoss
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return super
end
def pbEffectGeneral(user)
super
hpLoss = [user.totalhp / 2, 1].max
user.pbReduceHP(hpLoss, false, false)
user.pbItemHPHealCheck
end
end
#===============================================================================
# Increases the user's Defense by 1 stage. (Harden, Steel Wing, Withdraw)
#===============================================================================
@@ -453,16 +480,14 @@ class Battle::Move::LowerUserDefSpDef1RaiseUserAtkSpAtkSpd2 < Battle::Move
def pbMoveFailed?(user, targets)
failed = true
(@statUp.length / 2).times do |i|
if user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
failed = false
break
end
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
failed = false
break
end
(@statDown.length / 2).times do |i|
if user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
failed = false
break
end
next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
failed = false
break
end
if failed
@battle.pbDisplay(_INTL("{1}'s stats can't be changed further!", user.pbThis))
@@ -499,6 +524,86 @@ class Battle::Move::RaiseUserAtkSpd1 < Battle::Move::MultiStatUpMove
end
end
#===============================================================================
# Removes trapping moves, entry hazards and Leech Seed on user/user's side.
# Poisons the target. (Mortal Spin)
#===============================================================================
class Battle::Move::RaiseUserAtkSpd1RemoveEntryHazardsAndSubstitutes < Battle::Move::RaiseUserAtkSpd1
def pbMoveFailed?(user, targets)
return false if damagingMove?
failed = true
(@statUp.length / 2).times do |i|
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
failed = false
break
end
@battle.allBattlers.each do |b|
failed = false if b.effects[PBEffects::Substitute] > 0
end
failed = false if user.pbOwnSide.effects[PBEffects::StealthRock] ||
user.pbOwnSide.effects[PBEffects::Spikes] > 0 ||
user.pbOwnSide.effects[PBEffects::ToxicSpikes] > 0 ||
user.pbOwnSide.effects[PBEffects::StickyWeb]
if failed
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
something_tidied = false
@battle.allBattlers.each do |b|
next if b.effects[PBEffects::Substitute] == 0
b.effects[PBEffects::Substitute] = 0
something_tidied = true
@battle.pbDisplay(_INTL("{1}'s substitute faded!", b.pbThis))
end
if user.pbOwnSide.effects[PBEffects::StealthRock]
user.pbOwnSide.effects[PBEffects::StealthRock] = false
something_tidied = true
@battle.pbDisplay(_INTL("The pointed stones disappeared from around {1}!", user.pbTeam(true)))
end
if user.pbOpposingSide.effects[PBEffects::StealthRock]
user.pbOpposingSide.effects[PBEffects::StealthRock] = false
something_tidied = true
@battle.pbDisplay(_INTL("The pointed stones disappeared from around {1}!", user.pbOpposingTeam(true)))
end
if user.pbOwnSide.effects[PBEffects::Spikes] > 0
user.pbOwnSide.effects[PBEffects::Spikes] = 0
something_tidied = true
@battle.pbDisplay(_INTL("The spikes disappeared from the ground around {1}!", user.pbTeam(true)))
end
if user.pbOpposingSide.effects[PBEffects::Spikes] > 0
user.pbOpposingSide.effects[PBEffects::Spikes] = 0
something_tidied = true
@battle.pbDisplay(_INTL("The spikes disappeared from the ground around {1}!", user.pbpbOpposingSideTeam(true)))
end
if user.pbOwnSide.effects[PBEffects::ToxicSpikes] > 0
user.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
something_tidied = true
@battle.pbDisplay(_INTL("The poison spikes disappeared from the ground around {1}!", user.pbTeam(true)))
end
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes] > 0
user.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
something_tidied = true
@battle.pbDisplay(_INTL("The poison spikes disappeared from the ground around {1}!", user.pbpbOpposingSideTeam(true)))
end
if user.pbOwnSide.effects[PBEffects::StickyWeb]
user.pbOwnSide.effects[PBEffects::StickyWeb] = false
something_tidied = true
@battle.pbDisplay(_INTL("The sticky webs disappeared from the ground around {1}!", user.pbTeam(true)))
end
if user.pbOpposingSide.effects[PBEffects::StickyWeb]
user.pbOpposingSide.effects[PBEffects::StickyWeb] = false
something_tidied = true
@battle.pbDisplay(_INTL("The sticky webs disappeared from the ground around {1}!", user.pbpbOpposingSideTeam(true)))
end
@battle.pbDisplay(_INTL("Tidying up complete!")) if something_tidied
super
end
end
#===============================================================================
# Increases the user's Speed by 2 stages, and its Attack by 1 stage. (Shift Gear)
#===============================================================================
@@ -540,6 +645,37 @@ class Battle::Move::RaiseUserSpAtkSpDef1 < Battle::Move::MultiStatUpMove
end
end
#===============================================================================
# Increases the user's Sp. Attack and Sp. Defense by 1 stage each. Cures the
# user's status condition. (Take Heart)
#===============================================================================
class Battle::Move::RaiseUserSpAtkSpDef1CureStatus < Battle::Move::MultiStatUpMove
def initialize(battle, move)
super
@statUp = [:SPECIAL_ATTACK, 1, :SPECIAL_DEFENSE, 1]
end
def pbMoveFailed?(user, targets)
failed = true
(@statUp.length / 2).times do |i|
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
failed = false
break
end
failed = false if user.pbHasAnyStatus?
if failed
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
super
user.pbCureStatus
end
end
#===============================================================================
# Increases the user's Sp. Attack, Sp. Defense and Speed by 1 stage each.
# (Quiver Dance)
@@ -682,6 +818,21 @@ class Battle::Move::LowerUserSpAtk1 < Battle::Move::StatDownMove
end
end
#===============================================================================
# Decreases the user's Special Attack by 1 stage. Scatters coins that the player
# picks up after winning the battle. (Make It Rain)
#===============================================================================
class Battle::Move::LowerUserSpAtk1 < Battle::Move::LowerUserSpAtk1
def pbEffectWhenDealingDamage(user, target)
return if @stats_lowered
if user.pbOwnedByPlayer?
@battle.field.effects[PBEffects::PayDay] += 5 * user.level
end
@battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
super
end
end
#===============================================================================
# Decreases the user's Special Attack by 2 stages.
#===============================================================================
@@ -744,7 +895,7 @@ end
#===============================================================================
# Decreases the user's Defense and Special Defense by 1 stage each.
# (Close Combat, Dragon Ascent)
# (Armor Cannon, Close Combat, Dragon Ascent, Headlong Rush)
#===============================================================================
class Battle::Move::LowerUserDefSpDef1 < Battle::Move::StatDownMove
def initialize(battle, move)
@@ -801,6 +952,62 @@ class Battle::Move::RaiseTargetAttack1 < Battle::Move
end
end
#===============================================================================
# Increases the target's Attack by 2 stages. Decreases the target's Defense by 2
# stages. (Spicy Extract)
#===============================================================================
class Battle::Move::RaiseTargetAtk2LowerTargetDef2 < Battle::Move
attr_reader :statUp, :statDown
def canMagicCoat?; return true; end
def initialize(battle, move)
super
@statUp = [:ATTACK, 2]
@statDown = [:DEFENSE, 2]
end
def pbMoveFailed?(user, targets)
failed = true
targets.each do |b|
(@statUp.length / 2).times do |i|
next if !target.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
failed = false
break
end
break if !failed
(@statDown.length / 2).times do |i|
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
failed = false
break
end
break if !failed
end
if failed
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectAgainstTarget(user, target)
showAnim = true
(@statDown.length / 2).times do |i|
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if target.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim)
showAnim = false
end
end
showAnim = true
(@statUp.length / 2).times do |i|
next if !target.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
if target.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim)
showAnim = false
end
end
end
end
#===============================================================================
# Increases the target's Attack by 2 stages. Confuses the target. (Swagger)
#===============================================================================
@@ -990,6 +1197,27 @@ class Battle::Move::LowerTargetDefense1PowersUpInGravity < Battle::Move::LowerTa
end
end
#===============================================================================
# 50% chance to decreases the target's Defense by 1 stage. 30% chance to make
# the target flinch. (Triple Arrows)
#===============================================================================
class Battle::Move::LowerTargetDefense1FlinchTarget < Battle::Move::TargetStatDownMove
def flinchingMove?; return true; end
def initialize(battle, move)
super
@statDown = [:DEFENSE, 1]
end
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
stat_chance = pbAdditionalEffectChance(user, target, 50)
super if stat_chance > 0 && @battle.pbRandom(100) < stat_chance
flinch_chance = pbAdditionalEffectChance(user, target, 30)
target.pbFlinch(user) if flinch_chance > 0 && @battle.pbRandom(100) < flinch_chance
end
end
#===============================================================================
# Decreases the target's Defense by 2 stages. (Screech)
#===============================================================================