Use PokeBattle_Pokemon#isSpecies? instead of isConst?

This commit is contained in:
jonisavo
2020-09-06 08:42:58 +03:00
parent afd7b090b9
commit 1473d83a31
5 changed files with 34 additions and 35 deletions

View File

@@ -837,7 +837,7 @@ ItemHandlers::UseOnPokemon.add(:TAMATOBERRY,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:SHAYMIN) || pkmn.form!=0 ||
if !pkmn.isSpecies?(:SHAYMIN) || pkmn.form!=0 ||
pkmn.status==PBStatuses::FROZEN || PBDayNight.isNight?
scene.pbDisplay(_INTL("It had no effect."))
next false
@@ -854,7 +854,7 @@ ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:REDNECTAR,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:ORICORIO) || pkmn.form==0
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==0
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -869,7 +869,7 @@ ItemHandlers::UseOnPokemon.add(:REDNECTAR,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:ORICORIO) || pkmn.form==1
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==1
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -884,7 +884,7 @@ ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:PINKNECTAR,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:ORICORIO) || pkmn.form==2
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==2
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -899,7 +899,7 @@ ItemHandlers::UseOnPokemon.add(:PINKNECTAR,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:PURPLENECTAR,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:ORICORIO) || pkmn.form==3
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form==3
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -914,9 +914,9 @@ ItemHandlers::UseOnPokemon.add(:PURPLENECTAR,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:REVEALGLASS,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:TORNADUS) &&
!isConst?(pkmn.species,PBSpecies,:THUNDURUS) &&
!isConst?(pkmn.species,PBSpecies,:LANDORUS)
if !pkmn.isSpecies?(:TORNADUS) &&
!pkmn.isSpecies?(:THUNDURUS) &&
!pkmn.isSpecies?(:LANDORUS)
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -933,7 +933,7 @@ ItemHandlers::UseOnPokemon.add(:REVEALGLASS,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:HOOPA)
if !pkmn.isSpecies?(:HOOPA)
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -949,7 +949,7 @@ ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:KYUREM)
if !pkmn.isSpecies?(:KYUREM)
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -967,13 +967,13 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
elsif poke2.fainted?
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
elsif !isConst?(poke2.species,PBSpecies,:RESHIRAM) &&
!isConst?(poke2.species,PBSpecies,:ZEKROM)
elsif !poke2.isSpecies?(:RESHIRAM) &&
!poke2.isSpecies?(:ZEKROM)
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
end
newForm = 0
newForm = 1 if isConst?(poke2.species,PBSpecies,:RESHIRAM)
newForm = 2 if isConst?(poke2.species,PBSpecies,:ZEKROM)
newForm = 1 if poke2.isSpecies?(:RESHIRAM)
newForm = 2 if poke2.isSpecies?(:ZEKROM)
pkmn.setForm(newForm) {
pkmn.fused = poke2
pbRemovePokemonAt(chosen)
@@ -997,7 +997,7 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:NECROZMA) || pkmn.form==0
if !pkmn.isSpecies?(:NECROZMA) || pkmn.form==0
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -1015,7 +1015,7 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
elsif poke2.fainted?
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
elsif !isConst?(poke2.species,PBSpecies,:SOLGALEO)
elsif !poke2.isSpecies?(:SOLGALEO)
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
end
pkmn.setForm(1) {
@@ -1041,7 +1041,7 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene|
if !isConst?(pkmn.species,PBSpecies,:NECROZMA) || pkmn.form==1
if !pkmn.isSpecies?(:NECROZMA) || pkmn.form==1
scene.pbDisplay(_INTL("It had no effect."))
next false
end
@@ -1059,7 +1059,7 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene|
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
elsif poke2.fainted?
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
elsif !isConst?(poke2.species,PBSpecies,:LUNALA)
elsif !poke2.isSpecies?(:LUNALA)
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
end
pkmn.setForm(2) {
@@ -1091,8 +1091,7 @@ ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc { |item,pkmn,scene|
abil1 = i[0] if i[1]==0
abil2 = i[0] if i[1]==1
end
if abil1<=0 || abil2<=0 || pkmn.hasHiddenAbility? ||
isConst?(pkmn.species,PBSpecies,:ZYGARDE)
if abil1<=0 || abil2<=0 || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE)
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end

View File

@@ -193,7 +193,7 @@ end
#===============================================================================
def pbIsPurifiable?(pkmn)
return false if !pkmn
return false if isConst?(pkmn.species,PBSpecies,:LUGIA)
return false if pkmn.isSpecies?(:LUGIA)
return false if !pkmn.shadowPokemon? || pkmn.heartgauge>0
return true
end

View File

@@ -181,7 +181,7 @@ class PokemonStorage
pkmn = self[boxSrc,indexSrc]
raise "Trying to copy nil to storage" if !pkmn
pkmn.formTime = nil if pkmn.respond_to?("formTime")
pkmn.form = 0 if isConst?(pkmn.species,PBSpecies,:SHAYMIN)
pkmn.form = 0 if pkmn.isSpecies?(:SHAYMIN)
pkmn.heal
self[boxDst,indexDst] = pkmn
end
@@ -204,7 +204,7 @@ class PokemonStorage
if self[box,i]==nil
if box>=0
pkmn.formTime = nil if pkmn.respond_to?("formTime") && pkmn.formTime
pkmn.form = 0 if isConst?(pkmn.species,PBSpecies,:SHAYMIN)
pkmn.form = 0 if pkmn.isSpecies?(:SHAYMIN)
pkmn.heal
end
self[box,i] = pkmn
@@ -217,7 +217,7 @@ class PokemonStorage
def pbStoreCaught(pkmn)
if @currentBox>=0
pkmn.formTime = nil if pkmn.respond_to?("formTime")
pkmn.form = 0 if isConst?(pkmn.species,PBSpecies,:SHAYMIN)
pkmn.form = 0 if pkmn.isSpecies?(:SHAYMIN)
pkmn.heal
end
for i in 0...maxPokemon(@currentBox)

View File

@@ -1760,7 +1760,7 @@ class PokemonStorageScreen
end
if box>=0
@heldpkmn.formTime = nil if @heldpkmn.respond_to?("formTime")
@heldpkmn.form = 0 if isConst?(@heldpkmn.species,PBSpecies,:SHAYMIN)
@heldpkmn.form = 0 if @heldpkmn.isSpecies?(:SHAYMIN)
@heldpkmn.heal
end
@scene.pbPlace(selected,@heldpkmn)
@@ -1789,7 +1789,7 @@ class PokemonStorageScreen
end
if box>=0
@heldpkmn.formTime = nil if @heldpkmn.respond_to?("formTime")
@heldpkmn.form = 0 if isConst?(@heldpkmn.species,PBSpecies,:SHAYMIN)
@heldpkmn.form = 0 if @heldpkmn.isSpecies?(:SHAYMIN)
@heldpkmn.heal
end
@scene.pbSwap(selected,@heldpkmn)

View File

@@ -405,12 +405,12 @@ class StandardRestriction
# Certain named species are not banned
speciesWhitelist = [:DRAGONITE,:SALAMENCE,:TYRANITAR]
for i in speciesWhitelist
return true if isConst?(pokemon.species,PBSpecies,i)
return true if pokemon.isSpecies?(i)
end
# Certain named species are banned
speciesBlacklist = [:WYNAUT,:WOBBUFFET]
for i in speciesBlacklist
return false if isConst?(pokemon.species,PBSpecies,i)
return false if pokemon.isSpecies?(i)
end
# Species with total base stat 600 or more are banned
baseStats = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesBaseStats)
@@ -498,7 +498,7 @@ end
class NegativeExtendedGameClause
def isValid?(pokemon)
return false if isConst?(pokemon.species,PBSpecies,:ARCEUS)
return false if pokemon.isSpecies?(:ARCEUS)
return false if isConst?(pokemon.item,PBItems,:MICLEBERRY)
return false if isConst?(pokemon.item,PBItems,:CUSTAPBERRY)
return false if isConst?(pokemon.item,PBItems,:JABOCABERRY)
@@ -605,12 +605,12 @@ class LittleCupRestriction
return false if isConst?(pokemon.item,PBItems,:DEEPSEATOOTH)
return false if pokemon.hasMove?(:SONICBOOM)
return false if pokemon.hasMove?(:DRAGONRAGE)
return false if isConst?(pokemon.species,PBSpecies,:SCYTHER)
return false if isConst?(pokemon.species,PBSpecies,:SNEASEL)
return false if isConst?(pokemon.species,PBSpecies,:MEDITITE)
return false if isConst?(pokemon.species,PBSpecies,:YANMA)
return false if isConst?(pokemon.species,PBSpecies,:TANGELA)
return false if isConst?(pokemon.species,PBSpecies,:MURKROW)
return false if pokemon.isSpecies?(:SCYTHER)
return false if pokemon.isSpecies?(:SNEASEL)
return false if pokemon.isSpecies?(:MEDITITE)
return false if pokemon.isSpecies?(:YANMA)
return false if pokemon.isSpecies?(:TANGELA)
return false if pokemon.isSpecies?(:MURKROW)
return true
end
end