Snowstorm, forfeiting trainer battles, battle outcome values

This commit is contained in:
Maruno17
2024-06-15 21:29:00 +01:00
parent 22b33ca6c2
commit 8e9417c3b7
41 changed files with 284 additions and 214 deletions

View File

@@ -128,15 +128,15 @@ def pbSafariBattle(pkmn, level = 1)
battle.ballCount = pbSafariState.ballcount
BattleCreationHelperMethods.prepare_battle(battle)
# Perform the battle itself
decision = 0
outcome = Battle::Outcome::UNDECIDED
pbBattleAnimation(pbGetWildBattleBGM(foeParty), 0, foeParty) do
pbSceneStandby { decision = battle.pbStartBattle }
pbSceneStandby { outcome = battle.pbStartBattle }
end
Input.update
# Update Safari game data based on result of battle
pbSafariState.ballcount = battle.ballCount
if pbSafariState.ballcount <= 0
if decision != 2 # Last Safari Ball was used to catch the wild Pokémon
if outcome != Battle::Outcome::LOSE # Last Safari Ball was used to catch the wild Pokémon
pbMessage(_INTL("Announcer: You're out of Safari Balls! Game over!"))
end
pbSafariState.decision = 1
@@ -147,16 +147,16 @@ def pbSafariBattle(pkmn, level = 1)
# 2 - Player ran out of Safari Balls
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# 4 - Wild Pokémon was caught
if decision == 4
if outcome == Battle::Outcome::CATCH
$stats.safari_pokemon_caught += 1
pbSafariState.captures += 1
$stats.most_captures_per_safari_game = [$stats.most_captures_per_safari_game, pbSafariState.captures].max
end
pbSet(1, decision)
pbSet(1, outcome)
# Used by the Poké Radar to update/break the chain
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, outcome)
# Return the outcome of the battle
return decision
return outcome
end
#===============================================================================