Rewrote party screen, implemented redesign of it

This commit is contained in:
Maruno17
2024-09-07 21:51:54 +01:00
parent fab5fc0641
commit 2190f7c251
26 changed files with 2236 additions and 562 deletions

View File

@@ -686,10 +686,7 @@ class PokemonParty_Scene
self.update
break if oldsprite.x == old_start_x - (old_mult * Graphics.width / 2)
end
Settings::MAX_PARTY_SIZE.times do |i|
@sprites["pokemon#{i}"].preselected = false
@sprites["pokemon#{i}"].switching = false
end
pbClearSwitching
pbRefresh
end
@@ -914,43 +911,6 @@ class PokemonPartyScreen
@scene.pbStartScene(@party, helptext, annotations)
end
def pbChoosePokemon(helptext = nil)
@scene.pbSetHelpText(helptext) if helptext
return @scene.pbChoosePokemon
end
def pbPokemonGiveScreen(item)
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
pkmnid = @scene.pbChoosePokemon
ret = false
if pkmnid >= 0
ret = pbGiveItemToPokemon(item, @party[pkmnid], self, pkmnid)
end
pbRefreshSingle(pkmnid)
@scene.pbEndScene
return ret
end
def pbPokemonGiveMailScreen(mailIndex)
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
pkmnid = @scene.pbChoosePokemon
if pkmnid >= 0
pkmn = @party[pkmnid]
if pkmn.hasItem? || pkmn.mail
pbDisplay(_INTL("This Pokémon is holding an item. It can't hold mail."))
elsif pkmn.egg?
pbDisplay(_INTL("Eggs can't hold mail."))
else
pbDisplay(_INTL("Mail was transferred from the Mailbox."))
pkmn.mail = $PokemonGlobal.mailbox[mailIndex]
pkmn.item = pkmn.mail.item
$PokemonGlobal.mailbox.delete_at(mailIndex)
pbRefreshSingle(pkmnid)
end
end
@scene.pbEndScene
end
def pbEndScene
@scene.pbEndScene
end
@@ -1006,6 +966,53 @@ class PokemonPartyScreen
return true
end
# For after using an evolution stone.
def pbRefreshAnnotations(ableProc)
return if !@scene.pbHasAnnotations?
annot = []
@party.each do |pkmn|
elig = ableProc.call(pkmn)
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
end
@scene.pbAnnotate(annot)
end
def pbClearAnnotations
@scene.pbAnnotate(nil)
end
def pbPokemonGiveScreen(item)
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
pkmnid = @scene.pbChoosePokemon
ret = false
if pkmnid >= 0
ret = pbGiveItemToPokemon(item, @party[pkmnid], self, pkmnid)
end
pbRefreshSingle(pkmnid)
@scene.pbEndScene
return ret
end
def pbPokemonGiveMailScreen(mailIndex)
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
pkmnid = @scene.pbChoosePokemon
if pkmnid >= 0
pkmn = @party[pkmnid]
if pkmn.hasItem? || pkmn.mail
pbDisplay(_INTL("This Pokémon is holding an item. It can't hold mail."))
elsif pkmn.egg?
pbDisplay(_INTL("Eggs can't hold mail."))
else
pbDisplay(_INTL("Mail was transferred from the Mailbox."))
pkmn.mail = $PokemonGlobal.mailbox[mailIndex]
pkmn.item = pkmn.mail.item
$PokemonGlobal.mailbox.delete_at(mailIndex)
pbRefreshSingle(pkmnid)
end
end
@scene.pbEndScene
end
def pbSwitch(oldid, newid)
if oldid != newid
@scene.pbSwitchBegin(oldid, newid)
@@ -1029,21 +1036,6 @@ class PokemonPartyScreen
return @scene.pbShowCommands(helptext, movenames, index)
end
# For after using an evolution stone.
def pbRefreshAnnotations(ableProc)
return if !@scene.pbHasAnnotations?
annot = []
@party.each do |pkmn|
elig = ableProc.call(pkmn)
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
end
@scene.pbAnnotate(annot)
end
def pbClearAnnotations
@scene.pbAnnotate(nil)
end
def pbPokemonMultipleEntryScreenEx(ruleset)
annot = []
statuses = []
@@ -1134,6 +1126,11 @@ class PokemonPartyScreen
return ret
end
def pbChoosePokemon(helptext = nil)
@scene.pbSetHelpText(helptext) if helptext
return @scene.pbChoosePokemon
end
def pbChooseAblePokemon(ableProc, allowIneligible = false)
annot = []
eligibility = []
@@ -1480,78 +1477,3 @@ MenuHandlers.add(:party_menu_item, :move, {
screen.scene.pbSelect(old_party_idx) if !moved
}
})
#===============================================================================
# Open the party screen.
#===============================================================================
def pbPokemonScreen
pbFadeOutIn do
sscene = PokemonParty_Scene.new
sscreen = PokemonPartyScreen.new(sscene, $player.party)
sscreen.pbPokemonScreen
end
end
#===============================================================================
# Choose a Pokémon in the party.
#===============================================================================
# Choose a Pokémon/egg from the party.
# Stores result in variable _variableNumber_ and the chosen Pokémon's name in
# variable _nameVarNumber_; result is -1 if no Pokémon was chosen
def pbChoosePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
chosen = 0
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
if ableProc
chosen = screen.pbChooseAblePokemon(ableProc, allowIneligible)
else
screen.pbStartScene(_INTL("Choose a Pokémon."), false)
chosen = screen.pbChoosePokemon
screen.pbEndScene
end
end
pbSet(variableNumber, chosen)
if chosen >= 0
pbSet(nameVarNumber, $player.party[chosen].name)
else
pbSet(nameVarNumber, "")
end
end
def pbChooseNonEggPokemon(variableNumber, nameVarNumber)
pbChoosePokemon(variableNumber, nameVarNumber, proc { |pkmn| !pkmn.egg? })
end
def pbChooseAblePokemon(variableNumber, nameVarNumber)
pbChoosePokemon(variableNumber, nameVarNumber, proc { |pkmn| !pkmn.egg? && pkmn.hp > 0 })
end
# Same as pbChoosePokemon, but prevents choosing an egg or a Shadow Pokémon.
def pbChooseTradablePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
chosen = 0
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
if ableProc
chosen = screen.pbChooseTradablePokemon(ableProc, allowIneligible)
else
screen.pbStartScene(_INTL("Choose a Pokémon."), false)
chosen = screen.pbChoosePokemon
screen.pbEndScene
end
end
pbSet(variableNumber, chosen)
if chosen >= 0
pbSet(nameVarNumber, $player.party[chosen].name)
else
pbSet(nameVarNumber, "")
end
end
def pbChoosePokemonForTrade(variableNumber, nameVarNumber, wanted)
wanted = GameData::Species.get(wanted).species
pbChooseTradablePokemon(variableNumber, nameVarNumber, proc { |pkmn|
next pkmn.species == wanted
})
end

