Added Eject Pack's effect

This commit is contained in:
Maruno17
2021-09-19 23:04:29 +01:00
parent 1fb3ff5408
commit d4abc6ef2b
18 changed files with 139 additions and 66 deletions

View File

@@ -39,10 +39,11 @@ class PokeBattle_Battler
attr_accessor :movesUsed attr_accessor :movesUsed
attr_accessor :currentMove # ID of multi-turn move currently being used attr_accessor :currentMove # ID of multi-turn move currently being used
attr_accessor :droppedBelowHalfHP # Used for Emergency Exit/Wimp Out attr_accessor :droppedBelowHalfHP # Used for Emergency Exit/Wimp Out
attr_accessor :statsDropped # Used for Eject Pack
attr_accessor :tookDamageThisRound # Boolean for whether self took damage this round attr_accessor :tookDamageThisRound # Boolean for whether self took damage this round
attr_accessor :tookPhysicalHit attr_accessor :tookPhysicalHit
attr_accessor :statsRaised # Boolean for whether self's stat(s) raised this round attr_accessor :statsRaisedThisRound # Boolean for whether self's stat(s) raised this round
attr_accessor :statsLowered # Boolean for whether self's stat(s) lowered this round attr_accessor :statsLoweredThisRound # Boolean for whether self's stat(s) lowered this round
attr_accessor :canRestoreIceFace # Whether Hail started in the round attr_accessor :canRestoreIceFace # Whether Hail started in the round
attr_accessor :damageState attr_accessor :damageState

View File

@@ -148,10 +148,11 @@ class PokeBattle_Battler
@lastHPLost = 0 @lastHPLost = 0
@lastHPLostFromFoe = 0 @lastHPLostFromFoe = 0
@droppedBelowHalfHP = false @droppedBelowHalfHP = false
@statsDropped = false
@tookDamageThisRound = false @tookDamageThisRound = false
@tookPhysicalHit = false @tookPhysicalHit = false
@statsRaised = false @statsRaisedThisRound = false
@statsLowered = false @statsLoweredThisRound = false
@canRestoreIceFace = false @canRestoreIceFace = false
@lastMoveUsed = nil @lastMoveUsed = nil
@lastMoveUsedType = nil @lastMoveUsedType = nil

View File

@@ -51,11 +51,13 @@ class PokeBattle_Battler
end end
def pbTakeEffectDamage(amt, show_anim = true) def pbTakeEffectDamage(amt, show_anim = true)
@droppedBelowHalfHP = false
hp_lost = pbReduceHP(amt, show_anim) hp_lost = pbReduceHP(amt, show_anim)
yield hp_lost if block_given? # Show message yield hp_lost if block_given? # Show message
pbItemHPHealCheck pbItemHPHealCheck
pbAbilitiesOnDamageTaken pbAbilitiesOnDamageTaken
pbFaint if fainted? pbFaint if fainted?
@droppedBelowHalfHP = false
end end
def pbFaint(showMessage=true) def pbFaint(showMessage=true)

View File

@@ -37,7 +37,7 @@ class PokeBattle_Battler
new = @stages[stat]+increment new = @stages[stat]+increment
PBDebug.log("[Stat change] #{pbThis}'s #{stat_name}: #{@stages[stat]} -> #{new} (+#{increment})") PBDebug.log("[Stat change] #{pbThis}'s #{stat_name}: #{@stages[stat]} -> #{new} (+#{increment})")
@stages[stat] += increment @stages[stat] += increment
@statsRaised = true @statsRaisedThisRound = true
end end
return increment return increment
end end
@@ -176,7 +176,8 @@ class PokeBattle_Battler
new = @stages[stat]-increment new = @stages[stat]-increment
PBDebug.log("[Stat change] #{pbThis}'s #{stat_name}: #{@stages[stat]} -> #{new} (-#{increment})") PBDebug.log("[Stat change] #{pbThis}'s #{stat_name}: #{@stages[stat]} -> #{new} (-#{increment})")
@stages[stat] -= increment @stages[stat] -= increment
@statsLowered = true @statsLoweredThisRound = true
@statsDropped = true
end end
return increment return increment
end end
@@ -360,9 +361,10 @@ class PokeBattle_Battler
def pbResetStatStages def pbResetStatStages
GameData::Stat.each_battle do |s| GameData::Stat.each_battle do |s|
if @stages[s.id] > 0 if @stages[s.id] > 0
@statsLowered = true @statsLoweredThisRound = true
@statsDropped = true
elsif @stages[s.id] < 0 elsif @stages[s.id] < 0
@statsRaised = true @statsRaisedThisRound = true
end end
@stages[s.id] = 0 @stages[s.id] = 0
end end

