Split PokeBattle_Trainer into PlayerTrainer and NPCTrainer

This commit is contained in:
Maruno17
2021-01-24 17:55:39 +00:00
parent 7de034957b
commit 4098b1cd11
60 changed files with 748 additions and 648 deletions

View File

@@ -38,8 +38,8 @@ class Window_Pokedex < Window_DrawableCommand
species = @commands[index][0]
indexNumber = @commands[index][4]
indexNumber -= 1 if @commands[index][5]
if $Trainer.seen[species]
if $Trainer.owned[species]
if $Trainer.seen?(species)
if $Trainer.owned?(species)
pbCopyBitmap(self.contents,@pokeballOwn.bitmap,rect.x-6,rect.y+8)
else
pbCopyBitmap(self.contents,@pokeballSeen.bitmap,rect.x-6,rect.y+8)
@@ -305,9 +305,9 @@ class PokemonPokedex_Scene
def pbCanAddForModeList?(mode, species)
case mode
when MODEATOZ
return $Trainer.seen[species]
return $Trainer.seen?(species)
when MODEHEAVIEST, MODELIGHTEST, MODETALLEST, MODESMALLEST
return $Trainer.owned[species]
return $Trainer.owned?(species)
end
return true # For MODENUMERICAL
end
@@ -342,11 +342,11 @@ class PokemonPokedex_Scene
case $PokemonGlobal.pokedexMode
when MODENUMERICAL
# Hide the Dex number 0 species if unseen
dexlist[0] = nil if dexlist[0][5] && !$Trainer.seen[dexlist[0][0]]
dexlist[0] = nil if dexlist[0][5] && !$Trainer.seen?(dexlist[0][0])
# Remove unseen species from the end of the list
i = dexlist.length-1
loop do break unless i>=0
break if !dexlist[i] || $Trainer.seen[dexlist[i][0]]
break if !dexlist[i] || $Trainer.seen?(dexlist[i][0])
dexlist[i] = nil
i -= 1
end
@@ -382,7 +382,7 @@ class PokemonPokedex_Scene
base = Color.new(88,88,80)
shadow = Color.new(168,184,184)
iconspecies = @sprites["pokedex"].species
iconspecies = nil if !$Trainer.seen[iconspecies]
iconspecies = nil if !$Trainer.seen?(iconspecies)
# Write various bits of text
dexname = _INTL("Pokédex")
if $PokemonGlobal.pokedexUnlocked.length>1
@@ -400,9 +400,9 @@ class PokemonPokedex_Scene
textpos.push([@dexlist.length.to_s,112,340,2,base,shadow])
else
textpos.push([_INTL("Seen:"),42,308,0,base,shadow])
textpos.push([$Trainer.pokedexSeen(pbGetPokedexRegion).to_s,182,308,1,base,shadow])
textpos.push([$Trainer.seen_count(pbGetPokedexRegion).to_s,182,308,1,base,shadow])
textpos.push([_INTL("Owned:"),42,340,0,base,shadow])
textpos.push([$Trainer.pokedexOwned(pbGetPokedexRegion).to_s,182,340,1,base,shadow])
textpos.push([$Trainer.owned_count(pbGetPokedexRegion).to_s,182,340,1,base,shadow])
end
# Draw all text
pbDrawTextPositions(overlay,textpos)
@@ -675,10 +675,10 @@ class PokemonPokedex_Scene
end
def setIconBitmap(species)
$Trainer.formlastseen = {} if !$Trainer.formlastseen
$Trainer.formlastseen[species] = [] if !$Trainer.formlastseen[species]
gender = $Trainer.formlastseen[species][0] || 0
form = $Trainer.formlastseen[species][1] || 0
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
$Trainer.last_seen_forms[species] = [] if !$Trainer.last_seen_forms[species]
gender = $Trainer.last_seen_forms[species][0] || 0
form = $Trainer.last_seen_forms[species][1] || 0
@sprites["icon"].setSpeciesBitmap(species, gender, form)
end
@@ -689,7 +689,7 @@ class PokemonPokedex_Scene
if params[1]>=0
scanNameCommand = @nameCommands[params[1]].scan(/./)
dexlist = dexlist.find_all { |item|
next false if !$Trainer.seen[item[0]]
next false if !$Trainer.seen?(item[0])
firstChar = item[1][0,1]
next scanNameCommand.any? { |v| v==firstChar }
}
@@ -699,7 +699,7 @@ class PokemonPokedex_Scene
stype1 = (params[2]>=0) ? @typeCommands[params[2]].id : nil
stype2 = (params[3]>=0) ? @typeCommands[params[3]].id : nil
dexlist = dexlist.find_all { |item|
next false if !$Trainer.owned[item[0]]
next false if !$Trainer.owned?(item[0])
type1 = item[6]
type2 = item[7]
if stype1 && stype2
@@ -721,7 +721,7 @@ class PokemonPokedex_Scene
minh = (params[4]<0) ? 0 : (params[4]>=@heightCommands.length) ? 999 : @heightCommands[params[4]]
maxh = (params[5]<0) ? 999 : (params[5]>=@heightCommands.length) ? 0 : @heightCommands[params[5]]
dexlist = dexlist.find_all { |item|
next false if !$Trainer.owned[item[0]]
next false if !$Trainer.owned?(item[0])
height = item[2]
next height>=minh && height<=maxh
}
@@ -731,7 +731,7 @@ class PokemonPokedex_Scene
minw = (params[6]<0) ? 0 : (params[6]>=@weightCommands.length) ? 9999 : @weightCommands[params[6]]
maxw = (params[7]<0) ? 9999 : (params[7]>=@weightCommands.length) ? 0 : @weightCommands[params[7]]
dexlist = dexlist.find_all { |item|
next false if !$Trainer.owned[item[0]]
next false if !$Trainer.owned?(item[0])
weight = item[3]
next weight>=minw && weight<=maxw
}
@@ -745,7 +745,7 @@ class PokemonPokedex_Scene
end
scolor = colorCommands[params[8]]
dexlist = dexlist.find_all { |item|
next false if !$Trainer.seen[item[0]]
next false if !$Trainer.seen?(item[0])
color = item[8]
next color==scolor
}
@@ -754,13 +754,13 @@ class PokemonPokedex_Scene
if params[9]>=0
sshape = @shapeCommands[params[9]]+1
dexlist = dexlist.find_all { |item|
next false if !$Trainer.seen[item[0]]
next false if !$Trainer.seen?(item[0])
shape = item[9]
next shape==sshape
}
end
# Remove all unseen species from the results
dexlist = dexlist.find_all { |item| next $Trainer.seen[item[0]] }
dexlist = dexlist.find_all { |item| next $Trainer.seen?(item[0]) }
case $PokemonGlobal.pokedexMode
when MODENUMERICAL then dexlist.sort! { |a,b| a[4]<=>b[4] }
when MODEATOZ then dexlist.sort! { |a,b| a[1]<=>b[1] }
@@ -1166,7 +1166,7 @@ class PokemonPokedex_Scene
break
end
elsif Input.trigger?(Input::C)
if $Trainer.seen[@sprites["pokedex"].species]
if $Trainer.seen?(@sprites["pokedex"].species)
pbPlayDecisionSE
pbDexEntry(@sprites["pokedex"].index)
end