Implemented GameData::Move

This commit is contained in:
Maruno17
2020-11-19 21:00:29 +00:00
parent 52ffae9e8a
commit 3cd8d59918
71 changed files with 1443 additions and 1584 deletions

View File

@@ -980,11 +980,10 @@ class PokemonDebugPartyScreen
def pbChooseMove(pkmn,text,index=0)
moveNames = []
for i in pkmn.moves
break if i.id==0
if i.totalpp<=0
moveNames.push(_INTL("{1} (PP: ---)",PBMoves.getName(i.id)))
if i.total_pp<=0
moveNames.push(_INTL("{1} (PP: ---)",i.name))
else
moveNames.push(_INTL("{1} (PP: {2}/{3})",PBMoves.getName(i.id),i.pp,i.totalpp))
moveNames.push(_INTL("{1} (PP: {2}/{3})",i.name,i.pp,i.total_pp))
end
end
return pbShowCommands(text,moveNames,index)

View File

@@ -347,7 +347,7 @@ module PokemonDebugMixin
#===========================================================================
when "teachmove"
move = pbChooseMoveList
if move!=0
if move
pbLearnMove(pkmn,move)
pbRefreshSingle(pkmnid)
end
@@ -355,7 +355,7 @@ module PokemonDebugMixin
when "forgetmove"
moveindex = pbChooseMove(pkmn,_INTL("Choose move to forget."))
if moveindex>=0
movename = PBMoves.getName(pkmn.moves[moveindex].id)
movename = pkmn.moves[moveindex].name
pkmn.pbDeleteMoveAtIndex(moveindex)
pbDisplay(_INTL("{1} forgot {2}.",pkmn.name,movename))
pbRefreshSingle(pkmnid)
@@ -371,11 +371,11 @@ module PokemonDebugMixin
loop do
commands = []
for i in pkmn.moves
break if i.id==0
if i.totalpp<=0
commands.push(_INTL("{1} (PP: ---)",PBMoves.getName(i.id)))
break if !i.id
if i.total_pp<=0
commands.push(_INTL("{1} (PP: ---)",i.name))
else
commands.push(_INTL("{1} (PP: {2}/{3})",PBMoves.getName(i.id),i.pp,i.totalpp))
commands.push(_INTL("{1} (PP: {2}/{3})",i.name,i.pp,i.total_pp))
end
end
commands.push(_INTL("Restore all PP"))
@@ -383,13 +383,13 @@ module PokemonDebugMixin
break if cmd<0
if cmd>=0 && cmd<commands.length-1 # Move
move = pkmn.moves[cmd]
movename = PBMoves.getName(move.id)
if move.totalpp<=0
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.totalpp,move.ppup)
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"),
@@ -398,13 +398,13 @@ module PokemonDebugMixin
case cmd2
when 0 # Change PP
params = ChooseNumberParams.new
params.setRange(0,move.totalpp)
params.setRange(0,move.total_pp)
params.setDefaultValue(move.pp)
h = pbMessageChooseNumber(
_INTL("Set PP of {1} (max. {2}).",movename,move.totalpp),params) { pbUpdate }
_INTL("Set PP of {1} (max. {2}).",movename,move.total_pp),params) { pbUpdate }
move.pp = h
when 1 # Full PP
move.pp = move.totalpp
move.pp = move.total_pp
when 2 # Change PP Up
params = ChooseNumberParams.new
params.setRange(0,3)
@@ -412,7 +412,7 @@ module PokemonDebugMixin
h = pbMessageChooseNumber(
_INTL("Set PP Up of {1} (max. 3).",movename),params) { pbUpdate }
move.ppup = h
move.pp = move.totalpp if move.pp>move.totalpp
move.pp = move.total_pp if move.pp>move.total_pp
end
end
end

View File

@@ -694,7 +694,7 @@ def pbItemEditor
itm.field_use,
itm.battle_use,
itm.type,
itm.move || 0
itm.move
]
if pbPropertyList(itm.id.to_s, data, items, true)
# Construct item hash
@@ -709,7 +709,7 @@ def pbItemEditor
:field_use => data[6],
:battle_use => data[7],
:type => data[8],
:move => (data[9] > 0) ? data[9] : nil
:move => data[9]
}
# Add item's data to records
GameData::Item::DATA[itm.id_number] = GameData::Item::DATA[itm.id] = GameData::Item.new(item_hash)
@@ -938,7 +938,7 @@ def pbPokemonEditor
movelist.sort! { |a,b| (a[0]==b[0]) ? a[2]<=>b[2] : a[0]<=>b[0] }
originalEggMoves = pbGetSpeciesEggMoves(selection)
eggmovelist = []
originalEggMoves.each { |m| eggmovelist.push(m) if m!=0 }
originalEggMoves.each { |m| eggmovelist.push(m) }
regionallist = []
for i in 0...regionalDexes.length
regionallist.push(regionalDexes[i][selection])
@@ -1162,12 +1162,12 @@ def pbRegionalDexEditor(dex)
refreshlist = false
cmd = pbCommands3(cmdwin,commands,-1,cmd[1],true)
case cmd[0]
when 1 # Swap move up
when 1 # Swap entry up
if cmd[1]<tdex.length-1
tdex[cmd[1]+1],tdex[cmd[1]] = tdex[cmd[1]],tdex[cmd[1]+1]
refreshlist = true
end
when 2 # Swap move down
when 2 # Swap entry down
if cmd[1]>0
tdex[cmd[1]-1],tdex[cmd[1]] = tdex[cmd[1]],tdex[cmd[1]-1]
refreshlist = true

View File

