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

@@ -378,11 +378,11 @@ def pbBugContestBattle(pkmn, level = 1)
setBattleRule("single")
BattleCreationHelperMethods.prepare_battle(battle)
# Perform the battle itself
decision = 0
outcome = Battle::Outcome::UNDECIDED
pbBattleAnimation(pbGetWildBattleBGM(foeParty), 0, foeParty) do
decision = battle.pbStartBattle
BattleCreationHelperMethods.after_battle(decision, true)
if [2, 5].include?(decision) # Lost or drew
outcome = battle.pbStartBattle
BattleCreationHelperMethods.after_battle(outcome, true)
if Battle::Outcome.should_black_out?(outcome)
$game_system.bgm_unpause
$game_system.bgs_unpause
pbBugContestStartOver
@@ -392,15 +392,15 @@ def pbBugContestBattle(pkmn, level = 1)
# Update Bug Contest game data based on result of battle
pbBugContestState.ballcount = battle.ballCount
if pbBugContestState.ballcount == 0
pbMessage(_INTL("ANNOUNCER: The Bug-Catching Contest is over!"))
pbMessage(_INTL("ANNOUNCER: The Bug-Catching Contest is over!"))
pbBugContestState.pbStartJudging
end
# Save the result of the battle in Game Variable 1
BattleCreationHelperMethods.set_outcome(decision, 1)
BattleCreationHelperMethods.set_outcome(outcome, 1)
# 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 false if the player lost or drew the battle, and true if any other result
return (decision != 2 && decision != 5)
return !Battle::Outcome.should_black_out?(outcome)
end
#===============================================================================