new game plus

This commit is contained in:
infinitefusion
2022-04-14 20:29:23 -04:00
parent 3a12486fd2
commit 77fd81f2da
57 changed files with 189 additions and 26 deletions

View File

@@ -6,7 +6,7 @@
module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '5.0.0'
GAME_VERSION_NUMBER = "5.0.16 - beta"
GAME_VERSION_NUMBER = "5.0.17 - beta"
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18

View File

@@ -2,13 +2,13 @@
module Game
# Initializes various global variables and loads the game data.
def self.initialize
$PokemonTemp = PokemonTemp.new
$game_temp = Game_Temp.new
$game_system = Game_System.new
$data_animations = load_data('Data/Animations.rxdata')
$data_tilesets = load_data('Data/Tilesets.rxdata')
$PokemonTemp = PokemonTemp.new
$game_temp = Game_Temp.new
$game_system = Game_System.new
$data_animations = load_data('Data/Animations.rxdata')
$data_tilesets = load_data('Data/Tilesets.rxdata')
$data_common_events = load_data('Data/CommonEvents.rxdata')
$data_system = load_data('Data/System.rxdata')
$data_system = load_data('Data/System.rxdata')
pbLoadBattleAnimations
GameData.load_all
map_file = format('Data/Map%03d.rxdata', $data_system.start_map_id)
@@ -36,9 +36,50 @@ module Game
end
end
#For new game plus - resets everything in boxes/party to level 5 and 1st stage
def self.ngp_clean_pc_data(old_storage, old_party)
new_storage = old_storage
for pokemon in old_party
new_storage.pbStoreCaught(pokemon)
end
for box in new_storage.boxes
for pokemon in box.pokemon
if pokemon != nil
if !pokemon.egg?
pokemon.level = 5
pokemon.species = GameData::Species.get(pokemon.species).get_baby_species(false)
pokemon.reset_moves
end
end
end
end
return new_storage
end
#For new game plus - removes key items
def self.ngp_clean_item_data(old_bag)
new_storage = old_bag
new_storage.clear
for pocket in old_bag.pockets
for bagElement in pocket
item_id = bagElement[0]
item_qt = bagElement[1]
item = GameData::Item.get(item_id)
p item
if !item.is_key_item? && !item.is_HM?
new_storage.pbStoreItem(item, 1)
end
end
end
return new_storage
end
# Called when starting a new game. Initializes global variables
# and transfers the player into the map scene.
def self.start_new
def self.start_new(ngp_bag = nil, ngp_storage = nil, ngp_trainer = nil)
if $game_map && $game_map.events
$game_map.events.each_value { |event| event.clear_starting }
end
@@ -53,6 +94,13 @@ module Game
$PokemonEncounters.setup($game_map.map_id)
$game_map.autoplay
$game_map.update
#
# if ngp_bag != nil
# $PokemonBag = ngp_clean_item_data(ngp_bag)
# end
if ngp_storage != nil
$PokemonStorage = ngp_clean_pc_data(ngp_storage, ngp_trainer.party)
end
end
# Loads the game from the given save data and starts the map scene.

View File

