设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2226|回复: 2
打印 上一主题 下一主题

[已经解决] 用了鼠标脚本后出现隔空取物=。=

[复制链接]

Lv1.梦旅人

梦石
0
星屑
1042
在线时间
13 小时
注册时间
2016-6-26
帖子
1
跳转到指定楼层
1
发表于 2016-7-14 03:04:48 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 丿梁丶小柒 于 2016-10-17 11:50 编辑

如图,我用了鼠标脚本后出现了隔空取物的情况,正如图,人物没有移动,而宝箱在小河的另外一边,是不可能拿到的,但是用鼠标一点即使人物没到,也可以拿到宝箱的东西

脚本是这个,求大神解答这个问题,怎么修复隔空取物bug


RUBY 代码复制
  1. # Sion 鼠标系统(SionMouseSystem)v2.31 (2014/2/20)
  2. # 需求! 1,白菜组脚本基 (WhiteCabbageBase) v1.0+
  3. #       2,基础鼠标模组 (Sion_MouseBase) v1.0+
  4.  
  5.  
  6. # v2.32(2014/6/9)  优化了地图卷动指令、等待指令的衔接过程。
  7. # v2.31(2014/2/20) 事件执行过程中,卷动地图后不会自动跳转到玩家位置了。
  8.  
  9.  
  10. =begin 说明  
  11.  
  12.   主要功能
  13.  
  14.     1,自动寻路,按住 D 键可以扩大寻路的范围
  15.     2,变量输入框改良
  16.     3,鼠标启动事件:
  17.       在事件中加入“注释”:鼠标启动
  18.       该事件将无法用其它方式启动,只能用鼠标左键点击启动
  19.       
  20.   鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹
  21.   路径点指示图片 $Arrow.png 放入 Graphics\Characters 文件夹
  22.   如果未放入会使用RM自带图片代替缺失文件
  23.  
  24. =end
  25.  
  26.  
  27.  
  28. #==============================================================================
  29. # ■ 常数设置
  30. #==============================================================================
  31. module KsOfSion
  32.   Clip_Cursor    = true    # 鼠标锁定在游戏窗口内,需要关闭设置为false
  33.   Dbclick_Frame  = 15      # 双击的最大间隔帧数。在地图画面双击进行奔跑
  34.   New_Scroll     = true    # 更改地图卷动方式,需要关闭设置为false
  35.   Map_Scroll_Spd = 1.0     # 卷动速度
  36.   Menu_Set_Pos   = true    # 打开菜单时将鼠标移动到光标处
  37.   Break_Steps    = 30      # 鼠标寻路最大步数,防止路径太长导致卡帧
  38. #                             “30” 是默认显示格子数 长(17) + 宽(13)
  39.   Find_Path_Key  = :Z      # 扩大寻路范围至全地图按键 :Z 对应 D键
  40. #                               RM几个内置的空键位 (:X = A)(:Y = S)(:Z = D)
  41. end
  42. #
  43. class Move_Sign < Game_Character # ■ 用来显示路径点的类
  44. attr_accessor :direction
  45.   def init_public_members
  46.     @character_name  = '!$Arrow'# 路径点箭头,置于.\Graphics\Characters文件夹
  47.     @character_index = 0        # 图片索引。$开头的行走图设为0
  48.     @move_speed      = 5        # 踏步速度
  49.     @step_anime      = true     # 踏步动画(如果想使用静态图标就关闭这个)
  50.     @opacity         = 255      # 不透明度
  51.     @blend_type      = 0        # 图片合成方式,默认为0(正常)
  52.     @direction       = 2        # 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
  53.     @priority_type   = 1        # 优先级(默认与人物同级:1)
  54.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
  55.  
  56. #============================= 参数设置完毕 ===================================
  57.     unless File.exist?('Graphics/Characters/' + @character_name + '.png')
  58.       @character_name  = '!Flame'
  59.       @character_index = 6
  60.     end
  61.     @direction_fix = false
  62.     @move_frequency = 6
  63.     @walk_anime = true
  64.     @pattern = 1
  65.     @through = true
  66.     @bush_depth = 0
  67.     @animation_id = 0
  68.     @balloon_id = 0
  69.     @transparent = true
  70.     @id = 0
  71.     @x = 0
  72.     @y = 0
  73.     @real_x = 0
  74.     @real_y = 0
  75.     @tile_id = 0
  76.   end
  77. end
  78. #==============================================================================
  79. # ■ SceneManager
  80. #==============================================================================
  81. class << SceneManager
  82.   unless self.method_defined?(:sion_mouse_run)
  83.     alias_method :sion_mouse_run, :run
  84.     alias_method :sion_mouse_call, :call
  85.     alias_method :sion_mouse_return, :return
  86.   end
  87.   def run
  88.     Mouse.activate
  89.     sion_mouse_run
  90.   end
  91.   def call(scene_class, *args)
  92.     $game_map.prepare_reset_mouse_pos if @scene.instance_of?(Scene_Map)
  93.     sion_mouse_call(scene_class, *args)
  94.   end
  95.   def return
  96.     sion_mouse_return
  97.     $game_map.reset_mouse_pos if KsOfSion::Menu_Set_Pos &&
  98.       @scene.instance_of?(Scene_Map)
  99.   end
  100. end
  101. class << Mouse
  102.   attr_reader :sprite
  103. end
  104. class << Input
  105.   alias_method :sion_mouse_press?,   :press?
  106.   alias_method :sion_mouse_trigger?, :trigger?
  107.   alias_method :sion_mouse_repeat?,  :repeat?
  108.   unless self.method_defined?(:sion_mouse_update)
  109.     alias_method :sion_mouse_update, :update
  110.   end
  111.   def update
  112.     Mouse.update
  113.     sion_mouse_update
  114.   end
  115.   def press?(key)
  116.     return true if sion_mouse_press?(key)
  117.     return Mouse.press?(:L) if key == :C
  118.     return Mouse.press?(:R) if key == :B
  119.     return false
  120.   end
  121.   def trigger?(key)
  122.     return true if sion_mouse_trigger?(key)
  123.     return Mouse.trigger?(:L) if key == :C
  124.     return Mouse.trigger?(:R) if key == :B
  125.     return false
  126.   end
  127.   def repeat?(key)
  128.     return true if sion_mouse_repeat?(key)
  129.     return Mouse.repeat?(:L) if key == :C
  130.     return Mouse.repeat?(:R) if key == :B
  131.     return false
  132.   end
  133. end
  134.  
  135.  
  136. #==============================================================================
  137. # ■ Window_Selectable
  138. #------------------------------------------------------------------------------
  139. #  拥有光标移动、滚动功能的窗口
  140. #==============================================================================
  141. class Window_Selectable
  142.   #--------------------------------------------------------------------------
  143.   # ● 初始化
  144.   #--------------------------------------------------------------------------
  145.   alias sion_mouse_initialize initialize
  146.   def initialize(x, y, width, height)
  147.     sion_mouse_initialize(x, y, width, height)
  148.     @move_state = 0
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 更新
  152.   #--------------------------------------------------------------------------
  153.   alias sion_mouse_update update
  154.   def update
  155.     sion_mouse_update
  156.     update_mouse_cursor
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 按下确定键的处理
  160.   #--------------------------------------------------------------------------
  161.   alias sion_mouse_process_ok process_ok
  162.   def process_ok
  163.     return if Mouse.trigger?(:L) && mouse_out_rect?
  164.     sion_mouse_process_ok
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 判断鼠标是位于光标矩形处
  168.   #--------------------------------------------------------------------------
  169.   def mouse_out_rect?
  170.     if viewport.nil?
  171.       vp_x, vp_y = 0, 0
  172.     else
  173.       vp_x = viewport.rect.x - viewport.ox
  174.       vp_y = viewport.rect.y - viewport.oy
  175.     end
  176.     mouse_rx = ox + Mouse.x - (x + vp_x + standard_padding )
  177.     mouse_ry = oy + Mouse.y - (y + vp_y + standard_padding )
  178.     return cursor_rect.x > mouse_rx ||
  179.            cursor_rect.y > mouse_ry ||
  180.            cursor_rect.x + cursor_rect.width < mouse_rx ||
  181.            cursor_rect.y + cursor_rect.height< mouse_ry
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 启动后设置鼠标到index位置
  185.   #--------------------------------------------------------------------------
  186.   def activate
  187.     @need_set_pos = true if KsOfSion::Menu_Set_Pos
  188.     super
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 更新鼠标和光标的位置
  192.   #--------------------------------------------------------------------------
  193.   def update_mouse_cursor
  194.     if active
  195.       if @need_set_pos
  196.         @need_set_pos = nil
  197.         set_mouse_pos
  198.       elsif cursor_movable?
  199.         Input.dir4.zero? ? set_cursor : set_mouse_pos
  200.       end
  201.     end
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
  205.   #--------------------------------------------------------------------------
  206.   def set_cursor
  207.     mouse_row, mouse_col = mouse_window_area
  208.     if    mouse_row == -1
  209.       @move_state += 1 if need_scroll?
  210.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  211.     elsif mouse_row == -2
  212.       @move_state += 1 if need_scroll?
  213.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  214.     elsif mouse_col == -1
  215.       @move_state += 1 if need_scroll?
  216.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand?
  217.     elsif mouse_col == -2
  218.       @move_state += 1 if need_scroll?
  219.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand?
  220.     else
  221.       @move_state = 0
  222.       new_index = (top_row + mouse_row) * col_max + mouse_col
  223.       select(new_index) if new_index < item_max && new_index != @index
  224.     end
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 判断鼠标位于菜单的第几行、第几列
  228.   #--------------------------------------------------------------------------
  229.   def mouse_window_area
  230.     if viewport.nil? # necessary!
  231.       vp_x, vp_y = 0, 0
  232.     else
  233.       vp_x = viewport.rect.x - viewport.ox
  234.       vp_y = viewport.rect.y - viewport.oy
  235.     end
  236.     mouse_x = Mouse.x
  237.     mouse_y = Mouse.y
  238.     item_x1 = vp_x + x + standard_padding
  239.     item_y1 = vp_y + y + standard_padding
  240.     item_x2 = vp_x + x - standard_padding + width
  241.     item_y2 = vp_y + y - standard_padding + height
  242.     if mouse_x < item_x1
  243.       mouse_col = -1
  244.     elsif mouse_x > item_x2
  245.       mouse_col = -2
  246.     else
  247.       mouse_col = col_max * (mouse_x - item_x1) / (item_x2 - item_x1)
  248.     end
  249.     if mouse_y < item_y1
  250.       mouse_row = -1
  251.     elsif mouse_y > item_y2
  252.       mouse_row = -2
  253.     else
  254.       mouse_row = page_row_max * (mouse_y - item_y1 - 1) / (item_y2 - item_y1)
  255.     end
  256.     return mouse_row, mouse_col
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  260.   #--------------------------------------------------------------------------
  261.   def set_mouse_pos
  262.     if viewport.nil? # necessary!
  263.       vp_x, vp_y = 0, 0
  264.     else
  265.       vp_x = viewport.rect.x - viewport.ox
  266.       vp_y = viewport.rect.y - viewport.oy
  267.     end
  268.     item_x1 = vp_x + x + standard_padding
  269.     item_y1 = vp_y + y + standard_padding
  270.     get_index = @index < 0 ? 0 : @index
  271.     row = get_index / col_max - top_row
  272.     col = get_index % col_max
  273.     new_x = item_x1 + item_width * (col + 0.5)
  274.     new_y = item_y1 + item_height * (row + 0.5)
  275.     Mouse.set_pos(new_x, new_y)
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 判断菜单是否需要卷动
  279.   #--------------------------------------------------------------------------
  280.   def need_scroll?
  281.     item_max > col_max * page_row_max
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ● 判断是否为水平卷动菜单
  285.   #--------------------------------------------------------------------------
  286.   def is_horzcommand?
  287.     return false
  288.   end
  289. end
  290.  
  291. class Window_HorzCommand
  292.   #--------------------------------------------------------------------------
  293.   # ● 判断是否为水平卷动菜单
  294.   #--------------------------------------------------------------------------
  295.   def is_horzcommand?
  296.     return true
  297.   end
  298. end
  299.  
  300. #==============================================================================
  301. # ■ Window_NameInput
  302. #------------------------------------------------------------------------------
  303. #  名字输入画面中,选择文字的窗口。
  304. #==============================================================================
  305. class Window_NameInput
  306.   #--------------------------------------------------------------------------
  307.   # ● 设置列数
  308.   #--------------------------------------------------------------------------
  309.   def col_max
  310.     return 10
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 设置填充的Item个数
  314.   #--------------------------------------------------------------------------
  315.   def item_max
  316.     return 90
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 设置填充的Item个数
  320.   #--------------------------------------------------------------------------
  321.   def item_width
  322.     return 32
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● 判断鼠标位于菜单的第几行、第几列
  326.   #--------------------------------------------------------------------------
  327.   def mouse_window_area
  328.     if viewport.nil?
  329.       vp_x, vp_y = 0, 0
  330.     else
  331.       vp_x = viewport.rect.x - viewport.ox
  332.       vp_y = viewport.rect.y - viewport.oy
  333.     end
  334.     mouse_x = Mouse.x
  335.     mouse_y = Mouse.y
  336.     item_x1 = vp_x + x + standard_padding
  337.     item_y1 = vp_y + y + standard_padding
  338.     item_x2 = vp_x + x - standard_padding + width
  339.     item_y2 = vp_y + y - standard_padding + height
  340.     if mouse_x < item_x1
  341.       mouse_col = -1
  342.     elsif mouse_x > item_x2
  343.       mouse_col = -2
  344.     elsif mouse_x < item_x1 + 160
  345.       mouse_col = (mouse_x - item_x1)/32
  346.     elsif mouse_x > item_x2 - 160
  347.       mouse_col = 9 - (item_x2 - mouse_x)/32
  348.     else
  349.       mouse_col = mouse_x > x + width/2 ? 5 : 4
  350.     end
  351.     if mouse_y < item_y1
  352.       mouse_row = -1
  353.     elsif mouse_y > item_y2
  354.       mouse_row = -2
  355.     else
  356.       mouse_row = page_row_max * (mouse_y - item_y1 - 1)/(item_y2 - item_y1)
  357.     end
  358.     return mouse_row, mouse_col
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  362.   #--------------------------------------------------------------------------
  363.   def set_mouse_pos
  364.     if viewport.nil? # necessary!
  365.       vp_x, vp_y = 0, 0
  366.     else
  367.       vp_x = viewport.rect.x - viewport.ox
  368.       vp_y = viewport.rect.y - viewport.oy
  369.     end
  370.     item_x1 = vp_x + x + standard_padding
  371.     item_y1 = vp_y + y + standard_padding
  372.     get_index = @index < 0 ? 0 : @index
  373.     row = get_index / col_max - top_row
  374.     col = get_index % col_max
  375.     new_x = item_x1 + item_width * (col + 0.5)
  376.     new_y = item_y1 + item_height * (row + 0.5)
  377.     new_x += 14 if col > 4
  378.     Mouse.set_pos(new_x, new_y)
  379.   end
  380. end
  381.  
  382. #==============================================================================
  383. # ■ Window_NumberInput
  384. #------------------------------------------------------------------------------
  385. #  重写了数值输入的方法以适应鼠标
  386. #==============================================================================
  387. class Window_NumberInput < Window_Base
  388.   #--------------------------------------------------------------------------
  389.   # ● 定义实例变量
  390.   #--------------------------------------------------------------------------
  391.   attr_reader :extra_window
  392.   #--------------------------------------------------------------------------
  393.   # ● 初始化
  394.   #--------------------------------------------------------------------------
  395.   alias sion_mouse_initialize initialize
  396.   def initialize(arg)
  397.     sion_mouse_initialize(arg)
  398.     create_extra_window
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 启动
  402.   #--------------------------------------------------------------------------
  403.   alias sion_mouse_start start
  404.   def start
  405.     sion_mouse_start
  406.     deactivate
  407.     extra_start
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● 创建新的数值输入窗口
  411.   #--------------------------------------------------------------------------
  412.   def create_extra_window
  413.     @extra_window = Window_NumberInput_Ex.new
  414.     @extra_window.x = (Graphics.width - @extra_window.width) / 2
  415.     @extra_window.number_proc  = Proc.new {|n| @number = n }
  416.     @extra_window.index_proc   = Proc.new {|n| @index = n }
  417.     @extra_window.close_proc   = Proc.new { close }
  418.     @extra_window.refresh_proc = Proc.new { refresh }
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ● 激活新窗口
  422.   #--------------------------------------------------------------------------
  423.   def extra_start
  424.     case $game_message.position
  425.       when 0; @extra_window.y = y + height + 4
  426.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
  427.       when 2; @extra_window.y = y - @extra_window.height - 4
  428.       else  ; @extra_window.y = 8
  429.     end
  430.     @extra_window.variable_id = $game_message.num_input_variable_id
  431.     @extra_window.digits_max  = @digits_max
  432.     @extra_window.number      = @number
  433.     @extra_window.open
  434.     @extra_window.activate
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 更新
  438.   #--------------------------------------------------------------------------
  439.   def update
  440.     super
  441.     @extra_window.update
  442.     update_cursor
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● 关闭窗口
  446.   #--------------------------------------------------------------------------
  447.   def close
  448.     super
  449.     @extra_window.close
  450.     @extra_window.deactivate
  451.   end
  452. end
  453.  
  454. #==============================================================================
  455. # ■ Window_NumberInput_Ex
  456. #------------------------------------------------------------------------------
  457. #  新的数值输入窗口(NewClass)
  458. #==============================================================================
  459. class Window_NumberInput_Ex < Window_Selectable
  460.   #--------------------------------------------------------------------------
  461.   # ● 定义实例变量
  462.   #--------------------------------------------------------------------------
  463.   attr_accessor :number_proc
  464.   attr_accessor :index_proc
  465.   attr_accessor :close_proc
  466.   attr_accessor :refresh_proc
  467.   attr_accessor :number
  468.   attr_accessor :digits_max
  469.   attr_accessor :variable_id
  470.   #--------------------------------------------------------------------------
  471.   # ● 数字表
  472.   #--------------------------------------------------------------------------
  473.   TABLE = [  7,  8,  9,
  474.              4,  5,  6,
  475.              1,  2,  3,
  476.             '←',0,'确定',]
  477.   #--------------------------------------------------------------------------
  478.   # ● 初始化对象
  479.   #--------------------------------------------------------------------------
  480.   def initialize
  481.     super(0, 0, 120, fitting_height(4))
  482.     self.openness = 0
  483.     @index = 0
  484.     @number = 0
  485.     @old_window_index = 0
  486.     @digits_max = 0
  487.     12.times {|i| draw_text(item_rect(i), TABLE[i], 1) }
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ● 获取项目的绘制矩形
  491.   #--------------------------------------------------------------------------
  492.   def item_rect(index)
  493.     rect = Rect.new
  494.     rect.x = index % 3 * 32
  495.     rect.y = index / 3 * line_height
  496.     rect.width = 32
  497.     rect.height = line_height
  498.     return rect
  499.   end
  500.   #--------------------------------------------------------------------------
  501.   # ● 将光标设置到鼠标所在的位置
  502.   #--------------------------------------------------------------------------
  503.   def set_cursor
  504.     mouse_row, mouse_col = mouse_window_area
  505.     if mouse_row >= 0 && mouse_col >= 0
  506.       new_index = mouse_row * 3 + mouse_col
  507.       select(new_index) if new_index <= 11
  508.     end
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
  512.   #--------------------------------------------------------------------------
  513.   def mouse_window_area
  514.     if viewport.nil?
  515.       vp_x, vp_y = 0, 0
  516.     else
  517.       vp_x = viewport.rect.x - viewport.ox
  518.       vp_y = viewport.rect.y - viewport.oy
  519.     end
  520.     mouse_x = Mouse.x
  521.     mouse_y = Mouse.y
  522.     item_x1 = vp_x + x + standard_padding
  523.     item_y1 = vp_y + y + standard_padding
  524.     item_x2 = vp_x + x - standard_padding + width
  525.     item_y2 = vp_y + y - standard_padding + height
  526.     if mouse_x < item_x1
  527.       mouse_col = -1
  528.     elsif mouse_x > item_x2
  529.       mouse_col = -2
  530.     else
  531.       mouse_col = (mouse_x - item_x1) / 32
  532.     end
  533.     if mouse_y < item_y1
  534.       mouse_row = -1
  535.     elsif mouse_y > item_y2
  536.       mouse_row = -2
  537.     else
  538.       mouse_row = 4 * (mouse_y - item_y1 - 1) / (item_y2 - item_y1)
  539.     end
  540.     return mouse_row, mouse_col
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● 获取文字
  544.   #--------------------------------------------------------------------------
  545.   def get_number
  546.     return false if @index == 9 || @index == 11
  547.     return TABLE[@index]
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● 判定光标位置是否在“退格”上
  551.   #--------------------------------------------------------------------------
  552.   def is_delete?
  553.     @index == 9
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 判定光标位置是否在“确定”上
  557.   #--------------------------------------------------------------------------
  558.   def is_ok?
  559.     @index == 11
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # ● 更新光标
  563.   #--------------------------------------------------------------------------
  564.   def update_cursor
  565.     cursor_rect.set(item_rect(@index))
  566.   end
  567.   #--------------------------------------------------------------------------
  568.   # ● 判定光标是否可以移动
  569.   #--------------------------------------------------------------------------
  570.   def cursor_movable?
  571.     active
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ● 光标向下移动
  575.   #     wrap : 允许循环
  576.   #--------------------------------------------------------------------------
  577.   def cursor_down(wrap)
  578.     if @index < 9 or wrap
  579.       @index = (index + 3) % 12
  580.     end
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # ● 光标向上移动
  584.   #     wrap : 允许循环
  585.   #--------------------------------------------------------------------------
  586.   def cursor_up(wrap)
  587.     if @index >= 3 or wrap
  588.       @index = (index + 9) % 12
  589.     end
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # ● 光标向右移动
  593.   #     wrap : 允许循环
  594.   #--------------------------------------------------------------------------
  595.   def cursor_right(wrap)
  596.     if @index % 3 < 2
  597.       @index += 1
  598.     elsif wrap
  599.       @index -= 2
  600.     end
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ● 光标向左移动
  604.   #     wrap : 允许循环
  605.   #--------------------------------------------------------------------------
  606.   def cursor_left(wrap)
  607.     if @index % 3 > 0
  608.       @index -= 1
  609.     elsif wrap
  610.       @index += 2
  611.     end
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● 处理光标的移动
  615.   #--------------------------------------------------------------------------
  616.   def process_cursor_move
  617.     super
  618.     update_cursor
  619.   end
  620.   #--------------------------------------------------------------------------
  621.   # ● “确定”、“删除字符”和“取消输入”的处理
  622.   #--------------------------------------------------------------------------
  623.   def process_handling
  624.     return unless open? && active
  625.     process_jump if Input.trigger?(:A)
  626.     process_back if Input.repeat?(:B)
  627.     process_ok   if Input.trigger?(:C)
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● 跳转“确定”
  631.   #--------------------------------------------------------------------------
  632.   def process_jump
  633.     if @index != 11
  634.       @index = 11
  635.       Sound.play_cursor
  636.     end
  637.   end
  638.   #--------------------------------------------------------------------------
  639.   # ● 后退一个字符
  640.   #--------------------------------------------------------------------------
  641.   def process_back
  642.     Sound.play_cancel
  643.     place = 10 ** (@digits_max - 1 - @old_window_index)
  644.     n = (@number / place) % 10
  645.     @number -= n * place
  646.     @number_proc.call(@number)
  647.     @old_window_index -= 1 if @old_window_index > 0
  648.     @index_proc.call(@old_window_index)
  649.     @refresh_proc.call
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # ● 按下确定键时的处理
  653.   #--------------------------------------------------------------------------
  654.   def process_ok
  655.     return if Mouse.trigger?(:L) && mouse_out_rect?
  656.     if get_number
  657.       Sound.play_cursor
  658.       place = 10 ** (@digits_max - 1 - @old_window_index)
  659.       n = get_number - (@number / place) % 10
  660.       @number += n * place
  661.       @number_proc.call(@number)
  662.       @old_window_index += 1 if @old_window_index < @digits_max - 1
  663.       @index_proc.call(@old_window_index)
  664.       @refresh_proc.call
  665.     elsif is_delete?
  666.       process_back
  667.     elsif is_ok?
  668.       on_input_ok
  669.     end
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # ● 确定
  673.   #--------------------------------------------------------------------------
  674.   def on_input_ok
  675.     @index = 0
  676.     @old_window_index = 0
  677.     $game_variables[@variable_id] = @number
  678.     Sound.play_ok
  679.     @close_proc.call
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  683.   #--------------------------------------------------------------------------
  684.   def set_mouse_pos
  685.     if viewport.nil? # necessary!
  686.       vp_x, vp_y = 0, 0
  687.     else
  688.       vp_x = viewport.rect.x - viewport.ox
  689.       vp_y = viewport.rect.y - viewport.oy
  690.     end
  691.     item_x1 = vp_x + x + standard_padding
  692.     item_y1 = vp_y + y + standard_padding
  693.     get_index = @index < 0 ? 0 : @index
  694.     new_x = item_x1 + 32 * (get_index % 3 + 0.5)
  695.     new_y = item_y1 + 24 * (get_index / 3 + 0.5)
  696.     Mouse.set_pos(new_x, new_y)
  697.   end
  698. end
  699.  
  700. #==============================================================================
  701. # ■ Window_Message
  702. #------------------------------------------------------------------------------
  703. #  显示文字信息的窗口。
  704. #==============================================================================
  705. class Window_Message < Window_Base
  706.   #--------------------------------------------------------------------------
  707.   # ● 处理数值的输入(覆盖原方法)
  708.   #--------------------------------------------------------------------------
  709.   def input_number
  710.     @number_window.start
  711.     Fiber.yield while @number_window.extra_window.active
  712.   end
  713. end
  714.  
  715. #==============================================================================
  716. # ■ Window_PartyCommand
  717. #------------------------------------------------------------------------------
  718. #  战斗画面中,选择“战斗/撤退”的窗口。
  719. #==============================================================================
  720. class Window_PartyCommand < Window_Command
  721.   #--------------------------------------------------------------------------
  722.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  723.   #--------------------------------------------------------------------------
  724.   def set_mouse_pos
  725.     if viewport.nil?
  726.       vp_x, vp_y = 0, 0
  727.     else
  728.       #vp_x = viewport.rect.x - viewport.ox
  729.       vp_y = viewport.rect.y - viewport.oy
  730.     end
  731.     item_x1 = x + standard_padding
  732.     item_y1 = vp_y + y + standard_padding
  733.     get_index = @index < 0 ? 0 : @index
  734.     row = get_index / col_max - top_row
  735.     col = get_index % col_max
  736.     new_x = item_x1 + item_width * (col + 0.5)
  737.     new_y = item_y1 + item_height * (row + 0.5)
  738.     Mouse.set_pos(new_x, new_y)
  739.   end
  740. end
  741.  
  742. #==============================================================================
  743. # ■ Window_ActorCommand
  744. #------------------------------------------------------------------------------
  745. #  战斗画面中,选择角色行动的窗口。
  746. #==============================================================================
  747. class Window_ActorCommand < Window_Command
  748.   #--------------------------------------------------------------------------
  749.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  750.   #--------------------------------------------------------------------------
  751.   def set_mouse_pos
  752.     if viewport.nil?
  753.       vp_x, vp_y = 0, 0
  754.     else
  755.       #vp_x = viewport.rect.x - viewport.ox
  756.       vp_y = viewport.rect.y - viewport.oy
  757.     end
  758.     item_x1 = Graphics.width - width + standard_padding
  759.     item_y1 = vp_y + y + standard_padding
  760.     get_index = @index < 0 ? 0 : @index
  761.     row = get_index / col_max - top_row
  762.     col = get_index % col_max
  763.     new_x = item_x1 + item_width * (col + 0.5)
  764.     new_y = item_y1 + item_height * (row + 0.5)
  765.     Mouse.set_pos(new_x, new_y)
  766.   end
  767. end
  768.  
  769. #==============================================================================
  770. # ■ Game_Player
  771. #------------------------------------------------------------------------------
  772. #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
  773. #   本类的实例请参考 $game_player 。
  774. #==============================================================================
  775. class Game_Player < Game_Character
  776.   #--------------------------------------------------------------------------
  777.   # ● 由方向移动(覆盖原方法)
  778.   #--------------------------------------------------------------------------
  779.   def move_by_input
  780.     return if !movable? || $game_map.interpreter.running?
  781.     if Input.dir4 > 0
  782.       move_straight(Input.dir4)
  783.       reset_move_path
  784.     else
  785.       move_by_mouse
  786.     end
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # ● 非移动中的处理(覆盖原方法)
  790.   #     last_moving : 此前是否正在移动
  791.   #--------------------------------------------------------------------------
  792.   def update_nonmoving(last_moving)
  793.     return if $game_map.interpreter.running?
  794.     if last_moving
  795.       $game_party.on_player_walk
  796.       return if check_touch_event
  797.     end
  798.     if movable? && Input.trigger?(:C)
  799.       return if Mouse.press?(:L) # 防止按下鼠标左键绘制路径时触发事件或载具切换
  800.       return if get_on_off_vehicle
  801.       return if check_action_event
  802.     end
  803.     update_encounter if last_moving
  804.   end
  805.   #--------------------------------------------------------------------------
  806.   # ● 判定是否跑步状态(覆盖原方法)
  807.   #--------------------------------------------------------------------------
  808.   def dash?
  809.     return false if @move_route_forcing
  810.     return false if $game_map.disable_dash?
  811.     return false if vehicle
  812.     return Input.press?(:A) || @mouse_dash
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # ● 初始化
  816.   #--------------------------------------------------------------------------
  817.   alias sion_mouse_initialize initialize
  818.   def initialize
  819.     sion_mouse_initialize
  820.     reset_move_path
  821.     @moveto_x = 0
  822.     @moveto_y = 0
  823.   end
  824.   #--------------------------------------------------------------------------
  825.   # ● 更新
  826.   #--------------------------------------------------------------------------
  827.   alias sion_mouse_update update
  828.   def update
  829.     sion_mouse_update
  830.     clear_unreachable_sign
  831.   end
  832.   #--------------------------------------------------------------------------
  833.   # ● 处理卷动
  834.   #--------------------------------------------------------------------------
  835.   alias sion_mouse_update_scroll update_scroll
  836.   def update_scroll(last_real_x, last_real_y)
  837.     return if $game_map.scrolling? || $game_map.wait_scroll
  838.     KsOfSion::New_Scroll ? new_update_scroll :
  839.       sion_mouse_update_scroll(last_real_x, last_real_y)
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # ● 重置移动路径相关信息
  843.   #--------------------------------------------------------------------------
  844.   def reset_move_path
  845.     @mouse_dash = false
  846.     @mouse_move_path = []
  847.     $mouse_move_sign.transparent = true
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # ● 新的卷动地图方法
  851.   #--------------------------------------------------------------------------
  852.   def new_update_scroll
  853.     return if $game_message.busy? || $game_message.visible
  854.     horz_speed = 2 ** @move_speed * KsOfSion::Map_Scroll_Spd / Graphics.width
  855.     vert_speed = 2 ** @move_speed * KsOfSion::Map_Scroll_Spd / Graphics.height
  856.     ax = $game_map.adjust_x(@real_x)
  857.     ay = $game_map.adjust_y(@real_y)
  858.     if    ay>center_y; $game_map.new_scroll_down (vert_speed * (ay - center_y))
  859.     elsif ay<center_y; $game_map.new_scroll_up   (vert_speed * (center_y - ay))
  860.     end
  861.     if    ax>center_x; $game_map.new_scroll_right(horz_speed * (ax - center_x))
  862.     elsif ax<center_x; $game_map.new_scroll_left (horz_speed * (center_x - ax))
  863.     end
  864.   end
  865.   #--------------------------------------------------------------------------
  866.   # ● 消除不能抵达图标
  867.   #--------------------------------------------------------------------------
  868.   def clear_unreachable_sign
  869.     return if Mouse.press?(:L)
  870.     if $mouse_move_sign.direction == 4 && Mouse.click_count % 20 == 0
  871.       $mouse_move_sign.transparent = true
  872.       $mouse_move_sign.direction = 2
  873.     end
  874.   end
  875.   #--------------------------------------------------------------------------
  876.   # ● 由鼠标移动
  877.   #--------------------------------------------------------------------------
  878.   def move_by_mouse
  879.     unless @mouse_move_path.empty? # 移动路线数组不为空则执行移动
  880.       dir = @mouse_move_path.shift
  881.       if passable?(x, y, dir) && !@mouse_move_path.empty?
  882.         move_straight(dir)
  883.       elsif @mouse_move_path.empty? # 判断是否是最后一步
  884.         x2 = $game_map.round_x_with_direction(x, dir)
  885.         y2 = $game_map.round_y_with_direction(y, dir)
  886.         move_straight(dir) unless dir.zero?
  887.         unless @x == x2 && @y == y2 # 如果移动失败,检查是否启动前方事件
  888.           check_event_trigger_there([0,1,2])
  889.           get_on_off_vehicle unless $game_map.setup_starting_event
  890.         end
  891.         $mouse_move_sign.transparent = true if $mouse_move_sign.direction == 2
  892.         @mouse_dash = false
  893.       elsif @mouse_move_path[0].zero? # 目标点无法抵达,调整朝向→目标点
  894.         @mouse_move_path.shift
  895.         @direction = dir
  896.         @mouse_dash = false
  897.       else
  898.         draw_move_path
  899.       end
  900.     end
  901.   end
  902.   #--------------------------------------------------------------------------
  903.   # ● 地图界面按下鼠标左键的处理
  904.   #--------------------------------------------------------------------------
  905.   def left_button_action
  906.     @moveto_x = $game_map.mouse_map_x
  907.     @moveto_y = $game_map.mouse_map_y
  908.     return mouse_same_pos_action if @moveto_x == @x && @moveto_y == @y
  909.     return if mouse_trigger_event?
  910.     return unless drawable?
  911.     $mouse_move_sign.moveto(@moveto_x, @moveto_y) # 移动路径点指示图
  912.     @mouse_dash = true if Mouse.double_click? # 双击冲刺
  913.     return if Mouse.left_state % 10 != 1 # 按住鼠标左键10帧绘制1次路径
  914.     for i in 1..4 # 判断目标点是否为角色周围四点
  915.       if @x == $game_map.round_x_with_direction(@moveto_x, i * 2) &&
  916.          @y == $game_map.round_y_with_direction(@moveto_y, i * 2)
  917.         $mouse_move_sign.transparent = true
  918.         @mouse_move_path = [10 - i * 2]
  919.         return
  920.       end
  921.     end
  922.     draw_move_path
  923.   end
  924.   #--------------------------------------------------------------------------
  925.   # ● 鼠标位置与玩家一致的处理
  926.   #--------------------------------------------------------------------------
  927.   def mouse_same_pos_action
  928.     unless moving? || (vehicle && !vehicle.movable?)
  929.       check_event_trigger_here([0]) # 判断是否触发重合点事件
  930.       get_on_off_vehicle if !$game_map.setup_starting_event &&
  931.         $game_map.airship.pos?(@x, @y)  # 判断是否要上、下飞艇
  932.     end
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # ● trigger 鼠标左键的处理
  936.   #--------------------------------------------------------------------------
  937.   def mouse_trigger_event?
  938.     if Mouse.trigger?(:L)
  939.       $game_map.events_xy(@moveto_x, @moveto_y).each {|event|
  940.         if event.mouse_start?
  941.           event.start
  942.           return true
  943.         end
  944.       }
  945.     end
  946.     return false
  947.   end
  948.   #--------------------------------------------------------------------------
  949.   # ● 绘制移动路径 @array[move_directions...]
  950.   #--------------------------------------------------------------------------
  951.   def draw_move_path
  952.     @mouse_move_path =
  953.     case @vehicle_type
  954.     when :walk; draw_walk_path
  955.     when :boat; draw_boat_path
  956.     when :ship; draw_ship_path
  957.     when :airship; draw_air_path
  958.     end
  959.   end
  960.   #--------------------------------------------------------------------------
  961.   # ● 判定是否可以绘制移动路径
  962.   #--------------------------------------------------------------------------
  963.   def drawable?
  964.     return false if @move_route_forcing || @followers.gathering?
  965.     return false if @vehicle_getting_on || @vehicle_getting_off
  966.     return true
  967.   end
  968.   #--------------------------------------------------------------------------
  969.   # ● 绘制行走路径 @array[move_directions...]
  970.   #--------------------------------------------------------------------------
  971.   def draw_walk_path
  972.     # 准备绘制路径表格
  973.     sheet = Table.new($game_map.width, $game_map.height)
  974.     reversed_chase_path  = []; chase_path  = []
  975.     reversed_chase_point = []; chase_point = []
  976.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  977.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  978.     reach_point = false
  979.     step = 3
  980.     loop do #loop1 开始填充表格
  981.      draw_path = false
  982.      check_points = new_start_points
  983.      new_start_points = []
  984.       loop do #loop2 从起点开始正向填充
  985.         point_x = check_points.shift
  986.         break if point_x == nil
  987.         point_y = check_points.shift
  988.         left_x  = $game_map.round_x(point_x - 1)
  989.         right_x = $game_map.round_x(point_x + 1)
  990.         up_y    = $game_map.round_y(point_y - 1)
  991.         down_y  = $game_map.round_y(point_y + 1)
  992.                     # 判断路径是否连通
  993.         path_step = step - 1
  994.         if sheet[left_x, point_y] == path_step     &&
  995.            $game_map.passable?(left_x, point_y, 6) &&
  996.            $game_map.passable?(point_x, point_y, 4)
  997.           chase_path.push(4)
  998.           chase_point = [left_x, point_y]
  999.           reversed_chase_point = [point_x, point_y]
  1000.           reach_point = true; break
  1001.         elsif sheet[right_x, point_y] == path_step     &&
  1002.               $game_map.passable?(right_x, point_y, 4) &&
  1003.               $game_map.passable?(point_x, point_y, 6)
  1004.             chase_path.push(6)
  1005.             chase_point = [right_x, point_y]
  1006.             reversed_chase_point = [point_x, point_y]
  1007.             reach_point = true; break
  1008.         elsif sheet[point_x, up_y] == path_step     &&
  1009.               $game_map.passable?(point_x, up_y, 2) &&
  1010.               $game_map.passable?(point_x, point_y, 8)
  1011.             chase_path.push(8)
  1012.             chase_point = [point_x, up_y]
  1013.             reversed_chase_point = [point_x, point_y]
  1014.             reach_point = true; break
  1015.         elsif sheet[point_x, down_y] == path_step     &&
  1016.               $game_map.passable?(point_x, down_y, 8) &&
  1017.               $game_map.passable?(point_x, point_y, 2)
  1018.             chase_path.push(2)
  1019.             chase_point = [point_x, down_y]
  1020.             reversed_chase_point = [point_x, point_y]
  1021.             reach_point = true; break
  1022.         end
  1023.         # 以需要抵达该点的步数填充路径表格 #
  1024.         if sheet[left_x, point_y] == 0              &&
  1025.            $game_map.passable?(left_x, point_y, 6)  &&
  1026.            !collide_with_events?(left_x, point_y)   &&
  1027.            $game_map.passable?(point_x, point_y, 4) &&
  1028.            !collide_with_vehicles?(left_x, point_y) #judge_end
  1029.           sheet[left_x, point_y] = step
  1030.           draw_path = true
  1031.           new_start_points.push(left_x, point_y)
  1032.         end
  1033.         if sheet[right_x, point_y] == 0             &&
  1034.            $game_map.passable?(right_x, point_y, 4) &&
  1035.            !collide_with_events?(right_x, point_y)  &&
  1036.            $game_map.passable?(point_x, point_y, 6) &&
  1037.            !collide_with_vehicles?(right_x, point_y)#judge_end
  1038.           sheet[right_x, point_y] = step
  1039.           draw_path = true
  1040.           new_start_points.push(right_x, point_y)
  1041.         end
  1042.         if sheet[point_x, up_y] == 0                &&
  1043.            $game_map.passable?(point_x, up_y, 2)    &&
  1044.            !collide_with_events?(point_x, up_y)     &&
  1045.            $game_map.passable?(point_x, point_y, 8) &&
  1046.            !collide_with_vehicles?(point_x, up_y)   #judge_end
  1047.           sheet[point_x, up_y] = step
  1048.           draw_path = true
  1049.           new_start_points.push(point_x, up_y)
  1050.         end
  1051.         if sheet[point_x, down_y] == 0              &&
  1052.            $game_map.passable?(point_x, down_y, 8)  &&
  1053.            !collide_with_events?(point_x, down_y)   &&
  1054.            $game_map.passable?(point_x, point_y, 2) &&
  1055.            !collide_with_vehicles?(point_x, down_y) #judge_end
  1056.           sheet[point_x, down_y] = step
  1057.           draw_path = true
  1058.           new_start_points.push(point_x, down_y)
  1059.         end
  1060.       end#endOfLoop2
  1061.       break if !draw_path || reach_point
  1062.       draw_path = false
  1063.       check_points = new_end_points
  1064.       new_end_points = []
  1065.       step += 1
  1066.       break if step > KsOfSion::Break_Steps &&
  1067.                !Input.press?(KsOfSion::Find_Path_Key)
  1068.       loop do #loop3 从终点开始反向填充
  1069.         point_x = check_points.shift
  1070.         break if point_x == nil
  1071.         point_y = check_points.shift
  1072.         left_x  = $game_map.round_x(point_x - 1)
  1073.         right_x = $game_map.round_x(point_x + 1)
  1074.         up_y    = $game_map.round_y(point_y - 1)
  1075.         down_y  = $game_map.round_y(point_y + 1)
  1076.         # 判断路径是否连通
  1077.         path_step = step - 1
  1078.         if sheet[left_x, point_y] == path_step     &&
  1079.            $game_map.passable?(left_x, point_y, 6) &&
  1080.            $game_map.passable?(point_x, point_y, 4)
  1081.           chase_path.push(6)
  1082.           chase_point = [point_x, point_y]
  1083.           reversed_chase_point = [left_x, point_y]
  1084.           reach_point = true; break
  1085.         elsif sheet[right_x, point_y] == path_step     &&
  1086.               $game_map.passable?(right_x, point_y, 4) &&
  1087.               $game_map.passable?(point_x, point_y, 6)
  1088.             chase_path.push(4)
  1089.             chase_point = [point_x, point_y]
  1090.             reversed_chase_point = [right_x, point_y]
  1091.             reach_point = true; break
  1092.         elsif sheet[point_x, up_y] == path_step     &&
  1093.               $game_map.passable?(point_x, up_y, 2) &&
  1094.               $game_map.passable?(point_x, point_y, 8)
  1095.             chase_path.push(2)
  1096.             chase_point = [point_x, point_y]
  1097.             reversed_chase_point = [point_x, up_y]
  1098.             reach_point = true; break
  1099.         elsif sheet[point_x, down_y] == path_step     &&
  1100.               $game_map.passable?(point_x, down_y, 8) &&
  1101.               $game_map.passable?(point_x, point_y, 2)
  1102.             chase_path.push(8)
  1103.             chase_point = [point_x, point_y]
  1104.             reversed_chase_point = [point_x, down_y]
  1105.             reach_point = true; break
  1106.         end
  1107.         # 以需要抵达该点的步数填充路径表格 #
  1108.         if sheet[left_x, point_y] == 0              &&
  1109.            $game_map.passable?(left_x, point_y, 6)  &&
  1110.            !collide_with_events?(left_x, point_y)   &&
  1111.            $game_map.passable?(point_x, point_y, 4) &&
  1112.            !collide_with_vehicles?(left_x, point_y) #judge_end
  1113.           sheet[left_x, point_y] = step
  1114.           draw_path = true
  1115.           new_end_points.push(left_x, point_y)
  1116.         end
  1117.         if sheet[right_x, point_y] == 0             &&
  1118.            $game_map.passable?(right_x, point_y, 4) &&
  1119.            !collide_with_events?(right_x, point_y)  &&
  1120.            $game_map.passable?(point_x, point_y, 6) &&
  1121.            !collide_with_vehicles?(right_x, point_y)#judge_end
  1122.           sheet[right_x, point_y] = step
  1123.           draw_path = true
  1124.           new_end_points.push(right_x, point_y)
  1125.         end
  1126.         if sheet[point_x, up_y] == 0                &&
  1127.            $game_map.passable?(point_x, up_y, 2)    &&
  1128.            !collide_with_events?(point_x, up_y)     &&
  1129.            $game_map.passable?(point_x, point_y, 8) &&
  1130.            !collide_with_vehicles?(point_x, up_y)   #judge_end
  1131.           sheet[point_x, up_y] = step
  1132.           draw_path = true
  1133.           new_end_points.push(point_x, up_y)
  1134.         end
  1135.         if sheet[point_x, down_y] == 0              &&
  1136.            $game_map.passable?(point_x, down_y, 8)  &&
  1137.            !collide_with_events?(point_x, down_y)   &&
  1138.            $game_map.passable?(point_x, point_y, 2) &&
  1139.            !collide_with_vehicles?(point_x, down_y) #judge_end
  1140.           sheet[point_x, down_y] = step
  1141.           draw_path = true
  1142.           new_end_points.push(point_x, down_y)
  1143.         end
  1144.       end#endOfLoop3
  1145.       break if !draw_path || reach_point
  1146.       step += 1
  1147.     end #endOfLoop1 路径表格填充完毕
  1148.     $mouse_move_sign.transparent = false
  1149.     # 判断指定地点能否抵达
  1150.     if reach_point
  1151.       $mouse_move_sign.direction = 2
  1152.     else
  1153.       return not_reach_point
  1154.     end
  1155.     # 根据路径表格绘制最短移动路径(反向)
  1156.     steps = step / 2 * 2 + 1
  1157.     loop_times = step / 2
  1158.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1159.     for i in 1..loop_times # forLoop
  1160.     steps -= 2
  1161.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1162.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1163.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1164.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1165.         reversed_chase_path.push(6)
  1166.         point_x = $game_map.round_x(point_x - 1)
  1167.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1168.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1169.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1170.         reversed_chase_path.push(4)
  1171.         point_x = $game_map.round_x(point_x + 1)
  1172.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1173.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1174.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1175.         reversed_chase_path.push(8)
  1176.         point_y = $game_map.round_y(point_y + 1)
  1177.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1178.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1179.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1180.         reversed_chase_path.push(2)
  1181.         point_y = $game_map.round_y(point_y - 1)
  1182.       end
  1183.     else
  1184.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1185.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1186.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1187.         reversed_chase_path.push(8)
  1188.         point_y = $game_map.round_y(point_y + 1)
  1189.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1190.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1191.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1192.         reversed_chase_path.push(2)
  1193.         point_y = $game_map.round_y(point_y - 1)
  1194.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1195.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1196.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1197.         reversed_chase_path.push(6)
  1198.         point_x = $game_map.round_x(point_x - 1)
  1199.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1200.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1201.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1202.         reversed_chase_path.push(4)
  1203.         point_x = $game_map.round_x(point_x + 1)
  1204.       end
  1205.     end
  1206.     end #endOfForLoop
  1207.     # 根据路径表格绘制最短移动路径(正向)
  1208.     steps = step / 2 * 2
  1209.     loop_times = step / 2
  1210.     point_x, point_y = chase_point[0], chase_point[1]
  1211.     for i in 2..loop_times # forLoop
  1212.     steps -= 2
  1213.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1214.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1215.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1216.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1217.         chase_path.push(2)
  1218.         point_y = $game_map.round_y(point_y + 1)
  1219.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1220.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1221.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1222.         chase_path.push(8)
  1223.         point_y = $game_map.round_y(point_y - 1)
  1224.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1225.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1226.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1227.         chase_path.push(4)
  1228.         point_x = $game_map.round_x(point_x - 1)
  1229.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1230.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1231.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1232.         chase_path.push(6)
  1233.         point_x = $game_map.round_x(point_x + 1)
  1234.       end
  1235.     else
  1236.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1237.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1238.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1239.         chase_path.push(4)
  1240.         point_x = $game_map.round_x(point_x - 1)
  1241.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1242.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1243.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1244.         chase_path.push(6)
  1245.         point_x = $game_map.round_x(point_x + 1)
  1246.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1247.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1248.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1249.         chase_path.push(2)
  1250.         point_y = $game_map.round_y(point_y + 1)
  1251.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1252.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1253.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1254.         chase_path.push(8)
  1255.         point_y = $game_map.round_y(point_y - 1)
  1256.       end
  1257.     end
  1258.     end #endOfForLoop
  1259.     reversed_chase_path.reverse + chase_path
  1260.   end#walk
  1261.   ##
  1262.   def not_reach_point
  1263.     $mouse_move_sign.direction = 4
  1264.     dx = 0; dy = 0; dir = 0
  1265.     if @moveto_x - x > 0
  1266.       if @moveto_x - x > $game_map.width - @moveto_x + x &&
  1267.           $game_map.loop_vertical?
  1268.         dx = $game_map.width - @moveto_x + x; dir = 4
  1269.       else
  1270.         dx = @moveto_x - x; dir = 6
  1271.       end
  1272.     else
  1273.       if x - @moveto_x > $game_map.width - x + @moveto_x &&
  1274.           $game_map.loop_vertical?
  1275.         dx = $game_map.width - x + @moveto_x; dir = 6
  1276.       else
  1277.         dx = x - @moveto_x; dir = 4
  1278.       end
  1279.     end
  1280.     if @moveto_y - y > 0
  1281.       if @moveto_y - y > $game_map.height - @moveto_y + y &&
  1282.           $game_map.loop_horizontal?
  1283.         dy = $game_map.height - @moveto_y + y
  1284.         dir = 8 if dy > dx
  1285.       else
  1286.         dy = @moveto_y - y
  1287.         dir = 2 if dy > dx
  1288.       end
  1289.     else
  1290.       if y - @moveto_y > $game_map.height - y + @moveto_y &&
  1291.           $game_map.loop_horizontal?
  1292.         dy = $game_map.height - y + @moveto_y
  1293.         dir = 2 if dy > dx
  1294.       else
  1295.         dy = y - @moveto_y
  1296.         dir = 8 if dy > dx
  1297.       end
  1298.     end
  1299.     return [dir, 0] # 0方向用于防止移动过程中触发事件
  1300.   end
  1301.   #--------------------------------------------------------------------------
  1302.   # ● 绘制boat的移动路径 @array[move_directions...]
  1303.   #--------------------------------------------------------------------------
  1304.   def draw_boat_path
  1305.     # 准备绘制路径表格
  1306.     sheet = Table.new($game_map.width, $game_map.height)
  1307.     reversed_chase_path  = []; chase_path  = []
  1308.     reversed_chase_point = []; chase_point = []
  1309.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  1310.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  1311.     reach_point = false
  1312.     step = 3
  1313.     loop do #loop1 开始填充表格
  1314.      draw_path = false
  1315.      check_points = new_start_points
  1316.      new_start_points = []
  1317.       loop do #loop2 从起点开始正向填充
  1318.         point_x = check_points.shift
  1319.         break if point_x == nil
  1320.         point_y = check_points.shift
  1321.         left_x  = $game_map.round_x(point_x - 1)
  1322.         right_x = $game_map.round_x(point_x + 1)
  1323.         up_y    = $game_map.round_y(point_y - 1)
  1324.         down_y  = $game_map.round_y(point_y + 1)
  1325.                     # 判断路径是否连通
  1326.         path_step = step - 1
  1327.         if sheet[left_x, point_y] == path_step
  1328.           chase_path.push(4)
  1329.           chase_point = [left_x, point_y]
  1330.           reversed_chase_point = [point_x, point_y]
  1331.           reach_point = true; break
  1332.         elsif sheet[right_x, point_y] == path_step
  1333.             chase_path.push(6)
  1334.             chase_point = [right_x, point_y]
  1335.             reversed_chase_point = [point_x, point_y]
  1336.             reach_point = true; break
  1337.         elsif sheet[point_x, up_y] == path_step
  1338.             chase_path.push(8)
  1339.             chase_point = [point_x, up_y]
  1340.             reversed_chase_point = [point_x, point_y]
  1341.             reach_point = true; break
  1342.         elsif sheet[point_x, down_y] == path_step
  1343.             chase_path.push(2)
  1344.             chase_point = [point_x, down_y]
  1345.             reversed_chase_point = [point_x, point_y]
  1346.             reach_point = true; break
  1347.         end
  1348.         # 以需要抵达该点的步数填充路径表格 #
  1349.         if sheet[left_x, point_y] == 0                &&
  1350.            $game_map.boat_passable?(left_x, point_y)  &&
  1351.            !collide_with_events?(left_x, point_y)     &&
  1352.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1353.           sheet[left_x, point_y] = step
  1354.           draw_path = true
  1355.           new_start_points.push(left_x, point_y)
  1356.         end
  1357.         if sheet[right_x, point_y] == 0               &&
  1358.            $game_map.boat_passable?(right_x, point_y) &&
  1359.            !collide_with_events?(right_x, point_y)    &&
  1360.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1361.           sheet[right_x, point_y] = step
  1362.           draw_path = true
  1363.           new_start_points.push(right_x, point_y)
  1364.         end
  1365.         if sheet[point_x, up_y] == 0                  &&
  1366.            $game_map.boat_passable?(point_x, up_y)    &&
  1367.            !collide_with_events?(point_x, up_y)       &&
  1368.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1369.           sheet[point_x, up_y] = step
  1370.           draw_path = true
  1371.           new_start_points.push(point_x, up_y)
  1372.         end
  1373.         if sheet[point_x, down_y] == 0                &&
  1374.            $game_map.boat_passable?(point_x, down_y)  &&
  1375.            !collide_with_events?(point_x, down_y)     &&
  1376.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1377.           sheet[point_x, down_y] = step
  1378.           draw_path = true
  1379.           new_start_points.push(point_x, down_y)
  1380.         end
  1381.       end#endOfLoop2
  1382.       break if !draw_path || reach_point
  1383.       draw_path = false
  1384.       check_points = new_end_points
  1385.       new_end_points = []
  1386.       step += 1
  1387.       break if step > KsOfSion::Break_Steps &&
  1388.                !Input.press?(KsOfSion::Find_Path_Key)
  1389.       loop do #loop3 从终点开始反向填充
  1390.         point_x = check_points.shift
  1391.         break if point_x == nil
  1392.         point_y = check_points.shift
  1393.         left_x  = $game_map.round_x(point_x - 1)
  1394.         right_x = $game_map.round_x(point_x + 1)
  1395.         up_y    = $game_map.round_y(point_y - 1)
  1396.         down_y  = $game_map.round_y(point_y + 1)
  1397.         # 判断路径是否连通
  1398.         path_step = step - 1
  1399.         if sheet[left_x, point_y] == path_step
  1400.           chase_path.push(6)
  1401.           chase_point = [point_x, point_y]
  1402.           reversed_chase_point = [left_x, point_y]
  1403.           reach_point = true; break
  1404.         elsif sheet[right_x, point_y] == path_step
  1405.             chase_path.push(4)
  1406.             chase_point = [point_x, point_y]
  1407.             reversed_chase_point = [right_x, point_y]
  1408.             reach_point = true; break
  1409.         elsif sheet[point_x, up_y] == path_step
  1410.             chase_path.push(2)
  1411.             chase_point = [point_x, point_y]
  1412.             reversed_chase_point = [point_x, up_y]
  1413.             reach_point = true; break
  1414.         elsif sheet[point_x, down_y] == path_step
  1415.             chase_path.push(8)
  1416.             chase_point = [point_x, point_y]
  1417.             reversed_chase_point = [point_x, down_y]
  1418.             reach_point = true; break
  1419.         end
  1420.         # 以需要抵达该点的步数填充路径表格 #
  1421.         if sheet[left_x, point_y] == 0                &&
  1422.            $game_map.boat_passable?(left_x, point_y)  &&
  1423.            !collide_with_events?(left_x, point_y)     &&
  1424.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1425.           sheet[left_x, point_y] = step
  1426.           draw_path = true
  1427.           new_end_points.push(left_x, point_y)
  1428.         end
  1429.         if sheet[right_x, point_y] == 0               &&
  1430.            $game_map.boat_passable?(right_x, point_y) &&
  1431.            !collide_with_events?(right_x, point_y)    &&
  1432.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1433.           sheet[right_x, point_y] = step
  1434.           draw_path = true
  1435.           new_end_points.push(right_x, point_y)
  1436.         end
  1437.         if sheet[point_x, up_y] == 0                  &&
  1438.            $game_map.boat_passable?(point_x, up_y)    &&
  1439.            !collide_with_events?(point_x, up_y)       &&
  1440.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1441.           sheet[point_x, up_y] = step
  1442.           draw_path = true
  1443.           new_end_points.push(point_x, up_y)
  1444.         end
  1445.         if sheet[point_x, down_y] == 0                &&
  1446.            $game_map.boat_passable?(point_x, down_y)  &&
  1447.            !collide_with_events?(point_x, down_y)     &&
  1448.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1449.           sheet[point_x, down_y] = step
  1450.           draw_path = true
  1451.           new_end_points.push(point_x, down_y)
  1452.         end
  1453.       end#endOfLoop3
  1454.       break if !draw_path || reach_point
  1455.       step += 1
  1456.     end #endOfLoop1 路径表格填充完毕
  1457.     $mouse_move_sign.transparent = false
  1458.     # 判断指定地点能否抵达
  1459.     reach_point ? $mouse_move_sign.direction = 2 : (return not_reach_point)
  1460.     # 根据路径表格绘制最短移动路径(正向)
  1461.     steps = step / 2 * 2
  1462.     loop_times = step / 2
  1463.     point_x, point_y = chase_point[0], chase_point[1]
  1464.     for i in 2..loop_times # forLoop
  1465.     steps -= 2
  1466.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1467.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1468.         chase_path.push(2)
  1469.         point_y = $game_map.round_y(point_y + 1)
  1470.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1471.         chase_path.push(8)
  1472.         point_y = $game_map.round_y(point_y - 1)
  1473.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1474.         chase_path.push(4)
  1475.         point_x = $game_map.round_x(point_x - 1)
  1476.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1477.         chase_path.push(6)
  1478.         point_x = $game_map.round_x(point_x + 1)
  1479.       end
  1480.     else
  1481.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1482.         chase_path.push(4)
  1483.         point_x = $game_map.round_x(point_x - 1)
  1484.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1485.         chase_path.push(6)
  1486.         point_x = $game_map.round_x(point_x + 1)
  1487.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1488.         chase_path.push(2)
  1489.         point_y = $game_map.round_y(point_y + 1)
  1490.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1491.         chase_path.push(8)
  1492.         point_y = $game_map.round_y(point_y - 1)
  1493.       end
  1494.     end
  1495.     end #endOfForLoop
  1496.     # 如果指定点无法抵达或者登陆
  1497.     return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
  1498.     # 根据路径表格绘制最短移动路径(反向)
  1499.     steps = step / 2 * 2 + 1
  1500.     loop_times = step / 2
  1501.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1502.     for i in 1..loop_times # forLoop
  1503.     steps -= 2
  1504.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1505.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1506.         reversed_chase_path.push(6)
  1507.         point_x = $game_map.round_x(point_x - 1)
  1508.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1509.         reversed_chase_path.push(4)
  1510.         point_x = $game_map.round_x(point_x + 1)
  1511.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1512.         reversed_chase_path.push(8)
  1513.         point_y = $game_map.round_y(point_y + 1)
  1514.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1515.         reversed_chase_path.push(2)
  1516.         point_y = $game_map.round_y(point_y - 1)
  1517.       end
  1518.     else
  1519.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1520.         reversed_chase_path.push(8)
  1521.         point_y = $game_map.round_y(point_y + 1)
  1522.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1523.         reversed_chase_path.push(2)
  1524.         point_y = $game_map.round_y(point_y - 1)
  1525.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1526.         reversed_chase_path.push(6)
  1527.         point_x = $game_map.round_x(point_x - 1)
  1528.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1529.         reversed_chase_path.push(4)
  1530.         point_x = $game_map.round_x(point_x + 1)
  1531.       end
  1532.     end
  1533.     end #endOfForLoop
  1534.     return reversed_chase_path.reverse + chase_path
  1535.   end#boat
  1536.   #--------------------------------------------------------------------------
  1537.   # ● 绘制ship的移动路径 @array[move_directions...]
  1538.   #--------------------------------------------------------------------------
  1539.   def draw_ship_path
  1540.     # 准备绘制路径表格
  1541.     sheet = Table.new($game_map.width, $game_map.height)
  1542.     reversed_chase_path  = []; chase_path  = []
  1543.     reversed_chase_point = []; chase_point = []
  1544.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  1545.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  1546.     reach_point = false
  1547.     step = 3
  1548.     loop do #loop1 开始填充表格
  1549.      draw_path = false
  1550.      check_points = new_start_points
  1551.      new_start_points = []
  1552.       loop do #loop2 从起点开始正向填充
  1553.         point_x = check_points.shift
  1554.         break if point_x == nil
  1555.         point_y = check_points.shift
  1556.         left_x  = $game_map.round_x(point_x - 1)
  1557.         right_x = $game_map.round_x(point_x + 1)
  1558.         up_y    = $game_map.round_y(point_y - 1)
  1559.         down_y  = $game_map.round_y(point_y + 1)
  1560.                     # 判断路径是否连通
  1561.         path_step = step - 1
  1562.         if sheet[left_x, point_y] == path_step
  1563.           chase_path.push(4)
  1564.           chase_point = [left_x, point_y]
  1565.           reversed_chase_point = [point_x, point_y]
  1566.           reach_point = true; break
  1567.         elsif sheet[right_x, point_y] == path_step
  1568.             chase_path.push(6)
  1569.             chase_point = [right_x, point_y]
  1570.             reversed_chase_point = [point_x, point_y]
  1571.             reach_point = true; break
  1572.         elsif sheet[point_x, up_y] == path_step
  1573.             chase_path.push(8)
  1574.             chase_point = [point_x, up_y]
  1575.             reversed_chase_point = [point_x, point_y]
  1576.             reach_point = true; break
  1577.         elsif sheet[point_x, down_y] == path_step
  1578.             chase_path.push(2)
  1579.             chase_point = [point_x, down_y]
  1580.             reversed_chase_point = [point_x, point_y]
  1581.             reach_point = true; break
  1582.         end
  1583.         # 以需要抵达该点的步数填充路径表格 #
  1584.         if sheet[left_x, point_y] == 0                &&
  1585.            $game_map.ship_passable?(left_x, point_y)  &&
  1586.            !collide_with_events?(left_x, point_y)     &&
  1587.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1588.           sheet[left_x, point_y] = step
  1589.           draw_path = true
  1590.           new_start_points.push(left_x, point_y)
  1591.         end
  1592.         if sheet[right_x, point_y] == 0               &&
  1593.            $game_map.ship_passable?(right_x, point_y) &&
  1594.            !collide_with_events?(right_x, point_y)    &&
  1595.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1596.           sheet[right_x, point_y] = step
  1597.           draw_path = true
  1598.           new_start_points.push(right_x, point_y)
  1599.         end
  1600.         if sheet[point_x, up_y] == 0                  &&
  1601.            $game_map.ship_passable?(point_x, up_y)    &&
  1602.            !collide_with_events?(point_x, up_y)       &&
  1603.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1604.           sheet[point_x, up_y] = step
  1605.           draw_path = true
  1606.           new_start_points.push(point_x, up_y)
  1607.         end
  1608.         if sheet[point_x, down_y] == 0                &&
  1609.            $game_map.ship_passable?(point_x, down_y)  &&
  1610.            !collide_with_events?(point_x, down_y)     &&
  1611.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1612.           sheet[point_x, down_y] = step
  1613.           draw_path = true
  1614.           new_start_points.push(point_x, down_y)
  1615.         end
  1616.       end#endOfLoop2
  1617.       break if !draw_path || reach_point
  1618.       draw_path = false
  1619.       check_points = new_end_points
  1620.       new_end_points = []
  1621.       step += 1
  1622.       break if step > KsOfSion::Break_Steps &&
  1623.                !Input.press?(KsOfSion::Find_Path_Key)
  1624.       loop do #loop3 从终点开始反向填充
  1625.         point_x = check_points.shift
  1626.         break if point_x == nil
  1627.         point_y = check_points.shift
  1628.         left_x  = $game_map.round_x(point_x - 1)
  1629.         right_x = $game_map.round_x(point_x + 1)
  1630.         up_y    = $game_map.round_y(point_y - 1)
  1631.         down_y  = $game_map.round_y(point_y + 1)
  1632.         # 判断路径是否连通
  1633.         path_step = step - 1
  1634.         if sheet[left_x, point_y] == path_step
  1635.           chase_path.push(6)
  1636.           chase_point = [point_x, point_y]
  1637.           reversed_chase_point = [left_x, point_y]
  1638.           reach_point = true; break
  1639.         elsif sheet[right_x, point_y] == path_step
  1640.             chase_path.push(4)
  1641.             chase_point = [point_x, point_y]
  1642.             reversed_chase_point = [right_x, point_y]
  1643.             reach_point = true; break
  1644.         elsif sheet[point_x, up_y] == path_step
  1645.             chase_path.push(2)
  1646.             chase_point = [point_x, point_y]
  1647.             reversed_chase_point = [point_x, up_y]
  1648.             reach_point = true; break
  1649.         elsif sheet[point_x, down_y] == path_step
  1650.             chase_path.push(8)
  1651.             chase_point = [point_x, point_y]
  1652.             reversed_chase_point = [point_x, down_y]
  1653.             reach_point = true; break
  1654.         end
  1655.         # 以需要抵达该点的步数填充路径表格 #
  1656.         if sheet[left_x, point_y] == 0                &&
  1657.            $game_map.ship_passable?(left_x, point_y)  &&
  1658.            !collide_with_events?(left_x, point_y)     &&
  1659.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1660.           sheet[left_x, point_y] = step
  1661.           draw_path = true
  1662.           new_end_points.push(left_x, point_y)
  1663.         end
  1664.         if sheet[right_x, point_y] == 0               &&
  1665.            $game_map.ship_passable?(right_x, point_y) &&
  1666.            !collide_with_events?(right_x, point_y)    &&
  1667.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1668.           sheet[right_x, point_y] = step
  1669.           draw_path = true
  1670.           new_end_points.push(right_x, point_y)
  1671.         end
  1672.         if sheet[point_x, up_y] == 0                  &&
  1673.            $game_map.ship_passable?(point_x, up_y)    &&
  1674.            !collide_with_events?(point_x, up_y)       &&
  1675.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1676.           sheet[point_x, up_y] = step
  1677.           draw_path = true
  1678.           new_end_points.push(point_x, up_y)
  1679.         end
  1680.         if sheet[point_x, down_y] == 0                &&
  1681.            $game_map.ship_passable?(point_x, down_y)  &&
  1682.            !collide_with_events?(point_x, down_y)     &&
  1683.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1684.           sheet[point_x, down_y] = step
  1685.           draw_path = true
  1686.           new_end_points.push(point_x, down_y)
  1687.         end
  1688.       end#endOfLoop3
  1689.       break if !draw_path || reach_point
  1690.       step += 1
  1691.     end #endOfLoop1 路径表格填充完毕
  1692.     $mouse_move_sign.transparent = false
  1693.     # 判断指定地点能否抵达
  1694.     reach_point ? $mouse_move_sign.direction = 2 : (return not_reach_point)
  1695.     # 根据路径表格绘制最短移动路径(正向)
  1696.     steps = step / 2 * 2
  1697.     loop_times = step / 2
  1698.     point_x, point_y = chase_point[0], chase_point[1]
  1699.     for i in 2..loop_times # forLoop
  1700.     steps -= 2
  1701.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1702.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1703.         chase_path.push(2)
  1704.         point_y = $game_map.round_y(point_y + 1)
  1705.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1706.         chase_path.push(8)
  1707.         point_y = $game_map.round_y(point_y - 1)
  1708.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1709.         chase_path.push(4)
  1710.         point_x = $game_map.round_x(point_x - 1)
  1711.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1712.         chase_path.push(6)
  1713.         point_x = $game_map.round_x(point_x + 1)
  1714.       end
  1715.     else
  1716.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1717.         chase_path.push(4)
  1718.         point_x = $game_map.round_x(point_x - 1)
  1719.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1720.         chase_path.push(6)
  1721.         point_x = $game_map.round_x(point_x + 1)
  1722.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1723.         chase_path.push(2)
  1724.         point_y = $game_map.round_y(point_y + 1)
  1725.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1726.         chase_path.push(8)
  1727.         point_y = $game_map.round_y(point_y - 1)
  1728.       end
  1729.     end
  1730.     end #endOfForLoop
  1731.     # 如果指定点无法抵达或者登陆
  1732.     return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
  1733.     # 根据路径表格绘制最短移动路径(反向)
  1734.     steps = step / 2 * 2 + 1
  1735.     loop_times = step / 2
  1736.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1737.     for i in 1..loop_times # forLoop
  1738.     steps -= 2
  1739.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1740.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1741.         reversed_chase_path.push(6)
  1742.         point_x = $game_map.round_x(point_x - 1)
  1743.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1744.         reversed_chase_path.push(4)
  1745.         point_x = $game_map.round_x(point_x + 1)
  1746.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1747.         reversed_chase_path.push(8)
  1748.         point_y = $game_map.round_y(point_y + 1)
  1749.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1750.         reversed_chase_path.push(2)
  1751.         point_y = $game_map.round_y(point_y - 1)
  1752.       end
  1753.     else
  1754.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1755.         reversed_chase_path.push(8)
  1756.         point_y = $game_map.round_y(point_y + 1)
  1757.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1758.         reversed_chase_path.push(2)
  1759.         point_y = $game_map.round_y(point_y - 1)
  1760.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1761.         reversed_chase_path.push(6)
  1762.         point_x = $game_map.round_x(point_x - 1)
  1763.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1764.         reversed_chase_path.push(4)
  1765.         point_x = $game_map.round_x(point_x + 1)
  1766.       end
  1767.     end
  1768.     end #endOfForLoop
  1769.     return reversed_chase_path.reverse + chase_path
  1770.   end#ship
  1771.   #--------------------------------------------------------------------------
  1772.   # ● 绘制airship的移动路径 @array[move_directions...]
  1773.   #--------------------------------------------------------------------------
  1774.   def draw_air_path
  1775.     $mouse_move_sign.transparent = false
  1776.     # 准备绘制路径表格
  1777.     sheet = Table.new($game_map.width, $game_map.height)
  1778.     new_check_point = [x, y]; sheet[x, y] = 1
  1779.     reach_point = false;      step = 2
  1780.     loop do #loop1
  1781.      check_point = new_check_point
  1782.      new_check_point = []
  1783.       loop do #loop2
  1784.         point_x = check_point.shift
  1785.         break if point_x == nil
  1786.         point_y = check_point.shift
  1787.         if point_x == @moveto_x && point_y == @moveto_y
  1788.           reach_point = true; break
  1789.         end
  1790.         left_x  = $game_map.round_x(point_x - 1)
  1791.         right_x = $game_map.round_x(point_x + 1)
  1792.         up_y    = $game_map.round_y(point_y - 1)
  1793.         down_y  = $game_map.round_y(point_y + 1)
  1794.         # 以需要抵达该点的步数填充路径表格 #
  1795.         if sheet[left_x, point_y] == 0
  1796.           sheet[left_x, point_y] = step
  1797.           new_check_point.push(left_x, point_y)
  1798.         end
  1799.         if sheet[right_x, point_y] == 0
  1800.           sheet[right_x, point_y] = step
  1801.           new_check_point.push(right_x, point_y)
  1802.         end
  1803.         if sheet[point_x, up_y] == 0
  1804.           sheet[point_x, up_y] = step
  1805.           new_check_point.push(point_x, up_y)
  1806.         end
  1807.         if sheet[point_x, down_y] == 0
  1808.           sheet[point_x, down_y] = step
  1809.           new_check_point.push(point_x, down_y)
  1810.         end
  1811.       end#endOfLoop2
  1812.       break if reach_point
  1813.       step += 1
  1814.     end #endOfLoop1
  1815.     # 根据路径表格绘制最短移动路径 #
  1816.     reversed_chase_path = []; step -= 1
  1817.     point_x, point_y = @moveto_x, @moveto_y
  1818.     for i in 2..step
  1819.     step -= 1
  1820.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1821.       if    sheet[$game_map.round_x(point_x - 1), point_y] == step
  1822.         reversed_chase_path.push(6)
  1823.         point_x = $game_map.round_x(point_x - 1)
  1824.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
  1825.         reversed_chase_path.push(4)
  1826.         point_x = $game_map.round_x(point_x + 1)
  1827.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step
  1828.         reversed_chase_path.push(8)
  1829.         point_y = $game_map.round_y(point_y + 1)
  1830.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
  1831.         reversed_chase_path.push(2)
  1832.         point_y = $game_map.round_y(point_y - 1)
  1833.       end
  1834.     else
  1835.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == step
  1836.         reversed_chase_path.push(8)
  1837.         point_y = $game_map.round_y(point_y + 1)
  1838.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
  1839.         reversed_chase_path.push(2)
  1840.         point_y = $game_map.round_y(point_y - 1)
  1841.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == step
  1842.         reversed_chase_path.push(6)
  1843.         point_x = $game_map.round_x(point_x - 1)
  1844.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
  1845.         reversed_chase_path.push(4)
  1846.         point_x = $game_map.round_x(point_x + 1)
  1847.       end
  1848.     end
  1849.     end #endOfForLoop
  1850.     return reversed_chase_path.reverse
  1851.   end#airship
  1852.   #--------------------------------------------------------------------------
  1853.   # ● 判断目标点是否能抵达、登陆,用于船只路径绘制
  1854.   #--------------------------------------------------------------------------
  1855.   def landable?(x, y, path)
  1856.     case @vehicle_type
  1857.       when :ship; return $game_map.ship_passable?(x, y) ||
  1858.         $game_map.passable?(x, y, 10 - path[-1])
  1859.       when :boat; return $game_map.boat_passable?(x, y) ||
  1860.         $game_map.passable?(x, y, 10 - path[-1])
  1861.     end
  1862.   end
  1863. end
  1864.  
  1865. #==============================================================================
  1866. # ■ Game_Map
  1867. #------------------------------------------------------------------------------
  1868. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
  1869. #   本类的实例请参考 $game_map 。
  1870. #==============================================================================
  1871. class Game_Map
  1872.   #--------------------------------------------------------------------------
  1873.   # ● 初始化对象
  1874.   #--------------------------------------------------------------------------
  1875.   alias sion_mouse_initialize initialize
  1876.   def initialize
  1877.     sion_mouse_initialize
  1878.     creat_move_sign  ###
  1879.     set_constants
  1880.   end
  1881.   #--------------------------------------------------------------------------
  1882.   # ● 更新画面
  1883.   #     main : 事件解释器更新的标志
  1884.   #--------------------------------------------------------------------------
  1885.   alias sion_mouse_update update
  1886.   def update(main = false)
  1887.     sion_mouse_update(main)
  1888.     update_move_sign
  1889.   end
  1890.   #--------------------------------------------------------------------------
  1891.   # ● 设置显示位置
  1892.   #--------------------------------------------------------------------------
  1893.   alias sion_mouse_set_display_pos set_display_pos
  1894.   def set_display_pos(x, y)
  1895.     sion_mouse_set_display_pos(x, y)
  1896.     @_display_y_ = @display_y
  1897.     @_display_x_ = @display_x
  1898.   end
  1899.   #--------------------------------------------------------------------------
  1900.   # ● 创建显示路径点的事件
  1901.   #--------------------------------------------------------------------------
  1902.   def creat_move_sign
  1903.     $mouse_move_sign = Move_Sign.new
  1904.   end
  1905.   #--------------------------------------------------------------------------
  1906.   # ● 更新显示路径点的事件
  1907.   #--------------------------------------------------------------------------
  1908.   def set_constants
  1909.     @mouse_pos_setted = true
  1910.     @set_pos_prepared = false
  1911.     @mouse_old_x = 0
  1912.     @mouse_old_y = 0
  1913.   end
  1914.   #--------------------------------------------------------------------------
  1915.   # ● 更新显示路径点的事件
  1916.   #--------------------------------------------------------------------------
  1917.   def update_move_sign
  1918.     $mouse_move_sign.update
  1919.   end
  1920.   #--------------------------------------------------------------------------
  1921.   # ● 获取鼠标位于的地图块的x、y坐标
  1922.   #--------------------------------------------------------------------------
  1923.   def mouse_map_x
  1924.     round_x((@display_x + Mouse.x / 32.0).to_i)
  1925.   end
  1926.   def mouse_map_y
  1927.     round_y((@display_y + Mouse.y / 32.0).to_i)
  1928.   end
  1929.   #--------------------------------------------------------------------------
  1930.   # ● 返回地图画面时重设鼠标坐标
  1931.   #--------------------------------------------------------------------------
  1932.   def reset_mouse_pos
  1933.     return if @mouse_pos_setted
  1934.     Mouse.set_pos(@mouse_old_x, @mouse_old_y)
  1935.     @mouse_pos_setted = true
  1936.     @set_pos_prepared = false
  1937.   end
  1938.   #--------------------------------------------------------------------------
  1939.   # ● 重设鼠标的坐标
  1940.   #--------------------------------------------------------------------------
  1941.   def prepare_reset_mouse_pos
  1942.     return if @set_pos_prepared
  1943.     @mouse_pos_setted = false
  1944.     @mouse_old_x = Mouse.x
  1945.     @mouse_old_y = Mouse.y
  1946.     @set_pos_prepared = true
  1947.   end
  1948.   #--------------------------------------------------------------------------
  1949.   # ● 向下卷动
  1950.   #--------------------------------------------------------------------------
  1951.   def new_scroll_down(distance)
  1952.     if loop_vertical?
  1953.       @_display_y_ += distance
  1954.       @_display_y_ %= @map.height
  1955.       @parallax_y += distance if @parallax_loop_y
  1956.     else
  1957.       last_y = @_display_y_
  1958.       @_display_y_ = [@_display_y_ + distance, height - screen_tile_y].min
  1959.       @parallax_y += @_display_y_ - last_y
  1960.     end
  1961.     @display_y = (@_display_y_ * 32).round / 32.0
  1962.   end
  1963.   #--------------------------------------------------------------------------
  1964.   # ● 向左卷动
  1965.   #--------------------------------------------------------------------------
  1966.   def new_scroll_left(distance)
  1967.     if loop_horizontal?
  1968.       @_display_x_ += @map.width - distance
  1969.       @_display_x_ %= @map.width
  1970.       @parallax_x -= distance if @parallax_loop_x
  1971.     else
  1972.       last_x = @_display_x_
  1973.       @_display_x_ = [@_display_x_ - distance, 0].max
  1974.       @parallax_x += @_display_x_ - last_x
  1975.     end
  1976.     @display_x = (@_display_x_ * 32).round / 32.0
  1977.   end
  1978.   #--------------------------------------------------------------------------
  1979.   # ● 向右卷动
  1980.   #--------------------------------------------------------------------------
  1981.   def new_scroll_right(distance)
  1982.     if loop_horizontal?
  1983.       @_display_x_ += distance
  1984.       @_display_x_ %= @map.width
  1985.       @parallax_x += distance if @parallax_loop_x
  1986.     else
  1987.       last_x = @_display_x_
  1988.       @_display_x_ = [@_display_x_ + distance, (width - screen_tile_x)].min
  1989.       @parallax_x += @_display_x_ - last_x
  1990.     end
  1991.     @display_x = (@_display_x_ * 32).round / 32.0
  1992.   end
  1993.   #--------------------------------------------------------------------------
  1994.   # ● 向上卷动
  1995.   #--------------------------------------------------------------------------
  1996.   def new_scroll_up(distance)
  1997.     if loop_vertical?
  1998.       @_display_y_ += @map.height - distance
  1999.       @_display_y_ %= @map.height
  2000.       @parallax_y -= distance if @parallax_loop_y
  2001.     else
  2002.       last_y = @_display_y_
  2003.       @_display_y_ = [@_display_y_ - distance, 0].max
  2004.       @parallax_y += @_display_y_ - last_y
  2005.     end
  2006.     @display_y = (@_display_y_ * 32).round / 32.0
  2007.   end
  2008. end
  2009.  
  2010. #==============================================================================
  2011. # ■ Spriteset_Map
  2012. #------------------------------------------------------------------------------
  2013. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
  2014. #==============================================================================
  2015. class Spriteset_Map
  2016.   #--------------------------------------------------------------------------
  2017.   # ● 生成路径点精灵
  2018.   #--------------------------------------------------------------------------
  2019.   alias sion_mouse_create_characters create_characters
  2020.   def create_characters
  2021.     sion_mouse_create_characters
  2022.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
  2023.   end
  2024. end
  2025.  
  2026. #==============================================================================
  2027. # ■ SceneManager
  2028. #==============================================================================
  2029. class << SceneManager
  2030.   alias sion_mouse_snapshot_for_background snapshot_for_background
  2031.   def snapshot_for_background
  2032.     Mouse.sprite.visible = false
  2033.     sion_mouse_snapshot_for_background
  2034.     Mouse.sprite.visible = true
  2035.   end
  2036. end
  2037. #==============================================================================
  2038. # ■ Scene_Map
  2039. #------------------------------------------------------------------------------
  2040. #  地图画面
  2041. #==============================================================================
  2042. class Scene_Map
  2043.   #--------------------------------------------------------------------------
  2044.   # ● 画面更新
  2045.   #--------------------------------------------------------------------------
  2046.   alias sion_mouse_update_scene update_scene
  2047.   def update_scene
  2048.     sion_mouse_update_scene
  2049.     update_mouse_action unless scene_changing? || $game_map.interpreter.running?
  2050.   end
  2051.   #--------------------------------------------------------------------------
  2052.   # ● 场所移动前的处理
  2053.   #--------------------------------------------------------------------------
  2054.   alias sion_mouse_pre_transfer pre_transfer
  2055.   def pre_transfer
  2056.     $game_player.reset_move_path
  2057.     sion_mouse_pre_transfer
  2058.   end
  2059.   #--------------------------------------------------------------------------
  2060.   # ● 监听鼠标左键的按下
  2061.   #--------------------------------------------------------------------------
  2062.   def update_mouse_action
  2063.     $game_player.left_button_action if Mouse.press?(:L)
  2064.   end
  2065. end
  2066.  
  2067. #==============================================================================
  2068. # ■ Scene_File
  2069. #------------------------------------------------------------------------------
  2070. #  存档画面和读档画面共同的父类
  2071. #==============================================================================
  2072. class Scene_File < Scene_MenuBase
  2073.   #--------------------------------------------------------------------------
  2074.   # ● 开始处理
  2075.   #--------------------------------------------------------------------------
  2076.   alias sion_mouse_start start
  2077.   def start
  2078.     sion_mouse_start
  2079.     @move_state = 0
  2080.     set_mouse_pos
  2081.   end
  2082.   #--------------------------------------------------------------------------
  2083.   # ● 更新画面
  2084.   #--------------------------------------------------------------------------
  2085.   alias sion_mouse_update update
  2086.   def update
  2087.     sion_mouse_update
  2088.     Input.dir4.zero? ? set_cursor : set_mouse_pos
  2089.   end
  2090.   #--------------------------------------------------------------------------
  2091.   # ● 更新光标
  2092.   #--------------------------------------------------------------------------
  2093.   def set_cursor
  2094.     @move_state += 1
  2095.     last_index = @index
  2096.     if mouse_which_window == -2
  2097.       if (@move_state - 1) % 6 == 0
  2098.         @index = (@index + 1) % item_max if @index < item_max - 1
  2099.       end
  2100.     elsif mouse_which_window == -1
  2101.       if (@move_state - 1) % 6 == 0
  2102.         @index = (@index - 1 + item_max) % item_max if @index > 0
  2103.       end
  2104.     else
  2105.       @move_state = 0
  2106.       @index = top_index + mouse_which_window
  2107.     end
  2108.     ensure_cursor_visible
  2109.     if @index != last_index
  2110.       @savefile_windows[last_index].selected = false
  2111.       @savefile_windows[@index].selected = true
  2112.     end
  2113.   end
  2114.   #--------------------------------------------------------------------------
  2115.   # ● 判断鼠标位于哪个窗口
  2116.   #--------------------------------------------------------------------------
  2117.   def mouse_which_window
  2118.     mouse_x = Mouse.x
  2119.     mouse_y = Mouse.y
  2120.     if mouse_y < @help_window.height + 14
  2121.       mouse_row = -1
  2122.     elsif mouse_y > Graphics.height - 14
  2123.       mouse_row = -2
  2124.     else
  2125.       mouse_row = 4 * (mouse_y - @help_window.height) /
  2126.         (Graphics.height - @help_window.height)
  2127.     end
  2128.     return mouse_row
  2129.   end
  2130.   #--------------------------------------------------------------------------
  2131.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  2132.   #--------------------------------------------------------------------------
  2133.   def set_mouse_pos
  2134.     new_x = 40
  2135.     new_y = @help_window.height + savefile_height * (@index - top_index) + 24
  2136.     Mouse.set_pos(new_x, new_y)
  2137.   end
  2138. end
  2139.  
  2140. #==============================================================================
  2141. # ■ Game_Event
  2142. #------------------------------------------------------------------------------
  2143. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
  2144. #   在 Game_Map 类的内部使用。
  2145. #==============================================================================
  2146. class Game_Event < Game_Character
  2147.   alias_method :sion_mouse_start, :start
  2148.   alias_method :sion_mouse_setup_page, :setup_page
  2149.   def start
  2150.     return if mouse_start? && !Mouse.press?(:L)
  2151.     sion_mouse_start
  2152.   end
  2153.   def mouse_start?
  2154.     @mouse_start
  2155.   end
  2156.   def setup_page(p)
  2157.     sion_mouse_setup_page(p)
  2158.     sion_mouse_read_event_notes
  2159.   end
  2160.   def sion_mouse_read_event_notes
  2161.     @mouse_start = false
  2162.     @list.each {|cmd| break if sion_mouse_scan_list(cmd)} unless empty?
  2163.   end
  2164.   def sion_mouse_scan_list(cmd)
  2165.     return false unless cmd.code == 108 || cmd.code == 408
  2166.     return @mouse_start = cmd.parameters[0].include?("鼠标启动")
  2167.   end
  2168. end
  2169.  
  2170. #encoding:utf-8
  2171. #==============================================================================
  2172. # ■ BattleManager
  2173. #------------------------------------------------------------------------------
  2174. #  战斗过程的管理器。
  2175. #==============================================================================
  2176. class << BattleManager
  2177.   alias_method :sion_mouse_on_encounter, :on_encounter
  2178.   # 遇敌后重置移动路径
  2179.   def on_encounter
  2180.     $game_player.reset_move_path
  2181.     sion_mouse_on_encounter
  2182.   end
  2183. end
  2184.  
  2185.  
  2186. # v2.32 卷动地图优化
  2187. class Game_Interpreter
  2188.   alias_method :sion_mouse_command_204, :command_204
  2189.   def command_204
  2190.     sion_mouse_command_204
  2191.     case next_event_code
  2192.     when 204
  2193.       Fiber.yield while $game_map.scrolling?
  2194.       @index += 1
  2195.       execute_command
  2196.     when 230
  2197.       $game_map.wait_scroll = true
  2198.       @index += 1
  2199.       execute_command
  2200.       $game_map.wait_scroll = false
  2201.     end
  2202.   end
  2203.   #230 wait
  2204. end
  2205.  
  2206. class Game_Map
  2207.   attr_accessor :wait_scroll
  2208.   #--------------------------------------------------------------------------
  2209.   # ● 更新画面 覆盖原方法
  2210.   #     main : 事件解释器更新的标志
  2211.   #--------------------------------------------------------------------------
  2212.   def update(main = false)
  2213.     refresh if @need_refresh
  2214.     update_scroll
  2215.     update_interpreter if main
  2216.     update_events
  2217.     update_vehicles
  2218.     update_parallax
  2219.     @screen.update
  2220.   end
  2221. end

