mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-24 23:35:59 +00:00
Added prompt for what to do with a caught Pokémon if the party is full, and a battle rule that forces a capture into the party
This commit is contained in:
@@ -12,6 +12,69 @@ module Battle::CatchAndStoreMixin
|
||||
end
|
||||
end
|
||||
# Store the Pokémon
|
||||
if pbPlayer.party_full? && (@sendToBoxes == 0 || @sendToBoxes == 2) # Ask/must add to party
|
||||
cmds = [_INTL("Add to your party"),
|
||||
_INTL("Send to a Box"),
|
||||
_INTL("See {1}'s summary", pkmn.name),
|
||||
_INTL("Check party")]
|
||||
cmds.delete_at(1) if @sendToBoxes == 2
|
||||
loop do
|
||||
cmd = pbShowCommands(_INTL("Where do you want to send {1} to?", pkmn.name), cmds, 99)
|
||||
break if cmd == 99 # Cancelling = send to a Box
|
||||
cmd += 1 if cmd >= 1 && @sendToBoxes == 2
|
||||
case cmd
|
||||
when 0 # Add to your party
|
||||
pbDisplay(_INTL("Choose a Pokémon in your party to send to your Boxes."))
|
||||
party_index = -1
|
||||
@scene.pbPartyScreen(0, true, 1) { |idxParty, _partyScene|
|
||||
party_index = idxParty
|
||||
next true
|
||||
}
|
||||
next if party_index < 0 # Cancelled
|
||||
party_size = pbPlayer.party.length
|
||||
# Send chosen Pokémon to storage
|
||||
# NOTE: This doesn't work properly if you catch multiple Pokémon in
|
||||
# the same battle, because the code below doesn't alter the
|
||||
# contents of pbParty(0), only pbPlayer.party. This means that
|
||||
# viewing the party in battle after replacing a party Pokémon
|
||||
# with a caught one (which is possible if you've caught a second
|
||||
# Pokémon) will not show the first caught Pokémon in the party
|
||||
# but will still show the boxed Pokémon in the party. Correcting
|
||||
# this would take a surprising amount of code, and it's very
|
||||
# unlikely to be needed anyway, so I'm ignoring it for now.
|
||||
send_pkmn = pbPlayer.party[party_index]
|
||||
box_name = @peer.pbStorePokemon(pbPlayer, send_pkmn)
|
||||
pbPlayer.party.delete_at(party_index)
|
||||
pbDisplayPaused(_INTL("{1} has been sent to Box \"{2}\".", send_pkmn.name, box_name))
|
||||
# Rearrange all remembered properties of party Pokémon
|
||||
(party_index...party_size).each do |idx|
|
||||
if idx < party_size - 1
|
||||
@initialItems[0][idx] = @initialItems[0][idx + 1]
|
||||
$game_temp.party_levels_before_battle[idx] = $game_temp.party_levels_before_battle[idx + 1]
|
||||
$game_temp.party_critical_hits_dealt[idx] = $game_temp.party_critical_hits_dealt[idx + 1]
|
||||
$game_temp.party_direct_damage_taken[idx] = $game_temp.party_direct_damage_taken[idx + 1]
|
||||
else
|
||||
@initialItems[0][idx] = nil
|
||||
$game_temp.party_levels_before_battle[idx] = nil
|
||||
$game_temp.party_critical_hits_dealt[idx] = nil
|
||||
$game_temp.party_direct_damage_taken[idx] = nil
|
||||
end
|
||||
end
|
||||
break
|
||||
when 1 # Send to a Box
|
||||
break
|
||||
when 2 # See X's summary
|
||||
pbFadeOutIn {
|
||||
summary_scene = PokemonSummary_Scene.new
|
||||
summary_screen = PokemonSummaryScreen.new(summary_scene, true)
|
||||
summary_screen.pbStartScreen([pkmn], 0)
|
||||
}
|
||||
when 3 # Check party
|
||||
@scene.pbPartyScreen(0, true, 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
# Store as normal (add to party if there's space, or send to a Box if not)
|
||||
stored_box = @peer.pbStorePokemon(pbPlayer, pkmn)
|
||||
if stored_box < 0
|
||||
pbDisplayPaused(_INTL("{1} has been added to your party.", pkmn.name))
|
||||
|
||||
Reference in New Issue
Block a user