mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 22:54:59 +00:00
Added class Data::Ability and made all code use symbols for abilities instead of numbers. Also added class Data::Item but it's unused.
This commit is contained in:
@@ -181,7 +181,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
alias owned owned?
|
||||
|
||||
def abilityName; return PBAbilities.getName(@ability); end
|
||||
def abilityName; return Data::Ability.get(@ability).name; end
|
||||
def itemName; return PBItems.getName(@item); end
|
||||
|
||||
def pbThis(lowerCase=false)
|
||||
@@ -324,17 +324,12 @@ class PokeBattle_Battler
|
||||
return true
|
||||
end
|
||||
|
||||
def hasActiveAbility?(ability,ignoreFainted=false)
|
||||
def hasActiveAbility?(check_ability, ignoreFainted = false)
|
||||
return false if !abilityActive?(ignoreFainted)
|
||||
if ability.is_a?(Array)
|
||||
ability.each do |a|
|
||||
a = getID(PBAbilities,a)
|
||||
return true if a!=0 && a==@ability
|
||||
end
|
||||
return false
|
||||
if check_ability.is_a?(Array)
|
||||
return check_ability.any? { |a| a == @ability }
|
||||
end
|
||||
ability = getID(PBAbilities,ability)
|
||||
return ability!=0 && ability==@ability
|
||||
return check_ability == @ability
|
||||
end
|
||||
alias hasWorkingAbility hasActiveAbility?
|
||||
|
||||
@@ -358,10 +353,7 @@ class PokeBattle_Battler
|
||||
:COMATOSE,
|
||||
:RKSSYSTEM
|
||||
]
|
||||
abilityBlacklist.each do |a|
|
||||
return true if isConst?(abil, PBAbilities, a)
|
||||
end
|
||||
return false
|
||||
return abilityBlacklist.any? { |a| a == abil }
|
||||
end
|
||||
|
||||
# Applies to gaining the ability.
|
||||
@@ -386,10 +378,7 @@ class PokeBattle_Battler
|
||||
:COMATOSE,
|
||||
:RKSSYSTEM
|
||||
]
|
||||
abilityBlacklist.each do |a|
|
||||
return true if isConst?(abil, PBAbilities, a)
|
||||
end
|
||||
return false
|
||||
return abilityBlacklist.any? { |a| a == abil }
|
||||
end
|
||||
|
||||
def itemActive?(ignoreFainted=false)
|
||||
@@ -459,9 +448,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def canChangeType?
|
||||
return false if isConst?(@ability,PBAbilities,:MULTITYPE) ||
|
||||
isConst?(@ability,PBAbilities,:RKSSYSTEM)
|
||||
return true
|
||||
return ![:MULTITYPE, :RKSSYSTEM].include?(@ability)
|
||||
end
|
||||
|
||||
def airborne?
|
||||
|
||||
@@ -21,7 +21,7 @@ class PokeBattle_Battler
|
||||
@level = 0
|
||||
@hp = @totalhp = 0
|
||||
@type1 = @type2 = 0
|
||||
@ability = 0
|
||||
@ability = 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
|
||||
@ability = pkmn.ability_id
|
||||
@item = pkmn.item
|
||||
@gender = pkmn.gender
|
||||
@attack = pkmn.attack
|
||||
@@ -297,7 +297,7 @@ class PokeBattle_Battler
|
||||
if fullChange
|
||||
@type1 = @pokemon.type1
|
||||
@type2 = @pokemon.type2
|
||||
@ability = @pokemon.ability
|
||||
@ability = @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) && isConst?(@ability,PBAbilities,:ZENMODE)
|
||||
if isSpecies?(:DARMANITAN) && @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) && isConst?(@ability,PBAbilities,:SHIELDSDOWN)
|
||||
if isSpecies?(:MINIOR) && @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) && isConst?(@ability,PBAbilities,:SCHOOLING)
|
||||
if isSpecies?(:WISHIWASHI) && @ability == :SCHOOLING
|
||||
if @level>=20 && @hp>@totalhp/4
|
||||
if @form!=1
|
||||
@battle.pbShowAbilitySplash(self,true)
|
||||
@@ -254,8 +254,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
end
|
||||
# Zygarde - Power Construct
|
||||
if isSpecies?(:ZYGARDE) && isConst?(@ability,PBAbilities,:POWERCONSTRUCT) &&
|
||||
endOfRound
|
||||
if isSpecies?(:ZYGARDE) && @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!"))
|
||||
|
||||
@@ -75,9 +75,7 @@ class PokeBattle_Battler
|
||||
choices = []
|
||||
@battle.eachOtherSideBattler(@index) do |b|
|
||||
next if b.ungainableAbility? ||
|
||||
isConst?(b.ability, PBAbilities, :POWEROFALCHEMY) ||
|
||||
isConst?(b.ability, PBAbilities, :RECEIVER) ||
|
||||
isConst?(b.ability, PBAbilities, :TRACE)
|
||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability)
|
||||
choices.push(b)
|
||||
end
|
||||
if choices.length>0
|
||||
@@ -107,16 +105,16 @@ class PokeBattle_Battler
|
||||
# Ability change
|
||||
#=============================================================================
|
||||
def pbOnAbilityChanged(oldAbil)
|
||||
if @effects[PBEffects::Illusion] && isConst?(oldAbil,PBAbilities,:ILLUSION)
|
||||
if @effects[PBEffects::Illusion] && oldAbil == :ILLUSION
|
||||
@effects[PBEffects::Illusion] = nil
|
||||
if !@effects[PBEffects::Transform]
|
||||
@battle.scene.pbChangePokemon(self,@pokemon)
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} wore off!",pbThis,PBAbilities.getName(oldAbil)))
|
||||
@battle.scene.pbChangePokemon(self, @pokemon)
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} wore off!", pbThis, Data::Ability.get(oldAbil).name))
|
||||
@battle.pbSetSeen(self)
|
||||
end
|
||||
end
|
||||
@effects[PBEffects::GastroAcid] = false if unstoppableAbility?
|
||||
@effects[PBEffects::SlowStart] = 0 if !isConst?(@ability,PBAbilities,:SLOWSTART)
|
||||
@effects[PBEffects::SlowStart] = 0 if @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) && isConst?(@ability,PBAbilities,:STANCECHANGE)
|
||||
if isSpecies?(:AEGISLASH) && @ability == :STANCECHANGE
|
||||
if move.damagingMove?
|
||||
pbChangeForm(1,_INTL("{1} changed to Blade Forme!",pbThis))
|
||||
elsif isConst?(move.id,PBMoves,:KINGSSHIELD)
|
||||
|
||||
@@ -96,8 +96,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Greninja - Battle Bond
|
||||
if !user.fainted? && !user.effects[PBEffects::Transform] &&
|
||||
user.isSpecies?(:GRENINJA) &&
|
||||
isConst?(user.ability,PBAbilities,:BATTLEBOND)
|
||||
user.isSpecies?(:GRENINJA) && user.ability == :BATTLEBOND
|
||||
if !@battle.pbAllFainted?(user.idxOpposingSide) &&
|
||||
!@battle.battleBond[user.index&1][user.pokemonIndex]
|
||||
numFainted = 0
|
||||
|
||||
Reference in New Issue
Block a user