trainers rematch

This commit is contained in:
infinitefusion
2021-08-01 13:45:50 -04:00
parent 960867dc7d
commit cd5a2caf94
20 changed files with 276 additions and 204 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -104,7 +104,7 @@ module Settings
#============================================================================= #=============================================================================
# Whether poisoned Pokémon will lose HP while walking around in the field. # Whether poisoned Pokémon will lose HP while walking around in the field.
POISON_IN_FIELD = (MECHANICS_GENERATION <= 4) POISON_IN_FIELD = true#(MECHANICS_GENERATION <= 4)
# Whether poisoned Pokémon will faint while walking around in the field # Whether poisoned Pokémon will faint while walking around in the field
# (true), or survive the poisoning with 1 HP (false). # (true), or survive the poisoning with 1 HP (false).
POISON_FAINT_IN_FIELD = (MECHANICS_GENERATION >= 3) POISON_FAINT_IN_FIELD = (MECHANICS_GENERATION >= 3)

View File

@@ -129,10 +129,13 @@ module GameData
trainer.id = $Trainer.make_foreign_ID trainer.id = $Trainer.make_foreign_ID
trainer.items = @items.clone trainer.items = @items.clone
trainer.lose_text = self.lose_text trainer.lose_text = self.lose_text
isRematch = $game_switches[200]
rematchId = getRematchId(trainer.name,trainer.trainer_type)
# Create each Pokémon owned by the trainer # Create each Pokémon owned by the trainer
@pokemon.each do |pkmn_data| @pokemon.each do |pkmn_data|
#replace placeholder species infinite fusion edit
#infinite fusion edit
species = GameData::Species.get(pkmn_data[:species]).species species = GameData::Species.get(pkmn_data[:species]).species
if placeholder_species.include?(species) if placeholder_species.include?(species)
species = replace_species_with_placeholder(species) species = replace_species_with_placeholder(species)
@@ -145,6 +148,14 @@ module GameData
end end
end end
#### ####
#trainer rematch infinite fusion edit
if isRematch
nbRematch = getNumberRematch(rematchId)
level = getRematchLevel(level,nbRematch)
species = evolveRematchPokemon(nbRematch,species)
end
#
pkmn = Pokemon.new(species, level, trainer, false) pkmn = Pokemon.new(species, level, trainer, false)
trainer.party.push(pkmn) trainer.party.push(pkmn)

View File

@@ -336,6 +336,7 @@ class PokeBattle_Battle
# End of battle # End of battle
#============================================================================= #=============================================================================
def pbGainMoney def pbGainMoney
return if $game_switches[200] #is rematch
return if !@internalBattle || !@moneyGain return if !@internalBattle || !@moneyGain
# Money rewarded from opposing trainers # Money rewarded from opposing trainers
if trainerBattle? if trainerBattle?
@@ -452,6 +453,21 @@ class PokeBattle_Battle
end end
# Register captured Pokémon in the Pokédex, and store them # Register captured Pokémon in the Pokédex, and store them
pbRecordAndStoreCaughtPokemon pbRecordAndStoreCaughtPokemon
isRematch = $game_switches[200]
if isRematch
if @opponent.is_a?(Array)
for trainer in @opponent
rematchId = getRematchId(trainer.name,trainer.trainer_type)
incrNbRematches(rematchId)
end
else
rematchId = getRematchId(@opponent.name,@opponent.trainer_type)
incrNbRematches(rematchId)
end
end
# Collect Pay Day money in a wild battle that ended in a capture # Collect Pay Day money in a wild battle that ended in a capture
pbGainMoney if @decision==4 pbGainMoney if @decision==4
# Pass on Pokérus within the party # Pass on Pokérus within the party

View File

@@ -130,6 +130,8 @@ class PokeBattle_Scene
# playerBase = "Graphics/Battlebacks/"+baseFilename+"_base0" # playerBase = "Graphics/Battlebacks/"+baseFilename+"_base0"
# enemyBase = "Graphics/Battlebacks/"+baseFilename+"_base1" # enemyBase = "Graphics/Battlebacks/"+baseFilename+"_base1"
# messageBG = "Graphics/Battlebacks/"+messageFilename+"_message" # messageBG = "Graphics/Battlebacks/"+messageFilename+"_message"
battleBG = "Graphics/Battlebacks/battlebg/"+backdropFilename battleBG = "Graphics/Battlebacks/battlebg/"+backdropFilename
playerBase = "Graphics/Battlebacks/playerbase/"+baseFilename playerBase = "Graphics/Battlebacks/playerbase/"+baseFilename
enemyBase = "Graphics/Battlebacks/enemybase/"+baseFilename enemyBase = "Graphics/Battlebacks/enemybase/"+baseFilename

