mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
update 6.7
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
def setDifficulty(index)
|
||||
$Trainer.selected_difficulty = index
|
||||
case index
|
||||
when 0 # EASY
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = true
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when 1 # NORMAL
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when 2 # HARD
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = true
|
||||
end
|
||||
end
|
||||
|
||||
# Old menu for changing difficulty - unused
|
||||
def change_game_difficulty(down_only = false)
|
||||
message = _INTL("The game is currently on {1} difficulty.",get_difficulty_text())
|
||||
pbMessage(message)
|
||||
|
||||
choice_easy = _INTL("Easy")
|
||||
choice_normal = _INTL("Normal")
|
||||
choice_hard = _INTL("Hard")
|
||||
choice_cancel = _INTL("Cancel")
|
||||
|
||||
available_difficulties = []
|
||||
currentDifficulty = get_current_game_difficulty
|
||||
if down_only
|
||||
if currentDifficulty == :HARD
|
||||
available_difficulties << choice_hard
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_easy
|
||||
elsif currentDifficulty == :NORMAL
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_easy
|
||||
elsif currentDifficulty == :EASY
|
||||
available_difficulties << choice_easy
|
||||
end
|
||||
else
|
||||
available_difficulties << choice_easy
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_hard
|
||||
end
|
||||
available_difficulties << choice_cancel
|
||||
index = pbMessage(_INTL("Select a new difficulty"), available_difficulties, available_difficulties[-1])
|
||||
choice = available_difficulties[index]
|
||||
case choice
|
||||
when choice_easy
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = true
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when choice_normal
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when choice_hard
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = true
|
||||
when choice_cancel
|
||||
return
|
||||
end
|
||||
|
||||
message = _INTL("The game is currently on {1} difficulty.",get_difficulty_text())
|
||||
pbMessage(message)
|
||||
end
|
||||
|
||||
# Get difficulty for displaying in-game
|
||||
def getDisplayDifficulty
|
||||
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY] || $Trainer.lowest_difficulty <= 0
|
||||
return getDisplayDifficultyFromIndex(0)
|
||||
elsif $Trainer.lowest_difficulty <= 1
|
||||
return getDisplayDifficultyFromIndex(1)
|
||||
elsif $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return getDisplayDifficultyFromIndex(2)
|
||||
else
|
||||
return getDisplayDifficultyFromIndex(1)
|
||||
end
|
||||
end
|
||||
|
||||
def getDisplayDifficultyFromIndex(difficultyIndex)
|
||||
return _INTL("Easy") if difficultyIndex == 0
|
||||
return _INTL("Normal") if difficultyIndex == 1
|
||||
return _INTL("Hard") if difficultyIndex == 2
|
||||
return "???"
|
||||
end
|
||||
@@ -0,0 +1,35 @@
|
||||
def getGameModeFromIndex(index)
|
||||
return _INTL("Classic") if index == 0
|
||||
return _INTL("Random") if index == 1
|
||||
return _INTL("Remix") if index == 2
|
||||
return _INTL("Expert") if index == 3
|
||||
return _INTL("Species") if index == 4
|
||||
return _INTL("Debug") if index == 5
|
||||
return ""
|
||||
end
|
||||
|
||||
def getCurrentGameModeSymbol()
|
||||
gameMode = :CLASSIC
|
||||
if $game_switches[SWITCH_MODERN_MODE]
|
||||
gameMode = :REMIX
|
||||
end
|
||||
if $game_switches[SWITCH_EXPERT_MODE]
|
||||
gameMode = :EXPERT
|
||||
end
|
||||
if $game_switches[SWITCH_SINGLE_POKEMON_MODE]
|
||||
pokemon_number = pbGet(VAR_SINGLE_POKEMON_MODE)
|
||||
if pokemon_number.is_a?(Integer) && pokemon_number > 0
|
||||
gameMode = :SINGLE_SPECIES
|
||||
else
|
||||
gameMode = :DEBUG
|
||||
end
|
||||
end
|
||||
if $game_switches[SWITCH_RANDOMIZED_AT_LEAST_ONCE]
|
||||
gameMode = :RANDOMIZED
|
||||
end
|
||||
|
||||
if $game_switches[SWITCH_LEGENDARY_MODE]
|
||||
gameMode = :LEGENDARY
|
||||
end
|
||||
return gameMode
|
||||
end
|
||||
@@ -0,0 +1,170 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
GYM_TRAINERS = []
|
||||
GYM_LEADER_MAX_RETRIES = 20
|
||||
# def generate_legendaries_mode_trainers()
|
||||
# echoln "Converting trainers to legendary mode..."
|
||||
# trainers_list = getTrainersDataMode.list_all
|
||||
# for trainer_array in trainers_list
|
||||
# trainer = trainer_array[1]
|
||||
# echoln "------"
|
||||
# echoln "Processing [#{trainer.id}#] {trainer.traiàner_type} ##{trainer.real_name}"
|
||||
# new_party=[]
|
||||
# old_party = trainer.pokemon
|
||||
# for pokemon in old_party
|
||||
# species = pokemon[:species]
|
||||
# new_species = convert_species_to_legendary(species)
|
||||
# #echoln "#{get_readable_fusion_name(species)} -> #{get_readable_fusion_name(new_species)}"
|
||||
# end
|
||||
#
|
||||
# end
|
||||
# end
|
||||
|
||||
def initializeLegendaryMode()
|
||||
$game_variables[VAR_CURRENT_GYM_TYPE] = -1
|
||||
$game_switches[SWITCH_RANDOM_TRAINERS] = true
|
||||
$game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] = true
|
||||
$game_switches[SWITCH_GYM_RANDOM_EACH_BATTLE] = false
|
||||
$game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS] = true
|
||||
$game_switches[SWITCH_LEGENDARY_MODE] = true
|
||||
|
||||
addLegendaryEggsToPC
|
||||
$PokemonSystem.hide_custom_eggs = true
|
||||
$PokemonSystem.type_icons = true
|
||||
end
|
||||
|
||||
def convert_species_to_legendary(dex_number)
|
||||
species = GameData::Species.get(dex_number).species
|
||||
dex_number = getDexNumberForSpecies(species)
|
||||
return species if isTripleFusion?(dex_number)
|
||||
isFusion = isFusion(dex_number)
|
||||
new_species = isFusion ? convert_fusion_to_legendary(species) : convert_unfused_to_legendary(species)
|
||||
echoln "#{get_readable_fusion_name(species)} -> #{get_readable_fusion_name(new_species)}"
|
||||
return new_species
|
||||
end
|
||||
|
||||
# Takes an unfused Pokemon and fuses it with a random legendary
|
||||
def convert_unfused_to_legendary(unfused_species)
|
||||
legendary_species = LEGENDARIES_LIST.sample
|
||||
pokemon_to_fuse = [unfused_species, legendary_species].shuffle
|
||||
|
||||
head_species = pokemon_to_fuse[0]
|
||||
body_species = pokemon_to_fuse[1]
|
||||
|
||||
fusion_species = getFusionSpecies(body_species, head_species)
|
||||
if customSpriteExists(body_species, head_species) # && pokemonHasCorrectType(fusion_species)
|
||||
return fusion_species.species
|
||||
else
|
||||
# Try again
|
||||
return convert_unfused_to_legendary(unfused_species)
|
||||
end
|
||||
end
|
||||
|
||||
def convert_fusion_to_legendary(species, nb_retries = 0)
|
||||
permissive_type_validation = nb_retries >= GYM_LEADER_MAX_RETRIES
|
||||
if isInGym? && !permissive_type_validation
|
||||
getNewLegendaryFusionForGymType(species, nb_retries)
|
||||
else
|
||||
getNewLegendaryFusion(species, nb_retries)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def getNewLegendaryFusion(original_species, nb_retries = 0)
|
||||
head_species = get_head_id_from_symbol(original_species)
|
||||
body_species = get_body_id_from_symbol(original_species)
|
||||
|
||||
if rand(2) == 0
|
||||
head_species = LEGENDARIES_LIST.sample
|
||||
else
|
||||
body_species = LEGENDARIES_LIST.sample
|
||||
end
|
||||
|
||||
if customSpriteExists(body_species, head_species)
|
||||
return getFusionSpecies(body_species, head_species).species
|
||||
else
|
||||
# Try again
|
||||
return getNewLegendaryFusion(original_species, nb_retries + 1)
|
||||
end
|
||||
end
|
||||
|
||||
# In gyms, the game tries to figure out which of the head and body is of the
|
||||
# gym's type and replaces the other one with a legendary.
|
||||
# If there isn't one, it will eventually go in permissive mode and
|
||||
# replace either one
|
||||
def getNewLegendaryFusionForGymType(original_species, nb_retries = 0)
|
||||
return getNewLegendaryFusion(original_species, nb_retries) if nb_retries > GYM_LEADER_MAX_RETRIES
|
||||
|
||||
head_species_id = get_head_id_from_symbol(original_species)
|
||||
body_species_id = get_body_id_from_symbol(original_species)
|
||||
|
||||
head_species = GameData::Species.get(head_species_id)
|
||||
body_species = GameData::Species.get(body_species_id)
|
||||
|
||||
gym_type = getLeaderType()
|
||||
base_pokemon_with_gym_type = [head_species, body_species].select do |species|
|
||||
GameData::Species.get(species).hasType?(gym_type)
|
||||
end
|
||||
return getNewLegendaryFusion(original_species, nb_retries) if base_pokemon_with_gym_type.empty?
|
||||
|
||||
if base_pokemon_with_gym_type.length == 2
|
||||
pokemon_to_be_kept = base_pokemon_with_gym_type.sample
|
||||
pokemon_to_be_replaced = (base_pokemon_with_gym_type - [pokemon_to_be_kept]).first
|
||||
elsif base_pokemon_with_gym_type.length == 1
|
||||
# Only one has the gym type — keep it
|
||||
pokemon_to_be_kept = base_pokemon_with_gym_type.first
|
||||
pokemon_to_be_replaced = (pokemon_to_be_kept == head_species) ? body_species : head_species
|
||||
else #Neither have the type, just pick at random
|
||||
pokemon_to_be_kept = base_pokemon_with_gym_type.sample
|
||||
pokemon_to_be_replaced = (base_pokemon_with_gym_type - [pokemon_to_be_kept]).first
|
||||
end
|
||||
|
||||
echoln "gymType: #{gym_type} - body_species: #{body_species.species} head_species: #{head_species.species}, kept: #{pokemon_to_be_kept.species}"
|
||||
|
||||
legendary_species = LEGENDARIES_LIST.sample
|
||||
|
||||
if pokemon_to_be_replaced.species == head_species.species
|
||||
head_species_id = legendary_species
|
||||
else
|
||||
body_species_id = legendary_species
|
||||
end
|
||||
echoln "picked #{head_species_id}/#{body_species_id}"
|
||||
echoln "custom sprite exists: #{customSpriteExists(body_species_id, head_species_id)}"
|
||||
if customSpriteExists(body_species_id, head_species_id)
|
||||
return getFusionSpecies(body_species_id, head_species_id).species
|
||||
else
|
||||
return getNewLegendaryFusionForGymType(original_species, nb_retries + 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def isInGym?()
|
||||
return $game_variables[VAR_CURRENT_GYM_TYPE] != -1 && $game_variables[VAR_CURRENT_GYM_TYPE]<= GYM_TYPES_ARRAY.length
|
||||
end
|
||||
|
||||
def pokemonHasCorrectType(species)
|
||||
return true if !isInGym? # not in a gym
|
||||
leaderType = getLeaderType()
|
||||
if leaderType == nil
|
||||
return true
|
||||
else
|
||||
return species.hasType?(leaderType)
|
||||
end
|
||||
end
|
||||
|
||||
def addLegendaryEggsToPC()
|
||||
legendaries_species = LEGENDARIES_LIST.shuffle
|
||||
legendaries_species.each do |species|
|
||||
pokemon = Pokemon.new(species, Settings::EGG_LEVEL)
|
||||
pokemon.steps_to_hatch = pokemon.species_data.hatch_steps
|
||||
pokemon.name = "Egg"
|
||||
$PokemonStorage.pbStoreCaught(pokemon)
|
||||
end
|
||||
end
|
||||
|
||||
def generate_legendary_mode_starters
|
||||
grass_option = getFusionSpecies(Settings::GRASS_STARTERS.sample,LEGENDARIES_LIST.sample)
|
||||
fire_option = getFusionSpecies(Settings::FIRE_STARTERS.sample,LEGENDARIES_LIST.sample)
|
||||
water_option = getFusionSpecies(Settings::WATER_STARTERS.sample,LEGENDARIES_LIST.sample)
|
||||
return [grass_option, fire_option, water_option]
|
||||
end
|
||||
Reference in New Issue
Block a user