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
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 SaveData.register_conversion(:v20_add_battled_counts) do
essentials_version 20 essentials_version 20
display_title 'Adding Pokédex battle counts' display_title 'Adding Pokédex battle counts'

View File

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

View File

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

View File

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

View File

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

View File

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