Created and implemented GameData::Species

This commit is contained in:
Maruno17
2020-12-24 21:25:16 +00:00
parent 1ffeddc41c
commit ad21fc92cb
91 changed files with 6733 additions and 7963 deletions

View File

@@ -128,7 +128,7 @@ class PokemonPauseMenu
elsif pbInBugContest?
if pbBugContestState.lastPokemon
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
PBSpecies.getName(pbBugContestState.lastPokemon.species),
pbBugContestState.lastPokemon.speciesName,
pbBugContestState.lastPokemon.level,
pbBugContestState.ballcount))
else

View File

@@ -103,7 +103,7 @@ class PokemonPokedexMenuScreen
commands[i] = dexnames[index]
end
end
index = -1 if index>=$PokemonGlobal.pokedexUnlocked.length-1
index = -1 if index >= $PokemonGlobal.pokedexUnlocked.length - 1
commands2[i] = [$Trainer.pokedexSeen(index),
$Trainer.pokedexOwned(index),
pbGetRegionalDexLength(index)]

View File

@@ -300,45 +300,39 @@ class PokemonPokedex_Scene
return index
end
def pbCanAddForModeList?(mode,nationalSpecies)
def pbCanAddForModeList?(mode, species)
case mode
when MODENUMERICAL
return true
when MODEATOZ
return $Trainer.seen[nationalSpecies]
return $Trainer.seen[species]
when MODEHEAVIEST, MODELIGHTEST, MODETALLEST, MODESMALLEST
return $Trainer.owned[nationalSpecies]
return $Trainer.owned[species]
end
return true # For MODENUMERICAL
end
def pbGetDexList
dexlist = []
speciesData = pbLoadSpeciesData
region = pbGetPokedexRegion
regionalSpecies = pbAllRegionalSpecies(region)
if regionalSpecies.length==1
# If no Regional Dex defined for the given region, use National Pokédex
for i in 1..PBSpecies.maxValue
regionalSpecies.push(i)
end
if !regionalSpecies || regionalSpecies.length == 0
# If no Regional Dex defined for the given region, use the National Pokédex
regionalSpecies = []
GameData::Species.each { |s| regionalSpecies.push(s.id) if s.form == 0 }
end
for i in 1...regionalSpecies.length
nationalSpecies = regionalSpecies[i]
if pbCanAddForModeList?($PokemonGlobal.pokedexMode,nationalSpecies)
form = $Trainer.formlastseen[nationalSpecies][1] || 0
fspecies = pbGetFSpeciesFromForm(nationalSpecies,form)
color = speciesData[fspecies][SpeciesData::COLOR] || 0
type1 = speciesData[fspecies][SpeciesData::TYPE1]
type2 = speciesData[fspecies][SpeciesData::TYPE2] || type1
shape = speciesData[fspecies][SpeciesData::SHAPE] || 0
height = speciesData[fspecies][SpeciesData::HEIGHT] || 1
weight = speciesData[fspecies][SpeciesData::WEIGHT] || 1
shift = DEXES_WITH_OFFSETS.include?(region)
dexlist.push([nationalSpecies,PBSpecies.getName(nationalSpecies),
height,weight,i,shift,type1,type2,color,shape])
end
shift = DEXES_WITH_OFFSETS.include?(region)
ret = []
regionalSpecies.each_with_index do |species, i|
next if !species
next if !pbCanAddForModeList?($PokemonGlobal.pokedexMode, species)
species_data = GameData::Species.get(species)
color = species_data.color
type1 = species_data.type1
type2 = species_data.type2 || type1
shape = species_data.shape
height = species_data.height
weight = species_data.weight
ret.push([species, species_data.name, height, weight, i + 1, shift, type1, type2, color, shape])
end
return dexlist
return ret
end
def pbRefreshDexList(index=0)
@@ -348,7 +342,8 @@ class PokemonPokedex_Scene
# Hide the Dex number 0 species if unseen
dexlist[0] = nil if dexlist[0][5] && !$Trainer.seen[dexlist[0][0]]
# Remove unseen species from the end of the list
i = dexlist.length-1; loop do break unless i>=0
i = dexlist.length-1
loop do break unless i>=0
break if !dexlist[i] || $Trainer.seen[dexlist[i][0]]
dexlist[i] = nil
i -= 1
@@ -385,7 +380,7 @@ class PokemonPokedex_Scene
base = Color.new(88,88,80)
shadow = Color.new(168,184,184)
iconspecies = @sprites["pokedex"].species
iconspecies = 0 if !$Trainer.seen[iconspecies]
iconspecies = nil if !$Trainer.seen[iconspecies]
# Write various bits of text
dexname = _INTL("Pokédex")
if $PokemonGlobal.pokedexUnlocked.length>1
@@ -397,7 +392,7 @@ class PokemonPokedex_Scene
textpos = [
[dexname,Graphics.width/2,2,2,Color.new(248,248,248),Color.new(0,0,0)]
]
textpos.push([PBSpecies.getName(iconspecies),112,52,2,base,shadow]) if iconspecies>0
textpos.push([GameData::Species.get(iconspecies).name,112,52,2,base,shadow]) if iconspecies
if @searchResults
textpos.push([_INTL("Search results"),112,308,2,base,shadow])
textpos.push([@dexlist.length.to_s,112,340,2,base,shadow])
@@ -678,9 +673,11 @@ class PokemonPokedex_Scene
end
def setIconBitmap(species)
gender = ($Trainer.formlastseen[species][0] rescue 0)
form = ($Trainer.formlastseen[species][1] rescue 0)
@sprites["icon"].setSpeciesBitmap(species,(gender==1),form)
$Trainer.formlastseen = {} if !$Trainer.formlastseen
$Trainer.formlastseen[species] = [] if !$Trainer.formlastseen[species]
gender = $Trainer.formlastseen[species][0] || 0
form = $Trainer.formlastseen[species][1] || 0
@sprites["icon"].setSpeciesBitmap(species, gender, form)
end
def pbSearchDexList(params)

