mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Added support for large events, allowed field move-related event names to have other text in their names
This commit is contained in:
@@ -148,3 +148,13 @@ SaveData.register_conversion(:v19_convert_storage) do
|
||||
end # storage.instance_eval
|
||||
end # to_value
|
||||
end
|
||||
|
||||
# TODO: See if there are more conversions needed for this. There may not be.
|
||||
SaveData.register_conversion(:v19_convert_game_player) do
|
||||
essentials_version 19
|
||||
display_title 'Converting game player character'
|
||||
to_value :game_player do |game_player|
|
||||
game_player.width = 1
|
||||
game_player.height = 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,6 +62,7 @@ class Game_Map
|
||||
for i in @map.events.keys
|
||||
@events[i] = Game_Event.new(@map_id, @map.events[i],self)
|
||||
end
|
||||
# TODO: These should be moved to Spriteset_Global as we only need one copy of them.
|
||||
@common_events = {}
|
||||
for i in 1...$data_common_events.size
|
||||
@common_events[i] = Game_CommonEvent.new(i)
|
||||
@@ -147,10 +148,10 @@ class Game_Map
|
||||
bit = (1 << (d / 2 - 1)) & 0x0f
|
||||
for event in events.values
|
||||
next if event.tile_id <= 0
|
||||
next if GameData::TerrainTag.try_get(@terrain_tags[event.tile_id]).ignore_passability
|
||||
next if event == self_event
|
||||
next if event.x != x || event.y != y
|
||||
next if !event.at_coordinate?(x, y)
|
||||
next if event.through
|
||||
next if GameData::TerrainTag.try_get(@terrain_tags[event.tile_id]).ignore_passability
|
||||
passage = @passages[event.tile_id]
|
||||
return false if passage & bit != 0
|
||||
return false if passage & 0x0f == 0x0f
|
||||
@@ -158,7 +159,8 @@ class Game_Map
|
||||
end
|
||||
return playerPassable?(x, y, d, self_event) if self_event==$game_player
|
||||
# All other events
|
||||
newx = x; newy = y
|
||||
newx = x
|
||||
newy = y
|
||||
case d
|
||||
when 1
|
||||
newx -= 1
|
||||
@@ -185,7 +187,6 @@ class Game_Map
|
||||
for i in [2, 1, 0]
|
||||
tile_id = data[x, y, i]
|
||||
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
|
||||
passage = @passages[tile_id]
|
||||
# If already on water, only allow movement to another water tile
|
||||
if self_event != nil && terrain.can_surf_freely
|
||||
for j in [2, 1, 0]
|
||||
@@ -211,6 +212,7 @@ class Game_Map
|
||||
end
|
||||
# Regular passability checks
|
||||
if !terrain || !terrain.ignore_passability
|
||||
passage = @passages[tile_id]
|
||||
return false if passage & bit != 0 || passage & 0x0f == 0x0f
|
||||
return true if @priorities[tile_id] == 0
|
||||
end
|
||||
@@ -251,7 +253,7 @@ class Game_Map
|
||||
return false if !valid?(x, y)
|
||||
for event in events.values
|
||||
next if event == self_event || event.tile_id < 0 || event.through
|
||||
next if event.x != x || event.y != y
|
||||
next if !event.at_coordinate?(x, y)
|
||||
next if GameData::TerrainTag.try_get(@terrain_tags[event.tile_id]).ignore_passability
|
||||
return false if @passages[event.tile_id] & 0x0f != 0
|
||||
return true if @priorities[event.tile_id] == 0
|
||||
@@ -307,9 +309,10 @@ class Game_Map
|
||||
return GameData::TerrainTag.get(:None)
|
||||
end
|
||||
|
||||
# Unused.
|
||||
def check_event(x,y)
|
||||
for event in self.events.values
|
||||
return event.id if event.x == x and event.y == y
|
||||
return event.id if event.at_coordinate?(x, y)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class PokemonMapFactory
|
||||
end
|
||||
# Check passability of event(s) in that spot
|
||||
for event in map.events.values
|
||||
next if event.x != x || event.y != y || event == thisEvent
|
||||
next if event == thisEvent || !event.at_coordinate?(x, y)
|
||||
return false if !event.through && event.character_name != ""
|
||||
end
|
||||
# Check passability of player
|
||||
@@ -210,7 +210,7 @@ class PokemonMapFactory
|
||||
return false if !map.passableStrict?(x,y,0,thisEvent)
|
||||
end
|
||||
for event in map.events.values
|
||||
next if event == thisEvent || event.x != x || event.y != y
|
||||
next if event == thisEvent || !event.at_coordinate?(x, y)
|
||||
return false if !event.through && event.character_name!=""
|
||||
end
|
||||
return true
|
||||
@@ -221,6 +221,7 @@ class PokemonMapFactory
|
||||
return map.terrain_tag(x,y,countBridge)
|
||||
end
|
||||
|
||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one terrain tag.
|
||||
def getFacingTerrainTag(dir=nil,event=nil)
|
||||
tile = getFacingTile(dir,event)
|
||||
return GameData::TerrainTag.get(:None) if !tile
|
||||
@@ -281,12 +282,14 @@ class PokemonMapFactory
|
||||
thisEvent.map.map_id,thisEvent.x,thisEvent.y,otherMapID,otherX,otherY)
|
||||
end
|
||||
|
||||
# Unused
|
||||
def getOffsetEventPos(event,xOffset,yOffset)
|
||||
event = $game_player if !event
|
||||
return nil if !event
|
||||
return getRealTilePos(event.map.map_id,event.x+xOffset,event.y+yOffset)
|
||||
end
|
||||
|
||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||
def getFacingTile(direction=nil,event=nil,steps=1)
|
||||
event = $game_player if event==nil
|
||||
return [0,0,0] if !event
|
||||
|
||||
@@ -6,6 +6,8 @@ class Game_Character
|
||||
attr_reader :y
|
||||
attr_reader :real_x
|
||||
attr_reader :real_y
|
||||
attr_accessor :width
|
||||
attr_accessor :height
|
||||
attr_accessor :sprite_size
|
||||
attr_reader :tile_id
|
||||
attr_accessor :character_name
|
||||
@@ -33,6 +35,8 @@ class Game_Character
|
||||
@y = 0
|
||||
@real_x = 0
|
||||
@real_y = 0
|
||||
@width = 1
|
||||
@height = 1
|
||||
@sprite_size = [Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT]
|
||||
@tile_id = 0
|
||||
@character_name = ""
|
||||
@@ -73,6 +77,24 @@ class Game_Character
|
||||
@prelock_direction = 0
|
||||
end
|
||||
|
||||
def at_coordinate?(check_x, check_y)
|
||||
return check_x >= @x && check_x < @x + @width &&
|
||||
check_y > @y - @height && check_y <= @y
|
||||
end
|
||||
|
||||
def in_line_with_coordinate?(check_x, check_y)
|
||||
return (check_x >= @x && check_x < @x + @width) ||
|
||||
(check_y > @y - @height && check_y <= @y)
|
||||
end
|
||||
|
||||
def each_occupied_tile
|
||||
for i in @x...(@x + @width)
|
||||
for j in (@y - @height + 1)..@y
|
||||
yield i, j
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def move_speed=(val)
|
||||
return if val==@move_speed
|
||||
@move_speed = val
|
||||
@@ -182,7 +204,7 @@ class Game_Character
|
||||
#=============================================================================
|
||||
# Passability
|
||||
#=============================================================================
|
||||
def passableEx?(x, y, d, strict=false)
|
||||
def passable?(x, y, d, strict = false)
|
||||
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
|
||||
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
|
||||
return false unless self.map.valid?(new_x, new_y)
|
||||
@@ -195,7 +217,7 @@ class Game_Character
|
||||
return false unless self.map.passable?(new_x, new_y, 10 - d, self)
|
||||
end
|
||||
for event in self.map.events.values
|
||||
next if event.x != new_x || event.y != new_y || event.through
|
||||
next if self == event || !event.at_coordinate?(new_x, new_y) || event.through
|
||||
return false if self != $game_player || event.character_name != ""
|
||||
end
|
||||
if $game_player.x == new_x and $game_player.y == new_y
|
||||
@@ -204,12 +226,49 @@ class Game_Character
|
||||
return true
|
||||
end
|
||||
|
||||
def passable?(x,y,d)
|
||||
return passableEx?(x,y,d,false)
|
||||
def can_move_from_coordinate?(start_x, start_y, dir, strict = false)
|
||||
case dir
|
||||
when 2, 8 # Down, up
|
||||
y_diff = (dir == 8) ? @height - 1 : 0
|
||||
for i in start_x...(start_x + @width)
|
||||
return false if !passable?(i, start_y - y_diff, dir, strict)
|
||||
end
|
||||
return true
|
||||
when 4, 6 # Left, right
|
||||
x_diff = (dir == 6) ? @width - 1 : 0
|
||||
for i in (start_y - @height + 1)..start_y
|
||||
return false if !passable?(start_x + x_diff, i, dir, strict)
|
||||
end
|
||||
return true
|
||||
when 1, 3 # Down diagonals
|
||||
# Treated as moving down first and then horizontally, because that
|
||||
# describes which tiles the character's feet touch
|
||||
for i in start_x...(start_x + @width)
|
||||
return false if !passable?(i, start_y, 2, strict)
|
||||
end
|
||||
x_diff = (dir == 3) ? @width - 1 : 0
|
||||
for i in (start_y - @height + 1)..start_y
|
||||
return false if !passable?(start_x + x_diff, i + 1, dir + 3, strict)
|
||||
end
|
||||
return true
|
||||
when 7, 9 # Up diagonals
|
||||
# Treated as moving horizontally first and then up, because that describes
|
||||
# which tiles the character's feet touch
|
||||
x_diff = (dir == 9) ? @width - 1 : 0
|
||||
for i in (start_y - @height + 1)..start_y
|
||||
return false if !passable?(start_x + x_diff, i, dir - 3, strict)
|
||||
end
|
||||
x_offset = (dir == 9) ? 1 : -1
|
||||
for i in start_x...(start_x + @width)
|
||||
return false if !passable?(i + x_offset, start_y - @height + 1, 8, strict)
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def passableStrict?(x,y,d)
|
||||
return passableEx?(x,y,d,true)
|
||||
def can_move_in_direction?(dir, strict = false)
|
||||
return can_move_from_coordinate?(@x, @y, dir, strict)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -217,7 +276,7 @@ class Game_Character
|
||||
#=============================================================================
|
||||
def screen_x
|
||||
ret = ((@real_x - self.map.display_x) / Game_Map::X_SUBPIXELS).round
|
||||
ret += Game_Map::TILE_WIDTH/2
|
||||
ret += @width * Game_Map::TILE_WIDTH / 2
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -321,8 +380,8 @@ class Game_Character
|
||||
end
|
||||
|
||||
def move_type_toward_player
|
||||
sx = @x - $game_player.x
|
||||
sy = @y - $game_player.y
|
||||
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
|
||||
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
|
||||
if sx.abs + sy.abs >= 20
|
||||
move_random
|
||||
return
|
||||
@@ -441,7 +500,7 @@ class Game_Character
|
||||
turn_generic(dir) if turn_enabled
|
||||
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
|
||||
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
|
||||
if passable?(@x, @y, dir)
|
||||
if can_move_in_direction?(dir)
|
||||
turn_generic(dir)
|
||||
@x += x_offset
|
||||
@y += y_offset
|
||||
@@ -471,8 +530,7 @@ class Game_Character
|
||||
unless @direction_fix
|
||||
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
|
||||
end
|
||||
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
|
||||
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
|
||||
if can_move_in_direction?(7)
|
||||
@x -= 1
|
||||
@y -= 1
|
||||
increase_steps
|
||||
@@ -483,8 +541,7 @@ class Game_Character
|
||||
unless @direction_fix
|
||||
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
|
||||
end
|
||||
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
|
||||
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
|
||||
if can_move_in_direction?(9)
|
||||
@x += 1
|
||||
@y -= 1
|
||||
increase_steps
|
||||
@@ -495,8 +552,7 @@ class Game_Character
|
||||
unless @direction_fix
|
||||
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
|
||||
end
|
||||
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
|
||||
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
|
||||
if can_move_in_direction?(1)
|
||||
@x -= 1
|
||||
@y += 1
|
||||
increase_steps
|
||||
@@ -507,8 +563,7 @@ class Game_Character
|
||||
unless @direction_fix
|
||||
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
|
||||
end
|
||||
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
|
||||
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
|
||||
if can_move_in_direction?(3)
|
||||
@x += 1
|
||||
@y += 1
|
||||
increase_steps
|
||||
@@ -574,8 +629,8 @@ class Game_Character
|
||||
end
|
||||
|
||||
def move_toward_player
|
||||
sx = @x - $game_player.x
|
||||
sy = @y - $game_player.y
|
||||
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
|
||||
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
|
||||
return if sx == 0 and sy == 0
|
||||
abs_sx = sx.abs
|
||||
abs_sy = sy.abs
|
||||
@@ -596,8 +651,8 @@ class Game_Character
|
||||
end
|
||||
|
||||
def move_away_from_player
|
||||
sx = @x - $game_player.x
|
||||
sy = @y - $game_player.y
|
||||
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
|
||||
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
|
||||
return if sx == 0 and sy == 0
|
||||
abs_sx = sx.abs
|
||||
abs_sy = sy.abs
|
||||
@@ -639,18 +694,16 @@ class Game_Character
|
||||
end
|
||||
|
||||
def jump(x_plus, y_plus)
|
||||
if x_plus != 0 or y_plus != 0
|
||||
if x_plus != 0 || y_plus != 0
|
||||
if x_plus.abs > y_plus.abs
|
||||
(x_plus < 0) ? turn_left : turn_right
|
||||
else
|
||||
(y_plus < 0) ? turn_up : turn_down
|
||||
end
|
||||
each_occupied_tile { |i, j| return if !passable?(i + x_plus, j + y_plus, 0) }
|
||||
end
|
||||
new_x = @x + x_plus
|
||||
new_y = @y + y_plus
|
||||
if (x_plus == 0 and y_plus == 0) || passable?(new_x, new_y, 0)
|
||||
@x = new_x
|
||||
@y = new_y
|
||||
@x = @x + x_plus
|
||||
@y = @y + y_plus
|
||||
real_distance = Math::sqrt(x_plus * x_plus + y_plus * y_plus)
|
||||
distance = [1, real_distance].max
|
||||
@jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping
|
||||
@@ -668,7 +721,6 @@ class Game_Character
|
||||
end
|
||||
triggerLeaveTile
|
||||
end
|
||||
end
|
||||
|
||||
def jumpForward
|
||||
case self.direction
|
||||
@@ -742,8 +794,8 @@ class Game_Character
|
||||
end
|
||||
|
||||
def turn_toward_player
|
||||
sx = @x - $game_player.x
|
||||
sy = @y - $game_player.y
|
||||
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
|
||||
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
|
||||
return if sx == 0 and sy == 0
|
||||
if sx.abs > sy.abs
|
||||
(sx > 0) ? turn_left : turn_right
|
||||
@@ -753,8 +805,8 @@ class Game_Character
|
||||
end
|
||||
|
||||
def turn_away_from_player
|
||||
sx = @x - $game_player.x
|
||||
sy = @y - $game_player.y
|
||||
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
|
||||
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
|
||||
return if sx == 0 and sy == 0
|
||||
if sx.abs > sy.abs
|
||||
(sx > 0) ? turn_right : turn_left
|
||||
|
||||
@@ -13,6 +13,10 @@ class Game_Event < Game_Character
|
||||
@id = @event.id
|
||||
@original_x = @event.x
|
||||
@original_y = @event.y
|
||||
if @event.name[/size\((\d+),(\d+)\)/i]
|
||||
@width = $~[1].to_i
|
||||
@height = $~[2].to_i
|
||||
end
|
||||
@erased = false
|
||||
@starting = false
|
||||
@need_refresh = false
|
||||
@@ -119,14 +123,16 @@ class Game_Event < Game_Character
|
||||
end
|
||||
|
||||
def onEvent?
|
||||
return @map_id == $game_map.map_id && $game_player.x == self.x && $game_player.y == self.y
|
||||
return @map_id == $game_map.map_id && at_coordinate?($game_player.x, $game_player.y)
|
||||
end
|
||||
|
||||
def over_trigger?
|
||||
return false if @character_name!="" and not @through
|
||||
return false if @character_name != "" && !@through
|
||||
return false if @event.name[/hiddenitem/i]
|
||||
return false if !self.map.passable?(@x, @y, 0, $game_player)
|
||||
return true
|
||||
each_occupied_tile do |i, j|
|
||||
return true if self.map.passable?(i, j, 0, $game_player)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbCheckEventTriggerAfterTurning
|
||||
@@ -141,15 +147,15 @@ class Game_Event < Game_Character
|
||||
|
||||
def check_event_trigger_touch(x, y)
|
||||
return if $game_system.map_interpreter.running?
|
||||
return if @trigger!=2
|
||||
return if x != $game_player.x || y != $game_player.y
|
||||
return if @trigger != 2 # Event touch
|
||||
return if !at_coordinate?($game_player.xm $game_player.y)
|
||||
return if jumping? || over_trigger?
|
||||
start
|
||||
end
|
||||
|
||||
def check_event_trigger_auto
|
||||
if @trigger == 2 # Event touch
|
||||
if @x == $game_player.x and @y == $game_player.y
|
||||
if at_coordinate?($game_player.x, $game_player.y)
|
||||
start if not jumping? and over_trigger?
|
||||
end
|
||||
elsif @trigger == 3 # Autorun
|
||||
|
||||
@@ -72,7 +72,7 @@ class Game_Player < Game_Character
|
||||
if !$PokemonTemp.encounterTriggered
|
||||
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
|
||||
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
|
||||
if passable?(@x, @y, dir)
|
||||
if can_move_in_direction?(dir)
|
||||
return if pbLedge(x_offset, y_offset)
|
||||
return if pbEndSurf(x_offset, y_offset)
|
||||
turn_generic(dir, true)
|
||||
@@ -146,21 +146,28 @@ class Game_Player < Game_Character
|
||||
return true
|
||||
end
|
||||
|
||||
def pbTerrainTag(countBridge = false)
|
||||
return $MapFactory.getTerrainTag(self.map.map_id, @x, @y, countBridge) if $MapFactory
|
||||
return $game_map.terrain_tag(@x, @y, countBridge)
|
||||
end
|
||||
|
||||
def pbFacingEvent(ignoreInterpreter=false)
|
||||
return nil if $game_system.map_interpreter.running? && !ignoreInterpreter
|
||||
# Check the tile in front of the player for events
|
||||
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
|
||||
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
|
||||
return nil if !$game_map.valid?(new_x, new_y)
|
||||
for event in $game_map.events.values
|
||||
next if event.x != new_x || event.y != new_y
|
||||
next if !event.at_coordinate?(new_x, new_y)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
return event
|
||||
end
|
||||
# If the tile in front is a counter, check one tile beyond that for events
|
||||
if $game_map.counter?(new_x, new_y)
|
||||
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
|
||||
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
|
||||
for event in $game_map.events.values
|
||||
next if event.x != new_x || event.y != new_y
|
||||
next if !event.at_coordinate?(new_x, new_y)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
return event
|
||||
end
|
||||
@@ -168,6 +175,13 @@ class Game_Player < Game_Character
|
||||
return nil
|
||||
end
|
||||
|
||||
def pbFacingTerrainTag(dir = nil)
|
||||
dir = self.direction if !dir
|
||||
return $MapFactory.getFacingTerrainTag(dir, self) if $MapFactory
|
||||
facing = pbFacingTile(dir, self)
|
||||
return $game_map.terrain_tag(facing[1], facing[2])
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Passable Determinants
|
||||
# x : x-coordinate
|
||||
@@ -175,7 +189,7 @@ class Game_Player < Game_Character
|
||||
# d : direction (0,2,4,6,8)
|
||||
# * 0 = Determines if all directions are impassable (for jumping)
|
||||
#-----------------------------------------------------------------------------
|
||||
def passable?(x, y, d)
|
||||
def passable?(x, y, d, strict = false)
|
||||
# Get new coordinates
|
||||
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
|
||||
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
|
||||
@@ -231,7 +245,8 @@ class Game_Player < Game_Character
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Same Position Starting Determinant
|
||||
# * Trigger event(s) at the same coordinates as self with the appropriate
|
||||
# trigger(s) that can be triggered
|
||||
#-----------------------------------------------------------------------------
|
||||
def check_event_trigger_here(triggers)
|
||||
result = false
|
||||
@@ -240,7 +255,7 @@ class Game_Player < Game_Character
|
||||
# All event loops
|
||||
for event in $game_map.events.values
|
||||
# If event coordinates and triggers are consistent
|
||||
next if event.x != @x || event.y != @y
|
||||
next if !event.at_coordinate?(@x, @y)
|
||||
next if !triggers.include?(event.trigger)
|
||||
# If starting determinant is same position event (other than jumping)
|
||||
next if event.jumping? || !event.over_trigger?
|
||||
@@ -264,7 +279,7 @@ class Game_Player < Game_Character
|
||||
# All event loops
|
||||
for event in $game_map.events.values
|
||||
# If event coordinates and triggers are consistent
|
||||
next if event.x != new_x || event.y != new_y
|
||||
next if !event.at_coordinate?(new_x, new_y)
|
||||
next if !triggers.include?(event.trigger)
|
||||
# If starting determinant is front event (other than jumping)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
@@ -282,7 +297,7 @@ class Game_Player < Game_Character
|
||||
# All event loops
|
||||
for event in $game_map.events.values
|
||||
# If event coordinates and triggers are consistent
|
||||
next if event.x != new_x || event.y != new_y
|
||||
next if !event.at_coordinate?(new_x, new_y)
|
||||
next if !triggers.include?(event.trigger)
|
||||
# If starting determinant is front event (other than jumping)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
@@ -304,7 +319,7 @@ class Game_Player < Game_Character
|
||||
# All event loops
|
||||
for event in $game_map.events.values
|
||||
# If event coordinates and triggers are consistent
|
||||
next if event.x != x || event.y != y
|
||||
next if !event.at_coordinate?(x, y)
|
||||
if event.name[/trainer\((\d+)\)/i]
|
||||
distance = $~[1].to_i
|
||||
next if !pbEventCanReachPlayer?(event,self,distance)
|
||||
|
||||
@@ -26,7 +26,7 @@ class Game_Player < Game_Character
|
||||
input = ($PokemonSystem.runstyle == 1) ^ Input.press?(Input::SPECIAL)
|
||||
return input && $PokemonGlobal.runningShoes && !jumping? &&
|
||||
!$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
|
||||
!$PokemonGlobal.bicycle && !pbGetTerrainTag.must_walk
|
||||
!$PokemonGlobal.bicycle && !$game_player.pbTerrainTag.must_walk
|
||||
end
|
||||
|
||||
def pbIsRunning?
|
||||
@@ -52,7 +52,7 @@ class Game_Player < Game_Character
|
||||
end
|
||||
|
||||
def update_command
|
||||
if pbGetTerrainTag.ice
|
||||
if $game_player.pbTerrainTag.ice
|
||||
self.move_speed = 4 # Sliding on ice
|
||||
elsif !moving? && !@move_route_forcing && $PokemonGlobal
|
||||
if $PokemonGlobal.bicycle
|
||||
|
||||
@@ -106,13 +106,14 @@ class Sprite_Character < RPG::Sprite
|
||||
@oldbushdepth = @character.bush_depth
|
||||
if @tile_id>=384
|
||||
@charbitmap.dispose if @charbitmap
|
||||
@charbitmap = pbGetTileBitmap(@character.map.tileset_name,@tile_id,@character_hue)
|
||||
@charbitmap = pbGetTileBitmap(@character.map.tileset_name, @tile_id,
|
||||
@character_hue, @character.width, @character.height)
|
||||
@charbitmapAnimated = false
|
||||
@bushbitmap.dispose if @bushbitmap
|
||||
@bushbitmap = nil
|
||||
@spriteoffset = false
|
||||
@cw = Game_Map::TILE_WIDTH
|
||||
@ch = Game_Map::TILE_HEIGHT
|
||||
@cw = Game_Map::TILE_WIDTH * @character.width
|
||||
@ch = Game_Map::TILE_HEIGHT * @character.height
|
||||
self.src_rect.set(0,0,@cw,@ch)
|
||||
self.ox = @cw/2
|
||||
self.oy = @ch
|
||||
|
||||
@@ -384,7 +384,7 @@ class Interpreter
|
||||
old_y = event.y
|
||||
# Apply strict version of passable, which treats tiles that are passable
|
||||
# only from certain directions as fully impassible
|
||||
return if !event.passableStrict?(event.x, event.y, $game_player.direction)
|
||||
return if !event.can_move_in_direction?($game_player.direction, true)
|
||||
case $game_player.direction
|
||||
when 2 then event.move_down
|
||||
when 4 then event.move_left
|
||||
|
||||
@@ -60,17 +60,17 @@ module RPG
|
||||
return ret2
|
||||
end
|
||||
|
||||
def self.tileEx(filename, tile_id, hue)
|
||||
key = [filename, tile_id, hue]
|
||||
def self.tileEx(filename, tile_id, hue, width = 1, height = 1)
|
||||
key = [filename, tile_id, hue, width, height]
|
||||
ret = fromCache(key)
|
||||
if ret
|
||||
ret.addRef
|
||||
else
|
||||
ret = BitmapWrapper.new(32, 32)
|
||||
ret = BitmapWrapper.new(32 * width, 32 * height)
|
||||
x = (tile_id - 384) % 8 * 32
|
||||
y = (tile_id - 384) / 8 * 32
|
||||
y = (((tile_id - 384) / 8) - height + 1) * 32
|
||||
tileset = yield(filename)
|
||||
ret.blt(0, 0, tileset, Rect.new(x, y, 32, 32))
|
||||
ret.blt(0, 0, tileset, Rect.new(x, y, 32 * width, 32 * height))
|
||||
tileset.dispose
|
||||
ret.hue_change(hue) if hue != 0
|
||||
@cache[key] = ret
|
||||
|
||||
@@ -350,8 +350,8 @@ end
|
||||
|
||||
|
||||
|
||||
def pbGetTileBitmap(filename, tile_id, hue)
|
||||
return RPG::Cache.tileEx(filename, tile_id, hue) { |f|
|
||||
def pbGetTileBitmap(filename, tile_id, hue, width = 1, height = 1)
|
||||
return RPG::Cache.tileEx(filename, tile_id, hue, width, height) { |f|
|
||||
AnimatedBitmap.new("Graphics/Tilesets/"+filename).deanimate
|
||||
}
|
||||
end
|
||||
|
||||
@@ -325,14 +325,17 @@ Events.onStepTakenFieldMovement += proc { |_sender,e|
|
||||
Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
event = e[0] # Get the event affected by field movement
|
||||
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)
|
||||
event.each_occupied_tile do |x, y|
|
||||
if $MapFactory.getTerrainTag(event.map.map_id, x, y, true).shows_grass_rustle
|
||||
$scene.spriteset.addUserAnimation(Settings::GRASS_ANIMATION_ID, x, y, true, 1)
|
||||
end
|
||||
end
|
||||
if event == $game_player
|
||||
currentTag = $game_player.pbTerrainTag
|
||||
if currentTag.waterfall_crest
|
||||
pbDescendWaterfall(event)
|
||||
pbDescendWaterfall
|
||||
elsif currentTag.ice && !$PokemonGlobal.sliding
|
||||
pbSlideOnIce(event)
|
||||
pbSlideOnIce
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -483,129 +486,84 @@ Events.onMapSceneChange += proc { |_sender, e|
|
||||
#===============================================================================
|
||||
# Event locations, terrain tags
|
||||
#===============================================================================
|
||||
def pbEventFacesPlayer?(event,player,distance)
|
||||
return false if distance<=0
|
||||
# Event can't reach player if no coordinates coincide
|
||||
return false if event.x!=player.x && event.y!=player.y
|
||||
deltaX = (event.direction==6) ? 1 : (event.direction==4) ? -1 : 0
|
||||
deltaY = (event.direction==2) ? 1 : (event.direction==8) ? -1 : 0
|
||||
# Check for existence of player
|
||||
curx = event.x
|
||||
cury = event.y
|
||||
found = false
|
||||
distance.times do
|
||||
curx += deltaX
|
||||
cury += deltaY
|
||||
if player.x==curx && player.y==cury
|
||||
found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
return found
|
||||
end
|
||||
|
||||
def pbEventCanReachPlayer?(event,player,distance)
|
||||
return false if distance<=0
|
||||
# Event can't reach player if no coordinates coincide
|
||||
return false if event.x!=player.x && event.y!=player.y
|
||||
deltaX = (event.direction==6) ? 1 : (event.direction==4) ? -1 : 0
|
||||
deltaY = (event.direction==2) ? 1 : (event.direction==8) ? -1 : 0
|
||||
# Check for existence of player
|
||||
curx = event.x
|
||||
cury = event.y
|
||||
found = false
|
||||
realdist = 0
|
||||
distance.times do
|
||||
curx += deltaX
|
||||
cury += deltaY
|
||||
if player.x==curx && player.y==cury
|
||||
found = true
|
||||
break
|
||||
end
|
||||
realdist += 1
|
||||
end
|
||||
return false if !found
|
||||
# Check passibility
|
||||
curx = event.x
|
||||
cury = event.y
|
||||
realdist.times do
|
||||
return false if !event.passable?(curx,cury,event.direction)
|
||||
curx += deltaX
|
||||
cury += deltaY
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbFacingTileRegular(direction=nil,event=nil)
|
||||
event = $game_player if !event
|
||||
return [0,0,0] if !event
|
||||
x = event.x
|
||||
y = event.y
|
||||
direction = event.direction if !direction
|
||||
case direction
|
||||
when 1
|
||||
y += 1
|
||||
x -= 1
|
||||
when 2
|
||||
y += 1
|
||||
when 3
|
||||
y += 1
|
||||
x += 1
|
||||
when 4
|
||||
x -= 1
|
||||
when 6
|
||||
x += 1
|
||||
when 7
|
||||
y -= 1
|
||||
x -= 1
|
||||
when 8
|
||||
y -= 1
|
||||
when 9
|
||||
y -= 1
|
||||
x += 1
|
||||
end
|
||||
return [$game_map.map_id,x,y]
|
||||
end
|
||||
|
||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||
def pbFacingTile(direction=nil,event=nil)
|
||||
return $MapFactory.getFacingTile(direction,event) if $MapFactory
|
||||
return pbFacingTileRegular(direction,event)
|
||||
end
|
||||
|
||||
def pbFacingEachOther(event1,event2)
|
||||
return false if !event1 || !event2
|
||||
if $MapFactory
|
||||
tile1 = $MapFactory.getFacingTile(nil,event1)
|
||||
tile2 = $MapFactory.getFacingTile(nil,event2)
|
||||
return false if !tile1 || !tile2
|
||||
return tile1[0]==event2.map.map_id &&
|
||||
tile1[1]==event2.x && tile1[2]==event2.y &&
|
||||
tile2[0]==event1.map.map_id &&
|
||||
tile2[1]==event1.x && tile2[2]==event1.y
|
||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||
def pbFacingTileRegular(direction = nil, event = nil)
|
||||
event = $game_player if !event
|
||||
return [0, 0, 0] if !event
|
||||
x = event.x
|
||||
y = event.y
|
||||
direction = event.direction if !direction
|
||||
x_offset = [0, -1, 0, 1, -1, 0, 1, -1, 0, 1][direction]
|
||||
y_offset = [0, 1, 1, 1, 0, 0, 0, -1, -1, -1][direction]
|
||||
return [$game_map.map_id, x + x_offset, y + y_offset]
|
||||
end
|
||||
|
||||
# Returns whether event is in line with the player, is facing the player and is
|
||||
# within distance tiles of the player.
|
||||
def pbEventFacesPlayer?(event, player, distance)
|
||||
return false if !event || !player || distance <= 0
|
||||
x_min = x_max = y_min = y_max = -1
|
||||
case direction
|
||||
when 2 # Down
|
||||
x_min = event.x
|
||||
x_max = event.x + event.width - 1
|
||||
y_min = event.y + 1
|
||||
y_max = event.y + distance
|
||||
when 4 # Left
|
||||
x_min = event.x - distance
|
||||
x_max = event.x - 1
|
||||
y_min = event.y - event.height + 1
|
||||
y_max = event.y
|
||||
when 6 # Right
|
||||
x_min = event.x + event.width
|
||||
x_max = event.x + event.width - 1 + distance
|
||||
y_min = event.y - event.height + 1
|
||||
y_max = event.y
|
||||
when 8 # Up
|
||||
x_min = event.x
|
||||
x_max = event.x + event.width - 1
|
||||
y_min = event.y - event.height + 1 - distance
|
||||
y_max = event.y - event.height
|
||||
else
|
||||
tile1 = pbFacingTile(nil,event1)
|
||||
tile2 = pbFacingTile(nil,event2)
|
||||
return false if !tile1 || !tile2
|
||||
return tile1[1]==event2.x && tile1[2]==event2.y &&
|
||||
tile2[1]==event1.x && tile2[2]==event1.y
|
||||
return false
|
||||
end
|
||||
return player.x >= x_min && player.x <= x_max &&
|
||||
player.y >= y_min && player.y <= y_max
|
||||
end
|
||||
|
||||
def pbGetTerrainTag(event=nil,countBridge=false)
|
||||
event = $game_player if !event
|
||||
return GameData::TerrainTag.get(:None) if !event
|
||||
if $MapFactory
|
||||
return $MapFactory.getTerrainTag(event.map.map_id,event.x,event.y,countBridge)
|
||||
# Returns whether event is able to walk up to the player.
|
||||
def pbEventCanReachPlayer?(event, player, distance)
|
||||
return false if !pbEventFacesPlayer?(event, player, distance)
|
||||
delta_x = (event.direction == 6) ? 1 : (event.direction == 4) ? -1 : 0
|
||||
delta_y = (event.direction == 2) ? 1 : (event.direction == 8) ? -1 : 0
|
||||
case event.direction
|
||||
when 2 # Down
|
||||
real_distance = player.y - event.y - 1
|
||||
when 4 # Left
|
||||
real_distance = event.x - player.x + 1
|
||||
when 6 # Right
|
||||
real_distance = player.x - event.x - event.width
|
||||
when 8 # Up
|
||||
real_distance = event.y - event.height - player.y
|
||||
end
|
||||
return $game_map.terrain_tag(event.x,event.y,countBridge)
|
||||
if real_distance > 0
|
||||
real_distance.times do |i|
|
||||
return false if !event.can_move_from_coordinate?(event.x + i * delta_x, event.y + i * delta_y, event.direction)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbFacingTerrainTag(event=nil,dir=nil)
|
||||
return $MapFactory.getFacingTerrainTag(dir,event) if $MapFactory
|
||||
event = $game_player if !event
|
||||
return GameData::TerrainTag.get(:None) if !event
|
||||
facing = pbFacingTile(dir,event)
|
||||
return $game_map.terrain_tag(facing[1],facing[2])
|
||||
# Returns whether the two events are standing next to each other and facing each
|
||||
# other.
|
||||
def pbFacingEachOther(event1, event2)
|
||||
return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1)
|
||||
end
|
||||
|
||||
|
||||
@@ -754,7 +712,7 @@ end
|
||||
# Player/event movement in the field
|
||||
#===============================================================================
|
||||
def pbLedge(_xOffset,_yOffset)
|
||||
if pbFacingTerrainTag.ledge
|
||||
if $game_player.pbFacingTerrainTag.ledge
|
||||
if pbJumpToward(2,true)
|
||||
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)
|
||||
$game_player.increase_steps
|
||||
@@ -765,33 +723,32 @@ def pbLedge(_xOffset,_yOffset)
|
||||
return false
|
||||
end
|
||||
|
||||
def pbSlideOnIce(event=nil)
|
||||
event = $game_player if !event
|
||||
return if !event
|
||||
return if !pbGetTerrainTag(event).ice
|
||||
def pbSlideOnIce
|
||||
return if !$game_player.pbTerrainTag.ice
|
||||
$PokemonGlobal.sliding = true
|
||||
direction = event.direction
|
||||
oldwalkanime = event.walk_anime
|
||||
event.straighten
|
||||
event.walk_anime = false
|
||||
direction = $game_player.direction
|
||||
oldwalkanime = $game_player.walk_anime
|
||||
$game_player.straighten
|
||||
$game_player.walk_anime = false
|
||||
loop do
|
||||
break if !event.passable?(event.x,event.y,direction)
|
||||
break if !pbGetTerrainTag(event).ice
|
||||
event.move_forward
|
||||
while event.moving?
|
||||
break if !$game_player.can_move_in_direction?(direction)
|
||||
break if !$game_player.pbTerrainTag.ice
|
||||
$game_player.move_forward
|
||||
while $game_player.moving?
|
||||
pbUpdateSceneMap
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
end
|
||||
event.center(event.x,event.y)
|
||||
event.straighten
|
||||
event.walk_anime = oldwalkanime
|
||||
$game_player.center($game_player.x, $game_player.y)
|
||||
$game_player.straighten
|
||||
$game_player.walk_anime = oldwalkanime
|
||||
$PokemonGlobal.sliding = false
|
||||
end
|
||||
|
||||
def pbTurnTowardEvent(event,otherEvent)
|
||||
sx = 0; sy = 0
|
||||
sx = 0
|
||||
sy = 0
|
||||
if $MapFactory
|
||||
relativePos = $MapFactory.getThisAndOtherEventRelativePos(otherEvent,event)
|
||||
sx = relativePos[0]
|
||||
@@ -800,6 +757,8 @@ def pbTurnTowardEvent(event,otherEvent)
|
||||
sx = event.x - otherEvent.x
|
||||
sy = event.y - otherEvent.y
|
||||
end
|
||||
sx += (event.width - otherEvent.width) / 2.0
|
||||
sy -= (event.height - otherEvent.height) / 2.0
|
||||
return if sx == 0 and sy == 0
|
||||
if sx.abs > sy.abs
|
||||
(sx > 0) ? event.turn_left : event.turn_right
|
||||
@@ -809,13 +768,13 @@ def pbTurnTowardEvent(event,otherEvent)
|
||||
end
|
||||
|
||||
def pbMoveTowardPlayer(event)
|
||||
maxsize = [$game_map.width,$game_map.height].max
|
||||
return if !pbEventCanReachPlayer?(event,$game_player,maxsize)
|
||||
maxsize = [$game_map.width, $game_map.height].max
|
||||
return if !pbEventCanReachPlayer?(event, $game_player, maxsize)
|
||||
loop do
|
||||
x = event.x
|
||||
y = event.y
|
||||
event.move_toward_player
|
||||
break if event.x==x && event.y==y
|
||||
break if event.x == x && event.y == y
|
||||
while event.moving?
|
||||
Graphics.update
|
||||
Input.update
|
||||
|
||||
@@ -170,7 +170,7 @@ def pbGetEnvironment
|
||||
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
ret = map_metadata.battle_environment if map_metadata && map_metadata.battle_environment
|
||||
if GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
|
||||
terrainTag = pbFacingTerrainTag
|
||||
terrainTag = $game_player.pbFacingTerrainTag
|
||||
else
|
||||
terrainTag = $game_player.terrain_tag
|
||||
end
|
||||
|
||||
@@ -203,7 +203,7 @@ class PokemonEncounters
|
||||
return false if pbInSafari?
|
||||
return true if $PokemonGlobal.partner
|
||||
return false if $Trainer.able_pokemon_count <= 1
|
||||
return true if pbGetTerrainTag.double_wild_encounters && rand(100) < 30
|
||||
return true if $game_player.pbTerrainTag.double_wild_encounters && rand(100) < 30
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ end
|
||||
HiddenMoveHandlers::CanUseMove.add(:CUT,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT,showmsg)
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if !facingEvent || facingEvent.name.downcase!="tree"
|
||||
if !facingEvent || !facingEvent.name[/tree/i]
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -225,8 +225,8 @@ HiddenMoveHandlers::UseMove.add(:CUT,proc { |move,pokemon|
|
||||
|
||||
def pbSmashEvent(event)
|
||||
return if !event
|
||||
if event.name.downcase=="tree"; pbSEPlay("Cut",80)
|
||||
elsif event.name.downcase=="rock"; pbSEPlay("Rock Smash",80)
|
||||
if event.name[/tree/i]; pbSEPlay("Cut",80)
|
||||
elsif event.name[/rock/i]; pbSEPlay("Rock Smash",80)
|
||||
end
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::Wait,2,
|
||||
@@ -294,6 +294,7 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
|
||||
# Dive
|
||||
#===============================================================================
|
||||
def pbDive
|
||||
return false if $game_player.pbFacingEvent
|
||||
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
return false if !map_metadata || !map_metadata.dive_map_id
|
||||
move = :DIVE
|
||||
@@ -325,6 +326,7 @@ end
|
||||
|
||||
def pbSurfacing
|
||||
return if !$PokemonGlobal.diving
|
||||
return false if $game_player.pbFacingEvent
|
||||
surface_map_id = nil
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
|
||||
@@ -571,7 +573,7 @@ end
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:HEADBUTT,proc { |move,pkmn,showmsg|
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if !facingEvent || facingEvent.name.downcase!="headbutttree"
|
||||
if !facingEvent || !facingEvent.name[/headbutttree/i]
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -616,7 +618,7 @@ end
|
||||
HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_ROCKSMASH,showmsg)
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if !facingEvent || facingEvent.name.downcase!="rock"
|
||||
if !facingEvent || !facingEvent.name[/rock/i]
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -665,7 +667,7 @@ end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
pbStrength if facingEvent && facingEvent.name.downcase=="boulder"
|
||||
pbStrength if facingEvent && facingEvent.name[/boulder/i]
|
||||
}
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc { |move,pkmn,showmsg|
|
||||
@@ -727,7 +729,7 @@ def pbEndSurf(_xOffset,_yOffset)
|
||||
return false if !$PokemonGlobal.surfing
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
if $game_map.terrain_tag(x,y).can_surf && !pbFacingTerrainTag.can_surf
|
||||
if $game_map.terrain_tag(x,y).can_surf && !$game_player.pbFacingTerrainTag.can_surf
|
||||
$PokemonTemp.surfJump = [x,y]
|
||||
if pbJumpToward(1,false,true)
|
||||
$game_map.autoplayAsCue
|
||||
@@ -757,7 +759,7 @@ Events.onAction += proc { |_sender,_e|
|
||||
next if $PokemonGlobal.surfing
|
||||
next if GameData::MapMetadata.exists?($game_map.map_id) &&
|
||||
GameData::MapMetadata.get($game_map.map_id).always_bicycle
|
||||
next if !pbFacingTerrainTag.can_surf_freely
|
||||
next if !$game_player.pbFacingTerrainTag.can_surf_freely
|
||||
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
pbSurf
|
||||
}
|
||||
@@ -777,7 +779,7 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
|
||||
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
|
||||
next false
|
||||
end
|
||||
if !pbFacingTerrainTag.can_surf_freely ||
|
||||
if !$game_player.pbFacingTerrainTag.can_surf_freely ||
|
||||
!$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
pbMessage(_INTL("No surfing here!")) if showmsg
|
||||
next false
|
||||
@@ -905,42 +907,38 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
|
||||
#===============================================================================
|
||||
# Waterfall
|
||||
#===============================================================================
|
||||
def pbAscendWaterfall(event=nil)
|
||||
event = $game_player if !event
|
||||
return if !event
|
||||
return if event.direction!=8 # can't ascend if not facing up
|
||||
oldthrough = event.through
|
||||
oldmovespeed = event.move_speed
|
||||
terrain = pbFacingTerrainTag
|
||||
def pbAscendWaterfall
|
||||
return if $game_player.direction != 8 # Can't ascend if not facing up
|
||||
terrain = $game_player.pbFacingTerrainTag
|
||||
return if !terrain.waterfall && !terrain.waterfall_crest
|
||||
event.through = true
|
||||
event.move_speed = 2
|
||||
oldthrough = $game_player.through
|
||||
oldmovespeed = $game_player.move_speed
|
||||
$game_player.through = true
|
||||
$game_player.move_speed = 2
|
||||
loop do
|
||||
event.move_up
|
||||
terrain = pbGetTerrainTag(event)
|
||||
$game_player.move_up
|
||||
terrain = $game_player.pbTerrainTag
|
||||
break if !terrain.waterfall && !terrain.waterfall_crest
|
||||
end
|
||||
event.through = oldthrough
|
||||
event.move_speed = oldmovespeed
|
||||
$game_player.through = oldthrough
|
||||
$game_player.move_speed = oldmovespeed
|
||||
end
|
||||
|
||||
def pbDescendWaterfall(event=nil)
|
||||
event = $game_player if !event
|
||||
return if !event
|
||||
return if event.direction!=2 # Can't descend if not facing down
|
||||
oldthrough = event.through
|
||||
oldmovespeed = event.move_speed
|
||||
terrain = pbFacingTerrainTag
|
||||
def pbDescendWaterfall
|
||||
return if $game_player.direction != 2 # Can't descend if not facing down
|
||||
terrain = $game_player.pbFacingTerrainTag
|
||||
return if !terrain.waterfall && !terrain.waterfall_crest
|
||||
event.through = true
|
||||
event.move_speed = 2
|
||||
oldthrough = $game_player.through
|
||||
oldmovespeed = $game_player.move_speed
|
||||
$game_player.through = true
|
||||
$game_player.move_speed = 2
|
||||
loop do
|
||||
event.move_down
|
||||
terrain = pbGetTerrainTag(event)
|
||||
$game_player.move_down
|
||||
terrain = $game_player.pbTerrainTag
|
||||
break if !terrain.waterfall && !terrain.waterfall_crest
|
||||
end
|
||||
event.through = oldthrough
|
||||
event.move_speed = oldmovespeed
|
||||
$game_player.through = oldthrough
|
||||
$game_player.move_speed = oldmovespeed
|
||||
end
|
||||
|
||||
def pbWaterfall
|
||||
@@ -961,7 +959,7 @@ def pbWaterfall
|
||||
end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
terrain = pbFacingTerrainTag
|
||||
terrain = $game_player.pbFacingTerrainTag
|
||||
if terrain.waterfall
|
||||
pbWaterfall
|
||||
elsif terrain.waterfall_crest
|
||||
@@ -971,7 +969,7 @@ Events.onAction += proc { |_sender,_e|
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL,showmsg)
|
||||
if !pbFacingTerrainTag.waterfall
|
||||
if !$game_player.pbFacingTerrainTag.waterfall
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
|
||||
@@ -203,6 +203,7 @@ class DependentEvents
|
||||
facingDirection=10-d
|
||||
if !leaderIsTrueLeader && areConnected
|
||||
relativePos=$MapFactory.getThisAndOtherEventRelativePos(leader,follower)
|
||||
# Assumes leader and follower are both 1x1 tile in size
|
||||
if (relativePos[1]==0 && relativePos[0]==2) # 2 spaces to the right of leader
|
||||
facingDirection=6
|
||||
elsif (relativePos[1]==0 && relativePos[0]==-2) # 2 spaces to the left of leader
|
||||
@@ -227,6 +228,7 @@ class DependentEvents
|
||||
for i in 0...facings.length
|
||||
facing=facings[i]
|
||||
tile=$MapFactory.getFacingTile(facing,leader)
|
||||
# Assumes leader is 1x1 tile in size
|
||||
passable=tile && $MapFactory.isPassableStrict?(tile[0],tile[1],tile[2],follower)
|
||||
if i==0 && !passable && tile &&
|
||||
$MapFactory.getTerrainTag(tile[0],tile[1],tile[2]).ledge
|
||||
@@ -238,6 +240,7 @@ class DependentEvents
|
||||
if passable
|
||||
relativePos=$MapFactory.getThisAndOtherPosRelativePos(
|
||||
follower,tile[0],tile[1],tile[2])
|
||||
# Assumes follower is 1x1 tile in size
|
||||
distance=Math.sqrt(relativePos[0]*relativePos[0]+relativePos[1]*relativePos[1])
|
||||
if bestRelativePos==-1 || bestRelativePos>distance
|
||||
bestRelativePos=distance
|
||||
@@ -251,6 +254,7 @@ class DependentEvents
|
||||
follower.through=oldthrough
|
||||
else
|
||||
tile=$MapFactory.getFacingTile(facings[0],leader)
|
||||
# Assumes leader is 1x1 tile in size
|
||||
passable=tile && $MapFactory.isPassableStrict?(tile[0],tile[1],tile[2],follower)
|
||||
mapTile=passable ? mapTile : nil
|
||||
end
|
||||
@@ -399,9 +403,10 @@ class DependentEvents
|
||||
!pbMapInterpreterRunning?
|
||||
# Get position of tile facing the player
|
||||
facingTile=$MapFactory.getFacingTile()
|
||||
# Assumes player is 1x1 tile in size
|
||||
self.eachEvent { |e,d|
|
||||
next if !d[9]
|
||||
if e.x==$game_player.x && e.y==$game_player.y
|
||||
if e.at_coordinate?($game_player.x, $game_player.y)
|
||||
# On same position
|
||||
if not e.jumping? && (!e.respond_to?("over_trigger") || e.over_trigger?)
|
||||
if e.list.size>1
|
||||
@@ -412,7 +417,7 @@ class DependentEvents
|
||||
end
|
||||
end
|
||||
elsif facingTile && e.map.map_id==facingTile[0] &&
|
||||
e.x==facingTile[1] && e.y==facingTile[2]
|
||||
e.at_coordinate?(facingTile[1], facingTile[2])
|
||||
# On facing tile
|
||||
if not e.jumping? && (!e.respond_to?("over_trigger") || !e.over_trigger?)
|
||||
if e.list.size>1
|
||||
|
||||
@@ -336,7 +336,7 @@ end
|
||||
#===============================================================================
|
||||
def pbBikeCheck
|
||||
if $PokemonGlobal.surfing || $PokemonGlobal.diving ||
|
||||
(!$PokemonGlobal.bicycle && pbGetTerrainTag.must_walk)
|
||||
(!$PokemonGlobal.bicycle && $game_player.pbTerrainTag.must_walk)
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
return false
|
||||
end
|
||||
@@ -360,7 +360,7 @@ def pbBikeCheck
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Find the closest hidden item (for Iremfinder)
|
||||
# Find the closest hidden item (for Itemfinder)
|
||||
#===============================================================================
|
||||
def pbClosestHiddenItem
|
||||
result = []
|
||||
|
||||
@@ -42,7 +42,7 @@ ItemHandlers::UseFromBag.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
|
||||
|
||||
ItemHandlers::UseFromBag.add(:OLDROD,proc { |item|
|
||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
next 2 if pbFacingTerrainTag.can_fish && ($PokemonGlobal.surfing || notCliff)
|
||||
next 2 if $game_player.pbFacingTerrainTag.can_fish && ($PokemonGlobal.surfing || notCliff)
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
next 0
|
||||
})
|
||||
@@ -231,7 +231,7 @@ ItemHandlers::UseInField.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
|
||||
|
||||
ItemHandlers::UseInField.add(:OLDROD,proc { |item|
|
||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||
if !$game_player.pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
next 0
|
||||
end
|
||||
@@ -244,7 +244,7 @@ ItemHandlers::UseInField.add(:OLDROD,proc { |item|
|
||||
|
||||
ItemHandlers::UseInField.add(:GOODROD,proc { |item|
|
||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||
if !$game_player.pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
next 0
|
||||
end
|
||||
@@ -257,7 +257,7 @@ ItemHandlers::UseInField.add(:GOODROD,proc { |item|
|
||||
|
||||
ItemHandlers::UseInField.add(:SUPERROD,proc { |item|
|
||||
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||
if !$game_player.pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
next 0
|
||||
end
|
||||
|
||||
@@ -60,11 +60,9 @@ class PokemonPauseMenu_Scene
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
if Input.trigger?(Input::BACK)
|
||||
pbPlayCloseMenuSE
|
||||
ret = -1
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
ret = cmdwindow.index
|
||||
$PokemonTemp.menuLastChoice = ret
|
||||
break
|
||||
@@ -148,6 +146,7 @@ class PokemonPauseMenu
|
||||
loop do
|
||||
command = @scene.pbShowCommands(commands)
|
||||
if cmdPokedex>=0 && command==cmdPokedex
|
||||
pbPlayDecisionSE
|
||||
if Settings::USE_CURRENT_REGION_DEX
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
@@ -175,6 +174,7 @@ class PokemonPauseMenu
|
||||
end
|
||||
end
|
||||
elsif cmdPokemon>=0 && command==cmdPokemon
|
||||
pbPlayDecisionSE
|
||||
hiddenmove = nil
|
||||
pbFadeOutIn {
|
||||
sscene = PokemonParty_Scene.new
|
||||
@@ -188,6 +188,7 @@ class PokemonPauseMenu
|
||||
return
|
||||
end
|
||||
elsif cmdBag>=0 && command==cmdBag
|
||||
pbPlayDecisionSE
|
||||
item = nil
|
||||
pbFadeOutIn {
|
||||
scene = PokemonBag_Scene.new
|
||||
@@ -201,6 +202,7 @@ class PokemonPauseMenu
|
||||
return
|
||||
end
|
||||
elsif cmdPokegear>=0 && command==cmdPokegear
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokegear_Scene.new
|
||||
screen = PokemonPokegearScreen.new(scene)
|
||||
@@ -208,6 +210,7 @@ class PokemonPauseMenu
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdTrainer>=0 && command==cmdTrainer
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonTrainerCard_Scene.new
|
||||
screen = PokemonTrainerCardScreen.new(scene)
|
||||
@@ -246,6 +249,7 @@ class PokemonPauseMenu
|
||||
pbShowMenu
|
||||
end
|
||||
elsif cmdOption>=0 && command==cmdOption
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonOption_Scene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
@@ -254,6 +258,7 @@ class PokemonPauseMenu
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdDebug>=0 && command==cmdDebug
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
pbDebugMenu
|
||||
@scene.pbRefresh
|
||||
@@ -273,6 +278,7 @@ class PokemonPauseMenu
|
||||
pbShowMenu
|
||||
end
|
||||
else
|
||||
pbPlayCloseMenuSE
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,8 +21,8 @@ def pbWarpToMap
|
||||
next if !map.passableStrict?(x,y,0,$game_player)
|
||||
blocked = false
|
||||
for event in map.events.values
|
||||
if event.x==x && event.y==y && !event.through
|
||||
blocked = true if self!=$game_player || event.character_name!=""
|
||||
if event.at_coordinate?(x, y) && !event.through
|
||||
blocked = true if event.character_name != ""
|
||||
end
|
||||
end
|
||||
next if blocked
|
||||
|
||||
@@ -1092,7 +1092,7 @@ module Compiler
|
||||
)
|
||||
changed = true
|
||||
end
|
||||
if deletedRoute
|
||||
if false # deletedRoute
|
||||
insertMoveRouteAt.call(list,list.length-1,deletedRoute)
|
||||
changed = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user