update 6.7

This commit is contained in:
chardub
2025-09-28 15:53:01 -04:00
parent ef5e023ae0
commit 318ff90d8d
696 changed files with 111759 additions and 198230 deletions

View File

@@ -0,0 +1,232 @@
# # ------------------------------------------------------------------------------
# # Written by Stochastic, except for customTrainerBattle method which is a
# # modified version of pbTrainerBattle method.
# # ------------------------------------------------------------------------------
#
# BR_DRAW = 5
# BR_LOSS = 2
# BR_WIN = 1
#
# # ------------------------------------------------------------------------------
# # species - Name of the species, e.g. "PIKACHU"
# # level - Level
# # moveset - Optional. Array of moves, e.g. [:MUDSLAP, :THUNDERBOLT, :VINEWHIP]
# # If not specified, pokemon will be created with moves learned by leveling.
# # The pokemon doesn't need to be able to learn the given moves, they can be
# # arbitary.
# # ------------------------------------------------------------------------------
# def createPokemon(species, level, helditem=nil, moveset=nil, ability=nil, form=nil, nature=nil, hpev=nil, atkev=nil, defev=nil, speev=nil, spaev=nil, spdev=nil)
# begin
# poke = Pokemon.new(species, level)
# poke.item=(helditem) if helditem
# poke.moves = convertMoves(moveset) if moveset
# poke.ability=(ability) if ability
# poke.form = form if form
# poke.shiny = false
# poke.nature =(nature) if nature
# poke.happiness=0
# poke.iv[0]=hpev
# poke.iv[1]=atkev
# poke.iv[2]=defev
# poke.iv[3]=speev
# poke.iv[4]=spaev
# poke.iv[5]=spdev
#
# poke.calc_stats
# return poke
# end
# end
#
# def convertMoves(moves)
# moves.map! {|m| PBMove.new(getMoveID(m))}
# return moves
# end
#
# # provide move like this; :TACKLE
# def getMoveID(move)
# return getConst(PBMoves,move)
# end
#
# # ------------------------------------------------------------------------------
# # Creates a trainer with specified id, name, party, and optionally, items.
# # Does not depend on defined trainers, only on trainer types
# # ------------------------------------------------------------------------------
# def createTrainer(trainerid,trainername,party,items=[])
#
# name = pbGetMessageFromHash(MessageTypes::TrainerNames, trainername)
#
# trainer_hash = {
# :id_number => 999,
# :trainer_type => trainerid,
# :name => name,
# :version => 0,
# :pokemon => party,
# :items => items
# }
# opponent = GameData::Trainer.new(trainer_hash)
# #opponent.setForeignID($Trainer) if $Trainer
# # opponent.party = party
# return [opponent.to_trainer,items,party]
# end
#
# def init_trainer(trainer_data)
# return (trainer_data) ? trainer_data.to_trainer : nil
# end
#
# # ------------------------------------------------------------------------------
# # Initiates trainer battle. This is a modified pbTrainerBattle method.
# #
# # trainer - custom PokeBattle_Trainer provided by the user
# # endspeech - what the trainer says in-battle when defeated
# # doublebattle - Optional. Set it to true if you want a double battle
# # canlose - Optional. Set it to true if you want your party to be healed after battle,and if you don't want to be sent to a pokemon center if you lose
# # ------------------------------------------------------------------------------
#
# def customTrainerBattle(trainer,endSpeech,doubleBattle=false,canLose=false,outcomeVar=1)
# # If there is another NPC trainer who spotted the player at the same time, and
# # it is possible to have a double battle (the player has 2+ able Pokémon or
# # has a partner trainer), then record this first NPC trainer into
# # $PokemonTemp.waitingTrainer and end this method. That second NPC event will
# # 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))
# thisEvent = pbMapInterpreter.get_character(0)
# # Find all other triggered trainer events
# triggeredEvents = $game_player.pbTriggeredTrainerEvents([2],false)
# otherEvent = []
# for i in triggeredEvents
# next if i.id==thisEvent.id
# next if $game_self_switches[[$game_map.map_id,i.id,"A"]]
# otherEvent.push(i)
# end
# return false if !trainer
# Events.onTrainerPartyLoad.trigger(nil,trainer)
# # If there is exactly 1 other triggered trainer event, and this trainer has
# # 6 or fewer Pokémon, record this trainer for a double battle caused by the
# # other triggered trainer event
# if otherEvent.length == 1 && trainer.party.length <= Settings::MAX_PARTY_SIZE
# trainer.lose_text = endSpeech if endSpeech && !endSpeech.empty?
# $PokemonTemp.waitingTrainer = [trainer, thisEvent.id]
# return false
# end
# end
# # Set some battle rules
# setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
# setBattleRule("canLose") if canLose
# setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer
# # Perform the battle
# if $PokemonTemp.waitingTrainer
# decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer[0],
# [trainer[0].trainer_type,trainer[0].name,endSpeech]
# )
# else
# decision = pbTrainerCustomBattleCore(trainer,[trainer[0].trainer_type,trainer[0].name,endSpeech]) #trainerPartyID
# end
# # Finish off the recorded waiting trainer, because they have now been battled
# if decision==1 && $PokemonTemp.waitingTrainer # Win
# pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1], "A", true)
# end
# $PokemonTemp.waitingTrainer = nil
# # Return true if the player won the battle, and false if any other result
# return (decision==1)
# end
#
#
# def pbTrainerCustomBattleCore(trainer,*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("SKIPPING BATTLE...") if $DEBUG
# pbMessage("AFTER WINNING...") if $DEBUG && $Trainer.able_pokemon_count > 0
# pbSet(outcomeVar,($Trainer.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
# end
# # Record information about party Pokémon to be used at the end of battle (e.g.
# # comparing levels for an evolution check)
# Events.onStartBattle.trigger(nil)
# # Generate trainers and their parties based on the arguments given
# foeTrainers = []
# foeItems = []
# foeEndSpeeches = []
# foeParty = []
# foePartyStarts = []
# for arg in args
# if arg.is_a?(NPCTrainer)
# foeTrainers.push(arg)
# foePartyStarts.push(foeParty.length)
# arg.party.each { |pkmn| foeParty.push(pkmn) }
# foeEndSpeeches.push(arg.lose_text)
# foeItems.push(arg.items)
# elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)]
# pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer
# return 0 if !trainer
# Events.onTrainerPartyLoad.trigger(nil,trainer)
# foeTrainers.push(trainer)
# foePartyStarts.push(foeParty.length)
# trainer.party.each { |pkmn| foeParty.push(pkmn) }
# foeEndSpeeches.push(arg[3] || trainer.lose_text)
# foeItems.push(trainer.items)
# else
# raise "Expected NPCTrainer or array of trainer data, got {1}.", arg
# end
# end
# # Calculate who the player trainer(s) and their party are
# playerTrainers = [$Trainer]
# playerParty = $Trainer.party
# playerPartyStarts = [0]
# room_for_partner = (foeParty.length > 1)
# if !room_for_partner && $PokemonTemp.battleRules["size"] &&
# !["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
# room_for_partner = true
# end
# if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
# ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
# ally.id = $PokemonGlobal.partner[2]
# ally.party = $PokemonGlobal.partner[3]
# playerTrainers.push(ally)
# playerParty = []
# $Trainer.party.each { |pkmn| playerParty.push(pkmn) }
# playerPartyStarts.push(playerParty.length)
# ally.party.each { |pkmn| playerParty.push(pkmn) }
# setBattleRule("double") if !$PokemonTemp.battleRules["size"]
# end
# # Create the battle scene (the visual side of it)
# scene = pbNewBattleScene
# # Create the battle class (the mechanics side of it)
# battle = PokeBattle_Battle.new(scene,playerParty,foeParty,playerTrainers,foeTrainers)
# battle.party1starts = playerPartyStarts
# battle.party2starts = foePartyStarts
# battle.items = foeItems
# battle.endSpeeches = foeEndSpeeches
# # Set various other properties in the battle class
# pbPrepareBattle(battle)
# $PokemonTemp.clearBattleRules
# # End the trainer intro music
# Audio.me_stop
# # Perform the battle itself
# decision = 0
# pbBattleAnimation(pbGetTrainerBattleBGM(foeTrainers),(battle.singleBattle?) ? 1 : 3,foeTrainers) {
# pbSceneStandby {
# decision = battle.pbStartBattle
# }
# pbAfterBattle(decision,canLose)
# }
# Input.update
# # Save the result of the battle in a Game Variable (1 by default)
# # 0 - Undecided or aborted
# # 1 - Player won
# # 2 - Player lost
# # 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# # 5 - Draw
# pbSet(outcomeVar,decision)
# return decision
# end