@@ -110,8 +110,46 @@ module GameData
end
end
# Creates a battle-ready version of a trainer's data.
# @return [Array] all information about a trainer in a usable form
def replaceSingleSpeciesModeIfApplicable(species)
if $game_switches[SINGLE_POKEMON_MODE_SWITCH]
if $game_switches[SINGLE_POKEMON_MODE_HEAD_SWITCH]
return replaceFusionsHeadWithSpecies(species)
elsif $game_switches[SINGLE_POKEMON_MODE_BODY_SWITCH]
return replaceFusionsBodyWithSpecies(species)
elsif $game_switches[SINGLE_POKEMON_MODE_RANDOM_SWITCH]
if(rand(2) == 0)
return replaceFusionsHeadWithSpecies(species)
else
return replaceFusionsBodyWithSpecies(species)
end
end
end
return species
end
def replaceFusionsHeadWithSpecies(species)
speciesId = getDexNumberForSpecies(species)
if speciesId > NB_POKEMON
bodyPoke = getBodyID(speciesId)
headPoke = pbGet(SINGLE_POKEMON_MODE_VAR)
newSpecies = bodyPoke*NB_POKEMON+headPoke
return getPokemon(newSpecies)
end
return species
end
def replaceFusionsBodyWithSpecies(species)
speciesId = getDexNumberForSpecies(species)
if speciesId > NB_POKEMON
bodyPoke = pbGet(SINGLE_POKEMON_MODE_VAR)
headPoke = getHeadID(species)
newSpecies = bodyPoke*NB_POKEMON+headPoke
return getPokemon(newSpecies)
end
return species
end
def to_trainer
placeholder_species = [Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES,
Settings::VAR_1_PLACEHOLDER_SPECIES,
@@ -140,12 +178,13 @@ module GameData
if placeholder_species.include?(species)
species = replace_species_with_placeholder(species)
end
species = replaceSingleSpeciesModeIfApplicable(species)
if $game_switches[REVERSED_MODE]
species = reverseFusionSpecies(species)
end
level = pkmn_data[:level]
if $game_switches[GAME_DIFFICULTY_HARD]
level = (level*Settings::HARD_MODE_LEVEL_MODIFIER).ceil
level = (level * Settings::HARD_MODE_LEVEL_MODIFIER).ceil
if level > Settings::MAXIMUM_LEVEL
level = Settings::MAXIMUM_LEVEL
end
@@ -159,6 +198,7 @@ module GameData
end
####
#trainer rematch infinite fusion edit
if isRematch
nbRematch = getNumberRematch(rematchId)

View File

@@ -53,6 +53,7 @@ class PokeBattle_Battler
end
return if @fainted # Has already fainted properly
@battle.pbDisplayBrief(_INTL("{1} fainted!",pbThis)) if showMessage
updateSpirits()
PBDebug.log("[Pokémon fainted] #{pbThis} (#{@index})") if !showMessage
@battle.scene.pbFaintBattler(self)
pbInitEffects(false)
@@ -80,6 +81,15 @@ class PokeBattle_Battler
@battle.pbEndPrimordialWeather
end
def updateSpirits()
if $PokemonBag.pbQuantity(:ODDKEYSTONE)>=1 && @pokemon.hasType?(:GHOST)
nbSpirits = pbGet(ODDKEYSTONE_NB_VARIABLE)
if nbSpirits < 108
pbSet(ODDKEYSTONE_NB_VARIABLE,nbSpirits+1)
end
end
end
#=============================================================================
# Move PP
#=============================================================================

View File

@@ -305,7 +305,7 @@ def pbDive
move = :DIVE
movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder)
if $PokemonBag.pbQuantity(:SCUBAGEAR)>0
if $PokemonBag.pbQuantity(:SCUBAGEAR)<=0
pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
return false
end
@@ -343,10 +343,10 @@ def pbSurfacing
return if !surface_map_id
move = :DIVE
movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder)
pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
return false
end
# if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder)
# pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
# return false
# end
if pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
speciesname = (movefinder) ? movefinder.name : $Trainer.name
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))

View File

@@ -1,5 +1,5 @@
class PokemonBox
attr_reader :pokemon
attr_accessor :pokemon
attr_accessor :name
attr_accessor :background

View File

@@ -30,7 +30,9 @@ class Player < Trainer
attr_accessor :mystery_gift_unlocked
# @return [Array<Array>] downloaded Mystery Gift data
attr_accessor :mystery_gifts
attr_accessor :beat_league
attr_accessor :new_game_plus_unlocked
attr_accessor :new_game_plus
def trainer_type
if @trainer_type.is_a?(Integer)
@trainer_type = GameData::Metadata.get_player(@character_ID || 0)[0]
@@ -52,6 +54,13 @@ class Player < Trainer
@coins = value.clamp(0, Settings::MAX_COINS)
end
def beat_league=(value)
@beat_league = value
end
def new_game_plus_unlocked=(value)
@new_game_plus_unlocked = value
end
# Sets the player's Battle Points amount. It can not exceed
# {Settings::MAX_BATTLE_POINTS}.
# @param value [Integer] new Battle Points value
@@ -72,6 +81,10 @@ class Player < Trainer
return @badges.count { |badge| badge == true }
end
def new_game_plus=(value)
@new_game_plus = value
end
#=============================================================================
# (see Pokedex#seen?)
@@ -104,5 +117,8 @@ class Player < Trainer
@seen_storage_creator = false
@mystery_gift_unlocked = false
@mystery_gifts = []
@beat_league = false
@new_game_plus_unlocked = false
@new_game_plus = false
end
end

