mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 14:14:59 +00:00
Snowstorm, forfeiting trainer battles, battle outcome values
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -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
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -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
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -364,10 +364,10 @@ def pbDecideWinner(party0, party1, rating0, rating1)
|
||||
score0 = pbDecideWinnerScore(party0, party1, rating0)
|
||||
score1 = pbDecideWinnerScore(party1, party0, rating1)
|
||||
if score0 == score1
|
||||
return 5 if rating0 == rating1
|
||||
return (rating0 > rating1) ? 1 : 2
|
||||
return Battle::Outcome::DRAW if rating0 == rating1
|
||||
return (rating0 > rating1) ? Battle::Outcome::WIN : Battle::Outcome::LOSE
|
||||
else
|
||||
return (score0 > score1) ? 1 : 2
|
||||
return (score0 > score1) ? Battle::Outcome::WIN : Battle::Outcome::LOSE
|
||||
end
|
||||
end
|
||||
|
||||
@@ -375,7 +375,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
def pbRuledBattle(team1, team2, rule)
|
||||
decision = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
if rand(100) == 0
|
||||
level = rule.ruleset.suggestedLevel
|
||||
t_type = GameData::TrainerType.keys.first
|
||||
@@ -406,7 +406,7 @@ def pbRuledBattle(team1, team2, rule)
|
||||
battle.debug = true
|
||||
battle.controlPlayer = true
|
||||
battle.internalBattle = false
|
||||
decision = battle.pbStartBattle
|
||||
outcome = battle.pbStartBattle
|
||||
team1.team.each_with_index do |p, i|
|
||||
next if !p
|
||||
p.heal
|
||||
@@ -422,13 +422,13 @@ def pbRuledBattle(team1, team2, rule)
|
||||
party2 = []
|
||||
team1.length.times { |i| party1.push(team1[i]) }
|
||||
team2.length.times { |i| party2.push(team2[i]) }
|
||||
decision = pbDecideWinner(party1, party2, team1.rating, team2.rating)
|
||||
outcome = pbDecideWinner(party1, party2, team1.rating, team2.rating)
|
||||
end
|
||||
case decision
|
||||
when 1 # Team 1 wins
|
||||
case outcome
|
||||
when Battle::Outcome::WIN # Team 1 wins
|
||||
team1.addMatch(team2, 1)
|
||||
team2.addMatch(team1, 0)
|
||||
when 2 # Team 2 wins
|
||||
when Battle::Outcome::LOSE # Team 2 wins
|
||||
team1.addMatch(team2, 0)
|
||||
team2.addMatch(team1, 1)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user