Created setting MAX_PARTY_SIZE, fixed some bugs

This commit is contained in:
Maruno17
2021-01-11 22:44:01 +00:00
parent 53c3f23146
commit f72ce06654
17 changed files with 176 additions and 153 deletions

View File

@@ -50,6 +50,8 @@ MAX_MONEY = 999_999
MAX_COINS = 99_999 MAX_COINS = 99_999
# The maximum length, in characters, that the player's name can be. # The maximum length, in characters, that the player's name can be.
MAX_PLAYER_NAME_SIZE = 10 MAX_PLAYER_NAME_SIZE = 10
# The maximum number of Pokémon that can be in the party.
MAX_PARTY_SIZE = 6
#=============================================================================== #===============================================================================

View File

@@ -116,7 +116,7 @@ module GameData
#=========================================================================== #===========================================================================
def self.egg_icon_filename(species, form) def self.egg_icon_filename(species, form)
ret = self.check_egg_graphic_file("Graphics/Pokemon/Icons", species, form, "_icon") ret = self.check_egg_graphic_file("Graphics/Pokemon/Eggs/", species, form, "_icon")
return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000_icon") return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000_icon")
end end
@@ -198,14 +198,14 @@ module GameData
return nil if species_data.nil? return nil if species_data.nil?
species_id = self.get(species_data.species).id_number species_id = self.get(species_data.species).id_number
if form > 0 if form > 0
ret = sprintf("Cries/%sCry_%d", species_data.species, form) ret = sprintf("Cries/%s_%d", species_data.species, form)
return ret if pbResolveAudioSE(ret) return ret if pbResolveAudioSE(ret)
ret = sprintf("Cries/%03dCry_%d", species_id, form) ret = sprintf("Cries/%03d_%d", species_id, form)
return ret if pbResolveAudioSE(ret) return ret if pbResolveAudioSE(ret)
end end
ret = sprintf("Cries/%sCry", species_data.species) ret = sprintf("Cries/%s", species_data.species)
return ret if pbResolveAudioSE(ret) return ret if pbResolveAudioSE(ret)
ret = sprintf("Cries/%03dCry", species_id) ret = sprintf("Cries/%03d", species_id)
return (pbResolveAudioSE(ret)) ? ret : nil return (pbResolveAudioSE(ret)) ? ret : nil
end end

View File

@@ -5,7 +5,7 @@ module PokeBattle_SceneConstants
MESSAGE_SHADOW_COLOR = Color.new(160, 160, 168) MESSAGE_SHADOW_COLOR = Color.new(160, 160, 168)
# The number of party balls to show in each side's lineup. # The number of party balls to show in each side's lineup.
NUM_BALLS = 6 NUM_BALLS = MAX_PARTY_SIZE
# Centre bottom of the player's side base graphic # Centre bottom of the player's side base graphic
PLAYER_BASE_X = 128 PLAYER_BASE_X = 128

View File

@@ -7,7 +7,7 @@ class PokeBattle_NullBattlePeer
def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false); end def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false); end
def pbStorePokemon(player,pkmn) def pbStorePokemon(player,pkmn)
player.party[player.party.length] = pkmn if player.party.length<6 player.party[player.party.length] = pkmn if player.party.length < MAX_PARTY_SIZE
return -1 return -1
end end
@@ -23,7 +23,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_RealBattlePeer class PokeBattle_RealBattlePeer
def pbStorePokemon(player,pkmn) def pbStorePokemon(player,pkmn)
if player.party.length<6 if player.party.length < MAX_PARTY_SIZE
player.party[player.party.length] = pkmn player.party[player.party.length] = pkmn
return -1 return -1
end end

View File

@@ -65,7 +65,7 @@ end
def pbDayCareWithdraw(index) def pbDayCareWithdraw(index)
if !$PokemonGlobal.daycare[index][0] if !$PokemonGlobal.daycare[index][0]
raise _INTL("There's no Pokémon here...") raise _INTL("There's no Pokémon here...")
elsif $Trainer.party.length>=6 elsif $Trainer.party.length >= MAX_PARTY_SIZE
raise _INTL("Can't store the Pokémon...") raise _INTL("Can't store the Pokémon...")
else else
$Trainer.party[$Trainer.party.length] = $PokemonGlobal.daycare[index][0] $Trainer.party[$Trainer.party.length] = $PokemonGlobal.daycare[index][0]
@@ -154,7 +154,7 @@ end
#=============================================================================== #===============================================================================
def pbDayCareGenerateEgg def pbDayCareGenerateEgg
return if pbDayCareDeposited != 2 return if pbDayCareDeposited != 2
raise _INTL("Can't store the egg.") if $Trainer.party.length >= 6 raise _INTL("Can't store the egg.") if $Trainer.party.length >= MAX_PARTY_SIZE
pkmn0 = $PokemonGlobal.daycare[0][0] pkmn0 = $PokemonGlobal.daycare[0][0]
pkmn1 = $PokemonGlobal.daycare[1][0] pkmn1 = $PokemonGlobal.daycare[1][0]
mother = nil mother = nil

View File

@@ -985,7 +985,7 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
next true next true
end end
# Unfusing # Unfusing
if $Trainer.party.length>=6 if $Trainer.party.length >= MAX_PARTY_SIZE
scene.pbDisplay(_INTL("You have no room to separate the Pokémon.")) scene.pbDisplay(_INTL("You have no room to separate the Pokémon."))
next false next false
end end
@@ -1034,7 +1034,7 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
next true next true
end end
# Unfusing # Unfusing
if $Trainer.party.length>=6 if $Trainer.party.length >= MAX_PARTY_SIZE
scene.pbDisplay(_INTL("You have no room to separate the Pokémon.")) scene.pbDisplay(_INTL("You have no room to separate the Pokémon."))
next false next false
end end
@@ -1083,7 +1083,7 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene|
next true next true
end end
# Unfusing # Unfusing
if $Trainer.party.length>=6 if $Trainer.party.length >= MAX_PARTY_SIZE
scene.pbDisplay(_INTL("You have no room to separate the Pokémon.")) scene.pbDisplay(_INTL("You have no room to separate the Pokémon."))
next false next false
end end

