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

Project1

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

[已经解决] 报错求助!undefined method 'tp' for nil:NilClass

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
帖子
101
跳转到指定楼层
1
发表于 2013-10-22 20:33:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
改了战斗人数6人,用的横版,没问题的。
可是当加入第7个人后再战斗报错啦,求助,谢谢帮忙看下
报错如下:
脚本"横版"第4970行:发生NoMethodError。
undefined method 'tp' for nil:NilClass

横版脚本在下面:
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Sideview Ver100
  3. #------------------------------------------------------------------------------
  4. #  管理角色侧视图战斗设定。
  5. #   汉化by: 圣痕
  6. #==============================================================================
  7. class SideView
  8.   #--------------------------------------------------------------------------
  9.   # ● 定义实例变量
  10.   #--------------------------------------------------------------------------
  11.   attr_accessor   :x                    # 画面X坐标
  12.   attr_accessor   :y                    # 画面Y坐标
  13.   attr_accessor   :z                    # 画面Z坐标
  14.   attr_accessor   :h                    # 高度坐标
  15.   attr_accessor   :j                    # 跳跃坐标
  16.   attr_accessor   :c                    # 曲线坐标
  17.   attr_accessor   :ox                   # 横原点
  18.   attr_accessor   :oy                   # 纵原点
  19.   attr_accessor   :oy_adjust            # 縦原点修正
  20.   attr_accessor   :angle                # 旋转角度
  21.   attr_accessor   :zoom_x               # 横扩大率
  22.   attr_accessor   :zoom_y               # 纵扩大率
  23.   attr_accessor   :pattern_w            # 细胞横位置(矩形内)
  24.   attr_accessor   :pattern_h            # 细胞縦位置(矩形内)
  25.   attr_accessor   :sx                   # 细胞横位置(画像全体)
  26.   attr_accessor   :sy                   # 细胞縦位置(画像全体)
  27.   attr_accessor   :pattern_type         # 单元更新类型
  28.   attr_accessor   :pattern_time         # 单元更新间隔
  29.   attr_accessor   :graphic_name         # 角色画像文件名
  30.   attr_accessor   :graphic_file_index   # 角色画像文件名指数
  31.   attr_accessor   :graphic_index        # 角色画像指数
  32.   attr_accessor   :cw                   # 矩形横组件
  33.   attr_accessor   :ch                   # 矩形纵组件
  34.   attr_accessor   :shadow_visible       # 阴影表示
  35.   attr_accessor   :weapon_visible       # 武器表示
  36.  
  37.   attr_accessor   :wait                 # 下一个动作等待时间
  38.   attr_accessor   :weapon_index         # 显示图像的武器排列指数
  39.   attr_accessor   :weapon_end           # 武器动画结束标记
  40.   attr_accessor   :force_action         # 強制动作
  41.   attr_accessor   :target_battler       # 目标角色情報
  42.   attr_accessor   :second_targets       # 第二个目标角色情報
  43.   attr_accessor   :m_a_targets          # 飞行动画目标情報
  44.   attr_accessor   :individual_targets   # 个别处理目标角色情报
  45.   attr_accessor   :effect_data          # 效果数据
  46.   attr_accessor   :anime_id             # 动画ID配列
  47.   attr_accessor   :anime_move_id        # 飞行动画ID配列
  48.   attr_accessor   :mirror               # 反转标志
  49.   attr_accessor   :opacity              # 透明度
  50.   attr_accessor   :opacity_data         # 透明度操作情报
  51.   attr_accessor   :set_damage           # 战斗场景的损伤处理
  52.   attr_accessor   :m_a_data             # 飞行动画情报
  53.   attr_accessor   :m_a_starter          # 飞行动画开始目标情报
  54.   attr_accessor   :action_end           # 行动后结束
  55.   attr_accessor   :damage_anime_data    # 战斗损伤动画的数据
  56.   attr_accessor   :anime_no_mirror      # 战斗动画禁止反转
  57.   attr_accessor   :anime_horming        # 战斗动画归位标志
  58.   attr_accessor   :anime_camera_zoom    # 战斗动画扩大缩小的相机
  59.   attr_accessor   :anime_plus_z         # 战斗动画Z坐标修正
  60.   attr_accessor   :derivation_skill_id  # 技能连发ID
  61.   attr_accessor   :immortal             # 无敌标志
  62.   attr_accessor   :mirage               # 残像数据
  63.   attr_accessor   :balloon_data         # 气球数据
  64.   attr_accessor   :timing               # 从角色不同的时序数据
  65.   attr_accessor   :timing_targets       # 时间数据传递另个角色
  66.   attr_accessor   :color_set            # 色调变更数据
  67.   attr_accessor   :color                # 色调数据
  68.   attr_accessor   :change_up            # 画像变更数据
  69.   attr_accessor   :hit                  # 更加次数
  70.   attr_accessor   :add_state            # 增加状态的显示防止标记
  71.   attr_accessor   :counter_id           # 计数器时的技能ID
  72.   attr_accessor   :reflection_id        # 魔法反射式的动画ID
  73.   attr_accessor   :result_damage        # 回合结束时的HP数据变更
  74.   attr_accessor   :active               # 行动权
  75.   attr_accessor   :anime_off            # 战斗动画删除
  76.   attr_accessor   :command_action       # 行动指令标志
  77.  
  78.   attr_accessor   :base_x               # 初期位置 X坐标
  79.   attr_accessor   :base_y               # 初期位置 Y坐标
  80.   attr_accessor   :base_h               # 初期位置 高度坐标
  81.   attr_accessor   :max_pattern_w        # 单元的横分割数
  82.   attr_accessor   :max_pattern_h        # 单元的纵分割数
  83.  
  84.   attr_reader     :collapse             # 角色战斗不能
  85.   attr_reader     :picture              # 图片显示标记
  86.   #--------------------------------------------------------------------------
  87.   # ● 初始化物件
  88.   #--------------------------------------------------------------------------
  89.   def initialize(battler)
  90.     [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  91.     reset
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 初始化
  95.   #--------------------------------------------------------------------------
  96.   def reset
  97.     @x = 0
  98.     @y = 0
  99.     @z = 0
  100.     @h = 0
  101.     @j = 0
  102.     @c = 0
  103.     [url=home.php?mod=space&uid=271873]@jump[/url] = []
  104.     @curve = []
  105.     @ox = 0
  106.     @oy = 0
  107.     @oy_adjust = 0
  108.     @z_plus = 0
  109.     @move_time = 0
  110.     [url=home.php?mod=space&uid=124954]@Angle[/url] = 0
  111.     @angle_time = 0
  112.     @zoom_x = 1
  113.     @zoom_y = 1
  114.     @zoom_time = 0
  115.     @pattern_w = 0
  116.     @pattern_h = 0
  117.     @sx = 0
  118.     @sy = 0
  119.     @pattern_type = 0
  120.     @pattern_time = 0
  121.     @pattern_rest_time = 0
  122.     @graphic_name = ""
  123.     @graphic_file_index = ""
  124.     @graphic_index = 0
  125.     @cw = 0
  126.     @ch = 0
  127.     @shadow_visible = false
  128.     @weapon_visible = true
  129.  
  130.     [url=home.php?mod=space&uid=36110]@Wait[/url] = 0
  131.     @weapon_index = []
  132.     @weapon_end = true
  133.     @full_action = []
  134.     @action = []
  135.     @force_action = ""
  136.     @target_battler = []
  137.     @second_targets = []
  138.     @individual_targets = []
  139.     @m_a_targets = []
  140.     @effect_data = []
  141.     @anime_id = []
  142.     @anime_move_id = []
  143.     [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  144.     @opacity_data = []
  145.     @set_damage = false
  146.     @m_a_data = []
  147.     @m_a_starter = []
  148.     @action_end = false
  149.     @damage_anime_data = []
  150.     @anime_no_mirror = false
  151.     @anime_horming = false
  152.     @anime_camera_zoom = false
  153.     @anime_plus_z = true
  154.     @derivation_skill_id = 0
  155.     @immortal = false
  156.     @mirage = []
  157.     @play_data = []
  158.     @balloon_data = []
  159.     @picture = false
  160.     @timing = []
  161.     @timing_targets = []
  162.     @color_set = []
  163.     [url=home.php?mod=space&uid=10453]@color[/url] = []
  164.     @change_up = false
  165.     @non_motion = false
  166.     @graphics_change = false
  167.     @hit = []
  168.     @add_state = []
  169.     @collapse = false
  170.     @counter_id = 0
  171.     @reflection_id = 0
  172.     @result_damage = [0,0]
  173.     @active = false
  174.     @anime_off = false
  175.     @command_action = false
  176.  
  177.     @base_x = 0
  178.     @base_y = 0
  179.     @base_z = 0
  180.     @base_h = 0
  181.     @max_pattern_w = 0
  182.     @max_pattern_h = 0
  183.     @pattern_kind = 0
  184.     @pattern_count = 0
  185.     @move_time = 0
  186.     [url=home.php?mod=space&uid=111303]@mirror[/url] = false
  187.     @battler.set_graphic(@pre_change_data[0], @pre_change_data[1], @pre_change_data[2], @pre_change_data[3]) if @pre_change_data != nil
  188.     @pre_change_data = nil
  189.   end  
  190.   #--------------------------------------------------------------------------
  191.   # ● 格局
  192.   #--------------------------------------------------------------------------
  193.   def setup(bitmap_width, bitmap_height, first_action_flag)
  194.     reset if first_action_flag
  195.     set_data
  196.     set_base_position if !@graphics_change
  197.     set_graphics(bitmap_width, bitmap_height)
  198.     set_target
  199.     setup_graphics_change if @graphics_change
  200.     first_battler_anime_set if first_action_flag
  201.   end  
  202.   #--------------------------------------------------------------------------
  203.   # ● 取得角色数据
  204.   #--------------------------------------------------------------------------
  205.   def set_data
  206.     return if @battler == nil
  207.     if @battler.actor?
  208.       @graphic_name = @battler.character_name
  209.       @graphic_index = @battler.character_index
  210.     else
  211.       @graphic_name = @battler.battler_name
  212.       @graphic_index = 0
  213.     end
  214.     @max_pattern_w = max_pattern[0]
  215.     @max_pattern_h = max_pattern[1]
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 基础坐标设置 data=[X轴, Y轴, H轴]  moment_set…即时配置
  219.   #--------------------------------------------------------------------------
  220.   def set_base_position(moment_set = true)
  221.     mirroring_reset
  222.     if @battler.actor?
  223.       data = N03::ACTOR_POSITION[@battler.index].dup
  224.       @base_x = data[0] * 100 if !@mirror
  225.       @base_x = (Graphics.width - data[0]) * 100 if @mirror
  226.     else
  227.       data = [@battler.screen_x, @battler.screen_y, 0].dup
  228.       @base_x = data[0] * 100 if !$sv_camera.mirror
  229.       @base_x = (Graphics.width - data[0]) * 100 if $sv_camera.mirror
  230.     end
  231.     @base_y = data[1] * 100
  232.     @base_h = data[2] * 100
  233.     @base_z = @y
  234.     return if !moment_set
  235.     @x = @base_x
  236.     @y = @base_y
  237.     @z = @base_z
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 取得图像数据
  241.   #--------------------------------------------------------------------------
  242.   def set_graphics(bitmap_width, bitmap_height)
  243.     sign = @graphic_name[/^[\!\$]./]
  244.     if sign && sign.include?('$')
  245.       @cw = bitmap_width / @max_pattern_w
  246.       @ch = bitmap_height / @max_pattern_h
  247.     elsif @max_pattern_w == 1 && @max_pattern_h == 1
  248.       @cw = bitmap_width
  249.       @ch = bitmap_height
  250.     else
  251.       @cw = bitmap_width / (@max_pattern_w * 4)
  252.       @ch = bitmap_height / (@max_pattern_h * 2)
  253.     end
  254.     @ox = @cw / 2
  255.     @oy = @ch
  256.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  257.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● 设定目标
  261.   #--------------------------------------------------------------------------
  262.   def set_target(target = nil)
  263.     @target_battler = target
  264.     @target_battler = [@battler] if target == nil
  265.     @second_targets = @target_battler
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 设置图像的变更
  269.   #--------------------------------------------------------------------------
  270.   def setup_graphics_change
  271.     @graphics_change = false
  272.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  273.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  274.   end  
  275.   #--------------------------------------------------------------------------
  276.   # ● 取得战斗开始时的待机动画图像数据
  277.   #--------------------------------------------------------------------------
  278.   def first_battler_anime_set
  279.     loop do
  280.       update
  281.       break if @action_data == nil
  282.       break if @action_data[0] == "motion"
  283.       break if @action_data[0] == "move" && @action_data[8] != ""
  284.       break if @full_action == []
  285.     end
  286.     start_action(first_action) if @battler.movable?
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● 开始动作
  290.   #--------------------------------------------------------------------------
  291.   def start_action(kind = nil)
  292.     return if @event_fix && $game_troop.interpreter.running?
  293.     # 等待中的场合取消
  294.     return @wait -= 1 if @wait > 0 && kind == nil
  295.     action_setup(false) if kind != nil
  296.     set_action(kind)
  297.     @action = kind if @action == nil
  298.     # 动作顺序行动结束处理转变
  299.     action_terminate if @action == nil
  300.     # 决定下一个动作
  301.     @action_data = N03::ACTION[@action]
  302.     next_action
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 初始化行动参数
  306.   #--------------------------------------------------------------------------
  307.   def action_setup(reset = true)
  308.     @event_fix = false
  309.     @set_damage = false
  310.     @action_end = false
  311.     @balloon_data = []
  312.     @loop_act = []
  313.     angle_reset if reset
  314.     zoom_reset if reset
  315.     opacity_reset if reset
  316.     @curve = []
  317.     @c = 0
  318.     convert_jump
  319.   end  
  320.   #--------------------------------------------------------------------------
  321.   # ● 行动结束的处理
  322.   #--------------------------------------------------------------------------
  323.   def action_terminate
  324.     @mirage = [] if @mirage_end
  325.     mirroring_reset
  326.     @picture = false
  327.     @individual_targets = []
  328.     action_setup if @active
  329.     action_setup(false) if !@active
  330.     # 待机开始行动迁移
  331.     stand_by_action if !@non_motion
  332.     # 战斗行动激活结束权利
  333.     next_battler
  334.   end  
  335.   #--------------------------------------------------------------------------
  336.   # ● 新动作内容的決定
  337.   #--------------------------------------------------------------------------
  338.   def set_action(kind = nil)
  339.     full_act = N03::FULLACTION[kind]
  340.     @full_action = full_act.dup if full_act != nil
  341.     @action = @full_action.shift
  342.     # 参考全部动作如果全部动作统合
  343.     full_act2 = N03::FULLACTION[@action]
  344.     @full_action = full_act2.dup + @full_action if full_act2 != nil
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 采取下个行动
  348.   #--------------------------------------------------------------------------
  349.   def next_action
  350.     @wait = 0
  351.     # 捷径确认
  352.     eval(@action) if @action != nil && @action_data == nil && N03::FULLACTION[@action] == nil
  353.     # 体能设定
  354.     @wait = @action.to_i if @wait == 0 && @action_data == nil
  355.     @wait = rand(@wait.abs + 1) if @wait < 0
  356.     # 开始动作
  357.     action_play
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 待机开始动作迁移
  361.   #--------------------------------------------------------------------------
  362.   def stand_by_action
  363.     # 通常待机
  364.     stand_by_act = normal
  365.     # HP的1/4紧要关头行动
  366.     stand_by_act = pinch if @battler.hp <= @battler.mhp / 4
  367.     # 状态检查
  368.     stand_by_act = state(@battler.states[0].id) if @battler.states[0] != nil && state(@battler.states[0].id) != nil
  369.     # 指令检查
  370.     stand_by_act = command if @command_action && command != nil
  371.     set_action(stand_by_act)
  372.     @action = stand_by_act if @action == nil
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● 开始强制动作
  376.   #--------------------------------------------------------------------------
  377.   def start_force_action
  378.     return if @active
  379.     start_action(@force_action)
  380.     @force_action = ""
  381.   end  
  382.   #--------------------------------------------------------------------------
  383.   # ● 追加动作
  384.   #--------------------------------------------------------------------------
  385.   def add_action(kind)
  386.     @full_action.push(kind)
  387.   end  
  388.   #--------------------------------------------------------------------------
  389.   # ● 插入动作
  390.   #--------------------------------------------------------------------------
  391.   def unshift_action(kind)
  392.     @full_action.unshift(kind)
  393.   end  
  394.   #--------------------------------------------------------------------------
  395.   # ● 更新帧数
  396.   #--------------------------------------------------------------------------
  397.   def update
  398.     # 开始动作
  399.     start_action
  400.     # 开始强制动作
  401.     start_force_action if @force_action != ""
  402.     # 更新动画模式
  403.     update_pattern
  404.     # 更新移动
  405.     update_move
  406.     # 更新旋转
  407.     update_angle if @angle_time != 0
  408.     # 更新扩大缩小
  409.     update_zoom if @zoom_time != 0
  410.     # 更新透明度
  411.     update_opacity if @opacity_data != []
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 更新动画模式
  415.   #--------------------------------------------------------------------------
  416.   def update_pattern
  417.     return @pattern_rest_time -= 1 if @pattern_rest_time != 0
  418.     return if @max_pattern_w == 1 && @max_pattern_h == 1
  419.     @pattern_rest_time = @pattern_time
  420.     # 开始播放・取得结束单元位置
  421.     if @pattern_kind > 0 # 通常播放中
  422.       @pattern_start = 0
  423.       @pattern_end = @max_pattern_w - 1
  424.     elsif @pattern_kind < 0 # 逆转播放中
  425.       @pattern_start = @max_pattern_w - 1
  426.       @pattern_end = 0
  427.     end
  428.     # 结束单程的播放
  429.     @pattern_count += 1 if @pattern_w == @pattern_end && @pattern_kind != 0
  430.     # 循环处理
  431.     case @pattern_type.abs
  432.     when  1,3 # 单程
  433.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type ==  1
  434.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type == -1
  435.       @pattern_kind =  1 if @pattern_count != 0 && @pattern_type ==  3
  436.       @pattern_kind = -1 if @pattern_count != 0 && @pattern_type == -3
  437.       @pattern_w = @pattern_start - @pattern_kind if @pattern_count != 0 && @pattern_type.abs == 3
  438.       @pattern_count = 0
  439.     when  2,4 # 往返
  440.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  2
  441.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -2
  442.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type ==  2
  443.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type == -2
  444.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  4
  445.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -4
  446.       @pattern_kind =  1 if @pattern_count == 2 && @pattern_type ==  4
  447.       @pattern_kind = -1 if @pattern_count == 2 && @pattern_type == -4
  448.       @pattern_count = 0 if @pattern_count == 2
  449.     end
  450.     # 更新单元
  451.     @pattern_w += 1 * @pattern_kind
  452.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   # ● 更新移动
  456.   #--------------------------------------------------------------------------
  457.   def update_move
  458.     @z = @y / 100 + @z_plus
  459.     return if @move_time == 0
  460.     target_position_set if @horming_move
  461.     @x = (@x * (@move_time - 1) + @target_x) / @move_time
  462.     @y = (@y * (@move_time - 1) + @target_y) / @move_time
  463.     @h = (@h * (@move_time - 1) + @target_h) / @move_time if @move_h != nil
  464.     @c += @curve[@move_time - 1] if @curve[@move_time - 1] != nil
  465.     @j += @jump[@move_time - 1] if @jump[@move_time - 1] != nil
  466.     @move_time -= 1
  467.     convert_jump if @move_time == 0
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # ● 更新移动目标
  471.   #--------------------------------------------------------------------------
  472.   def target_position_set
  473.     target_position = N03.get_targets_position(@move_targets, @horming_move)
  474.     @target_x = target_position[0] + @move_x
  475.     @target_y = target_position[1] + @move_y
  476.     @target_h = target_position[2] + @move_h if @move_h != nil
  477.   end  
  478.   #--------------------------------------------------------------------------
  479.   # ● 更新旋转
  480.   #--------------------------------------------------------------------------
  481.   def update_angle
  482.     @angle += @angling
  483.     @angle_time -= 1
  484.     return if @angle_time != 0
  485.     return angle_reset if @angle_data[4] == 0
  486.     angling(@angle_data) if @angle_data[4] == 2
  487.   end  
  488.   #--------------------------------------------------------------------------
  489.   # ● 更新扩大缩小
  490.   #--------------------------------------------------------------------------
  491.   def update_zoom
  492.     @zoom_x += @zooming_x
  493.     @zoom_y += @zooming_y
  494.     @zoom_time -= 1
  495.     return if @zoom_time != 0
  496.     return zoom_reset if @zoom_data[4] == 0
  497.     zooming(@zoom_data) if @zoom_data[4] == 2
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # ● 更新透明度
  501.   #--------------------------------------------------------------------------
  502.   def update_opacity
  503.     @opacity += @opacity_data[2]
  504.     @opacity_data[0] -= 1
  505.     return if @opacity_data[0] != 0
  506.     return if !@opacity_data[5]
  507.     @opacity_data[2] *= -1
  508.     @opacity_data[0] = @opacity_data[1]
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● 实行动作
  512.   #--------------------------------------------------------------------------
  513.   def action_play
  514.     return if @action_data == nil
  515.     action = @action_data[0]
  516.     # 战斗角色反转的场合
  517.     return mirroring                    if action == "mirror"
  518.     # 残像的场合
  519.     return mirage_set                   if action == "mirage"
  520.     # 回转的场合  
  521.     return angling                      if action == "angle"
  522.     # 扩大缩小的场合
  523.     return zooming                      if action == "zoom"
  524.     # 透明度操作的场合  
  525.     return set_opacity                  if action == "opacity"
  526.     # 战斗角色动画的場合
  527.     return battler_anime                if action == "motion"
  528.     # 移动的場合
  529.     return move                         if action == "move"
  530.     # 武器动画的場合
  531.     return weapon_anime([@action_data]) if action == "wp"
  532.     # 跳过动画的場合
  533.     return move_anime                   if action == "m_a"
  534.     # 战斗场景通讯的场合(战斗不能)
  535.     return set_play_data                if action == "collapse" or action == "no_collapse"
  536.     # 显示战斗数据库的动画的場合  
  537.     return battle_anime                 if action == "anime"
  538.     # 摄影的場合
  539.     return camera                       if action == "camera"
  540.     # 画面摇动的場合
  541.     return shake                        if action == "shake"
  542.     # 画面色调变更的場合
  543.     return color_effect                 if action == "color"
  544.     # 过渡的場合
  545.     return transition                   if action == "ts"
  546.     # 气球动画显示的場合  
  547.     return balloon_anime                if action == "balloon"
  548.     # 图片显示的場合
  549.     return picture_set                  if action == "pic"
  550.     # 状态操作的場合
  551.     return state_set                    if action == "sta"
  552.     # FPS变更的場合
  553.     return fps                          if action == "fps"
  554.     # 战斗角色图像变更的場合  
  555.     return graphics_change              if action == "change"
  556.     # 技能衍生的場合  
  557.     return derivating_skill             if action == "der"
  558.     # BGM/BGS/SE演奏的場合  
  559.     return sound                        if action == "sound"
  560.     # 电影再生的場合  
  561.     return movie                        if action == "movie"
  562.     # 游戏开关操作的場合  
  563.     return switches                     if action == "switch"
  564.     # 变量开关操作的場合  
  565.     return variable                     if action == "variable"
  566.     # 条件分岐(游戏开关)的場合
  567.     return nece_1                       if action == "n_1"
  568.     # 条件分岐(游戏变量)的場合
  569.     return nece_2                       if action == "n_2"
  570.     # 条件分岐(状态)的場合
  571.     return nece_3                       if action == "n_3"
  572.     # 条件分岐(技能)的場合
  573.     return nece_4                       if action == "n_4"
  574.     # 条件分岐(参数)的場合
  575.     return nece_5                       if action == "n_5"
  576.     # 条件分岐(装备)的場合
  577.     return nece_6                       if action == "n_6"
  578.     # 条件分岐(脚本)的場合
  579.     return nece_7                       if action == "n_7"
  580.     # 第二目标操作的場合  
  581.     return second_targets_set           if action == "s_t"
  582.     # 呼叫公共事件的場合  
  583.     return call_common_event            if action == "common"
  584.     # 战斗动画关闭的場合  
  585.     return @anime_off = true            if action == "anime_off"
  586.     # 强制战斗结束的場合  
  587.     return BattleManager.process_abort  if action == "battle_end"
  588.     # 画面固定的場合  
  589.     return Graphics.freeze              if action == "graphics_freeze"
  590.     # 损坏动画的場合  
  591.     return damage_anime                 if action == "damage_anime"
  592.     # 武器不可见的場合  
  593.     return @weapon_visible = false      if action == "weapon_off"
  594.     # 武器可见的場合  
  595.     return @weapon_visible = true       if action == "weapon_on"
  596.     # 等待取消的場合
  597.     return @non_motion = true           if action == "non_motion"
  598.     # 等待取消解除的場合
  599.     return @non_motion = false          if action == "non_motion_cancel"
  600.     # 初期位置变更的場合
  601.     return change_base_position         if action == "change_base_position"
  602.     # 初期位置变更解除的場合
  603.     return set_base_position(false)     if action == "set_base_position"
  604.     # 强制行动的場合  
  605.     return force_act                    if action == "force_action"
  606.     # 强制行动的場合 (第二目标)
  607.     return force_act2                   if action == "force_action2"
  608.     # 个人开始的場合
  609.     return individual_start             if action == "individual_start"
  610.     # 个人结束的場合
  611.     return individual_end               if action == "individual_end"
  612.     # 循环开始的場合
  613.     return loop_start                   if action == "loop_start"
  614.     # 循环结束的場合
  615.     return loop_end                     if action == "loop_end"
  616.     # 只有行动的場合
  617.     return only_action_on               if action == "only_action_on"
  618.     # 只有行动解除的場合
  619.     return only_action_off              if action == "only_action_off"
  620.     # 下个战斗角色的場合
  621.     return next_battler                 if action == "next_battler"
  622.     # 画面变更标记的場合
  623.     return set_change                   if action == "set_change"
  624.     # 脚本操作的場合   
  625.     return eval(@action_data[0])
  626.   end
  627.   #--------------------------------------------------------------------------
  628.   # ● 实行角色反转
  629.   #--------------------------------------------------------------------------
  630.   def mirroring
  631.     @mirror = !@mirror
  632.   end  
  633.   #--------------------------------------------------------------------------
  634.   # ● 初始化反转
  635.   #--------------------------------------------------------------------------
  636.   def mirroring_reset
  637.     @mirror = false
  638.     mirroring if !@battler.actor? && N03::ENEMY_MIRROR
  639.     mirroring if $sv_camera.mirror
  640.   end  
  641.   #--------------------------------------------------------------------------
  642.   # ● 实行残像
  643.   #--------------------------------------------------------------------------
  644.   def mirage_set
  645.     @mirage = @action_data.dup
  646.     @mirage_end = @mirage[3]
  647.     @mirage = [] if @mirage[1] == 0
  648.   end  
  649.   #--------------------------------------------------------------------------
  650.   # ● 实行旋转
  651.   #--------------------------------------------------------------------------
  652.   def angling(data = @action_data)
  653.     @angle_data = data.dup
  654.     @oy = @ch / 2
  655.     @oy_adjust = @ch * 50
  656.     @angle_time = data[1]
  657.     start_angle = data[2] * N03.mirror_num(@mirror)
  658.     end_angle = data[3] * N03.mirror_num(@mirror)
  659.     # 时间要是0以下时立即到最后角度
  660.     @angle_time = 1 if @angle_time <= 0
  661.     # 从旋转时间计算一格相当于的角度
  662.     @angling = (end_angle - start_angle) / @angle_time
  663.     # 不能整除的剩余到初期角度
  664.     @angle = (end_angle - start_angle) % @angle_time + start_angle
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ● 初始化旋转
  668.   #--------------------------------------------------------------------------
  669.   def angle_reset
  670.     @oy = @ch
  671.     @angle = @angle_time = @oy_adjust = 0
  672.   end  
  673.   #--------------------------------------------------------------------------
  674.   # ● 实行扩大缩小
  675.   #--------------------------------------------------------------------------
  676.   def zooming(data = @action_data)
  677.     @zoom_data = data.dup
  678.     @zoom_time = data[1]
  679.     start_zoom_x = data[2][0]
  680.     start_zoom_y = data[2][1]
  681.     end_zoom_x = data[3][0]
  682.     end_zoom_y = data[3][1]
  683.     # 时间是0以下时跳过
  684.     @zoom_time = 1 if @zoom_time <= 0
  685.     # 从放大时间中计算一格相当于的放大率
  686.     @zooming_x = (end_zoom_x - start_zoom_x) / @zoom_time
  687.     @zooming_y = (end_zoom_y - start_zoom_y) / @zoom_time
  688.     # 开始的大小
  689.     @zoom_x = start_zoom_x
  690.     @zoom_y = start_zoom_y
  691.   end  
  692.   #--------------------------------------------------------------------------
  693.   # ● 实行扩大缩小
  694.   #--------------------------------------------------------------------------
  695.   def zoom_reset
  696.     @zoom_x = @zoom_y = 1
  697.     @zoom_time = 0
  698.   end  
  699.   #--------------------------------------------------------------------------
  700.   # ● 角色透明度操作
  701.   #--------------------------------------------------------------------------
  702.   def set_opacity
  703.     data = @action_data.dup
  704.     @opacity = data[2]
  705.     opacity_move = (data[3] - data[2])/ data[1]
  706.     @opacity_data = [data[1], data[1], opacity_move, data[4], data[5], data[6]]
  707.     @wait = data[1] if data[7]
  708.     @wait *= 2 if data[6] && data[7]
  709.   end
  710.   #--------------------------------------------------------------------------
  711.   # ● 初始化透明度操作
  712.   #--------------------------------------------------------------------------
  713.   def opacity_reset
  714.     @opacity = 255
  715.     @opacity = 0 if @battler.hidden?
  716.     @opacity_data = []
  717.   end
  718.   #--------------------------------------------------------------------------
  719.   # ● 实行角色动画
  720.   #--------------------------------------------------------------------------
  721.   def battler_anime(anime_data = nil)
  722.     anime_data = @action_data.dup if anime_data == nil
  723.     @graphic_file_index = anime_data[1] if !graphic_fix
  724.     @pattern_h = anime_data[2]
  725.     @pattern_w = anime_data[3]
  726.     @pattern_h = 0 if @max_pattern_w == 1
  727.     @pattern_w = 0 if @max_pattern_h == 1
  728.     @pattern_type = anime_data[4]
  729.     @pattern_time = anime_data[5]
  730.     @pattern_rest_time = anime_data[5]
  731.     @pattern_count = 0
  732.     @pattern_kind = 1
  733.     @pattern_kind = -1 if @pattern_type < 0
  734.     @pattern_kind = 0 if @pattern_type == 0
  735.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  736.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  737.     @z_plus = anime_data[6]
  738.     @wait = set_anime_wait if anime_data[7]
  739.     @shadow_visible = anime_data[8]
  740.     weapon_anime(anime_data)
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ● 计算等待动画
  744.   #--------------------------------------------------------------------------
  745.   def set_anime_wait
  746.     if @pattern_type > 0
  747.       pattern_time_a = @max_pattern_w - @pattern_w.abs
  748.     elsif @pattern_type < 0
  749.       pattern_time_a = @pattern_w.abs + 1
  750.     else
  751.       return @pattern_time if @pattern_type == 0
  752.     end
  753.     case @pattern_type
  754.     when 1,-1, 3,-3
  755.       return pattern_time_a * @pattern_time
  756.     when 2,-2, 4,-4
  757.       return pattern_time_a * @pattern_time + (@max_pattern_w - 2) * @pattern_time
  758.     end
  759.   end  
  760.   #--------------------------------------------------------------------------
  761.   # ● 实行移动
  762.   #--------------------------------------------------------------------------
  763.   def move
  764.     @move_targets = N03.get_targets(@action_data[1].abs, @battler)
  765.     return if @move_targets == []
  766.     @move_targets = [@battler] if @action_data[1].abs == 7
  767.     @move_x = @action_data[2] * 100 * N03.mirror_num(@mirror)
  768.     @move_y = @action_data[3] * 100
  769.     @move_h = @action_data[4] * 100 if @action_data[4] != nil
  770.     @move_h = nil if @action_data[4] == nil
  771.     battler_anime(N03::ACTION[@action_data[8]].dup) if N03::ACTION[@action_data[8]] != nil
  772.     @horming_move = true
  773.     @horming_move = false if @action_data[1] < 0 or @action_data[1].abs == 7
  774.     target_position_set
  775.     target_position = [@target_x, @target_y, @target_z]
  776.     distanse_move = @action_data[5] > 0
  777.     @move_time = N03.distanse_calculation(@action_data[5].abs, target_position, [@x, @y, @z], distanse_move)
  778.     @wait = @move_time
  779.     curve
  780.     jump
  781.     @move_time = 1 if @move_time == 0
  782.     @horming_move = false if !@move_targets or @move_targets.include?(@battler)
  783.     update_move if @move_time == 1
  784.   end  
  785.   #--------------------------------------------------------------------------
  786.   # ● 实行曲线
  787.   #--------------------------------------------------------------------------
  788.   def curve
  789.     @c = 0
  790.     return if @action_data[6] == 0
  791.     @curve = N03.parabola([@action_data[6], -@action_data[6]], @move_time, 100, 4)
  792.   end  
  793.   #--------------------------------------------------------------------------
  794.   # ● 实行跳跃
  795.   #--------------------------------------------------------------------------
  796.   def jump
  797.     convert_jump
  798.     return if @action_data[7] == [0,0]
  799.     @jump = N03.parabola(@action_data[7].dup, @move_time, 100)
  800.   end  
  801.   #--------------------------------------------------------------------------
  802.   # ● J坐标(跳跃高度)H坐标变换
  803.   #--------------------------------------------------------------------------
  804.   def convert_jump
  805.     @h += @j
  806.     @j = 0
  807.     @jump = []
  808.   end  
  809.   #--------------------------------------------------------------------------
  810.   # ● 实行数据库战斗动画
  811.   #--------------------------------------------------------------------------
  812.   def battle_anime
  813.     data = @action_data.dup
  814.     targets = N03.get_targets(data[2], @battler)
  815.     return if targets == []
  816.     data[8] = !data[8] if @mirror
  817.     @set_damage           = data[5]
  818.     @damage_anime_data[0] = N03.get_attack_anime_id(data[1], @battler)
  819.     @damage_anime_data[1] = data[8]
  820.     @damage_anime_data[2] = data[7]
  821.     @damage_anime_data[3] = data[6]
  822.     @damage_anime_data[4] = data[9]
  823.     @wait = N03.get_anime_time(@damage_anime_data[0]) - 2 if data[4]
  824.     return if @set_damage
  825.     for target in targets do display_anime(targets, target, data) end
  826.   end
  827.   #--------------------------------------------------------------------------
  828.   # ● 开始武器动画
  829.   #--------------------------------------------------------------------------
  830.   def weapon_anime(anime_data)
  831.     @weapon_end = true
  832.     for i in 9...anime_data.size
  833.       set_effect_data(anime_data[i]) if anime_data[i] != ""
  834.     end
  835.   end
  836.   #--------------------------------------------------------------------------
  837.   # ● 开始飞行动画
  838.   #--------------------------------------------------------------------------
  839.   def move_anime
  840.     @m_a_starter = []
  841.     @m_a_targets = []
  842.     starters = N03.get_targets(@action_data[2], @battler)
  843.     targets = N03.get_targets(@action_data[3], @battler)
  844.     return if starters == [] or targets == []
  845.     single_start = true if starters != nil && @action_data[2] < 0
  846.     single_start = true if @action_data[1][0] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][0], @battler)].position == 3
  847.     starters = [starters[0]] if single_start
  848.     single_end = true if targets != nil && @action_data[3] < 0
  849.     single_end = true if @action_data[1][1] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][1], @battler)].position == 3
  850.     targets = [targets[0]] if single_end
  851.     se_flag = true
  852.     for starter in starters
  853.       for target in targets
  854.         data = @action_data.dup
  855.         data[17] = se_flag
  856.         @effect_data.push(data)
  857.         @m_a_targets.push(target)
  858.         @m_a_starter.push(starter)
  859.         se_flag = false
  860.       end
  861.     end  
  862.   end
  863.   #--------------------------------------------------------------------------
  864.   # ● 效果通讯设置
  865.   #--------------------------------------------------------------------------
  866.   def set_effect_data(data = @action)
  867.     action_data = N03::ACTION[data]
  868.     return if action_data == nil
  869.     @effect_data.push(action_data.dup)
  870.   end
  871.   #--------------------------------------------------------------------------
  872.   # ● 战斗场景通讯的数据储存
  873.   #--------------------------------------------------------------------------
  874.   def set_play_data(data = @action_data)
  875.     @play_data = data.dup
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # ● 战斗动画显示
  879.   #--------------------------------------------------------------------------
  880.   def display_anime(targets, target, data)
  881.     return if !N03.first_of_all_screen_anime(data[1], target, targets)
  882.     target.animation_id         = N03.get_attack_anime_id(data[1], @battler)
  883.     target.animation_mirror     = data[8]
  884.     target.sv.anime_horming     = data[3]
  885.     target.sv.anime_camera_zoom = data[6]
  886.     target.sv.anime_no_mirror   = data[7]
  887.     target.sv.anime_plus_z      = data[9]
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● 初始化战斗动画扩张数据
  891.   #--------------------------------------------------------------------------
  892.   def reset_anime_data
  893.     @anime_no_mirror = false
  894.     @anime_horming = false
  895.     @anime_camera_zoom = false
  896.     @timing_targets = []
  897.     @anime_plus_z = true
  898.   end  
  899.   #--------------------------------------------------------------------------
  900.   # ● 摄影机
  901.   #--------------------------------------------------------------------------
  902.   def camera
  903.     data = @action_data.dup
  904.     N03.camera(@battler, data)
  905.     @wait = data[4] if data[5]
  906.   end  
  907.   #--------------------------------------------------------------------------
  908.   # ● 画面的摇动
  909.   #--------------------------------------------------------------------------
  910.   def shake
  911.     data = @action_data.dup
  912.     $sv_camera.shake(data[1], data[2], data[3])
  913.     @wait = data[3] if data[4]
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # ● 画面色调变更
  917.   #--------------------------------------------------------------------------
  918.   def color_effect
  919.     case @action_data[1]
  920.     when 0,1,2,3,4,5
  921.       targets = N03.get_targets(@action_data[1], @battler)
  922.     when 6
  923.       screen = true
  924.     when 7
  925.       targets = [@battler] + @target_battler
  926.     when 8
  927.       screen = true
  928.       targets = $game_troop.members + $game_party.battle_members - [@battler]
  929.     when 9
  930.       screen = true
  931.       targets = $game_troop.members + $game_party.battle_members - [@battler] - @target_battler
  932.     when 10
  933.       screen = true
  934.       targets = $game_troop.members + $game_party.battle_members
  935.     end
  936.     return if screen == nil && targets == []
  937.     for target in targets do target.sv.color_set = @action_data[2] end if targets
  938.     @wait = @action_data[2][4] if @action_data[3]
  939.     return if !screen
  940.     $sv_camera.color_set[1] = @action_data[2]
  941.     $sv_camera.color_set[2] = @action_data[2]
  942.   end  
  943.   #--------------------------------------------------------------------------
  944.   # ● 过渡
  945.   #--------------------------------------------------------------------------
  946.   def transition
  947.     $sv_camera.perform_transition(@action_data)
  948.   end  
  949.   #--------------------------------------------------------------------------
  950.   # ● 气球动画显示
  951.   #--------------------------------------------------------------------------
  952.   def balloon_anime
  953.     @balloon_data = @action_data.dup
  954.   end  
  955.   #--------------------------------------------------------------------------
  956.   # ● 图片显示
  957.   #--------------------------------------------------------------------------
  958.   def picture_set
  959.     @picture = true
  960.     set_effect_data
  961.   end
  962.   #--------------------------------------------------------------------------
  963.   # ● 状态操作
  964.   #--------------------------------------------------------------------------
  965.   def state_set
  966.     targets = N03.get_targets(@action_data[1], @battler)
  967.     return if targets == []
  968.     case @action_data[2]
  969.     when 1 ; targets = [targets[rand(targets.size)]]
  970.     when 2 ; targets -= @battler if targets.include?(@battler)
  971.     end
  972.     for target in targets
  973.       for id in @action_data[4]
  974.         target.add_state(id) if @action_data[3] == "+"
  975.         target.remove_state(id) if @action_data[3] == "-"
  976.       end
  977.     end
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ● FPS变更
  981.   #--------------------------------------------------------------------------
  982.   def fps
  983.     Graphics.frame_rate = @action_data[1]
  984.     start_action
  985.   end
  986.   #--------------------------------------------------------------------------
  987.   # ● 角色画像变更的場合
  988.   #--------------------------------------------------------------------------
  989.   def graphics_change
  990.     @graphics_change = true
  991.     return @battler.graphics_change(@action_data[3]) if !@battler.actor?
  992.     @pre_change_data = [@battler.character_name, @battler.character_index, @battler.face_name, @battler.face_index] if @pre_change_data == nil && !@action_data[1]
  993.     if @action_data[4] == []
  994.       face_name = @battler.face_name
  995.       face_index = @battler.face_index
  996.     else
  997.       face_name = @action_data[4][1]
  998.       face_index = @action_data[4][0]
  999.     end
  1000.     @battler.set_graphic(@action_data[3], @action_data[2], face_name, face_index)
  1001.   end
  1002.   #--------------------------------------------------------------------------
  1003.   # ● 技能连发
  1004.   #--------------------------------------------------------------------------
  1005.   def derivating_skill
  1006.     # 如果让没学的的技能不能连发时
  1007.     return if !@action_data[1] && !@battler.skill_learn?($data_skills[@action_data[3]])
  1008.     # 如果技能不能连发成本不够时
  1009.     return if !@action_data[2] && !@battler.skill_cost_payable?($data_skills[@action_data[3]])
  1010.     # 连发
  1011.     @derivation_skill_id = @action_data[3]
  1012.     # 取消之后的动作
  1013.     @full_action = []
  1014.   end
  1015.   #--------------------------------------------------------------------------
  1016.   # ● BGM/BGS/SE演奏
  1017.   #--------------------------------------------------------------------------
  1018.   def sound
  1019.     pitch = @action_data[2]
  1020.     vol   = @action_data[3]
  1021.     name  = @action_data[4]
  1022.     case @action_data[1]
  1023.     when "se"
  1024.       Audio.se_play("Audio/SE/" + name, vol, pitch)
  1025.     when "bgm"
  1026.       # 没有指定名字时、不改变现在的BGM
  1027.       name = RPG::BGM.last.name if @action_data[4] == ""
  1028.       Audio.bgm_play("Audio/BGM/" + name, vol, pitch)
  1029.     when "bgs"
  1030.       name = RPG::BGS.last.name if @action_data[4] == ""
  1031.       Audio.bgs_play("Audio/BGS/" + name, vol, pitch)
  1032.     end
  1033.   end
  1034.   #--------------------------------------------------------------------------
  1035.   # ● 电影播放
  1036.   #--------------------------------------------------------------------------
  1037.   def movie
  1038.     Graphics.play_movie('Movies/' + @action_data[1])
  1039.   end
  1040.   #--------------------------------------------------------------------------
  1041.   # ● 游戏开关的操作
  1042.   #--------------------------------------------------------------------------
  1043.   def switches
  1044.     for id in @action_data[1]
  1045.       $game_switches[id] = true if id > 0
  1046.       $sv_camera.switches[id.abs] = true  if id < 0
  1047.     end
  1048.     for id in @action_data[2]
  1049.       $game_switches[id] = false if id > 0
  1050.       $sv_camera.switches[id.abs] = false  if id < 0
  1051.     end
  1052.     $sv_camera.program_check
  1053.   end
  1054.   #--------------------------------------------------------------------------
  1055.   # ● 游戏变量操作
  1056.   #--------------------------------------------------------------------------
  1057.   def variable
  1058.     # 检查操作
  1059.     operand = @action_data[3]
  1060.     operand = $game_variables[@action_data[3].abs] if @action_data[3] < 0
  1061.     # 变数操作的分歧
  1062.     case @action_data[2]
  1063.     when 0 ; $game_variables[@action_data[1]] = operand  # 代入
  1064.     when 1 ; $game_variables[@action_data[1]] += operand # 加法
  1065.     when 2 ; $game_variables[@action_data[1]] -= operand # 减法
  1066.     when 3 ; $game_variables[@action_data[1]] *= operand # 乘法
  1067.     when 4 ; $game_variables[@action_data[1]] /= operand # 除法
  1068.     when 5 ; $game_variables[@action_data[1]] %= operand # 剩余
  1069.     end
  1070.   end  
  1071.   #--------------------------------------------------------------------------
  1072.   # ● 条件分岐 (游戏开关)
  1073.   #--------------------------------------------------------------------------
  1074.   def nece_1
  1075.     judgment = $game_switches[@action_data[1]] == @action_data[2] if @action_data[1] > 0
  1076.     judgment = $sv_camera.switches[@action_data[1].abs] == @action_data[2] if @action_data[1] < 0
  1077.     action_diverging(judgment, @action_data[3])
  1078.   end  
  1079.   #--------------------------------------------------------------------------
  1080.   # ● 条件分岐 (游戏变量)
  1081.   #--------------------------------------------------------------------------
  1082.   def nece_2
  1083.     variable = $game_variables[@action_data[1]]
  1084.     num = @action_data[2]
  1085.     num = $game_variables[@action_data[2].abs] if num < 0
  1086.     case @action_data[3]
  1087.     when 0 ; judgment = variable == num
  1088.     when 1 ; judgment = variable < num
  1089.     when 2 ; judgment = variable > num
  1090.     end  
  1091.     action_diverging(judgment, @action_data[4])
  1092.   end  
  1093.   #--------------------------------------------------------------------------
  1094.   # ● 条件分岐 (状态)
  1095.   #--------------------------------------------------------------------------
  1096.   def nece_3
  1097.     targets = N03.get_targets(@action_data[1], @battler)
  1098.     return if targets == []
  1099.     member_num = @action_data[4]
  1100.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1101.     hit_count = 0
  1102.     miss_count = 0
  1103.     for target in targets
  1104.       hit_count += 1 if target.state?(@action_data[2])
  1105.       miss_count += 1 if !target.state?(@action_data[2])
  1106.     end
  1107.     case @action_data[3]
  1108.     when 0 ; judgment = hit_count >= member_num
  1109.     when 1 ; judgment = miss_count >= member_num
  1110.     end
  1111.     action_diverging(judgment, @action_data[5])
  1112.   end  
  1113.   #--------------------------------------------------------------------------
  1114.   # ● 条件分岐 (技能)
  1115.   #--------------------------------------------------------------------------
  1116.   def nece_4
  1117.     targets = N03.get_targets(@action_data[1], @battler)
  1118.     return if targets == []
  1119.     member_num = @action_data[4]
  1120.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1121.     hit_count = 0
  1122.     miss_count = 0
  1123.     for target in targets
  1124.       hit_count += 1 if target.skill_learn?($data_skills[@action_data[2]]) && target.skill_conditions_met?($data_skills[@action_data[2]])
  1125.       miss_count += 1 if !target.skill_learn?($data_skills[@action_data[2]]) or !target.skill_conditions_met?($data_skills[@action_data[2]])
  1126.     end
  1127.     case @action_data[3]
  1128.     when 0 ; judgment = hit_count >= member_num
  1129.     when 1 ; judgment = miss_count >= member_num
  1130.     end
  1131.     action_diverging(judgment, @action_data[5])
  1132.   end  
  1133.   #--------------------------------------------------------------------------
  1134.   # ● 条件分岐 (参数)
  1135.   #--------------------------------------------------------------------------
  1136.   def nece_5
  1137.     targets = N03.get_targets(@action_data[1], @battler)
  1138.     return if targets == []
  1139.     member_num = @action_data[5]
  1140.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1141.     hit_count = 0
  1142.     for target in targets
  1143.       hit_count += 1 if target.comparison_parameter([@action_data[2],@action_data[3],@action_data[4]])
  1144.     end
  1145.     judgment = hit_count >= member_num
  1146.     action_diverging(judgment, @action_data[6])
  1147.   end  
  1148.   #--------------------------------------------------------------------------
  1149.   # ● 条件分岐 (装备)
  1150.   #--------------------------------------------------------------------------
  1151.   def nece_6
  1152.     targets = N03.get_targets(@action_data[1], @battler)
  1153.     return if targets == []
  1154.     member_num = @action_data[5]
  1155.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1156.     hit_count = 0
  1157.     miss_count = 0
  1158.     for target in targets
  1159.       hit_count += 1 if target.comparison_equip([@action_data[2],@action_data[3]])
  1160.       miss_count += 1 if !target.comparison_equip([@action_data[2],@action_data[3]])
  1161.     end
  1162.     case @action_data[4]
  1163.     when 0 ; judgment = hit_count >= member_num
  1164.     when 1 ; judgment = miss_count >= member_num
  1165.     end
  1166.     action_diverging(judgment, @action_data[6])
  1167.   end  
  1168.   #--------------------------------------------------------------------------
  1169.   # ● 条件分岐 (脚本)
  1170.   #--------------------------------------------------------------------------
  1171.   def nece_7
  1172.     judgment = eval(@action_data[2])
  1173.     action_diverging(judgment, @action_data[1])
  1174.   end  
  1175.   #--------------------------------------------------------------------------
  1176.   # ● 动作的分岐  
  1177.   #--------------------------------------------------------------------------
  1178.   def action_diverging(judgment, kind)
  1179.     result = 0
  1180.     if judgment
  1181.       result = 1 if kind == 1
  1182.       result = 2 if kind == 2
  1183.     else
  1184.       result = 1 if kind == 0
  1185.     end
  1186.     # 全部动作结束
  1187.     return @full_action = []  if result == 2
  1188.     # 清楚下一个动作
  1189.     @full_action.shift if result == 1
  1190.     set_action
  1191.     # 实行下一个动作
  1192.     @action_data = N03::ACTION[@action]
  1193.     next_action
  1194.   end
  1195.   #--------------------------------------------------------------------------
  1196.   # ● 第二个目标的操作
  1197.   #--------------------------------------------------------------------------
  1198.   def second_targets_set
  1199.     targets = N03.get_targets(@action_data[1], @battler)
  1200.     for target in targets
  1201.       targets.delete(target) if @action_data[2][1] == 1 && target.index != @action_data[2][0]
  1202.       targets.delete(target) if @action_data[2][1] == 2 && target.index == @action_data[2][0].abs
  1203.       targets.delete(target) if @action_data[3] > 0 && target.id != @action_data[3]
  1204.       targets.delete(target) if @action_data[3] < 0 && target.id == @action_data[3].abs
  1205.       targets.delete(target) if @action_data[4] > 0 && !target.state?(@action_data[4])
  1206.       targets.delete(target) if @action_data[4] < 0 && target.state?(@action_data[4].abs)
  1207.       targets.delete(target) if @action_data[5] > 0 && !target.skill_conditions_met?($data_skills[@action_data[5]])
  1208.       targets.delete(target) if @action_data[5] < 0 && target.skill_conditions_met?($data_skills[@action_data[5].abs])
  1209.       targets.delete(target) if !target.comparison_parameter(@action_data[6])
  1210.       targets.delete(target) if !@action_data[7][1].include?(0) && !target.comparison_equip(@action_data[7])
  1211.     end
  1212.     return @second_targets = [] if targets.size == 0
  1213.     case @action_data[8]
  1214.     when 1 ; targets = [targets[rand(targets.size)]]
  1215.     when 2 ; targets.delete(@battler)
  1216.     end
  1217.     return @second_targets = [] if targets.size == 0
  1218.     @second_targets = targets
  1219.     case @action_data[9]
  1220.     when 0 ; return
  1221.     when 1 ; set_play_data(["second_targets_set"])
  1222.     when 2 ; set_play_data(["targets_set"])
  1223.     end
  1224.     @wait += 1
  1225.   end
  1226.   #--------------------------------------------------------------------------
  1227.   # ● 公共事件的呼叫
  1228.   #--------------------------------------------------------------------------
  1229.   def call_common_event
  1230.     $game_temp.reserve_common_event(@action_data[1])
  1231.     $sv_camera.event = true
  1232.     @event_fix = @action_data[2]
  1233.   end
  1234.   #--------------------------------------------------------------------------
  1235.   # ● 伤害动画
  1236.   #--------------------------------------------------------------------------
  1237.   def damage_anime(delay_time = 12)
  1238.     anime(N03.get_attack_anime_id(-3, @battler), wait = true)
  1239.     action_play
  1240.     @wait -= delay_time
  1241.     @full_action.unshift("eval('@damage_anime_data = []
  1242.     @set_damage = true')")
  1243.   end
  1244.   #--------------------------------------------------------------------------
  1245.   # ● 通常战斗不能
  1246.   #--------------------------------------------------------------------------
  1247.   def normal_collapse
  1248.     @collapse = true
  1249.     return
  1250.   end
  1251.   #--------------------------------------------------------------------------
  1252.   # ● 初期位置变更
  1253.   #--------------------------------------------------------------------------
  1254.   def change_base_position
  1255.     @base_x = @x
  1256.     @base_y = @y
  1257.     @base_h = @h
  1258.   end  
  1259.   #--------------------------------------------------------------------------
  1260.   # ● 实行强制动作
  1261.   #--------------------------------------------------------------------------
  1262.   def force_act
  1263.     target(@full_action.shift)
  1264.   end
  1265.   #--------------------------------------------------------------------------
  1266.   # ● 实行强制动作 (第二个目标)
  1267.   #--------------------------------------------------------------------------
  1268.   def force_act2
  1269.     target2(@full_action.shift)
  1270.   end
  1271.   #--------------------------------------------------------------------------
  1272.   # ● 开始个别处理
  1273.   #--------------------------------------------------------------------------
  1274.   def individual_start
  1275.     @individual_targets = @target_battler.dup
  1276.     @remain_targets = @target_battler.dup
  1277.     @target_battler = [@individual_targets[0]]
  1278.     # 重复部分的动作并保持
  1279.     @individual_act = @full_action.dup
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 结束个别处理
  1283.   #--------------------------------------------------------------------------
  1284.   def individual_end
  1285.     @individual_targets.shift
  1286.     for target in @individual_targets
  1287.       @individual_targets.shift if target.dead?
  1288.     end
  1289.     # 目标没有残留时行动完毕
  1290.     return @target_battler = @remain_targets if @individual_targets.size == 0
  1291.     @full_action = @individual_act.dup
  1292.     @target_battler = [@individual_targets[0]]
  1293.   end
  1294.   #--------------------------------------------------------------------------
  1295.   # ● 循环開始
  1296.   #--------------------------------------------------------------------------
  1297.   def loop_start
  1298.     # 重复部分的动作并保持
  1299.     @loop_act = @full_action.dup
  1300.   end
  1301.   #--------------------------------------------------------------------------
  1302.   # ● 循环结束
  1303.   #--------------------------------------------------------------------------
  1304.   def loop_end
  1305.     # 动作重复
  1306.     @full_action = @loop_act.dup if @loop_act != []
  1307.   end
  1308.   #--------------------------------------------------------------------------
  1309.   # ● 下个动作角色
  1310.   #--------------------------------------------------------------------------
  1311.   def next_battler
  1312.     @action_end = true
  1313.     @active = false
  1314.   end
  1315.   #--------------------------------------------------------------------------
  1316.   # ● 图像变更标记
  1317.   #--------------------------------------------------------------------------
  1318.   def set_change
  1319.     @change_up = true
  1320.   end
  1321.   #--------------------------------------------------------------------------
  1322.   # ● 战斗场景通讯
  1323.   #--------------------------------------------------------------------------
  1324.   def play_data
  1325.     data = @play_data
  1326.     @play_data = []
  1327.     return data
  1328.   end
  1329.   #--------------------------------------------------------------------------
  1330.   # ● 捷径指令
  1331.   #--------------------------------------------------------------------------
  1332.   def anime(anime_id, wait = true)
  1333.     @action_data = ["anime",anime_id,1,false,wait,false,true,false]
  1334.   end
  1335.   def anime_me(anime_id, wait = true)
  1336.     @action_data = ["anime",anime_id,0,false,wait,false,true,false]
  1337.   end
  1338.   def se(file, pitch = 100)
  1339.     @action_data = ["sound",  "se", pitch, 100, file]
  1340.   end
  1341.   def target(act)
  1342.     for target in @target_battler do target.sv.force_action = act end
  1343.   end
  1344.   def target2(act)
  1345.     for target in @second_targets do target.sv.force_action = act end
  1346.   end
  1347.   def delay(time)
  1348.     @wait = @battler.index * time
  1349.   end
  1350.   #--------------------------------------------------------------------------
  1351.   # ● 取得角色ID
  1352.   #--------------------------------------------------------------------------
  1353.   def id
  1354.     return @battler.id if @battler.actor?
  1355.     return [email]-@battler.id[/email]
  1356.   end
  1357.   #--------------------------------------------------------------------------
  1358.   # ● 取得被致命一击
  1359.   #--------------------------------------------------------------------------
  1360.   def critical?
  1361.     return @battler.result.critical
  1362.   end
  1363.   #--------------------------------------------------------------------------
  1364.   # ● 取得被回复标记
  1365.   #--------------------------------------------------------------------------
  1366.   def recovery?
  1367.     recovery = false
  1368.     recovery = true if @battler.result.hp_damage < 0
  1369.     recovery = true if @battler.result.mp_damage < 0
  1370.     recovery = true if @battler.result.tp_damage < 0
  1371.     return recovery
  1372.   end
  1373.   #--------------------------------------------------------------------------
  1374.   # ● 取得被损伤技能ID
  1375.   #--------------------------------------------------------------------------
  1376.   def damage_skill_id
  1377.     return @damage_skill_id
  1378.   end
  1379.   #--------------------------------------------------------------------------
  1380.   # ● 取得被损伤物品ID
  1381.   #--------------------------------------------------------------------------
  1382.   def damage_item_id
  1383.     return @damage_item_id
  1384.   end
  1385.   #--------------------------------------------------------------------------
  1386.   # ● 取得装备武器ID
  1387.   #--------------------------------------------------------------------------
  1388.   def weapon_id
  1389.     return 0 if !@battler.weapons[0]
  1390.     return @battler.weapons[0].id
  1391.   end
  1392.   #--------------------------------------------------------------------------
  1393.   # ● 取得装备武器的类型
  1394.   #--------------------------------------------------------------------------
  1395.   def weapon_type
  1396.     return 0 if !@battler.weapons[0]
  1397.     return @battler.weapons[0].wtype_id
  1398.   end
  1399.   #--------------------------------------------------------------------------
  1400.   # ● 是否装备盾
  1401.   #--------------------------------------------------------------------------
  1402.   def shield?
  1403.     #for armor in @battler.armors do return true if armor != nil && armor.etype_id == 1 end
  1404.     return false
  1405.   end
  1406.   #--------------------------------------------------------------------------
  1407.   # ● 是否有伤害
  1408.   #--------------------------------------------------------------------------
  1409.   def damage_zero?
  1410.     return @battler.result.hp_damage == 0 && @battler.result.mp_damage == 0 && @battler.result.tp_damage == 0
  1411.   end
  1412.   #--------------------------------------------------------------------------
  1413.   # ● 取得技能ID
  1414.   #--------------------------------------------------------------------------
  1415.   def skill_id
  1416.     return @counter_id if @counter_id != 0
  1417.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1418.     return 0 if @battler.current_action.item.is_a?(RPG::Item)
  1419.     return @battler.current_action.item.id
  1420.   end
  1421.   #--------------------------------------------------------------------------
  1422.   # ● 取得技能的种类
  1423.   #--------------------------------------------------------------------------
  1424.   def skill_type
  1425.     return 0 if skill_id == 0
  1426.     return $data_skills[skill_id].stype_id
  1427.   end
  1428.   #--------------------------------------------------------------------------
  1429.   # ● 取得技能名字
  1430.   #--------------------------------------------------------------------------
  1431.   def skill_name
  1432.     return "" if skill_id == 0
  1433.     return $data_skills[skill_id].name
  1434.   end
  1435.   #--------------------------------------------------------------------------
  1436.   # ● 取得物品ID
  1437.   #--------------------------------------------------------------------------
  1438.   def item_id
  1439.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1440.     return @battler.current_action.item.id
  1441.   end
  1442.   #--------------------------------------------------------------------------
  1443.   # ● 攻击动作
  1444.   #--------------------------------------------------------------------------
  1445.   def attack_action(item)
  1446.     return skill_action if item.is_a?(RPG::Skill)
  1447.     return item_action
  1448.   end
  1449.   #--------------------------------------------------------------------------
  1450.   # ● 基础动作伤害
  1451.   #--------------------------------------------------------------------------
  1452.   def damage_action_base(item)
  1453.     @damage_skill_id = 0
  1454.     @damage_item_id = 0
  1455.     @damage_skill_id = item.id if item.is_a?(RPG::Skill)
  1456.     @damage_item_id = item.id if item.is_a?(RPG::Item)
  1457.   end  
  1458.   #--------------------------------------------------------------------------
  1459.   # ● 动作伤害
  1460.   #--------------------------------------------------------------------------
  1461.   def damage_action(attacker, item)
  1462.     damage_action_base(item)
  1463.     act = damage(attacker)
  1464.     return if @active
  1465.     start_action(act) if act != nil
  1466.   end
  1467.   #--------------------------------------------------------------------------
  1468.   # ● 回避动作
  1469.   #--------------------------------------------------------------------------
  1470.   def evasion_action(attacker, item)
  1471.     damage_action_base(item)
  1472.     act = evasion(attacker)
  1473.     return if @active
  1474.     start_action(act) if act != nil
  1475.   end
  1476.   #--------------------------------------------------------------------------
  1477.   # ● 失误动作
  1478.   #--------------------------------------------------------------------------
  1479.   def miss_action(attacker, item)
  1480.     damage_action_base(item)
  1481.     act = miss(attacker)
  1482.     return if @active
  1483.     start_action(act) if act != nil
  1484.   end
  1485.   #--------------------------------------------------------------------------
  1486.   # ● Flash动作同时处理
  1487.   #--------------------------------------------------------------------------
  1488.   def flash_action
  1489.     return "闪光"
  1490.   end
  1491.  
  1492. end
  1493.  
  1494.  
  1495. #==============================================================================
  1496. # ■ module N03
  1497. #------------------------------------------------------------------------------
  1498. #  这是一个侧视战斗的模块。
  1499. #==============================================================================
  1500. module N03
  1501.   #--------------------------------------------------------------------------
  1502.   # ● 取得敌人角色队伍
  1503.   #--------------------------------------------------------------------------
  1504.   def self.get_enemy_unit(battler)
  1505.     return $game_troop if battler.actor?
  1506.     return $game_party
  1507.   end
  1508.   #--------------------------------------------------------------------------
  1509.   # ● 取得我方角色队伍
  1510.   #--------------------------------------------------------------------------
  1511.   def self.get_party_unit(battler)
  1512.     return $game_party if battler.actor?
  1513.     return $game_troop
  1514.   end
  1515.   #--------------------------------------------------------------------------
  1516.   # ● 取得战斗动画时间
  1517.   #--------------------------------------------------------------------------
  1518.   def self.get_anime_time(anime_id)
  1519.     return 0 if anime_id <= 0
  1520.     return $data_animations[anime_id].frame_max * 4
  1521.   end
  1522.   #--------------------------------------------------------------------------
  1523.   # ● 取得攻击动画
  1524.   #--------------------------------------------------------------------------
  1525.   def self.get_attack_anime_id(kind, battler)
  1526.     return $data_skills[battler.sv.counter_id].animation_id if kind == -3 && battler.sv.counter_id != 0
  1527.     case kind
  1528.     when -1 ; anime_id = battler.atk_animation_id1
  1529.     when -2 ; anime_id = battler.atk_animation_id2
  1530.     when -3
  1531.       if battler.current_action != nil
  1532.         anime_id = battler.current_action.item.animation_id if battler.current_action.item != nil
  1533.       end
  1534.     else    ; anime_id = kind
  1535.     end
  1536.     case anime_id
  1537.     when -1 ; anime_id = battler.atk_animation_id1
  1538.     when -2 ; anime_id = battler.atk_animation_id2
  1539.     end
  1540.     return anime_id if anime_id
  1541.     return 0
  1542.   end  
  1543.   #--------------------------------------------------------------------------
  1544.   # ● 战斗动画数据
  1545.   #--------------------------------------------------------------------------
  1546.   def self.set_damage_anime_data(targets, target, data)
  1547.     return if !first_of_all_screen_anime(data[0], target, targets)
  1548.     target.animation_id         = data[0]
  1549.     target.animation_mirror     = data[1]
  1550.     target.sv.anime_no_mirror   = data[2]
  1551.     target.sv.anime_camera_zoom = data[3]
  1552.     target.sv.anime_plus_z      = data[4]
  1553.   end   
  1554.   #--------------------------------------------------------------------------
  1555.   # ● 取得目标
  1556.   #--------------------------------------------------------------------------
  1557.   def self.get_targets(kind, battler)
  1558.     case kind.abs
  1559.     when 0 ; return [battler].dup
  1560.     when 1 ; return battler.sv.target_battler.dup
  1561.     when 2 ; return get_enemy_unit(battler).members.dup
  1562.     when 3 ; return get_party_unit(battler).members.dup
  1563.     when 4 ; return $game_troop.members.dup + $game_party.battle_members.dup
  1564.     when 5 ; return battler.sv.second_targets.dup
  1565.     end
  1566.   end  
  1567.   #--------------------------------------------------------------------------
  1568.   # ● 目标的坐标取得
  1569.   #--------------------------------------------------------------------------
  1570.   def self.get_targets_position(targets, horming, m_a = nil)
  1571.     return [0,0,0] if targets == nil && !$sv_camera.mirror
  1572.     return [Graphics.width,0,0] if targets == nil && $sv_camera.mirror
  1573.     x = y = h = 0
  1574.     for i in 0...targets.size
  1575.       x += targets[i].sv.base_x if !horming
  1576.       y += targets[i].sv.base_y if !horming
  1577.       h += targets[i].sv.base_h if !horming
  1578.       x += targets[i].sv.x if horming
  1579.       y += targets[i].sv.y if horming
  1580.       h += targets[i].sv.h if horming
  1581.       y -= targets[i].sv.ch * 100 if m_a == 0
  1582.       y -= targets[i].sv.ch * 50 if m_a == 1
  1583.     end
  1584.     return [x / targets.size, y / targets.size, h / targets.size]
  1585.   end
  1586.   #--------------------------------------------------------------------------
  1587.   # ● 速度转换时间
  1588.   #--------------------------------------------------------------------------
  1589.   def self.distanse_calculation(time, target_position, self_position, distanse_move)
  1590.     return time if !distanse_move
  1591.     distanse_x = self_position[0] - target_position[0]
  1592.     distanse_x = target_position[0] - self_position[0] if target_position[0] > self_position[0]
  1593.     distanse_y = self_position[1] - target_position[1]
  1594.     distanse_y = target_position[1] - self_position[1] if target_position[1] > self_position[1]
  1595.     if self_position[2] != nil && target_position[2] != nil
  1596.       distanse_h = self_position[2] - target_position[2]
  1597.       distanse_h = target_position[2] - self_position[2] if target_position[2] > self_position[2]
  1598.     else
  1599.       distanse_h = 0
  1600.     end
  1601.     distanse = [distanse_x, distanse_y, distanse_h].max
  1602.     return distanse / (time * 100) + 1
  1603.   end
  1604.   #--------------------------------------------------------------------------
  1605.   # ● 计算抛物线移动
  1606.   #--------------------------------------------------------------------------
  1607.   def self.parabola(data, time, size, type = 1)
  1608.     move_data = data
  1609.     move_data[0] *= size
  1610.     move_data[1] *= size
  1611.     move = []
  1612.     move_d = []
  1613.     for i in 0...time / 2
  1614.       move[i] = move_data[0]
  1615.       move_d[i] = move_data[1]
  1616.       move_data[0] = move_data[0] * type / (1 + type)
  1617.       move_data[1] = move_data[1] * type / (1 + type)
  1618.     end
  1619.     move = move + move_d.reverse!
  1620.     move.reverse!
  1621.     adjust = move.inject(0) {|result, item| result + item }
  1622.     move[move.size - 1] += adjust if data[0] == data[1] && adjust != 0
  1623.     move.unshift(0) if time % 2 != 0
  1624.     return move
  1625.   end
  1626.   #--------------------------------------------------------------------------
  1627.   # ● 反转数值
  1628.   #--------------------------------------------------------------------------
  1629.   def self.mirror_num(mirror)
  1630.     return 1 if !mirror
  1631.     return -1
  1632.   end  
  1633.   #--------------------------------------------------------------------------
  1634.   # ● 摄影机
  1635.   #--------------------------------------------------------------------------
  1636.   def self.camera(battler, data)
  1637.     battler = $game_party.battle_members[0] if !battler
  1638.     cx = data[2][0] * 100
  1639.     cy = data[2][1] * 100
  1640.     return $sv_camera.move(cx, cy, data[3], data[4], true) if data[1] == 6
  1641.     targets = self.get_targets(data[1], battler)
  1642.     return if targets == nil or targets == []
  1643.     position = self.get_targets_position(targets, true)
  1644.     $sv_camera.move(position[0], position[1] - position[2], data[3], data[4], false)
  1645.   end
  1646.   #--------------------------------------------------------------------------
  1647.   # ● 禁止战斗不能
  1648.   #--------------------------------------------------------------------------
  1649.   def self.immortaling
  1650.     # 赋予全体不死状态
  1651.     for member in $game_party.battle_members + $game_troop.members
  1652.       # 事件操作等无敌设定就会解除flag的无效
  1653.       member.sv.immortal = true if member.state?(N03::IMMORTAL_ID)
  1654.       member.add_state(N03::IMMORTAL_ID)
  1655.     end
  1656.     return true
  1657.   end  
  1658.   #--------------------------------------------------------------------------
  1659.   # ● 允许战斗不能
  1660.   #--------------------------------------------------------------------------
  1661.   def self.unimmortaling
  1662.     # 解除全体不死状态(如果事件等无敌设定以外)
  1663.     for member in $game_party.battle_members + $game_troop.members
  1664.       next if member.dead?
  1665.       # 不死身状态行动中被解除的场合、从状态中解除无效
  1666.       member.sv.immortal = false if !member.state?(N03::IMMORTAL_ID) && member.sv.immortal
  1667.       next member.sv.immortal = false if member.sv.immortal
  1668.       member.remove_state(N03::IMMORTAL_ID)
  1669.       next if member.hp != 0
  1670.       member.add_state(1)
  1671.       member.perform_collapse_effect
  1672.       member.sv.action_terminate
  1673.     end
  1674.     return false
  1675.   end  
  1676.   #--------------------------------------------------------------------------
  1677.   # ● 技能连发
  1678.   #--------------------------------------------------------------------------
  1679.   def self.derived_skill(battler)
  1680.     battler.force_action(battler.sv.derivation_skill_id, -2)
  1681.     BattleManager.unshift_action_battlers(battler)
  1682.   end
  1683.   #--------------------------------------------------------------------------
  1684.   # ● 创建伤害
  1685.   #--------------------------------------------------------------------------
  1686.   def self.set_damage(battler, hp_damage, mp_damage)
  1687.     battler.result.hp_damage = hp_damage
  1688.     battler.result.mp_damage = mp_damage
  1689.   end
  1690.   #--------------------------------------------------------------------------
  1691.   # ● 确认目标生死
  1692.   #--------------------------------------------------------------------------
  1693.   def self.targets_alive?(targets)
  1694.     return false if targets == []
  1695.     for target in targets do return true if !target.dead? end
  1696.     return false
  1697.   end
  1698.   #--------------------------------------------------------------------------
  1699.   # ● 定位到第二个目标
  1700.   #--------------------------------------------------------------------------
  1701.   def self.s_targets(battler)
  1702.     battler.sv.target_battler = battler.sv.second_targets
  1703.     return battler.sv.second_targets
  1704.   end  
  1705.   #--------------------------------------------------------------------------
  1706.   # ● 定位目标到第二个目标
  1707.   #--------------------------------------------------------------------------
  1708.   def self.targets_set(battler)
  1709.     battler.sv.second_targets = battler.current_action.make_targets.compact
  1710.     battler.sv.target_battler = battler.sv.second_targets
  1711.   end  
  1712.   #--------------------------------------------------------------------------
  1713.   # ● 实行战斗动画判定 (对象:实行第一个目标时的画面的动画)
  1714.   #--------------------------------------------------------------------------
  1715.   def self.first_of_all_screen_anime(anime_id, target, targets)
  1716.     anime = $data_animations[anime_id]
  1717.     return false if !anime
  1718.     return true if anime.position != 3
  1719.     return false if anime.position == 3 && target != targets[0]
  1720.     targets.delete(target)
  1721.     target.sv.timing_targets = targets
  1722.     return true
  1723.   end
  1724.   #--------------------------------------------------------------------------
  1725.   # ● 战斗不能是否附加攻击
  1726.   #--------------------------------------------------------------------------
  1727.   def self.dead_attack?(battler, item)
  1728.     for state in battler.atk_states
  1729.       return true if state == battler.death_state_id
  1730.     end
  1731.     for effect in item.effects
  1732.       return true if effect.code == 21 && effect.data_id == battler.death_state_id
  1733.     end
  1734.     return false
  1735.   end
  1736. end
  1737.  
  1738. #==============================================================================
  1739. # ■ Sprite_Weapon
  1740. #------------------------------------------------------------------------------
  1741. #  这是一个显示武器的脚本。
  1742. #==============================================================================
  1743. class Sprite_Weapon < Sprite_Base
  1744.   #--------------------------------------------------------------------------
  1745.   # ● 公开实例变量 
  1746.   #--------------------------------------------------------------------------
  1747.   attr_reader   :index                       # 武器图像排列的index
  1748.   attr_reader   :battler                     # 角色图像
  1749.   attr_reader   :move_time                   # 图像达到目标的为止的这段时间
  1750.   attr_reader   :through                     # 贯穿标记
  1751.   attr_reader   :action_end                  # 武器动作结束的标记
  1752.   attr_reader   :action_end_cancel           # 武器动作结束,取消的标记
  1753.   attr_reader   :hit_position                # 图像达到目标时的坐标
  1754.   attr_accessor :hit_anime_id                # 图像达到目标时的动画ID
  1755.   #--------------------------------------------------------------------------
  1756.   # ● 初始化物件
  1757.   #--------------------------------------------------------------------------
  1758.   def initialize(viewport, index, battler)
  1759.     super(viewport)
  1760.     @index = index
  1761.     @battler = battler
  1762.     @position_x = @position_y = 0
  1763.     @o = 0
  1764.     @real_x = @real_y = 0
  1765.     @mirror = @battler.sv.mirror
  1766.     reset
  1767.     set_action
  1768.   end
  1769.   #--------------------------------------------------------------------------
  1770.   # ● 初始化
  1771.   #--------------------------------------------------------------------------
  1772.   def reset
  1773.     @z_plus = 0
  1774.     @weapon_data = []
  1775.     @move_data = []
  1776.     @move_x = 0
  1777.     @move_y = 0
  1778.     @orbit = []
  1779.     @through = false
  1780.     @distanse_move = false
  1781.     @weapon_width = 0
  1782.     @weapon_height = 0
  1783.     @anime_time = 0
  1784.     @anime_position = 1
  1785.     @move_time = 0
  1786.     @hit_anime_id = 0
  1787.     @move_anime = true
  1788.     @action_end = false
  1789.     @action_end_cancel = false
  1790.     reset_position
  1791.   end  
  1792.   #--------------------------------------------------------------------------
  1793.   # ● 动作设置
  1794.   #--------------------------------------------------------------------------
  1795.   def set_action
  1796.     return if @battler.sv.effect_data == []
  1797.     weapon_anime if @battler.sv.effect_data[0][0] == "wp"
  1798.     move_anime if @battler.sv.effect_data[0][0] == "m_a"
  1799.     @battler.sv.effect_data.shift
  1800.   end
  1801.   #--------------------------------------------------------------------------
  1802.   # ● 实行武器动画
  1803.   #--------------------------------------------------------------------------
  1804.   def weapon_anime
  1805.     @weapon_data = @battler.sv.effect_data[0].dup
  1806.     set_graphics
  1807.     set_ox
  1808.     set_weapon_move
  1809.   end
  1810.   #--------------------------------------------------------------------------
  1811.   # ● 实行动画移动
  1812.   #--------------------------------------------------------------------------
  1813.   def move_anime
  1814.     @move_data = @battler.sv.effect_data[0].dup
  1815.     # 取得目标
  1816.     @target_battler = [@battler.sv.m_a_targets.shift]
  1817.     @target_battler = N03.get_targets(@move_data[3], @battler) if @move_data[3] < 0
  1818.     set_move
  1819.     return if @move_data[16] == ""
  1820.     weapon_data = N03::ACTION[@move_data[16]]
  1821.     return if weapon_data == nil
  1822.     @weapon_data = weapon_data.dup
  1823.     set_graphics
  1824.     set_ox
  1825.     set_weapon_move
  1826.   end
  1827.   #--------------------------------------------------------------------------
  1828.   # ● 取得武器图像
  1829.   #--------------------------------------------------------------------------  
  1830.   def set_graphics
  1831.     # 武器不依赖图像设定的情况下
  1832.     if @weapon_data[13] != ""
  1833.       self.bitmap = Cache.character(@weapon_data[13]).dup
  1834.       @weapon_width = self.bitmap.width
  1835.       @weapon_height = self.bitmap.height
  1836.       return
  1837.     end
  1838.     # 取得武器
  1839.     weapon = @battler.weapons[0]
  1840.     # 取得二刀流武器
  1841.     if @weapon_data[10]
  1842.       weapon = nil
  1843.       for armor in @battler.armors do break weapon = armor if armor.is_a?(RPG::Armor) && armor.etype_id == 1 end
  1844.       weapon = @battler.weapons[1] if !weapon
  1845.     end  
  1846.     # 如果没有武器将取消处理
  1847.     return if weapon == nil
  1848.     # 指数取得
  1849.     file_index = @weapon_data[12]
  1850.     # 如果使用图标
  1851.     if @weapon_data[1] == 0
  1852.       icon_index = weapon.icon_index
  1853.       self.bitmap = Cache.system("Iconset" + file_index).dup
  1854.       self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1855.       @weapon_width = @weapon_height = 24
  1856.     # 独自图像指定
  1857.     else
  1858.       file_name = @battler.sv.weapon_graphic(weapon.id, weapon.wtype_id) if weapon.is_a?(RPG::Weapon)
  1859.       file_name = @battler.sv.shield_graphic(weapon.id, weapon.atype_id) if weapon.is_a?(RPG::Armor)
  1860.       self.bitmap = Cache.character(file_name + file_index).dup
  1861.       @weapon_width = self.bitmap.width
  1862.       @weapon_height = self.bitmap.height
  1863.       return if @weapon_data[1] == 1
  1864.       # 2003规范的武器动画
  1865.       @weapon_width /= @battler.sv.max_pattern[0]
  1866.     end
  1867.   end
  1868.   #--------------------------------------------------------------------------
  1869.   # ● 取得图像的原点
  1870.   #--------------------------------------------------------------------------  
  1871.   def set_ox
  1872.     # 反转时设置为相反
  1873.     if @mirror
  1874.       case @weapon_data[6]
  1875.       when 1 ; @weapon_data[6] = 2 # 左上→右上角
  1876.       when 2 ; @weapon_data[6] = 1 # 右上→左上角
  1877.       when 3 ; @weapon_data[6] = 4 # 左下→右下角
  1878.       when 4 ; @weapon_data[6] = 3 # 右下→左下角
  1879.       end
  1880.     end
  1881.     # 原点的設定
  1882.     case @weapon_data[6]
  1883.     when 0 # 中心
  1884.       self.ox = @weapon_width / 2
  1885.       self.oy = @weapon_height / 2
  1886.     when 1 # 左上
  1887.       self.ox = 0
  1888.       self.oy = 0
  1889.     when 2 # 右上
  1890.       self.ox = @weapon_width
  1891.       self.oy = 0
  1892.     when 3 # 左下
  1893.       self.ox = 0
  1894.       self.oy = @weapon_height
  1895.     when 4 # 右下
  1896.       self.ox = @weapon_width
  1897.       self.oy = @weapon_height
  1898.     when 5 # 同角色位置
  1899.       self.ox = @weapon_width / 2
  1900.       self.oy = @weapon_height
  1901.     end
  1902.   end  
  1903.   #--------------------------------------------------------------------------
  1904.   # ● 取得角色的坐标
  1905.   #--------------------------------------------------------------------------  
  1906.   def set_battler_position
  1907.     @position_x = @battler.sv.x + @weapon_data[3][0] * N03.mirror_num(@mirror) * 100
  1908.     @position_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust) + @weapon_data[3][1] * 100
  1909.     reset_position
  1910.   end
  1911.   #--------------------------------------------------------------------------
  1912.   # ● 初始化坐标
  1913.   #--------------------------------------------------------------------------  
  1914.   def reset_position
  1915.     @real_x = @position_x / 100
  1916.     @real_y = @position_y / 100
  1917.     @real_zoom_x = 1
  1918.     @real_zoom_y = 1
  1919.   end
  1920.   #--------------------------------------------------------------------------
  1921.   # ● 战斗动画显示
  1922.   #--------------------------------------------------------------------------  
  1923.   def set_animation(anime_id)
  1924.     return if $data_animations[anime_id] == nil
  1925.     @anime_position = $data_animations[anime_id].position
  1926.     @horming = true
  1927.     @horming = false if @anime_position == 3
  1928.     @anime_camera_zoom = true
  1929.     @anime_no_mirror = false
  1930.     start_animation($data_animations[anime_id], @mirror)
  1931.     timings = $data_animations[anime_id].timings
  1932.   end
  1933.   #--------------------------------------------------------------------------
  1934.   # ● 实行打击时的战斗动画
  1935.   #--------------------------------------------------------------------------  
  1936.   def set_hit_animation(position_data, hit_anime_id, target)
  1937.     return if $data_animations[hit_anime_id] == nil
  1938.     @real_x = position_data[0]
  1939.     @real_y = position_data[1]
  1940.     @position_x = position_data[0] * 100
  1941.     @position_y = position_data[1] * 100
  1942.     self.z = position_data[2]
  1943.     @z_plus = 1000
  1944.     @action_end = false
  1945.     @horming = true
  1946.     set_animation(hit_anime_id)
  1947.     @anime_time = $data_animations[hit_anime_id].frame_max * 4
  1948.     @timing_targets = [target]
  1949.     @move_time = @hit_anime_id = 0
  1950.     @weapon_data = []
  1951.   end
  1952.   #--------------------------------------------------------------------------
  1953.   # ● 角色时间追加
  1954.   #--------------------------------------------------------------------------  
  1955.   def timing_battler_set(target)
  1956.     @timing_targets.push(target)
  1957.   end
  1958.   #--------------------------------------------------------------------------
  1959.   # ● 取得武器的移动
  1960.   #--------------------------------------------------------------------------  
  1961.   def set_weapon_move
  1962.     # 取得开始位置
  1963.     set_battler_position if @move_time == 0
  1964.     @z_plus = 50 if @z_plus == 0 && @weapon_data[9]
  1965.     self.z = @battler.sv.z + @z_plus
  1966.     # 反转处理
  1967.     @mirror = !@mirror if @weapon_data[7]
  1968.     self.mirror = @mirror
  1969.     # 更新模式设置
  1970.     set_pattern
  1971.     @max_pattern = 2 if @max_pattern == 1
  1972.     # 计算武器移动
  1973.     @weapon_move_data = []
  1974.     @weapon_angle_data = []
  1975.     @weapon_zoom_data = []
  1976.     num = N03.mirror_num(@mirror)
  1977.     for i in 0...@max_pattern
  1978.       move_data_x = @weapon_data[2][0] * num * 100 * i / (@max_pattern - 1)
  1979.       move_data_y = @weapon_data[2][1] * 100 * i / (@max_pattern - 1)
  1980.       move_angle = @weapon_data[4] * num + (@weapon_data[5] * num - @weapon_data[4] * num) * i / (@max_pattern - 1)
  1981.       move_zoom_x = 1 + (@weapon_data[8][0] - 1) * i / (@max_pattern - 1)
  1982.       move_zoom_y = 1 + (@weapon_data[8][1] - 1) * i / (@max_pattern - 1)
  1983.       @weapon_move_data.push([move_data_x, move_data_y])
  1984.       @weapon_angle_data.push(move_angle)
  1985.       @weapon_zoom_data.push([move_zoom_x, move_zoom_y])
  1986.     end
  1987.   end  
  1988.   #--------------------------------------------------------------------------
  1989.   # ● 更新模式
  1990.   #--------------------------------------------------------------------------
  1991.   def set_pattern
  1992.     if @weapon_data[11] == -1
  1993.       return @max_pattern = @battler.sv.max_pattern[0] if @battler.sv.pattern_type != 0
  1994.       @count = @battler.sv.pattern_time
  1995.       @max_count = @battler.sv.pattern_time
  1996.       @max_pattern = @battler.sv.max_pattern[0]
  1997.       @repeat = false
  1998.     else
  1999.       @count = @weapon_data[11][0]
  2000.       @max_count = @weapon_data[11][0]
  2001.       @max_pattern = @weapon_data[11][1]
  2002.       @repeat = @weapon_data[11][2]
  2003.     end
  2004.     @pattern = 0
  2005.   end
  2006.   #--------------------------------------------------------------------------
  2007.   # ● 实行移动
  2008.   #--------------------------------------------------------------------------
  2009.   def set_move
  2010.     # 取得战斗动画
  2011.     set_animation(@move_data[1][0]) if $data_animations[@move_data[1][0]] != nil && $data_animations[@move_data[1][0]].position != 3
  2012.     @anime_camera_zoom = @move_data[13]
  2013.     @loop = @move_data[14]
  2014.     @loop = false if @move_data[1][0] == 0
  2015.     @anime_no_mirror = @move_data[15]
  2016.     @se_flag = @move_data[17]
  2017.     # 取得开始位置
  2018.     start_position
  2019.     @z_plus = 1000 if @move_data[9]
  2020.     # 目标角色图像的动画的反映SE和时机设定
  2021.     @timing_targets = @target_battler
  2022.     # 计算坐标
  2023.     @move_x = @move_data[5][0] * 100 * N03.mirror_num(@mirror)
  2024.     @move_y = @move_data[5][1] * 100
  2025.     # 计算时间或速度
  2026.     @distanse_move = true if @move_data[6] > 0
  2027.     @move_time = @move_data[6].abs
  2028.     # 时间为0的时、如果被描写成动画显示时间
  2029.     if @move_time == 0
  2030.       @move_time = $data_animations[@move_data[1][0]].frame_max * 4 if $data_animations[@move_data[1][0]]
  2031.       @move_time = 1 if !$data_animations[@move_data[1][0]]
  2032.       @distanse_move = false
  2033.     end
  2034.     # 贯穿类型的场合
  2035.     @through = true if @move_data[7] == 1
  2036.     @auto_through_flag = false
  2037.     @auto_through_flag = true if @move_data[7] == 0
  2038.     # 计算目标坐标
  2039.     if @target_battler == nil
  2040.       @target_x = @move_x * 100
  2041.       @target_x = (Graphics.width - @move_x) * 100 if @mirror
  2042.       @target_y = @move_y * 100
  2043.     else
  2044.       move_data_set
  2045.     end
  2046.     # 计算目标达到的时间
  2047.     @move_time = distanse_calculation(@move_time, @target_x, @target_y)
  2048.     # 计算圆形轨道
  2049.     orbit
  2050.     # 角色的体能设定
  2051.     @battler.sv.wait = @move_time - 1 if @move_data[10][0]
  2052.     @move_horming = @move_data[12]
  2053.   end  
  2054.   #--------------------------------------------------------------------------
  2055.   # ● 速度转换时间
  2056.   #--------------------------------------------------------------------------
  2057.   def distanse_calculation(time, target_x, target_y)
  2058.     return time if !@distanse_move
  2059.     distanse_x = @position_x - @target_x
  2060.     distanse_x = @target_x - @position_x if @target_x > @position_x
  2061.     distanse_y = @position_y - @target_y
  2062.     distanse_y = @target_y - @position_y if @target_y > @position_y
  2063.     distanse = [distanse_x, distanse_y].max
  2064.     return distanse / (time * 100) + 1
  2065.   end
  2066.   #--------------------------------------------------------------------------
  2067.   # ● 更新移动目标
  2068.   #--------------------------------------------------------------------------
  2069.   def move_data_set
  2070.     return if @target_battler == nil
  2071.     position = N03.get_targets_position(@target_battler, true, @anime_position)
  2072.     @target_x = position[0] + @move_x
  2073.     @target_y = position[1] - position[2] + @move_y
  2074.   end
  2075.   #--------------------------------------------------------------------------
  2076.   # ● 计算开始位置
  2077.   #--------------------------------------------------------------------------
  2078.   def start_position
  2079.     starter = [@battler.sv.m_a_starter.shift]
  2080.     starter = N03.get_targets(@move_data[2], @battler) if @move_data[2] < 0
  2081.     position = [0, 0]
  2082.     position = N03.get_targets_position(starter, true, @anime_position) if starter != nil
  2083.     @position_x = position[0] + @move_data[4][0] * 100
  2084.     @position_y = position[1] + position[2] + @move_data[4][1] * 100
  2085.     @position_z = @position_y
  2086.   end  
  2087.   #--------------------------------------------------------------------------
  2088.   # ● 计算原型轨道
  2089.   #--------------------------------------------------------------------------
  2090.   def orbit
  2091.     orbit_data = @move_data[8].dup
  2092.     orbit_data[0] *= 100
  2093.     orbit_data[1] *= 100
  2094.     orbit_d = []
  2095.     for i in 0...@move_time / 2
  2096.       @orbit[i] = orbit_data[0]
  2097.       orbit_data[0] /= 2
  2098.       orbit_d[i] = orbit_data[1]
  2099.       orbit_data[1] /= 2
  2100.     end
  2101.     @orbit = @orbit + orbit_d.reverse!
  2102.     @orbit.reverse!
  2103.   end  
  2104.   #--------------------------------------------------------------------------
  2105.   # ● 更新框架
  2106.   #--------------------------------------------------------------------------
  2107.   def update
  2108.     update_hit_anime if @anime_time != 0
  2109.     update_move if @move_time != 0
  2110.     update_weapon_move if @weapon_data != []
  2111.     update_position
  2112.     update_color
  2113.     self.visible = @battler.sv.weapon_visible
  2114.     super
  2115.   end
  2116.   #--------------------------------------------------------------------------
  2117.   # ● 打击时的战斗动画
  2118.   #--------------------------------------------------------------------------
  2119.   def update_hit_anime
  2120.     @anime_time -= 1
  2121.     @action_end = true if @anime_time == 0
  2122.   end
  2123.   #--------------------------------------------------------------------------
  2124.   # ● 更新移动
  2125.   #--------------------------------------------------------------------------
  2126.   def update_move
  2127.     move_data_set if @move_horming && !@hit_position
  2128.     through_set(@move_time, @target_x, @target_y) if @move_time == 1 && !@hit_position
  2129.     @o += @orbit[@move_time - 1] if @orbit[@move_time - 1] != nil
  2130.     @position_x = (@position_x * (@move_time - 1) + @target_x) / @move_time
  2131.     @position_y = (@position_y * (@move_time - 1) + @target_y) / @move_time + @o
  2132.     reset_position
  2133.     set_animation(@move_data[1][0]) if @loop && !animation?
  2134.     @move_time -= 1
  2135.     return if @move_time != 0
  2136.     @action_end = true if !@action_end_cancel
  2137.   end
  2138.   #--------------------------------------------------------------------------
  2139.   # ● 更新武器的移动
  2140.   #--------------------------------------------------------------------------
  2141.   def update_weapon_move
  2142.     pattern = update_pattern
  2143.     set_battler_position if @move_time == 0 && !@action_end_cancel
  2144.     @real_x = @position_x / 100 + @weapon_move_data[pattern][0] / 100
  2145.     @real_y = @position_y / 100 + @weapon_move_data[pattern][1] / 100
  2146.     @real_zoom_x = @weapon_zoom_data[pattern][0]
  2147.     @real_zoom_y = @weapon_zoom_data[pattern][1]
  2148.     self.angle = @weapon_angle_data[pattern]
  2149.     self.src_rect.set(@weapon_width * pattern, 0, @weapon_width, @weapon_height) if @weapon_data[1] == 2
  2150.   end
  2151.   #--------------------------------------------------------------------------
  2152.   # ● 更新模式
  2153.   #--------------------------------------------------------------------------
  2154.   def update_pattern
  2155.     return @battler.sv.pattern_w if @count == nil
  2156.     @count -= 1
  2157.     return @pattern if @count != 0
  2158.     @count = @max_count
  2159.     @pattern += 1
  2160.     if !@repeat && @pattern == @max_pattern
  2161.       @pattern = @max_pattern - 1
  2162.     elsif @pattern == @max_pattern
  2163.       @pattern = 0
  2164.     end
  2165.     return @pattern
  2166.   end
  2167.   #--------------------------------------------------------------------------
  2168.   # ● 更新坐标
  2169.   #--------------------------------------------------------------------------
  2170.   def update_position
  2171.     self.x = (@real_x - $sv_camera.x) * $sv_camera.convert / 1000
  2172.     self.y = (@real_y - $sv_camera.y) * $sv_camera.convert / 1000
  2173.     self.x += $sv_camera.sx / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2174.     self.y += $sv_camera.sy / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2175.     self.z = @battler.sv.z + @z_plus - 10
  2176.     self.zoom_x = @real_zoom_x * $sv_camera.zoom
  2177.     self.zoom_y = @real_zoom_y * $sv_camera.zoom
  2178.     self.opacity = @battler.sv.opacity if @battler.sv.opacity_data[4]
  2179.   end
  2180.   #--------------------------------------------------------------------------
  2181.   # ● 贯穿的处理
  2182.   #--------------------------------------------------------------------------
  2183.   def through_set(time, target_x, target_y)
  2184.     @hit_anime_id = N03.get_attack_anime_id(@move_data[1][1], @battler)
  2185.     @battler.sv.wait = N03.get_anime_time(@hit_anime_id) if @move_data[10][1]
  2186.     moving_x = (target_x / 100 - @position_x / 100) / time
  2187.     moving_y = (target_y / 100 - @position_y / 100) / time
  2188.     goal_x = $sv_camera.max_left - 100 if moving_x < 0
  2189.     goal_x = Graphics.width + $sv_camera.max_right + 100 if moving_x > 0
  2190.     goal_y = $sv_camera.max_top - 100 if moving_y < 0
  2191.     goal_y = Graphics.height + $sv_camera.max_bottom + 100 if moving_y > 0
  2192.     if goal_x == nil &&  goal_y == nil
  2193.       time = 0
  2194.       reset_position
  2195.     else
  2196.       time = move_calculation(moving_x, moving_y, goal_x, goal_y)
  2197.     end
  2198.     target_x = @position_x + moving_x * time * 100
  2199.     target_y = @position_y + moving_y * time * 100
  2200.     @pre_data = [time, target_x, target_y]
  2201.     @battler.sv.m_a_data.push([@move_data[11], @target_battler, @index, @auto_through_flag, []])
  2202.     @action_end_cancel = true
  2203.     @hit_position = [@real_x, @real_y, self.z]
  2204.   end  
  2205.   #--------------------------------------------------------------------------
  2206.   # ● 达到时间预算
  2207.   #--------------------------------------------------------------------------
  2208.   def move_calculation(moving_x, moving_y, goal_x, goal_y)
  2209.     move_x = @position_x / 100
  2210.     move_y = @position_y / 100
  2211.     time = 0
  2212.     loop do
  2213.       move_x += moving_x
  2214.       move_y += moving_y
  2215.       time += 1
  2216.       return time if moving_x < 0 && move_x < goal_x
  2217.       return time if moving_x > 0 && move_x > goal_x
  2218.       return time if moving_y < 0 && move_y < goal_y
  2219.       return time if moving_y > 0 && move_y > goal_y
  2220.     end
  2221.   end   
  2222.   #--------------------------------------------------------------------------
  2223.   # ● 错误时从处理消失转换成贯穿处理
  2224.   #--------------------------------------------------------------------------
  2225.   def through_change
  2226.     @action_end_cancel = false
  2227.     @through = true
  2228.     @move_time = @pre_data[0]
  2229.     @target_x = @pre_data[1]
  2230.     @target_y = @pre_data[2]
  2231.     @pre_data = nil
  2232.   end  
  2233.   #--------------------------------------------------------------------------
  2234.   # ● SE 闪光灯和处理的时间
  2235.   #--------------------------------------------------------------------------
  2236.   def animation_process_timing(timing)
  2237.     return if !@timing_targets
  2238.     se_flag = true
  2239.     se_flag = @se_flag if @se_flag != nil
  2240.     for target in @timing_targets
  2241.       target.sv.timing.push([se_flag, timing.dup])
  2242.       se_flag = false if @animation.position == 3
  2243.     end  
  2244.   end
  2245.   #--------------------------------------------------------------------------
  2246.   # ● 更新色调
  2247.   #--------------------------------------------------------------------------
  2248.   def update_color
  2249.     return if @battler.sv.color == []
  2250.     self.color.set(@battler.sv.color[0], @battler.sv.color[1], @battler.sv.color[2], @battler.sv.color[3])
  2251.   end
  2252.   #--------------------------------------------------------------------------
  2253.   # ● 释放
  2254.   #--------------------------------------------------------------------------
  2255.   def dispose
  2256.     super
  2257.     self.bitmap.dispose if self.bitmap != nil
  2258.   end
  2259. end
  2260.  
  2261. #==============================================================================
  2262. # ■ Sprite_Battle_Picture
  2263. #------------------------------------------------------------------------------
  2264. #  这是一个画面的图象显示。
  2265. #==============================================================================
  2266. class Sprite_Battle_Picture < Sprite
  2267.   #--------------------------------------------------------------------------
  2268.   # ● 公开实例变量
  2269.   #--------------------------------------------------------------------------
  2270.   attr_accessor   :action_end           # 结束标记
  2271.   #--------------------------------------------------------------------------
  2272.   # ● 初始化物件
  2273.   #--------------------------------------------------------------------------
  2274.   def initialize(viewport = nil)
  2275.     super(viewport)
  2276.     @action_end = false
  2277.     self.ox = 0
  2278.   end
  2279.   #--------------------------------------------------------------------------
  2280.   # ● 集合
  2281.   #--------------------------------------------------------------------------
  2282.   def set(battler)
  2283.     @battler = battler
  2284.     @data = @battler.sv.effect_data.shift
  2285.     @time = @data[4]
  2286.     @mirror = $sv_camera.mirror
  2287.     @mirror = false if !@data[8]
  2288.     self.opacity = @data[6][0]
  2289.     @s_x = @data[2][0] if @data[2] != []
  2290.     @s_x = Graphics.width - @data[2][0]  if @data[2] != [] && @mirror
  2291.     @s_y = @data[2][1] if @data[2] != []
  2292.     @e_x = @data[3][0] if @data[3] != []
  2293.     @e_x = Graphics.width - @data[3][0] if @data[3] != [] && @mirror
  2294.     @e_y = @data[3][1] if @data[3] != []
  2295.     @s_x = self.x if @data[2] == []
  2296.     @s_y = self.y if @data[2] == []
  2297.     @e_x = self.x if @data[3] == []
  2298.     @e_y = self.y if @data[3] == []
  2299.     self.x = @s_x
  2300.     self.y = @s_y
  2301.     return @action_end = true if @time == 0
  2302.     @move_x = (@e_x * 1.0 - @s_x) / @time
  2303.     @move_y = (@e_y * 1.0 - @s_y) / @time
  2304.     self.z = @data[5]
  2305.     return set_plane(battler) if @data[7] != []
  2306.     self.bitmap = Cache.picture(@data[9]) if !bitmap or @data[9] != ""
  2307.     return @action_end = true if !bitmap
  2308.     self.mirror = @mirror
  2309.     self.ox = self.bitmap.width if @mirror
  2310.   end
  2311.   #--------------------------------------------------------------------------
  2312.   # ● 过渡平面
  2313.   #--------------------------------------------------------------------------
  2314.   def set_plane(battler)
  2315.     @viewport = Viewport.new(@data[2][0],@data[2][1],@data[7][0],@data[7][1]) if !@viewport
  2316.     viewport = @viewport
  2317.     @plane = Plane.new(viewport) if !@plane
  2318.     @plane.bitmap = Cache.picture(@data[9]) if !@plane.bitmap or @data[9] != ""
  2319.     return @action_end = true if !@plane.bitmap
  2320.     @plane.ox = @data[7][0]
  2321.     @plane.oy = @data[7][1]
  2322.     @plane.opacity = @data[6][0]
  2323.     @move_x = @remain_move[0] if @data[2] == @data[3]
  2324.     @move_y = @remain_move[1] if @data[2] == @data[3]
  2325.     @remain_move = [@move_x, @move_y]
  2326.   end
  2327.   #--------------------------------------------------------------------------
  2328.   # ● 更新帧数
  2329.   #--------------------------------------------------------------------------
  2330.   def update
  2331.     @action_end = true if !@battler.sv.picture
  2332.     return if @time == 0
  2333.     return if @action_end
  2334.     @time -= 1
  2335.     return plane_update if @plane
  2336.     super
  2337.     self.x += @move_x
  2338.     self.y += @move_y
  2339.     self.opacity += @data[6][1]
  2340.     return if @time != 1
  2341.     self.x = @e_x
  2342.     self.y = @e_y
  2343.     @time = 0
  2344.   end
  2345.   #--------------------------------------------------------------------------
  2346.   # ● 更新平面
  2347.   #--------------------------------------------------------------------------
  2348.   def plane_update
  2349.     @plane.ox += @move_x
  2350.     @plane.oy += @move_y
  2351.     @plane.opacity += @data[6][1]
  2352.     @time = @data[4] if @time == 0
  2353.   end
  2354.   #--------------------------------------------------------------------------
  2355.   # ● 释放
  2356.   #--------------------------------------------------------------------------
  2357.   def dispose
  2358.     bitmap.dispose if bitmap
  2359.     @plane.dispose if @plane
  2360.     @viewport.dispose if @viewport
  2361.     super
  2362.   end
  2363. end
  2364.  
  2365. #==============================================================================
  2366. # ■ Sprite_Back_Picture
  2367. #------------------------------------------------------------------------------
  2368. #  这是一个精灵的一段画面。
  2369. #==============================================================================
  2370. class Sprite_Back_Picture < Plane
  2371.   #--------------------------------------------------------------------------
  2372.   # ● 公开实例变量 
  2373.   #--------------------------------------------------------------------------
  2374.   attr_accessor   :action_end           # 结束标记
  2375.   #--------------------------------------------------------------------------
  2376.   # ● 初始化物件
  2377.   #--------------------------------------------------------------------------
  2378.   def initialize(viewport = nil, index)
  2379.     super(viewport)
  2380.     @index = index
  2381.     @real_x = 0
  2382.     @real_y = 0
  2383.     @real_opacity = 0
  2384.     @move_x = 0
  2385.     @move_y = 0
  2386.     @move_opacity = 0
  2387.     @time = 0
  2388.     @switche = 0
  2389.     @action_end = false
  2390.   end
  2391.   #--------------------------------------------------------------------------
  2392.   # ● 格局
  2393.   #--------------------------------------------------------------------------
  2394.   def setup(data)
  2395.     self.bitmap = Cache.picture(data[9])
  2396.     self.z = data[6]
  2397.     @switche = data[1]
  2398.     mirror = $sv_camera.mirror
  2399.     mirror = false if !data[8]
  2400.     @move_x = data[3][0]
  2401.     @move_x *= -1 if mirror
  2402.     @move_y = data[3][1]
  2403.     @time = data[4]
  2404.     @time = -1 if @time == 0
  2405.     @real_opacity = (data[5][0] + 1) * 100
  2406.     @move_opacity = data[5][1]
  2407.     @start_opacity = data[5][0]
  2408.     @shake_ok = data[7]
  2409.   end
  2410.   #--------------------------------------------------------------------------
  2411.   # ● 更新帧数
  2412.   #--------------------------------------------------------------------------
  2413.   def update
  2414.     update_picture if @time != 0
  2415.     self.ox = $sv_camera.x - @real_x
  2416.     self.oy = $sv_camera.y - @real_y
  2417.     if @shake_ok
  2418.       self.ox -= $sv_camera.sx / 100
  2419.       self.oy -= $sv_camera.sy / 100
  2420.     end
  2421.     self.ox *= $sv_camera.zoom
  2422.     self.oy *= $sv_camera.zoom
  2423.     self.zoom_x = @zoom_x * $sv_camera.zoom
  2424.     self.zoom_y = @zoom_y * $sv_camera.zoom
  2425.     self.opacity = @real_opacity / 100
  2426.     @move_opacity *= -1 if self.opacity == 255 or self.opacity <= @start_opacity
  2427.     @switche
  2428.     @action_end = true if @switche > 0 && !$game_switches[@switche]
  2429.     @action_end = true if @switche < 0 && !$sv_camera.switches[@switche.abs]
  2430.   end
  2431.   #--------------------------------------------------------------------------
  2432.   # ● 更新图片
  2433.   #--------------------------------------------------------------------------
  2434.   def update_picture
  2435.     @real_x += @move_x / 100
  2436.     @real_y += @move_y / 100
  2437.     @real_x = 0 if @real_x >= self.bitmap.width or @real_x <= -self.bitmap.width
  2438.     @real_y = 0 if @real_y >= self.bitmap.height or @real_y <= -self.bitmap.height
  2439.     @zoom_x = 1
  2440.     @zoom_y = 1
  2441.     @real_opacity += @move_opacity
  2442.     @time -= 1
  2443.     @time = -1 if @time < -100
  2444.   end
  2445. end
  2446.  
  2447. #==============================================================================
  2448. # ■ Sprite_Back_Picture
  2449. #------------------------------------------------------------------------------
  2450. #  这是一个精灵的伤害显示。
  2451. #==============================================================================
  2452. class Sprite_Damage < Sprite
  2453.   #--------------------------------------------------------------------------
  2454.   # ● 公开实例变量 
  2455.   #--------------------------------------------------------------------------
  2456.   attr_reader   :action_end                  # POP结束标记
  2457.   #--------------------------------------------------------------------------
  2458.   # ● 初始化物件
  2459.   #--------------------------------------------------------------------------
  2460.   def initialize(viewport = nil, battler)
  2461.     super(viewport)
  2462.     @battler = battler
  2463.     @time = 0
  2464.     return @action_end = true if !@battler
  2465.     @direction = -1
  2466.     @direction *= -1 if @battler.actor?
  2467.     @direction *= -1 if $sv_camera.mirror
  2468.     set_state
  2469.     set_damage
  2470.     update
  2471.   end
  2472.   #--------------------------------------------------------------------------
  2473.   # ● 显示状态
  2474.   #--------------------------------------------------------------------------
  2475.   def set_state
  2476.     return if !N03::STATE_POP
  2477.     states = @battler.result.added_state_objects
  2478.     states.delete($data_states[@battler.death_state_id]) if @battler.result.hp_damage != 0
  2479.     return if states == []
  2480.     return if @battler.sv.add_state == @battler.result.added_state_objects
  2481.     @battler.sv.add_state = states.dup
  2482.     @st = []
  2483.     @st_base = []
  2484.     for i in 0...states.size
  2485.       @st[i] = Sprite.new
  2486.       bitmap_state(@st[i], states[i])
  2487.       @st_base[i] = []
  2488.       @st_base[i][0] = @direction * (-20 + 5 * i) + @battler.sv.x / 100
  2489.       @st_base[i][1] = -40 - @state_height * i + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2490.       @st[i].z = 1000 + i
  2491.       @st[i].opacity = 0
  2492.     end
  2493.     @time = @pop_time = 80
  2494.   end   
  2495.   #--------------------------------------------------------------------------
  2496.   # ● 状态图像
  2497.   #--------------------------------------------------------------------------
  2498.   def bitmap_state(state, state_object)
  2499.     name = state_object.name
  2500.     state.bitmap = Cache.system("Iconset").dup
  2501.     state.src_rect.set(state_object.icon_index % 16 * 24, state_object.icon_index / 16 * 24, 24, 24)
  2502.     @state_height = 24
  2503.   end
  2504.   #--------------------------------------------------------------------------
  2505.   # ● 显示打击伤害
  2506.   #--------------------------------------------------------------------------
  2507.   def hit_count
  2508.     for i in [email]0...@battler.sv.hit.size[/email]
  2509.       if @battler.sv.hit[i] == nil
  2510.         @hit = i
  2511.         return @battler.sv.hit[i] = @hit
  2512.       end
  2513.     end
  2514.     @hit = @battler.sv.hit.size
  2515.     @battler.sv.hit.push(@hit)
  2516.   end  
  2517.   #--------------------------------------------------------------------------
  2518.   # ● 显示伤害
  2519.   #--------------------------------------------------------------------------
  2520.   def set_damage
  2521.     return @action_end = true if !N03::DAMAGE_POP
  2522.     damage = @battler.result.hp_damage if @battler.result.hp_damage != 0
  2523.     damage = @battler.result.hp_drain  if @battler.result.hp_drain  != 0
  2524.     damage = @battler.result.mp_damage if @battler.result.mp_damage != 0
  2525.     damage = @battler.result.mp_drain  if @battler.result.mp_drain  != 0
  2526.     damage = @battler.result.tp_damage if @battler.result.tp_damage != 0
  2527.     if !damage or damage == 0
  2528.       @action_end = true if @st == nil
  2529.       return # 状态POP考虑设置@action_end不返回
  2530.     end
  2531.     hit_count
  2532.     # @hit = @battler.sv.hit
  2533.     # @battler.sv.hit += 1 if damage != 0
  2534.     file = N03::DAMAGE_PLUS if damage > 0
  2535.     file = N03::DAMAGE_MINUS if damage < 0
  2536.     add_file = N03::DAMAGE_MP if @battler.result.mp_damage != 0
  2537.     add_file = N03::DAMAGE_TP if @battler.result.tp_damage != 0
  2538.     adjust_x = N03::DAMAGE_ADJUST
  2539.     @num = []
  2540.     @num_base = []
  2541.     damage = damage.abs
  2542.     max_num = damage.to_s.size
  2543.     max_num += 1 if add_file != nil
  2544.     for i in 0...max_num
  2545.       @num[i] = Sprite.new
  2546.       if add_file != nil && i == max_num - 1
  2547.         @num[i].bitmap = Cache.system(add_file)
  2548.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2549.         sw = 0 if sw == nil
  2550.       else
  2551.         @num[i].bitmap = Cache.system(file)
  2552.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2553.         sw = @num[i].bitmap.width / 10
  2554.         @num[i].src_rect.set(cw * sw, 0, sw, @num[i].bitmap.height)
  2555.       end
  2556.       @num_base[i] = []
  2557.       @num_base[i][0] = (sw + adjust_x) * i * -1 + (@battler.sv.x / 100)
  2558.       @num_base[i][1] =  -(@num[i].bitmap.height / 3) - i * 2 - @hit * 2 + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2559.       @num_base[i][0] -= @num[i].bitmap.width / 2 - adjust_x if add_file != nil && i == max_num - 1
  2560.       @num[i].z = 1000 + i + @hit * 10
  2561.     end
  2562.     @time = @pop_time = 80
  2563.   end
  2564.   #--------------------------------------------------------------------------
  2565.   # ● 更新帧数
  2566.   #--------------------------------------------------------------------------
  2567.   def update
  2568.     return if @time == 0
  2569.     for i in [email]0...@st.size[/email] do update_state_move(@st[i], i) end if @st != nil
  2570.     for i in [email]0...@num.size[/email] do update_num_move(@num[i], i) end if @num != nil
  2571.     @time -= 1
  2572.     @action_end = true if @time == 0
  2573.   end
  2574.   #--------------------------------------------------------------------------
  2575.   # ● 更新状态图像
  2576.   #--------------------------------------------------------------------------
  2577.   def update_state_move(state, index)
  2578.     min = @pop_time - index * 2
  2579.     case @time
  2580.     when min-15..min
  2581.       @st_base[index][0] += @direction
  2582.       state.opacity += 25
  2583.     when min-80..min-50
  2584.       @st_base[index][0] += @direction
  2585.       state.opacity -= 25
  2586.     end
  2587.     state.x = (@st_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2588.     state.y = (@st_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2589.   end
  2590.   #--------------------------------------------------------------------------
  2591.   # ● 更新数值
  2592.   #--------------------------------------------------------------------------
  2593.   def update_num_move(num, index)
  2594.     min = @pop_time - index * 2
  2595.     case @time
  2596.     when min-1..min
  2597.       @num_base[index][0] += @direction * @hit
  2598.       @num_base[index][1] -= 5 + @hit * 2
  2599.     when min-3..min-2
  2600.       @num_base[index][0] += @direction * @hit
  2601.       @num_base[index][1] -= 4 + @hit * 2
  2602.     when min-6..min-4
  2603.       @num_base[index][0] += @direction
  2604.       @num_base[index][1] -= 3 + @hit * 2
  2605.     when min-14..min-7
  2606.       @num_base[index][0] += @direction
  2607.       @num_base[index][1] += 2
  2608.     when min-17..min-15
  2609.       @num_base[index][1] -= 2 + @hit * 2
  2610.     when min-23..min-18
  2611.       @num_base[index][1] += 1
  2612.     when min-27..min-24
  2613.       @num_base[index][1] -= 1
  2614.     when min-30..min-28
  2615.       @num_base[index][1] += 1
  2616.     when min-33..min-31
  2617.       @num_base[index][1] -= 1
  2618.     when min-36..min-34
  2619.       @num_base[index][1] += 1
  2620.     end
  2621.     num.x = (@num_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2622.     num.y = (@num_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2623.     num.opacity = 256 - (12 - @time) * 32
  2624.     num.visible = false if @time == 0
  2625.   end
  2626.   #--------------------------------------------------------------------------
  2627.   # ● 释放
  2628.   #--------------------------------------------------------------------------
  2629.   def dispose
  2630.     @battler.sv.hit[@hit] = nil if @hit
  2631.     bitmap.dispose if bitmap
  2632.     for i in [email]0...@num.size[/email] do @num[i].dispose end if @num != nil
  2633.     for i in [email]0...@st.size[/email] do @st[i].dispose end if @st != nil
  2634.     super
  2635.   end
  2636. end
  2637.  
  2638. #==============================================================================
  2639. # ■ Window_Skill_name
  2640. #------------------------------------------------------------------------------
  2641. #  这是一个显示技能名字的窗口。
  2642. #==============================================================================
  2643. class Window_Skill_name < Window_Base
  2644.   #--------------------------------------------------------------------------
  2645.   # ● 初始化物件
  2646.   #--------------------------------------------------------------------------
  2647.   def initialize(text)
  2648.     super(0, 0, Graphics.width, line_height + standard_padding * 2)
  2649.     draw_text(4, 0, Graphics.width - 64, line_height,text, 1)
  2650.   end
  2651. end
  2652.  
  2653. #==============================================================================
  2654. # ■ Spriteset_Sideview
  2655. #------------------------------------------------------------------------------
  2656. #  处理战斗画面的精灵的类。本类在横版战斗类的內定使用。
  2657. #==============================================================================
  2658. class Spriteset_Sideview
  2659.   #--------------------------------------------------------------------------
  2660.   # ● 初始化物件
  2661.   #--------------------------------------------------------------------------
  2662.   def initialize(viewport)
  2663.     @viewport = viewport
  2664.     @weapons = []
  2665.     @pictures = []
  2666.     @back_pic = []
  2667.     @damage = []
  2668.     $sv_camera.setup
  2669.     N03.camera(nil, N03::BATTLE_CAMERA["顺序开始前"].dup)
  2670.   end
  2671.   #--------------------------------------------------------------------------
  2672.   # ● 更新帧数
  2673.   #--------------------------------------------------------------------------
  2674.   def update
  2675.     update_battler_data
  2676.     update_damage
  2677.     update_pictures
  2678.     update_back_pic
  2679.     update_weapons
  2680.   end  
  2681.   #--------------------------------------------------------------------------
  2682.   # ● 更新角色数据
  2683.   #--------------------------------------------------------------------------
  2684.   def update_battler_data
  2685.     for battler in $game_party.battle_members + $game_troop.members
  2686.       weapon_end(battler) if battler.sv.weapon_end
  2687.       next if battler.sv.effect_data == []
  2688.       for effect_data in battler.sv.effect_data do set_effects(battler, effect_data) end
  2689.     end
  2690.   end
  2691.   #--------------------------------------------------------------------------
  2692.   # ● 更新伤害图像
  2693.   #--------------------------------------------------------------------------
  2694.   def update_damage
  2695.     for i in [email]0...@damage.size[/email]
  2696.       next if @damage[i] == nil
  2697.       @damage[i].update if @damage[i] != nil
  2698.       next if !@damage[i].action_end
  2699.       @damage[i].dispose
  2700.       @damage[i] = nil
  2701.     end
  2702.   end
  2703.   #--------------------------------------------------------------------------
  2704.   # ● 更新图片动作
  2705.   #--------------------------------------------------------------------------
  2706.   def update_pictures
  2707.     for i in [email]0...@pictures.size[/email]
  2708.       next if @pictures[i] == nil
  2709.       @pictures[i].update if @pictures[i] != nil
  2710.       next if !@pictures[i].action_end
  2711.       @pictures[i].dispose
  2712.       @pictures[i] = nil
  2713.     end
  2714.   end
  2715.   #--------------------------------------------------------------------------
  2716.   # ● 更新期间图片
  2717.   #--------------------------------------------------------------------------
  2718.   def update_back_pic
  2719.     set_back_pic if $sv_camera.program_picture != []
  2720.     for i in [email]0...@back_pic.size[/email]
  2721.       next if @back_pic[i] == nil
  2722.       @back_pic[i].update if @back_pic[i] != nil
  2723.       next if !@back_pic[i].action_end
  2724.       @back_pic[i].dispose
  2725.       @back_pic[i] = nil
  2726.     end
  2727.   end
  2728.   #--------------------------------------------------------------------------
  2729.   # ● 更新武器动作
  2730.   #--------------------------------------------------------------------------
  2731.   def update_weapons
  2732.     for i in [email]0...@weapons.size[/email]
  2733.       next if @weapons[i] == nil
  2734.       @weapons[i].update if @weapons[i] != nil
  2735.       next if !@weapons[i].action_end
  2736.       @weapons[i].dispose
  2737.       @weapons[i] = nil
  2738.     end
  2739.   end
  2740.   #--------------------------------------------------------------------------
  2741.   # ● 实行伤害
  2742.   #--------------------------------------------------------------------------
  2743.   def set_damage_pop(target)
  2744.     for i in [email]0...@damage.size[/email]
  2745.       next if @damage[i] != nil
  2746.       return @damage[i] = Sprite_Damage.new(@viewport, target)
  2747.     end
  2748.     @damage.push(Sprite_Damage.new(@viewport, target))
  2749.   end
  2750.   #--------------------------------------------------------------------------
  2751.   # ● 实行期间图片
  2752.   #--------------------------------------------------------------------------
  2753.   def set_back_pic
  2754.     for data in $sv_camera.program_picture
  2755.       if @back_pic[data[2]] != nil
  2756.         @back_pic[data[2]].dispose
  2757.         @back_pic[data[2]] = nil
  2758.       end
  2759.       @back_pic[data[2]] = Sprite_Back_Picture.new(@viewport, data[2])
  2760.       @back_pic[data[2]].setup(data)
  2761.     end
  2762.     $sv_camera.program_picture = []
  2763.   end
  2764.   #--------------------------------------------------------------------------
  2765.   # ● 开始效果
  2766.   #--------------------------------------------------------------------------
  2767.   def set_effects(battler, effect_data)
  2768.     case effect_data[0]
  2769.     when "pic" ; set_pictures(battler, effect_data)
  2770.     when  "wp" ; set_weapons(battler,  true)
  2771.     when "m_a" ; set_weapons(battler, false)
  2772.     end
  2773.   end
  2774.   #--------------------------------------------------------------------------
  2775.   # ● 实行图片动作
  2776.   #--------------------------------------------------------------------------
  2777.   def set_pictures(battler, effect_data)
  2778.     @pictures[effect_data[1]] = Sprite_Battle_Picture.new if @pictures[effect_data[1]] == nil
  2779.     @pictures[effect_data[1]].set(battler)
  2780.   end
  2781.   #--------------------------------------------------------------------------
  2782.   # ● 实行武器动作
  2783.   #--------------------------------------------------------------------------
  2784.   def set_weapons(battler, weapon_flag, test = true)
  2785.     for i in [email]0...@weapons.size[/email]
  2786.       next if @weapons[i] != nil
  2787.       @weapons[i] = Sprite_Weapon.new(@viewport, i, battler)
  2788.       battler.sv.weapon_index.push(i) if weapon_flag
  2789.       return i
  2790.     end
  2791.     @weapons.push(Sprite_Weapon.new(@viewport, @weapons.size, battler))
  2792.     battler.sv.weapon_index.push(@weapons.size - 1) if weapon_flag
  2793.     return @weapons.size - 1
  2794.   end
  2795.   #--------------------------------------------------------------------------
  2796.   # ● 角色的武器动作结束
  2797.   #--------------------------------------------------------------------------
  2798.   def weapon_end(battler)
  2799.     battler.sv.weapon_end = false
  2800.     for index in battler.sv.weapon_index
  2801.       weapon_index = battler.sv.weapon_index.shift
  2802.       @weapons[weapon_index].dispose if @weapons[weapon_index] != nil
  2803.       @weapons[weapon_index] = nil
  2804.     end
  2805.     battler.sv.weapon_index.compact!
  2806.   end  
  2807.   #--------------------------------------------------------------------------
  2808.   # ● 实行打击時的战斗动画
  2809.   #--------------------------------------------------------------------------
  2810.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  2811.     weapon = @weapons[weapon_index]
  2812.     for target in hit_targets
  2813.       next @weapons[@hit_index].timing_battler_set(target) if @hit_index != nil
  2814.       @hit_index = set_weapons(battler, false, false)
  2815.       @weapons[@hit_index].set_hit_animation(weapon.hit_position, weapon.hit_anime_id, target)
  2816.     end
  2817.     @hit_index = nil
  2818.     if !weapon.through && !miss
  2819.       @weapons[weapon_index].dispose
  2820.       @weapons[weapon_index] = nil
  2821.     else
  2822.       @weapons[weapon_index].through_change
  2823.     end
  2824.   end
  2825.   #--------------------------------------------------------------------------
  2826.   # ● 初始化侧视图数据
  2827.   #--------------------------------------------------------------------------
  2828.   def reset_sideview
  2829.     $sv_camera.reset
  2830.     for member in $game_troop.members + $game_party.battle_members do member.sv.reset end
  2831.   end  
  2832.   #--------------------------------------------------------------------------
  2833.   # ● 释放
  2834.   #--------------------------------------------------------------------------
  2835.   def dispose
  2836.     dispose_effects(@weapons)
  2837.     dispose_effects(@pictures)
  2838.     dispose_effects(@back_pic)
  2839.     dispose_effects(@damage)
  2840.     reset_sideview
  2841.   end
  2842.   #--------------------------------------------------------------------------
  2843.   # ● 释放图像效果
  2844.   #--------------------------------------------------------------------------
  2845.   def dispose_effects(effects)
  2846.     for i in 0...effects.size
  2847.       effects[i].dispose if effects[i] != nil
  2848.       effects[i] = nil
  2849.     end
  2850.   end
  2851. end
  2852.  
  2853.  
  2854. #==============================================================================
  2855. # ■ Sprite_Battle_Back
  2856. #------------------------------------------------------------------------------
  2857. #  战斗背景用的精灵。
  2858. #==============================================================================
  2859. class Sprite_Battle_Back < Plane
  2860.   #--------------------------------------------------------------------------
  2861.   # ● 初始化物件
  2862.   #--------------------------------------------------------------------------
  2863.   def initialize(viewport = nil, index, battleback_name)
  2864.     super(viewport)
  2865.     @index = index
  2866.     if @index == 1
  2867.       data = N03::FLOOR1_DATA[battleback_name]
  2868.       data = N03::FLOOR1_DATA["全Battlebacks1"] if data == nil
  2869.     elsif @index == 2
  2870.       data = N03::FLOOR2_DATA[battleback_name]
  2871.       data = N03::FLOOR2_DATA["全Battlebacks2"] if data == nil
  2872.     end   
  2873.     data = data.dup
  2874.     @adjust_position = data[0]
  2875.     @zoom_x = data[1][0] / 100.0
  2876.     @zoom_y = data[1][1] / 100.0
  2877.     @shake_on = data[2]
  2878.     $game_switches[data[3]] = true if data[3] > 0
  2879.     $sv_camera.switches[data[3].abs] = true if data[3] < 0
  2880.     reset_scroll
  2881.     reset_back_data(battleback_name)
  2882.   end
  2883.   #--------------------------------------------------------------------------
  2884.   # ● 初始化背景滚动
  2885.   #--------------------------------------------------------------------------
  2886.   def reset_scroll
  2887.     @scroll_x = 0
  2888.     @scroll_y = 0
  2889.     @move_x = 0
  2890.     @move_y = 0
  2891.   end
  2892.   #--------------------------------------------------------------------------
  2893.   # ● 初始化背景数据
  2894.   #--------------------------------------------------------------------------
  2895.   def reset_back_data(battleback_name)
  2896.     @back_data = []
  2897.     @active_data = ["scroll",0, @move_x, @move_y, false, battleback_name,""]
  2898.     start_back_data(@active_data)
  2899.   end  
  2900.   #--------------------------------------------------------------------------
  2901.   # ● 背景图像的设置
  2902.   #--------------------------------------------------------------------------
  2903.   def set_graphics(new_bitmap)
  2904.     self.bitmap = new_bitmap
  2905.     @base_x = (self.bitmap.width * @zoom_x - Graphics.width) / 2 + @adjust_position[0]
  2906.     @base_y = (self.bitmap.height * @zoom_y - Graphics.height) / 2 + @adjust_position[1]
  2907.     # 限制坐标取得
  2908.     max_top =  0
  2909.     max_bottom = self.bitmap.height * @zoom_y - Graphics.height
  2910.     max_left = 0
  2911.     max_right = self.bitmap.width * @zoom_x - Graphics.width
  2912.     exist = true
  2913.     exist = false if self.bitmap.height == 32 && self.bitmap.width == 32
  2914.     $sv_camera.setting(@index, [max_top, max_bottom, max_left, max_right, @base_x, @base_y,exist])
  2915.   end
  2916.   #--------------------------------------------------------------------------
  2917.   # ● 更新帧数
  2918.   #--------------------------------------------------------------------------
  2919.   def update
  2920.     return if !bitmap
  2921.     update_back_data
  2922.     update_scroll unless @move_x == 0 && @move_y == 0
  2923.     update_color
  2924.     update_position
  2925.     update_back_adjust if @bt_back != nil
  2926.     create_back_adjust if @bt_back == nil && !@active_data[10] && @scroll_x == 0 && @scroll_y == 0
  2927.   end
  2928.   #--------------------------------------------------------------------------
  2929.   # ● 更新背景数据
  2930.   #--------------------------------------------------------------------------
  2931.   def update_back_data
  2932.     delete = true if @active_data[1] > 0 && !$game_switches[@active_data[1]]
  2933.     delete = true if @active_data[1] < 0 && !$sv_camera.switches[@active_data[1].abs]
  2934.     return if !delete
  2935.     for i in [email]0...@back_data.size[/email]
  2936.       @back_data[i] = nil if @back_data[i][1] > 0 && !$game_switches[@back_data[i][1]]
  2937.       @back_data[i] = nil if @back_data[i][1] < 0 && !$sv_camera.switches[@back_data[i][1].abs]
  2938.     end
  2939.     @back_data.compact!
  2940.     next_back_data
  2941.   end
  2942.   #--------------------------------------------------------------------------
  2943.   # ● 下一个背景资料设置
  2944.   #--------------------------------------------------------------------------
  2945.   def next_back_data
  2946.     @back_data.delete(@active_data[11]) if @active_data[11] != nil
  2947.     @back_data.push(@active_data[11]) if @active_data[11] != nil
  2948.     @active_data = nil
  2949.     data = @back_data.pop
  2950.     @back_data = [@active_data] if @back_data.size == 0
  2951.     start_back_data(data)
  2952.   end  
  2953.   #--------------------------------------------------------------------------
  2954.   # ● 实行背景数据
  2955.   #--------------------------------------------------------------------------
  2956.   def start_back_data(data)
  2957.     return if back_data_remain(data)
  2958.     bt_back_dispose
  2959.     pre_active_data = @active_data
  2960.     @active_data[8] = [@back_name, @move_x, @move_y, @scroll_x, @scroll_y] if @active_data != nil
  2961.     @back_data.push(@active_data)     if @active_data != nil
  2962.     @active_data = data.dup
  2963.     @active_data[5] = @back_name      if @active_data[5] == ""
  2964.     @active_data[9] = set_back_adjust if @active_data[9] == nil
  2965.     back_data_scroll_on               if @active_data[8] == nil && @active_data[9][0] == false
  2966.     set_remain_back_data              if @active_data[8] != nil
  2967.     create_back(@active_data[5])      if @active_data[9][0] == false
  2968.     create_back_adjust                if @active_data[10]
  2969.     @active_data[11] = pre_active_data if pre_active_data && @active_data[7] == false
  2970.   end  
  2971.   #--------------------------------------------------------------------------
  2972.   # ● 背景数据的保持
  2973.   #--------------------------------------------------------------------------
  2974.   def back_data_remain(data)
  2975.     remain = false
  2976.     remain = true if data[6] != "" && @active_data != nil && @active_data[9] != nil && @active_data[9][0] != false
  2977.     remain = true if @active_data != nil && @active_data[7] == false
  2978.     return remain if !remain
  2979.     @remain = true
  2980.     @back_data.push(data)
  2981.     return remain
  2982.   end  
  2983.   #--------------------------------------------------------------------------
  2984.   # ● 背景变更修正数据
  2985.   #--------------------------------------------------------------------------
  2986.   def set_back_adjust
  2987.     bt_adjust = []
  2988.     sign = -1
  2989.     if @active_data[6] == ""
  2990.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  2991.       bt_adjust = [false,false,0,0]
  2992.       return bt_adjust
  2993.     elsif @move_x != 0 or @active_data[3][0] != 0
  2994.       sign = 1 if @move_x < 0
  2995.       bt_adjust[0] = [self.bitmap.width * @zoom_x * sign, 0]
  2996.       bt_adjust[1] = [self.bitmap.width * @zoom_x * sign * 2, 0]
  2997.     elsif @move_y != 0 or @active_data[3][1] != 0
  2998.       sign = 1 if @move_y < 0
  2999.       bt_adjust[0] = [0, self.bitmap.height * @zoom_y * sign]
  3000.       bt_adjust[1] = [0, self.bitmap.height * @zoom_y * sign * 2]
  3001.     else
  3002.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  3003.       bt_adjust = [false,false,0,0]
  3004.       return bt_adjust
  3005.     end
  3006.     bt_adjust[2] = [bt_adjust[0][0], bt_adjust[0][1]]
  3007.     return bt_adjust
  3008.   end
  3009.   #--------------------------------------------------------------------------
  3010.   # ● 实行背景滚动数据
  3011.   #--------------------------------------------------------------------------
  3012.   def back_data_scroll_on
  3013.     mirror = $sv_camera.mirror
  3014.     mirror = false if !@active_data[4]
  3015.     @move_x = @active_data[3][0]
  3016.     @move_x *= -1 if mirror
  3017.     @move_y = @active_data[3][1]
  3018.   end
  3019.   #--------------------------------------------------------------------------
  3020.   # ● 实行保持背景数据
  3021.   #--------------------------------------------------------------------------
  3022.   def set_remain_back_data
  3023.     return back_data_scroll_on if @move_x != 0 or @move_y != 0
  3024.     create_back(@active_data[8][0])
  3025.     @move_x    = @active_data[8][1]
  3026.     @move_y    = @active_data[8][2]
  3027.     @scroll_x  = @active_data[8][3]
  3028.     @scroll_y  = @active_data[8][4]
  3029.   end  
  3030.   #--------------------------------------------------------------------------
  3031.   # ● 创建背景图像
  3032.   #--------------------------------------------------------------------------
  3033.   def create_back(back_name)
  3034.     return if back_name == @back_name or back_name == ""
  3035.     self.bitmap = Cache.battleback1(back_name) if @index == 1
  3036.     self.bitmap = Cache.battleback2(back_name) if @index == 2
  3037.     @back_name = back_name
  3038.   end  
  3039.   #--------------------------------------------------------------------------
  3040.   # ● 创建背景变更修正图像
  3041.   #--------------------------------------------------------------------------
  3042.   def create_back_adjust
  3043.     return if @active_data[9][0] == false
  3044.     @active_data[10] = true
  3045.     mirror = $sv_camera.mirror
  3046.     mirror = false if !@active_data[4]
  3047.     @bt_back = []
  3048.     @bt_back[0] = Sprite.new(viewport)
  3049.     @bt_back[0].bitmap = Cache.battleback1(@active_data[6]) if @index == 1
  3050.     @bt_back[0].bitmap = Cache.battleback2(@active_data[6]) if @index == 2
  3051.     @bt_back[0].mirror = mirror
  3052.     @bt_back[1] = Sprite.new(viewport)
  3053.     @bt_back[1].bitmap = Cache.battleback1(@active_data[5]) if @index == 1
  3054.     @bt_back[1].bitmap = Cache.battleback2(@active_data[5]) if @index == 2
  3055.     @bt_back[1].mirror = mirror
  3056.   end
  3057.   #--------------------------------------------------------------------------
  3058.   # ● 更新背景滚动
  3059.   #--------------------------------------------------------------------------
  3060.   def update_scroll
  3061.     @scroll_x += @move_x
  3062.     @scroll_y += @move_y
  3063.     @scroll_x = 0 if @scroll_x / 100 >= self.bitmap.width * @zoom_x or @scroll_x / 100 <= -self.bitmap.width * @zoom_x
  3064.     @scroll_y = 0 if @scroll_y / 100 >= self.bitmap.height * @zoom_y or @scroll_y / 100 <= -self.bitmap.height * @zoom_y
  3065.   end
  3066.   #--------------------------------------------------------------------------
  3067.   # ● 更新色调变更
  3068.   #--------------------------------------------------------------------------
  3069.   def update_color
  3070.     color_set if $sv_camera.color_set[@index] != nil
  3071.     return if @color_data == nil
  3072.     @color_data[4] -= 1
  3073.     if @color_data[4] == 0 && @color_data[5] != 0
  3074.       @color_data[4] = @color_data[5]
  3075.       @color_data[5] = 0
  3076.       @color_data[6] = [0,0,0,0]
  3077.     elsif @color_data[4] == 0
  3078.       @remain_color_data = @color_data
  3079.       return @color_data = nil
  3080.     end  
  3081.     for i in 0..3
  3082.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  3083.     end  
  3084.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  3085.   end
  3086.   #--------------------------------------------------------------------------
  3087.   # ● 更新坐标
  3088.   #--------------------------------------------------------------------------
  3089.   def update_position
  3090.     self.ox = $sv_camera.x + @base_x - @scroll_x / 100
  3091.     self.oy = $sv_camera.y + @base_y - @scroll_y / 100
  3092.     self.ox -= $sv_camera.sx / 100 if @shake_on
  3093.     self.oy -= $sv_camera.sy / 100 if @shake_on
  3094.     self.zoom_x = @zoom_x * $sv_camera.zoom
  3095.     self.zoom_y = @zoom_y * $sv_camera.zoom
  3096.     self.ox *= $sv_camera.zoom
  3097.     self.oy *= $sv_camera.zoom
  3098.     self.z = @index * 10
  3099.   end
  3100.   #--------------------------------------------------------------------------
  3101.   # ● 更新背景变更修正图像
  3102.   #--------------------------------------------------------------------------
  3103.   def update_back_adjust
  3104.     @active_data[9][0][0] = 0 if @scroll_x == 0
  3105.     @active_data[9][0][1] = 0 if @scroll_y == 0
  3106.     @active_data[9][1][0] -= @active_data[9][2][0] if @scroll_x == 0
  3107.     @active_data[9][1][1] -= @active_data[9][2][1] if @scroll_y == 0
  3108.     for i in [email]0...@bt_back.size[/email]
  3109.       @bt_back[i].x = -self.ox + @active_data[9][i][0] * $sv_camera.zoom
  3110.       @bt_back[i].y = -self.oy + @active_data[9][i][1] * $sv_camera.zoom
  3111.       @bt_back[i].zoom_x = self.zoom_x
  3112.       @bt_back[i].zoom_y = self.zoom_y
  3113.       @bt_back[i].z = self.z + 1
  3114.       @bt_back[i].color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  3115.     end
  3116.     back_data_scroll_on if @active_data[9][0][0] == 0 && @active_data[9][0][1] == 0
  3117.     return unless @active_data[9][1][0] == 0 && @active_data[9][1][1] == 0
  3118.     bt_back_dispose
  3119.     create_back(@active_data[5])
  3120.     @active_data[9][0] = false
  3121.     next_back_data if @remain && @back_data.size != 1
  3122.     @remain = false
  3123.   end
  3124.   #--------------------------------------------------------------------------
  3125.   # ● 色调变更
  3126.   #--------------------------------------------------------------------------
  3127.   def color_set
  3128.     set = $sv_camera.color_set[@index]
  3129.     $sv_camera.color_set[@index] = nil
  3130.     set[4] = 1 if set[4] == 0
  3131.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  3132.     @color_data = @remain_color_data
  3133.     @color_data[4] = set[4]
  3134.     @color_data[5] = set[5]
  3135.     @color_data[6] = set
  3136.   end
  3137.   #--------------------------------------------------------------------------
  3138.   # ● 背景变更修正的释放
  3139.   #--------------------------------------------------------------------------
  3140.   def bt_back_dispose
  3141.     for i in [email]0...@bt_back.size[/email] do @bt_back[i].dispose end if @bt_back != nil
  3142.     @bt_back = nil
  3143.   end  
  3144.   #--------------------------------------------------------------------------
  3145.   # ● 释放
  3146.   #--------------------------------------------------------------------------
  3147.   def dispose
  3148.     bitmap.dispose if bitmap
  3149.     bt_back_dispose
  3150.     super
  3151.   end
  3152. end  
  3153.  
  3154. #==============================================================================
  3155. # ■ Battle_Camera
  3156. #------------------------------------------------------------------------------
  3157. #  这是一个类来处理相机和战斗的计划。
  3158. #==============================================================================
  3159. class Battle_Camera
  3160.   #--------------------------------------------------------------------------
  3161.   # ● 公开实例的变量
  3162.   #--------------------------------------------------------------------------
  3163.   attr_reader   :sx                 # 摇动X坐标
  3164.   attr_reader   :sy                 # 摇动Y坐标
  3165.   attr_reader   :max_top            # 上限界坐标
  3166.   attr_reader   :max_bottom         # 下限界坐标
  3167.   attr_reader   :max_left           # 左限界坐标
  3168.   attr_reader   :max_right          # 右限界坐标
  3169.   attr_accessor :switches           # 侧视图专用开关
  3170.   attr_accessor :color_set          # 色调变更数据
  3171.   attr_accessor :wait               # 战斗场景的强制体能
  3172.   attr_accessor :win_wait           # 战斗胜利前的体能
  3173.   attr_accessor :mirror             # 画面反转标记
  3174.   attr_accessor :program_scroll     # 战斗程序 背景的自动滚动
  3175.   attr_accessor :program_picture    # 战斗程序 期间图片
  3176.   attr_accessor :event              # 公共事件呼叫
  3177.   #--------------------------------------------------------------------------
  3178.   # ● 初始化物件
  3179.   #--------------------------------------------------------------------------
  3180.   def initialize
  3181.     @switches = []
  3182.     @max_data = []
  3183.     @color_set = []
  3184.     @wait = 0
  3185.     @win_wait = false
  3186.     @mirror = false
  3187.     @event = false
  3188.     setup
  3189.   end
  3190.   #--------------------------------------------------------------------------
  3191.   # ● 相机X坐标
  3192.   #--------------------------------------------------------------------------
  3193.   def x
  3194.     return @x / 100
  3195.   end
  3196.   #--------------------------------------------------------------------------
  3197.   # ● 相机Y坐标
  3198.   #--------------------------------------------------------------------------
  3199.   def y
  3200.     return @y / 100
  3201.   end
  3202.   #--------------------------------------------------------------------------
  3203.   # ● 变焦率
  3204.   #--------------------------------------------------------------------------
  3205.   def zoom
  3206.     return @zoom * 0.001
  3207.   end
  3208.   #--------------------------------------------------------------------------
  3209.   # ● 变焦虑的坐标变换
  3210.   #--------------------------------------------------------------------------
  3211.   def convert
  3212.     return @zoom
  3213.   end
  3214.   #--------------------------------------------------------------------------
  3215.   # ● 相机设置
  3216.   #--------------------------------------------------------------------------
  3217.   def setup
  3218.     @x = 0
  3219.     @y = 0
  3220.     @sx = 0
  3221.     @sy = 0
  3222.     @zoom = 1000
  3223.     @time = 0
  3224.     @shake_time = 0
  3225.     program_setup
  3226.   end
  3227.   #--------------------------------------------------------------------------
  3228.   # ● 初始化相机
  3229.   #--------------------------------------------------------------------------
  3230.   def reset
  3231.     @switches = []
  3232.     @max_data = []
  3233.     @color_set = []
  3234.     @wait = 0
  3235.     @win_wait = false
  3236.     @mirror = false
  3237.     program_setup(false)
  3238.   end  
  3239.   #--------------------------------------------------------------------------
  3240.   # ● 战斗安装程序
  3241.   #--------------------------------------------------------------------------
  3242.   def program_setup(check = true)
  3243.     @played_program  = []
  3244.     @program_switch  = []
  3245.     @program_sound   = []
  3246.     @program_scroll  = []
  3247.     @program_se      = []
  3248.     @program_shake   = []
  3249.     @program_color   = []
  3250.     @program_picture = []
  3251.     @program_base = N03::BATTLE_PROGRAM.values.dup
  3252.     program_check if check
  3253.   end  
  3254.   #--------------------------------------------------------------------------
  3255.   # ● 战斗的检测程序
  3256.   #--------------------------------------------------------------------------
  3257.   def program_check
  3258.     for data in @program_base
  3259.       if program_start?(data) && !@played_program.include?(data)
  3260.         @played_program.push(data.dup)
  3261.         @program_scroll.push(data.dup)  if data[0] == "scroll"
  3262.         @program_picture.push(data.dup) if data[0] == "kpic"
  3263.         start_sound(data.dup)           if data[0] == "sound"
  3264.         start_program_switch(data.dup)  if data[0] == "switch"
  3265.         start_program_se(data.dup)      if data[0] == "keep_se"
  3266.         start_program_shake(data.dup)   if data[0] == "keep_sk"
  3267.         start_program_color(data.dup)   if data[0] == "keep_c"
  3268.       else
  3269.         @played_program.delete(data)  if !program_start?(data)
  3270.         @program_scroll.delete(data)  if data[0] == "scroll"
  3271.         @program_picture.delete(data) if data[0] == "kpic"
  3272.         @program_switch.delete(data)  if data[0] == "switch"
  3273.         @program_sound.delete(data)   if data[0] == "sound"
  3274.         @program_se.delete(data)      if data[0] == "keep_se"
  3275.         @program_shake.delete(data)   if data[0] == "keep_sk"
  3276.         @program_color.delete(data)   if data[0] == "keep_c"
  3277.       end
  3278.     end
  3279.   end
  3280.   #--------------------------------------------------------------------------
  3281.   # ● 战斗程序开始
  3282.   #--------------------------------------------------------------------------
  3283.   def program_start?(data)
  3284.     start = false
  3285.     start = true if $game_switches[data[1].abs] && data[1] > 0
  3286.     start = true if @switches[data[1].abs] && data[1] < 0
  3287.     return start
  3288.   end  
  3289.   #--------------------------------------------------------------------------
  3290.   # ● 战斗程序 开关操作开始
  3291.   #--------------------------------------------------------------------------
  3292.   def start_program_switch(data)
  3293.     data[4] = data[4] + rand(data[5] + 1)
  3294.     data[4] = 1 if data[4] <= 0
  3295.     @program_switch.push(data)
  3296.   end
  3297.   #--------------------------------------------------------------------------
  3298.   # ● 更新开关操作
  3299.   #--------------------------------------------------------------------------
  3300.   def update_program_switch
  3301.     for data in @program_switch
  3302.       data[4] -= 1
  3303.       next @program_switch.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3304.       next @program_switch.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3305.       next if data[4] != 0
  3306.       for id in data[2]
  3307.         $game_switches[id] = true if id > 0
  3308.         @switches[id.abs] = true  if id < 0
  3309.       end
  3310.       for id in data[3]
  3311.         $game_switches[id] = false if id > 0
  3312.         @switches[id.abs] = false  if id < 0
  3313.       end
  3314.       @program_switch.delete(data)
  3315.       program_check
  3316.     end  
  3317.   end
  3318.   #--------------------------------------------------------------------------
  3319.   # ● 战斗程序 BGM/BGS的开始
  3320.   #--------------------------------------------------------------------------
  3321.   def start_sound(data)
  3322.     @program_sound.push(data)
  3323.     name = data[5]
  3324.     case data[2]
  3325.     when "se"
  3326.       Audio.se_play("Audio/SE/" + name, data[4], data[3])
  3327.     when "bgm"
  3328.       name = RPG::BGM.last.name if data[5] == ""
  3329.       Audio.bgm_play("Audio/BGM/" + name, data[4], data[3])
  3330.     when "bgs"
  3331.       name = RPG::BGS.last.name if data[5] == ""
  3332.       Audio.bgs_play("Audio/BGS/" + name, data[4], data[3])
  3333.     end
  3334.   end
  3335.   #--------------------------------------------------------------------------
  3336.   # ● 战斗程序 期间SE的开始
  3337.   #--------------------------------------------------------------------------
  3338.   def start_program_se(data)
  3339.     data[3] = [data[2], data[3]]
  3340.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3341.     @program_se.push(data)
  3342.     Audio.se_play("Audio/SE/" + data[7], data[5], data[4]) if data[6]
  3343.   end
  3344.   #--------------------------------------------------------------------------
  3345.   # ● 更新期间SE
  3346.   #--------------------------------------------------------------------------
  3347.   def update_program_se
  3348.     for data in @program_se
  3349.       data[2] -= 1
  3350.       next @program_se.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3351.       next @program_se.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3352.       next if data[2] != 0
  3353.       Audio.se_play("Audio/SE/" + data[7], data[5], data[4])
  3354.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3355.     end  
  3356.   end
  3357.   #--------------------------------------------------------------------------
  3358.   # ● 战斗程序 开始期间摇动
  3359.   #--------------------------------------------------------------------------
  3360.   def start_program_shake(data)
  3361.     data[3] = [data[2], data[3]]
  3362.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3363.     @program_shake.push(data)
  3364.     shake(data[4], data[5], data[6]) if data[7]
  3365.   end
  3366.   #--------------------------------------------------------------------------
  3367.   # ● 更新期间摇动
  3368.   #--------------------------------------------------------------------------
  3369.   def update_program_shake
  3370.     for data in @program_shake
  3371.       data[2] -= 1
  3372.       next @program_shake.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3373.       next @program_shake.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3374.       next if data[2] != 0
  3375.       shake(data[4], data[5], data[6])
  3376.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3377.     end  
  3378.   end
  3379.   #--------------------------------------------------------------------------
  3380.   # ● 战斗程序 开始期间色调变更
  3381.   #--------------------------------------------------------------------------
  3382.   def start_program_color(data)
  3383.     data[3] = [data[2], data[3]]
  3384.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3385.     data[7] = true if data[4] == 0 or data[4] == 4
  3386.     case data[4]
  3387.     when 1   ;data[4] = $game_troop.members
  3388.     when 2   ;data[4] = $game_party.battle_members
  3389.     when 3,4 ;data[4] = $game_troop.members + $game_party.battle_members
  3390.     else ;data[4] = []
  3391.     end
  3392.     @program_color.push(data)
  3393.     return if !data[6]
  3394.     for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3395.     @color_set[1] = data[5] if data[7]
  3396.     @color_set[2] = data[5] if data[7]
  3397.   end
  3398.   #--------------------------------------------------------------------------
  3399.   # ● 更新期间色调变更
  3400.   #--------------------------------------------------------------------------
  3401.   def update_program_color
  3402.     for data in @program_color
  3403.       data[2] -= 1
  3404.       next @program_color.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3405.       next @program_color.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3406.       next if data[2] != 0
  3407.       for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3408.       @color_set[1] = data[5] if data[7]
  3409.       @color_set[2] = data[5] if data[7]
  3410.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3411.     end
  3412.   end
  3413.   #--------------------------------------------------------------------------
  3414.   # ● 实行过渡
  3415.   #--------------------------------------------------------------------------
  3416.   def perform_transition(data)
  3417.     Graphics.transition(data[2], "Graphics/Pictures/" + data[3], data[1])
  3418.   end  
  3419.   #--------------------------------------------------------------------------
  3420.   # ● 取得背景相机的限制值  data=[max_top, max_bottom, max_left, max_right]
  3421.   #--------------------------------------------------------------------------
  3422.   def setting(index, data)
  3423.     @max_data[index - 1] = data
  3424.     return if index != 2
  3425.     setup
  3426.     # 相机的中心坐标
  3427.     @center_x     = (Graphics.width / 2 + N03::CAMERA_POSITION[0]) * 100
  3428.     @center_y     = (Graphics.height / 2 + N03::CAMERA_POSITION[1]) * 100
  3429.     # 上下左右的移动限制距离
  3430.     @max_top    = [@max_data[0][5], @max_data[1][5]].min * -1
  3431.     @max_bottom = [@max_data[0][1], @max_data[1][1]].min + @max_top
  3432.     @max_left   = [@max_data[0][4], @max_data[1][4]].min  * -1
  3433.     @max_right  = [@max_data[0][3], @max_data[1][3]].min + @max_left
  3434.     exist_data = @max_data[0] if !@max_data[1][6]
  3435.     exist_data = @max_data[1] if !@max_data[0][6]
  3436.     @max_top    = exist_data[5] * -1        if exist_data != nil
  3437.     @max_bottom = exist_data[1] + @max_top  if exist_data != nil
  3438.     @max_left   = exist_data[4] * -1        if exist_data != nil
  3439.     @max_right  = exist_data[3] + @max_left if exist_data != nil
  3440.     @max_top = @max_bottom = @max_left = @max_right = 0 if !@max_data[1][6] && !@max_data[0][6]
  3441.     @max_width    = @max_right - @max_left + Graphics.width
  3442.     @max_height   = @max_bottom - @max_top + Graphics.height
  3443.     # 扩大缩小限制值
  3444.     max_zoom_x    = 100 * Graphics.width / @max_width
  3445.     max_zoom_y    = 100 * Graphics.height / @max_height
  3446.     @max_zoom_out = [max_zoom_x, max_zoom_y].max
  3447.   end
  3448.   #--------------------------------------------------------------------------
  3449.   # ● 相机移动
  3450.   #--------------------------------------------------------------------------
  3451.   def move(target_x, target_y, zoom, time, screen = true)
  3452.     # 调整战斗背景以上尺寸的变焦来减少
  3453.     @target_zoom = [zoom * 0.01, @max_zoom_out * 0.01].max
  3454.     target_x *= -1 if screen && @mirror
  3455.     # 变焦分钟的中心坐标修正
  3456.     if screen && @target_zoom != 1
  3457.       target_x = target_x + @center_x
  3458.       target_y = target_y + @center_y
  3459.     end
  3460.     adjust_x = @center_x * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3461.     adjust_y = @center_y * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3462.     adjust_x = 0 if adjust_x.nan?
  3463.     adjust_y = 0 if adjust_y.nan?
  3464.     adjust_x = @center_x if !screen && adjust_x == 0
  3465.     adjust_y = @center_y if !screen && adjust_y == 0
  3466.     @target_x = target_x - adjust_x.to_i
  3467.     @target_y = target_y - adjust_y.to_i
  3468.     @target_zoom = (@target_zoom * 1000).to_i
  3469.     @zoom = @zoom.to_i
  3470.     limit_test
  3471.     # 马上实行当时间是0的场合
  3472.     return @time = time.abs if time != 0
  3473.     @time = 1
  3474.     update
  3475.   end
  3476.   #--------------------------------------------------------------------------
  3477.   # ● 计算限制的坐标
  3478.   #--------------------------------------------------------------------------
  3479.   def limit_test
  3480.     new_width = @max_width * @target_zoom / 1000
  3481.     new_height = @max_height * @target_zoom / 1000
  3482.     new_max_right = @max_right - (@max_width - new_width)
  3483.     new_max_bottom = @max_bottom - (@max_height - new_height)
  3484.     # 画面移动目标限制的场合、限制坐标设置
  3485.     if @target_x < @max_left * 100
  3486.       @target_x = @max_left * 100
  3487.     end
  3488.     if @target_x > new_max_right * 100
  3489.       @target_x = new_max_right * 100
  3490.     end
  3491.     if @target_y < @max_top * 100
  3492.       @target_y = @max_top * 100
  3493.     end
  3494.     if @target_y > new_max_bottom * 100
  3495.       @target_y = new_max_bottom * 100
  3496.     end
  3497.   end
  3498.   #--------------------------------------------------------------------------
  3499.   # ● 画面的摇动
  3500.   #--------------------------------------------------------------------------
  3501.   def shake(power, speed, time)
  3502.     @shake_x = power[0] * 100
  3503.     @shake_y = power[1] * 100
  3504.     @power_time_base = @power_time = speed
  3505.     @shake_time = time
  3506.     update_shake
  3507.   end
  3508.   #--------------------------------------------------------------------------
  3509.   # ● 更新摇动
  3510.   #--------------------------------------------------------------------------
  3511.   def update_shake
  3512.     @sx = (@sx * (@power_time - 1) + @shake_x) / @power_time
  3513.     @sy = (@sy * (@power_time - 1) + @shake_y) / @power_time
  3514.     @power_time -= 1
  3515.     @shake_time -= 1
  3516.     return @sx = @sy = 0 if @shake_time == 0
  3517.     return if @power_time != 0
  3518.     @power_time = @power_time_base
  3519.     @shake_x = @shake_x * -4 / 5
  3520.     @shake_y = @shake_y * -4 / 5
  3521.   end
  3522.   #--------------------------------------------------------------------------
  3523.   # ● 更新帧数
  3524.   #--------------------------------------------------------------------------
  3525.   def update
  3526.     update_shake if @shake_time != 0
  3527.     update_program
  3528.     return if @time == 0
  3529.     @x = (@x * (@time - 1) + @target_x) / @time
  3530.     @y = (@y * (@time - 1) + @target_y) / @time
  3531.     @zoom = (@zoom * (@time - 1) + @target_zoom) / @time
  3532.     @time -= 1
  3533.   end
  3534.   #--------------------------------------------------------------------------
  3535.   # ● 更新程序
  3536.   #--------------------------------------------------------------------------
  3537.   def update_program
  3538.     update_program_switch if @program_switch != []
  3539.     update_program_se     if @program_se != []
  3540.     update_program_shake  if @program_shake != []
  3541.     update_program_color  if @program_color != []
  3542.   end
  3543. end
  3544.  
  3545. #==============================================================================
  3546. # ■ Scene_Battle
  3547. #------------------------------------------------------------------------------
  3548. #  它是一类用于执行该过程的战斗画面。
  3549. #==============================================================================
  3550. class Scene_Battle < Scene_Base
  3551.   #--------------------------------------------------------------------------
  3552.   # ● 更新帧数(基本)
  3553.   #--------------------------------------------------------------------------
  3554.   alias update_basic_scene_battle_n03 update_basic
  3555.   def update_basic
  3556.     update_basic_scene_battle_n03
  3557.     $sv_camera.update
  3558.     $sv_camera.wait = N03::TURN_END_WAIT + 1 if $sv_camera.win_wait
  3559.     camera_wait
  3560.   end
  3561.   #--------------------------------------------------------------------------
  3562.   # ● 相机体能
  3563.   #--------------------------------------------------------------------------
  3564.   def camera_wait
  3565.     process_event if $sv_camera.event
  3566.     $sv_camera.event = false if $sv_camera.event
  3567.     while $sv_camera.wait != 0
  3568.       Graphics.update
  3569.       Input.update
  3570.       update_all_windows
  3571.       $game_timer.update
  3572.       $game_troop.update
  3573.       $sv_camera.update
  3574.       @spriteset.update
  3575.       update_info_viewport
  3576.       update_message_open
  3577.       $sv_camera.wait -= 1 if $sv_camera.wait > 0
  3578.       $sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
  3579.       BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
  3580.     end
  3581.   end
  3582.   #--------------------------------------------------------------------------
  3583.   # ● 相机体能集
  3584.   #--------------------------------------------------------------------------
  3585.   def set_camera_wait(time)
  3586.     $sv_camera.wait = time
  3587.     camera_wait
  3588.   end  
  3589.   #--------------------------------------------------------------------------
  3590.   # ● 实行等待直到效果结束 ★再定义
  3591.   #--------------------------------------------------------------------------
  3592.   def wait_for_effect
  3593.   end
  3594.   #--------------------------------------------------------------------------
  3595.   # ● 开始回合
  3596.   #--------------------------------------------------------------------------
  3597.   alias turn_start_scene_battle_n03 turn_start
  3598.   def turn_start
  3599.     turn_start_scene_battle_n03
  3600.     N03.camera(nil, N03::BATTLE_CAMERA["顺序开始后"].dup)
  3601.   end
  3602.   #--------------------------------------------------------------------------
  3603.   # ● 回合结束
  3604.   #--------------------------------------------------------------------------
  3605.   alias turn_end_scene_battle_n03 turn_end
  3606.   def turn_end
  3607.     turn_end_scene_battle_n03
  3608.     for member in $game_troop.members + $game_party.members
  3609.       N03.set_damage(member, member.sv.result_damage[0],member.sv.result_damage[1])
  3610.       member.sv.result_damage = [0,0]
  3611.       @spriteset.set_damage_pop(member) if member.result.hp_damage != 0 or member.result.mp_damage != 0
  3612.     end
  3613.     set_camera_wait(N03::TURN_END_WAIT)
  3614.     N03.camera(nil, N03::BATTLE_CAMERA["顺序开始前"].dup) if $game_party.inputable?
  3615.     @log_window.clear
  3616.   end
  3617.   #--------------------------------------------------------------------------
  3618.   # ● 技能/使用物品 ★再定义
  3619.   #--------------------------------------------------------------------------
  3620.   def use_item
  3621.     item = @subject.current_action.item
  3622.     display_item(item)
  3623.     @subject.use_item(item)
  3624.     refresh_status
  3625.     @targets = @subject.current_action.make_targets.compact
  3626.     @targets = [@subject] if @targets.size == 0
  3627.     set_substitute(item)
  3628.     for time in item.repeats.times do play_sideview(@targets, item) end
  3629.     end_reaction(item)
  3630.     display_end_item
  3631.   end
  3632.   #--------------------------------------------------------------------------
  3633.   # ● 技能/显示物品名
  3634.   #--------------------------------------------------------------------------
  3635.   def display_item(item)
  3636.     return @log_window.display_use_item(@subject, item) if N03::BATTLE_LOG
  3637.     @log_window.off
  3638.     @skill_name_window = Window_Skill_name.new(item.name) unless N03::NO_DISPLAY_SKILL_ID.include?(item.id) && item.is_a?(RPG::Skill)
  3639.   end  
  3640.   #--------------------------------------------------------------------------
  3641.   # ● 技能/显示物品名结束
  3642.   #--------------------------------------------------------------------------
  3643.   def display_end_item
  3644.     @skill_name_window.dispose if @skill_name_window != nil
  3645.     @skill_name_window = nil
  3646.     set_camera_wait(N03::ACTION_END_WAIT) if @subject.sv.derivation_skill_id == 0
  3647.     @log_window.clear if N03::BATTLE_LOG
  3648.   end  
  3649.   #--------------------------------------------------------------------------
  3650.   # ● 反击/魔法反射/代替处理
  3651.   #--------------------------------------------------------------------------
  3652.   def end_reaction(item)
  3653.     end_substitute if @substitute != nil
  3654.     set_reflection(item) if @reflection_data != nil
  3655.     set_counter_attack if @counter_attacker != nil
  3656.   end  
  3657.   #--------------------------------------------------------------------------
  3658.   # ● 发动反击 ★再定义
  3659.   #--------------------------------------------------------------------------
  3660.   def invoke_counter_attack(target, item)
  3661.     return if @subject.sv.counter_id != 0
  3662.     @counter_attacker = [] if @counter_attacker == nil
  3663.     return apply_item_effects(apply_substitute(target, item), item) if !target.movable?
  3664.     @log_window.add_text(sprintf(Vocab::CounterAttack, target.name)) if N03::BATTLE_LOG
  3665.     target.sv.counter_id = target.sv.counter_skill_id
  3666.     @counter_attacker.push(target)
  3667.   end
  3668.   #--------------------------------------------------------------------------
  3669.   # ● 发动魔法反射 ★再定义
  3670.   #--------------------------------------------------------------------------
  3671.   def invoke_magic_reflection(target, item)
  3672.     return if @subject.sv.reflection_id != 0
  3673.     @log_window.add_text(sprintf(Vocab::MagicReflection, target.name)) if N03::BATTLE_LOG
  3674.     target.sv.reflection_id = target.sv.reflection_anime_id
  3675.   end
  3676.   #--------------------------------------------------------------------------
  3677.   # ● 代替应用 ★再定义
  3678.   #--------------------------------------------------------------------------
  3679.   def apply_substitute(target, item)
  3680.     return target if @substitute == nil
  3681.     return target if !check_substitute(target, item)
  3682.     return @substitute
  3683.   end
  3684.   #--------------------------------------------------------------------------
  3685.   # ● 代替设置
  3686.   #--------------------------------------------------------------------------
  3687.   def set_substitute(item)
  3688.     @substitute = N03.get_enemy_unit(@subject).substitute_battler
  3689.     return if @substitute == nil
  3690.     s_targets = []
  3691.     for i in [email]0...@targets.size[/email]
  3692.       next if @targets[i] == @substitute
  3693.       next if !check_substitute(@targets[i], item)
  3694.       @log_window.add_text(sprintf(Vocab::Substitute, @substitute.name, @targets[i].name))
  3695.       @targets[i].sv.start_action(@targets[i].sv.substitute_receiver_start_action)
  3696.       s_targets.push(@targets[i])
  3697.       @targets[i] = @substitute
  3698.     end
  3699.     return @substitute = nil if s_targets == []
  3700.     @substitute.sv.set_target(s_targets)
  3701.     @substitute.sv.start_action(@substitute.sv.substitute_start_action)
  3702.   end  
  3703.   #--------------------------------------------------------------------------
  3704.   # ● 结束代替
  3705.   #--------------------------------------------------------------------------
  3706.   def end_substitute
  3707.     for member in @substitute.sv.target_battler
  3708.       member.sv.start_action(member.sv.substitute_receiver_end_action)
  3709.     end  
  3710.     @substitute.sv.start_action(@substitute.sv.substitute_end_action)
  3711.     @substitute = nil
  3712.   end
  3713.   #--------------------------------------------------------------------------
  3714.   # ● 反击
  3715.   #--------------------------------------------------------------------------
  3716.   def set_counter_attack
  3717.     pre_subject = @subject
  3718.     for attacker in @counter_attacker
  3719.       @subject = attacker
  3720.       item = $data_skills[attacker.sv.counter_skill_id]
  3721.       play_sideview([pre_subject], item)
  3722.     end
  3723.     # 实行同一个计数器者を考虑到计数器ID的初始化动作后
  3724.     for attacker in @counter_attacker do attacker.sv.counter_id = 0 end
  3725.     @subject = pre_subject
  3726.     @counter_attacker = nil
  3727.   end
  3728.   #--------------------------------------------------------------------------
  3729.   # ● 魔法反射
  3730.   #--------------------------------------------------------------------------
  3731.   def set_reflection(item)
  3732.     @log_window.back_to(1)
  3733.     for data in @reflection_data
  3734.       @subject.sv.damage_action(@subject, item)
  3735.       N03.set_damage_anime_data([@subject], @subject, data)
  3736.       apply_item_effects(@subject, item)
  3737.       @spriteset.set_damage_pop(@subject)
  3738.     end
  3739.     set_camera_wait(N03.get_anime_time(@reflection_data[0][0]))
  3740.     @reflection_data = nil
  3741.   end
  3742.   #--------------------------------------------------------------------------
  3743.   # ● 实行侧视图动作
  3744.   #--------------------------------------------------------------------------
  3745.   def play_sideview(targets, item)
  3746.     @subject.sv.set_target(targets)
  3747.     return if @subject.sv.attack_action(item) == nil
  3748.     return if !@subject.movable?
  3749.     return if item.scope != 9 && item.scope != 10 && !N03.targets_alive?(targets)
  3750.     @subject.sv.start_action(@subject.sv.attack_action(item))
  3751.     @subject.sv.unshift_action(@subject.sv.flash_action) if @subject.flash_flg
  3752.     @subject.sv.active = true
  3753.     @subject.sv.command_action = false
  3754.     loop do
  3755.       update_basic
  3756.       data = @subject.sv.play_data
  3757.       @targets = N03.s_targets(@subject) if data[0] == "second_targets_set"
  3758.       N03.targets_set(@subject)          if data[0] == "targets_set"
  3759.       @immortal = N03.immortaling        if data[0] == "no_collapse" && !N03.dead_attack?(@subject, item)
  3760.       @immortal = N03.unimmortaling      if data[0] == "collapse"
  3761.       next set_move_anime(item)          if @subject.sv.m_a_data != []
  3762.       set_damage(item)                   if @subject.sv.set_damage
  3763.       break N03.derived_skill(@subject)  if @subject.sv.derivation_skill_id != 0
  3764.       break                              if @subject.sv.action_end or @subject.hidden?
  3765.     end
  3766.     @immortal = N03.unimmortaling        if @immortal
  3767.   end
  3768.   #--------------------------------------------------------------------------
  3769.   # ● 实行伤害
  3770.   #--------------------------------------------------------------------------
  3771.   def set_damage(item)
  3772.     targets = @targets
  3773.     targets = [@subject.sv.individual_targets[0]] if @subject.sv.individual_targets.size != 0
  3774.     for target in targets do damage_anime(targets.dup, target, item) end
  3775.     @subject.sv.set_damage = false
  3776.     @subject.sv.damage_anime_data = []
  3777.   end
  3778.   #--------------------------------------------------------------------------
  3779.   # ● 战斗动画伤害处理
  3780.   #--------------------------------------------------------------------------
  3781.   def damage_anime(targets, target, item)
  3782.     @log_window.back_to(1) if @log_window.line_number == 5
  3783.     return if item.scope != 9 && item.scope != 10 && target.dead?
  3784.     @miss = false
  3785.     invoke_item(target,item)
  3786.     if target.result.missed
  3787.       target.sv.miss_action(@subject, item)
  3788.       return @miss = true
  3789.     elsif target.result.evaded or target.sv.counter_id != 0
  3790.       target.sv.evasion_action(@subject, item)
  3791.       return @miss = true
  3792.     elsif target.sv.reflection_id != 0
  3793.       N03.set_damage_anime_data(targets, target, [target.sv.reflection_id, false, false, true])
  3794.       target.sv.reflection_id = 0
  3795.       @reflection_data = [] if @reflection_data == nil
  3796.       return @reflection_data.push([N03.get_attack_anime_id(-3, @subject), false, false, true])
  3797.     end
  3798.     target.sv.damage_action(@subject, item)
  3799.     N03.set_damage(@subject, -target.result.hp_drain, -target.result.mp_drain) if target != @subject
  3800.     @spriteset.set_damage_pop(target)
  3801.     @spriteset.set_damage_pop(@subject) if target != @subject && @subject.result.hp_damage != 0 or @subject.result.mp_damage != 0
  3802.     N03.set_damage_anime_data(targets, target, @subject.sv.damage_anime_data) if @subject.sv.damage_anime_data != []
  3803.   end
  3804.   #--------------------------------------------------------------------------
  3805.   # ● 飞行动画处理
  3806.   #--------------------------------------------------------------------------
  3807.   def set_move_anime(item)
  3808.     for data in @subject.sv.m_a_data
  3809.       @subject.sv.damage_anime_data = data[4]
  3810.       hit_targets = []
  3811.       for target in data[1]
  3812.         damage_anime(data[1], target, item) if data[0]
  3813.         hit_targets.push(target) if !@miss
  3814.       end
  3815.       @miss = false if !data[3]
  3816.       @spriteset.set_hit_animation(@subject, data[2], hit_targets, @miss)
  3817.     end
  3818.     @subject.sv.set_damage = false
  3819.     @subject.sv.m_a_data = []
  3820.   end
  3821. end
  3822.  
  3823. #==============================================================================
  3824. # ■ DataManager
  3825. #------------------------------------------------------------------------------
  3826. #  这是一个模块管理游戏和数据库对象。
  3827. #==============================================================================
  3828. module DataManager
  3829.   #--------------------------------------------------------------------------
  3830.   # ● 创建各种游戏物件 ★再定义
  3831.   #--------------------------------------------------------------------------
  3832.   def self.create_game_objects
  3833.     $game_temp          = Game_Temp.new
  3834.     $game_system        = Game_System.new
  3835.     $game_timer         = Game_Timer.new
  3836.     $game_message       = Game_Message.new
  3837.     $game_switches      = Game_Switches.new
  3838.     $game_variables     = Game_Variables.new
  3839.     $game_self_switches = Game_SelfSwitches.new
  3840.     $game_actors        = Game_Actors.new
  3841.     $game_party         = Game_Party.new
  3842.     $game_troop         = Game_Troop.new
  3843.     $game_map           = Game_Map.new
  3844.     $game_player        = Game_Player.new
  3845.     $sv_camera          = Battle_Camera.new
  3846.   end
  3847. end
  3848.  
  3849. #==============================================================================
  3850. # ■ BattleManager
  3851. #------------------------------------------------------------------------------
  3852. #  这是一个模块管理战斗进行。
  3853. #==============================================================================
  3854. module BattleManager
  3855.   #--------------------------------------------------------------------------
  3856.   # ● 遇敌时时处理 ★再定义
  3857.   #--------------------------------------------------------------------------
  3858.   def self.on_encounter
  3859.     #save_bgm_and_bgs
  3860.     @preemptive = (rand < rate_preemptive)
  3861.     @surprise = (rand < rate_surprise && !@preemptive)
  3862.     $sv_camera.mirror = @surprise if N03::BACK_ATTACK
  3863.   end
  3864.   #--------------------------------------------------------------------------
  3865.   # ● 胜利的处理 ★再定义
  3866.   #--------------------------------------------------------------------------
  3867.   def self.process_victory
  3868.     $sv_camera.win_wait = true
  3869.   end  
  3870.   #--------------------------------------------------------------------------
  3871.   # ● 胜利
  3872.   #--------------------------------------------------------------------------
  3873.   def self.victory
  3874.     $sv_camera.win_wait = false
  3875.     N03.camera(nil, N03::BATTLE_CAMERA["战斗结束时"].dup)
  3876.     for member in $game_party.members do member.sv.start_action(member.sv.win) if member.movable? end
  3877.     @process_message = Sprite.new
  3878.     @process_message.bitmap = Bitmap.new("Graphics/System/battle_message.png")
  3879.     play_battle_end_me
  3880.     replay_bgm_and_bgs
  3881.     $game_message.add(sprintf(Vocab::Victory, $game_party.name))
  3882.     display_exp
  3883.     gain_gold
  3884.     gain_drop_items
  3885.     gain_exp
  3886.     SceneManager.return
  3887.     battle_end(0)
  3888.     @process_message.dispose
  3889.     return true
  3890.   end
  3891.   #--------------------------------------------------------------------------
  3892.   # ● 逃走的处理 ★再定义
  3893.   #--------------------------------------------------------------------------
  3894.   def self.process_escape
  3895.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  3896.     success = @preemptive ? true : (rand < @escape_ratio)
  3897.     Sound.play_escape
  3898.     if success
  3899.       process_abort
  3900.       for member in $game_party.members do member.sv.start_action(member.sv.escape) if member.movable? end
  3901.     else
  3902.       @escape_ratio += 0.1
  3903.       $game_message.add('\.' + Vocab::EscapeFailure)
  3904.       $game_party.clear_actions
  3905.       for member in $game_party.members do member.sv.start_action(member.sv.escape_ng) if member.movable? end
  3906.     end
  3907.     wait_for_message
  3908.     return success
  3909.   end
  3910.   #--------------------------------------------------------------------------
  3911.   # ● 输入下个命令 ★再定义
  3912.   #--------------------------------------------------------------------------
  3913.   def self.next_command
  3914.     begin
  3915.       if !actor || !actor.next_command
  3916.         $game_party.battle_members[@actor_index].sv.command_action = true
  3917.         @actor_index += 1
  3918.         if @actor_index >= $game_party.members.size
  3919.           for member in $game_party.battle_members.reverse
  3920.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3921.           end
  3922.           return false
  3923.         end
  3924.       end
  3925.     end until actor.inputable?
  3926.     actor.sv.start_action(actor.sv.command_b) if actor != nil && actor.inputable?
  3927.     if pre_actor
  3928.       pre_actor.sv.start_action(pre_actor.sv.command_a) if pre_actor != nil && pre_actor.inputable?
  3929.     end
  3930.     return true
  3931.   end
  3932.   #--------------------------------------------------------------------------
  3933.   # ● 输入上个命令 ★再定义
  3934.   #--------------------------------------------------------------------------
  3935.   def self.prior_command
  3936.     begin
  3937.       if !actor || !actor.prior_command
  3938.         $game_party.battle_members[@actor_index].sv.command_action = false
  3939.         @actor_index -= 1
  3940.         if @actor_index < 0
  3941.           for member in $game_party.battle_members
  3942.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3943.           end
  3944.           return false
  3945.         end
  3946.       end
  3947.     end until actor.inputable?
  3948.     actor.make_actions if actor.inputable?
  3949.     actor.sv.start_action(actor.sv.command_b) if actor.inputable?
  3950.     after_actor.sv.start_action(after_actor.sv.command_a) if after_actor != nil && after_actor.inputable?
  3951.     return true
  3952.   end
  3953.   #--------------------------------------------------------------------------
  3954.   # ● 取得上个角色输入的命令
  3955.   #--------------------------------------------------------------------------
  3956.   def self.pre_actor
  3957.     return if @actor_index == 0
  3958.     $game_party.members[@actor_index - 1]
  3959.   end
  3960.   #--------------------------------------------------------------------------
  3961.   # ● 取得输入命令后的角色
  3962.   #--------------------------------------------------------------------------
  3963.   def self.after_actor
  3964.     $game_party.members[@actor_index + 1]
  3965.   end
  3966.   #--------------------------------------------------------------------------
  3967.   # ● 战斗行动作角色前追加
  3968.   #--------------------------------------------------------------------------
  3969.   def self.unshift_action_battlers(battler)
  3970.     @action_battlers.unshift(battler)
  3971.   end
  3972. end  
  3973.  
  3974. #==============================================================================
  3975. # ■ Game_Battler
  3976. #------------------------------------------------------------------------------
  3977. #  处理战斗者的类、它是一个类追加角色的方法。
  3978. #==============================================================================
  3979. class Game_Battler < Game_BattlerBase
  3980.   #--------------------------------------------------------------------------
  3981.   # ● 公开实例变量
  3982.   #--------------------------------------------------------------------------
  3983.   attr_reader   :sv                     # 侧视图数据
  3984.   attr_accessor :flash_flg              # 闪光标志
  3985.   #--------------------------------------------------------------------------
  3986.   # ● 初始化物件
  3987.   #--------------------------------------------------------------------------
  3988.   alias initialize_game_battler_n03 initialize
  3989.   def initialize
  3990.     initialize_game_battler_n03
  3991.     @sv = SideView.new(self)
  3992.   end
  3993.   #--------------------------------------------------------------------------
  3994.   # ● 删除当前的战斗动作
  3995.   #--------------------------------------------------------------------------
  3996.   alias remove_current_action_game_battler_n03 remove_current_action
  3997.   def remove_current_action
  3998.     return @sv.derivation_skill_id = 0 if @sv.derivation_skill_id != 0
  3999.     remove_current_action_game_battler_n03
  4000.   end
  4001.   #--------------------------------------------------------------------------
  4002.   # ● 回合结束处理
  4003.   #--------------------------------------------------------------------------
  4004.   alias on_turn_end_game_battler_n03 on_turn_end
  4005.   def on_turn_end
  4006.     on_turn_end_game_battler_n03
  4007.     @sv.add_state = []
  4008.     @sv.result_damage = [@result.hp_damage, @result.mp_damage]
  4009.   end
  4010.   #--------------------------------------------------------------------------
  4011.   # ● 比较参数条件 data=[种别, 数值, 判别]
  4012.   #--------------------------------------------------------------------------
  4013.   def comparison_parameter(data)
  4014.     return true if data[0][0] == 0
  4015.     kind = data[0]
  4016.     num = data[1]
  4017.     select = data[2]
  4018.     case kind
  4019.     when  1 ; par = level
  4020.     when  2 ; par = mhp
  4021.     when  3 ; par = mmp
  4022.     when  4 ; par = hp
  4023.     when  5 ; par = mp
  4024.     when  6 ; par = tp
  4025.     when  7 ; par = atk
  4026.     when  8 ; par = self.def
  4027.     when  9 ; par = mat
  4028.     when 10 ; par = mdf
  4029.     when 11 ; par = agi
  4030.     when 12 ; par = luk
  4031.     end
  4032.     if num < 0
  4033.       case kind
  4034.       when  4 ; num = mhp * num / 100
  4035.       when  5 ; num = mmp * num / 100
  4036.       when  6 ; num = max_tp * num / 100
  4037.       end
  4038.       num = num.abs
  4039.     end  
  4040.     case select
  4041.     when  0 ; return par == num
  4042.     when  1 ; return par < num
  4043.     when  2 ; return par > num
  4044.     end
  4045.   end
  4046.   #--------------------------------------------------------------------------
  4047.   # ● 比较装备条件 data=[装备种别, 类型ID]
  4048.   #--------------------------------------------------------------------------
  4049.   def comparison_equip(data)
  4050.     kind = data[0]
  4051.     items = weapons if kind == 0
  4052.     items = armors  if kind == 1
  4053.     for item in items
  4054.       for id in data[1]
  4055.         return true if id > 0 && item.is_a?(RPG::Weapon) && item == $data_weapons[id.abs]
  4056.         return true if id > 0 && item.is_a?(RPG::Armor) && item == $data_armors[id.abs]
  4057.         return true if id < 0 && item.is_a?(RPG::Weapon) && item.wtype_id == id.abs
  4058.         return true if id < 0 && item.is_a?(RPG::Armor) && item.stype_id == id.abs
  4059.       end
  4060.     end
  4061.     return false
  4062.   end
  4063.  
  4064. end  
  4065. #==============================================================================
  4066. # ■ Game_Actor
  4067. #------------------------------------------------------------------------------
  4068. #  这是一个类来处理与主角。
  4069. #==============================================================================
  4070. class Game_Actor < Game_Battler
  4071.   #--------------------------------------------------------------------------
  4072.   # ● 公开实例变量
  4073.   #--------------------------------------------------------------------------
  4074.   attr_reader :actor_id                    # 主角ID
  4075.   #--------------------------------------------------------------------------
  4076.   # ● ID
  4077.   #--------------------------------------------------------------------------
  4078.   def id
  4079.     return @actor_id
  4080.   end
  4081.   #--------------------------------------------------------------------------
  4082.   # ● 是否使用精灵 ★再定义
  4083.   #--------------------------------------------------------------------------
  4084.   def use_sprite?
  4085.     return true
  4086.   end
  4087.   #--------------------------------------------------------------------------
  4088.   # ● 实行伤害效果 ★再定义
  4089.   #--------------------------------------------------------------------------
  4090.   def perform_damage_effect
  4091.     return if !N03::ACTOR_DAMAGE
  4092.     $game_troop.screen.start_shake(5, 5, 10)
  4093.     @sprite_effect_type = :blink
  4094.     Sound.play_actor_damage
  4095.   end
  4096.  
  4097. end
  4098.  
  4099. #==============================================================================
  4100. # ■ Game_Enemy
  4101. #------------------------------------------------------------------------------
  4102. #  它是一个类来处理敌人的角色。
  4103. #==============================================================================
  4104. class Game_Enemy < Game_Battler
  4105.   #--------------------------------------------------------------------------
  4106.   # ● 公开实例变量
  4107.   #--------------------------------------------------------------------------
  4108.   attr_reader :enemy_id                    # 敌人ID
  4109.   #--------------------------------------------------------------------------
  4110.   # ● ID
  4111.   #--------------------------------------------------------------------------
  4112.   def id
  4113.     return @enemy_id
  4114.   end
  4115.   #--------------------------------------------------------------------------
  4116.   # ● 等级
  4117.   #--------------------------------------------------------------------------
  4118.   def level
  4119.     return @sv.level
  4120.   end
  4121.   #--------------------------------------------------------------------------
  4122.   # ● 实行伤害效果 ★再定义
  4123.   #--------------------------------------------------------------------------
  4124.   def perform_damage_effect
  4125.     return if !N03::ENEMY_DAMAGE
  4126.     @sprite_effect_type = :blink
  4127.     Sound.play_enemy_damage
  4128.   end
  4129.   #--------------------------------------------------------------------------
  4130.   # ● 武器
  4131.   #--------------------------------------------------------------------------
  4132.   def weapons
  4133.     weapon1 = $data_weapons[@sv.enemy_weapon1_id]
  4134.     weapon2 = $data_weapons[@sv.enemy_weapon2_id]
  4135.     return [weapon1, weapon2]
  4136.   end
  4137.   #--------------------------------------------------------------------------
  4138.   # ● 防具
  4139.   #--------------------------------------------------------------------------
  4140.   def armors
  4141.     return [$data_armors[@sv.enemy_shield_id]]
  4142.   end
  4143.   #--------------------------------------------------------------------------
  4144.   # ● 二刀流的判定
  4145.   #--------------------------------------------------------------------------
  4146.   def dual_wield?
  4147.     return $data_weapons[@sv.enemy_weapon2_id] != nil
  4148.   end
  4149.   #--------------------------------------------------------------------------
  4150.   # ● 角色图像变更
  4151.   #--------------------------------------------------------------------------
  4152.   def graphics_change(battler_name)
  4153.     @battler_name = battler_name
  4154.   end
  4155.   #--------------------------------------------------------------------------
  4156.   # ● 取得通常攻击的动画ID
  4157.   #--------------------------------------------------------------------------
  4158.   def atk_animation_id1
  4159.     return weapons[0].animation_id if weapons[0]
  4160.     return weapons[1] ? 0 : 1
  4161.   end
  4162.   #--------------------------------------------------------------------------
  4163.   # ● 取得通常攻击的动画ID (二刀流:武器2)
  4164.   #--------------------------------------------------------------------------
  4165.   def atk_animation_id2
  4166.     return weapons[1] ? weapons[1].animation_id : 0
  4167.   end
  4168. end
  4169.  
  4170. #==============================================================================
  4171. # ■ Sprite_Base
  4172. #------------------------------------------------------------------------------
  4173. #  这是显示你添加处理精灵之类的。
  4174. #==============================================================================
  4175. class Sprite_Base < Sprite
  4176.   #--------------------------------------------------------------------------
  4177.   # ● 更新动画的坐标 (有归位)
  4178.   #--------------------------------------------------------------------------
  4179.   def update_animation_position_horming
  4180.     return if @action_end_cancel
  4181.     ani_ox_set if @horming
  4182.     camera_zoom = $sv_camera.zoom
  4183.     camera_zoom = 1 if @move_anime
  4184.     kind = 1
  4185.     kind = -1 if @ani_mirror && !@anime_no_mirror
  4186.     cell_data = @animation.frames[@animation.frame_max - (@ani_duration + @ani_rate - 1) / @ani_rate].cell_data
  4187.     for i in 0..15
  4188.       @ani_sprites[i].x = (@ani_ox + cell_data[i, 1] * kind - $sv_camera.x) * camera_zoom if @ani_sprites[i] != nil && cell_data[i, 1] != nil
  4189.       @ani_sprites[i].y = (@ani_oy + cell_data[i, 2] - $sv_camera.y) * camera_zoom if @ani_sprites[i] != nil && cell_data[i, 2] != nil
  4190.     end
  4191.   end
  4192.   #--------------------------------------------------------------------------
  4193.   # ● 动画原始的坐标设置
  4194.   #--------------------------------------------------------------------------
  4195.   def ani_ox_set
  4196.     if !SceneManager.scene_is?(Scene_Battle)
  4197.       @real_x = x
  4198.       @real_y = y
  4199.     end
  4200.     @ani_ox = @real_x - ox + width / 2
  4201.     @ani_oy = @real_y - oy + height / 2
  4202.     @ani_oy -= height / 2 if @animation.position == 0
  4203.     @ani_oy += height / 2 if @animation.position == 2
  4204.   end
  4205.   #--------------------------------------------------------------------------
  4206.   # ● 更新动画
  4207.   #--------------------------------------------------------------------------
  4208.   alias update_animation_sprite_base_n03 update_animation
  4209.   def update_animation
  4210.     update_animation_position_horming if animation? && SceneManager.scene_is?(Scene_Battle) && @animation.position != 3
  4211.     update_animation_sprite_base_n03
  4212.   end
  4213.   #--------------------------------------------------------------------------
  4214.   # ● 动画的原点设定 ★再定义
  4215.   #--------------------------------------------------------------------------
  4216.   def set_animation_origin
  4217.     return ani_ox_set if @animation.position != 3
  4218.     if viewport == nil
  4219.       @ani_ox = Graphics.width / 2
  4220.       @ani_oy = Graphics.height / 2
  4221.     else
  4222.       @ani_ox = viewport.rect.width / 2
  4223.       @ani_oy = viewport.rect.height / 2
  4224.     end
  4225.   end
  4226.   #--------------------------------------------------------------------------
  4227.   # ● 动画精灵的设定 ★再定义
  4228.   #--------------------------------------------------------------------------
  4229.   def animation_set_sprites(frame)
  4230.     camera_zoom = 1
  4231.     camera_zoom = $sv_camera.zoom if @anime_camera_zoom && @animation.position != 3 && SceneManager.scene_is?(Scene_Battle)
  4232.     camera_x = $sv_camera.x
  4233.     camera_y = $sv_camera.y
  4234.     camera_x = camera_y = 0 if @animation.position == 3 or !SceneManager.scene_is?(Scene_Battle)
  4235.     plus_z = 5
  4236.     plus_z = 1000 if @animation.position == 3
  4237.     plus_z = -17 if @plus_z != nil && @plus_z == false
  4238.     plus_z = -self.z + 10 if @plus_z != nil && @plus_z == false && @animation.position == 3
  4239.     cell_data = frame.cell_data
  4240.     @ani_sprites.each_with_index do |sprite, i|
  4241.       next unless sprite
  4242.       pattern = cell_data[i, 0]
  4243.       if !pattern || pattern < 0
  4244.         sprite.visible = false
  4245.         next
  4246.       end
  4247.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  4248.       sprite.visible = true
  4249.       sprite.src_rect.set(pattern % 5 * 192,
  4250.         pattern % 100 / 5 * 192, 192, 192)
  4251.       if @ani_mirror && !@anime_no_mirror
  4252.         sprite.x = (@ani_ox - cell_data[i, 1] - camera_x) * camera_zoom
  4253.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4254.         sprite.angle = (360 - cell_data[i, 4])
  4255.         sprite.mirror = (cell_data[i, 5] == 0)
  4256.       else
  4257.         sprite.x = (@ani_ox + cell_data[i, 1] - camera_x) * camera_zoom
  4258.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4259.         sprite.angle = cell_data[i, 4]
  4260.         sprite.mirror = (cell_data[i, 5] == 1)
  4261.       end
  4262.       sprite.z = self.z + plus_z + i
  4263.       sprite.ox = 96
  4264.       sprite.oy = 96
  4265.       sprite.zoom_x = cell_data[i, 3] * camera_zoom / 100.0
  4266.       sprite.zoom_y = cell_data[i, 3] * camera_zoom/ 100.0
  4267.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4268.       sprite.blend_type = cell_data[i, 7]
  4269.     end
  4270.   end
  4271.   #--------------------------------------------------------------------------
  4272.   # ● 精灵标志
  4273.   #--------------------------------------------------------------------------
  4274.   def set(battler, horming, camera_zoom, no_mirror)
  4275.     @battler = battler
  4276.     @next = true
  4277.     self.bitmap = Bitmap.new(@battler.sv.cw, @battler.sv.ch)
  4278.     self.ox = bitmap.width / 2
  4279.     self.oy = bitmap.height
  4280.     @horming = horming
  4281.     @anime_camera_zoom = camera_zoom
  4282.     @anime_no_mirror = no_mirror
  4283.     @battler.sv.reset_anime_data
  4284.   end  
  4285.   #--------------------------------------------------------------------------
  4286.   # ● 精灵坐标集
  4287.   #--------------------------------------------------------------------------
  4288.   def set_position(z, zoom_x, zoom_y, real_x, real_y)
  4289.     self.z = z
  4290.     self.zoom_x = zoom_x
  4291.     self.zoom_y = zoom_y
  4292.     @real_x = real_x
  4293.     @real_y = real_y
  4294.   end
  4295.   #--------------------------------------------------------------------------
  4296.   # ● 其他精灵的定时处理
  4297.   #--------------------------------------------------------------------------
  4298.   def other_process_timing(timing)
  4299.     se_flag = true
  4300.     se_flag = @se_flag if @se_flag != nil
  4301.     @battler.sv.timing.push([se_flag, timing.dup])
  4302.   end
  4303.   #--------------------------------------------------------------------------
  4304.   # ● 其他角色的定时处理
  4305.   #--------------------------------------------------------------------------
  4306.   def target_battler_process_timing(timing)
  4307.     for target in @timing_targets
  4308.       target.sv.timing.push([false, timing.dup])
  4309.     end  
  4310.   end
  4311.   #--------------------------------------------------------------------------
  4312.   # ● SE 闪光的定时处理
  4313.   #--------------------------------------------------------------------------
  4314.   alias animation_process_timing_sprite_base_n03 animation_process_timing
  4315.   def animation_process_timing(timing)
  4316.     target_battler_process_timing(timing) if @timing_targets && @timing_targets != []
  4317.     return other_process_timing(timing) if @next != nil
  4318.     animation_process_timing_sprite_base_n03(timing)
  4319.   end
  4320.   #--------------------------------------------------------------------------
  4321.   # ● 释放动画
  4322.   #--------------------------------------------------------------------------
  4323.   alias dispose_animation_sprite_base_n03 dispose_animation
  4324.   def dispose_animation
  4325.     dispose_animation_sprite_base_n03
  4326.   end
  4327. end
  4328.  
  4329.  
  4330. #==============================================================================
  4331. # ■ Sprite_Battler
  4332. #------------------------------------------------------------------------------
  4333. #  这是显示精灵角色的。
  4334. #==============================================================================
  4335. class Sprite_Battler < Sprite_Base
  4336.   #--------------------------------------------------------------------------
  4337.   # ● 公开实例变量
  4338.   #--------------------------------------------------------------------------
  4339.   attr_accessor   :removing             # 队伍脱离
  4340.   #--------------------------------------------------------------------------
  4341.   # ● 初始化物件
  4342.   #--------------------------------------------------------------------------
  4343.   alias initialize_sprite_battler_n03 initialize
  4344.   def initialize(viewport, battler = nil)
  4345.     initialize_sprite_battler_n03(viewport, battler)
  4346.     @real_x = @real_y = 0
  4347.     update_bitmap if @battler != nil
  4348.   end
  4349.   #--------------------------------------------------------------------------
  4350.   # ● 开始动画 ★再定义
  4351.   #--------------------------------------------------------------------------
  4352.   def start_animation(animation, mirror = false)
  4353.     return next_animation(animation, mirror) if animation?
  4354.     @animation = animation
  4355.     if @animation
  4356.       @horming = @battler.sv.anime_horming
  4357.       @anime_camera_zoom = @battler.sv.anime_camera_zoom
  4358.       @anime_no_mirror = @battler.sv.anime_no_mirror
  4359.       @timing_targets = @battler.sv.timing_targets
  4360.       @plus_z = @battler.sv.anime_plus_z
  4361.       @battler.sv.reset_anime_data
  4362.       @ani_mirror = mirror
  4363.       set_animation_rate
  4364.       @ani_duration = @animation.frame_max * @ani_rate + 1
  4365.       load_animation_bitmap
  4366.       make_animation_sprites
  4367.       set_animation_origin
  4368.     end
  4369.   end
  4370.   #--------------------------------------------------------------------------
  4371.   # ● 开始下一个动画
  4372.   #--------------------------------------------------------------------------
  4373.   def next_animation(animation, mirror)
  4374.     @next_anime = [] if @next_anime == nil
  4375.     @next_anime.push(Sprite_Base.new(viewport))
  4376.     @next_anime[@next_anime.size - 1].set(battler, @battler.sv.anime_horming, @battler.sv.anime_camera_zoom, @battler.sv.anime_no_mirror)
  4377.     @next_anime[@next_anime.size - 1].set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y)
  4378.     @next_anime[@next_anime.size - 1].start_animation(animation, mirror)
  4379.   end
  4380.   #--------------------------------------------------------------------------
  4381.   # ● 创建影图行
  4382.   #--------------------------------------------------------------------------
  4383.   def create_shadow
  4384.     reset_shadow
  4385.     return if @battler.sv.shadow == false
  4386.     @shadow = Sprite.new(viewport) if @shadow == nil
  4387.     @shadow.bitmap = Cache.character(@battler.sv.shadow)
  4388.     @shadow.ox = @shadow.bitmap.width / 2
  4389.     @shadow.oy = @shadow.bitmap.height / 2
  4390.   end
  4391.   #--------------------------------------------------------------------------
  4392.   # ● 初始化影图形
  4393.   #--------------------------------------------------------------------------
  4394.   def reset_shadow
  4395.     return if @shadow == nil
  4396.     @shadow.dispose
  4397.     @shadow = nil
  4398.   end  
  4399.   #--------------------------------------------------------------------------
  4400.   # ● 更新传输位图 ★再定义
  4401.   #--------------------------------------------------------------------------
  4402.   def update_bitmap
  4403.     update_bitmap_enemy if !@battler.actor?
  4404.     update_bitmap_actor if @battler.actor?
  4405.     update_src_rect if @battler != nil
  4406.     update_color if @battler != nil
  4407.   end
  4408.   #--------------------------------------------------------------------------
  4409.   # ● 传输位图:敌人
  4410.   #--------------------------------------------------------------------------
  4411.   def update_bitmap_enemy
  4412.     if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
  4413.       @battler_name = @battler.battler_name
  4414.       @battler_hue = @battler.battler_hue
  4415.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4416.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4417.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue)
  4418.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4419.       create_shadow
  4420.       init_visibility
  4421.       @battler_id = @battler.id
  4422.     end
  4423.   end  
  4424.   #--------------------------------------------------------------------------
  4425.   # ● 传输位图:主角
  4426.   #--------------------------------------------------------------------------
  4427.   def update_bitmap_actor
  4428.     if @battler.character_name != @battler_name or @battler.character_index != @battler_index
  4429.       @battler_name = @battler.character_name
  4430.       @battler_index = @battler.character_index
  4431.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4432.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4433.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
  4434.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4435.       create_shadow
  4436.       init_visibility
  4437.       @battler_id = @battler.id
  4438.     end
  4439.   end
  4440.   #--------------------------------------------------------------------------
  4441.   # ● 初始化可见状态 ★再定义
  4442.   #--------------------------------------------------------------------------
  4443.   def init_visibility
  4444.     @battler_visible = @battler.alive?
  4445.     @battler_visible = true if @battler.sv.state(1) != "敌人战斗不能"
  4446.     @battler_visible = false if @battler.hidden?
  4447.     @battler.sv.opacity = 0 unless @battler_visible
  4448.     self.opacity = 0 unless @battler_visible
  4449.     self.opacity = 255 if @battler_visible
  4450.     @battler.sv.weapon_visible = @battler_visible
  4451.   end
  4452.   #--------------------------------------------------------------------------
  4453.   # ● 更新传输矩形
  4454.   #--------------------------------------------------------------------------
  4455.   def update_src_rect
  4456.     return if @battler.sv.collapse
  4457.     if @battler_graphic_file_index != @battler.sv.graphic_file_index
  4458.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4459.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index) if @battler.actor?
  4460.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue) if !@battler.actor?
  4461.       @battler.sv.set_graphics(self.bitmap.width, self.bitmap.height)
  4462.     end
  4463.     anime_off if @battler.sv.anime_off
  4464.     self.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4465.     self.opacity = @battler.sv.opacity if @battler_visible
  4466.     set_process_timing(@battler.sv.timing) if @battler && @battler.sv.timing != []
  4467.   end
  4468.   #--------------------------------------------------------------------------
  4469.   # ● 更新位置 ★再定义
  4470.   #--------------------------------------------------------------------------
  4471.   def update_position
  4472.     @real_x = @battler.sv.x / 100
  4473.     @real_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust)/ 100
  4474.     self.x = @real_x - $sv_camera.x
  4475.     self.y = @real_y - $sv_camera.y
  4476.     self.z = @battler.sv.z - @battler.sv.c / 100
  4477.     if @battler.sv.h <= 0
  4478.       self.x += $sv_camera.sx / 100
  4479.       self.y += $sv_camera.sy / 100
  4480.     end  
  4481.     self.x *= $sv_camera.zoom
  4482.     self.y *= $sv_camera.zoom
  4483.   end
  4484.   #--------------------------------------------------------------------------
  4485.   # ● 更新原点 ★再定义
  4486.   #--------------------------------------------------------------------------
  4487.   def update_origin
  4488.     return if !bitmap or @battler.sv.collapse
  4489.     self.ox = @battler.sv.ox
  4490.     self.oy = @battler.sv.oy
  4491.     self.angle = @battler.sv.angle
  4492.     self.zoom_x = @battler.sv.zoom_x * $sv_camera.zoom
  4493.     self.zoom_y = @battler.sv.zoom_y * $sv_camera.zoom
  4494.     self.mirror = @battler.sv.mirror if !@graphic_mirror_flag
  4495.     self.mirror = !@battler.sv.mirror if @graphic_mirror_flag
  4496.   end
  4497.   #--------------------------------------------------------------------------
  4498.   # ● 更新影图像
  4499.   #--------------------------------------------------------------------------
  4500.   def update_shadow
  4501.     @shadow.visible = @battler.sv.shadow_visible
  4502.     @shadow.opacity = @battler.sv.opacity if @battler.sv.opacity_data[3]
  4503.     @shadow.opacity = self.opacity if !@battler.sv.opacity_data[3]
  4504.     @shadow.x = @real_x - $sv_camera.x
  4505.     @shadow.y = (@battler.sv.y - @battler.sv.c)/ 100 - $sv_camera.y
  4506.     @shadow.z = @battler.sv.z - 10
  4507.     @shadow.zoom_x = $sv_camera.zoom
  4508.     @shadow.zoom_y = $sv_camera.zoom
  4509.     @shadow.x += $sv_camera.sx / 100
  4510.     @shadow.y += $sv_camera.sy / 100
  4511.     @shadow.x *= $sv_camera.zoom
  4512.     @shadow.y *= $sv_camera.zoom
  4513.     @shadow.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4514.   end
  4515.   #--------------------------------------------------------------------------
  4516.   # ● 更新气球
  4517.   #--------------------------------------------------------------------------
  4518.   def update_balloon
  4519.     if @battler.sv.balloon_data == [] && @balloon
  4520.       @balloon_data = []
  4521.       @balloon.dispose
  4522.       return @balloon = nil
  4523.     elsif @battler.sv.balloon_data != [] && @battler.sv.balloon_data != @balloon_data
  4524.       @balloon_data = @battler.sv.balloon_data
  4525.       @balloon = Sprite.new(self.viewport)
  4526.       @balloon.bitmap = Cache.system("Balloon")
  4527.       @balloon.zoom_x = @balloon_data[3]
  4528.       @balloon.zoom_y = @balloon_data[3]
  4529.       @balloon.ox = 32 if @battler.sv.mirror
  4530.       @balloon.oy = 16
  4531.       @balloon_count = 0
  4532.     end
  4533.     return if !@balloon
  4534.     @balloon.opacity = self.opacity
  4535.     @balloon.x = self.x
  4536.     @balloon.y = self.y - @battler.sv.ch * $sv_camera.zoom
  4537.     @balloon.z = self.z + 20
  4538.     @balloon.src_rect.set(32 + @balloon_count / @balloon_data[2] * 32, @balloon_data[1] * 32, 32, 32) if @balloon_count % @balloon_data[2] == 0
  4539.     @balloon.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4540.     @balloon_count += 1
  4541.     @balloon_count = 0 if @balloon_count == @balloon_data[2] * 7
  4542.   end
  4543.   #--------------------------------------------------------------------------
  4544.   # ● 更新色调变更
  4545.   #--------------------------------------------------------------------------
  4546.   def update_color
  4547.     color_set if @battler.sv.color_set != []
  4548.     return if @color_data == nil
  4549.     @color_data[4] -= 1
  4550.     if @color_data[4] == 0 && @color_data[5] != 0
  4551.       @color_data[4] = @color_data[5]
  4552.       @color_data[5] = 0
  4553.       @color_data[6] = [0,0,0,0]
  4554.     elsif @color_data[4] == 0
  4555.       @remain_color_data = @color_data
  4556.       @battler.sv.color = @color_data.dup
  4557.       return @color_data = nil
  4558.     end  
  4559.     for i in 0..3
  4560.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  4561.     end  
  4562.     @battler.sv.color = @color_data.dup
  4563.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  4564.   end
  4565.   #--------------------------------------------------------------------------
  4566.   # ● 更新残像
  4567.   #--------------------------------------------------------------------------
  4568.   def update_mirage
  4569.     if @battler.sv.mirage == [] && @mirages
  4570.       @mirage_data = []
  4571.       for mirage in @mirages do mirage.dispose end
  4572.       return @mirages = nil
  4573.     elsif @battler.sv.mirage != [] && @battler.sv.mirage != @mirage_data
  4574.       @mirage_data = @battler.sv.mirage
  4575.       @mirages = []
  4576.       for i in 0...@mirage_data[1] do @mirages[i] = Sprite.new(self.viewport) end
  4577.       @mirage_count = 0
  4578.     end
  4579.     return if !@mirages
  4580.     @mirage_count += 1
  4581.     @mirage_count = 0 if @mirage_count == @mirage_data[2] * @mirages.size
  4582.     for i in [email]0...@mirages.size[/email]
  4583.       mirage_body(@mirages[i], @mirage_data[4]) if @mirage_count == 1 + i * @mirage_data[2]
  4584.     end
  4585.   end
  4586.   #--------------------------------------------------------------------------
  4587.   # ● 残像本体
  4588.   #--------------------------------------------------------------------------
  4589.   def mirage_body(body, opacity)
  4590.     body.bitmap = self.bitmap.dup
  4591.     body.x = self.x
  4592.     body.y = self.y
  4593.     body.ox = self.ox
  4594.     body.oy = self.oy
  4595.     body.z = self.z - 20
  4596.     body.mirror = self.mirror
  4597.     body.angle = self.angle
  4598.     body.opacity = opacity * self.opacity / 255
  4599.     body.zoom_x = self.zoom_x
  4600.     body.zoom_y = self.zoom_y   
  4601.     body.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4602.     body.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4603.   end   
  4604.   #--------------------------------------------------------------------------
  4605.   # ● 更新下一个动画
  4606.   #--------------------------------------------------------------------------
  4607.   def update_next_anime
  4608.     return if !@next_anime
  4609.     for anime in @next_anime
  4610.       anime.update
  4611.       anime.set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y) if @horming
  4612.       anime.dispose if !anime.animation?
  4613.       @next_anime.delete(anime) if !anime.animation?
  4614.     end  
  4615.   end
  4616.   #--------------------------------------------------------------------------
  4617.   # ● 更新帧数
  4618.   #--------------------------------------------------------------------------
  4619.   alias update_sprite_battler_n03 update
  4620.   def update
  4621.     @battler.sv.update if @battler
  4622.     update_sprite_battler_n03
  4623.     update_next_anime
  4624.     update_shadow  if @battler && @shadow
  4625.     update_mirage  if @battler
  4626.     update_balloon if @battler
  4627.     update_remove if @battler && @removing && @battler.sv.change_up
  4628.   end
  4629.   #--------------------------------------------------------------------------
  4630.   # ● 战斗动画消除
  4631.   #--------------------------------------------------------------------------
  4632.   def anime_off
  4633.     @battler.sv.anime_off = false
  4634.     dispose_animation
  4635.     for anime in @next_anime do anime.dispose_animation end if @next_anime
  4636.   end
  4637.   #--------------------------------------------------------------------------
  4638.   # ● 角色替换
  4639.   #--------------------------------------------------------------------------
  4640.   def remove
  4641.     @battler.sv.start_action(@battler.sv.remove_action)
  4642.     $sv_camera.wait = 40
  4643.     @battler.sv.add_action("eval('set_change')")
  4644.     @removing = true
  4645.   end
  4646.   #--------------------------------------------------------------------------
  4647.   # ● 更新角色替换
  4648.   #--------------------------------------------------------------------------
  4649.   def update_remove
  4650.     @battler.sv.change_up = false
  4651.     @removing = false
  4652.     @battler = nil
  4653.   end  
  4654.   #--------------------------------------------------------------------------
  4655.   # ● 加入角色
  4656.   #--------------------------------------------------------------------------
  4657.   def join(join_battler)
  4658.     $sv_camera.wait = 30
  4659.     @battler = join_battler
  4660.     @battler_name = @battler.character_name
  4661.     @battler_index = @battler.character_index
  4662.     @battler_graphic_file_index = @battler.sv.graphic_file_index
  4663.     self.bitmap = Cache.character(@battler_name)
  4664.     @battler.sv.setup(self.bitmap.width, self.bitmap.height, true)
  4665.     create_shadow
  4666.     init_visibility
  4667.   end
  4668.   #--------------------------------------------------------------------------
  4669.   # ● 通常的设定返回 ★再定义
  4670.   #--------------------------------------------------------------------------
  4671.   def revert_to_normal
  4672.     self.blend_type = 0
  4673.     self.opacity = 255
  4674.   end
  4675.   #--------------------------------------------------------------------------
  4676.   # ● 更新战斗不能效果
  4677.   #--------------------------------------------------------------------------
  4678.   alias update_collapse_sprite_battler_n03 update_collapse
  4679.   def update_collapse
  4680.     return if @battler.sv.state(1) != "敌人战斗不能"
  4681.     update_collapse_sprite_battler_n03
  4682.     @battler.sv.weapon_visible = false
  4683.   end
  4684.   #--------------------------------------------------------------------------
  4685.   # ● 更新Boss战斗不能效果 ★再定义
  4686.   #--------------------------------------------------------------------------
  4687.   def update_boss_collapse
  4688.     @effect_duration = @battler.sv.ch if @effect_duration >= @battler.sv.ch
  4689.     alpha = @effect_duration * 120 / @battler.sv.ch
  4690.     self.ox = @battler.sv.cw / 2 + @effect_duration % 2 * 4 - 2
  4691.     self.blend_type = 1
  4692.     self.color.set(255, 255, 255, 255 - alpha)
  4693.     self.opacity = alpha
  4694.     self.src_rect.y -= 1
  4695.     Sound.play_boss_collapse2 if @effect_duration % 20 == 19
  4696.   end
  4697.   #--------------------------------------------------------------------------
  4698.   # ● 另个精灵的定时处理
  4699.   #--------------------------------------------------------------------------
  4700.   def set_process_timing(timing_data)
  4701.     for data in timing_data
  4702.       set_timing(data[0],data[1])
  4703.     end
  4704.     @battler.sv.timing = []
  4705.   end
  4706.   #--------------------------------------------------------------------------
  4707.   # ● 定时的处理
  4708.   #--------------------------------------------------------------------------
  4709.   def set_timing(se_flag, data)
  4710.     @ani_rate = 4
  4711.     data.se.play if se_flag
  4712.     case data.flash_scope
  4713.     when 1 ;self.flash(data.flash_color, data.flash_duration * @ani_rate)
  4714.     when 2 ;viewport.flash(data.flash_color, data.flash_duration * @ani_rate) if viewport
  4715.     when 3 ;self.flash(nil, data.flash_duration * @ani_rate)
  4716.     end
  4717.   end
  4718.   #--------------------------------------------------------------------------
  4719.   # ● 色调变更
  4720.   #--------------------------------------------------------------------------
  4721.   def color_set
  4722.     set = @battler.sv.color_set
  4723.     @battler.sv.color_set= []
  4724.     set[4] = 1 if set[4] == 0
  4725.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  4726.     @color_data = @remain_color_data
  4727.     @color_data[4] = set[4]
  4728.     @color_data[5] = set[5]
  4729.     @color_data[6] = set
  4730.   end
  4731.   #--------------------------------------------------------------------------
  4732.   # ● 释放
  4733.   #--------------------------------------------------------------------------
  4734.   alias dispose_sprite_battler_n03 dispose
  4735.   def dispose
  4736.     dispose_sprite_battler_n03
  4737.     @shadow.dispose if @shadow != nil
  4738.     @balloon.dispose if @balloon != nil
  4739.     for mirage in @mirages do mirage.dispose end if @mirages != nil
  4740.     for anime in @next_anime do anime.dispose end if @next_anime
  4741.   end
  4742. end
  4743.  
  4744.  
  4745. #==============================================================================
  4746. # ■ Spriteset_Battle
  4747. #------------------------------------------------------------------------------
  4748. #  这是一个类结合了精灵的战斗画面。
  4749. #==============================================================================
  4750. class Spriteset_Battle
  4751.   #--------------------------------------------------------------------------
  4752.   # ● 战斗背景(地)创建精灵 ★再定义
  4753.   #--------------------------------------------------------------------------
  4754.   def create_battleback1
  4755.     @back1_sprite = Sprite_Battle_Back.new(@viewport1, 1, battleback1_name)
  4756.     @back1_sprite.set_graphics(battleback1_bitmap) if battleback1_name != nil
  4757.     @back1_sprite.z = 0
  4758.   end
  4759.   #--------------------------------------------------------------------------
  4760.   # ● 战斗背景(壁)创建精灵 ★再定义
  4761.   #--------------------------------------------------------------------------
  4762.   def create_battleback2
  4763.     @back2_sprite = Sprite_Battle_Back.new(@viewport1, 2, battleback2_name)
  4764.     @back2_sprite.set_graphics(battleback2_bitmap) if battleback2_name != nil
  4765.     @back2_sprite.z = 1
  4766.   end
  4767.   #--------------------------------------------------------------------------
  4768.   # ● 创建角色精灵 ★再定义
  4769.   #--------------------------------------------------------------------------
  4770.   def create_actors
  4771.     @actor_sprites = []
  4772.     for i in 0...$game_party.max_battle_members
  4773.       @actor_sprites[i] = Sprite_Battler.new(@viewport1, $game_party.members[i])
  4774.     end
  4775.     @effect_sprites = Spriteset_Sideview.new(@viewport1)
  4776.   end
  4777.   #--------------------------------------------------------------------------
  4778.   # ● 更新角色精灵 ★再定义
  4779.   #--------------------------------------------------------------------------
  4780.   def update_actors
  4781.     @actor_sprites.each_with_index do |sprite, i|
  4782.       sprite_join($game_party.members[i], sprite) if sprite.battler == nil && sprite.battler != $game_party.members[i]
  4783.       sprite.remove if sprite.battler != nil && !sprite.removing && sprite.battler != $game_party.members[i]
  4784.       sprite.update
  4785.     end
  4786.     @effect_sprites.update
  4787.     update_program
  4788.   end
  4789.   #--------------------------------------------------------------------------
  4790.   # ● 加入精灵成员
  4791.   #--------------------------------------------------------------------------
  4792.   def sprite_join(member, sprite)
  4793.     for sp in @actor_sprites
  4794.       sp.update_remove if member == sp.battler && !sp.battler.sv.change_up
  4795.     end
  4796.     sprite.join(member)
  4797.   end
  4798.   #--------------------------------------------------------------------------
  4799.   # ● 更新战斗程序
  4800.   #--------------------------------------------------------------------------
  4801.   def update_program
  4802.     return if $sv_camera.program_scroll == []
  4803.     for data in  $sv_camera.program_scroll
  4804.       @back1_sprite.start_back_data(data) if data[2] == 1
  4805.       @back2_sprite.start_back_data(data) if data[2] == 2
  4806.     end
  4807.     $sv_camera.program_scroll = []
  4808.   end
  4809.   #--------------------------------------------------------------------------
  4810.   # ● 实行打击时的战斗动画
  4811.   #--------------------------------------------------------------------------
  4812.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  4813.     @effect_sprites.set_hit_animation(battler, weapon_index, hit_targets, miss)
  4814.   end
  4815.   #--------------------------------------------------------------------------
  4816.   # ● 伤害POP
  4817.   #--------------------------------------------------------------------------
  4818.   def set_damage_pop(target)
  4819.     @effect_sprites.set_damage_pop(target)
  4820.   end
  4821.   #--------------------------------------------------------------------------
  4822.   # ● 释放
  4823.   #--------------------------------------------------------------------------
  4824.   alias dispose_spriteset_battle_n03 dispose
  4825.   def dispose
  4826.     dispose_spriteset_battle_n03
  4827.     @effect_sprites.dispose
  4828.   end
  4829. end
  4830.  
  4831. #==============================================================================
  4832. # ■ Window_BattleLog
  4833. #------------------------------------------------------------------------------
  4834. #  进行战斗的实况显示窗口。
  4835. #==============================================================================
  4836. class Window_BattleLog < Window_Selectable
  4837.   #--------------------------------------------------------------------------
  4838.   # ● 等待 ★再定义
  4839.   #--------------------------------------------------------------------------
  4840.   def wait
  4841.   end
  4842.   #--------------------------------------------------------------------------
  4843.   # ● 等待和清除 ★再定义
  4844.   #--------------------------------------------------------------------------
  4845.   def wait_and_clear
  4846.     $sv_camera.wait = 10
  4847.   end
  4848.   #--------------------------------------------------------------------------
  4849.   # ● 显示动作结果 ★再定义
  4850.   #--------------------------------------------------------------------------
  4851.   def display_action_results(target, item)
  4852.     if target.result.used
  4853.       last_line_number = line_number
  4854.       display_critical(target, item)
  4855.       display_damage(target, item)
  4856.       display_affected_status(target, item)
  4857.       display_failure(target, item)
  4858.     end
  4859.     off if !N03::BATTLE_LOG
  4860.   end
  4861.   #--------------------------------------------------------------------------
  4862.   # ● 隐藏窗口
  4863.   #--------------------------------------------------------------------------
  4864.   def off
  4865.     @back_sprite.visible = self.visible = false
  4866.   end
  4867. end
  4868. #==============================================================================
  4869. # ■ Game_Interpreter
  4870. #------------------------------------------------------------------------------
  4871. #  这是一个事件命令的解释器。
  4872. #==============================================================================
  4873. class Game_Interpreter
  4874.   #--------------------------------------------------------------------------
  4875.   # ● 开关的操作
  4876.   #--------------------------------------------------------------------------
  4877.   alias command_121_game_interpreter_n03 command_121
  4878.   def command_121
  4879.     command_121_game_interpreter_n03
  4880.     $sv_camera.program_check
  4881.   end
  4882. end
  4883.  
  4884. class Window_BattleStatus < Window_Selectable
  4885.     #--------------------------------------------------------------------------
  4886.   # ● フレーム更新 (HP)
  4887.   #--------------------------------------------------------------------------
  4888.   def update_hp(s,a,m)
  4889.     # HPくるくる
  4890.     if a.hp != s[13]
  4891.       c = 0; c = 1 if a.hp < a.mhp / 4; c = 2 if a.hp == 0
  4892.       if s[13] > a.hp
  4893.         s[13] -= BTSKIN_04SS
  4894.         s[13] = a.hp if s[13] < a.hp
  4895.       else
  4896.         s[13] += BTSKIN_04SS
  4897.         s[13] = a.hp if s[13] > a.hp
  4898.       end
  4899.       s[6].update(s[13], c)
  4900.     end
  4901.     # HP
  4902.     if a.hp != m[1]
  4903.       s[11] = ((@hpgw * (a.hp / (a.mhp * 1.0))) + 1).truncate
  4904.       m[1] = a.hp
  4905.     end
  4906.     sr = s[1].src_rect
  4907.     if sr.width != s[11]
  4908.       sp = BTSKIN_01GS
  4909.       sr.width = (s[11] + (s[1].src_rect.width * (sp - 1))) / sp
  4910.       sr.width = 2 if sr.width <= 1 and a.hp > 0
  4911.     end
  4912.     sr = s[2].src_rect
  4913.     sp = 2
  4914.     if sr.width != s[1].src_rect.width and (Graphics.frame_count % sp) == 0
  4915.       if sr.width < s[1].src_rect.width
  4916.         sr.width += 1
  4917.       else
  4918.         sr.width -= 1
  4919.       end
  4920.     end
  4921.     sr.width = 2 if sr.width <= 1 and a.hp > 0
  4922.   end
  4923.   #--------------------------------------------------------------------------
  4924.   # ● フレーム更新 (MP)
  4925.   #--------------------------------------------------------------------------
  4926.   def update_mp(s,a,m)
  4927.     # MPくるくる
  4928.     if a.mp != s[14]
  4929.       c = 0; c = 1 if a.mp < a.mmp / 4
  4930.       if s[14] > a.mp
  4931.         s[14] -= BTSKIN_05SS
  4932.         s[14] = a.mp if s[14] < a.mp
  4933.       else
  4934.         s[14] += BTSKIN_05SS
  4935.         s[14] = a.mp if s[14] > a.mp
  4936.       end
  4937.       s[7].update(s[14], c)
  4938.     end
  4939.     # MP
  4940.     if a.mp != m[3]
  4941.       if a.mmp != 0
  4942.         s[12] = ((@mpgw * (a.mp / (a.mmp * 1.0))) + 1).truncate
  4943.       else
  4944.         s[12] = 0
  4945.       end
  4946.       m[3] = a.mp
  4947.     end
  4948.     sr = s[3].src_rect
  4949.     if sr.width != s[12]
  4950.       sp = BTSKIN_02GS
  4951.       sr.width = (s[12] + (s[3].src_rect.width * (sp - 1))) / sp
  4952.       sr.width = 2 if sr.width <= 1 and a.mp > 0
  4953.     end
  4954.     sr = s[4].src_rect
  4955.     sp = 2
  4956.     if sr.width != s[3].src_rect.width and (Graphics.frame_count % sp) == 0
  4957.       if sr.width < s[3].src_rect.width
  4958.         sr.width += 1
  4959.       else
  4960.         sr.width -= 1
  4961.       end
  4962.     end
  4963.     sr.width = 2 if sr.width <= 1 and a.mp > 0
  4964.   end
  4965.   #--------------------------------------------------------------------------
  4966.   # ● フレーム更新 (TP)
  4967.   #--------------------------------------------------------------------------
  4968.   def update_tp(s,a,m)
  4969.     # TPくるくる
  4970.     if a.tp != s[26]
  4971.       c = 0; #c = 1 if a.tp > 99#; c = 2 if a.hp == 0
  4972.       if s[26] > a.tp
  4973.         s[26] -= BTSKIN_08SS
  4974.         s[26] = a.tp if s[26] < a.tp
  4975.       else
  4976.         s[26] += BTSKIN_08SS
  4977.         s[26] = a.tp if s[26] > a.tp
  4978.       end
  4979.       s[25].update(s[26], c)
  4980.     end
  4981.     # TP
  4982.     if a.tp != m[6]
  4983.       s[23] = ((@tpgw * (a.tp / (a.max_tp * 1.0))) + 1).truncate
  4984.       m[6] = a.tp
  4985.     end
  4986.     sr = s[21].src_rect
  4987.     if sr.width != s[23]
  4988.       sp = BTSKIN_07GS
  4989.       sr.width = (s[23] + (s[21].src_rect.width * (sp - 1))) / sp
  4990.       sr.width = 2 if sr.width <= 1 and a.tp > 0
  4991.     end
  4992.     sr = s[22].src_rect
  4993.     sp = 2
  4994.     if sr.width != s[21].src_rect.width and (Graphics.frame_count % sp) == 0
  4995.       if sr.width < s[21].src_rect.width
  4996.         sr.width += 1
  4997.       else
  4998.         sr.width -= 1
  4999.       end
  5000.     end
  5001.     sr.width = 2 if sr.width <= 1 and a.tp > 0
  5002.   end
  5003. end

