Use PokeBattle_Battler#isSpecies? instead of isConst?

This commit is contained in:
jonisavo
2020-09-06 08:41:27 +03:00
parent 7fb1281eab
commit afd7b090b9
13 changed files with 53 additions and 55 deletions

View File

@@ -108,7 +108,7 @@ class PokeBattle_Battler
end
# 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 isConst?(@species,PBSpecies,:GENGAR) && mega?
@effects[PBEffects::Telekinesis] = 0 if isSpecies?(:GENGAR) && mega?
@effects[PBEffects::GastroAcid] = false if nonNegatableAbility?
else
# These effects are passed on if Baton Pass is used

View File

@@ -149,7 +149,7 @@ class PokeBattle_Battler
def pbCheckFormOnStatusChange
return if fainted? || @effects[PBEffects::Transform]
# Shaymin - reverts if frozen
if isConst?(@species,PBSpecies,:SHAYMIN) && frozen?
if isSpecies?(:SHAYMIN) && frozen?
pbChangeForm(0,_INTL("{1} transformed!",pbThis))
end
end
@@ -157,7 +157,7 @@ class PokeBattle_Battler
def pbCheckFormOnMovesetChange
return if fainted? || @effects[PBEffects::Transform]
# Keldeo - knowing Secret Sword
if isConst?(@species,PBSpecies,:KELDEO)
if isSpecies?(:KELDEO)
newForm = 0
newForm = 1 if pbHasMove?(:SECRETSWORD)
pbChangeForm(newForm,_INTL("{1} transformed!",pbThis))
@@ -167,7 +167,7 @@ class PokeBattle_Battler
def pbCheckFormOnWeatherChange
return if fainted? || @effects[PBEffects::Transform]
# Castform - Forecast
if isConst?(@species,PBSpecies,:CASTFORM)
if isSpecies?(:CASTFORM)
if hasActiveAbility?(:FORECAST)
newForm = 0
case @battle.pbWeather
@@ -185,7 +185,7 @@ class PokeBattle_Battler
end
end
# Cherrim - Flower Gift
if isConst?(@species,PBSpecies,:CHERRIM)
if isSpecies?(:CHERRIM)
if hasActiveAbility?(:FLOWERGIFT)
newForm = 0
case @battle.pbWeather
@@ -210,7 +210,7 @@ class PokeBattle_Battler
# Form changes upon entering battle and when the weather changes
pbCheckFormOnWeatherChange if !endOfRound
# Darmanitan - Zen Mode
if isConst?(@species,PBSpecies,:DARMANITAN) && isConst?(@ability,PBAbilities,:ZENMODE)
if isSpecies?(:DARMANITAN) && isConst?(@ability,PBAbilities,:ZENMODE)
if @hp<=@totalhp/2
if @form!=1
@battle.pbShowAbilitySplash(self,true)
@@ -224,7 +224,7 @@ class PokeBattle_Battler
end
end
# Minior - Shields Down
if isConst?(@species,PBSpecies,:MINIOR) && isConst?(@ability,PBAbilities,:SHIELDSDOWN)
if isSpecies?(:MINIOR) && isConst?(@ability,PBAbilities,:SHIELDSDOWN)
if @hp>@totalhp/2 # Turn into Meteor form
newForm = (@form>=7) ? @form-7 : @form
if @form!=newForm
@@ -241,7 +241,7 @@ class PokeBattle_Battler
end
end
# Wishiwashi - Schooling
if isConst?(@species,PBSpecies,:WISHIWASHI) && isConst?(@ability,PBAbilities,:SCHOOLING)
if isSpecies?(:WISHIWASHI) && isConst?(@ability,PBAbilities,:SCHOOLING)
if @level>=20 && @hp>@totalhp/4
if @form!=1
@battle.pbShowAbilitySplash(self,true)
@@ -255,7 +255,7 @@ class PokeBattle_Battler
end
end
# Zygarde - Power Construct
if isConst?(@species,PBSpecies,:ZYGARDE) && isConst?(@ability,PBAbilities,:POWERCONSTRUCT) &&
if isSpecies?(:ZYGARDE) && isConst?(@ability,PBAbilities,:POWERCONSTRUCT) &&
endOfRound
if @hp<=@totalhp/2 && @form<2 # Turn into Complete Forme
newForm = @form+2