View File

@@ -0,0 +1,36 @@
def pick_trainer_sprite(spriter_name)
possible_types = "abcd"
trainer_type_index = select_number_from_seed(spriter_name,0,3)
path = _INTL("Graphics/Trainers/trainer116{1}",possible_types[trainer_type_index].to_s)
return path
end
def select_number_from_seed(seed, min_value, max_value)
hash = 137
seed.each_byte do |byte|
hash = ((hash << 5) + hash) + byte
end
srand(hash)
selected_number = rand(min_value..max_value)
selected_number
end
def pick_spriter_losing_dialog(spriter_name)
possible_dialogs = [
_INTL("Oh... I lost..."),
_INTL("I did my best!"),
_INTL("You're too strong!"),
_INTL("You win!"),
_INTL("What a fight!"),
_INTL("That was fun!"),
_INTL("Ohh, that's too bad"),
_INTL("I should've sprited some stronger Pokémon!"),
_INTL("So much for that!"),
_INTL("Should've seen that coming!"),
_INTL("I can't believe it!"),
_INTL("What a surprise!")
]
index = select_number_from_seed(spriter_name,0,possible_dialogs.size-1)
return possible_dialogs[index]
end

View File

@@ -0,0 +1,300 @@
#
#
#
class RematchTrainer
attr_reader :id
attr_reader :nbTimesRematched
def initialize(id)
@id = id
@nbTimesRematched = 0
end
def incrementNbTimes()
@nbTimesRematched += 1
end
def removeNbTimes()
@nbTimesRematched -= 1
end
end
#Methods called from elsewhere in the code
#
# called from pbEndOfBattle
#
def incrNbRematches(trainerId)
$PokemonGlobal.rematchedTrainers.each do |key, trainer|
if (trainer.id == trainerId)
trainer.incrementNbTimes()
end
end
end
# called from Trainer.to_trainer
def getNumberRematch(trainerId)
if $PokemonGlobal.rematchedTrainers == nil
$PokemonGlobal.rematchedTrainers = Hash.new
addNewTrainerRematch(trainerId)
end
trainer = $PokemonGlobal.rematchedTrainers[trainerId.to_sym]
if trainer == nil
addNewTrainerRematch(trainerId)
return 0
end
return (trainer.nbTimesRematched)
end
#
#
#
# #garder un list de cette classe en mem. globale
#
# #quand lance un combat: check si le switch pour rematch est actif.
# #si oui, check dans l'array globale si on trouve le trainer id.
# #si oui on maj, si non on l'ajoute
#
# #overload la classe qui lance les combats et ajuste les niveaux
# #selon le nb. de fois rematched
#
#
# # levelCap = originalLevel + (nbBadges*2) +2
#
# # on incremente le level a chaque x (jusqu'au levelcap)
# # nb = (level/10).ceil
#
#
def addNewTrainerRematch(trainerId)
#$PokemonGlobal.rematchedTrainers[:trainerId]
newTrainer = RematchTrainer.new(trainerId)
$PokemonGlobal.rematchedTrainers[trainerId.to_sym] = newTrainer
end
def getNumberRematchOld(trainerId)
if $PokemonGlobal.rematchedTrainers == nil
$PokemonGlobal.rematchedTrainers = Hash.new
addNewTrainerRematch(trainerId)
end
$PokemonGlobal.rematchedTrainers.each do |key, trainer|
if (trainer.id == trainerId)
return (trainer.nbTimesRematched)
end
end
addNewTrainerRematch(trainerId)
return 0
end
def getRematchLevel(originalLevel, nbRematch)
levelCap = getLevelCap(originalLevel, $Trainer.numbadges)
expRate = getLevelRate(originalLevel)
levelIncr = 0
for i in 0..nbRematch
if i % expRate == 0
levelIncr += 1
end
end
newLevel = originalLevel + levelIncr
#printDebugRematchInfo(nbRematch,expRate,newLevel,levelCap,originalLevel)
return (newLevel < levelCap) ? newLevel : levelCap
end
def getLevelRate(originalLevel)
return 2 + (originalLevel / 20).ceil
end
def getLevelCap(originalLevel, nbBadges)
return 100 if $game_switches[599] #no cap in battle arena
cap = originalLevel + nbBadges + 2
return cap < 100 ? cap : 100
end
def decreaseRematchNumber(trainerId)
$PokemonGlobal.rematchedTrainers.each do |key, trainer|
if (trainer.id == trainerId)
trainer.removeNbTimes()
return
end
end
end
# def evolveRematchPokemon(nbRematch, speciesSymbol)
# species = getDexNumberForSpecies(speciesSymbol)
# if (nbRematch >= 10 && $Trainer.numbadges >= 3)
# evospecies = getEvolution(species)
# return species if evospecies == -1
# if (nbRematch >= 20 && $Trainer.numbadges >= 8)
# secondEvoSpecies = getEvolution(evospecies)
# return secondEvoSpecies == -1 ? evospecies : secondEvoSpecies
# end
# return evospecies
# end
# return species
# end
def evolveRematchPokemon(nbRematch, speciesSymbol)
species = getDexNumberForSpecies(speciesSymbol)
if (nbRematch >= 30 && $Trainer.numbadges >= 6)
species = getEvolution(species,:HEAD)
species = getEvolution(species,:BODY)
species = getEvolution(species,:HEAD)
species = getEvolution(species,:BODY)
elsif (nbRematch >= 20 && $Trainer.numbadges >= 3)
species = getEvolution(species,:HEAD)
species = getEvolution(species,:BODY)
species = getEvolution(species,:HEAD)
elsif (nbRematch >= 10 && $Trainer.numbadges >= 3)
species = getEvolution(species,:HEAD)
species = getEvolution(species,:BODY)
elsif (nbRematch >= 5)
species = getEvolution(species,:HEAD)
end
return species
end
def getEvolution(speciesParam, halfToEvolve=nil)
species = dexNum(speciesParam)
begin
prioritizeHead = halfToEvolve == :HEAD
prioritizeBody = halfToEvolve == :BODY
if species >= Settings::NB_POKEMON
body = getBasePokemonID(species)
head = getBasePokemonID(species, false)
bodyPossibleEvolutions = GameData::Species.get(body).get_evolutions(true)
headPossibleEvolutions = GameData::Species.get(head).get_evolutions(true)
bodyCanEvolve = !bodyPossibleEvolutions.empty?
headCanEvolve = !headPossibleEvolutions.empty?
evoBodySpecies = bodyCanEvolve ? bodyPossibleEvolutions[rand(bodyPossibleEvolutions.length - 1)][0] : nil
evoHeadSpecies = headCanEvolve ? headPossibleEvolutions[rand(headPossibleEvolutions.length - 1)][0] : nil
if evoBodySpecies != nil
evoBody = getDexNumberForSpecies(evoBodySpecies)
end
if evoHeadSpecies != nil
evoHead = getDexNumberForSpecies(evoHeadSpecies)
end
return species if evoBody == nil && evoHead == nil
if prioritizeBody
if evoBody == nil
return body * Settings::NB_POKEMON + evoHead #only head evolves
else
return evoBody * Settings::NB_POKEMON + head #only body evolves
end
end
if prioritizeHead
if evoHead == nil
return evoBody * Settings::NB_POKEMON + head #only body evolves
else
return body * Settings::NB_POKEMON + evoHead #only head evolves
end
end
return body * Settings::NB_POKEMON + evoHead if evoBody == nil #only head evolves
return evoBody * Settings::NB_POKEMON + head if evoHead == nil #only body evolves
return evoBody * Settings::NB_POKEMON + evoHead #both evolve
else
evo = pbGetEvolvedFormData(species)
newSpecies = evo[rand(evo.length - 1)][0]
return evo.any? ? getDexNumberForSpecies(newSpecies) : species
end
rescue
return species
end
end
#just a shortcut
def fusionOf(head,body)
return getFusionSpeciesSymbol(body,head)
end
def getFusionSpeciesSymbol(body, head)
body_num = dexNum(body)
head_num = dexNum(head)
nb_pokemon = Settings::NB_POKEMON
id = body_num * nb_pokemon + head_num
if id > (nb_pokemon*nb_pokemon)+nb_pokemon
displayRandomizerErrorMessage()
return body
end
return GameData::Species.get(id).species
end
#
def evolveHead(species)
species_id = getDexNumberForSpecies(species)
if species_id <= Settings::NB_POKEMON
evo = getEvolution(species_id)
return evo == -1 ? species_id : evo
end
head = getBasePokemonID(species_id, false)
body = getBasePokemonID(species_id)
headEvo = getEvolution(head)
return headEvo == -1 ? species_id : getFusionSpeciesSymbol(body, headEvo)
end
def evolveBody(species)
species_id = getDexNumberForSpecies(species)
if species_id <= Settings::NB_POKEMON
evo = getEvolution(species_id)
return evo == -1 ? species_id : evo
end
head = getBasePokemonID(species_id, false)
body = getBasePokemonID(species_id)
bodyEvo = getEvolution(body)
return bodyEvo == -1 ? species_id : getFusionSpeciesSymbol(bodyEvo, head)
end
def getCorrectEvolvedSpecies(pokemon)
if pokemon.species >= Settings::NB_POKEMON
body = getBasePokemonID(pokemon.species)
head = getBasePokemonID(pokemon.species, false)
ret1 = -1; ret2 = -1
for form in pbGetEvolvedFormData(body)
retB = yield pokemon, form[0], form[1], form[2]
break if retB > 0
end
for form in pbGetEvolvedFormData(head)
retH = yield pokemon, form[0], form[1], form[2]
break if retH > 0
end
return ret if ret == retB && ret == retH
return fixEvolutionOverflow(retB, retH, pokemon.species)
else
for form in pbGetEvolvedFormData(pokemon.species)
newspecies = form[2]
end
return newspecies;
end
end
def printDebugRematchInfo(nbRematch, expRate, newLevel, levelCap, originalLevel)
info = ""
info << _INTL("total rematched trainers: ") + $PokemonGlobal.rematchedTrainers.length.to_s + "\n"
info << _INTL("nb times: ") + nbRematch.to_s + "\n"
info << _INTL("lvl up every {1} times",expRate.to_s) + "\n"
info << _INTL("original level: ") << originalLevel.to_s + "\n"
info << _INTL("new level: ") + newLevel.to_s + "\n"
info << _INTL("level cap: ") + levelCap.to_s
print info
end
#
#
#
# class PokeBattle_Trainer
# attr_accessor(:name)
# def name()
# return @name
# end
# end