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
# Unused
def getID(mod,constant)
return nil if !mod || constant.nil?
if constant.is_a?(Symbol) || constant.is_a?(String)
if (mod.const_defined?(constant.to_sym) rescue false)
return mod.const_get(constant.to_sym) rescue 0
end
return 0
end
return constant
end
# def getID(mod,constant)
# return nil if !mod || constant.nil?
# if constant.is_a?(Symbol) || constant.is_a?(String)
# if (mod.const_defined?(constant.to_sym) rescue false)
# return mod.const_get(constant.to_sym) rescue 0
# end
# return 0
# end
# return constant
# end
def getConstantName(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)

View File

@@ -50,15 +50,28 @@ end
def pbHasSpecies?(species)
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
for pokemon in $Trainer.party
next if pokemon.isEgg?
return true if pokemon.species == species
return true if pokemon.dexNum == id
end
return false
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
def CanLearnMove(pokemon, move)
species = getID(PBSpecies, pokemon)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.