View File

@@ -216,7 +216,7 @@ class PokeBattle_Battler
end
end
# Stance Change
if isConst?(@species,PBSpecies,:AEGISLASH) && isConst?(@ability,PBAbilities,:STANCECHANGE)
if isSpecies?(:AEGISLASH) && isConst?(@ability,PBAbilities,:STANCECHANGE)
if move.damagingMove?
pbChangeForm(1,_INTL("{1} changed to Blade Forme!",pbThis))
elsif isConst?(move.id,PBMoves,:KINGSSHIELD)

View File

@@ -96,7 +96,7 @@ class PokeBattle_Battler
end
# Greninja - Battle Bond
if !user.fainted? && !user.effects[PBEffects::Transform] &&
isConst?(user.species,PBSpecies,:GRENINJA) &&
user.isSpecies?(:GRENINJA) &&
isConst?(user.ability,PBAbilities,:BATTLEBOND)
if !@battle.pbAllFainted?(user.idxOpposingSide) &&
!@battle.battleBond[user.index&1][user.pokemonIndex]

View File

@@ -33,7 +33,7 @@ end
class PokeBattle_Move_003 < PokeBattle_SleepMove
def pbMoveFailed?(user,targets)
if NEWEST_BATTLE_MECHANICS && isConst?(@id,PBMoves,:DARKVOID)
if !isConst?(user.species,PBSpecies,:DARKRAI) &&
if !user.isSpecies?(:DARKRAI) &&
!isConst?(user.effects[PBEffects::TransformSpecies],PBSpecies,:DARKRAI)
@battle.pbDisplay(_INTL("But {1} can't use the move!",user.pbThis))
return true
@@ -46,7 +46,7 @@ class PokeBattle_Move_003 < PokeBattle_SleepMove
return if numHits==0
return if user.fainted? || user.effects[PBEffects::Transform]
return if !isConst?(@id,PBMoves,:RELICSONG)
return if !isConst?(user.species,PBSpecies,:MELOETTA)
return if !user.isSpecies?(:MELOETTA)
return if user.hasActiveAbility?(:SHEERFORCE) && @addlEffect>0
newForm = (oldForm+1)%2
user.pbChangeForm(newForm,_INTL("{1} transformed!",user.pbThis))

View File

@@ -1969,7 +1969,7 @@ class PokeBattle_Move_0C0 < PokeBattle_Move
def pbNumHits(user,targets)
if isConst?(@id,PBMoves,:WATERSHURIKEN) &&
isConst?(user.species,PBSpecies,:GRENINJA) && user.form==1
user.isSpecies?(:GRENINJA) && user.form==1
return 3
end
hitChances = [2,2,3,3,4,5]
@@ -1980,7 +1980,7 @@ class PokeBattle_Move_0C0 < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target)
if isConst?(@id,PBMoves,:WATERSHURIKEN) &&
isConst?(user.species,PBSpecies,:GRENINJA) && user.form==1
user.isSpecies?(:GRENINJA) && user.form==1
return 20
end
return super

View File

@@ -730,11 +730,11 @@ class PokeBattle_Move_11A < PokeBattle_Move
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
if isConst?(target.species,PBSpecies,:DIGLETT) ||
isConst?(target.species,PBSpecies,:DUGTRIO) ||
isConst?(target.species,PBSpecies,:SANDYGAST) ||
isConst?(target.species,PBSpecies,:PALOSSAND) ||
(isConst?(target.species,PBSpecies,:GENGAR) && target.mega?)
if target.isSpecies?(:DIGLETT) ||
target.isSpecies?(:DUGTRIO) ||
target.isSpecies?(:SANDYGAST) ||
target.isSpecies?(:PALOSSAND) ||
(target.isSpecies?(:GENGAR) && target.mega?)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1202,7 +1202,7 @@ class PokeBattle_Move_13B < PokeBattle_StatDownMove
end
def pbMoveFailed?(user,targets)
if !isConst?(user.species,PBSpecies,:HOOPA)
if !user.isSpecies?(:HOOPA)
@battle.pbDisplay(_INTL("But {1} can't use the move!",user.pbThis(true)))
return true
elsif user.form!=1