View File

@@ -513,10 +513,11 @@ class PokemonBagScreen
@scene.pbDisplay(_INTL("The {1} can't be held.", itm.portion_name))
else
pbFadeOutIn do
sscene = PokemonParty_Scene.new
sscreen = PokemonPartyScreen.new(sscene, $player.party)
sscreen.pbPokemonGiveScreen(item)
@scene.pbRefresh
screen = UI::Party.new($player.party, mode: :choose_pokemon)
screen.choose_pokemon do |pkmn, party_index|
pbGiveItemToPokemon(item, screen.pokemon, screen, chosen) if party_index >= 0
next true
end
end
end
elsif cmdToss >= 0 && command == cmdToss # Toss item

View File

@@ -261,7 +261,7 @@ class PokemonReadyMenu
user = $player.party[commands[0][command[1]][3]]
if move == :FLY
ret = nil
pbFadeOutInWithUpdate(99999, @scene.sprites) do
pbFadeOutInWithUpdate(@scene.sprites) do
pbHideMenu
scene = PokemonRegionMap_Scene.new(-1, false)
screen = PokemonRegionMapScreen.new(scene)

View File

@@ -1576,7 +1576,7 @@ class PokemonStorageScreen
elsif cmdRelease >= 0 && command == cmdRelease # Release
pbRelease(selected, @heldpkmn)
elsif cmdDebug >= 0 && command == cmdDebug # Debug
pbPokemonDebug((@heldpkmn) ? @heldpkmn : pokemon, selected, heldpoke)
pokemon_debug_menu((@heldpkmn) ? @heldpkmn : pokemon, selected, heldpoke)
end
end
end

View File

@@ -68,9 +68,9 @@ def pbPCMailbox
commands.push(_INTL("Cancel"))
command = pbShowCommands(nil, commands, -1, command)
if command >= 0 && command < $PokemonGlobal.mailbox.length
mailIndex = command
mail_index = command
commandMail = pbMessage(
_INTL("What do you want to do with {1}'s Mail?", $PokemonGlobal.mailbox[mailIndex].sender),
_INTL("What do you want to do with {1}'s Mail?", $PokemonGlobal.mailbox[mail_index].sender),
[_INTL("Read"),
_INTL("Move to Bag"),
_INTL("Give"),
@@ -79,22 +79,36 @@ def pbPCMailbox
case commandMail
when 0 # Read
pbFadeOutIn do
pbDisplayMail($PokemonGlobal.mailbox[mailIndex])
pbDisplayMail($PokemonGlobal.mailbox[mail_index])
end
when 1 # Move to Bag
if pbConfirmMessage(_INTL("The message will be lost. Is that OK?"))
if $bag.add($PokemonGlobal.mailbox[mailIndex].item)
if $bag.add($PokemonGlobal.mailbox[mail_index].item)
pbMessage(_INTL("The Mail was returned to the Bag with its message erased."))
$PokemonGlobal.mailbox.delete_at(mailIndex)
$PokemonGlobal.mailbox.delete_at(mail_index)
else
pbMessage(_INTL("The Bag is full."))
end
end
when 2 # Give
pbFadeOutIn do
sscene = PokemonParty_Scene.new
sscreen = PokemonPartyScreen.new(sscene, $player.party)
sscreen.pbPokemonGiveMailScreen(mailIndex)
screen = UI::Party.new($player.party, mode: :choose_pokemon)
screen.choose_pokemon do |pkmn, party_index|
next true if party_index < 0
if pkmn.egg?
screen.show_message(_INTL("Eggs can't hold mail."))
elsif pkmn.hasItem? || pkmn.mail
screen.show_message(_INTL("This Pokémon is holding an item. It can't hold mail."))
else
pkmn.mail = $PokemonGlobal.mailbox[mail_index]
pkmn.item = pkmn.mail.item
$PokemonGlobal.mailbox.delete_at(mail_index)
screen.refresh
screen.show_message(_INTL("Mail was transferred from the Mailbox."))
next true
end
next false
end
end
end
else