Added class GameData::BodyShape, some bug fixes, updated some PBS files

This commit is contained in:
Maruno17
2021-02-22 00:21:52 +00:00
parent bcab462ef0
commit f302d8346a
16 changed files with 3008 additions and 3246 deletions

View File

@@ -97,7 +97,7 @@ module GameData
"Height" => [0, "f"],
"Weight" => [0, "f"],
"Color" => [0, "e", :BodyColor],
"Shape" => [0, "u"],
"Shape" => [0, "y", :BodyShape],
"Habitat" => [0, "e", :Habitat],
"Generation" => [0, "i"],
"BattlerPlayerX" => [0, "i"],
@@ -160,7 +160,7 @@ module GameData
@height = hash[:height] || 1
@weight = hash[:weight] || 1
@color = hash[:color] || :Red
@shape = hash[:shape] || 1
@shape = hash[:shape] || :Body
@habitat = hash[:habitat] || :None
@generation = hash[:generation] || 0
@mega_stone = hash[:mega_stone]

View File

@@ -1,10 +1,10 @@
module PBGrowthRates
MediumFast = Medium = 0
Erratic = 1
Fluctuating = 2
MediumSlow = Parabolic = 3
Fast = 4
Slow = 5
Medium = 0 # MediumFast
Erratic = 1
Fluctuating = 2
Parabolic = 3 # MediumSlow
Fast = 4
Slow = 5
def self.maxValue; return 5; end
end

View File

@@ -0,0 +1,115 @@
# NOTE: The id_number is only used to determine the order that body shapes are
# listed in the Pokédex search screen. Number 0 (:None) is ignored; they
# start with shape 1.
# "Graphics/Pictures/Pokedex/icon_shapes.png" contains icons for these
# shapes.
module GameData
class BodyShape
attr_reader :id
attr_reader :id_number
attr_reader :real_name
DATA = {}
extend ClassMethods
include InstanceMethods
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
end
# @return [String] the translated name of this body shape
def name
return _INTL(@real_name)
end
end
end
GameData::BodyShape.register({
:id => :Head,
:id_number => 1,
:name => _INTL("Head")
})
GameData::BodyShape.register({
:id => :Serpentine,
:id_number => 2,
:name => _INTL("Serpentine")
})
GameData::BodyShape.register({
:id => :Finned,
:id_number => 3,
:name => _INTL("Finned")
})
GameData::BodyShape.register({
:id => :HeadArms,
:id_number => 4,
:name => _INTL("Head and arms")
})
GameData::BodyShape.register({
:id => :HeadBase,
:id_number => 5,
:name => _INTL("Head and base")
})
GameData::BodyShape.register({
:id => :BipedalTail,
:id_number => 6,
:name => _INTL("Bipedal with tail")
})
GameData::BodyShape.register({
:id => :HeadLegs,
:id_number => 7,
:name => _INTL("Head and legs")
})
GameData::BodyShape.register({
:id => :Quadruped,
:id_number => 8,
:name => _INTL("Quadruped")
})
GameData::BodyShape.register({
:id => :Winged,
:id_number => 9,
:name => _INTL("Winged")
})
GameData::BodyShape.register({
:id => :Multiped,
:id_number => 10,
:name => _INTL("Multiped")
})
GameData::BodyShape.register({
:id => :MultiBody,
:id_number => 11,
:name => _INTL("Multi Body")
})
GameData::BodyShape.register({
:id => :Bipedal,
:id_number => 12,
:name => _INTL("Bipedal")
})
GameData::BodyShape.register({
:id => :MultiWinged,
:id_number => 13,
:name => _INTL("Multi Winged")
})
GameData::BodyShape.register({
:id => :Insectoid,
:id_number => 14,
:name => _INTL("Insectoid")
})

View File

