Misc tidying

This commit is contained in:
Maruno17
2021-01-31 19:13:51 +00:00
parent f68cc1c98b
commit 168a1e5df7
19 changed files with 520 additions and 585 deletions

View File

@@ -637,7 +637,7 @@ PokemonDebugMenuCommands.register("setnature", {
"always_show" => true,
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
commands = []
(PBNatures.getCount).times do |i|
(PBNatures.maxValue + 1).times do |i|
statUp = PBNatures.getStatRaised(i)
statDown = PBNatures.getStatLowered(i)
if statUp != statDown
@@ -654,10 +654,10 @@ PokemonDebugMenuCommands.register("setnature", {
mag = _INTL("Nature is {1}.", PBNatures.getName(pkmn.nature))
cmd = screen.pbShowCommands(mag, commands, cmd)
break if cmd < 0
if cmd >= 0 && cmd < PBNatures.getCount # Set nature
if cmd >= 0 && cmd <= PBNatures.maxValue # Set nature
pkmn.nature = cmd
pkmn.calcStats
elsif cmd == PBNatures.getCount # Reset
elsif cmd == PBNatures.maxValue + 1 # Reset
pkmn.nature = nil
end
screen.pbRefreshSingle(pkmnid)

View File

@@ -284,12 +284,8 @@ def pbDefinePath(canvas)
showline=false
sliderwin2.visible=false
# This window displays the mouse's current position
window=Window_UnformattedTextPokemon.new("")
window.x=0
window.y=320-64
window.width=128
window.height=64
window.viewport=canvas.viewport
window=Window_UnformattedTextPokemon.newWithSize("",
0, 320 - 64, 128, 64, canvas.viewport)
loop do
Graphics.update
Input.update

View File

@@ -667,7 +667,7 @@ module TrainerPokemonProperty
pkmn_properties.concat([
[_INTL("Ability"), LimitProperty2.new(99), _INTL("Ability flag. 0=first ability, 1=second ability, 2-5=hidden ability.")],
[_INTL("Held item"), ItemProperty, _INTL("Item held by the Pokémon.")],
[_INTL("Nature"), NatureProperty, _INTL("Nature of the Pokémon.")],
[_INTL("Nature"), EnumProperty2.new(PBNatures), _INTL("Nature of the Pokémon.")],
[_INTL("IVs"), IVsProperty.new(Pokemon::IV_STAT_LIMIT), _INTL("Individual values for each of the Pokémon's stats.")],
[_INTL("EVs"), EVsProperty.new(Pokemon::EV_STAT_LIMIT), _INTL("Effort values for each of the Pokémon's stats.")],
[_INTL("Happiness"), LimitProperty2.new(255), _INTL("Happiness of the Pokémon (0-255).")],
@@ -958,13 +958,8 @@ def pbPokemonEditor
[_INTL("BaseStats"), BaseStatsProperty, _INTL("Base stats of the Pokémon.")],
[_INTL("EffortPoints"), EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")],
[_INTL("BaseEXP"), LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")],
[_INTL("GrowthRate"), EnumProperty.new([
_INTL("Medium"), _INTL("Erratic"), _INTL("Fluctuating"),
_INTL("Parabolic"), _INTL("Fast"), _INTL("Slow")]), _INTL("Pokémon's growth rate.")],
[_INTL("GenderRate"), EnumProperty.new([
_INTL("Genderless"), _INTL("AlwaysMale"), _INTL("FemaleOneEighth"),
_INTL("Female25Percent"), _INTL("Female50Percent"), _INTL("Female75Percent"),
_INTL("FemaleSevenEighths"), _INTL("AlwaysFemale")]), _INTL("Proportion of males to females for this species.")],
[_INTL("GrowthRate"), EnumProperty2.new(PBGrowthRates), _INTL("Pokémon's growth rate.")],
[_INTL("GenderRate"), EnumProperty2.new(PBGenderRates), _INTL("Proportion of males to females for this species.")],
[_INTL("Rareness"), LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")],
[_INTL("Happiness"), LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")],
[_INTL("Moves"), MovePoolProperty, _INTL("Moves which the Pokémon learns while levelling up.")],
@@ -979,28 +974,16 @@ def pbPokemonEditor
[_INTL("WildItemCommon"), ItemProperty, _INTL("Item commonly held by wild Pokémon of this species.")],
[_INTL("WildItemUncommon"), ItemProperty, _INTL("Item uncommonly held by wild Pokémon of this species.")],
[_INTL("WildItemRare"), ItemProperty, _INTL("Item rarely held by wild Pokémon of this species.")],
[_INTL("Compat1"), EnumProperty.new([
"Undiscovered", "Monster", "Water 1", "Bug", "Flying",
"Field", "Fairy", "Grass", "Human-like", "Water 3",
"Mineral", "Amorphous", "Water 2", "Ditto", "Dragon"]), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("Compat2"), EnumProperty.new([
"Undiscovered", "Monster", "Water 1", "Bug", "Flying",
"Field", "Fairy", "Grass", "Human-like", "Water 3",
"Mineral", "Amorphous", "Water 2", "Ditto", "Dragon"]), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("Compat1"), EnumProperty2.new(PBEggGroups), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("Compat2"), EnumProperty2.new(PBEggGroups), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("StepsToHatch"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")],
[_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
[_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")],
[_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"), EnumProperty.new([
_INTL("Red"), _INTL("Blue"), _INTL("Yellow"), _INTL("Green"),
_INTL("Black"), _INTL("Brown"), _INTL("Purple"), _INTL("Gray"),
_INTL("White"), _INTL("Pink")]), _INTL("Pokémon's body color.")],
[_INTL("Color"), EnumProperty2.new(PBColors), _INTL("Pokémon's body color.")],
[_INTL("Shape"), LimitProperty.new(14), _INTL("Body shape of this species (0-14).")],
[_INTL("Habitat"), EnumProperty.new([
_INTL("None"), _INTL("Grassland"), _INTL("Forest"), _INTL("WatersEdge"),
_INTL("Sea"), _INTL("Cave"), _INTL("Mountain"), _INTL("RoughTerrain"),
_INTL("Urban"), _INTL("Rare")]), _INTL("The habitat of this species.")],
[_INTL("Habitat"), EnumProperty2.new(PBHabitats), _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.")],
[_INTL("BattlerPlayerY"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
@@ -1418,20 +1401,12 @@ def pbAnimationsOrganiser
cmdwin = pbListWindow([])
cmdwin.viewport = viewport
cmdwin.z = 2
title = Window_UnformattedTextPokemon.new(_INTL("Animations Organiser"))
title.x = Graphics.width/2
title.y = 0
title.width = Graphics.width/2
title.height = 64
title.viewport = viewport
title.z = 2
info = Window_AdvancedTextPokemon.new(_INTL("Z+Up/Down: Swap\nZ+Left: Delete\nZ+Right: Insert"))
info.x = Graphics.width/2
info.y = 64
info.width = Graphics.width/2
info.height = Graphics.height-64
info.viewport = viewport
info.z = 2
title = Window_UnformattedTextPokemon.newWithSize(_INTL("Animations Organiser"),
Graphics.width / 2, 0, Graphics.width / 2, 64, viewport)
title.z = 2
info = Window_AdvancedTextPokemon.newWithSize(_INTL("Z+Up/Down: Swap\nZ+Left: Delete\nZ+Right: Insert"),
Graphics.width / 2, 64, Graphics.width / 2, Graphics.height - 64, viewport)
info.z = 2
commands = []
refreshlist = true; oldsel = -1
cmd = [0,0]

View File

@@ -209,6 +209,32 @@ end
class EnumProperty2
def initialize(value)
@module = value
end
def set(settingname,oldsetting)
commands = []
for i in 0..@module.maxValue
commands.push(getConstantName(@module, i))
end
cmd = pbMessage(_INTL("Choose a value for {1}.", settingname), commands, -1, nil, oldsetting)
return oldsetting if cmd < 0
return cmd
end
def defaultValue
return nil
end
def format(value)
return (value) ? getConstantName(@module, value) : "-"
end
end
module BGMProperty
def self.set(settingname,oldsetting)
chosenmap = pbListScreen(settingname,MusicFileLister.new(true,oldsetting))
@@ -393,27 +419,6 @@ end
module NatureProperty
def self.set(_settingname,_oldsetting)
commands = []
(PBNatures.getCount).times do |i|
commands.push(PBNatures.getName(i))
end
ret = pbShowCommands(nil,commands,-1)
return (ret>=0) ? ret : nil
end
def self.defaultValue
return nil
end
def self.format(value)
return (value) ? getConstantName(PBNatures,value) : "-"
end
end
class IVsProperty
def initialize(limit)
@limit = limit
@@ -592,13 +597,9 @@ end
def chooseMapPoint(map,rgnmap=false)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
title=Window_UnformattedTextPokemon.new(_INTL("Click a point on the map."))
title.x=0
title.y=Graphics.height-64
title.width=Graphics.width
title.height=64
title.viewport=viewport
title.z=2
title = Window_UnformattedTextPokemon.newWithSize(_INTL("Click a point on the map."),
0, Graphics.height - 64, Graphics.width, 64, viewport)
title.z = 2
if rgnmap
sprite=RegionMapSprite.new(map,viewport)
else
@@ -737,23 +738,6 @@ end
module EnvironmentProperty
def self.set(_settingname,_oldsetting)
options = []
for i in 0..PBEnvironment.maxValue
options.push(getConstantName(PBEnvironment,i) || "ERROR")
end
cmd = pbMessage(_INTL("Choose an environment."),options,1)
return cmd
end
def self.format(value)
return (value) ? (getConstantName(PBEnvironment,value) || "ERROR") : "-"
end
end
module MapProperty
def self.set(settingname,oldsetting)
chosenmap = pbListScreen(settingname,MapLister.new(oldsetting ? oldsetting : 0))
@@ -789,14 +773,10 @@ end
module PocketProperty
def self.pocketnames
return [_INTL("Items"), _INTL("Medicine"), _INTL("Poké Balls"),
_INTL("TMs & HMs"), _INTL("Berries"), _INTL("Mail"),
_INTL("Battle Items"), _INTL("Key Items")]
end
def self.set(_settingname, oldsetting)
cmd = pbMessage(_INTL("Choose a pocket for this item."), pocketnames(), -1)
commands = pbPocketNames.clone
commands.shift
cmd = pbMessage(_INTL("Choose a pocket for this item."), commands, -1)
return (cmd >= 0) ? cmd + 1 : oldsetting
end
@@ -806,7 +786,7 @@ module PocketProperty
def self.format(value)
return _INTL("No Pocket") if value == 0
return (value) ? pocketnames[value - 1] : value.inspect
return (value) ? pbPocketNames[value] : value.inspect
end
end

View File

@@ -64,7 +64,7 @@ def pbListScreenBlock(title,lister)
list.viewport = viewport
list.z = 2
title = Window_UnformattedTextPokemon.newWithSize(title,
Graphics.width / 2, 0, Graphics.width - title.x, 64, viewport)
Graphics.width / 2, 0, Graphics.width / 2, 64, viewport)
title.z = 2
lister.setViewport(viewport)
selectedmap = -1

View File

@@ -81,12 +81,8 @@ class PokemonTilesetScene
@tileset = @tilesetwrapper.data[1]
@tilehelper = TileDrawingHelper.fromTileset(@tileset)
@sprites = {}
@sprites["title"] = Window_UnformattedTextPokemon.new(_INTL("Tileset Editor\r\nPgUp/PgDn: SCROLL\r\nZ: MENU"))
@sprites["title"].viewport = @viewport
@sprites["title"].x = TILESET_WIDTH
@sprites["title"].y = 0
@sprites["title"].width = Graphics.width - TILESET_WIDTH
@sprites["title"].height = 128
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(_INTL("Tileset Editor\r\nPgUp/PgDn: SCROLL\r\nZ: MENU"),
TILESET_WIDTH, 0, Graphics.width - TILESET_WIDTH, 128, @viewport)
@sprites["tileset"] = IconSprite.new(0,0,@viewport)
@sprites["tileset"].setBitmap("Graphics/Tilesets/#{@tileset.tileset_name}")
@sprites["tileset"].src_rect = Rect.new(0,0,TILESET_WIDTH,Graphics.height)

View File

@@ -327,13 +327,9 @@ class MapScreenScene
@selmapid=-1
addBackgroundPlane(@sprites,"background","Trainer Card/bg",@viewport)
@sprites["selsprite"]=SelectionSprite.new(@viewport)
@sprites["title"]=Window_UnformattedTextPokemon.new(_INTL("F: Help"))
@sprites["title"].x=0
@sprites["title"].y=600-64
@sprites["title"].width=800
@sprites["title"].height=64
@sprites["title"].viewport=@viewport
@sprites["title"].z=2
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(_INTL("F: Help"),
0, 600 - 64, 800, 64, @viewport)
@sprites["title"].z = 2
@mapinfos=load_data("Data/MapInfos.rxdata")
conns=MapFactoryHelper.getMapConnections
@mapconns=[]
@@ -362,13 +358,9 @@ class MapScreenScene
helptext+=_INTL("Double-click: Edit map's metadata\r\n")
helptext+=_INTL("Drag map to move it\r\n")
helptext+=_INTL("Arrow keys/drag canvas: Move around canvas")
title=Window_UnformattedTextPokemon.new(helptext)
title.x=0
title.y=0
title.width=800*8/10
title.height=600
title.viewport=@viewport
title.z=2
title = Window_UnformattedTextPokemon.newWithSize(helptext,
0, 0, 800 * 8 / 10, 600, @viewport)
title.z = 2
loop do
Graphics.update
Input.update