View File

@@ -94,7 +94,7 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
for i in $Trainer.able_party for i in $Trainer.able_party
if i.status == :POISON && !i.hasAbility?(:IMMUNITY) if i.status == :POISON && !i.hasAbility?(:IMMUNITY)
if !flashed if !flashed
pbFlash(Color.new(255, 0, 0, 128), 8) pbFlash(Color.new(163, 73, 164, 128), 8)
flashed = true flashed = true
end end
i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD

View File

@@ -85,6 +85,37 @@ def pbNewBattleScene
return PokeBattle_Scene.new return PokeBattle_Scene.new
end end
def getBattleBackgroundFromMetadata(metadata)
#if battle bg specified, return that
battle_bg = metadata.battle_background
return battle_bg if battle_bg
#if no battle bg specified, dedude from environment
battle_env = metadata.battle_environment
case battle_env
when :Cave
return "Cave1"
when :Grass
return "Field"
when :Rock
return "Mountain"
when :Underwater
return "Underwater"
when :StillWater
return "Water"
when :MovingWater
return "Water"
when :Forest
return "Forest"
end
#if is city
if metadata.teleport_destination && metadata.announce_location && metadata.outdoor_map
return "City"
end
end
# Sets up various battle parameters and applies special rules. # Sets up various battle parameters and applies special rules.
def pbPrepareBattle(battle) def pbPrepareBattle(battle)
battleRules = $PokemonTemp.battleRules battleRules = $PokemonTemp.battleRules
@@ -137,7 +168,7 @@ def pbPrepareBattle(battle)
elsif $PokemonGlobal.surfing elsif $PokemonGlobal.surfing
backdrop = "water" # This applies wherever you are, including in caves backdrop = "water" # This applies wherever you are, including in caves
elsif GameData::MapMetadata.exists?($game_map.map_id) elsif GameData::MapMetadata.exists?($game_map.map_id)
back = GameData::MapMetadata.get($game_map.map_id).battle_background back = getBattleBackgroundFromMetadata(GameData::MapMetadata.get($game_map.map_id))
backdrop = back if back && back != "" backdrop = back if back && back != ""
end end
if !backdrop if !backdrop
@@ -145,8 +176,6 @@ def pbPrepareBattle(battle)
backdrop = "indoorA" if !isOutdoor backdrop = "indoorA" if !isOutdoor
backdrop = "Field" if isOutdoor backdrop = "Field" if isOutdoor
end end
backdrop = "indoorA" if !backdrop
battle.backdrop = backdrop battle.backdrop = backdrop
# Choose a name for bases depending on environment # Choose a name for bases depending on environment
if battleRules["base"].nil? if battleRules["base"].nil?

View File

@@ -54,6 +54,8 @@ class PokemonGlobalMetadata
attr_accessor :pokerusTime attr_accessor :pokerusTime
# Save file # Save file
attr_accessor :safesave attr_accessor :safesave
#Trainers rematch
attr_accessor :rematchedTrainers
def initialize def initialize
# Movement # Movement

View File

