Merged species Type1/Type2 into Types, did the same for Pokemon and Battler

This commit is contained in:
Maruno17
2021-11-22 23:55:28 +00:00
parent a5f91f62ea
commit 00c2df5772
33 changed files with 3756 additions and 5552 deletions

View File

@@ -645,7 +645,7 @@ GameData::Evolution.register({
#===============================================================================
def pbEvolutionEvent(number)
return if !$player
$player.able_pokemon_party.each do |pkmn|
$player.able_party.each do |pkmn|
pkmn.trigger_event_evolution(number)
end
end

View File

@@ -8,8 +8,7 @@ module GameData
attr_reader :real_category
attr_reader :real_pokedex_entry
attr_reader :pokedex_form
attr_reader :type1
attr_reader :type2
attr_reader :types
attr_reader :base_stats
attr_reader :evs
attr_reader :base_exp
@@ -77,8 +76,7 @@ module GameData
"FormName" => [0, "q"],
"Category" => [0, "s"],
"Pokedex" => [0, "q"],
"Type1" => [0, "e", :Type],
"Type2" => [0, "e", :Type],
"Types" => [0, "eE", :Type, :Type],
"BaseStats" => [0, "vvvvvv"],
"EVs" => [0, "uuuuuu"],
"BaseExp" => [0, "v"],
@@ -110,6 +108,8 @@ module GameData
"BattlerShadowSize" => [0, "u"],
# All properties below here are old names for some properties above.
# They will be removed in v21.
"Type1" => [0, "e", :Type],
"Type2" => [0, "e", :Type],
"Rareness" => [0, "u"],
"Compatibility" => [0, "*e", :EggGroup],
"Kind" => [0, "s"],
@@ -142,51 +142,50 @@ module GameData
end
def initialize(hash)
@id = hash[:id]
@species = hash[:species] || @id
@form = hash[:form] || 0
@real_name = hash[:name] || "Unnamed"
@real_form_name = hash[:form_name]
@real_category = hash[:category] || "???"
@real_pokedex_entry = hash[:pokedex_entry] || "???"
@pokedex_form = hash[:pokedex_form] || @form
@type1 = hash[:type1] || :NORMAL
@type2 = hash[:type2] || @type1
@base_stats = hash[:base_stats] || {}
@evs = hash[:evs] || {}
@id = hash[:id]
@species = hash[:species] || @id
@form = hash[:form] || 0
@real_name = hash[:name] || "Unnamed"
@real_form_name = hash[:form_name]
@real_category = hash[:category] || "???"
@real_pokedex_entry = hash[:pokedex_entry] || "???"
@pokedex_form = hash[:pokedex_form] || @form
@types = hash[:types] || [:NORMAL]
@base_stats = hash[:base_stats] || {}
@evs = hash[:evs] || {}
GameData::Stat.each_main do |s|
@base_stats[s.id] = 1 if !@base_stats[s.id] || @base_stats[s.id] <= 0
@evs[s.id] = 0 if !@evs[s.id] || @evs[s.id] < 0
end
@base_exp = hash[:base_exp] || 100
@growth_rate = hash[:growth_rate] || :Medium
@gender_ratio = hash[:gender_ratio] || :Female50Percent
@catch_rate = hash[:catch_rate] || 255
@happiness = hash[:happiness] || 70
@moves = hash[:moves] || []
@tutor_moves = hash[:tutor_moves] || []
@egg_moves = hash[:egg_moves] || []
@abilities = hash[:abilities] || []
@hidden_abilities = hash[:hidden_abilities] || []
@wild_item_common = hash[:wild_item_common] || []
@wild_item_uncommon = hash[:wild_item_uncommon] || []
@wild_item_rare = hash[:wild_item_rare] || []
@egg_groups = hash[:egg_groups] || [:Undiscovered]
@hatch_steps = hash[:hatch_steps] || 1
@incense = hash[:incense]
@offspring = hash[:offspring] || []
@evolutions = hash[:evolutions] || []
@height = hash[:height] || 1
@weight = hash[:weight] || 1
@color = hash[:color] || :Red
@shape = hash[:shape] || :Head
@habitat = hash[:habitat] || :None
@generation = hash[:generation] || 0
@flags = hash[:flags] || []
@mega_stone = hash[:mega_stone]
@mega_move = hash[:mega_move]
@unmega_form = hash[:unmega_form] || 0
@mega_message = hash[:mega_message] || 0
@base_exp = hash[:base_exp] || 100
@growth_rate = hash[:growth_rate] || :Medium
@gender_ratio = hash[:gender_ratio] || :Female50Percent
@catch_rate = hash[:catch_rate] || 255
@happiness = hash[:happiness] || 70
@moves = hash[:moves] || []
@tutor_moves = hash[:tutor_moves] || []
@egg_moves = hash[:egg_moves] || []
@abilities = hash[:abilities] || []
@hidden_abilities = hash[:hidden_abilities] || []
@wild_item_common = hash[:wild_item_common] || []
@wild_item_uncommon = hash[:wild_item_uncommon] || []
@wild_item_rare = hash[:wild_item_rare] || []
@egg_groups = hash[:egg_groups] || [:Undiscovered]
@hatch_steps = hash[:hatch_steps] || 1
@incense = hash[:incense]
@offspring = hash[:offspring] || []
@evolutions = hash[:evolutions] || []
@height = hash[:height] || 1
@weight = hash[:weight] || 1
@color = hash[:color] || :Red
@shape = hash[:shape] || :Head
@habitat = hash[:habitat] || :None
@generation = hash[:generation] || 0
@flags = hash[:flags] || []
@mega_stone = hash[:mega_stone]
@mega_move = hash[:mega_move]
@unmega_form = hash[:unmega_form] || 0
@mega_message = hash[:mega_message] || 0
end
# @return [String] the translated name of this species

View File

@@ -6,8 +6,7 @@ class Battle::Battler
attr_reader :pokemon
attr_accessor :pokemonIndex
attr_accessor :species
attr_accessor :type1
attr_accessor :type2
attr_accessor :types
attr_accessor :ability_id
attr_accessor :item_id
attr_accessor :moves
@@ -304,8 +303,7 @@ class Battle::Battler
# same type more than once, and should not include any invalid type numbers
# (e.g. -1).
def pbTypes(withType3=false)
ret = [@type1]
ret.push(@type2) if @type2!=@type1
ret = @types.clone
# Burn Up erases the Fire-type.
ret.delete(:FIRE) if @effects[PBEffects::BurnUp]
# Roost erases the Flying-type. If there are no types left, adds the Normal-

View File

@@ -20,7 +20,7 @@ class Battle::Battler
@form = 0
@level = 0
@hp = @totalhp = 0
@type1 = @type2 = nil
@types = []
@ability_id = nil
@item_id = nil
@gender = 0
@@ -44,8 +44,7 @@ class Battle::Battler
@level = pkmn.level
@hp = pkmn.hp
@totalhp = pkmn.totalhp
@type1 = pkmn.type1
@type2 = pkmn.type2
@types = pkmn.types
# ability and item intentionally not copied across here
@gender = pkmn.gender
@attack = pkmn.attack
@@ -78,8 +77,7 @@ class Battle::Battler
@level = pkmn.level
@hp = pkmn.hp
@totalhp = pkmn.totalhp
@type1 = pkmn.type1
@type2 = pkmn.type2
@types = pkmn.types
@ability_id = pkmn.ability_id
@item_id = pkmn.item_id
@gender = pkmn.gender
@@ -312,8 +310,7 @@ class Battle::Battler
@spdef = @pokemon.spdef
@speed = @pokemon.speed
if fullChange
@type1 = @pokemon.type1
@type2 = @pokemon.type2
@types = @pokemon.types
@ability_id = @pokemon.ability_id
end
end

View File

@@ -127,13 +127,11 @@ class Battle::Battler
newTypes.push(:NORMAL) if newTypes.length == 0
newType3 = newType.effects[PBEffects::Type3]
newType3 = nil if newTypes.include?(newType3)
@type1 = newTypes[0]
@type2 = (newTypes.length == 1) ? newTypes[0] : newTypes[1]
@types = newTypes.clone
@effects[PBEffects::Type3] = newType3
else
newType = GameData::Type.get(newType).id
@type1 = newType
@type2 = newType
@types = [newType]
@effects[PBEffects::Type3] = nil
end
@effects[PBEffects::BurnUp] = false
@@ -141,8 +139,7 @@ class Battle::Battler
end
def pbResetTypes
@type1 = @pokemon.type1
@type2 = @pokemon.type2
@types = @pokemon.types
@effects[PBEffects::Type3] = nil
@effects[PBEffects::BurnUp] = false
@effects[PBEffects::Roost] = false

View File

@@ -2458,8 +2458,8 @@ class Battle::AI
when "UseTargetDefenseInsteadOfTargetSpDef"
#---------------------------------------------------------------------------
when "FailsUnlessTargetSharesTypeWithUser"
if !target.pbHasType?(user.type1) &&
!target.pbHasType?(user.type2)
if !(user.types[0] && target.pbHasType?(user.types[0])) &&
!(user.types[1] && target.pbHasType?(user.types[1]))
score -= 90
end
#---------------------------------------------------------------------------

View File

@@ -82,10 +82,10 @@ class Battle::AI
# For switching. Determines the effectiveness of a potential switch-in against
# an opposing battler.
def pbCalcTypeModPokemon(battlerThis,_battlerOther)
mod1 = Effectiveness.calculate(battlerThis.type1,target.type1,target.type2)
mod1 = Effectiveness.calculate(battlerThis.types[0], target.types[0], target.types[1])
mod2 = Effectiveness::NORMAL_EFFECTIVE
if battlerThis.type1!=battlerThis.type2
mod2 = Effectiveness.calculate(battlerThis.type2,target.type1,target.type2)
if battlerThis.types.length > 1
mod2 = Effectiveness.calculate(battlerThis.types[1], target.types[0], target.types[1])
mod2 = mod2.to_f / Effectivenesss::NORMAL_EFFECTIVE
end
return mod1*mod2
@@ -275,7 +275,7 @@ class Battle::AI
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
else
mult = Effectiveness.calculate(:FLYING,
target.type1,target.type2,target.effects[PBEffects::Type3])
target.types[0], target.types[1], target.effects[PBEffects::Type3])
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
end
end

View File

@@ -2590,19 +2590,17 @@ Battle::AbilityEffects::OnSwitchIn.add(:ANTICIPATION,
proc { |ability,battler,battle|
next if !battler.pbOwnedByPlayer?
battlerTypes = battler.pbTypes(true)
type1 = battlerTypes[0]
type2 = battlerTypes[1] || type1
type3 = battlerTypes[2] || type2
types = battlerTypes
found = false
battle.allOtherSideBattlers(battler.index).each do |b|
b.eachMove do |m|
next if m.statusMove?
if type1
if types.length > 0
moveType = m.type
if Settings::MECHANICS_GENERATION >= 6 && m.function == "TypeDependsOnUserIVs" # Hidden Power
moveType = pbHiddenPower(b.pokemon)[0]
end
eff = Effectiveness.calculate(moveType,type1,type2,type3)
eff = Effectiveness.calculate(moveType, types[0], types[1], types[2])
next if Effectiveness.ineffective?(eff)
next if !Effectiveness.super_effective?(eff) &&
!["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function)

View File

@@ -305,9 +305,7 @@ class PokemonEncounters
new_enc_list = []
enc_list.each do |enc|
species_data = GameData::Species.get(enc[1])
t1 = species_data.type1
t2 = species_data.type2
new_enc_list.push(enc) if t1 == favored_type || t2 == favored_type
new_enc_list.push(enc) if species_data.types.include?(favored_type)
end
enc_list = new_enc_list if new_enc_list.length > 0
end

View File

@@ -192,9 +192,9 @@ class BerryPlantMoistureSprite
def update_graphic
case @moisture_stage
when -1 then @sprite.setBitmap("")
when 0 then @sprite.setBitmap("Graphics/Characters/berrytreeDry")
when 1 then @sprite.setBitmap("Graphics/Characters/berrytreeDamp")
when 2 then @sprite.setBitmap("Graphics/Characters/berrytreeWet")
when 0 then @sprite.setBitmap("Graphics/Characters/berrytreedry")
when 1 then @sprite.setBitmap("Graphics/Characters/berrytreedamp")
when 2 then @sprite.setBitmap("Graphics/Characters/berrytreewet")
end
end

View File

@@ -192,10 +192,7 @@ class Battle::Battler
__shadow__pbInitPokemon(*arg)
# Called into battle
if shadowPokemon?
if GameData::Type.exists?(:SHADOW)
self.type1 = :SHADOW
self.type2 = :SHADOW
end
self.types = [:SHADOW] if GameData::Type.exists?(:SHADOW)
self.pokemon.change_heart_gauge("battle") if pbOwnedByPlayer?
end
end

View File

@@ -304,23 +304,21 @@ class Pokemon
# Types
#=============================================================================
# @return [Symbol] this Pokémon's first type
def type1
return species_data.type1
end
# @return [Symbol] this Pokémon's second type, or the first type if none is defined
def type2
sp_data = species_data
return sp_data.type2 || sp_data.type1
end
# @return [Array<Symbol>] an array of this Pokémon's types
def types
sp_data = species_data
ret = [sp_data.type1]
ret.push(sp_data.type2) if sp_data.type2 && sp_data.type2 != sp_data.type1
return ret
return species_data.types.clone
end
# @deprecated This method is slated to be removed in v21.
def type1
Deprecation.warn_method('type1', 'v21', 'pkmn.types')
return types[0]
end
# @deprecated This method is slated to be removed in v21.
def type2
Deprecation.warn_method('type2', 'v21', 'pkmn.types')
return types[1] || types[0]
end
# @param type [Symbol, String, GameData::Type] type to check

View File

@@ -359,8 +359,8 @@ class PokemonPokedex_Scene
_gender, form = $player.pokedex.last_form_seen(species)
species_data = GameData::Species.get_species_form(species, form)
color = species_data.color
type1 = species_data.type1
type2 = species_data.type2 || type1
type1 = species_data.types[0]
type2 = species_data.types[1] || type1
shape = species_data.shape
height = species_data.height
weight = species_data.weight

View File

@@ -258,14 +258,11 @@ class PokemonPokedexInfo_Scene
# Show the owned icon
imagepos.push(["Graphics/Pictures/Pokedex/icon_own", 212, 44])
# Draw the type icon(s)
type1 = species_data.type1
type2 = species_data.type2
type1_number = GameData::Type.get(type1).icon_position
type2_number = GameData::Type.get(type2).icon_position
type1rect = Rect.new(0, type1_number * 32, 96, 32)
type2rect = Rect.new(0, type2_number * 32, 96, 32)
overlay.blt(296, 120, @typebitmap.bitmap, type1rect)
overlay.blt(396, 120, @typebitmap.bitmap, type2rect) if type1 != type2
species_data.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(296 + 100 * i, 120, @typebitmap.bitmap, type_rect)
end
else
# Write the category
textpos.push([_INTL("????? Pokémon"), 246, 68, 0, base, shadow])

View File

@@ -452,15 +452,11 @@ class PokemonSummary_Scene
# Draw all text
pbDrawTextPositions(overlay,textpos)
# Draw Pokémon type(s)
type1_number = GameData::Type.get(@pokemon.type1).icon_position
type2_number = GameData::Type.get(@pokemon.type2).icon_position
type1rect = Rect.new(0, type1_number * 28, 64, 28)
type2rect = Rect.new(0, type2_number * 28, 64, 28)
if @pokemon.type1==@pokemon.type2
overlay.blt(402,146,@typebitmap.bitmap,type1rect)
else
overlay.blt(370,146,@typebitmap.bitmap,type1rect)
overlay.blt(436,146,@typebitmap.bitmap,type2rect)
@pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28)
type_x = (@pokemon.types.length == 1) ? 402 : 370 + 66 * i
overlay.blt(type_x, 146, @typebitmap.bitmap, type_rect)
end
# Draw Exp bar
if @pokemon.level<GameData::GrowthRate.max_level
@@ -790,15 +786,11 @@ class PokemonSummary_Scene
pbDrawTextPositions(overlay,textpos)
pbDrawImagePositions(overlay,imagepos)
# Draw Pokémon's type icon(s)
type1_number = GameData::Type.get(@pokemon.type1).icon_position
type2_number = GameData::Type.get(@pokemon.type2).icon_position
type1rect = Rect.new(0, type1_number * 28, 64, 28)
type2rect = Rect.new(0, type2_number * 28, 64, 28)
if @pokemon.type1==@pokemon.type2
overlay.blt(130,78,@typebitmap.bitmap,type1rect)
else
overlay.blt(96,78,@typebitmap.bitmap,type1rect)
overlay.blt(166,78,@typebitmap.bitmap,type2rect)
@pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28)
type_x = (@pokemon.types.length == 1) ? 130 : 96 + 70 * i
overlay.blt(type_x, 78, @typebitmap.bitmap, type_rect)
end
end

View File

@@ -1442,15 +1442,11 @@ class PokemonStorageScene
imagepos.push(["Graphics/Pictures/shiny",156,198])
end
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
type1_number = GameData::Type.get(pokemon.type1).icon_position
type2_number = GameData::Type.get(pokemon.type2).icon_position
type1rect = Rect.new(0, type1_number * 28, 64, 28)
type2rect = Rect.new(0, type2_number * 28, 64, 28)
if pokemon.type1==pokemon.type2
overlay.blt(52,272,typebitmap.bitmap,type1rect)
else
overlay.blt(18,272,typebitmap.bitmap,type1rect)
overlay.blt(88,272,typebitmap.bitmap,type2rect)
pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28)
type_x = (pokemon.types.length == 1) ? 52 : 18 + 70 * i
overlay.blt(type_x, 272, typebitmap.bitmap, type_rect)
end
drawMarkings(overlay,70,240,128,20,pokemon.markings)
pbDrawImagePositions(overlay,imagepos)

View File

@@ -52,15 +52,11 @@ class MoveRelearner_Scene
def pbDrawMoveList
overlay=@sprites["overlay"].bitmap
overlay.clear
type1_number = GameData::Type.get(@pokemon.type1).icon_position
type2_number = GameData::Type.get(@pokemon.type2).icon_position
type1rect=Rect.new(0, type1_number * 28, 64, 28)
type2rect=Rect.new(0, type2_number * 28, 64, 28)
if @pokemon.type1==@pokemon.type2
overlay.blt(400,70,@typebitmap.bitmap,type1rect)
else
overlay.blt(366,70,@typebitmap.bitmap,type1rect)
overlay.blt(436,70,@typebitmap.bitmap,type2rect)
@pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28)
type_x = (@pokemon.types.length == 1) ? 400 : 366 + 70 * i
overlay.blt(type_x, 70, @typebitmap.bitmap, type_rect)
end
textpos=[
[_INTL("Teach which move?"),16,2,0,Color.new(88,88,80),Color.new(168,184,184)]

View File

@@ -147,7 +147,7 @@ class PurifyChamberSet
end
def self.isSuperEffective(p1,p2)
return (typeAdvantage(p1.type1,p2.type1) || typeAdvantage(p1.type1,p2.type2))
return (typeAdvantage(p1.types[0], p2.types[0]) || typeAdvantage(p1.types[0], p2.types[1]))
end
end
@@ -272,7 +272,7 @@ class PurifyChamber
end
def debugAdd(set,shadow,type1,type2=nil)
pkmn=PseudoPokemon.new(shadow,type1,type2||type1)
pkmn = PseudoPokemon.new(shadow, type1, type2 || type1)
if pkmn.shadowPokemon?
self.setShadow(set,pkmn)
else
@@ -946,13 +946,15 @@ class PurifyChamberSetView < SpriteWrapper
pbSetSmallFont(@info.bitmap)
textpos=[]
if pkmn
if pkmn.type1==pkmn.type2
textpos.push([_INTL("{1} Lv.{2} {3}",pkmn.name,pkmn.level,GameData::Type.get(pkmn.type1).name),2,-6,0,
Color.new(248,248,248),Color.new(128,128,128)])
if pkmn.types.length == 1
textpos.push([_INTL("{1} Lv.{2} {3}", pkmn.name, pkmn.level,
GameData::Type.get(pkmn.types[0]).name),
2, -6, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)])
else
textpos.push([_INTL("{1} Lv.{2} {3}/{4}",pkmn.name,pkmn.level,GameData::Type.get(pkmn.type1).name,
GameData::Type.get(pkmn.type2).name),2,-6,0,
Color.new(248,248,248),Color.new(128,128,128)])
textpos.push([_INTL("{1} Lv.{2} {3}/{4}", pkmn.name, pkmn.level,
GameData::Type.get(pkmn.types[0]).name,
GameData::Type.get(pkmn.types[1]).name),
2, -6, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)])
end
textpos.push([_INTL("FLOW"),2+@info.bitmap.width/2,18,0,
Color.new(248,248,248),Color.new(128,128,128)])

