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:
@@ -77,7 +77,7 @@ end
|
||||
#===============================================================================
|
||||
# Blacking out animation
|
||||
#===============================================================================
|
||||
def pbStartOver(gameover = false)
|
||||
def pbStartOver(game_over = false)
|
||||
if pbInBugContest?
|
||||
pbBugContestStartOver
|
||||
return
|
||||
@@ -85,12 +85,15 @@ def pbStartOver(gameover = false)
|
||||
$stats.blacked_out_count += 1
|
||||
$player.heal_party
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0
|
||||
if gameover
|
||||
if game_over
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("After the unfortunate defeat, you scurry back to a Pokémon Center."))
|
||||
else
|
||||
_INTL("After the unfortunate defeat, you hurry to the Pokémon Center."))
|
||||
elsif $player.all_fainted?
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You scurry back to a Pokémon Center, protecting your exhausted Pokémon from any further harm..."))
|
||||
_INTL("You hurry to the Pokémon Center, shielding your exhausted Pokémon from any further harm..."))
|
||||
else # Forfeited a trainer battle
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You went running to the Pokémon Center to regroup and reconsider your battle strategy..."))
|
||||
end
|
||||
pbCancelVehicles
|
||||
Followers.clear
|
||||
@@ -112,12 +115,15 @@ def pbStartOver(gameover = false)
|
||||
$player.heal_party
|
||||
return
|
||||
end
|
||||
if gameover
|
||||
if game_over
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("After the unfortunate defeat, you scurry back home."))
|
||||
else
|
||||
_INTL("After the unfortunate defeat, you hurry back home."))
|
||||
elsif $player.all_fainted?
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You scurry back home, protecting your exhausted Pokémon from any further harm..."))
|
||||
_INTL("You hurry back home, shielding your exhausted Pokémon from any further harm..."))
|
||||
else # Forfeited a trainer battle
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You went running back home to regroup and reconsider your battle strategy..."))
|
||||
end
|
||||
if homedata
|
||||
pbCancelVehicles
|
||||
|
||||
@@ -156,8 +156,8 @@ module BattleCreationHelperMethods
|
||||
$PokemonGlobal.nextBattleCaptureME = nil
|
||||
$PokemonGlobal.nextBattleBack = nil
|
||||
$PokemonEncounters.reset_step_count
|
||||
outcome = 1 # Win
|
||||
outcome = 0 if trainer_battle && $player.able_pokemon_count == 0 # Undecided
|
||||
outcome = Battle::Outcome::WIN
|
||||
outcome = Battle::Outcome::UNDECIDED if trainer_battle && $player.all_fainted?
|
||||
pbSet(outcome_variable, outcome)
|
||||
return outcome
|
||||
end
|
||||
@@ -246,7 +246,7 @@ module BattleCreationHelperMethods
|
||||
when :Rain, :Storm
|
||||
battle.defaultWeather = :Rain
|
||||
when :Hail
|
||||
battle.defaultWeather = :Hail
|
||||
battle.defaultWeather = (Settings::USE_SNOWSTORM_WEATHER_INSTEAD_OF_HAIL ? :Snowstorm : :Hail)
|
||||
when :Sandstorm
|
||||
battle.defaultWeather = :Sandstorm
|
||||
when :Sun
|
||||
@@ -311,7 +311,7 @@ module BattleCreationHelperMethods
|
||||
pkmn.makeUnprimal
|
||||
end
|
||||
end
|
||||
if [2, 5].include?(outcome) && can_lose # if loss or draw
|
||||
if Battle::Outcome.should_black_out?(outcome) && can_lose
|
||||
$player.party.each { |pkmn| pkmn.heal }
|
||||
timer_start = System.uptime
|
||||
until System.uptime - timer_start >= 0.25
|
||||
@@ -331,10 +331,10 @@ module BattleCreationHelperMethods
|
||||
# 5 - Draw
|
||||
def set_outcome(outcome, outcome_variable = 1, trainer_battle = false)
|
||||
case outcome
|
||||
when 1, 4 # Won, caught
|
||||
when Battle::Outcome::WIN, Battle::Outcome::CATCH
|
||||
$stats.wild_battles_won += 1 if !trainer_battle
|
||||
$stats.trainer_battles_won += 1 if trainer_battle
|
||||
when 2, 3, 5 # Lost, fled, draw
|
||||
when Battle::Outcome::LOSE, Battle::Outcome::FLEE, Battle::Outcome::DRAW
|
||||
$stats.wild_battles_lost += 1 if !trainer_battle
|
||||
$stats.trainer_battles_lost += 1 if trainer_battle
|
||||
end
|
||||
@@ -363,7 +363,7 @@ class WildBattle
|
||||
EventHandlers.trigger(:on_wild_battle_end, foe_party[0].species, foe_party[0].level, outcome)
|
||||
end
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return outcome != 2 && outcome != 5
|
||||
return !Battle::Outcome.should_black_out?(outcome)
|
||||
end
|
||||
|
||||
def self.start_core(*args)
|
||||
@@ -391,7 +391,7 @@ class WildBattle
|
||||
BattleCreationHelperMethods.prepare_battle(battle)
|
||||
$game_temp.clear_battle_rules
|
||||
# Perform the battle itself
|
||||
outcome = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
pbBattleAnimation(pbGetWildBattleBGM(foe_party), (foe_party.length == 1) ? 0 : 2, foe_party) do
|
||||
pbSceneStandby { outcome = battle.pbStartBattle }
|
||||
BattleCreationHelperMethods.after_battle(outcome, can_lose)
|
||||
@@ -481,7 +481,7 @@ class TrainerBattle
|
||||
outcome = TrainerBattle.start_core(*args)
|
||||
end
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return outcome == 1
|
||||
return outcome == Battle::Outcome::WIN
|
||||
end
|
||||
|
||||
def self.start_core(*args)
|
||||
@@ -511,7 +511,7 @@ class TrainerBattle
|
||||
BattleCreationHelperMethods.prepare_battle(battle)
|
||||
$game_temp.clear_battle_rules
|
||||
# Perform the battle itself
|
||||
outcome = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
pbBattleAnimation(pbGetTrainerBattleBGM(foe_trainers), (battle.singleBattle?) ? 1 : 3, foe_trainers) do
|
||||
pbSceneStandby { outcome = battle.pbStartBattle }
|
||||
BattleCreationHelperMethods.after_battle(outcome, can_lose)
|
||||
@@ -600,20 +600,20 @@ end
|
||||
# After battles
|
||||
#===============================================================================
|
||||
EventHandlers.add(:on_end_battle, :evolve_and_black_out,
|
||||
proc { |decision, canLose|
|
||||
proc { |outcome, canLose|
|
||||
# Check for evolutions
|
||||
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
||||
(decision != 2 && decision != 5) # not a loss or a draw
|
||||
!Battle::Outcome.should_black_out?(outcome)
|
||||
$game_temp.party_levels_before_battle = nil
|
||||
# Check for blacking out or gaining Pickup/Huney Gather items
|
||||
case decision
|
||||
when 1, 4 # Win, capture
|
||||
case outcome
|
||||
when Battle::Outcome::WIN, Battle::Outcome::CATCH
|
||||
$player.pokemon_party.each do |pkmn|
|
||||
pbPickup(pkmn)
|
||||
pbHoneyGather(pkmn)
|
||||
end
|
||||
when 2, 5 # Lose, draw
|
||||
if !canLose
|
||||
else
|
||||
if Battle::Outcome.should_black_out?(outcome) && !canLose
|
||||
$game_system.bgm_unpause
|
||||
$game_system.bgs_unpause
|
||||
pbStartOver
|
||||
|
||||
@@ -386,7 +386,9 @@ def pbGenerateWildPokemon(species, level, isRoamer = false)
|
||||
items = genwildpoke.wildHoldItems
|
||||
first_pkmn = $player.first_pokemon
|
||||
chances = [50, 5, 1]
|
||||
if first_pkmn
|
||||
if Settings::MECHANICS_GENERATION >= 9
|
||||
chances[0] = 30
|
||||
elsif first_pkmn
|
||||
case first_pkmn.ability_id
|
||||
when :COMPOUNDEYES
|
||||
chances = [60, 20, 5]
|
||||
|
||||
@@ -212,17 +212,17 @@ def pbRoamingPokemonBattle(pkmn, level = 1)
|
||||
setBattleRule("single")
|
||||
setBattleRule("roamerFlees")
|
||||
# Perform the battle
|
||||
decision = WildBattle.start_core($PokemonGlobal.roamPokemon[idxRoamer])
|
||||
outcome = WildBattle.start_core($PokemonGlobal.roamPokemon[idxRoamer])
|
||||
# Update Roaming Pokémon data based on result of battle
|
||||
if [1, 4].include?(decision) # Defeated or caught
|
||||
if [Battle::Outcome::WIN, Battle::Outcome::CATCH].include?(outcome) # Defeated or caught
|
||||
$PokemonGlobal.roamPokemon[idxRoamer] = true
|
||||
$PokemonGlobal.roamPokemonCaught[idxRoamer] = (decision == 4)
|
||||
$PokemonGlobal.roamPokemonCaught[idxRoamer] = (outcome == Battle::Outcome::CATCH)
|
||||
end
|
||||
$PokemonGlobal.roamEncounter = nil
|
||||
$PokemonGlobal.roamedAlready = true
|
||||
$game_temp.roamer_index_for_encounter = nil
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user