mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
Rewrote Debug menus to store options in self-contained handlers
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
|
#===============================================================================
|
||||||
# Defines an event that procedures can subscribe to.
|
# Defines an event that procedures can subscribe to.
|
||||||
|
#===============================================================================
|
||||||
class Event
|
class Event
|
||||||
def initialize
|
def initialize
|
||||||
@callbacks = []
|
@callbacks = []
|
||||||
@@ -63,8 +65,9 @@ class Event
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
class HandlerHash
|
class HandlerHash
|
||||||
def initialize(mod)
|
def initialize(mod)
|
||||||
@mod = mod
|
@mod = mod
|
||||||
@@ -145,10 +148,10 @@ class HandlerHash
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
# A stripped-down version of class HandlerHash which only deals with symbols and
|
# A stripped-down version of class HandlerHash which only deals with symbols and
|
||||||
# doesn't care about whether those symbols actually relate to a defined thing.
|
# doesn't care about whether those symbols actually relate to a defined thing.
|
||||||
|
#===============================================================================
|
||||||
class HandlerHash2
|
class HandlerHash2
|
||||||
def initialize
|
def initialize
|
||||||
@hash = {}
|
@hash = {}
|
||||||
@@ -197,22 +200,76 @@ class HandlerHash2
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# An even more stripped down version of class HandlerHash which just takes
|
||||||
|
# hashes with keys, no matter what the keys are.
|
||||||
|
#===============================================================================
|
||||||
|
class HandlerHashBasic
|
||||||
|
def initialize
|
||||||
|
@ordered_keys = []
|
||||||
|
@hash = {}
|
||||||
|
@addIfs = []
|
||||||
|
end
|
||||||
|
|
||||||
|
def [](entry)
|
||||||
|
ret = nil
|
||||||
|
ret = @hash[entry] if entry && @hash[entry]
|
||||||
|
unless ret
|
||||||
|
for addif in @addIfs
|
||||||
|
return addif[1] if addif[0].call(entry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
class SpeciesHandlerHash < HandlerHash2
|
def each
|
||||||
|
@ordered_keys.each { |key| yield key, @hash[key] }
|
||||||
|
end
|
||||||
|
|
||||||
|
def add(entry, handler = nil, &handlerBlock)
|
||||||
|
if ![Proc,Hash].include?(handler.class) && !block_given?
|
||||||
|
raise ArgumentError, "#{self.class.name} for #{entry.inspect} has no valid handler (#{handler.inspect} was given)"
|
||||||
|
end
|
||||||
|
return if !entry || entry.empty?
|
||||||
|
@ordered_keys.push(entry) if !@ordered_keys.include?(entry)
|
||||||
|
@hash[entry] = handler || handlerBlock
|
||||||
|
end
|
||||||
|
|
||||||
|
def addIf(conditionProc, handler = nil, &handlerBlock)
|
||||||
|
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||||
|
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
||||||
|
end
|
||||||
|
@addIfs.push([conditionProc, handler || handlerBlock])
|
||||||
|
end
|
||||||
|
|
||||||
|
def copy(src, *dests)
|
||||||
|
handler = self[src]
|
||||||
|
return if !handler
|
||||||
|
dests.each { |dest| self.add(dest, handler) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def clear
|
||||||
|
@hash.clear
|
||||||
|
@ordered_keys.clear
|
||||||
|
end
|
||||||
|
|
||||||
|
def trigger(entry, *args)
|
||||||
|
handler = self[entry]
|
||||||
|
return (handler) ? handler.call(*args) : nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
class SpeciesHandlerHash < HandlerHash2
|
||||||
|
end
|
||||||
|
|
||||||
class AbilityHandlerHash < HandlerHash2
|
class AbilityHandlerHash < HandlerHash2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ItemHandlerHash < HandlerHash2
|
class ItemHandlerHash < HandlerHash2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MoveHandlerHash < HandlerHash2
|
class MoveHandlerHash < HandlerHash2
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1449,6 +1449,7 @@ end
|
|||||||
class PokemonStorageScreen
|
class PokemonStorageScreen
|
||||||
attr_reader :scene
|
attr_reader :scene
|
||||||
attr_reader :storage
|
attr_reader :storage
|
||||||
|
attr_accessor :heldpkmn
|
||||||
|
|
||||||
def initialize(scene,storage)
|
def initialize(scene,storage)
|
||||||
@scene = scene
|
@scene = scene
|
||||||
|
|||||||
@@ -1,858 +0,0 @@
|
|||||||
class CommandMenuList
|
|
||||||
attr_accessor :currentList
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
@commands = []
|
|
||||||
@currentList = "main"
|
|
||||||
end
|
|
||||||
|
|
||||||
def add(parent,cmd,name,desc=nil)
|
|
||||||
@commands.push([parent,cmd,name,desc])
|
|
||||||
end
|
|
||||||
|
|
||||||
def list
|
|
||||||
ret = []
|
|
||||||
for i in @commands
|
|
||||||
ret.push(i[2]) if i[0]==@currentList
|
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
def getCommand(index)
|
|
||||||
count = 0
|
|
||||||
for i in @commands
|
|
||||||
if i[0]==@currentList
|
|
||||||
return i[1] if count==index
|
|
||||||
count += 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def getDesc(index)
|
|
||||||
count = 0
|
|
||||||
for i in @commands
|
|
||||||
if i[0]==@currentList
|
|
||||||
return i[3] if count==index && i[3]
|
|
||||||
count += 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return "<No description available>"
|
|
||||||
end
|
|
||||||
|
|
||||||
def hasSubMenu?(cmd)
|
|
||||||
for i in @commands
|
|
||||||
return true if i[0]==cmd
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def getParent
|
|
||||||
ret = nil
|
|
||||||
for i in @commands
|
|
||||||
if i[1]==@currentList
|
|
||||||
ret = i[0]; break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if ret
|
|
||||||
count = 0
|
|
||||||
for i in @commands
|
|
||||||
if i[0]==ret
|
|
||||||
return [ret,count] if i[1]==@currentList
|
|
||||||
count += 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return [ret,0]
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def pbDebugMenuCommands(showall=true)
|
|
||||||
commands = CommandMenuList.new
|
|
||||||
if showall
|
|
||||||
commands.add("main","fieldmenu",_INTL("Field options..."),
|
|
||||||
_INTL("Warp to maps, edit switches/variables, use the PC, edit Day Care, etc."))
|
|
||||||
commands.add("fieldmenu","warp",_INTL("Warp to Map"),
|
|
||||||
_INTL("Instantly warp to another map of your choice."))
|
|
||||||
# - Optional coordinates
|
|
||||||
commands.add("fieldmenu","refreshmap",_INTL("Refresh Map"),
|
|
||||||
_INTL("Make all events on this map, and common events, refresh themselves."))
|
|
||||||
commands.add("fieldmenu","switches",_INTL("Switches"),
|
|
||||||
_INTL("Edit all Game Switches (except Script Switches)."))
|
|
||||||
commands.add("fieldmenu","variables",_INTL("Variables"),
|
|
||||||
_INTL("Edit all Game Variables. Can set them to numbers or text."))
|
|
||||||
commands.add("fieldmenu","usepc",_INTL("Use PC"),
|
|
||||||
_INTL("Use a PC to access Pokémon storage and player's PC."))
|
|
||||||
commands.add("fieldmenu","togglewallpapers",_INTL("Toggle Storage Wallpapers"),
|
|
||||||
_INTL("Unlock and lock special wallpapers used in Pokémon storage."))
|
|
||||||
commands.add("fieldmenu","daycare",_INTL("Day Care"),
|
|
||||||
_INTL("View Pokémon in the Day Care and edit them."))
|
|
||||||
commands.add("fieldmenu","relicstone",_INTL("Use Relic Stone"),
|
|
||||||
_INTL("Shadow Pokémon. Choose a Pokémon to show to the Relic Stone for purification."))
|
|
||||||
commands.add("fieldmenu","purifychamber",_INTL("Use Purify Chamber"),
|
|
||||||
_INTL("Shadow Pokémon. Open the Purify Chamber for purification."))
|
|
||||||
|
|
||||||
commands.add("main","battlemenu",_INTL("Battle options..."),
|
|
||||||
_INTL("Start battles, reset this map's trainers, ready rematches, edit roamers, etc."))
|
|
||||||
commands.add("battlemenu","testwildbattle",_INTL("Test Wild Battle"),
|
|
||||||
_INTL("Start a single battle against a wild Pokémon. You choose the species/level."))
|
|
||||||
commands.add("battlemenu","testwildbattleadvanced",_INTL("Test Wild Battle Advanced"),
|
|
||||||
_INTL("Start a battle against 1 or more wild Pokémon. Battle size is your choice."))
|
|
||||||
commands.add("battlemenu","testtrainerbattle",_INTL("Test Trainer Battle"),
|
|
||||||
_INTL("Start a single battle against a trainer of your choice."))
|
|
||||||
commands.add("battlemenu","testtrainerbattleadvanced",_INTL("Test Trainer Battle Advanced"),
|
|
||||||
_INTL("Start a battle against 1 or more trainers with a battle size of your choice."))
|
|
||||||
commands.add("battlemenu","togglelogging",_INTL("Toggle Battle Logging"),
|
|
||||||
_INTL("Record debug logs for battles in Data/debuglog.txt."))
|
|
||||||
commands.add("battlemenu","resettrainers",_INTL("Reset Map's Trainers"),
|
|
||||||
_INTL("Turn off Self Switches A and B for all events with \"Trainer\" in their name."))
|
|
||||||
commands.add("battlemenu","readyrematches",_INTL("Ready All Phone Rematches"),
|
|
||||||
_INTL("Make all trainers in the phone ready for rematches."))
|
|
||||||
commands.add("battlemenu","roamers",_INTL("Roaming Pokémon"),
|
|
||||||
_INTL("Toggle and edit all roaming Pokémon."))
|
|
||||||
|
|
||||||
commands.add("main","itemsmenu",_INTL("Item options..."),
|
|
||||||
_INTL("Give and take items."))
|
|
||||||
commands.add("itemsmenu","additem",_INTL("Add Item"),
|
|
||||||
_INTL("Choose an item and a quantity of it to add to the Bag."))
|
|
||||||
commands.add("itemsmenu","fillbag",_INTL("Fill Bag"),
|
|
||||||
_INTL("Add a certain number of every item to the Bag."))
|
|
||||||
commands.add("itemsmenu","emptybag",_INTL("Empty Bag"),
|
|
||||||
_INTL("Remove all items from the Bag."))
|
|
||||||
|
|
||||||
commands.add("main","pokemonmenu",_INTL("Pokémon options..."),
|
|
||||||
_INTL("Give Pokémon, heal party, fill/empty PC storage, etc."))
|
|
||||||
commands.add("pokemonmenu","addpokemon",_INTL("Add Pokémon"),
|
|
||||||
_INTL("Give yourself a Pokémon of a chosen species/level. Goes to PC if party is full."))
|
|
||||||
commands.add("pokemonmenu","demoparty",_INTL("Give Demo Party"),
|
|
||||||
_INTL("Give yourself 6 preset Pokémon. They overwrite the current party."))
|
|
||||||
commands.add("pokemonmenu","healparty",_INTL("Heal Party"),
|
|
||||||
_INTL("Fully heal the HP/status/PP of all Pokémon in the party."))
|
|
||||||
commands.add("pokemonmenu","quickhatch",_INTL("Quick Hatch"),
|
|
||||||
_INTL("Make all eggs in the party require just one more step to hatch."))
|
|
||||||
commands.add("pokemonmenu","fillboxes",_INTL("Fill Storage Boxes"),
|
|
||||||
_INTL("Add one Pokémon of each species (at Level 50) to storage."))
|
|
||||||
commands.add("pokemonmenu","clearboxes",_INTL("Clear Storage Boxes"),
|
|
||||||
_INTL("Remove all Pokémon in storage."))
|
|
||||||
commands.add("pokemonmenu","openstorage",_INTL("Access Pokémon Storage"),
|
|
||||||
_INTL("Opens the Pokémon storage boxes in Organize Boxes mode."))
|
|
||||||
|
|
||||||
commands.add("main","playermenu",_INTL("Player options..."),
|
|
||||||
_INTL("Set money, badges, Pokédexes, player's appearance and name, etc."))
|
|
||||||
commands.add("playermenu","setbadges",_INTL("Set Badges"),
|
|
||||||
_INTL("Toggle possession of each Gym Badge."))
|
|
||||||
commands.add("playermenu","setmoney",_INTL("Set Money"),
|
|
||||||
_INTL("Edit how much money you have."))
|
|
||||||
commands.add("playermenu","setcoins",_INTL("Set Coins"),
|
|
||||||
_INTL("Edit how many Game Corner Coins you have."))
|
|
||||||
commands.add("playermenu","toggleshoes",_INTL("Toggle Running Shoes"),
|
|
||||||
_INTL("Toggle possession of running shoes."))
|
|
||||||
commands.add("playermenu","togglepokegear",_INTL("Toggle Pokégear"),
|
|
||||||
_INTL("Toggle possession of the Pokégear."))
|
|
||||||
commands.add("playermenu","dexlists",_INTL("Toggle Pokédex and Dexes"),
|
|
||||||
_INTL("Toggle possession of the Pokédex, and edit Regional Dex accessibility."))
|
|
||||||
commands.add("playermenu","setplayer",_INTL("Set Player Character"),
|
|
||||||
_INTL("Edit the player's character, as defined in \"metadata.txt\"."))
|
|
||||||
commands.add("playermenu","changeoutfit",_INTL("Set Player Outfit"),
|
|
||||||
_INTL("Edit the player's outfit number."))
|
|
||||||
commands.add("playermenu","renameplayer",_INTL("Set Player Name"),
|
|
||||||
_INTL("Rename the player."))
|
|
||||||
commands.add("playermenu","randomid",_INTL("Randomise Player ID"),
|
|
||||||
_INTL("Generate a random new ID for the player."))
|
|
||||||
end
|
|
||||||
|
|
||||||
commands.add("main","editorsmenu",_INTL("Information editors..."),
|
|
||||||
_INTL("Edit information in the PBS files, terrain tags, battle animations, etc."))
|
|
||||||
commands.add("editorsmenu","setmetadata",_INTL("Edit Metadata"),
|
|
||||||
_INTL("Edit global and map metadata."))
|
|
||||||
commands.add("editorsmenu","mapconnections",_INTL("Edit Map Connections"),
|
|
||||||
_INTL("Connect maps using a visual interface. Can also edit map encounters/metadata."))
|
|
||||||
commands.add("editorsmenu","terraintags",_INTL("Edit Terrain Tags"),
|
|
||||||
_INTL("Edit the terrain tags of tiles in tilesets. Required for tags 8+."))
|
|
||||||
commands.add("editorsmenu","setencounters",_INTL("Edit Wild Encounters"),
|
|
||||||
_INTL("Edit the wild Pokémon that can be found on maps, and how they are encountered."))
|
|
||||||
commands.add("editorsmenu","trainertypes",_INTL("Edit Trainer Types"),
|
|
||||||
_INTL("Edit the properties of trainer types."))
|
|
||||||
commands.add("editorsmenu","edittrainers",_INTL("Edit Individual Trainers"),
|
|
||||||
_INTL("Edit individual trainers, their Pokémon and items."))
|
|
||||||
commands.add("editorsmenu","edititems",_INTL("Edit Items"),
|
|
||||||
_INTL("Edit item data."))
|
|
||||||
commands.add("editorsmenu","editpokemon",_INTL("Edit Pokémon"),
|
|
||||||
_INTL("Edit Pokémon species data."))
|
|
||||||
commands.add("editorsmenu","editdexes",_INTL("Edit Regional Dexes"),
|
|
||||||
_INTL("Create, rearrange and delete Regional Pokédex lists."))
|
|
||||||
commands.add("editorsmenu","positionsprites",_INTL("Edit Pokémon Sprite Positions"),
|
|
||||||
_INTL("Reposition Pokémon sprites in battle."))
|
|
||||||
commands.add("editorsmenu","autopositionsprites",_INTL("Auto-Position All Sprites"),
|
|
||||||
_INTL("Automatically reposition all Pokémon sprites in battle. Don't use lightly."))
|
|
||||||
commands.add("editorsmenu","animeditor",_INTL("Battle Animation Editor"),
|
|
||||||
_INTL("Edit the battle animations."))
|
|
||||||
commands.add("editorsmenu","animorganiser",_INTL("Battle Animation Organiser"),
|
|
||||||
_INTL("Rearrange/add/delete battle animations."))
|
|
||||||
commands.add("editorsmenu","importanims",_INTL("Import All Battle Animations"),
|
|
||||||
_INTL("Import all battle animations from the \"Animations\" folder."))
|
|
||||||
commands.add("editorsmenu","exportanims",_INTL("Export All Battle Animations"),
|
|
||||||
_INTL("Export all battle animations individually to the \"Animations\" folder."))
|
|
||||||
|
|
||||||
commands.add("main","othermenu",_INTL("Other options..."),
|
|
||||||
_INTL("Mystery Gifts, translations, compile data, etc."))
|
|
||||||
commands.add("othermenu","mysterygift",_INTL("Manage Mystery Gifts"),
|
|
||||||
_INTL("Edit and enable/disable Mystery Gifts."))
|
|
||||||
commands.add("othermenu","extracttext",_INTL("Extract Text"),
|
|
||||||
_INTL("Extract all text in the game to a single file for translating."))
|
|
||||||
commands.add("othermenu","compiletext",_INTL("Compile Text"),
|
|
||||||
_INTL("Import text and converts it into a language file."))
|
|
||||||
commands.add("othermenu","compiledata",_INTL("Compile Data"),
|
|
||||||
_INTL("Fully compile all data."))
|
|
||||||
commands.add("othermenu","debugconsole",_INTL("Debug Console"),
|
|
||||||
_INTL("Open the Debug Console."))
|
|
||||||
commands.add("othermenu","invalidtiles",_INTL("Fix Invalid Tiles"),
|
|
||||||
_INTL("Scans all maps and erases non-existent tiles."))
|
|
||||||
|
|
||||||
return commands
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
|
|
||||||
case cmd
|
|
||||||
#=============================================================================
|
|
||||||
# Field options
|
|
||||||
#=============================================================================
|
|
||||||
when "warp"
|
|
||||||
map = pbWarpToMap
|
|
||||||
if map
|
|
||||||
pbFadeOutAndHide(sprites)
|
|
||||||
pbDisposeMessageWindow(sprites["textbox"])
|
|
||||||
pbDisposeSpriteHash(sprites)
|
|
||||||
viewport.dispose
|
|
||||||
if $scene.is_a?(Scene_Map)
|
|
||||||
$game_temp.player_new_map_id = map[0]
|
|
||||||
$game_temp.player_new_x = map[1]
|
|
||||||
$game_temp.player_new_y = map[2]
|
|
||||||
$game_temp.player_new_direction = 2
|
|
||||||
$scene.transfer_player
|
|
||||||
$game_map.refresh
|
|
||||||
else
|
|
||||||
pbCancelVehicles
|
|
||||||
$MapFactory.setup(map[0])
|
|
||||||
$game_player.moveto(map[1],map[2])
|
|
||||||
$game_player.turn_down
|
|
||||||
$game_map.update
|
|
||||||
$game_map.autoplay
|
|
||||||
$game_map.refresh
|
|
||||||
end
|
|
||||||
return true # Closes the debug menu to allow the warp
|
|
||||||
end
|
|
||||||
when "refreshmap"
|
|
||||||
$game_map.need_refresh = true
|
|
||||||
pbMessage(_INTL("The map will refresh."))
|
|
||||||
when "switches"
|
|
||||||
pbDebugVariables(0)
|
|
||||||
when "variables"
|
|
||||||
pbDebugVariables(1)
|
|
||||||
when "usepc"
|
|
||||||
pbPokeCenterPC
|
|
||||||
when "togglewallpapers"
|
|
||||||
w = $PokemonStorage.allWallpapers
|
|
||||||
if w.length<=PokemonStorage::BASICWALLPAPERQTY
|
|
||||||
pbMessage(_INTL("There are no special wallpapers defined."))
|
|
||||||
else
|
|
||||||
paperscmd = 0
|
|
||||||
unlockarray = $PokemonStorage.unlockedWallpapers
|
|
||||||
loop do
|
|
||||||
paperscmds = []
|
|
||||||
paperscmds.push(_INTL("Unlock all"))
|
|
||||||
paperscmds.push(_INTL("Lock all"))
|
|
||||||
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
|
|
||||||
paperscmds.push(_INTL("{1} {2}",unlockarray[i] ? "[Y]" : "[ ]",w[i]))
|
|
||||||
end
|
|
||||||
paperscmd = pbShowCommands(nil,paperscmds,-1,paperscmd)
|
|
||||||
break if paperscmd<0
|
|
||||||
if paperscmd==0 # Unlock all
|
|
||||||
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
|
|
||||||
unlockarray[i] = true
|
|
||||||
end
|
|
||||||
elsif paperscmd==1 # Lock all
|
|
||||||
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
|
|
||||||
unlockarray[i] = false
|
|
||||||
end
|
|
||||||
else
|
|
||||||
paperindex = paperscmd-2+PokemonStorage::BASICWALLPAPERQTY
|
|
||||||
unlockarray[paperindex] = !$PokemonStorage.unlockedWallpapers[paperindex]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "daycare"
|
|
||||||
pbDebugDayCare
|
|
||||||
when "relicstone"
|
|
||||||
pbRelicStone
|
|
||||||
when "purifychamber"
|
|
||||||
pbPurifyChamber
|
|
||||||
#=============================================================================
|
|
||||||
# Battle options
|
|
||||||
#=============================================================================
|
|
||||||
when "testwildbattle"
|
|
||||||
species = pbChooseSpeciesList
|
|
||||||
if species
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,PBExperience.maxLevel)
|
|
||||||
params.setInitialValue(5)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.", GameData::Species.get(species).name), params)
|
|
||||||
if level>0
|
|
||||||
$PokemonTemp.encounterType = -1
|
|
||||||
pbWildBattle(species,level)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "testwildbattleadvanced"
|
|
||||||
pkmn = []
|
|
||||||
size0 = 1
|
|
||||||
pkmnCmd = 0
|
|
||||||
loop do
|
|
||||||
pkmnCmds = []
|
|
||||||
pkmn.each do |p|
|
|
||||||
pkmnCmds.push(sprintf("%s Lv.%d",p.name,p.level))
|
|
||||||
end
|
|
||||||
pkmnCmds.push(_INTL("[Add Pokémon]"))
|
|
||||||
pkmnCmds.push(_INTL("[Set player side size]"))
|
|
||||||
pkmnCmds.push(_INTL("[Start {1}v{2} battle]",size0,pkmn.length))
|
|
||||||
pkmnCmd = pbShowCommands(nil,pkmnCmds,-1,pkmnCmd)
|
|
||||||
break if pkmnCmd<0
|
|
||||||
if pkmnCmd==pkmnCmds.length-1 # Start battle
|
|
||||||
if pkmn.length==0
|
|
||||||
pbMessage(_INTL("No Pokémon were chosen, cannot start battle."))
|
|
||||||
next
|
|
||||||
end
|
|
||||||
setBattleRule(sprintf("%dv%d",size0,pkmn.length))
|
|
||||||
$PokemonTemp.encounterType = -1
|
|
||||||
pbWildBattleCore(*pkmn)
|
|
||||||
break
|
|
||||||
elsif pkmnCmd==pkmnCmds.length-2 # Set player side size
|
|
||||||
if !pbCanDoubleBattle?
|
|
||||||
pbMessage(_INTL("You only have one Pokémon."))
|
|
||||||
next
|
|
||||||
end
|
|
||||||
maxVal = (pbCanTripleBattle?) ? 3 : 2
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,maxVal)
|
|
||||||
params.setInitialValue(size0)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
newSize = pbMessageChooseNumber(
|
|
||||||
_INTL("Choose the number of battlers on the player's side (max. {1}).",maxVal),params)
|
|
||||||
size0 = newSize if newSize>0
|
|
||||||
elsif pkmnCmd==pkmnCmds.length-3 # Add Pokémon
|
|
||||||
species = pbChooseSpeciesList
|
|
||||||
if species
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,PBExperience.maxLevel)
|
|
||||||
params.setInitialValue(5)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.", GameData::Species.get(species).name), params)
|
|
||||||
if level>0
|
|
||||||
pkmn.push(Pokemon.new(species,level))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else # Edit a Pokémon
|
|
||||||
if pbConfirmMessage(_INTL("Change this Pokémon?"))
|
|
||||||
scr = PokemonDebugPartyScreen.new
|
|
||||||
scr.pbPokemonDebug(pkmn[pkmnCmd],-1,nil,true)
|
|
||||||
scr.pbEndScreen
|
|
||||||
elsif pbConfirmMessage(_INTL("Delete this Pokémon?"))
|
|
||||||
pkmn[pkmnCmd] = nil
|
|
||||||
pkmn.compact!
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "testtrainerbattle"
|
|
||||||
battle = pbListScreen(_INTL("SINGLE TRAINER"),TrainerBattleLister.new(0,false))
|
|
||||||
if battle
|
|
||||||
trainerdata = battle[1]
|
|
||||||
pbTrainerBattle(trainerdata[0],trainerdata[1],nil,false,trainerdata[4],true)
|
|
||||||
end
|
|
||||||
when "testtrainerbattleadvanced"
|
|
||||||
trainers = []
|
|
||||||
size0 = 1
|
|
||||||
size1 = 1
|
|
||||||
trainerCmd = 0
|
|
||||||
loop do
|
|
||||||
trainerCmds = []
|
|
||||||
trainers.each do |t|
|
|
||||||
trainerCmds.push(sprintf("%s x%d",t[1][0].fullname,t[1][2].length))
|
|
||||||
end
|
|
||||||
trainerCmds.push(_INTL("[Add trainer]"))
|
|
||||||
trainerCmds.push(_INTL("[Set player side size]"))
|
|
||||||
trainerCmds.push(_INTL("[Set opponent side size]"))
|
|
||||||
trainerCmds.push(_INTL("[Start {1}v{2} battle]",size0,size1))
|
|
||||||
trainerCmd = pbShowCommands(nil,trainerCmds,-1,trainerCmd)
|
|
||||||
break if trainerCmd<0
|
|
||||||
if trainerCmd==trainerCmds.length-1 # Start battle
|
|
||||||
if trainers.length==0
|
|
||||||
pbMessage(_INTL("No trainers were chosen, cannot start battle."))
|
|
||||||
next
|
|
||||||
elsif size1<trainers.length
|
|
||||||
pbMessage(_INTL("Opposing side size is invalid. It should be at least {1}",trainers.length))
|
|
||||||
next
|
|
||||||
elsif size1>trainers.length && trainers[0][1][2].length==1
|
|
||||||
pbMessage(
|
|
||||||
_INTL("Opposing side size cannot be {1}, as that requires the first trainer to have 2 or more Pokémon, which they don't.",
|
|
||||||
size1))
|
|
||||||
next
|
|
||||||
end
|
|
||||||
setBattleRule(sprintf("%dv%d",size0,size1))
|
|
||||||
battleArgs = []
|
|
||||||
trainers.each do |t|
|
|
||||||
battleArgs.push([t[1][0],t[1][2],t[1][3],t[1][1]])
|
|
||||||
end
|
|
||||||
pbTrainerBattleCore(*battleArgs)
|
|
||||||
break
|
|
||||||
elsif trainerCmd==trainerCmds.length-2 # Set opponent side size
|
|
||||||
if trainers.length==0 || (trainers.length==1 && trainers[0][1][2].length==1)
|
|
||||||
pbMessage(_INTL("No trainers were chosen or trainer only has one Pokémon."))
|
|
||||||
next
|
|
||||||
end
|
|
||||||
maxVal = 2
|
|
||||||
maxVal = 3 if trainers.length>=3 ||
|
|
||||||
(trainers.length==2 && trainers[0][1][2].length>=2) ||
|
|
||||||
trainers[0][1][2].length>=3
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,maxVal)
|
|
||||||
params.setInitialValue(size1)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
newSize = pbMessageChooseNumber(
|
|
||||||
_INTL("Choose the number of battlers on the opponent's side (max. {1}).",maxVal),params)
|
|
||||||
size1 = newSize if newSize>0
|
|
||||||
elsif trainerCmd==trainerCmds.length-3 # Set player side size
|
|
||||||
if !pbCanDoubleBattle?
|
|
||||||
pbMessage(_INTL("You only have one Pokémon."))
|
|
||||||
next
|
|
||||||
end
|
|
||||||
maxVal = (pbCanTripleBattle?) ? 3 : 2
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,maxVal)
|
|
||||||
params.setInitialValue(size0)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
newSize = pbMessageChooseNumber(
|
|
||||||
_INTL("Choose the number of battlers on the player's side (max. {1}).",maxVal),params)
|
|
||||||
size0 = newSize if newSize>0
|
|
||||||
elsif trainerCmd==trainerCmds.length-4 # Add trainer
|
|
||||||
battle = pbListScreen(_INTL("CHOOSE A TRAINER"),TrainerBattleLister.new(0,false))
|
|
||||||
if battle
|
|
||||||
trainerdata = battle[1]
|
|
||||||
tr = pbLoadTrainer(trainerdata[0],trainerdata[1],trainerdata[4])
|
|
||||||
trainers.push([battle[0],tr])
|
|
||||||
end
|
|
||||||
else # Edit a trainer
|
|
||||||
if pbConfirmMessage(_INTL("Change this trainer?"))
|
|
||||||
battle = pbListScreen(_INTL("CHOOSE A TRAINER"),
|
|
||||||
TrainerBattleLister.new(trainers[trainerCmd][0],false))
|
|
||||||
if battle
|
|
||||||
trainerdata = battle[1]
|
|
||||||
tr = pbLoadTrainer(trainerdata[0],trainerdata[1],trainerdata[4])
|
|
||||||
trainers[trainerCmd] = [battle[0],tr]
|
|
||||||
end
|
|
||||||
elsif pbConfirmMessage(_INTL("Delete this trainer?"))
|
|
||||||
trainers[trainerCmd] = nil
|
|
||||||
trainers.compact!
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "togglelogging"
|
|
||||||
$INTERNAL = !$INTERNAL
|
|
||||||
pbMessage(_INTL("Debug logs for battles will be made in the Data folder.")) if $INTERNAL
|
|
||||||
pbMessage(_INTL("Debug logs for battles will not be made.")) if !$INTERNAL
|
|
||||||
when "resettrainers"
|
|
||||||
if $game_map
|
|
||||||
for event in $game_map.events.values
|
|
||||||
if event.name[/trainer/i]
|
|
||||||
$game_self_switches[[$game_map.map_id,event.id,"A"]] = false
|
|
||||||
$game_self_switches[[$game_map.map_id,event.id,"B"]] = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
$game_map.need_refresh = true
|
|
||||||
pbMessage(_INTL("All Trainers on this map were reset."))
|
|
||||||
else
|
|
||||||
pbMessage(_INTL("This command can't be used here."))
|
|
||||||
end
|
|
||||||
when "readyrematches"
|
|
||||||
if !$PokemonGlobal.phoneNumbers || $PokemonGlobal.phoneNumbers.length==0
|
|
||||||
pbMessage(_INTL("There are no trainers in the Phone."))
|
|
||||||
else
|
|
||||||
for i in $PokemonGlobal.phoneNumbers
|
|
||||||
if i.length==8 # A trainer with an event
|
|
||||||
i[4] = 2
|
|
||||||
pbSetReadyToBattle(i)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pbMessage(_INTL("All trainers in the Phone are now ready to rebattle."))
|
|
||||||
end
|
|
||||||
when "roamers"
|
|
||||||
pbDebugRoamers
|
|
||||||
#=============================================================================
|
|
||||||
# Item options
|
|
||||||
#=============================================================================
|
|
||||||
when "additem"
|
|
||||||
pbListScreenBlock(_INTL("ADD ITEM"),ItemLister.new) { |button,item|
|
|
||||||
if button==Input::C && item
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,BAG_MAX_PER_SLOT)
|
|
||||||
params.setInitialValue(1)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
qty = pbMessageChooseNumber(_INTL("Add how many {1}?",
|
|
||||||
GameData::Item.get(item).name_plural), params)
|
|
||||||
if qty>0
|
|
||||||
$PokemonBag.pbStoreItem(item,qty)
|
|
||||||
pbMessage(_INTL("Gave {1}x {2}.",qty,GameData::Item.get(item).name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
}
|
|
||||||
when "fillbag"
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,BAG_MAX_PER_SLOT)
|
|
||||||
params.setInitialValue(1)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
qty = pbMessageChooseNumber(_INTL("Choose the number of items."),params)
|
|
||||||
if qty>0
|
|
||||||
GameData::Item.each { |i| $PokemonBag.pbStoreItem(i.id, qty) }
|
|
||||||
pbMessage(_INTL("The Bag was filled with {1} of each item.",qty))
|
|
||||||
end
|
|
||||||
when "emptybag"
|
|
||||||
$PokemonBag.clear
|
|
||||||
pbMessage(_INTL("The Bag was cleared."))
|
|
||||||
#=============================================================================
|
|
||||||
# Pokémon options
|
|
||||||
#=============================================================================
|
|
||||||
when "addpokemon"
|
|
||||||
species = pbChooseSpeciesList
|
|
||||||
if species
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,PBExperience.maxLevel)
|
|
||||||
params.setInitialValue(5)
|
|
||||||
params.setCancelValue(0)
|
|
||||||
level = pbMessageChooseNumber(_INTL("Set the Pokémon's level."),params)
|
|
||||||
if level>0
|
|
||||||
pbAddPokemon(species,level)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "demoparty"
|
|
||||||
pbCreatePokemon
|
|
||||||
pbMessage(_INTL("Filled party with demo Pokémon."))
|
|
||||||
when "healparty"
|
|
||||||
for i in $Trainer.party
|
|
||||||
i.heal
|
|
||||||
end
|
|
||||||
pbMessage(_INTL("Your Pokémon were fully healed."))
|
|
||||||
when "quickhatch"
|
|
||||||
for pokemon in $Trainer.party
|
|
||||||
pokemon.eggsteps = 1 if pokemon.egg?
|
|
||||||
end
|
|
||||||
pbMessage(_INTL("All eggs in your party now require one step to hatch."))
|
|
||||||
when "fillboxes"
|
|
||||||
$Trainer.formseen = {} if !$Trainer.formseen
|
|
||||||
$Trainer.formlastseen = {} if !$Trainer.formlastseen
|
|
||||||
added = 0
|
|
||||||
box_qty = $PokemonStorage.maxPokemon(0)
|
|
||||||
completed = true
|
|
||||||
GameData::Species.each do |species_data|
|
|
||||||
sp = species_data.species
|
|
||||||
f = species_data.form
|
|
||||||
# Record each form of each species as seen and owned
|
|
||||||
$Trainer.formseen[sp] = [[], []] if !$Trainer.formseen[sp]
|
|
||||||
if f == 0
|
|
||||||
$Trainer.seen[sp] = true
|
|
||||||
$Trainer.owned[sp] = true
|
|
||||||
if [PBGenderRates::AlwaysMale, PBGenderRates::AlwaysFemale,
|
|
||||||
PBGenderRates::Genderless].include?(species_data.gender_rate)
|
|
||||||
g = (species_data.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0
|
|
||||||
$Trainer.formseen[sp][g][f] = true
|
|
||||||
$Trainer.formlastseen[sp] = [g, f] if f == 0
|
|
||||||
else # Both male and female
|
|
||||||
$Trainer.formseen[sp][0][f] = true
|
|
||||||
$Trainer.formseen[sp][1][f] = true
|
|
||||||
$Trainer.formlastseen[i] = [0, f] if f == 0
|
|
||||||
end
|
|
||||||
elsif species_data.real_form_name && !species_data.real_form_name.empty?
|
|
||||||
g = (species_data.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0
|
|
||||||
$Trainer.formseen[sp][g][f] = true
|
|
||||||
end
|
|
||||||
# Add Pokémon (if form 0)
|
|
||||||
next if f != 0
|
|
||||||
if added >= NUM_STORAGE_BOXES * box_qty
|
|
||||||
completed = false
|
|
||||||
next
|
|
||||||
end
|
|
||||||
added += 1
|
|
||||||
$PokemonStorage[(added - 1) / box_qty, (added - 1) % box_qty] = Pokemon.new(sp, 50)
|
|
||||||
end
|
|
||||||
pbMessage(_INTL("Storage boxes were filled with one Pokémon of each species."))
|
|
||||||
if !completed
|
|
||||||
pbMessage(_INTL("Note: The number of storage spaces ({1} boxes of 30) is less than the number of species.",NUM_STORAGE_BOXES))
|
|
||||||
end
|
|
||||||
when "clearboxes"
|
|
||||||
for i in 0...$PokemonStorage.maxBoxes
|
|
||||||
for j in 0...$PokemonStorage.maxPokemon(i)
|
|
||||||
$PokemonStorage[i,j] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pbMessage(_INTL("The storage boxes were cleared."))
|
|
||||||
when "openstorage"
|
|
||||||
pbFadeOutIn {
|
|
||||||
scene = PokemonStorageScene.new
|
|
||||||
screen = PokemonStorageScreen.new(scene,$PokemonStorage)
|
|
||||||
screen.pbStartScreen(0)
|
|
||||||
}
|
|
||||||
#=============================================================================
|
|
||||||
# Player options
|
|
||||||
#=============================================================================
|
|
||||||
when "setbadges"
|
|
||||||
badgecmd = 0
|
|
||||||
loop do
|
|
||||||
badgecmds = []
|
|
||||||
badgecmds.push(_INTL("Give all"))
|
|
||||||
badgecmds.push(_INTL("Remove all"))
|
|
||||||
for i in 0...24
|
|
||||||
badgecmds.push(_INTL("{1} Badge {2}",$Trainer.badges[i] ? "[Y]" : "[ ]",i+1))
|
|
||||||
end
|
|
||||||
badgecmd = pbShowCommands(nil,badgecmds,-1,badgecmd)
|
|
||||||
break if badgecmd<0
|
|
||||||
if badgecmd==0 # Give all
|
|
||||||
for i in 0...24; $Trainer.badges[i] = true; end
|
|
||||||
elsif badgecmd==1 # Remove all
|
|
||||||
for i in 0...24; $Trainer.badges[i] = false; end
|
|
||||||
else
|
|
||||||
$Trainer.badges[badgecmd-2] = !$Trainer.badges[badgecmd-2]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "setmoney"
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,MAX_MONEY)
|
|
||||||
params.setDefaultValue($Trainer.money)
|
|
||||||
$Trainer.money = pbMessageChooseNumber(_INTL("Set the player's money."),params)
|
|
||||||
pbMessage(_INTL("You now have ${1}.",$Trainer.money.to_s_formatted))
|
|
||||||
when "setcoins"
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,MAX_COINS)
|
|
||||||
params.setDefaultValue($PokemonGlobal.coins)
|
|
||||||
$PokemonGlobal.coins = pbMessageChooseNumber(_INTL("Set the player's Coin amount."),params)
|
|
||||||
pbMessage(_INTL("You now have {1} Coins.",$PokemonGlobal.coins.to_s_formatted))
|
|
||||||
when "toggleshoes"
|
|
||||||
$PokemonGlobal.runningShoes = !$PokemonGlobal.runningShoes
|
|
||||||
pbMessage(_INTL("Gave Running Shoes.")) if $PokemonGlobal.runningShoes
|
|
||||||
pbMessage(_INTL("Lost Running Shoes.")) if !$PokemonGlobal.runningShoes
|
|
||||||
when "togglepokegear"
|
|
||||||
$Trainer.pokegear = !$Trainer.pokegear
|
|
||||||
pbMessage(_INTL("Gave Pokégear.")) if $Trainer.pokegear
|
|
||||||
pbMessage(_INTL("Lost Pokégear.")) if !$Trainer.pokegear
|
|
||||||
when "dexlists"
|
|
||||||
dexescmd = 0
|
|
||||||
loop do
|
|
||||||
dexescmds = []
|
|
||||||
dexescmds.push(_INTL("Have Pokédex: {1}",$Trainer.pokedex ? "[YES]" : "[NO]"))
|
|
||||||
d = pbDexNames
|
|
||||||
for i in 0...d.length
|
|
||||||
name = d[i]
|
|
||||||
name = name[0] if name.is_a?(Array)
|
|
||||||
dexindex = i
|
|
||||||
unlocked = $PokemonGlobal.pokedexUnlocked[dexindex]
|
|
||||||
dexescmds.push(_INTL("{1} {2}",unlocked ? "[Y]" : "[ ]",name))
|
|
||||||
end
|
|
||||||
dexescmd = pbShowCommands(nil,dexescmds,-1,dexescmd)
|
|
||||||
break if dexescmd<0
|
|
||||||
dexindex = dexescmd-1
|
|
||||||
if dexindex<0 # Toggle Pokédex ownership
|
|
||||||
$Trainer.pokedex = !$Trainer.pokedex
|
|
||||||
else # Toggle Regional Dex accessibility
|
|
||||||
if $PokemonGlobal.pokedexUnlocked[dexindex]
|
|
||||||
pbLockDex(dexindex)
|
|
||||||
else
|
|
||||||
pbUnlockDex(dexindex)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "setplayer"
|
|
||||||
limit = 0
|
|
||||||
for i in 0...8
|
|
||||||
meta = GameData::Metadata.get_player(i)
|
|
||||||
if !meta
|
|
||||||
limit = i; break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if limit<=1
|
|
||||||
pbMessage(_INTL("There is only one player defined."))
|
|
||||||
else
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,limit-1)
|
|
||||||
params.setDefaultValue($PokemonGlobal.playerID)
|
|
||||||
newid = pbMessageChooseNumber(_INTL("Choose the new player character."),params)
|
|
||||||
if newid!=$PokemonGlobal.playerID
|
|
||||||
pbChangePlayer(newid)
|
|
||||||
pbMessage(_INTL("The player character was changed."))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when "changeoutfit"
|
|
||||||
oldoutfit = $Trainer.outfit
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,99)
|
|
||||||
params.setDefaultValue(oldoutfit)
|
|
||||||
$Trainer.outfit = pbMessageChooseNumber(_INTL("Set the player's outfit."),params)
|
|
||||||
pbMessage(_INTL("Player's outfit was changed.")) if $Trainer.outfit!=oldoutfit
|
|
||||||
when "renameplayer"
|
|
||||||
trname = pbEnterPlayerName("Your name?",0,MAX_PLAYER_NAME_SIZE,$Trainer.name)
|
|
||||||
if trname=="" && pbConfirmMessage(_INTL("Give yourself a default name?"))
|
|
||||||
trainertype = pbGetPlayerTrainerType
|
|
||||||
gender = pbGetTrainerTypeGender(trainertype)
|
|
||||||
trname = pbSuggestTrainerName(gender)
|
|
||||||
end
|
|
||||||
if trname==""
|
|
||||||
pbMessage(_INTL("The player's name remained {1}.",$Trainer.name))
|
|
||||||
else
|
|
||||||
$Trainer.name = trname
|
|
||||||
pbMessage(_INTL("The player's name was changed to {1}.",$Trainer.name))
|
|
||||||
end
|
|
||||||
when "randomid"
|
|
||||||
$Trainer.id = rand(256)
|
|
||||||
$Trainer.id |= rand(256)<<8
|
|
||||||
$Trainer.id |= rand(256)<<16
|
|
||||||
$Trainer.id |= rand(256)<<24
|
|
||||||
pbMessage(_INTL("The player's ID was changed to {1} (full ID: {2}).",$Trainer.publicID,$Trainer.id))
|
|
||||||
#=============================================================================
|
|
||||||
# Information editors
|
|
||||||
#=============================================================================
|
|
||||||
when "setmetadata"
|
|
||||||
pbMetadataScreen(pbDefaultMap)
|
|
||||||
# TODO: Only need to reload the metadata.
|
|
||||||
pbClearData
|
|
||||||
when "mapconnections"
|
|
||||||
pbFadeOutIn { pbConnectionsEditor }
|
|
||||||
when "terraintags"
|
|
||||||
pbFadeOutIn { pbTilesetScreen }
|
|
||||||
when "setencounters"
|
|
||||||
encdata = pbLoadEncountersData
|
|
||||||
map = pbDefaultMap
|
|
||||||
loop do
|
|
||||||
map = pbListScreen(_INTL("SET ENCOUNTERS"),MapLister.new(map))
|
|
||||||
break if map<=0
|
|
||||||
pbEncounterEditorMap(encdata,map)
|
|
||||||
end
|
|
||||||
save_data(encdata,"Data/encounters.dat")
|
|
||||||
# TODO: Only need to reload the encounters data.
|
|
||||||
pbClearData
|
|
||||||
pbSaveEncounterData # Rewrite PBS file encounters.txt
|
|
||||||
when "trainertypes"
|
|
||||||
pbFadeOutIn { pbTrainerTypeEditor }
|
|
||||||
when "edittrainers"
|
|
||||||
pbFadeOutIn { pbTrainerBattleEditor }
|
|
||||||
when "edititems"
|
|
||||||
pbFadeOutIn { pbItemEditor }
|
|
||||||
when "editpokemon"
|
|
||||||
pbFadeOutIn { pbPokemonEditor }
|
|
||||||
when "editdexes"
|
|
||||||
pbFadeOutIn { pbRegionalDexEditorMain }
|
|
||||||
when "positionsprites"
|
|
||||||
pbFadeOutIn {
|
|
||||||
sp = SpritePositioner.new
|
|
||||||
sps = SpritePositionerScreen.new(sp)
|
|
||||||
sps.pbStart
|
|
||||||
}
|
|
||||||
when "autopositionsprites"
|
|
||||||
if pbConfirmMessage(_INTL("Are you sure you want to reposition all sprites?"))
|
|
||||||
msgwindow = pbCreateMessageWindow
|
|
||||||
pbMessageDisplay(msgwindow,_INTL("Repositioning all sprites. Please wait."),false)
|
|
||||||
Graphics.update
|
|
||||||
pbAutoPositionAll
|
|
||||||
pbDisposeMessageWindow(msgwindow)
|
|
||||||
end
|
|
||||||
when "animeditor"
|
|
||||||
pbFadeOutIn { pbAnimationEditor }
|
|
||||||
when "animorganiser"
|
|
||||||
pbFadeOutIn { pbAnimationsOrganiser }
|
|
||||||
when "importanims"
|
|
||||||
pbImportAllAnimations
|
|
||||||
when "exportanims"
|
|
||||||
pbExportAllAnimations
|
|
||||||
#=============================================================================
|
|
||||||
# Other options
|
|
||||||
#=============================================================================
|
|
||||||
when "mysterygift"
|
|
||||||
pbManageMysteryGifts
|
|
||||||
when "extracttext"
|
|
||||||
pbExtractText
|
|
||||||
when "compiletext"
|
|
||||||
pbCompileTextUI
|
|
||||||
when "compiledata"
|
|
||||||
msgwindow = pbCreateMessageWindow
|
|
||||||
Compiler.compile_all(true) { |msg| pbMessageDisplay(msgwindow,msg,false) }
|
|
||||||
pbMessageDisplay(msgwindow,_INTL("All game data was compiled."))
|
|
||||||
pbDisposeMessageWindow(msgwindow)
|
|
||||||
when "debugconsole"
|
|
||||||
Console::setup_console
|
|
||||||
when "invalidtiles"
|
|
||||||
pbDebugFixInvalidTiles
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbDebugMenu(showall=true)
|
|
||||||
commands = pbDebugMenuCommands(showall)
|
|
||||||
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
|
||||||
viewport.z = 99999
|
|
||||||
sprites = {}
|
|
||||||
sprites["textbox"] = pbCreateMessageWindow
|
|
||||||
sprites["textbox"].letterbyletter = false
|
|
||||||
sprites["cmdwindow"] = Window_CommandPokemonEx.new(commands.list)
|
|
||||||
cmdwindow = sprites["cmdwindow"]
|
|
||||||
cmdwindow.x = 0
|
|
||||||
cmdwindow.y = 0
|
|
||||||
cmdwindow.width = Graphics.width
|
|
||||||
cmdwindow.height = Graphics.height-sprites["textbox"].height
|
|
||||||
cmdwindow.viewport = viewport
|
|
||||||
cmdwindow.visible = true
|
|
||||||
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
|
|
||||||
pbFadeInAndShow(sprites)
|
|
||||||
ret = -1
|
|
||||||
refresh = true
|
|
||||||
loop do
|
|
||||||
loop do
|
|
||||||
oldindex = cmdwindow.index
|
|
||||||
cmdwindow.update
|
|
||||||
if refresh || cmdwindow.index!=oldindex
|
|
||||||
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
|
|
||||||
refresh = false
|
|
||||||
end
|
|
||||||
Graphics.update
|
|
||||||
Input.update
|
|
||||||
if Input.trigger?(Input::B)
|
|
||||||
parent = commands.getParent
|
|
||||||
if parent
|
|
||||||
pbPlayCancelSE
|
|
||||||
commands.currentList = parent[0]
|
|
||||||
cmdwindow.commands = commands.list
|
|
||||||
cmdwindow.index = parent[1]
|
|
||||||
refresh = true
|
|
||||||
else
|
|
||||||
ret = -1
|
|
||||||
break
|
|
||||||
end
|
|
||||||
elsif Input.trigger?(Input::C)
|
|
||||||
pbPlayDecisionSE
|
|
||||||
ret = cmdwindow.index
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
break if ret<0
|
|
||||||
cmd = commands.getCommand(ret)
|
|
||||||
if commands.hasSubMenu?(cmd)
|
|
||||||
commands.currentList = cmd
|
|
||||||
cmdwindow.commands = commands.list
|
|
||||||
cmdwindow.index = 0
|
|
||||||
refresh = true
|
|
||||||
else
|
|
||||||
return if pbDebugMenuActions(cmd,sprites,viewport)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pbPlayCloseMenuSE
|
|
||||||
pbFadeOutAndHide(sprites)
|
|
||||||
pbDisposeMessageWindow(sprites["textbox"])
|
|
||||||
pbDisposeSpriteHash(sprites)
|
|
||||||
viewport.dispose
|
|
||||||
end
|
|
||||||
185
Data/Scripts/021_Debug/001_Debug_Menus.rb
Normal file
185
Data/Scripts/021_Debug/001_Debug_Menus.rb
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
class CommandMenuList
|
||||||
|
attr_accessor :currentList
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@commands = []
|
||||||
|
@currentList = "main"
|
||||||
|
end
|
||||||
|
|
||||||
|
def add(option, hash)
|
||||||
|
@commands.push([option, hash["parent"], hash["name"], hash["description"]])
|
||||||
|
end
|
||||||
|
|
||||||
|
def list
|
||||||
|
ret = []
|
||||||
|
@commands.each { |cmd| ret.push(cmd[2]) if cmd[1] == @currentList }
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
def getCommand(index)
|
||||||
|
count = 0
|
||||||
|
@commands.each do |cmd|
|
||||||
|
next if cmd[1] != @currentList
|
||||||
|
return cmd[0] if count == index
|
||||||
|
count += 1
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def getDesc(index)
|
||||||
|
count = 0
|
||||||
|
@commands.each do |cmd|
|
||||||
|
next if cmd[1] != @currentList
|
||||||
|
return cmd[3] if count == index && cmd[3]
|
||||||
|
break if count == index
|
||||||
|
count += 1
|
||||||
|
end
|
||||||
|
return "<No description available>"
|
||||||
|
end
|
||||||
|
|
||||||
|
def hasSubMenu?(check_cmd)
|
||||||
|
@commands.each { |cmd| return true if cmd[1] == check_cmd }
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
def getParent
|
||||||
|
ret = nil
|
||||||
|
@commands.each do |cmd|
|
||||||
|
next if cmd[0] != @currentList
|
||||||
|
ret = cmd[1]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
return nil if !ret
|
||||||
|
count = 0
|
||||||
|
@commands.each do |cmd|
|
||||||
|
next if cmd[1] != ret
|
||||||
|
return [ret, count] if cmd[0] == @currentList
|
||||||
|
count += 1
|
||||||
|
end
|
||||||
|
return [ret, 0]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
def pbDebugMenu(show_all = true)
|
||||||
|
commands = CommandMenuList.new
|
||||||
|
DebugMenuCommands.each do |option, hash|
|
||||||
|
commands.add(option, hash) if show_all || hash["always_show"]
|
||||||
|
end
|
||||||
|
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
|
viewport.z = 99999
|
||||||
|
sprites = {}
|
||||||
|
sprites["textbox"] = pbCreateMessageWindow
|
||||||
|
sprites["textbox"].letterbyletter = false
|
||||||
|
sprites["cmdwindow"] = Window_CommandPokemonEx.new(commands.list)
|
||||||
|
cmdwindow = sprites["cmdwindow"]
|
||||||
|
cmdwindow.x = 0
|
||||||
|
cmdwindow.y = 0
|
||||||
|
cmdwindow.width = Graphics.width
|
||||||
|
cmdwindow.height = Graphics.height - sprites["textbox"].height
|
||||||
|
cmdwindow.viewport = viewport
|
||||||
|
cmdwindow.visible = true
|
||||||
|
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
|
||||||
|
pbFadeInAndShow(sprites)
|
||||||
|
ret = -1
|
||||||
|
refresh = true
|
||||||
|
loop do
|
||||||
|
loop do
|
||||||
|
oldindex = cmdwindow.index
|
||||||
|
cmdwindow.update
|
||||||
|
if refresh || cmdwindow.index != oldindex
|
||||||
|
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
|
||||||
|
refresh = false
|
||||||
|
end
|
||||||
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
if Input.trigger?(Input::B)
|
||||||
|
parent = commands.getParent
|
||||||
|
if parent
|
||||||
|
pbPlayCancelSE
|
||||||
|
commands.currentList = parent[0]
|
||||||
|
cmdwindow.commands = commands.list
|
||||||
|
cmdwindow.index = parent[1]
|
||||||
|
refresh = true
|
||||||
|
else
|
||||||
|
ret = -1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
elsif Input.trigger?(Input::C)
|
||||||
|
pbPlayDecisionSE
|
||||||
|
ret = cmdwindow.index
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
break if ret < 0
|
||||||
|
cmd = commands.getCommand(ret)
|
||||||
|
if commands.hasSubMenu?(cmd)
|
||||||
|
commands.currentList = cmd
|
||||||
|
cmdwindow.commands = commands.list
|
||||||
|
cmdwindow.index = 0
|
||||||
|
refresh = true
|
||||||
|
elsif cmd == "warp"
|
||||||
|
return if DebugMenuCommands.call(cmd, "effect", sprites, viewport)
|
||||||
|
else
|
||||||
|
return if DebugMenuCommands.call(cmd, "effect")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
pbPlayCloseMenuSE
|
||||||
|
pbFadeOutAndHide(sprites)
|
||||||
|
pbDisposeMessageWindow(sprites["textbox"])
|
||||||
|
pbDisposeSpriteHash(sprites)
|
||||||
|
viewport.dispose
|
||||||
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
module PokemonDebugMixin
|
||||||
|
def pbPokemonDebug(pkmn, pkmnid, heldpoke = nil, settingUpBattle = false)
|
||||||
|
command = 0
|
||||||
|
commands = CommandMenuList.new
|
||||||
|
PokemonDebugMenuCommands.each do |option, hash|
|
||||||
|
commands.add(option, hash) if !settingUpBattle || hash["always_show"]
|
||||||
|
end
|
||||||
|
loop do
|
||||||
|
command = pbShowCommands(_INTL("Do what with {1}?", pkmn.name), commands.list, command)
|
||||||
|
if command < 0
|
||||||
|
parent = commands.getParent
|
||||||
|
if parent
|
||||||
|
commands.currentList = parent[0]
|
||||||
|
command = parent[1]
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
else
|
||||||
|
cmd = commands.getCommand(command)
|
||||||
|
if commands.hasSubMenu?(cmd)
|
||||||
|
commands.currentList = cmd
|
||||||
|
command = 0
|
||||||
|
elsif PokemonDebugMenuCommands.call(cmd, "effect", pkmn, pkmnid, heldpoke, settingUpBattle, self)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
class PokemonPartyScreen
|
||||||
|
include PokemonDebugMixin
|
||||||
|
end
|
||||||
|
|
||||||
|
class PokemonStorageScreen
|
||||||
|
include PokemonDebugMixin
|
||||||
|
end
|
||||||
|
|
||||||
|
class PokemonDebugPartyScreen
|
||||||
|
include PokemonDebugMixin
|
||||||
|
end
|
||||||
1096
Data/Scripts/021_Debug/001b_Debug_MenuCommands.rb
Normal file
1096
Data/Scripts/021_Debug/001b_Debug_MenuCommands.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -521,50 +521,6 @@ def pbDebugRoamers
|
|||||||
viewport.dispose
|
viewport.dispose
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
# Give the player a party of Pokémon.
|
|
||||||
# For demonstration purposes only, not to be used in a real game.
|
|
||||||
#===============================================================================
|
|
||||||
def pbCreatePokemon
|
|
||||||
party = []
|
|
||||||
species = [:PIKACHU, :PIDGEOTTO, :KADABRA, :GYARADOS, :DIGLETT, :CHANSEY]
|
|
||||||
for id in species
|
|
||||||
party.push(id) if GameData::Species.exists?(id)
|
|
||||||
end
|
|
||||||
# Species IDs of the Pokémon to be created
|
|
||||||
for i in 0...party.length
|
|
||||||
species = party[i]
|
|
||||||
# Generate Pokémon with species and level 20
|
|
||||||
$Trainer.party[i] = Pokemon.new(species, 20)
|
|
||||||
$Trainer.seen[species] = true
|
|
||||||
$Trainer.owned[species] = true
|
|
||||||
pbSeenForm($Trainer.party[i])
|
|
||||||
case species
|
|
||||||
when :PIDGEOTTO
|
|
||||||
$Trainer.party[i].pbLearnMove(:FLY)
|
|
||||||
when :KADABRA
|
|
||||||
$Trainer.party[i].pbLearnMove(:FLASH)
|
|
||||||
$Trainer.party[i].pbLearnMove(:TELEPORT)
|
|
||||||
when :GYARADOS
|
|
||||||
$Trainer.party[i].pbLearnMove(:SURF)
|
|
||||||
$Trainer.party[i].pbLearnMove(:DIVE)
|
|
||||||
$Trainer.party[i].pbLearnMove(:WATERFALL)
|
|
||||||
when :DIGLETT
|
|
||||||
$Trainer.party[i].pbLearnMove(:DIG)
|
|
||||||
$Trainer.party[i].pbLearnMove(:CUT)
|
|
||||||
$Trainer.party[i].pbLearnMove(:HEADBUTT)
|
|
||||||
$Trainer.party[i].pbLearnMove(:ROCKSMASH)
|
|
||||||
when :CHANSEY
|
|
||||||
$Trainer.party[i].pbLearnMove(:SOFTBOILED)
|
|
||||||
$Trainer.party[i].pbLearnMove(:STRENGTH)
|
|
||||||
$Trainer.party[i].pbLearnMove(:SWEETSCENT)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for i in 0...party.length
|
|
||||||
$Trainer.party[i].pbRecordFirstMoves
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -1,873 +0,0 @@
|
|||||||
module PokemonDebugMixin
|
|
||||||
def pbPokemonDebugCommands(settingUpBattle=false)
|
|
||||||
commands = CommandMenuList.new
|
|
||||||
commands.add("main","hpstatusmenu",_INTL("HP/Status..."))
|
|
||||||
commands.add("hpstatusmenu","sethp",_INTL("Set HP"))
|
|
||||||
commands.add("hpstatusmenu","setstatus",_INTL("Set status"))
|
|
||||||
commands.add("hpstatusmenu","fullheal",_INTL("Fully heal"))
|
|
||||||
commands.add("hpstatusmenu","makefainted",_INTL("Make fainted"))
|
|
||||||
commands.add("hpstatusmenu","setpokerus",_INTL("Set Pokérus"))
|
|
||||||
|
|
||||||
commands.add("main","levelstats",_INTL("Level/stats..."))
|
|
||||||
commands.add("levelstats","setlevel",_INTL("Set level"))
|
|
||||||
commands.add("levelstats","setexp",_INTL("Set Exp"))
|
|
||||||
commands.add("levelstats","hiddenvalues",_INTL("EV/IV/pID..."))
|
|
||||||
commands.add("levelstats","sethappiness",_INTL("Set happiness"))
|
|
||||||
commands.add("levelstats","conteststats",_INTL("Contest stats..."))
|
|
||||||
commands.add("conteststats","setbeauty",_INTL("Set Beauty"))
|
|
||||||
commands.add("conteststats","setcool",_INTL("Set Cool"))
|
|
||||||
commands.add("conteststats","setcute",_INTL("Set Cute"))
|
|
||||||
commands.add("conteststats","setsmart",_INTL("Set Smart"))
|
|
||||||
commands.add("conteststats","settough",_INTL("Set Tough"))
|
|
||||||
commands.add("conteststats","setsheen",_INTL("Set Sheen"))
|
|
||||||
|
|
||||||
commands.add("main","moves",_INTL("Moves..."))
|
|
||||||
commands.add("moves","teachmove",_INTL("Teach move"))
|
|
||||||
commands.add("moves","forgetmove",_INTL("Forget move"))
|
|
||||||
commands.add("moves","resetmoves",_INTL("Reset moves"))
|
|
||||||
commands.add("moves","setmovepp",_INTL("Set move PP"))
|
|
||||||
commands.add("moves","setinitialmoves",_INTL("Reset initial moves"))
|
|
||||||
|
|
||||||
commands.add("main","setability",_INTL("Set ability"))
|
|
||||||
commands.add("main","setnature",_INTL("Set nature"))
|
|
||||||
commands.add("main","setgender",_INTL("Set gender"))
|
|
||||||
commands.add("main","speciesform",_INTL("Species/form..."))
|
|
||||||
|
|
||||||
commands.add("main","cosmetic",_INTL("Cosmetic info..."))
|
|
||||||
commands.add("cosmetic","setshininess",_INTL("Set shininess"))
|
|
||||||
commands.add("cosmetic","setpokeball",_INTL("Set Poké Ball"))
|
|
||||||
commands.add("cosmetic","setribbons",_INTL("Set ribbons"))
|
|
||||||
commands.add("cosmetic","setnickname",_INTL("Set nickname"))
|
|
||||||
commands.add("cosmetic","ownership",_INTL("Ownership..."))
|
|
||||||
|
|
||||||
commands.add("main","setegg",_INTL("Set egg"))
|
|
||||||
commands.add("main","shadowpkmn",_INTL("Shadow Pkmn..."))
|
|
||||||
if !settingUpBattle
|
|
||||||
commands.add("main","mysterygift",_INTL("Mystery Gift"))
|
|
||||||
commands.add("main","duplicate",_INTL("Duplicate"))
|
|
||||||
commands.add("main","delete",_INTL("Delete"))
|
|
||||||
end
|
|
||||||
return commands
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbPokemonDebugActions(command,pkmn,pkmnid,heldpoke=nil,settingUpBattle=false)
|
|
||||||
case command
|
|
||||||
#===========================================================================
|
|
||||||
when "sethp"
|
|
||||||
if pkmn.egg?
|
|
||||||
pbDisplay(_INTL("{1} is an egg.",pkmn.name))
|
|
||||||
else
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,pkmn.totalhp)
|
|
||||||
params.setDefaultValue(pkmn.hp)
|
|
||||||
newhp = pbMessageChooseNumber(
|
|
||||||
_INTL("Set {1}'s HP (max. {2}).",pkmn.name,pkmn.totalhp),params) { pbUpdate }
|
|
||||||
if newhp!=pkmn.hp
|
|
||||||
pkmn.hp = newhp
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setstatus"
|
|
||||||
if pkmn.egg?
|
|
||||||
pbDisplay(_INTL("{1} is an egg.",pkmn.name))
|
|
||||||
elsif pkmn.hp<=0
|
|
||||||
pbDisplay(_INTL("{1} is fainted, can't change status.",pkmn.name))
|
|
||||||
else
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
cmd = pbShowCommands(_INTL("Set {1}'s status.",pkmn.name),[
|
|
||||||
_INTL("[Cure]"),
|
|
||||||
_INTL("Sleep"),
|
|
||||||
_INTL("Poison"),
|
|
||||||
_INTL("Burn"),
|
|
||||||
_INTL("Paralysis"),
|
|
||||||
_INTL("Frozen")
|
|
||||||
],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Cure
|
|
||||||
pkmn.healStatus
|
|
||||||
pbDisplay(_INTL("{1}'s status was cured.",pkmn.name))
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
else # Give status problem
|
|
||||||
count = 0
|
|
||||||
cancel = false
|
|
||||||
if cmd==PBStatuses::SLEEP
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,9)
|
|
||||||
params.setDefaultValue(3)
|
|
||||||
count = pbMessageChooseNumber(
|
|
||||||
_INTL("Set the Pokémon's sleep count."),params) { pbUpdate }
|
|
||||||
cancel = true if count<=0
|
|
||||||
end
|
|
||||||
if !cancel
|
|
||||||
pkmn.status = cmd
|
|
||||||
pkmn.statusCount = count
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "fullheal"
|
|
||||||
if pkmn.egg?
|
|
||||||
pbDisplay(_INTL("{1} is an egg.",pkmn.name))
|
|
||||||
else
|
|
||||||
pkmn.heal
|
|
||||||
pbDisplay(_INTL("{1} was fully healed.",pkmn.name))
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "makefainted"
|
|
||||||
if pkmn.egg?
|
|
||||||
pbDisplay(_INTL("{1} is an egg.",pkmn.name))
|
|
||||||
else
|
|
||||||
pkmn.hp = 0
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setpokerus"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
pokerus = (pkmn.pokerus) ? pkmn.pokerus : 0
|
|
||||||
msg = [_INTL("{1} doesn't have Pokérus.",pkmn.name),
|
|
||||||
_INTL("Has strain {1}, infectious for {2} more days.",pokerus/16,pokerus%16),
|
|
||||||
_INTL("Has strain {1}, not infectious.",pokerus/16)][pkmn.pokerusStage]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Give random strain"),
|
|
||||||
_INTL("Make not infectious"),
|
|
||||||
_INTL("Clear Pokérus")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Give random strain
|
|
||||||
pkmn.givePokerus
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
when 1 # Make not infectious
|
|
||||||
if pokerus>0
|
|
||||||
strain = pokerus/16
|
|
||||||
p = strain << 4
|
|
||||||
pkmn.pokerus = p
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
when 2 # Clear Pokérus
|
|
||||||
pkmn.pokerus = 0
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setlevel"
|
|
||||||
if pkmn.egg?
|
|
||||||
pbDisplay(_INTL("{1} is an egg.",pkmn.name))
|
|
||||||
else
|
|
||||||
mLevel = PBExperience.maxLevel
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(1,mLevel)
|
|
||||||
params.setDefaultValue(pkmn.level)
|
|
||||||
level = pbMessageChooseNumber(
|
|
||||||
_INTL("Set the Pokémon's level (max. {1}).",mLevel),params) { pbUpdate }
|
|
||||||
if level!=pkmn.level
|
|
||||||
pkmn.level = level
|
|
||||||
pkmn.calcStats
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setexp"
|
|
||||||
if pkmn.egg?
|
|
||||||
pbDisplay(_INTL("{1} is an egg.",pkmn.name))
|
|
||||||
else
|
|
||||||
minxp = PBExperience.pbGetStartExperience(pkmn.level,pkmn.growthrate)
|
|
||||||
maxxp = PBExperience.pbGetStartExperience(pkmn.level+1,pkmn.growthrate)
|
|
||||||
if minxp==maxxp
|
|
||||||
pbDisplay(_INTL("{1} is at the maximum level.",pkmn.name))
|
|
||||||
else
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(minxp,maxxp-1)
|
|
||||||
params.setDefaultValue(pkmn.exp)
|
|
||||||
newexp = pbMessageChooseNumber(
|
|
||||||
_INTL("Set the Pokémon's Exp (range {1}-{2}).",minxp,maxxp-1),params) { pbUpdate }
|
|
||||||
if newexp!=pkmn.exp
|
|
||||||
pkmn.exp = newexp
|
|
||||||
pkmn.calcStats
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "hiddenvalues"
|
|
||||||
numstats = 6
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
persid = sprintf("0x%08X",pkmn.personalID)
|
|
||||||
cmd = pbShowCommands(_INTL("Personal ID is {1}.",persid),[
|
|
||||||
_INTL("Set EVs"),
|
|
||||||
_INTL("Set IVs"),
|
|
||||||
_INTL("Randomise pID")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Set EVs
|
|
||||||
cmd2 = 0
|
|
||||||
loop do
|
|
||||||
totalev = 0
|
|
||||||
evcommands = []
|
|
||||||
for i in 0...numstats
|
|
||||||
evcommands.push(PBStats.getName(i)+" (#{pkmn.ev[i]})")
|
|
||||||
totalev += pkmn.ev[i]
|
|
||||||
end
|
|
||||||
evcommands.push(_INTL("Randomise all"))
|
|
||||||
evcommands.push(_INTL("Max randomise all"))
|
|
||||||
cmd2 = pbShowCommands(_INTL("Change which EV?\nTotal: {1}/{2} ({3}%)",
|
|
||||||
totalev, Pokemon::EV_LIMIT,
|
|
||||||
100*totalev/Pokemon::EV_LIMIT), evcommands, cmd2)
|
|
||||||
break if cmd2<0
|
|
||||||
if cmd2<numstats
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
upperLimit = 0
|
|
||||||
for i in 0...numstats
|
|
||||||
upperLimit += pkmn.ev[i] if i!=cmd2
|
|
||||||
end
|
|
||||||
upperLimit = Pokemon::EV_LIMIT-upperLimit
|
|
||||||
upperLimit = [upperLimit, Pokemon::EV_STAT_LIMIT].min
|
|
||||||
thisValue = [pkmn.ev[cmd2],upperLimit].min
|
|
||||||
params.setRange(0,upperLimit)
|
|
||||||
params.setDefaultValue(thisValue)
|
|
||||||
params.setCancelValue(thisValue)
|
|
||||||
f = pbMessageChooseNumber(_INTL("Set the EV for {1} (max. {2}).",
|
|
||||||
PBStats.getName(cmd2),upperLimit),params) { pbUpdate }
|
|
||||||
if f!=pkmn.ev[cmd2]
|
|
||||||
pkmn.ev[cmd2] = f
|
|
||||||
pkmn.calcStats
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
elsif cmd2<evcommands.length # Randomise
|
|
||||||
evTotalTarget = Pokemon::EV_LIMIT
|
|
||||||
if cmd2==evcommands.length-2
|
|
||||||
evTotalTarget = rand(Pokemon::EV_LIMIT)
|
|
||||||
end
|
|
||||||
for i in 0...numstats
|
|
||||||
pkmn.ev[i] = 0
|
|
||||||
end
|
|
||||||
while evTotalTarget>0
|
|
||||||
r = rand(numstats)
|
|
||||||
next if pkmn.ev[r]>=Pokemon::EV_STAT_LIMIT
|
|
||||||
addVal = 1+rand(Pokemon::EV_STAT_LIMIT/4)
|
|
||||||
addVal = evTotalTarget if addVal>evTotalTarget
|
|
||||||
addVal = [addVal, Pokemon::EV_STAT_LIMIT-pkmn.ev[r]].min
|
|
||||||
next if addVal==0
|
|
||||||
pkmn.ev[r] += addVal
|
|
||||||
evTotalTarget -= addVal
|
|
||||||
end
|
|
||||||
pkmn.calcStats
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when 1 # Set IVs
|
|
||||||
cmd2 = 0
|
|
||||||
loop do
|
|
||||||
hiddenpower = pbHiddenPower(pkmn)
|
|
||||||
totaliv = 0
|
|
||||||
ivcommands = []
|
|
||||||
for i in 0...numstats
|
|
||||||
ivcommands.push(PBStats.getName(i)+" (#{pkmn.iv[i]})")
|
|
||||||
totaliv += pkmn.iv[i]
|
|
||||||
end
|
|
||||||
msg = _INTL("Change which IV?\nHidden Power:\n{1}, power {2}\nTotal: {3}/{4} ({5}%)",
|
|
||||||
GameData::Type.get(hiddenpower[0]).name,hiddenpower[1],totaliv,numstats*31,
|
|
||||||
100*totaliv/(numstats*31))
|
|
||||||
ivcommands.push(_INTL("Randomise all"))
|
|
||||||
cmd2 = pbShowCommands(msg,ivcommands,cmd2)
|
|
||||||
break if cmd2<0
|
|
||||||
if cmd2<numstats
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,31)
|
|
||||||
params.setDefaultValue(pkmn.iv[cmd2])
|
|
||||||
params.setCancelValue(pkmn.iv[cmd2])
|
|
||||||
f = pbMessageChooseNumber(_INTL("Set the IV for {1} (max. 31).",
|
|
||||||
PBStats.getName(cmd2)),params) { pbUpdate }
|
|
||||||
if f!=pkmn.iv[cmd2]
|
|
||||||
pkmn.iv[cmd2] = f
|
|
||||||
pkmn.calcStats
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
elsif cmd2==ivcommands.length-1 # Randomise
|
|
||||||
for i in 0...numstats
|
|
||||||
pkmn.iv[i] = rand(Pokemon::IV_STAT_LIMIT+1)
|
|
||||||
end
|
|
||||||
pkmn.calcStats
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when 2 # Randomise pID
|
|
||||||
pkmn.personalID = rand(2**16) | rand(2**16) << 16
|
|
||||||
pkmn.calcStats
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "sethappiness"
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,255)
|
|
||||||
params.setDefaultValue(pkmn.happiness)
|
|
||||||
h = pbMessageChooseNumber(
|
|
||||||
_INTL("Set the Pokémon's happiness (max. 255)."),params) { pbUpdate }
|
|
||||||
if h!=pkmn.happiness
|
|
||||||
pkmn.happiness = h
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setbeauty", "setcool", "setcute", "setsmart", "settough", "setsheen"
|
|
||||||
case command
|
|
||||||
when "setbeauty"
|
|
||||||
statname = _INTL("Beauty")
|
|
||||||
defval = pkmn.beauty
|
|
||||||
when "setcool"
|
|
||||||
statname = _INTL("Cool")
|
|
||||||
defval = pkmn.cool
|
|
||||||
when "setcute"
|
|
||||||
statname = _INTL("Cute")
|
|
||||||
defval = pkmn.cute
|
|
||||||
when "setsmart"
|
|
||||||
statname = _INTL("Smart")
|
|
||||||
defval = pkmn.smart
|
|
||||||
when "settough"
|
|
||||||
statname = _INTL("Tough")
|
|
||||||
defval = pkmn.tough
|
|
||||||
when "setsheen"
|
|
||||||
statname = _INTL("Sheen")
|
|
||||||
defval = pkmn.sheen
|
|
||||||
end
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,255)
|
|
||||||
params.setDefaultValue(defval)
|
|
||||||
newval = pbMessageChooseNumber(
|
|
||||||
_INTL("Set the Pokémon's {1} (max. 255).",statname),params) { pbUpdate }
|
|
||||||
if newval!=defval
|
|
||||||
case command
|
|
||||||
when "setbeauty" then pkmn.beauty = newval
|
|
||||||
when "setcool" then pkmn.cool = newval
|
|
||||||
when "setcute" then pkmn.cute = newval
|
|
||||||
when "setsmart" then pkmn.smart = newval
|
|
||||||
when "settough" then pkmn.tough = newval
|
|
||||||
when "setsheen" then pkmn.sheen = newval
|
|
||||||
end
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "teachmove"
|
|
||||||
move = pbChooseMoveList
|
|
||||||
if move
|
|
||||||
pbLearnMove(pkmn,move)
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "forgetmove"
|
|
||||||
moveindex = pbChooseMove(pkmn,_INTL("Choose move to forget."))
|
|
||||||
if moveindex>=0
|
|
||||||
movename = pkmn.moves[moveindex].name
|
|
||||||
pkmn.pbDeleteMoveAtIndex(moveindex)
|
|
||||||
pbDisplay(_INTL("{1} forgot {2}.",pkmn.name,movename))
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "resetmoves"
|
|
||||||
pkmn.resetMoves
|
|
||||||
pbDisplay(_INTL("{1}'s moves were reset.",pkmn.name))
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
#===========================================================================
|
|
||||||
when "setmovepp"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
commands = []
|
|
||||||
for i in pkmn.moves
|
|
||||||
break if !i.id
|
|
||||||
if i.total_pp<=0
|
|
||||||
commands.push(_INTL("{1} (PP: ---)",i.name))
|
|
||||||
else
|
|
||||||
commands.push(_INTL("{1} (PP: {2}/{3})",i.name,i.pp,i.total_pp))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
commands.push(_INTL("Restore all PP"))
|
|
||||||
cmd = pbShowCommands(_INTL("Alter PP of which move?"),commands,cmd)
|
|
||||||
break if cmd<0
|
|
||||||
if cmd>=0 && cmd<commands.length-1 # Move
|
|
||||||
move = pkmn.moves[cmd]
|
|
||||||
movename = move.name
|
|
||||||
if move.total_pp<=0
|
|
||||||
pbDisplay(_INTL("{1} has infinite PP.",movename))
|
|
||||||
else
|
|
||||||
cmd2 = 0
|
|
||||||
loop do
|
|
||||||
msg = _INTL("{1}: PP {2}/{3} (PP Up {4}/3)",movename,move.pp,move.total_pp,move.ppup)
|
|
||||||
cmd2 = pbShowCommands(msg,[
|
|
||||||
_INTL("Set PP"),
|
|
||||||
_INTL("Full PP"),
|
|
||||||
_INTL("Set PP Up")],cmd2)
|
|
||||||
break if cmd2<0
|
|
||||||
case cmd2
|
|
||||||
when 0 # Change PP
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,move.total_pp)
|
|
||||||
params.setDefaultValue(move.pp)
|
|
||||||
h = pbMessageChooseNumber(
|
|
||||||
_INTL("Set PP of {1} (max. {2}).",movename,move.total_pp),params) { pbUpdate }
|
|
||||||
move.pp = h
|
|
||||||
when 1 # Full PP
|
|
||||||
move.pp = move.total_pp
|
|
||||||
when 2 # Change PP Up
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,3)
|
|
||||||
params.setDefaultValue(move.ppup)
|
|
||||||
h = pbMessageChooseNumber(
|
|
||||||
_INTL("Set PP Up of {1} (max. 3).",movename),params) { pbUpdate }
|
|
||||||
move.ppup = h
|
|
||||||
move.pp = move.total_pp if move.pp>move.total_pp
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elsif cmd==commands.length-1 # Restore all PP
|
|
||||||
pkmn.healPP
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setinitialmoves"
|
|
||||||
pkmn.pbRecordFirstMoves
|
|
||||||
pbDisplay(_INTL("{1}'s moves were set as its first-known moves.",pkmn.name))
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
#===========================================================================
|
|
||||||
when "setability"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
abils = pkmn.getAbilityList
|
|
||||||
oldabil = (pkmn.ability) ? pkmn.ability.name : "No ability"
|
|
||||||
commands = []
|
|
||||||
for i in abils
|
|
||||||
commands.push(((i[1]<2) ? "" : "(H) ") + GameData::Ability.get(i[0]).name)
|
|
||||||
end
|
|
||||||
commands.push(_INTL("Remove override"))
|
|
||||||
msg = [_INTL("Ability {1} is natural.",oldabil),
|
|
||||||
_INTL("Ability {1} is being forced.",oldabil)][pkmn.abilityflag!=nil ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,commands,cmd)
|
|
||||||
break if cmd<0
|
|
||||||
if cmd>=0 && cmd<abils.length # Set ability override
|
|
||||||
pkmn.setAbility(abils[cmd][1])
|
|
||||||
elsif cmd==abils.length # Remove override
|
|
||||||
pkmn.abilityflag = nil
|
|
||||||
end
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setnature"
|
|
||||||
commands = []
|
|
||||||
(PBNatures.getCount).times do |i|
|
|
||||||
statUp = PBNatures.getStatRaised(i)
|
|
||||||
statDown = PBNatures.getStatLowered(i)
|
|
||||||
if statUp!=statDown
|
|
||||||
text = _INTL("{1} (+{2}, -{3})",PBNatures.getName(i),
|
|
||||||
PBStats.getNameBrief(statUp),PBStats.getNameBrief(statDown))
|
|
||||||
else
|
|
||||||
text = _INTL("{1} (---)",PBNatures.getName(i))
|
|
||||||
end
|
|
||||||
commands.push(text)
|
|
||||||
end
|
|
||||||
commands.push(_INTL("[Remove override]"))
|
|
||||||
cmd = pkmn.nature
|
|
||||||
loop do
|
|
||||||
oldnature = PBNatures.getName(pkmn.nature)
|
|
||||||
msg = [_INTL("Nature {1} is natural.",oldnature),
|
|
||||||
_INTL("Nature {1} is being forced.",oldnature)][pkmn.natureflag ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,commands,cmd)
|
|
||||||
break if cmd<0
|
|
||||||
if cmd>=0 && cmd<PBNatures.getCount # Set nature override
|
|
||||||
pkmn.setNature(cmd)
|
|
||||||
pkmn.calcStats
|
|
||||||
elsif cmd==PBNatures.getCount # Remove override
|
|
||||||
pkmn.natureflag = nil
|
|
||||||
end
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setgender"
|
|
||||||
if pkmn.singleGendered?
|
|
||||||
pbDisplay(_INTL("{1} is single-gendered or genderless.",pkmn.speciesName))
|
|
||||||
else
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
oldgender = (pkmn.male?) ? _INTL("male") : _INTL("female")
|
|
||||||
msg = [_INTL("Gender {1} is natural.",oldgender),
|
|
||||||
_INTL("Gender {1} is being forced.",oldgender)][pkmn.genderflag ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Make male"),
|
|
||||||
_INTL("Make female"),
|
|
||||||
_INTL("Remove override")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Make male
|
|
||||||
pkmn.makeMale
|
|
||||||
if !pkmn.male?
|
|
||||||
pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
|
|
||||||
end
|
|
||||||
when 1 # Make female
|
|
||||||
pkmn.makeFemale
|
|
||||||
if !pkmn.female?
|
|
||||||
pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
|
|
||||||
end
|
|
||||||
when 2 # Remove override
|
|
||||||
pkmn.genderflag = nil
|
|
||||||
end
|
|
||||||
pbSeenForm(pkmn) if !settingUpBattle
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "speciesform"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
msg = [_INTL("Species {1}, form {2}.",pkmn.speciesName,pkmn.form),
|
|
||||||
_INTL("Species {1}, form {2} (forced).",pkmn.speciesName,pkmn.form)][(pkmn.forcedForm!=nil) ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Set species"),
|
|
||||||
_INTL("Set form"),
|
|
||||||
_INTL("Remove override")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Set species
|
|
||||||
species = pbChooseSpeciesList(pkmn.species)
|
|
||||||
if species && species != pkmn.species
|
|
||||||
pkmn.species = species
|
|
||||||
pkmn.calcStats
|
|
||||||
pbSeenForm(pkmn) if !settingUpBattle
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
when 1 # Set form
|
|
||||||
cmd2 = 0
|
|
||||||
formcmds = [[], []]
|
|
||||||
GameData::Species.each do |sp|
|
|
||||||
next if sp.species != pkmn.species
|
|
||||||
form_name = sp.form_name
|
|
||||||
form_name = _INTL("Unnamed form") if !form_name || form_name.empty?
|
|
||||||
form_name = sprintf("%d: %s", sp.form, form_name)
|
|
||||||
formcmds[0].push(sp.form)
|
|
||||||
formcmds[1].push(form_name)
|
|
||||||
cmd2 = sp.form if pkmn.form == sp.form
|
|
||||||
end
|
|
||||||
if formcmds[0].length <= 1
|
|
||||||
pbDisplay(_INTL("Species {1} only has one form.", pkmn.speciesName))
|
|
||||||
else
|
|
||||||
cmd2 = pbShowCommands(_INTL("Set the Pokémon's form."), formcmds[1], cmd2)
|
|
||||||
next if cmd2 < 0
|
|
||||||
f = formcmds[0][cmd2]
|
|
||||||
if f != pkmn.form
|
|
||||||
if MultipleForms.hasFunction?(pkmn, "getForm")
|
|
||||||
next if !pbConfirm(_INTL("This species decides its own form. Override?"))
|
|
||||||
pkmn.forcedForm = f
|
|
||||||
end
|
|
||||||
pkmn.form = f
|
|
||||||
pbSeenForm(pkmn) if !settingUpBattle
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
when 2 # Remove override
|
|
||||||
pkmn.forcedForm = nil
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setshininess"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
oldshiny = (pkmn.shiny?) ? _INTL("shiny") : _INTL("normal")
|
|
||||||
msg = [_INTL("Shininess ({1}) is natural.",oldshiny),
|
|
||||||
_INTL("Shininess ({1}) is being forced.",oldshiny)][pkmn.shinyflag!=nil ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Make shiny"),
|
|
||||||
_INTL("Make normal"),
|
|
||||||
_INTL("Remove override")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Make shiny
|
|
||||||
pkmn.makeShiny
|
|
||||||
when 1 # Make normal
|
|
||||||
pkmn.makeNotShiny
|
|
||||||
when 2 # Remove override
|
|
||||||
pkmn.shinyflag = nil
|
|
||||||
end
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setnickname"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
speciesname = pkmn.speciesName
|
|
||||||
msg = [_INTL("{1} has the nickname {2}.",speciesname,pkmn.name),
|
|
||||||
_INTL("{1} has no nickname.",speciesname)][pkmn.name==speciesname ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Rename"),
|
|
||||||
_INTL("Erase name")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Rename
|
|
||||||
oldname = (pkmn.name && pkmn.name!=speciesname) ? pkmn.name : ""
|
|
||||||
newname = pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),
|
|
||||||
0, Pokemon::MAX_NAME_SIZE, oldname, pkmn)
|
|
||||||
if newname && newname!=""
|
|
||||||
pkmn.name = newname
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
when 1 # Erase name
|
|
||||||
pkmn.name = speciesname
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setpokeball"
|
|
||||||
commands = []; balls = []
|
|
||||||
for key in $BallTypes.keys
|
|
||||||
item = GameData::Item.try_get($BallTypes[key])
|
|
||||||
balls.push([key.to_i, item.name]) if item
|
|
||||||
end
|
|
||||||
balls.sort! { |a,b| a[1]<=>b[1] }
|
|
||||||
cmd = 0
|
|
||||||
for i in 0...balls.length
|
|
||||||
if balls[i][0]==pkmn.ballused
|
|
||||||
cmd = i; break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for i in balls
|
|
||||||
commands.push(i[1])
|
|
||||||
end
|
|
||||||
loop do
|
|
||||||
oldball = pbBallTypeToItem(pkmn.ballused).name
|
|
||||||
cmd = pbShowCommands(_INTL("{1} used.",oldball),commands,cmd)
|
|
||||||
break if cmd<0
|
|
||||||
pkmn.ballused = balls[cmd][0]
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setribbons"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
commands = []
|
|
||||||
for i in 1..PBRibbons.maxValue
|
|
||||||
commands.push(_INTL("{1} {2}",
|
|
||||||
(pkmn.hasRibbon?(i)) ? "[Y]" : "[ ]",PBRibbons.getName(i)))
|
|
||||||
end
|
|
||||||
commands.push(_INTL("Give all"))
|
|
||||||
commands.push(_INTL("Clear all"))
|
|
||||||
cmd = pbShowCommands(_INTL("{1} ribbons.",pkmn.ribbonCount),commands,cmd)
|
|
||||||
break if cmd<0
|
|
||||||
if cmd>=0 && cmd<PBRibbons.maxValue # Toggle ribbon
|
|
||||||
if pkmn.hasRibbon?(cmd+1)
|
|
||||||
pkmn.takeRibbon(cmd+1)
|
|
||||||
else
|
|
||||||
pkmn.giveRibbon(cmd+1)
|
|
||||||
end
|
|
||||||
elsif cmd==commands.length-2 # Give all
|
|
||||||
for i in 1..PBRibbons.maxValue
|
|
||||||
pkmn.giveRibbon(i)
|
|
||||||
end
|
|
||||||
elsif cmd==commands.length-1 # Clear all
|
|
||||||
for i in 1..PBRibbons.maxValue
|
|
||||||
pkmn.takeRibbon(i)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "ownership"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
gender = [_INTL("Male"),_INTL("Female"),_INTL("Unknown")][pkmn.owner.gender]
|
|
||||||
msg = [_INTL("Player's Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.owner.name,gender,pkmn.owner.public_id,pkmn.owner.id),
|
|
||||||
_INTL("Foreign Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.owner.name,gender,pkmn.owner.public_id,pkmn.owner.id)
|
|
||||||
][pkmn.foreign?($Trainer) ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Make player's"),
|
|
||||||
_INTL("Set OT's name"),
|
|
||||||
_INTL("Set OT's gender"),
|
|
||||||
_INTL("Random foreign ID"),
|
|
||||||
_INTL("Set foreign ID")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Make player's
|
|
||||||
pkmn.owner = Pokemon::Owner.new_from_trainer($Trainer)
|
|
||||||
when 1 # Set OT's name
|
|
||||||
pkmn.owner.name = pbEnterPlayerName(_INTL("{1}'s OT's name?",pkmn.name),1,MAX_PLAYER_NAME_SIZE)
|
|
||||||
when 2 # Set OT's gender
|
|
||||||
cmd2 = pbShowCommands(_INTL("Set OT's gender."),
|
|
||||||
[_INTL("Male"),_INTL("Female"),_INTL("Unknown")],pkmn.owner.gender)
|
|
||||||
pkmn.owner.gender = cmd2 if cmd2>=0
|
|
||||||
when 3 # Random foreign ID
|
|
||||||
pkmn.owner.id = $Trainer.getForeignID
|
|
||||||
when 4 # Set foreign ID
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0,65535)
|
|
||||||
params.setDefaultValue(pkmn.owner.public_id)
|
|
||||||
val = pbMessageChooseNumber(
|
|
||||||
_INTL("Set the new ID (max. 65535)."),params) { pbUpdate }
|
|
||||||
pkmn.owner.id = val
|
|
||||||
pkmn.owner.id |= val << 16
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "setegg"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
msg = [_INTL("Not an egg"),
|
|
||||||
_INTL("Egg with eggsteps: {1}.",pkmn.eggsteps)][pkmn.egg? ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Make egg"),
|
|
||||||
_INTL("Make Pokémon"),
|
|
||||||
_INTL("Set eggsteps to 1")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Make egg
|
|
||||||
if !pkmn.egg? && (pbHasEgg?(pkmn.species) ||
|
|
||||||
pbConfirm(_INTL("{1} cannot legally be an egg. Make egg anyway?", pkmn.speciesName)))
|
|
||||||
pkmn.level = EGG_LEVEL
|
|
||||||
pkmn.calcStats
|
|
||||||
pkmn.name = _INTL("Egg")
|
|
||||||
pkmn.eggsteps = pkmn.species_data.hatch_steps
|
|
||||||
pkmn.hatchedMap = 0
|
|
||||||
pkmn.obtainMode = 1
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
when 1 # Make Pokémon
|
|
||||||
if pkmn.egg?
|
|
||||||
pkmn.name = pkmn.speciesName
|
|
||||||
pkmn.eggsteps = 0
|
|
||||||
pkmn.hatchedMap = 0
|
|
||||||
pkmn.obtainMode = 0
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
when 2 # Set eggsteps to 1
|
|
||||||
pkmn.eggsteps = 1 if pkmn.egg?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "shadowpkmn"
|
|
||||||
cmd = 0
|
|
||||||
loop do
|
|
||||||
msg = [_INTL("Not a Shadow Pokémon."),
|
|
||||||
_INTL("Heart gauge is {1} (stage {2}).",pkmn.heartgauge,pkmn.heartStage)
|
|
||||||
][pkmn.shadowPokemon? ? 1 : 0]
|
|
||||||
cmd = pbShowCommands(msg,[
|
|
||||||
_INTL("Make Shadow"),
|
|
||||||
_INTL("Set heart gauge")],cmd)
|
|
||||||
break if cmd<0
|
|
||||||
case cmd
|
|
||||||
when 0 # Make Shadow
|
|
||||||
if !pkmn.shadowPokemon?
|
|
||||||
pkmn.makeShadow
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
else
|
|
||||||
pbDisplay(_INTL("{1} is already a Shadow Pokémon.",pkmn.name))
|
|
||||||
end
|
|
||||||
when 1 # Set heart gauge
|
|
||||||
if pkmn.shadowPokemon?
|
|
||||||
oldheart = pkmn.heartgauge
|
|
||||||
params = ChooseNumberParams.new
|
|
||||||
params.setRange(0, Pokemon::HEARTGAUGESIZE)
|
|
||||||
params.setDefaultValue(pkmn.heartgauge)
|
|
||||||
val = pbMessageChooseNumber(
|
|
||||||
_INTL("Set the heart gauge (max. {1}).", Pokemon::HEARTGAUGESIZE),
|
|
||||||
params) { pbUpdate }
|
|
||||||
if val!=oldheart
|
|
||||||
pkmn.adjustHeart(val-oldheart)
|
|
||||||
pbReadyToPurify(pkmn)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
pbDisplay(_INTL("{1} is not a Shadow Pokémon.",pkmn.name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "mysterygift"
|
|
||||||
pbCreateMysteryGift(0,pkmn)
|
|
||||||
#===========================================================================
|
|
||||||
when "duplicate"
|
|
||||||
if pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
|
|
||||||
clonedpkmn = pkmn.clone
|
|
||||||
if self.is_a?(PokemonPartyScreen)
|
|
||||||
pbStorePokemon(clonedpkmn)
|
|
||||||
pbHardRefresh
|
|
||||||
pbDisplay(_INTL("The Pokémon was duplicated."))
|
|
||||||
elsif self.is_a?(PokemonStorageScreen)
|
|
||||||
if @storage.pbMoveCaughtToParty(clonedpkmn)
|
|
||||||
if pkmnid[0]!=-1
|
|
||||||
pbDisplay(_INTL("The duplicated Pokémon was moved to your party."))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
oldbox = @storage.currentBox
|
|
||||||
newbox = @storage.pbStoreCaught(clonedpkmn)
|
|
||||||
if newbox<0
|
|
||||||
pbDisplay(_INTL("All boxes are full."))
|
|
||||||
elsif newbox!=oldbox
|
|
||||||
pbDisplay(_INTL("The duplicated Pokémon was moved to box \"{1}.\"",@storage[newbox].name))
|
|
||||||
@storage.currentBox = oldbox
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pbHardRefresh
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
#===========================================================================
|
|
||||||
when "delete"
|
|
||||||
if pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
|
|
||||||
if self.is_a?(PokemonPartyScreen)
|
|
||||||
@party[pkmnid] = nil
|
|
||||||
@party.compact!
|
|
||||||
pbHardRefresh
|
|
||||||
elsif self.is_a?(PokemonStorageScreen)
|
|
||||||
@scene.pbRelease(pkmnid,heldpoke)
|
|
||||||
(heldpoke) ? @heldpkmn = nil : @storage.pbDelete(pkmnid[0],pkmnid[1])
|
|
||||||
@scene.pbRefresh
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbPokemonDebug(pkmn,pkmnid,heldpoke=nil,settingUpBattle=false)
|
|
||||||
command = 0
|
|
||||||
commands = pbPokemonDebugCommands(settingUpBattle)
|
|
||||||
loop do
|
|
||||||
command = pbShowCommands(_INTL("Do what with {1}?",pkmn.name),commands.list,command)
|
|
||||||
if command<0
|
|
||||||
parent = commands.getParent
|
|
||||||
if parent
|
|
||||||
commands.currentList = parent[0]
|
|
||||||
command = parent[1]
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
else
|
|
||||||
cmd = commands.getCommand(command)
|
|
||||||
if commands.hasSubMenu?(cmd)
|
|
||||||
commands.currentList = cmd
|
|
||||||
command = 0
|
|
||||||
else
|
|
||||||
cont = pbPokemonDebugActions(cmd,pkmn,pkmnid,heldpoke,settingUpBattle)
|
|
||||||
break if !cont
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PokemonPartyScreen
|
|
||||||
include PokemonDebugMixin
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PokemonStorageScreen
|
|
||||||
include PokemonDebugMixin
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PokemonDebugPartyScreen
|
|
||||||
include PokemonDebugMixin
|
|
||||||
end
|
|
||||||
1084
Data/Scripts/021_Debug/003_Debug_PokemonCommands.rb
Normal file
1084
Data/Scripts/021_Debug/003_Debug_PokemonCommands.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -572,9 +572,9 @@ class MapScreenScene
|
|||||||
if Input.trigger?(Input::B)
|
if Input.trigger?(Input::B)
|
||||||
if pbConfirmMessage(_INTL("Save changes?"))
|
if pbConfirmMessage(_INTL("Save changes?"))
|
||||||
serializeConnectionData
|
serializeConnectionData
|
||||||
|
MapFactoryHelper.clear
|
||||||
save_data(@encdata,"Data/encounters.dat")
|
save_data(@encdata,"Data/encounters.dat")
|
||||||
# TODO: Only need to reload connections and encounter data.
|
$PokemonTemp.encountersData = nil
|
||||||
pbClearData
|
|
||||||
pbSaveEncounterData
|
pbSaveEncounterData
|
||||||
end
|
end
|
||||||
break if pbConfirmMessage(_INTL("Exit from the editor?"))
|
break if pbConfirmMessage(_INTL("Exit from the editor?"))
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ class SpritePositioner
|
|||||||
frm = species_data.form
|
frm = species_data.form
|
||||||
@sprites["pokemon_0"].setSpeciesBitmap(spe, 0, frm, false, false, true)
|
@sprites["pokemon_0"].setSpeciesBitmap(spe, 0, frm, false, false, true)
|
||||||
@sprites["pokemon_1"].setSpeciesBitmap(spe, 0, frm)
|
@sprites["pokemon_1"].setSpeciesBitmap(spe, 0, frm)
|
||||||
# TODO
|
|
||||||
@sprites["shadow_1"].setBitmap(GameData::Species.shadow_filename(spe, frm))
|
@sprites["shadow_1"].setBitmap(GameData::Species.shadow_filename(spe, frm))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user