View File

@@ -54,7 +54,7 @@ class PokemonPokedexInfo_Scene
@sprites["formback"] = PokemonSprite.new(@viewport)
@sprites["formback"].setOffset(PictureOrigin::Bottom)
@sprites["formback"].x = 382 # y is set below as it depends on metrics
@sprites["formicon"] = PokemonSpeciesIconSprite.new(0,@viewport)
@sprites["formicon"] = PokemonSpeciesIconSprite.new(nil, @viewport)
@sprites["formicon"].setOffset(PictureOrigin::Center)
@sprites["formicon"].x = 82
@sprites["formicon"].y = 328
@@ -79,20 +79,18 @@ class PokemonPokedexInfo_Scene
def pbStartSceneBrief(species) # For standalone access, shows first page only
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z = 99999
# @region = 0
dexnum = species
dexnumshift = false
if $PokemonGlobal.pokedexUnlocked[$PokemonGlobal.pokedexUnlocked.length-1]
dexnumshift = true if DEXES_WITH_OFFSETS.include?(-1)
if $PokemonGlobal.pokedexUnlocked[$PokemonGlobal.pokedexUnlocked.length - 1]
dexnumshift = true if DEXES_WITH_OFFSETS.include?(-1) # National Dex
else
dexnum = 0
for i in 0...$PokemonGlobal.pokedexUnlocked.length-1
for i in 0...$PokemonGlobal.pokedexUnlocked.length - 1 # Regional Dexes
next if !$PokemonGlobal.pokedexUnlocked[i]
num = pbGetRegionalNumber(i,species)
next if num<=0
next if num <= 0
dexnum = num
dexnumshift = true if DEXES_WITH_OFFSETS.include?(i)
# @region = pbDexNames[i][1] if pbDexNames[i].is_a?(Array)
break
end
end
@@ -132,17 +130,19 @@ class PokemonPokedexInfo_Scene
def pbUpdateDummyPokemon
@species = @dexlist[@index][0]
@gender = ($Trainer.formlastseen[@species][0] rescue 0)
@form = ($Trainer.formlastseen[@species][1] rescue 0)
@sprites["infosprite"].setSpeciesBitmap(@species,(@gender==1),@form)
$Trainer.formlastseen = {} if !$Trainer.formlastseen
$Trainer.formlastseen[@species] = [] if !$Trainer.formlastseen[@species]
@gender = $Trainer.formlastseen[@species][0] || 0
@form = $Trainer.formlastseen[@species][1] || 0
species_data = GameData::Species.get_species_form(@species, @form)
@sprites["infosprite"].setSpeciesBitmap(@species,@gender,@form)
if @sprites["formfront"]
@sprites["formfront"].setSpeciesBitmap(@species,(@gender==1),@form)
@sprites["formfront"].setSpeciesBitmap(@species,@gender,@form)
end
if @sprites["formback"]
@sprites["formback"].setSpeciesBitmap(@species,(@gender==1),@form,false,false,true)
@sprites["formback"].setSpeciesBitmap(@species,@gender,@form,false,false,true)
@sprites["formback"].y = 256
fSpecies = pbGetFSpeciesFromForm(@species,@form)
@sprites["formback"].y += (pbLoadSpeciesMetrics[SpeciesData::METRIC_PLAYER_Y][fSpecies] || 0)*2
@sprites["formback"].y += species_data.back_sprite_y * 2
end
if @sprites["formicon"]
@sprites["formicon"].pbSetParams(@species,@gender,@form)
@@ -150,53 +150,44 @@ class PokemonPokedexInfo_Scene
end
def pbGetAvailableForms
available = [] # [name, gender, form]
formdata = pbLoadFormToSpecies
possibleforms = []
multiforms = false
if formdata[@species]
for i in 0...formdata[@species].length
fSpecies = pbGetFSpeciesFromForm(@species,i)
formname = pbGetMessage(MessageTypes::FormNames,fSpecies)
genderRate = pbGetSpeciesData(@species,i,SpeciesData::GENDER_RATE)
if i==0 || (formname && formname!="")
multiforms = true if i>0
case genderRate
when PBGenderRates::AlwaysMale,
PBGenderRates::AlwaysFemale,
PBGenderRates::Genderless
gendertopush = (genderRate==PBGenderRates::AlwaysFemale) ? 1 : 0
if $Trainer.formseen[@species][gendertopush][i] || DEX_SHOWS_ALL_FORMS
gendertopush = 2 if genderRate==PBGenderRates::Genderless
possibleforms.push([i,gendertopush,formname])
end
else # Both male and female
for g in 0...2
if $Trainer.formseen[@species][g][i] || DEX_SHOWS_ALL_FORMS
possibleforms.push([i,g,formname])
break if (formname && formname!="")
end
end
end
ret = []
multiple_forms = false
# Find all genders/forms of @species that have been seen
GameData::Species.each do |sp|
next if sp.species != @species
next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?)
next if sp.pokedex_form != sp.form
multiple_forms = true if sp.form > 0
$Trainer.formseen[@species] = [[], []] if !$Trainer.formseen[@species]
case sp.gender_rate
when PBGenderRates::AlwaysMale, PBGenderRates::AlwaysFemale, PBGenderRates::Genderless
real_gender = (sp.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0
next if !$Trainer.formseen[@species][real_gender][sp.form] && !DEX_SHOWS_ALL_FORMS
real_gender = 2 if sp.gender_rate == PBGenderRates::Genderless
ret.push([sp.form_name, real_gender, sp.form])
else # Both male and female
for real_gender in 0...2
next if !$Trainer.formseen[@species][real_gender][sp.form] && !DEX_SHOWS_ALL_FORMS
ret.push([sp.form_name, real_gender, sp.form])
break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
end
end
end
for thisform in possibleforms
if thisform[2] && thisform[2]!="" # Has a form name
thisformname = thisform[2]
else # Necessarily applies only to form 0
case thisform[1]
when 0 then thisformname = _INTL("Male")
when 1 then thisformname = _INTL("Female")
# Sort all entries
ret.sort! { |a, b| (a[2] == b[2]) ? a[1] <=> b[1] : a[2] <=> b[2] }
# Create form names for entries if they don't already exist
ret.each do |entry|
if !entry[0] || entry[0].empty? # Necessarily applies only to form 0
case entry[1]
when 0 then entry[0] = _INTL("Male")
when 1 then entry[0] = _INTL("Female")
else
thisformname = (multiforms) ? _INTL("One Form") : _INTL("Genderless")
entry[0] = (multiple_forms) ? _INTL("One Form") : _INTL("Genderless")
end
end
# Push to available array
gendertopush = (thisform[1]==2) ? 0 : thisform[1]
available.push([thisformname,gendertopush,thisform[0]])
entry[1] = 0 if entry[1] == 2 # Genderless entries are treated as male
end
return available
return ret
end
def drawPage(page)
@@ -221,82 +212,78 @@ class PokemonPokedexInfo_Scene
def drawPageInfo
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_info"))
overlay = @sprites["overlay"].bitmap
base = Color.new(88,88,80)
shadow = Color.new(168,184,184)
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
imagepos = []
if @brief
imagepos.push([_INTL("Graphics/Pictures/Pokedex/overlay_info"),0,0])
imagepos.push([_INTL("Graphics/Pictures/Pokedex/overlay_info"), 0, 0])
end
species_data = GameData::Species.get_species_form(@species, @form)
# Write various bits of text
indexText = "???"
if @dexlist[@index][4]>0
if @dexlist[@index][4] > 0
indexNumber = @dexlist[@index][4]
indexNumber -= 1 if @dexlist[@index][5]
indexText = sprintf("%03d",indexNumber)
indexText = sprintf("%03d", indexNumber)
end
textpos = [
[_INTL("{1}{2} {3}",indexText," ",PBSpecies.getName(@species)),
246,42,0,Color.new(248,248,248),Color.new(0,0,0)],
[_INTL("Height"),314,158,0,base,shadow],
[_INTL("Weight"),314,190,0,base,shadow]
[_INTL("{1}{2} {3}", indexText, " ", species_data.name),
246, 42, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
[_INTL("Height"), 314, 158, 0, base, shadow],
[_INTL("Weight"), 314, 190, 0, base, shadow]
]
if $Trainer.owned[@species]
speciesData = pbGetSpeciesData(@species,@form)
fSpecies = pbGetFSpeciesFromForm(@species,@form)
# Write the kind
kind = pbGetMessage(MessageTypes::Kinds,fSpecies)
kind = pbGetMessage(MessageTypes::Kinds,@species) if !kind || kind==""
textpos.push([_INTL("{1} Pokémon",kind),246,74,0,base,shadow])
# Write the category
textpos.push([_INTL("{1} Pokémon", species_data.category), 246, 74, 0, base, shadow])
# Write the height and weight
height = speciesData[SpeciesData::HEIGHT] || 1
weight = speciesData[SpeciesData::WEIGHT] || 1
if pbGetCountry==0xF4 # If the user is in the United States
inches = (height/0.254).round
pounds = (weight/0.45359).round
textpos.push([_ISPRINTF("{1:d}'{2:02d}\"",inches/12,inches%12),460,158,1,base,shadow])
textpos.push([_ISPRINTF("{1:4.1f} lbs.",pounds/10.0),494,190,1,base,shadow])
height = species_data.height
weight = species_data.weight
if pbGetCountry == 0xF4 # If the user is in the United States
inches = (height / 0.254).round
pounds = (weight / 0.45359).round
textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 158, 1, base, shadow])
textpos.push([_ISPRINTF("{1:4.1f} lbs.", pounds / 10.0), 494, 190, 1, base, shadow])
else
textpos.push([_ISPRINTF("{1:.1f} m",height/10.0),470,158,1,base,shadow])
textpos.push([_ISPRINTF("{1:.1f} kg",weight/10.0),482,190,1,base,shadow])
textpos.push([_ISPRINTF("{1:.1f} m", height / 10.0), 470, 158, 1, base, shadow])
textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 190, 1, base, shadow])
end
# Draw the Pokédex entry text
entry = pbGetMessage(MessageTypes::Entries,fSpecies)
entry = pbGetMessage(MessageTypes::Entries,@species) if !entry || entry==""
drawTextEx(overlay,40,240,Graphics.width-(40*2),4,entry,base,shadow)
drawTextEx(overlay, 40, 240, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
species_data.pokedex_entry, base, shadow)
# Draw the footprint
footprintfile = pbPokemonFootprintFile(@species,@form)
footprintfile = GameData::Species.footprint_filename(@species, @form)
if footprintfile
footprint = BitmapCache.load_bitmap(footprintfile)
overlay.blt(226,138,footprint,footprint.rect)
overlay.blt(226, 138, footprint, footprint.rect)
footprint.dispose
end
# Show the owned icon
imagepos.push(["Graphics/Pictures/Pokedex/icon_own",212,44])
imagepos.push(["Graphics/Pictures/Pokedex/icon_own", 212, 44])
# Draw the type icon(s)
type1 = speciesData[SpeciesData::TYPE1]
type2 = speciesData[SpeciesData::TYPE2] || type1
type1 = species_data.type1
type2 = species_data.type2
type1_number = GameData::Type.get(type1).id_number
type2_number = GameData::Type.get(type2).id_number
type1rect = Rect.new(0,type1_number*32,96,32)
type2rect = Rect.new(0,type2_number*32,96,32)
overlay.blt(296,120,@typebitmap.bitmap,type1rect)
overlay.blt(396,120,@typebitmap.bitmap,type2rect) if type1!=type2
type1rect = Rect.new(0, type1_number * 32, 96, 32)
type2rect = Rect.new(0, type2_number * 32, 96, 32)
overlay.blt(296, 120, @typebitmap.bitmap, type1rect)
overlay.blt(396, 120, @typebitmap.bitmap, type2rect) if type1 != type2
else
# Write the kind
textpos.push([_INTL("????? Pokémon"),246,74,0,base,shadow])
# Write the category
textpos.push([_INTL("????? Pokémon"), 246, 74, 0, base, shadow])
# Write the height and weight
if pbGetCountry()==0xF4 # If the user is in the United States
textpos.push([_INTL("???'??\""),460,158,1,base,shadow])
textpos.push([_INTL("????.? lbs."),494,190,1,base,shadow])
if pbGetCountry == 0xF4 # If the user is in the United States
textpos.push([_INTL("???'??\""), 460, 158, 1, base, shadow])
textpos.push([_INTL("????.? lbs."), 494, 190, 1, base, shadow])
else
textpos.push([_INTL("????.? m"),470,158,1,base,shadow])
textpos.push([_INTL("????.? kg"),482,190,1,base,shadow])
textpos.push([_INTL("????.? m"), 470, 158, 1, base, shadow])
textpos.push([_INTL("????.? kg"), 482, 190, 1, base, shadow])
end
end
# Draw all text
pbDrawTextPositions(@sprites["overlay"].bitmap,textpos)
pbDrawTextPositions(overlay, textpos)
# Draw all images
pbDrawImagePositions(overlay,imagepos)
pbDrawImagePositions(overlay, imagepos)
end
def drawPageArea
@@ -374,7 +361,7 @@ class PokemonPokedexInfo_Scene
textpos.push([_INTL("Area unknown"),Graphics.width/2,Graphics.height/2,2,base,shadow])
end
textpos.push([pbGetMessage(MessageTypes::RegionNames,@region),414,44,2,base,shadow])
textpos.push([_INTL("{1}'s area",PBSpecies.getName(@species)),
textpos.push([_INTL("{1}'s area",GameData::Species.get(@species).name),
Graphics.width/2,352,2,base,shadow])
pbDrawTextPositions(overlay,textpos)
end
@@ -392,7 +379,7 @@ class PokemonPokedexInfo_Scene
end
end
textpos = [
[PBSpecies.getName(@species),Graphics.width/2,Graphics.height-88,2,base,shadow],
[GameData::Species.get(@species).name,Graphics.width/2,Graphics.height-88,2,base,shadow],
[formname,Graphics.width/2,Graphics.height-56,2,base,shadow],
]
# Draw all text
@@ -432,6 +419,8 @@ class PokemonPokedexInfo_Scene
oldindex = -1
loop do
if oldindex!=index
$Trainer.formlastseen = {} if !$Trainer.formlastseen
$Trainer.formlastseen[@species] = [] if !$Trainer.formlastseen
$Trainer.formlastseen[@species][0] = @available[index][1]
$Trainer.formlastseen[@species][1] = @available[index][2]
pbUpdateDummyPokemon
@@ -462,7 +451,7 @@ class PokemonPokedexInfo_Scene
end
def pbScene
pbPlayCrySpecies(@species,@form)
GameData::Species.play_cry_from_species(@species, @form)
loop do
Graphics.update
Input.update
@@ -470,7 +459,7 @@ class PokemonPokedexInfo_Scene
dorefresh = false
if Input.trigger?(Input::A)
pbSEStop
pbPlayCrySpecies(@species,@form) if @page==1
GameData::Species.play_cry_from_species(@species, @form) if @page == 1
elsif Input.trigger?(Input::B)
pbPlayCloseMenuSE
break
@@ -491,7 +480,7 @@ class PokemonPokedexInfo_Scene
pbUpdateDummyPokemon
@available = pbGetAvailableForms
pbSEStop
(@page==1) ? pbPlayCrySpecies(@species,@form) : pbPlayCursorSE
(@page==1) ? GameData::Species.play_cry_from_species(@species, @form) : pbPlayCursorSE
dorefresh = true
end
elsif Input.trigger?(Input::DOWN)
@@ -501,7 +490,7 @@ class PokemonPokedexInfo_Scene
pbUpdateDummyPokemon
@available = pbGetAvailableForms
pbSEStop
(@page==1) ? pbPlayCrySpecies(@species,@form) : pbPlayCursorSE
(@page==1) ? GameData::Species.play_cry_from_species(@species, @form) : pbPlayCursorSE
dorefresh = true
end
elsif Input.trigger?(Input::LEFT)
@@ -531,14 +520,14 @@ class PokemonPokedexInfo_Scene
end
def pbSceneBrief
pbPlayCrySpecies(@species,@form)
GameData::Species.play_cry_from_species(@species, @form)
loop do
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::A)
pbSEStop
pbPlayCrySpecies(@species,@form)
GameData::Species.play_cry_from_species(@species, @form)
elsif Input.trigger?(Input::B)
pbPlayCloseMenuSE
break
@@ -574,7 +563,7 @@ class PokemonPokedexInfoScreen
end
dexnum = pbGetRegionalNumber(region,species)
dexnumshift = DEXES_WITH_OFFSETS.include?(region)
dexlist = [[species,PBSpecies.getName(species),0,0,dexnum,dexnumshift]]
dexlist = [[species,GameData::Species.get(species).name,0,0,dexnum,dexnumshift]]
@scene.pbStartScene(dexlist,0,region)
@scene.pbScene
@scene.pbEndScene

View File

@@ -1395,7 +1395,7 @@ def pbChooseTradablePokemon(variableNumber,nameVarNumber,ableProc=nil,allowIneli
end
def pbChoosePokemonForTrade(variableNumber,nameVarNumber,wanted)
wanted = getID(PBSpecies,wanted)
wanted = GameData::Species.get(wanted).species
pbChooseTradablePokemon(variableNumber,nameVarNumber,proc { |pkmn|
next pkmn.species==wanted
})

View File

@@ -374,7 +374,7 @@ class PokemonSummary_Scene
textpos = [
[_INTL("Dex No."),238,80,0,base,shadow],
[_INTL("Species"),238,112,0,base,shadow],
[PBSpecies.getName(@pokemon.species),435,112,2,Color.new(64,64,64),Color.new(176,176,176)],
[@pokemon.speciesName,435,112,2,Color.new(64,64,64),Color.new(176,176,176)],
[_INTL("Type"),238,144,0,base,shadow],
[_INTL("OT"),238,176,0,base,shadow],
[_INTL("ID No."),238,208,0,base,shadow],
@@ -898,7 +898,7 @@ class PokemonSummary_Scene
@sprites["pokemon"].setPokemonBitmap(@pokemon)
@sprites["itemicon"].item = @pokemon.item_id
pbSEStop
pbPlayCry(@pokemon)
GameData::Species.play_cry_from_pokemon(@pokemon)
end
def pbMoveSelection
@@ -1235,7 +1235,7 @@ class PokemonSummary_Scene
end
def pbScene
pbPlayCry(@pokemon)
GameData::Species.play_cry_from_pokemon(@pokemon)
loop do
Graphics.update
Input.update
@@ -1243,7 +1243,7 @@ class PokemonSummary_Scene
dorefresh = false
if Input.trigger?(Input::A)
pbSEStop
pbPlayCry(@pokemon)
GameData::Species.play_cry_from_pokemon(@pokemon)
elsif Input.trigger?(Input::B)
pbPlayCloseMenuSE
break

View File

@@ -29,7 +29,7 @@ class PokemonBoxIcon < IconSprite
def refresh
return if !@pokemon
self.setBitmap(pbPokemonIconFile(@pokemon))
self.setBitmap(GameData::Species.icon_filename_from_pokemon(@pokemon))
self.src_rect = Rect.new(0,0,self.bitmap.height,self.bitmap.height)
end

View File

@@ -24,15 +24,14 @@ class PokemonEggHatch_Scene
@sprites["pokemon"].setOffset(PictureOrigin::Bottom)
@sprites["pokemon"].x = Graphics.width/2
@sprites["pokemon"].y = 264+56 # 56 to offset the egg sprite
@sprites["pokemon"].setSpeciesBitmap(@pokemon.species,@pokemon.female?,
(@pokemon.form rescue 0),@pokemon.shiny?,
false,false,true) # Egg sprite
@sprites["pokemon"].setSpeciesBitmap(@pokemon.species, @pokemon.gender,
@pokemon.form, @pokemon.shiny?,
false, false, true) # Egg sprite
# Load egg cracks bitmap
crackfilename=sprintf("Graphics/Battlers/%seggCracks",
getConstantName(PBSpecies,@pokemon.species)) rescue nil
crackfilename = sprintf("Graphics/Battlers/%seggCracks", @pokemon.species)
if !pbResolveBitmap(crackfilename)
crackfilename=sprintf("Graphics/Battlers/%03deggCracks",@pokemon.species)
crackfilename=sprintf("Graphics/Battlers/eggCracks") if !pbResolveBitmap(crackfilename)
crackfilename = sprintf("Graphics/Battlers/%03deggCracks", @pokemon.species_data.id_number)
crackfilename = sprintf("Graphics/Battlers/eggCracks") if !pbResolveBitmap(crackfilename)
end
crackfilename=pbResolveBitmap(crackfilename)
@hatchSheet=AnimatedBitmap.new(crackfilename)
@@ -90,7 +89,7 @@ class PokemonEggHatch_Scene
@sprites["pokemon"].setPokemonBitmap(@pokemon) # Pokémon sprite
@sprites["pokemon"].x = Graphics.width/2
@sprites["pokemon"].y = 264
pbApplyBattlerMetricsToSprite(@sprites["pokemon"],1,@pokemon.fSpecies)
@pokemon.species_data.apply_metrics_to_sprite(@sprites["pokemon"], 1)
@sprites["hatch"].visible=false
for i in 1..fadeTime
@sprites["pokemon"].tone=Tone.new(255-i*toneDiff,255-i*toneDiff,255-i*toneDiff)
@@ -100,8 +99,8 @@ class PokemonEggHatch_Scene
@sprites["pokemon"].tone=Tone.new(0,0,0)
@sprites["overlay"].opacity=0
# Finish scene
frames=pbCryFrameLength(@pokemon)
pbPlayCry(@pokemon)
frames = GameData::Species.cry_length(@pokemon)
GameData::Species.play_cry_from_pokemon(@pokemon)
updateScene(frames)
pbBGMStop()
pbMEPlay("Evolution success")

View File

@@ -532,7 +532,7 @@ class PokemonEvolutionScene
metaplayer1.play
metaplayer2.play
pbBGMStop
pbPlayCry(@pokemon)
GameData::Species.play_cry_from_pokemon(@pokemon)
pbMessageDisplay(@sprites["msgwindow"],
_INTL("\\se[]What? {1} is evolving!\\^",@pokemon.name)) { pbUpdate }
pbMessageWaitForInput(@sprites["msgwindow"],50,true) { pbUpdate }
@@ -567,17 +567,17 @@ class PokemonEvolutionScene
def pbEvolutionSuccess
# Play cry of evolved species
frames = pbCryFrameLength(@newspecies,@pokemon.form)
frames = GameData::Species.cry_length(@newspecies, @pokemon.form)
pbBGMStop
pbPlayCrySpecies(@newspecies,@pokemon.form)
GameData::Species.play_cry_from_species(@newspecies, @pokemon.form)
frames.times do
Graphics.update
pbUpdate
end
# Success jingle/message
pbMEPlay("Evolution success")
newspeciesname = PBSpecies.getName(@newspecies)
oldspeciesname = PBSpecies.getName(@pokemon.species)
newspeciesname = GameData::Species.get(@newspecies).name
is_nicknamed = @pokemon.nicknamed?
pbMessageDisplay(@sprites["msgwindow"],
_INTL("\\se[]Congratulations! Your {1} evolved into {2}!\\wt[80]",
@pokemon.name,newspeciesname)) { pbUpdate }
@@ -586,7 +586,7 @@ class PokemonEvolutionScene
pbEvolutionMethodAfterEvolution
# Modify Pokémon to make it evolved
@pokemon.species = @newspecies
@pokemon.name = newspeciesname if @pokemon.name==oldspeciesname
@pokemon.name = newspeciesname if !is_nicknamed
@pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM)
@pokemon.calcStats
# See and own evolved species
@@ -611,7 +611,7 @@ class PokemonEvolutionScene
def self.pbDuplicatePokemon(pkmn, new_species)
new_pkmn = pkmn.clone
new_pkmn.species = new_species
new_pkmn.name = PBSpecies.getName(new_species)
new_pkmn.name = GameData::Species.get(new_species).name
new_pkmn.markings = 0
new_pkmn.ballused = 0
new_pkmn.setItem(nil)

View File

@@ -41,14 +41,14 @@ class PokemonTrade_Scene
@sprites["rsprite1"].x = Graphics.width/2
@sprites["rsprite1"].y = 264
@sprites["rsprite1"].z = 10
pbApplyBattlerMetricsToSprite(@sprites["rsprite1"],1,@pokemon.fSpecies)
@pokemon.species_data.apply_metrics_to_sprite(@sprites["rsprite1"], 1)
@sprites["rsprite2"] = PokemonSprite.new(@viewport)
@sprites["rsprite2"].setPokemonBitmap(@pokemon2,false)
@sprites["rsprite2"].setOffset(PictureOrigin::Bottom)
@sprites["rsprite2"].x = Graphics.width/2
@sprites["rsprite2"].y = 264
@sprites["rsprite2"].z = 10
pbApplyBattlerMetricsToSprite(@sprites["rsprite2"],1,@pokemon2.fSpecies)
@pokemon2.species_data.apply_metrics_to_sprite(@sprites["rsprite2"], 1)
@sprites["rsprite2"].visible = false
@sprites["msgwindow"] = pbCreateMessageWindow(@viewport)
pbFadeInAndShow(@sprites)
@@ -139,8 +139,8 @@ class PokemonTrade_Scene
# Return Pokémon's color to normal and play cry
delay = picturePoke.totalDuration
picturePoke.moveColor(delay,5,Color.new(31*8,22*8,30*8,0))
cry = pbCryFile(@pokemon2)
picturePoke.setSE(delay,cry) if pbResolveAudioSE(cry)
cry = GameData::Species.cry_filename_from_pokemon(@pokemon2)
picturePoke.setSE(delay,cry) if cry
# Play animation
pbRunPictures(
[picturePoke,pictureBall],
@@ -155,7 +155,7 @@ class PokemonTrade_Scene
pbDisposeSpriteHash(@sprites)
@viewport.dispose
newspecies = pbTradeCheckEvolution(@pokemon2,@pokemon)
if newspecies>0
if newspecies
evo = PokemonEvolutionScene.new
evo.pbStartScreen(@pokemon2,newspecies)
evo.pbEvolution(false)
@@ -165,9 +165,9 @@ class PokemonTrade_Scene
def pbTrade
pbBGMStop
pbPlayCry(@pokemon)
speciesname1=PBSpecies.getName(@pokemon.species)
speciesname2=PBSpecies.getName(@pokemon2.species)
GameData::Species.play_cry_from_pokemon(@pokemon)
speciesname1=GameData::Species.get(@pokemon.species).name
speciesname2=GameData::Species.get(@pokemon2.species).name
pbMessageDisplay(@sprites["msgwindow"],
_ISPRINTF("{1:s}\r\nID: {2:05d} OT: {3:s}\\wtnp[0]",
@pokemon.name,@pokemon.owner.public_id,@pokemon.owner.name)) { pbUpdate }
@@ -193,17 +193,16 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
myPokemon = $Trainer.party[pokemonIndex]
opponent = PokeBattle_Trainer.new(trainerName,trainerGender)
opponent.setForeignID($Trainer)
yourPokemon = nil; resetmoves = true
yourPokemon = nil
resetmoves = true
if newpoke.is_a?(Pokemon)
newpoke.owner = Pokemon::Owner.new_from_trainer(opponent)
yourPokemon = newpoke
resetmoves = false
else
if newpoke.is_a?(String) || newpoke.is_a?(Symbol)
raise _INTL("Species does not exist ({1}).",newpoke) if !hasConst?(PBSpecies,newpoke)
newpoke = getID(PBSpecies,newpoke)
end
yourPokemon = Pokemon.new(newpoke,myPokemon.level,opponent)
species_data = GameData::Species.try_get(newpoke)
raise _INTL("Species does not exist ({1}).", newpoke) if !species_data
yourPokemon = Pokemon.new(species_data.id, myPokemon.level, opponent)
end
yourPokemon.name = nickname
yourPokemon.obtainMode = 2 # traded
@@ -225,9 +224,8 @@ end
# Evolution methods
#===============================================================================
def pbTradeCheckEvolution(pkmn, other_pkmn)
ret = pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species|
return pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species|
success = PBEvolution.call("tradeCheck", method, pkmn, parameter, other_pkmn)
next (success) ? new_species : -1
}
return ret
end

View File

@@ -1,10 +1,4 @@
def pbEachNaturalMove(pokemon)
movelist=pokemon.getMoveList
for i in movelist
yield i[1],i[0]
end
end
# Unused
def pbHasRelearnableMove?(pokemon)
return pbGetRelearnableMoves(pokemon).length>0
end
@@ -12,11 +6,10 @@ end
def pbGetRelearnableMoves(pokemon)
return [] if !pokemon || pokemon.egg? || pokemon.shadowPokemon?
moves=[]
pbEachNaturalMove(pokemon) { |move,level|
if level<=pokemon.level && !pokemon.hasMove?(move)
moves.push(move) if !moves.include?(move)
end
}
pokemon.getMoveList.each do |m|
next if m[0] > pokemon.level || pokemon.hasMove?(m[1])
moves.push(m[1]) if !moves.include?(m[1])
end
tmoves=[]
if pokemon.firstmoves
for i in pokemon.firstmoves

View File

@@ -211,14 +211,12 @@ class PurifyChamber # German: der Kryptorbis
end
def debugAddShadow(set,species)
species=getID(PBSpecies,species)
pkmn=Pokemon.new(species,1)
pkmn.makeShadow
setShadow(set,pkmn)
end
def debugAddNormal(set,species)
species=getID(PBSpecies,species)
pkmn=Pokemon.new(species,1)
insertAfter(set,setCount(set),pkmn)
end

View File

@@ -236,7 +236,7 @@ def pbRefreshMGCommands(master, online)
for gift in master
itemname = "BLANK"
if gift[1] == 0
itemname = PBSpecies.getName(gift[2].species)
itemname = gift[2].speciesName
elsif gift[1] > 0
itemname = GameData::Item.get(gift[2]).name + sprintf(" x%d", gift[1])
end

View File

@@ -294,7 +294,7 @@ class HallOfFame_Scene
overlay=@sprites["overlay"].bitmap
overlay.clear
pokename=pokemon.name
speciesname=PBSpecies.getName(pokemon.species)
speciesname=pokemon.speciesName
if pokemon.male?
speciesname+=""
elsif pokemon.female?
@@ -373,7 +373,7 @@ class HallOfFame_Scene
if @battlerIndex<=@hallEntry.size
# If it is a pokémon, write the pokémon text, wait the
# ENTRYWAITTIME and goes to the next battler
pbPlayCry(@hallEntry[@battlerIndex-1])
GameData::Species.play_cry_from_pokemon(@hallEntry[@battlerIndex - 1])
writePokemonData(@hallEntry[@battlerIndex-1])
(ENTRYWAITTIME*Graphics.frame_rate/20).times do
Graphics.update
@@ -428,7 +428,7 @@ class HallOfFame_Scene
createBattlers(false)
end
# Change the pokemon
pbPlayCry(@hallEntry[@battlerIndex])
GameData::Species.play_cry_from_pokemon(@hallEntry[@battlerIndex])
setPokemonSpritesOpacity(@battlerIndex,OPACITY)
hallNumber=$PokemonGlobal.hallOfFameLastNumber + @hallIndex -
$PokemonGlobal.hallOfFame.size + 1