QQ图片20160714025728.png (206.3 KB, 下载次数: 21)

用了鼠标脚本后的隔空取物

用了鼠标脚本后的隔空取物

Lv3.寻梦者

梦石
0
星屑
1293
在线时间
995 小时
注册时间
2014-12-14
帖子
3016

开拓者

2
发表于 2016-7-16 14:09:14 | 只看该作者
本帖最后由 Vortur 于 2016-10-16 22:51 编辑



梁大变小气了!以前都是甩手1张好人卡的!!!




你好~
  代码放到【代码框】里,然后使用【Toggle】会更方便!~
  隔空取物并非bug,而是缺乏一个判断!~~直接使用事件来达成的方式就不说了,这里卖弄下事件脚本~~
思路1:
思路2:
上述思路配合【判断角色朝向】,即可达成必要功能
部分姿势点解释
脚本出处:
【新手礼包】【事件脚本汇总1】【事件脚本汇总2】
@VIPArcher @taroxd
@丿梁丶小柒
管理员大人直接结贴吧~

祝君愉快!


评分

参与人数 1星屑 +110 收起 理由
丿梁丶小柒 + 110 我很赞同

查看全部评分

【RMVA教程】
---------------------
欲买桂花同载酒,终不似,少年游.
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3841
在线时间
723 小时
注册时间
2014-3-29
帖子
509
3
发表于 2016-7-17 10:49:05 | 只看该作者
https://rpg.blue/forum.php?mod=viewthread&tid=284480
Sion的鼠标有新的吧。话说,你的是这个么?

评分

参与人数 1星屑 +110 收起 理由
丿梁丶小柒 + 110 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-16 16:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表