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

@@ -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