View File

@@ -170,17 +170,17 @@ module PokeBattle_BattleCommon
rareness = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesRareness)
end
# Modify rareness depending on the Poké Ball's effect
ultraBeast = (isConst?(battler.species,PBSpecies,:NIHILEGO) ||
isConst?(battler.species,PBSpecies,:BUZZWOLE) ||
isConst?(battler.species,PBSpecies,:PHEROMOSA) ||
isConst?(battler.species,PBSpecies,:XURKITREE) ||
isConst?(battler.species,PBSpecies,:CELESTEELA) ||
isConst?(battler.species,PBSpecies,:KARTANA) ||
isConst?(battler.species,PBSpecies,:GUZZLORD) ||
isConst?(battler.species,PBSpecies,:POIPOLE) ||
isConst?(battler.species,PBSpecies,:NAGANADEL) ||
isConst?(battler.species,PBSpecies,:STAKATAKA) ||
isConst?(battler.species,PBSpecies,:BLACEPHALON))
ultraBeast = (battler.isSpecies?(:NIHILEGO) ||
battler.isSpecies?(:BUZZWOLE) ||
battler.isSpecies?(:PHEROMOSA) ||
battler.isSpecies?(:XURKITREE) ||
battler.isSpecies?(:CELESTEELA) ||
battler.isSpecies?(:KARTANA) ||
battler.isSpecies?(:GUZZLORD) ||
battler.isSpecies?(:POIPOLE) ||
battler.isSpecies?(:NAGANADEL) ||
battler.isSpecies?(:STAKATAKA) ||
battler.isSpecies?(:BLACEPHALON))
if !ultraBeast || isConst?(ball,PBItems,:BEASTBALL)
rareness = BallHandlers.modifyCatchRate(ball,rareness,self,battler,ultraBeast)
else

View File

@@ -157,7 +157,7 @@ class PokeBattle_Battle
side = battler.idxOwnSide
owner = pbGetOwnerIndexFromBattlerIndex(idxBattler)
@megaEvolution[side][owner] = -2
if isConst?(battler.species,PBSpecies,:GENGAR) && battler.mega?
if battler.isSpecies?(:GENGAR) && battler.mega?
battler.effects[PBEffects::Telekinesis] = 0
end
pbCalculatePriority(false,[idxBattler]) if NEWEST_BATTLE_MECHANICS
@@ -172,9 +172,9 @@ class PokeBattle_Battle
battler = @battlers[idxBattler]
return if !battler || !battler.pokemon
return if !battler.hasPrimal? || battler.primal?
if isConst?(battler.pokemon.species,PBSpecies,:KYOGRE)
if battler.isSpecies?(:KYOGRE)
pbCommonAnimation("PrimalKyogre",battler)
elsif isConst?(battler.pokemon.species,PBSpecies,:GROUDON)
elsif battler.isSpecies?(:GROUDON)
pbCommonAnimation("PrimalGroudon",battler)
end
battler.pokemon.makePrimal
@@ -182,9 +182,9 @@ class PokeBattle_Battle
battler.pbUpdate(true)
@scene.pbChangePokemon(battler,battler.pokemon)
@scene.pbRefreshOne(idxBattler)
if isConst?(battler.pokemon.species,PBSpecies,:KYOGRE)
if battler.isSpecies?(:KYOGRE)
pbCommonAnimation("PrimalKyogre2",battler)
elsif isConst?(battler.pokemon.species,PBSpecies,:GROUDON)
elsif battler.isSpecies?(:GROUDON)
pbCommonAnimation("PrimalGroudon2",battler)
end
pbDisplay(_INTL("{1}'s Primal Reversion!\nIt reverted to its primal form!",battler.pbThis))

