Fixed animations played by an event command being mispositioned, fixed Geomancy, removed $PokemonGlobal.playerID, tweaked player/bag object creation, overrode type effectiveness for Shadow moves, bug fixes

This commit is contained in:
Maruno17
2021-04-17 19:32:54 +01:00
parent 4bc744e3fb
commit 4489cde044
25 changed files with 125 additions and 96 deletions

View File

@@ -40,8 +40,6 @@ class Trainer
def gender; return GameData::TrainerType.get(@trainer_type).gender; end
def male?; return GameData::TrainerType.get(@trainer_type).male?; end
def female?; return GameData::TrainerType.get(@trainer_type).female?; end
alias isMale? male?
alias isFemale? female?
def skill_level; return GameData::TrainerType.get(@trainer_type).skill_level; end
def skill_code; return GameData::TrainerType.get(@trainer_type).skill_code; end

View File

@@ -2,8 +2,8 @@
# Trainer class for the player
#===============================================================================
class Player < Trainer
# @param value [Integer] new character ID
attr_writer :character_ID
# @return [Integer] the character ID of the player
attr_accessor :character_ID
# @return [Integer] the player's outfit
attr_accessor :outfit
# @return [Array<Boolean>] the player's Gym Badges (true if owned)
@@ -38,12 +38,6 @@ class Player < Trainer
return str
end
# @return [Integer] the character ID of the player
def character_ID
@character_ID = $PokemonGlobal.playerID || 0 if !@character_ID
return @character_ID
end
# Sets the player's money. It can not exceed {Settings::MAX_MONEY}.
# @param value [Integer] new money value
def money=(value)
@@ -96,7 +90,7 @@ class Player < Trainer
def initialize(name, trainer_type)
super
@character_ID = nil
@character_ID = -1
@outfit = 0
@badges = [false] * 8
@money = Settings::INITIAL_MONEY

View File

@@ -34,11 +34,12 @@ class Player < Trainer
# Sets the given species as seen in the Pokédex.
# @param species [Symbol, GameData::Species] species to set as seen
def set_seen(species)
# @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated
def set_seen(species, should_refresh_dexes = true)
species_id = GameData::Species.try_get(species)&.species
return if species_id.nil?
@seen[species_id] = true
self.refresh_accessible_dexes
self.refresh_accessible_dexes if should_refresh_dexes
end
# @param species [Symbol, GameData::Species] species to check
@@ -116,11 +117,12 @@ class Player < Trainer
# Sets the given species as owned in the Pokédex.
# @param species [Symbol, GameData::Species] species to set as owned
def set_owned(species)
# @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated
def set_owned(species, should_refresh_dexes = true)
species_id = GameData::Species.try_get(species)&.species
return if species_id.nil?
@owned[species_id] = true
self.refresh_accessible_dexes
self.refresh_accessible_dexes if should_refresh_dexes
end
# Sets the given species as owned in the Pokédex.
@@ -162,7 +164,7 @@ class Player < Trainer
# @param pkmn [Pokemon, Symbol, GameData::Species] Pokemon to register as seen
# @param gender [Integer] gender to register (0=male, 1=female, 2=genderless)
# @param form [Integer] form to register
def register(species, gender = 0, form = 0)
def register(species, gender = 0, form = 0, should_refresh_dexes = true)
if species.is_a?(Pokemon)
species_data = species.species_data
gender = species.gender
@@ -183,7 +185,7 @@ class Player < Trainer
@seen_forms[species][gender][form] = true
@last_seen_forms[species] ||= []
@last_seen_forms[species] = [gender, form] if @last_seen_forms[species] == []
self.refresh_accessible_dexes
self.refresh_accessible_dexes if should_refresh_dexes
end
# @param pkmn [Pokemon] Pokemon to register as most recently seen

View File

@@ -7,6 +7,8 @@ class Trainer
deprecated_method_alias :secretID, :secret_ID, removal_in: 'v20'
deprecated_method_alias :getForeignID, :make_foreign_ID, removal_in: 'v20'
deprecated_method_alias :trainerTypeName, :trainer_type_name, removal_in: 'v20'
deprecated_method_alias :isMale?, :male?, removal_in: 'v20'
deprecated_method_alias :isFemale?, :female?, removal_in: 'v20'
deprecated_method_alias :moneyEarned, :base_money, removal_in: 'v20'
deprecated_method_alias :skill, :skill_level, removal_in: 'v20'
deprecated_method_alias :skillCode, :skill_code, removal_in: 'v20'
@@ -75,6 +77,7 @@ class Player < Trainer
end
end
# @deprecated Use {Player} instead. PokeBattle_Trainer is slated to be removed in v20.
class PokeBattle_Trainer
attr_reader :trainertype, :name, :id, :metaID, :outfit, :language
attr_reader :party, :badges, :money