Give Nicknames (#142)

* Option: Give Nicknames
This commit is contained in:
Nathan-MV
2021-12-19 18:08:31 -03:00
committed by GitHub
parent 7f86db6da9
commit db4acd3369
6 changed files with 53 additions and 30 deletions

View File

@@ -131,6 +131,14 @@ SaveData.register_conversion(:v20_berry_plant_data) do
end
end
SaveData.register_conversion(:v20_add_default_nicknaming_option) do
essentials_version 20
display_title 'Updating Options to include nicknaming setting'
to_value :pokemon_system do |option|
option.givenicknames = 0 if option.givenicknames.nil?
end
end
SaveData.register_conversion(:v20_add_battled_counts) do
essentials_version 20
display_title 'Adding Pokédex battle counts'

View File

@@ -4,7 +4,7 @@ module Battle::CatchAndStoreMixin
#=============================================================================
def pbStorePokemon(pkmn)
# Nickname the Pokémon (unless it's a Shadow Pokémon)
if !pkmn.shadowPokemon?
if !pkmn.shadowPokemon? && $PokemonSystem.givenicknames == 0
if pbDisplayConfirm(_INTL("Would you like to give a nickname to {1}?", pkmn.name))
nickname = @scene.pbNameEntry(_INTL("{1}'s nickname?", pkmn.speciesName), pkmn)
pkmn.name = nickname
@@ -12,7 +12,7 @@ module Battle::CatchAndStoreMixin
end
# Store the Pokémon
stored_box = @peer.pbStorePokemon(pbPlayer, pkmn)
if stored_box.negative?
if stored_box < 0
pbDisplayPaused(_INTL("{1} has been added to your party.", pkmn.name))
@initialItems[0][pbPlayer.party.length - 1] = pkmn.item_id if @initialItems
return

View File

@@ -50,10 +50,12 @@ def pbPurify(pkmn, scene)
pkmn.exp = newexp
end
end
if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?", pkmn.speciesName))
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pkmn.speciesName),
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
pkmn.name = newname
if $PokemonSystem.givenicknames == 0
if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?", pkmn.speciesName))
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pkmn.speciesName),
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
pkmn.name = newname
end
end
end

View File

@@ -103,12 +103,15 @@ class PokemonEggHatch_Scene
pbMEPlay("Evolution success")
@pokemon.name = nil
pbMessage(_INTL("\\se[]{1} hatched from the Egg!\\wt[80]", @pokemon.name)) { update }
if pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",
@pokemon.name)) { update }
nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", @pokemon.name),
0, Pokemon::MAX_NAME_SIZE, "", @pokemon, true)
@pokemon.name = nickname
@nicknamed = true
if $PokemonSystem.givenicknames == 0
if pbConfirmMessage(
_INTL("Would you like to nickname the newly hatched {1}?", @pokemon.name)
) { update }
nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", @pokemon.name),
0, Pokemon::MAX_NAME_SIZE, "", @pokemon, true)
@pokemon.name = nickname
@nicknamed = true
end
end
end
@@ -206,10 +209,12 @@ def pbHatch(pokemon)
pbMessage(_INTL("...\1"))
pbMessage(_INTL("... .... .....\1"))
pbMessage(_INTL("{1} hatched from the Egg!", speciesname))
if pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?", speciesname))
nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", speciesname),
0, Pokemon::MAX_NAME_SIZE, "", pokemon)
pokemon.name = nickname
if $PokemonSystem.givenicknames == 0
if pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?", speciesname))
nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", speciesname),
0, Pokemon::MAX_NAME_SIZE, "", pokemon)
pokemon.name = nickname
end
end
end
end

View File

@@ -5,6 +5,7 @@ class PokemonSystem
attr_accessor :textspeed
attr_accessor :battlescene
attr_accessor :battlestyle
attr_accessor :givenicknames
attr_accessor :frame
attr_accessor :textskin
attr_accessor :screensize
@@ -15,17 +16,18 @@ class PokemonSystem
attr_accessor :textinput
def initialize
@textspeed = 1 # Text speed (0=slow, 1=normal, 2=fast)
@battlescene = 0 # Battle effects (animations) (0=on, 1=off)
@battlestyle = 0 # Battle style (0=switch, 1=set)
@frame = 0 # Default window frame (see also Settings::MENU_WINDOWSKINS)
@textskin = 0 # Speech frame
@screensize = (Settings::SCREEN_SCALE * 2).floor - 1 # 0=half size, 1=full size, 2=full-and-a-half size, 3=double size
@language = 0 # Language (see also Settings::LANGUAGES in script PokemonSystem)
@runstyle = 0 # Default movement speed (0=walk, 1=run)
@bgmvolume = 100 # Volume of background music and ME
@sevolume = 100 # Volume of sound effects
@textinput = 0 # Text input mode (0=cursor, 1=keyboard)
@textspeed = 1 # Text speed (0=slow, 1=normal, 2=fast)
@battlescene = 0 # Battle effects (animations) (0=on, 1=off)
@battlestyle = 0 # Battle style (0=switch, 1=set)
@givenicknames = 0 # Give nicknames (0=give, 1=don't give)
@frame = 0 # Default window frame (see also Settings::MENU_WINDOWSKINS)
@textskin = 0 # Speech frame
@screensize = (Settings::SCREEN_SCALE * 2).floor - 1 # 0=half size, 1=full size, 2=full-and-a-half size, 3=double size
@language = 0 # Language (see also Settings::LANGUAGES in script PokemonSystem)
@runstyle = 0 # Default movement speed (0=walk, 1=run)
@bgmvolume = 100 # Volume of background music and ME
@sevolume = 100 # Volume of sound effects
@textinput = 0 # Text input mode (0=cursor, 1=keyboard)
end
end
@@ -349,6 +351,10 @@ class PokemonOption_Scene
proc { $PokemonSystem.runstyle },
proc { |value| $PokemonSystem.runstyle = value }
),
EnumOption.new(_INTL("Give Nicknames"), [_INTL("Give"), _INTL("Don't give")],
proc { $PokemonSystem.givenicknames },
proc { |value| $PokemonSystem.givenicknames = value }
),
NumberOption.new(_INTL("Speech Frame"), 1, Settings::SPEECH_WINDOWSKINS.length,
proc { $PokemonSystem.textskin },
proc { |value|

View File

@@ -7,9 +7,11 @@ end
def pbNickname(pkmn)
species_name = pkmn.speciesName
if pbConfirmMessage(_INTL("Would you like to give a nickname to {1}?", species_name))
pkmn.name = pbEnterPokemonName(_INTL("{1}'s nickname?", species_name),
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
if $PokemonSystem.givenicknames == 0
if pbConfirmMessage(_INTL("Would you like to give a nickname to {1}?", species_name))
pkmn.name = pbEnterPokemonName(_INTL("{1}'s nickname?", species_name),
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
end
end
end