mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
side stairs + wonderguard
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,90 +1,90 @@
|
||||
class Game_Character
|
||||
attr_reader :id
|
||||
attr_reader :original_x
|
||||
attr_reader :original_y
|
||||
attr_reader :x
|
||||
attr_reader :y
|
||||
attr_reader :real_x
|
||||
attr_reader :real_y
|
||||
attr_reader :id
|
||||
attr_reader :original_x
|
||||
attr_reader :original_y
|
||||
attr_reader :x
|
||||
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_reader :tile_id
|
||||
attr_accessor :character_name
|
||||
attr_accessor :character_hue
|
||||
attr_reader :opacity
|
||||
attr_reader :blend_type
|
||||
attr_reader :opacity
|
||||
attr_reader :blend_type
|
||||
attr_accessor :direction
|
||||
attr_accessor :pattern
|
||||
attr_accessor :pattern_surf
|
||||
attr_accessor :lock_pattern
|
||||
attr_reader :move_route_forcing
|
||||
attr_reader :move_route_forcing
|
||||
attr_accessor :through
|
||||
attr_accessor :animation_id
|
||||
attr_accessor :transparent
|
||||
attr_reader :move_speed
|
||||
attr_reader :move_speed
|
||||
attr_accessor :walk_anime
|
||||
attr_writer :bob_height
|
||||
attr_writer :bob_height
|
||||
|
||||
def initialize(map=nil)
|
||||
@map = map
|
||||
@id = 0
|
||||
@original_x = 0
|
||||
@original_y = 0
|
||||
@x = 0
|
||||
@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 = ""
|
||||
@character_hue = 0
|
||||
@opacity = 255
|
||||
@blend_type = 0
|
||||
@direction = 2
|
||||
@pattern = 0
|
||||
@pattern_surf = 0
|
||||
@lock_pattern = false
|
||||
@move_route_forcing = false
|
||||
@through = false
|
||||
@animation_id = 0
|
||||
@transparent = false
|
||||
@original_direction = 2
|
||||
@original_pattern = 0
|
||||
@move_type = 0
|
||||
self.move_speed = 3
|
||||
self.move_frequency = 6
|
||||
@move_route = nil
|
||||
@move_route_index = 0
|
||||
@original_move_route = nil
|
||||
def initialize(map = nil)
|
||||
@map = map
|
||||
@id = 0
|
||||
@original_x = 0
|
||||
@original_y = 0
|
||||
@x = 0
|
||||
@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 = ""
|
||||
@character_hue = 0
|
||||
@opacity = 255
|
||||
@blend_type = 0
|
||||
@direction = 2
|
||||
@pattern = 0
|
||||
@pattern_surf = 0
|
||||
@lock_pattern = false
|
||||
@move_route_forcing = false
|
||||
@through = false
|
||||
@animation_id = 0
|
||||
@transparent = false
|
||||
@original_direction = 2
|
||||
@original_pattern = 0
|
||||
@move_type = 0
|
||||
self.move_speed = 3
|
||||
self.move_frequency = 6
|
||||
@move_route = nil
|
||||
@move_route_index = 0
|
||||
@original_move_route = nil
|
||||
@original_move_route_index = 0
|
||||
@walk_anime = true # Whether character should animate while moving
|
||||
@step_anime = false # Whether character should animate while still
|
||||
@direction_fix = false
|
||||
@always_on_top = false
|
||||
@anime_count = 0
|
||||
@stop_count = 0
|
||||
@jump_peak = 0 # Max height while jumping
|
||||
@jump_distance = 0 # Total distance of jump
|
||||
@jump_distance_left = 0 # Distance left to travel
|
||||
@jump_count = 0 # Frames left in a stationary jump
|
||||
@bob_height = 0
|
||||
@wait_count = 0
|
||||
@moved_this_frame = false
|
||||
@locked = false
|
||||
@prelock_direction = 0
|
||||
@walk_anime = true # Whether character should animate while moving
|
||||
@step_anime = false # Whether character should animate while still
|
||||
@direction_fix = false
|
||||
@always_on_top = false
|
||||
@anime_count = 0
|
||||
@stop_count = 0
|
||||
@jump_peak = 0 # Max height while jumping
|
||||
@jump_distance = 0 # Total distance of jump
|
||||
@jump_distance_left = 0 # Distance left to travel
|
||||
@jump_count = 0 # Frames left in a stationary jump
|
||||
@bob_height = 0
|
||||
@wait_count = 0
|
||||
@moved_this_frame = false
|
||||
@locked = false
|
||||
@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
|
||||
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)
|
||||
(check_y > @y - @height && check_y <= @y)
|
||||
end
|
||||
|
||||
def each_occupied_tile
|
||||
@@ -96,7 +96,7 @@ class Game_Character
|
||||
end
|
||||
|
||||
def move_speed=(val)
|
||||
return if val==@move_speed
|
||||
return if val == @move_speed
|
||||
@move_speed = val
|
||||
# @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
|
||||
@@ -120,7 +120,7 @@ class Game_Character
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
@@ -129,7 +129,7 @@ class Game_Character
|
||||
end
|
||||
|
||||
def move_frequency=(val)
|
||||
return if val==@move_frequency
|
||||
return if val == @move_frequency
|
||||
@move_frequency = val
|
||||
# @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
|
||||
@@ -161,13 +161,13 @@ class Game_Character
|
||||
|
||||
def lock
|
||||
return if @locked
|
||||
@prelock_direction = 0 # Was @direction but disabled
|
||||
@prelock_direction = 0 # Was @direction but disabled
|
||||
turn_toward_player
|
||||
@locked = true
|
||||
end
|
||||
|
||||
def minilock
|
||||
@prelock_direction = 0 # Was @direction but disabled
|
||||
@prelock_direction = 0 # Was @direction but disabled
|
||||
@locked = true
|
||||
end
|
||||
|
||||
@@ -193,7 +193,7 @@ class Game_Character
|
||||
end
|
||||
|
||||
def cancelMoveRoute()
|
||||
@move_route=nil
|
||||
@move_route = nil
|
||||
@move_route_forcing = false
|
||||
end
|
||||
|
||||
@@ -246,19 +246,19 @@ class Game_Character
|
||||
|
||||
def can_move_from_coordinate?(start_x, start_y, dir, strict = false)
|
||||
case dir
|
||||
when 2, 8 # Down, up
|
||||
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
|
||||
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
|
||||
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)
|
||||
@@ -269,7 +269,7 @@ class Game_Character
|
||||
return false if !passable?(start_x + x_diff, i + 1, dir + 3, strict)
|
||||
end
|
||||
return true
|
||||
when 7, 9 # Up diagonals
|
||||
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
|
||||
@@ -308,11 +308,11 @@ class Game_Character
|
||||
ret = screen_y_ground
|
||||
if jumping?
|
||||
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
|
||||
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
|
||||
ret += @jump_peak * (4 * jump_fraction**2 - 1)
|
||||
ret += @jump_peak * (4 * jump_fraction ** 2 - 1)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -337,7 +337,7 @@ class Game_Character
|
||||
#=============================================================================
|
||||
def moving?
|
||||
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
|
||||
|
||||
def jumping?
|
||||
@@ -352,14 +352,14 @@ class Game_Character
|
||||
|
||||
def force_move_route(move_route)
|
||||
if @original_move_route == nil
|
||||
@original_move_route = @move_route
|
||||
@original_move_route = @move_route
|
||||
@original_move_route_index = @move_route_index
|
||||
end
|
||||
@move_route = move_route
|
||||
@move_route_index = 0
|
||||
@move_route = move_route
|
||||
@move_route_index = 0
|
||||
@move_route_forcing = true
|
||||
@prelock_direction = 0
|
||||
@wait_count = 0
|
||||
@prelock_direction = 0
|
||||
@wait_count = 0
|
||||
move_type_custom
|
||||
end
|
||||
|
||||
@@ -375,8 +375,8 @@ class Game_Character
|
||||
|
||||
def triggerLeaveTile
|
||||
if @oldX && @oldY && @oldMap &&
|
||||
(@oldX!=self.x || @oldY!=self.y || @oldMap!=self.map.map_id)
|
||||
Events.onLeaveTile.trigger(self,self,@oldMap,@oldX,@oldY)
|
||||
(@oldX != self.x || @oldY != self.y || @oldMap != self.map.map_id)
|
||||
Events.onLeaveTile.trigger(self, self, @oldMap, @oldX, @oldY)
|
||||
end
|
||||
@oldX = self.x
|
||||
@oldY = self.y
|
||||
@@ -393,9 +393,12 @@ class Game_Character
|
||||
#=============================================================================
|
||||
def move_type_random
|
||||
case rand(6)
|
||||
when 0..3 then move_random
|
||||
when 4 then move_forward
|
||||
when 5 then @stop_count = 0
|
||||
when 0..3 then
|
||||
move_random
|
||||
when 4 then
|
||||
move_forward
|
||||
when 5 then
|
||||
@stop_count = 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -407,9 +410,12 @@ class Game_Character
|
||||
return
|
||||
end
|
||||
case rand(6)
|
||||
when 0..3 then move_toward_player
|
||||
when 4 then move_random
|
||||
when 5 then move_forward
|
||||
when 0..3 then
|
||||
move_toward_player
|
||||
when 4 then
|
||||
move_random
|
||||
when 5 then
|
||||
move_forward
|
||||
end
|
||||
end
|
||||
|
||||
@@ -423,7 +429,7 @@ class Game_Character
|
||||
else
|
||||
if @move_route_forcing
|
||||
@move_route_forcing = false
|
||||
@move_route = @original_move_route
|
||||
@move_route = @original_move_route
|
||||
@move_route_index = @original_move_route_index
|
||||
@original_move_route = nil
|
||||
end
|
||||
@@ -433,42 +439,67 @@ class Game_Character
|
||||
end
|
||||
if command.code <= 14
|
||||
case command.code
|
||||
when 1 then move_down
|
||||
when 2 then move_left
|
||||
when 3 then move_right
|
||||
when 4 then move_up
|
||||
when 5 then move_lower_left
|
||||
when 6 then move_lower_right
|
||||
when 7 then 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])
|
||||
when 1 then
|
||||
move_down
|
||||
when 2 then
|
||||
move_left
|
||||
when 3 then
|
||||
move_right
|
||||
when 4 then
|
||||
move_up
|
||||
when 5 then
|
||||
move_lower_left
|
||||
when 6 then
|
||||
move_lower_right
|
||||
when 7 then
|
||||
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
|
||||
@move_route_index += 1 if @move_route.skippable || moving? || jumping?
|
||||
return
|
||||
end
|
||||
if command.code == 15 # Wait
|
||||
if command.code == 15 # Wait
|
||||
@wait_count = (command.parameters[0] * Graphics.frame_rate / 20) - 1
|
||||
@move_route_index += 1
|
||||
return
|
||||
end
|
||||
if command.code >= 16 && command.code <= 26
|
||||
case command.code
|
||||
when 16 then turn_down
|
||||
when 17 then turn_left
|
||||
when 18 then turn_right
|
||||
when 19 then turn_up
|
||||
when 20 then turn_right_90
|
||||
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
|
||||
when 16 then
|
||||
turn_down
|
||||
when 17 then
|
||||
turn_left
|
||||
when 18 then
|
||||
turn_right
|
||||
when 19 then
|
||||
turn_up
|
||||
when 20 then
|
||||
turn_right_90
|
||||
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
|
||||
@move_route_index += 1
|
||||
return
|
||||
@@ -481,16 +512,26 @@ class Game_Character
|
||||
when 28
|
||||
$game_switches[command.parameters[0]] = false
|
||||
self.map.need_refresh = true
|
||||
when 29 then self.move_speed = command.parameters[0]
|
||||
when 30 then self.move_frequency = command.parameters[0]
|
||||
when 31 then @walk_anime = true
|
||||
when 32 then @walk_anime = false
|
||||
when 33 then @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 29 then
|
||||
self.move_speed = command.parameters[0]
|
||||
when 30 then
|
||||
self.move_frequency = command.parameters[0]
|
||||
when 31 then
|
||||
@walk_anime = true
|
||||
when 32 then
|
||||
@walk_anime = false
|
||||
when 33 then
|
||||
@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
|
||||
old_always_on_top = @always_on_top
|
||||
@always_on_top = true
|
||||
@@ -514,10 +555,14 @@ class Game_Character
|
||||
@original_pattern = @pattern
|
||||
end
|
||||
calculate_bush_depth if @tile_id != old_tile_id
|
||||
when 42 then @opacity = command.parameters[0]
|
||||
when 43 then @blend_type = command.parameters[0]
|
||||
when 44 then pbSEPlay(command.parameters[0])
|
||||
when 45 then eval(command.parameters[0])
|
||||
when 42 then
|
||||
@opacity = command.parameters[0]
|
||||
when 43 then
|
||||
@blend_type = command.parameters[0]
|
||||
when 44 then
|
||||
pbSEPlay(command.parameters[0])
|
||||
when 45 then
|
||||
eval(command.parameters[0])
|
||||
end
|
||||
@move_route_index += 1
|
||||
end
|
||||
@@ -552,114 +597,210 @@ class Game_Character
|
||||
move_generic(8, turn_enabled)
|
||||
end
|
||||
|
||||
def move_upper_left
|
||||
@through=true
|
||||
unless @direction_fix
|
||||
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
|
||||
end
|
||||
if can_move_in_direction?(7)
|
||||
@x -= 1
|
||||
@y -= 1
|
||||
increase_steps
|
||||
end
|
||||
@through=false
|
||||
end
|
||||
|
||||
def move_upper_right
|
||||
@through=true
|
||||
unless @direction_fix
|
||||
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
|
||||
end
|
||||
if can_move_in_direction?(9)
|
||||
@x += 1
|
||||
@y -= 1
|
||||
increase_steps
|
||||
end
|
||||
@through=false
|
||||
end
|
||||
# def move_upper_left
|
||||
# @through=true
|
||||
# unless @direction_fix
|
||||
# @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
|
||||
# end
|
||||
# if can_move_in_direction?(7)
|
||||
# @x -= 1
|
||||
# @y -= 1
|
||||
# increase_steps
|
||||
# end
|
||||
# @through=false
|
||||
# end
|
||||
#
|
||||
# def move_upper_right
|
||||
# @through=true
|
||||
# unless @direction_fix
|
||||
# @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
|
||||
# end
|
||||
# if can_move_in_direction?(9)
|
||||
# @x += 1
|
||||
# @y -= 1
|
||||
# increase_steps
|
||||
# end
|
||||
# @through=false
|
||||
# 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
|
||||
@through=true
|
||||
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
|
||||
if can_move_in_direction?(1)
|
||||
@x -= 1
|
||||
@y += 1
|
||||
increase_steps
|
||||
if (passable?(@x, @y, DIRECTION_DOWN) and passable?(@x, @y + 1, DIRECTION_LEFT)) or
|
||||
(passable?(@x, @y, DIRECTION_LEFT) and passable?(@x - 1, @y, DIRECTION_DOWN))
|
||||
if destination_is_passable(@x - 1, @y + 1)
|
||||
@x -= 1
|
||||
@y += 1
|
||||
increase_steps
|
||||
end
|
||||
end
|
||||
@through=false
|
||||
end
|
||||
|
||||
def move_lower_right
|
||||
@through=true
|
||||
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
|
||||
if can_move_in_direction?(3)
|
||||
@x += 1
|
||||
@y += 1
|
||||
increase_steps
|
||||
end
|
||||
@through=false
|
||||
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
|
||||
if (passable?(@x, @y, DIRECTION_DOWN) and passable?(@x, @y + 1, DIRECTION_RIGHT)) or
|
||||
(passable?(@x, @y, DIRECTION_RIGHT) and passable?(@x + 1, @y, DIRECTION_DOWN))
|
||||
if destination_is_passable(@x + 1, @y + 1)
|
||||
@x += 1
|
||||
@y += 1
|
||||
increase_steps
|
||||
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
|
||||
when 2 then move_left # down
|
||||
when 4 then move_up # left
|
||||
when 6 then move_down # right
|
||||
when 8 then move_right # up
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
def move_random
|
||||
case rand(4)
|
||||
when 0 then move_down(false)
|
||||
when 1 then move_left(false)
|
||||
when 2 then move_right(false)
|
||||
when 3 then move_up(false)
|
||||
when 0 then
|
||||
move_down(false)
|
||||
when 1 then
|
||||
move_left(false)
|
||||
when 2 then
|
||||
move_right(false)
|
||||
when 3 then
|
||||
move_up(false)
|
||||
end
|
||||
end
|
||||
|
||||
def move_random_range(xrange=-1,yrange=-1)
|
||||
dirs = [] # 0=down, 1=left, 2=right, 3=up
|
||||
if xrange<0
|
||||
def move_random_range(xrange = -1, yrange = -1)
|
||||
dirs = [] # 0=down, 1=left, 2=right, 3=up
|
||||
if xrange < 0
|
||||
dirs.push(1); dirs.push(2)
|
||||
elsif xrange>0
|
||||
elsif xrange > 0
|
||||
dirs.push(1) if @x > @original_x - xrange
|
||||
dirs.push(2) if @x < @original_x + xrange
|
||||
end
|
||||
if yrange<0
|
||||
if yrange < 0
|
||||
dirs.push(0); dirs.push(3)
|
||||
elsif yrange>0
|
||||
elsif yrange > 0
|
||||
dirs.push(0) if @y < @original_y + yrange
|
||||
dirs.push(3) if @y > @original_y - yrange
|
||||
end
|
||||
return if dirs.length==0
|
||||
return if dirs.length == 0
|
||||
case dirs[rand(dirs.length)]
|
||||
when 0 then move_down(false)
|
||||
when 1 then move_left(false)
|
||||
when 2 then move_right(false)
|
||||
when 3 then move_up(false)
|
||||
when 0 then
|
||||
move_down(false)
|
||||
when 1 then
|
||||
move_left(false)
|
||||
when 2 then
|
||||
move_right(false)
|
||||
when 3 then
|
||||
move_up(false)
|
||||
end
|
||||
end
|
||||
|
||||
def move_random_UD(range=-1)
|
||||
move_random_range(0,range)
|
||||
def move_random_UD(range = -1)
|
||||
move_random_range(0, range)
|
||||
end
|
||||
|
||||
def move_random_LR(range=-1)
|
||||
move_random_range(range,0)
|
||||
def move_random_LR(range = -1)
|
||||
move_random_range(range, 0)
|
||||
end
|
||||
|
||||
def move_toward_player
|
||||
@@ -708,10 +849,14 @@ class Game_Character
|
||||
|
||||
def move_forward
|
||||
case @direction
|
||||
when 2 then move_down(false)
|
||||
when 4 then move_left(false)
|
||||
when 6 then move_right(false)
|
||||
when 8 then move_up(false)
|
||||
when 2 then
|
||||
move_down(false)
|
||||
when 4 then
|
||||
move_left(false)
|
||||
when 6 then
|
||||
move_right(false)
|
||||
when 8 then
|
||||
move_up(false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -719,10 +864,14 @@ class Game_Character
|
||||
last_direction_fix = @direction_fix
|
||||
@direction_fix = true
|
||||
case @direction
|
||||
when 2 then move_up(false)
|
||||
when 4 then move_right(false)
|
||||
when 6 then move_left(false)
|
||||
when 8 then move_down(false)
|
||||
when 2 then
|
||||
move_up(false)
|
||||
when 4 then
|
||||
move_right(false)
|
||||
when 6 then
|
||||
move_left(false)
|
||||
when 8 then
|
||||
move_down(false)
|
||||
end
|
||||
@direction_fix = last_direction_fix
|
||||
end
|
||||
@@ -740,14 +889,15 @@ class Game_Character
|
||||
@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
|
||||
@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_left = 1 # Just needs to be non-zero
|
||||
if real_distance > 0 # Jumping to somewhere else
|
||||
@jump_distance_left = 1 # Just needs to be non-zero
|
||||
if real_distance > 0 # Jumping to somewhere else
|
||||
@jump_count = 0
|
||||
else # Jumping on the spot
|
||||
@jump_speed_real = nil # Reset jump speed
|
||||
@jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile
|
||||
else
|
||||
# Jumping on the spot
|
||||
@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
|
||||
@stop_count = 0
|
||||
if self.is_a?(Game_Player)
|
||||
@@ -758,19 +908,27 @@ class Game_Character
|
||||
|
||||
def jumpForward
|
||||
case self.direction
|
||||
when 2 then jump(0,1) # down
|
||||
when 4 then jump(-1,0) # left
|
||||
when 6 then jump(1,0) # right
|
||||
when 8 then jump(0,-1) # up
|
||||
when 2 then
|
||||
jump(0, 1) # down
|
||||
when 4 then
|
||||
jump(-1, 0) # left
|
||||
when 6 then
|
||||
jump(1, 0) # right
|
||||
when 8 then
|
||||
jump(0, -1) # up
|
||||
end
|
||||
end
|
||||
|
||||
def jumpBackward
|
||||
case self.direction
|
||||
when 2 then jump(0,-1) # down
|
||||
when 4 then jump(1,0) # left
|
||||
when 6 then jump(-1,0) # right
|
||||
when 8 then jump(0,1) # up
|
||||
when 2 then
|
||||
jump(0, -1) # down
|
||||
when 4 then
|
||||
jump(1, 0) # left
|
||||
when 6 then
|
||||
jump(-1, 0) # right
|
||||
when 8 then
|
||||
jump(0, 1) # up
|
||||
end
|
||||
end
|
||||
|
||||
@@ -782,35 +940,58 @@ class Game_Character
|
||||
pbCheckEventTriggerAfterTurning if dir != oldDirection
|
||||
end
|
||||
|
||||
def turn_down; turn_generic(2); end
|
||||
def turn_left; turn_generic(4); end
|
||||
def turn_right; turn_generic(6); end
|
||||
def turn_up; turn_generic(8); end
|
||||
def turn_down
|
||||
turn_generic(2);
|
||||
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
|
||||
case @direction
|
||||
when 2 then turn_left
|
||||
when 4 then turn_up
|
||||
when 6 then turn_down
|
||||
when 8 then turn_right
|
||||
when 2 then
|
||||
turn_left
|
||||
when 4 then
|
||||
turn_up
|
||||
when 6 then
|
||||
turn_down
|
||||
when 8 then
|
||||
turn_right
|
||||
end
|
||||
end
|
||||
|
||||
def turn_left_90
|
||||
case @direction
|
||||
when 2 then turn_right
|
||||
when 4 then turn_down
|
||||
when 6 then turn_up
|
||||
when 8 then turn_left
|
||||
when 2 then
|
||||
turn_right
|
||||
when 4 then
|
||||
turn_down
|
||||
when 6 then
|
||||
turn_up
|
||||
when 8 then
|
||||
turn_left
|
||||
end
|
||||
end
|
||||
|
||||
def turn_180
|
||||
case @direction
|
||||
when 2 then turn_up
|
||||
when 4 then turn_right
|
||||
when 6 then turn_left
|
||||
when 8 then turn_down
|
||||
when 2 then
|
||||
turn_up
|
||||
when 4 then
|
||||
turn_right
|
||||
when 6 then
|
||||
turn_left
|
||||
when 8 then
|
||||
turn_down
|
||||
end
|
||||
end
|
||||
|
||||
@@ -820,10 +1001,14 @@ class Game_Character
|
||||
|
||||
def turn_random
|
||||
case rand(4)
|
||||
when 0 then turn_up
|
||||
when 1 then turn_right
|
||||
when 2 then turn_left
|
||||
when 3 then turn_down
|
||||
when 0 then
|
||||
turn_up
|
||||
when 1 then
|
||||
turn_right
|
||||
when 2 then
|
||||
turn_left
|
||||
when 3 then
|
||||
turn_down
|
||||
end
|
||||
end
|
||||
|
||||
@@ -886,9 +1071,12 @@ class Game_Character
|
||||
# 6 => @stop_count > 0 # 0 seconds
|
||||
if @stop_count >= self.move_frequency_real
|
||||
case @move_type
|
||||
when 1 then move_type_random
|
||||
when 2 then move_type_toward_player
|
||||
when 3 then move_type_custom
|
||||
when 1 then
|
||||
move_type_random
|
||||
when 2 then
|
||||
move_type_toward_player
|
||||
when 3 then
|
||||
move_type_custom
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -914,7 +1102,7 @@ class Game_Character
|
||||
end
|
||||
# Refresh how far is left to travel in a jump
|
||||
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
|
||||
end
|
||||
# End of a step, so perform events that happen at this time
|
||||
@@ -922,7 +1110,7 @@ class Game_Character
|
||||
Events.onStepTakenFieldMovement.trigger(self, self)
|
||||
calculate_bush_depth
|
||||
@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
|
||||
@stopped_this_frame = false
|
||||
end
|
||||
@@ -933,14 +1121,14 @@ class Game_Character
|
||||
|
||||
def update_stop
|
||||
@anime_count += 1 if @step_anime
|
||||
@stop_count += 1 if !@starting && !lock?
|
||||
@stop_count += 1 if !@starting && !lock?
|
||||
@moved_this_frame = false
|
||||
@stopped_this_frame = false
|
||||
end
|
||||
|
||||
def update_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
|
||||
if @moved_last_frame && !@moved_this_frame && !@step_anime
|
||||
@pattern = @original_pattern
|
||||
@@ -958,7 +1146,7 @@ class Game_Character
|
||||
# game uses square tiles.
|
||||
real_speed = (jumping?) ? jump_speed_real : move_speed_real
|
||||
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
|
||||
# Advance to the next animation frame
|
||||
@pattern = (@pattern + 1) % 4
|
||||
|
||||
@@ -191,7 +191,7 @@ end
|
||||
def pbCut
|
||||
move = :CUT
|
||||
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."))
|
||||
return false
|
||||
end
|
||||
@@ -300,7 +300,7 @@ def pbDive
|
||||
return false if !map_metadata || !map_metadata.dive_map_id
|
||||
move = :DIVE
|
||||
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."))
|
||||
return false
|
||||
end
|
||||
@@ -657,7 +657,7 @@ def pbStrength
|
||||
end
|
||||
move = :STRENGTH
|
||||
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."))
|
||||
return false
|
||||
end
|
||||
@@ -704,7 +704,7 @@ def pbSurf
|
||||
return false if $game_player.pbHasDependentEvents?
|
||||
move = :SURF
|
||||
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
|
||||
end
|
||||
if pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
|
||||
@@ -944,7 +944,7 @@ end
|
||||
def pbWaterfall
|
||||
move = :WATERFALL
|
||||
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."))
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -1060,8 +1060,10 @@ class Pokemon
|
||||
end
|
||||
end
|
||||
hpDiff = @totalhp - @hp
|
||||
@totalhp = stats[:HP]
|
||||
@hp = @totalhp - hpDiff
|
||||
#@totalhp = stats[:HP]
|
||||
@totalhp= self.ability == :WONDERGUARD ? 1 : stats[:HP]
|
||||
calculated_hp = @totalhp - hpDiff
|
||||
@hp = calculated_hp > 0 ? calculated_hp: 0
|
||||
@attack = stats[:ATTACK]
|
||||
@defense = stats[:DEFENSE]
|
||||
@spatk = stats[:SPECIAL_ATTACK]
|
||||
|
||||
@@ -18,4 +18,10 @@ EGGINITIALLEVEL=Settings::EGG_LEVEL
|
||||
|
||||
#this is fucking stupid but apparently necessary
|
||||
FALSE = false
|
||||
TRUE = true
|
||||
TRUE = true
|
||||
|
||||
|
||||
DIRECTION_LEFT=4
|
||||
DIRECTION_RIGHT=6
|
||||
DIRECTION_DOWN=2
|
||||
DIRECTION_UP=8
|
||||
Binary file not shown.
Reference in New Issue
Block a user