Ball property in trainers.txt can now be a Poké Ball item's ID, fixed move-learning saying "already knows four moves" regardless of the value of Pokemon::MAX_MOVES

This commit is contained in:
Maruno17
2021-05-13 21:50:36 +01:00
parent 52e7f7b51a
commit 8384adeb22
10 changed files with 39 additions and 17 deletions

View File

@@ -71,6 +71,17 @@ class Numeric
def to_s_formatted def to_s_formatted
return self.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\1,').reverse return self.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\1,').reverse
end end
def to_word
ret = [_INTL("zero"), _INTL("one"), _INTL("two"), _INTL("three"),
_INTL("four"), _INTL("five"), _INTL("six"), _INTL("seven"),
_INTL("eight"), _INTL("nine"), _INTL("ten"), _INTL("eleven"),
_INTL("twelve"), _INTL("thirteen"), _INTL("fourteen"), _INTL("fifteen"),
_INTL("sixteen"), _INTL("seventeen"), _INTL("eighteen"), _INTL("nineteen"),
_INTL("twenty")]
return ret[self] if self.is_a?(Integer) && self >= 0 && self <= ret.length
return self.to_s
end
end end
#=============================================================================== #===============================================================================

View File

@@ -29,7 +29,7 @@ module GameData
"Happiness" => [:happiness, "u"], "Happiness" => [:happiness, "u"],
"Shiny" => [:shininess, "b"], "Shiny" => [:shininess, "b"],
"Shadow" => [:shadowness, "b"], "Shadow" => [:shadowness, "b"],
"Ball" => [:poke_ball, "u"], "Ball" => [:poke_ball, "s"],
} }
extend ClassMethods extend ClassMethods
@@ -155,7 +155,7 @@ module GameData
pkmn.update_shadow_moves(true) pkmn.update_shadow_moves(true)
pkmn.shiny = false pkmn.shiny = false
end end
pkmn.poke_ball = pbBallTypeToItem(pkmn_data[:poke_ball]).id if pkmn_data[:poke_ball] pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
pkmn.calc_stats pkmn.calc_stats
end end
return trainer return trainer

View File

@@ -239,7 +239,8 @@ class PokeBattle_Battle
end end
# Pokémon already knows the maximum number of moves; try to forget one to learn the new move # Pokémon already knows the maximum number of moves; try to forget one to learn the new move
loop do loop do
pbDisplayPaused(_INTL("{1} wants to learn {2}, but it already knows four moves.",pkmnName,moveName)) pbDisplayPaused(_INTL("{1} wants to learn {2}, but it already knows {3} moves.",
pkmnName, moveName, pkmn.moves.length.to_word))
if pbDisplayConfirm(_INTL("Forget a move to learn {1}?",moveName)) if pbDisplayConfirm(_INTL("Forget a move to learn {1}?",moveName))
pbDisplayPaused(_INTL("Which move should be forgotten?")) pbDisplayPaused(_INTL("Which move should be forgotten?"))
forgetMove = @scene.pbForgetMove(pkmn,newMove) forgetMove = @scene.pbForgetMove(pkmn,newMove)

View File

@@ -411,7 +411,8 @@ def pbLearnMove(pkmn,move,ignoreifknown=false,bymachine=false,&block)
return true return true
end end
loop do loop do
pbMessage(_INTL("{1} wants to learn {2}, but it already knows four moves.\1",pkmnname,movename),&block) if !bymachine pbMessage(_INTL("{1} wants to learn {2}, but it already knows {3} moves.\1",
pkmnname, movename, pkmn.numMoves.to_word), &block) if !bymachine
pbMessage(_INTL("Please choose a move that will be replaced with {1}.",movename),&block) pbMessage(_INTL("Please choose a move that will be replaced with {1}.",movename),&block)
forgetmove = pbForgetMove(pkmn,move) forgetmove = pbForgetMove(pkmn,move)
if forgetmove>=0 if forgetmove>=0
@@ -421,7 +422,7 @@ def pbLearnMove(pkmn,move,ignoreifknown=false,bymachine=false,&block)
if bymachine && Settings::TAUGHT_MACHINES_KEEP_OLD_PP if bymachine && Settings::TAUGHT_MACHINES_KEEP_OLD_PP
pkmn.moves[forgetmove].pp = [oldmovepp,pkmn.moves[forgetmove].total_pp].min pkmn.moves[forgetmove].pp = [oldmovepp,pkmn.moves[forgetmove].total_pp].min
end end
pbMessage(_INTL("1,\\wt[16] 2, and\\wt[16]...\\wt[16] ...\\wt[16] ... Ta-da!\\se[Battle ball drop]\1"),&block) pbMessage(_INTL("1, 2, and...\\wt[16] ...\\wt[16] ... Ta-da!\\se[Battle ball drop]\1"),&block)
pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1",pkmnname,oldmovename),&block) pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1",pkmnname,oldmovename),&block)
pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]",pkmnname,movename),&block) pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]",pkmnname,movename),&block)
pkmn.changeHappiness("machine") if bymachine pkmn.changeHappiness("machine") if bymachine

View File

@@ -134,7 +134,7 @@ def isBattlePokemonDuplicate(pk, pk2)
end end
moves1.sort! moves1.sort!
moves2.sort! moves2.sort!
# Accept as same if moves are same and there are four moves each # Accept as same if moves are same and there are MAX_MOVES number of moves each
return true if moves1 == moves2 && moves1[Pokemon::MAX_MOVES - 1] return true if moves1 == moves2 && moves1[Pokemon::MAX_MOVES - 1]
same_evs = true same_evs = true
GameData::Stat.each_main { |s| same_evs = false if pk.ev[s.id] != pk2.ev[s.id] } GameData::Stat.each_main { |s| same_evs = false if pk.ev[s.id] != pk2.ev[s.id] }

