mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
pokemon preview window + bugfixes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -115,7 +115,7 @@ def pbAddToPartySilent(pkmn, level = nil, see_form = true)
|
||||
end
|
||||
|
||||
def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner_gender = 0, see_form = true)
|
||||
return false if !pkmn || $Trainer.party_full?
|
||||
return false if !pkmn
|
||||
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||
# Set original trainer to a foreign one
|
||||
pkmn.owner = Pokemon::Owner.new_foreign(owner_name || "", owner_gender)
|
||||
|
||||
@@ -24,7 +24,7 @@ GOT_BADGE_16 = 50
|
||||
DEFAULT_BATTLE_TYPE = 242
|
||||
BATTLE_FACTORY_TOKENS = 243
|
||||
NB_GYM_REMATCHES = 162
|
||||
|
||||
CUSTOM_SPRITES_ENABLED= 196
|
||||
#Settings
|
||||
# This is for settings that are used in scripts since it's a chore to change them everywhere to include the module name
|
||||
NUM_BADGES = Settings::NB_BADGES
|
||||
|
||||
@@ -298,3 +298,25 @@ def getGenericPokemonCryText(pokemonSpecies)
|
||||
end
|
||||
end
|
||||
|
||||
def obtainPokemonSpritePath(id,includeCustoms=true)
|
||||
head=getBasePokemonID(param.to_i,false)
|
||||
body=getBasePokemonID(param.to_i,true)
|
||||
return obtainPokemonSpritePath(body,head,includeCustoms)
|
||||
end
|
||||
|
||||
def obtainPokemonSpritePath(bodyId, headId,include_customs=true)
|
||||
hasCustom=false
|
||||
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png", headId, bodyId)
|
||||
|
||||
if include_customs
|
||||
pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", headId, bodyId)
|
||||
if (pbResolveBitmap(pathCustom))
|
||||
picturePath = pathCustom
|
||||
hasCustom = true
|
||||
end
|
||||
end
|
||||
return picturePath
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -134,33 +134,37 @@ def evolveRematchPokemon(nbRematch, speciesSymbol)
|
||||
end
|
||||
|
||||
def getEvolution(species)
|
||||
if species >= Settings::NB_POKEMON
|
||||
body = getBasePokemonID(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
begin
|
||||
if species >= Settings::NB_POKEMON
|
||||
body = getBasePokemonID(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
|
||||
bodyPossibleEvolutions = GameData::Species.get(body).get_evolutions(true)
|
||||
headPossibleEvolutions = GameData::Species.get(head).get_evolutions(true)
|
||||
bodyPossibleEvolutions = GameData::Species.get(body).get_evolutions(true)
|
||||
headPossibleEvolutions = GameData::Species.get(head).get_evolutions(true)
|
||||
|
||||
bodyCanEvolve = !bodyPossibleEvolutions.empty?
|
||||
headCanEvolve = !headPossibleEvolutions.empty?
|
||||
bodyCanEvolve = !bodyPossibleEvolutions.empty?
|
||||
headCanEvolve = !headPossibleEvolutions.empty?
|
||||
|
||||
evoBodySpecies = bodyCanEvolve ? bodyPossibleEvolutions[rand(bodyPossibleEvolutions.length - 1)][0] : nil
|
||||
evoHeadSpecies = headCanEvolve ? headPossibleEvolutions[rand(headPossibleEvolutions.length - 1)][0] : nil
|
||||
if evoBodySpecies != nil
|
||||
evoBody= getDexNumberForSpecies(evoBodySpecies)
|
||||
evoBodySpecies = bodyCanEvolve ? bodyPossibleEvolutions[rand(bodyPossibleEvolutions.length - 1)][0] : nil
|
||||
evoHeadSpecies = headCanEvolve ? headPossibleEvolutions[rand(headPossibleEvolutions.length - 1)][0] : nil
|
||||
if evoBodySpecies != nil
|
||||
evoBody = getDexNumberForSpecies(evoBodySpecies)
|
||||
end
|
||||
if evoHeadSpecies != nil
|
||||
evoHead = getDexNumberForSpecies(evoHeadSpecies)
|
||||
end
|
||||
|
||||
return -1 if evoBody == nil && evoHead == nil
|
||||
return body * Settings::NB_POKEMON + evoHead if evoBody == nil #only head evolves
|
||||
return evoBody * Settings::NB_POKEMON + head if evoHead == nil #only body evolves
|
||||
return evoBody * Settings::NB_POKEMON + evoHead #both evolve
|
||||
else
|
||||
evo = pbGetEvolvedFormData(species)
|
||||
newSpecies = evo[rand(evo.length - 1)][0]
|
||||
return evo.any? ? getDexNumberForSpecies(newSpecies) : -1
|
||||
end
|
||||
if evoHeadSpecies != nil
|
||||
evoHead= getDexNumberForSpecies(evoHeadSpecies)
|
||||
end
|
||||
|
||||
return -1 if evoBody == nil && evoHead == nil
|
||||
return body * Settings::NB_POKEMON + evoHead if evoBody == nil #only head evolves
|
||||
return evoBody * Settings::NB_POKEMON + head if evoHead == nil #only body evolves
|
||||
return evoBody * Settings::NB_POKEMON + evoHead #both evolve
|
||||
else
|
||||
evo = pbGetEvolvedFormData(species)
|
||||
newSpecies = evo[rand(evo.length - 1)][0]
|
||||
return evo.any? ? getDexNumberForSpecies(newSpecies) : -1
|
||||
rescue
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user