pokemon preview window + bugfixes

This commit is contained in:
infinitefusion
2021-12-26 13:22:09 -05:00
parent fa79640115
commit 72d804163e
23 changed files with 405 additions and 395 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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