side stairs + wonderguard

This commit is contained in:
infinitefusion
2021-10-09 18:46:55 -04:00
parent 5f9e03726c
commit cd2e3cd04c
10 changed files with 457 additions and 261 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,90 +1,90 @@
class Game_Character class Game_Character
attr_reader :id attr_reader :id
attr_reader :original_x attr_reader :original_x
attr_reader :original_y attr_reader :original_y
attr_reader :x attr_reader :x
attr_reader :y attr_reader :y
attr_reader :real_x attr_reader :real_x
attr_reader :real_y attr_reader :real_y
attr_accessor :width attr_accessor :width
attr_accessor :height attr_accessor :height
attr_accessor :sprite_size attr_accessor :sprite_size
attr_reader :tile_id attr_reader :tile_id
attr_accessor :character_name attr_accessor :character_name
attr_accessor :character_hue attr_accessor :character_hue
attr_reader :opacity attr_reader :opacity
attr_reader :blend_type attr_reader :blend_type
attr_accessor :direction attr_accessor :direction
attr_accessor :pattern attr_accessor :pattern
attr_accessor :pattern_surf attr_accessor :pattern_surf
attr_accessor :lock_pattern attr_accessor :lock_pattern
attr_reader :move_route_forcing attr_reader :move_route_forcing
attr_accessor :through attr_accessor :through
attr_accessor :animation_id attr_accessor :animation_id
attr_accessor :transparent attr_accessor :transparent
attr_reader :move_speed attr_reader :move_speed
attr_accessor :walk_anime attr_accessor :walk_anime
attr_writer :bob_height attr_writer :bob_height
def initialize(map=nil) def initialize(map = nil)
@map = map @map = map
@id = 0 @id = 0
@original_x = 0 @original_x = 0
@original_y = 0 @original_y = 0
@x = 0 @x = 0
@y = 0 @y = 0
@real_x = 0 @real_x = 0
@real_y = 0 @real_y = 0
@width = 1 @width = 1
@height = 1 @height = 1
@sprite_size = [Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT] @sprite_size = [Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT]
@tile_id = 0 @tile_id = 0
@character_name = "" @character_name = ""
@character_hue = 0 @character_hue = 0
@opacity = 255 @opacity = 255
@blend_type = 0 @blend_type = 0
@direction = 2 @direction = 2
@pattern = 0 @pattern = 0
@pattern_surf = 0 @pattern_surf = 0
@lock_pattern = false @lock_pattern = false
@move_route_forcing = false @move_route_forcing = false
@through = false @through = false
@animation_id = 0 @animation_id = 0
@transparent = false @transparent = false
@original_direction = 2 @original_direction = 2
@original_pattern = 0 @original_pattern = 0
@move_type = 0 @move_type = 0
self.move_speed = 3 self.move_speed = 3
self.move_frequency = 6 self.move_frequency = 6
@move_route = nil @move_route = nil
@move_route_index = 0 @move_route_index = 0
@original_move_route = nil @original_move_route = nil
@original_move_route_index = 0 @original_move_route_index = 0
@walk_anime = true # Whether character should animate while moving @walk_anime = true # Whether character should animate while moving
@step_anime = false # Whether character should animate while still @step_anime = false # Whether character should animate while still
@direction_fix = false @direction_fix = false
@always_on_top = false @always_on_top = false
@anime_count = 0 @anime_count = 0
@stop_count = 0 @stop_count = 0
@jump_peak = 0 # Max height while jumping @jump_peak = 0 # Max height while jumping
@jump_distance = 0 # Total distance of jump @jump_distance = 0 # Total distance of jump
@jump_distance_left = 0 # Distance left to travel @jump_distance_left = 0 # Distance left to travel
@jump_count = 0 # Frames left in a stationary jump @jump_count = 0 # Frames left in a stationary jump
@bob_height = 0 @bob_height = 0
@wait_count = 0 @wait_count = 0
@moved_this_frame = false @moved_this_frame = false
@locked = false @locked = false
@prelock_direction = 0 @prelock_direction = 0
end end
def at_coordinate?(check_x, check_y) def at_coordinate?(check_x, check_y)
return check_x >= @x && check_x < @x + @width && return check_x >= @x && check_x < @x + @width &&
check_y > @y - @height && check_y <= @y check_y > @y - @height && check_y <= @y
end end
def in_line_with_coordinate?(check_x, check_y) def in_line_with_coordinate?(check_x, check_y)
return (check_x >= @x && check_x < @x + @width) || return (check_x >= @x && check_x < @x + @width) ||
(check_y > @y - @height && check_y <= @y) (check_y > @y - @height && check_y <= @y)
end end
def each_occupied_tile def each_occupied_tile
@@ -96,7 +96,7 @@ class Game_Character
end end
def move_speed=(val) def move_speed=(val)
return if val==@move_speed return if val == @move_speed
@move_speed = val @move_speed = val
# @move_speed_real is the number of quarter-pixels to move each frame. There # @move_speed_real is the number of quarter-pixels to move each frame. There
# are 128 quarter-pixels per tile. By default, it is calculated from # are 128 quarter-pixels per tile. By default, it is calculated from
@@ -120,7 +120,7 @@ class Game_Character
end end
def jump_speed_real def jump_speed_real
self.jump_speed_real = (2 ** (3 + 1)) * 0.8 if !@jump_speed_real # 3 is walking speed self.jump_speed_real = (2 ** (3 + 1)) * 0.8 if !@jump_speed_real # 3 is walking speed
return @jump_speed_real return @jump_speed_real
end end
@@ -129,7 +129,7 @@ class Game_Character
end end
def move_frequency=(val) def move_frequency=(val)
return if val==@move_frequency return if val == @move_frequency
@move_frequency = val @move_frequency = val
# @move_frequency_real is the number of frames to wait between each action # @move_frequency_real is the number of frames to wait between each action
# in a move route (not forced). Specifically, this is the number of frames # in a move route (not forced). Specifically, this is the number of frames
@@ -161,13 +161,13 @@ class Game_Character
def lock def lock
return if @locked return if @locked
@prelock_direction = 0 # Was @direction but disabled @prelock_direction = 0 # Was @direction but disabled
turn_toward_player turn_toward_player
@locked = true @locked = true
end end
def minilock def minilock
@prelock_direction = 0 # Was @direction but disabled @prelock_direction = 0 # Was @direction but disabled
@locked = true @locked = true
end end
@@ -193,7 +193,7 @@ class Game_Character
end end
def cancelMoveRoute() def cancelMoveRoute()
@move_route=nil @move_route = nil
@move_route_forcing = false @move_route_forcing = false
end end
@@ -246,19 +246,19 @@ class Game_Character
def can_move_from_coordinate?(start_x, start_y, dir, strict = false) def can_move_from_coordinate?(start_x, start_y, dir, strict = false)
case dir case dir
when 2, 8 # Down, up when 2, 8 # Down, up
y_diff = (dir == 8) ? @height - 1 : 0 y_diff = (dir == 8) ? @height - 1 : 0
for i in start_x...(start_x + @width) for i in start_x...(start_x + @width)
return false if !passable?(i, start_y - y_diff, dir, strict) return false if !passable?(i, start_y - y_diff, dir, strict)
end end
return true return true
when 4, 6 # Left, right when 4, 6 # Left, right
x_diff = (dir == 6) ? @width - 1 : 0 x_diff = (dir == 6) ? @width - 1 : 0
for i in (start_y - @height + 1)..start_y for i in (start_y - @height + 1)..start_y
return false if !passable?(start_x + x_diff, i, dir, strict) return false if !passable?(start_x + x_diff, i, dir, strict)
end end
return true return true
when 1, 3 # Down diagonals when 1, 3 # Down diagonals
# Treated as moving down first and then horizontally, because that # Treated as moving down first and then horizontally, because that
# describes which tiles the character's feet touch # describes which tiles the character's feet touch
for i in start_x...(start_x + @width) for i in start_x...(start_x + @width)
@@ -269,7 +269,7 @@ class Game_Character
return false if !passable?(start_x + x_diff, i + 1, dir + 3, strict) return false if !passable?(start_x + x_diff, i + 1, dir + 3, strict)
end end
return true return true
when 7, 9 # Up diagonals when 7, 9 # Up diagonals
# Treated as moving horizontally first and then up, because that describes # Treated as moving horizontally first and then up, because that describes
# which tiles the character's feet touch # which tiles the character's feet touch
x_diff = (dir == 9) ? @width - 1 : 0 x_diff = (dir == 9) ? @width - 1 : 0
@@ -308,11 +308,11 @@ class Game_Character
ret = screen_y_ground ret = screen_y_ground
if jumping? if jumping?
if @jump_count > 0 if @jump_count > 0
jump_fraction = ((@jump_count * jump_speed_real / Game_Map::REAL_RES_X) - 0.5).abs # 0.5 to 0 to 0.5 jump_fraction = ((@jump_count * jump_speed_real / Game_Map::REAL_RES_X) - 0.5).abs # 0.5 to 0 to 0.5
else else
jump_fraction = ((@jump_distance_left / @jump_distance) - 0.5).abs # 0.5 to 0 to 0.5 jump_fraction = ((@jump_distance_left / @jump_distance) - 0.5).abs # 0.5 to 0 to 0.5
end end
ret += @jump_peak * (4 * jump_fraction**2 - 1) ret += @jump_peak * (4 * jump_fraction ** 2 - 1)
end end
return ret return ret
end end
@@ -337,7 +337,7 @@ class Game_Character
#============================================================================= #=============================================================================
def moving? def moving?
return @real_x != @x * Game_Map::REAL_RES_X || return @real_x != @x * Game_Map::REAL_RES_X ||
@real_y != @y * Game_Map::REAL_RES_Y @real_y != @y * Game_Map::REAL_RES_Y
end end
def jumping? def jumping?
@@ -352,14 +352,14 @@ class Game_Character
def force_move_route(move_route) def force_move_route(move_route)
if @original_move_route == nil if @original_move_route == nil
@original_move_route = @move_route @original_move_route = @move_route
@original_move_route_index = @move_route_index @original_move_route_index = @move_route_index
end end
@move_route = move_route @move_route = move_route
@move_route_index = 0 @move_route_index = 0
@move_route_forcing = true @move_route_forcing = true
@prelock_direction = 0 @prelock_direction = 0
@wait_count = 0 @wait_count = 0
move_type_custom move_type_custom
end end
@@ -375,8 +375,8 @@ class Game_Character
def triggerLeaveTile def triggerLeaveTile
if @oldX && @oldY && @oldMap && if @oldX && @oldY && @oldMap &&
(@oldX!=self.x || @oldY!=self.y || @oldMap!=self.map.map_id) (@oldX != self.x || @oldY != self.y || @oldMap != self.map.map_id)
Events.onLeaveTile.trigger(self,self,@oldMap,@oldX,@oldY) Events.onLeaveTile.trigger(self, self, @oldMap, @oldX, @oldY)
end end
@oldX = self.x @oldX = self.x
@oldY = self.y @oldY = self.y
@@ -393,9 +393,12 @@ class Game_Character
#============================================================================= #=============================================================================
def move_type_random def move_type_random
case rand(6) case rand(6)
when 0..3 then move_random when 0..3 then
when 4 then move_forward move_random
when 5 then @stop_count = 0 when 4 then
move_forward
when 5 then
@stop_count = 0
end end
end end
@@ -407,9 +410,12 @@ class Game_Character
return return
end end
case rand(6) case rand(6)
when 0..3 then move_toward_player when 0..3 then
when 4 then move_random move_toward_player
when 5 then move_forward when 4 then
move_random
when 5 then
move_forward
end end
end end
@@ -423,7 +429,7 @@ class Game_Character
else else
if @move_route_forcing if @move_route_forcing
@move_route_forcing = false @move_route_forcing = false
@move_route = @original_move_route @move_route = @original_move_route
@move_route_index = @original_move_route_index @move_route_index = @original_move_route_index
@original_move_route = nil @original_move_route = nil
end end
@@ -433,42 +439,67 @@ class Game_Character
end end
if command.code <= 14 if command.code <= 14
case command.code case command.code
when 1 then move_down when 1 then
when 2 then move_left move_down
when 3 then move_right when 2 then
when 4 then move_up move_left
when 5 then move_lower_left when 3 then
when 6 then move_lower_right move_right
when 7 then move_upper_left when 4 then
when 8 then move_upper_right move_up
when 9 then move_random when 5 then
when 10 then move_toward_player move_lower_left
when 11 then move_away_from_player when 6 then
when 12 then move_forward move_lower_right
when 13 then move_backward when 7 then
when 14 then jump(command.parameters[0], command.parameters[1]) move_upper_left
when 8 then
move_upper_right
when 9 then
move_random
when 10 then
move_toward_player
when 11 then
move_away_from_player
when 12 then
move_forward
when 13 then
move_backward
when 14 then
jump(command.parameters[0], command.parameters[1])
end end
@move_route_index += 1 if @move_route.skippable || moving? || jumping? @move_route_index += 1 if @move_route.skippable || moving? || jumping?
return return
end end
if command.code == 15 # Wait if command.code == 15 # Wait
@wait_count = (command.parameters[0] * Graphics.frame_rate / 20) - 1 @wait_count = (command.parameters[0] * Graphics.frame_rate / 20) - 1
@move_route_index += 1 @move_route_index += 1
return return
end end
if command.code >= 16 && command.code <= 26 if command.code >= 16 && command.code <= 26
case command.code case command.code
when 16 then turn_down when 16 then
when 17 then turn_left turn_down
when 18 then turn_right when 17 then
when 19 then turn_up turn_left
when 20 then turn_right_90 when 18 then
when 21 then turn_left_90 turn_right
when 22 then turn_180 when 19 then
when 23 then turn_right_or_left_90 turn_up
when 24 then turn_random when 20 then
when 25 then turn_toward_player turn_right_90
when 26 then turn_away_from_player when 21 then
turn_left_90
when 22 then
turn_180
when 23 then
turn_right_or_left_90
when 24 then
turn_random
when 25 then
turn_toward_player
when 26 then
turn_away_from_player
end end
@move_route_index += 1 @move_route_index += 1
return return
@@ -481,16 +512,26 @@ class Game_Character
when 28 when 28
$game_switches[command.parameters[0]] = false $game_switches[command.parameters[0]] = false
self.map.need_refresh = true self.map.need_refresh = true
when 29 then self.move_speed = command.parameters[0] when 29 then
when 30 then self.move_frequency = command.parameters[0] self.move_speed = command.parameters[0]
when 31 then @walk_anime = true when 30 then
when 32 then @walk_anime = false self.move_frequency = command.parameters[0]
when 33 then @step_anime = true when 31 then
when 34 then @step_anime = false @walk_anime = true
when 35 then @direction_fix = true when 32 then
when 36 then @direction_fix = false @walk_anime = false
when 37 then @through = true when 33 then
when 38 then @through = false @step_anime = true
when 34 then
@step_anime = false
when 35 then
@direction_fix = true
when 36 then
@direction_fix = false
when 37 then
@through = true
when 38 then
@through = false
when 39 when 39
old_always_on_top = @always_on_top old_always_on_top = @always_on_top
@always_on_top = true @always_on_top = true
@@ -514,10 +555,14 @@ class Game_Character
@original_pattern = @pattern @original_pattern = @pattern
end end
calculate_bush_depth if @tile_id != old_tile_id calculate_bush_depth if @tile_id != old_tile_id
when 42 then @opacity = command.parameters[0] when 42 then
when 43 then @blend_type = command.parameters[0] @opacity = command.parameters[0]
when 44 then pbSEPlay(command.parameters[0]) when 43 then
when 45 then eval(command.parameters[0]) @blend_type = command.parameters[0]
when 44 then
pbSEPlay(command.parameters[0])
when 45 then
eval(command.parameters[0])
end end
@move_route_index += 1 @move_route_index += 1
end end
@@ -552,114 +597,210 @@ class Game_Character
move_generic(8, turn_enabled) move_generic(8, turn_enabled)
end end
def move_upper_left # def move_upper_left
@through=true # @through=true
unless @direction_fix # unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction) # @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
end # end
if can_move_in_direction?(7) # if can_move_in_direction?(7)
@x -= 1 # @x -= 1
@y -= 1 # @y -= 1
increase_steps # increase_steps
end # end
@through=false # @through=false
end # end
#
def move_upper_right # def move_upper_right
@through=true # @through=true
unless @direction_fix # unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction) # @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
end # end
if can_move_in_direction?(9) # if can_move_in_direction?(9)
@x += 1 # @x += 1
@y -= 1 # @y -= 1
increase_steps # increase_steps
end # end
@through=false # @through=false
end # end
#
# def move_lower_left
# @through=true
# unless @direction_fix
# @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
# end
# if can_move_in_direction?(1)
# @x -= 1
# @y += 1
# increase_steps
# end
# @through=false
# end
#
# def move_lower_right
# @through=true
# unless @direction_fix
# @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
# end
# if can_move_in_direction?(3)
# @x += 1
# @y += 1
# increase_steps
# end
# @through=false
# end
def move_lower_left def move_lower_left
@through=true
unless @direction_fix unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction) @direction = (
if @direction == DIRECTION_RIGHT
DIRECTION_LEFT
else
@direction == DIRECTION_UP ? DIRECTION_DOWN : @direction
end)
end end
if can_move_in_direction?(1) if (passable?(@x, @y, DIRECTION_DOWN) and passable?(@x, @y + 1, DIRECTION_LEFT)) or
@x -= 1 (passable?(@x, @y, DIRECTION_LEFT) and passable?(@x - 1, @y, DIRECTION_DOWN))
@y += 1 if destination_is_passable(@x - 1, @y + 1)
increase_steps @x -= 1
@y += 1
increase_steps
end
end end
@through=false
end end
def move_lower_right def move_lower_right
@through=true
unless @direction_fix unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction) @direction = (
if @direction == DIRECTION_LEFT
DIRECTION_RIGHT
else
@direction == DIRECTION_UP ? DIRECTION_DOWN : @direction
end)
end end
if can_move_in_direction?(3) if (passable?(@x, @y, DIRECTION_DOWN) and passable?(@x, @y + 1, DIRECTION_RIGHT)) or
@x += 1 (passable?(@x, @y, DIRECTION_RIGHT) and passable?(@x + 1, @y, DIRECTION_DOWN))
@y += 1 if destination_is_passable(@x + 1, @y + 1)
increase_steps @x += 1
end @y += 1
@through=false increase_steps
end end
def moveLeft90 # anticlockwise
case self.direction
when 2 then move_right # down
when 4 then move_down # left
when 6 then move_up # right
when 8 then move_left # up
end end
end end
def moveRight90 # clockwise def move_upper_left
unless @direction_fix
@direction = (
if @direction == DIRECTION_RIGHT
DIRECTION_LEFT
else
@direction == DIRECTION_DOWN ? DIRECTION_UP : @direction
end)
end
if (passable?(@x, @y, DIRECTION_UP) and passable?(@x, @y - 1, DIRECTION_LEFT)) or
(passable?(@x, @y, DIRECTION_LEFT) and passable?(@x - 1, @y, DIRECTION_UP))
if destination_is_passable(@x - 1, @y - 1)
@x -= 1
@y -= 1
increase_steps
end
end
end
def move_upper_right
unless @direction_fix
@direction = (
if @direction == DIRECTION_LEFT
DIRECTION_RIGHT
else
@direction == DIRECTION_DOWN ? DIRECTION_UP : @direction
end)
end
if (passable?(@x, @y, DIRECTION_UP) and passable?(@x, @y - 1, DIRECTION_RIGHT)) or
(passable?(@x, @y, DIRECTION_RIGHT) and passable?(@x + 1, @y, DIRECTION_UP))
if destination_is_passable(@x + 1, @y - 1)
@x += 1
@y -= 1
increase_steps
end
end
end
def destination_is_passable(x_dest, y_dest)
return passable?(x_dest, y_dest, 0)
end
def moveLeft90 # anticlockwise
case self.direction case self.direction
when 2 then move_left # down when 2 then
when 4 then move_up # left move_right # down
when 6 then move_down # right when 4 then
when 8 then move_right # up move_down # left
when 6 then
move_up # right
when 8 then
move_left # up
end
end
def moveRight90 # clockwise
case self.direction
when 2 then
move_left # down
when 4 then
move_up # left
when 6 then
move_down # right
when 8 then
move_right # up
end end
end end
def move_random def move_random
case rand(4) case rand(4)
when 0 then move_down(false) when 0 then
when 1 then move_left(false) move_down(false)
when 2 then move_right(false) when 1 then
when 3 then move_up(false) move_left(false)
when 2 then
move_right(false)
when 3 then
move_up(false)
end end
end end
def move_random_range(xrange=-1,yrange=-1) def move_random_range(xrange = -1, yrange = -1)
dirs = [] # 0=down, 1=left, 2=right, 3=up dirs = [] # 0=down, 1=left, 2=right, 3=up
if xrange<0 if xrange < 0
dirs.push(1); dirs.push(2) dirs.push(1); dirs.push(2)
elsif xrange>0 elsif xrange > 0
dirs.push(1) if @x > @original_x - xrange dirs.push(1) if @x > @original_x - xrange
dirs.push(2) if @x < @original_x + xrange dirs.push(2) if @x < @original_x + xrange
end end
if yrange<0 if yrange < 0
dirs.push(0); dirs.push(3) dirs.push(0); dirs.push(3)
elsif yrange>0 elsif yrange > 0
dirs.push(0) if @y < @original_y + yrange dirs.push(0) if @y < @original_y + yrange
dirs.push(3) if @y > @original_y - yrange dirs.push(3) if @y > @original_y - yrange
end end
return if dirs.length==0 return if dirs.length == 0
case dirs[rand(dirs.length)] case dirs[rand(dirs.length)]
when 0 then move_down(false) when 0 then
when 1 then move_left(false) move_down(false)
when 2 then move_right(false) when 1 then
when 3 then move_up(false) move_left(false)
when 2 then
move_right(false)
when 3 then
move_up(false)
end end
end end
def move_random_UD(range=-1) def move_random_UD(range = -1)
move_random_range(0,range) move_random_range(0, range)
end end
def move_random_LR(range=-1) def move_random_LR(range = -1)
move_random_range(range,0) move_random_range(range, 0)
end end
def move_toward_player def move_toward_player
@@ -708,10 +849,14 @@ class Game_Character
def move_forward def move_forward
case @direction case @direction
when 2 then move_down(false) when 2 then
when 4 then move_left(false) move_down(false)
when 6 then move_right(false) when 4 then
when 8 then move_up(false) move_left(false)
when 6 then
move_right(false)
when 8 then
move_up(false)
end end
end end
@@ -719,10 +864,14 @@ class Game_Character
last_direction_fix = @direction_fix last_direction_fix = @direction_fix
@direction_fix = true @direction_fix = true
case @direction case @direction
when 2 then move_up(false) when 2 then
when 4 then move_right(false) move_up(false)
when 6 then move_left(false) when 4 then
when 8 then move_down(false) move_right(false)
when 6 then
move_left(false)
when 8 then
move_down(false)
end end
@direction_fix = last_direction_fix @direction_fix = last_direction_fix
end end
@@ -740,14 +889,15 @@ class Game_Character
@y = @y + y_plus @y = @y + y_plus
real_distance = Math::sqrt(x_plus * x_plus + y_plus * y_plus) real_distance = Math::sqrt(x_plus * x_plus + y_plus * y_plus)
distance = [1, real_distance].max distance = [1, real_distance].max
@jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping @jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping
@jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max @jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max
@jump_distance_left = 1 # Just needs to be non-zero @jump_distance_left = 1 # Just needs to be non-zero
if real_distance > 0 # Jumping to somewhere else if real_distance > 0 # Jumping to somewhere else
@jump_count = 0 @jump_count = 0
else # Jumping on the spot else
@jump_speed_real = nil # Reset jump speed # Jumping on the spot
@jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile @jump_speed_real = nil # Reset jump speed
@jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile
end end
@stop_count = 0 @stop_count = 0
if self.is_a?(Game_Player) if self.is_a?(Game_Player)
@@ -758,19 +908,27 @@ class Game_Character
def jumpForward def jumpForward
case self.direction case self.direction
when 2 then jump(0,1) # down when 2 then
when 4 then jump(-1,0) # left jump(0, 1) # down
when 6 then jump(1,0) # right when 4 then
when 8 then jump(0,-1) # up jump(-1, 0) # left
when 6 then
jump(1, 0) # right
when 8 then
jump(0, -1) # up
end end
end end
def jumpBackward def jumpBackward
case self.direction case self.direction
when 2 then jump(0,-1) # down when 2 then
when 4 then jump(1,0) # left jump(0, -1) # down
when 6 then jump(-1,0) # right when 4 then
when 8 then jump(0,1) # up jump(1, 0) # left
when 6 then
jump(-1, 0) # right
when 8 then
jump(0, 1) # up
end end
end end
@@ -782,35 +940,58 @@ class Game_Character
pbCheckEventTriggerAfterTurning if dir != oldDirection pbCheckEventTriggerAfterTurning if dir != oldDirection
end end
def turn_down; turn_generic(2); end def turn_down
def turn_left; turn_generic(4); end turn_generic(2);
def turn_right; turn_generic(6); end end
def turn_up; turn_generic(8); end
def turn_left
turn_generic(4);
end
def turn_right
turn_generic(6);
end
def turn_up
turn_generic(8);
end
def turn_right_90 def turn_right_90
case @direction case @direction
when 2 then turn_left when 2 then
when 4 then turn_up turn_left
when 6 then turn_down when 4 then
when 8 then turn_right turn_up
when 6 then
turn_down
when 8 then
turn_right
end end
end end
def turn_left_90 def turn_left_90
case @direction case @direction
when 2 then turn_right when 2 then
when 4 then turn_down turn_right
when 6 then turn_up when 4 then
when 8 then turn_left turn_down
when 6 then
turn_up
when 8 then
turn_left
end end
end end
def turn_180 def turn_180
case @direction case @direction
when 2 then turn_up when 2 then
when 4 then turn_right turn_up
when 6 then turn_left when 4 then
when 8 then turn_down turn_right
when 6 then
turn_left
when 8 then
turn_down
end end
end end
@@ -820,10 +1001,14 @@ class Game_Character
def turn_random def turn_random
case rand(4) case rand(4)
when 0 then turn_up when 0 then
when 1 then turn_right turn_up
when 2 then turn_left when 1 then
when 3 then turn_down turn_right
when 2 then
turn_left
when 3 then
turn_down
end end
end end
@@ -886,9 +1071,12 @@ class Game_Character
# 6 => @stop_count > 0 # 0 seconds # 6 => @stop_count > 0 # 0 seconds
if @stop_count >= self.move_frequency_real if @stop_count >= self.move_frequency_real
case @move_type case @move_type
when 1 then move_type_random when 1 then
when 2 then move_type_toward_player move_type_random
when 3 then move_type_custom when 2 then
move_type_toward_player
when 3 then
move_type_custom
end end
end end
end end
@@ -914,7 +1102,7 @@ class Game_Character
end end
# Refresh how far is left to travel in a jump # Refresh how far is left to travel in a jump
if jumping? if jumping?
@jump_count -= 1 if @jump_count > 0 # For stationary jumps only @jump_count -= 1 if @jump_count > 0 # For stationary jumps only
@jump_distance_left = [(dest_x - @real_x).abs, (dest_y - @real_y).abs].max @jump_distance_left = [(dest_x - @real_x).abs, (dest_y - @real_y).abs].max
end end
# End of a step, so perform events that happen at this time # End of a step, so perform events that happen at this time
@@ -922,7 +1110,7 @@ class Game_Character
Events.onStepTakenFieldMovement.trigger(self, self) Events.onStepTakenFieldMovement.trigger(self, self)
calculate_bush_depth calculate_bush_depth
@stopped_this_frame = true @stopped_this_frame = true
elsif !@moved_last_frame || @stopped_last_frame # Started a new step elsif !@moved_last_frame || @stopped_last_frame # Started a new step
calculate_bush_depth calculate_bush_depth
@stopped_this_frame = false @stopped_this_frame = false
end end
@@ -933,14 +1121,14 @@ class Game_Character
def update_stop def update_stop
@anime_count += 1 if @step_anime @anime_count += 1 if @step_anime
@stop_count += 1 if !@starting && !lock? @stop_count += 1 if !@starting && !lock?
@moved_this_frame = false @moved_this_frame = false
@stopped_this_frame = false @stopped_this_frame = false
end end
def update_pattern def update_pattern
return if @lock_pattern return if @lock_pattern
# return if @jump_count > 0 # Don't animate if jumping on the spot # return if @jump_count > 0 # Don't animate if jumping on the spot
# Character has stopped moving, return to original pattern # Character has stopped moving, return to original pattern
if @moved_last_frame && !@moved_this_frame && !@step_anime if @moved_last_frame && !@moved_this_frame && !@step_anime
@pattern = @original_pattern @pattern = @original_pattern
@@ -958,7 +1146,7 @@ class Game_Character
# game uses square tiles. # game uses square tiles.
real_speed = (jumping?) ? jump_speed_real : move_speed_real real_speed = (jumping?) ? jump_speed_real : move_speed_real
frames_per_pattern = Game_Map::REAL_RES_X / (real_speed * 2.0) frames_per_pattern = Game_Map::REAL_RES_X / (real_speed * 2.0)
frames_per_pattern *= 2 if move_speed >= 5 # Cycling speed or faster frames_per_pattern *= 2 if move_speed >= 5 # Cycling speed or faster
return if @anime_count < frames_per_pattern return if @anime_count < frames_per_pattern
# Advance to the next animation frame # Advance to the next animation frame
@pattern = (@pattern + 1) % 4 @pattern = (@pattern + 1) % 4