@@ -501,9 +501,10 @@ class PokemonPokedex_Scene
overlay.blt(344,214,@hwbitmap.bitmap,Rect.new(0,(hwoffset) ? 44 : 0,32,44))
overlay.blt(344,266,@hwbitmap.bitmap,Rect.new(32,(hwoffset) ? 44 : 0,32,44))
# Draw shape icon
if params[9]>=0
shaperect = Rect.new(0,params[9]*60,60,60)
overlay.blt(424,218,@shapebitmap.bitmap,shaperect)
if params[9] >= 0
shape_number = @shapeCommands[params[9]].id_number
shaperect = Rect.new(0, (shape_number - 1) * 60, 60, 60)
overlay.blt(424, 218, @shapebitmap.bitmap, shaperect)
end
# Draw all text
pbDrawTextPositions(overlay,textpos)
@@ -607,9 +608,9 @@ class PokemonPokedex_Scene
textpos.push([cmds[sel[0]].name,362,58,2,base,shadow,1])
end
when 6 # Shape icon
if sel[0]>=0
shaperect = Rect.new(0,@shapeCommands[sel[0]]*60,60,60)
overlay.blt(332,50,@shapebitmap.bitmap,shaperect)
if sel[0] >= 0
shaperect = Rect.new(0, (@shapeCommands[sel[0]].id_number - 1) * 60, 60, 60)
overlay.blt(332, 50, @shapebitmap.bitmap, shaperect)
end
else
if sel[0]<0
@@ -678,10 +679,10 @@ class PokemonPokedex_Scene
textpos.push(["----",
xstart+halfwidth+(cols-1)*xgap,ystart+6+(cmds.length/cols).floor*ygap,2,base,shadow,1])
when 6 # Shape
shaperect = Rect.new(0,0,60,60)
shaperect = Rect.new(0, 0, 60, 60)
for i in 0...cmds.length
shaperect.y = i*60
overlay.blt(xstart+4+(i%cols)*xgap,ystart+4+(i/cols).floor*ygap,@shapebitmap.bitmap,shaperect)
shaperect.y = (@shapeCommands[i].id_number - 1) * 60
overlay.blt(xstart + 4 + (i % cols) * xgap, ystart + 4 + (i / cols).floor * ygap, @shapebitmap.bitmap, shaperect)
end
end
# Draw all text
@@ -760,11 +761,10 @@ class PokemonPokedex_Scene
end
# Filter by shape
if params[9]>=0
sshape = @shapeCommands[params[9]]+1
sshape = @shapeCommands[params[9]].id
dexlist = dexlist.find_all { |item|
next false if !$Trainer.seen?(item[0])
shape = item[9]
next shape==sshape
next item[9] == sshape
}
end
# Remove all unseen species from the results
@@ -1025,7 +1025,7 @@ class PokemonPokedex_Scene
@colorCommands = []
GameData::BodyColor.each { |c| @colorCommands.push(c) }
@shapeCommands = []
for i in 0...14; @shapeCommands.push(i); end
GameData::BodyShape.each { |c| @shapeCommands.push(c) if c.id != :None }
@sprites["searchbg"].visible = true
@sprites["overlay"].visible = true
@sprites["searchcursor"].visible = true

View File

