Tidied, fixed some bugs

This commit is contained in:
Maruno17
2021-02-28 23:58:53 +00:00
parent 9c2b6e943b
commit 57b3fe1b09
18 changed files with 224 additions and 266 deletions

View File

@@ -263,7 +263,7 @@ MultipleForms.register(:ROTOM,{
MultipleForms.register(:GIRATINA,{
"getForm" => proc { |pkmn|
maps = [49,50,51,72,73] # Map IDs for Origin Forme
if pkmn.hasItem?(:GRISEOUSORB) || maps.include?($game_map.map_id)
if pkmn.hasItem?(:GRISEOUSORB) || ($game_map && maps.include?($game_map.map_id))
next 1
end
next 0
@@ -597,9 +597,11 @@ MultipleForms.register(:NECROZMA,{
MultipleForms.register(:PIKACHU, {
"getForm" => proc { |pkmn|
next if pkmn.form_simple >= 2
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
next 1 if map_metadata && map_metadata.town_map_position &&
map_metadata.town_map_position[0] == 1 # Tiall region
if $game_map
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
next 1 if map_metadata && map_metadata.town_map_position &&
map_metadata.town_map_position[0] == 1 # Tiall region
end
next 0
}
})

View File

@@ -970,8 +970,9 @@ class Pokemon
# @param species [Symbol, String, Integer] Pokémon species
# @param level [Integer] Pokémon level
# @param owner [Owner, PlayerTrainer, NPCTrainer] Pokémon owner (the player by default)
# @param withMoves [Boolean] whether the Pokémon should have moves
def initialize(species, level, owner = $Trainer, withMoves = true)
# @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves
# @param rechech_form [TrueClass, FalseClass] whether to auto-check the form
def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true)
species_data = GameData::Species.get(species)
@species = species_data.species
@form = species_data.form
@@ -1030,7 +1031,7 @@ class Pokemon
@hp = 1
@totalhp = 1
calcStats
if @form == 0
if @form == 0 && recheck_form
f = MultipleForms.call("getFormOnCreation", self)
if f
self.form = f

View File

@@ -28,7 +28,7 @@ class PokeBattle_Pokemon
return pkmn if pkmn.is_a?(Pokemon)
owner = Pokemon::Owner.new(pkmn.trainerID, pkmn.ot, pkmn.otgender, pkmn.language)
# Set level to 1 initially, as it will be recalculated later
ret = Pokemon.new(pkmn.species, 1, owner, false)
ret = Pokemon.new(pkmn.species, 1, owner, false, false)
ret.forced_form = pkmn.forcedForm if pkmn.forcedForm
ret.time_form_set = pkmn.formTime
ret.exp = pkmn.exp
@@ -43,7 +43,9 @@ class PokeBattle_Pokemon
ret.item = pkmn.item
ret.mail = PokemonMail.copy(pkmn.mail) if pkmn.mail
pkmn.moves.each { |m| ret.moves.push(PBMove.copy(m)) if m && m.id > 0 }
pkmn.firstmoves.each { |m| ret.add_first_move(m) }
if pkmn.firstmoves
pkmn.firstmoves.each { |m| ret.add_first_move(m) }
end
if pkmn.ribbons
pkmn.ribbons.each { |r| ret.giveRibbon(r) }
end