View File

@@ -292,4 +292,11 @@ class PokeBattle_Battler
pbHeldItemTriggered(self.item) pbHeldItemTriggered(self.item)
end end
end end
# Used for Eject Pack. Returns whether self has switched out.
def pbItemOnStatDropped(move_user = nil)
return false if !@statsDropped
return false if !itemActive?
return BattleHandlers.triggerItemOnStatDropped(self.item, self, move_user, @battle)
end
end end

View File

@@ -384,7 +384,10 @@ class PokeBattle_Battler
user.lastMoveFailed = true user.lastMoveFailed = true
else # We have targets, or move doesn't use targets else # We have targets, or move doesn't use targets
# Reset whole damage state, perform various success checks (not accuracy) # Reset whole damage state, perform various success checks (not accuracy)
@battle.eachBattler { |b| b.droppedBelowHalfHP = false } @battle.eachBattler do |b|
b.droppedBelowHalfHP = false
b.statsDropped = false
end
targets.each do |b| targets.each do |b|
b.damageState.reset b.damageState.reset
next if pbSuccessCheckAgainstTarget(move, user, b, targets) next if pbSuccessCheckAgainstTarget(move, user, b, targets)
@@ -496,7 +499,10 @@ class PokeBattle_Battler
user.pbFaint if user.fainted? user.pbFaint if user.fainted?
# External/general effects after all hits. Eject Button, Shell Bell, etc. # External/general effects after all hits. Eject Button, Shell Bell, etc.
pbEffectsAfterMove(user,targets,move,realNumHits) pbEffectsAfterMove(user,targets,move,realNumHits)
@battle.eachBattler { |b| b.droppedBelowHalfHP = false } @battle.eachBattler do |b|
b.droppedBelowHalfHP = false
b.statsDropped = false
end
end end
# End effect of Mold Breaker # End effect of Mold Breaker
@battle.moldBreaker = false @battle.moldBreaker = false

View File

