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

@@ -205,7 +205,7 @@ class BattleChallengeData
def pbStart(t, numRounds)
@inProgress = true
@resting = false
@decision = 0
@decision = Battle::Outcome::UNDECIDED
@swaps = t.currentSwaps
@wins = t.currentWins
@battleNumber = 1
@@ -251,7 +251,7 @@ class BattleChallengeData
end
def pbMatchOver?
return true if !@inProgress || @decision != 0
return true if !@inProgress || @decision != Battle::Outcome::UNDECIDED
return @battleNumber > @numRounds
end
@@ -275,7 +275,7 @@ class BattleChallengeData
def pbEnd
$player.party = @oldParty
return if !@inProgress
save = (@decision != 0)
save = (@decision != Battle::Outcome::UNDECIDED)
reset
$game_map.need_refresh = true
Game.save(safe: true) if save
@@ -293,7 +293,7 @@ class BattleChallengeData
@inProgress = false
@resting = false
@start = nil
@decision = 0
@decision = Battle::Outcome::UNDECIDED
@wins = 0
@swaps = 0
@battleNumber = 0
@@ -343,11 +343,11 @@ class BattleChallengeType
end
def saveWins(challenge)
if challenge.decision == 0 # if undecided
if challenge.decision == Battle::Outcome::UNDECIDED
@currentWins = 0
@currentSwaps = 0
else
if challenge.decision == 1 # if won
if challenge.decision == Battle::Outcome::WIN
@currentWins = challenge.wins
@currentSwaps = challenge.swaps
else # if lost

View File

@@ -61,9 +61,9 @@ def pbOrganizedBattleEx(opponent, challengedata)
# Set various other properties in the battle class
BattleCreationHelperMethods.prepare_battle(battle)
# Perform the battle itself
decision = 0
outcome = Battle::Outcome::UNDECIDED
pbBattleAnimation(pbGetTrainerBattleBGM(opponent)) do
pbSceneStandby { decision = battle.pbStartBattle }
pbSceneStandby { outcome = battle.pbStartBattle }
end
Input.update
# Restore both parties to their original levels
@@ -83,17 +83,17 @@ def pbOrganizedBattleEx(opponent, challengedata)
end
# Save the record of the battle
$game_temp.last_battle_record = nil
if [1, 2, 5].include?(decision) # if win, loss or draw
if [Battle::Outcome::WIN, Battle::Outcome::LOSE, Battle::Outcome::DRAW].include?(outcome)
$game_temp.last_battle_record = battle.pbDumpRecord
end
case decision
when 1 # Won
case outcome
when Battle::Outcome::WIN # Won
$stats.trainer_battles_won += 1
when 2, 3, 5 # Lost, fled, draw
when Battle::Outcome::LOSE, Battle::Outcome::FLEE, Battle::Outcome::DRAW
$stats.trainer_battles_lost += 1
end
# Return true if the player won the battle, and false if any other result
return (decision == 1)
return (outcome == Battle::Outcome::WIN)
end
#===============================================================================