Refactored checking whether a Pokémon/species is single gendered, tweaked console message.

This commit is contained in:
Maruno17
2021-08-31 00:17:30 +01:00
parent 0405497868
commit 3c88c897f0
7 changed files with 38 additions and 24 deletions

View File

@@ -5,22 +5,19 @@ module Console
def self.setup_console def self.setup_console
return unless $DEBUG return unless $DEBUG
echoln "GPU Cache Max: #{Bitmap.max_size}" echoln "GPU Cache Max: #{Bitmap.max_size}"
echoln "--------------------------------" echoln "-------------------------------------------------------------------------------"
echoln "#{System.game_title} Output Window" echoln "#{System.game_title} Output Window"
echoln "--------------------------------" echoln "-------------------------------------------------------------------------------"
echoln "If you are seeing this window, you are running" echoln "If you can see this window, you are running the game in Debug Mode. This means"
echoln "#{System.game_title} in Debug Mode. This means" echoln "that you're either playing a debug version of the game, or you're playing from"
echoln "that you're either playing a Debug Version, or" echoln "within RPG Maker XP."
echoln "you are playing from within RPG Maker XP."
echoln "" echoln ""
echoln "Closing this window will close the game. If" echoln "Closing this window will close the game. If you want to get rid of this window,"
echoln "you want to get rid of this window, run the" echoln "run the program from the Shell, or download a release version of the game."
echoln "program from the Shell, or download a Release"
echoln "version."
echoln "" echoln ""
echoln "--------------------------------" echoln "-------------------------------------------------------------------------------"
echoln "Debug Output:" echoln "Debug Output:"
echoln "--------------------------------" echoln "-------------------------------------------------------------------------------"
echoln "" echoln ""
end end

View File

@@ -26,6 +26,12 @@ module GameData
def name def name
return _INTL(@real_name) return _INTL(@real_name)
end end
# @return [Boolean] whether a Pokémon with this gender ratio can only ever
# be a single gender
def single_gendered?
return @female_chance.nil?
end
end end
end end

View File

@@ -216,6 +216,10 @@ module GameData
return pbGetMessageFromHash(MessageTypes::Entries, @real_pokedex_entry) return pbGetMessageFromHash(MessageTypes::Entries, @real_pokedex_entry)
end end
def single_gendered?
return GameData::GenderRatio.get(@gender_ratio).single_gendered?
end
def apply_metrics_to_sprite(sprite, index, shadow = false) def apply_metrics_to_sprite(sprite, index, shadow = false)
if shadow if shadow
if (index & 1) == 1 # Foe Pokémon if (index & 1) == 1 # Foe Pokémon

View File

@@ -331,11 +331,12 @@ class Pokemon
# @return [0, 1, 2] this Pokémon's gender (0 = male, 1 = female, 2 = genderless) # @return [0, 1, 2] this Pokémon's gender (0 = male, 1 = female, 2 = genderless)
def gender def gender
if !@gender if !@gender
gender_ratio = species_data.gender_ratio if species_data.single_gendered?
case gender_ratio case species_data.gender_ratio
when :AlwaysMale then @gender = 0 when :AlwaysMale then @gender = 0
when :AlwaysFemale then @gender = 1 when :AlwaysFemale then @gender = 1
when :Genderless then @gender = 2 else @gender = 2
end
else else
female_chance = GameData::GenderRatio.get(gender_ratio).female_chance female_chance = GameData::GenderRatio.get(gender_ratio).female_chance
@gender = ((@personalID & 0xFF) < female_chance) ? 1 : 0 @gender = ((@personalID & 0xFF) < female_chance) ? 1 : 0
@@ -369,8 +370,7 @@ class Pokemon
# @return [Boolean] whether this Pokémon species is restricted to only ever being one # @return [Boolean] whether this Pokémon species is restricted to only ever being one
# gender (or genderless) # gender (or genderless)
def singleGendered? def singleGendered?
gender_ratio = species_data.gender_ratio return species_data.single_gendered?
return [:AlwaysMale, :AlwaysFemale, :Genderless].include?(gender_ratio)
end end
#============================================================================= #=============================================================================
@@ -1109,8 +1109,8 @@ class Pokemon
# @param species [Symbol, String, GameData::Species] Pokémon species # @param species [Symbol, String, GameData::Species] Pokémon species
# @param level [Integer] Pokémon level # @param level [Integer] Pokémon level
# @param owner [Owner, Player, NPCTrainer] Pokémon owner (the player by default) # @param owner [Owner, Player, NPCTrainer] Pokémon owner (the player by default)
# @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves # @param withMoves [Boolean] whether the Pokémon should have moves
# @param recheck_form [TrueClass, FalseClass] whether to auto-check the form # @param recheck_form [Boolean] whether to auto-check the form
def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true) def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true)
species_data = GameData::Species.get(species) species_data = GameData::Species.get(species)
@species = species_data.species @species = species_data.species

View File

@@ -151,8 +151,7 @@ class PokemonPokedexInfo_Scene
next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?) next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?)
next if sp.pokedex_form != sp.form next if sp.pokedex_form != sp.form
multiple_forms = true if sp.form > 0 multiple_forms = true if sp.form > 0
case sp.gender_ratio if sp.single_gendered?
when :AlwaysMale, :AlwaysFemale, :Genderless
real_gender = (sp.gender_ratio == :AlwaysFemale) ? 1 : 0 real_gender = (sp.gender_ratio == :AlwaysFemale) ? 1 : 0
next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
real_gender = 2 if sp.gender_ratio == :Genderless real_gender = 2 if sp.gender_ratio == :Genderless

View File

@@ -619,7 +619,7 @@ DebugMenuCommands.register("fillboxes", {
f = species_data.form f = species_data.form
# Record each form of each species as seen and owned # Record each form of each species as seen and owned
if f == 0 if f == 0
if [:AlwaysMale, :AlwaysFemale, :Genderless].include?(species_data.gender_ratio) if species_data.single_gendered?
g = (species_data.gender_ratio == :AlwaysFemale) ? 1 : 0 g = (species_data.gender_ratio == :AlwaysFemale) ? 1 : 0
$Trainer.pokedex.register(sp, g, f, false) $Trainer.pokedex.register(sp, g, f, false)
else # Both male and female else # Both male and female

View File

@@ -69,6 +69,14 @@ Maybe have multiple sets of Pickup items for multiple Gens. Probably not. Gens
Add a newer type of berry tree mechanics? Have a separate setting that prevents Add a newer type of berry tree mechanics? Have a separate setting that prevents
deterioration? deterioration?
The happiness evolution threshold value has lowered from 220 to 160. This is
because, in Gen 8, you have to use Pokémon Camp or berries to raise a Pokémon's
happiness above 179, which in turn is because affection effects have been added
(chance of resisting a KO, chance of shaking off a status problem, etc.) that
apply above 179 happiness. Pokémon Camp will not be added. Affection effects and
the 179 soft cap/160 evolution threshold may be added (the latter two should be
treated as related rather than separate settings).
#=============================================================================== #===============================================================================
# Implemented # Implemented
#=============================================================================== #===============================================================================