mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Replace all usage of pbNewPkmn with Pokemon.new
This commit is contained in:
@@ -404,7 +404,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Returns a Pokémon generated by a wild encounter, given its species and level.
|
# Returns a Pokémon generated by a wild encounter, given its species and level.
|
||||||
def pbGenerateWildPokemon(species,level,isRoamer=false)
|
def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||||
genwildpoke = pbNewPkmn(species,level)
|
genwildpoke = Pokemon.new(species,level)
|
||||||
# Give the wild Pokémon a held item
|
# Give the wild Pokémon a held item
|
||||||
items = genwildpoke.wildHoldItems
|
items = genwildpoke.wildHoldItems
|
||||||
firstPkmn = $Trainer.firstPokemon
|
firstPkmn = $Trainer.firstPokemon
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ def pbDayCareGenerateEgg
|
|||||||
getConst(PBSpecies,:ILLUMISE)][rand(2)]
|
getConst(PBSpecies,:ILLUMISE)][rand(2)]
|
||||||
end
|
end
|
||||||
# Generate egg
|
# Generate egg
|
||||||
egg = pbNewPkmn(babyspecies,EGG_LEVEL)
|
egg = Pokemon.new(babyspecies,EGG_LEVEL)
|
||||||
# Randomise personal ID
|
# Randomise personal ID
|
||||||
pid = rand(65536)
|
pid = rand(65536)
|
||||||
pid |= (rand(65536)<<16)
|
pid |= (rand(65536)<<16)
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def pbLoadTrainer(trainerid,trainername,partyid=0)
|
|||||||
for poke in trainer[3]
|
for poke in trainer[3]
|
||||||
species = pbGetSpeciesFromFSpecies(poke[TPSPECIES])[0]
|
species = pbGetSpeciesFromFSpecies(poke[TPSPECIES])[0]
|
||||||
level = poke[TPLEVEL]
|
level = poke[TPLEVEL]
|
||||||
pokemon = pbNewPkmn(species,level,opponent,false)
|
pokemon = Pokemon.new(species,level,opponent,false)
|
||||||
if poke[TPFORM]
|
if poke[TPFORM]
|
||||||
pokemon.forcedForm = poke[TPFORM] if MultipleForms.hasFunction?(pokemon.species,"getForm")
|
pokemon.forcedForm = poke[TPFORM] if MultipleForms.hasFunction?(pokemon.species,"getForm")
|
||||||
pokemon.formSimple = poke[TPFORM]
|
pokemon.formSimple = poke[TPFORM]
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class Pokemon
|
|||||||
# Max EVs that a single stat can have
|
# Max EVs that a single stat can have
|
||||||
EV_STAT_LIMIT = 252
|
EV_STAT_LIMIT = 252
|
||||||
# Maximum length a Pokémon's nickname can be
|
# Maximum length a Pokémon's nickname can be
|
||||||
MAX_NAME_SIZE = 10
|
MAX_NAME_SIZE = 10
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Ownership, obtained information
|
# Ownership, obtained information
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
|
|||||||
raise _INTL("Species does not exist ({1}).",newpoke) if !hasConst?(PBSpecies,newpoke)
|
raise _INTL("Species does not exist ({1}).",newpoke) if !hasConst?(PBSpecies,newpoke)
|
||||||
newpoke = getID(PBSpecies,newpoke)
|
newpoke = getID(PBSpecies,newpoke)
|
||||||
end
|
end
|
||||||
yourPokemon = pbNewPkmn(newpoke,myPokemon.level,opponent)
|
yourPokemon = Pokemon.new(newpoke,myPokemon.level,opponent)
|
||||||
end
|
end
|
||||||
yourPokemon.name = nickname
|
yourPokemon.name = nickname
|
||||||
yourPokemon.obtainMode = 2 # traded
|
yourPokemon.obtainMode = 2 # traded
|
||||||
|
|||||||
@@ -212,14 +212,14 @@ class PurifyChamber # German: der Kryptorbis
|
|||||||
|
|
||||||
def debugAddShadow(set,species)
|
def debugAddShadow(set,species)
|
||||||
species=getID(PBSpecies,species)
|
species=getID(PBSpecies,species)
|
||||||
pkmn=pbNewPkmn(species,1)
|
pkmn=Pokemon.new(species,1)
|
||||||
pkmn.makeShadow
|
pkmn.makeShadow
|
||||||
setShadow(set,pkmn)
|
setShadow(set,pkmn)
|
||||||
end
|
end
|
||||||
|
|
||||||
def debugAddNormal(set,species)
|
def debugAddNormal(set,species)
|
||||||
species=getID(PBSpecies,species)
|
species=getID(PBSpecies,species)
|
||||||
pkmn=pbNewPkmn(species,1)
|
pkmn=Pokemon.new(species,1)
|
||||||
insertAfter(set,setCount(set),pkmn)
|
insertAfter(set,setCount(set),pkmn)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class BugContestState
|
|||||||
if !enc
|
if !enc
|
||||||
raise _INTL("No encounters for map {1}, so can't judge contest",@contestMap)
|
raise _INTL("No encounters for map {1}, so can't judge contest",@contestMap)
|
||||||
end
|
end
|
||||||
pokemon=pbNewPkmn(enc[0],enc[1])
|
pokemon=Pokemon.new(enc[0],enc[1])
|
||||||
pokemon.hp=1+rand(pokemon.totalhp-1)
|
pokemon.hp=1+rand(pokemon.totalhp-1)
|
||||||
score=pbBugContestScore(pokemon)
|
score=pbBugContestScore(pokemon)
|
||||||
judgearray.push([cont,pokemon.species,score])
|
judgearray.push([cont,pokemon.species,score])
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class PBPokemon
|
|||||||
end
|
end
|
||||||
|
|
||||||
def createPokemon(level,iv,trainer)
|
def createPokemon(level,iv,trainer)
|
||||||
pokemon=pbNewPkmn(@species,level,trainer,false)
|
pokemon=Pokemon.new(@species,level,trainer,false)
|
||||||
pokemon.setItem(@item)
|
pokemon.setItem(@item)
|
||||||
pokemon.personalID=rand(65536)
|
pokemon.personalID=rand(65536)
|
||||||
pokemon.personalID|=rand(65536)<<8
|
pokemon.personalID|=rand(65536)<<8
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ def pbAddPokemon(pokemon,level=nil,seeform=true)
|
|||||||
end
|
end
|
||||||
pokemon = getID(PBSpecies,pokemon)
|
pokemon = getID(PBSpecies,pokemon)
|
||||||
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
||||||
pokemon = pbNewPkmn(pokemon,level)
|
pokemon = Pokemon.new(pokemon,level)
|
||||||
end
|
end
|
||||||
speciesname = PBSpecies.getName(pokemon.species)
|
speciesname = PBSpecies.getName(pokemon.species)
|
||||||
pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
|
pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
|
||||||
@@ -87,7 +87,7 @@ def pbAddPokemonSilent(pokemon,level=nil,seeform=true)
|
|||||||
return false if !pokemon || pbBoxesFull?
|
return false if !pokemon || pbBoxesFull?
|
||||||
pokemon = getID(PBSpecies,pokemon)
|
pokemon = getID(PBSpecies,pokemon)
|
||||||
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
||||||
pokemon = pbNewPkmn(pokemon,level)
|
pokemon = Pokemon.new(pokemon,level)
|
||||||
end
|
end
|
||||||
$Trainer.seen[pokemon.species] = true
|
$Trainer.seen[pokemon.species] = true
|
||||||
$Trainer.owned[pokemon.species] = true
|
$Trainer.owned[pokemon.species] = true
|
||||||
@@ -110,7 +110,7 @@ def pbAddToParty(pokemon,level=nil,seeform=true)
|
|||||||
return false if !pokemon || $Trainer.party.length>=6
|
return false if !pokemon || $Trainer.party.length>=6
|
||||||
pokemon = getID(PBSpecies,pokemon)
|
pokemon = getID(PBSpecies,pokemon)
|
||||||
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
||||||
pokemon = pbNewPkmn(pokemon,level)
|
pokemon = Pokemon.new(pokemon,level)
|
||||||
end
|
end
|
||||||
speciesname = PBSpecies.getName(pokemon.species)
|
speciesname = PBSpecies.getName(pokemon.species)
|
||||||
pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
|
pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
|
||||||
@@ -123,7 +123,7 @@ def pbAddToPartySilent(pokemon,level=nil,seeform=true)
|
|||||||
return false if !pokemon || $Trainer.party.length>=6
|
return false if !pokemon || $Trainer.party.length>=6
|
||||||
pokemon = getID(PBSpecies,pokemon)
|
pokemon = getID(PBSpecies,pokemon)
|
||||||
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
||||||
pokemon = pbNewPkmn(pokemon,level)
|
pokemon = Pokemon.new(pokemon,level)
|
||||||
end
|
end
|
||||||
$Trainer.seen[pokemon.species] = true
|
$Trainer.seen[pokemon.species] = true
|
||||||
$Trainer.owned[pokemon.species] = true
|
$Trainer.owned[pokemon.species] = true
|
||||||
@@ -137,7 +137,7 @@ def pbAddForeignPokemon(pokemon,level=nil,ownerName=nil,nickname=nil,ownerGender
|
|||||||
return false if !pokemon || $Trainer.party.length>=6
|
return false if !pokemon || $Trainer.party.length>=6
|
||||||
pokemon = getID(PBSpecies,pokemon)
|
pokemon = getID(PBSpecies,pokemon)
|
||||||
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
if pokemon.is_a?(Integer) && level.is_a?(Integer)
|
||||||
pokemon = pbNewPkmn(pokemon,level)
|
pokemon = Pokemon.new(pokemon,level)
|
||||||
end
|
end
|
||||||
# Set original trainer to a foreign one (if ID isn't already foreign)
|
# Set original trainer to a foreign one (if ID isn't already foreign)
|
||||||
if pokemon.trainerID==$Trainer.id
|
if pokemon.trainerID==$Trainer.id
|
||||||
@@ -165,7 +165,7 @@ def pbGenerateEgg(pokemon,text="")
|
|||||||
return false if !pokemon || $Trainer.party.length>=6
|
return false if !pokemon || $Trainer.party.length>=6
|
||||||
pokemon = getID(PBSpecies,pokemon)
|
pokemon = getID(PBSpecies,pokemon)
|
||||||
if pokemon.is_a?(Integer)
|
if pokemon.is_a?(Integer)
|
||||||
pokemon = pbNewPkmn(pokemon,EGG_LEVEL)
|
pokemon = Pokemon.new(pokemon,EGG_LEVEL)
|
||||||
end
|
end
|
||||||
# Get egg steps
|
# Get egg steps
|
||||||
eggSteps = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesStepsToHatch)
|
eggSteps = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesStepsToHatch)
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
|
|||||||
params.setCancelValue(0)
|
params.setCancelValue(0)
|
||||||
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",PBSpecies.getName(species)),params)
|
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",PBSpecies.getName(species)),params)
|
||||||
if level>0
|
if level>0
|
||||||
pkmn.push(pbNewPkmn(species,level))
|
pkmn.push(Pokemon.new(species,level))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else # Edit a Pokémon
|
else # Edit a Pokémon
|
||||||
@@ -563,7 +563,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
|
|||||||
end
|
end
|
||||||
cname = getConstantName(PBSpecies,i) rescue nil
|
cname = getConstantName(PBSpecies,i) rescue nil
|
||||||
next if !cname
|
next if !cname
|
||||||
pkmn = pbNewPkmn(i,50)
|
pkmn = Pokemon.new(i,50)
|
||||||
$PokemonStorage[(i-1)/$PokemonStorage.maxPokemon(0),
|
$PokemonStorage[(i-1)/$PokemonStorage.maxPokemon(0),
|
||||||
(i-1)%$PokemonStorage.maxPokemon(0)] = pkmn
|
(i-1)%$PokemonStorage.maxPokemon(0)] = pkmn
|
||||||
# Record all forms of this Pokémon as seen and owned
|
# Record all forms of this Pokémon as seen and owned
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ def pbCreatePokemon
|
|||||||
for i in 0...party.length
|
for i in 0...party.length
|
||||||
species = party[i]
|
species = party[i]
|
||||||
# Generate Pokémon with species and level 20
|
# Generate Pokémon with species and level 20
|
||||||
$Trainer.party[i] = pbNewPkmn(species,20)
|
$Trainer.party[i] = Pokemon.new(species,20)
|
||||||
$Trainer.seen[species] = true # Set this species to seen and owned
|
$Trainer.seen[species] = true # Set this species to seen and owned
|
||||||
$Trainer.owned[species] = true
|
$Trainer.owned[species] = true
|
||||||
pbSeenForm($Trainer.party[i])
|
pbSeenForm($Trainer.party[i])
|
||||||
|
|||||||
Reference in New Issue
Block a user