View File

@@ -206,16 +206,16 @@ def pbChooseAbilityList(default = nil)
return pbChooseList(commands, default, nil, -1) return pbChooseList(commands, default, nil, -1)
end end
def pbChooseBallList(defaultMoveID = -1) def pbChooseBallList(defaultMoveID = nil)
cmdwin = pbListWindow([], 200) cmdwin = pbListWindow([], 200)
commands = [] commands = []
moveDefault = 0 moveDefault = 0
for key in $BallTypes.keys for key in $BallTypes.keys
item = GameData::Item.try_get($BallTypes[key]) item = GameData::Item.try_get($BallTypes[key])
commands.push([key.to_i, item.name]) if item commands.push([$BallTypes[key], item.name]) if item
end end
commands.sort! { |a, b| a[1] <=> b[1] } commands.sort! { |a, b| a[1] <=> b[1] }
if defaultMoveID >= 0 if defaultMoveID
for i in 0...commands.length for i in 0...commands.length
moveDefault = i if commands[i][0] == defaultMoveID moveDefault = i if commands[i][0] == defaultMoveID
end end

View File

@@ -557,8 +557,7 @@ class BallProperty
end end
def set(_settingname,oldsetting) def set(_settingname,oldsetting)
ret = pbChooseBallList((oldsetting) ? oldsetting : -1) return pbChooseBallList(oldsetting)
return (ret>=0) ? ret : (oldsetting) ? oldsetting : nil
end end
def defaultValue def defaultValue
@@ -566,7 +565,7 @@ class BallProperty
end end
def format(value) def format(value)
return (value) ? pbBallTypeToItem(value).name : "-" return (value) ? GameData::Item.get(value).name : "-"
end end
end end

View File

@@ -1222,6 +1222,15 @@ module Compiler
value_hash[s.id] = property_value[s.pbs_order] || property_value[0] value_hash[s.id] = property_value[s.pbs_order] || property_value[0]
end end
current_pkmn[line_schema[0]] = value_hash current_pkmn[line_schema[0]] = value_hash
when "Ball"
if property_value[/^\d+$/]
current_pkmn[line_schema[0]] = pbBallTypeToItem(property_value.to_i).id
elsif !GameData::Item.exists?(property_value.to_sym) ||
!GameData::Item.get(property_value.to_sym).is_poke_ball?
raise _INTL("Value {1} isn't a defined Poké Ball.\r\n{2}", property_value, FileLineData.linereport)
else
current_pkmn[line_schema[0]] = property_value.to_sym
end
else else
current_pkmn[line_schema[0]] = property_value current_pkmn[line_schema[0]] = property_value
end end

View File

@@ -622,7 +622,7 @@ module Compiler
f.write(sprintf(" IV = %s\r\n", ivs_array.join(","))) if pkmn[:iv] f.write(sprintf(" IV = %s\r\n", ivs_array.join(","))) if pkmn[:iv]
f.write(sprintf(" EV = %s\r\n", evs_array.join(","))) if pkmn[:ev] f.write(sprintf(" EV = %s\r\n", evs_array.join(","))) if pkmn[:ev]
f.write(sprintf(" Happiness = %d\r\n", pkmn[:happiness])) if pkmn[:happiness] f.write(sprintf(" Happiness = %d\r\n", pkmn[:happiness])) if pkmn[:happiness]
f.write(sprintf(" Ball = %d\r\n", pkmn[:poke_ball])) if pkmn[:poke_ball] f.write(sprintf(" Ball = %s\r\n", pkmn[:poke_ball])) if pkmn[:poke_ball]
end end
end end
} }

View File

@@ -12,7 +12,7 @@ Pokemon = GEODUDE,12
Gender = male Gender = male
Moves = DEFENSECURL,HEADSMASH,ROCKPOLISH,ROCKTHROW Moves = DEFENSECURL,HEADSMASH,ROCKPOLISH,ROCKTHROW
Ability = 0 Ability = 0
IV = 20 IV = 20,20,20,20,20,20
Pokemon = ONIX,14 Pokemon = ONIX,14
Name = Rocky Name = Rocky
Gender = male Gender = male
@@ -20,8 +20,8 @@ Pokemon = ONIX,14
Moves = HEADSMASH,ROCKTHROW,RAGE,ROCKTOMB Moves = HEADSMASH,ROCKTHROW,RAGE,ROCKTOMB
Ability = 0 Ability = 0
Item = SITRUSBERRY Item = SITRUSBERRY
IV = 20 IV = 20,20,20,20,20,20
Ball = 19 Ball = HEAVYBALL
#------------------------------- #-------------------------------
[TEAMROCKET_M,Grunt,1] [TEAMROCKET_M,Grunt,1]
LoseText = "You're too good for me!" LoseText = "You're too good for me!"
@@ -82,6 +82,7 @@ Pokemon = TURTWIG,19
Pokemon = CHIMCHAR,19 Pokemon = CHIMCHAR,19
#------------------------------- #-------------------------------
[POKEMONTRAINER_Brendan,Brendan] [POKEMONTRAINER_Brendan,Brendan]
LoseText = "..."
Pokemon = MARSHTOMP,19 Pokemon = MARSHTOMP,19
#------------------------------- #-------------------------------
[SWIMMER2_F,Ariel] [SWIMMER2_F,Ariel]