mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Battlers now make use of Ability objects to be consistent with Pokemon objects
This commit is contained in:
@@ -8,7 +8,7 @@ class PokeBattle_Battler
|
||||
attr_accessor :species
|
||||
attr_accessor :type1
|
||||
attr_accessor :type2
|
||||
attr_accessor :ability
|
||||
attr_accessor :ability_id
|
||||
attr_accessor :moves
|
||||
attr_accessor :gender
|
||||
attr_accessor :iv
|
||||
@@ -59,6 +59,15 @@ class PokeBattle_Battler
|
||||
@pokemon.form = value if @pokemon
|
||||
end
|
||||
|
||||
def ability
|
||||
return PokemonData::Ability.try_get(@ability_id)
|
||||
end
|
||||
|
||||
def ability=(value)
|
||||
abil = PokemonData::Ability.try_get(value)
|
||||
@ability_id = (abil) ? abil.id : nil
|
||||
end
|
||||
|
||||
attr_reader :item
|
||||
|
||||
def item=(value)
|
||||
@@ -181,8 +190,12 @@ class PokeBattle_Battler
|
||||
end
|
||||
alias owned owned?
|
||||
|
||||
def abilityName; return Data::Ability.get(@ability).name; end
|
||||
def itemName; return PBItems.getName(@item); end
|
||||
def abilityName
|
||||
abil = self.ability
|
||||
return (abil) ? abil.name : ""
|
||||
end
|
||||
|
||||
def itemName; return PBItems.getName(@item); end
|
||||
|
||||
def pbThis(lowerCase=false)
|
||||
if opposes?
|
||||
@@ -223,7 +236,7 @@ class PokeBattle_Battler
|
||||
speedMult = 1.0
|
||||
# Ability effects that alter calculated Speed
|
||||
if abilityActive?
|
||||
speedMult = BattleHandlers.triggerSpeedCalcAbility(@ability,self,speedMult)
|
||||
speedMult = BattleHandlers.triggerSpeedCalcAbility(self.ability,self,speedMult)
|
||||
end
|
||||
# Item effects that alter calculated Speed
|
||||
if itemActive?
|
||||
@@ -250,7 +263,7 @@ class PokeBattle_Battler
|
||||
ret += @effects[PBEffects::WeightChange]
|
||||
ret = 1 if ret<1
|
||||
if abilityActive? && !@battle.moldBreaker
|
||||
ret = BattleHandlers.triggerWeightCalcAbility(@ability,self,ret)
|
||||
ret = BattleHandlers.triggerWeightCalcAbility(self.ability,self,ret)
|
||||
end
|
||||
if itemActive?
|
||||
ret = BattleHandlers.triggerWeightCalcItem(@item,self,ret)
|
||||
@@ -326,18 +339,18 @@ class PokeBattle_Battler
|
||||
|
||||
def hasActiveAbility?(check_ability, ignoreFainted = false)
|
||||
return false if !abilityActive?(ignoreFainted)
|
||||
if check_ability.is_a?(Array)
|
||||
return check_ability.any? { |a| a == @ability }
|
||||
end
|
||||
return check_ability == @ability
|
||||
return check_ability.include?(@ability_id) if check_ability.is_a?(Array)
|
||||
return check_ability == self.ability
|
||||
end
|
||||
alias hasWorkingAbility hasActiveAbility?
|
||||
|
||||
# Applies to both losing self's ability (i.e. being replaced by another) and
|
||||
# having self's ability be negated.
|
||||
def unstoppableAbility?(abil = nil)
|
||||
abil = @ability if !abil
|
||||
abilityBlacklist = [
|
||||
abil = @ability_id if !abil
|
||||
abil = PokemonData::Ability.try_get(abil)
|
||||
return false if !abil
|
||||
ability_blacklist = [
|
||||
# Form-changing abilities
|
||||
:BATTLEBOND,
|
||||
:DISGUISE,
|
||||
@@ -353,13 +366,15 @@ class PokeBattle_Battler
|
||||
:COMATOSE,
|
||||
:RKSSYSTEM
|
||||
]
|
||||
return abilityBlacklist.any? { |a| a == abil }
|
||||
return ability_blacklist.include?(abil.id)
|
||||
end
|
||||
|
||||
# Applies to gaining the ability.
|
||||
def ungainableAbility?(abil = nil)
|
||||
abil = @ability if !abil
|
||||
abilityBlacklist = [
|
||||
abil = @ability_id if !abil
|
||||
abil = PokemonData::Ability.try_get(abil)
|
||||
return false if !abil
|
||||
ability_blacklist = [
|
||||
# Form-changing abilities
|
||||
:BATTLEBOND,
|
||||
:DISGUISE,
|
||||
@@ -378,7 +393,7 @@ class PokeBattle_Battler
|
||||
:COMATOSE,
|
||||
:RKSSYSTEM
|
||||
]
|
||||
return abilityBlacklist.any? { |a| a == abil }
|
||||
return ability_blacklist.include?(abil.id)
|
||||
end
|
||||
|
||||
def itemActive?(ignoreFainted=false)
|
||||
@@ -410,7 +425,7 @@ class PokeBattle_Battler
|
||||
return false if @effects[PBEffects::Transform]
|
||||
# Items that change a Pokémon's form
|
||||
return true if @pokemon && @pokemon.getMegaForm(true) > 0 # Mega Stone
|
||||
return pbIsUnlosableItem?(check_item, @species, @ability)
|
||||
return pbIsUnlosableItem?(check_item, @species, self.ability)
|
||||
end
|
||||
|
||||
def eachMove
|
||||
@@ -448,7 +463,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def canChangeType?
|
||||
return ![:MULTITYPE, :RKSSYSTEM].include?(@ability)
|
||||
return ![:MULTITYPE, :RKSSYSTEM].include?(@ability_id)
|
||||
end
|
||||
|
||||
def airborne?
|
||||
|
||||
@@ -21,7 +21,7 @@ class PokeBattle_Battler
|
||||
@level = 0
|
||||
@hp = @totalhp = 0
|
||||
@type1 = @type2 = 0
|
||||
@ability = nil
|
||||
@ability_id = nil
|
||||
@item = 0
|
||||
@gender = 0
|
||||
@attack = @defense = @spatk = @spdef = @speed = 0
|
||||
@@ -78,7 +78,7 @@ class PokeBattle_Battler
|
||||
@totalhp = pkmn.totalhp
|
||||
@type1 = pkmn.type1
|
||||
@type2 = pkmn.type2
|
||||
@ability = pkmn.ability_id
|
||||
@ability_id = pkmn.ability_id
|
||||
@item = pkmn.item
|
||||
@gender = pkmn.gender
|
||||
@attack = pkmn.attack
|
||||
@@ -285,19 +285,19 @@ class PokeBattle_Battler
|
||||
def pbUpdate(fullChange=false)
|
||||
return if !@pokemon
|
||||
@pokemon.calcStats
|
||||
@level = @pokemon.level
|
||||
@hp = @pokemon.hp
|
||||
@totalhp = @pokemon.totalhp
|
||||
@level = @pokemon.level
|
||||
@hp = @pokemon.hp
|
||||
@totalhp = @pokemon.totalhp
|
||||
if !@effects[PBEffects::Transform]
|
||||
@attack = @pokemon.attack
|
||||
@defense = @pokemon.defense
|
||||
@spatk = @pokemon.spatk
|
||||
@spdef = @pokemon.spdef
|
||||
@speed = @pokemon.speed
|
||||
@attack = @pokemon.attack
|
||||
@defense = @pokemon.defense
|
||||
@spatk = @pokemon.spatk
|
||||
@spdef = @pokemon.spdef
|
||||
@speed = @pokemon.speed
|
||||
if fullChange
|
||||
@type1 = @pokemon.type1
|
||||
@type2 = @pokemon.type2
|
||||
@ability = @pokemon.ability_id
|
||||
@type1 = @pokemon.type1
|
||||
@type2 = @pokemon.type2
|
||||
@ability_id = @pokemon.ability_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -209,7 +209,7 @@ class PokeBattle_Battler
|
||||
# Form changes upon entering battle and when the weather changes
|
||||
pbCheckFormOnWeatherChange if !endOfRound
|
||||
# Darmanitan - Zen Mode
|
||||
if isSpecies?(:DARMANITAN) && @ability == :ZENMODE
|
||||
if isSpecies?(:DARMANITAN) && self.ability == :ZENMODE
|
||||
if @hp<=@totalhp/2
|
||||
if @form!=1
|
||||
@battle.pbShowAbilitySplash(self,true)
|
||||
@@ -223,7 +223,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
end
|
||||
# Minior - Shields Down
|
||||
if isSpecies?(:MINIOR) && @ability == :SHIELDSDOWN
|
||||
if isSpecies?(:MINIOR) && self.ability == :SHIELDSDOWN
|
||||
if @hp>@totalhp/2 # Turn into Meteor form
|
||||
newForm = (@form>=7) ? @form-7 : @form
|
||||
if @form!=newForm
|
||||
@@ -240,7 +240,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
end
|
||||
# Wishiwashi - Schooling
|
||||
if isSpecies?(:WISHIWASHI) && @ability == :SCHOOLING
|
||||
if isSpecies?(:WISHIWASHI) && self.ability == :SCHOOLING
|
||||
if @level>=20 && @hp>@totalhp/4
|
||||
if @form!=1
|
||||
@battle.pbShowAbilitySplash(self,true)
|
||||
@@ -254,7 +254,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
end
|
||||
# Zygarde - Power Construct
|
||||
if isSpecies?(:ZYGARDE) && @ability == :POWERCONSTRUCT && endOfRound
|
||||
if isSpecies?(:ZYGARDE) && self.ability == :POWERCONSTRUCT && endOfRound
|
||||
if @hp<=@totalhp/2 && @form<2 # Turn into Complete Forme
|
||||
newForm = @form+2
|
||||
@battle.pbDisplay(_INTL("You sense the presence of many!"))
|
||||
@@ -266,11 +266,11 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def pbTransform(target)
|
||||
oldAbil = @ability
|
||||
oldAbil = @ability_id
|
||||
@effects[PBEffects::Transform] = true
|
||||
@effects[PBEffects::TransformSpecies] = target.species
|
||||
pbChangeTypes(target)
|
||||
@ability = target.ability
|
||||
self.ability = target.ability
|
||||
@attack = target.attack
|
||||
@defense = target.defense
|
||||
@spatk = target.spatk
|
||||
|
||||
@@ -9,14 +9,14 @@ class PokeBattle_Battler
|
||||
# "counts as having that status", which includes Comatose which can't be
|
||||
# cured.
|
||||
def pbHasStatus?(checkStatus)
|
||||
if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(@ability,self,checkStatus)
|
||||
if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,checkStatus)
|
||||
return true
|
||||
end
|
||||
return @status==checkStatus
|
||||
end
|
||||
|
||||
def pbHasAnyStatus?
|
||||
if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(@ability,self,nil)
|
||||
if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,nil)
|
||||
return true
|
||||
end
|
||||
return @status!=PBStatuses::NONE
|
||||
@@ -103,10 +103,10 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Ability immunity
|
||||
immuneByAbility = false; immAlly = nil
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,newStatus)
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus)
|
||||
immuneByAbility = true
|
||||
elsif selfInflicted || !@battle.moldBreaker
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,newStatus)
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
||||
immuneByAbility = true
|
||||
else
|
||||
eachAlly do |b|
|
||||
@@ -193,10 +193,10 @@ class PokeBattle_Battler
|
||||
end
|
||||
return false if hasImmuneType
|
||||
# Ability immunity
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,newStatus)
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus)
|
||||
return false
|
||||
end
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,newStatus)
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
||||
return false
|
||||
end
|
||||
eachAlly do |b|
|
||||
@@ -249,7 +249,7 @@ class PokeBattle_Battler
|
||||
pbCheckFormOnStatusChange
|
||||
# Synchronize
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatusInflicted(@ability,self,user,newStatus)
|
||||
BattleHandlers.triggerAbilityOnStatusInflicted(self.ability,self,user,newStatus)
|
||||
end
|
||||
# Status cures
|
||||
pbItemStatusCureCheck
|
||||
@@ -287,13 +287,13 @@ class PokeBattle_Battler
|
||||
return false if b.effects[PBEffects::Uproar]>0
|
||||
end
|
||||
end
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,PBStatuses::SLEEP)
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,PBStatuses::SLEEP)
|
||||
return false
|
||||
end
|
||||
# NOTE: Bulbapedia claims that Flower Veil shouldn't prevent sleep due to
|
||||
# drowsiness, but I disagree because that makes no sense. Also, the
|
||||
# comparable Sweet Veil does prevent sleep due to drowsiness.
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,PBStatuses::SLEEP)
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,PBStatuses::SLEEP)
|
||||
return false
|
||||
end
|
||||
eachAlly do |b|
|
||||
|
||||
@@ -58,7 +58,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat gain
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatGain(@ability,self,stat,user)
|
||||
BattleHandlers.triggerAbilityOnStatGain(self.ability,self,stat,user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -88,7 +88,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat gain
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatGain(@ability,self,stat,user)
|
||||
BattleHandlers.triggerAbilityOnStatGain(self.ability,self,stat,user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -133,9 +133,9 @@ class PokeBattle_Battler
|
||||
end
|
||||
if abilityActive?
|
||||
return false if BattleHandlers.triggerStatLossImmunityAbility(
|
||||
@ability,self,stat,@battle,showFailMsg) if !@battle.moldBreaker
|
||||
self.ability,self,stat,@battle,showFailMsg) if !@battle.moldBreaker
|
||||
return false if BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(
|
||||
@ability,self,stat,@battle,showFailMsg)
|
||||
self.ability,self,stat,@battle,showFailMsg)
|
||||
end
|
||||
if !@battle.moldBreaker
|
||||
eachAlly do |b|
|
||||
@@ -191,7 +191,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat loss
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatLoss(@ability,self,stat,user)
|
||||
BattleHandlers.triggerAbilityOnStatLoss(self.ability,self,stat,user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -221,7 +221,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat loss
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatLoss(@ability,self,stat,user)
|
||||
BattleHandlers.triggerAbilityOnStatLoss(self.ability,self,stat,user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -266,8 +266,8 @@ class PokeBattle_Battler
|
||||
return false
|
||||
end
|
||||
if abilityActive?
|
||||
if BattleHandlers.triggerStatLossImmunityAbility(@ability,self,PBStats::ATTACK,@battle,false) ||
|
||||
BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(@ability,self,PBStats::ATTACK,@battle,false)
|
||||
if BattleHandlers.triggerStatLossImmunityAbility(self.ability,self,PBStats::ATTACK,@battle,false) ||
|
||||
BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(self.ability,self,PBStats::ATTACK,@battle,false)
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
|
||||
pbThis,abilityName,user.pbThis(true),user.abilityName))
|
||||
return false
|
||||
|
||||
@@ -11,7 +11,7 @@ class PokeBattle_Battler
|
||||
pbContinualAbilityChecks(true)
|
||||
# Abilities that trigger upon switching in
|
||||
if (!fainted? && unstoppableAbility?) || abilityActive?
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(@ability,self,@battle)
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(self.ability,self,@battle)
|
||||
end
|
||||
# Check for end of primordial weather
|
||||
@battle.pbEndPrimordialWeather
|
||||
@@ -29,7 +29,7 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
def pbAbilitiesOnSwitchOut
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnSwitchOut(@ability,self,false)
|
||||
BattleHandlers.triggerAbilityOnSwitchOut(self.ability,self,false)
|
||||
end
|
||||
# Reset form
|
||||
@battle.peer.pbOnLeavingBattle(@battle,@pokemon,@battle.usedInBattle[idxOwnSide][@index/2])
|
||||
@@ -57,7 +57,7 @@ class PokeBattle_Battler
|
||||
return false if !abilityActive?
|
||||
newHP = @hp if newHP<0
|
||||
return false if oldHP<@totalhp/2 || newHP>=@totalhp/2 # Didn't drop below half
|
||||
ret = BattleHandlers.triggerAbilityOnHPDroppedBelowHalf(@ability,self,@battle)
|
||||
ret = BattleHandlers.triggerAbilityOnHPDroppedBelowHalf(self.ability,self,@battle)
|
||||
return ret # Whether self has switched out
|
||||
end
|
||||
|
||||
@@ -81,11 +81,11 @@ class PokeBattle_Battler
|
||||
if choices.length>0
|
||||
choice = choices[@battle.pbRandom(choices.length)]
|
||||
@battle.pbShowAbilitySplash(self)
|
||||
@ability = choice.ability
|
||||
self.ability = choice.ability
|
||||
@battle.pbDisplay(_INTL("{1} traced {2}'s {3}!",pbThis,choice.pbThis(true),choice.abilityName))
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
if !onSwitchIn && (unstoppableAbility? || abilityActive?)
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(@ability,self,@battle)
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(self.ability,self,@battle)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -97,7 +97,7 @@ class PokeBattle_Battler
|
||||
# Cures status conditions, confusion and infatuation.
|
||||
def pbAbilityStatusCureCheck
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerStatusCureAbility(@ability,self)
|
||||
BattleHandlers.triggerStatusCureAbility(self.ability,self)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,12 +109,12 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::Illusion] = nil
|
||||
if !@effects[PBEffects::Transform]
|
||||
@battle.scene.pbChangePokemon(self, @pokemon)
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} wore off!", pbThis, Data::Ability.get(oldAbil).name))
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} wore off!", pbThis, PokemonData::Ability.get(oldAbil).name))
|
||||
@battle.pbSetSeen(self)
|
||||
end
|
||||
end
|
||||
@effects[PBEffects::GastroAcid] = false if unstoppableAbility?
|
||||
@effects[PBEffects::SlowStart] = 0 if @ability != :SLOWSTART
|
||||
@effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART
|
||||
# Revert form if Flower Gift/Forecast was lost
|
||||
pbCheckFormOnWeatherChange
|
||||
# Check for end of primordial weather
|
||||
|
||||
@@ -216,7 +216,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
end
|
||||
# Stance Change
|
||||
if isSpecies?(:AEGISLASH) && @ability == :STANCECHANGE
|
||||
if isSpecies?(:AEGISLASH) && self.ability == :STANCECHANGE
|
||||
if move.damagingMove?
|
||||
pbChangeForm(1,_INTL("{1} changed to Blade Forme!",pbThis))
|
||||
elsif isConst?(move.id,PBMoves,:KINGSSHIELD)
|
||||
|
||||
@@ -239,7 +239,7 @@ class PokeBattle_Battler
|
||||
if @effects[PBEffects::Flinch]
|
||||
@battle.pbDisplay(_INTL("{1} flinched and couldn't move!",pbThis))
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnFlinch(@ability,self,@battle)
|
||||
BattleHandlers.triggerAbilityOnFlinch(self.ability,self,@battle)
|
||||
end
|
||||
@lastMoveFailed = true
|
||||
return false
|
||||
|
||||
@@ -1997,7 +1997,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_063 < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !Data::Ability.exists?(:SIMPLE)
|
||||
if !PokemonData::Ability.exists?(:SIMPLE)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2030,7 +2030,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_064 < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !Data::Ability.exists?(:INSOMNIA)
|
||||
if !PokemonData::Ability.exists?(:INSOMNIA)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2038,7 +2038,7 @@ class PokeBattle_Move_064 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability)
|
||||
if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability_id)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2073,12 +2073,12 @@ class PokeBattle_Move_065 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.ability==0 || user.ability==target.ability
|
||||
if !target.ability || user.ability==target.ability
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
if target.ungainableAbility? ||
|
||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(target.ability)
|
||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(target.ability_id)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2105,12 +2105,12 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_066 < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.ability==0
|
||||
if !user.ability
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
if user.ungainableAbility? ||
|
||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(user.ability)
|
||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(user.ability_id)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2146,7 +2146,7 @@ class PokeBattle_Move_067 < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.ability==0
|
||||
if !user.ability
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -2162,7 +2162,7 @@ class PokeBattle_Move_067 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if target.ability==0 ||
|
||||
if !target.ability ||
|
||||
(user.ability==target.ability && !NEWEST_BATTLE_MECHANICS)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
|
||||
@@ -1387,7 +1387,7 @@ class PokeBattle_AI
|
||||
if target.effects[PBEffects::Substitute]>0
|
||||
score -= 90
|
||||
elsif skill>=PBTrainerAI.mediumSkill
|
||||
if [:MULTITYPE, :RKSSYSTEM, :SIMPLE, :TRUANT].include?(target.ability)
|
||||
if [:MULTITYPE, :RKSSYSTEM, :SIMPLE, :TRUANT].include?(target.ability_id)
|
||||
score -= 90
|
||||
end
|
||||
end
|
||||
@@ -1396,7 +1396,7 @@ class PokeBattle_AI
|
||||
if target.effects[PBEffects::Substitute]>0
|
||||
score -= 90
|
||||
elsif skill>=PBTrainerAI.mediumSkill
|
||||
if [:INSOMNIA, :MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability)
|
||||
if [:INSOMNIA, :MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability_id)
|
||||
score -= 90
|
||||
end
|
||||
end
|
||||
@@ -1404,10 +1404,10 @@ class PokeBattle_AI
|
||||
when "065"
|
||||
score -= 40 # don't prefer this move
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if target.ability==0 || user.ability==target.ability ||
|
||||
[:MULTITYPE, :RKSSYSTEM].include?(user.ability) ||
|
||||
if !target.ability || user.ability==target.ability ||
|
||||
[:MULTITYPE, :RKSSYSTEM].include?(user.ability_id) ||
|
||||
[:FLOWERGIFT, :FORECAST, :ILLUSION, :IMPOSTER, :MULTITYPE, :RKSSYSTEM,
|
||||
:TRACE, :WONDERGUARD, :ZENMODE].include?(target.ability)
|
||||
:TRACE, :WONDERGUARD, :ZENMODE].include?(target.ability_id)
|
||||
score -= 90
|
||||
end
|
||||
end
|
||||
@@ -1424,10 +1424,10 @@ class PokeBattle_AI
|
||||
if target.effects[PBEffects::Substitute]>0
|
||||
score -= 90
|
||||
elsif skill>=PBTrainerAI.mediumSkill
|
||||
if user.ability==0 || user.ability==target.ability ||
|
||||
[:MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability) ||
|
||||
if !user.ability || user.ability==target.ability ||
|
||||
[:MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability_id) ||
|
||||
[:FLOWERGIFT, :FORECAST, :ILLUSION, :IMPOSTER, :MULTITYPE, :RKSSYSTEM,
|
||||
:TRACE, :ZENMODE].include?(user.ability)
|
||||
:TRACE, :ZENMODE].include?(user.ability_id)
|
||||
score -= 90
|
||||
end
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
@@ -1442,10 +1442,10 @@ class PokeBattle_AI
|
||||
when "067"
|
||||
score -= 40 # don't prefer this move
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if (user.ability==0 && target.ability==0) ||
|
||||
if (!user.ability && !target.ability) ||
|
||||
user.ability==target.ability ||
|
||||
[:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(user.ability) ||
|
||||
[:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(target.ability)
|
||||
[:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(user.ability_id) ||
|
||||
[:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(target.ability_id)
|
||||
score -= 90
|
||||
end
|
||||
end
|
||||
@@ -1462,7 +1462,7 @@ class PokeBattle_AI
|
||||
target.effects[PBEffects::GastroAcid]
|
||||
score -= 90
|
||||
elsif skill>=PBTrainerAI.highSkill
|
||||
score -= 90 if [:MULTITYPE, :RKSSYSTEM, :SLOWSTART, :TRUANT].include?(target.ability)
|
||||
score -= 90 if [:MULTITYPE, :RKSSYSTEM, :SLOWSTART, :TRUANT].include?(target.ability_id)
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "069"
|
||||
|
||||
@@ -2419,7 +2419,7 @@ BattleHandlers::AbilityChangeOnBattlerFainting.add(:POWEROFALCHEMY,
|
||||
proc { |ability,battler,fainted,battle|
|
||||
next if battler.opposes?(fainted)
|
||||
next if fainted.ungainableAbility? ||
|
||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(fainted.ability)
|
||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(fainted.ability_id)
|
||||
battle.pbShowAbilitySplash(battler,true)
|
||||
battler.ability = fainted.ability
|
||||
battle.pbReplaceAbilitySplash(battler)
|
||||
|
||||
Reference in New Issue
Block a user