View File

@@ -23,7 +23,7 @@ ItemHandlers::CanUseInBattle.copy(:POKEDOLL,:FLUFFYTAIL,:POKETOY)
ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? }, # Poké Balls ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? }, # Poké Balls
proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
if battle.pbPlayer.party.length>=6 && $PokemonStorage.full? if battle.pbPlayer.party.length >= MAX_PARTY_SIZE && $PokemonStorage.full?
scene.pbDisplay(_INTL("There is no room left in the PC!")) if showMessages scene.pbDisplay(_INTL("There is no room left in the PC!")) if showMessages
next false next false
end end

View File

@@ -452,7 +452,7 @@ PBEvolution.register(:Ninjask, {
PBEvolution.register(:Shedinja, { PBEvolution.register(:Shedinja, {
"parameterType" => nil, "parameterType" => nil,
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if $Trainer.party.length>=6 next false if $Trainer.party.length >= MAX_PARTY_SIZE
next false if !$PokemonBag.pbHasItem?(:POKEBALL) next false if !$PokemonBag.pbHasItem?(:POKEBALL)
PokemonEvolutionScene.pbDuplicatePokemon(pkmn, new_species) PokemonEvolutionScene.pbDuplicatePokemon(pkmn, new_species)
$PokemonBag.pbDeleteItem(:POKEBALL) $PokemonBag.pbDeleteItem(:POKEBALL)

View File

@@ -3,7 +3,11 @@ class PokemonBox
attr_accessor :name attr_accessor :name
attr_accessor :background attr_accessor :background
def initialize(name,maxPokemon=30) BOX_WIDTH = 6
BOX_HEIGHT = 5
BOX_SIZE = BOX_WIDTH * BOX_HEIGHT
def initialize(name, maxPokemon = BOX_SIZE)
@pokemon = [] @pokemon = []
@name = name @name = name
@background = 0 @background = 0
@@ -17,15 +21,17 @@ class PokemonBox
end end
def nitems def nitems
return @pokemon.nitems ret = 0
@pokemon.each { |pkmn| ret += 1 if !pkmn.nil? }
return ret
end end
def full? def full?
return (@pokemon.nitems==self.length) return nitems == self.length
end end
def empty? def empty?
return (@pokemon.nitems==0) return nitems == 0
end end
def [](i) def [](i)
@@ -53,7 +59,7 @@ class PokemonStorage
attr_writer :unlockedWallpapers attr_writer :unlockedWallpapers
BASICWALLPAPERQTY = 16 BASICWALLPAPERQTY = 16
def initialize(maxBoxes=NUM_STORAGE_BOXES,maxPokemon=30) def initialize(maxBoxes = NUM_STORAGE_BOXES, maxPokemon = PokemonBox::BOX_SIZE)
@boxes = [] @boxes = []
for i in 0...maxBoxes for i in 0...maxBoxes
@boxes[i] = PokemonBox.new(_INTL("Box {1}",i+1),maxPokemon) @boxes[i] = PokemonBox.new(_INTL("Box {1}",i+1),maxPokemon)
@@ -120,8 +126,8 @@ class PokemonStorage
end end
def maxPokemon(box) def maxPokemon(box)
return 0 if box>=self.maxBoxes return 0 if box >= self.maxBoxes
return (box<0) ? 6 : self[box].length return (box < 0) ? MAX_PARTY_SIZE : self[box].length
end end
def full? def full?
@@ -133,14 +139,13 @@ class PokemonStorage
def pbFirstFreePos(box) def pbFirstFreePos(box)
if box==-1 if box==-1
ret = self.party.nitems ret = self.party.length
return (ret==6) ? -1 : ret return (ret >= MAX_PARTY_SIZE) ? -1 : ret
else
for i in 0...maxPokemon(box)
return i if !self[box,i]
end
return -1
end end
for i in 0...maxPokemon(box)
return i if !self[box,i]
end
return -1
end end
def [](x,y=nil) def [](x,y=nil)
@@ -174,7 +179,7 @@ class PokemonStorage
return false if !found return false if !found
end end
if boxDst==-1 # Copying into party if boxDst==-1 # Copying into party
return false if self.party.nitems>=6 return false if self.party.length >= MAX_PARTY_SIZE
self.party[self.party.length] = self[boxSrc,indexSrc] self.party[self.party.length] = self[boxSrc,indexSrc]
self.party.compact! self.party.compact!
else # Copying into box else # Copying into box
@@ -195,7 +200,7 @@ class PokemonStorage
end end
def pbMoveCaughtToParty(pkmn) def pbMoveCaughtToParty(pkmn)
return false if self.party.nitems>=6 return false if self.party.length >= MAX_PARTY_SIZE
self.party[self.party.length] = pkmn self.party[self.party.length] = pkmn
end end

View File

@@ -139,8 +139,8 @@ class PokemonPartyBlankPanel < SpriteWrapper
def initialize(_pokemon,index,viewport=nil) def initialize(_pokemon,index,viewport=nil)
super(viewport) super(viewport)
self.x = [0, Graphics.width/2][index%2] self.x = (index % 2) * Graphics.width / 2
self.y = [0, 16, 96, 112, 192, 208][index] self.y = 16 * (index % 2) + 96 * (index / 2)
@panelbgsprite = AnimatedBitmap.new("Graphics/Pictures/Party/panel_blank") @panelbgsprite = AnimatedBitmap.new("Graphics/Pictures/Party/panel_blank")
self.bitmap = @panelbgsprite.bitmap self.bitmap = @panelbgsprite.bitmap
@text = nil @text = nil
@@ -176,8 +176,8 @@ class PokemonPartyPanel < SpriteWrapper
@pokemon = pokemon @pokemon = pokemon
@active = (index==0) # true = rounded panel, false = rectangular panel @active = (index==0) # true = rounded panel, false = rectangular panel
@refreshing = true @refreshing = true
self.x = [0, Graphics.width/2][index%2] self.x = (index % 2) * Graphics.width / 2
self.y = [0, 16, 96, 112, 192, 208][index] self.y = 16 * (index % 2) + 96 * (index / 2)
@panelbgsprite = ChangelingSprite.new(0,0,viewport) @panelbgsprite = ChangelingSprite.new(0,0,viewport)
@panelbgsprite.z = self.z @panelbgsprite.z = self.z
if @active # Rounded panel if @active # Rounded panel
@@ -448,7 +448,7 @@ class PokemonParty_Scene
pbBottomLeftLines(@sprites["helpwindow"],1) pbBottomLeftLines(@sprites["helpwindow"],1)
pbSetHelpText(starthelptext) pbSetHelpText(starthelptext)
# Add party Pokémon sprites # Add party Pokémon sprites
for i in 0...6 for i in 0...MAX_PARTY_SIZE
if @party[i] if @party[i]
@sprites["pokemon#{i}"] = PokemonPartyPanel.new(@party[i],i,@viewport) @sprites["pokemon#{i}"] = PokemonPartyPanel.new(@party[i],i,@viewport)
else else
@@ -457,10 +457,10 @@ class PokemonParty_Scene
@sprites["pokemon#{i}"].text = annotations[i] if annotations @sprites["pokemon#{i}"].text = annotations[i] if annotations
end end
if @multiselect if @multiselect
@sprites["pokemon6"] = PokemonPartyConfirmSprite.new(@viewport) @sprites["pokemon#{MAX_PARTY_SIZE}"] = PokemonPartyConfirmSprite.new(@viewport)
@sprites["pokemon7"] = PokemonPartyCancelSprite2.new(@viewport) @sprites["pokemon#{MAX_PARTY_SIZE + 1}"] = PokemonPartyCancelSprite2.new(@viewport)
else else
@sprites["pokemon6"] = PokemonPartyCancelSprite.new(@viewport) @sprites["pokemon#{MAX_PARTY_SIZE}"] = PokemonPartyCancelSprite.new(@viewport)
end end
# Select first Pokémon # Select first Pokémon
@activecmd = 0 @activecmd = 0
@@ -573,14 +573,14 @@ class PokemonParty_Scene
end end
def pbAnnotate(annot) def pbAnnotate(annot)
for i in 0...6 for i in 0...MAX_PARTY_SIZE
@sprites["pokemon#{i}"].text = (annot) ? annot[i] : nil @sprites["pokemon#{i}"].text = (annot) ? annot[i] : nil
end end
end end
def pbSelect(item) def pbSelect(item)
@activecmd = item @activecmd = item
numsprites = (@multiselect) ? 8 : 7 numsprites = MAX_PARTY_SIZE + ((@multiselect) ? 2 : 1)
for i in 0...numsprites for i in 0...numsprites
@sprites["pokemon#{i}"].selected = (i==@activecmd) @sprites["pokemon#{i}"].selected = (i==@activecmd)
end end
@@ -620,7 +620,7 @@ class PokemonParty_Scene
Input.update Input.update
self.update self.update
end end
for i in 0...6 for i in 0...MAX_PARTY_SIZE
@sprites["pokemon#{i}"].preselected = false @sprites["pokemon#{i}"].preselected = false
@sprites["pokemon#{i}"].switching = false @sprites["pokemon#{i}"].switching = false
end end
@@ -628,7 +628,7 @@ class PokemonParty_Scene
end end
def pbClearSwitching def pbClearSwitching
for i in 0...6 for i in 0...MAX_PARTY_SIZE
@sprites["pokemon#{i}"].preselected = false @sprites["pokemon#{i}"].preselected = false
@sprites["pokemon#{i}"].switching = false @sprites["pokemon#{i}"].switching = false
end end
@@ -674,7 +674,7 @@ class PokemonParty_Scene
end end
def pbChoosePokemon(switching=false,initialsel=-1,canswitch=0) def pbChoosePokemon(switching=false,initialsel=-1,canswitch=0)
for i in 0...6 for i in 0...MAX_PARTY_SIZE
@sprites["pokemon#{i}"].preselected = (switching && i==@activecmd) @sprites["pokemon#{i}"].preselected = (switching && i==@activecmd)
@sprites["pokemon#{i}"].switching = switching @sprites["pokemon#{i}"].switching = switching
end end
@@ -695,12 +695,12 @@ class PokemonParty_Scene
end end
if @activecmd!=oldsel # Changing selection if @activecmd!=oldsel # Changing selection
pbPlayCursorSE pbPlayCursorSE
numsprites = (@multiselect) ? 8 : 7 numsprites = MAX_PARTY_SIZE + ((@multiselect) ? 2 : 1)
for i in 0...numsprites for i in 0...numsprites
@sprites["pokemon#{i}"].selected = (i==@activecmd) @sprites["pokemon#{i}"].selected = (i==@activecmd)
end end
end end
cancelsprite = (@multiselect) ? 7 : 6 cancelsprite = MAX_PARTY_SIZE + ((@multiselect) ? 1 : 0)
if Input.trigger?(Input::A) && canswitch==1 && @activecmd!=cancelsprite if Input.trigger?(Input::A) && canswitch==1 && @activecmd!=cancelsprite
pbPlayDecisionSE pbPlayDecisionSE
return [1,@activecmd] return [1,@activecmd]
@@ -722,49 +722,49 @@ class PokemonParty_Scene
end end
def pbChangeSelection(key,currentsel) def pbChangeSelection(key,currentsel)
numsprites = (@multiselect) ? 8 : 7 numsprites = MAX_PARTY_SIZE + ((@multiselect) ? 2 : 1)
case key case key
when Input::LEFT when Input::LEFT
begin begin
currentsel -= 1 currentsel -= 1
end while currentsel>0 && currentsel<@party.length && !@party[currentsel] end while currentsel > 0 && currentsel < @party.length && !@party[currentsel]
if currentsel>=@party.length && currentsel<6 if currentsel >= @party.length && currentsel < MAX_PARTY_SIZE
currentsel = @party.length-1 currentsel = @party.length - 1
end end
currentsel = numsprites-1 if currentsel<0 currentsel = numsprites - 1 if currentsel < 0
when Input::RIGHT when Input::RIGHT
begin begin
currentsel += 1 currentsel += 1
end while currentsel<@party.length && !@party[currentsel] end while currentsel < @party.length && !@party[currentsel]
if currentsel==@party.length if currentsel == @party.length
currentsel = 6 currentsel = MAX_PARTY_SIZE
elsif currentsel==numsprites elsif currentsel == numsprites
currentsel = 0 currentsel = 0
end end
when Input::UP when Input::UP
if currentsel>=6 if currentsel >= MAX_PARTY_SIZE
begin begin
currentsel -= 1 currentsel -= 1
end while currentsel>0 && !@party[currentsel] end while currentsel > 0 && !@party[currentsel]
else else
begin begin
currentsel -= 2 currentsel -= 2
end while currentsel>0 && !@party[currentsel] end while currentsel > 0 && !@party[currentsel]
end end
if currentsel>=@party.length && currentsel<6 if currentsel >= @party.length && currentsel < MAX_PARTY_SIZE
currentsel = @party.length-1 currentsel = @party.length-1
end end
currentsel = numsprites-1 if currentsel<0 currentsel = numsprites - 1 if currentsel < 0
when Input::DOWN when Input::DOWN
if currentsel>=5 if currentsel >= MAX_PARTY_SIZE - 1
currentsel += 1 currentsel += 1
else else
currentsel += 2 currentsel += 2
currentsel = 6 if currentsel<6 && !@party[currentsel] currentsel = MAX_PARTY_SIZE if currentsel < MAX_PARTY_SIZE && !@party[currentsel]
end end
if currentsel>=@party.length && currentsel<6 if currentsel >= @party.length && currentsel < MAX_PARTY_SIZE
currentsel = 6 currentsel = MAX_PARTY_SIZE
elsif currentsel>=numsprites elsif currentsel >= numsprites
currentsel = 0 currentsel = 0
end end
end end
@@ -774,14 +774,14 @@ class PokemonParty_Scene
def pbHardRefresh def pbHardRefresh
oldtext = [] oldtext = []
lastselected = -1 lastselected = -1
for i in 0...6 for i in 0...MAX_PARTY_SIZE
oldtext.push(@sprites["pokemon#{i}"].text) oldtext.push(@sprites["pokemon#{i}"].text)
lastselected = i if @sprites["pokemon#{i}"].selected lastselected = i if @sprites["pokemon#{i}"].selected
@sprites["pokemon#{i}"].dispose @sprites["pokemon#{i}"].dispose
end end
lastselected = @party.length-1 if lastselected>=@party.length lastselected = @party.length-1 if lastselected>=@party.length
lastselected = 0 if lastselected<0 lastselected = 0 if lastselected<0
for i in 0...6 for i in 0...MAX_PARTY_SIZE
if @party[i] if @party[i]
@sprites["pokemon#{i}"] = PokemonPartyPanel.new(@party[i],i,@viewport) @sprites["pokemon#{i}"] = PokemonPartyPanel.new(@party[i],i,@viewport)
else else
@@ -793,7 +793,7 @@ class PokemonParty_Scene
end end
def pbRefresh def pbRefresh
for i in 0...6 for i in 0...MAX_PARTY_SIZE
sprite = @sprites["pokemon#{i}"] sprite = @sprites["pokemon#{i}"]
if sprite if sprite
if sprite.is_a?(PokemonPartyPanel) if sprite.is_a?(PokemonPartyPanel)
@@ -967,17 +967,17 @@ class PokemonPartyScreen
def pbPokemonMultipleEntryScreenEx(ruleset) def pbPokemonMultipleEntryScreenEx(ruleset)
annot = [] annot = []
statuses = [] statuses = []
ordinals = [ ordinals = [_INTL("INELIGIBLE"), _INTL("NOT ENTERED"), _INTL("BANNED")]
_INTL("INELIGIBLE"), positions = [_INTL("FIRST"), _INTL("SECOND"), _INTL("THIRD"), _INTL("FOURTH"),
_INTL("NOT ENTERED"), _INTL("FIFTH"), _INTL("SIXTH"), _INTL("SEVENTH"), _INTL("EIGHTH"),
_INTL("BANNED"), _INTL("NINTH"), _INTL("TENTH"), _INTL("ELEVENTH"), _INTL("TWELFTH")]
_INTL("FIRST"), for i in 0...MAX_PARTY_SIZE
_INTL("SECOND"), if i < positions.length
_INTL("THIRD"), ordinals.push(positions[i])
_INTL("FOURTH"), else
_INTL("FIFTH"), ordinals.push("#{i + 1}th")
_INTL("SIXTH") end
] end
return nil if !ruleset.hasValidTeam?(@party) return nil if !ruleset.hasValidTeam?(@party)
ret = nil ret = nil
addedEntry = false addedEntry = false
@@ -1006,12 +1006,12 @@ class PokemonPartyScreen
end end
@scene.pbAnnotate(annot) @scene.pbAnnotate(annot)
if realorder.length==ruleset.number && addedEntry if realorder.length==ruleset.number && addedEntry
@scene.pbSelect(6) @scene.pbSelect(MAX_PARTY_SIZE)
end end
@scene.pbSetHelpText(_INTL("Choose Pokémon and confirm.")) @scene.pbSetHelpText(_INTL("Choose Pokémon and confirm."))
pkmnid = @scene.pbChoosePokemon pkmnid = @scene.pbChoosePokemon
addedEntry = false addedEntry = false
if pkmnid==6 # Confirm was chosen if pkmnid == MAX_PARTY_SIZE # Confirm was chosen
ret = [] ret = []
for i in realorder; ret.push(@party[i]); end for i in realorder; ret.push(@party[i]); end
error = [] error = []

View File

@@ -291,6 +291,7 @@ end
class PokemonBoxSprite < SpriteWrapper class PokemonBoxSprite < SpriteWrapper
attr_accessor :refreshBox attr_accessor :refreshBox
attr_accessor :refreshSprites attr_accessor :refreshSprites
def initialize(storage,boxnumber,viewport=nil) def initialize(storage,boxnumber,viewport=nil)
super(viewport) super(viewport)
@storage = storage @storage = storage
@@ -298,7 +299,7 @@ class PokemonBoxSprite < SpriteWrapper
@refreshBox = true @refreshBox = true
@refreshSprites = true @refreshSprites = true
@pokemonsprites = [] @pokemonsprites = []
for i in 0...30 for i in 0...PokemonBox::BOX_SIZE
@pokemonsprites[i] = nil @pokemonsprites[i] = nil
pokemon = @storage[boxnumber,i] pokemon = @storage[boxnumber,i]
@pokemonsprites[i] = PokemonBoxIcon.new(pokemon,viewport) @pokemonsprites[i] = PokemonBoxIcon.new(pokemon,viewport)
@@ -312,7 +313,7 @@ class PokemonBoxSprite < SpriteWrapper
def dispose def dispose
if !disposed? if !disposed?
for i in 0...30 for i in 0...PokemonBox::BOX_SIZE
@pokemonsprites[i].dispose if @pokemonsprites[i] @pokemonsprites[i].dispose if @pokemonsprites[i]
@pokemonsprites[i] = nil @pokemonsprites[i] = nil
end end
@@ -335,7 +336,7 @@ class PokemonBoxSprite < SpriteWrapper
def color=(value) def color=(value)
super super
if @refreshSprites if @refreshSprites
for i in 0...30 for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed? if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].color = value @pokemonsprites[i].color = value
end end
@@ -346,7 +347,7 @@ class PokemonBoxSprite < SpriteWrapper
def visible=(value) def visible=(value)
super super
for i in 0...30 for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed? if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].visible = value @pokemonsprites[i].visible = value
end end
@@ -413,10 +414,10 @@ class PokemonBoxSprite < SpriteWrapper
@refreshBox = false @refreshBox = false
end end
yval = self.y+30 yval = self.y+30
for j in 0...5 for j in 0...PokemonBox::BOX_HEIGHT
xval = self.x+10 xval = self.x+10
for k in 0...6 for k in 0...PokemonBox::BOX_WIDTH
sprite = @pokemonsprites[j*6+k] sprite = @pokemonsprites[j * PokemonBox::BOX_WIDTH + k]
if sprite && !sprite.disposed? if sprite && !sprite.disposed?
sprite.viewport = self.viewport sprite.viewport = self.viewport
sprite.x = xval sprite.x = xval
@@ -431,7 +432,7 @@ class PokemonBoxSprite < SpriteWrapper
def update def update
super super
for i in 0...30 for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed? if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].update @pokemonsprites[i].update
end end
@@ -448,7 +449,7 @@ class PokemonBoxPartySprite < SpriteWrapper
@party = party @party = party
@boxbitmap = AnimatedBitmap.new("Graphics/Pictures/Storage/overlay_party") @boxbitmap = AnimatedBitmap.new("Graphics/Pictures/Storage/overlay_party")
@pokemonsprites = [] @pokemonsprites = []
for i in 0...6 for i in 0...MAX_PARTY_SIZE
@pokemonsprites[i] = nil @pokemonsprites[i] = nil
pokemon = @party[i] pokemon = @party[i]
if pokemon if pokemon
@@ -464,7 +465,7 @@ class PokemonBoxPartySprite < SpriteWrapper
end end
def dispose def dispose
for i in 0...6 for i in 0...MAX_PARTY_SIZE
@pokemonsprites[i].dispose if @pokemonsprites[i] @pokemonsprites[i].dispose if @pokemonsprites[i]
end end
@boxbitmap.dispose @boxbitmap.dispose
@@ -484,7 +485,7 @@ class PokemonBoxPartySprite < SpriteWrapper
def color=(value) def color=(value)
super super
for i in 0...6 for i in 0...MAX_PARTY_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed? if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].color = pbSrcOver(@pokemonsprites[i].color,value) @pokemonsprites[i].color = pbSrcOver(@pokemonsprites[i].color,value)
end end
@@ -493,7 +494,7 @@ class PokemonBoxPartySprite < SpriteWrapper
def visible=(value) def visible=(value)
super super
for i in 0...6 for i in 0...MAX_PARTY_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed? if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].visible = value @pokemonsprites[i].visible = value
end end
@@ -528,23 +529,26 @@ class PokemonBoxPartySprite < SpriteWrapper
end end
def refresh def refresh
@contents.blt(0,0,@boxbitmap.bitmap,Rect.new(0,0,172,352)) @contents.blt(0, 0, @boxbitmap.bitmap, Rect.new(0, 0, 172, 352))
pbDrawTextPositions(self.bitmap,[ pbDrawTextPositions(self.bitmap,[
[_INTL("Back"),86,240,2,Color.new(248,248,248),Color.new(80,80,80),1] [_INTL("Back"), 86, 240, 2, Color.new(248, 248, 248), Color.new(80, 80, 80), 1]
]) ])
xvalues = [] # [18, 90, 18, 90, 18, 90]
xvalues = [18,90,18,90,18,90] yvalues = [] # [2, 18, 66, 82, 130, 146]
yvalues = [2,18,66,82,130,146] for i in 0...MAX_PARTY_SIZE
for j in 0...6 xvalues.push(18 + 72 * (i % 2))
yvalues.push(2 + 16 * (i % 2) + 64 * (i / 2))
end
for j in 0...MAX_PARTY_SIZE
@pokemonsprites[j] = nil if @pokemonsprites[j] && @pokemonsprites[j].disposed? @pokemonsprites[j] = nil if @pokemonsprites[j] && @pokemonsprites[j].disposed?
end end
@pokemonsprites.compact! @pokemonsprites.compact!
for j in 0...6 for j in 0...MAX_PARTY_SIZE
sprite = @pokemonsprites[j] sprite = @pokemonsprites[j]
if sprite && !sprite.disposed? if sprite && !sprite.disposed?
sprite.viewport = self.viewport sprite.viewport = self.viewport
sprite.x = self.x+xvalues[j] sprite.x = self.x + xvalues[j]
sprite.y = self.y+yvalues[j] sprite.y = self.y + yvalues[j]
sprite.z = 0 sprite.z = 0
end end
end end
@@ -552,7 +556,7 @@ class PokemonBoxPartySprite < SpriteWrapper
def update def update
super super
for i in 0...6 for i in 0...MAX_PARTY_SIZE
@pokemonsprites[i].update if @pokemonsprites[i] && !@pokemonsprites[i].disposed? @pokemonsprites[i].update if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
end end
end end
@@ -702,8 +706,8 @@ class PokemonStorageScene
arrow.x = 207*2 arrow.x = 207*2
arrow.y = 139*2 arrow.y = 139*2
else else
arrow.x = (97+24*(selection%6))*2 arrow.x = (97 + 24 * (selection % PokemonBox::BOX_WIDTH)) * 2
arrow.y = (8+24*(selection/6))*2 arrow.y = (8 + 24 * (selection / PokemonBox::BOX_WIDTH)) * 2
end end
end end
@@ -713,24 +717,29 @@ class PokemonStorageScene
if selection==-1 # Box name if selection==-1 # Box name
selection = -2 selection = -2
elsif selection==-2 # Party elsif selection==-2 # Party
selection = 25 selection = PokemonBox::BOX_SIZE - 1 - PokemonBox::BOX_WIDTH * 2 / 3 # 25
elsif selection==-3 # Close Box elsif selection==-3 # Close Box
selection = 28 selection = PokemonBox::BOX_SIZE - PokemonBox::BOX_WIDTH / 3 # 28
else else
selection -= 6 selection -= PokemonBox::BOX_WIDTH
selection = -1 if selection<0 selection = -1 if selection < 0
end end
when Input::DOWN when Input::DOWN
if selection==-1 # Box name if selection==-1 # Box name
selection = 2 selection = PokemonBox::BOX_WIDTH / 3 # 2
elsif selection==-2 # Party elsif selection==-2 # Party
selection = -1 selection = -1
elsif selection==-3 # Close Box elsif selection==-3 # Close Box
selection = -1 selection = -1
else else
selection += 6 selection += PokemonBox::BOX_WIDTH
selection = -2 if selection==30 || selection==31 || selection==32 if selection >= PokemonBox::BOX_SIZE
selection = -3 if selection==33 || selection==34 || selection==35 if selection < PokemonBox::BOX_SIZE + PokemonBox::BOX_WIDTH / 2
selection = -2 # Party
else
selection = -3 # Close Box
end
end
end end
when Input::LEFT when Input::LEFT
if selection==-1 # Box name if selection==-1 # Box name
@@ -739,9 +748,10 @@ class PokemonStorageScene
selection = -3 selection = -3
elsif selection==-3 elsif selection==-3
selection = -2 selection = -2
elsif (selection % PokemonBox::BOX_WIDTH) == 0 # Wrap around
selection += PokemonBox::BOX_WIDTH - 1
else else
selection -= 1 selection -= 1
selection += 6 if selection==-1 || selection%6==5
end end
when Input::RIGHT when Input::RIGHT
if selection==-1 # Box name if selection==-1 # Box name
@@ -750,48 +760,54 @@ class PokemonStorageScene
selection = -3 selection = -3
elsif selection==-3 elsif selection==-3
selection = -2 selection = -2
elsif (selection % PokemonBox::BOX_WIDTH) == PokemonBox::BOX_WIDTH - 1 # Wrap around
selection -= PokemonBox::BOX_WIDTH - 1
else else
selection += 1 selection += 1
selection -= 6 if selection%6==0
end end
end end
return selection return selection
end end
def pbPartySetArrow(arrow,selection) def pbPartySetArrow(arrow,selection)
if selection>=0 return if selection < 0
xvalues = [100,136,100,136,100,136,118] xvalues = [] # [200, 272, 200, 272, 200, 272, 236]
yvalues = [1,9,33,41,65,73,110] yvalues = [] # [2, 18, 66, 82, 130, 146, 220]
arrow.angle = 0 for i in 0...MAX_PARTY_SIZE
arrow.mirror = false xvalues.push(200 + 72 * (i % 2))
arrow.ox = 0 yvalues.push(2 + 16 * (i % 2) + 64 * (i / 2))
arrow.oy = 0
arrow.x = xvalues[selection]*2
arrow.y = yvalues[selection]*2
end end
xvalues.push(236)
yvalues.push(220)
arrow.angle = 0
arrow.mirror = false
arrow.ox = 0
arrow.oy = 0
arrow.x = xvalues[selection]
arrow.y = yvalues[selection]
end end
def pbPartyChangeSelection(key,selection) def pbPartyChangeSelection(key,selection)
case key case key
when Input::LEFT when Input::LEFT
selection -= 1 selection -= 1
selection = 6 if selection<0 selection = MAX_PARTY_SIZE if selection < 0
when Input::RIGHT when Input::RIGHT
selection += 1 selection += 1
selection = 0 if selection>6 selection = 0 if selection > MAX_PARTY_SIZE
when Input::UP when Input::UP
if selection==6 if selection == MAX_PARTY_SIZE
selection = 5 selection = MAX_PARTY_SIZE - 1
else else
selection -= 2 selection -= 2
selection = 6 if selection<0 selection = MAX_PARTY_SIZE if selection < 0
end end
when Input::DOWN when Input::DOWN
if selection==6 if selection == MAX_PARTY_SIZE
selection = 0 selection = 0
else else
selection += 2 selection += 2
selection = 6 if selection>6 selection = MAX_PARTY_SIZE if selection > MAX_PARTY_SIZE
end end
end end
return selection return selection
@@ -929,17 +945,17 @@ class PokemonStorageScene
pbSetMosaic(selection) pbSetMosaic(selection)
end end
self.update self.update
if Input.trigger?(Input::A) && @command==0 # Organize only if Input.trigger?(Input::A) && @command == 0 # Organize only
pbPlayDecisionSE pbPlayDecisionSE
pbSetQuickSwap(!@quickswap) pbSetQuickSwap(!@quickswap)
elsif Input.trigger?(Input::B) elsif Input.trigger?(Input::B)
@selection = selection @selection = selection
return -1 return -1
elsif Input.trigger?(Input::C) elsif Input.trigger?(Input::C)
if selection>=0 && selection<6 if selection >= 0 && selection < MAX_PARTY_SIZE
@selection = selection @selection = selection
return selection return selection
elsif selection==6 # Close Box elsif selection == MAX_PARTY_SIZE # Close Box
@selection = selection @selection = selection
return (depositing) ? -3 : -1 return (depositing) ? -3 : -1
end end
@@ -1665,7 +1681,7 @@ class PokemonStorageScreen
if box==-1 if box==-1
raise _INTL("Can't withdraw from party..."); raise _INTL("Can't withdraw from party...");
end end
if @storage.party.nitems>=6 if @storage.party.length >= MAX_PARTY_SIZE
pbDisplay(_INTL("Your party's full!")) pbDisplay(_INTL("Your party's full!"))
return false return false
end end

View File

@@ -48,7 +48,7 @@ class StorageSystemPC
) )
if command>=0 && command<3 if command>=0 && command<3
if command==1 # Withdraw if command==1 # Withdraw
if $PokemonStorage.party.length>=6 if $PokemonStorage.party.length >= MAX_PARTY_SIZE
pbMessage(_INTL("Your party is full!")) pbMessage(_INTL("Your party is full!"))
next next
end end