@@ -138,12 +138,6 @@ class PokeBattle_Battler
user.pbChangeForm((user.hp > user.totalhp / 2) ? 1 : 2, nil) user.pbChangeForm((user.hp > user.totalhp / 2) ? 1 : 2, nil)
end end
end end
# Consume user's Gem
if user.effects[PBEffects::GemConsumed]
# NOTE: The consume animation and message for Gems are shown immediately
# after the move's animation, but the item is only consumed now.
user.pbConsumeItem
end
# Room Service # Room Service
if move.function == "StartSlowerBattlersActFirst" && @battle.field.effects[PBEffects::TrickRoom] > 0 if move.function == "StartSlowerBattlersActFirst" && @battle.field.effects[PBEffects::TrickRoom] > 0
@battle.battlers.each do |b| @battle.battlers.each do |b|
@@ -154,6 +148,12 @@ class PokeBattle_Battler
b.pbConsumeItem b.pbConsumeItem
end end
end end
# Consume user's Gem
if user.effects[PBEffects::GemConsumed]
# NOTE: The consume animation and message for Gems are shown immediately
# after the move's animation, but the item is only consumed now.
user.pbConsumeItem
end
switched_battlers = [] # Indices of battlers that were switched out somehow switched_battlers = [] # Indices of battlers that were switched out somehow
# Target switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail # Target switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail
move.pbSwitchOutTargetEffect(user, targets, numHits, switched_battlers) move.pbSwitchOutTargetEffect(user, targets, numHits, switched_battlers)
@@ -180,11 +180,18 @@ class PokeBattle_Battler
def pbEffectsAfterMove2(user, targets, move, numHits, switched_battlers) def pbEffectsAfterMove2(user, targets, move, numHits, switched_battlers)
# Target's held item (Eject Button, Red Card, Eject Pack) # Target's held item (Eject Button, Red Card, Eject Pack)
@battle.pbPriority(true).each do |b| @battle.pbPriority(true).each do |b|
next if !targets.any? { |targetB| targetB.index==b.index } if targets.any? { |targetB| targetB.index==b.index }
next if b.damageState.unaffected || b.damageState.calcDamage == 0 if !b.damageState.unaffected && b.damageState.calcDamage > 0 && b.itemActive?
next if !b.itemActive?
BattleHandlers.triggerTargetItemAfterMoveUse(b.item, b, user, move, switched_battlers, @battle) BattleHandlers.triggerTargetItemAfterMoveUse(b.item, b, user, move, switched_battlers, @battle)
end end
end
# Target's Eject Pack
if switched_battlers.empty? && b.index != user.index
if b.pbItemOnStatDropped(user)
switched_battlers.push(b.index)
end
end
end
# User's held item (Life Orb, Shell Bell, Throat Spray, Eject Pack) # User's held item (Life Orb, Shell Bell, Throat Spray, Eject Pack)
if !switched_battlers.include?(user.index) && user.itemActive? # Only if user hasn't switched out if !switched_battlers.include?(user.index) && user.itemActive? # Only if user hasn't switched out
BattleHandlers.triggerUserItemAfterMoveUse(user.item,user,targets,move,numHits,@battle) BattleHandlers.triggerUserItemAfterMoveUse(user.item,user,targets,move,numHits,@battle)
@@ -192,11 +199,11 @@ class PokeBattle_Battler
# Target's ability (Berserk, Color Change, Emergency Exit, Pickpocket, Wimp Out) # Target's ability (Berserk, Color Change, Emergency Exit, Pickpocket, Wimp Out)
@battle.pbPriority(true).each do |b| @battle.pbPriority(true).each do |b|
if targets.any? { |targetB| targetB.index==b.index } if targets.any? { |targetB| targetB.index==b.index }
next if b.damageState.unaffected || switched_battlers.include?(b.index) if !b.damageState.unaffected && !switched_battlers.include?(b.index) && b.abilityActive?
next if !b.abilityActive?
BattleHandlers.triggerTargetAbilityAfterMoveUse(b.ability, b, user, move, switched_battlers, @battle) BattleHandlers.triggerTargetAbilityAfterMoveUse(b.ability, b, user, move, switched_battlers, @battle)
end end
# Emergency Exit, Wimp Out (including for Pokémon hurt by Flame Burst) end
# Target's Emergency Exit, Wimp Out (including for Pokémon hurt by Flame Burst)
if switched_battlers.empty? && move.damagingMove? && b.index != user.index if switched_battlers.empty? && move.damagingMove? && b.index != user.index
if b.pbAbilitiesOnDamageTaken(user) if b.pbAbilitiesOnDamageTaken(user)
switched_battlers.push(b.index) switched_battlers.push(b.index)
@@ -207,8 +214,12 @@ class PokeBattle_Battler
# Everything in this method is negated by Sheer Force. # Everything in this method is negated by Sheer Force.
def pbEffectsAfterMove3(user, targets, move, numHits, switched_battlers) def pbEffectsAfterMove3(user, targets, move, numHits, switched_battlers)
# TODO: User's Eject Pack. # User's held item that switches it out (Eject Pack)
if switched_battlers.empty?
if user.pbItemOnStatDropped(user)
switched_battlers.push(user.index)
end
end
# User's ability (Emergency Exit, Wimp Out) # User's ability (Emergency Exit, Wimp Out)
if switched_battlers.empty? && move.damagingMove? if switched_battlers.empty? && move.damagingMove?
if user.pbAbilitiesOnDamageTaken(user) if user.pbAbilitiesOnDamageTaken(user)

View File