View File

@@ -2627,7 +2627,7 @@ class PokeBattle_AI
score += avg/2
#---------------------------------------------------------------------------
when "13B"
if !isConst?(user.species,PBSpecies,:HOOPA) || user.form!=1
if !user.isSpecies?(:HOOPA) || user.form!=1
score -= 100
else
score += 20 if target.stages[PBStats::DEFENSE]>0

View File

@@ -234,9 +234,9 @@ class PokemonDataBox < SpriteWrapper
imagePos.push(["Graphics/Pictures/Battle/icon_mega",@spriteBaseX+8,34])
elsif @battler.primal?
primalX = (@battler.opposes?) ? 208 : -28 # Foe's/player's
if isConst?(@battler.pokemon.species,PBSpecies,:KYOGRE)
if @battler.isSpecies?(:KYOGRE)
imagePos.push(["Graphics/Pictures/Battle/icon_primal_Kyogre",@spriteBaseX+primalX,4])
elsif isConst?(@battler.pokemon.species,PBSpecies,:GROUDON)
elsif @battler.isSpecies?(:GROUDON)
imagePos.push(["Graphics/Pictures/Battle/icon_primal_Groudon",@spriteBaseX+primalX,4])
end
end

View File

@@ -119,7 +119,7 @@ BattleHandlers::AbilityOnHPDroppedBelowHalf.copy(:EMERGENCYEXIT,:WIMPOUT)
BattleHandlers::StatusCheckAbilityNonIgnorable.add(:COMATOSE,
proc { |ability,battler,status|
next false if !isConst?(battler.species,PBSpecies,:KOMALA)
next false if !battler.isSpecies?(:KOMALA)
next true if status.nil? || status==PBStatuses::SLEEP
}
)
@@ -181,13 +181,13 @@ BattleHandlers::StatusImmunityAbility.copy(:WATERVEIL,:WATERBUBBLE)
BattleHandlers::StatusImmunityAbilityNonIgnorable.add(:COMATOSE,
proc { |ability,battler,status|
next true if isConst?(battler.species,PBSpecies,:KOMALA)
next true if battler.isSpecies?(:KOMALA)
}
)
BattleHandlers::StatusImmunityAbilityNonIgnorable.add(:SHIELDSDOWN,
proc { |ability,battler,status|
next true if isConst?(battler.species,PBSpecies,:MINIOR) && battler.form<7
next true if battler.isSpecies?(:MINIOR) && battler.form<7
}
)

View File

