Release 6.9.0

This commit is contained in:
chardub
2026-11-02 11:34:46 -05:00
parent 060726298d
commit ae6e2ebc64
5697 changed files with 131795 additions and 17423 deletions
@@ -13,6 +13,11 @@ class PokemonTemp
attr_accessor :encounterType
attr_accessor :evolutionLevels
attr_accessor :battle_npc_used_items
attr_accessor :last_battle_participants
def last_participants
return @last_battle_participants
end
def battleRules
@battleRules = {} if !@battleRules
@@ -175,6 +180,9 @@ def pbPrepareBattle(battle)
# Environment
if battleRules["environment"].nil?
battle.environment = pbGetEnvironment
if Settings::SNOW_DAY && battle.environment == :Grass
battle.environment = GameData::Environment.get(:Snow)
end
else
battle.environment = battleRules["environment"]
end
@@ -657,6 +665,7 @@ def pbTrainerBattleCore(*args)
# 2 - Player lost
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# 5 - Draw
pbAfterTrainerBattle(decision, battle)
pbSet(outcomeVar, decision)
return decision
end
@@ -708,6 +717,7 @@ def rematchable_trainer_battle(rematchable_trainers = [], default_level = 50, ca
end
}
loseDialog = trainer_data ? trainer_data.rematch_lose_text : "..."
loseDialog = loseDialog.gsub("<PLAYER_NAME>", $Trainer.name)
npc_trainer = NPCTrainer.new(trainer.trainerName, trainer.trainerType, nil, trainer.custom_appearance)
npc_trainer.lose_text = loseDialog
@@ -942,6 +952,7 @@ Events.onEndBattle += proc { |_sender, e|
pickUpTypeItemSetBonus()
nurseOutfitHeal()
qmarkMaskCheck()
when 2, 5 # Lose, draw
if !canLose
$game_system.bgm_unpause
@@ -951,6 +962,17 @@ Events.onEndBattle += proc { |_sender, e|
end
}
#Called after trainer battles only
def pbAfterTrainerBattle(decision, battle)
battle_participants = battle.list_all_player_participants
$PokemonTemp.last_battle_participants = battle_participants
case decision
when 1# Win
checkObtainClothesAfterBattle(battle.list_all_player_participants) if Settings::HOENN
else
end
end
Events.onWildBattleEnd += proc { |_sender, e|
species = e[0]
result = e[2]
@@ -125,7 +125,12 @@ class PokemonEncounters
#Always check encounter if pokeradar is active
return true if $PokemonTemp.pokeradar != nil && !$PokemonSystem.overworld_encounters
# Get base encounter chance and minimum steps grace period
#safari encounters don't get broken up by fights so only spawn hald the time to tone it down a bit
if $PokemonTemp.overworld_safari
return if rand(2) == 0
end
# Get base encounter chance and minimum steps grace period
encounter_chance = @step_chances[enc_type].to_f
min_steps_needed = (8 - encounter_chance / 10).clamp(0, 8).to_f
# Apply modifiers to the encounter chance and the minimum steps amount
@@ -269,7 +274,9 @@ class PokemonEncounters
baseType = :Land1 if terrain_tag == :Grass_alt1
baseType = :Land2 if terrain_tag == :Grass_alt2
baseType = :Land3 if terrain_tag == :Grass_alt3
baseType = :Land4 if terrain_tag == :Grass_alt4
baseType = :TallGrass if terrain_tag == :TallGrass
baseType = :Puddle if terrain_tag == :Puddle
ret = find_valid_encounter_type_for_time(baseType, time) if !ret
end
if !ret && has_cave_encounters?
@@ -497,9 +504,18 @@ end
# Pokémon (or two) for a triggered wild encounter.
def pbEncounter(enc_type)
$PokemonTemp.encounterType = enc_type
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
pokeblock = scan_for_nearby_pokeblock
if pokeblock
encounter1 = check_feebas_encounter(20,20,25,enc_type,pokeblock)
unless encounter1
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type,3) #Higher chance of rare pokemon when you put down a pokeblock near
end
else
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
end
encounter1 = EncounterModifier.trigger(encounter1)
return false if !encounter1
if $PokemonEncounters.have_double_wild_battle?
encounter2 = $PokemonEncounters.choose_wild_pokemon(enc_type)
encounter2 = EncounterModifier.trigger(encounter2)
@@ -513,3 +529,42 @@ def pbEncounter(enc_type)
EncounterModifier.triggerEncounterEnd
return true
end
#Feebas can only be caught while fishing with a pokeblock in the water
def check_feebas_encounter(feebas_odds,min_level, max_level, enc_type,pokeblock)
return unless [:GoodRod, :SuperRod].include?(enc_type)
return unless [MAP_ROUTE_119_SOUTH,MAP_ROUTE_119_NORTH].include?($game_map.map_id)
return unless pokeblock && pokeblock.is_a?(PokeblockEvent)
return unless pokeblock.floating
feebas_odds *= 20 if isRaining?
feebas_encounter = rand(100) <= feebas_odds
if feebas_encounter
feebas_level = rand(min_level..max_level)
return [:FEEBAS, feebas_level]
end
end
def scan_for_nearby_pokeblock(px = $game_player.x,py = $game_player.y, scan_radius = 3)
map = $MapFactory.getMapNoAdd($game_map.map_id)
return nil if !map
nearest_event = nil
nearest_distance = nil
$game_map.events.each_value do |event|
next unless event.is_a?(PokeblockEvent)
dx = event.x - px
dy = event.y - py
distance = Math.sqrt(dx * dx + dy * dy)
next if distance > scan_radius
next if nearest_distance && nearest_distance <= distance
nearest_event = event
nearest_distance = distance
end
return nil if nearest_event.nil?
return nearest_event
end
@@ -238,7 +238,11 @@ def pbRoamingPokemonBattle(species, level)
setBattleRule("single")
setBattleRule("roamerFlees")
# Perform the battle
decision = pbWildBattleCore($PokemonGlobal.roamPokemon[idxRoamer])
roamPokemon = $PokemonGlobal.roamPokemon[idxRoamer]
if !roamPokemon.able? #Fallback in case the roamer is fainted for some reason (shouldn't happen but does in rare cases)
roamPokemon.hp =1
end
decision = pbWildBattleCore(roamPokemon)
# Update Roaming Pokémon data based on result of battle
if decision==1 || decision==4 # Defeated or caught
$PokemonGlobal.roamPokemon[idxRoamer] = true