View File

@@ -21,8 +21,8 @@ class TriadCard
spAtk = baseStats[:SPECIAL_ATTACK]
spDef = baseStats[:SPECIAL_DEFENSE]
speed = baseStats[:SPEED]
@type = species_data.type1
@type = species_data.type2 if @type == :NORMAL && species_data.type2
@type = species_data.types[0]
@type = species_data.types[1] if @type == :NORMAL && species_data.types[1]
@west = baseStatToValue(attack + speed / 3)
@east = baseStatToValue(defense + hp / 3)
@north = baseStatToValue(spAtk + speed / 3)

View File

@@ -344,9 +344,8 @@ def pbRandomPokemonFromRule(rules, trainer)
item = :LEFTOVERS
end
if item == :BLACKSLUDGE
type1 = GameData::Species.get(species).type1
type2 = GameData::Species.get(species).type2 || type1
item = :LEFTOVERS if type1 != :POISON && type2 != :POISON
types = GameData::Species.get(species).types
item = :LEFTOVERS if !types.include?(:POISON)
end
if item == :HEATROCK && !moves.any? { |m| m == :SUNNYDAY }
item = :LEFTOVERS

View File

@@ -3,9 +3,7 @@
#===============================================================================
def getTypes(species)
species_data = GameData::Species.get(species)
type1 = species_data.type1
type2 = species_data.type2
return (type1 == type2) ? [type1] : [type1, type2]
return species_data.types.clone
end
#===============================================================================

