查看: 2660|回复: 2

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

[复制链接]
梦石
0
星屑
1042
在线时间
13 小时
注册时间
2016-6-26
回帖
0
发表于 2016-7-14 03:04:48 | 显示全部楼层 |阅读模式

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

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

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

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

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


  1. # Sion 鼠标系统(SionMouseSystem)v2.31 (2014/2/20)
  2. # 需求! 1,白菜组脚本基 (WhiteCabbageBase) v1.0+
  3. #       2,基础鼠标模组 (Sion_MouseBase) v1.0+


  4. # v2.32(2014/6/9)  优化了地图卷动指令、等待指令的衔接过程。
  5. # v2.31(2014/2/20) 事件执行过程中,卷动地图后不会自动跳转到玩家位置了。


  6. =begin 说明  

  7.   主要功能

  8.     1,自动寻路,按住 D 键可以扩大寻路的范围
  9.     2,变量输入框改良
  10.     3,鼠标启动事件:
  11.       在事件中加入“注释”:鼠标启动
  12.       该事件将无法用其它方式启动,只能用鼠标左键点击启动
  13.       
  14.   鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹
  15.   路径点指示图片 $Arrow.png 放入 Graphics\Characters 文件夹
  16.   如果未放入会使用RM自带图片代替缺失文件

  17. =end



  18. #==============================================================================
  19. # ■ 常数设置
  20. #==============================================================================
  21. module KsOfSion
  22.   Clip_Cursor    = true    # 鼠标锁定在游戏窗口内,需要关闭设置为false
  23.   Dbclick_Frame  = 15      # 双击的最大间隔帧数。在地图画面双击进行奔跑
  24.   New_Scroll     = true    # 更改地图卷动方式,需要关闭设置为false
  25.   Map_Scroll_Spd = 1.0     # 卷动速度
  26.   Menu_Set_Pos   = true    # 打开菜单时将鼠标移动到光标处
  27.   Break_Steps    = 30      # 鼠标寻路最大步数,防止路径太长导致卡帧
  28. #                             “30” 是默认显示格子数 长(17) + 宽(13)
  29.   Find_Path_Key  = :Z      # 扩大寻路范围至全地图按键 :Z 对应 D键
  30. #                               RM几个内置的空键位 (:X = A)(:Y = S)(:Z = D)
  31. end
  32. #
  33. class Move_Sign < Game_Character # ■ 用来显示路径点的类
  34. attr_accessor :direction
  35.   def init_public_members
  36.     @character_name  = '!$Arrow'# 路径点箭头,置于.\Graphics\Characters文件夹
  37.     @character_index = 0        # 图片索引。$开头的行走图设为0
  38.     @move_speed      = 5        # 踏步速度
  39.     @step_anime      = true     # 踏步动画(如果想使用静态图标就关闭这个)
  40.     @opacity         = 255      # 不透明度
  41.     @blend_type      = 0        # 图片合成方式,默认为0(正常)
  42.     @direction       = 2        # 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
  43.     @priority_type   = 1        # 优先级(默认与人物同级:1)
  44.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
  45.    
  46. #============================= 参数设置完毕 ===================================
  47.     unless File.exist?('Graphics/Characters/' + @character_name + '.png')
  48.       @character_name  = '!Flame'
  49.       @character_index = 6
  50.     end
  51.     @direction_fix = false
  52.     @move_frequency = 6
  53.     @walk_anime = true
  54.     @pattern = 1
  55.     @through = true
  56.     @bush_depth = 0
  57.     @animation_id = 0
  58.     @balloon_id = 0
  59.     @transparent = true
  60.     @id = 0
  61.     @x = 0
  62.     @y = 0
  63.     @real_x = 0
  64.     @real_y = 0
  65.     @tile_id = 0
  66.   end
  67. end
  68. #==============================================================================
  69. # ■ SceneManager
  70. #==============================================================================
  71. class << SceneManager
  72.   unless self.method_defined?(:sion_mouse_run)
  73.     alias_method :sion_mouse_run, :run
  74.     alias_method :sion_mouse_call, :call
  75.     alias_method :sion_mouse_return, :return
  76.   end
  77.   def run
  78.     Mouse.activate
  79.     sion_mouse_run
  80.   end
  81.   def call(scene_class, *args)
  82.     $game_map.prepare_reset_mouse_pos if @scene.instance_of?(Scene_Map)
  83.     sion_mouse_call(scene_class, *args)
  84.   end
  85.   def return
  86.     sion_mouse_return
  87.     $game_map.reset_mouse_pos if KsOfSion::Menu_Set_Pos &&
  88.       @scene.instance_of?(Scene_Map)
  89.   end
  90. end
  91. class << Mouse
  92.   attr_reader :sprite
  93. end
  94. class << Input
  95.   alias_method :sion_mouse_press?,   :press?
  96.   alias_method :sion_mouse_trigger?, :trigger?
  97.   alias_method :sion_mouse_repeat?,  :repeat?
  98.   unless self.method_defined?(:sion_mouse_update)
  99.     alias_method :sion_mouse_update, :update
  100.   end
  101.   def update
  102.     Mouse.update
  103.     sion_mouse_update
  104.   end
  105.   def press?(key)
  106.     return true if sion_mouse_press?(key)
  107.     return Mouse.press?(:L) if key == :C
  108.     return Mouse.press?(:R) if key == :B
  109.     return false
  110.   end
  111.   def trigger?(key)
  112.     return true if sion_mouse_trigger?(key)
  113.     return Mouse.trigger?(:L) if key == :C
  114.     return Mouse.trigger?(:R) if key == :B
  115.     return false
  116.   end
  117.   def repeat?(key)
  118.     return true if sion_mouse_repeat?(key)
  119.     return Mouse.repeat?(:L) if key == :C
  120.     return Mouse.repeat?(:R) if key == :B
  121.     return false
  122.   end
  123. end


  124. #==============================================================================
  125. # ■ Window_Selectable
  126. #------------------------------------------------------------------------------
  127. #  拥有光标移动、滚动功能的窗口
  128. #==============================================================================
  129. class Window_Selectable
  130.   #--------------------------------------------------------------------------
  131.   # ● 初始化
  132.   #--------------------------------------------------------------------------
  133.   alias sion_mouse_initialize initialize
  134.   def initialize(x, y, width, height)
  135.     sion_mouse_initialize(x, y, width, height)
  136.     @move_state = 0
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 更新
  140.   #--------------------------------------------------------------------------
  141.   alias sion_mouse_update update
  142.   def update
  143.     sion_mouse_update
  144.     update_mouse_cursor
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 按下确定键的处理
  148.   #--------------------------------------------------------------------------
  149.   alias sion_mouse_process_ok process_ok
  150.   def process_ok
  151.     return if Mouse.trigger?(:L) && mouse_out_rect?
  152.     sion_mouse_process_ok
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 判断鼠标是位于光标矩形处
  156.   #--------------------------------------------------------------------------
  157.   def mouse_out_rect?
  158.     if viewport.nil?
  159.       vp_x, vp_y = 0, 0
  160.     else
  161.       vp_x = viewport.rect.x - viewport.ox
  162.       vp_y = viewport.rect.y - viewport.oy
  163.     end
  164.     mouse_rx = ox + Mouse.x - (x + vp_x + standard_padding )
  165.     mouse_ry = oy + Mouse.y - (y + vp_y + standard_padding )
  166.     return cursor_rect.x > mouse_rx ||
  167.            cursor_rect.y > mouse_ry ||
  168.            cursor_rect.x + cursor_rect.width < mouse_rx ||
  169.            cursor_rect.y + cursor_rect.height< mouse_ry
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 启动后设置鼠标到index位置
  173.   #--------------------------------------------------------------------------
  174.   def activate
  175.     @need_set_pos = true if KsOfSion::Menu_Set_Pos
  176.     super
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 更新鼠标和光标的位置
  180.   #--------------------------------------------------------------------------
  181.   def update_mouse_cursor
  182.     if active
  183.       if @need_set_pos
  184.         @need_set_pos = nil
  185.         set_mouse_pos
  186.       elsif cursor_movable?
  187.         Input.dir4.zero? ? set_cursor : set_mouse_pos
  188.       end
  189.     end
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
  193.   #--------------------------------------------------------------------------
  194.   def set_cursor
  195.     mouse_row, mouse_col = mouse_window_area
  196.     if    mouse_row == -1
  197.       @move_state += 1 if need_scroll?
  198.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  199.     elsif mouse_row == -2
  200.       @move_state += 1 if need_scroll?
  201.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  202.     elsif mouse_col == -1
  203.       @move_state += 1 if need_scroll?
  204.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand?
  205.     elsif mouse_col == -2
  206.       @move_state += 1 if need_scroll?
  207.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand?
  208.     else
  209.       @move_state = 0
  210.       new_index = (top_row + mouse_row) * col_max + mouse_col
  211.       select(new_index) if new_index < item_max && new_index != @index
  212.     end
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 判断鼠标位于菜单的第几行、第几列
  216.   #--------------------------------------------------------------------------
  217.   def mouse_window_area
  218.     if viewport.nil? # necessary!
  219.       vp_x, vp_y = 0, 0
  220.     else
  221.       vp_x = viewport.rect.x - viewport.ox
  222.       vp_y = viewport.rect.y - viewport.oy
  223.     end
  224.     mouse_x = Mouse.x
  225.     mouse_y = Mouse.y
  226.     item_x1 = vp_x + x + standard_padding
  227.     item_y1 = vp_y + y + standard_padding
  228.     item_x2 = vp_x + x - standard_padding + width
  229.     item_y2 = vp_y + y - standard_padding + height
  230.     if mouse_x < item_x1
  231.       mouse_col = -1
  232.     elsif mouse_x > item_x2
  233.       mouse_col = -2
  234.     else
  235.       mouse_col = col_max * (mouse_x - item_x1) / (item_x2 - item_x1)
  236.     end
  237.     if mouse_y < item_y1
  238.       mouse_row = -1
  239.     elsif mouse_y > item_y2
  240.       mouse_row = -2
  241.     else
  242.       mouse_row = page_row_max * (mouse_y - item_y1 - 1) / (item_y2 - item_y1)
  243.     end
  244.     return mouse_row, mouse_col
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  248.   #--------------------------------------------------------------------------
  249.   def set_mouse_pos
  250.     if viewport.nil? # necessary!
  251.       vp_x, vp_y = 0, 0
  252.     else
  253.       vp_x = viewport.rect.x - viewport.ox
  254.       vp_y = viewport.rect.y - viewport.oy
  255.     end
  256.     item_x1 = vp_x + x + standard_padding
  257.     item_y1 = vp_y + y + standard_padding
  258.     get_index = @index < 0 ? 0 : @index
  259.     row = get_index / col_max - top_row
  260.     col = get_index % col_max
  261.     new_x = item_x1 + item_width * (col + 0.5)
  262.     new_y = item_y1 + item_height * (row + 0.5)
  263.     Mouse.set_pos(new_x, new_y)
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● 判断菜单是否需要卷动
  267.   #--------------------------------------------------------------------------
  268.   def need_scroll?
  269.     item_max > col_max * page_row_max
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 判断是否为水平卷动菜单
  273.   #--------------------------------------------------------------------------
  274.   def is_horzcommand?
  275.     return false
  276.   end
  277. end

  278. class Window_HorzCommand
  279.   #--------------------------------------------------------------------------
  280.   # ● 判断是否为水平卷动菜单
  281.   #--------------------------------------------------------------------------
  282.   def is_horzcommand?
  283.     return true
  284.   end
  285. end

  286. #==============================================================================
  287. # ■ Window_NameInput
  288. #------------------------------------------------------------------------------
  289. #  名字输入画面中,选择文字的窗口。
  290. #==============================================================================
  291. class Window_NameInput
  292.   #--------------------------------------------------------------------------
  293.   # ● 设置列数
  294.   #--------------------------------------------------------------------------
  295.   def col_max
  296.     return 10
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ● 设置填充的Item个数
  300.   #--------------------------------------------------------------------------
  301.   def item_max
  302.     return 90
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 设置填充的Item个数
  306.   #--------------------------------------------------------------------------
  307.   def item_width
  308.     return 32
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 判断鼠标位于菜单的第几行、第几列
  312.   #--------------------------------------------------------------------------
  313.   def mouse_window_area
  314.     if viewport.nil?
  315.       vp_x, vp_y = 0, 0
  316.     else
  317.       vp_x = viewport.rect.x - viewport.ox
  318.       vp_y = viewport.rect.y - viewport.oy
  319.     end
  320.     mouse_x = Mouse.x
  321.     mouse_y = Mouse.y
  322.     item_x1 = vp_x + x + standard_padding
  323.     item_y1 = vp_y + y + standard_padding
  324.     item_x2 = vp_x + x - standard_padding + width
  325.     item_y2 = vp_y + y - standard_padding + height
  326.     if mouse_x < item_x1
  327.       mouse_col = -1
  328.     elsif mouse_x > item_x2
  329.       mouse_col = -2
  330.     elsif mouse_x < item_x1 + 160
  331.       mouse_col = (mouse_x - item_x1)/32
  332.     elsif mouse_x > item_x2 - 160
  333.       mouse_col = 9 - (item_x2 - mouse_x)/32
  334.     else
  335.       mouse_col = mouse_x > x + width/2 ? 5 : 4
  336.     end
  337.     if mouse_y < item_y1
  338.       mouse_row = -1
  339.     elsif mouse_y > item_y2
  340.       mouse_row = -2
  341.     else
  342.       mouse_row = page_row_max * (mouse_y - item_y1 - 1)/(item_y2 - item_y1)
  343.     end
  344.     return mouse_row, mouse_col
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  348.   #--------------------------------------------------------------------------
  349.   def set_mouse_pos
  350.     if viewport.nil? # necessary!
  351.       vp_x, vp_y = 0, 0
  352.     else
  353.       vp_x = viewport.rect.x - viewport.ox
  354.       vp_y = viewport.rect.y - viewport.oy
  355.     end
  356.     item_x1 = vp_x + x + standard_padding
  357.     item_y1 = vp_y + y + standard_padding
  358.     get_index = @index < 0 ? 0 : @index
  359.     row = get_index / col_max - top_row
  360.     col = get_index % col_max
  361.     new_x = item_x1 + item_width * (col + 0.5)
  362.     new_y = item_y1 + item_height * (row + 0.5)
  363.     new_x += 14 if col > 4
  364.     Mouse.set_pos(new_x, new_y)
  365.   end
  366. end

  367. #==============================================================================
  368. # ■ Window_NumberInput
  369. #------------------------------------------------------------------------------
  370. #  重写了数值输入的方法以适应鼠标
  371. #==============================================================================
  372. class Window_NumberInput < Window_Base
  373.   #--------------------------------------------------------------------------
  374.   # ● 定义实例变量
  375.   #--------------------------------------------------------------------------
  376.   attr_reader :extra_window
  377.   #--------------------------------------------------------------------------
  378.   # ● 初始化
  379.   #--------------------------------------------------------------------------
  380.   alias sion_mouse_initialize initialize
  381.   def initialize(arg)
  382.     sion_mouse_initialize(arg)
  383.     create_extra_window
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 启动
  387.   #--------------------------------------------------------------------------
  388.   alias sion_mouse_start start
  389.   def start
  390.     sion_mouse_start
  391.     deactivate
  392.     extra_start
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ● 创建新的数值输入窗口
  396.   #--------------------------------------------------------------------------
  397.   def create_extra_window
  398.     @extra_window = Window_NumberInput_Ex.new
  399.     @extra_window.x = (Graphics.width - @extra_window.width) / 2
  400.     @extra_window.number_proc  = Proc.new {|n| @number = n }
  401.     @extra_window.index_proc   = Proc.new {|n| @index = n }
  402.     @extra_window.close_proc   = Proc.new { close }
  403.     @extra_window.refresh_proc = Proc.new { refresh }
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● 激活新窗口
  407.   #--------------------------------------------------------------------------
  408.   def extra_start
  409.     case $game_message.position
  410.       when 0; @extra_window.y = y + height + 4
  411.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
  412.       when 2; @extra_window.y = y - @extra_window.height - 4
  413.       else  ; @extra_window.y = 8
  414.     end
  415.     @extra_window.variable_id = $game_message.num_input_variable_id
  416.     @extra_window.digits_max  = @digits_max
  417.     @extra_window.number      = @number
  418.     @extra_window.open
  419.     @extra_window.activate
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● 更新
  423.   #--------------------------------------------------------------------------
  424.   def update
  425.     super
  426.     @extra_window.update
  427.     update_cursor
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ● 关闭窗口
  431.   #--------------------------------------------------------------------------
  432.   def close
  433.     super
  434.     @extra_window.close
  435.     @extra_window.deactivate
  436.   end
  437. end

  438. #==============================================================================
  439. # ■ Window_NumberInput_Ex
  440. #------------------------------------------------------------------------------
  441. #  新的数值输入窗口(NewClass)
  442. #==============================================================================
  443. class Window_NumberInput_Ex < Window_Selectable
  444.   #--------------------------------------------------------------------------
  445.   # ● 定义实例变量
  446.   #--------------------------------------------------------------------------
  447.   attr_accessor :number_proc
  448.   attr_accessor :index_proc
  449.   attr_accessor :close_proc
  450.   attr_accessor :refresh_proc
  451.   attr_accessor :number
  452.   attr_accessor :digits_max
  453.   attr_accessor :variable_id
  454.   #--------------------------------------------------------------------------
  455.   # ● 数字表
  456.   #--------------------------------------------------------------------------
  457.   TABLE = [  7,  8,  9,
  458.              4,  5,  6,
  459.              1,  2,  3,
  460.             '←',0,'确定',]
  461.   #--------------------------------------------------------------------------
  462.   # ● 初始化对象
  463.   #--------------------------------------------------------------------------
  464.   def initialize
  465.     super(0, 0, 120, fitting_height(4))
  466.     self.openness = 0
  467.     @index = 0
  468.     @number = 0
  469.     @old_window_index = 0
  470.     @digits_max = 0
  471.     12.times {|i| draw_text(item_rect(i), TABLE[i], 1) }
  472.   end
  473.   #--------------------------------------------------------------------------
  474.   # ● 获取项目的绘制矩形
  475.   #--------------------------------------------------------------------------
  476.   def item_rect(index)
  477.     rect = Rect.new
  478.     rect.x = index % 3 * 32
  479.     rect.y = index / 3 * line_height
  480.     rect.width = 32
  481.     rect.height = line_height
  482.     return rect
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ● 将光标设置到鼠标所在的位置
  486.   #--------------------------------------------------------------------------
  487.   def set_cursor
  488.     mouse_row, mouse_col = mouse_window_area
  489.     if mouse_row >= 0 && mouse_col >= 0
  490.       new_index = mouse_row * 3 + mouse_col
  491.       select(new_index) if new_index <= 11
  492.     end
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
  496.   #--------------------------------------------------------------------------
  497.   def mouse_window_area
  498.     if viewport.nil?
  499.       vp_x, vp_y = 0, 0
  500.     else
  501.       vp_x = viewport.rect.x - viewport.ox
  502.       vp_y = viewport.rect.y - viewport.oy
  503.     end
  504.     mouse_x = Mouse.x
  505.     mouse_y = Mouse.y
  506.     item_x1 = vp_x + x + standard_padding
  507.     item_y1 = vp_y + y + standard_padding
  508.     item_x2 = vp_x + x - standard_padding + width
  509.     item_y2 = vp_y + y - standard_padding + height
  510.     if mouse_x < item_x1
  511.       mouse_col = -1
  512.     elsif mouse_x > item_x2
  513.       mouse_col = -2
  514.     else
  515.       mouse_col = (mouse_x - item_x1) / 32
  516.     end
  517.     if mouse_y < item_y1
  518.       mouse_row = -1
  519.     elsif mouse_y > item_y2
  520.       mouse_row = -2
  521.     else
  522.       mouse_row = 4 * (mouse_y - item_y1 - 1) / (item_y2 - item_y1)
  523.     end
  524.     return mouse_row, mouse_col
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # ● 获取文字
  528.   #--------------------------------------------------------------------------
  529.   def get_number
  530.     return false if @index == 9 || @index == 11
  531.     return TABLE[@index]
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # ● 判定光标位置是否在“退格”上
  535.   #--------------------------------------------------------------------------
  536.   def is_delete?
  537.     @index == 9
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # ● 判定光标位置是否在“确定”上
  541.   #--------------------------------------------------------------------------
  542.   def is_ok?
  543.     @index == 11
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ● 更新光标
  547.   #--------------------------------------------------------------------------
  548.   def update_cursor
  549.     cursor_rect.set(item_rect(@index))
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● 判定光标是否可以移动
  553.   #--------------------------------------------------------------------------
  554.   def cursor_movable?
  555.     active
  556.   end
  557.   #--------------------------------------------------------------------------
  558.   # ● 光标向下移动
  559.   #     wrap : 允许循环
  560.   #--------------------------------------------------------------------------
  561.   def cursor_down(wrap)
  562.     if @index < 9 or wrap
  563.       @index = (index + 3) % 12
  564.     end
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # ● 光标向上移动
  568.   #     wrap : 允许循环
  569.   #--------------------------------------------------------------------------
  570.   def cursor_up(wrap)
  571.     if @index >= 3 or wrap
  572.       @index = (index + 9) % 12
  573.     end
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● 光标向右移动
  577.   #     wrap : 允许循环
  578.   #--------------------------------------------------------------------------
  579.   def cursor_right(wrap)
  580.     if @index % 3 < 2
  581.       @index += 1
  582.     elsif wrap
  583.       @index -= 2
  584.     end
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 光标向左移动
  588.   #     wrap : 允许循环
  589.   #--------------------------------------------------------------------------
  590.   def cursor_left(wrap)
  591.     if @index % 3 > 0
  592.       @index -= 1
  593.     elsif wrap
  594.       @index += 2
  595.     end
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ● 处理光标的移动
  599.   #--------------------------------------------------------------------------
  600.   def process_cursor_move
  601.     super
  602.     update_cursor
  603.   end
  604.   #--------------------------------------------------------------------------
  605.   # ● “确定”、“删除字符”和“取消输入”的处理
  606.   #--------------------------------------------------------------------------
  607.   def process_handling
  608.     return unless open? && active
  609.     process_jump if Input.trigger?(:A)
  610.     process_back if Input.repeat?(:B)
  611.     process_ok   if Input.trigger?(:C)
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● 跳转“确定”
  615.   #--------------------------------------------------------------------------
  616.   def process_jump
  617.     if @index != 11
  618.       @index = 11
  619.       Sound.play_cursor
  620.     end
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● 后退一个字符
  624.   #--------------------------------------------------------------------------
  625.   def process_back
  626.     Sound.play_cancel
  627.     place = 10 ** (@digits_max - 1 - @old_window_index)
  628.     n = (@number / place) % 10
  629.     @number -= n * place
  630.     @number_proc.call(@number)
  631.     @old_window_index -= 1 if @old_window_index > 0
  632.     @index_proc.call(@old_window_index)
  633.     @refresh_proc.call
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● 按下确定键时的处理
  637.   #--------------------------------------------------------------------------
  638.   def process_ok
  639.     return if Mouse.trigger?(:L) && mouse_out_rect?
  640.     if get_number
  641.       Sound.play_cursor
  642.       place = 10 ** (@digits_max - 1 - @old_window_index)
  643.       n = get_number - (@number / place) % 10
  644.       @number += n * place
  645.       @number_proc.call(@number)
  646.       @old_window_index += 1 if @old_window_index < @digits_max - 1
  647.       @index_proc.call(@old_window_index)
  648.       @refresh_proc.call
  649.     elsif is_delete?
  650.       process_back
  651.     elsif is_ok?
  652.       on_input_ok
  653.     end
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # ● 确定
  657.   #--------------------------------------------------------------------------
  658.   def on_input_ok
  659.     @index = 0
  660.     @old_window_index = 0
  661.     $game_variables[@variable_id] = @number
  662.     Sound.play_ok
  663.     @close_proc.call
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  667.   #--------------------------------------------------------------------------
  668.   def set_mouse_pos
  669.     if viewport.nil? # necessary!
  670.       vp_x, vp_y = 0, 0
  671.     else
  672.       vp_x = viewport.rect.x - viewport.ox
  673.       vp_y = viewport.rect.y - viewport.oy
  674.     end
  675.     item_x1 = vp_x + x + standard_padding
  676.     item_y1 = vp_y + y + standard_padding
  677.     get_index = @index < 0 ? 0 : @index
  678.     new_x = item_x1 + 32 * (get_index % 3 + 0.5)
  679.     new_y = item_y1 + 24 * (get_index / 3 + 0.5)
  680.     Mouse.set_pos(new_x, new_y)
  681.   end
  682. end

  683. #==============================================================================
  684. # ■ Window_Message
  685. #------------------------------------------------------------------------------
  686. #  显示文字信息的窗口。
  687. #==============================================================================
  688. class Window_Message < Window_Base
  689.   #--------------------------------------------------------------------------
  690.   # ● 处理数值的输入(覆盖原方法)
  691.   #--------------------------------------------------------------------------
  692.   def input_number
  693.     @number_window.start
  694.     Fiber.yield while @number_window.extra_window.active
  695.   end
  696. end

  697. #==============================================================================
  698. # ■ Window_PartyCommand
  699. #------------------------------------------------------------------------------
  700. #  战斗画面中,选择“战斗/撤退”的窗口。
  701. #==============================================================================
  702. class Window_PartyCommand < Window_Command
  703.   #--------------------------------------------------------------------------
  704.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  705.   #--------------------------------------------------------------------------
  706.   def set_mouse_pos
  707.     if viewport.nil?
  708.       vp_x, vp_y = 0, 0
  709.     else
  710.       #vp_x = viewport.rect.x - viewport.ox
  711.       vp_y = viewport.rect.y - viewport.oy
  712.     end
  713.     item_x1 = x + standard_padding
  714.     item_y1 = vp_y + y + standard_padding
  715.     get_index = @index < 0 ? 0 : @index
  716.     row = get_index / col_max - top_row
  717.     col = get_index % col_max
  718.     new_x = item_x1 + item_width * (col + 0.5)
  719.     new_y = item_y1 + item_height * (row + 0.5)
  720.     Mouse.set_pos(new_x, new_y)
  721.   end
  722. end

  723. #==============================================================================
  724. # ■ Window_ActorCommand
  725. #------------------------------------------------------------------------------
  726. #  战斗画面中,选择角色行动的窗口。
  727. #==============================================================================
  728. class Window_ActorCommand < Window_Command
  729.   #--------------------------------------------------------------------------
  730.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  731.   #--------------------------------------------------------------------------
  732.   def set_mouse_pos
  733.     if viewport.nil?
  734.       vp_x, vp_y = 0, 0
  735.     else
  736.       #vp_x = viewport.rect.x - viewport.ox
  737.       vp_y = viewport.rect.y - viewport.oy
  738.     end
  739.     item_x1 = Graphics.width - width + standard_padding
  740.     item_y1 = vp_y + y + standard_padding
  741.     get_index = @index < 0 ? 0 : @index
  742.     row = get_index / col_max - top_row
  743.     col = get_index % col_max
  744.     new_x = item_x1 + item_width * (col + 0.5)
  745.     new_y = item_y1 + item_height * (row + 0.5)
  746.     Mouse.set_pos(new_x, new_y)
  747.   end
  748. end

  749. #==============================================================================
  750. # ■ Game_Player
  751. #------------------------------------------------------------------------------
  752. #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
  753. #   本类的实例请参考 $game_player 。
  754. #==============================================================================
  755. class Game_Player < Game_Character
  756.   #--------------------------------------------------------------------------
  757.   # ● 由方向移动(覆盖原方法)
  758.   #--------------------------------------------------------------------------
  759.   def move_by_input
  760.     return if !movable? || $game_map.interpreter.running?
  761.     if Input.dir4 > 0
  762.       move_straight(Input.dir4)
  763.       reset_move_path
  764.     else
  765.       move_by_mouse
  766.     end
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # ● 非移动中的处理(覆盖原方法)
  770.   #     last_moving : 此前是否正在移动
  771.   #--------------------------------------------------------------------------
  772.   def update_nonmoving(last_moving)
  773.     return if $game_map.interpreter.running?
  774.     if last_moving
  775.       $game_party.on_player_walk
  776.       return if check_touch_event
  777.     end
  778.     if movable? && Input.trigger?(:C)
  779.       return if Mouse.press?(:L) # 防止按下鼠标左键绘制路径时触发事件或载具切换
  780.       return if get_on_off_vehicle
  781.       return if check_action_event
  782.     end
  783.     update_encounter if last_moving
  784.   end
  785.   #--------------------------------------------------------------------------
  786.   # ● 判定是否跑步状态(覆盖原方法)
  787.   #--------------------------------------------------------------------------
  788.   def dash?
  789.     return false if @move_route_forcing
  790.     return false if $game_map.disable_dash?
  791.     return false if vehicle
  792.     return Input.press?(:A) || @mouse_dash
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # ● 初始化
  796.   #--------------------------------------------------------------------------
  797.   alias sion_mouse_initialize initialize
  798.   def initialize
  799.     sion_mouse_initialize
  800.     reset_move_path
  801.     @moveto_x = 0
  802.     @moveto_y = 0
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # ● 更新
  806.   #--------------------------------------------------------------------------
  807.   alias sion_mouse_update update
  808.   def update
  809.     sion_mouse_update
  810.     clear_unreachable_sign
  811.   end
  812.   #--------------------------------------------------------------------------
  813.   # ● 处理卷动
  814.   #--------------------------------------------------------------------------
  815.   alias sion_mouse_update_scroll update_scroll
  816.   def update_scroll(last_real_x, last_real_y)
  817.     return if $game_map.scrolling? || $game_map.wait_scroll
  818.     KsOfSion::New_Scroll ? new_update_scroll :
  819.       sion_mouse_update_scroll(last_real_x, last_real_y)
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● 重置移动路径相关信息
  823.   #--------------------------------------------------------------------------
  824.   def reset_move_path
  825.     @mouse_dash = false
  826.     @mouse_move_path = []
  827.     $mouse_move_sign.transparent = true
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # ● 新的卷动地图方法
  831.   #--------------------------------------------------------------------------
  832.   def new_update_scroll
  833.     return if $game_message.busy? || $game_message.visible
  834.     horz_speed = 2 ** @move_speed * KsOfSion::Map_Scroll_Spd / Graphics.width
  835.     vert_speed = 2 ** @move_speed * KsOfSion::Map_Scroll_Spd / Graphics.height
  836.     ax = $game_map.adjust_x(@real_x)
  837.     ay = $game_map.adjust_y(@real_y)
  838.     if    ay>center_y; $game_map.new_scroll_down (vert_speed * (ay - center_y))
  839.     elsif ay<center_y; $game_map.new_scroll_up   (vert_speed * (center_y - ay))
  840.     end
  841.     if    ax>center_x; $game_map.new_scroll_right(horz_speed * (ax - center_x))
  842.     elsif ax<center_x; $game_map.new_scroll_left (horz_speed * (center_x - ax))
  843.     end
  844.   end
  845.   #--------------------------------------------------------------------------
  846.   # ● 消除不能抵达图标
  847.   #--------------------------------------------------------------------------
  848.   def clear_unreachable_sign
  849.     return if Mouse.press?(:L)
  850.     if $mouse_move_sign.direction == 4 && Mouse.click_count % 20 == 0
  851.       $mouse_move_sign.transparent = true
  852.       $mouse_move_sign.direction = 2
  853.     end
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● 由鼠标移动
  857.   #--------------------------------------------------------------------------
  858.   def move_by_mouse
  859.     unless @mouse_move_path.empty? # 移动路线数组不为空则执行移动
  860.       dir = @mouse_move_path.shift
  861.       if passable?(x, y, dir) && !@mouse_move_path.empty?
  862.         move_straight(dir)
  863.       elsif @mouse_move_path.empty? # 判断是否是最后一步
  864.         x2 = $game_map.round_x_with_direction(x, dir)
  865.         y2 = $game_map.round_y_with_direction(y, dir)
  866.         move_straight(dir) unless dir.zero?
  867.         unless @x == x2 && @y == y2 # 如果移动失败,检查是否启动前方事件
  868.           check_event_trigger_there([0,1,2])
  869.           get_on_off_vehicle unless $game_map.setup_starting_event
  870.         end
  871.         $mouse_move_sign.transparent = true if $mouse_move_sign.direction == 2
  872.         @mouse_dash = false
  873.       elsif @mouse_move_path[0].zero? # 目标点无法抵达,调整朝向→目标点
  874.         @mouse_move_path.shift
  875.         @direction = dir
  876.         @mouse_dash = false
  877.       else
  878.         draw_move_path
  879.       end
  880.     end
  881.   end
  882.   #--------------------------------------------------------------------------
  883.   # ● 地图界面按下鼠标左键的处理
  884.   #--------------------------------------------------------------------------
  885.   def left_button_action
  886.     @moveto_x = $game_map.mouse_map_x
  887.     @moveto_y = $game_map.mouse_map_y
  888.     return mouse_same_pos_action if @moveto_x == @x && @moveto_y == @y
  889.     return if mouse_trigger_event?
  890.     return unless drawable?
  891.     $mouse_move_sign.moveto(@moveto_x, @moveto_y) # 移动路径点指示图
  892.     @mouse_dash = true if Mouse.double_click? # 双击冲刺
  893.     return if Mouse.left_state % 10 != 1 # 按住鼠标左键10帧绘制1次路径
  894.     for i in 1..4 # 判断目标点是否为角色周围四点
  895.       if @x == $game_map.round_x_with_direction(@moveto_x, i * 2) &&
  896.          @y == $game_map.round_y_with_direction(@moveto_y, i * 2)
  897.         $mouse_move_sign.transparent = true
  898.         @mouse_move_path = [10 - i * 2]
  899.         return
  900.       end
  901.     end
  902.     draw_move_path
  903.   end
  904.   #--------------------------------------------------------------------------
  905.   # ● 鼠标位置与玩家一致的处理
  906.   #--------------------------------------------------------------------------
  907.   def mouse_same_pos_action
  908.     unless moving? || (vehicle && !vehicle.movable?)
  909.       check_event_trigger_here([0]) # 判断是否触发重合点事件
  910.       get_on_off_vehicle if !$game_map.setup_starting_event &&
  911.         $game_map.airship.pos?(@x, @y)  # 判断是否要上、下飞艇
  912.     end
  913.   end
  914.   #--------------------------------------------------------------------------
  915.   # ● trigger 鼠标左键的处理
  916.   #--------------------------------------------------------------------------
  917.   def mouse_trigger_event?
  918.     if Mouse.trigger?(:L)
  919.       $game_map.events_xy(@moveto_x, @moveto_y).each {|event|
  920.         if event.mouse_start?
  921.           event.start
  922.           return true
  923.         end
  924.       }
  925.     end
  926.     return false
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # ● 绘制移动路径 @array[move_directions...]
  930.   #--------------------------------------------------------------------------
  931.   def draw_move_path
  932.     @mouse_move_path =
  933.     case @vehicle_type
  934.     when :walk; draw_walk_path
  935.     when :boat; draw_boat_path
  936.     when :ship; draw_ship_path
  937.     when :airship; draw_air_path
  938.     end
  939.   end
  940.   #--------------------------------------------------------------------------
  941.   # ● 判定是否可以绘制移动路径
  942.   #--------------------------------------------------------------------------
  943.   def drawable?
  944.     return false if @move_route_forcing || @followers.gathering?
  945.     return false if @vehicle_getting_on || @vehicle_getting_off
  946.     return true
  947.   end
  948.   #--------------------------------------------------------------------------
  949.   # ● 绘制行走路径 @array[move_directions...]
  950.   #--------------------------------------------------------------------------
  951.   def draw_walk_path
  952.     # 准备绘制路径表格
  953.     sheet = Table.new($game_map.width, $game_map.height)
  954.     reversed_chase_path  = []; chase_path  = []
  955.     reversed_chase_point = []; chase_point = []
  956.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  957.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  958.     reach_point = false
  959.     step = 3
  960.     loop do #loop1 开始填充表格
  961.      draw_path = false
  962.      check_points = new_start_points
  963.      new_start_points = []
  964.       loop do #loop2 从起点开始正向填充
  965.         point_x = check_points.shift
  966.         break if point_x == nil
  967.         point_y = check_points.shift
  968.         left_x  = $game_map.round_x(point_x - 1)
  969.         right_x = $game_map.round_x(point_x + 1)
  970.         up_y    = $game_map.round_y(point_y - 1)
  971.         down_y  = $game_map.round_y(point_y + 1)
  972.                     # 判断路径是否连通
  973.         path_step = step - 1
  974.         if sheet[left_x, point_y] == path_step     &&
  975.            $game_map.passable?(left_x, point_y, 6) &&
  976.            $game_map.passable?(point_x, point_y, 4)
  977.           chase_path.push(4)
  978.           chase_point = [left_x, point_y]
  979.           reversed_chase_point = [point_x, point_y]
  980.           reach_point = true; break
  981.         elsif sheet[right_x, point_y] == path_step     &&
  982.               $game_map.passable?(right_x, point_y, 4) &&
  983.               $game_map.passable?(point_x, point_y, 6)
  984.             chase_path.push(6)
  985.             chase_point = [right_x, point_y]
  986.             reversed_chase_point = [point_x, point_y]
  987.             reach_point = true; break
  988.         elsif sheet[point_x, up_y] == path_step     &&
  989.               $game_map.passable?(point_x, up_y, 2) &&
  990.               $game_map.passable?(point_x, point_y, 8)
  991.             chase_path.push(8)
  992.             chase_point = [point_x, up_y]
  993.             reversed_chase_point = [point_x, point_y]
  994.             reach_point = true; break
  995.         elsif sheet[point_x, down_y] == path_step     &&
  996.               $game_map.passable?(point_x, down_y, 8) &&
  997.               $game_map.passable?(point_x, point_y, 2)
  998.             chase_path.push(2)
  999.             chase_point = [point_x, down_y]
  1000.             reversed_chase_point = [point_x, point_y]
  1001.             reach_point = true; break
  1002.         end
  1003.         # 以需要抵达该点的步数填充路径表格 #
  1004.         if sheet[left_x, point_y] == 0              &&
  1005.            $game_map.passable?(left_x, point_y, 6)  &&
  1006.            !collide_with_events?(left_x, point_y)   &&
  1007.            $game_map.passable?(point_x, point_y, 4) &&
  1008.            !collide_with_vehicles?(left_x, point_y) #judge_end
  1009.           sheet[left_x, point_y] = step
  1010.           draw_path = true
  1011.           new_start_points.push(left_x, point_y)
  1012.         end
  1013.         if sheet[right_x, point_y] == 0             &&
  1014.            $game_map.passable?(right_x, point_y, 4) &&
  1015.            !collide_with_events?(right_x, point_y)  &&
  1016.            $game_map.passable?(point_x, point_y, 6) &&
  1017.            !collide_with_vehicles?(right_x, point_y)#judge_end
  1018.           sheet[right_x, point_y] = step
  1019.           draw_path = true
  1020.           new_start_points.push(right_x, point_y)
  1021.         end
  1022.         if sheet[point_x, up_y] == 0                &&
  1023.            $game_map.passable?(point_x, up_y, 2)    &&
  1024.            !collide_with_events?(point_x, up_y)     &&
  1025.            $game_map.passable?(point_x, point_y, 8) &&
  1026.            !collide_with_vehicles?(point_x, up_y)   #judge_end
  1027.           sheet[point_x, up_y] = step
  1028.           draw_path = true
  1029.           new_start_points.push(point_x, up_y)
  1030.         end
  1031.         if sheet[point_x, down_y] == 0              &&
  1032.            $game_map.passable?(point_x, down_y, 8)  &&
  1033.            !collide_with_events?(point_x, down_y)   &&
  1034.            $game_map.passable?(point_x, point_y, 2) &&
  1035.            !collide_with_vehicles?(point_x, down_y) #judge_end
  1036.           sheet[point_x, down_y] = step
  1037.           draw_path = true
  1038.           new_start_points.push(point_x, down_y)
  1039.         end
  1040.       end#endOfLoop2
  1041.       break if !draw_path || reach_point
  1042.       draw_path = false
  1043.       check_points = new_end_points
  1044.       new_end_points = []
  1045.       step += 1
  1046.       break if step > KsOfSion::Break_Steps &&
  1047.                !Input.press?(KsOfSion::Find_Path_Key)
  1048.       loop do #loop3 从终点开始反向填充
  1049.         point_x = check_points.shift
  1050.         break if point_x == nil
  1051.         point_y = check_points.shift
  1052.         left_x  = $game_map.round_x(point_x - 1)
  1053.         right_x = $game_map.round_x(point_x + 1)
  1054.         up_y    = $game_map.round_y(point_y - 1)
  1055.         down_y  = $game_map.round_y(point_y + 1)
  1056.         # 判断路径是否连通
  1057.         path_step = step - 1
  1058.         if sheet[left_x, point_y] == path_step     &&
  1059.            $game_map.passable?(left_x, point_y, 6) &&
  1060.            $game_map.passable?(point_x, point_y, 4)
  1061.           chase_path.push(6)
  1062.           chase_point = [point_x, point_y]
  1063.           reversed_chase_point = [left_x, point_y]
  1064.           reach_point = true; break
  1065.         elsif sheet[right_x, point_y] == path_step     &&
  1066.               $game_map.passable?(right_x, point_y, 4) &&
  1067.               $game_map.passable?(point_x, point_y, 6)
  1068.             chase_path.push(4)
  1069.             chase_point = [point_x, point_y]
  1070.             reversed_chase_point = [right_x, point_y]
  1071.             reach_point = true; break
  1072.         elsif sheet[point_x, up_y] == path_step     &&
  1073.               $game_map.passable?(point_x, up_y, 2) &&
  1074.               $game_map.passable?(point_x, point_y, 8)
  1075.             chase_path.push(2)
  1076.             chase_point = [point_x, point_y]
  1077.             reversed_chase_point = [point_x, up_y]
  1078.             reach_point = true; break
  1079.         elsif sheet[point_x, down_y] == path_step     &&
  1080.               $game_map.passable?(point_x, down_y, 8) &&
  1081.               $game_map.passable?(point_x, point_y, 2)
  1082.             chase_path.push(8)
  1083.             chase_point = [point_x, point_y]
  1084.             reversed_chase_point = [point_x, down_y]
  1085.             reach_point = true; break
  1086.         end
  1087.         # 以需要抵达该点的步数填充路径表格 #
  1088.         if sheet[left_x, point_y] == 0              &&
  1089.            $game_map.passable?(left_x, point_y, 6)  &&
  1090.            !collide_with_events?(left_x, point_y)   &&
  1091.            $game_map.passable?(point_x, point_y, 4) &&
  1092.            !collide_with_vehicles?(left_x, point_y) #judge_end
  1093.           sheet[left_x, point_y] = step
  1094.           draw_path = true
  1095.           new_end_points.push(left_x, point_y)
  1096.         end
  1097.         if sheet[right_x, point_y] == 0             &&
  1098.            $game_map.passable?(right_x, point_y, 4) &&
  1099.            !collide_with_events?(right_x, point_y)  &&
  1100.            $game_map.passable?(point_x, point_y, 6) &&
  1101.            !collide_with_vehicles?(right_x, point_y)#judge_end
  1102.           sheet[right_x, point_y] = step
  1103.           draw_path = true
  1104.           new_end_points.push(right_x, point_y)
  1105.         end
  1106.         if sheet[point_x, up_y] == 0                &&
  1107.            $game_map.passable?(point_x, up_y, 2)    &&
  1108.            !collide_with_events?(point_x, up_y)     &&
  1109.            $game_map.passable?(point_x, point_y, 8) &&
  1110.            !collide_with_vehicles?(point_x, up_y)   #judge_end
  1111.           sheet[point_x, up_y] = step
  1112.           draw_path = true
  1113.           new_end_points.push(point_x, up_y)
  1114.         end
  1115.         if sheet[point_x, down_y] == 0              &&
  1116.            $game_map.passable?(point_x, down_y, 8)  &&
  1117.            !collide_with_events?(point_x, down_y)   &&
  1118.            $game_map.passable?(point_x, point_y, 2) &&
  1119.            !collide_with_vehicles?(point_x, down_y) #judge_end
  1120.           sheet[point_x, down_y] = step
  1121.           draw_path = true
  1122.           new_end_points.push(point_x, down_y)
  1123.         end
  1124.       end#endOfLoop3
  1125.       break if !draw_path || reach_point
  1126.       step += 1
  1127.     end #endOfLoop1 路径表格填充完毕
  1128.     $mouse_move_sign.transparent = false
  1129.     # 判断指定地点能否抵达
  1130.     if reach_point
  1131.       $mouse_move_sign.direction = 2
  1132.     else
  1133.       return not_reach_point
  1134.     end
  1135.     # 根据路径表格绘制最短移动路径(反向)
  1136.     steps = step / 2 * 2 + 1
  1137.     loop_times = step / 2
  1138.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1139.     for i in 1..loop_times # forLoop
  1140.     steps -= 2
  1141.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1142.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1143.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1144.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1145.         reversed_chase_path.push(6)
  1146.         point_x = $game_map.round_x(point_x - 1)
  1147.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1148.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1149.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1150.         reversed_chase_path.push(4)
  1151.         point_x = $game_map.round_x(point_x + 1)
  1152.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1153.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1154.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1155.         reversed_chase_path.push(8)
  1156.         point_y = $game_map.round_y(point_y + 1)
  1157.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1158.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1159.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1160.         reversed_chase_path.push(2)
  1161.         point_y = $game_map.round_y(point_y - 1)
  1162.       end
  1163.     else
  1164.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1165.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1166.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1167.         reversed_chase_path.push(8)
  1168.         point_y = $game_map.round_y(point_y + 1)
  1169.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1170.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1171.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1172.         reversed_chase_path.push(2)
  1173.         point_y = $game_map.round_y(point_y - 1)
  1174.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1175.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1176.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1177.         reversed_chase_path.push(6)
  1178.         point_x = $game_map.round_x(point_x - 1)
  1179.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1180.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1181.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1182.         reversed_chase_path.push(4)
  1183.         point_x = $game_map.round_x(point_x + 1)
  1184.       end
  1185.     end
  1186.     end #endOfForLoop
  1187.     # 根据路径表格绘制最短移动路径(正向)
  1188.     steps = step / 2 * 2
  1189.     loop_times = step / 2
  1190.     point_x, point_y = chase_point[0], chase_point[1]
  1191.     for i in 2..loop_times # forLoop
  1192.     steps -= 2
  1193.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1194.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1195.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1196.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1197.         chase_path.push(2)
  1198.         point_y = $game_map.round_y(point_y + 1)
  1199.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1200.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1201.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1202.         chase_path.push(8)
  1203.         point_y = $game_map.round_y(point_y - 1)
  1204.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1205.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1206.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1207.         chase_path.push(4)
  1208.         point_x = $game_map.round_x(point_x - 1)
  1209.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1210.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1211.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1212.         chase_path.push(6)
  1213.         point_x = $game_map.round_x(point_x + 1)
  1214.       end
  1215.     else
  1216.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1217.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1218.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1219.         chase_path.push(4)
  1220.         point_x = $game_map.round_x(point_x - 1)
  1221.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1222.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1223.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1224.         chase_path.push(6)
  1225.         point_x = $game_map.round_x(point_x + 1)
  1226.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1227.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1228.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1229.         chase_path.push(2)
  1230.         point_y = $game_map.round_y(point_y + 1)
  1231.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1232.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1233.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1234.         chase_path.push(8)
  1235.         point_y = $game_map.round_y(point_y - 1)
  1236.       end
  1237.     end
  1238.     end #endOfForLoop
  1239.     reversed_chase_path.reverse + chase_path
  1240.   end#walk
  1241.   ##
  1242.   def not_reach_point
  1243.     $mouse_move_sign.direction = 4
  1244.     dx = 0; dy = 0; dir = 0
  1245.     if @moveto_x - x > 0
  1246.       if @moveto_x - x > $game_map.width - @moveto_x + x &&
  1247.           $game_map.loop_vertical?
  1248.         dx = $game_map.width - @moveto_x + x; dir = 4
  1249.       else
  1250.         dx = @moveto_x - x; dir = 6
  1251.       end
  1252.     else
  1253.       if x - @moveto_x > $game_map.width - x + @moveto_x &&
  1254.           $game_map.loop_vertical?
  1255.         dx = $game_map.width - x + @moveto_x; dir = 6
  1256.       else
  1257.         dx = x - @moveto_x; dir = 4
  1258.       end
  1259.     end
  1260.     if @moveto_y - y > 0
  1261.       if @moveto_y - y > $game_map.height - @moveto_y + y &&
  1262.           $game_map.loop_horizontal?
  1263.         dy = $game_map.height - @moveto_y + y
  1264.         dir = 8 if dy > dx
  1265.       else
  1266.         dy = @moveto_y - y
  1267.         dir = 2 if dy > dx
  1268.       end
  1269.     else
  1270.       if y - @moveto_y > $game_map.height - y + @moveto_y &&
  1271.           $game_map.loop_horizontal?
  1272.         dy = $game_map.height - y + @moveto_y
  1273.         dir = 2 if dy > dx
  1274.       else
  1275.         dy = y - @moveto_y
  1276.         dir = 8 if dy > dx
  1277.       end
  1278.     end
  1279.     return [dir, 0] # 0方向用于防止移动过程中触发事件
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 绘制boat的移动路径 @array[move_directions...]
  1283.   #--------------------------------------------------------------------------
  1284.   def draw_boat_path
  1285.     # 准备绘制路径表格
  1286.     sheet = Table.new($game_map.width, $game_map.height)
  1287.     reversed_chase_path  = []; chase_path  = []
  1288.     reversed_chase_point = []; chase_point = []
  1289.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  1290.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  1291.     reach_point = false
  1292.     step = 3
  1293.     loop do #loop1 开始填充表格
  1294.      draw_path = false
  1295.      check_points = new_start_points
  1296.      new_start_points = []
  1297.       loop do #loop2 从起点开始正向填充
  1298.         point_x = check_points.shift
  1299.         break if point_x == nil
  1300.         point_y = check_points.shift
  1301.         left_x  = $game_map.round_x(point_x - 1)
  1302.         right_x = $game_map.round_x(point_x + 1)
  1303.         up_y    = $game_map.round_y(point_y - 1)
  1304.         down_y  = $game_map.round_y(point_y + 1)
  1305.                     # 判断路径是否连通
  1306.         path_step = step - 1
  1307.         if sheet[left_x, point_y] == path_step
  1308.           chase_path.push(4)
  1309.           chase_point = [left_x, point_y]
  1310.           reversed_chase_point = [point_x, point_y]
  1311.           reach_point = true; break
  1312.         elsif sheet[right_x, point_y] == path_step
  1313.             chase_path.push(6)
  1314.             chase_point = [right_x, point_y]
  1315.             reversed_chase_point = [point_x, point_y]
  1316.             reach_point = true; break
  1317.         elsif sheet[point_x, up_y] == path_step
  1318.             chase_path.push(8)
  1319.             chase_point = [point_x, up_y]
  1320.             reversed_chase_point = [point_x, point_y]
  1321.             reach_point = true; break
  1322.         elsif sheet[point_x, down_y] == path_step
  1323.             chase_path.push(2)
  1324.             chase_point = [point_x, down_y]
  1325.             reversed_chase_point = [point_x, point_y]
  1326.             reach_point = true; break
  1327.         end
  1328.         # 以需要抵达该点的步数填充路径表格 #
  1329.         if sheet[left_x, point_y] == 0                &&
  1330.            $game_map.boat_passable?(left_x, point_y)  &&
  1331.            !collide_with_events?(left_x, point_y)     &&
  1332.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1333.           sheet[left_x, point_y] = step
  1334.           draw_path = true
  1335.           new_start_points.push(left_x, point_y)
  1336.         end
  1337.         if sheet[right_x, point_y] == 0               &&
  1338.            $game_map.boat_passable?(right_x, point_y) &&
  1339.            !collide_with_events?(right_x, point_y)    &&
  1340.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1341.           sheet[right_x, point_y] = step
  1342.           draw_path = true
  1343.           new_start_points.push(right_x, point_y)
  1344.         end
  1345.         if sheet[point_x, up_y] == 0                  &&
  1346.            $game_map.boat_passable?(point_x, up_y)    &&
  1347.            !collide_with_events?(point_x, up_y)       &&
  1348.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1349.           sheet[point_x, up_y] = step
  1350.           draw_path = true
  1351.           new_start_points.push(point_x, up_y)
  1352.         end
  1353.         if sheet[point_x, down_y] == 0                &&
  1354.            $game_map.boat_passable?(point_x, down_y)  &&
  1355.            !collide_with_events?(point_x, down_y)     &&
  1356.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1357.           sheet[point_x, down_y] = step
  1358.           draw_path = true
  1359.           new_start_points.push(point_x, down_y)
  1360.         end
  1361.       end#endOfLoop2
  1362.       break if !draw_path || reach_point
  1363.       draw_path = false
  1364.       check_points = new_end_points
  1365.       new_end_points = []
  1366.       step += 1
  1367.       break if step > KsOfSion::Break_Steps &&
  1368.                !Input.press?(KsOfSion::Find_Path_Key)
  1369.       loop do #loop3 从终点开始反向填充
  1370.         point_x = check_points.shift
  1371.         break if point_x == nil
  1372.         point_y = check_points.shift
  1373.         left_x  = $game_map.round_x(point_x - 1)
  1374.         right_x = $game_map.round_x(point_x + 1)
  1375.         up_y    = $game_map.round_y(point_y - 1)
  1376.         down_y  = $game_map.round_y(point_y + 1)
  1377.         # 判断路径是否连通
  1378.         path_step = step - 1
  1379.         if sheet[left_x, point_y] == path_step
  1380.           chase_path.push(6)
  1381.           chase_point = [point_x, point_y]
  1382.           reversed_chase_point = [left_x, point_y]
  1383.           reach_point = true; break
  1384.         elsif sheet[right_x, point_y] == path_step
  1385.             chase_path.push(4)
  1386.             chase_point = [point_x, point_y]
  1387.             reversed_chase_point = [right_x, point_y]
  1388.             reach_point = true; break
  1389.         elsif sheet[point_x, up_y] == path_step
  1390.             chase_path.push(2)
  1391.             chase_point = [point_x, point_y]
  1392.             reversed_chase_point = [point_x, up_y]
  1393.             reach_point = true; break
  1394.         elsif sheet[point_x, down_y] == path_step
  1395.             chase_path.push(8)
  1396.             chase_point = [point_x, point_y]
  1397.             reversed_chase_point = [point_x, down_y]
  1398.             reach_point = true; break
  1399.         end
  1400.         # 以需要抵达该点的步数填充路径表格 #
  1401.         if sheet[left_x, point_y] == 0                &&
  1402.            $game_map.boat_passable?(left_x, point_y)  &&
  1403.            !collide_with_events?(left_x, point_y)     &&
  1404.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1405.           sheet[left_x, point_y] = step
  1406.           draw_path = true
  1407.           new_end_points.push(left_x, point_y)
  1408.         end
  1409.         if sheet[right_x, point_y] == 0               &&
  1410.            $game_map.boat_passable?(right_x, point_y) &&
  1411.            !collide_with_events?(right_x, point_y)    &&
  1412.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1413.           sheet[right_x, point_y] = step
  1414.           draw_path = true
  1415.           new_end_points.push(right_x, point_y)
  1416.         end
  1417.         if sheet[point_x, up_y] == 0                  &&
  1418.            $game_map.boat_passable?(point_x, up_y)    &&
  1419.            !collide_with_events?(point_x, up_y)       &&
  1420.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1421.           sheet[point_x, up_y] = step
  1422.           draw_path = true
  1423.           new_end_points.push(point_x, up_y)
  1424.         end
  1425.         if sheet[point_x, down_y] == 0                &&
  1426.            $game_map.boat_passable?(point_x, down_y)  &&
  1427.            !collide_with_events?(point_x, down_y)     &&
  1428.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1429.           sheet[point_x, down_y] = step
  1430.           draw_path = true
  1431.           new_end_points.push(point_x, down_y)
  1432.         end
  1433.       end#endOfLoop3
  1434.       break if !draw_path || reach_point
  1435.       step += 1
  1436.     end #endOfLoop1 路径表格填充完毕
  1437.     $mouse_move_sign.transparent = false
  1438.     # 判断指定地点能否抵达
  1439.     reach_point ? $mouse_move_sign.direction = 2 : (return not_reach_point)
  1440.     # 根据路径表格绘制最短移动路径(正向)
  1441.     steps = step / 2 * 2
  1442.     loop_times = step / 2
  1443.     point_x, point_y = chase_point[0], chase_point[1]
  1444.     for i in 2..loop_times # forLoop
  1445.     steps -= 2
  1446.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1447.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1448.         chase_path.push(2)
  1449.         point_y = $game_map.round_y(point_y + 1)
  1450.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1451.         chase_path.push(8)
  1452.         point_y = $game_map.round_y(point_y - 1)
  1453.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1454.         chase_path.push(4)
  1455.         point_x = $game_map.round_x(point_x - 1)
  1456.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1457.         chase_path.push(6)
  1458.         point_x = $game_map.round_x(point_x + 1)
  1459.       end
  1460.     else
  1461.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1462.         chase_path.push(4)
  1463.         point_x = $game_map.round_x(point_x - 1)
  1464.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1465.         chase_path.push(6)
  1466.         point_x = $game_map.round_x(point_x + 1)
  1467.       elsif 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.       end
  1474.     end
  1475.     end #endOfForLoop
  1476.     # 如果指定点无法抵达或者登陆
  1477.     return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
  1478.     # 根据路径表格绘制最短移动路径(反向)
  1479.     steps = step / 2 * 2 + 1
  1480.     loop_times = step / 2
  1481.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1482.     for i in 1..loop_times # forLoop
  1483.     steps -= 2
  1484.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1485.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1486.         reversed_chase_path.push(6)
  1487.         point_x = $game_map.round_x(point_x - 1)
  1488.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1489.         reversed_chase_path.push(4)
  1490.         point_x = $game_map.round_x(point_x + 1)
  1491.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1492.         reversed_chase_path.push(8)
  1493.         point_y = $game_map.round_y(point_y + 1)
  1494.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1495.         reversed_chase_path.push(2)
  1496.         point_y = $game_map.round_y(point_y - 1)
  1497.       end
  1498.     else
  1499.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1500.         reversed_chase_path.push(8)
  1501.         point_y = $game_map.round_y(point_y + 1)
  1502.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1503.         reversed_chase_path.push(2)
  1504.         point_y = $game_map.round_y(point_y - 1)
  1505.       elsif 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.       end
  1512.     end
  1513.     end #endOfForLoop
  1514.     return reversed_chase_path.reverse + chase_path
  1515.   end#boat
  1516.   #--------------------------------------------------------------------------
  1517.   # ● 绘制ship的移动路径 @array[move_directions...]
  1518.   #--------------------------------------------------------------------------
  1519.   def draw_ship_path
  1520.     # 准备绘制路径表格
  1521.     sheet = Table.new($game_map.width, $game_map.height)
  1522.     reversed_chase_path  = []; chase_path  = []
  1523.     reversed_chase_point = []; chase_point = []
  1524.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  1525.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  1526.     reach_point = false
  1527.     step = 3
  1528.     loop do #loop1 开始填充表格
  1529.      draw_path = false
  1530.      check_points = new_start_points
  1531.      new_start_points = []
  1532.       loop do #loop2 从起点开始正向填充
  1533.         point_x = check_points.shift
  1534.         break if point_x == nil
  1535.         point_y = check_points.shift
  1536.         left_x  = $game_map.round_x(point_x - 1)
  1537.         right_x = $game_map.round_x(point_x + 1)
  1538.         up_y    = $game_map.round_y(point_y - 1)
  1539.         down_y  = $game_map.round_y(point_y + 1)
  1540.                     # 判断路径是否连通
  1541.         path_step = step - 1
  1542.         if sheet[left_x, point_y] == path_step
  1543.           chase_path.push(4)
  1544.           chase_point = [left_x, point_y]
  1545.           reversed_chase_point = [point_x, point_y]
  1546.           reach_point = true; break
  1547.         elsif sheet[right_x, point_y] == path_step
  1548.             chase_path.push(6)
  1549.             chase_point = [right_x, point_y]
  1550.             reversed_chase_point = [point_x, point_y]
  1551.             reach_point = true; break
  1552.         elsif sheet[point_x, up_y] == path_step
  1553.             chase_path.push(8)
  1554.             chase_point = [point_x, up_y]
  1555.             reversed_chase_point = [point_x, point_y]
  1556.             reach_point = true; break
  1557.         elsif sheet[point_x, down_y] == path_step
  1558.             chase_path.push(2)
  1559.             chase_point = [point_x, down_y]
  1560.             reversed_chase_point = [point_x, point_y]
  1561.             reach_point = true; break
  1562.         end
  1563.         # 以需要抵达该点的步数填充路径表格 #
  1564.         if sheet[left_x, point_y] == 0                &&
  1565.            $game_map.ship_passable?(left_x, point_y)  &&
  1566.            !collide_with_events?(left_x, point_y)     &&
  1567.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1568.           sheet[left_x, point_y] = step
  1569.           draw_path = true
  1570.           new_start_points.push(left_x, point_y)
  1571.         end
  1572.         if sheet[right_x, point_y] == 0               &&
  1573.            $game_map.ship_passable?(right_x, point_y) &&
  1574.            !collide_with_events?(right_x, point_y)    &&
  1575.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1576.           sheet[right_x, point_y] = step
  1577.           draw_path = true
  1578.           new_start_points.push(right_x, point_y)
  1579.         end
  1580.         if sheet[point_x, up_y] == 0                  &&
  1581.            $game_map.ship_passable?(point_x, up_y)    &&
  1582.            !collide_with_events?(point_x, up_y)       &&
  1583.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1584.           sheet[point_x, up_y] = step
  1585.           draw_path = true
  1586.           new_start_points.push(point_x, up_y)
  1587.         end
  1588.         if sheet[point_x, down_y] == 0                &&
  1589.            $game_map.ship_passable?(point_x, down_y)  &&
  1590.            !collide_with_events?(point_x, down_y)     &&
  1591.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1592.           sheet[point_x, down_y] = step
  1593.           draw_path = true
  1594.           new_start_points.push(point_x, down_y)
  1595.         end
  1596.       end#endOfLoop2
  1597.       break if !draw_path || reach_point
  1598.       draw_path = false
  1599.       check_points = new_end_points
  1600.       new_end_points = []
  1601.       step += 1
  1602.       break if step > KsOfSion::Break_Steps &&
  1603.                !Input.press?(KsOfSion::Find_Path_Key)
  1604.       loop do #loop3 从终点开始反向填充
  1605.         point_x = check_points.shift
  1606.         break if point_x == nil
  1607.         point_y = check_points.shift
  1608.         left_x  = $game_map.round_x(point_x - 1)
  1609.         right_x = $game_map.round_x(point_x + 1)
  1610.         up_y    = $game_map.round_y(point_y - 1)
  1611.         down_y  = $game_map.round_y(point_y + 1)
  1612.         # 判断路径是否连通
  1613.         path_step = step - 1
  1614.         if sheet[left_x, point_y] == path_step
  1615.           chase_path.push(6)
  1616.           chase_point = [point_x, point_y]
  1617.           reversed_chase_point = [left_x, point_y]
  1618.           reach_point = true; break
  1619.         elsif sheet[right_x, point_y] == path_step
  1620.             chase_path.push(4)
  1621.             chase_point = [point_x, point_y]
  1622.             reversed_chase_point = [right_x, point_y]
  1623.             reach_point = true; break
  1624.         elsif sheet[point_x, up_y] == path_step
  1625.             chase_path.push(2)
  1626.             chase_point = [point_x, point_y]
  1627.             reversed_chase_point = [point_x, up_y]
  1628.             reach_point = true; break
  1629.         elsif sheet[point_x, down_y] == path_step
  1630.             chase_path.push(8)
  1631.             chase_point = [point_x, point_y]
  1632.             reversed_chase_point = [point_x, down_y]
  1633.             reach_point = true; break
  1634.         end
  1635.         # 以需要抵达该点的步数填充路径表格 #
  1636.         if sheet[left_x, point_y] == 0                &&
  1637.            $game_map.ship_passable?(left_x, point_y)  &&
  1638.            !collide_with_events?(left_x, point_y)     &&
  1639.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1640.           sheet[left_x, point_y] = step
  1641.           draw_path = true
  1642.           new_end_points.push(left_x, point_y)
  1643.         end
  1644.         if sheet[right_x, point_y] == 0               &&
  1645.            $game_map.ship_passable?(right_x, point_y) &&
  1646.            !collide_with_events?(right_x, point_y)    &&
  1647.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1648.           sheet[right_x, point_y] = step
  1649.           draw_path = true
  1650.           new_end_points.push(right_x, point_y)
  1651.         end
  1652.         if sheet[point_x, up_y] == 0                  &&
  1653.            $game_map.ship_passable?(point_x, up_y)    &&
  1654.            !collide_with_events?(point_x, up_y)       &&
  1655.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1656.           sheet[point_x, up_y] = step
  1657.           draw_path = true
  1658.           new_end_points.push(point_x, up_y)
  1659.         end
  1660.         if sheet[point_x, down_y] == 0                &&
  1661.            $game_map.ship_passable?(point_x, down_y)  &&
  1662.            !collide_with_events?(point_x, down_y)     &&
  1663.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1664.           sheet[point_x, down_y] = step
  1665.           draw_path = true
  1666.           new_end_points.push(point_x, down_y)
  1667.         end
  1668.       end#endOfLoop3
  1669.       break if !draw_path || reach_point
  1670.       step += 1
  1671.     end #endOfLoop1 路径表格填充完毕
  1672.     $mouse_move_sign.transparent = false
  1673.     # 判断指定地点能否抵达
  1674.     reach_point ? $mouse_move_sign.direction = 2 : (return not_reach_point)
  1675.     # 根据路径表格绘制最短移动路径(正向)
  1676.     steps = step / 2 * 2
  1677.     loop_times = step / 2
  1678.     point_x, point_y = chase_point[0], chase_point[1]
  1679.     for i in 2..loop_times # forLoop
  1680.     steps -= 2
  1681.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1682.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1683.         chase_path.push(2)
  1684.         point_y = $game_map.round_y(point_y + 1)
  1685.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1686.         chase_path.push(8)
  1687.         point_y = $game_map.round_y(point_y - 1)
  1688.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1689.         chase_path.push(4)
  1690.         point_x = $game_map.round_x(point_x - 1)
  1691.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1692.         chase_path.push(6)
  1693.         point_x = $game_map.round_x(point_x + 1)
  1694.       end
  1695.     else
  1696.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1697.         chase_path.push(4)
  1698.         point_x = $game_map.round_x(point_x - 1)
  1699.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1700.         chase_path.push(6)
  1701.         point_x = $game_map.round_x(point_x + 1)
  1702.       elsif 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.       end
  1709.     end
  1710.     end #endOfForLoop
  1711.     # 如果指定点无法抵达或者登陆
  1712.     return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
  1713.     # 根据路径表格绘制最短移动路径(反向)
  1714.     steps = step / 2 * 2 + 1
  1715.     loop_times = step / 2
  1716.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1717.     for i in 1..loop_times # forLoop
  1718.     steps -= 2
  1719.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1720.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1721.         reversed_chase_path.push(6)
  1722.         point_x = $game_map.round_x(point_x - 1)
  1723.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1724.         reversed_chase_path.push(4)
  1725.         point_x = $game_map.round_x(point_x + 1)
  1726.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1727.         reversed_chase_path.push(8)
  1728.         point_y = $game_map.round_y(point_y + 1)
  1729.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1730.         reversed_chase_path.push(2)
  1731.         point_y = $game_map.round_y(point_y - 1)
  1732.       end
  1733.     else
  1734.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1735.         reversed_chase_path.push(8)
  1736.         point_y = $game_map.round_y(point_y + 1)
  1737.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1738.         reversed_chase_path.push(2)
  1739.         point_y = $game_map.round_y(point_y - 1)
  1740.       elsif 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.       end
  1747.     end
  1748.     end #endOfForLoop
  1749.     return reversed_chase_path.reverse + chase_path
  1750.   end#ship
  1751.   #--------------------------------------------------------------------------
  1752.   # ● 绘制airship的移动路径 @array[move_directions...]
  1753.   #--------------------------------------------------------------------------
  1754.   def draw_air_path
  1755.     $mouse_move_sign.transparent = false
  1756.     # 准备绘制路径表格
  1757.     sheet = Table.new($game_map.width, $game_map.height)
  1758.     new_check_point = [x, y]; sheet[x, y] = 1
  1759.     reach_point = false;      step = 2
  1760.     loop do #loop1
  1761.      check_point = new_check_point
  1762.      new_check_point = []
  1763.       loop do #loop2
  1764.         point_x = check_point.shift
  1765.         break if point_x == nil
  1766.         point_y = check_point.shift
  1767.         if point_x == @moveto_x && point_y == @moveto_y
  1768.           reach_point = true; break
  1769.         end
  1770.         left_x  = $game_map.round_x(point_x - 1)
  1771.         right_x = $game_map.round_x(point_x + 1)
  1772.         up_y    = $game_map.round_y(point_y - 1)
  1773.         down_y  = $game_map.round_y(point_y + 1)
  1774.         # 以需要抵达该点的步数填充路径表格 #
  1775.         if sheet[left_x, point_y] == 0
  1776.           sheet[left_x, point_y] = step
  1777.           new_check_point.push(left_x, point_y)
  1778.         end
  1779.         if sheet[right_x, point_y] == 0
  1780.           sheet[right_x, point_y] = step
  1781.           new_check_point.push(right_x, point_y)
  1782.         end
  1783.         if sheet[point_x, up_y] == 0
  1784.           sheet[point_x, up_y] = step
  1785.           new_check_point.push(point_x, up_y)
  1786.         end
  1787.         if sheet[point_x, down_y] == 0
  1788.           sheet[point_x, down_y] = step
  1789.           new_check_point.push(point_x, down_y)
  1790.         end
  1791.       end#endOfLoop2
  1792.       break if reach_point
  1793.       step += 1
  1794.     end #endOfLoop1
  1795.     # 根据路径表格绘制最短移动路径 #
  1796.     reversed_chase_path = []; step -= 1
  1797.     point_x, point_y = @moveto_x, @moveto_y
  1798.     for i in 2..step
  1799.     step -= 1
  1800.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1801.       if    sheet[$game_map.round_x(point_x - 1), point_y] == step
  1802.         reversed_chase_path.push(6)
  1803.         point_x = $game_map.round_x(point_x - 1)
  1804.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
  1805.         reversed_chase_path.push(4)
  1806.         point_x = $game_map.round_x(point_x + 1)
  1807.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step
  1808.         reversed_chase_path.push(8)
  1809.         point_y = $game_map.round_y(point_y + 1)
  1810.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
  1811.         reversed_chase_path.push(2)
  1812.         point_y = $game_map.round_y(point_y - 1)
  1813.       end
  1814.     else
  1815.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == step
  1816.         reversed_chase_path.push(8)
  1817.         point_y = $game_map.round_y(point_y + 1)
  1818.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
  1819.         reversed_chase_path.push(2)
  1820.         point_y = $game_map.round_y(point_y - 1)
  1821.       elsif 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.       end
  1828.     end
  1829.     end #endOfForLoop
  1830.     return reversed_chase_path.reverse
  1831.   end#airship
  1832.   #--------------------------------------------------------------------------
  1833.   # ● 判断目标点是否能抵达、登陆,用于船只路径绘制
  1834.   #--------------------------------------------------------------------------
  1835.   def landable?(x, y, path)
  1836.     case @vehicle_type
  1837.       when :ship; return $game_map.ship_passable?(x, y) ||
  1838.         $game_map.passable?(x, y, 10 - path[-1])
  1839.       when :boat; return $game_map.boat_passable?(x, y) ||
  1840.         $game_map.passable?(x, y, 10 - path[-1])
  1841.     end
  1842.   end
  1843. end

  1844. #==============================================================================
  1845. # ■ Game_Map
  1846. #------------------------------------------------------------------------------
  1847. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
  1848. #   本类的实例请参考 $game_map 。
  1849. #==============================================================================
  1850. class Game_Map
  1851.   #--------------------------------------------------------------------------
  1852.   # ● 初始化对象
  1853.   #--------------------------------------------------------------------------
  1854.   alias sion_mouse_initialize initialize
  1855.   def initialize
  1856.     sion_mouse_initialize
  1857.     creat_move_sign  ###
  1858.     set_constants
  1859.   end
  1860.   #--------------------------------------------------------------------------
  1861.   # ● 更新画面
  1862.   #     main : 事件解释器更新的标志
  1863.   #--------------------------------------------------------------------------
  1864.   alias sion_mouse_update update
  1865.   def update(main = false)
  1866.     sion_mouse_update(main)
  1867.     update_move_sign
  1868.   end
  1869.   #--------------------------------------------------------------------------
  1870.   # ● 设置显示位置
  1871.   #--------------------------------------------------------------------------
  1872.   alias sion_mouse_set_display_pos set_display_pos
  1873.   def set_display_pos(x, y)
  1874.     sion_mouse_set_display_pos(x, y)
  1875.     @_display_y_ = @display_y
  1876.     @_display_x_ = @display_x
  1877.   end
  1878.   #--------------------------------------------------------------------------
  1879.   # ● 创建显示路径点的事件
  1880.   #--------------------------------------------------------------------------
  1881.   def creat_move_sign
  1882.     $mouse_move_sign = Move_Sign.new
  1883.   end
  1884.   #--------------------------------------------------------------------------
  1885.   # ● 更新显示路径点的事件
  1886.   #--------------------------------------------------------------------------
  1887.   def set_constants
  1888.     @mouse_pos_setted = true
  1889.     @set_pos_prepared = false
  1890.     @mouse_old_x = 0
  1891.     @mouse_old_y = 0
  1892.   end
  1893.   #--------------------------------------------------------------------------
  1894.   # ● 更新显示路径点的事件
  1895.   #--------------------------------------------------------------------------
  1896.   def update_move_sign
  1897.     $mouse_move_sign.update
  1898.   end
  1899.   #--------------------------------------------------------------------------
  1900.   # ● 获取鼠标位于的地图块的x、y坐标
  1901.   #--------------------------------------------------------------------------
  1902.   def mouse_map_x
  1903.     round_x((@display_x + Mouse.x / 32.0).to_i)
  1904.   end
  1905.   def mouse_map_y
  1906.     round_y((@display_y + Mouse.y / 32.0).to_i)
  1907.   end
  1908.   #--------------------------------------------------------------------------
  1909.   # ● 返回地图画面时重设鼠标坐标
  1910.   #--------------------------------------------------------------------------
  1911.   def reset_mouse_pos
  1912.     return if @mouse_pos_setted
  1913.     Mouse.set_pos(@mouse_old_x, @mouse_old_y)
  1914.     @mouse_pos_setted = true
  1915.     @set_pos_prepared = false
  1916.   end
  1917.   #--------------------------------------------------------------------------
  1918.   # ● 重设鼠标的坐标
  1919.   #--------------------------------------------------------------------------
  1920.   def prepare_reset_mouse_pos
  1921.     return if @set_pos_prepared
  1922.     @mouse_pos_setted = false
  1923.     @mouse_old_x = Mouse.x
  1924.     @mouse_old_y = Mouse.y
  1925.     @set_pos_prepared = true
  1926.   end
  1927.   #--------------------------------------------------------------------------
  1928.   # ● 向下卷动
  1929.   #--------------------------------------------------------------------------
  1930.   def new_scroll_down(distance)
  1931.     if loop_vertical?
  1932.       @_display_y_ += distance
  1933.       @_display_y_ %= @map.height
  1934.       @parallax_y += distance if @parallax_loop_y
  1935.     else
  1936.       last_y = @_display_y_
  1937.       @_display_y_ = [@_display_y_ + distance, height - screen_tile_y].min
  1938.       @parallax_y += @_display_y_ - last_y
  1939.     end
  1940.     @display_y = (@_display_y_ * 32).round / 32.0
  1941.   end
  1942.   #--------------------------------------------------------------------------
  1943.   # ● 向左卷动
  1944.   #--------------------------------------------------------------------------
  1945.   def new_scroll_left(distance)
  1946.     if loop_horizontal?
  1947.       @_display_x_ += @map.width - distance
  1948.       @_display_x_ %= @map.width
  1949.       @parallax_x -= distance if @parallax_loop_x
  1950.     else
  1951.       last_x = @_display_x_
  1952.       @_display_x_ = [@_display_x_ - distance, 0].max
  1953.       @parallax_x += @_display_x_ - last_x
  1954.     end
  1955.     @display_x = (@_display_x_ * 32).round / 32.0
  1956.   end
  1957.   #--------------------------------------------------------------------------
  1958.   # ● 向右卷动
  1959.   #--------------------------------------------------------------------------
  1960.   def new_scroll_right(distance)
  1961.     if loop_horizontal?
  1962.       @_display_x_ += distance
  1963.       @_display_x_ %= @map.width
  1964.       @parallax_x += distance if @parallax_loop_x
  1965.     else
  1966.       last_x = @_display_x_
  1967.       @_display_x_ = [@_display_x_ + distance, (width - screen_tile_x)].min
  1968.       @parallax_x += @_display_x_ - last_x
  1969.     end
  1970.     @display_x = (@_display_x_ * 32).round / 32.0
  1971.   end
  1972.   #--------------------------------------------------------------------------
  1973.   # ● 向上卷动
  1974.   #--------------------------------------------------------------------------
  1975.   def new_scroll_up(distance)
  1976.     if loop_vertical?
  1977.       @_display_y_ += @map.height - distance
  1978.       @_display_y_ %= @map.height
  1979.       @parallax_y -= distance if @parallax_loop_y
  1980.     else
  1981.       last_y = @_display_y_
  1982.       @_display_y_ = [@_display_y_ - distance, 0].max
  1983.       @parallax_y += @_display_y_ - last_y
  1984.     end
  1985.     @display_y = (@_display_y_ * 32).round / 32.0
  1986.   end
  1987. end

  1988. #==============================================================================
  1989. # ■ Spriteset_Map
  1990. #------------------------------------------------------------------------------
  1991. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
  1992. #==============================================================================
  1993. class Spriteset_Map
  1994.   #--------------------------------------------------------------------------
  1995.   # ● 生成路径点精灵
  1996.   #--------------------------------------------------------------------------
  1997.   alias sion_mouse_create_characters create_characters
  1998.   def create_characters
  1999.     sion_mouse_create_characters
  2000.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
  2001.   end
  2002. end

  2003. #==============================================================================
  2004. # ■ SceneManager
  2005. #==============================================================================
  2006. class << SceneManager
  2007.   alias sion_mouse_snapshot_for_background snapshot_for_background
  2008.   def snapshot_for_background
  2009.     Mouse.sprite.visible = false
  2010.     sion_mouse_snapshot_for_background
  2011.     Mouse.sprite.visible = true
  2012.   end
  2013. end
  2014. #==============================================================================
  2015. # ■ Scene_Map
  2016. #------------------------------------------------------------------------------
  2017. #  地图画面
  2018. #==============================================================================
  2019. class Scene_Map
  2020.   #--------------------------------------------------------------------------
  2021.   # ● 画面更新
  2022.   #--------------------------------------------------------------------------
  2023.   alias sion_mouse_update_scene update_scene
  2024.   def update_scene
  2025.     sion_mouse_update_scene
  2026.     update_mouse_action unless scene_changing? || $game_map.interpreter.running?
  2027.   end
  2028.   #--------------------------------------------------------------------------
  2029.   # ● 场所移动前的处理
  2030.   #--------------------------------------------------------------------------
  2031.   alias sion_mouse_pre_transfer pre_transfer
  2032.   def pre_transfer
  2033.     $game_player.reset_move_path
  2034.     sion_mouse_pre_transfer
  2035.   end
  2036.   #--------------------------------------------------------------------------
  2037.   # ● 监听鼠标左键的按下
  2038.   #--------------------------------------------------------------------------
  2039.   def update_mouse_action
  2040.     $game_player.left_button_action if Mouse.press?(:L)
  2041.   end
  2042. end

  2043. #==============================================================================
  2044. # ■ Scene_File
  2045. #------------------------------------------------------------------------------
  2046. #  存档画面和读档画面共同的父类
  2047. #==============================================================================
  2048. class Scene_File < Scene_MenuBase
  2049.   #--------------------------------------------------------------------------
  2050.   # ● 开始处理
  2051.   #--------------------------------------------------------------------------
  2052.   alias sion_mouse_start start
  2053.   def start
  2054.     sion_mouse_start
  2055.     @move_state = 0
  2056.     set_mouse_pos
  2057.   end
  2058.   #--------------------------------------------------------------------------
  2059.   # ● 更新画面
  2060.   #--------------------------------------------------------------------------
  2061.   alias sion_mouse_update update
  2062.   def update
  2063.     sion_mouse_update
  2064.     Input.dir4.zero? ? set_cursor : set_mouse_pos
  2065.   end
  2066.   #--------------------------------------------------------------------------
  2067.   # ● 更新光标
  2068.   #--------------------------------------------------------------------------
  2069.   def set_cursor
  2070.     @move_state += 1
  2071.     last_index = @index
  2072.     if mouse_which_window == -2
  2073.       if (@move_state - 1) % 6 == 0
  2074.         @index = (@index + 1) % item_max if @index < item_max - 1
  2075.       end
  2076.     elsif mouse_which_window == -1
  2077.       if (@move_state - 1) % 6 == 0
  2078.         @index = (@index - 1 + item_max) % item_max if @index > 0
  2079.       end
  2080.     else
  2081.       @move_state = 0
  2082.       @index = top_index + mouse_which_window
  2083.     end
  2084.     ensure_cursor_visible
  2085.     if @index != last_index
  2086.       @savefile_windows[last_index].selected = false
  2087.       @savefile_windows[@index].selected = true
  2088.     end
  2089.   end
  2090.   #--------------------------------------------------------------------------
  2091.   # ● 判断鼠标位于哪个窗口
  2092.   #--------------------------------------------------------------------------
  2093.   def mouse_which_window
  2094.     mouse_x = Mouse.x
  2095.     mouse_y = Mouse.y
  2096.     if mouse_y < @help_window.height + 14
  2097.       mouse_row = -1
  2098.     elsif mouse_y > Graphics.height - 14
  2099.       mouse_row = -2
  2100.     else
  2101.       mouse_row = 4 * (mouse_y - @help_window.height) /
  2102.         (Graphics.height - @help_window.height)
  2103.     end
  2104.     return mouse_row
  2105.   end
  2106.   #--------------------------------------------------------------------------
  2107.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  2108.   #--------------------------------------------------------------------------
  2109.   def set_mouse_pos
  2110.     new_x = 40
  2111.     new_y = @help_window.height + savefile_height * (@index - top_index) + 24
  2112.     Mouse.set_pos(new_x, new_y)
  2113.   end
  2114. end

  2115. #==============================================================================
  2116. # ■ Game_Event
  2117. #------------------------------------------------------------------------------
  2118. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
  2119. #   在 Game_Map 类的内部使用。
  2120. #==============================================================================
  2121. class Game_Event < Game_Character
  2122.   alias_method :sion_mouse_start, :start
  2123.   alias_method :sion_mouse_setup_page, :setup_page
  2124.   def start
  2125.     return if mouse_start? && !Mouse.press?(:L)
  2126.     sion_mouse_start
  2127.   end
  2128.   def mouse_start?
  2129.     @mouse_start
  2130.   end
  2131.   def setup_page(p)
  2132.     sion_mouse_setup_page(p)
  2133.     sion_mouse_read_event_notes
  2134.   end
  2135.   def sion_mouse_read_event_notes
  2136.     @mouse_start = false
  2137.     @list.each {|cmd| break if sion_mouse_scan_list(cmd)} unless empty?
  2138.   end
  2139.   def sion_mouse_scan_list(cmd)
  2140.     return false unless cmd.code == 108 || cmd.code == 408
  2141.     return @mouse_start = cmd.parameters[0].include?("鼠标启动")
  2142.   end
  2143. end

  2144. #encoding:utf-8
  2145. #==============================================================================
  2146. # ■ BattleManager
  2147. #------------------------------------------------------------------------------
  2148. #  战斗过程的管理器。
  2149. #==============================================================================
  2150. class << BattleManager
  2151.   alias_method :sion_mouse_on_encounter, :on_encounter
  2152.   # 遇敌后重置移动路径
  2153.   def on_encounter
  2154.     $game_player.reset_move_path
  2155.     sion_mouse_on_encounter
  2156.   end
  2157. end


  2158. # v2.32 卷动地图优化
  2159. class Game_Interpreter
  2160.   alias_method :sion_mouse_command_204, :command_204
  2161.   def command_204
  2162.     sion_mouse_command_204
  2163.     case next_event_code
  2164.     when 204
  2165.       Fiber.yield while $game_map.scrolling?
  2166.       @index += 1
  2167.       execute_command
  2168.     when 230
  2169.       $game_map.wait_scroll = true
  2170.       @index += 1
  2171.       execute_command
  2172.       $game_map.wait_scroll = false
  2173.     end
  2174.   end
  2175.   #230 wait
  2176. end

  2177. class Game_Map
  2178.   attr_accessor :wait_scroll
  2179.   #--------------------------------------------------------------------------
  2180.   # ● 更新画面 覆盖原方法
  2181.   #     main : 事件解释器更新的标志
  2182.   #--------------------------------------------------------------------------
  2183.   def update(main = false)
  2184.     refresh if @need_refresh
  2185.     update_scroll
  2186.     update_interpreter if main
  2187.     update_events
  2188.     update_vehicles
  2189.     update_parallax
  2190.     @screen.update
  2191.   end
  2192. end
