class Game_Character
alias:md:move_down
def move_down(turn_enabled = true,bot=true)
kz = [0,0]
#不能移动的情况
if defined? self.battler.agi == nil
#解除逃跑
self.battler.remove_state(29)
# 睡眠
return if self.battler.states.include?(90)
#害怕
return if self.battler.states.include?(91)
#待命
return if self.battler.states.include?(6)
return if $game_temp.cast_time > 0 and self.is_a?(Game_Player)
return if @cold_countsf > 0
#大型尺寸移动接触
if XAS_BA_ENEMY::BODY_SQUARE.include?(self.battler.id) and
not XAS_BA_ENEMY::BODY_SQUARE_QH.include?(self.battler.id)
kz = [-XAS_BA_ENEMY::BODY_SQUARE[self.battler.id],XAS_BA_ENEMY::BODY_SQUARE[self.battler.id]]
end
end
unless bot
speed1 = (2**@move_speed).to_f/128
speed2 = speed1 - speed1.to_i
speed = speed1.to_i
for i in 0..speed1.to_i*2
if i == 0
speed = speed2
else
speed = 0.5
end
if passable?(@x.to_i, (@y+speed).to_i, 2)
if @x.to_i != @x
tongxing = true
for i in kz
next unless $game_map.valid?((@x+0.9+i).to_i, (@y+speed).to_i)
unless passable?((@x+0.9+i).to_i,(@y+speed).to_i, 2)
tongxing = false
end
end
if $game_map.valid?((@x+0.9).to_i, (@y+speed).to_i)
unless passable?((@x+0.9).to_i,(@y+speed).to_i, 2)
tongxing = false
end
end
if tongxing == true
turn_down if turn_enabled
@y += speed
# if passable?((@x+0.9).to_i,(@y+speed).to_i, 2)
else
if passable?((@x-0.1).to_i,(@y+speed).to_i, 2)
# unless check_event_trigger_touch(@x.to_i+1, (@y+speed).to_i+1)
@y = (@y+speed).to_i
@x -= speed
turn_down if turn_enabled
else
turn_down if turn_enabled
end
end
else
tongxing = true
for i in kz
next unless $game_map.valid?((@x+0.9+i).to_i, (@y+speed).to_i)
unless passable?((@x+0.9+i).to_i,(@y+speed).to_i, 2)
tongxing = false
end
end
if $game_map.valid?((@x+0.9).to_i, (@y+speed).to_i)
unless passable?((@x+0.9).to_i,(@y+speed).to_i, 2)
tongxing = false
end
end
if tongxing == true
turn_down if turn_enabled
@y += speed
end
end
else
# if passable?((@x+0.9).to_i,(@y+speed).to_i, 2)
if passable?((@x+1).to_i,(@y+speed).to_i, 2)
# unless check_event_trigger_touch(@x.to_i, (@y+speed).to_i+1)
@y = (@y+speed).to_i
@x += speed
turn_down if turn_enabled
# else
# turn_down if turn_enabled
# @y = (@y+speed).to_i
# end
else
turn_down if turn_enabled
@y = (@y+speed).to_i
check_event_trigger_touch(@x.to_i, @y.to_i+1)
end
end
end
else
md(turn_enabled)
end
end
alias:ml:move_left
def move_left(turn_enabled = true,bot=true)
kz = [0,0]
#不能移动的情况
if defined? self.battler.agi == nil
#解除逃跑
self.battler.remove_state(29)
# 睡眠
return if self.battler.states.include?(90)
#害怕
return if self.battler.states.include?(91)
#待命
return if self.battler.states.include?(6)
return if $game_temp.cast_time > 0 and self.is_a?(Game_Player)
return if @cold_countsf > 0
#大型尺寸移动接触
if XAS_BA_ENEMY::BODY_SQUARE.include?(self.battler.id) and
not XAS_BA_ENEMY::BODY_SQUARE_QH.include?(self.battler.id)
kz = [-XAS_BA_ENEMY::BODY_SQUARE[self.battler.id]*0.9,XAS_BA_ENEMY::BODY_SQUARE[self.battler.id]*0.9]
end
end
unless bot
speed1 = (2**@move_speed).to_f/128
speed2 = speed1 - speed1.to_i
speed = speed1.to_i
for i in 0..speed1.to_i
if i == 0
speed = speed2
else
speed = 0.5
end
if passable?((@x-speed+0.9).to_i,@y.to_i, 4)
if @y.to_i != @y
tongxing = true
if $game_map.valid?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9).to_i)
unless passable?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9).to_i, 4)
tongxing = false
end
end
if $game_map.valid?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i)
unless passable?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i, 4)
tongxing = false
end
end
if tongxing == true
# if passable?((@x-speed+0.9).to_i,(@y+0.9).to_i, 4)
turn_left if turn_enabled
@x -= speed
else
if passable?((@x-speed+0.9).to_i,(@y-0.1).to_i, 4)
# unless check_event_trigger_touch(@x.to_i-1, @y.to_i+1)
@x = @x.to_i
@y -= speed
turn_left if turn_enabled
else
turn_left if turn_enabled
end
end
else
tongxing = true
if $game_map.valid?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9).to_i)
unless passable?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9).to_i, 4)
tongxing = false
end
end
if $game_map.valid?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i)
unless passable?((@x-speed+0.9-kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i, 4)
tongxing = false
end
end
if tongxing == true
turn_left if turn_enabled
@x -= speed
else
@x = @x.to_i
end
end
else
# if passable?((@x-speed+0.9).to_i,(@y+0.9).to_i, 4)
if passable?((@x-speed+0.9).to_i,(@y+1).to_i, 4)
# unless check_event_trigger_touch(@x.to_i-1, @y.to_i)
@x = @x.to_i
@y += speed
turn_left if turn_enabled
# else
# turn_left if turn_enabled
# @x = @x.to_i
# end
else
turn_left if turn_enabled
@x = @x.to_i
check_event_trigger_touch(@x.to_i-1, @y.to_i)
end
end
end
else
ml(turn_enabled)
end
end
alias:mr:move_right
def move_right(turn_enabled = true,bot=true)
kz = [0,0]
#不能移动的情况
if defined? self.battler.agi == nil
#解除逃跑
self.battler.remove_state(29)
# 睡眠
return if self.battler.states.include?(90)
#害怕
return if self.battler.states.include?(91)
#待命
return if self.battler.states.include?(6)
return if $game_temp.cast_time > 0 and self.is_a?(Game_Player)
return if @cold_countsf > 0
#大型尺寸移动接触
if XAS_BA_ENEMY::BODY_SQUARE.include?(self.battler.id) and
not XAS_BA_ENEMY::BODY_SQUARE_QH.include?(self.battler.id)
kz = [-XAS_BA_ENEMY::BODY_SQUARE[self.battler.id]*0.9,XAS_BA_ENEMY::BODY_SQUARE[self.battler.id]*0.9]
end
end
unless bot
speed1 = (2**@move_speed).to_f/128
speed2 = speed1 - speed1.to_i
speed = speed1.to_i
for i in 0..speed1.to_i
if i == 0
speed = speed2
else
speed = 0.5
end
if passable?((@x+speed).to_i,@y.to_i, 6)
if @y.to_i != @y
tongxing = true
if $game_map.valid?((@x+speed+kz[0].abs).to_i,(@y+0.9).to_i)
unless passable?((@x+speed+kz[0].abs).to_i,(@y+0.9).to_i, 6)
tongxing = false
end
end
if $game_map.valid?((@x+speed+kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i)
unless passable?((@x+speed+kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i, 6)
tongxing = false
end
end
if tongxing == true
# if passable?((@x+speed).to_i,(@y+0.9).to_i, 6)
turn_right if turn_enabled
@x += speed
else
if passable?((@x+speed).to_i,(@y-0.1).to_i, 6)
# unless check_event_trigger_touch((@x+speed).to_i+1, @y.to_i+1)
@x = (@x+speed).to_i
@y -= speed
turn_right if turn_enabled
else
@x = (@x+speed).to_i
turn_right if turn_enabled
end
end
else
tongxing = true
if $game_map.valid?((@x+speed+kz[0].abs).to_i,(@y+0.9).to_i)
unless passable?((@x+speed+kz[0].abs).to_i,(@y+0.9).to_i, 6)
tongxing = false
end
end
if $game_map.valid?((@x+speed+kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i)
unless passable?((@x+speed+kz[0].abs).to_i,(@y+0.9-kz[0].abs).to_i, 6)
tongxing = false
end
end
if tongxing == true
turn_right if turn_enabled
@x += speed
else
turn_right if turn_enabled
@x = @x.to_i
end
end
else
# if passable?((@x+speed).to_i,(@y+0.9).to_i, 6)
if passable?((@x+speed).to_i,(@y+1).to_i, 6)
# unless check_event_trigger_touch((@x+speed).to_i+1, @y.to_i)
@x = (@x+speed).to_i
@y += speed
# turn_right if turn_enabled
# else
# @x = (@x+speed).to_i
# turn_right if turn_enabled
# end
else
turn_right if turn_enabled
@x = (@x+speed).to_i
check_event_trigger_touch(@x.to_i+1, @y.to_i)
end
end
end
else
mr(turn_enabled)
end
end
alias:mu:move_up
def move_up(turn_enabled = true,bot=true)
kz = [0,0]
#不能移动的情况
if defined? self.battler.agi == nil
#解除逃跑
self.battler.remove_state(29)
# 睡眠
return if self.battler.states.include?(90)
#害怕
return if self.battler.states.include?(91)
#待命
return if self.battler.states.include?(6)
return if $game_temp.cast_time > 0 and self.is_a?(Game_Player)
return if @cold_countsf > 0
#大型尺寸移动接触
if XAS_BA_ENEMY::BODY_SQUARE.include?(self.battler.id) and
not XAS_BA_ENEMY::BODY_SQUARE_QH.include?(self.battler.id)
kz = [-XAS_BA_ENEMY::BODY_SQUARE[self.battler.id],XAS_BA_ENEMY::BODY_SQUARE[self.battler.id]]
end
end
unless bot
speed1 = (2**@move_speed).to_f/128
speed2 = speed1 - speed1.to_i
speed = speed1.to_i
for i in 0..speed1.to_i
if i == 0
speed = speed2
else
speed = 0.5
end
if passable?(@x.to_i, (@y-speed+0.9).to_i, 8)
if @x.to_i != @x
tongxing = true
for i in kz
next unless $game_map.valid?((@x+0.9+i).to_i, (@y-speed+0.9-i.abs).to_i)
unless passable?((@x+0.9+i).to_i,(@y-speed+0.9-i.abs).to_i, 8)
tongxing = false
end
end
if $game_map.valid?((@x+0.9).to_i, (@y-speed+0.9-kz[0].abs).to_i)
unless passable?((@x+0.9).to_i,(@y-speed+0.9-kz[0].abs).to_i, 8)
tongxing = false
end
end
if tongxing == true
# if passable?((@x+0.9).to_i,(@y-speed+0.9).to_i, 8)
turn_up if turn_enabled
@y -= speed
else
if passable?((@x-0.1).to_i,(@y-speed+0.9).to_i, 8)
# unless check_event_trigger_touch(@x.to_i+1, @y.to_i-1)
@y = @y.to_i
@x -= speed
turn_up if turn_enabled
else
turn_up if turn_enabled
end
end
else
tongxing = true
for i in kz
next unless $game_map.valid?((@x+0.9+i).to_i, (@y-speed+0.9-i.abs).to_i)
unless passable?((@x+0.9+i).to_i,(@y-speed+0.9-i.abs).to_i, 8)
tongxing = false
end
end
if $game_map.valid?((@x+0.9).to_i, (@y-speed+0.9-kz[0].abs).to_i)
unless passable?((@x+0.9).to_i,(@y-speed+0.9-kz[0].abs).to_i, 8)
tongxing = false
end
end
if tongxing == true
turn_up if turn_enabled
@y -= speed
else
turn_right if turn_enabled
@y = @y.to_i
end
end
else
# if passable?((@x+0.9).to_i,(@y-speed+0.9).to_i, 8)
# unless check_event_trigger_touch(@x.to_i, @y.to_i-1)
# @y = @y.to_i
# @x += speed
# turn_up if turn_enabled
# else
# turn_up if turn_enabled
if passable?((@x+1).to_i,(@y-speed+0.9).to_i, 8)
@x += speed
# elsif passable?((@x-0.9).to_i-1,(@y-speed+0.9).to_i, 8)
# @x -= speed
# else
@y = @y.to_i
# end
# end
else
turn_up if turn_enabled
@y = @y.to_i
check_event_trigger_touch(@x.to_i, @y.to_i-1)
end
end
end
else
mu(turn_enabled)
end
@y = 10 if @y < 10 and $game_switches[32] == true
end
end
class Game_Event < Game_Character
def check_event_trigger_touch(x, y)
# 事件执行中的情况下
if $game_system.map_interpreter.running?
return
end
# 目标为 [与事件接触] 以及和主角坐标一致的情况下
# if @trigger == 2 and x == $game_player.x and y == $game_player.y
if @trigger == 2 and ($game_player.x+0.5).between?(x-0.5,x+1.5) and ($game_player.y+0.5).between?(y,y+1.5)
# 除跳跃中以外的情况、启动判定就是正面的事件
if not jumping? #and not over_trigger?
start
end
end
end
def check_event_trigger_auto
# 目标为 [与事件接触] 以及和主角坐标一致的情况下
if @trigger == 2 and ($game_player.x+0.5).between?(@x-0.5,@x+1.5) and ($game_player.y+0.5).between?(@y,@y+1.5)
# 除跳跃中以外的情况、启动判定就是同位置的事件
if not jumping? #and over_trigger?
start
end
end
# 目标是 [自动执行] 的情况下
if @trigger == 3
start
end
end
end
class Game_Player < Game_Character
def check_event_trigger_here(triggers)
result = false
if $game_system.map_interpreter.running?
return result
end
x = $game_variables[138]["x"]
y = $game_variables[138]["y"]
for event in $game_map.events.values
next if (event.x+0.5).between?(x-0.5,x+1.5) and (event.y+0.5).between?(y,y+1.5) and
(event.name == "传送" or event.name.include?("陷阱"))
if (event.x+0.5).between?(@x-0.5,@x+1.5) and (event.y+0.5).between?(@y,@y+1.5) and triggers.include?(event.trigger)
if not event.jumping? #and event.over_trigger?
event.start
result = true
end
end
end
return result
end
def check_event_trigger_there(triggers)
result = false
if $game_system.map_interpreter.running?
return result
end
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
for event in $game_map.events.values
if (event.x+0.5).between?(new_x-0.5,new_x+1.5) and (event.y+0.5).between?(new_y,new_y+1.5) and triggers.include?(event.trigger)
if not event.jumping? #and not event.over_trigger?
event.start
result = true
end
end
end
return result
end