fixes pbHasSpecies method (which is used in a bunch of events)

This commit is contained in:
infinitefusion
2022-03-25 18:08:00 -04:00
parent b84ab95622
commit f8c8be07b7
16 changed files with 25 additions and 12 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -100,16 +100,16 @@ def getConst(mod,constant)
end end
# Unused # Unused
def getID(mod,constant) # def getID(mod,constant)
return nil if !mod || constant.nil? # return nil if !mod || constant.nil?
if constant.is_a?(Symbol) || constant.is_a?(String) # if constant.is_a?(Symbol) || constant.is_a?(String)
if (mod.const_defined?(constant.to_sym) rescue false) # if (mod.const_defined?(constant.to_sym) rescue false)
return mod.const_get(constant.to_sym) rescue 0 # return mod.const_get(constant.to_sym) rescue 0
end # end
return 0 # return 0
end # end
return constant # return constant
end # end
def getConstantName(mod,value) def getConstantName(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol) mod = Object.const_get(mod) if mod.is_a?(Symbol)

View File

@@ -50,15 +50,28 @@ end
def pbHasSpecies?(species) def pbHasSpecies?(species)
if species.is_a?(String) || species.is_a?(Symbol) if species.is_a?(String) || species.is_a?(Symbol)
species = getID(PBSpecies, species) id = getID(PBSpecies, species)
elsif species.is_a?(Pokemon)
id = species.dexNum
end end
for pokemon in $Trainer.party for pokemon in $Trainer.party
next if pokemon.isEgg? next if pokemon.isEgg?
return true if pokemon.species == species return true if pokemon.dexNum == id
end end
return false return false
end end
#ancienne methode qui est encore callée un peu partout dans les vieux scripts
def getID(pbspecies_unused,species)
if species.is_a?(String)
return nil
elsif species.is_a?(Symbol)
return GameData::Species.get(species).id_number
elsif species.is_a?(Pokemon)
id = species.dexNum
end
end
#Check if the Pokemon can learn a TM #Check if the Pokemon can learn a TM
def CanLearnMove(pokemon, move) def CanLearnMove(pokemon, move)
species = getID(PBSpecies, pokemon) species = getID(PBSpecies, pokemon)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.