View File

@@ -333,8 +333,8 @@ def pbDecideWinnerScore(party0, party1, rating)
types2 = []
abilities = []
for j in 0...party1.length
types1.push(party1[j].type1)
types2.push(party1[j].type2)
types1.push(party1[j].types[0])
types2.push(party1[j].types[1] || party1[j].types[0])
abilities.push(party1[j].ability_id)
end
for i in 0...party0.length

View File

@@ -1001,8 +1001,8 @@ def pbPokemonEditor
[_INTL("FormName"), StringProperty, _INTL("Name of this form of the Pokémon.")],
[_INTL("Category"), StringProperty, _INTL("Kind of Pokémon species.")],
[_INTL("Pokédex"), StringProperty, _INTL("Description of the Pokémon as displayed in the Pokédex.")],
[_INTL("Type1"), TypeProperty, _INTL("Pokémon's type. If same as Type2, this Pokémon has a single type.")],
[_INTL("Type2"), TypeProperty, _INTL("Pokémon's type. If same as Type1, this Pokémon has a single type.")],
[_INTL("Type 1"), TypeProperty, _INTL("Pokémon's type. If same as Type 2, this Pokémon has a single type.")],
[_INTL("Type 2"), TypeProperty, _INTL("Pokémon's type. If same as Type 1, this Pokémon has a single type.")],
[_INTL("BaseStats"), BaseStatsProperty, _INTL("Base stats of the Pokémon.")],
[_INTL("EVs"), EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")],
[_INTL("BaseExp"), LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")],
@@ -1062,8 +1062,8 @@ def pbPokemonEditor
spec.real_form_name,
spec.real_category,
spec.real_pokedex_entry,
spec.type1,
(spec.type2 == spec.type1) ? nil : spec.type2,
spec.types[0],
spec.types[1],
spec.base_stats,
spec.evs,
spec.base_exp,
@@ -1100,10 +1100,10 @@ def pbPokemonEditor
# Edit the properties
if pbPropertyList(spec.id.to_s, data, species_properties, true)
# Sanitise data
data[5] = data[6] if !data[5] # Type1
data[6] = data[5] if !data[6] # Type2
types = [data[5], data[6]].uniq.compact # Types
types = nil if types.empty?
egg_groups = [data[26], data[27]].uniq.compact # Egg groups
egg_groups.push(:Undiscovered) if egg_groups.length == 0
egg_groups = nil if egg_groups.empty?
abilities = [data[17], data[18]].uniq.compact # Abilities
hidden_abilities = [data[19], data[20], data[21], data[22]].uniq.compact # Hidden abilities
# Construct species hash
@@ -1113,8 +1113,7 @@ def pbPokemonEditor
:form_name => data[2],
:category => data[3],
:pokedex_entry => data[4],
:type1 => data[5],
:type2 => data[6],
:types => types, # 5, 6
:base_stats => data[7],
:evs => data[8],
:base_exp => data[9],

View File

@@ -604,14 +604,16 @@ module Compiler
end
end
# Construct species hash
types = contents["Types"] || [contents["Type1"], contents["Type2"]]
types = [types] if !types.is_a?(Array)
types = types.uniq.compact
species_hash = {
:id => contents["InternalName"].to_sym,
:name => contents["Name"],
:form_name => contents["FormName"],
:category => contents["Category"] || contents["Kind"],
:pokedex_entry => contents["Pokedex"],
:type1 => contents["Type1"],
:type2 => contents["Type2"],
:types => types,
:base_stats => contents["BaseStats"],
:evs => contents["EVs"] || contents["EffortPoints"],
:base_exp => contents["BaseExp"] || contents["BaseEXP"],
@@ -791,6 +793,11 @@ module Compiler
end
# Construct species hash
form_symbol = sprintf("%s_%d", species_symbol.to_s, form).to_sym
types = contents["Types"]
types ||= [contents["Type1"], contents["Type2"]] if contents["Type1"]
types ||= base_data.types.clone
types = [types] if !types.is_a?(Array)
types = types.uniq.compact
moves = contents["Moves"]
if !moves
moves = []
@@ -810,8 +817,7 @@ module Compiler
:category => contents["Category"] || contents["Kind"] || base_data.real_category,
:pokedex_entry => contents["Pokedex"] || base_data.real_pokedex_entry,
:pokedex_form => contents["PokedexForm"],
:type1 => contents["Type1"] || base_data.type1,
:type2 => contents["Type2"] || base_data.type2,
:types => types,
:base_stats => contents["BaseStats"] || base_data.base_stats,
:evs => contents["EVs"] || contents["EffortPoints"] || base_data.evs,
:base_exp => contents["BaseExp"] || contents["BaseEXP"] || base_data.base_exp,
@@ -844,8 +850,6 @@ module Compiler
:unmega_form => contents["UnmegaForm"],
:mega_message => contents["MegaMessage"]
}
# If form is single-typed, ensure it remains so if base species is dual-typed
species_hash[:type2] = contents["Type1"] if contents["Type1"] && !contents["Type2"]
# If form has any wild items, ensure none are inherited from base species
if (contents["WildItemCommon"] && !contents["WildItemCommon"].empty?) ||
(contents["WildItemUncommon"] && !contents["WildItemUncommon"].empty?) ||

View File

@@ -280,8 +280,7 @@ module Compiler
f.write("\#-------------------------------\r\n")
f.write(sprintf("[%s]\r\n", species.id))
f.write(sprintf("Name = %s\r\n", species.real_name))
f.write(sprintf("Type1 = %s\r\n", species.type1))
f.write(sprintf("Type2 = %s\r\n", species.type2)) if species.type2 != species.type1
f.write(sprintf("Types = %s\r\n", species.types.uniq.compact.join(",")))
stats_array = []
evs_array = []
GameData::Stat.each_main do |s|
@@ -379,9 +378,8 @@ module Compiler
f.write(sprintf("MegaMove = %s\r\n", species.mega_move)) if species.mega_move
f.write(sprintf("UnmegaForm = %d\r\n", species.unmega_form)) if species.unmega_form != 0
f.write(sprintf("MegaMessage = %d\r\n", species.mega_message)) if species.mega_message != 0
if species.type1 != base_species.type1 || species.type2 != base_species.type2
f.write(sprintf("Type1 = %s\r\n", species.type1))
f.write(sprintf("Type2 = %s\r\n", species.type2)) if species.type2 != species.type1
if species.types.uniq.compact != base_species.types.uniq.compact
f.write(sprintf("Types = %s\r\n", species.types.uniq.compact.join(",")))
end
stats_array = []
evs_array = []