@@ -5,9 +5,10 @@ module BattleHandlers
# Battler's weight calculation # Battler's weight calculation
WeightCalcAbility = AbilityHandlerHash.new WeightCalcAbility = AbilityHandlerHash.new
WeightCalcItem = ItemHandlerHash.new # Float Stone WeightCalcItem = ItemHandlerHash.new # Float Stone
# Battler's HP changed # Battler's HP/stat changed
HPHealItem = ItemHandlerHash.new HPHealItem = ItemHandlerHash.new
AbilityOnHPDroppedBelowHalf = AbilityHandlerHash.new AbilityOnHPDroppedBelowHalf = AbilityHandlerHash.new
ItemOnStatDropped = ItemHandlerHash.new
# Battler's status problem # Battler's status problem
StatusCheckAbilityNonIgnorable = AbilityHandlerHash.new # Comatose StatusCheckAbilityNonIgnorable = AbilityHandlerHash.new # Comatose
StatusImmunityAbility = AbilityHandlerHash.new StatusImmunityAbility = AbilityHandlerHash.new
@@ -133,6 +134,11 @@ module BattleHandlers
return (ret!=nil) ? ret : false return (ret!=nil) ? ret : false
end end
def self.triggerItemOnStatDropped(item, user, move_user, battle)
ret = ItemOnStatDropped.trigger(item, user, move_user, battle)
return (ret != nil) ? ret : false
end
#============================================================================= #=============================================================================
def self.triggerStatusCheckAbilityNonIgnorable(ability,battler,status) def self.triggerStatusCheckAbilityNonIgnorable(ability,battler,status)

View File

@@ -62,12 +62,13 @@ class PokeBattle_Move_MaxUserAttackLoseHalfOfTotalHP < PokeBattle_Move
user.pbReduceHP(hpLoss, false, false) user.pbReduceHP(hpLoss, false, false)
if user.hasActiveAbility?(:CONTRARY) if user.hasActiveAbility?(:CONTRARY)
user.stages[:ATTACK] = -6 user.stages[:ATTACK] = -6
user.statsLowered = true user.statsLoweredThisRound = true
user.statsDropped = true
@battle.pbCommonAnimation("StatDown",user) @battle.pbCommonAnimation("StatDown",user)
@battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",user.pbThis)) @battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",user.pbThis))
else else
user.stages[:ATTACK] = 6 user.stages[:ATTACK] = 6
user.statsRaised = true user.statsRaisedThisRound = true
@battle.pbCommonAnimation("StatUp",user) @battle.pbCommonAnimation("StatUp",user)
@battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",user.pbThis)) @battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",user.pbThis))
end end
@@ -1616,11 +1617,13 @@ class PokeBattle_Move_UserTargetSwapAtkSpAtkStages < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
[:ATTACK,:SPECIAL_ATTACK].each do |s| [:ATTACK,:SPECIAL_ATTACK].each do |s|
if user.stages[s] > target.stages[s] if user.stages[s] > target.stages[s]
user.statsLowered = true user.statsLoweredThisRound = true
target.statsRaised = true user.statsDropped = true
target.statsRaisedThisRound = true
elsif user.stages[s] < target.stages[s] elsif user.stages[s] < target.stages[s]
user.statsRaised = true user.statsRaisedThisRound = true
target.statsLowered = true target.statsLoweredThisRound = true
target.statsDropped = true
end end
user.stages[s],target.stages[s] = target.stages[s],user.stages[s] user.stages[s],target.stages[s] = target.stages[s],user.stages[s]
end end
@@ -1637,11 +1640,13 @@ class PokeBattle_Move_UserTargetSwapDefSpDefStages < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
[:DEFENSE,:SPECIAL_DEFENSE].each do |s| [:DEFENSE,:SPECIAL_DEFENSE].each do |s|
if user.stages[s] > target.stages[s] if user.stages[s] > target.stages[s]
user.statsLowered = true user.statsLoweredThisRound = true
target.statsRaised = true user.statsDropped = true
target.statsRaisedThisRound = true
elsif user.stages[s] < target.stages[s] elsif user.stages[s] < target.stages[s]
user.statsRaised = true user.statsRaisedThisRound = true
target.statsLowered = true target.statsLoweredThisRound = true
target.statsDropped = true
end end
user.stages[s],target.stages[s] = target.stages[s],user.stages[s] user.stages[s],target.stages[s] = target.stages[s],user.stages[s]
end end
@@ -1658,11 +1663,13 @@ class PokeBattle_Move_UserTargetSwapStatStages < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
GameData::Stat.each_battle do |s| GameData::Stat.each_battle do |s|
if user.stages[s.id] > target.stages[s.id] if user.stages[s.id] > target.stages[s.id]
user.statsLowered = true user.statsLoweredThisRound = true
target.statsRaised = true user.statsDropped = true
target.statsRaisedThisRound = true
elsif user.stages[s.id] < target.stages[s.id] elsif user.stages[s.id] < target.stages[s.id]
user.statsRaised = true user.statsRaisedThisRound = true
target.statsLowered = true target.statsLoweredThisRound = true
target.statsDropped = true
end end
user.stages[s.id],target.stages[s.id] = target.stages[s.id],user.stages[s.id] user.stages[s.id],target.stages[s.id] = target.stages[s.id],user.stages[s.id]
end end
@@ -1679,9 +1686,10 @@ class PokeBattle_Move_UserCopyTargetStatStages < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
GameData::Stat.each_battle do |s| GameData::Stat.each_battle do |s|
if user.stages[s.id] > target.stages[s.id] if user.stages[s.id] > target.stages[s.id]
user.statsLowered = true user.statsLoweredThisRound = true
user.statsDropped = true
elsif user.stages[s.id] < target.stages[s.id] elsif user.stages[s.id] < target.stages[s.id]
user.statsRaised = true user.statsRaisedThisRound = true
end end
user.stages[s.id] = target.stages[s.id] user.stages[s.id] = target.stages[s.id]
end end
@@ -1713,7 +1721,8 @@ class PokeBattle_Move_UserStealTargetPositiveStatStages < PokeBattle_Move
showAnim = false showAnim = false
end end
end end
target.statsLowered = true target.statsLoweredThisRound = true
target.statsDropped = true
target.stages[s.id] = 0 target.stages[s.id] = 0
end end
end end
@@ -1738,9 +1747,10 @@ class PokeBattle_Move_InvertTargetStatStages < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
GameData::Stat.each_battle do |s| GameData::Stat.each_battle do |s|
if target.stages[s.id] > 0 if target.stages[s.id] > 0
target.statsLowered = true target.statsLoweredThisRound = true
target.statsDropped = true
elsif target.stages[s.id] < 0 elsif target.stages[s.id] < 0
target.statsRaised = true target.statsRaisedThisRound = true
end end
target.stages[s.id] *= -1 target.stages[s.id] *= -1
end end

