Added method $Trainer.party_full?

This commit is contained in:
Maruno17
2021-01-11 23:41:35 +00:00
parent f72ce06654
commit 2ab552ad3c
11 changed files with 40 additions and 28 deletions

View File

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

View File

@@ -3,9 +3,9 @@ class PokemonBox
attr_accessor :name
attr_accessor :background
BOX_WIDTH = 6
BOX_WIDTH = 6
BOX_HEIGHT = 5
BOX_SIZE = BOX_WIDTH * BOX_HEIGHT
BOX_SIZE = BOX_WIDTH * BOX_HEIGHT
def initialize(name, maxPokemon = BOX_SIZE)
@pokemon = []
@@ -121,6 +121,10 @@ class PokemonStorage
raise ArgumentError.new("Not supported")
end
def party_full?
return $Trainer.party_full?
end
def maxBoxes
return @boxes.length
end
@@ -179,7 +183,7 @@ class PokemonStorage
return false if !found
end
if boxDst==-1 # Copying into party
return false if self.party.length >= MAX_PARTY_SIZE
return false if party_full?
self.party[self.party.length] = self[boxSrc,indexSrc]
self.party.compact!
else # Copying into box
@@ -200,7 +204,7 @@ class PokemonStorage
end
def pbMoveCaughtToParty(pkmn)
return false if self.party.length >= MAX_PARTY_SIZE
return false if party_full?
self.party[self.party.length] = pkmn
end
@@ -306,6 +310,10 @@ class RegionalStorage
return getCurrentStorage.party
end
def party_full?
return getCurrentStorage.party_full?
end
def maxBoxes
return getCurrentStorage.maxBoxes
end