Added Flags property to types, abilities, species and map metadata. Added LocationFlag evolution method.

This commit is contained in:
Maruno17
2021-09-02 19:01:16 +01:00
parent cfbefceb00
commit 86cbcad382
39 changed files with 1200 additions and 1183 deletions

View File

@@ -101,6 +101,10 @@ class Game_Map
ret.gsub!(/\\PN/,$Trainer.name) if $Trainer
return ret
end
def metadata
return GameData::MapMetadata.try_get(@map_id)
end
#-----------------------------------------------------------------------------
# * Autoplays background music
# Plays music called "[normal BGM]_n" if it's night time and it exists
@@ -319,7 +323,7 @@ class Game_Map
def display_x=(value)
return if @display_x == value
@display_x = value
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
if metadata&.snap_edges
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
@display_x = [0, [@display_x, max_x].min].max
end
@@ -329,7 +333,7 @@ class Game_Map
def display_y=(value)
return if @display_y == value
@display_y = value
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
if metadata&.snap_edges
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
@display_y = [0, [@display_y, max_y].min].max
end

View File

@@ -423,9 +423,7 @@ end
def pbCanUseBike?(map_id)
map_metadata = GameData::MapMetadata.try_get(map_id)
return false if !map_metadata
return true if map_metadata.always_bicycle
val = map_metadata.can_bicycle || map_metadata.outdoor_map
return (val) ? true : false
return map_metadata.always_bicycle || map_metadata.can_bicycle || map_metadata.outdoor_map
end
def pbMountBike

View File

@@ -200,8 +200,7 @@ GameData::Evolution.register({
:id => :LevelDarkness,
:parameter => Integer,
:level_up_proc => proc { |pkmn, parameter|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
next pkmn.level >= parameter && map_metadata && map_metadata.dark_map
next pkmn.level >= parameter && $game_map.metadata&.dark_map
}
})
@@ -489,12 +488,21 @@ GameData::Evolution.register({
}
})
GameData::Evolution.register({
:id => :LocationFlag,
:parameter => String,
:minimum_level => 1, # Needs any level up
:level_up_proc => proc { |pkmn, parameter|
next $game_map.metadata&.has_flag?(parameter)
}
})
GameData::Evolution.register({
:id => :Region,
:parameter => Integer,
:minimum_level => 1, # Needs any level up
:level_up_proc => proc { |pkmn, parameter|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
map_metadata = $game_map.metadata
next map_metadata && map_metadata.town_map_position &&
map_metadata.town_map_position[0] == parameter
}

View File

@@ -4,6 +4,7 @@ module GameData
attr_reader :real_name
attr_reader :special_type
attr_reader :pseudo_type
attr_reader :flags
attr_reader :weaknesses
attr_reader :resistances
attr_reader :immunities
@@ -13,14 +14,15 @@ module GameData
DATA_FILENAME = "types.dat"
SCHEMA = {
"Name" => [1, "s"],
"InternalName" => [2, "s"],
"IsPseudoType" => [3, "b"],
"IsSpecialType" => [4, "b"],
"Weaknesses" => [5, "*s"],
"Resistances" => [6, "*s"],
"Immunities" => [7, "*s"],
"IconPosition" => [8, "u"]
"Name" => [0, "s"],
"InternalName" => [0, "s"],
"IsSpecialType" => [0, "b"],
"IsPseudoType" => [0, "b"],
"Flags" => [0, "*s"],
"Weaknesses" => [0, "*s"],
"Resistances" => [0, "*s"],
"Immunities" => [0, "*s"],
"IconPosition" => [0, "u"]
}
extend ClassMethodsSymbols
@@ -29,8 +31,9 @@ module GameData
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@pseudo_type = hash[:pseudo_type] || false
@special_type = hash[:special_type] || false
@pseudo_type = hash[:pseudo_type] || false
@flags = hash[:flags] || []
@weaknesses = hash[:weaknesses] || []
@weaknesses = [@weaknesses] if !@weaknesses.is_a?(Array)
@resistances = hash[:resistances] || []
@@ -48,6 +51,10 @@ module GameData
def physical?; return !@special_type; end
def special?; return @special_type; end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
def effectiveness(other_type)
return Effectiveness::NORMAL_EFFECTIVE_ONE if !other_type
return Effectiveness::SUPER_EFFECTIVE_ONE if @weaknesses.include?(other_type)

View File

@@ -3,6 +3,7 @@ module GameData
attr_reader :id
attr_reader :real_name
attr_reader :real_description
attr_reader :flags
DATA = {}
DATA_FILENAME = "abilities.dat"
@@ -12,13 +13,15 @@ module GameData
SCHEMA = {
"Name" => [:name, "s"],
"Description" => [:description, "q"]
"Description" => [:description, "q"],
"Flags" => [:flags, "*s"]
}
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@real_description = hash[:description] || "???"
@flags = hash[:flags] || []
end
# @return [String] the translated name of this ability
@@ -30,5 +33,9 @@ module GameData
def description
return pbGetMessageFromHash(MessageTypes::AbilityDescs, @real_description)
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -10,7 +10,7 @@ module GameData
attr_reader :field_use
attr_reader :battle_use
attr_reader :consumable
attr_reader :type
attr_reader :flags
attr_reader :move
DATA = {}
@@ -30,10 +30,7 @@ module GameData
"OnMoveReusable" => 2, "OnBattlerReusable" => 3,
"OnFoeReusable" => 4, "DirectReusable" => 5}],
"Consumable" => [:consumable, "b"],
"Type" => [:type, "e", {"Mail" => 1, "IconMail" => 2, "SnagBall" => 3,
"PokeBall" => 4, "Berry" => 5, "KeyItem" => 6,
"EvolutionStone" => 7, "Fossil" => 8, "Apricorn" => 9,
"TypeGem" => 10, "Mulch" => 11, "MegaStone" => 12}],
"Flags" => [:flags, "*s"],
"Move" => [:move, "e", :Move]
}
@@ -95,7 +92,7 @@ module GameData
@real_description = hash[:description] || "???"
@field_use = hash[:field_use] || 0
@battle_use = hash[:battle_use] || 0
@type = hash[:type] || 0
@flags = hash[:flags] || []
@consumable = hash[:consumable]
@consumable = !is_important? if @consumable.nil?
@move = hash[:move]
@@ -116,22 +113,26 @@ module GameData
return pbGetMessageFromHash(MessageTypes::ItemDescriptions, @real_description)
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
def is_TM?; return @field_use == 3; end
def is_HM?; return @field_use == 4; end
def is_TR?; return @field_use == 6; end
def is_machine?; return is_TM? || is_HM? || is_TR?; end
def is_mail?; return @type == 1 || @type == 2; end
def is_icon_mail?; return @type == 2; end
def is_poke_ball?; return @type == 3 || @type == 4; end
def is_snag_ball?; return @type == 3 || (@type == 4 && $Trainer.has_snag_machine); end
def is_berry?; return @type == 5; end
def is_key_item?; return @type == 6; end
def is_evolution_stone?; return @type == 7; end
def is_fossil?; return @type == 8; end
def is_apricorn?; return @type == 9; end
def is_gem?; return @type == 10; end
def is_mulch?; return @type == 11; end
def is_mega_stone?; return @type == 12; end # Does NOT include Red Orb/Blue Orb
def is_mail?; return has_flag?("Mail") || has_flag?("IconMail"); end
def is_icon_mail?; return has_flag?("IconMail"); end
def is_poke_ball?; return has_flag?("PokeBall") || has_flag?("SnagBall"); end
def is_snag_ball?; return has_flag?("SnagBall") || (is_poke_ball? && $Trainer.has_snag_machine); end
def is_berry?; return has_flag?("Berry"); end
def is_key_item?; return has_flag?("KeyItem"); end
def is_evolution_stone?; return has_flag?("EvolutionStone"); end
def is_fossil?; return has_flag?("Fossil"); end
def is_apricorn?; return has_flag?("Apricorn"); end
def is_gem?; return has_flag?("TypeGem"); end
def is_mulch?; return has_flag?("Mulch"); end
def is_mega_stone?; return has_flag?("MegaStone"); end # Does NOT include Red Orb/Blue Orb
def is_important?
return true if is_key_item? || is_HM? || is_TM?

