mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
fixes pbHasSpecies method (which is used in a bunch of events)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user