View File

@@ -868,7 +868,7 @@ def pbBattleFactoryPokemon(rule,numwins,numswaps,_rentals)
party=[] party=[]
loop do loop do
party.clear party.clear
while party.length<6 while party.length < MAX_PARTY_SIZE
rnd=pokemonNumbers[0]+rand(pokemonNumbers[1]-pokemonNumbers[0]+1) rnd=pokemonNumbers[0]+rand(pokemonNumbers[1]-pokemonNumbers[0]+1)
rndpoke=btpokemon[rnd] rndpoke=btpokemon[rnd]
indvalue=(party.length<ivgroups[0]) ? ivs[0] : ivs[1] indvalue=(party.length<ivgroups[0]) ? ivs[0] : ivs[1]

View File

@@ -995,8 +995,8 @@ def pbTrainerInfo(pokemonlist,trfile,rules)
end end
end end
numbers|=[] numbers|=[]
if (numbers.length<6 || if numbers.length < MAX_PARTY_SIZE ||
!rulesetTeam.hasValidTeam?(numbersPokemon)) !rulesetTeam.hasValidTeam?(numbersPokemon)
for index in 0...pokemonlist.length for index in 0...pokemonlist.length
pkmn=pokemonlist[index] pkmn=pokemonlist[index]
next if !validities[index] next if !validities[index]
@@ -1013,11 +1013,11 @@ def pbTrainerInfo(pokemonlist,trfile,rules)
end end
} }
end end
break if numbers.length>=6 && rules.ruleset.hasValidTeam?(numbersPokemon) break if numbers.length >= MAX_PARTY_SIZE && rules.ruleset.hasValidTeam?(numbersPokemon)
end end
if numbers.length<6 || !rules.ruleset.hasValidTeam?(numbersPokemon) if numbers.length < MAX_PARTY_SIZE || !rules.ruleset.hasValidTeam?(numbersPokemon)
while numbers.length<pokemonlist.length && while numbers.length<pokemonlist.length &&
(numbers.length<6 || !rules.ruleset.hasValidTeam?(numbersPokemon)) (numbers.length < MAX_PARTY_SIZE || !rules.ruleset.hasValidTeam?(numbersPokemon))
index=rand(pokemonlist.length) index=rand(pokemonlist.length)
if !numbers.include?(index) if !numbers.include?(index)
numbers.push(index) numbers.push(index)

