Grouped all ability blacklists together

This commit is contained in:
Maruno17
2020-09-12 22:00:25 +01:00
parent 0fc544adb8
commit d4db99719b
6 changed files with 85 additions and 348 deletions

View File

@@ -338,25 +338,54 @@ class PokeBattle_Battler
end
alias hasWorkingAbility hasActiveAbility?
def nonNegatableAbility?
# Applies to both losing self's ability (i.e. being replaced by another) and
# having self's ability be negated.
def unstoppableAbility?
abilityBlacklist = [
# Form-changing abilities
:BATTLEBOND,
:DISGUISE,
# :FLOWERGIFT, # This can be negated
# :FORECAST, # This can be negated
:MULTITYPE,
:POWERCONSTRUCT,
:SCHOOLING,
:SHIELDSDOWN,
:STANCECHANGE,
:ZENMODE,
# Abilities intended to be inherent properties of a certain species
:COMATOSE,
:RKSSYSTEM
# Form-changing abilities
:BATTLEBOND,
:DISGUISE,
# :FLOWERGIFT, # This can be stopped
# :FORECAST, # This can be stopped
:MULTITYPE,
:POWERCONSTRUCT,
:SCHOOLING,
:SHIELDSDOWN,
:STANCECHANGE,
:ZENMODE,
# Abilities intended to be inherent properties of a certain species
:COMATOSE,
:RKSSYSTEM
]
abilityBlacklist.each do |abil|
return true if isConst?(@ability,PBAbilities,abil)
abilityBlacklist.each do |a|
return true if isConst?(@ability, PBAbilities, a)
end
return false
end
# Applies to gaining the ability.
def ungainableAbility?(abil)
abilityBlacklist = [
# Form-changing abilities
:BATTLEBOND,
:DISGUISE,
:FLOWERGIFT,
:FORECAST,
:MULTITYPE,
:POWERCONSTRUCT,
:SCHOOLING,
:SHIELDSDOWN,
:STANCECHANGE,
:ZENMODE,
# Appearance-changing abilities
:ILLUSION,
:IMPOSTER,
# Abilities intended to be inherent properties of a certain species
:COMATOSE,
:RKSSYSTEM
]
abilityBlacklist.each do |a|
return true if isConst?(abil, PBAbilities, a)
end
return false
end

View File

@@ -109,7 +109,7 @@ class PokeBattle_Battler
# These effects are passed on if Baton Pass is used, but they need to be
# cancelled in certain circumstances anyway
@effects[PBEffects::Telekinesis] = 0 if isSpecies?(:GENGAR) && mega?
@effects[PBEffects::GastroAcid] = false if nonNegatableAbility?
@effects[PBEffects::GastroAcid] = false if unstoppableAbility?
else
# These effects are passed on if Baton Pass is used
@stages[PBStats::ATTACK] = 0

View File

@@ -10,7 +10,7 @@ class PokeBattle_Battler
# Ending primordial weather, checking Trace
pbContinualAbilityChecks(true)
# Abilities that trigger upon switching in
if (!fainted? && nonNegatableAbility?) || abilityActive?
if (!fainted? && unstoppableAbility?) || abilityActive?
BattleHandlers.triggerAbilityOnSwitchIn(@ability,self,@battle)
end
# Check for end of primordial weather
@@ -72,36 +72,13 @@ class PokeBattle_Battler
# in and not at any later times, even if a traceable ability turns
# up later. Essentials ignores this, and allows Trace to trigger
# whenever it can even in the old battle mechanics.
abilityBlacklist = [
# Replaces self with another ability
:POWEROFALCHEMY,
:RECEIVER,
:TRACE,
# Form-changing abilities
:BATTLEBOND,
:DISGUISE,
:FLOWERGIFT,
:FORECAST,
:MULTITYPE,
:POWERCONSTRUCT,
:SCHOOLING,
:SHIELDSDOWN,
:STANCECHANGE,
:ZENMODE,
# Appearance-changing abilities
:ILLUSION,
:IMPOSTER,
# Abilities intended to be inherent properties of a certain species
:COMATOSE,
:RKSSYSTEM
]
choices = []
@battle.eachOtherSideBattler(@index) do |b|
abilityBlacklist.each do |abil|
next if !isConst?(b.ability,PBAbilities,abil)
choices.push(b)
break
end
next if b.ungainableAbility? ||
isConst?(b.ability, PBAbilities, :POWEROFALCHEMY) ||
isConst?(b.ability, PBAbilities, :RECEIVER) ||
isConst?(b.ability, PBAbilities, :TRACE)
choices.push(b)
end
if choices.length>0
choice = choices[@battle.pbRandom(choices.length)]
@@ -109,7 +86,7 @@ class PokeBattle_Battler
@ability = choice.ability
@battle.pbDisplay(_INTL("{1} traced {2}'s {3}!",pbThis,choice.pbThis(true),choice.abilityName))
@battle.pbHideAbilitySplash(self)
if !onSwitchIn && (nonNegatableAbility? || abilityActive?)
if !onSwitchIn && (unstoppableAbility? || abilityActive?)
BattleHandlers.triggerAbilityOnSwitchIn(@ability,self,@battle)
end
end
@@ -138,7 +115,7 @@ class PokeBattle_Battler
@battle.pbSetSeen(self)
end
end
@effects[PBEffects::GastroAcid] = false if nonNegatableAbility?
@effects[PBEffects::GastroAcid] = false if unstoppableAbility?
@effects[PBEffects::SlowStart] = 0 if !isConst?(@ability,PBAbilities,:SLOWSTART)
# Revert form if Flower Gift/Forecast was lost
pbCheckFormOnWeatherChange