View File

@@ -284,6 +284,7 @@ class PokemonLoadScreen
cmd_debug = -1
cmd_quit = -1
show_continue = !@save_data.empty?
new_game_plus = @save_data[:player].new_game_plus_unlocked
if show_continue
commands[cmd_continue = commands.length] = _INTL('Continue')
if @save_data[:player].mystery_gift_unlocked
@@ -291,6 +292,9 @@ class PokemonLoadScreen
end
end
commands[cmd_new_game = commands.length] = _INTL('New Game')
if new_game_plus
commands[cmd_new_game_plus = commands.length] = _INTL('New Game +')
end
commands[cmd_options = commands.length] = _INTL('Options')
commands[cmd_language = commands.length] = _INTL('Language') if Settings::LANGUAGES.length >= 2
commands[cmd_debug = commands.length] = _INTL('Debug') if $DEBUG
@@ -312,6 +316,11 @@ class PokemonLoadScreen
@scene.pbEndScene
Game.start_new
return
when cmd_new_game_plus
@scene.pbEndScene
Game.start_new(@save_data[:bag],@save_data[:storage_system],@save_data[:player])
@save_data[:player].new_game_plus_unlocked=true
return
when cmd_mystery_gift
pbFadeOutIn { pbDownloadMysteryGift(@save_data[:player]) }
when cmd_options

View File

@@ -128,6 +128,16 @@ def pbChooseSpeciesList(default = nil)
return GameData::Species.get(dexNum)
end
def pbChooseSpeciesTextList(default = nil)
commands = []
for i in 1..NB_POKEMON
species = GameData::Species.get(i)
commands.push([species.id_number, species.real_name, species.id])
end
return pbChooseList(commands, default, nil, -1)
end
def pbChooseSpeciesFormList(default = nil)
commands = []
GameData::Species.each do |s|

View File

@@ -734,7 +734,7 @@ module Compiler
end
def main
#return
return
return if !$DEBUG
begin
dataFiles = [

View File

@@ -48,4 +48,11 @@ DIRECTION_DOWN = 2
DIRECTION_UP = 8
RACE_BIKE = 984
IS_REMATCH_SWITCH=200
IS_REMATCH_SWITCH=200
SINGLE_POKEMON_MODE_SWITCH=790
SINGLE_POKEMON_MODE_VAR=251
SINGLE_POKEMON_MODE_HEAD_SWITCH=791
SINGLE_POKEMON_MODE_BODY_SWITCH=792
SINGLE_POKEMON_MODE_RANDOM_SWITCH=793
ODDKEYSTONE_NB_VARIABLE=252

View File

@@ -373,6 +373,29 @@ ItemHandlers::UseFromBag.add(:DEBUGGER, proc { |item|
end
})
ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item|
TOTAL_SPIRITS_NEEDED = 108
nbSpirits = pbGet(ODDKEYSTONE_NB_VARIABLE)
if nbSpirits == 107
Kernel.pbMessage(_INTL("The Odd Keystone appears to be moving on its own."))
Kernel.pbMessage(_INTL("Voices can be heard whispering from it..."))
Kernel.pbMessage(_INTL("Just... one... more..."))
elsif nbSpirits < TOTAL_SPIRITS_NEEDED
nbNeeded = TOTAL_SPIRITS_NEEDED-nbSpirits
Kernel.pbMessage(_INTL("Voices can be heard whispering from the Odd Keystone..."))
Kernel.pbMessage(_INTL("Bring... us... {1}... spirits",nbNeeded.to_s))
else
Kernel.pbMessage(_INTL("The Odd Keystone appears to be moving on its own."))
Kernel.pbMessage(_INTL("It seems as if some poweful energy is trying to escape from it."))
if (Kernel.pbMessage("Let it out?", ["No","Yes"], 0)) == 1
pbWildBattle(:SPIRITOMB,27)
pbSet(ODDKEYSTONE_NB_VARIABLE,0)
end
next 1
end
})
ItemHandlers::UseFromBag.add(:MAGICBOOTS, proc { |item|
if $DEBUG
if Kernel.pbConfirmMessageSerious(_INTL("Take off the Magic Boots?"))