mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 06:34:59 +00:00
Renamed $Trainer to $player
This commit is contained in:
@@ -192,19 +192,19 @@ Events.onStartBattle += proc { |_sender|
|
||||
# during battle and may need to evolve afterwards
|
||||
$PokemonTemp.party_levels_before_battle = []
|
||||
$PokemonTemp.party_critical_hits_dealt = []
|
||||
for i in 0...$Trainer.party.length
|
||||
$PokemonTemp.party_levels_before_battle[i] = $Trainer.party[i].level
|
||||
$player.party.each_with_index do |pkmn, i|
|
||||
$PokemonTemp.party_levels_before_battle[i] = pkmn.level
|
||||
$PokemonTemp.party_critical_hits_dealt[i] = 0
|
||||
end
|
||||
}
|
||||
|
||||
def pbCanDoubleBattle?
|
||||
return $PokemonGlobal.partner || $Trainer.able_pokemon_count >= 2
|
||||
return $PokemonGlobal.partner || $player.able_pokemon_count >= 2
|
||||
end
|
||||
|
||||
def pbCanTripleBattle?
|
||||
return true if $Trainer.able_pokemon_count >= 3
|
||||
return $PokemonGlobal.partner && $Trainer.able_pokemon_count >= 2
|
||||
return true if $player.able_pokemon_count >= 3
|
||||
return $PokemonGlobal.partner && $player.able_pokemon_count >= 2
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
@@ -214,8 +214,8 @@ def pbWildBattleCore(*args)
|
||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
if $Trainer.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $Trainer.pokemon_count > 0
|
||||
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $player.pokemon_count > 0
|
||||
pbSet(outcomeVar,1) # Treat it as a win
|
||||
$PokemonTemp.clearBattleRules
|
||||
$PokemonGlobal.nextBattleBGM = nil
|
||||
@@ -249,8 +249,8 @@ def pbWildBattleCore(*args)
|
||||
end
|
||||
raise _INTL("Expected a level after being given {1}, but one wasn't found.",sp) if sp
|
||||
# Calculate who the trainers and their party are
|
||||
playerTrainers = [$Trainer]
|
||||
playerParty = $Trainer.party
|
||||
playerTrainers = [$player]
|
||||
playerParty = $player.party
|
||||
playerPartyStarts = [0]
|
||||
room_for_partner = (foeParty.length > 1)
|
||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
||||
@@ -263,7 +263,7 @@ def pbWildBattleCore(*args)
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
playerTrainers.push(ally)
|
||||
playerParty = []
|
||||
$Trainer.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
playerPartyStarts.push(playerParty.length)
|
||||
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
|
||||
@@ -352,17 +352,17 @@ def pbTrainerBattleCore(*args)
|
||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
if $Trainer.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
|
||||
pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $Trainer.able_pokemon_count > 0
|
||||
pbSet(outcomeVar,($Trainer.able_pokemon_count == 0) ? 0 : 1) # Treat it as undecided/a win
|
||||
pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $player.able_pokemon_count > 0
|
||||
pbSet(outcomeVar, ($player.able_pokemon_count == 0) ? 0 : 1) # Treat it as undecided/a win
|
||||
$PokemonTemp.clearBattleRules
|
||||
$PokemonGlobal.nextBattleBGM = nil
|
||||
$PokemonGlobal.nextBattleME = nil
|
||||
$PokemonGlobal.nextBattleCaptureME = nil
|
||||
$PokemonGlobal.nextBattleBack = nil
|
||||
pbMEStop
|
||||
return ($Trainer.able_pokemon_count == 0) ? 0 : 1 # Treat it as undecided/a win
|
||||
return ($player.able_pokemon_count == 0) ? 0 : 1 # Treat it as undecided/a win
|
||||
end
|
||||
# Record information about party Pokémon to be used at the end of battle (e.g.
|
||||
# comparing levels for an evolution check)
|
||||
@@ -395,8 +395,8 @@ def pbTrainerBattleCore(*args)
|
||||
end
|
||||
end
|
||||
# Calculate who the player trainer(s) and their party are
|
||||
playerTrainers = [$Trainer]
|
||||
playerParty = $Trainer.party
|
||||
playerTrainers = [$player]
|
||||
playerParty = $player.party
|
||||
playerPartyStarts = [0]
|
||||
room_for_partner = (foeParty.length > 1)
|
||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
||||
@@ -409,7 +409,7 @@ def pbTrainerBattleCore(*args)
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
playerTrainers.push(ally)
|
||||
playerParty = []
|
||||
$Trainer.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
playerPartyStarts.push(playerParty.length)
|
||||
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
|
||||
@@ -461,8 +461,8 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
||||
# then trigger and cause the battle to happen against this first trainer and
|
||||
# themselves.
|
||||
if !$PokemonTemp.waitingTrainer && pbMapInterpreterRunning? &&
|
||||
($Trainer.able_pokemon_count > 1 ||
|
||||
($Trainer.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
||||
($player.able_pokemon_count > 1 ||
|
||||
($player.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
||||
thisEvent = pbMapInterpreter.get_character(0)
|
||||
# Find all other triggered trainer events
|
||||
triggeredEvents = $game_player.pbTriggeredTrainerEvents([2],false)
|
||||
@@ -545,13 +545,13 @@ end
|
||||
# After battles
|
||||
#===============================================================================
|
||||
def pbAfterBattle(decision,canLose)
|
||||
$Trainer.party.each do |pkmn|
|
||||
$player.party.each do |pkmn|
|
||||
pkmn.statusCount = 0 if pkmn.status == :POISON # Bad poison becomes regular
|
||||
pkmn.makeUnmega
|
||||
pkmn.makeUnprimal
|
||||
end
|
||||
if $PokemonGlobal.partner
|
||||
$Trainer.heal_party
|
||||
$player.heal_party
|
||||
$PokemonGlobal.partner[3].each do |pkmn|
|
||||
pkmn.heal
|
||||
pkmn.makeUnmega
|
||||
@@ -560,7 +560,7 @@ def pbAfterBattle(decision,canLose)
|
||||
end
|
||||
if decision==2 || decision==5 # if loss or draw
|
||||
if canLose
|
||||
$Trainer.party.each { |pkmn| pkmn.heal }
|
||||
$player.party.each { |pkmn| pkmn.heal }
|
||||
(Graphics.frame_rate/4).times { Graphics.update }
|
||||
end
|
||||
end
|
||||
@@ -579,7 +579,7 @@ Events.onEndBattle += proc { |_sender,e|
|
||||
# Check for blacking out or gaining Pickup/Huney Gather items
|
||||
case decision
|
||||
when 1, 4 # Win, capture
|
||||
$Trainer.pokemon_party.each do |pkmn|
|
||||
$player.pokemon_party.each do |pkmn|
|
||||
pbPickup(pkmn)
|
||||
pbHoneyGather(pkmn)
|
||||
end
|
||||
@@ -593,7 +593,7 @@ Events.onEndBattle += proc { |_sender,e|
|
||||
}
|
||||
|
||||
def pbEvolutionCheck
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
$player.party.each_with_index do |pkmn, i|
|
||||
next if !pkmn || pkmn.egg?
|
||||
next if pkmn.fainted? && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON
|
||||
# Find an evolution
|
||||
|
||||
@@ -194,8 +194,8 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
|
||||
tr_type = foe[0].trainer_type
|
||||
trainer_bar_graphic = sprintf("vsBar_%s", tr_type.to_s) rescue nil
|
||||
trainer_graphic = sprintf("vsTrainer_%s", tr_type.to_s) rescue nil
|
||||
player_tr_type = $Trainer.trainer_type
|
||||
outfit = $Trainer.outfit
|
||||
player_tr_type = $player.trainer_type
|
||||
outfit = $player.outfit
|
||||
player_bar_graphic = sprintf("vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil
|
||||
if !pbResolveBitmap("Graphics/Transitions/" + player_bar_graphic)
|
||||
player_bar_graphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil
|
||||
@@ -283,7 +283,7 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
|
||||
trainer.tone = Tone.new(0, 0, 0)
|
||||
trainername = foe[0].name
|
||||
textpos = [
|
||||
[$Trainer.name, Graphics.width / 4, (Graphics.height / 1.5) + 4, 2,
|
||||
[$player.name, Graphics.width / 4, (Graphics.height / 1.5) + 4, 2,
|
||||
Color.new(248, 248, 248), Color.new(72, 72, 72)],
|
||||
[trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 4, 2,
|
||||
Color.new(248, 248, 248), Color.new(72, 72, 72)]
|
||||
|
||||
@@ -104,7 +104,7 @@ class PokemonEncounters
|
||||
raise ArgumentError.new(_INTL("Encounter type {1} does not exist", enc_type))
|
||||
end
|
||||
return false if $game_system.encounter_disabled
|
||||
return false if !$Trainer
|
||||
return false if !$player
|
||||
return false if $DEBUG && Input.press?(Input::CTRL)
|
||||
# Check if enc_type has a defined step chance/encounter table
|
||||
return false if !@step_chances[enc_type] || @step_chances[enc_type] == 0
|
||||
@@ -126,7 +126,7 @@ class PokemonEncounters
|
||||
encounter_chance *= 1.5 if $PokemonMap.whiteFluteUsed
|
||||
min_steps_needed /= 2 if $PokemonMap.whiteFluteUsed
|
||||
end
|
||||
first_pkmn = $Trainer.first_pokemon
|
||||
first_pkmn = $player.first_pokemon
|
||||
if first_pkmn
|
||||
case first_pkmn.item_id
|
||||
when :CLEANSETAG
|
||||
@@ -187,7 +187,7 @@ class PokemonEncounters
|
||||
return true if pbPokeRadarOnShakingGrass
|
||||
# Repel
|
||||
if repel_active
|
||||
first_pkmn = (Settings::REPEL_COUNTS_FAINTED_POKEMON) ? $Trainer.first_pokemon : $Trainer.first_able_pokemon
|
||||
first_pkmn = (Settings::REPEL_COUNTS_FAINTED_POKEMON) ? $player.first_pokemon : $player.first_able_pokemon
|
||||
if first_pkmn && enc_data[1] < first_pkmn.level
|
||||
@chance_accumulator = 0
|
||||
return false
|
||||
@@ -195,7 +195,7 @@ class PokemonEncounters
|
||||
end
|
||||
# Some abilities make wild encounters less likely if the wild Pokémon is
|
||||
# sufficiently weaker than the Pokémon with the ability
|
||||
first_pkmn = $Trainer.first_pokemon
|
||||
first_pkmn = $player.first_pokemon
|
||||
if first_pkmn
|
||||
case first_pkmn.ability_id
|
||||
when :INTIMIDATE, :KEENEYE
|
||||
@@ -211,7 +211,7 @@ class PokemonEncounters
|
||||
return false if $PokemonTemp.forceSingleBattle
|
||||
return false if pbInSafari?
|
||||
return true if $PokemonGlobal.partner
|
||||
return false if $Trainer.able_pokemon_count <= 1
|
||||
return false if $player.able_pokemon_count <= 1
|
||||
return true if $game_player.pbTerrainTag.double_wild_encounters && rand(100) < 30
|
||||
return false
|
||||
end
|
||||
@@ -276,7 +276,7 @@ class PokemonEncounters
|
||||
# Static/Magnet Pull prefer wild encounters of certain types, if possible.
|
||||
# If they activate, they remove all Pokémon from the encounter table that do
|
||||
# not have the type they favor. If none have that type, nothing is changed.
|
||||
first_pkmn = $Trainer.first_pokemon
|
||||
first_pkmn = $player.first_pokemon
|
||||
if first_pkmn
|
||||
favored_type = nil
|
||||
case first_pkmn.ability_id
|
||||
@@ -393,7 +393,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
genwildpoke = Pokemon.new(species,level)
|
||||
# Give the wild Pokémon a held item
|
||||
items = genwildpoke.wildHoldItems
|
||||
first_pkmn = $Trainer.first_pokemon
|
||||
first_pkmn = $player.first_pokemon
|
||||
chances = [50,5,1]
|
||||
if first_pkmn
|
||||
case first_pkmn.ability_id
|
||||
@@ -417,7 +417,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
shiny_retries += 2 if $bag.has?(:SHINYCHARM)
|
||||
if Settings::HIGHER_SHINY_CHANCES_WITH_NUMBER_BATTLED
|
||||
values = [0, 0]
|
||||
case $Trainer.pokedex.battled_count(species)
|
||||
case $player.pokedex.battled_count(species)
|
||||
when 0...50 then values = [0, 0]
|
||||
when 50...100 then values = [1, 15]
|
||||
when 100...200 then values = [2, 20]
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
# Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
|
||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
pokemon = e[0]
|
||||
pkmn = e[0]
|
||||
if $game_switches[Settings::SHINY_WILD_POKEMON_SWITCH]
|
||||
pokemon.shiny = true
|
||||
pkmn.shiny = true
|
||||
end
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
# This is a simple method, and can/should be modified to account for evolutions
|
||||
# and other such details. Of course, you don't HAVE to use this code.
|
||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
pokemon = e[0]
|
||||
pkmn = e[0]
|
||||
if $game_map.map_id == 51
|
||||
new_level = pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety
|
||||
new_level = pbBalancedLevel($player.party) - 4 + rand(5) # For variety
|
||||
new_level = new_level.clamp(1, GameData::GrowthRate.max_level)
|
||||
pokemon.level = new_level
|
||||
pokemon.calc_stats
|
||||
pokemon.reset_moves
|
||||
pkmn.level = new_level
|
||||
pkmn.calc_stats
|
||||
pkmn.reset_moves
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user