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

@@ -717,7 +717,12 @@ class Battle
# Reset/count down battler-specific effects (no messages)
allBattlers.each do |battler|
battler.effects[PBEffects::BanefulBunker] = false
battler.effects[PBEffects::Charge] -= 1 if battler.effects[PBEffects::Charge] > 0
battler.effects[PBEffects::BurningBulwark] = false
if Settings::MECHANICS_GENERATION >= 9
battler.effects[PBEffects::Charge] -= 1 if battler.effects[PBEffects::Charge] > 1
else
battler.effects[PBEffects::Charge] -= 1 if battler.effects[PBEffects::Charge] > 0
end
battler.effects[PBEffects::Counter] = -1
battler.effects[PBEffects::CounterTarget] = -1
battler.effects[PBEffects::Electrify] = false
@@ -746,6 +751,7 @@ class Battle
battler.effects[PBEffects::Protect] = false
battler.effects[PBEffects::RagePowder] = false
battler.effects[PBEffects::Roost] = false
battler.effects[PBEffects::SilkTrap] = false
battler.effects[PBEffects::Snatch] = 0
battler.effects[PBEffects::SpikyShield] = false
battler.effects[PBEffects::Spotlight] = 0

View File

@@ -66,7 +66,7 @@ class Battle::Battler
def form=(value)
@form = value
@pokemon.form = value if @pokemon
@pokemon.form = value if @pokemon && !@effects[PBEffects::Transform]
end
def ability
@@ -308,15 +308,17 @@ class Battle::Battler
# same type more than once, and should not include any invalid types.
def pbTypes(withExtraType = false)
ret = @types.uniq
# Burn Up erases the Fire-type.
# Burn Up erases the Fire-type
ret.delete(:FIRE) if @effects[PBEffects::BurnUp]
# Roost erases the Flying-type. If there are no types left, adds the Normal-
# type.
# Double Shock erases the Electric-type
ret.delete(:ELECTRIC) if @effects[PBEffects::DoubleShock]
# Roost erases the Flying-type (if there are no types left, adds the Normal-
# type)
if @effects[PBEffects::Roost]
ret.delete(:FLYING)
ret.push(:NORMAL) if ret.length == 0
end
# Add the third type specially.
# Add the third type specially
if withExtraType && @effects[PBEffects::ExtraType] && !ret.include?(@effects[PBEffects::ExtraType])
ret.push(@effects[PBEffects::ExtraType])
end

View File

@@ -152,6 +152,7 @@ class Battle::Battler
b.effects[PBEffects::Attract] = -1 if b.effects[PBEffects::Attract] == @index
end
@effects[PBEffects::BanefulBunker] = false
@effects[PBEffects::BurningBulwark] = false
@effects[PBEffects::BeakBlast] = false
@effects[PBEffects::Bide] = 0
@effects[PBEffects::BideDamage] = 0
@@ -168,6 +169,7 @@ class Battle::Battler
@effects[PBEffects::DestinyBondTarget] = -1
@effects[PBEffects::Disable] = 0
@effects[PBEffects::DisableMove] = nil
@effects[PBEffects::DoubleShock] = false
@effects[PBEffects::Electrify] = false
@effects[PBEffects::Encore] = 0
@effects[PBEffects::EncoreMove] = nil
@@ -243,6 +245,7 @@ class Battle::Battler
@effects[PBEffects::RagePowder] = false
@effects[PBEffects::Rollout] = 0
@effects[PBEffects::Roost] = false
@effects[PBEffects::SilkTrap] = false
@effects[PBEffects::SkyDrop] = -1
@battle.allBattlers.each do |b| # Other battlers no longer Sky Dropped by self
b.effects[PBEffects::SkyDrop] = -1 if b.effects[PBEffects::SkyDrop] == @index

View File