View File

@@ -191,7 +191,7 @@ end
def pbCut def pbCut
move = :CUT move = :CUT
movefinder = $Trainer.get_pokemon_with_move(move) movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT, false) || (!$DEBUG && !movefinder) if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT, false) || (!$DEBUG && !movefinder) || $PokemonBag.pbQuantity(:MACHETE)>0
pbMessage(_INTL("This tree looks like it can be cut down.")) pbMessage(_INTL("This tree looks like it can be cut down."))
return false return false
end end
@@ -300,7 +300,7 @@ def pbDive
return false if !map_metadata || !map_metadata.dive_map_id return false if !map_metadata || !map_metadata.dive_map_id
move = :DIVE move = :DIVE
movefinder = $Trainer.get_pokemon_with_move(move) movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder) if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder) || $PokemonBag.pbQuantity(:SCUBAGEAR)>0
pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater.")) pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
return false return false
end end
@@ -657,7 +657,7 @@ def pbStrength
end end
move = :STRENGTH move = :STRENGTH
movefinder = $Trainer.get_pokemon_with_move(move) movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH, false) || (!$DEBUG && !movefinder) if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH, false) || (!$DEBUG && !movefinder) || $PokemonBag.pbQuantity(:LEVER)>0
pbMessage(_INTL("It's a big boulder, but a Pokémon may be able to push it aside.")) pbMessage(_INTL("It's a big boulder, but a Pokémon may be able to push it aside."))
return false return false
end end
@@ -704,7 +704,7 @@ def pbSurf
return false if $game_player.pbHasDependentEvents? return false if $game_player.pbHasDependentEvents?
move = :SURF move = :SURF
movefinder = $Trainer.get_pokemon_with_move(move) movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, false) || (!$DEBUG && !movefinder) if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, false) || (!$DEBUG && !movefinder) || $PokemonBag.pbQuantity(:SURFBOARD)>0
return false return false
end end
if pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?")) if pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
@@ -944,7 +944,7 @@ end
def pbWaterfall def pbWaterfall
move = :WATERFALL move = :WATERFALL
movefinder = $Trainer.get_pokemon_with_move(move) movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL, false) || (!$DEBUG && !movefinder) if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL, false) || (!$DEBUG && !movefinder) || $PokemonBag.pbQuantity(:JETPACK)>0
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."))
return false return false
end end

View File

@@ -1060,8 +1060,10 @@ class Pokemon
end end
end end
hpDiff = @totalhp - @hp hpDiff = @totalhp - @hp
@totalhp = stats[:HP] #@totalhp = stats[:HP]
@hp = @totalhp - hpDiff @totalhp= self.ability == :WONDERGUARD ? 1 : stats[:HP]
calculated_hp = @totalhp - hpDiff
@hp = calculated_hp > 0 ? calculated_hp: 0
@attack = stats[:ATTACK] @attack = stats[:ATTACK]
@defense = stats[:DEFENSE] @defense = stats[:DEFENSE]
@spatk = stats[:SPECIAL_ATTACK] @spatk = stats[:SPECIAL_ATTACK]

View File

@@ -18,4 +18,10 @@ EGGINITIALLEVEL=Settings::EGG_LEVEL
#this is fucking stupid but apparently necessary #this is fucking stupid but apparently necessary
FALSE = false FALSE = false
TRUE = true TRUE = true
DIRECTION_LEFT=4
DIRECTION_RIGHT=6
DIRECTION_DOWN=2
DIRECTION_UP=8

Binary file not shown.