mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixed code assuming map metadata exists, fixed misplaced species data methods, rewrote class PokeBattle_Pokemon
This commit is contained in:
@@ -449,9 +449,10 @@ def pbCancelVehicles(destination=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbCanUseBike?(map_id)
|
def pbCanUseBike?(map_id)
|
||||||
return true if GameData::MapMetadata.get(map_id).always_bicycle
|
map_metadata = GameData::MapMetadata.try_get(map_id)
|
||||||
val = GameData::MapMetadata.get(map_id).can_bicycle
|
return false if !map_metadata
|
||||||
val = GameData::MapMetadata.get(map_id).outdoor_map if val.nil?
|
return true if map_metadata.always_bicycle
|
||||||
|
val = map_metadata.can_bicycle || map_metadata.outdoor_map
|
||||||
return (val) ? true : false
|
return (val) ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ class Game_Map
|
|||||||
|
|
||||||
def display_x=(value)
|
def display_x=(value)
|
||||||
@display_x = value
|
@display_x = value
|
||||||
if GameData::MapMetadata.get(self.map_id).snap_edges
|
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
|
||||||
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
|
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
|
||||||
@display_x = [0, [@display_x, max_x].min].max
|
@display_x = [0, [@display_x, max_x].min].max
|
||||||
end
|
end
|
||||||
@@ -339,7 +339,7 @@ class Game_Map
|
|||||||
|
|
||||||
def display_y=(value)
|
def display_y=(value)
|
||||||
@display_y = value
|
@display_y = value
|
||||||
if GameData::MapMetadata.get(self.map_id).snap_edges
|
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
|
||||||
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
|
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
|
||||||
@display_y = [0, [@display_y, max_y].min].max
|
@display_y = [0, [@display_y, max_y].min].max
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -195,28 +195,28 @@ module GameData
|
|||||||
def pokedex_entry
|
def pokedex_entry
|
||||||
return pbGetMessage(MessageTypes::Entries, @id_number)
|
return pbGetMessage(MessageTypes::Entries, @id_number)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def apply_metrics_to_sprite(sprite, index, shadow = false)
|
def apply_metrics_to_sprite(sprite, index, shadow = false)
|
||||||
if shadow
|
if shadow
|
||||||
if (index & 1) == 1 # Foe Pokémon
|
if (index & 1) == 1 # Foe Pokémon
|
||||||
sprite.x += @shadow_x * 2
|
sprite.x += @shadow_x * 2
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (index & 1) == 0 # Player's Pokémon
|
if (index & 1) == 0 # Player's Pokémon
|
||||||
sprite.x += @back_sprite_x * 2
|
sprite.x += @back_sprite_x * 2
|
||||||
sprite.y += @back_sprite_y * 2
|
sprite.y += @back_sprite_y * 2
|
||||||
else # Foe Pokémon
|
else # Foe Pokémon
|
||||||
sprite.x += @front_sprite_x * 2
|
sprite.x += @front_sprite_x * 2
|
||||||
sprite.y += @front_sprite_y * 2
|
sprite.y += @front_sprite_y * 2
|
||||||
sprite.y -= @front_sprite_altitude * 2
|
sprite.y -= @front_sprite_altitude * 2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def shows_shadow?
|
def shows_shadow?
|
||||||
return true
|
return true
|
||||||
# return @front_sprite_altitude > 0
|
# return @front_sprite_altitude > 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -406,94 +406,85 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Checks when moving between maps
|
# Checks when moving between maps
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Clears the weather of the old map, if the old and new maps have different
|
# Clears the weather of the old map, if the old map has defined weather and the
|
||||||
# names or defined weather
|
# new map either has the same name as the old map or doesn't have defined
|
||||||
Events.onMapChanging += proc { |_sender,e|
|
# weather.
|
||||||
newMapID = e[0]
|
Events.onMapChanging += proc { |_sender, e|
|
||||||
if newMapID>0
|
new_map_ID = e[0]
|
||||||
mapinfos = load_data("Data/MapInfos.rxdata")
|
next if new_map_ID == 0
|
||||||
oldWeather = GameData::MapMetadata.get($game_map.map_id).weather
|
old_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
if $game_map.name!=mapinfos[newMapID].name
|
next if !old_map_metadata || !old_map_metadata.weather
|
||||||
$game_screen.weather(0,0,0) if oldWeather
|
map_infos = load_data("Data/MapInfos.rxdata")
|
||||||
else
|
if $game_map.name == map_infos[new_map_ID].name
|
||||||
newWeather = GameData::MapMetadata.get(newMapID).weather
|
new_map_metadata = GameData::MapMetadata.try_get(new_map_ID)
|
||||||
$game_screen.weather(0,0,0) if oldWeather && !newWeather
|
next if new_map_metadata && new_map_metadata.weather
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
$game_screen.weather(0, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set up various data related to the new map
|
# Set up various data related to the new map
|
||||||
Events.onMapChange += proc { |_sender,e|
|
Events.onMapChange += proc { |_sender, e|
|
||||||
oldid = e[0] # previous map ID, is 0 if no map ID
|
old_map_ID = e[0] # previous map ID, is 0 if no map ID
|
||||||
healing = GameData::MapMetadata.get($game_map.map_id).teleport_destination
|
new_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
$PokemonGlobal.healingSpot = healing if healing
|
if new_map_metadata && new_map_metadata.teleport_destination
|
||||||
|
$PokemonGlobal.healingSpot = new_map_metadata.teleport_destination
|
||||||
|
end
|
||||||
$PokemonMap.clear if $PokemonMap
|
$PokemonMap.clear if $PokemonMap
|
||||||
$PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters
|
$PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters
|
||||||
$PokemonGlobal.visitedMaps[$game_map.map_id] = true
|
$PokemonGlobal.visitedMaps[$game_map.map_id] = true
|
||||||
if oldid!=0 && oldid!=$game_map.map_id
|
next if old_map_ID == 0 || old_map_ID == $game_map.map_id
|
||||||
mapinfos = load_data("Data/MapInfos.rxdata")
|
next if !new_map_metadata || !new_map_metadata.weather
|
||||||
weather = GameData::MapMetadata.get($game_map.map_id).weather
|
map_infos = load_data("Data/MapInfos.rxdata")
|
||||||
if $game_map.name!=mapinfos[oldid].name
|
if $game_map.name == map_infos[old_map_ID].name
|
||||||
$game_screen.weather(weather[0],8,20) if weather && rand(100)<weather[1]
|
old_map_metadata = GameData::MapMetadata.try_get(old_map_ID)
|
||||||
else
|
next if old_map_metadata && old_map_metadata.weather
|
||||||
oldweather = GameData::MapMetadata.get(oldid).weather
|
|
||||||
$game_screen.weather(weather[0],8,20) if weather && !oldweather && rand(100)<weather[1]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
new_weather = new_map_metadata.weather
|
||||||
|
$game_screen.weather(new_weather[0], 8, 20) if rand(100) < new_weather[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.onMapSceneChange += proc { |_sender,e|
|
Events.onMapSceneChange += proc { |_sender, e|
|
||||||
scene = e[0]
|
scene = e[0]
|
||||||
mapChanged = e[1]
|
mapChanged = e[1]
|
||||||
next if !scene || !scene.spriteset
|
next if !scene || !scene.spriteset
|
||||||
# Update map trail
|
# Update map trail
|
||||||
if $game_map
|
if $game_map
|
||||||
$PokemonGlobal.mapTrail = [] if !$PokemonGlobal.mapTrail
|
$PokemonGlobal.mapTrail = [] if !$PokemonGlobal.mapTrail
|
||||||
if $PokemonGlobal.mapTrail[0]!=$game_map.map_id
|
if $PokemonGlobal.mapTrail[0] != $game_map.map_id
|
||||||
$PokemonGlobal.mapTrail[3] = $PokemonGlobal.mapTrail[2] if $PokemonGlobal.mapTrail[2]
|
$PokemonGlobal.mapTrail.pop if $PokemonGlobal.mapTrail.length >= 4
|
||||||
$PokemonGlobal.mapTrail[2] = $PokemonGlobal.mapTrail[1] if $PokemonGlobal.mapTrail[1]
|
|
||||||
$PokemonGlobal.mapTrail[1] = $PokemonGlobal.mapTrail[0] if $PokemonGlobal.mapTrail[0]
|
|
||||||
end
|
end
|
||||||
$PokemonGlobal.mapTrail[0] = $game_map.map_id
|
$PokemonGlobal.mapTrail = [$game_map.map_id] + $PokemonGlobal.mapTrail
|
||||||
end
|
end
|
||||||
# Display darkness circle on dark maps
|
# Display darkness circle on dark maps
|
||||||
darkmap = GameData::MapMetadata.get($game_map.map_id).dark_map
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
if darkmap
|
if map_metadata && map_metadata.dark_map
|
||||||
|
$PokemonTemp.darknessSprite = DarknessSprite.new
|
||||||
|
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
|
||||||
if $PokemonGlobal.flashUsed
|
if $PokemonGlobal.flashUsed
|
||||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
$PokemonTemp.darknessSprite.radius = $PokemonTemp.darknessSprite.radiusMax
|
||||||
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
|
|
||||||
darkness = $PokemonTemp.darknessSprite
|
|
||||||
darkness.radius = darkness.radiusMax
|
|
||||||
else
|
|
||||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
|
||||||
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
|
|
||||||
end
|
end
|
||||||
elsif !darkmap
|
else
|
||||||
$PokemonGlobal.flashUsed = false
|
$PokemonGlobal.flashUsed = false
|
||||||
if $PokemonTemp.darknessSprite
|
$PokemonTemp.darknessSprite.dispose if $PokemonTemp.darknessSprite
|
||||||
$PokemonTemp.darknessSprite.dispose
|
$PokemonTemp.darknessSprite = nil
|
||||||
$PokemonTemp.darknessSprite = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
# Show location signpost
|
# Show location signpost
|
||||||
if mapChanged
|
if mapChanged && map_metadata && map_metadata.announce_location
|
||||||
if GameData::MapMetadata.get($game_map.map_id).announce_location
|
nosignpost = false
|
||||||
nosignpost = false
|
if $PokemonGlobal.mapTrail[1]
|
||||||
if $PokemonGlobal.mapTrail[1]
|
for i in 0...NO_SIGNPOSTS.length / 2
|
||||||
for i in 0...NO_SIGNPOSTS.length/2
|
nosignpost = true if NO_SIGNPOSTS[2 * i] == $PokemonGlobal.mapTrail[1] && NO_SIGNPOSTS[2 * i + 1] == $game_map.map_id
|
||||||
nosignpost = true if NO_SIGNPOSTS[2*i]==$PokemonGlobal.mapTrail[1] && NO_SIGNPOSTS[2*i+1]==$game_map.map_id
|
nosignpost = true if NO_SIGNPOSTS[2 * i + 1] == $PokemonGlobal.mapTrail[1] && NO_SIGNPOSTS[2 * i] == $game_map.map_id
|
||||||
nosignpost = true if NO_SIGNPOSTS[2*i+1]==$PokemonGlobal.mapTrail[1] && NO_SIGNPOSTS[2*i]==$game_map.map_id
|
break if nosignpost
|
||||||
break if nosignpost
|
|
||||||
end
|
|
||||||
mapinfos = load_data("Data/MapInfos.rxdata")
|
|
||||||
oldmapname = mapinfos[$PokemonGlobal.mapTrail[1]].name
|
|
||||||
nosignpost = true if $game_map.name==oldmapname
|
|
||||||
end
|
end
|
||||||
scene.spriteset.addUserSprite(LocationWindow.new($game_map.name)) if !nosignpost
|
mapinfos = load_data("Data/MapInfos.rxdata")
|
||||||
|
oldmapname = mapinfos[$PokemonGlobal.mapTrail[1]].name
|
||||||
|
nosignpost = true if $game_map.name == oldmapname
|
||||||
end
|
end
|
||||||
|
scene.spriteset.addUserSprite(LocationWindow.new($game_map.name)) if !nosignpost
|
||||||
end
|
end
|
||||||
# Force cycling/walking
|
# Force cycling/walking
|
||||||
if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
if map_metadata && map_metadata.always_bicycle
|
||||||
pbMountBike
|
pbMountBike
|
||||||
elsif !pbCanUseBike?($game_map.map_id)
|
elsif !pbCanUseBike?($game_map.map_id)
|
||||||
pbDismountBike
|
pbDismountBike
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
|||||||
location = 3
|
location = 3
|
||||||
elsif $PokemonEncounters.isCave?
|
elsif $PokemonEncounters.isCave?
|
||||||
location = 2
|
location = 2
|
||||||
elsif !GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
elsif !GameData::MapMetadata.exists?($game_map.map_id) ||
|
||||||
|
!GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||||
location = 1
|
location = 1
|
||||||
end
|
end
|
||||||
anim = ""
|
anim = ""
|
||||||
|
|||||||
@@ -130,9 +130,9 @@ def pbPrepareBattle(battle)
|
|||||||
backdrop = $PokemonGlobal.nextBattleBack
|
backdrop = $PokemonGlobal.nextBattleBack
|
||||||
elsif $PokemonGlobal.surfing
|
elsif $PokemonGlobal.surfing
|
||||||
backdrop = "water" # This applies wherever you are, including in caves
|
backdrop = "water" # This applies wherever you are, including in caves
|
||||||
else
|
elsif GameData::MapMetadata.exists?($game_map.map_id)
|
||||||
back = GameData::MapMetadata.get($game_map.map_id).battle_background
|
back = GameData::MapMetadata.get($game_map.map_id).battle_background
|
||||||
backdrop = back if back && back!=""
|
backdrop = back if back && back != ""
|
||||||
end
|
end
|
||||||
backdrop = "indoor1" if !backdrop
|
backdrop = "indoor1" if !backdrop
|
||||||
battle.backdrop = backdrop
|
battle.backdrop = backdrop
|
||||||
@@ -158,7 +158,8 @@ def pbPrepareBattle(battle)
|
|||||||
end
|
end
|
||||||
battle.backdropBase = base if base
|
battle.backdropBase = base if base
|
||||||
# Time of day
|
# Time of day
|
||||||
if GameData::MapMetadata.get($game_map.map_id).battle_environment == PBEnvironment::Cave
|
if GameData::MapMetadata.exists?($game_map.map_id) &&
|
||||||
|
GameData::MapMetadata.get($game_map.map_id).battle_environment == PBEnvironment::Cave
|
||||||
battle.time = 2 # This makes Dusk Balls work properly in caves
|
battle.time = 2 # This makes Dusk Balls work properly in caves
|
||||||
elsif TIME_SHADING
|
elsif TIME_SHADING
|
||||||
timeNow = pbGetTimeNow
|
timeNow = pbGetTimeNow
|
||||||
@@ -172,8 +173,9 @@ end
|
|||||||
# Used to determine the environment in battle, and also the form of Burmy/
|
# Used to determine the environment in battle, and also the form of Burmy/
|
||||||
# Wormadam.
|
# Wormadam.
|
||||||
def pbGetEnvironment
|
def pbGetEnvironment
|
||||||
ret = GameData::MapMetadata.get($game_map.map_id).battle_environment
|
ret = PBEnvironment::None
|
||||||
ret = PBEnvironment::None if !ret
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
|
ret = map_metadata.battle_environment if map_metadata && map_metadata.battle_environment
|
||||||
if $PokemonTemp.encounterType == EncounterTypes::OldRod ||
|
if $PokemonTemp.encounterType == EncounterTypes::OldRod ||
|
||||||
$PokemonTemp.encounterType == EncounterTypes::GoodRod ||
|
$PokemonTemp.encounterType == EncounterTypes::GoodRod ||
|
||||||
$PokemonTemp.encounterType == EncounterTypes::SuperRod
|
$PokemonTemp.encounterType == EncounterTypes::SuperRod
|
||||||
|
|||||||
@@ -178,8 +178,9 @@ EncounterModifier.register(proc { |encounter|
|
|||||||
# are in the same region
|
# are in the same region
|
||||||
if roamerMap!=$game_map.map_id
|
if roamerMap!=$game_map.map_id
|
||||||
currentRegion = pbGetCurrentRegion
|
currentRegion = pbGetCurrentRegion
|
||||||
map_position = GameData::MapMetadata.get(roamerMap).town_map_position
|
map_metadata = GameData::MapMetadata.try_get(roamerMap)
|
||||||
next if !map_position || map_position[0] != currentRegion
|
next if !map_metadata || !map_metadata.town_map_position ||
|
||||||
|
map_metadata.town_map_position[0] != currentRegion
|
||||||
currentMapName = pbGetMessage(MessageTypes::MapNames,$game_map.map_id)
|
currentMapName = pbGetMessage(MessageTypes::MapNames,$game_map.map_id)
|
||||||
next if pbGetMessage(MessageTypes::MapNames,roamerMap)!=currentMapName
|
next if pbGetMessage(MessageTypes::MapNames,roamerMap)!=currentMapName
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -562,27 +562,27 @@ def pbRandomRoomTile(dungeon,tiles)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Events.onMapCreate += proc { |_sender, e|
|
Events.onMapCreate += proc { |_sender, e|
|
||||||
mapID=e[0]
|
mapID = e[0]
|
||||||
map=e[1]
|
map = e[1]
|
||||||
if GameData::MapMetadata.get(mapID).random_dungeon
|
next if !GameData::MapMetadata.exists?(mapID) ||
|
||||||
# this map is a randomly generated dungeon
|
!GameData::MapMetadata.get(mapID).random_dungeon
|
||||||
dungeon=Dungeon.new(map.width,map.height)
|
# this map is a randomly generated dungeon
|
||||||
dungeon.generate
|
dungeon=Dungeon.new(map.width,map.height)
|
||||||
dungeon.generateMapInPlace(map)
|
dungeon.generate
|
||||||
roomtiles=[]
|
dungeon.generateMapInPlace(map)
|
||||||
# Reposition events
|
roomtiles=[]
|
||||||
for event in map.events.values
|
# Reposition events
|
||||||
tile=pbRandomRoomTile(dungeon,roomtiles)
|
for event in map.events.values
|
||||||
if tile
|
|
||||||
event.x=tile[0]
|
|
||||||
event.y=tile[1]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# Override transfer X and Y
|
|
||||||
tile=pbRandomRoomTile(dungeon,roomtiles)
|
tile=pbRandomRoomTile(dungeon,roomtiles)
|
||||||
if tile
|
if tile
|
||||||
$game_temp.player_new_x=tile[0]
|
event.x=tile[0]
|
||||||
$game_temp.player_new_y=tile[1]
|
event.y=tile[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# Override transfer X and Y
|
||||||
|
tile=pbRandomRoomTile(dungeon,roomtiles)
|
||||||
|
if tile
|
||||||
|
$game_temp.player_new_x=tile[0]
|
||||||
|
$game_temp.player_new_y=tile[1]
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,8 +294,8 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
|
|||||||
# Dive
|
# Dive
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbDive
|
def pbDive
|
||||||
divemap = GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
return false if !divemap
|
return false if !map_metadata || !map_metadata.dive_map_id
|
||||||
move = :DIVE
|
move = :DIVE
|
||||||
movefinder = pbCheckMove(move)
|
movefinder = pbCheckMove(move)
|
||||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||||
@@ -307,7 +307,7 @@ def pbDive
|
|||||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||||
pbHiddenMoveAnimation(movefinder)
|
pbHiddenMoveAnimation(movefinder)
|
||||||
pbFadeOutIn {
|
pbFadeOutIn {
|
||||||
$game_temp.player_new_map_id = divemap
|
$game_temp.player_new_map_id = map_metadata.dive_map_id
|
||||||
$game_temp.player_new_x = $game_player.x
|
$game_temp.player_new_x = $game_player.x
|
||||||
$game_temp.player_new_y = $game_player.y
|
$game_temp.player_new_y = $game_player.y
|
||||||
$game_temp.player_new_direction = $game_player.direction
|
$game_temp.player_new_direction = $game_player.direction
|
||||||
@@ -404,7 +404,8 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
|||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if !GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
if !GameData::MapMetadata.exists?($game_map.map_id) ||
|
||||||
|
!GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -426,7 +427,8 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
dive_map_id = GameData::MapMetadata.get($game_map.map_id).dive_map_id
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
|
dive_map_id = map_metadata.dive_map_id if map_metadata
|
||||||
end
|
end
|
||||||
next false if !dive_map_id
|
next false if !dive_map_id
|
||||||
if !pbHiddenMoveAnimation(pokemon)
|
if !pbHiddenMoveAnimation(pokemon)
|
||||||
@@ -454,7 +456,8 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
||||||
next false if !pbCheckHiddenMoveBadge(BADGE_FOR_FLASH,showmsg)
|
next false if !pbCheckHiddenMoveBadge(BADGE_FOR_FLASH,showmsg)
|
||||||
if !GameData::MapMetadata.get($game_map.map_id).dark_map
|
if !GameData::MapMetadata.exists?($game_map.map_id) ||
|
||||||
|
!GameData::MapMetadata.get($game_map.map_id).dark_map
|
||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -494,7 +497,8 @@ HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move,pkmn,showmsg|
|
|||||||
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
if !GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
if !GameData::MapMetadata.exists?($game_map.map_id) ||
|
||||||
|
!GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -753,7 +757,8 @@ end
|
|||||||
|
|
||||||
Events.onAction += proc { |_sender,_e|
|
Events.onAction += proc { |_sender,_e|
|
||||||
next if $PokemonGlobal.surfing
|
next if $PokemonGlobal.surfing
|
||||||
next if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
next if GameData::MapMetadata.exists?($game_map.map_id) &&
|
||||||
|
GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||||
next if !PBTerrain.isSurfable?(pbFacingTerrainTag)
|
next if !PBTerrain.isSurfable?(pbFacingTerrainTag)
|
||||||
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||||
pbSurf
|
pbSurf
|
||||||
@@ -769,7 +774,8 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
|
|||||||
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
if GameData::MapMetadata.exists?($game_map.map_id) &&
|
||||||
|
GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||||
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
|
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -850,7 +856,8 @@ HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
|
|||||||
# Teleport
|
# Teleport
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
||||||
if !GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
if !GameData::MapMetadata.exists?($game_map.map_id) ||
|
||||||
|
!GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ end
|
|||||||
|
|
||||||
def pbDayNightTint(object)
|
def pbDayNightTint(object)
|
||||||
return if !$scene.is_a?(Scene_Map)
|
return if !$scene.is_a?(Scene_Map)
|
||||||
if TIME_SHADING && GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
if TIME_SHADING && GameData::MapMetadata.exists?($game_map.map_id) &&
|
||||||
|
GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||||
tone = PBDayNight.getTone
|
tone = PBDayNight.getTone
|
||||||
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
|
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -358,16 +358,15 @@ def pbBikeCheck
|
|||||||
pbMessage(_INTL("It can't be used when you have someone with you."))
|
pbMessage(_INTL("It can't be used when you have someone with you."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
if $PokemonGlobal.bicycle
|
if $PokemonGlobal.bicycle
|
||||||
if GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
if map_metadata && map_metadata.always_bicycle
|
||||||
pbMessage(_INTL("You can't dismount your Bike here."))
|
pbMessage(_INTL("You can't dismount your Bike here."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
val = GameData::MapMetadata.get($game_map.map_id).can_bicycle
|
if !map_metadata || (!map_metadata.can_bicycle && !map_metadata.outdoor_map)
|
||||||
val = GameData::MapMetadata.get($game_map.map_id).outdoor_map if val.nil?
|
|
||||||
if !val
|
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -64,14 +64,16 @@ end
|
|||||||
def pbRandomPhoneTrainer
|
def pbRandomPhoneTrainer
|
||||||
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
||||||
temparray = []
|
temparray = []
|
||||||
currentRegion = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
this_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
return nil if !currentRegion
|
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
|
for num in $PokemonGlobal.phoneNumbers
|
||||||
next if !num[0] || num.length!=8 # if not visible or not a trainer
|
next if !num[0] || num.length != 8 # if not visible or not a trainer
|
||||||
next if $game_map.map_id==num[6] # Can't call if on same map
|
next if $game_map.map_id == num[6] # Can't call if on same map
|
||||||
callerRegion = GameData::MapMetadata.get(num[6]).town_map_position
|
caller_map_metadata = GameData::MapMetadata.try_get(num[6])
|
||||||
|
next if !caller_map_metadata || !caller_map_metadata.town_map_position
|
||||||
# Can't call if in different region
|
# Can't call if in different region
|
||||||
next if !callerRegion || callerRegion[0] != currentRegion[0]
|
next if caller_map_metadata.town_map_position[0] != currentRegion
|
||||||
temparray.push(num)
|
temparray.push(num)
|
||||||
end
|
end
|
||||||
return nil if temparray.length==0
|
return nil if temparray.length==0
|
||||||
@@ -190,9 +192,11 @@ def pbCallTrainer(trtype,trname)
|
|||||||
pbMessage(_INTL("The Trainer is close by.\nTalk to the Trainer in person!"))
|
pbMessage(_INTL("The Trainer is close by.\nTalk to the Trainer in person!"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
callerregion = GameData::MapMetadata.get(trainer[6]).town_map_position
|
caller_map_metadata = GameData::MapMetadata.try_get(trainer[6])
|
||||||
currentregion = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
this_map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
if !callerregion || !currentregion || callerregion[0] != currentregion[0]
|
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]
|
||||||
pbMessage(_INTL("The Trainer is out of range."))
|
pbMessage(_INTL("The Trainer is out of range."))
|
||||||
return # Can't call if in different region
|
return # Can't call if in different region
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class Pokemon
|
|||||||
attr_reader :status
|
attr_reader :status
|
||||||
# @return [Integer] sleep count / toxic flag / 0:
|
# @return [Integer] sleep count / toxic flag / 0:
|
||||||
# sleep (number of rounds before waking up), toxic (0 = regular poison, 1 = toxic)
|
# sleep (number of rounds before waking up), toxic (0 = regular poison, 1 = toxic)
|
||||||
attr_reader :statusCount
|
attr_accessor :statusCount
|
||||||
# Another Pokémon which has been fused with this Pokémon (or nil if there is none).
|
# Another Pokémon which has been fused with this Pokémon (or nil if there is none).
|
||||||
# Currently only used by Kyurem, to record a fused Reshiram or Zekrom.
|
# Currently only used by Kyurem, to record a fused Reshiram or Zekrom.
|
||||||
# @return [Pokemon, nil] the Pokémon fused into this one (nil if there is none)
|
# @return [Pokemon, nil] the Pokémon fused into this one (nil if there is none)
|
||||||
@@ -751,12 +751,6 @@ class Pokemon
|
|||||||
@status = new_status
|
@status = new_status
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets a new status count. See {#statusCount} for more information.
|
|
||||||
# @param new_status_count [Integer] new sleep count / toxic flag
|
|
||||||
def statusCount=(new_status_count)
|
|
||||||
@statusCount = new_status_count
|
|
||||||
end
|
|
||||||
|
|
||||||
# @return [Boolean] whether the Pokémon is not fainted and not an egg
|
# @return [Boolean] whether the Pokémon is not fainted and not an egg
|
||||||
def able?
|
def able?
|
||||||
return !egg? && @hp > 0
|
return !egg? && @hp > 0
|
||||||
@@ -824,7 +818,8 @@ class Pokemon
|
|||||||
# @param check_species [Integer, Symbol, String] id of the species to check for
|
# @param check_species [Integer, Symbol, String] id of the species to check for
|
||||||
# @return [Boolean] whether this Pokémon is of the specified species
|
# @return [Boolean] whether this Pokémon is of the specified species
|
||||||
def isSpecies?(check_species)
|
def isSpecies?(check_species)
|
||||||
return @species == check_species || @species == GameData::Species.get(check_species).species
|
return @species == check_species || (GameData::Species.exists?(check_species) &&
|
||||||
|
@species == GameData::Species.get(check_species).species)
|
||||||
end
|
end
|
||||||
|
|
||||||
def form
|
def form
|
||||||
|
|||||||
@@ -582,8 +582,9 @@ MultipleForms.register(:NECROZMA,{
|
|||||||
MultipleForms.register(:PIKACHU, {
|
MultipleForms.register(:PIKACHU, {
|
||||||
"getForm" => proc { |pkmn|
|
"getForm" => proc { |pkmn|
|
||||||
next if pkmn.formSimple >= 2
|
next if pkmn.formSimple >= 2
|
||||||
mapPos = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
next 1 if mapPos && mapPos[0] == 1 # Tiall region
|
next 1 if map_metadata && map_metadata.town_map_position &&
|
||||||
|
map_metadata.town_map_position[0] == 1 # Tiall region
|
||||||
next 0
|
next 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -401,7 +401,8 @@ PBEvolution.register(:LevelDiving, {
|
|||||||
|
|
||||||
PBEvolution.register(:LevelDarkness, {
|
PBEvolution.register(:LevelDarkness, {
|
||||||
"levelUpCheck" => proc { |pkmn, parameter|
|
"levelUpCheck" => proc { |pkmn, parameter|
|
||||||
next pkmn.level >= parameter && GameData::MapMetadata.get($game_map.map_id).dark_map
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
|
next pkmn.level >= parameter && map_metadata && map_metadata.dark_map
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -660,8 +661,9 @@ PBEvolution.register(:Location, {
|
|||||||
PBEvolution.register(:Region, {
|
PBEvolution.register(:Region, {
|
||||||
"minimumLevel" => 1, # Needs any level up
|
"minimumLevel" => 1, # Needs any level up
|
||||||
"levelUpCheck" => proc { |pkmn, parameter|
|
"levelUpCheck" => proc { |pkmn, parameter|
|
||||||
mapPos = GameData::MapMetadata.get($game_map.map_id).town_map_position
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
next mapPos && mapPos[0] == parameter
|
next map_metadata && map_metadata.town_map_position &&
|
||||||
|
map_metadata.town_map_position[0] == parameter
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,85 @@
|
|||||||
# These will be removed in a future Essentials version.
|
# These will be removed in a future Essentials version.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# @deprecated Use {Pokemon} instead. PokeBattle_Pokemon has been turned into an alias
|
# @deprecated Use {Pokemon} instead. PokeBattle_Pokemon is slated to be removed
|
||||||
# and is slated to be removed in v20.
|
# in v20.
|
||||||
class PokeBattle_Pokemon; end
|
class PokeBattle_Pokemon
|
||||||
|
attr_reader :name, :species, :form, :formTime, :forcedForm, :fused
|
||||||
|
attr_reader :personalID, :exp, :hp, :status, :statusCount
|
||||||
|
attr_reader :abilityflag, :genderflag, :natureflag, :natureOverride, :shinyflag
|
||||||
|
attr_reader :moves, :firstmoves
|
||||||
|
attr_reader :item, :mail
|
||||||
|
attr_reader :iv, :ivMaxed, :ev
|
||||||
|
attr_reader :happiness, :eggsteps, :pokerus
|
||||||
|
attr_reader :ballused, :markings, :ribbons
|
||||||
|
attr_reader :obtainMode, :obtainMap, :obtainText, :obtainLevel, :hatchedMap
|
||||||
|
attr_reader :timeReceived, :timeEggHatched
|
||||||
|
attr_reader :cool, :beauty, :cute, :smart, :tough, :sheen
|
||||||
|
attr_reader :trainerID, :ot, :otgender, :language
|
||||||
|
attr_reader :shadow, :heartgauge, :savedexp, :savedev, :hypermode
|
||||||
|
attr_reader :shadowmoves, :shadowmovenum
|
||||||
|
|
||||||
PokeBattle_Pokemon = Pokemon
|
def initialise
|
||||||
|
raise "PokeBattle_Pokemon.new is deprecated. Use Pokemon.new instead."
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.copy(pkmn)
|
||||||
|
owner = Pokemon::Owner.new(pkmn.trainerID, pkmn.ot, pkmn.otgender, pkmn.language)
|
||||||
|
ret = Pokemon.new(pkmn.species, pkmn.level, owner, false)
|
||||||
|
ret.name = pkmn.name
|
||||||
|
ret.exp = pkmn.exp
|
||||||
|
ret.formTime = pkmn.formTime
|
||||||
|
ret.forcedForm = pkmn.forcedForm
|
||||||
|
ret.hp = pkmn.hp
|
||||||
|
ret.abilityflag = pkmn.abilityflag
|
||||||
|
ret.genderflag = pkmn.genderflag
|
||||||
|
ret.natureflag = pkmn.natureflag
|
||||||
|
ret.natureOverride = pkmn.natureOverride
|
||||||
|
ret.shinyflag = pkmn.shinyflag
|
||||||
|
ret.item_id = pkmn.item
|
||||||
|
ret.mail = pkmn.mail
|
||||||
|
ret.moves = pkmn.moves
|
||||||
|
ret.firstmoves = pkmn.firstmoves.clone
|
||||||
|
ret.status = pkmn.status
|
||||||
|
ret.statusCount = pkmn.statusCount
|
||||||
|
ret.iv = pkmn.iv.clone
|
||||||
|
ret.ev = pkmn.ev.clone
|
||||||
|
ret.ivMaxed = pkmn.ivMaxed if pkmn.ivMaxed
|
||||||
|
ret.happiness = pkmn.happiness
|
||||||
|
ret.ballused = pkmn.ballused
|
||||||
|
ret.eggsteps = pkmn.eggsteps
|
||||||
|
ret.markings = pkmn.markings if pkmn.markings
|
||||||
|
ret.ribbons = pkmn.ribbons.clone
|
||||||
|
ret.pokerus = pkmn.pokerus
|
||||||
|
ret.personalID = pkmn.personalID
|
||||||
|
ret.obtainMode = pkmn.obtainMode
|
||||||
|
ret.obtainMap = pkmn.obtainMap
|
||||||
|
ret.obtainText = pkmn.obtainText
|
||||||
|
ret.obtainLevel = pkmn.obtainLevel if pkmn.obtainLevel
|
||||||
|
ret.hatchedMap = pkmn.hatchedMap
|
||||||
|
ret.timeReceived = pkmn.timeReceived
|
||||||
|
ret.timeEggHatched = pkmn.timeEggHatched
|
||||||
|
ret.cool = pkmn.cool if pkmn.cool
|
||||||
|
ret.beauty = pkmn.beauty if pkmn.beauty
|
||||||
|
ret.cute = pkmn.cute if pkmn.cute
|
||||||
|
ret.smart = pkmn.smart if pkmn.smart
|
||||||
|
ret.tough = pkmn.tough if pkmn.tough
|
||||||
|
ret.sheen = pkmn.sheen if pkmn.sheen
|
||||||
|
if pkmn.fused
|
||||||
|
ret.fused = PokeBattle_Pokemon.copy(pkmn.fused) if pkmn.fused.is_a?(PokeBattle_Pokemon)
|
||||||
|
ret.fused = pkmn.fused if pkmn.fused.is_a?(Pokemon)
|
||||||
|
end
|
||||||
|
ret.shadow = pkmn.shadow
|
||||||
|
ret.heartgauge = pkmn.heartgauge
|
||||||
|
ret.savedexp = pkmn.savedexp
|
||||||
|
ret.savedev = pkmn.savedev.clone
|
||||||
|
ret.hypermode = pkmn.hypermode
|
||||||
|
ret.shadowmoves = pkmn.shadowmoves.clone
|
||||||
|
ret.shadowmovenum = pkmn.shadowmovenum
|
||||||
|
# NOTE: Intentionally set last, as it recalculates stats.
|
||||||
|
ret.formSimple = pkmn.form
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class Pokemon
|
class Pokemon
|
||||||
# @deprecated Use {MAX_NAME_SIZE} instead. This alias is slated to be removed in v20.
|
# @deprecated Use {MAX_NAME_SIZE} instead. This alias is slated to be removed in v20.
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ class PokemonPokedexInfo_Scene
|
|||||||
@sprites["infosprite"].x = 104
|
@sprites["infosprite"].x = 104
|
||||||
@sprites["infosprite"].y = 136
|
@sprites["infosprite"].y = 136
|
||||||
@mapdata = pbLoadTownMapData
|
@mapdata = pbLoadTownMapData
|
||||||
mappos = ($game_map) ? GameData::MapMetadata.get($game_map.map_id).town_map_position : nil
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
if @region<0 # Use player's current region
|
mappos = (map_metadata) ? map_metadata.town_map_position : nil
|
||||||
|
if @region < 0 # Use player's current region
|
||||||
@region = (mappos) ? mappos[0] : 0 # Region 0 default
|
@region = (mappos) ? mappos[0] : 0 # Region 0 default
|
||||||
end
|
end
|
||||||
@sprites["areamap"] = IconSprite.new(0,0,@viewport)
|
@sprites["areamap"] = IconSprite.new(0,0,@viewport)
|
||||||
@@ -300,31 +301,29 @@ class PokemonPokedexInfo_Scene
|
|||||||
encdata = pbLoadEncountersData
|
encdata = pbLoadEncountersData
|
||||||
for enc in encdata.keys
|
for enc in encdata.keys
|
||||||
enctypes = encdata[enc][1]
|
enctypes = encdata[enc][1]
|
||||||
if pbFindEncounter(enctypes,@species)
|
next if !pbFindEncounter(enctypes, @species)
|
||||||
mappos = GameData::MapMetadata.get(enc).town_map_position
|
map_metadata = GameData::MapMetadata.try_get(enc)
|
||||||
if mappos && mappos[0]==@region
|
mappos = (map_metadata) ? map_metadata.town_map_position : nil
|
||||||
showpoint = true
|
next if !mappos || mappos[0] != @region
|
||||||
for loc in @mapdata[@region][2]
|
showpoint = true
|
||||||
showpoint = false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
|
for loc in @mapdata[@region][2]
|
||||||
loc[7] && !$game_switches[loc[7]]
|
showpoint = false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
|
||||||
end
|
loc[7] && !$game_switches[loc[7]]
|
||||||
if showpoint
|
end
|
||||||
mapsize = GameData::MapMetadata.get(enc).town_map_size
|
next if !showpoint
|
||||||
if mapsize && mapsize[0] && mapsize[0]>0
|
mapsize = map_metadata.town_map_size
|
||||||
sqwidth = mapsize[0]
|
if mapsize && mapsize[0] && mapsize[0]>0
|
||||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
sqwidth = mapsize[0]
|
||||||
for i in 0...sqwidth
|
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||||
for j in 0...sqheight
|
for i in 0...sqwidth
|
||||||
if mapsize[1][i+j*sqwidth,1].to_i>0
|
for j in 0...sqheight
|
||||||
points[mappos[1]+i+(mappos[2]+j)*mapwidth] = true
|
if mapsize[1][i+j*sqwidth,1].to_i>0
|
||||||
end
|
points[mappos[1]+i+(mappos[2]+j)*mapwidth] = true
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
points[mappos[1]+mappos[2]*mapwidth] = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
points[mappos[1]+mappos[2]*mapwidth] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Draw coloured squares on each square of the region map with a nest
|
# Draw coloured squares on each square of the region map with a nest
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ class PokemonRegionMap_Scene
|
|||||||
@viewport.z = 99999
|
@viewport.z = 99999
|
||||||
@sprites = {}
|
@sprites = {}
|
||||||
@mapdata = pbLoadTownMapData
|
@mapdata = pbLoadTownMapData
|
||||||
playerpos = (!$game_map) ? nil : GameData::MapMetadata.get($game_map.map_id).town_map_position
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
|
playerpos = (map_metadata) ? map_metadata.town_map_position : nil
|
||||||
if !playerpos
|
if !playerpos
|
||||||
mapindex = 0
|
mapindex = 0
|
||||||
@map = @mapdata[0]
|
@map = @mapdata[0]
|
||||||
@@ -97,7 +98,7 @@ class PokemonRegionMap_Scene
|
|||||||
@map = @mapdata[playerpos[0]]
|
@map = @mapdata[playerpos[0]]
|
||||||
@mapX = playerpos[1]
|
@mapX = playerpos[1]
|
||||||
@mapY = playerpos[2]
|
@mapY = playerpos[2]
|
||||||
mapsize = (!$game_map) ? nil : GameData::MapMetadata.get($game_map.map_id).town_map_size
|
mapsize = map_metadata.town_map_size
|
||||||
if mapsize && mapsize[0] && mapsize[0]>0
|
if mapsize && mapsize[0] && mapsize[0]>0
|
||||||
sqwidth = mapsize[0]
|
sqwidth = mapsize[0]
|
||||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||||
|
|||||||
@@ -61,8 +61,9 @@ def pbInSafari?
|
|||||||
# Reception map is handled separately from safari map since the reception
|
# Reception map is handled separately from safari map since the reception
|
||||||
# map can be outdoors, with its own grassy patches.
|
# map can be outdoors, with its own grassy patches.
|
||||||
reception = pbSafariState.pbReceptionMap
|
reception = pbSafariState.pbReceptionMap
|
||||||
return true if $game_map.map_id==reception
|
return true if $game_map.map_id == reception
|
||||||
return true if GameData::MapMetadata.get($game_map.map_id).safari_map
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
|
return true if map_metadata && map_metadata.safari_map
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects
|
|||||||
ret = nil
|
ret = nil
|
||||||
if !ret
|
if !ret
|
||||||
# Check map metadata
|
# Check map metadata
|
||||||
music = GameData::MapMetadata.get($game_map.map_id).wild_battle_BGM
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
ret = pbStringToAudioFile(music) if music && music!=""
|
music = (map_metadata) ? map_metadata.wild_battle_BGM : nil
|
||||||
|
ret = pbStringToAudioFile(music) if music && music != ""
|
||||||
end
|
end
|
||||||
if !ret
|
if !ret
|
||||||
# Check global metadata
|
# Check global metadata
|
||||||
@@ -27,8 +28,9 @@ def pbGetWildVictoryME
|
|||||||
ret = nil
|
ret = nil
|
||||||
if !ret
|
if !ret
|
||||||
# Check map metadata
|
# Check map metadata
|
||||||
music = GameData::MapMetadata.get($game_map.map_id).wild_victory_ME
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
ret = pbStringToAudioFile(music) if music && music!=""
|
music = (map_metadata) ? map_metadata.wild_victory_ME : nil
|
||||||
|
ret = pbStringToAudioFile(music) if music && music != ""
|
||||||
end
|
end
|
||||||
if !ret
|
if !ret
|
||||||
# Check global metadata
|
# Check global metadata
|
||||||
@@ -47,8 +49,9 @@ def pbGetWildCaptureME
|
|||||||
ret = nil
|
ret = nil
|
||||||
if !ret
|
if !ret
|
||||||
# Check map metadata
|
# Check map metadata
|
||||||
music = GameData::MapMetadata.get($game_map.map_id).wild_capture_ME
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
ret = pbStringToAudioFile(music) if music && music!=""
|
music = (map_metadata) ? map_metadata.wild_capture_ME : nil
|
||||||
|
ret = pbStringToAudioFile(music) if music && music != ""
|
||||||
end
|
end
|
||||||
if !ret
|
if !ret
|
||||||
# Check global metadata
|
# Check global metadata
|
||||||
@@ -84,10 +87,9 @@ def pbGetTrainerBattleBGM(trainer) # can be a PokeBattle_Trainer or an array o
|
|||||||
ret = pbStringToAudioFile(music) if music && music!=""
|
ret = pbStringToAudioFile(music) if music && music!=""
|
||||||
if !ret
|
if !ret
|
||||||
# Check map metadata
|
# Check map metadata
|
||||||
music = GameData::MapMetadata.get($game_map.map_id).trainer_battle_BGM
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
if music && music!=""
|
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
|
||||||
ret = pbStringToAudioFile(music)
|
ret = pbStringToAudioFile(music) if music && music != ""
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if !ret
|
if !ret
|
||||||
# Check global metadata
|
# Check global metadata
|
||||||
@@ -108,8 +110,9 @@ def pbGetTrainerBattleBGMFromType(trainertype)
|
|||||||
ret = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
|
ret = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
|
||||||
if !ret
|
if !ret
|
||||||
# Check map metadata
|
# Check map metadata
|
||||||
music = GameData::MapMetadata.get($game_map.map_id).trainer_battle_BGM
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
ret = pbStringToAudioFile(music) if music && music!=""
|
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
|
||||||
|
ret = pbStringToAudioFile(music) if music && music != ""
|
||||||
end
|
end
|
||||||
if !ret
|
if !ret
|
||||||
# Check global metadata
|
# Check global metadata
|
||||||
@@ -136,10 +139,9 @@ def pbGetTrainerVictoryME(trainer) # can be a PokeBattle_Trainer or an array o
|
|||||||
end
|
end
|
||||||
if !ret
|
if !ret
|
||||||
# Check map metadata
|
# Check map metadata
|
||||||
music = GameData::MapMetadata.get($game_map.map_id).trainer_victory_ME
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
if music && music!=""
|
music = (map_metadata) ? map_metadata.trainer_victory_ME : nil
|
||||||
ret = pbStringToAudioFile(music)
|
ret = pbStringToAudioFile(music) if music && music != ""
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if !ret
|
if !ret
|
||||||
# Check global metadata
|
# Check global metadata
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ def pbAddPokemon(pkmn, level = 1, see_form = true)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbAddPokemonSilent(pkmn, level = 1, see_form = true)
|
def pbAddPokemonSilent(pkmn, level = 1, see_form = true)
|
||||||
return false if !pokemon || pbBoxesFull?
|
return false if !pkmn || pbBoxesFull?
|
||||||
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
|
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||||
$Trainer.seen[pkmn.species] = true
|
$Trainer.seen[pkmn.species] = true
|
||||||
$Trainer.owned[pkmn.species] = true
|
$Trainer.owned[pkmn.species] = true
|
||||||
|
|||||||
@@ -392,7 +392,9 @@ end
|
|||||||
# Returns the ID number of the region containing the player's current location,
|
# Returns the ID number of the region containing the player's current location,
|
||||||
# as determined by the current map's metadata.
|
# as determined by the current map's metadata.
|
||||||
def pbGetCurrentRegion(default = -1)
|
def pbGetCurrentRegion(default = -1)
|
||||||
map_pos = ($game_map) ? GameData::MapMetadata.get($game_map.map_id).town_map_position : nil
|
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
|
||||||
return (map_pos) ? map_pos[0] : default
|
return (map_pos) ? map_pos[0] : default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -612,7 +612,8 @@ def pbEditMetadata(map_id = 0)
|
|||||||
properties = GameData::Metadata.editor_properties
|
properties = GameData::Metadata.editor_properties
|
||||||
else # Map metadata
|
else # Map metadata
|
||||||
map_name = mapinfos[map_id].name
|
map_name = mapinfos[map_id].name
|
||||||
metadata = GameData::MapMetadata.get(map_id)
|
metadata = GameData::MapMetadata.try_get(map_id)
|
||||||
|
metadata = GameData::Metadata.new({}) if !metadata
|
||||||
properties = GameData::MapMetadata.editor_properties
|
properties = GameData::MapMetadata.editor_properties
|
||||||
end
|
end
|
||||||
properties.each do |property|
|
properties.each do |property|
|
||||||
|
|||||||
Reference in New Issue
Block a user