View File

@@ -2,7 +2,7 @@
# Nicknaming and storing Pokémon # Nicknaming and storing Pokémon
#=============================================================================== #===============================================================================
def pbBoxesFull? def pbBoxesFull?
return ($Trainer.party.length == 6 && $PokemonStorage.full?) return ($Trainer.party.length >= MAX_PARTY_SIZE && $PokemonStorage.full?)
end end
def pbNickname(pkmn) def pbNickname(pkmn)
@@ -21,7 +21,7 @@ def pbStorePokemon(pkmn)
return return
end end
pkmn.pbRecordFirstMoves pkmn.pbRecordFirstMoves
if $Trainer.party.length < 6 if $Trainer.party.length < MAX_PARTY_SIZE
$Trainer.party[$Trainer.party.length] = pkmn $Trainer.party[$Trainer.party.length] = pkmn
else else
oldcurbox = $PokemonStorage.currentBox oldcurbox = $PokemonStorage.currentBox
@@ -85,7 +85,7 @@ def pbAddPokemonSilent(pkmn, level = 1, see_form = true)
$Trainer.owned[pkmn.species] = true $Trainer.owned[pkmn.species] = true
pbSeenForm(pkmn) if see_form pbSeenForm(pkmn) if see_form
pkmn.pbRecordFirstMoves pkmn.pbRecordFirstMoves
if $Trainer.party.length < 6 if $Trainer.party.length < MAX_PARTY_SIZE
$Trainer.party[$Trainer.party.length] = pkmn $Trainer.party[$Trainer.party.length] = pkmn
else else
$PokemonStorage.pbStoreCaught(pkmn) $PokemonStorage.pbStoreCaught(pkmn)
@@ -97,7 +97,7 @@ end
# Giving Pokémon/eggs to the player (can only add to party) # Giving Pokémon/eggs to the player (can only add to party)
#=============================================================================== #===============================================================================
def pbAddToParty(pkmn, level = 1, see_form = true) def pbAddToParty(pkmn, level = 1, see_form = true)
return false if !pkmn || $Trainer.party.length >= 6 return false if !pkmn || $Trainer.party.length >= MAX_PARTY_SIZE
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon) pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
species_name = pkmn.speciesName species_name = pkmn.speciesName
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name)) pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name))
@@ -107,7 +107,7 @@ def pbAddToParty(pkmn, level = 1, see_form = true)
end end
def pbAddToPartySilent(pkmn, level = nil, see_form = true) def pbAddToPartySilent(pkmn, level = nil, see_form = true)
return false if !pkmn || $Trainer.party.length >= 6 return false if !pkmn || $Trainer.party.length >= MAX_PARTY_SIZE
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon) pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
$Trainer.seen[pkmn.species] = true $Trainer.seen[pkmn.species] = true
$Trainer.owned[pkmn.species] = true $Trainer.owned[pkmn.species] = true
@@ -118,7 +118,7 @@ def pbAddToPartySilent(pkmn, level = nil, see_form = true)
end end
def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner_gender = 0, see_form = true) def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner_gender = 0, see_form = true)
return false if !pkmn || $Trainer.party.length>=6 return false if !pkmn || $Trainer.party.length >= MAX_PARTY_SIZE
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon) pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
# Set original trainer to a foreign one # Set original trainer to a foreign one
pkmn.owner = Pokemon::Owner.new_foreign(owner_name || "", owner_gender) pkmn.owner = Pokemon::Owner.new_foreign(owner_name || "", owner_gender)
@@ -139,7 +139,7 @@ def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner
end end
def pbGenerateEgg(pkmn, text = "") def pbGenerateEgg(pkmn, text = "")
return false if !pkmn || $Trainer.party.length >= 6 return false if !pkmn || $Trainer.party.length >= MAX_PARTY_SIZE
pkmn = Pokemon.new(pkmn, EGG_LEVEL) if !pkmn.is_a?(Pokemon) pkmn = Pokemon.new(pkmn, EGG_LEVEL) if !pkmn.is_a?(Pokemon)
# Set egg's details # Set egg's details
pkmn.name = _INTL("Egg") pkmn.name = _INTL("Egg")