@@ -354,13 +354,13 @@ class PokemonOption_Scene
MessageConfig.pbSetSpeechFrame("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[value]) MessageConfig.pbSetSpeechFrame("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[value])
} }
), ),
NumberOption.new(_INTL("Menu Frame"),1,Settings::MENU_WINDOWSKINS.length, # NumberOption.new(_INTL("Menu Frame"),1,Settings::MENU_WINDOWSKINS.length,
proc { $PokemonSystem.frame }, # proc { $PokemonSystem.frame },
proc { |value| # proc { |value|
$PokemonSystem.frame = value # $PokemonSystem.frame = value
MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[value]) # MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[value])
} # }
), # ),
EnumOption.new(_INTL("Text Entry"),[_INTL("Cursor"),_INTL("Keyboard")], EnumOption.new(_INTL("Text Entry"),[_INTL("Cursor"),_INTL("Keyboard")],
proc { $PokemonSystem.textinput }, proc { $PokemonSystem.textinput },
proc { |value| $PokemonSystem.textinput = value } proc { |value| $PokemonSystem.textinput = value }

View File

@@ -1,23 +1,50 @@
# #
# #
# #
# class RematchTrainer class RematchTrainer
# attr_reader :id attr_reader :id
# attr_reader :nbTimesRematched 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
# #
# def initialize(id) # called from pbEndOfBattle
# @id = id
# @nbTimesRematched = 0
# end
# #
# def incrementNbTimes() def incrNbRematches(trainerId)
# @nbTimesRematched += 1 $PokemonGlobal.rematchedTrainers.each do |key, trainer|
# end if(trainer.id == trainerId)
# trainer.incrementNbTimes()
# def removeNbTimes() end
# @nbTimesRematched -= 1 end
# 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
# #
# #
# #
@@ -37,186 +64,169 @@
# # nb = (level/10).ceil # # nb = (level/10).ceil
# #
# #
# def addNewTrainerRematch(trainerId) def addNewTrainerRematch(trainerId)
# #$PokemonGlobal.rematchedTrainers[:trainerId] #$PokemonGlobal.rematchedTrainers[:trainerId]
# newTrainer = RematchTrainer.new(trainerId) newTrainer = RematchTrainer.new(trainerId)
# $PokemonGlobal.rematchedTrainers[trainerId.to_sym] = newTrainer $PokemonGlobal.rematchedTrainers[trainerId.to_sym] = newTrainer
#
# end end
#
#
# def getNumberRematch(trainerId)
# if $PokemonGlobal.rematchedTrainers == nil
# $PokemonGlobal.rematchedTrainers = Hash.new
# addNewTrainerRematch(trainerId)
# end def getNumberRematchOld(trainerId)
# trainer = $PokemonGlobal.rematchedTrainers[trainerId.to_sym] if $PokemonGlobal.rematchedTrainers == nil
# if trainer == nil $PokemonGlobal.rematchedTrainers = Hash.new
# addNewTrainerRematch(trainerId) addNewTrainerRematch(trainerId)
# return 0 end
# end
# return (trainer.nbTimesRematched) $PokemonGlobal.rematchedTrainers.each do |key, trainer|
# end if(trainer.id == trainerId)
# return (trainer.nbTimesRematched)
# end
# end
# def getNumberRematchOld(trainerId) addNewTrainerRematch(trainerId)
# if $PokemonGlobal.rematchedTrainers == nil return 0
# $PokemonGlobal.rematchedTrainers = Hash.new end
# addNewTrainerRematch(trainerId)
# end
#
# $PokemonGlobal.rematchedTrainers.each do |key, trainer| def getRematchLevel(originalLevel,nbRematch)
# if(trainer.id == trainerId) levelCap = getLevelCap(originalLevel,$Trainer.numbadges)
# return (trainer.nbTimesRematched) expRate = getLevelRate(originalLevel)
# end levelIncr =0
# end for i in 0..nbRematch
# addNewTrainerRematch(trainerId) if i % expRate == 0
# return 0 levelIncr += 1
# end end
# end
# def incrNbRematches(trainerId) newLevel = originalLevel + levelIncr
# $PokemonGlobal.rematchedTrainers.each do |key, trainer| #printDebugRematchInfo(nbRematch,expRate,newLevel,levelCap,originalLevel)
# if(trainer.id == trainerId) return (newLevel < levelCap) ? newLevel : levelCap
# trainer.incrementNbTimes() end
# end
# end def getLevelRate(originalLevel)
# end return 2 + (originalLevel/20).ceil
# end
# def getRematchLevel(originalLevel,nbRematch)
# levelCap = getLevelCap(originalLevel,$Trainer.numbadges) def getLevelCap(originalLevel,nbBadges)
# expRate = getLevelRate(originalLevel) return 100 if $game_switches[599] #no cap in battle arena
# levelIncr =0 cap = originalLevel + nbBadges +2
# for i in 0..nbRematch return cap < 100 ? cap : 100
# if i % expRate == 0 end
# levelIncr += 1
# end
# end def decreaseRematchNumber(trainerId)
# newLevel = originalLevel + levelIncr $PokemonGlobal.rematchedTrainers.each do |key, trainer|
# #printDebugRematchInfo(nbRematch,expRate,newLevel,levelCap,originalLevel) if(trainer.id == trainerId)
# return (newLevel < levelCap) ? newLevel : levelCap trainer.removeNbTimes()
# end return
# end
# def getLevelRate(originalLevel) end
# return 2 + (originalLevel/20).ceil end
# end
#
# def getLevelCap(originalLevel,nbBadges) def evolveRematchPokemon(nbRematch,species)
# return 100 if $game_switches[599] #no cap in battle arena if(nbRematch >= 10 && $Trainer.numbadges >= 3)
# cap = originalLevel + nbBadges +2 evospecies=getEvolution(species)
# return cap < 100 ? cap : 100 return species if evospecies == -1
# end if(nbRematch >= 20 && $Trainer.numbadges >= 8)
# secondEvoSpecies=getEvolution(evospecies)
# return secondEvoSpecies == -1 ? evospecies : secondEvoSpecies
# def decreaseRematchNumber(trainerId) end
# $PokemonGlobal.rematchedTrainers.each do |key, trainer| return evospecies
# if(trainer.id == trainerId) end
# trainer.removeNbTimes() return species
# return end
# end
# end def getEvolution(species)
# end if species >= Settings::NB_POKEMON
# pokemon = PokeBattle_Pokemon.new(species,1)
# body = getBasePokemonID(species)
# def evolveRematchPokemon(nbRematch,species) head = getBasePokemonID(species,false)
# if(nbRematch >= 10 && $Trainer.numbadges >= 3) ret_evoB = pbGetEvolvedFormData(body)
# evospecies=getEvolution(species) ret_evoH = pbGetEvolvedFormData(head)
# return species if evospecies == -1
# if(nbRematch >= 20 && $Trainer.numbadges >= 8) evoBody = ret_evoB.any? ? ret_evoB[0][2] : -1
# secondEvoSpecies=getEvolution(evospecies) evoHead = ret_evoH.any? ? ret_evoH[0][2] : -1
# return secondEvoSpecies == -1 ? evospecies : secondEvoSpecies
# end return -1 if isNegativeOrNull(evoBody) && isNegativeOrNull(evoHead)
# return evospecies return body*Settings::NB_POKEMON+evoHead if isNegativeOrNull(evoBody) #only head evolves
# end return evoBody*Settings::NB_POKEMON + head if isNegativeOrNull(evoHead) #only body evolves
# return species return evoBody*Settings::NB_POKEMON+evoHead #both evolve
# end else
# evo = pbGetEvolvedFormData(species)
# def getEvolution(species) return evo.any? ? evo[0][2] : -1
# if species >= Settings::NB_POKEMON end
# pokemon = PokeBattle_Pokemon.new(species,1) end
# body = getBasePokemonID(species)
# head = getBasePokemonID(species,false)
# ret_evoB = pbGetEvolvedFormData(body)
# ret_evoH = pbGetEvolvedFormData(head)
#
# evoBody = ret_evoB.any? ? ret_evoB[0][2] : -1
# evoHead = ret_evoH.any? ? ret_evoH[0][2] : -1
#
# return -1 if isNegativeOrNull(evoBody) && isNegativeOrNull(evoHead)
# return body*Settings::NB_POKEMON+evoHead if isNegativeOrNull(evoBody) #only head evolves
# return evoBody*Settings::NB_POKEMON + head if isNegativeOrNull(evoHead) #only body evolves
# return evoBody*Settings::NB_POKEMON+evoHead #both evolve
# else
# evo = pbGetEvolvedFormData(species)
# return evo.any? ? evo[0][2] : -1
# end
# end
#
#
def getFusionSpecies(body,head) def getFusionSpecies(body,head)
id = body * Settings::NB_POKEMON + head id = body * Settings::NB_POKEMON + head
return GameData::Species.get(id).species return GameData::Species.get(id).species
end end
# #
# def evolveHead(species) def evolveHead(species)
# if species <= Settings::NB_POKEMON if species <= Settings::NB_POKEMON
# evo = getEvolution(species) evo = getEvolution(species)
# return evo == -1 ? species : evo return evo == -1 ? species : evo
# end end
# head = getBasePokemonID(species,false) head = getBasePokemonID(species,false)
# body = getBasePokemonID(species) body = getBasePokemonID(species)
# headEvo = getEvolution(head) headEvo = getEvolution(head)
# return headEvo == -1 ? species : getFusionSpecies(body,headEvo) return headEvo == -1 ? species : getFusionSpecies(body,headEvo)
# end end
#
# def evolveBody(species) def evolveBody(species)
# if species <= Settings::NB_POKEMON if species <= Settings::NB_POKEMON
# evo = getEvolution(species) evo = getEvolution(species)
# return evo == -1 ? species : evo return evo == -1 ? species : evo
# end end
# head = getBasePokemonID(species,false) head = getBasePokemonID(species,false)
# body = getBasePokemonID(species) body = getBasePokemonID(species)
# bodyEvo = getEvolution(body) bodyEvo = getEvolution(body)
# return bodyEvo == -1 ? species : getFusionSpecies(bodyEvo,head) return bodyEvo == -1 ? species : getFusionSpecies(bodyEvo,head)
# end end
#
#
# def getCorrectEvolvedSpecies(pokemon) def getCorrectEvolvedSpecies(pokemon)
# if pokemon.species >= Settings::NB_POKEMON if pokemon.species >= Settings::NB_POKEMON
# body = getBasePokemonID(pokemon.species) body = getBasePokemonID(pokemon.species)
# head = getBasePokemonID(pokemon.species,false) head = getBasePokemonID(pokemon.species,false)
# ret1=-1;ret2=-1 ret1=-1;ret2=-1
# for form in pbGetEvolvedFormData(body) for form in pbGetEvolvedFormData(body)
# retB=yield pokemon,form[0],form[1],form[2] retB=yield pokemon,form[0],form[1],form[2]
# break if retB>0 break if retB>0
# end end
# for form in pbGetEvolvedFormData(head) for form in pbGetEvolvedFormData(head)
# retH=yield pokemon,form[0],form[1],form[2] retH=yield pokemon,form[0],form[1],form[2]
# break if retH>0 break if retH>0
# end end
# return ret if ret == retB && ret == retH return ret if ret == retB && ret == retH
# return fixEvolutionOverflow(retB,retH,pokemon.species) return fixEvolutionOverflow(retB,retH,pokemon.species)
# else else
# for form in pbGetEvolvedFormData(pokemon.species) for form in pbGetEvolvedFormData(pokemon.species)
# newspecies=form[2] newspecies=form[2]
# end end
# return newspecies; return newspecies;
# end end
#
# end end
#
#
# def printDebugRematchInfo(nbRematch,expRate,newLevel,levelCap,originalLevel) def printDebugRematchInfo(nbRematch,expRate,newLevel,levelCap,originalLevel)
# info = "" info = ""
# info << "total rematched trainers: "+ $PokemonGlobal.rematchedTrainers.length.to_s + "\n" info << "total rematched trainers: "+ $PokemonGlobal.rematchedTrainers.length.to_s + "\n"
#
# info << "nb times: "+ nbRematch.to_s + "\n" info << "nb times: "+ nbRematch.to_s + "\n"
# info << "lvl up every " + expRate.to_s + " times" + "\n" info << "lvl up every " + expRate.to_s + " times" + "\n"
# info << "original level: " << originalLevel.to_s + "\n" info << "original level: " << originalLevel.to_s + "\n"
# info << "new level: " + newLevel.to_s + "\n" info << "new level: " + newLevel.to_s + "\n"
# info << "level cap: "+ levelCap.to_s info << "level cap: "+ levelCap.to_s
# print info print info
# end end
# #
# #
# #

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -70,8 +70,10 @@ Removed features that will be coming back eventually
- Modern Mode compatibility - Modern Mode compatibility
- Quest log - Quest log
- Hidden abilities routes - Hidden abilities routes
- Pokeradar special encounters
- In-game clock - In-game clock
- Hard mode, Easy mode - Hard mode, Easy mode
- Some quests probably don't work
Removed features that probably won't be coming back Removed features that probably won't be coming back
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