mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
Added class GameData::TerrainTag
This commit is contained in:
@@ -147,8 +147,7 @@ class Game_Map
|
|||||||
bit = (1 << (d / 2 - 1)) & 0x0f
|
bit = (1 << (d / 2 - 1)) & 0x0f
|
||||||
for event in events.values
|
for event in events.values
|
||||||
next if event.tile_id <= 0
|
next if event.tile_id <= 0
|
||||||
terrain = @terrain_tags[event.tile_id]
|
next if GameData::TerrainTag.try_get(@terrain_tags[event.tile_id]).ignore_passability
|
||||||
next if terrain == PBTerrain::Neutral
|
|
||||||
next if event == self_event
|
next if event == self_event
|
||||||
next if event.x != x || event.y != y
|
next if event.x != x || event.y != y
|
||||||
next if event.through
|
next if event.through
|
||||||
@@ -185,48 +184,35 @@ class Game_Map
|
|||||||
return false if !valid?(newx, newy)
|
return false if !valid?(newx, newy)
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = data[x, y, i]
|
tile_id = data[x, y, i]
|
||||||
terrain = @terrain_tags[tile_id]
|
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
|
||||||
passage = @passages[tile_id]
|
passage = @passages[tile_id]
|
||||||
# If already on water, only allow movement to another water tile
|
# If already on water, only allow movement to another water tile
|
||||||
if self_event!=nil && PBTerrain.isJustWater?(terrain)
|
if self_event != nil && terrain.can_surf_freely
|
||||||
for j in [2, 1, 0]
|
for j in [2, 1, 0]
|
||||||
facing_tile_id = data[newx, newy, j]
|
facing_tile_id = data[newx, newy, j]
|
||||||
return false if facing_tile_id==nil
|
return false if facing_tile_id == nil
|
||||||
facing_terrain = @terrain_tags[facing_tile_id]
|
facing_terrain = GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id])
|
||||||
if facing_terrain!=0 && facing_terrain!=PBTerrain::Neutral
|
if facing_terrain.id != :None && !facing_terrain.ignore_passability
|
||||||
return PBTerrain.isJustWater?(facing_terrain)
|
return facing_terrain.can_surf_freely
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
# Can't walk onto ice
|
# Can't walk onto ice
|
||||||
elsif PBTerrain.isIce?(terrain)
|
elsif terrain.ice
|
||||||
return false
|
return false
|
||||||
elsif self_event!=nil && self_event.x==x && self_event.y==y
|
elsif self_event != nil && self_event.x == x && self_event.y == y
|
||||||
# Can't walk onto ledges
|
# Can't walk onto ledges
|
||||||
for j in [2, 1, 0]
|
for j in [2, 1, 0]
|
||||||
facing_tile_id = data[newx, newy, j]
|
facing_tile_id = data[newx, newy, j]
|
||||||
return false if facing_tile_id==nil
|
return false if facing_tile_id == nil
|
||||||
facing_terrain = @terrain_tags[facing_tile_id]
|
return false if GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id]).ledge
|
||||||
if facing_terrain!=0 && facing_terrain!=PBTerrain::Neutral
|
|
||||||
return false if PBTerrain.isLedge?(facing_terrain)
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Regular passability checks
|
# Regular passability checks
|
||||||
if terrain!=PBTerrain::Neutral
|
if !terrain || !terrain.ignore_passability
|
||||||
if passage & bit != 0 || passage & 0x0f == 0x0f
|
return false if passage & bit != 0 || passage & 0x0f == 0x0f
|
||||||
return false
|
return true if @priorities[tile_id] == 0
|
||||||
elsif @priorities[tile_id] == 0
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# Regular passability checks
|
|
||||||
elsif terrain!=PBTerrain::Neutral
|
|
||||||
if passage & bit != 0 || passage & 0x0f == 0x0f
|
|
||||||
return false
|
|
||||||
elsif @priorities[tile_id] == 0
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@@ -236,27 +222,25 @@ class Game_Map
|
|||||||
bit = (1 << (d / 2 - 1)) & 0x0f
|
bit = (1 << (d / 2 - 1)) & 0x0f
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = data[x, y, i]
|
tile_id = data[x, y, i]
|
||||||
terrain = @terrain_tags[tile_id]
|
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
|
||||||
passage = @passages[tile_id]
|
passage = @passages[tile_id]
|
||||||
|
if terrain
|
||||||
# Ignore bridge tiles if not on a bridge
|
# Ignore bridge tiles if not on a bridge
|
||||||
next if PBTerrain.isBridge?(terrain) && $PokemonGlobal.bridge==0
|
next if terrain.bridge && $PokemonGlobal.bridge == 0
|
||||||
# Make water tiles passable if player is surfing
|
# Make water tiles passable if player is surfing
|
||||||
if $PokemonGlobal.surfing && PBTerrain.isPassableWater?(terrain)
|
return true if $PokemonGlobal.surfing && terrain.can_surf && !terrain.waterfall
|
||||||
return true
|
|
||||||
# Prevent cycling in really tall grass/on ice
|
# Prevent cycling in really tall grass/on ice
|
||||||
elsif $PokemonGlobal.bicycle && PBTerrain.onlyWalk?(terrain)
|
return false if $PokemonGlobal.bicycle && terrain.must_walk
|
||||||
return false
|
|
||||||
# Depend on passability of bridge tile if on bridge
|
# Depend on passability of bridge tile if on bridge
|
||||||
elsif PBTerrain.isBridge?(terrain) && $PokemonGlobal.bridge>0
|
if terrain.bridge && $PokemonGlobal.bridge > 0
|
||||||
return (passage & bit == 0 && passage & 0x0f != 0x0f)
|
return (passage & bit == 0 && passage & 0x0f != 0x0f)
|
||||||
# Regular passability checks
|
|
||||||
elsif terrain!=PBTerrain::Neutral
|
|
||||||
if passage & bit != 0 || passage & 0x0f == 0x0f
|
|
||||||
return false
|
|
||||||
elsif @priorities[tile_id] == 0
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# Regular passability checks
|
||||||
|
if !terrain || !terrain.ignore_passability
|
||||||
|
return false if passage & bit != 0 || passage & 0x0f == 0x0f
|
||||||
|
return true if @priorities[tile_id] == 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -268,15 +252,13 @@ class Game_Map
|
|||||||
for event in events.values
|
for event in events.values
|
||||||
next if event == self_event || event.tile_id < 0 || event.through
|
next if event == self_event || event.tile_id < 0 || event.through
|
||||||
next if event.x != x || event.y != y
|
next if event.x != x || event.y != y
|
||||||
terrain = @terrain_tags[event.tile_id]
|
next if GameData::TerrainTag.try_get(@terrain_tags[event.tile_id]).ignore_passability
|
||||||
next if terrain == PBTerrain::Neutral
|
|
||||||
return false if @passages[event.tile_id] & 0x0f != 0
|
return false if @passages[event.tile_id] & 0x0f != 0
|
||||||
return true if @priorities[event.tile_id] == 0
|
return true if @priorities[event.tile_id] == 0
|
||||||
end
|
end
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = data[x, y, i]
|
tile_id = data[x, y, i]
|
||||||
terrain = @terrain_tags[tile_id]
|
next if GameData::TerrainTag.try_get(@terrain_tags[tile_id]).ignore_passability
|
||||||
next if terrain == PBTerrain::Neutral
|
|
||||||
return false if @passages[tile_id] & 0x0f != 0
|
return false if @passages[tile_id] & 0x0f != 0
|
||||||
return true if @priorities[tile_id] == 0
|
return true if @priorities[tile_id] == 0
|
||||||
end
|
end
|
||||||
@@ -286,7 +268,8 @@ class Game_Map
|
|||||||
def bush?(x,y)
|
def bush?(x,y)
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = data[x, y, i]
|
tile_id = data[x, y, i]
|
||||||
return false if PBTerrain.isBridge?(@terrain_tags[tile_id]) && $PokemonGlobal.bridge>0
|
return false if GameData::TerrainTag.try_get(@terrain_tags[tile_id]).bridge &&
|
||||||
|
$PokemonGlobal.bridge > 0
|
||||||
return true if @passages[tile_id] & 0x40 == 0x40
|
return true if @passages[tile_id] & 0x40 == 0x40
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@@ -295,9 +278,9 @@ class Game_Map
|
|||||||
def deepBush?(x,y)
|
def deepBush?(x,y)
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = data[x, y, i]
|
tile_id = data[x, y, i]
|
||||||
terrain = @terrain_tags[tile_id]
|
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
|
||||||
return false if $PokemonGlobal.bridge>0 && PBTerrain.isBridge?(terrain)
|
return false if terrain.bridge && $PokemonGlobal.bridge > 0
|
||||||
return true if terrain==PBTerrain::TallGrass && @passages[tile_id] & 0x40 == 0x40
|
return true if terrain.deep_bush && @passages[tile_id] & 0x40 == 0x40
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -312,14 +295,16 @@ class Game_Map
|
|||||||
end
|
end
|
||||||
|
|
||||||
def terrain_tag(x,y,countBridge=false)
|
def terrain_tag(x,y,countBridge=false)
|
||||||
return 0 if !valid?(x, y)
|
if valid?(x, y)
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = data[x, y, i]
|
tile_id = data[x, y, i]
|
||||||
terrain = @terrain_tags[tile_id]
|
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
|
||||||
next if !countBridge && PBTerrain.isBridge?(terrain) && $PokemonGlobal.bridge==0
|
next if terrain.id == :None || terrain.ignore_passability
|
||||||
return terrain if terrain > 0 && terrain!=PBTerrain::Neutral
|
next if !countBridge && terrain.bridge && $PokemonGlobal.bridge == 0
|
||||||
|
return terrain
|
||||||
end
|
end
|
||||||
return 0
|
end
|
||||||
|
return GameData::TerrainTag.get(:None)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_event(x,y)
|
def check_event(x,y)
|
||||||
|
|||||||
@@ -223,13 +223,13 @@ class PokemonMapFactory
|
|||||||
|
|
||||||
def getFacingTerrainTag(dir=nil,event=nil)
|
def getFacingTerrainTag(dir=nil,event=nil)
|
||||||
tile = getFacingTile(dir,event)
|
tile = getFacingTile(dir,event)
|
||||||
return 0 if !tile
|
return GameData::TerrainTag.get(:None) if !tile
|
||||||
return getTerrainTag(tile[0],tile[1],tile[2])
|
return getTerrainTag(tile[0],tile[1],tile[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
def getTerrainTagFromCoords(mapid,x,y,countBridge=false)
|
def getTerrainTagFromCoords(mapid,x,y,countBridge=false)
|
||||||
tile = getRealTilePos(mapid,x,y)
|
tile = getRealTilePos(mapid,x,y)
|
||||||
return 0 if !tile
|
return GameData::TerrainTag.get(:None) if !tile
|
||||||
return getTerrainTag(tile[0],tile[1],tile[2])
|
return getTerrainTag(tile[0],tile[1],tile[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,10 @@ class Game_Player < Game_Character
|
|||||||
return false if $game_temp.in_menu || $game_temp.in_battle ||
|
return false if $game_temp.in_menu || $game_temp.in_battle ||
|
||||||
@move_route_forcing || $game_temp.message_window_showing ||
|
@move_route_forcing || $game_temp.message_window_showing ||
|
||||||
pbMapInterpreterRunning?
|
pbMapInterpreterRunning?
|
||||||
terrain = pbGetTerrainTag
|
|
||||||
input = ($PokemonSystem.runstyle == 1) ^ Input.press?(Input::SPECIAL)
|
input = ($PokemonSystem.runstyle == 1) ^ Input.press?(Input::SPECIAL)
|
||||||
return input && $PokemonGlobal.runningShoes && !jumping? &&
|
return input && $PokemonGlobal.runningShoes && !jumping? &&
|
||||||
!$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
|
!$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
|
||||||
!$PokemonGlobal.bicycle && !PBTerrain.onlyWalk?(terrain)
|
!$PokemonGlobal.bicycle && !pbGetTerrainTag.must_walk
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbIsRunning?
|
def pbIsRunning?
|
||||||
@@ -53,7 +52,7 @@ class Game_Player < Game_Character
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_command
|
def update_command
|
||||||
if PBTerrain.isIce?(pbGetTerrainTag)
|
if pbGetTerrainTag.ice
|
||||||
self.move_speed = 4 # Sliding on ice
|
self.move_speed = 4 # Sliding on ice
|
||||||
elsif !moving? && !@move_route_forcing && $PokemonGlobal
|
elsif !moving? && !@move_route_forcing && $PokemonGlobal
|
||||||
if $PokemonGlobal.bicycle
|
if $PokemonGlobal.bicycle
|
||||||
|
|||||||
@@ -502,9 +502,10 @@ class CustomTilemap
|
|||||||
sprite.color = @color
|
sprite.color = @color
|
||||||
getAutotile(sprite,id)
|
getAutotile(sprite,id)
|
||||||
end
|
end
|
||||||
if PBTerrain.hasReflections?(terrain)
|
terrain_tag_data = GameData::TerrainTag.try_get(terrain)
|
||||||
|
if terrain_tag_data.shows_reflections
|
||||||
spriteZ = -100
|
spriteZ = -100
|
||||||
elsif $PokemonGlobal.bridge>0 && PBTerrain.isBridge?(terrain)
|
elsif $PokemonGlobal.bridge > 0 && terrain_tag_data.bridge
|
||||||
spriteZ = 1
|
spriteZ = 1
|
||||||
else
|
else
|
||||||
spriteZ = (priority==0) ? 0 : ypos+priority*32+32
|
spriteZ = (priority==0) ? 0 : ypos+priority*32+32
|
||||||
@@ -610,7 +611,7 @@ class CustomTilemap
|
|||||||
for x in 0...xsize
|
for x in 0...xsize
|
||||||
id = @map_data[x, y, z]
|
id = @map_data[x, y, z]
|
||||||
next if id == 0
|
next if id == 0
|
||||||
next if @priorities[id] == 0 && !PBTerrain.hasReflections?(@terrain_tags[id])
|
next if @priorities[id] == 0 && !GameData::TerrainTag.try_get(@terrain_tags[id]).shows_reflections
|
||||||
@priotiles[[x, y]] = [] if !@priotiles[[x, y]]
|
@priotiles[[x, y]] = [] if !@priotiles[[x, y]]
|
||||||
@priotiles[[x, y]].push([z, id])
|
@priotiles[[x, y]].push([z, id])
|
||||||
end
|
end
|
||||||
@@ -662,7 +663,7 @@ class CustomTilemap
|
|||||||
for z in 0...zsize
|
for z in 0...zsize
|
||||||
id = @map_data[x, y, z]
|
id = @map_data[x, y, z]
|
||||||
next if id == 0 || id >= 384 # Skip non-autotiles
|
next if id == 0 || id >= 384 # Skip non-autotiles
|
||||||
next if @priorities[id] != 0 || PBTerrain.hasReflections?(@terrain_tags[id])
|
next if @priorities[id] != 0 || GameData::TerrainTag.try_get(@terrain_tags[id]).shows_reflections
|
||||||
next if @framecount[id / 48 - 1] < 2
|
next if @framecount[id / 48 - 1] < 2
|
||||||
@prioautotiles[[x, y]] = true
|
@prioautotiles[[x, y]] = true
|
||||||
break
|
break
|
||||||
@@ -727,7 +728,7 @@ class CustomTilemap
|
|||||||
id = mapdata[x, y, z]
|
id = mapdata[x, y, z]
|
||||||
next if !id || id < 48 || id >= 384 # Skip non-autotiles
|
next if !id || id < 48 || id >= 384 # Skip non-autotiles
|
||||||
prioid = @priorities[id]
|
prioid = @priorities[id]
|
||||||
next if prioid != 0 || PBTerrain.hasReflections?(@terrain_tags[id])
|
next if prioid != 0 || GameData::TerrainTag.try_get(@terrain_tags[id]).shows_reflections
|
||||||
fcount = @framecount[id / 48 - 1]
|
fcount = @framecount[id / 48 - 1]
|
||||||
next if !fcount || fcount < 2
|
next if !fcount || fcount < 2
|
||||||
overallcount += 1
|
overallcount += 1
|
||||||
@@ -740,7 +741,7 @@ class CustomTilemap
|
|||||||
id = mapdata[x, y, z]
|
id = mapdata[x, y, z]
|
||||||
next if !id || id < 48
|
next if !id || id < 48
|
||||||
prioid = @priorities[id]
|
prioid = @priorities[id]
|
||||||
next if prioid != 0 || PBTerrain.hasReflections?(@terrain_tags[id])
|
next if prioid != 0 || GameData::TerrainTag.try_get(@terrain_tags[id]).shows_reflections
|
||||||
if overallcount > 2000
|
if overallcount > 2000
|
||||||
xpos = (x * twidth) - @oxLayer0
|
xpos = (x * twidth) - @oxLayer0
|
||||||
ypos = (y * theight) - @oyLayer0
|
ypos = (y * theight) - @oyLayer0
|
||||||
@@ -798,7 +799,7 @@ class CustomTilemap
|
|||||||
z += 1
|
z += 1
|
||||||
next if !id || id < 48
|
next if !id || id < 48
|
||||||
prioid = @priorities[id]
|
prioid = @priorities[id]
|
||||||
next if prioid != 0 || PBTerrain.hasReflections?(@terrain_tags[id])
|
next if prioid != 0 || GameData::TerrainTag.try_get(@terrain_tags[id]).shows_reflections
|
||||||
if id >= 384 # Tileset tiles
|
if id >= 384 # Tileset tiles
|
||||||
temprect.set(((id - 384) & 7) * @tileSrcWidth,
|
temprect.set(((id - 384) & 7) * @tileSrcWidth,
|
||||||
((id - 384) >> 3) * @tileSrcHeight,
|
((id - 384) >> 3) * @tileSrcHeight,
|
||||||
@@ -859,7 +860,7 @@ class CustomTilemap
|
|||||||
for x in xrange
|
for x in xrange
|
||||||
xpos = (x * twidth) - @oxLayer0
|
xpos = (x * twidth) - @oxLayer0
|
||||||
id = mapdata[x, y, z]
|
id = mapdata[x, y, z]
|
||||||
next if id == 0 || @priorities[id] != 0 || PBTerrain.hasReflections?(@terrain_tags[id])
|
next if id == 0 || @priorities[id] != 0 || GameData::TerrainTag.try_get(@terrain_tags[id]).shows_reflections
|
||||||
if id >= 384 # Tileset tiles
|
if id >= 384 # Tileset tiles
|
||||||
tmprect.set(((id - 384) & 7) * @tileSrcWidth,
|
tmprect.set(((id - 384) & 7) * @tileSrcWidth,
|
||||||
((id - 384) >> 3) * @tileSrcHeight,
|
((id - 384) >> 3) * @tileSrcHeight,
|
||||||
@@ -930,7 +931,7 @@ class CustomTilemap
|
|||||||
for x in minX..maxX
|
for x in minX..maxX
|
||||||
id = @map_data[x, y, z]
|
id = @map_data[x, y, z]
|
||||||
next if id == 0
|
next if id == 0
|
||||||
next if @priorities[id] == 0 && !PBTerrain.hasReflections?(@terrain_tags[id])
|
next if @priorities[id] == 0 && !GameData::TerrainTag.try_get(@terrain_tags[id]).shows_reflections
|
||||||
@priotilesfast.push([x, y, z, id])
|
@priotilesfast.push([x, y, z, id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ class Interpreter
|
|||||||
when 2 then value = character.direction # direction
|
when 2 then value = character.direction # direction
|
||||||
when 3 then value = character.screen_x # screen x-coordinate
|
when 3 then value = character.screen_x # screen x-coordinate
|
||||||
when 4 then value = character.screen_y # screen y-coordinate
|
when 4 then value = character.screen_y # screen y-coordinate
|
||||||
when 5 then value = character.terrain_tag # terrain tag
|
when 5 then value = character.terrain_tag.id_number # terrain tag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when 7 # other
|
when 7 # other
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
#===============================================================================
|
|
||||||
# Terrain tags
|
|
||||||
#===============================================================================
|
|
||||||
module PBTerrain
|
|
||||||
None = 0
|
|
||||||
Ledge = 1
|
|
||||||
Grass = 2
|
|
||||||
Sand = 3
|
|
||||||
Rock = 4
|
|
||||||
DeepWater = 5
|
|
||||||
StillWater = 6
|
|
||||||
Water = 7
|
|
||||||
Waterfall = 8
|
|
||||||
WaterfallCrest = 9
|
|
||||||
TallGrass = 10
|
|
||||||
UnderwaterGrass = 11
|
|
||||||
Ice = 12
|
|
||||||
Neutral = 13
|
|
||||||
SootGrass = 14
|
|
||||||
Bridge = 15
|
|
||||||
Puddle = 16
|
|
||||||
|
|
||||||
module_function
|
|
||||||
|
|
||||||
def isSurfable?(tag)
|
|
||||||
return isWater?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isWater?(tag)
|
|
||||||
return [Water, StillWater, DeepWater, WaterfallCrest, Waterfall].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isPassableWater?(tag)
|
|
||||||
return [Water, StillWater, DeepWater, WaterfallCrest].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isJustWater?(tag)
|
|
||||||
return [Water, StillWater, DeepWater].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isDeepWater?(tag)
|
|
||||||
return tag == DeepWater
|
|
||||||
end
|
|
||||||
|
|
||||||
def isWaterfall?(tag)
|
|
||||||
return [WaterfallCrest, Waterfall].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isGrass?(tag)
|
|
||||||
return [Grass, TallGrass, UnderwaterGrass, SootGrass].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isJustGrass?(tag) # The Poké Radar only works in these tiles
|
|
||||||
return [Grass, SootGrass].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isLedge?(tag)
|
|
||||||
return tag == Ledge
|
|
||||||
end
|
|
||||||
|
|
||||||
def isIce?(tag)
|
|
||||||
return tag == Ice
|
|
||||||
end
|
|
||||||
|
|
||||||
def isBridge?(tag)
|
|
||||||
return tag == Bridge
|
|
||||||
end
|
|
||||||
|
|
||||||
def hasReflections?(tag)
|
|
||||||
return [StillWater, Puddle].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def onlyWalk?(tag)
|
|
||||||
return [TallGrass, Ice].include?(tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def isDoubleWildBattle?(tag)
|
|
||||||
return tag == TallGrass
|
|
||||||
end
|
|
||||||
end
|
|
||||||
194
Data/Scripts/011_Data/002_Hardcoded data/013_TerrainTag.rb
Normal file
194
Data/Scripts/011_Data/002_Hardcoded data/013_TerrainTag.rb
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
module GameData
|
||||||
|
class TerrainTag
|
||||||
|
attr_reader :id
|
||||||
|
attr_reader :id_number
|
||||||
|
attr_reader :real_name
|
||||||
|
attr_reader :can_surf
|
||||||
|
attr_reader :waterfall # The main part only, not the crest
|
||||||
|
attr_reader :waterfall_crest
|
||||||
|
attr_reader :can_fish
|
||||||
|
attr_reader :can_dive
|
||||||
|
attr_reader :deep_bush
|
||||||
|
attr_reader :shows_grass_rustle
|
||||||
|
attr_reader :land_wild_encounters
|
||||||
|
attr_reader :double_wild_encounters
|
||||||
|
attr_reader :battle_environment
|
||||||
|
attr_reader :ledge
|
||||||
|
attr_reader :ice
|
||||||
|
attr_reader :bridge
|
||||||
|
attr_reader :shows_reflections
|
||||||
|
attr_reader :must_walk
|
||||||
|
attr_reader :ignore_passability
|
||||||
|
|
||||||
|
DATA = {}
|
||||||
|
|
||||||
|
extend ClassMethods
|
||||||
|
include InstanceMethods
|
||||||
|
|
||||||
|
# @param other [Symbol, self, String, Integer]
|
||||||
|
# @return [self]
|
||||||
|
def self.try_get(other)
|
||||||
|
return self.get(:None) if other.nil?
|
||||||
|
validate other => [Symbol, self, String, Integer]
|
||||||
|
return other if other.is_a?(self)
|
||||||
|
other = other.to_sym if other.is_a?(String)
|
||||||
|
return (self::DATA.has_key?(other)) ? self::DATA[other] : self.get(:None)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.load; end
|
||||||
|
def self.save; end
|
||||||
|
|
||||||
|
def initialize(hash)
|
||||||
|
@id = hash[:id]
|
||||||
|
@id_number = hash[:id_number]
|
||||||
|
@real_name = hash[:id].to_s || "Unnamed"
|
||||||
|
@can_surf = hash[:can_surf] || false
|
||||||
|
@waterfall = hash[:waterfall] || false
|
||||||
|
@waterfall_crest = hash[:waterfall_crest] || false
|
||||||
|
@can_fish = hash[:can_fish] || false
|
||||||
|
@can_dive = hash[:can_dive] || false
|
||||||
|
@deep_bush = hash[:deep_bush] || false
|
||||||
|
@shows_grass_rustle = hash[:shows_grass_rustle] || false
|
||||||
|
@land_wild_encounters = hash[:land_wild_encounters] || false
|
||||||
|
@double_wild_encounters = hash[:double_wild_encounters] || false
|
||||||
|
@battle_environment = hash[:battle_environment]
|
||||||
|
@ledge = hash[:ledge] || false
|
||||||
|
@ice = hash[:ice] || false
|
||||||
|
@bridge = hash[:bridge] || false
|
||||||
|
@shows_reflections = hash[:shows_reflections] || false
|
||||||
|
@must_walk = hash[:must_walk] || false
|
||||||
|
@ignore_passability = hash[:ignore_passability] || false
|
||||||
|
end
|
||||||
|
|
||||||
|
def can_surf_freely
|
||||||
|
return @can_surf && !@waterfall && !@waterfall_crest
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :None,
|
||||||
|
:id_number => 0
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Ledge,
|
||||||
|
:id_number => 1,
|
||||||
|
:ledge => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Grass,
|
||||||
|
:id_number => 2,
|
||||||
|
:shows_grass_rustle => true,
|
||||||
|
:land_wild_encounters => true,
|
||||||
|
:battle_environment => :Grass
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Sand,
|
||||||
|
:id_number => 3,
|
||||||
|
:battle_environment => :Sand
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Rock,
|
||||||
|
:id_number => 4,
|
||||||
|
:battle_environment => :Rock
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :DeepWater,
|
||||||
|
:id_number => 5,
|
||||||
|
:can_surf => true,
|
||||||
|
:can_fish => true,
|
||||||
|
:can_dive => true,
|
||||||
|
:battle_environment => :MovingWater
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :StillWater,
|
||||||
|
:id_number => 6,
|
||||||
|
:can_surf => true,
|
||||||
|
:can_fish => true,
|
||||||
|
:battle_environment => :StillWater,
|
||||||
|
:shows_reflections => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Water,
|
||||||
|
:id_number => 7,
|
||||||
|
:can_surf => true,
|
||||||
|
:can_fish => true,
|
||||||
|
:battle_environment => :MovingWater
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Waterfall,
|
||||||
|
:id_number => 8,
|
||||||
|
:can_surf => true,
|
||||||
|
:waterfall => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :WaterfallCrest,
|
||||||
|
:id_number => 9,
|
||||||
|
:can_surf => true,
|
||||||
|
:can_fish => true,
|
||||||
|
:waterfall_crest => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :TallGrass,
|
||||||
|
:id_number => 10,
|
||||||
|
:deep_bush => true,
|
||||||
|
:land_wild_encounters => true,
|
||||||
|
:double_wild_encounters => true,
|
||||||
|
:battle_environment => :TallGrass,
|
||||||
|
:must_walk => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :UnderwaterGrass,
|
||||||
|
:id_number => 11,
|
||||||
|
:land_wild_encounters => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Ice,
|
||||||
|
:id_number => 12,
|
||||||
|
:battle_environment => :Ice,
|
||||||
|
:ice => true,
|
||||||
|
:must_walk => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Neutral,
|
||||||
|
:id_number => 13,
|
||||||
|
:ignore_passability => true
|
||||||
|
})
|
||||||
|
|
||||||
|
# NOTE: This is referenced by ID in an Events.onStepTakenFieldMovement proc that
|
||||||
|
# adds soot to the Soot Sack if the player walks over one of these tiles.
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :SootGrass,
|
||||||
|
:id_number => 14,
|
||||||
|
:shows_grass_rustle => true,
|
||||||
|
:land_wild_encounters => true,
|
||||||
|
:battle_environment => :Grass
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Bridge,
|
||||||
|
:id_number => 15,
|
||||||
|
:bridge => true
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::TerrainTag.register({
|
||||||
|
:id => :Puddle,
|
||||||
|
:id_number => 16,
|
||||||
|
:battle_environment => :Puddle,
|
||||||
|
:shows_reflections => true
|
||||||
|
})
|
||||||
@@ -307,37 +307,31 @@ Events.onStepTakenFieldMovement += proc { |_sender,e|
|
|||||||
event = e[0] # Get the event affected by field movement
|
event = e[0] # Get the event affected by field movement
|
||||||
thistile = $MapFactory.getRealTilePos(event.map.map_id,event.x,event.y)
|
thistile = $MapFactory.getRealTilePos(event.map.map_id,event.x,event.y)
|
||||||
map = $MapFactory.getMap(thistile[0])
|
map = $MapFactory.getMap(thistile[0])
|
||||||
sootlevel = -1
|
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = map.data[thistile[1],thistile[2],i]
|
tile_id = map.data[thistile[1],thistile[2],i]
|
||||||
next if tile_id==nil
|
next if tile_id == nil
|
||||||
if map.terrain_tags[tile_id]==PBTerrain::SootGrass
|
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
|
||||||
sootlevel = i
|
if event == $game_player && GameData::Item.exists?(:SOOTSACK) && $PokemonBag.pbHasItem?(:SOOTSACK)
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if sootlevel>=0 && GameData::Item.exists?(:SOOTSACK)
|
|
||||||
$PokemonGlobal.sootsack = 0 if !$PokemonGlobal.sootsack
|
$PokemonGlobal.sootsack = 0 if !$PokemonGlobal.sootsack
|
||||||
# map.data[thistile[1],thistile[2],sootlevel]=0
|
|
||||||
if event==$game_player && $PokemonBag.pbHasItem?(:SOOTSACK)
|
|
||||||
$PokemonGlobal.sootsack += 1
|
$PokemonGlobal.sootsack += 1
|
||||||
end
|
end
|
||||||
|
# map.data[thistile[1], thistile[2], i] = 0
|
||||||
# $scene.createSingleSpriteset(map.map_id)
|
# $scene.createSingleSpriteset(map.map_id)
|
||||||
|
break
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Show grass rustle animation, and auto-move the player over waterfalls and ice
|
# Show grass rustle animation, and auto-move the player over waterfalls and ice
|
||||||
Events.onStepTakenFieldMovement += proc { |_sender,e|
|
Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||||
event = e[0] # Get the event affected by field movement
|
event = e[0] # Get the event affected by field movement
|
||||||
if $scene.is_a?(Scene_Map)
|
if $scene.is_a?(Scene_Map)
|
||||||
|
if pbGetTerrainTag(event, true).shows_grass_rustle # Won't show if under bridge
|
||||||
|
$scene.spriteset.addUserAnimation(Settings::GRASS_ANIMATION_ID, event.x, event.y, true, 1)
|
||||||
|
elsif event == $game_player
|
||||||
currentTag = pbGetTerrainTag(event)
|
currentTag = pbGetTerrainTag(event)
|
||||||
if PBTerrain.isJustGrass?(pbGetTerrainTag(event,true)) # Won't show if under bridge
|
if currentTag.waterfall_crest
|
||||||
$scene.spriteset.addUserAnimation(Settings::GRASS_ANIMATION_ID,event.x,event.y,true,1)
|
|
||||||
elsif event==$game_player
|
|
||||||
if currentTag==PBTerrain::WaterfallCrest
|
|
||||||
# Descend waterfall, but only if this event is the player
|
|
||||||
pbDescendWaterfall(event)
|
pbDescendWaterfall(event)
|
||||||
elsif PBTerrain.isIce?(currentTag) && !$PokemonGlobal.sliding
|
elsif currentTag.ice && !$PokemonGlobal.sliding
|
||||||
pbSlideOnIce(event)
|
pbSlideOnIce(event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -599,19 +593,17 @@ end
|
|||||||
|
|
||||||
def pbGetTerrainTag(event=nil,countBridge=false)
|
def pbGetTerrainTag(event=nil,countBridge=false)
|
||||||
event = $game_player if !event
|
event = $game_player if !event
|
||||||
return 0 if !event
|
return GameData::TerrainTag.get(:None) if !event
|
||||||
if $MapFactory
|
if $MapFactory
|
||||||
return $MapFactory.getTerrainTag(event.map.map_id,event.x,event.y,countBridge)
|
return $MapFactory.getTerrainTag(event.map.map_id,event.x,event.y,countBridge)
|
||||||
end
|
end
|
||||||
$game_map.terrain_tag(event.x,event.y,countBridge)
|
return $game_map.terrain_tag(event.x,event.y,countBridge)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFacingTerrainTag(event=nil,dir=nil)
|
def pbFacingTerrainTag(event=nil,dir=nil)
|
||||||
if $MapFactory
|
return $MapFactory.getFacingTerrainTag(dir,event) if $MapFactory
|
||||||
return $MapFactory.getFacingTerrainTag(dir,event)
|
|
||||||
end
|
|
||||||
event = $game_player if !event
|
event = $game_player if !event
|
||||||
return 0 if !event
|
return GameData::TerrainTag.get(:None) if !event
|
||||||
facing = pbFacingTile(dir,event)
|
facing = pbFacingTile(dir,event)
|
||||||
return $game_map.terrain_tag(facing[1],facing[2])
|
return $game_map.terrain_tag(facing[1],facing[2])
|
||||||
end
|
end
|
||||||
@@ -762,7 +754,7 @@ end
|
|||||||
# Player/event movement in the field
|
# Player/event movement in the field
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLedge(_xOffset,_yOffset)
|
def pbLedge(_xOffset,_yOffset)
|
||||||
if PBTerrain.isLedge?(pbFacingTerrainTag)
|
if pbFacingTerrainTag.ledge
|
||||||
if pbJumpToward(2,true)
|
if pbJumpToward(2,true)
|
||||||
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)
|
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)
|
||||||
$game_player.increase_steps
|
$game_player.increase_steps
|
||||||
@@ -776,7 +768,7 @@ end
|
|||||||
def pbSlideOnIce(event=nil)
|
def pbSlideOnIce(event=nil)
|
||||||
event = $game_player if !event
|
event = $game_player if !event
|
||||||
return if !event
|
return if !event
|
||||||
return if !PBTerrain.isIce?(pbGetTerrainTag(event))
|
return if !pbGetTerrainTag(event).ice
|
||||||
$PokemonGlobal.sliding = true
|
$PokemonGlobal.sliding = true
|
||||||
direction = event.direction
|
direction = event.direction
|
||||||
oldwalkanime = event.walk_anime
|
oldwalkanime = event.walk_anime
|
||||||
@@ -784,7 +776,7 @@ def pbSlideOnIce(event=nil)
|
|||||||
event.walk_anime = false
|
event.walk_anime = false
|
||||||
loop do
|
loop do
|
||||||
break if !event.passable?(event.x,event.y,direction)
|
break if !event.passable?(event.x,event.y,direction)
|
||||||
break if !PBTerrain.isIce?(pbGetTerrainTag(event))
|
break if !pbGetTerrainTag(event).ice
|
||||||
event.move_forward
|
event.move_forward
|
||||||
while event.moving?
|
while event.moving?
|
||||||
pbUpdateSceneMap
|
pbUpdateSceneMap
|
||||||
|
|||||||
@@ -174,17 +174,11 @@ def pbGetEnvironment
|
|||||||
else
|
else
|
||||||
terrainTag = $game_player.terrain_tag
|
terrainTag = $game_player.terrain_tag
|
||||||
end
|
end
|
||||||
case terrainTag
|
tile_environment = terrainTag.battle_environment
|
||||||
when PBTerrain::Grass, PBTerrain::SootGrass
|
if ret == :Forest && [:Grass, :TallGrass].include?(tile_environment)
|
||||||
ret = (ret == :Forest) ? :ForestGrass : :Grass
|
ret = :ForestGrass
|
||||||
when PBTerrain::TallGrass
|
else
|
||||||
ret = (ret == :Forest) ? :ForestGrass : :TallGrass
|
ret = tile_environment if tile_environment
|
||||||
when PBTerrain::Rock then ret = :Rock
|
|
||||||
when PBTerrain::Sand then ret = :Sand
|
|
||||||
when PBTerrain::DeepWater, PBTerrain::Water then ret = :MovingWater
|
|
||||||
when PBTerrain::StillWater then ret = :StillWater
|
|
||||||
when PBTerrain::Puddle then ret = :Puddle
|
|
||||||
when PBTerrain::Ice then ret = :Ice
|
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ class PokemonEncounters
|
|||||||
def encounter_possible_here?
|
def encounter_possible_here?
|
||||||
return true if $PokemonGlobal.surfing
|
return true if $PokemonGlobal.surfing
|
||||||
terrain_tag = $game_map.terrain_tag($game_player.x, $game_player.y)
|
terrain_tag = $game_map.terrain_tag($game_player.x, $game_player.y)
|
||||||
return false if PBTerrain.isIce?(terrain_tag)
|
return false if terrain_tag.ice
|
||||||
return true if has_cave_encounters? # i.e. this map is a cave
|
return true if has_cave_encounters? # i.e. this map is a cave
|
||||||
return true if PBTerrain.isGrass?(terrain_tag) && has_land_encounters?
|
return true if has_land_encounters? && terrain_tag.land_wild_encounters
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ class PokemonEncounters
|
|||||||
return false if pbInSafari?
|
return false if pbInSafari?
|
||||||
return true if $PokemonGlobal.partner
|
return true if $PokemonGlobal.partner
|
||||||
return false if $Trainer.able_pokemon_count <= 1
|
return false if $Trainer.able_pokemon_count <= 1
|
||||||
return true if PBTerrain.isDoubleWildBattle?(pbGetTerrainTag) && rand(100) < 30
|
return true if pbGetTerrainTag.double_wild_encounters && rand(100) < 30
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ class PokemonEncounters
|
|||||||
if $PokemonGlobal.surfing
|
if $PokemonGlobal.surfing
|
||||||
ret = find_valid_encounter_type_for_time(:Water, time)
|
ret = find_valid_encounter_type_for_time(:Water, time)
|
||||||
else # Land/Cave (can have both in the same map)
|
else # Land/Cave (can have both in the same map)
|
||||||
if has_land_encounters? && PBTerrain.isGrass?($game_map.terrain_tag($game_player.x, $game_player.y))
|
if has_land_encounters? && $game_map.terrain_tag($game_player.x, $game_player.y).land_wild_encounters
|
||||||
ret = :BugContest if pbInBugContest? && has_encounter_type?(:BugContest)
|
ret = :BugContest if pbInBugContest? && has_encounter_type?(:BugContest)
|
||||||
ret = find_valid_encounter_type_for_time(:Land, time) if !ret
|
ret = find_valid_encounter_type_for_time(:Land, time) if !ret
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -381,11 +381,11 @@ Events.onAction += proc { |_sender, _e|
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
if surface_map_id &&
|
if surface_map_id &&
|
||||||
PBTerrain.isDeepWater?($MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y))
|
$MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive
|
||||||
pbSurfacing
|
pbSurfacing
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
pbDive if PBTerrain.isDeepWater?($game_player.terrain_tag)
|
pbDive if $game_player.terrain_tag.can_dive
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
if !surface_map_id ||
|
if !surface_map_id ||
|
||||||
!PBTerrain.isDeepWater?($MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y))
|
!$MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive
|
||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -409,7 +409,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
|||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
if !PBTerrain.isDeepWater?($game_player.terrain_tag)
|
if !$game_player.terrain_tag.can_dive
|
||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -727,9 +727,7 @@ def pbEndSurf(_xOffset,_yOffset)
|
|||||||
return false if !$PokemonGlobal.surfing
|
return false if !$PokemonGlobal.surfing
|
||||||
x = $game_player.x
|
x = $game_player.x
|
||||||
y = $game_player.y
|
y = $game_player.y
|
||||||
currentTag = $game_map.terrain_tag(x,y)
|
if $game_map.terrain_tag(x,y).can_surf && !pbFacingTerrainTag.can_surf
|
||||||
facingTag = pbFacingTerrainTag
|
|
||||||
if PBTerrain.isSurfable?(currentTag) && !PBTerrain.isSurfable?(facingTag)
|
|
||||||
$PokemonTemp.surfJump = [x,y]
|
$PokemonTemp.surfJump = [x,y]
|
||||||
if pbJumpToward(1,false,true)
|
if pbJumpToward(1,false,true)
|
||||||
$game_map.autoplayAsCue
|
$game_map.autoplayAsCue
|
||||||
@@ -759,7 +757,7 @@ Events.onAction += proc { |_sender,_e|
|
|||||||
next if $PokemonGlobal.surfing
|
next if $PokemonGlobal.surfing
|
||||||
next if GameData::MapMetadata.exists?($game_map.map_id) &&
|
next if GameData::MapMetadata.exists?($game_map.map_id) &&
|
||||||
GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||||
next if !PBTerrain.isSurfable?(pbFacingTerrainTag)
|
next if !pbFacingTerrainTag.can_surf_freely
|
||||||
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
|
||||||
}
|
}
|
||||||
@@ -779,7 +777,7 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
|
|||||||
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
|
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
if !PBTerrain.isSurfable?(pbFacingTerrainTag) ||
|
if !pbFacingTerrainTag.can_surf_freely ||
|
||||||
!$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
!$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||||
pbMessage(_INTL("No surfing here!")) if showmsg
|
pbMessage(_INTL("No surfing here!")) if showmsg
|
||||||
next false
|
next false
|
||||||
@@ -914,13 +912,13 @@ def pbAscendWaterfall(event=nil)
|
|||||||
oldthrough = event.through
|
oldthrough = event.through
|
||||||
oldmovespeed = event.move_speed
|
oldmovespeed = event.move_speed
|
||||||
terrain = pbFacingTerrainTag
|
terrain = pbFacingTerrainTag
|
||||||
return if !PBTerrain.isWaterfall?(terrain)
|
return if !terrain.waterfall && !terrain.waterfall_crest
|
||||||
event.through = true
|
event.through = true
|
||||||
event.move_speed = 2
|
event.move_speed = 2
|
||||||
loop do
|
loop do
|
||||||
event.move_up
|
event.move_up
|
||||||
terrain = pbGetTerrainTag(event)
|
terrain = pbGetTerrainTag(event)
|
||||||
break if !PBTerrain.isWaterfall?(terrain)
|
break if !terrain.waterfall && !terrain.waterfall_crest
|
||||||
end
|
end
|
||||||
event.through = oldthrough
|
event.through = oldthrough
|
||||||
event.move_speed = oldmovespeed
|
event.move_speed = oldmovespeed
|
||||||
@@ -933,13 +931,13 @@ def pbDescendWaterfall(event=nil)
|
|||||||
oldthrough = event.through
|
oldthrough = event.through
|
||||||
oldmovespeed = event.move_speed
|
oldmovespeed = event.move_speed
|
||||||
terrain = pbFacingTerrainTag
|
terrain = pbFacingTerrainTag
|
||||||
return if !PBTerrain.isWaterfall?(terrain)
|
return if !terrain.waterfall && !terrain.waterfall_crest
|
||||||
event.through = true
|
event.through = true
|
||||||
event.move_speed = 2
|
event.move_speed = 2
|
||||||
loop do
|
loop do
|
||||||
event.move_down
|
event.move_down
|
||||||
terrain = pbGetTerrainTag(event)
|
terrain = pbGetTerrainTag(event)
|
||||||
break if !PBTerrain.isWaterfall?(terrain)
|
break if !terrain.waterfall && !terrain.waterfall_crest
|
||||||
end
|
end
|
||||||
event.through = oldthrough
|
event.through = oldthrough
|
||||||
event.move_speed = oldmovespeed
|
event.move_speed = oldmovespeed
|
||||||
@@ -964,16 +962,16 @@ end
|
|||||||
|
|
||||||
Events.onAction += proc { |_sender,_e|
|
Events.onAction += proc { |_sender,_e|
|
||||||
terrain = pbFacingTerrainTag
|
terrain = pbFacingTerrainTag
|
||||||
if terrain==PBTerrain::Waterfall
|
if terrain.waterfall
|
||||||
pbWaterfall
|
pbWaterfall
|
||||||
elsif terrain==PBTerrain::WaterfallCrest
|
elsif terrain.waterfall_crest
|
||||||
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc { |move,pkmn,showmsg|
|
HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc { |move,pkmn,showmsg|
|
||||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL,showmsg)
|
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL,showmsg)
|
||||||
if pbFacingTerrainTag!=PBTerrain::Waterfall
|
if !pbFacingTerrainTag.waterfall
|
||||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ class DependentEvents
|
|||||||
tile=$MapFactory.getFacingTile(facing,leader)
|
tile=$MapFactory.getFacingTile(facing,leader)
|
||||||
passable=tile && $MapFactory.isPassableStrict?(tile[0],tile[1],tile[2],follower)
|
passable=tile && $MapFactory.isPassableStrict?(tile[0],tile[1],tile[2],follower)
|
||||||
if i==0 && !passable && tile &&
|
if i==0 && !passable && tile &&
|
||||||
PBTerrain.isLedge?($MapFactory.getTerrainTag(tile[0],tile[1],tile[2]))
|
$MapFactory.getTerrainTag(tile[0],tile[1],tile[2]).ledge
|
||||||
# If the tile isn't passable and the tile is a ledge,
|
# If the tile isn't passable and the tile is a ledge,
|
||||||
# get tile from further behind
|
# get tile from further behind
|
||||||
tile=$MapFactory.getFacingTileFromPos(tile[0],tile[1],tile[2],facing)
|
tile=$MapFactory.getFacingTileFromPos(tile[0],tile[1],tile[2],facing)
|
||||||
|
|||||||
@@ -335,8 +335,8 @@ end
|
|||||||
# Decide whether the player is able to ride/dismount their Bicycle
|
# Decide whether the player is able to ride/dismount their Bicycle
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbBikeCheck
|
def pbBikeCheck
|
||||||
if $PokemonGlobal.surfing ||
|
if $PokemonGlobal.surfing || $PokemonGlobal.diving ||
|
||||||
(!$PokemonGlobal.bicycle && PBTerrain.onlyWalk?(pbGetTerrainTag))
|
(!$PokemonGlobal.bicycle && pbGetTerrainTag.must_walk)
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,12 +41,8 @@ ItemHandlers::UseFromBag.add(:BICYCLE,proc { |item|
|
|||||||
ItemHandlers::UseFromBag.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
|
ItemHandlers::UseFromBag.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
|
||||||
|
|
||||||
ItemHandlers::UseFromBag.add(:OLDROD,proc { |item|
|
ItemHandlers::UseFromBag.add(:OLDROD,proc { |item|
|
||||||
terrain = pbFacingTerrainTag
|
|
||||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||||
if (PBTerrain.isWater?(terrain) && !$PokemonGlobal.surfing && notCliff) ||
|
next 2 if pbFacingTerrainTag.can_fish && ($PokemonGlobal.surfing || notCliff)
|
||||||
(PBTerrain.isWater?(terrain) && $PokemonGlobal.surfing)
|
|
||||||
next 2
|
|
||||||
end
|
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
next 0
|
next 0
|
||||||
})
|
})
|
||||||
@@ -113,10 +109,9 @@ ItemHandlers::UseInField.add(:MAXREPEL,proc { |item|
|
|||||||
})
|
})
|
||||||
|
|
||||||
Events.onStepTaken += proc {
|
Events.onStepTaken += proc {
|
||||||
if $PokemonGlobal.repel>0
|
if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice
|
||||||
if !PBTerrain.isIce?($game_player.terrain_tag) # Shouldn't count down if on ice
|
|
||||||
$PokemonGlobal.repel -= 1
|
$PokemonGlobal.repel -= 1
|
||||||
if $PokemonGlobal.repel<=0
|
if $PokemonGlobal.repel <= 0
|
||||||
if $PokemonBag.pbHasItem?(:REPEL) ||
|
if $PokemonBag.pbHasItem?(:REPEL) ||
|
||||||
$PokemonBag.pbHasItem?(:SUPERREPEL) ||
|
$PokemonBag.pbHasItem?(:SUPERREPEL) ||
|
||||||
$PokemonBag.pbHasItem?(:MAXREPEL)
|
$PokemonBag.pbHasItem?(:MAXREPEL)
|
||||||
@@ -136,7 +131,6 @@ Events.onStepTaken += proc {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemHandlers::UseInField.add(:BLACKFLUTE,proc { |item|
|
ItemHandlers::UseInField.add(:BLACKFLUTE,proc { |item|
|
||||||
@@ -236,9 +230,8 @@ ItemHandlers::UseInField.add(:BICYCLE,proc { |item|
|
|||||||
ItemHandlers::UseInField.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
|
ItemHandlers::UseInField.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
|
||||||
|
|
||||||
ItemHandlers::UseInField.add(:OLDROD,proc { |item|
|
ItemHandlers::UseInField.add(:OLDROD,proc { |item|
|
||||||
terrain = pbFacingTerrainTag
|
|
||||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||||
if !PBTerrain.isWater?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
|
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
next 0
|
next 0
|
||||||
end
|
end
|
||||||
@@ -250,9 +243,8 @@ ItemHandlers::UseInField.add(:OLDROD,proc { |item|
|
|||||||
})
|
})
|
||||||
|
|
||||||
ItemHandlers::UseInField.add(:GOODROD,proc { |item|
|
ItemHandlers::UseInField.add(:GOODROD,proc { |item|
|
||||||
terrain = pbFacingTerrainTag
|
|
||||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||||
if !PBTerrain.isWater?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
|
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
next 0
|
next 0
|
||||||
end
|
end
|
||||||
@@ -264,9 +256,8 @@ ItemHandlers::UseInField.add(:GOODROD,proc { |item|
|
|||||||
})
|
})
|
||||||
|
|
||||||
ItemHandlers::UseInField.add(:SUPERROD,proc { |item|
|
ItemHandlers::UseInField.add(:SUPERROD,proc { |item|
|
||||||
terrain = pbFacingTerrainTag
|
|
||||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||||
if !PBTerrain.isWater?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
|
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
next 0
|
next 0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ end
|
|||||||
################################################################################
|
################################################################################
|
||||||
def pbCanUsePokeRadar?
|
def pbCanUsePokeRadar?
|
||||||
# Can't use Radar if not in tall grass
|
# Can't use Radar if not in tall grass
|
||||||
if !PBTerrain.isJustGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
|
terrain = $game_map.terrain_tag($game_player.x,$game_player.y)
|
||||||
|
if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -73,7 +74,8 @@ def pbPokeRadarHighlightGrass(showmessage=true)
|
|||||||
# Add tile to grasses array if it's a valid grass tile
|
# Add tile to grasses array if it's a valid grass tile
|
||||||
if x>=0 && x<$game_map.width &&
|
if x>=0 && x<$game_map.width &&
|
||||||
y>=0 && y<$game_map.height
|
y>=0 && y<$game_map.height
|
||||||
if PBTerrain.isJustGrass?($game_map.terrain_tag(x,y))
|
terrain = $game_map.terrain_tag(x, y)
|
||||||
|
if terrain.land_wild_encounters && terrain.shows_grass_rustle
|
||||||
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
|
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
|
||||||
s = (rand(100) < 25) ? 1 : 0
|
s = (rand(100) < 25) ? 1 : 0
|
||||||
if $PokemonTemp.pokeradar && $PokemonTemp.pokeradar[2] > 0
|
if $PokemonTemp.pokeradar && $PokemonTemp.pokeradar[2] > 0
|
||||||
@@ -216,7 +218,8 @@ Events.onStepTaken += proc { |_sender,_e|
|
|||||||
!$PokemonTemp.pokeradar
|
!$PokemonTemp.pokeradar
|
||||||
$PokemonGlobal.pokeradarBattery -= 1
|
$PokemonGlobal.pokeradarBattery -= 1
|
||||||
end
|
end
|
||||||
if !PBTerrain.isJustGrass?($game_map.terrain_tag($game_player.x, $game_player.y))
|
terrain = $game_map.terrain_tag($game_player.x,$game_player.y)
|
||||||
|
if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
|
||||||
pbPokeRadarCancel
|
pbPokeRadarCancel
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,11 +77,10 @@ class PokemonTilesetScene
|
|||||||
overlay.fill_rect(tile_x + TILE_SIZE * 2, tile_y - 1, 1, TILE_SIZE * 2 + 2, Color.new(255, 255, 255))
|
overlay.fill_rect(tile_x + TILE_SIZE * 2, tile_y - 1, 1, TILE_SIZE * 2 + 2, Color.new(255, 255, 255))
|
||||||
# Write terrain tag info about selected tile
|
# Write terrain tag info about selected tile
|
||||||
terrain_tag = @tileset.terrain_tags[tile_id] || 0
|
terrain_tag = @tileset.terrain_tags[tile_id] || 0
|
||||||
terrain_tag_name = getConstantNameOrValue(PBTerrain, terrain_tag)
|
if GameData::TerrainTag.exists?(terrain_tag)
|
||||||
if terrain_tag_name == terrain_tag.to_s
|
terrain_tag_name = sprintf("%d: %s", terrain_tag, GameData::TerrainTag.get(terrain_tag).real_name)
|
||||||
terrain_tag_name = terrain_tag.to_s
|
|
||||||
else
|
else
|
||||||
terrain_tag_name = sprintf("%d: %s", terrain_tag, terrain_tag_name)
|
terrain_tag_name = terrain_tag.to_s
|
||||||
end
|
end
|
||||||
textpos = [
|
textpos = [
|
||||||
[_INTL("Terrain Tag:"), tile_x + TILE_SIZE, tile_y + TILE_SIZE * 2 + 10, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)],
|
[_INTL("Terrain Tag:"), tile_x + TILE_SIZE, tile_y + TILE_SIZE * 2 + 10, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)],
|
||||||
|
|||||||
Reference in New Issue
Block a user