mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 14:44:58 +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:
@@ -69,6 +69,7 @@ class Battle
|
||||
attr_accessor :expGain # Whether Pokémon can gain Exp/EVs
|
||||
attr_accessor :moneyGain # Whether the player can gain/lose money
|
||||
attr_accessor :disablePokeBalls # Whether Poké Balls cannot be thrown at all
|
||||
attr_accessor :sendToBoxes # Send to Boxes (0=ask, 1=don't ask, 2=must add to party)
|
||||
attr_accessor :rules
|
||||
attr_accessor :choices # Choices made by each Pokémon this round
|
||||
attr_accessor :megaEvolution # Battle index of each trainer's Pokémon to Mega Evolve
|
||||
@@ -140,6 +141,7 @@ class Battle
|
||||
@expGain = true
|
||||
@moneyGain = true
|
||||
@disablePokeBalls = false
|
||||
@sendToBoxes = 1
|
||||
@rules = {}
|
||||
@priority = []
|
||||
@priorityTrickRoom = false
|
||||
@@ -830,8 +832,10 @@ class Battle
|
||||
return @scene.pbDisplayConfirmMessage(msg)
|
||||
end
|
||||
|
||||
def pbShowCommands(msg, commands, canCancel = true)
|
||||
@scene.pbShowCommands(msg, commands, canCancel)
|
||||
# defaultValue of -1 means "can't cancel". If it's 0 or greater, returns that
|
||||
# value when pressing the "Back" button.
|
||||
def pbShowCommands(msg, commands, defaultValue = -1)
|
||||
return @scene.pbShowCommands(msg, commands, defaultValue)
|
||||
end
|
||||
|
||||
def pbAnimation(move, user, targets, hitNum = 0)
|
||||
|
||||
@@ -86,7 +86,9 @@ class Battle::Battler
|
||||
# Do other things
|
||||
@battle.pbClearChoice(@index) # Reset choice
|
||||
pbOwnSide.effects[PBEffects::LastRoundFainted] = @battle.turnCount
|
||||
if $game_temp.party_direct_damage_taken && pbOwnedByPlayer?
|
||||
if $game_temp.party_direct_damage_taken &&
|
||||
$game_temp.party_direct_damage_taken[@pokemonIndex] &&
|
||||
pbOwnedByPlayer?
|
||||
$game_temp.party_direct_damage_taken[@pokemonIndex] = 0
|
||||
end
|
||||
# Check other battlers' abilities that trigger upon a battler fainting
|
||||
|
||||
@@ -294,7 +294,9 @@ class Battle::Move
|
||||
@battle.pbDisplay(_INTL("The substitute took damage for {1}!", target.pbThis(true)))
|
||||
end
|
||||
if target.damageState.critical
|
||||
if $game_temp.party_critical_hits_dealt && user.pbOwnedByPlayer?
|
||||
if $game_temp.party_critical_hits_dealt &&
|
||||
$game_temp.party_critical_hits_dealt[user.pokemonIndex] &&
|
||||
user.pbOwnedByPlayer?
|
||||
$game_temp.party_critical_hits_dealt[user.pokemonIndex] += 1
|
||||
end
|
||||
if target.damageState.affection_critical
|
||||
@@ -388,7 +390,9 @@ class Battle::Move
|
||||
target.lastHPLostFromFoe = damage # For Metal Burst
|
||||
target.lastFoeAttacker.push(user.index) # For Metal Burst
|
||||
end
|
||||
if $game_temp.party_direct_damage_taken && target.pbOwnedByPlayer?
|
||||
if $game_temp.party_direct_damage_taken &&
|
||||
$game_temp.party_direct_damage_taken[target.pokemonIndex] &&
|
||||
target.pbOwnedByPlayer?
|
||||
$game_temp.party_direct_damage_taken[target.pokemonIndex] += damage
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,8 +139,10 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Opens the party screen to choose a Pokémon to switch in (or just view its
|
||||
# summary screens)
|
||||
# mode: 0=Pokémon command, 1=choose a Pokémon to send to the Boxes, 2=view
|
||||
# summaries only
|
||||
#=============================================================================
|
||||
def pbPartyScreen(idxBattler, canCancel = false)
|
||||
def pbPartyScreen(idxBattler, canCancel = false, mode = 0)
|
||||
# Fade out and hide all sprites
|
||||
visibleSprites = pbFadeOutAndHide(@sprites)
|
||||
# Get player's party
|
||||
@@ -150,11 +152,13 @@ class Battle::Scene
|
||||
# Start party screen
|
||||
scene = PokemonParty_Scene.new
|
||||
switchScreen = PokemonPartyScreen.new(scene, modParty)
|
||||
switchScreen.pbStartScene(_INTL("Choose a Pokémon."), @battle.pbNumPositions(0, 0))
|
||||
msg = _INTL("Choose a Pokémon.")
|
||||
msg = _INTL("Send which Pokémon to Boxes?") if mode == 1
|
||||
switchScreen.pbStartScene(msg, @battle.pbNumPositions(0, 0))
|
||||
# Loop while in party screen
|
||||
loop do
|
||||
# Select a Pokémon
|
||||
scene.pbSetHelpText(_INTL("Choose a Pokémon."))
|
||||
scene.pbSetHelpText(msg)
|
||||
idxParty = switchScreen.pbChoosePokemon
|
||||
if idxParty < 0
|
||||
next if !canCancel
|
||||
@@ -162,13 +166,16 @@ class Battle::Scene
|
||||
end
|
||||
# Choose a command for the selected Pokémon
|
||||
cmdSwitch = -1
|
||||
cmdBoxes = -1
|
||||
cmdSummary = -1
|
||||
commands = []
|
||||
commands[cmdSwitch = commands.length] = _INTL("Switch In") if modParty[idxParty].able?
|
||||
commands[cmdSwitch = commands.length] = _INTL("Switch In") if mode == 0 && modParty[idxParty].able?
|
||||
commands[cmdBoxes = commands.length] = _INTL("Send to Boxes") if mode == 1
|
||||
commands[cmdSummary = commands.length] = _INTL("Summary")
|
||||
commands[commands.length] = _INTL("Cancel")
|
||||
command = scene.pbShowCommands(_INTL("Do what with {1}?", modParty[idxParty].name), commands)
|
||||
if cmdSwitch >= 0 && command == cmdSwitch # Switch In
|
||||
if (cmdSwitch >= 0 && command == cmdSwitch) || # Switch In
|
||||
(cmdBoxes >= 0 && command == cmdBoxes) # Send to Boxes
|
||||
idxPartyRet = -1
|
||||
partyPos.each_with_index do |pos, i|
|
||||
next if pos != idxParty + partyStart
|
||||
|
||||
@@ -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