@@ -980,7 +980,7 @@ def pbPokemonEditor
[_INTL("Height"), NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")],
[_INTL("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
[_INTL("Color"), GameDataProperty.new(:BodyColor), _INTL("Pokémon's body color.")],
[_INTL("Shape"), LimitProperty.new(14), _INTL("Body shape of this species (0-14).")],
[_INTL("Shape"), GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")],
[_INTL("Habitat"), GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")],
[_INTL("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")],
[_INTL("BattlerPlayerX"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],

View File

@@ -252,7 +252,7 @@ class GameDataProperty
end
i += 1
end
return pbChooseList(commands, oldsetting, nil, -1)
return pbChooseList(commands, oldsetting, oldsetting, -1)
end
def defaultValue
@@ -1165,19 +1165,20 @@ class EvolutionsProperty
for i in 0...oldsetting.length
realcmds.push([oldsetting[i][0],oldsetting[i][1],oldsetting[i][2],i])
end
refreshlist = true; oldsel = -1
refreshlist = true
oldsel = -1
cmd = [0,0]
loop do
if refreshlist
realcmds.sort! { |a,b| a[3]<=>b[3] }
commands = []
for i in 0...realcmds.length
if realcmds[i][0]<0
if realcmds[i][3]<0
commands.push(_INTL("[ADD EVOLUTION]"))
else
level = realcmds[i][1]
param_type = PBEvolution.getFunction(realcmds[i][0], "parameterType")
has_param = !PBEvolution.hasFunction?(realcmds[i][0], "parameterType") || param_type != nil
level = realcmds[i][2]
param_type = PBEvolution.getFunction(realcmds[i][1], "parameterType")
has_param = !PBEvolution.hasFunction?(realcmds[i][1], "parameterType") || param_type != nil
if has_param
if param_type && !GameData.const_defined?(param_type.to_sym)
level = getConstantName(param_type, level)
@@ -1186,16 +1187,17 @@ class EvolutionsProperty
end
level = "???" if !level || level.empty?
commands.push(_INTL("{1}: {2}, {3}",
GameData::Species.get(realcmds[i][2]).name, @methods[realcmds[i][0]], level.to_s))
GameData::Species.get(realcmds[i][0]).name, @methods[realcmds[i][1]], level.to_s))
else
commands.push(_INTL("{1}: {2}",
GameData::Species.get(realcmds[i][2]).name, @methods[realcmds[i][0]]))
GameData::Species.get(realcmds[i][0]).name, @methods[realcmds[i][1]]))
end
end
cmd[1] = i if oldsel>=0 && realcmds[i][3]==oldsel
end
end
refreshlist = false; oldsel = -1
refreshlist = false
oldsel = -1
cmd = pbCommands3(cmdwin,commands,-1,cmd[1],true)
if cmd[0]==1 # Swap evolution up
if cmd[1]>0 && cmd[1]<realcmds.length-1
@@ -1210,7 +1212,7 @@ class EvolutionsProperty
elsif cmd[0]==0
if cmd[1]>=0
entry = realcmds[cmd[1]]
if entry[0]==-1 # Add new evolution path
if entry[3]==-1 # Add new evolution path
pbMessage(_INTL("Choose an evolved form, method and parameter."))
newspecies = pbChooseSpeciesList
if newspecies
@@ -1244,16 +1246,16 @@ class EvolutionsProperty
(newparam.is_a?(Integer) && (newparam > 0 || (allow_zero && newparam == 0)))
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][3] if realcmds[i][0]==newmethod &&
realcmds[i][1]==newparam &&
realcmds[i][2]==newspecies
havemove = realcmds[i][3] if realcmds[i][0]==newspecies &&
realcmds[i][1]==newmethod &&
realcmds[i][2]==newparam
end
if havemove>=0
oldsel = havemove
else
maxid = -1
for i in realcmds; maxid = [maxid,i[3]].max; end
realcmds.push([newmethod,newparam,newspecies,maxid+1])
realcmds.each { |i| maxid = [maxid,i[3]].max }
realcmds.push([newspecies,newmethod,newparam,maxid+1])
oldsel = maxid+1
end
refreshlist = true
@@ -1261,34 +1263,15 @@ class EvolutionsProperty
end
end
else # Edit evolution
cmd2 = pbMessage(_INTL("\\ts[]Do what with this evolution?"),
case pbMessage(_INTL("\\ts[]Do what with this evolution?"),
[_INTL("Change species"),_INTL("Change method"),
_INTL("Change parameter"),_INTL("Delete"),_INTL("Cancel")],5)
if cmd2==0 # Change species
newspecies = pbChooseSpeciesList(entry[2])
when 0 # Change species
newspecies = pbChooseSpeciesList(entry[0])
if newspecies
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][3] if realcmds[i][0]==entry[0] &&
realcmds[i][1]==entry[1] &&
realcmds[i][2]==newspecies
end
if havemove>=0
realcmds[cmd[1]] = nil
realcmds.compact!
oldsel = havemove
else
entry[2] = newspecies
oldsel = entry[3]
end
refreshlist = true
end
elsif cmd2==1 # Change method
newmethod = pbMessage(_INTL("Choose an evolution method."),@methods,-1,nil,entry[0])
if newmethod>0
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][3] if realcmds[i][0]==newmethod &&
havemove = realcmds[i][3] if realcmds[i][0]==newspecies &&
realcmds[i][1]==entry[1] &&
realcmds[i][2]==entry[2]
end
@@ -1296,35 +1279,54 @@ class EvolutionsProperty
realcmds[cmd[1]] = nil
realcmds.compact!
oldsel = havemove
elsif newmethod != entry[0]
entry[0] = newmethod
entry[1] = 0
else
entry[0] = newspecies
oldsel = entry[3]
end
refreshlist = true
end
elsif cmd2==2 # Change parameter
when 1 # Change method
newmethod = pbMessage(_INTL("Choose an evolution method."),@methods,-1,nil,entry[1])
if newmethod>0
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][3] if realcmds[i][0]==entry[0] &&
realcmds[i][1]==newmethod &&
realcmds[i][2]==entry[2]
end
if havemove>=0
realcmds[cmd[1]] = nil
realcmds.compact!
oldsel = havemove
elsif newmethod != entry[1]
entry[1] = newmethod
entry[2] = 0
oldsel = entry[3]
end
refreshlist = true
end
when 2 # Change parameter
newparam = -1
param_type = PBEvolution.getFunction(entry[0], "parameterType")
has_param = !PBEvolution.hasFunction?(entry[0], "parameterType") || param_type != nil
param_type = PBEvolution.getFunction(entry[1], "parameterType")
has_param = !PBEvolution.hasFunction?(entry[1], "parameterType") || param_type != nil
if has_param
allow_zero = false
case param_type
when :Item
newparam = pbChooseItemList(entry[1])
newparam = pbChooseItemList(entry[2])
when :Move
newparam = pbChooseMoveList(entry[1])
newparam = pbChooseMoveList(entry[2])
when :Species
newparam = pbChooseSpeciesList(entry[1])
newparam = pbChooseSpeciesList(entry[2])
when :Type
newparam = pbChooseTypeList(entry[1])
newparam = pbChooseTypeList(entry[2])
when :Ability
newparam = pbChooseAbilityList(entry[1])
newparam = pbChooseAbilityList(entry[2])
else
allow_zero = true
params = ChooseNumberParams.new
params.setRange(0,65535)
params.setDefaultValue(entry[1])
params.setDefaultValue(entry[2])
params.setCancelValue(-1)
newparam = pbMessageChooseNumber(_INTL("Choose a parameter."),params)
end
@@ -1333,15 +1335,15 @@ class EvolutionsProperty
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][3] if realcmds[i][0]==entry[0] &&
realcmds[i][1]==newparam &&
realcmds[i][2]==entry[2]
realcmds[i][1]==entry[1] &&
realcmds[i][2]==newparam
end
if havemove>=0
realcmds[cmd[1]] = nil
realcmds.compact!
oldsel = havemove
else
entry[1] = newparam
entry[2] = newparam
oldsel = entry[3]
end
refreshlist = true
@@ -1349,7 +1351,7 @@ class EvolutionsProperty
else
pbMessage(_INTL("This evolution method doesn't use a parameter."))
end
elsif cmd2==3 # Delete
when 3 # Delete
realcmds[cmd[1]] = nil
realcmds.compact!
cmd[1] = [cmd[1],realcmds.length-1].min
@@ -1385,15 +1387,15 @@ class EvolutionsProperty
ret = ""
for i in 0...value.length
ret << "," if i>0
param = value[i][1]
param_type = PBEvolution.getFunction(value[i][0], "parameterType")
param = value[i][2]
param_type = PBEvolution.getFunction(value[i][1], "parameterType")
if param_type && !GameData.const_defined?(param_type.to_sym)
param = getConstantName(param_type, param)
else
param = param.to_s
end
param = "" if !param
ret << sprintf("#{GameData::Species.get(value[i][2]).name},#{@methods[value[i][0]]},#{param}")
ret << sprintf("#{GameData::Species.get(value[i][0]).name},#{@methods[value[i][1]]},#{param}")
end
return ret
end