View File

@@ -605,7 +605,7 @@ DebugMenuCommands.register("fillboxes", {
else # Both male and female else # Both male and female
$Trainer.formseen[sp][0][f] = true $Trainer.formseen[sp][0][f] = true
$Trainer.formseen[sp][1][f] = true $Trainer.formseen[sp][1][f] = true
$Trainer.formlastseen[i] = [0, f] if f == 0 $Trainer.formlastseen[sp] = [0, f] if f == 0
end end
elsif species_data.real_form_name && !species_data.real_form_name.empty? elsif species_data.real_form_name && !species_data.real_form_name.empty?
g = (species_data.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0 g = (species_data.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0

View File

@@ -291,7 +291,7 @@ def pbDebugDayCare
when 0 # Withdraw Pokémon 1 when 0 # Withdraw Pokémon 1
if !$PokemonGlobal.daycare[0][0] if !$PokemonGlobal.daycare[0][0]
pbPlayBuzzerSE pbPlayBuzzerSE
elsif $Trainer.party.length>=6 elsif $Trainer.party.length >= MAX_PARTY_SIZE
pbPlayBuzzerSE pbPlayBuzzerSE
pbMessage(_INTL("Party is full, can't withdraw Pokémon.")) pbMessage(_INTL("Party is full, can't withdraw Pokémon."))
else else
@@ -303,7 +303,7 @@ def pbDebugDayCare
when 1 # Withdraw Pokémon 2 when 1 # Withdraw Pokémon 2
if !$PokemonGlobal.daycare[1][0] if !$PokemonGlobal.daycare[1][0]
pbPlayBuzzerSE pbPlayBuzzerSE
elsif $Trainer.party.length>=6 elsif $Trainer.party.length >= MAX_PARTY_SIZE
pbPlayBuzzerSE pbPlayBuzzerSE
pbMessage(_INTL("Party is full, can't withdraw Pokémon.")) pbMessage(_INTL("Party is full, can't withdraw Pokémon."))
else else
@@ -344,7 +344,7 @@ def pbDebugDayCare
when 4 # Collect egg when 4 # Collect egg
if $PokemonGlobal.daycareEgg!=1 if $PokemonGlobal.daycareEgg!=1
pbPlayBuzzerSE pbPlayBuzzerSE
elsif $Trainer.party.length>=6 elsif $Trainer.party.length >= MAX_PARTY_SIZE
pbPlayBuzzerSE pbPlayBuzzerSE
pbMessage(_INTL("Party is full, can't collect the egg.")) pbMessage(_INTL("Party is full, can't collect the egg."))
else else