Tidying up of Gen 8 ability code, fixed Analytic's effect, added trigger for berry consuming when Unnerve ends

This commit is contained in:
Maruno17
2021-10-17 19:49:25 +01:00
parent c68e5e7abf
commit 72c50db6c0
6 changed files with 373 additions and 370 deletions

View File

@@ -373,6 +373,8 @@ class PokeBattle_Battler
:STANCECHANGE,
:ZENMODE,
# Abilities intended to be inherent properties of a certain species
:ASONECHILLINGNEIGH,
:ASONEGRIMNEIGH,
:COMATOSE,
:RKSSYSTEM
]
@@ -402,6 +404,8 @@ class PokeBattle_Battler
:ILLUSION,
:IMPOSTER,
# Abilities intended to be inherent properties of a certain species
:ASONECHILLINGNEIGH,
:ASONEGRIMNEIGH,
:COMATOSE,
:RKSSYSTEM,
# Abilities that can't be negated

View File

@@ -11,8 +11,9 @@ class PokeBattle_Battler
# Treat self as fainted
@hp = 0
@fainted = true
# Check for end of Neutralizing Gas
# Check for end of Neutralizing Gas/Unnerve
pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true)
pbItemsOnUnnerveEnding if hasActiveAbility?(:UNNERVE, true)
# Check for end of primordial weather
@battle.pbEndPrimordialWeather
end
@@ -28,6 +29,7 @@ class PokeBattle_Battler
BattleHandlers.triggerAbilityOnBattlerFainting(b.ability,b,self,@battle)
end
pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true)
pbItemsOnUnnerveEnding if hasActiveAbility?(:UNNERVE, true)
end
# Used for Emergency Exit/Wimp Out. Returns whether self has switched out.
@@ -105,6 +107,8 @@ class PokeBattle_Battler
def pbOnLosingAbility(oldAbil, suppressed = false)
if oldAbil == :NEUTRALIZINGGAS && (suppressed || !@effects[PBEffects::GastroAcid])
pbAbilitiesOnNeutralizingGasEnding
elsif oldAbil == :UNNERVE && (suppressed || !@effects[PBEffects::GastroAcid])
pbItemsOnUnnerveEnding
elsif oldAbil == :ILLUSION && @effects[PBEffects::Illusion]
@effects[PBEffects::Illusion] = nil
if !@effects[PBEffects::Transform]
@@ -316,4 +320,10 @@ class PokeBattle_Battler
return false if !itemActive?
return BattleHandlers.triggerItemOnStatDropped(self.item, self, move_user, @battle)
end
def pbItemsOnUnnerveEnding
@battle.pbPriority(true).each do |b|
b.pbHeldItemTriggerCheck if b.item && b.item.is_berry?
end
end
end