View File

@@ -175,7 +175,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_BurnTargetIfTargetStatsRaisedThisTurn < PokeBattle_BurnMove class PokeBattle_Move_BurnTargetIfTargetStatsRaisedThisTurn < PokeBattle_BurnMove
def pbAdditionalEffect(user, target) def pbAdditionalEffect(user, target)
super if target.statsRaised super if target.statsRaisedThisRound
end end
end end

View File

@@ -605,7 +605,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_DoublePowerIfUserStatsLoweredThisTurn < PokeBattle_Move class PokeBattle_Move_DoublePowerIfUserStatsLoweredThisTurn < PokeBattle_Move
def pbBaseDamage(baseDmg, user, target) def pbBaseDamage(baseDmg, user, target)
baseDmg *= 2 if user.statsLowered baseDmg *= 2 if user.statsLoweredThisRound
return baseDmg return baseDmg
end end
end end

View File

@@ -316,8 +316,9 @@ class PokeBattle_Battle
# in. # in.
def pbOnBattlerEnteringBattle(*battler_indices) def pbOnBattlerEnteringBattle(*battler_indices)
battler_indices.flatten! battler_indices.flatten!
pbPriority(true).each do |b| eachBattler do |b|
b.droppedBelowHalfHP = false b.droppedBelowHalfHP = false
b.statsDropped = false
end end
# For each battler that entered battle, in speed order # For each battler that entered battle, in speed order
pbPriority(true).each do |b| pbPriority(true).each do |b|
@@ -355,10 +356,12 @@ class PokeBattle_Battle
# Check for triggering of Emergency Exit/Wimp Out/Eject Pack (only one will # Check for triggering of Emergency Exit/Wimp Out/Eject Pack (only one will
# be triggered) # be triggered)
pbPriority(true).each do |b| pbPriority(true).each do |b|
break if b.pbItemOnStatDropped
break if b.pbAbilitiesOnDamageTaken break if b.pbAbilitiesOnDamageTaken
end end
pbPriority(true).each do |b| eachBattler do |b|
b.droppedBelowHalfHP = false b.droppedBelowHalfHP = false
b.statsDropped = false
end end
end end

View File