@@ -48,7 +48,7 @@ end
# Save ability data to PBS file
#===============================================================================
def pbSaveAbilities
File.open("PBS/abilities.txt","wb") { |f|
File.open("PBS/abilities.txt", "wb") { |f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
@@ -72,39 +72,34 @@ end
# Save move data to PBS file
#===============================================================================
def pbSaveMoveData
movesData = pbLoadMovesData
return if !movesData
File.open("PBS/moves.txt","wb") { |f|
File.open("PBS/moves.txt", "wb") { |f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file."))
f.write("\r\n")
currentType = -1
for i in 1..(PBMoves.maxValue rescue PBMoves.getCount-1 rescue pbGetMessageCount(MessageTypes::Moves)-1)
moveData = movesData[i]
next if !moveData # No move with that ID defined
if currentType!=moveData[MoveData::TYPE]
currentType = moveData[MoveData::TYPE]
current_type = -1
GameData::Move.each do |m|
if current_type != m.type
current_type = m.type
f.write("\#-------------------------------\r\n")
end
f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s",
moveData[MoveData::ID],
moveData[MoveData::INTERNAL_NAME],
csvQuote(moveData[MoveData::NAME]),
csvQuote(moveData[MoveData::FUNCTION_CODE]),
moveData[MoveData::BASE_DAMAGE],
(getConstantName(PBTypes,moveData[MoveData::TYPE]) rescue pbGetTypeConst(moveData[MoveData::TYPE]) rescue ""),
["Physical","Special","Status"][moveData[MoveData::CATEGORY]],
moveData[MoveData::ACCURACY],
moveData[MoveData::TOTAL_PP],
moveData[MoveData::EFFECT_CHANCE],
(getConstantName(PBTargets,moveData[MoveData::TARGET]) rescue sprintf("%02X",moveData[MoveData::TARGET])),
moveData[MoveData::PRIORITY],
csvQuote(moveData[MoveData::FLAGS]),
csvQuoteAlways(moveData[MoveData::DESCRIPTION])
f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s\r\n",
m.id_number,
csvQuote(m.id.to_s),
csvQuote(m.real_name),
csvQuote(m.function_code),
m.base_damage,
(getConstantName(PBTypes, m.type) rescue pbGetTypeConst(m.type) rescue ""),
["Physical", "Special", "Status"][m.category],
m.accuracy,
m.total_pp,
m.effect_chance,
(getConstantName(PBTargets, m.target) rescue sprintf("%02X", m.target)),
m.priority,
csvQuote(m.flags),
csvQuoteAlways(m.real_description)
))
f.write("\r\n")
end
}
end
@@ -185,7 +180,7 @@ end
# Save metadata data to PBS file
#===============================================================================
def pbSaveMetadata
File.open("PBS/metadata.txt","wb") { |f|
File.open("PBS/metadata.txt", "wb") { |f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
@@ -231,7 +226,7 @@ end
# Save item data to PBS file
#===============================================================================
def pbSaveItems
File.open("PBS/items.txt","wb") { |f|
File.open("PBS/items.txt", "wb") { |f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
@@ -243,11 +238,10 @@ def pbSaveItems
current_pocket = i.pocket
f.write("\#-------------------------------\r\n")
end
move_name = ""
if i.move
move_name = getConstantName(PBMoves, i.move) rescue pbGetMoveConst(i.move) rescue ""
end
f.write(sprintf("%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n",
move_name = (i.move) ? GameData::Move.get(i.move).id.to_s : ""
sprintf_text = "%d,%s,%s,%s,%d,%d,%s,%d,%d,%d\r\n"
sprintf_text = "%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n" if move_name != ""
f.write(sprintf(sprintf_text,
i.id_number,
csvQuote(i.id.to_s),
csvQuote(i.real_name),
@@ -270,7 +264,7 @@ end
# Save berry plant data to PBS file
#===============================================================================
def pbSaveBerryPlants
File.open("PBS/berryplants.txt","wb") { |f|
File.open("PBS/berryplants.txt", "wb") { |f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
@@ -329,17 +323,18 @@ def pbSaveMachines
f.write(0xBF.chr)
f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file."))
f.write("\r\n")
for i in 1...machines.length
keys = machines.keys.sort { |a, b| GameData::Move.get(a).id_number <=> GameData::Move.get(b).id_number }
for i in 0...keys.length
Graphics.update if i%50==0
Win32API.SetWindowText(_INTL("Writing move {1}/{2}",i,machines.length)) if i%20==0
next if !machines[i]
movename = getConstantName(PBMoves,i) rescue pbGetMoveConst(i) rescue nil
Win32API.SetWindowText(_INTL("Writing move {1}/{2}",i,keys.length)) if i%20==0
next if !machines[keys[i]]
movename = GameData::Move.get(keys[i]).id.to_s
next if !movename || movename==""
f.write("\#-------------------------------\r\n")
f.write(sprintf("[%s]\r\n",movename))
x = []
for j in 0...machines[i].length
speciesname = getConstantName(PBSpecies,machines[i][j]) rescue pbGetSpeciesConst(machines[i][j]) rescue nil
machines[keys[i]].each do |species|
speciesname = getConstantName(PBSpecies,species) rescue pbGetSpeciesConst(species) rescue nil
next if !speciesname || speciesname==""
x.push(speciesname)
end
@@ -487,7 +482,7 @@ def pbSaveTrainerBattles
if poke[TrainerData::MOVES] && poke[TrainerData::MOVES].length>0
movestring = ""
for i in 0...poke[TrainerData::MOVES].length
movename = getConstantName(PBMoves,poke[TrainerData::MOVES][i]) rescue pbGetMoveConst(poke[TrainerData::MOVES][i]) rescue nil
movename = GameData::Move.get(poke[TrainerData::MOVES][i]).id.to_s
next if !movename
movestring.concat(",") if i>0
movestring.concat(movename)
@@ -747,7 +742,7 @@ def pbSavePokemonData
level = m[0]
move = m[1]
pokedata.write(",") if !first
cmove = getConstantName(PBMoves,move) rescue pbGetMoveConst(move)
cmove = GameData::Move.get(move).id.to_s
pokedata.write(sprintf("%d,%s",level,cmove))
first = false
end
@@ -759,7 +754,7 @@ def pbSavePokemonData
eggMoves[i].each do |m|
next if !m || m==0
pokedata.write(",") if !first
cmove = getConstantName(PBMoves,m) rescue pbGetMoveConst(m)
cmove = GameData::Move.get(m).id.to_s
pokedata.write("#{cmove}")
first = false
end
@@ -1053,7 +1048,7 @@ def pbSavePokemonFormsData
incense = nil if incense==origdata["incense"]
pokedexform = speciesData[i][SpeciesData::POKEDEX_FORM] || 0 # No nil check
megastone = speciesData[i][SpeciesData::MEGA_STONE] # No nil check
megamove = speciesData[i][SpeciesData::MEGA_MOVE] || 0 # No nil check
megamove = speciesData[i][SpeciesData::MEGA_MOVE] # No nil check
unmega = speciesData[i][SpeciesData::UNMEGA_FORM] || 0 # No nil check
megamessage = speciesData[i][SpeciesData::MEGA_MESSAGE] || 0 # No nil check
pokedata.write("\#-------------------------------\r\n")
@@ -1064,8 +1059,8 @@ def pbSavePokemonFormsData
citem = GameData::Item.get(megastone).id.to_s
pokedata.write("MegaStone = #{citem}\r\n")
end
if megamove>0
cmove = getConstantName(PBMoves,megamove) rescue pbGetMoveConst(megamove)
if megamove
cmove = GameData::Move.get(megamove).id.to_s
pokedata.write("MegaMove = #{cmove}\r\n")
end
pokedata.write("UnmegaForm = #{unmega}\r\n") if unmega>0
@@ -1163,7 +1158,7 @@ def pbSavePokemonFormsData
level = m[0]
move = m[1]
pokedata.write(",") if !first
cmove = getConstantName(PBMoves,move) rescue pbGetMoveConst(move)
cmove = GameData::Move.get(move).id.to_s
pokedata.write(sprintf("%d,%s",level,cmove))
first = false
end
@@ -1189,7 +1184,7 @@ def pbSavePokemonFormsData
eggList.each do |m|
next if !m || m==0
pokedata.write(",") if !first
cmove = getConstantName(PBMoves,m) rescue pbGetMoveConst(m)
cmove = GameData::Move.get(m).id.to_s
pokedata.write("#{cmove}")
first = false
end
@@ -1351,7 +1346,7 @@ def pbSaveShadowMoves
f.write(sprintf("%s = ",constname))
movenames = []
for m in move
movenames.push((getConstantName(PBMoves,m) rescue pbGetMoveConst(m) rescue nil))
movenames.push(GameData::Move.get(m).id.to_s)
end
f.write(sprintf("%s\r\n",movenames.compact.join(",")))
end
@@ -1443,14 +1438,10 @@ def pbFastInspect(pkmn,moves,species,items,natures)
evlist += evs[i]
end
end
c4 = (moves[pkmn.move1]) ? moves[pkmn.move1] :
(moves[pkmn.move1] = (getConstantName(PBMoves,pkmn.move1) rescue pbGetMoveConst(pkmn.move1)))
c5 = (moves[pkmn.move2]) ? moves[pkmn.move2] :
(moves[pkmn.move2] = (getConstantName(PBMoves,pkmn.move2) rescue pbGetMoveConst(pkmn.move2)))
c6 = (moves[pkmn.move3]) ? moves[pkmn.move3] :
(moves[pkmn.move3] = (getConstantName(PBMoves,pkmn.move3) rescue pbGetMoveConst(pkmn.move3)))
c7 = (moves[pkmn.move4]) ? moves[pkmn.move4] :
(moves[pkmn.move4] = (getConstantName(PBMoves,pkmn.move4) rescue pbGetMoveConst(pkmn.move4)))
c4 = (moves[pkmn.move1]) ? moves[pkmn.move1] : (moves[pkmn.move1] = GameData::Move.get(pkmn.move1).id_to_s)
c5 = (moves[pkmn.move2]) ? moves[pkmn.move2] : (moves[pkmn.move2] = GameData::Move.get(pkmn.move2).id_to_s)
c6 = (moves[pkmn.move3]) ? moves[pkmn.move3] : (moves[pkmn.move3] = GameData::Move.get(pkmn.move3).id_to_s)
c7 = (moves[pkmn.move4]) ? moves[pkmn.move4] : (moves[pkmn.move4] = GameData::Move.get(pkmn.move4).id_to_s)
return "#{c1};#{c2};#{c3};#{evlist};#{c4},#{c5},#{c6},#{c7}"
end

View File

@@ -296,17 +296,17 @@ end
module MoveProperty
def self.set(_settingname,oldsetting)
ret = pbChooseMoveList((oldsetting) ? oldsetting : 1)
return (ret<=0) ? (oldsetting) ? oldsetting : 0 : ret
def self.set(_settingname, oldsetting)
ret = pbChooseMoveList(oldsetting || nil)
return ret || oldsetting
end
def self.defaultValue
return 0
return nil
end
def self.format(value)
return (value) ? PBMoves.getName(value) : "-"
return (value && GameData::Move.exists?(value)) ? GameData::Move.get(value).real_name : "-"
end
end
@@ -317,9 +317,9 @@ class MoveProperty2
@pokemondata = pokemondata
end
def set(_settingname,oldsetting)
ret = pbChooseMoveListForSpecies(@pokemondata[0],(oldsetting) ? oldsetting : 1)
return (ret>0) ? ret : (oldsetting) ? oldsetting : nil
def set(_settingname, oldsetting)
ret = pbChooseMoveListForSpecies(@pokemondata[TrainerData::SPECIES], oldsetting || nil)
return ret || oldsetting
end
def defaultValue
@@ -327,7 +327,7 @@ class MoveProperty2
end
def format(value)
return (value) ? PBMoves.getName(value) : "-"
return (value && GameData::Move.exists?(value)) ? GameData::Move.get(value).real_name : "-"
end
end
@@ -399,14 +399,13 @@ class IVsProperty
for i in 0...6
oldsetting[i] = oldsetting[0] if !oldsetting[i]
end
properties = [
[_INTL("HP"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's HP stat (0-{1}).",@limit)],
[_INTL("Attack"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Attack stat (0-{1}).",@limit)],
[_INTL("Defense"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Defense stat (0-{1}).",@limit)],
[_INTL("Speed"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Speed stat (0-{1}).",@limit)],
[_INTL("Sp. Atk"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Sp. Atk stat (0-{1}).",@limit)],
[_INTL("Sp. Def"),LimitProperty2.new(@limit),_INTL("Individual values for the Pokémon's Sp. Def stat (0-{1}).",@limit)]
]
properties = []
properties[PBStats::HP] = [_INTL("HP"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's HP stat (0-{1}).", @limit)]
properties[PBStats::ATTACK] = [_INTL("Attack"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Attack stat (0-{1}).", @limit)]
properties[PBStats::DEFENSE] = [_INTL("Defense"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Defense stat (0-{1}).", @limit)]
properties[PBStats::SPATK] = [_INTL("Sp. Atk"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Sp. Atk stat (0-{1}).", @limit)]
properties[PBStats::SPDEF] = [_INTL("Sp. Def"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Sp. Def stat (0-{1}).", @limit)]
properties[PBStats::SPEED] = [_INTL("Speed"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Speed stat (0-{1}).", @limit)]
pbPropertyList(settingname,oldsetting,properties,false)
hasNonNil = false
hasAltVal = false
@@ -452,14 +451,13 @@ class EVsProperty
for i in 0...6
oldsetting[i] = oldsetting[0] if !oldsetting[i]
end
properties = [
[_INTL("HP"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's HP stat (0-{1}).",@limit)],
[_INTL("Attack"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Attack stat (0-{1}).",@limit)],
[_INTL("Defense"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Defense stat (0-{1}).",@limit)],
[_INTL("Speed"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Speed stat (0-{1}).",@limit)],
[_INTL("Sp. Atk"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Sp. Atk stat (0-{1}).",@limit)],
[_INTL("Sp. Def"),LimitProperty2.new(@limit),_INTL("Effort values for the Pokémon's Sp. Def stat (0-{1}).",@limit)]
]
properties = []
properties[PBStats::HP] = [_INTL("HP"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's HP stat (0-{1}).", @limit)]
properties[PBStats::ATTACK] = [_INTL("Attack"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Attack stat (0-{1}).", @limit)]
properties[PBStats::DEFENSE] = [_INTL("Defense"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Defense stat (0-{1}).", @limit)]
properties[PBStats::SPATK] = [_INTL("Sp. Atk"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Sp. Atk stat (0-{1}).", @limit)]
properties[PBStats::SPDEF] = [_INTL("Sp. Def"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Sp. Def stat (0-{1}).", @limit)]
properties[PBStats::SPEED] = [_INTL("Speed"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Speed stat (0-{1}).", @limit)]
loop do
pbPropertyList(settingname,oldsetting,properties,false)
evtotal = 0
@@ -467,8 +465,7 @@ class EVsProperty
evtotal += oldsetting[i] if oldsetting[i]
end
if evtotal>Pokemon::EV_LIMIT
pbMessage(_INTL("Total EVs ({1}) are greater than allowed ({2}). Please reduce them.",
evtotal, Pokemon::EV_LIMIT))
pbMessage(_INTL("Total EVs ({1}) are greater than allowed ({2}). Please reduce them.", evtotal, Pokemon::EV_LIMIT))
else
break
end
@@ -545,14 +542,14 @@ module PlayerProperty
def self.set(settingname,oldsetting)
oldsetting = [0,"xxx","xxx","xxx","xxx","xxx","xxx","xxx"] if !oldsetting
properties = [
[_INTL("Trainer Type"),TrainerTypeProperty,_INTL("Trainer type of this player.")],
[_INTL("Sprite"),CharacterProperty,_INTL("Walking character sprite.")],
[_INTL("Cycling"),CharacterProperty,_INTL("Cycling character sprite.")],
[_INTL("Surfing"),CharacterProperty,_INTL("Surfing character sprite.")],
[_INTL("Running"),CharacterProperty,_INTL("Running character sprite.")],
[_INTL("Diving"),CharacterProperty,_INTL("Diving character sprite.")],
[_INTL("Fishing"),CharacterProperty,_INTL("Fishing character sprite.")],
[_INTL("Field Move"),CharacterProperty,_INTL("Using a field move character sprite.")]
[_INTL("Trainer Type"), TrainerTypeProperty, _INTL("Trainer type of this player.")],
[_INTL("Sprite"), CharacterProperty, _INTL("Walking character sprite.")],
[_INTL("Cycling"), CharacterProperty, _INTL("Cycling character sprite.")],
[_INTL("Surfing"), CharacterProperty, _INTL("Surfing character sprite.")],
[_INTL("Running"), CharacterProperty, _INTL("Running character sprite.")],
[_INTL("Diving"), CharacterProperty, _INTL("Diving character sprite.")],
[_INTL("Fishing"), CharacterProperty, _INTL("Fishing character sprite.")],
[_INTL("Field Move"), CharacterProperty, _INTL("Using a field move character sprite.")]
]
pbPropertyList(settingname,oldsetting,properties,false)
return oldsetting
@@ -717,7 +714,7 @@ end
module ItemNameProperty
def self.set(settingname,oldsetting)
def self.set(settingname, oldsetting)
return pbMessageFreeText(_INTL("Set the value for {1}.",settingname),
(oldsetting) ? oldsetting : "",false,30)
end
@@ -735,14 +732,14 @@ 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")]
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)
return (cmd>=0) ? cmd+1 : oldsetting
def self.set(_settingname, oldsetting)
cmd = pbMessage(_INTL("Choose a pocket for this item."), pocketnames(), -1)
return (cmd >= 0) ? cmd + 1 : oldsetting
end
def self.defaultValue
@@ -750,8 +747,8 @@ module PocketProperty
end
def self.format(value)
return _INTL("No Pocket") if value==0
return (value) ? pocketnames[value-1] : value.inspect
return _INTL("No Pocket") if value == 0
return (value) ? pocketnames[value - 1] : value.inspect
end
end
@@ -761,12 +758,12 @@ module BaseStatsProperty
def self.set(settingname,oldsetting)
return oldsetting if !oldsetting
properties = []
properties[PBStats::HP] = _INTL("Base HP"),NonzeroLimitProperty.new(255),_INTL("Base HP stat of the Pokémon.")
properties[PBStats::ATTACK] = _INTL("Base Attack"),NonzeroLimitProperty.new(255),_INTL("Base Attack stat of the Pokémon.")
properties[PBStats::DEFENSE] = _INTL("Base Defense"),NonzeroLimitProperty.new(255),_INTL("Base Defense stat of the Pokémon.")
properties[PBStats::SPATK] = _INTL("Base Sp. Attack"),NonzeroLimitProperty.new(255),_INTL("Base Special Attack stat of the Pokémon.")
properties[PBStats::SPDEF] = _INTL("Base Sp. Defense"),NonzeroLimitProperty.new(255),_INTL("Base Special Defense stat of the Pokémon.")
properties[PBStats::SPEED] = _INTL("Base Speed"),NonzeroLimitProperty.new(255),_INTL("Base Speed stat of the Pokémon.")
properties[PBStats::HP] = _INTL("Base HP"), NonzeroLimitProperty.new(255), _INTL("Base HP stat of the Pokémon.")
properties[PBStats::ATTACK] = _INTL("Base Attack"), NonzeroLimitProperty.new(255), _INTL("Base Attack stat of the Pokémon.")
properties[PBStats::DEFENSE] = _INTL("Base Defense"), NonzeroLimitProperty.new(255), _INTL("Base Defense stat of the Pokémon.")
properties[PBStats::SPATK] = _INTL("Base Sp. Attack"), NonzeroLimitProperty.new(255), _INTL("Base Special Attack stat of the Pokémon.")
properties[PBStats::SPDEF] = _INTL("Base Sp. Defense"), NonzeroLimitProperty.new(255), _INTL("Base Special Defense stat of the Pokémon.")
properties[PBStats::SPEED] = _INTL("Base Speed"), NonzeroLimitProperty.new(255), _INTL("Base Speed stat of the Pokémon.")
if !pbPropertyList(settingname,oldsetting,properties,true)
oldsetting = nil
else
@@ -790,12 +787,12 @@ module EffortValuesProperty
def self.set(settingname,oldsetting)
return oldsetting if !oldsetting
properties = []
properties[PBStats::HP] = _INTL("HP EVs"),LimitProperty.new(255),_INTL("Number of HP Effort Value points gained from the Pokémon.")
properties[PBStats::ATTACK] = _INTL("Attack EVs"),LimitProperty.new(255),_INTL("Number of Attack Effort Value points gained from the Pokémon.")
properties[PBStats::DEFENSE] = _INTL("Defense EVs"),LimitProperty.new(255),_INTL("Number of Defense Effort Value points gained from the Pokémon.")
properties[PBStats::SPATK] = _INTL("Sp. Attack EVs"),LimitProperty.new(255),_INTL("Number of Special Attack Effort Value points gained from the Pokémon.")
properties[PBStats::SPDEF] = _INTL("Sp. Defense EVs"),LimitProperty.new(255),_INTL("Number of Special Defense Effort Value points gained from the Pokémon.")
properties[PBStats::SPEED] = _INTL("Speed EVs"),LimitProperty.new(255),_INTL("Number of Speed Effort Value points gained from the Pokémon.")
properties[PBStats::HP] = [_INTL("HP EVs"), LimitProperty.new(255), _INTL("Number of HP Effort Value points gained from the Pokémon.")]
properties[PBStats::ATTACK] = [_INTL("Attack EVs"), LimitProperty.new(255), _INTL("Number of Attack Effort Value points gained from the Pokémon.")]
properties[PBStats::DEFENSE] = [_INTL("Defense EVs"), LimitProperty.new(255), _INTL("Number of Defense Effort Value points gained from the Pokémon.")]
properties[PBStats::SPATK] = [_INTL("Sp. Attack EVs"), LimitProperty.new(255), _INTL("Number of Special Attack Effort Value points gained from the Pokémon.")]
properties[PBStats::SPDEF] = [_INTL("Sp. Defense EVs"), LimitProperty.new(255), _INTL("Number of Special Defense Effort Value points gained from the Pokémon.")]
properties[PBStats::SPEED] = [_INTL("Speed EVs"), LimitProperty.new(255), _INTL("Number of Speed Effort Value points gained from the Pokémon.")]
if !pbPropertyList(settingname,oldsetting,properties,true)
oldsetting = nil
else
@@ -833,127 +830,133 @@ end
module MovePoolProperty
def self.set(_settingname,oldsetting)
ret = oldsetting
cmdwin = pbListWindow([],200)
commands = []
def self.set(_settingname, oldsetting)
# Get all moves in move pool
realcmds = []
realcmds.push([-1,0,-1])
realcmds.push([-1, nil, -1, "-"]) # Level, move ID, index in this list, name
for i in 0...oldsetting.length
realcmds.push([oldsetting[i][0],oldsetting[i][1],i])
realcmds.push([oldsetting[i][0], oldsetting[i][1], i, GameData::Move.get(oldsetting[i][1]).real_name])
end
refreshlist = true; oldsel = -1
cmd = [0,0]
# Edit move pool
cmdwin = pbListWindow([], 200)
oldsel = -1
ret = oldsetting
cmd = [0, 0]
commands = []
refreshlist = true
loop do
if refreshlist
realcmds.sort! { |a,b| (a[0]==b[0]) ? a[2]<=>b[2] : a[0]<=>b[0] }
realcmds.sort! { |a, b| (a[0] == b[0]) ? a[2] <=> b[2] : a[0] <=> b[0] }
commands = []
for i in 0...realcmds.length
if realcmds[i][0]==-1
realcmds.each_with_index do |entry, i|
if entry[0] == -1
commands.push(_INTL("[ADD MOVE]"))
else
commands.push(_INTL("{1}: {2}",realcmds[i][0],PBMoves.getName(realcmds[i][1])))
commands.push(_INTL("{1}: {2}", entry[0], entry[3]))
end
cmd[1] = i if oldsel>=0 && realcmds[i][2]==oldsel
cmd[1] = i if oldsel >= 0 && entry[2] == oldsel
end
end
refreshlist = false; oldsel = -1
cmd = pbCommands3(cmdwin,commands,-1,cmd[1],true)
if cmd[0]==1 # Swap move up
if cmd[1]<realcmds.length-1 && realcmds[cmd[1]][0]==realcmds[cmd[1]+1][0]
realcmds[cmd[1]+1][2],realcmds[cmd[1]][2] = realcmds[cmd[1]][2],realcmds[cmd[1]+1][2]
refreshlist = false
oldsel = -1
cmd = pbCommands3(cmdwin, commands, -1, cmd[1], true)
case cmd[0]
when 1 # Swap move up (if both moves have the same level)
if cmd[1] < realcmds.length - 1 && realcmds[cmd[1]][0] == realcmds[cmd[1] + 1][0]
realcmds[cmd[1] + 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] + 1][2]
refreshlist = true
end
elsif cmd[0]==2 # Swap move down
if cmd[1]>0 && realcmds[cmd[1]][0]==realcmds[cmd[1]-1][0]
realcmds[cmd[1]-1][2],realcmds[cmd[1]][2] = realcmds[cmd[1]][2],realcmds[cmd[1]-1][2]
when 2 # Swap move down (if both moves have the same level)
if cmd[1] > 0 && realcmds[cmd[1]][0] == realcmds[cmd[1] - 1][0]
realcmds[cmd[1] - 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] - 1][2]
refreshlist = true
end
elsif cmd[0]==0
if cmd[1]>=0
when 0
if cmd[1] >= 0 # Chose an entry
entry = realcmds[cmd[1]]
if entry[0]==-1 # Add new move
if entry[0] == -1 # Add new move
params = ChooseNumberParams.new
params.setRange(0,PBExperience.maxLevel)
params.setRange(0, PBExperience.maxLevel)
params.setDefaultValue(1)
params.setCancelValue(-1)
newlevel = pbMessageChooseNumber(_INTL("Choose a level."),params)
if newlevel>=0
if newlevel >= 0
newmove = pbChooseMoveList
if newmove>0
if newmove
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][2] if realcmds[i][0]==newlevel && realcmds[i][1]==newmove
realcmds.each do |e|
havemove = e[2] if e[0] == newlevel && e[1] == newmove
end
if havemove>=0
if havemove >= 0
oldsel = havemove
else
maxid = -1
for i in realcmds; maxid = [maxid,i[2]].max; end
realcmds.push([newlevel,newmove,maxid+1])
realcmds.each { |e| maxid = [maxid, e[2]].max }
realcmds.push([newlevel, newmove, maxid + 1, GameData::Move.get(newmove).real_name])
end
refreshlist = true
end
end
else # Edit move
cmd2 = pbMessage(_INTL("\\ts[]Do what with this move?"),
[_INTL("Change level"),_INTL("Change move"),_INTL("Delete"),_INTL("Cancel")],4)
if cmd2==0
else # Edit existing move
case pbMessage(_INTL("\\ts[]Do what with this move?"),
[_INTL("Change level"), _INTL("Change move"), _INTL("Delete"), _INTL("Cancel")], 4)
when 0 # Change level
params = ChooseNumberParams.new
params.setRange(0,PBExperience.maxLevel)
params.setRange(0, PBExperience.maxLevel)
params.setDefaultValue(entry[0])
newlevel = pbMessageChooseNumber(_INTL("Choose a new level."),params)
if newlevel>=0 && newlevel!=entry[0]
newlevel = pbMessageChooseNumber(_INTL("Choose a new level."), params)
if newlevel >= 0 && newlevel != entry[0]
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][2] if realcmds[i][0]==newlevel && realcmds[i][1]==entry[1]
realcmds.each do |e|
havemove = e[2] if e[0] == newlevel && e[1] == entry[1]
end
if havemove>=0
if havemove >= 0 # Move already known at new level; delete this move
realcmds[cmd[1]] = nil
realcmds.compact!
oldsel = havemove
else
else # Apply the new level
entry[0] = newlevel
oldsel = entry[2]
end
refreshlist = true
end
elsif cmd2==1
when 1 # Change move
newmove = pbChooseMoveList(entry[1])
if newmove>0
if newmove
havemove = -1
for i in 0...realcmds.length
havemove = realcmds[i][2] if realcmds[i][0]==entry[0] && realcmds[i][1]==newmove
realcmds.each do |e|
havemove = e[2] if e[0] == entry[0] && e[1] == newmove
end
if havemove>=0
if havemove >= 0 # New move already known at level; delete this move
realcmds[cmd[1]] = nil
realcmds.compact!
oldsel = havemove
else
else # Apply the new move
entry[1] = newmove
entry[3] = GameData::Move.get(newmove).real_name
oldsel = entry[2]
end
refreshlist = true
end
elsif cmd2==2
when 2 # Delete
realcmds[cmd[1]] = nil
realcmds.compact!
cmd[1] = [cmd[1],realcmds.length-1].min
cmd[1] = [cmd[1], realcmds.length - 1].min
refreshlist = true
end
end
else
cmd2 = pbMessage(_INTL("Save changes?"),
[_INTL("Yes"),_INTL("No"),_INTL("Cancel")],3)
if cmd2==0 || cmd2==1
if cmd2==0
for i in 0...realcmds.length
realcmds[i].pop
realcmds[i] = nil if realcmds[i][0]==0
end
realcmds.compact!
ret = realcmds
else # Cancel/quit
case pbMessage(_INTL("Save changes?"),
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0
for i in 0...realcmds.length
realcmds[i].pop # Remove name
realcmds[i].pop # Remove index in this list
end
realcmds.compact!
ret = realcmds
break
when 1
break
end
end
@@ -970,8 +973,8 @@ module MovePoolProperty
def self.format(value)
ret = ""
for i in 0...value.length
ret << "," if i>0
ret << sprintf("#{value[i][0]},#{PBMoves.getName(value[i][1])}")
ret << "," if i > 0
ret << sprintf("%s,%s", value[i][0], GameData::Move.get(value[i][1]).real_name)
end
return ret
end
@@ -980,83 +983,78 @@ end
module EggMovesProperty
def self.set(_settingname,oldsetting)
ret = oldsetting
cmdwin = pbListWindow([],200)
commands = []
def self.set(_settingname, oldsetting)
# Get all egg moves
realcmds = []
realcmds.push([0,_INTL("[ADD MOVE]"),-1])
realcmds.push([nil, _INTL("[ADD MOVE]"), -1])
for i in 0...oldsetting.length
realcmds.push([oldsetting[i],PBMoves.getName(oldsetting[i]),0])
realcmds.push([oldsetting[i], GameData::Move.get(oldsetting[i]).real_name, 0])
end
refreshlist = true; oldsel = -1
# Edit egg moves list
cmdwin = pbListWindow([], 200)
oldsel = nil
ret = oldsetting
cmd = 0
commands = []
refreshlist = true
loop do
if refreshlist
realcmds.sort! { |a,b| (a[2]==b[2]) ? a[1]<=>b[1] : a[2]<=>b[2] }
realcmds.sort! { |a, b| (a[2] == b[2]) ? a[1] <=> b[1] : a[2] <=> b[2] }
commands = []
for i in 0...realcmds.length
commands.push(realcmds[i][1])
cmd = i if oldsel>=0 && realcmds[i][0]==oldsel
realcmds.each_with_index do |entry, i|
commands.push(entry[1])
cmd = i if oldsel && entry[0] == oldsel
end
end
refreshlist = false; oldsel = -1
cmd = pbCommands2(cmdwin,commands,-1,cmd,true)
if cmd>=0
refreshlist = false
oldsel = nil
cmd = pbCommands2(cmdwin, commands, -1, cmd, true)
if cmd >= 0 # Chose an entry
entry = realcmds[cmd]
if entry[0]==0 # Add new move
if entry[2] == -1 # Add new move
newmove = pbChooseMoveList
if newmove>0
havemove = false
for i in 0...realcmds.length
havemove = true if realcmds[i][0]==newmove
end
if havemove
oldsel = newmove
if newmove
if realcmds.any? { |e| e[0] == newmove }
oldsel = newmove # Already have move; just move cursor to it
else
realcmds.push([newmove,PBMoves.getName(newmove),0])
realcmds.push([newmove, GameData::Move.get(newmove).name, 0])
end
refreshlist = true
end
else # Edit move
cmd2 = pbMessage(_INTL("\\ts[]Do what with this move?"),
[_INTL("Change move"),_INTL("Delete"),_INTL("Cancel")],3)
if cmd2==0
case pbMessage(_INTL("\\ts[]Do what with this move?"),
[_INTL("Change move"), _INTL("Delete"), _INTL("Cancel")], 3)
when 0 # Change move
newmove = pbChooseMoveList(entry[0])
if newmove>0
havemove = false
for i in 0...realcmds.length
havemove = true if realcmds[i][0]==newmove
end
if havemove
if newmove
if realcmds.any? { |e| e[0] == newmove } # Already have move; delete this one
realcmds[cmd] = nil
realcmds.compact!
cmd = [cmd,realcmds.length-1].min
else
realcmds[cmd] = [newmove,PBMoves.getName(newmove),0]
cmd = [cmd, realcmds.length - 1].min
else # Change move
realcmds[cmd] = [newmove, GameData::Move.get(newmove).name, 0]
end
oldsel = newmove
refreshlist = true
end
elsif cmd2==1
when 1 # Delete
realcmds[cmd] = nil
realcmds.compact!
cmd = [cmd,realcmds.length-1].min
cmd = [cmd, realcmds.length - 1].min
refreshlist = true
end
end
else
cmd2 = pbMessage(_INTL("Save changes?"),
[_INTL("Yes"),_INTL("No"),_INTL("Cancel")],3)
if cmd2==0 || cmd2==1
if cmd2==0
for i in 0...realcmds.length
realcmds[i] = realcmds[i][0]
realcmds[i] = nil if realcmds[i]==0
end
realcmds.compact!
ret = realcmds
else # Cancel/quit
case pbMessage(_INTL("Save changes?"),
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0
for i in 0...realcmds.length
realcmds[i] = realcmds[i][0]
end
realcmds.compact!
ret = realcmds
break
when 1
break
end
end
@@ -1072,8 +1070,8 @@ module EggMovesProperty
def self.format(value)
ret = ""
for i in 0...value.length
ret << "," if i>0
ret << sprintf("#{PBMoves.getName(value[i])}")
ret << "," if i > 0
ret << GameData::Move.get(value[i]).real_name
end
return ret
end
@@ -1254,7 +1252,7 @@ class EvolutionsProperty
case param_type
when :Item
newparam = pbChooseItemList
when :PBMoves
when :Move
newparam = pbChooseMoveList
when :PBSpecies
newparam = pbChooseSpeciesList
@@ -1343,7 +1341,7 @@ class EvolutionsProperty
case param_type
when :Item
newparam = pbChooseItemList(entry[1])
when :PBMoves
when :Move
newparam = pbChooseMoveList(entry[1])
when :PBSpecies
newparam = pbChooseSpeciesList(entry[1])

View File

@@ -17,8 +17,7 @@ def pbGetLegalMoves(species)
tmdat = pbLoadSpeciesTMData
GameData::Item.each do |i|
next if !i.move
atk = getConst(PBMoves, i.move)
moves.push(atk) if tmdat[atk] && tmdat[atk].include?(species)
moves.push(i.move) if tmdat[i.move] && tmdat[i.move].include?(species)
end
babyspecies = pbGetBabySpecies(species)
eggMoves = pbGetSpeciesEggMoves(babyspecies)
@@ -228,7 +227,7 @@ def pbGetGenderConst(i)
end
def pbGetHabitatConst(i)
ret = MakeshiftConsts.get(53,i,PBHabitats)
ret = MakeshiftConsts.get(54,i,PBHabitats)
if !ret
ret = ["","Grassland","Forest","WatersEdge","Sea","Cave","Mountain",
"RoughTerrain","Urban","Rare"]
@@ -243,9 +242,10 @@ end
# return MakeshiftConsts.get(MessageTypes::Abilities,i,PBAbilities)
#end
def pbGetMoveConst(i)
return MakeshiftConsts.get(MessageTypes::Moves,i,PBMoves)
end
# Unused
#def pbGetMoveConst(i)
# return MakeshiftConsts.get(MessageTypes::Moves,i,PBMoves)
#end
# Unused
#def pbGetItemConst(i)
@@ -283,47 +283,44 @@ end
# is the ID of the move to initially select.
def pbChooseMoveList(default=0)
commands = []
for i in 1..PBMoves.maxValue
cname = getConstantName(PBMoves,i) rescue nil
commands.push([i,PBMoves.getName(i)]) if cname
end
return pbChooseList(commands,default,0)
GameData::Move.each { |i| commands.push([i.id_number, i.name, i.id]) }
return pbChooseList(commands, default, nil, -1)
end
def pbChooseMoveListForSpecies(species,defaultMoveID=0)
cmdwin = pbListWindow([],200)
def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
cmdwin = pbListWindow([], 200)
commands = []
moveDefault = 0
# Get all legal moves
legalMoves = pbGetLegalMoves(species)
for move in legalMoves
commands.push([move,PBMoves.getName(move)])
legalMoves.each do |move|
move_data = GameData::Move.get(move)
commands.push([move_data.id_number, move_data.name, move_data.id])
end
commands.sort! { |a,b| a[1]<=>b[1] }
if defaultMoveID>0
commands.each_with_index do |_item,i|
moveDefault = i if moveDefault==0 && i[0]==defaultMoveID
commands.sort! { |a, b| a[1] <=> b[1] }
moveDefault = 0
if defaultMoveID
commands.each_with_index do |_item, i|
moveDefault = i if moveDefault == 0 && i[2] == defaultMoveID
end
end
# Get all moves
commands2 = []
for i in 1..PBMoves.maxValue
if PBMoves.getName(i)!=nil && PBMoves.getName(i)!=""
commands2.push([i,PBMoves.getName(i)])
end
end
commands2.sort! { |a,b| a[1]<=>b[1] }
if defaultMoveID>0
commands2.each_with_index do |_item,i|
moveDefault = i if moveDefault==0 && i[0]==defaultMoveID
GameData::Move.each do |move_data|
commands2.push([move_data.id_number, move_data.name, move_data.id])
end
commands2.sort! { |a, b| a[0] <=> b[0] }
if defaultMoveID
commands2.each_with_index do |_item, i|
moveDefault = i if moveDefault == 0 && i[2] == defaultMoveID
end
end
# Choose from all moves
commands.concat(commands2)
realcommands = []
for command in commands
realcommands.push("#{command[1]}")
end
ret = pbCommands2(cmdwin,realcommands,-1,moveDefault,true)
commands.each { |cmd| realcommands.push(cmd[1]) }
ret = pbCommands2(cmdwin, realcommands, -1, moveDefault, true)
cmdwin.dispose
return (ret>=0) ? commands[ret][0] : 0
return (ret >= 0) ? commands[ret][2] : nil
end
# Displays an alphabetically sorted list of all types, and returns the ID of the
@@ -352,7 +349,7 @@ end
# (or -1 if the selection was canceled). "default", if specified, is the ID of
# the ability to initially select. Pressing Input::A will toggle the list
# sorting between numerical and alphabetical.
def pbChooseAbilityList(default = 0)
def pbChooseAbilityList(default = nil)
commands = []
GameData::Ability.each { |a| commands.push([a.id_number, a.name, a.id]) }
return pbChooseList(commands, default, nil, -1)
@@ -364,7 +361,7 @@ def pbChooseBallList(defaultMoveID = -1)
moveDefault = 0
for key in $BallTypes.keys
item = GameData::Item.try_get($BallTypes[key])
balls.push([key.to_i, item.name]) if item
commands.push([key.to_i, item.name]) if item
end
commands.sort! { |a, b| a[1] <=> b[1] }
if defaultMoveID >= 0