Lv1.梦旅人

梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
帖子
101
2
 楼主| 发表于 2013-10-22 20:45:00 | 只看该作者
设置战斗人数6人是下面这个吗?
  1.   #--------------------------------------------------------------------------
  2.   # ● 取得参战角色的最大数
  3.   #--------------------------------------------------------------------------
  4.   def max_battle_members
  5.     return 6
  6.   end
复制代码
那加入的其他角色不参加战斗,待机不行吗?
回复 支持 反对

使用道具 举报

Lv2.观梦者

会吐槽的画师

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
帖子
6535
3
发表于 2013-10-25 19:15:15 | 只看该作者
缺少回城卷轴………全局找去,看哪里冲突

点评

你还是去VX区水吧【雾  发表于 2013-10-26 14:57
老大,能详细点吗?完全不懂,谢谢指点  发表于 2013-10-25 23:22

评分

参与人数 1星屑 -35 收起 理由
熊喵酱 -35 純水+誤導

查看全部评分

长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
帖子
101
4
 楼主| 发表于 2013-10-26 14:36:14 | 只看该作者
上贺茂润 发表于 2013-10-25 19:15
缺少回城卷轴………全局找去,看哪里冲突

{:2_270:}{:2_270:}完全被打败了,原来是娱乐贴,能给点实质的指导吗?
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

梦石
1
星屑
23994
在线时间
3339 小时
注册时间
2011-7-8
帖子
3926

开拓者

5
发表于 2013-10-28 18:18:05 | 只看该作者
你调用过一次update_tp(s,a,m),其中的a未赋值(a == nil)所以会报这个错误,建议调试程序看看哪里调用了update_tp(s,a,m)

点评

谢谢,根据你的提示,解决了,把另外个冲突脚本删除了  发表于 2013-10-30 21:11
你给的脚本里这个函数update_tp(s,a,m)似乎没有在定义外出现,我也不知道在哪里调用的。  发表于 2013-10-29 00:27
能具体点吗?帅哥。我脚本好无力  发表于 2013-10-28 22:05

评分

参与人数 2星屑 +145 收起 理由
Sion + 100 认可答案
longshili + 45 认可答案

查看全部评分

熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-22 15:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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