mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Implemented Neutralizing Gas
This commit is contained in:
@@ -336,11 +336,12 @@ class PokeBattle_Battler
|
|||||||
# NOTE: Do not create any held item which affects whether a Pokémon's ability
|
# NOTE: Do not create any held item which affects whether a Pokémon's ability
|
||||||
# is active. The ability Klutz affects whether a Pokémon's item is
|
# is active. The ability Klutz affects whether a Pokémon's item is
|
||||||
# active, and the code for the two combined would cause an infinite loop
|
# active, and the code for the two combined would cause an infinite loop
|
||||||
# (regardless of whether any Pokémon actualy has either the ability or
|
# (regardless of whether any Pokémon actually has either the ability or
|
||||||
# the item - the code existing is enough to cause the loop).
|
# the item - the code existing is enough to cause the loop).
|
||||||
def abilityActive?(ignore_fainted = false)
|
def abilityActive?(ignore_fainted = false)
|
||||||
return false if fainted? && !ignore_fainted
|
return false if fainted? && !ignore_fainted
|
||||||
return false if @effects[PBEffects::GastroAcid]
|
return false if @effects[PBEffects::GastroAcid]
|
||||||
|
return false if self.ability != :NEUTRALIZINGGAS && @battle.pbCheckGlobalAbility(:NEUTRALIZINGGAS)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -402,7 +403,9 @@ class PokeBattle_Battler
|
|||||||
:IMPOSTER,
|
:IMPOSTER,
|
||||||
# Abilities intended to be inherent properties of a certain species
|
# Abilities intended to be inherent properties of a certain species
|
||||||
:COMATOSE,
|
:COMATOSE,
|
||||||
:RKSSYSTEM
|
:RKSSYSTEM,
|
||||||
|
# Abilities that can't be negated
|
||||||
|
:NEUTRALIZINGGAS
|
||||||
]
|
]
|
||||||
return ability_blacklist.include?(abil.id)
|
return ability_blacklist.include?(abil.id)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ class PokeBattle_Battler
|
|||||||
# Treat self as fainted
|
# Treat self as fainted
|
||||||
@hp = 0
|
@hp = 0
|
||||||
@fainted = true
|
@fainted = true
|
||||||
|
# Check for end of Neutralizing Gas
|
||||||
|
pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true)
|
||||||
# Check for end of primordial weather
|
# Check for end of primordial weather
|
||||||
@battle.pbEndPrimordialWeather
|
@battle.pbEndPrimordialWeather
|
||||||
end
|
end
|
||||||
@@ -25,6 +27,7 @@ class PokeBattle_Battler
|
|||||||
next if !b || !b.abilityActive?
|
next if !b || !b.abilityActive?
|
||||||
BattleHandlers.triggerAbilityOnBattlerFainting(b.ability,b,self,@battle)
|
BattleHandlers.triggerAbilityOnBattlerFainting(b.ability,b,self,@battle)
|
||||||
end
|
end
|
||||||
|
pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used for Emergency Exit/Wimp Out. Returns whether self has switched out.
|
# Used for Emergency Exit/Wimp Out. Returns whether self has switched out.
|
||||||
@@ -45,6 +48,17 @@ class PokeBattle_Battler
|
|||||||
BattleHandlers.triggerAbilityOnIntimidated(self.ability, self, @battle)
|
BattleHandlers.triggerAbilityOnIntimidated(self.ability, self, @battle)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pbAbilitiesOnNeutralizingGasEnding
|
||||||
|
return if @battle.pbCheckGlobalAbility(:NEUTRALIZINGGAS)
|
||||||
|
@battle.pbDisplay(_INTL("The effects of the neutralizing gas wore off!"))
|
||||||
|
@battle.pbEndPrimordialWeather
|
||||||
|
@battle.pbPriority(true).each do |b|
|
||||||
|
next if b.fainted?
|
||||||
|
next if !b.unstoppableAbility? && !b.abilityActive?
|
||||||
|
BattleHandlers.triggerAbilityOnSwitchIn(b.ability, b, @battle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Called when a Pokémon (self) enters battle, at the end of each move used,
|
# Called when a Pokémon (self) enters battle, at the end of each move used,
|
||||||
# and at the end of each round.
|
# and at the end of each round.
|
||||||
def pbContinualAbilityChecks(onSwitchIn=false)
|
def pbContinualAbilityChecks(onSwitchIn=false)
|
||||||
@@ -88,8 +102,10 @@ class PokeBattle_Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Ability change
|
# Ability change
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbOnLosingAbility(oldAbil)
|
def pbOnLosingAbility(oldAbil, suppressed = false)
|
||||||
if @effects[PBEffects::Illusion] && oldAbil == :ILLUSION
|
if oldAbil == :NEUTRALIZINGGAS && (suppressed || !@effects[PBEffects::GastroAcid])
|
||||||
|
pbAbilitiesOnNeutralizingGasEnding
|
||||||
|
elsif oldAbil == :ILLUSION && @effects[PBEffects::Illusion]
|
||||||
@effects[PBEffects::Illusion] = nil
|
@effects[PBEffects::Illusion] = nil
|
||||||
if !@effects[PBEffects::Transform]
|
if !@effects[PBEffects::Transform]
|
||||||
@battle.scene.pbChangePokemon(self, @pokemon)
|
@battle.scene.pbChangePokemon(self, @pokemon)
|
||||||
@@ -99,6 +115,7 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
@effects[PBEffects::GastroAcid] = false if unstoppableAbility?
|
@effects[PBEffects::GastroAcid] = false if unstoppableAbility?
|
||||||
@effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART
|
@effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART
|
||||||
|
@effects[PBEffects::Truant] = false if self.ability != :TRUANT
|
||||||
# Check for end of primordial weather
|
# Check for end of primordial weather
|
||||||
@battle.pbEndPrimordialWeather
|
@battle.pbEndPrimordialWeather
|
||||||
# Revert form if Flower Gift/Forecast was lost
|
# Revert form if Flower Gift/Forecast was lost
|
||||||
@@ -138,8 +155,8 @@ class PokeBattle_Battler
|
|||||||
# permanent is whether the item is lost even after battle. Is false for Knock
|
# permanent is whether the item is lost even after battle. Is false for Knock
|
||||||
# Off.
|
# Off.
|
||||||
def pbRemoveItem(permanent = true)
|
def pbRemoveItem(permanent = true)
|
||||||
@effects[PBEffects::ChoiceBand] = nil if ability_id != :GORILLATACTICS
|
@effects[PBEffects::ChoiceBand] = nil if !hasActiveAbility?(:GORILLATACTICS)
|
||||||
@effects[PBEffects::Unburden] = true if self.item
|
@effects[PBEffects::Unburden] = true if self.item && hasActiveAbility?(:UNBURDEN)
|
||||||
setInitialItem(nil) if permanent && self.item == self.initialItem
|
setInitialItem(nil) if permanent && self.item == self.initialItem
|
||||||
self.item = nil
|
self.item = nil
|
||||||
end
|
end
|
||||||
@@ -174,7 +191,7 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
self.item = b.item
|
self.item = b.item
|
||||||
b.item = nil
|
b.item = nil
|
||||||
b.effects[PBEffects::Unburden] = true
|
b.effects[PBEffects::Unburden] = true if b.hasActiveAbility?(:UNBURDEN)
|
||||||
@battle.pbHideAbilitySplash(b)
|
@battle.pbHideAbilitySplash(b)
|
||||||
pbHeldItemTriggerCheck
|
pbHeldItemTriggerCheck
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -1096,7 +1096,7 @@ class PokeBattle_Move_NegateTargetAbility < PokeBattle_Move
|
|||||||
target.effects[PBEffects::GastroAcid] = true
|
target.effects[PBEffects::GastroAcid] = true
|
||||||
target.effects[PBEffects::Truant] = false
|
target.effects[PBEffects::Truant] = false
|
||||||
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
|
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
|
||||||
target.pbOnLosingAbility(target.ability)
|
target.pbOnLosingAbility(target.ability, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1114,7 +1114,7 @@ class PokeBattle_Move_NegateTargetAbilityIfTargetActed < PokeBattle_Move
|
|||||||
target.effects[PBEffects::GastroAcid] = true
|
target.effects[PBEffects::GastroAcid] = true
|
||||||
target.effects[PBEffects::Truant] = false
|
target.effects[PBEffects::Truant] = false
|
||||||
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
|
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
|
||||||
target.pbOnLosingAbility(target.ability)
|
target.pbOnLosingAbility(target.ability, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -115,11 +115,11 @@ class PokeBattle_Move_UserTargetSwapItems < PokeBattle_Move
|
|||||||
oldTargetItem = target.item
|
oldTargetItem = target.item
|
||||||
oldTargetItemName = target.itemName
|
oldTargetItemName = target.itemName
|
||||||
user.item = oldTargetItem
|
user.item = oldTargetItem
|
||||||
user.effects[PBEffects::ChoiceBand] = nil if user.ability_id != :GORILLATACTICS
|
user.effects[PBEffects::ChoiceBand] = nil if !user.hasActiveAbility?(:GORILLATACTICS)
|
||||||
user.effects[PBEffects::Unburden] = (!user.item && oldUserItem)
|
user.effects[PBEffects::Unburden] = (!user.item && oldUserItem) if user.hasActiveAbility?(:UNBURDEN)
|
||||||
target.item = oldUserItem
|
target.item = oldUserItem
|
||||||
target.effects[PBEffects::ChoiceBand] = nil if target.ability_id != :GORILLATACTICS
|
target.effects[PBEffects::ChoiceBand] = nil if !target.hasActiveAbility?(:GORILLATACTICS)
|
||||||
target.effects[PBEffects::Unburden] = (!target.item && oldTargetItem)
|
target.effects[PBEffects::Unburden] = (!target.item && oldTargetItem) if target.hasActiveAbility?(:UNBURDEN)
|
||||||
# Permanently steal the item from wild Pokémon
|
# Permanently steal the item from wild Pokémon
|
||||||
if @battle.wildBattle? && target.opposes? && !user.initialItem &&
|
if @battle.wildBattle? && target.opposes? && !user.initialItem &&
|
||||||
oldTargetItem == target.initialItem
|
oldTargetItem == target.initialItem
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class PokeBattle_Battle
|
|||||||
pbCanChooseNonActive?(0) && @battlers[0].effects[PBEffects::Outrage]==0
|
pbCanChooseNonActive?(0) && @battlers[0].effects[PBEffects::Outrage]==0
|
||||||
idxPartyForName = idxPartyNew
|
idxPartyForName = idxPartyNew
|
||||||
enemyParty = pbParty(idxBattler)
|
enemyParty = pbParty(idxBattler)
|
||||||
if enemyParty[idxPartyNew].ability == :ILLUSION
|
if enemyParty[idxPartyNew].ability == :ILLUSION && !pbCheckGlobalAbility(:NEUTRALIZINGGAS)
|
||||||
new_index = pbLastInTeam(idxBattler)
|
new_index = pbLastInTeam(idxBattler)
|
||||||
idxPartyForName = new_index if new_index >= 0 && new_index != idxPartyNew
|
idxPartyForName = new_index if new_index >= 0 && new_index != idxPartyNew
|
||||||
end
|
end
|
||||||
@@ -249,7 +249,7 @@ class PokeBattle_Battle
|
|||||||
def pbMessagesOnReplace(idxBattler,idxParty)
|
def pbMessagesOnReplace(idxBattler,idxParty)
|
||||||
party = pbParty(idxBattler)
|
party = pbParty(idxBattler)
|
||||||
newPkmnName = party[idxParty].name
|
newPkmnName = party[idxParty].name
|
||||||
if party[idxParty].ability == :ILLUSION
|
if party[idxParty].ability == :ILLUSION && !pbCheckGlobalAbility(:NEUTRALIZINGGAS)
|
||||||
new_index = pbLastInTeam(idxBattler)
|
new_index = pbLastInTeam(idxBattler)
|
||||||
newPkmnName = party[new_index].name if new_index >= 0 && new_index != idxParty
|
newPkmnName = party[new_index].name if new_index >= 0 && new_index != idxParty
|
||||||
end
|
end
|
||||||
@@ -314,15 +314,24 @@ class PokeBattle_Battle
|
|||||||
# Called when one or more Pokémon switch in. Does a lot of things, including
|
# Called when one or more Pokémon switch in. Does a lot of things, including
|
||||||
# entry hazards, form changes and items/abilities that trigger upon switching
|
# entry hazards, form changes and items/abilities that trigger upon switching
|
||||||
# in.
|
# in.
|
||||||
def pbOnBattlerEnteringBattle(*battler_indices)
|
def pbOnBattlerEnteringBattle(battler_index, skip_event_reset = false)
|
||||||
battler_indices.flatten!
|
battler_index = [battler_index] if !battler_index.is_a?(Array)
|
||||||
eachBattler do |b|
|
battler_index.flatten!
|
||||||
b.droppedBelowHalfHP = false
|
# NOTE: This isn't done for switch commands, because they previously call
|
||||||
b.statsDropped = false
|
# pbRecallAndReplace, which could cause Neutralizing Gas to end, which
|
||||||
|
# in turn could cause Intimidate to trigger another Pokémon's Eject
|
||||||
|
# Pack. That Eject Pack should trigger at the end of this method, but
|
||||||
|
# this resetting would prevent that from happening, so it is skipped
|
||||||
|
# and instead done earlier in def pbAttackPhaseSwitch.
|
||||||
|
if !skip_event_reset
|
||||||
|
eachBattler do |b|
|
||||||
|
b.droppedBelowHalfHP = false
|
||||||
|
b.statsDropped = false
|
||||||
|
end
|
||||||
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|
|
||||||
next if !battler_indices.include?(b.index) || b.fainted?
|
next if !battler_index.include?(b.index) || b.fainted?
|
||||||
pbRecordBattlerAsParticipated(b)
|
pbRecordBattlerAsParticipated(b)
|
||||||
pbMessagesOnBattlerEnteringBattle(b)
|
pbMessagesOnBattlerEnteringBattle(b)
|
||||||
# Position/field effects triggered by the battler appearing
|
# Position/field effects triggered by the battler appearing
|
||||||
|
|||||||
@@ -59,8 +59,12 @@ class PokeBattle_Battle
|
|||||||
pbPursuit(b.index)
|
pbPursuit(b.index)
|
||||||
return if @decision>0
|
return if @decision>0
|
||||||
# Switch Pokémon
|
# Switch Pokémon
|
||||||
|
eachBattler do |b|
|
||||||
|
b.droppedBelowHalfHP = false
|
||||||
|
b.statsDropped = false
|
||||||
|
end
|
||||||
pbRecallAndReplace(b.index,idxNewPkmn)
|
pbRecallAndReplace(b.index,idxNewPkmn)
|
||||||
pbOnBattlerEnteringBattle(b.index)
|
pbOnBattlerEnteringBattle(b.index, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1683,7 +1683,7 @@ BattleHandlers::UserAbilityEndOfMove.add(:MAGICIAN,
|
|||||||
end
|
end
|
||||||
user.item = b.item
|
user.item = b.item
|
||||||
b.item = nil
|
b.item = nil
|
||||||
b.effects[PBEffects::Unburden] = true
|
b.effects[PBEffects::Unburden] = true if n.hasActiveAbility?(:UNBURDEN)
|
||||||
if battle.wildBattle? && !user.initialItem && user.item == b.initialItem
|
if battle.wildBattle? && !user.initialItem && user.item == b.initialItem
|
||||||
user.setInitialItem(user.item)
|
user.setInitialItem(user.item)
|
||||||
b.setInitialItem(nil)
|
b.setInitialItem(nil)
|
||||||
@@ -1762,7 +1762,7 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:PICKPOCKET,
|
|||||||
end
|
end
|
||||||
target.item = user.item
|
target.item = user.item
|
||||||
user.item = nil
|
user.item = nil
|
||||||
user.effects[PBEffects::Unburden] = true
|
user.effects[PBEffects::Unburden] = true if user.hasActiveAbility?(:UNBURDEN)
|
||||||
if battle.wildBattle? && !target.initialItem && target.item == user.initialItem
|
if battle.wildBattle? && !target.initialItem && target.item == user.initialItem
|
||||||
target.setInitialItem(target.item)
|
target.setInitialItem(target.item)
|
||||||
user.setInitialItem(nil)
|
user.setInitialItem(nil)
|
||||||
@@ -2338,6 +2338,33 @@ BattleHandlers::AbilityOnSwitchIn.add(:MOLDBREAKER,
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
BattleHandlers::AbilityOnSwitchIn.add(:NEUTRALIZINGGAS,
|
||||||
|
proc { |ability,battler,battle|
|
||||||
|
battle.pbShowAbilitySplash(battler, true)
|
||||||
|
battle.pbHideAbilitySplash(battler)
|
||||||
|
battle.pbDisplay(_INTL("Neutralizing gas filled the area!"))
|
||||||
|
battle.eachBattler do |b|
|
||||||
|
# Slow Start - end all turn counts
|
||||||
|
b.effects[PBEffects::SlowStart] = 0
|
||||||
|
# Truant - let b move on its first turn after Neutralizing Gas disappears
|
||||||
|
b.effects[PBEffects::Truant] = false
|
||||||
|
# Gorilla Tactics - end choice lock
|
||||||
|
if !hasActiveItem?([:CHOICEBAND, :CHOICESPECS, :CHOICESCARF])
|
||||||
|
b.effects[PBEffects::ChoiceBand] = nil
|
||||||
|
end
|
||||||
|
# Illusion - end illusions
|
||||||
|
if b.effects[PBEffects::Illusion]
|
||||||
|
b.effects[PBEffects::Illusion] = nil
|
||||||
|
if !b.effects[PBEffects::Transform]
|
||||||
|
battle.scene.pbChangePokemon(b, b.pokemon)
|
||||||
|
battle.pbDisplay(_INTL("{1}'s {2} wore off!", b.pbThis, b.abilityName))
|
||||||
|
battle.pbSetSeen(b)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
BattleHandlers::AbilityOnSwitchIn.add(:PRESSURE,
|
BattleHandlers::AbilityOnSwitchIn.add(:PRESSURE,
|
||||||
proc { |ability,battler,battle|
|
proc { |ability,battler,battle|
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
|
|||||||
@@ -1201,7 +1201,7 @@ BattleHandlers::TargetItemOnHit.add(:STICKYBARB,
|
|||||||
next if user.fainted? || user.item
|
next if user.fainted? || user.item
|
||||||
user.item = target.item
|
user.item = target.item
|
||||||
target.item = nil
|
target.item = nil
|
||||||
target.effects[PBEffects::Unburden] = true
|
target.effects[PBEffects::Unburden] = true if target.hasActiveAbility?(:UNBURDEN)
|
||||||
if battle.wildBattle? && !user.opposes?
|
if battle.wildBattle? && !user.opposes?
|
||||||
if !user.initialItem && user.item == target.initialItem
|
if !user.initialItem && user.item == target.initialItem
|
||||||
user.setInitialItem(user.item)
|
user.setInitialItem(user.item)
|
||||||
|
|||||||
Reference in New Issue
Block a user