View File

@@ -301,7 +301,7 @@ module Compiler
f.write(sprintf("Height = %.1f\r\n", species.height / 10.0))
f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0))
f.write(sprintf("Color = %s\r\n", species.color))
f.write(sprintf("Shape = %d\r\n", species.shape))
f.write(sprintf("Shape = %s\r\n", GameData::BodyShape.get(species.shape).id))
f.write(sprintf("Habitat = %s\r\n", species.habitat)) if species.habitat != :None
f.write(sprintf("Kind = %s\r\n", species.real_category))
f.write(sprintf("Pokedex = %s\r\n", species.real_pokedex_entry))
@@ -343,6 +343,7 @@ module Compiler
f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense
end
}
pbSetWindowText(nil)
Graphics.update
end
@@ -396,7 +397,9 @@ module Compiler
f.write(sprintf("Height = %.1f\r\n", species.height / 10.0)) if species.height != base_species.height
f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0)) if species.weight != base_species.weight
f.write(sprintf("Color = %s\r\n", species.color)) if species.color != base_species.color
f.write(sprintf("Shape = %d\r\n", species.shape)) if species.shape != base_species.shape
if GameData::BodyShape.get(species.shape).id != GameData::BodyShape.get(base_species.shape).id
f.write(sprintf("Shape = %s\r\n", GameData::BodyShape.get(species.shape).id))
end
if species.habitat != :None && species.habitat != base_species.habitat
f.write(sprintf("Habitat = %s\r\n", species.habitat))
end
@@ -404,8 +407,8 @@ module Compiler
f.write(sprintf("Pokedex = %s\r\n", species.real_pokedex_entry)) if species.real_pokedex_entry != base_species.real_pokedex_entry
f.write(sprintf("Generation = %d\r\n", species.generation)) if species.generation != base_species.generation
if species.wild_item_common != base_species.wild_item_common ||
species.wild_item_uncommon != base_species.wild_item_uncommon ||
species.wild_item_rare != base_species.wild_item_rare
species.wild_item_uncommon != base_species.wild_item_uncommon ||
species.wild_item_rare != base_species.wild_item_rare
f.write(sprintf("WildItemCommon = %s\r\n", species.wild_item_common)) if species.wild_item_common
f.write(sprintf("WildItemUncommon = %s\r\n", species.wild_item_uncommon)) if species.wild_item_uncommon
f.write(sprintf("WildItemRare = %s\r\n", species.wild_item_rare)) if species.wild_item_rare
@@ -442,6 +445,7 @@ module Compiler
end
end
}
pbSetWindowText(nil)
Graphics.update
end
@@ -613,6 +617,7 @@ module Compiler
end
end
}
pbSetWindowText(nil)
Graphics.update
end