View File

@@ -35,6 +35,7 @@ module GameData
attr_reader :shape
attr_reader :habitat
attr_reader :generation
attr_reader :flags
attr_reader :mega_stone
attr_reader :mega_move
attr_reader :unmega_form
@@ -105,6 +106,7 @@ module GameData
"Shape" => [0, "e", :BodyShape],
"Habitat" => [0, "e", :Habitat],
"Generation" => [0, "i"],
"Flags" => [0, "*s"],
"BattlerPlayerX" => [0, "i"],
"BattlerPlayerY" => [0, "i"],
"BattlerEnemyX" => [0, "i"],
@@ -183,6 +185,7 @@ module GameData
@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
@@ -220,6 +223,10 @@ module GameData
return GameData::GenderRatio.get(@gender_ratio).single_gendered?
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
def apply_metrics_to_sprite(sprite, index, shadow = false)
if shadow
if (index & 1) == 1 # Foe Pokémon

View File

@@ -5,7 +5,7 @@ module GameData
attr_reader :gender
attr_reader :base_money
attr_reader :skill_level
attr_reader :skill_flags
attr_reader :flags
attr_reader :intro_ME
attr_reader :battle_BGM
attr_reader :victory_ME
@@ -21,7 +21,7 @@ module GameData
"Mixed" => 2, "mixed" => 2, "X" => 2, "x" => 2, "2" => 2}],
"BaseMoney" => [:base_money, "u"],
"SkillLevel" => [:skill_level, "u"],
"SkillFlags" => [:skill_flags, "*s"],
"Flags" => [:flags, "*s"],
"IntroME" => [:intro_ME, "s"],
"BattleBGM" => [:battle_BGM, "s"],
"VictoryME" => [:victory_ME, "s"]
@@ -85,7 +85,7 @@ module GameData
@gender = hash[:gender] || 2
@base_money = hash[:base_money] || 30
@skill_level = hash[:skill_level] || @base_money
@skill_flags = hash[:skill_flags] || []
@flags = hash[:flags] || []
@intro_ME = hash[:intro_ME]
@battle_BGM = hash[:battle_BGM]
@victory_ME = hash[:victory_ME]
@@ -98,5 +98,9 @@ module GameData
def male?; return @gender == 0; end
def female?; return @gender == 1; end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -21,6 +21,7 @@ module GameData
attr_reader :wild_capture_ME
attr_reader :town_map_size
attr_reader :battle_environment
attr_reader :flags
DATA = {}
DATA_FILENAME = "map_metadata.dat"
@@ -45,7 +46,8 @@ module GameData
"TrainerVictoryME" => [17, "s"],
"WildCaptureME" => [18, "s"],
"MapSize" => [19, "us"],
"Environment" => [20, "e", :Environment]
"Environment" => [20, "e", :Environment],
"Flags" => [21, "*s"]
}
extend ClassMethodsIDNumbers
@@ -72,7 +74,8 @@ module GameData
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle on this map.")],
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a wild Pokémon on this map.")],
["MapSize", MapSizeProperty, _INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
["Environment", GameDataProperty.new(:Environment), _INTL("The default battle environment for battles on this map.")]
["Environment", GameDataProperty.new(:Environment), _INTL("The default battle environment for battles on this map.")],
["Flags", StringListProperty, _INTL("Words/phrases that distinguish this map from others.")]
]
end
@@ -98,6 +101,7 @@ module GameData
@wild_capture_ME = hash[:wild_capture_ME]
@town_map_size = hash[:town_map_size]
@battle_environment = hash[:battle_environment]
@flags = hash[:flags] || []
end
def property_from_string(str)
@@ -122,8 +126,13 @@ module GameData
when "WildCaptureME" then return @wild_capture_ME
when "MapSize" then return @town_map_size
when "Environment" then return @battle_environment
when "Flags" then return @flags
end
return nil
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -223,7 +223,7 @@ end
Events.onMapChanging += proc { |_sender, e|
new_map_ID = e[0]
next if new_map_ID == 0
old_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
old_map_metadata = $game_map.metadata
next if !old_map_metadata || !old_map_metadata.weather
map_infos = pbLoadMapInfos
if $game_map.name == map_infos[new_map_ID].name
@@ -236,7 +236,7 @@ Events.onMapChanging += proc { |_sender, e|
# Set up various data related to the new map
Events.onMapChange += proc { |_sender, e|
old_map_ID = e[0] # previous map ID, is 0 if no map ID
new_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
new_map_metadata = $game_map.metadata
if new_map_metadata && new_map_metadata.teleport_destination
$PokemonGlobal.healingSpot = new_map_metadata.teleport_destination
end
@@ -267,7 +267,7 @@ Events.onMapSceneChange += proc { |_sender, e|
$PokemonGlobal.mapTrail = [$game_map.map_id] + $PokemonGlobal.mapTrail
end
# Display darkness circle on dark maps
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
map_metadata = $game_map.metadata
if map_metadata && map_metadata.dark_map
$PokemonTemp.darknessSprite = DarknessSprite.new
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)

View File

@@ -137,8 +137,8 @@ def pbPrepareBattle(battle)
backdrop = $PokemonGlobal.nextBattleBack
elsif $PokemonGlobal.surfing
backdrop = "water" # This applies wherever you are, including in caves
elsif GameData::MapMetadata.exists?($game_map.map_id)
back = GameData::MapMetadata.get($game_map.map_id).battle_background
elsif $game_map.metadata
back = $game_map.metadata.battle_background
backdrop = back if back && back != ""
end
backdrop = "indoor1" if !backdrop
@@ -152,8 +152,7 @@ def pbPrepareBattle(battle)
end
battle.backdropBase = base if base
# Time of day
if GameData::MapMetadata.exists?($game_map.map_id) &&
GameData::MapMetadata.get($game_map.map_id).battle_environment == :Cave
if $game_map.metadata&.battle_environment == :Cave
battle.time = 2 # This makes Dusk Balls work properly in caves
elsif Settings::TIME_SHADING
timeNow = pbGetTimeNow
@@ -171,8 +170,8 @@ end
# Wormadam.
def pbGetEnvironment
ret = :None
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
ret = map_metadata.battle_environment if map_metadata && map_metadata.battle_environment
map_env = $game_map.metadata&.battle_environment
ret = map_env if map_env
if $PokemonTemp.encounterType &&
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
terrainTag = $game_player.pbFacingTerrainTag

View File

@@ -41,8 +41,7 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
location = 3
elsif $PokemonEncounters.has_cave_encounters?
location = 2
elsif !GameData::MapMetadata.exists?($game_map.map_id) ||
!GameData::MapMetadata.get($game_map.map_id).outdoor_map
elsif !$game_map.metadata&.outdoor_map
location = 1
end
anim = ""

View File

@@ -115,8 +115,7 @@ end
def pbDayNightTint(object)
return if !$scene.is_a?(Scene_Map)
if Settings::TIME_SHADING && GameData::MapMetadata.exists?($game_map.map_id) &&
GameData::MapMetadata.get($game_map.map_id).outdoor_map
if Settings::TIME_SHADING && $game_map.metadata&.outdoor_map
tone = PBDayNight.getTone
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
else

View File

@@ -297,7 +297,7 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
#===============================================================================
def pbDive
return false if $game_player.pbFacingEvent
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
map_metadata = $game_map.metadata
return false if !map_metadata || !map_metadata.dive_map_id
move = :DIVE
movefinder = $Trainer.get_pokemon_with_move(move)
@@ -408,8 +408,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
next false
end
else
if !GameData::MapMetadata.exists?($game_map.map_id) ||
!GameData::MapMetadata.get($game_map.map_id).dive_map_id
if !$game_map.metadata&.dive_map_id
pbMessage(_INTL("Can't use that here.")) if showmsg
next false
end
@@ -431,8 +430,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
break
end
else
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
dive_map_id = map_metadata.dive_map_id if map_metadata
dive_map_id = $game_map.metadata&.dive_map_id
end
next false if !dive_map_id
if !pbHiddenMoveAnimation(pokemon)
@@ -460,8 +458,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
#===============================================================================
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_FLASH,showmsg)
if !GameData::MapMetadata.exists?($game_map.map_id) ||
!GameData::MapMetadata.get($game_map.map_id).dark_map
if !$game_map.metadata&.dark_map
pbMessage(_INTL("Can't use that here.")) if showmsg
next false
end
@@ -501,8 +498,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move,pkmn,showmsg|
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
next false
end
if !GameData::MapMetadata.exists?($game_map.map_id) ||
!GameData::MapMetadata.get($game_map.map_id).outdoor_map
if !$game_map.metadata&.outdoor_map
pbMessage(_INTL("Can't use that here.")) if showmsg
next false
end
@@ -762,8 +758,7 @@ end
Events.onAction += proc { |_sender,_e|
next if $PokemonGlobal.surfing
next if GameData::MapMetadata.exists?($game_map.map_id) &&
GameData::MapMetadata.get($game_map.map_id).always_bicycle
next if $game_map.metadata&.always_bicycle
next if !$game_player.pbFacingTerrainTag.can_surf_freely
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
pbSurf
@@ -779,8 +774,7 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
next false
end
if GameData::MapMetadata.exists?($game_map.map_id) &&
GameData::MapMetadata.get($game_map.map_id).always_bicycle
if $game_map.metadata&.always_bicycle
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
next false
end
@@ -861,8 +855,7 @@ HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
# Teleport
#===============================================================================
HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
if !GameData::MapMetadata.exists?($game_map.map_id) ||
!GameData::MapMetadata.get($game_map.map_id).outdoor_map
if !$game_map.metadata&.outdoor_map
pbMessage(_INTL("Can't use that here.")) if showmsg
next false
end

View File

@@ -201,7 +201,7 @@ def pbDayCareGenerateEgg
end
# Inheriting regional form
if [:RATTATA, :SANDSHREW, :VULPIX, :DIGLETT, :MEOWTH, :GEODUDE, :GRIMER,
:PONYTA, :SLOWPOKE, :FARFETCHD, :MRMINE, :ARTICUNO, :ZAPDOS, :MOLTRES,
:PONYTA, :SLOWPOKE, :FARFETCHD, :MRMIME, :ARTICUNO, :ZAPDOS, :MOLTRES,
:CORSOLA, :ZIGZAGOON, :DARUMAKA, :YAMASK, :STUNFISK].include?(babyspecies)
if mother.form > 0
egg.form = mother.form if mother.hasItem?(:EVERSTONE)

View File

@@ -646,8 +646,7 @@ end
Events.onMapCreate += proc { |_sender, e|
mapID = e[0]
map = e[1]
next if !GameData::MapMetadata.exists?(mapID) ||
!GameData::MapMetadata.get(mapID).random_dungeon
next if !GameData::MapMetadata.try_get(mapID)&.random_dungeon
# this map is a randomly generated dungeon
dungeon = RandomDungeonGenerator::Dungeon.new(map.width, map.height)
dungeon.generate

View File

@@ -439,9 +439,9 @@ def pbBikeCheck
pbMessage(_INTL("It can't be used when you have someone with you."))
return false
end
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
map_metadata = $game_map.metadata
if $PokemonGlobal.bicycle
if map_metadata && map_metadata.always_bicycle
if map_metadata&.always_bicycle
pbMessage(_INTL("You can't dismount your Bike here."))
return false
end

View File

@@ -64,7 +64,7 @@ end
def pbRandomPhoneTrainer
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
temparray = []
this_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
this_map_metadata = $game_map.metadata
return nil if !this_map_metadata || !this_map_metadata.town_map_position
currentRegion = this_map_metadata.town_map_position[0]
for num in $PokemonGlobal.phoneNumbers
@@ -192,7 +192,7 @@ def pbCallTrainer(trtype,trname)
return
end
caller_map_metadata = GameData::MapMetadata.try_get(trainer[6])
this_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
this_map_metadata = $game_map.metadata
if !caller_map_metadata || !caller_map_metadata.town_map_position ||
!this_map_metadata || !this_map_metadata.town_map_position ||
caller_map_metadata.town_map_position[0] != this_map_metadata.town_map_position[0]

View File

@@ -602,8 +602,7 @@ MultipleForms.copy(:TOXEL, :TOXTRICITY)
MultipleForms.register(:SINISTEA, {
"getFormOnCreation" => proc { |pkmn|
next 1 if rand(100) < 50
next 0
next rand(2)
}
})
@@ -737,9 +736,8 @@ MultipleForms.register(:PIKACHU, {
"getForm" => proc { |pkmn|
next if pkmn.form_simple >= 2
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
map_pos = $game_map.metadata&.town_map_position
next 1 if map_pos && map_pos[0] == 1 # Tiall region
end
next 0
}
@@ -752,9 +750,8 @@ MultipleForms.register(:KOFFING, {
"getForm" => proc { |pkmn|
next if pkmn.form_simple >= 2
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] == 2 # Galar region
map_pos = $game_map.metadata&.town_map_position
next 1 if map_pos && map_pos[0] == 2 # Galar region
end
next 0
}

View File

@@ -48,11 +48,8 @@ class Trainer
def male?; return GameData::TrainerType.get(self.trainer_type).male?; end
def female?; return GameData::TrainerType.get(self.trainer_type).female?; end
def skill_level; return GameData::TrainerType.get(self.trainer_type).skill_level; end
def skill_flags; return GameData::TrainerType.get(self.trainer_type).skill_flags; end
def has_skill_flag?(code)
return skill_flags.any? { |c| c.downcase == code.downcase }
end
def flags; return GameData::TrainerType.get(self.trainer_type).flags; end
def has_flag?(flag); return GameData::TrainerType.get(self.trainer_type).has_flag?(flag); end
#=============================================================================

View File

@@ -18,8 +18,7 @@ class PokemonPokedexInfo_Scene
@sprites["infosprite"].x = 104
@sprites["infosprite"].y = 136
@mapdata = pbLoadTownMapData
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
mappos = (map_metadata) ? map_metadata.town_map_position : nil
mappos = $game_map.metadata&.town_map_position
if @region < 0 # Use player's current region
@region = (mappos) ? mappos[0] : 0 # Region 0 default
end

View File

@@ -81,7 +81,7 @@ class PokemonRegionMap_Scene
@viewport.z = 99999
@sprites = {}
@mapdata = pbLoadTownMapData
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
map_metadata = $game_map.metadata
playerpos = (map_metadata) ? map_metadata.town_map_position : nil
if !playerpos
mapindex = 0

View File

@@ -62,8 +62,7 @@ def pbInSafari?
# map can be outdoors, with its own grassy patches.
reception = pbSafariState.pbReceptionMap
return true if $game_map.map_id == reception
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
return true if map_metadata && map_metadata.safari_map
return true if $game_map.metadata&.safari_map
end
return false
end

View File

@@ -355,8 +355,7 @@ end
# as determined by the current map's metadata.
def pbGetCurrentRegion(default = -1)
return default if !$game_map
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
map_pos = (map_metadata) ? map_metadata.town_map_position : nil
map_pos = $game_map.metadata&.town_map_position
return (map_pos) ? map_pos[0] : default
end

View File

@@ -8,8 +8,7 @@ def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_battle_BGM : nil
music = $game_map.metadata&.wild_battle_BGM
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
@@ -28,8 +27,7 @@ def pbGetWildVictoryME
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_victory_ME : nil
music = $game_map.metadata&.wild_victory_ME
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
@@ -49,8 +47,7 @@ def pbGetWildCaptureME
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_capture_ME : nil
music = $game_map.metadata&.wild_capture_ME
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
@@ -87,8 +84,7 @@ def pbGetTrainerBattleBGM(trainer) # can be a Player, NPCTrainer or an array o
ret = pbStringToAudioFile(music) if music && music!=""
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
music = $game_map.metadata&.trainer_battle_BGM
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
@@ -110,8 +106,7 @@ def pbGetTrainerBattleBGMFromType(trainertype)
ret = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
music = $game_map.metadata&.trainer_battle_BGM
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
@@ -139,8 +134,7 @@ def pbGetTrainerVictoryME(trainer) # can be a Player, NPCTrainer or an array o
end
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_victory_ME : nil
music = $game_map.metadata&.trainer_victory_ME
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret

View File

@@ -349,7 +349,7 @@ def pbTrainerTypeEditor
[_INTL("Gender"), EnumProperty.new(gender_array), _INTL("Gender of this Trainer Type.")],
[_INTL("BaseMoney"), LimitProperty.new(9999), _INTL("Player earns this much money times the highest level among the trainer's Pokémon.")],
[_INTL("SkillLevel"), LimitProperty.new(9999), _INTL("Skill level of this Trainer Type.")],
[_INTL("SkillFlags"), StringListProperty, _INTL("Words/phrases representing AI modifications of trainers of this type.")],
[_INTL("Flags"), StringListProperty, _INTL("Words/phrases that can be used to make trainers of this type behave differently to others.")],
[_INTL("IntroME"), MEProperty, _INTL("ME played before battles against trainers of this type.")],
[_INTL("BattleBGM"), BGMProperty, _INTL("BGM played in battles against trainers of this type.")],
[_INTL("VictoryME"), MEProperty, _INTL("ME played when player wins battles against trainers of this type.")]
@@ -374,7 +374,7 @@ def pbTrainerTypeEditor
t_data.gender,
t_data.base_money,
t_data.skill_level,
t_data.skill_flags,
t_data.flags,
t_data.intro_ME,
t_data.battle_BGM,
t_data.victory_ME
@@ -387,7 +387,7 @@ def pbTrainerTypeEditor
:gender => data[2],
:base_money => data[3],
:skill_level => data[4],
:skill_flags => data[5],
:flags => data[5],
:intro_ME => data[6],
:battle_BGM => data[7],
:victory_ME => data[8]
@@ -782,7 +782,8 @@ def pbEditMetadata(map_id = 0)
:trainer_victory_ME => data[16],
:wild_capture_ME => data[17],
:town_map_size => data[18],
:battle_environment => data[19]
:battle_environment => data[19],
:flags => data[20]
}
# Add metadata's data to records
GameData::MapMetadata.register(metadata_hash)
@@ -815,7 +816,7 @@ def pbItemEditor
[_INTL("FieldUse"), EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")],
[_INTL("BattleUse"), EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
[_INTL("Consumable"), BooleanProperty, _INTL("Whether this item is consumed after use.")],
[_INTL("Type"), EnumProperty.new(type_array), _INTL("For special kinds of items.")],
[_INTL("Flags"), StringListProperty, _INTL("Words/phrases that group certain kinds of items.")],
[_INTL("Move"), MoveProperty, _INTL("Move taught by this HM, TM or TR.")]
]
pbListScreenBlock(_INTL("Items"), ItemLister.new(0, true)) { |button, item|
@@ -843,7 +844,7 @@ def pbItemEditor
itm.field_use,
itm.battle_use,
itm.consumable,
itm.type,
itm.flags,
itm.move
]
if pbPropertyList(itm.id.to_s, data, item_properties, true)
@@ -859,7 +860,7 @@ def pbItemEditor
:field_use => data[7],
:battle_use => data[8],
:consumable => data[9],
:type => data[10],
:flags => data[10],
:move => data[11]
}
# Add item's data to records
@@ -973,6 +974,7 @@ def pbPokemonEditor
[_INTL("Shape"), GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")],
[_INTL("Habitat"), GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")],
[_INTL("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")],
[_INTL("Flags"), StringListProperty, _INTL("Words/phrases that distinguish this species from others.")],
[_INTL("BattlerPlayerX"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerPlayerY"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerEnemyX"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
@@ -1039,6 +1041,7 @@ def pbPokemonEditor
spec.shape,
spec.habitat,
spec.generation,
spec.flags.clone,
spec.back_sprite_x,
spec.back_sprite_y,
spec.front_sprite_x,
@@ -1090,13 +1093,14 @@ def pbPokemonEditor
:shape => data[34],
:habitat => data[35],
:generation => data[36],
:back_sprite_x => data[37],
:back_sprite_y => data[38],
:front_sprite_x => data[39],
:front_sprite_y => data[40],
:front_sprite_altitude => data[41],
:shadow_x => data[42],
:shadow_size => data[43]
:flags => data[37],
:back_sprite_x => data[38],
:back_sprite_y => data[39],
:front_sprite_x => data[40],
:front_sprite_y => data[41],
:front_sprite_altitude => data[42],
:shadow_x => data[43],
:shadow_size => data[44]
}
# Add species' data to records
GameData::Species.register(species_hash)

View File

@@ -1271,6 +1271,10 @@ class EvolutionsProperty
ret = pbChooseTypeList(value)
when :Ability
ret = pbChooseAbilityList(value)
when String
ret = pbMessageFreeText(_INTL("Enter a value."), ret || "", false, 250, Graphics.width)
ret.strip!
ret = nil if ret.empty?
else
params = ChooseNumberParams.new
params.setRange(0, 65535)
@@ -1309,7 +1313,7 @@ class EvolutionsProperty
commands.push(_INTL("{1}: {2}",
GameData::Species.get(realcmds[i][0]).name, evo_method_data.real_name))
else
if !GameData.const_defined?(param_type.to_sym) && param_type.is_a?(Symbol)
if param_type.is_a?(Symbol) && !GameData.const_defined?(param_type)
level = getConstantName(param_type, level)
end
level = "???" if !level || (level.is_a?(String) && level.empty?)
@@ -1469,7 +1473,7 @@ class EvolutionsProperty
param_type = evo_method_data.parameter
if param_type.nil?
param = ""
elsif !GameData.const_defined?(param_type.to_sym) && param_type.is_a?(Symbol)
elsif param_type.is_a?(Symbol) && !GameData.const_defined?(param_type)
param = getConstantName(param_type, param)
else
param = param.to_s

View File

@@ -400,206 +400,221 @@ module Compiler
repeat = true
start = 1
end
subarrays = repeat && schema[1].length > 2
begin
subrecord = []
for i in start...schema[1].length
chr = schema[1][i,1]
case chr
when "i" # Integer
record.push(csvInt!(rec,lineno))
subrecord.push(csvInt!(rec,lineno))
when "I" # Optional integer
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif !field[/^\-?\d+$/]
raise _INTL("Field {1} is not an integer\r\n{2}",field,FileLineData.linereport)
else
record.push(field.to_i)
subrecord.push(field.to_i)
end
when "u" # Positive integer or zero
record.push(csvPosInt!(rec,lineno))
subrecord.push(csvPosInt!(rec,lineno))
when "U" # Optional positive integer or zero
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif !field[/^\d+$/]
raise _INTL("Field '{1}' must be 0 or greater\r\n{2}",field,FileLineData.linereport)
else
record.push(field.to_i)
subrecord.push(field.to_i)
end
when "v" # Positive integer
field = csvPosInt!(rec,lineno)
raise _INTL("Field '{1}' must be greater than 0\r\n{2}",field,FileLineData.linereport) if field==0
record.push(field)
subrecord.push(field)
when "V" # Optional positive integer
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif !field[/^\d+$/]
raise _INTL("Field '{1}' must be greater than 0\r\n{2}",field,FileLineData.linereport)
elsif field.to_i==0
raise _INTL("Field '{1}' must be greater than 0\r\n{2}",field,FileLineData.linereport)
else
record.push(field.to_i)
subrecord.push(field.to_i)
end
when "x" # Hexadecimal number
field = csvfield!(rec)
if !field[/^[A-Fa-f0-9]+$/]
raise _INTL("Field '{1}' is not a hexadecimal number\r\n{2}",field,FileLineData.linereport)
end
record.push(field.hex)
subrecord.push(field.hex)
when "X" # Optional hexadecimal number
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif !field[/^[A-Fa-f0-9]+$/]
raise _INTL("Field '{1}' is not a hexadecimal number\r\n{2}",field,FileLineData.linereport)
else
record.push(field.hex)
subrecord.push(field.hex)
end
when "f" # Floating point number
record.push(csvFloat!(rec,lineno))
subrecord.push(csvFloat!(rec,lineno))
when "F" # Optional floating point number
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif !field[/^\-?^\d*\.?\d*$/]
raise _INTL("Field {1} is not a floating point number\r\n{2}",field,FileLineData.linereport)
else
record.push(field.to_f)
subrecord.push(field.to_f)
end
when "b" # Boolean
record.push(csvBoolean!(rec,lineno))
subrecord.push(csvBoolean!(rec,lineno))
when "B" # Optional Boolean
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif field[/^1|[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]|[Tt]|[Yy]$/]
record.push(true)
subrecord.push(true)
else
record.push(false)
subrecord.push(false)
end
when "n" # Name
field = csvfield!(rec)
if !field[/^(?![0-9])\w+$/]
raise _INTL("Field '{1}' must contain only letters, digits, and\r\nunderscores and can't begin with a number.\r\n{2}",field,FileLineData.linereport)
end
record.push(field)
subrecord.push(field)
when "N" # Optional name
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif !field[/^(?![0-9])\w+$/]
raise _INTL("Field '{1}' must contain only letters, digits, and\r\nunderscores and can't begin with a number.\r\n{2}",field,FileLineData.linereport)
else
record.push(field)
subrecord.push(field)
end
when "s" # String
record.push(csvfield!(rec))
subrecord.push(csvfield!(rec))
when "S" # Optional string
field = csvfield!(rec)
record.push((nil_or_empty?(field)) ? nil : field)
subrecord.push((nil_or_empty?(field)) ? nil : field)
when "q" # Unformatted text
record.push(rec)
subrecord.push(rec)
rec = ""
when "Q" # Optional unformatted text
if nil_or_empty?(rec)
record.push(nil)
subrecord.push(nil)
else
record.push(rec)
subrecord.push(rec)
rec = ""
end
when "e" # Enumerable
record.push(csvEnumField!(rec,schema[2+i-start],"",FileLineData.linereport))
subrecord.push(csvEnumField!(rec,schema[2+i-start],"",FileLineData.linereport))
when "E" # Optional enumerable
field = csvfield!(rec)
record.push(checkEnumFieldOrNil(field,schema[2+i-start]))
subrecord.push(checkEnumFieldOrNil(field,schema[2+i-start]))
when "y" # Enumerable or integer
field = csvfield!(rec)
record.push(csvEnumFieldOrInt!(field,schema[2+i-start],"",FileLineData.linereport))
subrecord.push(csvEnumFieldOrInt!(field,schema[2+i-start],"",FileLineData.linereport))
when "Y" # Optional enumerable or integer
field = csvfield!(rec)
if nil_or_empty?(field)
record.push(nil)
subrecord.push(nil)
elsif field[/^\-?\d+$/]
record.push(field.to_i)
subrecord.push(field.to_i)
else
record.push(checkEnumFieldOrNil(field,schema[2+i-start]))
subrecord.push(checkEnumFieldOrNil(field,schema[2+i-start]))
end
end
end
if !subrecord.empty?
if subarrays
record.push(subrecord)
else
record.concat(subrecord)
end
end
break if repeat && nil_or_empty?(rec)
end while repeat
return (schema[1].length==1) ? record[0] : record
return (schema[1].length == 1) ? record[0] : record
end
#=============================================================================
# Write values to a file using a schema
#=============================================================================
def pbWriteCsvRecord(record,file,schema)
rec = (record.is_a?(Array)) ? record.clone : [record]
for i in 0...schema[1].length
chr = schema[1][i,1]
file.write(",") if i>0
if rec[i].nil?
# do nothing
elsif rec[i].is_a?(String)
file.write(csvQuote(rec[i]))
elsif rec[i].is_a?(Symbol)
file.write(csvQuote(rec[i].to_s))
elsif rec[i]==true
file.write("true")
elsif rec[i]==false
file.write("false")
elsif rec[i].is_a?(Numeric)
case chr
when "e", "E" # Enumerable
enumer = schema[2+i]
if enumer.is_a?(Array)
file.write(enumer[rec[i]])
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
mod = Object.const_get(enumer.to_sym)
file.write(getConstantName(mod,rec[i]))
elsif enumer.is_a?(Module)
file.write(getConstantName(enumer,rec[i]))
elsif enumer.is_a?(Hash)
for key in enumer.keys
if enumer[key]==rec[i]
file.write(key)
break
rec = (record.is_a?(Array)) ? record.flatten : [record]
start = (schema[1][0, 1] == "*") ? 1 : 0
index = 0
begin
for i in start...schema[1].length
index += 1
file.write(",") if index > 1
value = rec[index]
if value.nil?
# do nothing
elsif value.is_a?(String)
file.write(csvQuote(value))
elsif value.is_a?(Symbol)
file.write(csvQuote(value.to_s))
elsif value==true
file.write("true")
elsif value==false
file.write("false")
elsif value.is_a?(Numeric)
case schema[1][i, 1]
when "e", "E" # Enumerable
enumer = schema[2+i]
if enumer.is_a?(Array)
file.write(enumer[value])
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
mod = Object.const_get(enumer.to_sym)
file.write(getConstantName(mod,value))
elsif enumer.is_a?(Module)
file.write(getConstantName(enumer,value))
elsif enumer.is_a?(Hash)
for key in enumer.keys
if enumer[key]==value
file.write(key)
break
end
end
end
end
when "y", "Y" # Enumerable or integer
enumer = schema[2+i]
if enumer.is_a?(Array)
if enumer[rec[i]]!=nil
file.write(enumer[rec[i]])
else
file.write(rec[i])
end
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
mod = Object.const_get(enumer.to_sym)
file.write(getConstantNameOrValue(mod,rec[i]))
elsif enumer.is_a?(Module)
file.write(getConstantNameOrValue(enumer,rec[i]))
elsif enumer.is_a?(Hash)
hasenum = false
for key in enumer.keys
if enumer[key]==rec[i]
file.write(key)
hasenum = true
break
when "y", "Y" # Enumerable or integer
enumer = schema[2+i]
if enumer.is_a?(Array)
if enumer[value]!=nil
file.write(enumer[value])
else
file.write(value)
end
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
mod = Object.const_get(enumer.to_sym)
file.write(getConstantNameOrValue(mod,value))
elsif enumer.is_a?(Module)
file.write(getConstantNameOrValue(enumer,value))
elsif enumer.is_a?(Hash)
hasenum = false
for key in enumer.keys
if enumer[key]==value
file.write(key)
hasenum = true
break
end
end
file.write(value) unless hasenum
end
file.write(rec[i]) unless hasenum
else # Any other record type
file.write(value.inspect)
end
else # Any other record type
file.write(rec[i].inspect)
else
file.write(value.inspect)
end
else
file.write(rec[i].inspect)
end
end
break if start > 0 && index >= rec.length
end while start > 0
return record
end

View File

@@ -158,11 +158,10 @@ module Compiler
end
# Compile value for key
value = pbGetCsvRecord(contents[key], key, schema[key])
value = nil if value.is_a?(Array) && value.length == 0
value = nil if value.is_a?(Array) && value.empty?
contents[key] = value
# Ensure weaknesses/resistances/immunities are in arrays and are symbols
if value && ["Weaknesses", "Resistances", "Immunities"].include?(key)
contents[key] = [contents[key]] if !contents[key].is_a?(Array)
contents[key].map! { |x| x.to_sym }
contents[key].uniq!
end
@@ -173,6 +172,7 @@ module Compiler
:name => contents["Name"],
:pseudo_type => contents["IsPseudoType"],
:special_type => contents["IsSpecialType"],
:flags => contents["Flags"],
:weaknesses => contents["Weaknesses"],
:resistances => contents["Resistances"],
:immunities => contents["Immunities"],
@@ -461,6 +461,8 @@ module Compiler
consumable = !([3, 4, 5].include?(line[7]) || line[8] >= 6)
line[7] = 1 if line[7] == 5
line[8] -= 5 if line[8] > 5
flags = []
flags.push(line[9]) if !nil_or_empty?(line[9])
# Construct item hash
item_hash = {
:id => item_id,
@@ -472,7 +474,7 @@ module Compiler
:field_use => line[7],
:battle_use => line[8],
:consumable => consumable,
:type => line[9],
:flags => flags,
:move => line[10]
}
# Add item's data to records
@@ -559,7 +561,7 @@ module Compiler
FileLineData.setSection(species_id, key, contents[key]) # For error reporting
# Compile value for key
value = pbGetCsvRecord(contents[key], key, schema[key])
value = nil if value.is_a?(Array) && value.length == 0
value = nil if value.is_a?(Array) && value.empty?
contents[key] = value
# Sanitise data
case key
@@ -576,23 +578,8 @@ module Compiler
raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, {3})", key, species_id, path)
end
contents[key] = value
when "Moves"
move_array = []
for i in 0...value.length / 2
move_array.push([value[i * 2], value[i * 2 + 1], i])
end
move_array.sort! { |a, b| (a[0] == b[0]) ? a[2] <=> b[2] : a[0] <=>b [0] }
move_array.each { |arr| arr.pop }
contents[key] = move_array
when "TutorMoves", "EggMoves", "Abilities", "HiddenAbilities", "HiddenAbility", "EggGroups", "Compatibility"
contents[key] = [contents[key]] if !contents[key].is_a?(Array)
contents[key].compact!
when "Evolutions"
evo_array = []
for i in 0...value.length / 3
evo_array.push([value[i * 3], value[i * 3 + 1], value[i * 3 + 2], false])
end
contents[key] = evo_array
contents[key].each { |evo| evo[3] = false }
end
end
# Construct species hash
@@ -629,6 +616,7 @@ module Compiler
:shape => contents["Shape"],
:habitat => contents["Habitat"],
:generation => contents["Generation"],
:flags => contents["Flags"],
:back_sprite_x => contents["BattlerPlayerX"],
:back_sprite_y => contents["BattlerPlayerY"],
:front_sprite_x => contents["BattlerEnemyX"],
@@ -655,7 +643,7 @@ module Compiler
evo[2] = nil
elsif param_type == Integer
evo[2] = csvPosInt!(evo[2])
else
elsif param_type != String
evo[2] = csvEnumField!(evo[2], param_type, "Evolutions", species.id)
end
end
@@ -743,32 +731,18 @@ module Compiler
raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, {3})", key, section_name, path)
end
contents[key] = value
when "Moves"
move_array = []
for i in 0...value.length / 2
move_array.push([value[i * 2], value[i * 2 + 1], i])
end
move_array.sort! { |a, b| (a[0] == b[0]) ? a[2] <=> b[2] : a[0] <=>b [0] }
move_array.each { |arr| arr.pop }
contents[key] = move_array
when "TutorMoves", "EggMoves", "Abilities", "HiddenAbilities", "HiddenAbility", "EggGroups", "Compatibility"
contents[key] = [contents[key]] if !contents[key].is_a?(Array)
contents[key].compact!
when "Evolutions"
evo_array = []
for i in 0...value.length / 3
param_type = GameData::Evolution.get(value[i * 3 + 1]).parameter
param = value[i * 3 + 2]
contents[key].each do |evo|
evo[3] = false
param_type = GameData::Evolution.get(evo[1]).parameter
if param_type.nil?
param = nil
evo[2] = nil
elsif param_type == Integer
param = csvPosInt!(param)
else
param = csvEnumField!(param, param_type, "Evolutions", section_name)
evo[2] = csvPosInt!(evo[2])
elsif param_type != String
evo[2] = csvEnumField!(evo[2], param_type, "Evolutions", section_name)
end
evo_array.push([value[i * 3], value[i * 3 + 1], param, false])
end
contents[key] = evo_array
end
end
# Construct species hash
@@ -819,6 +793,7 @@ module Compiler
:shape => contents["Shape"] || base_data.shape,
:habitat => contents["Habitat"] || base_data.habitat,
:generation => contents["Generation"] || base_data.generation,
:flags => contents["Flags"] || base_data.flags.clone,
:mega_stone => contents["MegaStone"],
:mega_move => contents["MegaMove"],
:unmega_form => contents["UnmegaForm"],
@@ -1165,7 +1140,7 @@ module Compiler
:intro_ME => line[6],
:gender => line[7],
:skill_level => line[8],
:skill_flags => line[9]
:flags => line[9]
}
# Add trainer type's data to records
GameData::TrainerType.register(tr_type_hash)
@@ -1225,9 +1200,6 @@ module Compiler
property_value = pbGetCsvRecord($~[2], line_no, line_schema)
# Error checking in XXX=YYY lines
case property_name
when "Items"
property_value = [property_value] if !property_value.is_a?(Array)
property_value.compact!
when "Pokemon"
if property_value[1] > max_level
raise _INTL("Bad level: {1} (must be 1-{2}).\r\n{3}", property_value[1], max_level, FileLineData.linereport)
@@ -1237,19 +1209,13 @@ module Compiler
raise _INTL("Bad nickname: {1} (must be 1-{2} characters).\r\n{3}", property_value, Pokemon::MAX_NAME_SIZE, FileLineData.linereport)
end
when "Moves"
property_value = [property_value] if !property_value.is_a?(Array)
property_value.uniq!
property_value.compact!
when "IV"
property_value = [property_value] if !property_value.is_a?(Array)
property_value.compact!
property_value.each do |iv|
next if iv <= Pokemon::IV_STAT_LIMIT
raise _INTL("Bad IV: {1} (must be 0-{2}).\r\n{3}", iv, Pokemon::IV_STAT_LIMIT, FileLineData.linereport)
end
when "EV"
property_value = [property_value] if !property_value.is_a?(Array)
property_value.compact!
property_value.each do |ev|
next if ev <= Pokemon::EV_STAT_LIMIT
raise _INTL("Bad EV: {1} (must be 0-{2}).\r\n{3}", ev, Pokemon::EV_STAT_LIMIT, FileLineData.linereport)
@@ -1502,7 +1468,8 @@ module Compiler
:trainer_victory_ME => contents["TrainerVictoryME"],
:wild_capture_ME => contents["WildCaptureME"],
:town_map_size => contents["MapSize"],
:battle_environment => contents["Environment"]
:battle_environment => contents["Environment"],
:flags => contents["Flags"]
}
# Add metadata's data to records
GameData::MapMetadata.register(metadata_hash)

View File

@@ -141,8 +141,9 @@ module Compiler
f.write("[#{type.id}]\r\n")
f.write("Name = #{type.real_name}\r\n")
f.write("IconPosition = #{type.icon_position}\r\n")
f.write("IsPseudoType = true\r\n") if type.pseudo_type
f.write("IsSpecialType = true\r\n") if type.special?
f.write("IsPseudoType = true\r\n") if type.pseudo_type
f.write(sprintf("Flags = %s\r\n", type.flags.join(","))) if type.flags.length > 0
f.write("Weaknesses = #{type.weaknesses.join(",")}\r\n") if type.weaknesses.length > 0
f.write("Resistances = #{type.resistances.join(",")}\r\n") if type.resistances.length > 0
f.write("Immunities = #{type.immunities.join(",")}\r\n") if type.immunities.length > 0
@@ -163,6 +164,7 @@ module Compiler
f.write("[#{ability.id}]\r\n")
f.write("Name = #{ability.real_name}\r\n")
f.write("Description = #{ability.real_description}\r\n")
f.write(sprintf("Flags = %s\r\n", ability.flags.join(","))) if ability.flags.length > 0
end
}
Graphics.update
@@ -188,7 +190,7 @@ module Compiler
f.write("Target = #{move.target}\r\n")
f.write("Priority = #{move.priority}\r\n") if move.priority != 0
f.write("FunctionCode = #{move.function_code}\r\n")
f.write("Flags = #{move.flags.join(",")}\r\n") if move.flags && move.flags.length > 0
f.write("Flags = #{move.flags.join(",")}\r\n") if move.flags.length > 0
f.write("EffectChance = #{move.effect_chance}\r\n") if move.effect_chance > 0
f.write("Description = #{move.real_description}\r\n")
end
@@ -214,9 +216,8 @@ module Compiler
f.write(sprintf("FieldUse = %s\r\n", field_use)) if field_use
battle_use = GameData::Item::SCHEMA["BattleUse"][2].key(item.battle_use)
f.write(sprintf("BattleUse = %s\r\n", battle_use)) if battle_use
type = GameData::Item::SCHEMA["Type"][2].key(item.type)
f.write(sprintf("Consumable = false\r\n")) if !item.is_important? && !item.consumable
f.write(sprintf("Type = %s\r\n", type)) if type
f.write(sprintf("Flags = %s\r\n", item.flags.join(","))) if item.flags.length > 0
f.write(sprintf("Move = %s\r\n", item.move)) if item.move
f.write(sprintf("Description = %s\r\n", item.real_description))
end
@@ -303,6 +304,7 @@ module Compiler
f.write(sprintf("Pokedex = %s\r\n", species.real_pokedex_entry))
f.write(sprintf("FormName = %s\r\n", species.real_form_name)) if species.real_form_name && !species.real_form_name.empty?
f.write(sprintf("Generation = %d\r\n", species.generation)) if species.generation != 0
f.write(sprintf("Flags = %s\r\n", species.flags.join(","))) if species.flags.length > 0
f.write(sprintf("WildItemCommon = %s\r\n", species.wild_item_common)) if species.wild_item_common
f.write(sprintf("WildItemUncommon = %s\r\n", species.wild_item_uncommon)) if species.wild_item_uncommon
f.write(sprintf("WildItemRare = %s\r\n", species.wild_item_rare)) if species.wild_item_rare
@@ -324,7 +326,7 @@ module Compiler
param_type = evo_type_data.parameter
f.write(sprintf("%s,%s,", evo[0], evo_type_data.id.to_s))
if !param_type.nil?
if !GameData.const_defined?(param_type.to_sym) && param_type.is_a?(Symbol)
if param_type.is_a?(Symbol) && !GameData.const_defined?(param_type)
f.write(getConstantName(param_type, evo[2]))
else
f.write(evo[2].to_s)
@@ -405,6 +407,7 @@ module Compiler
f.write(sprintf("Category = %s\r\n", species.real_category)) if species.real_category != base_species.real_category
f.write(sprintf("Pokedex = %s\r\n", species.real_pokedex_entry)) if species.real_pokedex_entry != base_species.real_pokedex_entry
f.write(sprintf("Generation = %d\r\n", species.generation)) if species.generation != base_species.generation
f.write(sprintf("Flags = %s\r\n", species.flags.join(","))) if species.flags.length > 0 && species.flags != base_species.flags
if species.wild_item_common != base_species.wild_item_common ||
species.wild_item_uncommon != base_species.wild_item_uncommon ||
species.wild_item_rare != base_species.wild_item_rare
@@ -430,7 +433,7 @@ module Compiler
param_type = evo_type_data.parameter
f.write(sprintf("%s,%s,", evo[0], evo_type_data.id.to_s))
if !param_type.nil?
if !GameData.const_defined?(param_type.to_sym) && param_type.is_a?(Symbol)
if param_type.is_a?(Symbol) && !GameData.const_defined?(param_type)
f.write(getConstantName(param_type, evo[2]))
else
f.write(evo[2].to_s)
@@ -559,7 +562,7 @@ module Compiler
f.write(sprintf("Gender = %s\r\n", gender))
f.write(sprintf("BaseMoney = %d\r\n", t.base_money))
f.write(sprintf("SkillLevel = %d\r\n", t.skill_level)) if t.skill_level != t.base_money
f.write(sprintf("SkillFlags = %s\r\n", t.skill_flags.join(","))) if t.skill_flags.length > 0
f.write(sprintf("Flags = %s\r\n", t.flags.join(","))) if t.flags.length > 0
f.write(sprintf("IntroME = %s\r\n", t.intro_ME)) if !nil_or_empty?(t.intro_ME)
f.write(sprintf("BattleBGM = %s\r\n", t.battle_BGM)) if !nil_or_empty?(t.battle_BGM)
f.write(sprintf("VictoryME = %s\r\n", t.victory_ME)) if !nil_or_empty?(t.victory_ME)

File diff suppressed because it is too large Load Diff

View File

@@ -2705,7 +2705,7 @@ BattlerEnemyX = 0
BattlerEnemyY = -2
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = MAGNEZONE,Location,49,MAGNEZONE,Location,50,MAGNEZONE,Location,51
Evolutions = MAGNEZONE,LocationFlag,Magnetic
#-------------------------------
[FARFETCHD]
Name = Farfetch'd
@@ -4380,7 +4380,7 @@ BattlerEnemyX = 0
BattlerEnemyY = 20
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,28,GLACEON,Location,34,ESPEON,HappinessDay,,UMBREON,HappinessNight,
Evolutions = VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,LocationFlag,MossRock,GLACEON,LocationFlag,IceRock,ESPEON,HappinessDay,,UMBREON,HappinessNight,
#-------------------------------
[VAPOREON]
Name = Vaporeon
@@ -9810,7 +9810,7 @@ BattlerEnemyX = -2
BattlerEnemyY = 17
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = PROBOPASS,Location,49,PROBOPASS,Location,50,PROBOPASS,Location,51
Evolutions = PROBOPASS,LocationFlag,Magnetic
#-------------------------------
[SKITTY]
Name = Skitty

File diff suppressed because it is too large Load Diff

View File

@@ -2699,7 +2699,7 @@ BattlerEnemyX = 0
BattlerEnemyY = -2
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = MAGNEZONE,Location,49,MAGNEZONE,Location,50,MAGNEZONE,Location,51
Evolutions = MAGNEZONE,LocationFlag,Magnetic
#-------------------------------
[FARFETCHD]
Name = Farfetch'd
@@ -4375,7 +4375,7 @@ BattlerEnemyX = 0
BattlerEnemyY = 20
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,28,GLACEON,Location,34,SYLVEON,HappinessMoveType,FAIRY,ESPEON,HappinessDay,,UMBREON,HappinessNight,
Evolutions = VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,LocationFlag,MossRock,GLACEON,LocationFlag,IceRock,SYLVEON,HappinessMoveType,FAIRY,ESPEON,HappinessDay,,UMBREON,HappinessNight,
#-------------------------------
[VAPOREON]
Name = Vaporeon
@@ -9811,7 +9811,7 @@ BattlerEnemyX = -2
BattlerEnemyY = 17
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = PROBOPASS,Location,49,PROBOPASS,Location,50,PROBOPASS,Location,51
Evolutions = PROBOPASS,LocationFlag,Magnetic
#-------------------------------
[SKITTY]
Name = Skitty
@@ -23743,7 +23743,7 @@ BattlerEnemyX = 0
BattlerEnemyY = 0
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = VIKAVOLT,Location,49,VIKAVOLT,Location,50,VIKAVOLT,Location,51
Evolutions = VIKAVOLT,LocationFlag,Magnetic
#-------------------------------
[VIKAVOLT]
Name = Vikavolt
@@ -23806,7 +23806,7 @@ BattlerEnemyX = 0
BattlerEnemyY = 0
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = CRABOMINABLE,Location,34
Evolutions = CRABOMINABLE,LocationFlag,IceRock
#-------------------------------
[CRABOMINABLE]
Name = Crabominable

File diff suppressed because it is too large Load Diff

View File

@@ -23808,7 +23808,7 @@ BattlerEnemyX = 0
BattlerEnemyY = 0
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = CRABOMINABLE,Location,34
Evolutions = CRABOMINABLE,LocationFlag,IceRock
#-------------------------------
[CRABOMINABLE]
Name = Crabominable

File diff suppressed because it is too large Load Diff

View File

@@ -142,6 +142,7 @@ Outdoor = true
ShowArea = true
MapPosition = 0,16,8
BattleBack = field
Flags = MossRock
#-------------------------------
[029]
# Natural Park Entrance
@@ -166,6 +167,7 @@ Bicycle = true
MapPosition = 0,15,6
BattleBack = cave1
Environment = Cave
Flags = IceRock
#-------------------------------
[035]
# Ingido Plateau
@@ -246,6 +248,7 @@ Bicycle = true
MapPosition = 0,16,10
BattleBack = cave1
Environment = Cave
Flags = Magnetic
#-------------------------------
[050]
# Rock Cave
@@ -254,6 +257,7 @@ MapPosition = 0,16,10
DarkMap = true
BattleBack = cave3
Environment = Cave
Flags = Magnetic
#-------------------------------
[051]
# Dungeon
@@ -262,6 +266,7 @@ MapPosition = 0,16,10
Dungeon = true
BattleBack = cave2
Environment = Cave
Flags = Magnetic
#-------------------------------
[052]
# Battle Frontier

View File

@@ -23808,7 +23808,7 @@ BattlerEnemyX = 0
BattlerEnemyY = 0
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = CRABOMINABLE,Location,34
Evolutions = CRABOMINABLE,LocationFlag,IceRock
#-------------------------------
[CRABOMINABLE]
Name = Crabominable