@@ -103,6 +103,7 @@ class PokeBattle_Battle
if ItemHandlers.triggerCanUseInBattle(item,battler.pokemon,battler,ch[3],true,self,@scene,false) if ItemHandlers.triggerCanUseInBattle(item,battler.pokemon,battler,ch[3],true,self,@scene,false)
ItemHandlers.triggerBattleUseOnBattler(item,battler,@scene) ItemHandlers.triggerBattleUseOnBattler(item,battler,@scene)
ch[1] = nil # Delete item from choice ch[1] = nil # Delete item from choice
battler.pbItemOnStatDropped
return return
else else
pbDisplay(_INTL("But it had no effect!")) pbDisplay(_INTL("But it had no effect!"))

View File

@@ -52,6 +52,7 @@ class PokeBattle_Battle
battler.pbCureStatus battler.pbCureStatus
elsif battler.pbCanRaiseStatStage?(:ACCURACY,battler) elsif battler.pbCanRaiseStatStage?(:ACCURACY,battler)
battler.pbRaiseStatStage(:ACCURACY,1,battler) battler.pbRaiseStatStage(:ACCURACY,1,battler)
battler.pbItemOnStatDropped
else else
pbDisplay(_INTL("But nothing happened!")) pbDisplay(_INTL("But nothing happened!"))
end end

View File

@@ -350,22 +350,26 @@ class PokeBattle_Battle
pbHideAbilitySplash(b) pbHideAbilitySplash(b)
end end
elsif b.takesIndirectDamage? elsif b.takesIndirectDamage?
b.droppedBelowHalfHP = false
dmg = (b.statusCount==0) ? b.totalhp/8 : b.totalhp*b.effects[PBEffects::Toxic]/16 dmg = (b.statusCount==0) ? b.totalhp/8 : b.totalhp*b.effects[PBEffects::Toxic]/16
b.pbContinueStatus { b.pbReduceHP(dmg,false) } b.pbContinueStatus { b.pbReduceHP(dmg,false) }
b.pbItemHPHealCheck b.pbItemHPHealCheck
b.pbAbilitiesOnDamageTaken b.pbAbilitiesOnDamageTaken
b.pbFaint if b.fainted? b.pbFaint if b.fainted?
b.droppedBelowHalfHP = false
end end
end end
# Damage from burn # Damage from burn
priority.each do |b| priority.each do |b|
next if b.status != :BURN || !b.takesIndirectDamage? next if b.status != :BURN || !b.takesIndirectDamage?
b.droppedBelowHalfHP = false
dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8 dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF) dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF)
b.pbContinueStatus { b.pbReduceHP(dmg,false) } b.pbContinueStatus { b.pbReduceHP(dmg,false) }
b.pbItemHPHealCheck b.pbItemHPHealCheck
b.pbAbilitiesOnDamageTaken b.pbAbilitiesOnDamageTaken
b.pbFaint if b.fainted? b.pbFaint if b.fainted?
b.droppedBelowHalfHP = false
end end
# Damage from sleep (Nightmare) # Damage from sleep (Nightmare)
priority.each do |b| priority.each do |b|
@@ -418,6 +422,7 @@ class PokeBattle_Battle
pbCommonAnimation("Octolock", b) pbCommonAnimation("Octolock", b)
b.pbLowerStatStage(:DEFENSE, 1, nil) if b.pbCanLowerStatStage?(:DEFENSE) b.pbLowerStatStage(:DEFENSE, 1, nil) if b.pbCanLowerStatStage?(:DEFENSE)
b.pbLowerStatStage(:SPECIAL_DEFENSE, 1, nil) if b.pbCanLowerStatStage?(:SPECIAL_DEFENSE) b.pbLowerStatStage(:SPECIAL_DEFENSE, 1, nil) if b.pbCanLowerStatStage?(:SPECIAL_DEFENSE)
b.pbItemOnStatDropped
end end
# Taunt # Taunt
pbEORCountDownBattlerEffect(priority,PBEffects::Taunt) { |battler| pbEORCountDownBattlerEffect(priority,PBEffects::Taunt) { |battler|
@@ -631,10 +636,11 @@ class PokeBattle_Battle
b.lastHPLost = 0 b.lastHPLost = 0
b.lastHPLostFromFoe = 0 b.lastHPLostFromFoe = 0
b.droppedBelowHalfHP = false b.droppedBelowHalfHP = false
b.statsDropped = false
b.tookDamageThisRound = false b.tookDamageThisRound = false
b.tookPhysicalHit = false b.tookPhysicalHit = false
b.statsRaised = false b.statsRaisedThisRound = false
b.statsLowered = false b.statsLoweredThisRound = false
b.canRestoreIceFace = false b.canRestoreIceFace = false
b.lastRoundMoveFailed = b.lastMoveFailed b.lastRoundMoveFailed = b.lastMoveFailed
b.lastAttacker.clear b.lastAttacker.clear

View File

@@ -1328,7 +1328,7 @@ BattleHandlers::TargetAbilityOnHit.add(:ANGERPOINT,
next if !target.pbCanRaiseStatStage?(:ATTACK,target) next if !target.pbCanRaiseStatStage?(:ATTACK,target)
battle.pbShowAbilitySplash(target) battle.pbShowAbilitySplash(target)
target.stages[:ATTACK] = 6 target.stages[:ATTACK] = 6
target.statsRaised = true target.statsRaisedThisRound = true
battle.pbCommonAnimation("StatUp",target) battle.pbCommonAnimation("StatUp",target)
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1} maxed its {2}!",target.pbThis,GameData::Stat.get(:ATTACK).name)) battle.pbDisplay(_INTL("{1} maxed its {2}!",target.pbThis,GameData::Stat.get(:ATTACK).name))
@@ -1976,6 +1976,7 @@ BattleHandlers::EOREffectAbility.add(:MOODY,
end end
battle.pbHideAbilitySplash(battler) battle.pbHideAbilitySplash(battler)
battler.pbItemStatRestoreCheck if randomDown.length>0 battler.pbItemStatRestoreCheck if randomDown.length>0
battler.pbItemOnStatDropped
} }
) )