@@ -135,6 +135,7 @@ class Battle::Battler
@effects[PBEffects::ExtraType] = nil
end
@effects[PBEffects::BurnUp] = false
@effects[PBEffects::DoubleShock] = false
@effects[PBEffects::Roost] = false
end
@@ -142,6 +143,7 @@ class Battle::Battler
@types = @pokemon.types
@effects[PBEffects::ExtraType] = nil
@effects[PBEffects::BurnUp] = false
@effects[PBEffects::DoubleShock] = false
@effects[PBEffects::Roost] = false
end
@@ -293,6 +295,7 @@ class Battle::Battler
oldAbil = @ability_id
@effects[PBEffects::Transform] = true
@effects[PBEffects::TransformSpecies] = target.species
self.form = target.form
pbChangeTypes(target)
self.ability = target.ability
@attack = target.attack

View File

@@ -106,7 +106,9 @@ class Battle::Battler
end
end
@effects[PBEffects::BeakBlast] = false
@effects[PBEffects::Charge] = 0 if @effects[PBEffects::Charge] == 1
if Settings::MECHANICS_GENERATION < 9 || @lastMoveUsedType == :ELECTRIC
@effects[PBEffects::Charge] = 0 if @effects[PBEffects::Charge] == 1
end
@effects[PBEffects::GemConsumed] = nil
@effects[PBEffects::ShellTrap] = false
@battle.allBattlers.each { |b| b.pbContinualAbilityChecks } # Trace, end primordial weathers

View File

@@ -369,6 +369,14 @@ class Battle::Battler
@battle.successStates[user.index].protected = true
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)) if show_message
target.damageState.protected = true
@battle.successStates[user.index].protected = true
return false
end
# King's Shield
if target.effects[PBEffects::KingsShield] && move.damagingMove?
if show_message
@@ -383,6 +391,34 @@ class Battle::Battler
end
return false
end
# Obstruct
if target.effects[PBEffects::Obstruct] && move.damagingMove?
if show_message
@battle.pbCommonAnimation("Obstruct", target)
@battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis))
end
target.damageState.protected = true
@battle.successStates[user.index].protected = true
if move.pbContactMove?(user) && user.affectedByContactEffect? &&
user.pbCanLowerStatStage?(:DEFENSE, target)
user.pbLowerStatStage(:DEFENSE, 2, target)
end
return false
end
# Silk Trap
if target.effects[PBEffects::SilkTrap] && move.damagingMove?
if show_message
@battle.pbCommonAnimation("SilkTrap", target)
@battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis))
end
target.damageState.protected = true
@battle.successStates[user.index].protected = true
if move.pbContactMove?(user) && user.affectedByContactEffect? &&
user.pbCanLowerStatStage?(:SPEED, target)
user.pbLowerStatStage(:SPEED, 1, target)
end
return false
end
# Spiky Shield
if target.effects[PBEffects::SpikyShield]
if show_message
@@ -413,28 +449,20 @@ class Battle::Battler
end
return false
end
# Obstruct
if target.effects[PBEffects::Obstruct] && move.damagingMove?
# Burning Bulwark
if target.effects[PBEffects::BurningBulwark]
if show_message
@battle.pbCommonAnimation("Obstruct", target)
@battle.pbCommonAnimation("BurningBulwark", target)
@battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis))
end
target.damageState.protected = true
@battle.successStates[user.index].protected = true
if move.pbContactMove?(user) && user.affectedByContactEffect? &&
user.pbCanLowerStatStage?(:DEFENSE, target)
user.pbLowerStatStage(:DEFENSE, 2, target)
user.pbCanBurn?(target, false)
user.pbBurn(target)
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)) if show_message
target.damageState.protected = true
@battle.successStates[user.index].protected = true
return false
end
end
end
# Magic Coat/Magic Bounce

View File

@@ -155,8 +155,14 @@ end
class Battle::Move::StatDownMove < Battle::Move
attr_reader :statDown
def pbOnStartUse(user, targets)
@stats_lowered = false
end
def pbEffectWhenDealingDamage(user, target)
return if @stats_lowered
return if @battle.pbAllFainted?(target.idxOwnSide)
@stats_lowered = true
showAnim = true
(@statDown.length / 2).times do |i|
next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self)