复制代码

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

用了鼠标脚本后的隔空取物
梦石
0
星屑
1297
在线时间
995 小时
注册时间
2014-12-14
回帖
2939

开拓者

发表于 2016-7-16 14:09:14 | 显示全部楼层
本帖最后由 Vortur 于 2016-10-16 22:51 编辑



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




你好~
  代码放到【代码框】里,然后使用【Toggle】会更方便!~
  隔空取物并非bug,而是缺乏一个判断!~~直接使用事件来达成的方式就不说了,这里卖弄下事件脚本~~
思路1:判断玩家处于某固定位置(当玩家处于地图(1,1)坐标时)

  1. $game_player.x==1 &&  $game_player.y==1
复制代码

此思路较下述的优势在于,【当这类判断事件不多时】,写得东西少



.
思路2:判断玩家处于某事件旁(玩家处于当前事件上下左右四方向)

  1. $game_map.events[get_character(0).id].x.to_i==($game_player.x+1).to_i && $game_map.events[get_character(0).id].y.to_i==$game_player.y.to_i #处于事件左方
  2. $game_map.events[get_character(0).id].x.to_i==($game_player.x-1).to_i && $game_map.events[get_character(0).id].y.to_i==$game_player.y.to_i #右方
  3. #上、下方略
复制代码

此思路较上述的优势,在于:只需1次写好,之后便【可以直接复制事件】




.
上述思路配合【判断角色朝向】,即可达成必要功能
部分姿势点解释
get_character(0).id #表示当前事件
.to_i #表示转换为数值



脚本出处:
【新手礼包】、【事件脚本汇总1】、【事件脚本汇总2】
@VIPArcher @taroxd
@丿梁丶小柒
管理员大人直接结贴吧~

祝君愉快!


评分

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

查看全部评分

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

使用道具 举报

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

评分

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

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部