View File

@@ -1418,7 +1418,7 @@ BattleHandlers::EndOfMoveStatRestoreItem.add(:WHITEHERB,
GameData::Stat.each_battle do |s| GameData::Stat.each_battle do |s|
next if battler.stages[s.id] >= 0 next if battler.stages[s.id] >= 0
battler.stages[s.id] = 0 battler.stages[s.id] = 0
battler.statsRaised = true battler.statsRaisedThisRound = true
reducedStats = true reducedStats = true
end end
next false if !reducedStats next false if !reducedStats

View File

@@ -340,6 +340,33 @@ BattleHandlers::UserItemAfterMoveUse.add(:THROATSPRAY,
} }
) )
BattleHandlers::ItemOnStatDropped.add(:EJECTPACK,
proc { |item, battler, move_user, battle|
next false if battler.effects[PBEffects::SkyDrop] >= 0 ||
battler.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") # Sky Drop
next false if battle.pbAllFainted?(battler.idxOpposingSide)
next false if battle.wildBattle? && battler.opposes? # Wild Pokémon can't eject
next false if !battle.pbCanSwitch?(battler.index) # Battler can't switch out
next false if !battle.pbCanChooseNonActive?(battler.index) # No Pokémon can switch in
battle.pbCommonAnimation("UseItem", battler)
battle.pbDisplay(_INTL("{1} is switched out by the {2}!", battler.pbThis, battler.itemName))
battler.pbConsumeItem(true, false)
if battle.endOfRound # Just switch out
battle.scene.pbRecall(battler.index) if !battler.fainted?
battler.pbAbilitiesOnSwitchOut # Inc. primordial weather check
next true
end
newPkmn = battle.pbGetReplacementPokemonIndex(battler.index) # Owner chooses
next false if newPkmn < 0 # Shouldn't ever do this
battle.pbRecallAndReplace(battler.index, newPkmn)
battle.pbClearChoice(battler.index) # Replacement Pokémon does nothing this round
battle.moldBreaker = false if move_user && battler.index == move_user.index
battle.pbOnBattlerEnteringBattle(battler.index)
next true
}
)
BattleHandlers::ItemOnSwitchIn.add(:ROOMSERVICE, BattleHandlers::ItemOnSwitchIn.add(:ROOMSERVICE,
proc { |item, battler, battle| proc { |item, battler, battle|
next if battle.field.effects[PBEffects::TrickRoom] == 0 next if battle.field.effects[PBEffects::TrickRoom] == 0
@@ -377,15 +404,3 @@ ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE, proc { |item, pkmn, scene|
end end
next false next false
}) })
=begin
#===============================================================================
Eject Pack
When holder's stat(s) is lowered, consume item and holder switches out. Not
triggered by Parting Shot, or if a faster mon's Eject Button/Eject Pack
triggers.
=end