View File

@@ -208,12 +208,10 @@ class Battle::Move::FailsIfTargetActed < Battle::Move
end
#===============================================================================
# If attack misses, user takes crash damage of 1/2 of max HP.
# (High Jump Kick, Jump Kick)
# If attack misses, user takes crash damage of 1/2 of max HP. (Supercell Slam)
#===============================================================================
class Battle::Move::CrashDamageIfFailsUnusableInGravity < Battle::Move
def recoilMove?; return true; end
def unusableInGravity?; return true; end
class Battle::Move::CrashDamageIfFails < Battle::Move
def recoilMove?; return true; end
def pbCrashDamage(user)
return if !user.takesIndirectDamage?
@@ -225,6 +223,14 @@ class Battle::Move::CrashDamageIfFailsUnusableInGravity < Battle::Move
end
end
#===============================================================================
# If attack misses, user takes crash damage of 1/2 of max HP. Can't be used in
# gravity. (High Jump Kick, Jump Kick)
#===============================================================================
class Battle::Move::CrashDamageIfFailsUnusableInGravity < Battle::Move::CrashDamageIfFails
def unusableInGravity?; return true; end
end
#===============================================================================
# Starts sunny weather. (Sunny Day)
#===============================================================================
@@ -387,6 +393,7 @@ class Battle::Move::AddSpikesToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user, targets)
return false if damagingMove?
if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -395,6 +402,15 @@ class Battle::Move::AddSpikesToFoeSide < Battle::Move
end
def pbEffectGeneral(user)
return if damagingMove?
user.pbOpposingSide.effects[PBEffects::Spikes] += 1
@battle.pbDisplay(_INTL("Spikes were scattered all around {1}'s feet!",
user.pbOpposingTeam(true)))
end
def pbAdditionalEffect(user, target)
return if user.fainted?
return if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3
user.pbOpposingSide.effects[PBEffects::Spikes] += 1
@battle.pbDisplay(_INTL("Spikes were scattered all around {1}'s feet!",
user.pbOpposingTeam(true)))
@@ -409,6 +425,7 @@ class Battle::Move::AddToxicSpikesToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user, targets)
return false if damagingMove?
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes] >= 2
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -417,6 +434,15 @@ class Battle::Move::AddToxicSpikesToFoeSide < Battle::Move
end
def pbEffectGeneral(user)
return if damagingMove?
user.pbOpposingSide.effects[PBEffects::ToxicSpikes] += 1
@battle.pbDisplay(_INTL("Poison spikes were scattered all around {1}'s feet!",
user.pbOpposingTeam(true)))
end
def pbAdditionalEffect(user, target)
return if user.fainted?
return if user.pbOpposingSide.effects[PBEffects::ToxicSpikes] >= 2
user.pbOpposingSide.effects[PBEffects::ToxicSpikes] += 1
@battle.pbDisplay(_INTL("Poison spikes were scattered all around {1}'s feet!",
user.pbOpposingTeam(true)))
@@ -430,6 +456,7 @@ class Battle::Move::AddStealthRocksToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user, targets)
return false if damagingMove?
if user.pbOpposingSide.effects[PBEffects::StealthRock]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -438,6 +465,15 @@ class Battle::Move::AddStealthRocksToFoeSide < Battle::Move
end
def pbEffectGeneral(user)
return if damagingMove?
user.pbOpposingSide.effects[PBEffects::StealthRock] = true
@battle.pbDisplay(_INTL("Pointed stones float in the air around {1}!",
user.pbOpposingTeam(true)))
end
def pbAdditionalEffect(user, target)
return if user.fainted?
return if user.pbOpposingSide.effects[PBEffects::StealthRock]
user.pbOpposingSide.effects[PBEffects::StealthRock] = true
@battle.pbDisplay(_INTL("Pointed stones float in the air around {1}!",
user.pbOpposingTeam(true)))
@@ -451,6 +487,7 @@ class Battle::Move::AddStickyWebToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user, targets)
return false if damagingMove?
if user.pbOpposingSide.effects[PBEffects::StickyWeb]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -459,6 +496,15 @@ class Battle::Move::AddStickyWebToFoeSide < Battle::Move
end
def pbEffectGeneral(user)
return false if damagingMove?
user.pbOpposingSide.effects[PBEffects::StickyWeb] = true
@battle.pbDisplay(_INTL("A sticky web has been laid out beneath {1}'s feet!",
user.pbOpposingTeam(true)))
end
def pbAdditionalEffect(user, target)
return if user.fainted?
return if user.pbOpposingSide.effects[PBEffects::StickyWeb]
user.pbOpposingSide.effects[PBEffects::StickyWeb] = true
@battle.pbDisplay(_INTL("A sticky web has been laid out beneath {1}'s feet!",
user.pbOpposingTeam(true)))

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)
#===============================================================================