@@ -20,7 +20,7 @@ BattleHandlers::SpeedCalcItem.copy(:MACHOBRACE,:POWERANKLET,:POWERBAND,
BattleHandlers::SpeedCalcItem.add(:QUICKPOWDER,
proc { |item,battler,mult|
next mult*2 if isConst?(battler.species,PBSpecies,:DITTO) &&
next mult*2 if battler.isSpecies?(:DITTO) &&
!battler.effects[PBEffects::Transform]
}
)
@@ -442,7 +442,7 @@ BattleHandlers::AccuracyCalcTargetItem.copy(:BRIGHTPOWDER,:LAXINCENSE)
BattleHandlers::DamageCalcUserItem.add(:ADAMANTORB,
proc { |item,user,target,move,mults,baseDmg,type|
if isConst?(user.species,PBSpecies,:DIALGA) &&
if user.isSpecies?(:DIALGA) &&
(isConst?(type,PBTypes,:DRAGON) || isConst?(type,PBTypes,:STEEL))
mults[BASE_DMG_MULT] = (mults[BASE_DMG_MULT]*1.2).round
end
@@ -499,7 +499,7 @@ BattleHandlers::DamageCalcUserItem.add(:DARKGEM,
BattleHandlers::DamageCalcUserItem.add(:DEEPSEATOOTH,
proc { |item,user,target,move,mults,baseDmg,type|
if isConst?(user.species,PBSpecies,:CLAMPERL) && move.specialMove?
if user.isSpecies?(:CLAMPERL) && move.specialMove?
mults[ATK_MULT] *= 2
end
}
@@ -571,7 +571,7 @@ BattleHandlers::DamageCalcUserItem.add(:GRASSGEM,
BattleHandlers::DamageCalcUserItem.add(:GRISEOUSORB,
proc { |item,user,target,move,mults,baseDmg,type|
if isConst?(user.species,PBSpecies,:GIRATINA) &&
if user.isSpecies?(:GIRATINA) &&
(isConst?(type,PBTypes,:DRAGON) || isConst?(type,PBTypes,:GHOST))
mults[BASE_DMG_MULT] = (mults[BASE_DMG_MULT]*1.2).round
end
@@ -608,7 +608,7 @@ BattleHandlers::DamageCalcUserItem.add(:LIFEORB,
BattleHandlers::DamageCalcUserItem.add(:LIGHTBALL,
proc { |item,user,target,move,mults,baseDmg,type|
if isConst?(user.species,PBSpecies,:PIKACHU)
if user.isSpecies?(:PIKACHU)
mults[ATK_MULT] *= 2
end
}
@@ -616,7 +616,7 @@ BattleHandlers::DamageCalcUserItem.add(:LIGHTBALL,
BattleHandlers::DamageCalcUserItem.add(:LUSTROUSORB,
proc { |item,user,target,move,mults,baseDmg,type|
if isConst?(user.species,PBSpecies,:PALKIA) &&
if user.isSpecies?(:PALKIA) &&
(isConst?(type,PBTypes,:DRAGON) || isConst?(type,PBTypes,:WATER))
mults[BASE_DMG_MULT] = (mults[BASE_DMG_MULT]*1.2).round
end
@@ -746,8 +746,7 @@ BattleHandlers::DamageCalcUserItem.copy(:SOFTSAND,:EARTHPLATE)
BattleHandlers::DamageCalcUserItem.add(:SOULDEW,
proc { |item,user,target,move,mults,baseDmg,type|
next if !isConst?(user.species,PBSpecies,:LATIAS) &&
!isConst?(user.species,PBSpecies,:LATIOS)
next if !user.isSpecies?(:LATIAS) && !user.isSpecies?(:LATIOS)
if NEWEST_BATTLE_MECHANICS
if isConst?(type,PBTypes,:PSYCHIC) || isConst?(type,PBTypes,:DRAGON)
mults[FINAL_DMG_MULT] = (mults[FINAL_DMG_MULT]*1.2).round
@@ -776,8 +775,7 @@ BattleHandlers::DamageCalcUserItem.add(:STEELGEM,
BattleHandlers::DamageCalcUserItem.add(:THICKCLUB,
proc { |item,user,target,move,mults,baseDmg,type|
if (isConst?(user.species,PBSpecies,:CUBONE) ||
isConst?(user.species,PBSpecies,:MAROWAK)) && move.physicalMove?
if (user.isSpecies?(:CUBONE) || user.isSpecies?(:MAROWAK)) && move.physicalMove?
mults[ATK_MULT] *= 2
end
}
@@ -969,7 +967,7 @@ BattleHandlers::DamageCalcTargetItem.add(:YACHEBERRY,
BattleHandlers::CriticalCalcUserItem.add(:LUCKYPUNCH,
proc { |item,user,target,c|
next c+2 if isConst?(user.species,PBSpecies,:CHANSEY)
next c+2 if user.isSpecies?(:CHANSEY)
}
)
@@ -983,7 +981,7 @@ BattleHandlers::CriticalCalcUserItem.copy(:RAZORCLAW,:SCOPELENS)
BattleHandlers::CriticalCalcUserItem.add(:STICK,
proc { |item,user,target,c|
next c+2 if isConst?(user.species,PBSpecies,:FARFETCHD)
next c+2 if user.isSpecies?(:FARFETCHD)
}
)