View File

@@ -126,6 +126,44 @@ class Battle::Move::PoisonTargetLowerTargetSpeed1 < Battle::Move
end
end
#===============================================================================
# Removes trapping moves, entry hazards and Leech Seed on user/user's side.
# Poisons the target. (Mortal Spin)
#===============================================================================
class Battle::Move::PoisonTargetRemoveUserBindingAndEntryHazards < Battle::Move::PoisonTarget
def pbEffectAfterAllHits(user, target)
return if user.fainted? || target.damageState.unaffected
if user.effects[PBEffects::Trapping] > 0
trapMove = GameData::Move.get(user.effects[PBEffects::TrappingMove]).name
trapUser = @battle.battlers[user.effects[PBEffects::TrappingUser]]
@battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!", user.pbThis, trapUser.pbThis(true), trapMove))
user.effects[PBEffects::Trapping] = 0
user.effects[PBEffects::TrappingMove] = nil
user.effects[PBEffects::TrappingUser] = -1
end
if user.effects[PBEffects::LeechSeed] >= 0
user.effects[PBEffects::LeechSeed] = -1
@battle.pbDisplay(_INTL("{1} shed Leech Seed!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::StealthRock]
user.pbOwnSide.effects[PBEffects::StealthRock] = false
@battle.pbDisplay(_INTL("{1} blew away stealth rocks!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::Spikes] > 0
user.pbOwnSide.effects[PBEffects::Spikes] = 0
@battle.pbDisplay(_INTL("{1} blew away spikes!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::ToxicSpikes] > 0
user.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
@battle.pbDisplay(_INTL("{1} blew away poison spikes!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::StickyWeb]
user.pbOwnSide.effects[PBEffects::StickyWeb] = false
@battle.pbDisplay(_INTL("{1} blew away sticky webs!", user.pbThis))
end
end
end
#===============================================================================
# Badly poisons the target. (Poison Fang, Toxic)
#===============================================================================
@@ -353,6 +391,20 @@ class Battle::Move::ParalyzeBurnOrFreezeTarget < Battle::Move
end
end
#===============================================================================
# Poisons, paralyzes or puts to sleep the target. (Dire Claw)
#===============================================================================
class Battle::Move::PoisonParalyzeOrSleepTarget < Battle::Move
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
case @battle.pbRandom(3)
when 0 then target.pbPoison(user) if target.pbCanPoison?(user, false, self)
when 1 then target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
when 2 then target.pbSleep if target.pbCanSleep?(user, false, self)
end
end
end
#===============================================================================
# User passes its status problem to the target. (Psycho Shift)
#===============================================================================
@@ -649,6 +701,23 @@ class Battle::Move::ConfuseTargetAlwaysHitsInRainHitsTargetInSky < Battle::Move:
end
end
#===============================================================================
# Confuses the target. If attack misses, user takes crash damage of 1/2 of max
# HP. (Axe Kick)
#===============================================================================
class Battle::Move::ConfuseTargetCrashDamageIfFails < Battle::Move::ConfuseTarget
def recoilMove?; return true; end
def pbCrashDamage(user)
return if !user.takesIndirectDamage?
@battle.pbDisplay(_INTL("{1} kept going and crashed!", user.pbThis))
@battle.scene.pbDamageAnimation(user)
user.pbReduceHP(user.totalhp / 2, false)
user.pbItemHPHealCheck
user.pbFaint if user.fainted?
end
end
#===============================================================================
# Attracts the target. (Attract)
#===============================================================================
@@ -953,6 +1022,27 @@ class Battle::Move::UserLosesFireType < Battle::Move
end
end
#===============================================================================
# User loses their Electric type. Fails if user is not Electric-type.
# (Double Shock)
#===============================================================================
class Battle::Move::UserLosesElectricType < Battle::Move
def pbMoveFailed?(user, targets)
if !user.pbHasType?(:ELECTRIC)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectAfterAllHits(user, target)
if !user.effects[PBEffects::DoubleShock]
user.effects[PBEffects::DoubleShock] = true
@battle.pbDisplay(_INTL("{1} used up all its electricity!", user.pbThis))
end
end
end
#===============================================================================
# Target's ability becomes Simple. (Simple Beam)
#===============================================================================

View File

@@ -421,6 +421,38 @@ class Battle::Move::IncreasePowerInElectricTerrain < Battle::Move
end
end
#===============================================================================
# Damage is increased by 33% if the move is super-effective. (Electro Drift)
#===============================================================================
class Battle::Move::IncreasePowerIfSuperEffective < Battle::Move
def pbModifyDamage(damageMult, user, target)
damageMult = damageMult * 4 / 3 if Effectiveness.super_effective?(target.damageState.typeMod)
return damageMult
end
end
#===============================================================================
# Power is doubled 30% of the time. (Fickle Beam)
#===============================================================================
class Battle::Move::DoublePower30PercentChance < Battle::Move
def pbOnStartUse(user, targets)
@double_power = @battle.pbRandom(100) < 30
if @double_power
@battle.pbDisplayBrief(_INTL("{1} is going all out for this attack!", user.pbThis))
end
end
def pbBaseDamage(baseDmg, user, target)
baseDmg *= 2 if @double_power
return baseDmg
end
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if @double_power
super
end
end
#===============================================================================
# Power is doubled if the target's HP is down to 1/2 or less. (Brine)
#===============================================================================
@@ -477,6 +509,20 @@ class Battle::Move::DoublePowerIfTargetPoisoned < Battle::Move
end
end
#===============================================================================
# Power is doubled if the target is poisoned, and then poisons the target.
# (Barb Barrage)
#===============================================================================
class Battle::Move::DoublePowerIfTargetPoisonedPoisonTarget < Battle::Move::PoisonTarget
def pbBaseDamage(baseDmg, user, target)
if target.poisoned? &&
(target.effects[PBEffects::Substitute] == 0 || ignoresSubstitute?(user))
baseDmg *= 2
end
return baseDmg
end
end
#===============================================================================
# Power is doubled if the target is paralyzed. Cures the target of paralysis.
# (Smelling Salts)
@@ -511,6 +557,20 @@ class Battle::Move::DoublePowerIfTargetStatusProblem < Battle::Move
end
end
#===============================================================================
# Power is doubled if the target has a status problem, and then burns the
# target. (Infernal Parade)
#===============================================================================
class Battle::Move::DoublePowerIfTargetStatusProblemBurnTarget < Battle::Move::BurnTarget
def pbBaseDamage(baseDmg, user, target)
if target.pbHasAnyStatus? &&
(target.effects[PBEffects::Substitute] == 0 || ignoresSubstitute?(user))
baseDmg *= 2
end
return baseDmg
end
end
#===============================================================================
# Power is doubled if the user has no held item. (Acrobatics)
#===============================================================================
@@ -895,6 +955,18 @@ class Battle::Move::ProtectUserBanefulBunker < Battle::Move::ProtectMove
end
end
#===============================================================================
# User is protected against damaging moves this round. If a Pokémon makes
# contact with the user while this effect applies, that Pokémon is burned.
# (Burning Bulwark)
#===============================================================================
class Battle::Move::ProtectUserFromDamagingMovesBurningBulwark < Battle::Move::ProtectMove
def initialize(battle, move)
super
@effect = PBEffects::BurningBulwark
end
end
#===============================================================================
# User is protected against damaging moves this round. Decreases the Attack of
# the user of a stopped contact move by 2 stages. (King's Shield)
@@ -919,6 +991,19 @@ class Battle::Move::ProtectUserFromDamagingMovesObstruct < Battle::Move::Protect
end
end
#===============================================================================
# For the rest of this round, the user avoids all damaging moves that would hit
# it. If a move that makes contact is stopped by this effect, decreases the
# Speed of the Pokémon using that move by 1 stage. Contributes to Protect's
# counter. (Silk Trap)
#===============================================================================
class Battle::Move::ProtectUserFromDamagingMovesSilkTrap < Battle::Move::ProtectMove
def initialize(battle, move)
super
@effect = PBEffects::SilkTrap
end
end
#===============================================================================
# User is protected against moves that target it this round. Damages the user of
# a stopped contact move by 1/8 of its max HP. (Spiky Shield)
@@ -1004,9 +1089,11 @@ end
class Battle::Move::RemoveProtections < Battle::Move
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::BanefulBunker] = false
target.effects[PBEffects::BurningBulwark] = false
target.effects[PBEffects::KingsShield] = false
target.effects[PBEffects::Obstruct] = false
target.effects[PBEffects::Protect] = false
target.effects[PBEffects::SilkTrap] = false
target.effects[PBEffects::SpikyShield] = false
target.pbOwnSide.effects[PBEffects::CraftyShield] = false
target.pbOwnSide.effects[PBEffects::MatBlock] = false
@@ -1047,9 +1134,11 @@ class Battle::Move::HoopaRemoveProtectionsBypassSubstituteLowerUserDef1 < Battle
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::BanefulBunker] = false
target.effects[PBEffects::BurningBulwark] = false
target.effects[PBEffects::KingsShield] = false
target.effects[PBEffects::Obstruct] = false
target.effects[PBEffects::Protect] = false
target.effects[PBEffects::SilkTrap] = false
target.effects[PBEffects::SpikyShield] = false
target.pbOwnSide.effects[PBEffects::CraftyShield] = false
target.pbOwnSide.effects[PBEffects::MatBlock] = false
@@ -1317,6 +1406,46 @@ class Battle::Move::TypeIsUserFirstType < Battle::Move
end
end
#===============================================================================
# This move's type is the same as the user's second type, only if the user is
# Ogerpon. (Ivy Cudgel)
#===============================================================================
class Battle::Move::TypeDependsOnUserOgerponForm < Battle::Move
def pbBaseType(user)
if user.isSpecies?(:OGERPON)
case user.form
when 1
return :WATER if GameData::Type.exists?(:WATER)
when 2
return :FIRE if GameData::Type.exists?(:FIRE)
when 3
return :ROCK if GameData::Type.exists?(:ROCK)
end
end
return @type
end
end
#===============================================================================
# This move's type is the same as the user's second type, only if the user is
# Ogerpon. (Ivy Cudgel)
#===============================================================================
class Battle::Move::TypeDependsOnUserTaurosFormRemoveScreens < Battle::Move::RemoveScreens
def pbBaseType(user)
if user.isSpecies?(:TAUROS)
case user.form
when 1
return :FIGHTING if GameData::Type.exists?(:WATER)
when 2
return :FIRE if GameData::Type.exists?(:FIRE)
when 3
return :WATER if GameData::Type.exists?(:ROCK)
end
end
return @type
end
end
#===============================================================================
# Power and type depends on the user's IVs. (Hidden Power)
#===============================================================================

View File

@@ -63,8 +63,8 @@ class Battle::Move::HitTwoTimesTargetThenTargetAlly < Battle::Move
end
#===============================================================================
# Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
# An accuracy check is performed for each hit.
# Hits 3 times. Power is multiplied by the hit number. An accuracy check is
# performed for each hit. (Triple Kick)
#===============================================================================
class Battle::Move::HitThreeTimesPowersUpWithEachHit < Battle::Move
def multiHitMove?; return true; end
@@ -95,6 +95,27 @@ class Battle::Move::HitThreeTimesAlwaysCriticalHit < Battle::Move
def pbCritialOverride(user, target); return 1; end
end
#===============================================================================
# Hits 10 times in a row. An accuracy check is performed for each hit.
# (Population Bomb)
#===============================================================================
class Battle::Move::HitThreeTimesAlwaysCriticalHit < Battle::Move
def multiHitMove?; return true; end
def pbNumHits(user, targets)
return 4 + @battle.pbRandom(7) if user.hasActiveItem?(:LOADEDDICE)
return 10
end
def successCheckPerHit?
return @accCheckPerHit
end
def pbOnStartUse(user, targets)
@accCheckPerHit = !user.hasActiveAbility?(:SKILLLINK) && !user.hasActiveItem?(:LOADEDDICE)
end
end
#===============================================================================
# Hits 2-5 times.
#===============================================================================
@@ -317,8 +338,8 @@ class Battle::Move::TwoTurnAttackRaiseUserSpAtkSpDefSpd2 < Battle::Move::TwoTurn
end
#===============================================================================
# Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
# (Skull Bash)
# Two turn attack. On the first turn, increases the user's Defense by 1 stage.
# On the second turn, does damage. (Skull Bash)
#===============================================================================
class Battle::Move::TwoTurnAttackChargeRaiseUserDefense1 < Battle::Move::TwoTurnMove
attr_reader :statUp
@@ -362,6 +383,29 @@ class Battle::Move::TwoTurnAttackChargeRaiseUserSpAtk1 < Battle::Move::TwoTurnMo
end
end
#===============================================================================
# Two turn attack. On the first turn, increases the user's Special Attack by 1
# stage. On the second turn, does damage. In rain, takes 1 turn instead.
# (Electro Shot)
#===============================================================================
class Battle::Move::TwoTurnAttackOneTurnInRainChargeRaiseUserSpAtk1 < Battle::Move::TwoTurnAttackChargeRaiseUserSpAtk1
def pbIsChargingTurn?(user)
ret = super
if !user.effects[PBEffects::TwoTurnAttack] &&
[:Rain, :HeavyRain].include?(user.effectiveWeather)
@powerHerb = false
@chargingTurn = true
@damagingTurn = true
return false
end
return ret
end
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} absorbed electricity!", user.pbThis))
end
end
#===============================================================================
# Two turn attack. Skips first turn, attacks second turn. (Dig)
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
@@ -488,9 +532,11 @@ class Battle::Move::TwoTurnAttackInvulnerableRemoveProtections < Battle::Move::T
def pbAttackingTurnEffect(user, target)
target.effects[PBEffects::BanefulBunker] = false
target.effects[PBEffects::BurningBulwark] = false
target.effects[PBEffects::KingsShield] = false
target.effects[PBEffects::Obstruct] = false
target.effects[PBEffects::Protect] = false
target.effects[PBEffects::SilkTrap] = false
target.effects[PBEffects::SpikyShield] = false
target.pbOwnSide.effects[PBEffects::CraftyShield] = false
target.pbOwnSide.effects[PBEffects::MatBlock] = false

View File

@@ -199,6 +199,19 @@ class Battle::Move::HealUserByHalfOfDamageDoneIfTargetAsleep < Battle::Move
end
end
#===============================================================================
# User gains half the HP it inflicts as damage. Burns the target. (Matcha Gotcha)
#===============================================================================
class Battle::Move::HealUserByHalfOfDamageDoneBurnTarget < Battle::Move::BurnTarget
def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end
def pbEffectAgainstTarget(user, target)
return if target.damageState.hpLost <= 0
hpGain = (target.damageState.hpLost / 2.0).round
user.pbRecoverHPFromDrain(hpGain, target)
end
end
#===============================================================================
# User gains 3/4 the HP it inflicts as damage. (Draining Kiss, Oblivion Wing)
#===============================================================================

View File

@@ -727,6 +727,8 @@ class Battle::Move::UseLastMoveUsed < Battle::Move
"ProtectUserFromDamagingMovesObstruct", # Obstruct # Not listed on Bulbapedia
"ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield
"ProtectUserBanefulBunker", # Baneful Bunker
"ProtectUserFromDamagingMovesSilkTrap", # Silk Trap
"ProtectUserFromDamagingMovesBurningBulwark", # Burning Bulwark
# Moves that call other moves
"UseLastMoveUsedByTarget", # Mirror Move
"UseLastMoveUsed", # Copycat (this move)
@@ -960,6 +962,8 @@ class Battle::Move::UseRandomMove < Battle::Move
"ProtectUserFromDamagingMovesObstruct", # Obstruct
"ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield
"ProtectUserBanefulBunker", # Baneful Bunker
"ProtectUserFromDamagingMovesSilkTrap", # Silk Trap
"ProtectUserFromDamagingMovesBurningBulwark", # Burning Bulwark
# Moves that call other moves
"UseLastMoveUsedByTarget", # Mirror Move
"UseLastMoveUsed", # Copycat
@@ -1052,6 +1056,8 @@ class Battle::Move::UseRandomMoveFromUserParty < Battle::Move
"ProtectUserFromDamagingMovesObstruct", # Obstruct # Not listed on Bulbapedia
"ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield
"ProtectUserBanefulBunker", # Baneful Bunker
"ProtectUserFromDamagingMovesSilkTrap", # Silk Trap
"ProtectUserFromDamagingMovesBurningBulwark", # Burning Bulwark
# Moves that call other moves
"UseLastMoveUsedByTarget", # Mirror Move
"UseLastMoveUsed", # Copycat

View File

@@ -234,7 +234,9 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("TwoTurnAttack",
# user's first turn in battle, so it can't be used in response
# to this move charging up.
if target.has_move_with_function?("ProtectUserFromDamagingMovesKingsShield",
"ProtectUserFromDamagingMovesObstruct")
"ProtectUserFromDamagingMovesObstruct",
"ProtectUserFromDamagingMovesSilkTrap",
"ProtectUserFromDamagingMovesBurningBulwark")
has_protect_move = true
end
end

View File

@@ -800,7 +800,9 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("DisableTargetStatusMoves
"ProtectUserFromDamagingMovesKingsShield", # King's Shield
"ProtectUserFromDamagingMovesObstruct", # Obstruct
"ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield
"ProtectUserBanefulBunker" # Baneful Bunker
"ProtectUserBanefulBunker", # Baneful Bunker
"ProtectUserFromDamagingMovesSilkTrap", # Silk Trap
"ProtectUserFromDamagingMovesBurningBulwark" # Burning Bulwark
]
if target.check_for_move { |m| m.statusMove? && protection_moves.include?(m.function_code) }
score += 10

View File

@@ -9,6 +9,7 @@ module PBEffects
Bide = 4
BideDamage = 5
BideTarget = 6
BurningBulwark = 1107
BurnUp = 7
Charge = 8
ChoiceBand = 9
@@ -23,6 +24,7 @@ module PBEffects
DestinyBondTarget = 18
Disable = 19
DisableMove = 20
DoubleShock = 9922
Electrify = 21
Embargo = 22
Encore = 23
@@ -91,6 +93,7 @@ module PBEffects
Rollout = 86
Roost = 87
ShellTrap = 88
SilkTrap = 1189
SkyDrop = 89
SlowStart = 90
SmackDown = 91