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

Project1

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

[已经解决] 横版出错,求助

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
113 小时
注册时间
2013-8-7
帖子
32
跳转到指定楼层
1
发表于 2014-8-15 14:44:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
是第848行
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Sideview Ver100
  3. #------------------------------------------------------------------------------
  4. #  サイドビューバトラーを管理するクラスです。
  5. #==============================================================================
  6. class SideView
  7.   #--------------------------------------------------------------------------
  8.   # ● 公開インスタンス変数 
  9.   #--------------------------------------------------------------------------
  10.   attr_accessor   :x                    # 画面X座標
  11.   attr_accessor   :y                    # 画面Y座標
  12.   attr_accessor   :z                    # 画面Z座標
  13.   attr_accessor   :h                    # 高さ座標
  14.   attr_accessor   :j                    # ジャンプ座標
  15.   attr_accessor   :c                    # カーブ座標
  16.   attr_accessor   :ox                   # 横原点
  17.   attr_accessor   :oy                   # 縦原点
  18.   attr_accessor   :oy_adjust            # 縦原点補正
  19.   attr_accessor   :angle                # 回転角度
  20.   attr_accessor   :zoom_x               # 横の拡大率
  21.   attr_accessor   :zoom_y               # 縦の拡大率
  22.   attr_accessor   :pattern_w            # セル横位置(矩形内)
  23.   attr_accessor   :pattern_h            # セル縦位置(矩形内)
  24.   attr_accessor   :sx                   # セル横位置(画像全体)
  25.   attr_accessor   :sy                   # セル縦位置(画像全体)
  26.   attr_accessor   :pattern_type         # セル更新タイプ
  27.   attr_accessor   :pattern_time         # セル更新間隔
  28.   attr_accessor   :graphic_name         # バトラー画像ファイル名
  29.   attr_accessor   :graphic_file_index   # バトラー画像ファイル名インデックス
  30.   attr_accessor   :graphic_index        # バトラー画像インデックス
  31.   attr_accessor   :cw                   # セル横矩形
  32.   attr_accessor   :ch                   # セル縦矩形
  33.   attr_accessor   :shadow_visible       # 影表示
  34.   attr_accessor   :weapon_visible       # 武器表示
  35.  
  36.   attr_accessor   :wait                 # 次の動作待ち時間
  37.   attr_accessor   :weapon_index         # 表示中の武器画像インデックス配列
  38.   attr_accessor   :weapon_end           # 武器アニメ終了フラグ
  39.   attr_accessor   :force_action         # 強制アクション
  40.   attr_accessor   :target_battler       # ターゲットバトラー情報
  41.   attr_accessor   :second_targets       # セカンドターゲット情報
  42.   attr_accessor   :m_a_targets          # アニメ飛ばしターゲット情報
  43.   attr_accessor   :individual_targets   # 個別処理ターゲットバトラー情報
  44.   attr_accessor   :effect_data          # エフェクトデータ
  45.   attr_accessor   :anime_id             # アニメID配列
  46.   attr_accessor   :anime_move_id        # 飛ばしアニメID配列
  47.   attr_accessor   :mirror               # 反転フラグ
  48.   attr_accessor   :opacity              # 透明度
  49.   attr_accessor   :opacity_data         # 透明度操作情報
  50.   attr_accessor   :set_damage           # バトルシーンでのダメージ処理
  51.   attr_accessor   :m_a_data             # アニメ飛ばし情報
  52.   attr_accessor   :m_a_starter          # アニメ飛ばし開始ターゲット情報
  53.   attr_accessor   :action_end           # バトルシーンでの行動終了
  54.   attr_accessor   :damage_anime_data    # ダメージ戦闘アニメのデータ
  55.   attr_accessor   :anime_no_mirror      # 戦闘アニメの反転禁止フラグ
  56.   attr_accessor   :anime_horming        # 戦闘アニメのホーミングフラグ
  57.   attr_accessor   :anime_camera_zoom    # 戦闘アニメがカメラに合わせて拡大縮小するか
  58.   attr_accessor   :anime_plus_z         # 戦闘アニメZ座標補正
  59.   attr_accessor   :derivation_skill_id  # スキル派生ID
  60.   attr_accessor   :immortal             # 不死身フラグ
  61.   attr_accessor   :mirage               # 残像データ
  62.   attr_accessor   :balloon_data         # ふきだしデータ
  63.   attr_accessor   :timing               # 別バトラーからのタイミングデータ
  64.   attr_accessor   :timing_targets       # タイミングデータを渡す別バトラー
  65.   attr_accessor   :color_set            # 色調変更データ
  66.   attr_accessor   :color                # 色調データ
  67.   attr_accessor   :change_up            # 画像変更フラグ
  68.   attr_accessor   :hit                  # 被攻撃回数
  69.   attr_accessor   :add_state            # 何度も付加ステートの表示を防ぐフラグ
  70.   attr_accessor   :counter_id           # カウンター時のスキルID
  71.   attr_accessor   :reflection_id        # 魔法反射時のアニメID
  72.   attr_accessor   :result_damage        # ターン終了時のHP変動データ
  73.   attr_accessor   :active               # 行動権
  74.   attr_accessor   :anime_off            # 戦闘アニメ消去
  75.   attr_accessor   :command_action       # コマンドアクションフラグ
  76.  
  77.   attr_accessor   :base_x               # 初期位置 X座標
  78.   attr_accessor   :base_y               # 初期位置 Y座標
  79.   attr_accessor   :base_h               # 初期位置 高さ座標
  80.   attr_accessor   :max_pattern_w        # セルの横分割数
  81.   attr_accessor   :max_pattern_h        # セルの縦分割数
  82.  
  83.   attr_reader     :collapse             # コラプスフラグ
  84.   attr_reader     :picture              # ピクチャ表示フラグ
  85.   #--------------------------------------------------------------------------
  86.   # ● オブジェクト初期化
  87.   #--------------------------------------------------------------------------
  88.   def initialize(battler)
  89.     [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  90.     reset
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 初期化
  94.   #--------------------------------------------------------------------------
  95.   def reset
  96.     @x = 0
  97.     @y = 0
  98.     @z = 0
  99.     @h = 0
  100.     @j = 0
  101.     @c = 0
  102.     [url=home.php?mod=space&uid=271873]@jump[/url] = []
  103.     @curve = []
  104.     @ox = 0
  105.     @oy = 0
  106.     @oy_adjust = 0
  107.     @z_plus = 0
  108.     @move_time = 0
  109.     [url=home.php?mod=space&uid=124954]@Angle[/url] = 0
  110.     @angle_time = 0
  111.     @zoom_x = 1
  112.     @zoom_y = 1
  113.     @zoom_time = 0
  114.     @pattern_w = 0
  115.     @pattern_h = 0
  116.     @sx = 0
  117.     @sy = 0
  118.     @pattern_type = 0
  119.     @pattern_time = 0
  120.     @pattern_rest_time = 0
  121.     @graphic_name = ""
  122.     @graphic_file_index = ""
  123.     @graphic_index = 0
  124.     @cw = 0
  125.     @ch = 0
  126.     @shadow_visible = false
  127.     @weapon_visible = true
  128.  
  129.     [url=home.php?mod=space&uid=36110]@Wait[/url] = 0
  130.     @weapon_index = []
  131.     @weapon_end = true
  132.     @full_action = []
  133.     @action = []
  134.     @force_action = ""
  135.     @target_battler = []
  136.     @second_targets = []
  137.     @individual_targets = []
  138.     @m_a_targets = []
  139.     @effect_data = []
  140.     @anime_id = []
  141.     @anime_move_id = []
  142.     @opacity = 255
  143.     @opacity_data = []
  144.     @set_damage = false
  145.     @m_a_data = []
  146.     @m_a_starter = []
  147.     @action_end = false
  148.     @damage_anime_data = []
  149.     @anime_no_mirror = false
  150.     @anime_horming = false
  151.     @anime_camera_zoom = false
  152.     @anime_plus_z = true
  153.     @derivation_skill_id = 0
  154.     @immortal = false
  155.     @mirage = []
  156.     @play_data = []
  157.     @balloon_data = []
  158.     @picture = false
  159.     @timing = []
  160.     @timing_targets = []
  161.     @color_set = []
  162.     [url=home.php?mod=space&uid=10453]@color[/url] = []
  163.     @change_up = false
  164.     @non_motion = false
  165.     @graphics_change = false
  166.     @hit = []
  167.     @add_state = []
  168.     @collapse = false
  169.     @counter_id = 0
  170.     @reflection_id = 0
  171.     @result_damage = [0,0]
  172.     @active = false
  173.     @anime_off = false
  174.     @command_action = false
  175.  
  176.     @base_x = 0
  177.     @base_y = 0
  178.     @base_z = 0
  179.     @base_h = 0
  180.     @max_pattern_w = 0
  181.     @max_pattern_h = 0
  182.     @pattern_kind = 0
  183.     @pattern_count = 0
  184.     @move_time = 0
  185.     [url=home.php?mod=space&uid=111303]@mirror[/url] = false
  186.     @battler.set_graphic(@pre_change_data[0], @pre_change_data[1], @pre_change_data[2], @pre_change_data[3]) if @pre_change_data != nil
  187.     @pre_change_data = nil
  188.   end  
  189.   #--------------------------------------------------------------------------
  190.   # ● セットアップ
  191.   #--------------------------------------------------------------------------
  192.   def setup(bitmap_width, bitmap_height, first_action_flag)
  193.     reset if first_action_flag
  194.     set_data
  195.     set_base_position if !@graphics_change
  196.     set_graphics(bitmap_width, bitmap_height)
  197.     set_target
  198.     setup_graphics_change if @graphics_change
  199.     first_battler_anime_set if first_action_flag
  200.   end  
  201.   #--------------------------------------------------------------------------
  202.   # ● バトラーデータ取得
  203.   #--------------------------------------------------------------------------
  204.   def set_data
  205.     return if @battler == nil
  206.     if @battler.actor?
  207.       @graphic_name = @battler.character_name
  208.       @graphic_index = @battler.character_index
  209.     else
  210.       @graphic_name = @battler.battler_name
  211.       @graphic_index = 0
  212.     end
  213.     @max_pattern_w = max_pattern[0]
  214.     @max_pattern_h = max_pattern[1]
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● ベース座標をセット data = [X軸, Y軸, H軸]  moment_set…瞬間配置
  218.   #--------------------------------------------------------------------------
  219.   def set_base_position(moment_set = true)
  220.     mirroring_reset
  221.     if @battler.actor?
  222.       data = N03::ACTOR_POSITION[@battler.index].dup
  223.       @base_x = data[0] * 100 if !@mirror
  224.       @base_x = (Graphics.width - data[0]) * 100 if @mirror
  225.     else
  226.       data = [@battler.screen_x, @battler.screen_y, 0].dup
  227.       @base_x = data[0] * 100 if !$sv_camera.mirror
  228.       @base_x = (Graphics.width - data[0]) * 100 if $sv_camera.mirror
  229.     end
  230.     @base_y = data[1] * 100
  231.     @base_h = data[2] * 100
  232.     @base_z = @y
  233.     return if !moment_set
  234.     @x = @base_x
  235.     @y = @base_y
  236.     @z = @base_z
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● グラフィックデータ取得
  240.   #--------------------------------------------------------------------------
  241.   def set_graphics(bitmap_width, bitmap_height)
  242.     sign = @graphic_name[/^[\!\$]./]
  243.     if sign && sign.include?('$')
  244.       @cw = bitmap_width / @max_pattern_w
  245.       @ch = bitmap_height / @max_pattern_h
  246.     elsif @max_pattern_w == 1 && @max_pattern_h == 1
  247.       @cw = bitmap_width
  248.       @ch = bitmap_height
  249.     else
  250.       @cw = bitmap_width / (@max_pattern_w * 4)
  251.       @ch = bitmap_height / (@max_pattern_h * 2)
  252.     end
  253.     @ox = @cw / 2
  254.     @oy = @ch
  255.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  256.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ● ターゲットをセット
  260.   #--------------------------------------------------------------------------
  261.   def set_target(target = nil)
  262.     @target_battler = target
  263.     @target_battler = [@battler] if target == nil
  264.     @second_targets = @target_battler
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● 画像変更用のセットアップ
  268.   #--------------------------------------------------------------------------
  269.   def setup_graphics_change
  270.     @graphics_change = false
  271.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  272.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  273.   end  
  274.   #--------------------------------------------------------------------------
  275.   # ● 戦闘開始時の待機アニメ画像データ取得
  276.   #--------------------------------------------------------------------------
  277.   def first_battler_anime_set
  278.     loop do
  279.       update
  280.       break if @action_data == nil
  281.       break if @action_data[0] == "motion"
  282.       break if @action_data[0] == "move" && @action_data[8] != ""
  283.       break if @full_action == []
  284.     end
  285.     start_action(first_action) if @battler.movable?
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● アクション開始
  289.   #--------------------------------------------------------------------------
  290.   def start_action(kind = nil)
  291.     return if @event_fix && $game_troop.interpreter.running?
  292.     # ウェイト中の場合キャンセル
  293.     return @wait -= 1 if @wait > 0 && kind == nil
  294.     action_setup(false) if kind != nil
  295.     set_action(kind)
  296.     @action = kind if @action == nil
  297.     # 行動配列が無い場合は行動終了処理へ移行
  298.     action_terminate if @action == nil
  299.     # 次のアクション決定
  300.     @action_data = N03::ACTION[@action]
  301.     next_action
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 行動パラメータの初期化
  305.   #--------------------------------------------------------------------------
  306.   def action_setup(reset = true)
  307.     @event_fix = false
  308.     @set_damage = false
  309.     @action_end = false
  310.     @balloon_data = []
  311.     @loop_act = []
  312.     angle_reset if reset
  313.     zoom_reset if reset
  314.     opacity_reset if reset
  315.     @curve = []
  316.     @c = 0
  317.     convert_jump
  318.   end  
  319.   #--------------------------------------------------------------------------
  320.   # ● 行動終了処理
  321.   #--------------------------------------------------------------------------
  322.   def action_terminate
  323.     @mirage = [] if @mirage_end
  324.     mirroring_reset
  325.     @picture = false
  326.     @individual_targets = []
  327.     action_setup if @active
  328.     action_setup(false) if !@active
  329.     # 待機アクションへ移行
  330.     stand_by_action if !@non_motion
  331.     # 戦闘行動のアクティブ権を終了
  332.     next_battler
  333.   end  
  334.   #--------------------------------------------------------------------------
  335.   # ● 新しいアクション内容の決定
  336.   #--------------------------------------------------------------------------
  337.   def set_action(kind = nil)
  338.     full_act = N03::FULLACTION[kind]
  339.     @full_action = full_act.dup if full_act != nil
  340.     @action = @full_action.shift
  341.     # 参照したアクションがフルアクションであれば全体のアクションを統合
  342.     full_act2 = N03::FULLACTION[@action]
  343.     @full_action = full_act2.dup + @full_action if full_act2 != nil
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 次のアクションへ
  347.   #--------------------------------------------------------------------------
  348.   def next_action
  349.     @wait = 0
  350.     # ショートカット確認
  351.     eval(@action) if @action != nil && @action_data == nil && N03::FULLACTION[@action] == nil
  352.     # ウエイト設定
  353.     @wait = @action.to_i if @wait == 0 && @action_data == nil
  354.     @wait = rand(@wait.abs + 1) if @wait < 0
  355.     # アクション開始
  356.     action_play
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● 待機アクションへ移行
  360.   #--------------------------------------------------------------------------
  361.   def stand_by_action
  362.     # 通常待機に
  363.     stand_by_act = normal
  364.     # HPが1/4でピンチアクションに
  365.     stand_by_act = pinch if @battler.hp <= @battler.mhp / 4
  366.     # ステートチェック
  367.     stand_by_act = state(@battler.states[0].id) if @battler.states[0] != nil && state(@battler.states[0].id) != nil
  368.     # コマンドチェック
  369.     stand_by_act = command if @command_action && command != nil
  370.     set_action(stand_by_act)
  371.     @action = stand_by_act if @action == nil
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 強制アクション開始
  375.   #--------------------------------------------------------------------------
  376.   def start_force_action
  377.     return if @active
  378.     start_action(@force_action)
  379.     @force_action = ""
  380.   end  
  381.   #--------------------------------------------------------------------------
  382.   # ● アクション追加
  383.   #--------------------------------------------------------------------------
  384.   def add_action(kind)
  385.     @full_action.push(kind)
  386.   end  
  387.   #--------------------------------------------------------------------------
  388.   # ● アクションの挿入
  389.   #--------------------------------------------------------------------------
  390.   def unshift_action(kind)
  391.     @full_action.unshift(kind)
  392.   end  
  393.   #--------------------------------------------------------------------------
  394.   # ● フレーム更新
  395.   #--------------------------------------------------------------------------
  396.   def update
  397.     # アクション開始
  398.     start_action
  399.     # 強制アクション開始
  400.     start_force_action if @force_action != ""
  401.     # アニメパターン更新
  402.     update_pattern
  403.     # 移動更新
  404.     update_move
  405.     # 回転更新
  406.     update_angle if @angle_time != 0
  407.     # 拡大縮小更新
  408.     update_zoom if @zoom_time != 0
  409.     # 透明度更新
  410.     update_opacity if @opacity_data != []
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ● アニメパターン更新
  414.   #--------------------------------------------------------------------------
  415.   def update_pattern
  416.     return @pattern_rest_time -= 1 if @pattern_rest_time != 0
  417.     return if @max_pattern_w == 1 && @max_pattern_h == 1
  418.     @pattern_rest_time = @pattern_time
  419.     # 再生開始・終了セル位置を取得
  420.     if @pattern_kind > 0 # 通常再生中
  421.       @pattern_start = 0
  422.       @pattern_end = @max_pattern_w - 1
  423.     elsif @pattern_kind < 0 # 逆転再生中
  424.       @pattern_start = @max_pattern_w - 1
  425.       @pattern_end = 0
  426.     end
  427.     # 片道の再生が終了
  428.     @pattern_count += 1 if @pattern_w == @pattern_end && @pattern_kind != 0
  429.     # ループ処理
  430.     case @pattern_type.abs
  431.     when  1,3 # 片道
  432.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type ==  1
  433.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type == -1
  434.       @pattern_kind =  1 if @pattern_count != 0 && @pattern_type ==  3
  435.       @pattern_kind = -1 if @pattern_count != 0 && @pattern_type == -3
  436.       @pattern_w = @pattern_start - @pattern_kind if @pattern_count != 0 && @pattern_type.abs == 3
  437.       @pattern_count = 0
  438.     when  2,4 # 往復
  439.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  2
  440.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -2
  441.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type ==  2
  442.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type == -2
  443.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  4
  444.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -4
  445.       @pattern_kind =  1 if @pattern_count == 2 && @pattern_type ==  4
  446.       @pattern_kind = -1 if @pattern_count == 2 && @pattern_type == -4
  447.       @pattern_count = 0 if @pattern_count == 2
  448.     end
  449.     # セル更新
  450.     @pattern_w += 1 * @pattern_kind
  451.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ● 移動の更新
  455.   #--------------------------------------------------------------------------
  456.   def update_move
  457.     @z = @y / 100 + @z_plus
  458.     return if @move_time == 0
  459.     target_position_set if @horming_move
  460.     @x = (@x * (@move_time - 1) + @target_x) / @move_time
  461.     @y = (@y * (@move_time - 1) + @target_y) / @move_time
  462.     @h = (@h * (@move_time - 1) + @target_h) / @move_time if @move_h != nil
  463.     @c += @curve[@move_time - 1] if @curve[@move_time - 1] != nil
  464.     @j += @jump[@move_time - 1] if @jump[@move_time - 1] != nil
  465.     @move_time -= 1
  466.     convert_jump if @move_time == 0
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # ● 移動目標の更新
  470.   #--------------------------------------------------------------------------
  471.   def target_position_set
  472.     target_position = N03.get_targets_position(@move_targets, @horming_move)
  473.     @target_x = target_position[0] + @move_x
  474.     @target_y = target_position[1] + @move_y
  475.     @target_h = target_position[2] + @move_h if @move_h != nil
  476.   end  
  477.   #--------------------------------------------------------------------------
  478.   # ● 回転更新
  479.   #--------------------------------------------------------------------------
  480.   def update_angle
  481.     @angle += @angling
  482.     @angle_time -= 1
  483.     return if @angle_time != 0
  484.     return angle_reset if @angle_data[4] == 0
  485.     angling(@angle_data) if @angle_data[4] == 2
  486.   end  
  487.   #--------------------------------------------------------------------------
  488.   # ● 拡大縮小更新
  489.   #--------------------------------------------------------------------------
  490.   def update_zoom
  491.     @zoom_x += @zooming_x
  492.     @zoom_y += @zooming_y
  493.     @zoom_time -= 1
  494.     return if @zoom_time != 0
  495.     return zoom_reset if @zoom_data[4] == 0
  496.     zooming(@zoom_data) if @zoom_data[4] == 2
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ● 透明度更新
  500.   #--------------------------------------------------------------------------
  501.   def update_opacity
  502.     @opacity += @opacity_data[2]
  503.     @opacity_data[0] -= 1
  504.     return if @opacity_data[0] != 0
  505.     return if !@opacity_data[5]
  506.     @opacity_data[2] *= -1
  507.     @opacity_data[0] = @opacity_data[1]
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # ● アクション実行
  511.   #--------------------------------------------------------------------------
  512.   def action_play
  513.     return if @action_data == nil
  514.     action = @action_data[0]
  515.     # バトラー反転の場合
  516.     return mirroring                    if action == "mirror"
  517.     # 残像の場合
  518.     return mirage_set                   if action == "mirage"
  519.     # 回転の場合  
  520.     return angling                      if action == "angle"
  521.     # 拡大縮小の場合  
  522.     return zooming                      if action == "zoom"
  523.     # 透明度操作の場合  
  524.     return set_opacity                  if action == "opacity"
  525.     # バトラーアニメの場合
  526.     return battler_anime                if action == "motion"
  527.     # 移動の場合
  528.     return move                         if action == "move"
  529.     # 武器アニメの場合
  530.     return weapon_anime([@action_data]) if action == "wp"
  531.     # アニメ飛ばしの場合
  532.     return move_anime                   if action == "m_a"
  533.     # 戦闘シーン通信の場合(コラプス)
  534.     return set_play_data                if action == "collapse" or action == "no_collapse"
  535.     # データベース戦闘アニメ表示の場合  
  536.     return battle_anime                 if action == "anime"
  537.     # カメラワークの場合
  538.     return camera                       if action == "camera"
  539.     # 画面のシェイクの場合
  540.     return shake                        if action == "shake"
  541.     # 画面色調変更の場合
  542.     return color_effect                 if action == "color"
  543.     # トランジションの場合
  544.     return transition                   if action == "ts"
  545.     # ふきだしアニメ表示の場合  
  546.     return balloon_anime                if action == "balloon"
  547.     # ピクチャ表示の場合
  548.     return picture_set                  if action == "pic"
  549.     # ステート操作の場合
  550.     return state_set                    if action == "sta"
  551.     # FPS変更の場合
  552.     return fps                          if action == "fps"
  553.     # バトラー画像変更の場合  
  554.     return graphics_change              if action == "change"
  555.     # スキル派生の場合  
  556.     return derivating_skill             if action == "der"
  557.     # BGM/BGS/SE演奏の場合  
  558.     return sound                        if action == "sound"
  559.     # ムービー再生の場合  
  560.     return movie                        if action == "movie"
  561.     # ゲームスイッチ操作の場合  
  562.     return switches                     if action == "switch"
  563.     # ゲーム変数操作の場合  
  564.     return variable                     if action == "variable"
  565.     # 条件分岐(ゲームスイッチ)の場合
  566.     return nece_1                       if action == "n_1"
  567.     # 条件分岐(ゲーム変数)の場合
  568.     return nece_2                       if action == "n_2"
  569.     # 条件分岐(ステート)の場合
  570.     return nece_3                       if action == "n_3"
  571.     # 条件分岐(スキル)の場合
  572.     return nece_4                       if action == "n_4"
  573.     # 条件分岐(パラメータ)の場合
  574.     return nece_5                       if action == "n_5"
  575.     # 条件分岐(装備)の場合
  576.     return nece_6                       if action == "n_6"
  577.     # 条件分岐(スクリプト)の場合
  578.     return nece_7                       if action == "n_7"
  579.     # セカンドターゲット操作の場合  
  580.     return second_targets_set           if action == "s_t"
  581.     # コモンイベント呼び出しの場合  
  582.     return call_common_event            if action == "common"
  583.     # 戦闘アニメ消去の場合  
  584.     return @anime_off = true            if action == "anime_off"
  585.     # 強制戦闘終了の場合  
  586.     return BattleManager.process_abort  if action == "battle_end"
  587.     # 画面固定の場合  
  588.     return Graphics.freeze              if action == "graphics_freeze"
  589.     # ダメージアニメの場合  
  590.     return damage_anime                 if action == "damage_anime"
  591.     # 武器消去の場合  
  592.     return @weapon_visible = false      if action == "weapon_off"
  593.     # 武器消去解除の場合  
  594.     return @weapon_visible = true       if action == "weapon_on"
  595.     # 待機キャンセルの場合
  596.     return @non_motion = true           if action == "non_motion"
  597.     # 待機キャンセル解除の場合
  598.     return @non_motion = false          if action == "non_motion_cancel"
  599.     # 初期位置変更の場合
  600.     return change_base_position         if action == "change_base_position"
  601.     # 初期位置変更解除の場合
  602.     return set_base_position(false)     if action == "set_base_position"
  603.     # 強制アクションの場合  
  604.     return force_act                    if action == "force_action"
  605.     # 強制アクションの場合 (セカンドターゲット)
  606.     return force_act2                   if action == "force_action2"
  607.     # 個別開始の場合
  608.     return individual_start             if action == "individual_start"
  609.     # 個別終了の場合
  610.     return individual_end               if action == "individual_end"
  611.     # ループ開始の場合
  612.     return loop_start                   if action == "loop_start"
  613.     # ループ終了の場合
  614.     return loop_end                     if action == "loop_end"
  615.     # 自分のみ更新の場合
  616.     return only_action_on               if action == "only_action_on"
  617.     # 自分のみ更新解除の場合
  618.     return only_action_off              if action == "only_action_off"
  619.     # 次の行動者へ移行の場合
  620.     return next_battler                 if action == "next_battler"
  621.     # 画像変更フラグの場合
  622.     return set_change                   if action == "set_change"
  623.     # スクリプト操作の場合   
  624.     return eval(@action_data[0])
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # ● バトラー反転実行
  628.   #--------------------------------------------------------------------------
  629.   def mirroring
  630.     @mirror = !@mirror
  631.   end  
  632.   #--------------------------------------------------------------------------
  633.   # ● 反転初期化
  634.   #--------------------------------------------------------------------------
  635.   def mirroring_reset
  636.     @mirror = false
  637.     mirroring if !@battler.actor? && N03::ENEMY_MIRROR
  638.     mirroring if $sv_camera.mirror
  639.   end  
  640.   #--------------------------------------------------------------------------
  641.   # ● 残像実行
  642.   #--------------------------------------------------------------------------
  643.   def mirage_set
  644.     @mirage = @action_data.dup
  645.     @mirage_end = @mirage[3]
  646.     @mirage = [] if @mirage[1] == 0
  647.   end  
  648.   #--------------------------------------------------------------------------
  649.   # ● 回転実行
  650.   #--------------------------------------------------------------------------
  651.   def angling(data = @action_data)
  652.     @angle_data = data.dup
  653.     @oy = @ch / 2
  654.     @oy_adjust = @ch * 50
  655.     @angle_time = data[1]
  656.     start_angle = data[2] * N03.mirror_num(@mirror)
  657.     end_angle = data[3] * N03.mirror_num(@mirror)
  658.     # 時間が0以下なら即座に最終角度へ
  659.     @angle_time = 1 if @angle_time <= 0
  660.     # 回転時間から1フレームあたりの角度を出す
  661.     @angling = (end_angle - start_angle) / @angle_time
  662.     # 割り切れない余りを初期角度に
  663.     @angle = (end_angle - start_angle) % @angle_time + start_angle
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ● 回転初期化
  667.   #--------------------------------------------------------------------------
  668.   def angle_reset
  669.     @oy = @ch
  670.     @angle = @angle_time = @oy_adjust = 0
  671.   end  
  672.   #--------------------------------------------------------------------------
  673.   # ● 拡大縮小実行
  674.   #--------------------------------------------------------------------------
  675.   def zooming(data = @action_data)
  676.     @zoom_data = data.dup
  677.     @zoom_time = data[1]
  678.     start_zoom_x = data[2][0]
  679.     start_zoom_y = data[2][1]
  680.     end_zoom_x = data[3][0]
  681.     end_zoom_y = data[3][1]
  682.     # 時間が0以下なら即座に最終サイズへ
  683.     @zoom_time = 1 if @zoom_time <= 0
  684.     # 拡大縮小時間から1フレームあたりの拡大縮小率を出す
  685.     @zooming_x = (end_zoom_x - start_zoom_x) / @zoom_time
  686.     @zooming_y = (end_zoom_y - start_zoom_y) / @zoom_time
  687.     # 開始サイズに
  688.     @zoom_x = start_zoom_x
  689.     @zoom_y = start_zoom_y
  690.   end  
  691.   #--------------------------------------------------------------------------
  692.   # ● 拡大縮小初期化
  693.   #--------------------------------------------------------------------------
  694.   def zoom_reset
  695.     @zoom_x = @zoom_y = 1
  696.     @zoom_time = 0
  697.   end  
  698.   #--------------------------------------------------------------------------
  699.   # ● バトラー透明度操作
  700.   #--------------------------------------------------------------------------
  701.   def set_opacity
  702.     data = @action_data.dup
  703.     @opacity = data[2]
  704.     opacity_move = (data[3] - data[2])/ data[1]
  705.     @opacity_data = [data[1], data[1], opacity_move, data[4], data[5], data[6]]
  706.     @wait = data[1] if data[7]
  707.     @wait *= 2 if data[6] && data[7]
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● 透明度操作初期化
  711.   #--------------------------------------------------------------------------
  712.   def opacity_reset
  713.     @opacity = 255
  714.     @opacity = 0 if @battler.hidden?
  715.     @opacity_data = []
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ● バトラーアニメ実行
  719.   #--------------------------------------------------------------------------
  720.   def battler_anime(anime_data = nil)
  721.     anime_data = @action_data.dup if anime_data == nil
  722.     @graphic_file_index = anime_data[1] if !graphic_fix
  723.     @pattern_h = anime_data[2]
  724.     @pattern_w = anime_data[3]
  725.     @pattern_h = 0 if @max_pattern_w == 1
  726.     @pattern_w = 0 if @max_pattern_h == 1
  727.     @pattern_type = anime_data[4]
  728.     @pattern_time = anime_data[5]
  729.     @pattern_rest_time = anime_data[5]
  730.     @pattern_count = 0
  731.     @pattern_kind = 1
  732.     @pattern_kind = -1 if @pattern_type < 0
  733.     @pattern_kind = 0 if @pattern_type == 0
  734.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  735.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  736.     @z_plus = anime_data[6]
  737.     @wait = set_anime_wait if anime_data[7]
  738.     @shadow_visible = anime_data[8]
  739.     weapon_anime(anime_data)
  740.   end
  741.   #--------------------------------------------------------------------------
  742.   # ● アニメウエイト計算
  743.   #--------------------------------------------------------------------------
  744.   def set_anime_wait
  745.     if @pattern_type > 0
  746.       pattern_time_a = @max_pattern_w - @pattern_w.abs
  747.     elsif @pattern_type < 0
  748.       pattern_time_a = @pattern_w.abs + 1
  749.     else
  750.       return @pattern_time if @pattern_type == 0
  751.     end
  752.     case @pattern_type
  753.     when 1,-1, 3,-3
  754.       return pattern_time_a * @pattern_time
  755.     when 2,-2, 4,-4
  756.       return pattern_time_a * @pattern_time + (@max_pattern_w - 2) * @pattern_time
  757.     end
  758.   end  
  759.   #--------------------------------------------------------------------------
  760.   # ● 移動実行
  761.   #--------------------------------------------------------------------------
  762.   def move
  763.     @move_targets = N03.get_targets(@action_data[1].abs, @battler)
  764.     return if @move_targets == []
  765.     @move_targets = [@battler] if @action_data[1].abs == 7
  766.     @move_x = @action_data[2] * 100 * N03.mirror_num(@mirror)
  767.     @move_y = @action_data[3] * 100
  768.     @move_h = @action_data[4] * 100 if @action_data[4] != nil
  769.     @move_h = nil if @action_data[4] == nil
  770.     battler_anime(N03::ACTION[@action_data[8]].dup) if N03::ACTION[@action_data[8]] != nil
  771.     @horming_move = true
  772.     @horming_move = false if @action_data[1] < 0 or @action_data[1].abs == 7
  773.     target_position_set
  774.     target_position = [@target_x, @target_y, @target_z]
  775.     distanse_move = @action_data[5] > 0
  776.     @move_time = N03.distanse_calculation(@action_data[5].abs, target_position, [@x, @y, @z], distanse_move)
  777.     @wait = @move_time
  778.     curve
  779.     jump
  780.     @move_time = 1 if @move_time == 0
  781.     @horming_move = false if !@move_targets or @move_targets.include?(@battler)
  782.     update_move if @move_time == 1
  783.   end  
  784.   #--------------------------------------------------------------------------
  785.   # ● カーブ実行
  786.   #--------------------------------------------------------------------------
  787.   def curve
  788.     @c = 0
  789.     return if @action_data[6] == 0
  790.     @curve = N03.parabola([@action_data[6], -@action_data[6]], @move_time, 100, 4)
  791.   end  
  792.   #--------------------------------------------------------------------------
  793.   # ● ジャンプ実行
  794.   #--------------------------------------------------------------------------
  795.   def jump
  796.     convert_jump
  797.     return if @action_data[7] == [0,0]
  798.     @jump = N03.parabola(@action_data[7].dup, @move_time, 100)
  799.   end  
  800.   #--------------------------------------------------------------------------
  801.   # ● J座標(ジャンプ高度)をH座標に変換
  802.   #--------------------------------------------------------------------------
  803.   def convert_jump
  804.     @h += @j
  805.     @j = 0
  806.     @jump = []
  807.   end  
  808.   #--------------------------------------------------------------------------
  809.   # ● データベース戦闘アニメ実行
  810.   #--------------------------------------------------------------------------
  811.   def battle_anime
  812.     data = @action_data.dup
  813.     targets = N03.get_targets(data[2], @battler)
  814.     return if targets == []
  815.     data[8] = !data[8] if @mirror
  816.     @set_damage           = data[5]
  817.     @damage_anime_data[0] = N03.get_attack_anime_id(data[1], @battler)
  818.     @damage_anime_data[1] = data[8]
  819.     @damage_anime_data[2] = data[7]
  820.     @damage_anime_data[3] = data[6]
  821.     @damage_anime_data[4] = data[9]
  822.     @wait = N03.get_anime_time(@damage_anime_data[0]) - 2 if data[4]
  823.     return if @set_damage
  824.     for target in targets do display_anime(targets, target, data) end
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # ● 武器アニメ開始
  828.   #--------------------------------------------------------------------------
  829.   def weapon_anime(anime_data)
  830.     @weapon_end = true
  831.     for i in 9...anime_data.size
  832.       set_effect_data(anime_data[i]) if anime_data[i] != ""
  833.     end
  834.   end
  835.   #--------------------------------------------------------------------------
  836.   # ● アニメ飛ばし開始
  837.   #--------------------------------------------------------------------------
  838.   def move_anime
  839.     @m_a_starter = []
  840.     @m_a_targets = []
  841.     starters = N03.get_targets(@action_data[2], @battler)
  842.     targets = N03.get_targets(@action_data[3], @battler)
  843.     return if starters == [] or targets == []
  844.     single_start = true if starters != nil && @action_data[2] < 0
  845.     single_start = true if @action_data[1][0] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][0], @battler)].position == 3
  846.     starters = [starters[0]] if single_start
  847.     single_end = true if targets != nil && @action_data[3] < 0
  848.     single_end = true if @action_data[1][1] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][1], @battler)].position == 3
  849.     targets = [targets[0]] if single_end
  850.     se_flag = true
  851.     for starter in starters
  852.       for target in targets
  853.         data = @action_data.dup
  854.         data[17] = se_flag
  855.         @effect_data.push(data)
  856.         @m_a_targets.push(target)
  857.         @m_a_starter.push(starter)
  858.         se_flag = false
  859.       end
  860.     end  
  861.   end
  862.   #--------------------------------------------------------------------------
  863.   # ● スプライトセット通信
  864.   #--------------------------------------------------------------------------
  865.   def set_effect_data(data = @action)
  866.     action_data = N03::ACTION[data]
  867.     return if action_data == nil
  868.     @effect_data.push(action_data.dup)
  869.   end
  870.   #--------------------------------------------------------------------------
  871.   # ● 戦闘シーン通信のデータを格納
  872.   #--------------------------------------------------------------------------
  873.   def set_play_data(data = @action_data)
  874.     @play_data = data.dup
  875.   end
  876.   #--------------------------------------------------------------------------
  877.   # ● 戦闘アニメの表示
  878.   #--------------------------------------------------------------------------
  879.   def display_anime(targets, target, data)
  880.     return if !N03.first_of_all_screen_anime(data[1], target, targets)
  881.     target.animation_id         = N03.get_attack_anime_id(data[1], @battler)
  882.     target.animation_mirror     = data[8]
  883.     target.sv.anime_horming     = data[3]
  884.     target.sv.anime_camera_zoom = data[6]
  885.     target.sv.anime_no_mirror   = data[7]
  886.     target.sv.anime_plus_z      = data[9]
  887.   end
  888.   #--------------------------------------------------------------------------
  889.   # ● 戦闘アニメ拡張データの初期化
  890.   #--------------------------------------------------------------------------
  891.   def reset_anime_data
  892.     @anime_no_mirror = false
  893.     @anime_horming = false
  894.     @anime_camera_zoom = false
  895.     @timing_targets = []
  896.     @anime_plus_z = true
  897.   end  
  898.   #--------------------------------------------------------------------------
  899.   # ● カメラワーク
  900.   #--------------------------------------------------------------------------
  901.   def camera
  902.     data = @action_data.dup
  903.     N03.camera(@battler, data)
  904.     @wait = data[4] if data[5]
  905.   end  
  906.   #--------------------------------------------------------------------------
  907.   # ● 画面のシェイク
  908.   #--------------------------------------------------------------------------
  909.   def shake
  910.     data = @action_data.dup
  911.     $sv_camera.shake(data[1], data[2], data[3])
  912.     @wait = data[3] if data[4]
  913.   end
  914.   #--------------------------------------------------------------------------
  915.   # ● 画面色調変更
  916.   #--------------------------------------------------------------------------
  917.   def color_effect
  918.     case @action_data[1]
  919.     when 0,1,2,3,4,5
  920.       targets = N03.get_targets(@action_data[1], @battler)
  921.     when 6
  922.       screen = true
  923.     when 7
  924.       targets = [@battler] + @target_battler
  925.     when 8
  926.       screen = true
  927.       targets = $game_troop.members + $game_party.battle_members - [@battler]
  928.     when 9
  929.       screen = true
  930.       targets = $game_troop.members + $game_party.battle_members - [@battler] - @target_battler
  931.     when 10
  932.       screen = true
  933.       targets = $game_troop.members + $game_party.battle_members
  934.     end
  935.     return if screen == nil && targets == []
  936.     for target in targets do target.sv.color_set = @action_data[2] end if targets
  937.     @wait = @action_data[2][4] if @action_data[3]
  938.     return if !screen
  939.     $sv_camera.color_set[1] = @action_data[2]
  940.     $sv_camera.color_set[2] = @action_data[2]
  941.   end  
  942.   #--------------------------------------------------------------------------
  943.   # ● トランジション
  944.   #--------------------------------------------------------------------------
  945.   def transition
  946.     $sv_camera.perform_transition(@action_data)
  947.   end  
  948.   #--------------------------------------------------------------------------
  949.   # ● ふきだしアニメ表示
  950.   #--------------------------------------------------------------------------
  951.   def balloon_anime
  952.     @balloon_data = @action_data.dup
  953.   end  
  954.   #--------------------------------------------------------------------------
  955.   # ● ピクチャ表示
  956.   #--------------------------------------------------------------------------
  957.   def picture_set
  958.     @picture = true
  959.     set_effect_data
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● ステート操作
  963.   #--------------------------------------------------------------------------
  964.   def state_set
  965.     targets = N03.get_targets(@action_data[1], @battler)
  966.     return if targets == []
  967.     case @action_data[2]
  968.     when 1 ; targets = [targets[rand(targets.size)]]
  969.     when 2 ; targets -= @battler if targets.include?(@battler)
  970.     end
  971.     for target in targets
  972.       for id in @action_data[4]
  973.         target.add_state(id) if @action_data[3] == "+"
  974.         target.remove_state(id) if @action_data[3] == "-"
  975.       end
  976.     end
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ● FPS変更
  980.   #--------------------------------------------------------------------------
  981.   def fps
  982.     Graphics.frame_rate = @action_data[1]
  983.     start_action
  984.   end
  985.   #--------------------------------------------------------------------------
  986.   # ● バトラー画像変更の場合
  987.   #--------------------------------------------------------------------------
  988.   def graphics_change
  989.     @graphics_change = true
  990.     return @battler.graphics_change(@action_data[3]) if !@battler.actor?
  991.     @pre_change_data = [@battler.character_name, @battler.character_index, @battler.face_name, @battler.face_index] if @pre_change_data == nil && !@action_data[1]
  992.     if @action_data[4] == []
  993.       face_name = @battler.face_name
  994.       face_index = @battler.face_index
  995.     else
  996.       face_name = @action_data[4][1]
  997.       face_index = @action_data[4][0]
  998.     end
  999.     @battler.set_graphic(@action_data[3], @action_data[2], face_name, face_index)
  1000.   end
  1001.   #--------------------------------------------------------------------------
  1002.   # ● スキル派生
  1003.   #--------------------------------------------------------------------------
  1004.   def derivating_skill
  1005.     # 未修得スキルは派生不可なら
  1006.     return if !@action_data[1] && !@battler.skill_learn?($data_skills[@action_data[3]])
  1007.     # コスト不足は派生不可なら
  1008.     return if !@action_data[2] && !@battler.skill_cost_payable?($data_skills[@action_data[3]])
  1009.     # 派生
  1010.     @derivation_skill_id = @action_data[3]
  1011.     # 以降のアクションをキャンセル
  1012.     @full_action = []
  1013.   end
  1014.   #--------------------------------------------------------------------------
  1015.   # ● BGM/BGS/SE演奏
  1016.   #--------------------------------------------------------------------------
  1017.   def sound
  1018.     pitch = @action_data[2]
  1019.     vol   = @action_data[3]
  1020.     name  = @action_data[4]
  1021.     case @action_data[1]
  1022.     when "se"
  1023.       Audio.se_play("Audio/SE/" + name, vol, pitch)
  1024.     when "bgm"
  1025.       # 名前指定のない場合、現在のBGMを変えないように
  1026.       name = RPG::BGM.last.name if @action_data[4] == ""
  1027.       Audio.bgm_play("Audio/BGM/" + name, vol, pitch)
  1028.     when "bgs"
  1029.       name = RPG::BGS.last.name if @action_data[4] == ""
  1030.       Audio.bgs_play("Audio/BGS/" + name, vol, pitch)
  1031.     end
  1032.   end
  1033.   #--------------------------------------------------------------------------
  1034.   # ● ムービーの再生
  1035.   #--------------------------------------------------------------------------
  1036.   def movie
  1037.     Graphics.play_movie('Movies/' + @action_data[1])
  1038.   end
  1039.   #--------------------------------------------------------------------------
  1040.   # ● ゲームスイッチ操作
  1041.   #--------------------------------------------------------------------------
  1042.   def switches
  1043.     for id in @action_data[1]
  1044.       $game_switches[id] = true if id > 0
  1045.       $sv_camera.switches[id.abs] = true  if id < 0
  1046.     end
  1047.     for id in @action_data[2]
  1048.       $game_switches[id] = false if id > 0
  1049.       $sv_camera.switches[id.abs] = false  if id < 0
  1050.     end
  1051.     $sv_camera.program_check
  1052.   end
  1053.   #--------------------------------------------------------------------------
  1054.   # ● ゲーム変数操作
  1055.   #--------------------------------------------------------------------------
  1056.   def variable
  1057.     # オペランドチェック
  1058.     operand = @action_data[3]
  1059.     operand = $game_variables[@action_data[3].abs] if @action_data[3] < 0
  1060.     # 変数操作で分岐
  1061.     case @action_data[2]
  1062.     when 0 ; $game_variables[@action_data[1]] = operand  # 代入
  1063.     when 1 ; $game_variables[@action_data[1]] += operand # 加算
  1064.     when 2 ; $game_variables[@action_data[1]] -= operand # 減算
  1065.     when 3 ; $game_variables[@action_data[1]] *= operand # 乗算
  1066.     when 4 ; $game_variables[@action_data[1]] /= operand # 除算
  1067.     when 5 ; $game_variables[@action_data[1]] %= operand # 剰余
  1068.     end
  1069.   end  
  1070.   #--------------------------------------------------------------------------
  1071.   # ● 条件分岐 (ゲームスイッチ)
  1072.   #--------------------------------------------------------------------------
  1073.   def nece_1
  1074.     judgment = $game_switches[@action_data[1]] == @action_data[2] if @action_data[1] > 0
  1075.     judgment = $sv_camera.switches[@action_data[1].abs] == @action_data[2] if @action_data[1] < 0
  1076.     action_diverging(judgment, @action_data[3])
  1077.   end  
  1078.   #--------------------------------------------------------------------------
  1079.   # ● 条件分岐 (ゲーム変数)
  1080.   #--------------------------------------------------------------------------
  1081.   def nece_2
  1082.     variable = $game_variables[@action_data[1]]
  1083.     num = @action_data[2]
  1084.     num = $game_variables[@action_data[2].abs] if num < 0
  1085.     case @action_data[3]
  1086.     when 0 ; judgment = variable == num
  1087.     when 1 ; judgment = variable < num
  1088.     when 2 ; judgment = variable > num
  1089.     end  
  1090.     action_diverging(judgment, @action_data[4])
  1091.   end  
  1092.   #--------------------------------------------------------------------------
  1093.   # ● 条件分岐 (ステート)
  1094.   #--------------------------------------------------------------------------
  1095.   def nece_3
  1096.     targets = N03.get_targets(@action_data[1], @battler)
  1097.     return if targets == []
  1098.     member_num = @action_data[4]
  1099.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1100.     hit_count = 0
  1101.     miss_count = 0
  1102.     for target in targets
  1103.       hit_count += 1 if target.state?(@action_data[2])
  1104.       miss_count += 1 if !target.state?(@action_data[2])
  1105.     end
  1106.     case @action_data[3]
  1107.     when 0 ; judgment = hit_count >= member_num
  1108.     when 1 ; judgment = miss_count >= member_num
  1109.     end
  1110.     action_diverging(judgment, @action_data[5])
  1111.   end  
  1112.   #--------------------------------------------------------------------------
  1113.   # ● 条件分岐 (スキル)
  1114.   #--------------------------------------------------------------------------
  1115.   def nece_4
  1116.     targets = N03.get_targets(@action_data[1], @battler)
  1117.     return if targets == []
  1118.     member_num = @action_data[4]
  1119.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1120.     hit_count = 0
  1121.     miss_count = 0
  1122.     for target in targets
  1123.       hit_count += 1 if target.skill_learn?($data_skills[@action_data[2]]) && target.skill_conditions_met?($data_skills[@action_data[2]])
  1124.       miss_count += 1 if !target.skill_learn?($data_skills[@action_data[2]]) or !target.skill_conditions_met?($data_skills[@action_data[2]])
  1125.     end
  1126.     case @action_data[3]
  1127.     when 0 ; judgment = hit_count >= member_num
  1128.     when 1 ; judgment = miss_count >= member_num
  1129.     end
  1130.     action_diverging(judgment, @action_data[5])
  1131.   end  
  1132.   #--------------------------------------------------------------------------
  1133.   # ● 条件分岐 (パラメータ)
  1134.   #--------------------------------------------------------------------------
  1135.   def nece_5
  1136.     targets = N03.get_targets(@action_data[1], @battler)
  1137.     return if targets == []
  1138.     member_num = @action_data[5]
  1139.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1140.     hit_count = 0
  1141.     for target in targets
  1142.       hit_count += 1 if target.comparison_parameter([@action_data[2],@action_data[3],@action_data[4]])
  1143.     end
  1144.     judgment = hit_count >= member_num
  1145.     action_diverging(judgment, @action_data[6])
  1146.   end  
  1147.   #--------------------------------------------------------------------------
  1148.   # ● 条件分岐 (装備)
  1149.   #--------------------------------------------------------------------------
  1150.   def nece_6
  1151.     targets = N03.get_targets(@action_data[1], @battler)
  1152.     return if targets == []
  1153.     member_num = @action_data[5]
  1154.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1155.     hit_count = 0
  1156.     miss_count = 0
  1157.     for target in targets
  1158.       hit_count += 1 if target.comparison_equip([@action_data[2],@action_data[3]])
  1159.       miss_count += 1 if !target.comparison_equip([@action_data[2],@action_data[3]])
  1160.     end
  1161.     case @action_data[4]
  1162.     when 0 ; judgment = hit_count >= member_num
  1163.     when 1 ; judgment = miss_count >= member_num
  1164.     end
  1165.     action_diverging(judgment, @action_data[6])
  1166.   end  
  1167.   #--------------------------------------------------------------------------
  1168.   # ● 条件分岐 (スクリプト)
  1169.   #--------------------------------------------------------------------------
  1170.   def nece_7
  1171.     judgment = eval(@action_data[2])
  1172.     action_diverging(judgment, @action_data[1])
  1173.   end  
  1174.   #--------------------------------------------------------------------------
  1175.   # ● アクション分岐  
  1176.   #--------------------------------------------------------------------------
  1177.   def action_diverging(judgment, kind)
  1178.     result = 0
  1179.     if judgment
  1180.       result = 1 if kind == 1
  1181.       result = 2 if kind == 2
  1182.     else
  1183.       result = 1 if kind == 0
  1184.     end
  1185.     # フルアクション終了
  1186.     return @full_action = []  if result == 2
  1187.     # 次のアクションを除去
  1188.     @full_action.shift if result == 1
  1189.     set_action
  1190.     # 次のアクションを実行
  1191.     @action_data = N03::ACTION[@action]
  1192.     next_action
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # ● セカンドターゲット操作
  1196.   #--------------------------------------------------------------------------
  1197.   def second_targets_set
  1198.     targets = N03.get_targets(@action_data[1], @battler)
  1199.     for target in targets
  1200.       targets.delete(target) if @action_data[2][1] == 1 && target.index != @action_data[2][0]
  1201.       targets.delete(target) if @action_data[2][1] == 2 && target.index == @action_data[2][0].abs
  1202.       targets.delete(target) if @action_data[3] > 0 && target.id != @action_data[3]
  1203.       targets.delete(target) if @action_data[3] < 0 && target.id == @action_data[3].abs
  1204.       targets.delete(target) if @action_data[4] > 0 && !target.state?(@action_data[4])
  1205.       targets.delete(target) if @action_data[4] < 0 && target.state?(@action_data[4].abs)
  1206.       targets.delete(target) if @action_data[5] > 0 && !target.skill_conditions_met?($data_skills[@action_data[5]])
  1207.       targets.delete(target) if @action_data[5] < 0 && target.skill_conditions_met?($data_skills[@action_data[5].abs])
  1208.       targets.delete(target) if !target.comparison_parameter(@action_data[6])
  1209.       targets.delete(target) if !@action_data[7][1].include?(0) && !target.comparison_equip(@action_data[7])
  1210.     end
  1211.     return @second_targets = [] if targets.size == 0
  1212.     case @action_data[8]
  1213.     when 1 ; targets = [targets[rand(targets.size)]]
  1214.     when 2 ; targets.delete(@battler)
  1215.     end
  1216.     return @second_targets = [] if targets.size == 0
  1217.     @second_targets = targets
  1218.     case @action_data[9]
  1219.     when 0 ; return
  1220.     when 1 ; set_play_data(["second_targets_set"])
  1221.     when 2 ; set_play_data(["targets_set"])
  1222.     end
  1223.     @wait += 1
  1224.   end
  1225.   #--------------------------------------------------------------------------
  1226.   # ● コモンイベント呼び出し
  1227.   #--------------------------------------------------------------------------
  1228.   def call_common_event
  1229.     $game_temp.reserve_common_event(@action_data[1])
  1230.     $sv_camera.event = true
  1231.     @event_fix = @action_data[2]
  1232.   end
  1233.   #--------------------------------------------------------------------------
  1234.   # ● ダメージアニメ
  1235.   #--------------------------------------------------------------------------
  1236.   def damage_anime(delay_time = 12)
  1237.     anime(N03.get_attack_anime_id(-3, @battler), wait = true)
  1238.     action_play
  1239.     @wait -= delay_time
  1240.     @full_action.unshift("eval('@damage_anime_data = []
  1241.     @set_damage = true')")
  1242.   end
  1243.   #--------------------------------------------------------------------------
  1244.   # ● 通常コラプス
  1245.   #--------------------------------------------------------------------------
  1246.   def normal_collapse
  1247.     @collapse = true
  1248.     return
  1249.   end
  1250.   #--------------------------------------------------------------------------
  1251.   # ● 初期位置変更
  1252.   #--------------------------------------------------------------------------
  1253.   def change_base_position
  1254.     @base_x = @x
  1255.     @base_y = @y
  1256.     @base_h = @h
  1257.   end  
  1258.   #--------------------------------------------------------------------------
  1259.   # ● 強制アクション実行
  1260.   #--------------------------------------------------------------------------
  1261.   def force_act
  1262.     target(@full_action.shift)
  1263.   end
  1264.   #--------------------------------------------------------------------------
  1265.   # ● 強制アクション実行 (セカンドターゲット)
  1266.   #--------------------------------------------------------------------------
  1267.   def force_act2
  1268.     target2(@full_action.shift)
  1269.   end
  1270.   #--------------------------------------------------------------------------
  1271.   # ● 個別処理開始
  1272.   #--------------------------------------------------------------------------
  1273.   def individual_start
  1274.     @individual_targets = @target_battler.dup
  1275.     @remain_targets = @target_battler.dup
  1276.     @target_battler = [@individual_targets[0]]
  1277.     # リピート部分のアクションを保持
  1278.     @individual_act = @full_action.dup
  1279.   end
  1280.   #--------------------------------------------------------------------------
  1281.   # ● 個別処理終了
  1282.   #--------------------------------------------------------------------------
  1283.   def individual_end
  1284.     @individual_targets.shift
  1285.     for target in @individual_targets
  1286.       @individual_targets.shift if target.dead?
  1287.     end
  1288.     # ターゲットが残っているなら行動リピート
  1289.     return @target_battler = @remain_targets if @individual_targets.size == 0
  1290.     @full_action = @individual_act.dup
  1291.     @target_battler = [@individual_targets[0]]
  1292.   end
  1293.   #--------------------------------------------------------------------------
  1294.   # ● ループ開始
  1295.   #--------------------------------------------------------------------------
  1296.   def loop_start
  1297.     # ループ部分のアクションを保持
  1298.     @loop_act = @full_action.dup
  1299.   end
  1300.   #--------------------------------------------------------------------------
  1301.   # ● ループ終了
  1302.   #--------------------------------------------------------------------------
  1303.   def loop_end
  1304.     # 行動リピート
  1305.     @full_action = @loop_act.dup if @loop_act != []
  1306.   end
  1307.   #--------------------------------------------------------------------------
  1308.   # ● 次の行動者へ移行
  1309.   #--------------------------------------------------------------------------
  1310.   def next_battler
  1311.     @action_end = true
  1312.     @active = false
  1313.   end
  1314.   #--------------------------------------------------------------------------
  1315.   # ● 画像変更フラグ
  1316.   #--------------------------------------------------------------------------
  1317.   def set_change
  1318.     @change_up = true
  1319.   end
  1320.   #--------------------------------------------------------------------------
  1321.   # ● 戦闘シーン通信
  1322.   #--------------------------------------------------------------------------
  1323.   def play_data
  1324.     data = @play_data
  1325.     @play_data = []
  1326.     return data
  1327.   end
  1328.   #--------------------------------------------------------------------------
  1329.   # ● ショートカットコマンド
  1330.   #--------------------------------------------------------------------------
  1331.   def anime(anime_id, wait = true)
  1332.     @action_data = ["anime",anime_id,1,false,wait,false,true,false]
  1333.   end
  1334.   def anime_me(anime_id, wait = true)
  1335.     @action_data = ["anime",anime_id,0,false,wait,false,true,false]
  1336.   end
  1337.   def se(file, pitch = 100)
  1338.     @action_data = ["sound",  "se", pitch, 100, file]
  1339.   end
  1340.   def target(act)
  1341.     for target in @target_battler do target.sv.force_action = act end
  1342.   end
  1343.   def target2(act)
  1344.     for target in @second_targets do target.sv.force_action = act end
  1345.   end
  1346.   def delay(time)
  1347.     @wait = @battler.index * time
  1348.   end
  1349.   #--------------------------------------------------------------------------
  1350.   # ● バトラーのIDを取得
  1351.   #--------------------------------------------------------------------------
  1352.   def id
  1353.     return @battler.id if @battler.actor?
  1354.     return [email]-@battler.id[/email]
  1355.   end
  1356.   #--------------------------------------------------------------------------
  1357.   # ● 被クリティカルフラグを取得
  1358.   #--------------------------------------------------------------------------
  1359.   def critical?
  1360.     return @battler.result.critical
  1361.   end
  1362.   #--------------------------------------------------------------------------
  1363.   # ● 被回復フラグを取得
  1364.   #--------------------------------------------------------------------------
  1365.   def recovery?
  1366.     recovery = false
  1367.     recovery = true if @battler.result.hp_damage < 0
  1368.     recovery = true if @battler.result.mp_damage < 0
  1369.     recovery = true if @battler.result.tp_damage < 0
  1370.     return recovery
  1371.   end
  1372.   #--------------------------------------------------------------------------
  1373.   # ● 被スキルIDを取得
  1374.   #--------------------------------------------------------------------------
  1375.   def damage_skill_id
  1376.     return @damage_skill_id
  1377.   end
  1378.   #--------------------------------------------------------------------------
  1379.   # ● 被アイテムIDを取得
  1380.   #--------------------------------------------------------------------------
  1381.   def damage_item_id
  1382.     return @damage_item_id
  1383.   end
  1384.   #--------------------------------------------------------------------------
  1385.   # ● 装備武器を取得
  1386.   #--------------------------------------------------------------------------
  1387.   def weapon_id
  1388.     return 0 if !@battler.weapons[0]
  1389.     return @battler.weapons[0].id
  1390.   end
  1391.   #--------------------------------------------------------------------------
  1392.   # ● 装備武器のタイプを取得
  1393.   #--------------------------------------------------------------------------
  1394.   def weapon_type
  1395.     return 0 if !@battler.weapons[0]
  1396.     return @battler.weapons[0].wtype_id
  1397.   end
  1398.   #--------------------------------------------------------------------------
  1399.   # ● 盾を装備しているか
  1400.   #--------------------------------------------------------------------------
  1401.   def shield?
  1402.     for armor in @battler.armors do return true if armor != nil && armor.etype_id == 1 end
  1403.     return false
  1404.   end
  1405.   #--------------------------------------------------------------------------
  1406.   # ● ダメージがあるか
  1407.   #--------------------------------------------------------------------------
  1408.   def damage_zero?
  1409.     return @battler.result.hp_damage == 0 && @battler.result.mp_damage == 0 && @battler.result.tp_damage == 0
  1410.   end
  1411.   #--------------------------------------------------------------------------
  1412.   # ● スキルIDを取得
  1413.   #--------------------------------------------------------------------------
  1414.   def skill_id
  1415.     return @counter_id if @counter_id != 0
  1416.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1417.     return 0 if @battler.current_action.item.is_a?(RPG::Item)
  1418.     return @battler.current_action.item.id
  1419.   end
  1420.   #--------------------------------------------------------------------------
  1421.   # ● スキルのタイプを取得
  1422.   #--------------------------------------------------------------------------
  1423.   def skill_type
  1424.     return 0 if skill_id == 0
  1425.     return $data_skills[skill_id].stype_id
  1426.   end
  1427.   #--------------------------------------------------------------------------
  1428.   # ● スキル名を取得
  1429.   #--------------------------------------------------------------------------
  1430.   def skill_name
  1431.     return "" if skill_id == 0
  1432.     return $data_skills[skill_id].name
  1433.   end
  1434.   #--------------------------------------------------------------------------
  1435.   # ● アイテムIDを取得
  1436.   #--------------------------------------------------------------------------
  1437.   def item_id
  1438.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1439.     return @battler.current_action.item.id
  1440.   end
  1441.   #--------------------------------------------------------------------------
  1442.   # ● 攻撃アクション
  1443.   #--------------------------------------------------------------------------
  1444.   def attack_action(item)
  1445.     return skill_action if item.is_a?(RPG::Skill)
  1446.     return item_action
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # ● ダメージアクションベース
  1450.   #--------------------------------------------------------------------------
  1451.   def damage_action_base(item)
  1452.     @damage_skill_id = 0
  1453.     @damage_item_id = 0
  1454.     @damage_skill_id = item.id if item.is_a?(RPG::Skill)
  1455.     @damage_item_id = item.id if item.is_a?(RPG::Item)
  1456.   end  
  1457.   #--------------------------------------------------------------------------
  1458.   # ● ダメージアクション
  1459.   #--------------------------------------------------------------------------
  1460.   def damage_action(attacker, item)
  1461.     damage_action_base(item)
  1462.     act = damage(attacker)
  1463.     return if @active
  1464.     start_action(act) if act != nil
  1465.   end
  1466.   #--------------------------------------------------------------------------
  1467.   # ● 回避アクション
  1468.   #--------------------------------------------------------------------------
  1469.   def evasion_action(attacker, item)
  1470.     damage_action_base(item)
  1471.     act = evasion(attacker)
  1472.     return if @active
  1473.     start_action(act) if act != nil
  1474.   end
  1475.   #--------------------------------------------------------------------------
  1476.   # ● ミスアクション
  1477.   #--------------------------------------------------------------------------
  1478.   def miss_action(attacker, item)
  1479.     damage_action_base(item)
  1480.     act = miss(attacker)
  1481.     return if @active
  1482.     start_action(act) if act != nil
  1483.   end
  1484.   #--------------------------------------------------------------------------
  1485.   # ● 閃きスクリプト併用処理
  1486.   #--------------------------------------------------------------------------
  1487.   def flash_action
  1488.     return "閃き"
  1489.   end
  1490.  
  1491. end
  1492.  
  1493.  
  1494. #==============================================================================
  1495. # ■ module N03
  1496. #------------------------------------------------------------------------------
  1497. #  サイドビューバトルのモジュールです。
  1498. #==============================================================================
  1499. module N03
  1500.   #--------------------------------------------------------------------------
  1501.   # ● バトラーの敵グループを取得
  1502.   #--------------------------------------------------------------------------
  1503.   def self.get_enemy_unit(battler)
  1504.     return $game_troop if battler.actor?
  1505.     return $game_party
  1506.   end
  1507.   #--------------------------------------------------------------------------
  1508.   # ● バトラーの味方グループを取得
  1509.   #--------------------------------------------------------------------------
  1510.   def self.get_party_unit(battler)
  1511.     return $game_party if battler.actor?
  1512.     return $game_troop
  1513.   end
  1514.   #--------------------------------------------------------------------------
  1515.   # ● 戦闘アニメ時間の取得
  1516.   #--------------------------------------------------------------------------
  1517.   def self.get_anime_time(anime_id)
  1518.     return 0 if anime_id <= 0
  1519.     return $data_animations[anime_id].frame_max * 4
  1520.   end
  1521.   #--------------------------------------------------------------------------
  1522.   # ● 攻撃アニメの取得
  1523.   #--------------------------------------------------------------------------
  1524.   def self.get_attack_anime_id(kind, battler)
  1525.     return $data_skills[battler.sv.counter_id].animation_id if kind == -3 && battler.sv.counter_id != 0
  1526.     case kind
  1527.     when -1 ; anime_id = battler.atk_animation_id1
  1528.     when -2 ; anime_id = battler.atk_animation_id2
  1529.     when -3
  1530.       if battler.current_action != nil
  1531.         anime_id = battler.current_action.item.animation_id if battler.current_action.item != nil
  1532.       end
  1533.     else    ; anime_id = kind
  1534.     end
  1535.     case anime_id
  1536.     when -1 ; anime_id = battler.atk_animation_id1
  1537.     when -2 ; anime_id = battler.atk_animation_id2
  1538.     end
  1539.     return anime_id if anime_id
  1540.     return 0
  1541.   end  
  1542.   #--------------------------------------------------------------------------
  1543.   # ● 戦闘アニメデータをセット
  1544.   #--------------------------------------------------------------------------
  1545.   def self.set_damage_anime_data(targets, target, data)
  1546.     return if !first_of_all_screen_anime(data[0], target, targets)
  1547.     target.animation_id         = data[0]
  1548.     target.animation_mirror     = data[1]
  1549.     target.sv.anime_no_mirror   = data[2]
  1550.     target.sv.anime_camera_zoom = data[3]
  1551.     target.sv.anime_plus_z      = data[4]
  1552.   end   
  1553.   #--------------------------------------------------------------------------
  1554.   # ● ターゲットの取得
  1555.   #--------------------------------------------------------------------------
  1556.   def self.get_targets(kind, battler)
  1557.     case kind.abs
  1558.     when 0 ; return [battler].dup
  1559.     when 1 ; return battler.sv.target_battler.dup
  1560.     when 2 ; return get_enemy_unit(battler).members.dup
  1561.     when 3 ; return get_party_unit(battler).members.dup
  1562.     when 4 ; return $game_troop.members.dup + $game_party.battle_members.dup
  1563.     when 5 ; return battler.sv.second_targets.dup
  1564.     end
  1565.   end  
  1566.   #--------------------------------------------------------------------------
  1567.   # ● ターゲットの座標を取得
  1568.   #--------------------------------------------------------------------------
  1569.   def self.get_targets_position(targets, horming, m_a = nil)
  1570.     return [0,0,0] if targets == nil && !$sv_camera.mirror
  1571.     return [Graphics.width,0,0] if targets == nil && $sv_camera.mirror
  1572.     x = y = h = 0
  1573.     for i in 0...targets.size
  1574.       x += targets[i].sv.base_x if !horming
  1575.       y += targets[i].sv.base_y if !horming
  1576.       h += targets[i].sv.base_h if !horming
  1577.       x += targets[i].sv.x if horming
  1578.       y += targets[i].sv.y if horming
  1579.       h += targets[i].sv.h if horming
  1580.       y -= targets[i].sv.ch * 100 if m_a == 0
  1581.       y -= targets[i].sv.ch * 50 if m_a == 1
  1582.     end
  1583.     return [x / targets.size, y / targets.size, h / targets.size]
  1584.   end
  1585.   #--------------------------------------------------------------------------
  1586.   # ● 速度を時間に変換
  1587.   #--------------------------------------------------------------------------
  1588.   def self.distanse_calculation(time, target_position, self_position, distanse_move)
  1589.     return time if !distanse_move
  1590.     distanse_x = self_position[0] - target_position[0]
  1591.     distanse_x = target_position[0] - self_position[0] if target_position[0] > self_position[0]
  1592.     distanse_y = self_position[1] - target_position[1]
  1593.     distanse_y = target_position[1] - self_position[1] if target_position[1] > self_position[1]
  1594.     if self_position[2] != nil && target_position[2] != nil
  1595.       distanse_h = self_position[2] - target_position[2]
  1596.       distanse_h = target_position[2] - self_position[2] if target_position[2] > self_position[2]
  1597.     else
  1598.       distanse_h = 0
  1599.     end
  1600.     distanse = [distanse_x, distanse_y, distanse_h].max
  1601.     return distanse / (time * 100) + 1
  1602.   end
  1603.   #--------------------------------------------------------------------------
  1604.   # ● 放物線移動計算
  1605.   #--------------------------------------------------------------------------
  1606.   def self.parabola(data, time, size, type = 1)
  1607.     move_data = data
  1608.     move_data[0] *= size
  1609.     move_data[1] *= size
  1610.     move = []
  1611.     move_d = []
  1612.     for i in 0...time / 2
  1613.       move[i] = move_data[0]
  1614.       move_d[i] = move_data[1]
  1615.       move_data[0] = move_data[0] * type / (1 + type)
  1616.       move_data[1] = move_data[1] * type / (1 + type)
  1617.     end
  1618.     move = move + move_d.reverse!
  1619.     move.reverse!
  1620.     adjust = move.inject(0) {|result, item| result + item }
  1621.     move[move.size - 1] += adjust if data[0] == data[1] && adjust != 0
  1622.     move.unshift(0) if time % 2 != 0
  1623.     return move
  1624.   end
  1625.   #--------------------------------------------------------------------------
  1626.   # ● 反転値
  1627.   #--------------------------------------------------------------------------
  1628.   def self.mirror_num(mirror)
  1629.     return 1 if !mirror
  1630.     return -1
  1631.   end  
  1632.   #--------------------------------------------------------------------------
  1633.   # ● カメラワーク
  1634.   #--------------------------------------------------------------------------
  1635.   def self.camera(battler, data)
  1636.     battler = $game_party.battle_members[0] if !battler
  1637.     cx = data[2][0] * 100
  1638.     cy = data[2][1] * 100
  1639.     return $sv_camera.move(cx, cy, data[3], data[4], true) if data[1] == 6
  1640.     targets = self.get_targets(data[1], battler)
  1641.     return if targets == nil or targets == []
  1642.     position = self.get_targets_position(targets, true)
  1643.     $sv_camera.move(position[0], position[1] - position[2], data[3], data[4], false)
  1644.   end
  1645.   #--------------------------------------------------------------------------
  1646.   # ● コラプス禁止
  1647.   #--------------------------------------------------------------------------
  1648.   def self.immortaling
  1649.     # 全員に不死身付与
  1650.     for member in $game_party.battle_members + $game_troop.members
  1651.       # イベント操作等で不死身設定になっていたら解除を無効にするフラグを立てる
  1652.       member.sv.immortal = true if member.state?(N03::IMMORTAL_ID)
  1653.       member.add_state(N03::IMMORTAL_ID)
  1654.     end
  1655.     return true
  1656.   end  
  1657.   #--------------------------------------------------------------------------
  1658.   # ● コラプス許可
  1659.   #--------------------------------------------------------------------------
  1660.   def self.unimmortaling
  1661.     # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
  1662.     for member in $game_party.battle_members + $game_troop.members
  1663.       next if member.dead?
  1664.       # 不死身ステートが行動中に解除されていた場合、解除無効を解除
  1665.       member.sv.immortal = false if !member.state?(N03::IMMORTAL_ID) && member.sv.immortal
  1666.       next member.sv.immortal = false if member.sv.immortal
  1667.       member.remove_state(N03::IMMORTAL_ID)
  1668.       next if member.hp != 0
  1669.       member.add_state(1)
  1670.       member.perform_collapse_effect
  1671.       member.sv.action_terminate
  1672.     end
  1673.     return false
  1674.   end  
  1675.   #--------------------------------------------------------------------------
  1676.   # ● スキル派生
  1677.   #--------------------------------------------------------------------------
  1678.   def self.derived_skill(battler)
  1679.     battler.force_action(battler.sv.derivation_skill_id, -2)
  1680.     BattleManager.unshift_action_battlers(battler)
  1681.   end
  1682.   #--------------------------------------------------------------------------
  1683.   # ● ダメージの作成
  1684.   #--------------------------------------------------------------------------
  1685.   def self.set_damage(battler, hp_damage, mp_damage)
  1686.     battler.result.hp_damage = hp_damage
  1687.     battler.result.mp_damage = mp_damage
  1688.   end
  1689.   #--------------------------------------------------------------------------
  1690.   # ● ターゲット生死確認
  1691.   #--------------------------------------------------------------------------
  1692.   def self.targets_alive?(targets)
  1693.     return false if targets == []
  1694.     for target in targets do return true if !target.dead? end
  1695.     return false
  1696.   end
  1697.   #--------------------------------------------------------------------------
  1698.   # ● ターゲットをセカンドターゲットへ
  1699.   #--------------------------------------------------------------------------
  1700.   def self.s_targets(battler)
  1701.     battler.sv.target_battler = battler.sv.second_targets
  1702.     return battler.sv.second_targets
  1703.   end  
  1704.   #--------------------------------------------------------------------------
  1705.   # ● セカンドターゲットをターゲットへ
  1706.   #--------------------------------------------------------------------------
  1707.   def self.targets_set(battler)
  1708.     battler.sv.second_targets = battler.current_action.make_targets.compact
  1709.     battler.sv.target_battler = battler.sv.second_targets
  1710.   end  
  1711.   #--------------------------------------------------------------------------
  1712.   # ● 戦闘アニメ実行判定 (対象:画面時は最初のターゲットのみアニメ実行)
  1713.   #--------------------------------------------------------------------------
  1714.   def self.first_of_all_screen_anime(anime_id, target, targets)
  1715.     anime = $data_animations[anime_id]
  1716.     return false if !anime
  1717.     return true if anime.position != 3
  1718.     return false if anime.position == 3 && target != targets[0]
  1719.     targets.delete(target)
  1720.     target.sv.timing_targets = targets
  1721.     return true
  1722.   end
  1723.   #--------------------------------------------------------------------------
  1724.   # ● 戦闘不能付加攻撃か
  1725.   #--------------------------------------------------------------------------
  1726.   def self.dead_attack?(battler, item)
  1727.     for state in battler.atk_states
  1728.       return true if state == battler.death_state_id
  1729.     end
  1730.     for effect in item.effects
  1731.       return true if effect.code == 21 && effect.data_id == battler.death_state_id
  1732.     end
  1733.     return false
  1734.   end
  1735. end
  1736.  
  1737. #==============================================================================
  1738. # ■ Sprite_Weapon
  1739. #------------------------------------------------------------------------------
  1740. #  ウエポン表示用のスプライトです。
  1741. #==============================================================================
  1742. class Sprite_Weapon < Sprite_Base
  1743.   #--------------------------------------------------------------------------
  1744.   # ● 公開インスタンス変数 
  1745.   #--------------------------------------------------------------------------
  1746.   attr_reader   :index                       # ウエポン画像配列のインデックス
  1747.   attr_reader   :battler                     # 画像が参照しているバトラー
  1748.   attr_reader   :move_time                   # 画像が目標に到達するまでの時間
  1749.   attr_reader   :through                     # 貫通フラグ
  1750.   attr_reader   :action_end                  # 武器アクション終了フラグ
  1751.   attr_reader   :action_end_cancel                  # 武器アクション終了フラグ
  1752.   attr_reader   :hit_position                # 画像が目標に到達した時の座標
  1753.   attr_accessor :hit_anime_id                # 画像が目標に到達した時のアニメID
  1754.   #--------------------------------------------------------------------------
  1755.   # ● オブジェクト初期化
  1756.   #--------------------------------------------------------------------------
  1757.   def initialize(viewport, index, battler)
  1758.     super(viewport)
  1759.     @index = index
  1760.     @battler = battler
  1761.     @position_x = @position_y = 0
  1762.     @o = 0
  1763.     @real_x = @real_y = 0
  1764.     @mirror = @battler.sv.mirror
  1765.     reset
  1766.     set_action
  1767.   end
  1768.   #--------------------------------------------------------------------------
  1769.   # ● 初期化
  1770.   #--------------------------------------------------------------------------
  1771.   def reset
  1772.     @z_plus = 0
  1773.     @weapon_data = []
  1774.     @move_data = []
  1775.     @move_x = 0
  1776.     @move_y = 0
  1777.     @orbit = []
  1778.     @through = false
  1779.     @distanse_move = false
  1780.     @weapon_width = 0
  1781.     @weapon_height = 0
  1782.     @anime_time = 0
  1783.     @anime_position = 1
  1784.     @move_time = 0
  1785.     @hit_anime_id = 0
  1786.     @move_anime = true
  1787.     @action_end = false
  1788.     @action_end_cancel = false
  1789.     reset_position
  1790.   end  
  1791.   #--------------------------------------------------------------------------
  1792.   # ● アクションをセット
  1793.   #--------------------------------------------------------------------------
  1794.   def set_action
  1795.     return if @battler.sv.effect_data == []
  1796.     weapon_anime if @battler.sv.effect_data[0][0] == "wp"
  1797.     move_anime if @battler.sv.effect_data[0][0] == "m_a"
  1798.     @battler.sv.effect_data.shift
  1799.   end
  1800.   #--------------------------------------------------------------------------
  1801.   # ● 武器アニメ実行
  1802.   #--------------------------------------------------------------------------
  1803.   def weapon_anime
  1804.     @weapon_data = @battler.sv.effect_data[0].dup
  1805.     set_graphics
  1806.     set_ox
  1807.     set_weapon_move
  1808.   end
  1809.   #--------------------------------------------------------------------------
  1810.   # ● アニメ移動実行
  1811.   #--------------------------------------------------------------------------
  1812.   def move_anime
  1813.     @move_data = @battler.sv.effect_data[0].dup
  1814.     # ターゲットを取得
  1815.     @target_battler = [@battler.sv.m_a_targets.shift]
  1816.     @target_battler = N03.get_targets(@move_data[3], @battler) if @move_data[3] < 0
  1817.     set_move
  1818.     return if @move_data[16] == ""
  1819.     weapon_data = N03::ACTION[@move_data[16]]
  1820.     return if weapon_data == nil
  1821.     @weapon_data = weapon_data.dup
  1822.     set_graphics
  1823.     set_ox
  1824.     set_weapon_move
  1825.   end
  1826.   #--------------------------------------------------------------------------
  1827.   # ● 武器画像を取得
  1828.   #--------------------------------------------------------------------------  
  1829.   def set_graphics
  1830.     # 武器に依存しない画像設定がある場合
  1831.     if @weapon_data[13] != ""
  1832.       self.bitmap = Cache.character(@weapon_data[13]).dup
  1833.       @weapon_width = self.bitmap.width
  1834.       @weapon_height = self.bitmap.height
  1835.       return
  1836.     end
  1837.     # 武器を取得
  1838.     weapon = @battler.weapons[0]
  1839.     # 逆手装備を取得
  1840.     if @weapon_data[10]
  1841.       weapon = nil
  1842.       for armor in @battler.armors do break weapon = armor if armor.is_a?(RPG::Armor) && armor.etype_id == 1 end
  1843.       weapon = @battler.weapons[1] if !weapon
  1844.     end  
  1845.     # 武器がなければ処理をキャンセル
  1846.     return if weapon == nil
  1847.     # インデックスを取得
  1848.     file_index = @weapon_data[12]
  1849.     # アイコンを利用するなら
  1850.     if @weapon_data[1] == 0
  1851.       icon_index = weapon.icon_index
  1852.       self.bitmap = Cache.system("Iconset" + file_index).dup
  1853.       self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1854.       @weapon_width = @weapon_height = 24
  1855.     # 独自画像指定
  1856.     else
  1857.       file_name = @battler.sv.weapon_graphic(weapon.id, weapon.wtype_id) if weapon.is_a?(RPG::Weapon)
  1858.       file_name = @battler.sv.shield_graphic(weapon.id, weapon.atype_id) if weapon.is_a?(RPG::Armor)
  1859.       self.bitmap = Cache.character(file_name + file_index).dup
  1860.       @weapon_width = self.bitmap.width
  1861.       @weapon_height = self.bitmap.height
  1862.       return if @weapon_data[1] == 1
  1863.       # 2003仕様の武器アニメ
  1864.       @weapon_width /= @battler.sv.max_pattern[0]
  1865.     end
  1866.   end
  1867.   #--------------------------------------------------------------------------
  1868.   # ● 画像の原点を取得
  1869.   #--------------------------------------------------------------------------  
  1870.   def set_ox
  1871.     # 反転時は設定を逆に
  1872.     if @mirror
  1873.       case @weapon_data[6]
  1874.       when 1 ; @weapon_data[6] = 2 # 左上→右上に
  1875.       when 2 ; @weapon_data[6] = 1 # 右上→左上に
  1876.       when 3 ; @weapon_data[6] = 4 # 左下→右下に
  1877.       when 4 ; @weapon_data[6] = 3 # 右下→左下に
  1878.       end
  1879.     end
  1880.     # 原点を設定
  1881.     case @weapon_data[6]
  1882.     when 0 # 中心
  1883.       self.ox = @weapon_width / 2
  1884.       self.oy = @weapon_height / 2
  1885.     when 1 # 左上
  1886.       self.ox = 0
  1887.       self.oy = 0
  1888.     when 2 # 右上
  1889.       self.ox = @weapon_width
  1890.       self.oy = 0
  1891.     when 3 # 左下
  1892.       self.ox = 0
  1893.       self.oy = @weapon_height
  1894.     when 4 # 右下
  1895.       self.ox = @weapon_width
  1896.       self.oy = @weapon_height
  1897.     when 5 # バトラーと同じ
  1898.       self.ox = @weapon_width / 2
  1899.       self.oy = @weapon_height
  1900.     end
  1901.   end  
  1902.   #--------------------------------------------------------------------------
  1903.   # ● バトラーの座標を取得
  1904.   #--------------------------------------------------------------------------  
  1905.   def set_battler_position
  1906.     @position_x = @battler.sv.x + @weapon_data[3][0] * N03.mirror_num(@mirror) * 100
  1907.     @position_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust) + @weapon_data[3][1] * 100
  1908.     reset_position
  1909.   end
  1910.   #--------------------------------------------------------------------------
  1911.   # ● 座標を初期化
  1912.   #--------------------------------------------------------------------------  
  1913.   def reset_position
  1914.     @real_x = @position_x / 100
  1915.     @real_y = @position_y / 100
  1916.     @real_zoom_x = 1
  1917.     @real_zoom_y = 1
  1918.   end
  1919.   #--------------------------------------------------------------------------
  1920.   # ● 戦闘アニメを表示
  1921.   #--------------------------------------------------------------------------  
  1922.   def set_animation(anime_id)
  1923.     return if $data_animations[anime_id] == nil
  1924.     @anime_position = $data_animations[anime_id].position
  1925.     @horming = true
  1926.     @horming = false if @anime_position == 3
  1927.     @anime_camera_zoom = true
  1928.     @anime_no_mirror = false
  1929.     start_animation($data_animations[anime_id], @mirror)
  1930.     timings = $data_animations[anime_id].timings
  1931.   end
  1932.   #--------------------------------------------------------------------------
  1933.   # ● ヒット時の戦闘アニメ実行
  1934.   #--------------------------------------------------------------------------  
  1935.   def set_hit_animation(position_data, hit_anime_id, target)
  1936.     return if $data_animations[hit_anime_id] == nil
  1937.     @real_x = position_data[0]
  1938.     @real_y = position_data[1]
  1939.     @position_x = position_data[0] * 100
  1940.     @position_y = position_data[1] * 100
  1941.     self.z = position_data[2]
  1942.     @z_plus = 1000
  1943.     @action_end = false
  1944.     @horming = true
  1945.     set_animation(hit_anime_id)
  1946.     @anime_time = $data_animations[hit_anime_id].frame_max * 4
  1947.     @timing_targets = [target]
  1948.     @move_time = @hit_anime_id = 0
  1949.     @weapon_data = []
  1950.   end
  1951.   #--------------------------------------------------------------------------
  1952.   # ● タイミングバトラー追加
  1953.   #--------------------------------------------------------------------------  
  1954.   def timing_battler_set(target)
  1955.     @timing_targets.push(target)
  1956.   end
  1957.   #--------------------------------------------------------------------------
  1958.   # ● 武器の動きを取得
  1959.   #--------------------------------------------------------------------------  
  1960.   def set_weapon_move
  1961.     # 開始位置を取得
  1962.     set_battler_position if @move_time == 0
  1963.     @z_plus = 50 if @z_plus == 0 && @weapon_data[9]
  1964.     self.z = @battler.sv.z + @z_plus
  1965.     # 反転処理
  1966.     @mirror = !@mirror if @weapon_data[7]
  1967.     self.mirror = @mirror
  1968.     # 更新パターンをセット
  1969.     set_pattern
  1970.     @max_pattern = 2 if @max_pattern == 1
  1971.     # 動きを計算
  1972.     @weapon_move_data = []
  1973.     @weapon_angle_data = []
  1974.     @weapon_zoom_data = []
  1975.     num = N03.mirror_num(@mirror)
  1976.     for i in 0...@max_pattern
  1977.       move_data_x = @weapon_data[2][0] * num * 100 * i / (@max_pattern - 1)
  1978.       move_data_y = @weapon_data[2][1] * 100 * i / (@max_pattern - 1)
  1979.       move_angle = @weapon_data[4] * num + (@weapon_data[5] * num - @weapon_data[4] * num) * i / (@max_pattern - 1)
  1980.       move_zoom_x = 1 + (@weapon_data[8][0] - 1) * i / (@max_pattern - 1)
  1981.       move_zoom_y = 1 + (@weapon_data[8][1] - 1) * i / (@max_pattern - 1)
  1982.       @weapon_move_data.push([move_data_x, move_data_y])
  1983.       @weapon_angle_data.push(move_angle)
  1984.       @weapon_zoom_data.push([move_zoom_x, move_zoom_y])
  1985.     end
  1986.   end  
  1987.   #--------------------------------------------------------------------------
  1988.   # ● 更新パターン
  1989.   #--------------------------------------------------------------------------
  1990.   def set_pattern
  1991.     if @weapon_data[11] == -1
  1992.       return @max_pattern = @battler.sv.max_pattern[0] if @battler.sv.pattern_type != 0
  1993.       @count = @battler.sv.pattern_time
  1994.       @max_count = @battler.sv.pattern_time
  1995.       @max_pattern = @battler.sv.max_pattern[0]
  1996.       @repeat = false
  1997.     else
  1998.       @count = @weapon_data[11][0]
  1999.       @max_count = @weapon_data[11][0]
  2000.       @max_pattern = @weapon_data[11][1]
  2001.       @repeat = @weapon_data[11][2]
  2002.     end
  2003.     @pattern = 0
  2004.   end
  2005.   #--------------------------------------------------------------------------
  2006.   # ● 移動実行
  2007.   #--------------------------------------------------------------------------
  2008.   def set_move
  2009.     # 戦闘アニメを取得
  2010.     set_animation(@move_data[1][0]) if $data_animations[@move_data[1][0]] != nil && $data_animations[@move_data[1][0]].position != 3
  2011.     @anime_camera_zoom = @move_data[13]
  2012.     @loop = @move_data[14]
  2013.     @loop = false if @move_data[1][0] == 0
  2014.     @anime_no_mirror = @move_data[15]
  2015.     @se_flag = @move_data[17]
  2016.     # 開始位置を取得
  2017.     start_position
  2018.     @z_plus = 1000 if @move_data[9]
  2019.     # ターゲットバトラー画像にこのアニメのSEとタイミング設定を反映させる
  2020.     @timing_targets = @target_battler
  2021.     # 座標計算
  2022.     @move_x = @move_data[5][0] * 100 * N03.mirror_num(@mirror)
  2023.     @move_y = @move_data[5][1] * 100
  2024.     # 時間計算か速度計算か
  2025.     @distanse_move = true if @move_data[6] > 0
  2026.     @move_time = @move_data[6].abs
  2027.     # 時間0の場合、アニメが設定されていればアニメ表示時間に合わせる
  2028.     if @move_time == 0
  2029.       @move_time = $data_animations[@move_data[1][0]].frame_max * 4 if $data_animations[@move_data[1][0]]
  2030.       @move_time = 1 if !$data_animations[@move_data[1][0]]
  2031.       @distanse_move = false
  2032.     end
  2033.     # 貫通タイプの場合
  2034.     @through = true if @move_data[7] == 1
  2035.     @auto_through_flag = false
  2036.     @auto_through_flag = true if @move_data[7] == 0
  2037.     # ターゲット座標計算
  2038.     if @target_battler == nil
  2039.       @target_x = @move_x * 100
  2040.       @target_x = (Graphics.width - @move_x) * 100 if @mirror
  2041.       @target_y = @move_y * 100
  2042.     else
  2043.       move_data_set
  2044.     end
  2045.     # ターゲットに到達するまでの時間を計算
  2046.     @move_time = distanse_calculation(@move_time, @target_x, @target_y)
  2047.     # 円軌道計算
  2048.     orbit
  2049.     # バトラーのウエイト設定
  2050.     @battler.sv.wait = @move_time - 1 if @move_data[10][0]
  2051.     @move_horming = @move_data[12]
  2052.   end  
  2053.   #--------------------------------------------------------------------------
  2054.   # ● 速度を時間に変換
  2055.   #--------------------------------------------------------------------------
  2056.   def distanse_calculation(time, target_x, target_y)
  2057.     return time if !@distanse_move
  2058.     distanse_x = @position_x - @target_x
  2059.     distanse_x = @target_x - @position_x if @target_x > @position_x
  2060.     distanse_y = @position_y - @target_y
  2061.     distanse_y = @target_y - @position_y if @target_y > @position_y
  2062.     distanse = [distanse_x, distanse_y].max
  2063.     return distanse / (time * 100) + 1
  2064.   end
  2065.   #--------------------------------------------------------------------------
  2066.   # ● 移動目標の更新
  2067.   #--------------------------------------------------------------------------
  2068.   def move_data_set
  2069.     return if @target_battler == nil
  2070.     position = N03.get_targets_position(@target_battler, true, @anime_position)
  2071.     @target_x = position[0] + @move_x
  2072.     @target_y = position[1] - position[2] + @move_y
  2073.   end
  2074.   #--------------------------------------------------------------------------
  2075.   # ● 開始位置を計算
  2076.   #--------------------------------------------------------------------------
  2077.   def start_position
  2078.     starter = [@battler.sv.m_a_starter.shift]
  2079.     starter = N03.get_targets(@move_data[2], @battler) if @move_data[2] < 0
  2080.     position = [0, 0]
  2081.     position = N03.get_targets_position(starter, true, @anime_position) if starter != nil
  2082.     @position_x = position[0] + @move_data[4][0] * 100
  2083.     @position_y = position[1] + position[2] + @move_data[4][1] * 100
  2084.     @position_z = @position_y
  2085.   end  
  2086.   #--------------------------------------------------------------------------
  2087.   # ● 円軌道計算
  2088.   #--------------------------------------------------------------------------
  2089.   def orbit
  2090.     orbit_data = @move_data[8].dup
  2091.     orbit_data[0] *= 100
  2092.     orbit_data[1] *= 100
  2093.     orbit_d = []
  2094.     for i in 0...@move_time / 2
  2095.       @orbit[i] = orbit_data[0]
  2096.       orbit_data[0] /= 2
  2097.       orbit_d[i] = orbit_data[1]
  2098.       orbit_data[1] /= 2
  2099.     end
  2100.     @orbit = @orbit + orbit_d.reverse!
  2101.     @orbit.reverse!
  2102.   end  
  2103.   #--------------------------------------------------------------------------
  2104.   # ● フレーム更新
  2105.   #--------------------------------------------------------------------------
  2106.   def update
  2107.     update_hit_anime if @anime_time != 0
  2108.     update_move if @move_time != 0
  2109.     update_weapon_move if @weapon_data != []
  2110.     update_position
  2111.     update_color
  2112.     self.visible = @battler.sv.weapon_visible
  2113.     super
  2114.   end
  2115.   #--------------------------------------------------------------------------
  2116.   # ● ヒット時の戦闘アニメ
  2117.   #--------------------------------------------------------------------------
  2118.   def update_hit_anime
  2119.     @anime_time -= 1
  2120.     @action_end = true if @anime_time == 0
  2121.   end
  2122.   #--------------------------------------------------------------------------
  2123.   # ● 移動の更新
  2124.   #--------------------------------------------------------------------------
  2125.   def update_move
  2126.     move_data_set if @move_horming && !@hit_position
  2127.     through_set(@move_time, @target_x, @target_y) if @move_time == 1 && !@hit_position
  2128.     @o += @orbit[@move_time - 1] if @orbit[@move_time - 1] != nil
  2129.     @position_x = (@position_x * (@move_time - 1) + @target_x) / @move_time
  2130.     @position_y = (@position_y * (@move_time - 1) + @target_y) / @move_time + @o
  2131.     reset_position
  2132.     set_animation(@move_data[1][0]) if @loop && !animation?
  2133.     @move_time -= 1
  2134.     return if @move_time != 0
  2135.     @action_end = true if !@action_end_cancel
  2136.   end
  2137.   #--------------------------------------------------------------------------
  2138.   # ● 武器の動きを更新
  2139.   #--------------------------------------------------------------------------
  2140.   def update_weapon_move
  2141.     pattern = update_pattern
  2142.     set_battler_position if @move_time == 0 && !@action_end_cancel
  2143.     @real_x = @position_x / 100 + @weapon_move_data[pattern][0] / 100
  2144.     @real_y = @position_y / 100 + @weapon_move_data[pattern][1] / 100
  2145.     @real_zoom_x = @weapon_zoom_data[pattern][0]
  2146.     @real_zoom_y = @weapon_zoom_data[pattern][1]
  2147.     self.angle = @weapon_angle_data[pattern]
  2148.     self.src_rect.set(@weapon_width * pattern, 0, @weapon_width, @weapon_height) if @weapon_data[1] == 2
  2149.   end
  2150.   #--------------------------------------------------------------------------
  2151.   # ● パターンを更新
  2152.   #--------------------------------------------------------------------------
  2153.   def update_pattern
  2154.     return @battler.sv.pattern_w if @count == nil
  2155.     @count -= 1
  2156.     return @pattern if @count != 0
  2157.     @count = @max_count
  2158.     @pattern += 1
  2159.     if !@repeat && @pattern == @max_pattern
  2160.       @pattern = @max_pattern - 1
  2161.     elsif @pattern == @max_pattern
  2162.       @pattern = 0
  2163.     end
  2164.     return @pattern
  2165.   end
  2166.   #--------------------------------------------------------------------------
  2167.   # ● 座標を更新
  2168.   #--------------------------------------------------------------------------
  2169.   def update_position
  2170.     self.x = (@real_x - $sv_camera.x) * $sv_camera.convert / 1000
  2171.     self.y = (@real_y - $sv_camera.y) * $sv_camera.convert / 1000
  2172.     self.x += $sv_camera.sx / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2173.     self.y += $sv_camera.sy / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2174.     self.z = @battler.sv.z + @z_plus - 10
  2175.     self.zoom_x = @real_zoom_x * $sv_camera.zoom
  2176.     self.zoom_y = @real_zoom_y * $sv_camera.zoom
  2177.     self.opacity = @battler.sv.opacity if @battler.sv.opacity_data[4]
  2178.   end
  2179.   #--------------------------------------------------------------------------
  2180.   # ● 貫通の処理
  2181.   #--------------------------------------------------------------------------
  2182.   def through_set(time, target_x, target_y)
  2183.     @hit_anime_id = N03.get_attack_anime_id(@move_data[1][1], @battler)
  2184.     @battler.sv.wait = N03.get_anime_time(@hit_anime_id) if @move_data[10][1]
  2185.     moving_x = (target_x / 100 - @position_x / 100) / time
  2186.     moving_y = (target_y / 100 - @position_y / 100) / time
  2187.     goal_x = $sv_camera.max_left - 100 if moving_x < 0
  2188.     goal_x = Graphics.width + $sv_camera.max_right + 100 if moving_x > 0
  2189.     goal_y = $sv_camera.max_top - 100 if moving_y < 0
  2190.     goal_y = Graphics.height + $sv_camera.max_bottom + 100 if moving_y > 0
  2191.     if goal_x == nil &&  goal_y == nil
  2192.       time = 0
  2193.       reset_position
  2194.     else
  2195.       time = move_calculation(moving_x, moving_y, goal_x, goal_y)
  2196.     end
  2197.     target_x = @position_x + moving_x * time * 100
  2198.     target_y = @position_y + moving_y * time * 100
  2199.     @pre_data = [time, target_x, target_y]
  2200.     @battler.sv.m_a_data.push([@move_data[11], @target_battler, @index, @auto_through_flag, []])
  2201.     @action_end_cancel = true
  2202.     @hit_position = [@real_x, @real_y, self.z]
  2203.   end  
  2204.   #--------------------------------------------------------------------------
  2205.   # ● 到達時間試算
  2206.   #--------------------------------------------------------------------------
  2207.   def move_calculation(moving_x, moving_y, goal_x, goal_y)
  2208.     move_x = @position_x / 100
  2209.     move_y = @position_y / 100
  2210.     time = 0
  2211.     loop do
  2212.       move_x += moving_x
  2213.       move_y += moving_y
  2214.       time += 1
  2215.       return time if moving_x < 0 && move_x < goal_x
  2216.       return time if moving_x > 0 && move_x > goal_x
  2217.       return time if moving_y < 0 && move_y < goal_y
  2218.       return time if moving_y > 0 && move_y > goal_y
  2219.     end
  2220.   end   
  2221.   #--------------------------------------------------------------------------
  2222.   # ● ミス時に消える処理から貫通処理に変換
  2223.   #--------------------------------------------------------------------------
  2224.   def through_change
  2225.     @action_end_cancel = false
  2226.     @through = true
  2227.     @move_time = @pre_data[0]
  2228.     @target_x = @pre_data[1]
  2229.     @target_y = @pre_data[2]
  2230.     @pre_data = nil
  2231.   end  
  2232.   #--------------------------------------------------------------------------
  2233.   # ● SE とフラッシュのタイミング処理
  2234.   #--------------------------------------------------------------------------
  2235.   def animation_process_timing(timing)
  2236.     return if !@timing_targets
  2237.     se_flag = true
  2238.     se_flag = @se_flag if @se_flag != nil
  2239.     for target in @timing_targets
  2240.       target.sv.timing.push([se_flag, timing.dup])
  2241.       se_flag = false if @animation.position == 3
  2242.     end  
  2243.   end
  2244.   #--------------------------------------------------------------------------
  2245.   # ● 色調の更新
  2246.   #--------------------------------------------------------------------------
  2247.   def update_color
  2248.     return if @battler.sv.color == []
  2249.     self.color.set(@battler.sv.color[0], @battler.sv.color[1], @battler.sv.color[2], @battler.sv.color[3])
  2250.   end
  2251.   #--------------------------------------------------------------------------
  2252.   # ● 解放
  2253.   #--------------------------------------------------------------------------
  2254.   def dispose
  2255.     super
  2256.     self.bitmap.dispose if self.bitmap != nil
  2257.   end
  2258. end
  2259.  
  2260. #==============================================================================
  2261. # ■ Sprite_Battle_Picture
  2262. #------------------------------------------------------------------------------
  2263. #  ピクチャ表示用のスプライトです。
  2264. #==============================================================================
  2265. class Sprite_Battle_Picture < Sprite
  2266.   #--------------------------------------------------------------------------
  2267.   # ● 公開インスタンス変数 
  2268.   #--------------------------------------------------------------------------
  2269.   attr_accessor   :action_end           # 終了フラグ
  2270.   #--------------------------------------------------------------------------
  2271.   # ● オブジェクト初期化
  2272.   #--------------------------------------------------------------------------
  2273.   def initialize(viewport = nil)
  2274.     super(viewport)
  2275.     @action_end = false
  2276.     self.ox = 0
  2277.   end
  2278.   #--------------------------------------------------------------------------
  2279.   # ● セット
  2280.   #--------------------------------------------------------------------------
  2281.   def set(battler)
  2282.     @battler = battler
  2283.     @data = @battler.sv.effect_data.shift
  2284.     @time = @data[4]
  2285.     @mirror = $sv_camera.mirror
  2286.     @mirror = false if !@data[8]
  2287.     self.opacity = @data[6][0]
  2288.     @s_x = @data[2][0] if @data[2] != []
  2289.     @s_x = Graphics.width - @data[2][0]  if @data[2] != [] && @mirror
  2290.     @s_y = @data[2][1] if @data[2] != []
  2291.     @e_x = @data[3][0] if @data[3] != []
  2292.     @e_x = Graphics.width - @data[3][0] if @data[3] != [] && @mirror
  2293.     @e_y = @data[3][1] if @data[3] != []
  2294.     @s_x = self.x if @data[2] == []
  2295.     @s_y = self.y if @data[2] == []
  2296.     @e_x = self.x if @data[3] == []
  2297.     @e_y = self.y if @data[3] == []
  2298.     self.x = @s_x
  2299.     self.y = @s_y
  2300.     return @action_end = true if @time == 0
  2301.     @move_x = (@e_x * 1.0 - @s_x) / @time
  2302.     @move_y = (@e_y * 1.0 - @s_y) / @time
  2303.     self.z = @data[5]
  2304.     return set_plane(battler) if @data[7] != []
  2305.     self.bitmap = Cache.picture(@data[9]) if !bitmap or @data[9] != ""
  2306.     return @action_end = true if !bitmap
  2307.     self.mirror = @mirror
  2308.     self.ox = self.bitmap.width if @mirror
  2309.   end
  2310.   #--------------------------------------------------------------------------
  2311.   # ● プレーン移行
  2312.   #--------------------------------------------------------------------------
  2313.   def set_plane(battler)
  2314.     @viewport = Viewport.new(@data[2][0],@data[2][1],@data[7][0],@data[7][1]) if !@viewport
  2315.     viewport = @viewport
  2316.     @plane = Plane.new(viewport) if !@plane
  2317.     @plane.bitmap = Cache.picture(@data[9]) if !@plane.bitmap or @data[9] != ""
  2318.     return @action_end = true if !@plane.bitmap
  2319.     @plane.ox = @data[7][0]
  2320.     @plane.oy = @data[7][1]
  2321.     @plane.opacity = @data[6][0]
  2322.     @move_x = @remain_move[0] if @data[2] == @data[3]
  2323.     @move_y = @remain_move[1] if @data[2] == @data[3]
  2324.     @remain_move = [@move_x, @move_y]
  2325.   end
  2326.   #--------------------------------------------------------------------------
  2327.   # ● フレーム更新
  2328.   #--------------------------------------------------------------------------
  2329.   def update
  2330.     @action_end = true if !@battler.sv.picture
  2331.     return if @time == 0
  2332.     return if @action_end
  2333.     @time -= 1
  2334.     return plane_update if @plane
  2335.     super
  2336.     self.x += @move_x
  2337.     self.y += @move_y
  2338.     self.opacity += @data[6][1]
  2339.     return if @time != 1
  2340.     self.x = @e_x
  2341.     self.y = @e_y
  2342.     @time = 0
  2343.   end
  2344.   #--------------------------------------------------------------------------
  2345.   # ● フレーム更新
  2346.   #--------------------------------------------------------------------------
  2347.   def plane_update
  2348.     @plane.ox += @move_x
  2349.     @plane.oy += @move_y
  2350.     @plane.opacity += @data[6][1]
  2351.     @time = @data[4] if @time == 0
  2352.   end
  2353.   #--------------------------------------------------------------------------
  2354.   # ● 解放
  2355.   #--------------------------------------------------------------------------
  2356.   def dispose
  2357.     bitmap.dispose if bitmap
  2358.     @plane.dispose if @plane
  2359.     @viewport.dispose if @viewport
  2360.     super
  2361.   end
  2362. end
  2363.  
  2364. #==============================================================================
  2365. # ■ Sprite_Back_Picture
  2366. #------------------------------------------------------------------------------
  2367. #  周期ピクチャ用のスプライトです。
  2368. #==============================================================================
  2369. class Sprite_Back_Picture < Plane
  2370.   #--------------------------------------------------------------------------
  2371.   # ● 公開インスタンス変数 
  2372.   #--------------------------------------------------------------------------
  2373.   attr_accessor   :action_end           # 終了フラグ
  2374.   #--------------------------------------------------------------------------
  2375.   # ● オブジェクト初期化
  2376.   #--------------------------------------------------------------------------
  2377.   def initialize(viewport = nil, index)
  2378.     super(viewport)
  2379.     @index = index
  2380.     @real_x = 0
  2381.     @real_y = 0
  2382.     @real_opacity = 0
  2383.     @move_x = 0
  2384.     @move_y = 0
  2385.     @move_opacity = 0
  2386.     @time = 0
  2387.     @switche = 0
  2388.     @action_end = false
  2389.   end
  2390.   #--------------------------------------------------------------------------
  2391.   # ● セットアップ
  2392.   #--------------------------------------------------------------------------
  2393.   def setup(data)
  2394.     self.bitmap = Cache.picture(data[9])
  2395.     self.z = data[6]
  2396.     @switche = data[1]
  2397.     mirror = $sv_camera.mirror
  2398.     mirror = false if !data[8]
  2399.     @move_x = data[3][0]
  2400.     @move_x *= -1 if mirror
  2401.     @move_y = data[3][1]
  2402.     @time = data[4]
  2403.     @time = -1 if @time == 0
  2404.     @real_opacity = (data[5][0] + 1) * 100
  2405.     @move_opacity = data[5][1]
  2406.     @start_opacity = data[5][0]
  2407.     @shake_ok = data[7]
  2408.   end
  2409.   #--------------------------------------------------------------------------
  2410.   # ● フレーム更新
  2411.   #--------------------------------------------------------------------------
  2412.   def update
  2413.     update_picture if @time != 0
  2414.     self.ox = $sv_camera.x - @real_x
  2415.     self.oy = $sv_camera.y - @real_y
  2416.     if @shake_ok
  2417.       self.ox -= $sv_camera.sx / 100
  2418.       self.oy -= $sv_camera.sy / 100
  2419.     end
  2420.     self.ox *= $sv_camera.zoom
  2421.     self.oy *= $sv_camera.zoom
  2422.     self.zoom_x = @zoom_x * $sv_camera.zoom
  2423.     self.zoom_y = @zoom_y * $sv_camera.zoom
  2424.     self.opacity = @real_opacity / 100
  2425.     @move_opacity *= -1 if self.opacity == 255 or self.opacity <= @start_opacity
  2426.     @switche
  2427.     @action_end = true if @switche > 0 && !$game_switches[@switche]
  2428.     @action_end = true if @switche < 0 && !$sv_camera.switches[@switche.abs]
  2429.   end
  2430.   #--------------------------------------------------------------------------
  2431.   # ● ピクチャの更新
  2432.   #--------------------------------------------------------------------------
  2433.   def update_picture
  2434.     @real_x += @move_x / 100
  2435.     @real_y += @move_y / 100
  2436.     @real_x = 0 if @real_x >= self.bitmap.width or @real_x <= -self.bitmap.width
  2437.     @real_y = 0 if @real_y >= self.bitmap.height or @real_y <= -self.bitmap.height
  2438.     @zoom_x = 1
  2439.     @zoom_y = 1
  2440.     @real_opacity += @move_opacity
  2441.     @time -= 1
  2442.     @time = -1 if @time < -100
  2443.   end
  2444. end
  2445.  
  2446. #==============================================================================
  2447. # ■ Sprite_Back_Picture
  2448. #------------------------------------------------------------------------------
  2449. #  ダメージ表示のスプライトです。
  2450. #==============================================================================
  2451. class Sprite_Damage < Sprite
  2452.   #--------------------------------------------------------------------------
  2453.   # ● 公開インスタンス変数 
  2454.   #--------------------------------------------------------------------------
  2455.   attr_reader   :action_end                  # POP終了フラグ
  2456.   #--------------------------------------------------------------------------
  2457.   # ● オブジェクト初期化
  2458.   #--------------------------------------------------------------------------
  2459.   def initialize(viewport = nil, battler)
  2460.     super(viewport)
  2461.     @battler = battler
  2462.     @time = 0
  2463.     return @action_end = true if !@battler
  2464.     @direction = -1
  2465.     @direction *= -1 if @battler.actor?
  2466.     @direction *= -1 if $sv_camera.mirror
  2467.     set_state
  2468.     set_damage
  2469.     update
  2470.   end
  2471.   #--------------------------------------------------------------------------
  2472.   # ● ステート表示
  2473.   #--------------------------------------------------------------------------
  2474.   def set_state
  2475.     return if !N03::STATE_POP
  2476.     states = @battler.result.added_state_objects
  2477.     states.delete($data_states[@battler.death_state_id]) if @battler.result.hp_damage != 0
  2478.     return if states == []
  2479.     return if @battler.sv.add_state == @battler.result.added_state_objects
  2480.     @battler.sv.add_state = states.dup
  2481.     @st = []
  2482.     @st_base = []
  2483.     for i in 0...states.size
  2484.       @st[i] = Sprite.new
  2485.       bitmap_state(@st[i], states[i])
  2486.       @st_base[i] = []
  2487.       @st_base[i][0] = @direction * (-20 + 5 * i) + @battler.sv.x / 100
  2488.       @st_base[i][1] = -40 - @state_height * i + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2489.       @st[i].z = 1000 + i
  2490.       @st[i].opacity = 0
  2491.     end
  2492.     @time = @pop_time = 80
  2493.   end   
  2494.   #--------------------------------------------------------------------------
  2495.   # ● ステート画像
  2496.   #--------------------------------------------------------------------------
  2497.   def bitmap_state(state, state_object)
  2498.     name = state_object.name
  2499.     state.bitmap = Cache.system("Iconset").dup
  2500.     state.src_rect.set(state_object.icon_index % 16 * 24, state_object.icon_index / 16 * 24, 24, 24)
  2501.     @state_height = 24
  2502.   end
  2503.   #--------------------------------------------------------------------------
  2504.   # ● ダメージ表示
  2505.   #--------------------------------------------------------------------------
  2506.   def hit_count
  2507.     for i in [email]0...@battler.sv.hit.size[/email]
  2508.       if @battler.sv.hit[i] == nil
  2509.         @hit = i
  2510.         return @battler.sv.hit[i] = @hit
  2511.       end
  2512.     end
  2513.     @hit = @battler.sv.hit.size
  2514.     @battler.sv.hit.push(@hit)
  2515.   end  
  2516.   #--------------------------------------------------------------------------
  2517.   # ● ダメージ表示
  2518.   #--------------------------------------------------------------------------
  2519.   def set_damage
  2520.     return @action_end = true if !N03::DAMAGE_POP
  2521.     damage = @battler.result.hp_damage if @battler.result.hp_damage != 0
  2522.     damage = @battler.result.hp_drain  if @battler.result.hp_drain  != 0
  2523.     damage = @battler.result.mp_damage if @battler.result.mp_damage != 0
  2524.     damage = @battler.result.mp_drain  if @battler.result.mp_drain  != 0
  2525.     damage = @battler.result.tp_damage if @battler.result.tp_damage != 0
  2526.     if !damage or damage == 0
  2527.       @action_end = true if @st == nil
  2528.       return # ステートだけPOPする設定を考慮して@action_endは返さない
  2529.     end
  2530.     hit_count
  2531.     #@hit = @battler.sv.hit
  2532.     #@battler.sv.hit += 1 if damage != 0
  2533.     file = N03::DAMAGE_PLUS if damage > 0
  2534.     file = N03::DAMAGE_MINUS if damage < 0
  2535.     add_file = N03::DAMAGE_MP if @battler.result.mp_damage != 0
  2536.     add_file = N03::DAMAGE_TP if @battler.result.tp_damage != 0
  2537.     adjust_x = N03::DAMAGE_ADJUST
  2538.     @num = []
  2539.     @num_base = []
  2540.     damage = damage.abs
  2541.     max_num = damage.to_s.size
  2542.     max_num += 1 if add_file != nil
  2543.     for i in 0...max_num
  2544.       @num[i] = Sprite.new
  2545.       if add_file != nil && i == max_num - 1
  2546.         @num[i].bitmap = Cache.system(add_file)
  2547.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2548.         sw = 0 if sw == nil
  2549.       else
  2550.         @num[i].bitmap = Cache.system(file)
  2551.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2552.         sw = @num[i].bitmap.width / 10
  2553.         @num[i].src_rect.set(cw * sw, 0, sw, @num[i].bitmap.height)
  2554.       end
  2555.       @num_base[i] = []
  2556.       @num_base[i][0] = (sw + adjust_x) * i * -1 + (@battler.sv.x / 100)
  2557.       @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
  2558.       @num_base[i][0] -= @num[i].bitmap.width / 2 - adjust_x if add_file != nil && i == max_num - 1
  2559.       @num[i].z = 1000 + i + @hit * 10
  2560.     end
  2561.     @time = @pop_time = 80
  2562.   end
  2563.   #--------------------------------------------------------------------------
  2564.   # ● フレーム更新
  2565.   #--------------------------------------------------------------------------
  2566.   def update
  2567.     return if @time == 0
  2568.     for i in [email]0...@st.size[/email] do update_state_move(@st[i], i) end if @st != nil
  2569.     for i in [email]0...@num.size[/email] do update_num_move(@num[i], i) end if @num != nil
  2570.     @time -= 1
  2571.     @action_end = true if @time == 0
  2572.   end
  2573.   #--------------------------------------------------------------------------
  2574.   # ● ステート画像の更新
  2575.   #--------------------------------------------------------------------------
  2576.   def update_state_move(state, index)
  2577.     min = @pop_time - index * 2
  2578.     case @time
  2579.     when min-15..min
  2580.       @st_base[index][0] += @direction
  2581.       state.opacity += 25
  2582.     when min-80..min-50
  2583.       @st_base[index][0] += @direction
  2584.       state.opacity -= 25
  2585.     end
  2586.     state.x = (@st_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2587.     state.y = (@st_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2588.   end
  2589.   #--------------------------------------------------------------------------
  2590.   # ● 数値の更新
  2591.   #--------------------------------------------------------------------------
  2592.   def update_num_move(num, index)
  2593.     min = @pop_time - index * 2
  2594.     case @time
  2595.     when min-1..min
  2596.       @num_base[index][0] += @direction * @hit
  2597.       @num_base[index][1] -= 5 + @hit * 2
  2598.     when min-3..min-2
  2599.       @num_base[index][0] += @direction * @hit
  2600.       @num_base[index][1] -= 4 + @hit * 2
  2601.     when min-6..min-4
  2602.       @num_base[index][0] += @direction
  2603.       @num_base[index][1] -= 3 + @hit * 2
  2604.     when min-14..min-7
  2605.       @num_base[index][0] += @direction
  2606.       @num_base[index][1] += 2
  2607.     when min-17..min-15
  2608.       @num_base[index][1] -= 2 + @hit * 2
  2609.     when min-23..min-18
  2610.       @num_base[index][1] += 1
  2611.     when min-27..min-24
  2612.       @num_base[index][1] -= 1
  2613.     when min-30..min-28
  2614.       @num_base[index][1] += 1
  2615.     when min-33..min-31
  2616.       @num_base[index][1] -= 1
  2617.     when min-36..min-34
  2618.       @num_base[index][1] += 1
  2619.     end
  2620.     num.x = (@num_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2621.     num.y = (@num_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2622.     num.opacity = 256 - (12 - @time) * 32
  2623.     num.visible = false if @time == 0
  2624.   end
  2625.   #--------------------------------------------------------------------------
  2626.   # ● 解放
  2627.   #--------------------------------------------------------------------------
  2628.   def dispose
  2629.     @battler.sv.hit[@hit] = nil if @hit
  2630.     bitmap.dispose if bitmap
  2631.     for i in [email]0...@num.size[/email] do @num[i].dispose end if @num != nil
  2632.     for i in [email]0...@st.size[/email] do @st[i].dispose end if @st != nil
  2633.     super
  2634.   end
  2635. end
  2636.  
  2637. #==============================================================================
  2638. # ■ Window_Skill_name
  2639. #------------------------------------------------------------------------------
  2640. #  スキル名を表示するウィンドウです。
  2641. #==============================================================================
  2642. class Window_Skill_name < Window_Base
  2643.   #--------------------------------------------------------------------------
  2644.   # ● オブジェクト初期化
  2645.   #--------------------------------------------------------------------------
  2646.   def initialize(text)
  2647.     super(0, 0, Graphics.width, line_height + standard_padding * 2)
  2648.     draw_text(4, 0, Graphics.width - 64, line_height,text, 1)
  2649.   end
  2650. end
  2651.  
  2652. #==============================================================================
  2653. # ■ Spriteset_Sideview
  2654. #------------------------------------------------------------------------------
  2655. #  サイドビュー独自のスプライトをまとめたクラスです。
  2656. #==============================================================================
  2657. class Spriteset_Sideview
  2658.   #--------------------------------------------------------------------------
  2659.   # ● オブジェクト初期化
  2660.   #--------------------------------------------------------------------------
  2661.   def initialize(viewport)
  2662.     @viewport = viewport
  2663.     @weapons = []
  2664.     @pictures = []
  2665.     @back_pic = []
  2666.     @damage = []
  2667.     $sv_camera.setup
  2668.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup)
  2669.   end
  2670.   #--------------------------------------------------------------------------
  2671.   # ● フレーム更新
  2672.   #--------------------------------------------------------------------------
  2673.   def update
  2674.     update_battler_data
  2675.     update_damage
  2676.     update_pictures
  2677.     update_back_pic
  2678.     update_weapons
  2679.   end  
  2680.   #--------------------------------------------------------------------------
  2681.   # ● バトラーデータの更新
  2682.   #--------------------------------------------------------------------------
  2683.   def update_battler_data
  2684.     for battler in $game_party.battle_members + $game_troop.members
  2685.       weapon_end(battler) if battler.sv.weapon_end
  2686.       next if battler.sv.effect_data == []
  2687.       for effect_data in battler.sv.effect_data do set_effects(battler, effect_data) end
  2688.     end
  2689.   end
  2690.   #--------------------------------------------------------------------------
  2691.   # ● ダメージ画像の更新
  2692.   #--------------------------------------------------------------------------
  2693.   def update_damage
  2694.     for i in [email]0...@damage.size[/email]
  2695.       next if @damage[i] == nil
  2696.       @damage[i].update if @damage[i] != nil
  2697.       next if !@damage[i].action_end
  2698.       @damage[i].dispose
  2699.       @damage[i] = nil
  2700.     end
  2701.   end
  2702.   #--------------------------------------------------------------------------
  2703.   # ● ピクチャアクションの更新
  2704.   #--------------------------------------------------------------------------
  2705.   def update_pictures
  2706.     for i in [email]0...@pictures.size[/email]
  2707.       next if @pictures[i] == nil
  2708.       @pictures[i].update if @pictures[i] != nil
  2709.       next if !@pictures[i].action_end
  2710.       @pictures[i].dispose
  2711.       @pictures[i] = nil
  2712.     end
  2713.   end
  2714.   #--------------------------------------------------------------------------
  2715.   # ● 周期ピクチャの更新
  2716.   #--------------------------------------------------------------------------
  2717.   def update_back_pic
  2718.     set_back_pic if $sv_camera.program_picture != []
  2719.     for i in [email]0...@back_pic.size[/email]
  2720.       next if @back_pic[i] == nil
  2721.       @back_pic[i].update if @back_pic[i] != nil
  2722.       next if !@back_pic[i].action_end
  2723.       @back_pic[i].dispose
  2724.       @back_pic[i] = nil
  2725.     end
  2726.   end
  2727.   #--------------------------------------------------------------------------
  2728.   # ● 武器アクションの更新
  2729.   #--------------------------------------------------------------------------
  2730.   def update_weapons
  2731.     for i in [email]0...@weapons.size[/email]
  2732.       next if @weapons[i] == nil
  2733.       @weapons[i].update if @weapons[i] != nil
  2734.       next if !@weapons[i].action_end
  2735.       @weapons[i].dispose
  2736.       @weapons[i] = nil
  2737.     end
  2738.   end
  2739.   #--------------------------------------------------------------------------
  2740.   # ● ダメージ実行
  2741.   #--------------------------------------------------------------------------
  2742.   def set_damage_pop(target)
  2743.     for i in [email]0...@damage.size[/email]
  2744.       next if @damage[i] != nil
  2745.       return @damage[i] = Sprite_Damage.new(@viewport, target)
  2746.     end
  2747.     @damage.push(Sprite_Damage.new(@viewport, target))
  2748.   end
  2749.   #--------------------------------------------------------------------------
  2750.   # ● 周期ピクチャ実行
  2751.   #--------------------------------------------------------------------------
  2752.   def set_back_pic
  2753.     for data in $sv_camera.program_picture
  2754.       if @back_pic[data[2]] != nil
  2755.         @back_pic[data[2]].dispose
  2756.         @back_pic[data[2]] = nil
  2757.       end
  2758.       @back_pic[data[2]] = Sprite_Back_Picture.new(@viewport, data[2])
  2759.       @back_pic[data[2]].setup(data)
  2760.     end
  2761.     $sv_camera.program_picture = []
  2762.   end
  2763.   #--------------------------------------------------------------------------
  2764.   # ● エフェクト開始
  2765.   #--------------------------------------------------------------------------
  2766.   def set_effects(battler, effect_data)
  2767.     case effect_data[0]
  2768.     when "pic" ; set_pictures(battler, effect_data)
  2769.     when  "wp" ; set_weapons(battler,  true)
  2770.     when "m_a" ; set_weapons(battler, false)
  2771.     end
  2772.   end
  2773.   #--------------------------------------------------------------------------
  2774.   # ● ピクチャアクション実行
  2775.   #--------------------------------------------------------------------------
  2776.   def set_pictures(battler, effect_data)
  2777.     @pictures[effect_data[1]] = Sprite_Battle_Picture.new if @pictures[effect_data[1]] == nil
  2778.     @pictures[effect_data[1]].set(battler)
  2779.   end
  2780.   #--------------------------------------------------------------------------
  2781.   # ● 武器アクション実行
  2782.   #--------------------------------------------------------------------------
  2783.   def set_weapons(battler, weapon_flag, test = true)
  2784.     for i in [email]0...@weapons.size[/email]
  2785.       next if @weapons[i] != nil
  2786.       @weapons[i] = Sprite_Weapon.new(@viewport, i, battler)
  2787.       battler.sv.weapon_index.push(i) if weapon_flag
  2788.       return i
  2789.     end
  2790.     @weapons.push(Sprite_Weapon.new(@viewport, @weapons.size, battler))
  2791.     battler.sv.weapon_index.push(@weapons.size - 1) if weapon_flag
  2792.     return @weapons.size - 1
  2793.   end
  2794.   #--------------------------------------------------------------------------
  2795.   # ● バトラーの武器アクション終了
  2796.   #--------------------------------------------------------------------------
  2797.   def weapon_end(battler)
  2798.     battler.sv.weapon_end = false
  2799.     for index in battler.sv.weapon_index
  2800.       weapon_index = battler.sv.weapon_index.shift
  2801.       @weapons[weapon_index].dispose if @weapons[weapon_index] != nil
  2802.       @weapons[weapon_index] = nil
  2803.     end
  2804.     battler.sv.weapon_index.compact!
  2805.   end  
  2806.   #--------------------------------------------------------------------------
  2807.   # ● ヒット時の戦闘アニメ実行
  2808.   #--------------------------------------------------------------------------
  2809.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  2810.     weapon = @weapons[weapon_index]
  2811.     for target in hit_targets
  2812.       next @weapons[@hit_index].timing_battler_set(target) if @hit_index != nil
  2813.       @hit_index = set_weapons(battler, false, false)
  2814.       @weapons[@hit_index].set_hit_animation(weapon.hit_position, weapon.hit_anime_id, target)
  2815.     end
  2816.     @hit_index = nil
  2817.     if !weapon.through && !miss
  2818.       @weapons[weapon_index].dispose
  2819.       @weapons[weapon_index] = nil
  2820.     else
  2821.       @weapons[weapon_index].through_change
  2822.     end
  2823.   end
  2824.   #--------------------------------------------------------------------------
  2825.   # ● サイドビューデータの初期化
  2826.   #--------------------------------------------------------------------------
  2827.   def reset_sideview
  2828.     $sv_camera.reset
  2829.     for member in $game_troop.members + $game_party.battle_members do member.sv.reset end
  2830.   end  
  2831.   #--------------------------------------------------------------------------
  2832.   # ● 解放
  2833.   #--------------------------------------------------------------------------
  2834.   def dispose
  2835.     dispose_effects(@weapons)
  2836.     dispose_effects(@pictures)
  2837.     dispose_effects(@back_pic)
  2838.     dispose_effects(@damage)
  2839.     reset_sideview
  2840.   end
  2841.   #--------------------------------------------------------------------------
  2842.   # ● エフェクト画像の解放
  2843.   #--------------------------------------------------------------------------
  2844.   def dispose_effects(effects)
  2845.     for i in 0...effects.size
  2846.       effects[i].dispose if effects[i] != nil
  2847.       effects[i] = nil
  2848.     end
  2849.   end
  2850. end
  2851.  
  2852.  
  2853. #==============================================================================
  2854. # ■ Sprite_Battle_Back
  2855. #------------------------------------------------------------------------------
  2856. #  戦闘背景用のスプライトです。
  2857. #==============================================================================
  2858. class Sprite_Battle_Back < Plane
  2859.   #--------------------------------------------------------------------------
  2860.   # ● オブジェクト初期化
  2861.   #--------------------------------------------------------------------------
  2862.   def initialize(viewport = nil, index, battleback_name)
  2863.     super(viewport)
  2864.     @index = index
  2865.     if @index == 1
  2866.       data = N03::FLOOR1_DATA[battleback_name]
  2867.       data = N03::FLOOR1_DATA["全Battlebacks1"] if data == nil
  2868.     elsif @index == 2
  2869.       data = N03::FLOOR2_DATA[battleback_name]
  2870.       data = N03::FLOOR2_DATA["全Battlebacks2"] if data == nil
  2871.     end   
  2872.     data = data.dup
  2873.     @adjust_position = data[0]
  2874.     @zoom_x = data[1][0] / 100.0
  2875.     @zoom_y = data[1][1] / 100.0
  2876.     @shake_on = data[2]
  2877.     $game_switches[data[3]] = true if data[3] > 0
  2878.     $sv_camera.switches[data[3].abs] = true if data[3] < 0
  2879.     reset_scroll
  2880.     reset_back_data(battleback_name)
  2881.   end
  2882.   #--------------------------------------------------------------------------
  2883.   # ● 背景スクロールを初期化
  2884.   #--------------------------------------------------------------------------
  2885.   def reset_scroll
  2886.     @scroll_x = 0
  2887.     @scroll_y = 0
  2888.     @move_x = 0
  2889.     @move_y = 0
  2890.   end
  2891.   #--------------------------------------------------------------------------
  2892.   # ● 背景データを初期化
  2893.   #--------------------------------------------------------------------------
  2894.   def reset_back_data(battleback_name)
  2895.     @back_data = []
  2896.     @active_data = ["scroll",0, @move_x, @move_y, false, battleback_name,""]
  2897.     start_back_data(@active_data)
  2898.   end  
  2899.   #--------------------------------------------------------------------------
  2900.   # ● 背景画像のセッティング
  2901.   #--------------------------------------------------------------------------
  2902.   def set_graphics(new_bitmap)
  2903.     self.bitmap = new_bitmap
  2904.     @base_x = (self.bitmap.width * @zoom_x - Graphics.width) / 2 + @adjust_position[0]
  2905.     @base_y = (self.bitmap.height * @zoom_y - Graphics.height) / 2 + @adjust_position[1]
  2906.     # 限界座標を取得
  2907.     max_top =  0
  2908.     max_bottom = self.bitmap.height * @zoom_y - Graphics.height
  2909.     max_left = 0
  2910.     max_right = self.bitmap.width * @zoom_x - Graphics.width
  2911.     exist = true
  2912.     exist = false if self.bitmap.height == 32 && self.bitmap.width == 32
  2913.     $sv_camera.setting(@index, [max_top, max_bottom, max_left, max_right, @base_x, @base_y,exist])
  2914.   end
  2915.   #--------------------------------------------------------------------------
  2916.   # ● フレーム更新
  2917.   #--------------------------------------------------------------------------
  2918.   def update
  2919.     return if !bitmap
  2920.     update_back_data
  2921.     update_scroll unless @move_x == 0 && @move_y == 0
  2922.     update_color
  2923.     update_position
  2924.     update_back_adjust if @bt_back != nil
  2925.     create_back_adjust if @bt_back == nil && !@active_data[10] && @scroll_x == 0 && @scroll_y == 0
  2926.   end
  2927.   #--------------------------------------------------------------------------
  2928.   # ● 背景データを更新
  2929.   #--------------------------------------------------------------------------
  2930.   def update_back_data
  2931.     delete = true if @active_data[1] > 0 && !$game_switches[@active_data[1]]
  2932.     delete = true if @active_data[1] < 0 && !$sv_camera.switches[@active_data[1].abs]
  2933.     return if !delete
  2934.     for i in [email]0...@back_data.size[/email]
  2935.       @back_data[i] = nil if @back_data[i][1] > 0 && !$game_switches[@back_data[i][1]]
  2936.       @back_data[i] = nil if @back_data[i][1] < 0 && !$sv_camera.switches[@back_data[i][1].abs]
  2937.     end
  2938.     @back_data.compact!
  2939.     next_back_data
  2940.   end
  2941.   #--------------------------------------------------------------------------
  2942.   # ● 次の背景データをセット
  2943.   #--------------------------------------------------------------------------
  2944.   def next_back_data
  2945.     @back_data.delete(@active_data[11]) if @active_data[11] != nil
  2946.     @back_data.push(@active_data[11]) if @active_data[11] != nil
  2947.     @active_data = nil
  2948.     data = @back_data.pop
  2949.     @back_data = [@active_data] if @back_data.size == 0
  2950.     start_back_data(data)
  2951.   end  
  2952.   #--------------------------------------------------------------------------
  2953.   # ● 背景データを実行
  2954.   #--------------------------------------------------------------------------
  2955.   def start_back_data(data)
  2956.     return if back_data_remain(data)
  2957.     bt_back_dispose
  2958.     pre_active_data = @active_data
  2959.     @active_data[8] = [@back_name, @move_x, @move_y, @scroll_x, @scroll_y] if @active_data != nil
  2960.     @back_data.push(@active_data)     if @active_data != nil
  2961.     @active_data = data.dup
  2962.     @active_data[5] = @back_name      if @active_data[5] == ""
  2963.     @active_data[9] = set_back_adjust if @active_data[9] == nil
  2964.     back_data_scroll_on               if @active_data[8] == nil && @active_data[9][0] == false
  2965.     set_remain_back_data              if @active_data[8] != nil
  2966.     create_back(@active_data[5])      if @active_data[9][0] == false
  2967.     create_back_adjust                if @active_data[10]
  2968.     @active_data[11] = pre_active_data if pre_active_data && @active_data[7] == false
  2969.   end  
  2970.   #--------------------------------------------------------------------------
  2971.   # ● 背景データの保留
  2972.   #--------------------------------------------------------------------------
  2973.   def back_data_remain(data)
  2974.     remain = false
  2975.     remain = true if data[6] != "" && @active_data != nil && @active_data[9] != nil && @active_data[9][0] != false
  2976.     remain = true if @active_data != nil && @active_data[7] == false
  2977.     return remain if !remain
  2978.     @remain = true
  2979.     @back_data.push(data)
  2980.     return remain
  2981.   end  
  2982.   #--------------------------------------------------------------------------
  2983.   # ● 背景変更補正データをセット
  2984.   #--------------------------------------------------------------------------
  2985.   def set_back_adjust
  2986.     bt_adjust = []
  2987.     sign = -1
  2988.     if @active_data[6] == ""
  2989.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  2990.       bt_adjust = [false,false,0,0]
  2991.       return bt_adjust
  2992.     elsif @move_x != 0 or @active_data[3][0] != 0
  2993.       sign = 1 if @move_x < 0
  2994.       bt_adjust[0] = [self.bitmap.width * @zoom_x * sign, 0]
  2995.       bt_adjust[1] = [self.bitmap.width * @zoom_x * sign * 2, 0]
  2996.     elsif @move_y != 0 or @active_data[3][1] != 0
  2997.       sign = 1 if @move_y < 0
  2998.       bt_adjust[0] = [0, self.bitmap.height * @zoom_y * sign]
  2999.       bt_adjust[1] = [0, self.bitmap.height * @zoom_y * sign * 2]
  3000.     else
  3001.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  3002.       bt_adjust = [false,false,0,0]
  3003.       return bt_adjust
  3004.     end
  3005.     bt_adjust[2] = [bt_adjust[0][0], bt_adjust[0][1]]
  3006.     return bt_adjust
  3007.   end
  3008.   #--------------------------------------------------------------------------
  3009.   # ● 背景スクロールデータを実行
  3010.   #--------------------------------------------------------------------------
  3011.   def back_data_scroll_on
  3012.     mirror = $sv_camera.mirror
  3013.     mirror = false if !@active_data[4]
  3014.     @move_x = @active_data[3][0]
  3015.     @move_x *= -1 if mirror
  3016.     @move_y = @active_data[3][1]
  3017.   end
  3018.   #--------------------------------------------------------------------------
  3019.   # ● 保持している背景データを実行
  3020.   #--------------------------------------------------------------------------
  3021.   def set_remain_back_data
  3022.     return back_data_scroll_on if @move_x != 0 or @move_y != 0
  3023.     create_back(@active_data[8][0])
  3024.     @move_x    = @active_data[8][1]
  3025.     @move_y    = @active_data[8][2]
  3026.     @scroll_x  = @active_data[8][3]
  3027.     @scroll_y  = @active_data[8][4]
  3028.   end  
  3029.   #--------------------------------------------------------------------------
  3030.   # ● 背景画像の作成
  3031.   #--------------------------------------------------------------------------
  3032.   def create_back(back_name)
  3033.     return if back_name == @back_name or back_name == ""
  3034.     self.bitmap = Cache.battleback1(back_name) if @index == 1
  3035.     self.bitmap = Cache.battleback2(back_name) if @index == 2
  3036.     @back_name = back_name
  3037.   end  
  3038.   #--------------------------------------------------------------------------
  3039.   # ● 背景変更補正画像の作成
  3040.   #--------------------------------------------------------------------------
  3041.   def create_back_adjust
  3042.     return if @active_data[9][0] == false
  3043.     @active_data[10] = true
  3044.     mirror = $sv_camera.mirror
  3045.     mirror = false if !@active_data[4]
  3046.     @bt_back = []
  3047.     @bt_back[0] = Sprite.new(viewport)
  3048.     @bt_back[0].bitmap = Cache.battleback1(@active_data[6]) if @index == 1
  3049.     @bt_back[0].bitmap = Cache.battleback2(@active_data[6]) if @index == 2
  3050.     @bt_back[0].mirror = mirror
  3051.     @bt_back[1] = Sprite.new(viewport)
  3052.     @bt_back[1].bitmap = Cache.battleback1(@active_data[5]) if @index == 1
  3053.     @bt_back[1].bitmap = Cache.battleback2(@active_data[5]) if @index == 2
  3054.     @bt_back[1].mirror = mirror
  3055.   end
  3056.   #--------------------------------------------------------------------------
  3057.   # ● 背景スクロールの更新
  3058.   #--------------------------------------------------------------------------
  3059.   def update_scroll
  3060.     @scroll_x += @move_x
  3061.     @scroll_y += @move_y
  3062.     @scroll_x = 0 if @scroll_x / 100 >= self.bitmap.width * @zoom_x or @scroll_x / 100 <= -self.bitmap.width * @zoom_x
  3063.     @scroll_y = 0 if @scroll_y / 100 >= self.bitmap.height * @zoom_y or @scroll_y / 100 <= -self.bitmap.height * @zoom_y
  3064.   end
  3065.   #--------------------------------------------------------------------------
  3066.   # ● 色調変更の更新
  3067.   #--------------------------------------------------------------------------
  3068.   def update_color
  3069.     color_set if $sv_camera.color_set[@index] != nil
  3070.     return if @color_data == nil
  3071.     @color_data[4] -= 1
  3072.     if @color_data[4] == 0 && @color_data[5] != 0
  3073.       @color_data[4] = @color_data[5]
  3074.       @color_data[5] = 0
  3075.       @color_data[6] = [0,0,0,0]
  3076.     elsif @color_data[4] == 0
  3077.       @remain_color_data = @color_data
  3078.       return @color_data = nil
  3079.     end  
  3080.     for i in 0..3
  3081.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  3082.     end  
  3083.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  3084.   end
  3085.   #--------------------------------------------------------------------------
  3086.   # ● 座標の更新
  3087.   #--------------------------------------------------------------------------
  3088.   def update_position
  3089.     self.ox = $sv_camera.x + @base_x - @scroll_x / 100
  3090.     self.oy = $sv_camera.y + @base_y - @scroll_y / 100
  3091.     self.ox -= $sv_camera.sx / 100 if @shake_on
  3092.     self.oy -= $sv_camera.sy / 100 if @shake_on
  3093.     self.zoom_x = @zoom_x * $sv_camera.zoom
  3094.     self.zoom_y = @zoom_y * $sv_camera.zoom
  3095.     self.ox *= $sv_camera.zoom
  3096.     self.oy *= $sv_camera.zoom
  3097.     self.z = @index * 10
  3098.   end
  3099.   #--------------------------------------------------------------------------
  3100.   # ● 背景変更補正画像を更新
  3101.   #--------------------------------------------------------------------------
  3102.   def update_back_adjust
  3103.     @active_data[9][0][0] = 0 if @scroll_x == 0
  3104.     @active_data[9][0][1] = 0 if @scroll_y == 0
  3105.     @active_data[9][1][0] -= @active_data[9][2][0] if @scroll_x == 0
  3106.     @active_data[9][1][1] -= @active_data[9][2][1] if @scroll_y == 0
  3107.     for i in [email]0...@bt_back.size[/email]
  3108.       @bt_back[i].x = -self.ox + @active_data[9][i][0] * $sv_camera.zoom
  3109.       @bt_back[i].y = -self.oy + @active_data[9][i][1] * $sv_camera.zoom
  3110.       @bt_back[i].zoom_x = self.zoom_x
  3111.       @bt_back[i].zoom_y = self.zoom_y
  3112.       @bt_back[i].z = self.z + 1
  3113.       @bt_back[i].color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  3114.     end
  3115.     back_data_scroll_on if @active_data[9][0][0] == 0 && @active_data[9][0][1] == 0
  3116.     return unless @active_data[9][1][0] == 0 && @active_data[9][1][1] == 0
  3117.     bt_back_dispose
  3118.     create_back(@active_data[5])
  3119.     @active_data[9][0] = false
  3120.     next_back_data if @remain && @back_data.size != 1
  3121.     @remain = false
  3122.   end
  3123.   #--------------------------------------------------------------------------
  3124.   # ● 色調変更
  3125.   #--------------------------------------------------------------------------
  3126.   def color_set
  3127.     set = $sv_camera.color_set[@index]
  3128.     $sv_camera.color_set[@index] = nil
  3129.     set[4] = 1 if set[4] == 0
  3130.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  3131.     @color_data = @remain_color_data
  3132.     @color_data[4] = set[4]
  3133.     @color_data[5] = set[5]
  3134.     @color_data[6] = set
  3135.   end
  3136.   #--------------------------------------------------------------------------
  3137.   # ● 背景変更補正画像の解放
  3138.   #--------------------------------------------------------------------------
  3139.   def bt_back_dispose
  3140.     for i in [email]0...@bt_back.size[/email] do @bt_back[i].dispose end if @bt_back != nil
  3141.     @bt_back = nil
  3142.   end  
  3143.   #--------------------------------------------------------------------------
  3144.   # ● 解放
  3145.   #--------------------------------------------------------------------------
  3146.   def dispose
  3147.     bitmap.dispose if bitmap
  3148.     bt_back_dispose
  3149.     super
  3150.   end
  3151. end  
  3152.  
  3153. #==============================================================================
  3154. # ■ Battle_Camera
  3155. #------------------------------------------------------------------------------
  3156. #  戦闘カメラやバトルプログラムを扱うクラスです。
  3157. #==============================================================================
  3158. class Battle_Camera
  3159.   #--------------------------------------------------------------------------
  3160.   # ● 公開インスタンス変数 
  3161.   #--------------------------------------------------------------------------
  3162.   attr_reader   :sx                 # シェイクX座標
  3163.   attr_reader   :sy                 # シェイクY座標
  3164.   attr_reader   :max_top            # 上限界座標
  3165.   attr_reader   :max_bottom         # 下限界座標
  3166.   attr_reader   :max_left           # 左限界座標
  3167.   attr_reader   :max_right          # 右限界座標
  3168.   attr_accessor :switches           # サイドビュー専用スイッチ
  3169.   attr_accessor :color_set          # 色調変更データ
  3170.   attr_accessor :wait               # 戦闘シーンの強制ウエイト
  3171.   attr_accessor :win_wait           # 戦闘勝利前のウエイト
  3172.   attr_accessor :mirror             # 画面反転フラグ
  3173.   attr_accessor :program_scroll     # バトルプログラム 背景の自動スクロール
  3174.   attr_accessor :program_picture    # バトルプログラム 周期ピクチャ
  3175.   attr_accessor :event              # コモンイベント呼び出し
  3176.   #--------------------------------------------------------------------------
  3177.   # ● オブジェクト初期化
  3178.   #--------------------------------------------------------------------------
  3179.   def initialize
  3180.     @switches = []
  3181.     @max_data = []
  3182.     @color_set = []
  3183.     @wait = 0
  3184.     @win_wait = false
  3185.     @mirror = false
  3186.     @event = false
  3187.     setup
  3188.   end
  3189.   #--------------------------------------------------------------------------
  3190.   # ● カメラX座標
  3191.   #--------------------------------------------------------------------------
  3192.   def x
  3193.     return @x / 100
  3194.   end
  3195.   #--------------------------------------------------------------------------
  3196.   # ● カメラY座標
  3197.   #--------------------------------------------------------------------------
  3198.   def y
  3199.     return @y / 100
  3200.   end
  3201.   #--------------------------------------------------------------------------
  3202.   # ● ズーム率
  3203.   #--------------------------------------------------------------------------
  3204.   def zoom
  3205.     return @zoom * 0.001
  3206.   end
  3207.   #--------------------------------------------------------------------------
  3208.   # ● ズーム率による座標変換
  3209.   #--------------------------------------------------------------------------
  3210.   def convert
  3211.     return @zoom
  3212.   end
  3213.   #--------------------------------------------------------------------------
  3214.   # ● カメラセットアップ
  3215.   #--------------------------------------------------------------------------
  3216.   def setup
  3217.     @x = 0
  3218.     @y = 0
  3219.     @sx = 0
  3220.     @sy = 0
  3221.     @zoom = 1000
  3222.     @time = 0
  3223.     @shake_time = 0
  3224.     program_setup
  3225.   end
  3226.   #--------------------------------------------------------------------------
  3227.   # ● カメラ初期化
  3228.   #--------------------------------------------------------------------------
  3229.   def reset
  3230.     @switches = []
  3231.     @max_data = []
  3232.     @color_set = []
  3233.     @wait = 0
  3234.     @win_wait = false
  3235.     @mirror = false
  3236.     program_setup(false)
  3237.   end  
  3238.   #--------------------------------------------------------------------------
  3239.   # ● バトルプログラムのセットアップ
  3240.   #--------------------------------------------------------------------------
  3241.   def program_setup(check = true)
  3242.     @played_program  = []
  3243.     @program_switch  = []
  3244.     @program_sound   = []
  3245.     @program_scroll  = []
  3246.     @program_se      = []
  3247.     @program_shake   = []
  3248.     @program_color   = []
  3249.     @program_picture = []
  3250.     @program_base = N03::BATTLE_PROGRAM.values.dup
  3251.     program_check if check
  3252.   end  
  3253.   #--------------------------------------------------------------------------
  3254.   # ● バトルプログラムのチェック
  3255.   #--------------------------------------------------------------------------
  3256.   def program_check
  3257.     for data in @program_base
  3258.       if program_start?(data) && !@played_program.include?(data)
  3259.         @played_program.push(data.dup)
  3260.         @program_scroll.push(data.dup)  if data[0] == "scroll"
  3261.         @program_picture.push(data.dup) if data[0] == "kpic"
  3262.         start_sound(data.dup)           if data[0] == "sound"
  3263.         start_program_switch(data.dup)  if data[0] == "switch"
  3264.         start_program_se(data.dup)      if data[0] == "keep_se"
  3265.         start_program_shake(data.dup)   if data[0] == "keep_sk"
  3266.         start_program_color(data.dup)   if data[0] == "keep_c"
  3267.       else
  3268.         @played_program.delete(data)  if !program_start?(data)
  3269.         @program_scroll.delete(data)  if data[0] == "scroll"
  3270.         @program_picture.delete(data) if data[0] == "kpic"
  3271.         @program_switch.delete(data)  if data[0] == "switch"
  3272.         @program_sound.delete(data)   if data[0] == "sound"
  3273.         @program_se.delete(data)      if data[0] == "keep_se"
  3274.         @program_shake.delete(data)   if data[0] == "keep_sk"
  3275.         @program_color.delete(data)   if data[0] == "keep_c"
  3276.       end
  3277.     end
  3278.   end
  3279.   #--------------------------------------------------------------------------
  3280.   # ● バトルプログラムの開始
  3281.   #--------------------------------------------------------------------------
  3282.   def program_start?(data)
  3283.     start = false
  3284.     start = true if $game_switches[data[1].abs] && data[1] > 0
  3285.     start = true if @switches[data[1].abs] && data[1] < 0
  3286.     return start
  3287.   end  
  3288.   #--------------------------------------------------------------------------
  3289.   # ● バトルプログラム スイッチ操作の開始
  3290.   #--------------------------------------------------------------------------
  3291.   def start_program_switch(data)
  3292.     data[4] = data[4] + rand(data[5] + 1)
  3293.     data[4] = 1 if data[4] <= 0
  3294.     @program_switch.push(data)
  3295.   end
  3296.   #--------------------------------------------------------------------------
  3297.   # ● スイッチ操作の更新
  3298.   #--------------------------------------------------------------------------
  3299.   def update_program_switch
  3300.     for data in @program_switch
  3301.       data[4] -= 1
  3302.       next @program_switch.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3303.       next @program_switch.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3304.       next if data[4] != 0
  3305.       for id in data[2]
  3306.         $game_switches[id] = true if id > 0
  3307.         @switches[id.abs] = true  if id < 0
  3308.       end
  3309.       for id in data[3]
  3310.         $game_switches[id] = false if id > 0
  3311.         @switches[id.abs] = false  if id < 0
  3312.       end
  3313.       @program_switch.delete(data)
  3314.       program_check
  3315.     end  
  3316.   end
  3317.   #--------------------------------------------------------------------------
  3318.   # ● バトルプログラム BGM/BGSの開始
  3319.   #--------------------------------------------------------------------------
  3320.   def start_sound(data)
  3321.     @program_sound.push(data)
  3322.     name = data[5]
  3323.     case data[2]
  3324.     when "se"
  3325.       Audio.se_play("Audio/SE/" + name, data[4], data[3])
  3326.     when "bgm"
  3327.       name = RPG::BGM.last.name if data[5] == ""
  3328.       Audio.bgm_play("Audio/BGM/" + name, data[4], data[3])
  3329.     when "bgs"
  3330.       name = RPG::BGS.last.name if data[5] == ""
  3331.       Audio.bgs_play("Audio/BGS/" + name, data[4], data[3])
  3332.     end
  3333.   end
  3334.   #--------------------------------------------------------------------------
  3335.   # ● バトルプログラム 周期SEの開始
  3336.   #--------------------------------------------------------------------------
  3337.   def start_program_se(data)
  3338.     data[3] = [data[2], data[3]]
  3339.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3340.     @program_se.push(data)
  3341.     Audio.se_play("Audio/SE/" + data[7], data[5], data[4]) if data[6]
  3342.   end
  3343.   #--------------------------------------------------------------------------
  3344.   # ● 周期SEの更新
  3345.   #--------------------------------------------------------------------------
  3346.   def update_program_se
  3347.     for data in @program_se
  3348.       data[2] -= 1
  3349.       next @program_se.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3350.       next @program_se.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3351.       next if data[2] != 0
  3352.       Audio.se_play("Audio/SE/" + data[7], data[5], data[4])
  3353.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3354.     end  
  3355.   end
  3356.   #--------------------------------------------------------------------------
  3357.   # ● バトルプログラム 周期シェイクの開始
  3358.   #--------------------------------------------------------------------------
  3359.   def start_program_shake(data)
  3360.     data[3] = [data[2], data[3]]
  3361.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3362.     @program_shake.push(data)
  3363.     shake(data[4], data[5], data[6]) if data[7]
  3364.   end
  3365.   #--------------------------------------------------------------------------
  3366.   # ● 周期シェイクの更新
  3367.   #--------------------------------------------------------------------------
  3368.   def update_program_shake
  3369.     for data in @program_shake
  3370.       data[2] -= 1
  3371.       next @program_shake.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3372.       next @program_shake.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3373.       next if data[2] != 0
  3374.       shake(data[4], data[5], data[6])
  3375.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3376.     end  
  3377.   end
  3378.   #--------------------------------------------------------------------------
  3379.   # ● バトルプログラム 周期色調変更の開始
  3380.   #--------------------------------------------------------------------------
  3381.   def start_program_color(data)
  3382.     data[3] = [data[2], data[3]]
  3383.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3384.     data[7] = true if data[4] == 0 or data[4] == 4
  3385.     case data[4]
  3386.     when 1   ;data[4] = $game_troop.members
  3387.     when 2   ;data[4] = $game_party.battle_members
  3388.     when 3,4 ;data[4] = $game_troop.members + $game_party.battle_members
  3389.     else ;data[4] = []
  3390.     end
  3391.     @program_color.push(data)
  3392.     return if !data[6]
  3393.     for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3394.     @color_set[1] = data[5] if data[7]
  3395.     @color_set[2] = data[5] if data[7]
  3396.   end
  3397.   #--------------------------------------------------------------------------
  3398.   # ● 周期色調変更の更新
  3399.   #--------------------------------------------------------------------------
  3400.   def update_program_color
  3401.     for data in @program_color
  3402.       data[2] -= 1
  3403.       next @program_color.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3404.       next @program_color.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3405.       next if data[2] != 0
  3406.       for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3407.       @color_set[1] = data[5] if data[7]
  3408.       @color_set[2] = data[5] if data[7]
  3409.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3410.     end
  3411.   end
  3412.   #--------------------------------------------------------------------------
  3413.   # ● トランジション実行
  3414.   #--------------------------------------------------------------------------
  3415.   def perform_transition(data)
  3416.     Graphics.transition(data[2], "Graphics/Pictures/" + data[3], data[1])
  3417.   end  
  3418.   #--------------------------------------------------------------------------
  3419.   # ● 背景からカメラの限界値を取得  data = [max_top, max_bottom, max_left, max_right]
  3420.   #--------------------------------------------------------------------------
  3421.   def setting(index, data)
  3422.     @max_data[index - 1] = data
  3423.     return if index != 2
  3424.     setup
  3425.     # カメラの中心座標
  3426.     @center_x     = (Graphics.width / 2 + N03::CAMERA_POSITION[0]) * 100
  3427.     @center_y     = (Graphics.height / 2 + N03::CAMERA_POSITION[1]) * 100
  3428.     # 上下左右の移動限界距離
  3429.     @max_top    = [@max_data[0][5], @max_data[1][5]].min * -1
  3430.     @max_bottom = [@max_data[0][1], @max_data[1][1]].min + @max_top
  3431.     @max_left   = [@max_data[0][4], @max_data[1][4]].min  * -1
  3432.     @max_right  = [@max_data[0][3], @max_data[1][3]].min + @max_left
  3433.     exist_data = @max_data[0] if !@max_data[1][6]
  3434.     exist_data = @max_data[1] if !@max_data[0][6]
  3435.     @max_top    = exist_data[5] * -1        if exist_data != nil
  3436.     @max_bottom = exist_data[1] + @max_top  if exist_data != nil
  3437.     @max_left   = exist_data[4] * -1        if exist_data != nil
  3438.     @max_right  = exist_data[3] + @max_left if exist_data != nil
  3439.     @max_top = @max_bottom = @max_left = @max_right = 0 if !@max_data[1][6] && !@max_data[0][6]
  3440.     @max_width    = @max_right - @max_left + Graphics.width
  3441.     @max_height   = @max_bottom - @max_top + Graphics.height
  3442.     # ズームアウト限界値
  3443.     max_zoom_x    = 100 * Graphics.width / @max_width
  3444.     max_zoom_y    = 100 * Graphics.height / @max_height
  3445.     @max_zoom_out = [max_zoom_x, max_zoom_y].max
  3446.   end
  3447.   #--------------------------------------------------------------------------
  3448.   # ● カメラ移動
  3449.   #--------------------------------------------------------------------------
  3450.   def move(target_x, target_y, zoom, time, screen = true)
  3451.     # 戦闘背景以上のサイズまでズームアウトしないよう調整
  3452.     @target_zoom = [zoom * 0.01, @max_zoom_out * 0.01].max
  3453.     target_x *= -1 if screen && @mirror
  3454.     # ズーム分の中心座標補正
  3455.     if screen && @target_zoom != 1
  3456.       target_x = target_x + @center_x
  3457.       target_y = target_y + @center_y
  3458.     end
  3459.     adjust_x = @center_x * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3460.     adjust_y = @center_y * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3461.     adjust_x = 0 if adjust_x.nan?
  3462.     adjust_y = 0 if adjust_y.nan?
  3463.     adjust_x = @center_x if !screen && adjust_x == 0
  3464.     adjust_y = @center_y if !screen && adjust_y == 0
  3465.     @target_x = target_x - adjust_x.to_i
  3466.     @target_y = target_y - adjust_y.to_i
  3467.     @target_zoom = (@target_zoom * 1000).to_i
  3468.     @zoom = @zoom.to_i
  3469.     limit_test
  3470.     # 時間0の場合は即実行
  3471.     return @time = time.abs if time != 0
  3472.     @time = 1
  3473.     update
  3474.   end
  3475.   #--------------------------------------------------------------------------
  3476.   # ● 限界座標の試算
  3477.   #--------------------------------------------------------------------------
  3478.   def limit_test
  3479.     new_width = @max_width * @target_zoom / 1000
  3480.     new_height = @max_height * @target_zoom / 1000
  3481.     new_max_right = @max_right - (@max_width - new_width)
  3482.     new_max_bottom = @max_bottom - (@max_height - new_height)
  3483.     # 画面の移動先が限界の場合、限界座標をセット
  3484.     if @target_x < @max_left * 100
  3485.       @target_x = @max_left * 100
  3486.     end
  3487.     if @target_x > new_max_right * 100
  3488.       @target_x = new_max_right * 100
  3489.     end
  3490.     if @target_y < @max_top * 100
  3491.       @target_y = @max_top * 100
  3492.     end
  3493.     if @target_y > new_max_bottom * 100
  3494.       @target_y = new_max_bottom * 100
  3495.     end
  3496.   end
  3497.   #--------------------------------------------------------------------------
  3498.   # ● 画面のシェイク
  3499.   #--------------------------------------------------------------------------
  3500.   def shake(power, speed, time)
  3501.     @shake_x = power[0] * 100
  3502.     @shake_y = power[1] * 100
  3503.     @power_time_base = @power_time = speed
  3504.     @shake_time = time
  3505.     update_shake
  3506.   end
  3507.   #--------------------------------------------------------------------------
  3508.   # ● シェイクの更新
  3509.   #--------------------------------------------------------------------------
  3510.   def update_shake
  3511.     @sx = (@sx * (@power_time - 1) + @shake_x) / @power_time
  3512.     @sy = (@sy * (@power_time - 1) + @shake_y) / @power_time
  3513.     @power_time -= 1
  3514.     @shake_time -= 1
  3515.     return @sx = @sy = 0 if @shake_time == 0
  3516.     return if @power_time != 0
  3517.     @power_time = @power_time_base
  3518.     @shake_x = @shake_x * -4 / 5
  3519.     @shake_y = @shake_y * -4 / 5
  3520.   end
  3521.   #--------------------------------------------------------------------------
  3522.   # ● フレーム更新
  3523.   #--------------------------------------------------------------------------
  3524.   def update
  3525.     update_shake if @shake_time != 0
  3526.     update_program
  3527.     return if @time == 0
  3528.     @x = (@x * (@time - 1) + @target_x) / @time
  3529.     @y = (@y * (@time - 1) + @target_y) / @time
  3530.     @zoom = (@zoom * (@time - 1) + @target_zoom) / @time
  3531.     @time -= 1
  3532.   end
  3533.   #--------------------------------------------------------------------------
  3534.   # ● フレーム更新
  3535.   #--------------------------------------------------------------------------
  3536.   def update_program
  3537.     update_program_switch if @program_switch != []
  3538.     update_program_se     if @program_se != []
  3539.     update_program_shake  if @program_shake != []
  3540.     update_program_color  if @program_color != []
  3541.   end
  3542. end
  3543.  
  3544. #==============================================================================
  3545. # ■ Scene_Battle
  3546. #------------------------------------------------------------------------------
  3547. #  バトル画面の処理を行うクラスです。
  3548. #==============================================================================
  3549. class Scene_Battle < Scene_Base
  3550.   #--------------------------------------------------------------------------
  3551.   # ● フレーム更新(基本)
  3552.   #--------------------------------------------------------------------------
  3553.   alias update_basic_scene_battle_n03 update_basic
  3554.   def update_basic
  3555.     update_basic_scene_battle_n03
  3556.     $sv_camera.update
  3557.     $sv_camera.wait = N03::TURN_END_WAIT + 1 if $sv_camera.win_wait
  3558.     camera_wait
  3559.   end
  3560.   #--------------------------------------------------------------------------
  3561.   # ● カメラウェイト
  3562.   #--------------------------------------------------------------------------
  3563.   def camera_wait
  3564.     process_event if $sv_camera.event
  3565.     $sv_camera.event = false if $sv_camera.event
  3566.     while $sv_camera.wait != 0
  3567.       Graphics.update
  3568.       Input.update
  3569.       update_all_windows
  3570.       $game_timer.update
  3571.       $game_troop.update
  3572.       $sv_camera.update
  3573.       @spriteset.update
  3574.       update_info_viewport
  3575.       update_message_open
  3576.       $sv_camera.wait -= 1 if $sv_camera.wait > 0
  3577.       $sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
  3578.       BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
  3579.     end
  3580.   end
  3581.   #--------------------------------------------------------------------------
  3582.   # ● カメラウェイトのセット
  3583.   #--------------------------------------------------------------------------
  3584.   def set_camera_wait(time)
  3585.     $sv_camera.wait = time
  3586.     camera_wait
  3587.   end  
  3588.   #--------------------------------------------------------------------------
  3589.   # ● エフェクト実行が終わるまでウェイト ★再定義
  3590.   #--------------------------------------------------------------------------
  3591.   def wait_for_effect
  3592.   end
  3593.   #--------------------------------------------------------------------------
  3594.   # ● ターン開始
  3595.   #--------------------------------------------------------------------------
  3596.   alias turn_start_scene_battle_n03 turn_start
  3597.   def turn_start
  3598.     turn_start_scene_battle_n03
  3599.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始後"].dup)
  3600.   end
  3601.   #--------------------------------------------------------------------------
  3602.   # ● ターン終了
  3603.   #--------------------------------------------------------------------------
  3604.   alias turn_end_scene_battle_n03 turn_end
  3605.   def turn_end
  3606.     turn_end_scene_battle_n03
  3607.     for member in $game_troop.members + $game_party.members
  3608.       N03.set_damage(member, member.sv.result_damage[0],member.sv.result_damage[1])
  3609.       member.sv.result_damage = [0,0]
  3610.       @spriteset.set_damage_pop(member) if member.result.hp_damage != 0 or member.result.mp_damage != 0
  3611.     end
  3612.     set_camera_wait(N03::TURN_END_WAIT)
  3613.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup) if $game_party.inputable?
  3614.     @log_window.clear
  3615.   end
  3616.   #--------------------------------------------------------------------------
  3617.   # ● スキル/アイテムの使用 ★再定義
  3618.   #--------------------------------------------------------------------------
  3619.   def use_item
  3620.     item = @subject.current_action.item
  3621.     display_item(item)
  3622.     @subject.use_item(item)
  3623.     refresh_status
  3624.     @targets = @subject.current_action.make_targets.compact
  3625.     @targets = [@subject] if @targets.size == 0
  3626.     set_substitute(item)
  3627.     for time in item.repeats.times do play_sideview(@targets, item) end
  3628.     end_reaction(item)
  3629.     display_end_item
  3630.   end
  3631.   #--------------------------------------------------------------------------
  3632.   # ● スキル/アイテム名の表示
  3633.   #--------------------------------------------------------------------------
  3634.   def display_item(item)
  3635.     return @log_window.display_use_item(@subject, item) if N03::BATTLE_LOG
  3636.     @log_window.off
  3637.     @skill_name_window = Window_Skill_name.new(item.name) unless N03::NO_DISPLAY_SKILL_ID.include?(item.id) && item.is_a?(RPG::Skill)
  3638.   end  
  3639.   #--------------------------------------------------------------------------
  3640.   # ● スキル/アイテム名の表示終了
  3641.   #--------------------------------------------------------------------------
  3642.   def display_end_item
  3643.     @skill_name_window.dispose if @skill_name_window != nil
  3644.     @skill_name_window = nil
  3645.     set_camera_wait(N03::ACTION_END_WAIT) if @subject.sv.derivation_skill_id == 0
  3646.     @log_window.clear if N03::BATTLE_LOG
  3647.   end  
  3648.   #--------------------------------------------------------------------------
  3649.   # ● 反撃/魔法反射/身代わり処理
  3650.   #--------------------------------------------------------------------------
  3651.   def end_reaction(item)
  3652.     end_substitute if @substitute != nil
  3653.     set_reflection(item) if @reflection_data != nil
  3654.     set_counter_attack if @counter_attacker != nil
  3655.   end  
  3656.   #--------------------------------------------------------------------------
  3657.   # ● 反撃の発動 ★再定義
  3658.   #--------------------------------------------------------------------------
  3659.   def invoke_counter_attack(target, item)
  3660.     return if @subject.sv.counter_id != 0
  3661.     @counter_attacker = [] if @counter_attacker == nil
  3662.     return apply_item_effects(apply_substitute(target, item), item) if !target.movable?
  3663.     @log_window.add_text(sprintf(Vocab::CounterAttack, target.name)) if N03::BATTLE_LOG
  3664.     target.sv.counter_id = target.sv.counter_skill_id
  3665.     @counter_attacker.push(target)
  3666.   end
  3667.   #--------------------------------------------------------------------------
  3668.   # ● 魔法反射の発動 ★再定義
  3669.   #--------------------------------------------------------------------------
  3670.   def invoke_magic_reflection(target, item)
  3671.     return if @subject.sv.reflection_id != 0
  3672.     @log_window.add_text(sprintf(Vocab::MagicReflection, target.name)) if N03::BATTLE_LOG
  3673.     target.sv.reflection_id = target.sv.reflection_anime_id
  3674.   end
  3675.   #--------------------------------------------------------------------------
  3676.   # ● 身代わりの適用 ★再定義
  3677.   #--------------------------------------------------------------------------
  3678.   def apply_substitute(target, item)
  3679.     return target if @substitute == nil
  3680.     return target if !check_substitute(target, item)
  3681.     return @substitute
  3682.   end
  3683.   #--------------------------------------------------------------------------
  3684.   # ● 身代わりセット
  3685.   #--------------------------------------------------------------------------
  3686.   def set_substitute(item)
  3687.     @substitute = N03.get_enemy_unit(@subject).substitute_battler
  3688.     return if @substitute == nil
  3689.     s_targets = []
  3690.     for i in [email]0...@targets.size[/email]
  3691.       next if @targets[i] == @substitute
  3692.       next if !check_substitute(@targets[i], item)
  3693.       @log_window.add_text(sprintf(Vocab::Substitute, @substitute.name, @targets[i].name))
  3694.       @targets[i].sv.start_action(@targets[i].sv.substitute_receiver_start_action)
  3695.       s_targets.push(@targets[i])
  3696.       @targets[i] = @substitute
  3697.     end
  3698.     return @substitute = nil if s_targets == []
  3699.     @substitute.sv.set_target(s_targets)
  3700.     @substitute.sv.start_action(@substitute.sv.substitute_start_action)
  3701.   end  
  3702.   #--------------------------------------------------------------------------
  3703.   # ● 身代わり終了
  3704.   #--------------------------------------------------------------------------
  3705.   def end_substitute
  3706.     for member in @substitute.sv.target_battler
  3707.       member.sv.start_action(member.sv.substitute_receiver_end_action)
  3708.     end  
  3709.     @substitute.sv.start_action(@substitute.sv.substitute_end_action)
  3710.     @substitute = nil
  3711.   end
  3712.   #--------------------------------------------------------------------------
  3713.   # ● 反撃
  3714.   #--------------------------------------------------------------------------
  3715.   def set_counter_attack
  3716.     pre_subject = @subject
  3717.     for attacker in @counter_attacker
  3718.       @subject = attacker
  3719.       item = $data_skills[attacker.sv.counter_skill_id]
  3720.       play_sideview([pre_subject], item)
  3721.     end
  3722.     # 同一カウンター者を考慮してカウンターIDの初期化はアクション後に実行
  3723.     for attacker in @counter_attacker do attacker.sv.counter_id = 0 end
  3724.     @subject = pre_subject
  3725.     @counter_attacker = nil
  3726.   end
  3727.   #--------------------------------------------------------------------------
  3728.   # ● 魔法反射
  3729.   #--------------------------------------------------------------------------
  3730.   def set_reflection(item)
  3731.     @log_window.back_to(1)
  3732.     for data in @reflection_data
  3733.       @subject.sv.damage_action(@subject, item)
  3734.       N03.set_damage_anime_data([@subject], @subject, data)
  3735.       apply_item_effects(@subject, item)
  3736.       @spriteset.set_damage_pop(@subject)
  3737.     end
  3738.     set_camera_wait(N03.get_anime_time(@reflection_data[0][0]))
  3739.     @reflection_data = nil
  3740.   end
  3741.   #--------------------------------------------------------------------------
  3742.   # ● サイドビューアクション実行
  3743.   #--------------------------------------------------------------------------
  3744.   def play_sideview(targets, item)
  3745.     @subject.sv.set_target(targets)
  3746.     return if @subject.sv.attack_action(item) == nil
  3747.     return if !@subject.movable?
  3748.     return if item.scope != 9 && item.scope != 10 && !N03.targets_alive?(targets)
  3749.     @subject.sv.start_action(@subject.sv.attack_action(item))
  3750.     @subject.sv.unshift_action(@subject.sv.flash_action) if @subject.flash_flg
  3751.     @subject.sv.active = true
  3752.     @subject.sv.command_action = false
  3753.     loop do
  3754.       update_basic
  3755.       data = @subject.sv.play_data
  3756.       @targets = N03.s_targets(@subject) if data[0] == "second_targets_set"
  3757.       N03.targets_set(@subject)          if data[0] == "targets_set"
  3758.       @immortal = N03.immortaling        if data[0] == "no_collapse" && !N03.dead_attack?(@subject, item)
  3759.       @immortal = N03.unimmortaling      if data[0] == "collapse"
  3760.       next set_move_anime(item)          if @subject.sv.m_a_data != []
  3761.       set_damage(item)                   if @subject.sv.set_damage
  3762.       break N03.derived_skill(@subject)  if @subject.sv.derivation_skill_id != 0
  3763.       break                              if @subject.sv.action_end or @subject.hidden?
  3764.     end
  3765.     @immortal = N03.unimmortaling        if @immortal
  3766.   end
  3767.   #--------------------------------------------------------------------------
  3768.   # ● ダメージの実行
  3769.   #--------------------------------------------------------------------------
  3770.   def set_damage(item)
  3771.     targets = @targets
  3772.     targets = [@subject.sv.individual_targets[0]] if @subject.sv.individual_targets.size != 0
  3773.     for target in targets do damage_anime(targets.dup, target, item) end
  3774.     @subject.sv.set_damage = false
  3775.     @subject.sv.damage_anime_data = []
  3776.   end
  3777.   #--------------------------------------------------------------------------
  3778.   # ● ダメージ戦闘アニメ処理
  3779.   #--------------------------------------------------------------------------
  3780.   def damage_anime(targets, target, item)
  3781.     @log_window.back_to(1) if @log_window.line_number == 5
  3782.     return if item.scope != 9 && item.scope != 10 && target.dead?
  3783.     @miss = false
  3784.     invoke_item(target,item)
  3785.     if target.result.missed
  3786.       target.sv.miss_action(@subject, item)
  3787.       return @miss = true
  3788.     elsif target.result.evaded or target.sv.counter_id != 0
  3789.       target.sv.evasion_action(@subject, item)
  3790.       return @miss = true
  3791.     elsif target.sv.reflection_id != 0
  3792.       N03.set_damage_anime_data(targets, target, [target.sv.reflection_id, false, false, true])
  3793.       target.sv.reflection_id = 0
  3794.       @reflection_data = [] if @reflection_data == nil
  3795.       return @reflection_data.push([N03.get_attack_anime_id(-3, @subject), false, false, true])
  3796.     end
  3797.     target.sv.damage_action(@subject, item)
  3798.     N03.set_damage(@subject, -target.result.hp_drain, -target.result.mp_drain) if target != @subject
  3799.     @spriteset.set_damage_pop(target)
  3800.     @spriteset.set_damage_pop(@subject) if target != @subject && @subject.result.hp_damage != 0 or @subject.result.mp_damage != 0
  3801.     N03.set_damage_anime_data(targets, target, @subject.sv.damage_anime_data) if @subject.sv.damage_anime_data != []
  3802.   end
  3803.   #--------------------------------------------------------------------------
  3804.   # ● 飛ばしアニメ処理
  3805.   #--------------------------------------------------------------------------
  3806.   def set_move_anime(item)
  3807.     for data in @subject.sv.m_a_data
  3808.       @subject.sv.damage_anime_data = data[4]
  3809.       hit_targets = []
  3810.       for target in data[1]
  3811.         damage_anime(data[1], target, item) if data[0]
  3812.         hit_targets.push(target) if !@miss
  3813.       end
  3814.       @miss = false if !data[3]
  3815.       @spriteset.set_hit_animation(@subject, data[2], hit_targets, @miss)
  3816.     end
  3817.     @subject.sv.set_damage = false
  3818.     @subject.sv.m_a_data = []
  3819.   end
  3820. end
  3821.  
  3822. #==============================================================================
  3823. # ■ DataManager
  3824. #------------------------------------------------------------------------------
  3825. #  データベースとゲームオブジェクトを管理するモジュールです。
  3826. #==============================================================================
  3827. module DataManager
  3828.   #--------------------------------------------------------------------------
  3829.   # ● 各種ゲームオブジェクトの作成 ★再定義
  3830.   #--------------------------------------------------------------------------
  3831.   def self.create_game_objects
  3832.     $game_temp          = Game_Temp.new
  3833.     $game_system        = Game_System.new
  3834.     $game_timer         = Game_Timer.new
  3835.     $game_message       = Game_Message.new
  3836.     $game_switches      = Game_Switches.new
  3837.     $game_variables     = Game_Variables.new
  3838.     $game_self_switches = Game_SelfSwitches.new
  3839.     $game_actors        = Game_Actors.new
  3840.     $game_party         = Game_Party.new
  3841.     $game_troop         = Game_Troop.new
  3842.     $game_map           = Game_Map.new
  3843.     $game_player        = Game_Player.new
  3844.     $sv_camera          = Battle_Camera.new
  3845.   end
  3846. end
  3847.  
  3848. #==============================================================================
  3849. # ■ BattleManager
  3850. #------------------------------------------------------------------------------
  3851. #  戦闘の進行を管理するモジュールです。
  3852. #==============================================================================
  3853. module BattleManager
  3854.   #--------------------------------------------------------------------------
  3855.   # ● エンカウント時の処理 ★再定義
  3856.   #--------------------------------------------------------------------------
  3857.   def self.on_encounter
  3858.     @preemptive = (rand < rate_preemptive)
  3859.     @surprise = (rand < rate_surprise && !@preemptive)
  3860.     $sv_camera.mirror = @surprise if N03::BACK_ATTACK
  3861.   end
  3862.   #--------------------------------------------------------------------------
  3863.   # ● 勝利の処理 ★再定義
  3864.   #--------------------------------------------------------------------------
  3865.   def self.process_victory
  3866.     $sv_camera.win_wait = true
  3867.   end  
  3868.   #--------------------------------------------------------------------------
  3869.   # ● 勝利
  3870.   #--------------------------------------------------------------------------
  3871.   def self.victory
  3872.     $sv_camera.win_wait = false
  3873.     N03.camera(nil, N03::BATTLE_CAMERA["戦闘終了時"].dup)
  3874.     for member in $game_party.members do member.sv.start_action(member.sv.win) if member.movable? end
  3875.     play_battle_end_me
  3876.     replay_bgm_and_bgs
  3877.     $game_message.add(sprintf(Vocab::Victory, $game_party.name))
  3878.     display_exp
  3879.     gain_gold
  3880.     gain_drop_items
  3881.     gain_exp
  3882.     SceneManager.return
  3883.     battle_end(0)
  3884.     return true
  3885.   end
  3886.   #--------------------------------------------------------------------------
  3887.   # ● 逃走の処理 ★再定義
  3888.   #--------------------------------------------------------------------------
  3889.   def self.process_escape
  3890.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  3891.     success = @preemptive ? true : (rand < @escape_ratio)
  3892.     Sound.play_escape
  3893.     if success
  3894.       process_abort
  3895.       for member in $game_party.members do member.sv.start_action(member.sv.escape) if member.movable? end
  3896.     else
  3897.       @escape_ratio += 0.1
  3898.       $game_message.add('\.' + Vocab::EscapeFailure)
  3899.       $game_party.clear_actions
  3900.       for member in $game_party.members do member.sv.start_action(member.sv.escape_ng) if member.movable? end
  3901.     end
  3902.     wait_for_message
  3903.     return success
  3904.   end
  3905.   #--------------------------------------------------------------------------
  3906.   # ● 次のコマンド入力へ ★再定義
  3907.   #--------------------------------------------------------------------------
  3908.   def self.next_command
  3909.     begin
  3910.       if !actor || !actor.next_command
  3911.         $game_party.battle_members[@actor_index].sv.command_action = true
  3912.         @actor_index += 1
  3913.         if @actor_index >= $game_party.members.size
  3914.           for member in $game_party.battle_members.reverse
  3915.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3916.           end
  3917.           return false
  3918.         end
  3919.       end
  3920.     end until actor.inputable?
  3921.     actor.sv.start_action(actor.sv.command_b) if actor != nil && actor.inputable?
  3922.     if pre_actor
  3923.       pre_actor.sv.start_action(pre_actor.sv.command_a) if pre_actor != nil && pre_actor.inputable?
  3924.     end
  3925.     return true
  3926.   end
  3927.   #--------------------------------------------------------------------------
  3928.   # ● 前のコマンド入力へ ★再定義
  3929.   #--------------------------------------------------------------------------
  3930.   def self.prior_command
  3931.     begin
  3932.       if !actor || !actor.prior_command
  3933.         $game_party.battle_members[@actor_index].sv.command_action = false
  3934.         @actor_index -= 1
  3935.         if @actor_index < 0
  3936.           for member in $game_party.battle_members
  3937.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3938.           end
  3939.           return false
  3940.         end
  3941.       end
  3942.     end until actor.inputable?
  3943.     actor.make_actions if actor.inputable?
  3944.     actor.sv.start_action(actor.sv.command_b) if actor.inputable?
  3945.     after_actor.sv.start_action(after_actor.sv.command_a) if after_actor != nil && after_actor.inputable?
  3946.     return true
  3947.   end
  3948.   #--------------------------------------------------------------------------
  3949.   # ● コマンド入力前のアクターを取得
  3950.   #--------------------------------------------------------------------------
  3951.   def self.pre_actor
  3952.     return if @actor_index == 0
  3953.     $game_party.members[@actor_index - 1]
  3954.   end
  3955.   #--------------------------------------------------------------------------
  3956.   # ● コマンド入力後のアクターを取得
  3957.   #--------------------------------------------------------------------------
  3958.   def self.after_actor
  3959.     $game_party.members[@actor_index + 1]
  3960.   end
  3961.   #--------------------------------------------------------------------------
  3962.   # ● 戦闘行動者を前に追加
  3963.   #--------------------------------------------------------------------------
  3964.   def self.unshift_action_battlers(battler)
  3965.     @action_battlers.unshift(battler)
  3966.   end
  3967. end  
  3968.  
  3969. #==============================================================================
  3970. # ■ Game_Battler
  3971. #------------------------------------------------------------------------------
  3972. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。
  3973. #==============================================================================
  3974. class Game_Battler < Game_BattlerBase
  3975.   #--------------------------------------------------------------------------
  3976.   # ● 公開インスタンス変数
  3977.   #--------------------------------------------------------------------------
  3978.   attr_reader   :sv                     # サイドビューデータ
  3979.   attr_accessor :flash_flg              # 閃きフラグ
  3980.   #--------------------------------------------------------------------------
  3981.   # ● オブジェクト初期化
  3982.   #--------------------------------------------------------------------------
  3983.   alias initialize_game_battler_n03 initialize
  3984.   def initialize
  3985.     initialize_game_battler_n03
  3986.     @sv = SideView.new(self)
  3987.   end
  3988.   #--------------------------------------------------------------------------
  3989.   # ● 現在の戦闘行動を除去
  3990.   #--------------------------------------------------------------------------
  3991.   alias remove_current_action_game_battler_n03 remove_current_action
  3992.   def remove_current_action
  3993.     return @sv.derivation_skill_id = 0 if @sv.derivation_skill_id != 0
  3994.     remove_current_action_game_battler_n03
  3995.   end
  3996.   #--------------------------------------------------------------------------
  3997.   # ● ターン終了処理
  3998.   #--------------------------------------------------------------------------
  3999.   alias on_turn_end_game_battler_n03 on_turn_end
  4000.   def on_turn_end
  4001.     on_turn_end_game_battler_n03
  4002.     @sv.add_state = []
  4003.     @sv.result_damage = [@result.hp_damage, @result.mp_damage]
  4004.   end
  4005.   #--------------------------------------------------------------------------
  4006.   # ● パラメータ条件比較 data = [種別, 数値, 判別]
  4007.   #--------------------------------------------------------------------------
  4008.   def comparison_parameter(data)
  4009.     return true if data[0][0] == 0
  4010.     kind = data[0]
  4011.     num = data[1]
  4012.     select = data[2]
  4013.     case kind
  4014.     when  1 ; par = level
  4015.     when  2 ; par = mhp
  4016.     when  3 ; par = mmp
  4017.     when  4 ; par = hp
  4018.     when  5 ; par = mp
  4019.     when  6 ; par = tp
  4020.     when  7 ; par = atk
  4021.     when  8 ; par = self.def
  4022.     when  9 ; par = mat
  4023.     when 10 ; par = mdf
  4024.     when 11 ; par = agi
  4025.     when 12 ; par = luk
  4026.     end
  4027.     if num < 0
  4028.       case kind
  4029.       when  4 ; num = mhp * num / 100
  4030.       when  5 ; num = mmp * num / 100
  4031.       when  6 ; num = max_tp * num / 100
  4032.       end
  4033.       num = num.abs
  4034.     end  
  4035.     case select
  4036.     when  0 ; return par == num
  4037.     when  1 ; return par < num
  4038.     when  2 ; return par > num
  4039.     end
  4040.   end
  4041.   #--------------------------------------------------------------------------
  4042.   # ● 装備条件比較 data = [装備種別, タイプID]
  4043.   #--------------------------------------------------------------------------
  4044.   def comparison_equip(data)
  4045.     kind = data[0]
  4046.     items = weapons if kind == 0
  4047.     items = armors  if kind == 1
  4048.     for item in items
  4049.       for id in data[1]
  4050.         return true if id > 0 && item.is_a?(RPG::Weapon) && item == $data_weapons[id.abs]
  4051.         return true if id > 0 && item.is_a?(RPG::Armor) && item == $data_armors[id.abs]
  4052.         return true if id < 0 && item.is_a?(RPG::Weapon) && item.wtype_id == id.abs
  4053.         return true if id < 0 && item.is_a?(RPG::Armor) && item.stype_id == id.abs
  4054.       end
  4055.     end
  4056.     return false
  4057.   end
  4058.  
  4059. end  
  4060. #==============================================================================
  4061. # ■ Game_Actor
  4062. #------------------------------------------------------------------------------
  4063. #  アクターを扱うクラスです。
  4064. #==============================================================================
  4065. class Game_Actor < Game_Battler
  4066.   #--------------------------------------------------------------------------
  4067.   # ● 公開インスタンス変数
  4068.   #--------------------------------------------------------------------------
  4069.   attr_reader :actor_id                    # ID
  4070.   #--------------------------------------------------------------------------
  4071.   # ● ID
  4072.   #--------------------------------------------------------------------------
  4073.   def id
  4074.     return @actor_id
  4075.   end
  4076.   #--------------------------------------------------------------------------
  4077.   # ● スプライトを使うか? ★再定義
  4078.   #--------------------------------------------------------------------------
  4079.   def use_sprite?
  4080.     return true
  4081.   end
  4082.   #--------------------------------------------------------------------------
  4083.   # ● ダメージ効果の実行 ★再定義
  4084.   #--------------------------------------------------------------------------
  4085.   def perform_damage_effect
  4086.     return if !N03::ACTOR_DAMAGE
  4087.     $game_troop.screen.start_shake(5, 5, 10)
  4088.     @sprite_effect_type = :blink
  4089.     Sound.play_actor_damage
  4090.   end
  4091.  
  4092. end
  4093.  
  4094. #==============================================================================
  4095. # ■ Game_Enemy
  4096. #------------------------------------------------------------------------------
  4097. #  敵キャラを扱うクラスです。
  4098. #==============================================================================
  4099. class Game_Enemy < Game_Battler
  4100.   #--------------------------------------------------------------------------
  4101.   # ● 公開インスタンス変数
  4102.   #--------------------------------------------------------------------------
  4103.   attr_reader :enemy_id                    # ID
  4104.   #--------------------------------------------------------------------------
  4105.   # ● ID
  4106.   #--------------------------------------------------------------------------
  4107.   def id
  4108.     return @enemy_id
  4109.   end
  4110.   #--------------------------------------------------------------------------
  4111.   # ● レベル
  4112.   #--------------------------------------------------------------------------
  4113.   def level
  4114.     return @sv.level
  4115.   end
  4116.   #--------------------------------------------------------------------------
  4117.   # ● ダメージ効果の実行 ★再定義
  4118.   #--------------------------------------------------------------------------
  4119.   def perform_damage_effect
  4120.     return if !N03::ENEMY_DAMAGE
  4121.     @sprite_effect_type = :blink
  4122.     Sound.play_enemy_damage
  4123.   end
  4124.   #--------------------------------------------------------------------------
  4125.   # ● 武器
  4126.   #--------------------------------------------------------------------------
  4127.   def weapons
  4128.     weapon1 = $data_weapons[@sv.enemy_weapon1_id]
  4129.     weapon2 = $data_weapons[@sv.enemy_weapon2_id]
  4130.     return [weapon1, weapon2]
  4131.   end
  4132.   #--------------------------------------------------------------------------
  4133.   # ● 防具
  4134.   #--------------------------------------------------------------------------
  4135.   def armors
  4136.     return [$data_armors[@sv.enemy_shield_id]]
  4137.   end
  4138.   #--------------------------------------------------------------------------
  4139.   # ● 二刀流の判定
  4140.   #--------------------------------------------------------------------------
  4141.   def dual_wield?
  4142.     return $data_weapons[@sv.enemy_weapon2_id] != nil
  4143.   end
  4144.   #--------------------------------------------------------------------------
  4145.   # ● バトラー画像変更
  4146.   #--------------------------------------------------------------------------
  4147.   def graphics_change(battler_name)
  4148.     @battler_name = battler_name
  4149.   end
  4150.   #--------------------------------------------------------------------------
  4151.   # ● 通常攻撃 アニメーション ID の取得
  4152.   #--------------------------------------------------------------------------
  4153.   def atk_animation_id1
  4154.     return weapons[0].animation_id if weapons[0]
  4155.     return weapons[1] ? 0 : 1
  4156.   end
  4157.   #--------------------------------------------------------------------------
  4158.   # ● 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  4159.   #--------------------------------------------------------------------------
  4160.   def atk_animation_id2
  4161.     return weapons[1] ? weapons[1].animation_id : 0
  4162.   end
  4163. end
  4164.  
  4165. #==============================================================================
  4166. # ■ Sprite_Base
  4167. #------------------------------------------------------------------------------
  4168. #  アニメーションの表示処理を追加したスプライトのクラスです。
  4169. #==============================================================================
  4170. class Sprite_Base < Sprite
  4171.   #--------------------------------------------------------------------------
  4172.   # ● アニメーションの座標更新 (ホーミングあり)
  4173.   #--------------------------------------------------------------------------
  4174.   def update_animation_position_horming
  4175.     return if @action_end_cancel
  4176.     ani_ox_set if @horming
  4177.     camera_zoom = $sv_camera.zoom
  4178.     camera_zoom = 1 if @move_anime
  4179.     kind = 1
  4180.     kind = -1 if @ani_mirror && !@anime_no_mirror
  4181.     cell_data = @animation.frames[@animation.frame_max - (@ani_duration + @ani_rate - 1) / @ani_rate].cell_data
  4182.     for i in 0..15
  4183.       @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
  4184.       @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
  4185.     end
  4186.   end
  4187.   #--------------------------------------------------------------------------
  4188.   # ● アニメーション元の座標をセット
  4189.   #--------------------------------------------------------------------------
  4190.   def ani_ox_set
  4191.     if !SceneManager.scene_is?(Scene_Battle)
  4192.       @real_x = x
  4193.       @real_y = y
  4194.     end
  4195.     @ani_ox = @real_x - ox + width / 2
  4196.     @ani_oy = @real_y - oy + height / 2
  4197.     @ani_oy -= height / 2 if @animation.position == 0
  4198.     @ani_oy += height / 2 if @animation.position == 2
  4199.   end
  4200.   #--------------------------------------------------------------------------
  4201.   # ● アニメーションの更新
  4202.   #--------------------------------------------------------------------------
  4203.   alias update_animation_sprite_base_n03 update_animation
  4204.   def update_animation
  4205.     update_animation_position_horming if animation? && SceneManager.scene_is?(Scene_Battle) && @animation.position != 3
  4206.     update_animation_sprite_base_n03
  4207.   end
  4208.   #--------------------------------------------------------------------------
  4209.   # ● アニメーションの原点設定 ★再定義
  4210.   #--------------------------------------------------------------------------
  4211.   def set_animation_origin
  4212.     return ani_ox_set if @animation.position != 3
  4213.     if viewport == nil
  4214.       @ani_ox = Graphics.width / 2
  4215.       @ani_oy = Graphics.height / 2
  4216.     else
  4217.       @ani_ox = viewport.rect.width / 2
  4218.       @ani_oy = viewport.rect.height / 2
  4219.     end
  4220.   end
  4221.   #--------------------------------------------------------------------------
  4222.   # ● アニメーションスプライトの設定 ★再定義
  4223.   #--------------------------------------------------------------------------
  4224.   def animation_set_sprites(frame)
  4225.     camera_zoom = 1
  4226.     camera_zoom = $sv_camera.zoom if @anime_camera_zoom && @animation.position != 3 && SceneManager.scene_is?(Scene_Battle)
  4227.     camera_x = $sv_camera.x
  4228.     camera_y = $sv_camera.y
  4229.     camera_x = camera_y = 0 if @animation.position == 3 or !SceneManager.scene_is?(Scene_Battle)
  4230.     plus_z = 5
  4231.     plus_z = 1000 if @animation.position == 3
  4232.     plus_z = -17 if @plus_z != nil && @plus_z == false
  4233.     plus_z = -self.z + 10 if @plus_z != nil && @plus_z == false && @animation.position == 3
  4234.     cell_data = frame.cell_data
  4235.     @ani_sprites.each_with_index do |sprite, i|
  4236.       next unless sprite
  4237.       pattern = cell_data[i, 0]
  4238.       if !pattern || pattern < 0
  4239.         sprite.visible = false
  4240.         next
  4241.       end
  4242.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  4243.       sprite.visible = true
  4244.       sprite.src_rect.set(pattern % 5 * 192,
  4245.         pattern % 100 / 5 * 192, 192, 192)
  4246.       if @ani_mirror && !@anime_no_mirror
  4247.         sprite.x = (@ani_ox - cell_data[i, 1] - camera_x) * camera_zoom
  4248.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4249.         sprite.angle = (360 - cell_data[i, 4])
  4250.         sprite.mirror = (cell_data[i, 5] == 0)
  4251.       else
  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 = cell_data[i, 4]
  4255.         sprite.mirror = (cell_data[i, 5] == 1)
  4256.       end
  4257.       sprite.z = self.z + plus_z + i
  4258.       sprite.ox = 96
  4259.       sprite.oy = 96
  4260.       sprite.zoom_x = cell_data[i, 3] * camera_zoom / 100.0
  4261.       sprite.zoom_y = cell_data[i, 3] * camera_zoom/ 100.0
  4262.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4263.       sprite.blend_type = cell_data[i, 7]
  4264.     end
  4265.   end
  4266.   #--------------------------------------------------------------------------
  4267.   # ● 子スプライトフラグ
  4268.   #--------------------------------------------------------------------------
  4269.   def set(battler, horming, camera_zoom, no_mirror)
  4270.     @battler = battler
  4271.     @next = true
  4272.     self.bitmap = Bitmap.new(@battler.sv.cw, @battler.sv.ch)
  4273.     self.ox = bitmap.width / 2
  4274.     self.oy = bitmap.height
  4275.     @horming = horming
  4276.     @anime_camera_zoom = camera_zoom
  4277.     @anime_no_mirror = no_mirror
  4278.     @battler.sv.reset_anime_data
  4279.   end  
  4280.   #--------------------------------------------------------------------------
  4281.   # ● 子スプライト座標セット
  4282.   #--------------------------------------------------------------------------
  4283.   def set_position(z, zoom_x, zoom_y, real_x, real_y)
  4284.     self.z = z
  4285.     self.zoom_x = zoom_x
  4286.     self.zoom_y = zoom_y
  4287.     @real_x = real_x
  4288.     @real_y = real_y
  4289.   end
  4290.   #--------------------------------------------------------------------------
  4291.   # ● 他スプライトへのタイミング処理
  4292.   #--------------------------------------------------------------------------
  4293.   def other_process_timing(timing)
  4294.     se_flag = true
  4295.     se_flag = @se_flag if @se_flag != nil
  4296.     @battler.sv.timing.push([se_flag, timing.dup])
  4297.   end
  4298.   #--------------------------------------------------------------------------
  4299.   # ● 他バトラーへのタイミング処理
  4300.   #--------------------------------------------------------------------------
  4301.   def target_battler_process_timing(timing)
  4302.     for target in @timing_targets
  4303.       target.sv.timing.push([false, timing.dup])
  4304.     end  
  4305.   end
  4306.   #--------------------------------------------------------------------------
  4307.   # ● SE とフラッシュのタイミング処理
  4308.   #--------------------------------------------------------------------------
  4309.   alias animation_process_timing_sprite_base_n03 animation_process_timing
  4310.   def animation_process_timing(timing)
  4311.     target_battler_process_timing(timing) if @timing_targets && @timing_targets != []
  4312.     return other_process_timing(timing) if @next != nil
  4313.     animation_process_timing_sprite_base_n03(timing)
  4314.   end
  4315.   #--------------------------------------------------------------------------
  4316.   # ● アニメーションの解放
  4317.   #--------------------------------------------------------------------------
  4318.   alias dispose_animation_sprite_base_n03 dispose_animation
  4319.   def dispose_animation
  4320.     dispose_animation_sprite_base_n03
  4321.   end
  4322. end
  4323.  
  4324.  
  4325. #==============================================================================
  4326. # ■ Sprite_Battler
  4327. #------------------------------------------------------------------------------
  4328. #  バトラー表示用のスプライトです。
  4329. #==============================================================================
  4330. class Sprite_Battler < Sprite_Base
  4331.   #--------------------------------------------------------------------------
  4332.   # ● 公開インスタンス変数 
  4333.   #--------------------------------------------------------------------------
  4334.   attr_accessor   :removing             # パーティ離脱中
  4335.   #--------------------------------------------------------------------------
  4336.   # ● オブジェクト初期化
  4337.   #--------------------------------------------------------------------------
  4338.   alias initialize_sprite_battler_n03 initialize
  4339.   def initialize(viewport, battler = nil)
  4340.     initialize_sprite_battler_n03(viewport, battler)
  4341.     @real_x = @real_y = 0
  4342.     update_bitmap if @battler != nil
  4343.   end
  4344.   #--------------------------------------------------------------------------
  4345.   # ● アニメーションの開始 ★再定義
  4346.   #--------------------------------------------------------------------------
  4347.   def start_animation(animation, mirror = false)
  4348.     return next_animation(animation, mirror) if animation?
  4349.     @animation = animation
  4350.     if @animation
  4351.       @horming = @battler.sv.anime_horming
  4352.       @anime_camera_zoom = @battler.sv.anime_camera_zoom
  4353.       @anime_no_mirror = @battler.sv.anime_no_mirror
  4354.       @timing_targets = @battler.sv.timing_targets
  4355.       @plus_z = @battler.sv.anime_plus_z
  4356.       @battler.sv.reset_anime_data
  4357.       @ani_mirror = mirror
  4358.       set_animation_rate
  4359.       @ani_duration = @animation.frame_max * @ani_rate + 1
  4360.       load_animation_bitmap
  4361.       make_animation_sprites
  4362.       set_animation_origin
  4363.     end
  4364.   end
  4365.   #--------------------------------------------------------------------------
  4366.   # ● 次のアニメを開始
  4367.   #--------------------------------------------------------------------------
  4368.   def next_animation(animation, mirror)
  4369.     @next_anime = [] if @next_anime == nil
  4370.     @next_anime.push(Sprite_Base.new(viewport))
  4371.     @next_anime[@next_anime.size - 1].set(battler, @battler.sv.anime_horming, @battler.sv.anime_camera_zoom, @battler.sv.anime_no_mirror)
  4372.     @next_anime[@next_anime.size - 1].set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y)
  4373.     @next_anime[@next_anime.size - 1].start_animation(animation, mirror)
  4374.   end
  4375.   #--------------------------------------------------------------------------
  4376.   # ● 影グラフィック作成
  4377.   #--------------------------------------------------------------------------
  4378.   def create_shadow
  4379.     reset_shadow
  4380.     return if @battler.sv.shadow == false
  4381.     @shadow = Sprite.new(viewport) if @shadow == nil
  4382.     @shadow.bitmap = Cache.character(@battler.sv.shadow)
  4383.     @shadow.ox = @shadow.bitmap.width / 2
  4384.     @shadow.oy = @shadow.bitmap.height / 2
  4385.   end
  4386.   #--------------------------------------------------------------------------
  4387.   # ● 影グラフィック初期化
  4388.   #--------------------------------------------------------------------------
  4389.   def reset_shadow
  4390.     return if @shadow == nil
  4391.     @shadow.dispose
  4392.     @shadow = nil
  4393.   end  
  4394.   #--------------------------------------------------------------------------
  4395.   # ● 転送元ビットマップの更新 ★再定義
  4396.   #--------------------------------------------------------------------------
  4397.   def update_bitmap
  4398.     update_bitmap_enemy if !@battler.actor?
  4399.     update_bitmap_actor if @battler.actor?
  4400.     update_src_rect if @battler != nil
  4401.     update_color if @battler != nil
  4402.   end
  4403.   #--------------------------------------------------------------------------
  4404.   # ● 転送元ビットマップ:エネミー
  4405.   #--------------------------------------------------------------------------
  4406.   def update_bitmap_enemy
  4407.     if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
  4408.       @battler_name = @battler.battler_name
  4409.       @battler_hue = @battler.battler_hue
  4410.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4411.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4412.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue)
  4413.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4414.       create_shadow
  4415.       init_visibility
  4416.       @battler_id = @battler.id
  4417.     end
  4418.   end  
  4419.   #--------------------------------------------------------------------------
  4420.   # ● 転送元ビットマップ:アクター
  4421.   #--------------------------------------------------------------------------
  4422.   def update_bitmap_actor
  4423.     if @battler.character_name != @battler_name or @battler.character_index != @battler_index
  4424.       @battler_name = @battler.character_name
  4425.       @battler_index = @battler.character_index
  4426.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4427.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4428.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
  4429.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4430.       create_shadow
  4431.       init_visibility
  4432.       @battler_id = @battler.id
  4433.     end
  4434.   end
  4435.   #--------------------------------------------------------------------------
  4436.   # ● 可視状態の初期化 ★再定義
  4437.   #--------------------------------------------------------------------------
  4438.   def init_visibility
  4439.     @battler_visible = @battler.alive?
  4440.     @battler_visible = true if @battler.sv.state(1) != "敵コラプス"
  4441.     @battler_visible = false if @battler.hidden?
  4442.     @battler.sv.opacity = 0 unless @battler_visible
  4443.     self.opacity = 0 unless @battler_visible
  4444.     self.opacity = 255 if @battler_visible
  4445.     @battler.sv.weapon_visible = @battler_visible
  4446.   end
  4447.   #--------------------------------------------------------------------------
  4448.   # ● 転送元矩形の更新
  4449.   #--------------------------------------------------------------------------
  4450.   def update_src_rect
  4451.     return if @battler.sv.collapse
  4452.     if @battler_graphic_file_index != @battler.sv.graphic_file_index
  4453.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4454.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index) if @battler.actor?
  4455.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue) if !@battler.actor?
  4456.       @battler.sv.set_graphics(self.bitmap.width, self.bitmap.height)
  4457.     end
  4458.     anime_off if @battler.sv.anime_off
  4459.     self.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4460.     self.opacity = @battler.sv.opacity if @battler_visible
  4461.     set_process_timing(@battler.sv.timing) if @battler && @battler.sv.timing != []
  4462.   end
  4463.   #--------------------------------------------------------------------------
  4464.   # ● 位置の更新 ★再定義
  4465.   #--------------------------------------------------------------------------
  4466.   def update_position
  4467.     @real_x = @battler.sv.x / 100
  4468.     @real_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust)/ 100
  4469.     self.x = @real_x - $sv_camera.x
  4470.     self.y = @real_y - $sv_camera.y
  4471.     self.z = @battler.sv.z - @battler.sv.c / 100
  4472.     if @battler.sv.h <= 0
  4473.       self.x += $sv_camera.sx / 100
  4474.       self.y += $sv_camera.sy / 100
  4475.     end  
  4476.     self.x *= $sv_camera.zoom
  4477.     self.y *= $sv_camera.zoom
  4478.   end
  4479.   #--------------------------------------------------------------------------
  4480.   # ● 原点の更新 ★再定義
  4481.   #--------------------------------------------------------------------------
  4482.   def update_origin
  4483.     return if !bitmap or @battler.sv.collapse
  4484.     self.ox = @battler.sv.ox
  4485.     self.oy = @battler.sv.oy
  4486.     self.angle = @battler.sv.angle
  4487.     self.zoom_x = @battler.sv.zoom_x * $sv_camera.zoom
  4488.     self.zoom_y = @battler.sv.zoom_y * $sv_camera.zoom
  4489.     self.mirror = @battler.sv.mirror if !@graphic_mirror_flag
  4490.     self.mirror = !@battler.sv.mirror if @graphic_mirror_flag
  4491.   end
  4492.   #--------------------------------------------------------------------------
  4493.   # ● 影グラフィックの更新
  4494.   #--------------------------------------------------------------------------
  4495.   def update_shadow
  4496.     @shadow.visible = @battler.sv.shadow_visible
  4497.     @shadow.opacity = @battler.sv.opacity if @battler.sv.opacity_data[3]
  4498.     @shadow.opacity = self.opacity if !@battler.sv.opacity_data[3]
  4499.     @shadow.x = @real_x - $sv_camera.x
  4500.     @shadow.y = (@battler.sv.y - @battler.sv.c)/ 100 - $sv_camera.y
  4501.     @shadow.z = @battler.sv.z - 10
  4502.     @shadow.zoom_x = $sv_camera.zoom
  4503.     @shadow.zoom_y = $sv_camera.zoom
  4504.     @shadow.x += $sv_camera.sx / 100
  4505.     @shadow.y += $sv_camera.sy / 100
  4506.     @shadow.x *= $sv_camera.zoom
  4507.     @shadow.y *= $sv_camera.zoom
  4508.     @shadow.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4509.   end
  4510.   #--------------------------------------------------------------------------
  4511.   # ● ふきだしの更新
  4512.   #--------------------------------------------------------------------------
  4513.   def update_balloon
  4514.     if @battler.sv.balloon_data == [] && @balloon
  4515.       @balloon_data = []
  4516.       @balloon.dispose
  4517.       return @balloon = nil
  4518.     elsif @battler.sv.balloon_data != [] && @battler.sv.balloon_data != @balloon_data
  4519.       @balloon_data = @battler.sv.balloon_data
  4520.       @balloon = Sprite.new(self.viewport)
  4521.       @balloon.bitmap = Cache.system("Balloon")
  4522.       @balloon.zoom_x = @balloon_data[3]
  4523.       @balloon.zoom_y = @balloon_data[3]
  4524.       @balloon.ox = 32 if @battler.sv.mirror
  4525.       @balloon.oy = 16
  4526.       @balloon_count = 0
  4527.     end
  4528.     return if !@balloon
  4529.     @balloon.opacity = self.opacity
  4530.     @balloon.x = self.x
  4531.     @balloon.y = self.y - @battler.sv.ch * $sv_camera.zoom
  4532.     @balloon.z = self.z + 20
  4533.     @balloon.src_rect.set(32 + @balloon_count / @balloon_data[2] * 32, @balloon_data[1] * 32, 32, 32) if @balloon_count % @balloon_data[2] == 0
  4534.     @balloon.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4535.     @balloon_count += 1
  4536.     @balloon_count = 0 if @balloon_count == @balloon_data[2] * 7
  4537.   end
  4538.   #--------------------------------------------------------------------------
  4539.   # ● 色調変更の更新
  4540.   #--------------------------------------------------------------------------
  4541.   def update_color
  4542.     color_set if @battler.sv.color_set != []
  4543.     return if @color_data == nil
  4544.     @color_data[4] -= 1
  4545.     if @color_data[4] == 0 && @color_data[5] != 0
  4546.       @color_data[4] = @color_data[5]
  4547.       @color_data[5] = 0
  4548.       @color_data[6] = [0,0,0,0]
  4549.     elsif @color_data[4] == 0
  4550.       @remain_color_data = @color_data
  4551.       @battler.sv.color = @color_data.dup
  4552.       return @color_data = nil
  4553.     end  
  4554.     for i in 0..3
  4555.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  4556.     end  
  4557.     @battler.sv.color = @color_data.dup
  4558.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  4559.   end
  4560.   #--------------------------------------------------------------------------
  4561.   # ● 残像の更新
  4562.   #--------------------------------------------------------------------------
  4563.   def update_mirage
  4564.     if @battler.sv.mirage == [] && @mirages
  4565.       @mirage_data = []
  4566.       for mirage in @mirages do mirage.dispose end
  4567.       return @mirages = nil
  4568.     elsif @battler.sv.mirage != [] && @battler.sv.mirage != @mirage_data
  4569.       @mirage_data = @battler.sv.mirage
  4570.       @mirages = []
  4571.       for i in 0...@mirage_data[1] do @mirages[i] = Sprite.new(self.viewport) end
  4572.       @mirage_count = 0
  4573.     end
  4574.     return if !@mirages
  4575.     @mirage_count += 1
  4576.     @mirage_count = 0 if @mirage_count == @mirage_data[2] * @mirages.size
  4577.     for i in [email]0...@mirages.size[/email]
  4578.       mirage_body(@mirages[i], @mirage_data[4]) if @mirage_count == 1 + i * @mirage_data[2]
  4579.     end
  4580.   end
  4581.   #--------------------------------------------------------------------------
  4582.   # ● 残像本体
  4583.   #--------------------------------------------------------------------------
  4584.   def mirage_body(body, opacity)
  4585.     body.bitmap = self.bitmap.dup
  4586.     body.x = self.x
  4587.     body.y = self.y
  4588.     body.ox = self.ox
  4589.     body.oy = self.oy
  4590.     body.z = self.z - 20
  4591.     body.mirror = self.mirror
  4592.     body.angle = self.angle
  4593.     body.opacity = opacity * self.opacity / 255
  4594.     body.zoom_x = self.zoom_x
  4595.     body.zoom_y = self.zoom_y   
  4596.     body.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4597.     body.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4598.   end   
  4599.   #--------------------------------------------------------------------------
  4600.   # ● 次のアニメを更新
  4601.   #--------------------------------------------------------------------------
  4602.   def update_next_anime
  4603.     return if !@next_anime
  4604.     for anime in @next_anime
  4605.       anime.update
  4606.       anime.set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y) if @horming
  4607.       anime.dispose if !anime.animation?
  4608.       @next_anime.delete(anime) if !anime.animation?
  4609.     end  
  4610.   end
  4611.   #--------------------------------------------------------------------------
  4612.   # ● フレーム更新
  4613.   #--------------------------------------------------------------------------
  4614.   alias update_sprite_battler_n03 update
  4615.   def update
  4616.     @battler.sv.update if @battler
  4617.     update_sprite_battler_n03
  4618.     update_next_anime
  4619.     update_shadow  if @battler && @shadow
  4620.     update_mirage  if @battler
  4621.     update_balloon if @battler
  4622.     update_remove if @battler && @removing && @battler.sv.change_up
  4623.   end
  4624.   #--------------------------------------------------------------------------
  4625.   # ● 戦闘アニメ消去
  4626.   #--------------------------------------------------------------------------
  4627.   def anime_off
  4628.     @battler.sv.anime_off = false
  4629.     dispose_animation
  4630.     for anime in @next_anime do anime.dispose_animation end if @next_anime
  4631.   end
  4632.   #--------------------------------------------------------------------------
  4633.   # ● バトラー入れ替え
  4634.   #--------------------------------------------------------------------------
  4635.   def remove
  4636.     @battler.sv.start_action(@battler.sv.remove_action)
  4637.     $sv_camera.wait = 40
  4638.     @battler.sv.add_action("eval('set_change')")
  4639.     @removing = true
  4640.   end
  4641.   #--------------------------------------------------------------------------
  4642.   # ● バトラー入れ替えの更新
  4643.   #--------------------------------------------------------------------------
  4644.   def update_remove
  4645.     @battler.sv.change_up = false
  4646.     @removing = false
  4647.     @battler = nil
  4648.   end  
  4649.   #--------------------------------------------------------------------------
  4650.   # ● バトラー加入
  4651.   #--------------------------------------------------------------------------
  4652.   def join(join_battler)
  4653.     $sv_camera.wait = 30
  4654.     @battler = join_battler
  4655.     @battler_name = @battler.character_name
  4656.     @battler_index = @battler.character_index
  4657.     @battler_graphic_file_index = @battler.sv.graphic_file_index
  4658.     self.bitmap = Cache.character(@battler_name)
  4659.     @battler.sv.setup(self.bitmap.width, self.bitmap.height, true)
  4660.     create_shadow
  4661.     init_visibility
  4662.   end
  4663.   #--------------------------------------------------------------------------
  4664.   # ● 通常の設定に戻す ★再定義
  4665.   #--------------------------------------------------------------------------
  4666.   def revert_to_normal
  4667.     self.blend_type = 0
  4668.     self.opacity = 255
  4669.   end
  4670.   #--------------------------------------------------------------------------
  4671.   # ● 崩壊エフェクトの更新
  4672.   #--------------------------------------------------------------------------
  4673.   alias update_collapse_sprite_battler_n03 update_collapse
  4674.   def update_collapse
  4675.     return if @battler.sv.state(1) != "敵コラプス"
  4676.     update_collapse_sprite_battler_n03
  4677.     @battler.sv.weapon_visible = false
  4678.   end
  4679.   #--------------------------------------------------------------------------
  4680.   # ● ボス崩壊エフェクトの更新 ★再定義
  4681.   #--------------------------------------------------------------------------
  4682.   def update_boss_collapse
  4683.     @effect_duration = @battler.sv.ch if @effect_duration >= @battler.sv.ch
  4684.     alpha = @effect_duration * 120 / @battler.sv.ch
  4685.     self.ox = @battler.sv.cw / 2 + @effect_duration % 2 * 4 - 2
  4686.     self.blend_type = 1
  4687.     self.color.set(255, 255, 255, 255 - alpha)
  4688.     self.opacity = alpha
  4689.     self.src_rect.y -= 1
  4690.     Sound.play_boss_collapse2 if @effect_duration % 20 == 19
  4691.   end
  4692.   #--------------------------------------------------------------------------
  4693.   # ● 別スプライトからのタイミング処理
  4694.   #--------------------------------------------------------------------------
  4695.   def set_process_timing(timing_data)
  4696.     for data in timing_data
  4697.       set_timing(data[0],data[1])
  4698.     end
  4699.     @battler.sv.timing = []
  4700.   end
  4701.   #--------------------------------------------------------------------------
  4702.   # ● タイミング処理
  4703.   #--------------------------------------------------------------------------
  4704.   def set_timing(se_flag, data)
  4705.     @ani_rate = 4
  4706.     data.se.play if se_flag
  4707.     case data.flash_scope
  4708.     when 1 ;self.flash(data.flash_color, data.flash_duration * @ani_rate)
  4709.     when 2 ;viewport.flash(data.flash_color, data.flash_duration * @ani_rate) if viewport
  4710.     when 3 ;self.flash(nil, data.flash_duration * @ani_rate)
  4711.     end
  4712.   end
  4713.   #--------------------------------------------------------------------------
  4714.   # ● 色調変更
  4715.   #--------------------------------------------------------------------------
  4716.   def color_set
  4717.     set = @battler.sv.color_set
  4718.     @battler.sv.color_set= []
  4719.     set[4] = 1 if set[4] == 0
  4720.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  4721.     @color_data = @remain_color_data
  4722.     @color_data[4] = set[4]
  4723.     @color_data[5] = set[5]
  4724.     @color_data[6] = set
  4725.   end
  4726.   #--------------------------------------------------------------------------
  4727.   # ● 解放
  4728.   #--------------------------------------------------------------------------
  4729.   alias dispose_sprite_battler_n03 dispose
  4730.   def dispose
  4731.     dispose_sprite_battler_n03
  4732.     @shadow.dispose if @shadow != nil
  4733.     @balloon.dispose if @balloon != nil
  4734.     for mirage in @mirages do mirage.dispose end if @mirages != nil
  4735.     for anime in @next_anime do anime.dispose end if @next_anime
  4736.   end
  4737. end
  4738.  
  4739.  
  4740. #==============================================================================
  4741. # ■ Spriteset_Battle
  4742. #------------------------------------------------------------------------------
  4743. #  バトル画面のスプライトをまとめたクラスです。
  4744. #==============================================================================
  4745. class Spriteset_Battle
  4746.   #--------------------------------------------------------------------------
  4747.   # ● 戦闘背景(床)スプライトの作成 ★再定義
  4748.   #--------------------------------------------------------------------------
  4749.   def create_battleback1
  4750.     @back1_sprite = Sprite_Battle_Back.new(@viewport1, 1, battleback1_name)
  4751.     @back1_sprite.set_graphics(battleback1_bitmap) if battleback1_name != nil
  4752.     @back1_sprite.z = 0
  4753.   end
  4754.   #--------------------------------------------------------------------------
  4755.   # ● 戦闘背景(壁)スプライトの作成 ★再定義
  4756.   #--------------------------------------------------------------------------
  4757.   def create_battleback2
  4758.     @back2_sprite = Sprite_Battle_Back.new(@viewport1, 2, battleback2_name)
  4759.     @back2_sprite.set_graphics(battleback2_bitmap) if battleback2_name != nil
  4760.     @back2_sprite.z = 1
  4761.   end
  4762.   #--------------------------------------------------------------------------
  4763.   # ● アクタースプライトの作成 ★再定義
  4764.   #--------------------------------------------------------------------------
  4765.   def create_actors
  4766.     @actor_sprites = []
  4767.     for i in 0...$game_party.max_battle_members
  4768.       @actor_sprites[i] = Sprite_Battler.new(@viewport1, $game_party.members[i])
  4769.     end
  4770.     @effect_sprites = Spriteset_Sideview.new(@viewport1)
  4771.   end
  4772.   #--------------------------------------------------------------------------
  4773.   # ● アクタースプライトの更新 ★再定義
  4774.   #--------------------------------------------------------------------------
  4775.   def update_actors
  4776.     @actor_sprites.each_with_index do |sprite, i|
  4777.       sprite_join($game_party.members[i], sprite) if sprite.battler == nil && sprite.battler != $game_party.members[i]
  4778.       sprite.remove if sprite.battler != nil && !sprite.removing && sprite.battler != $game_party.members[i]
  4779.       sprite.update
  4780.     end
  4781.     @effect_sprites.update
  4782.     update_program
  4783.   end
  4784.   #--------------------------------------------------------------------------
  4785.   # ● メンバーを加える
  4786.   #--------------------------------------------------------------------------
  4787.   def sprite_join(member, sprite)
  4788.     for sp in @actor_sprites
  4789.       sp.update_remove if member == sp.battler && !sp.battler.sv.change_up
  4790.     end
  4791.     sprite.join(member)
  4792.   end
  4793.   #--------------------------------------------------------------------------
  4794.   # ● バトルプログラムの更新
  4795.   #--------------------------------------------------------------------------
  4796.   def update_program
  4797.     return if $sv_camera.program_scroll == []
  4798.     for data in  $sv_camera.program_scroll
  4799.       @back1_sprite.start_back_data(data) if data[2] == 1
  4800.       @back2_sprite.start_back_data(data) if data[2] == 2
  4801.     end
  4802.     $sv_camera.program_scroll = []
  4803.   end
  4804.   #--------------------------------------------------------------------------
  4805.   # ● ヒット時の戦闘アニメ実行
  4806.   #--------------------------------------------------------------------------
  4807.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  4808.     @effect_sprites.set_hit_animation(battler, weapon_index, hit_targets, miss)
  4809.   end
  4810.   #--------------------------------------------------------------------------
  4811.   # ● ダメージPOP
  4812.   #--------------------------------------------------------------------------
  4813.   def set_damage_pop(target)
  4814.     @effect_sprites.set_damage_pop(target)
  4815.   end
  4816.   #--------------------------------------------------------------------------
  4817.   # ● 解放
  4818.   #--------------------------------------------------------------------------
  4819.   alias dispose_spriteset_battle_n03 dispose
  4820.   def dispose
  4821.     dispose_spriteset_battle_n03
  4822.     @effect_sprites.dispose
  4823.   end
  4824.  
  4825.  
  4826.  
  4827. end
  4828.  
  4829.  
  4830. #==============================================================================
  4831. # ■ Window_BattleLog
  4832. #------------------------------------------------------------------------------
  4833. #  戦闘の進行を実況表示するウィンドウです。
  4834. #==============================================================================
  4835. class Window_BattleLog < Window_Selectable
  4836.   #--------------------------------------------------------------------------
  4837.   # ● ウェイト ★再定義
  4838.   #--------------------------------------------------------------------------
  4839.   def wait
  4840.   end
  4841.   #--------------------------------------------------------------------------
  4842.   # ● ウェイトとクリア ★再定義
  4843.   #--------------------------------------------------------------------------
  4844.   def wait_and_clear
  4845.     $sv_camera.wait = 10
  4846.   end
  4847.   #--------------------------------------------------------------------------
  4848.   # ● 行動結果の表示 ★再定義
  4849.   #--------------------------------------------------------------------------
  4850.   def display_action_results(target, item)
  4851.     if target.result.used
  4852.       last_line_number = line_number
  4853.       display_critical(target, item)
  4854.       display_damage(target, item)
  4855.       display_affected_status(target, item)
  4856.       display_failure(target, item)
  4857.     end
  4858.     off if !N03::BATTLE_LOG
  4859.   end
  4860.   #--------------------------------------------------------------------------
  4861.   # ● ウインドウ非表示
  4862.   #--------------------------------------------------------------------------
  4863.   def off
  4864.     @back_sprite.visible = self.visible = false
  4865.   end
  4866. end
  4867. #==============================================================================
  4868. # ■ Game_Interpreter
  4869. #------------------------------------------------------------------------------
  4870. #  イベントコマンドを実行するインタプリタです。
  4871. #==============================================================================
  4872. class Game_Interpreter
  4873.   #--------------------------------------------------------------------------
  4874.   # ● スイッチの操作
  4875.   #--------------------------------------------------------------------------
  4876.   alias command_121_game_interpreter_n03 command_121
  4877.   def command_121
  4878.     command_121_game_interpreter_n03
  4879.     $sv_camera.program_check
  4880.   end
  4881. end#==============================================================================
  4882. # ■ Sideview Ver100
  4883. #------------------------------------------------------------------------------
  4884. #  サイドビューバトラーを管理するクラスです。
  4885. #==============================================================================
  4886. class SideView
  4887.   #--------------------------------------------------------------------------
  4888.   # ● 公開インスタンス変数 
  4889.   #--------------------------------------------------------------------------
  4890.   attr_accessor   :x                    # 画面X座標
  4891.   attr_accessor   :y                    # 画面Y座標
  4892.   attr_accessor   :z                    # 画面Z座標
  4893.   attr_accessor   :h                    # 高さ座標
  4894.   attr_accessor   :j                    # ジャンプ座標
  4895.   attr_accessor   :c                    # カーブ座標
  4896.   attr_accessor   :ox                   # 横原点
  4897.   attr_accessor   :oy                   # 縦原点
  4898.   attr_accessor   :oy_adjust            # 縦原点補正
  4899.   attr_accessor   :angle                # 回転角度
  4900.   attr_accessor   :zoom_x               # 横の拡大率
  4901.   attr_accessor   :zoom_y               # 縦の拡大率
  4902.   attr_accessor   :pattern_w            # セル横位置(矩形内)
  4903.   attr_accessor   :pattern_h            # セル縦位置(矩形内)
  4904.   attr_accessor   :sx                   # セル横位置(画像全体)
  4905.   attr_accessor   :sy                   # セル縦位置(画像全体)
  4906.   attr_accessor   :pattern_type         # セル更新タイプ
  4907.   attr_accessor   :pattern_time         # セル更新間隔
  4908.   attr_accessor   :graphic_name         # バトラー画像ファイル名
  4909.   attr_accessor   :graphic_file_index   # バトラー画像ファイル名インデックス
  4910.   attr_accessor   :graphic_index        # バトラー画像インデックス
  4911.   attr_accessor   :cw                   # セル横矩形
  4912.   attr_accessor   :ch                   # セル縦矩形
  4913.   attr_accessor   :shadow_visible       # 影表示
  4914.   attr_accessor   :weapon_visible       # 武器表示
  4915.  
  4916.   attr_accessor   :wait                 # 次の動作待ち時間
  4917.   attr_accessor   :weapon_index         # 表示中の武器画像インデックス配列
  4918.   attr_accessor   :weapon_end           # 武器アニメ終了フラグ
  4919.   attr_accessor   :force_action         # 強制アクション
  4920.   attr_accessor   :target_battler       # ターゲットバトラー情報
  4921.   attr_accessor   :second_targets       # セカンドターゲット情報
  4922.   attr_accessor   :m_a_targets          # アニメ飛ばしターゲット情報
  4923.   attr_accessor   :individual_targets   # 個別処理ターゲットバトラー情報
  4924.   attr_accessor   :effect_data          # エフェクトデータ
  4925.   attr_accessor   :anime_id             # アニメID配列
  4926.   attr_accessor   :anime_move_id        # 飛ばしアニメID配列
  4927.   attr_accessor   :mirror               # 反転フラグ
  4928.   attr_accessor   :opacity              # 透明度
  4929.   attr_accessor   :opacity_data         # 透明度操作情報
  4930.   attr_accessor   :set_damage           # バトルシーンでのダメージ処理
  4931.   attr_accessor   :m_a_data             # アニメ飛ばし情報
  4932.   attr_accessor   :m_a_starter          # アニメ飛ばし開始ターゲット情報
  4933.   attr_accessor   :action_end           # バトルシーンでの行動終了
  4934.   attr_accessor   :damage_anime_data    # ダメージ戦闘アニメのデータ
  4935.   attr_accessor   :anime_no_mirror      # 戦闘アニメの反転禁止フラグ
  4936.   attr_accessor   :anime_horming        # 戦闘アニメのホーミングフラグ
  4937.   attr_accessor   :anime_camera_zoom    # 戦闘アニメがカメラに合わせて拡大縮小するか
  4938.   attr_accessor   :anime_plus_z         # 戦闘アニメZ座標補正
  4939.   attr_accessor   :derivation_skill_id  # スキル派生ID
  4940.   attr_accessor   :immortal             # 不死身フラグ
  4941.   attr_accessor   :mirage               # 残像データ
  4942.   attr_accessor   :balloon_data         # ふきだしデータ
  4943.   attr_accessor   :timing               # 別バトラーからのタイミングデータ
  4944.   attr_accessor   :timing_targets       # タイミングデータを渡す別バトラー
  4945.   attr_accessor   :color_set            # 色調変更データ
  4946.   attr_accessor   :color                # 色調データ
  4947.   attr_accessor   :change_up            # 画像変更フラグ
  4948.   attr_accessor   :hit                  # 被攻撃回数
  4949.   attr_accessor   :add_state            # 何度も付加ステートの表示を防ぐフラグ
  4950.   attr_accessor   :counter_id           # カウンター時のスキルID
  4951.   attr_accessor   :reflection_id        # 魔法反射時のアニメID
  4952.   attr_accessor   :result_damage        # ターン終了時のHP変動データ
  4953.   attr_accessor   :active               # 行動権
  4954.   attr_accessor   :anime_off            # 戦闘アニメ消去
  4955.   attr_accessor   :command_action       # コマンドアクションフラグ
  4956.  
  4957.   attr_accessor   :base_x               # 初期位置 X座標
  4958.   attr_accessor   :base_y               # 初期位置 Y座標
  4959.   attr_accessor   :base_h               # 初期位置 高さ座標
  4960.   attr_accessor   :max_pattern_w        # セルの横分割数
  4961.   attr_accessor   :max_pattern_h        # セルの縦分割数
  4962.  
  4963.   attr_reader     :collapse             # コラプスフラグ
  4964.   attr_reader     :picture              # ピクチャ表示フラグ
  4965.   #--------------------------------------------------------------------------
  4966.   # ● オブジェクト初期化
  4967.   #--------------------------------------------------------------------------
  4968.   def initialize(battler)
  4969.     @battler = battler
  4970.     reset
  4971.   end
  4972.   #--------------------------------------------------------------------------
  4973.   # ● 初期化
  4974.   #--------------------------------------------------------------------------
  4975.   def reset
  4976.     @x = 0
  4977.     @y = 0
  4978.     @z = 0
  4979.     @h = 0
  4980.     @j = 0
  4981.     @c = 0
  4982.     @jump = []
  4983.     @curve = []
  4984.     @ox = 0
  4985.     @oy = 0
  4986.     @oy_adjust = 0
  4987.     @z_plus = 0
  4988.     @move_time = 0
  4989.     @angle = 0
  4990.     @angle_time = 0
  4991.     @zoom_x = 1
  4992.     @zoom_y = 1
  4993.     @zoom_time = 0
  4994.     @pattern_w = 0
  4995.     @pattern_h = 0
  4996.     @sx = 0
  4997.     @sy = 0
  4998.     @pattern_type = 0
  4999.     @pattern_time = 0
  5000.     @pattern_rest_time = 0
  5001.     @graphic_name = ""
  5002.     @graphic_file_index = ""
  5003.     @graphic_index = 0
  5004.     @cw = 0
  5005.     @ch = 0
  5006.     @shadow_visible = false
  5007.     @weapon_visible = true
  5008.  
  5009.     @wait = 0
  5010.     @weapon_index = []
  5011.     @weapon_end = true
  5012.     @full_action = []
  5013.     @action = []
  5014.     @force_action = ""
  5015.     @target_battler = []
  5016.     @second_targets = []
  5017.     @individual_targets = []
  5018.     @m_a_targets = []
  5019.     @effect_data = []
  5020.     @anime_id = []
  5021.     @anime_move_id = []
  5022.     @opacity = 255
  5023.     @opacity_data = []
  5024.     @set_damage = false
  5025.     @m_a_data = []
  5026.     @m_a_starter = []
  5027.     @action_end = false
  5028.     @damage_anime_data = []
  5029.     @anime_no_mirror = false
  5030.     @anime_horming = false
  5031.     @anime_camera_zoom = false
  5032.     @anime_plus_z = true
  5033.     @derivation_skill_id = 0
  5034.     @immortal = false
  5035.     @mirage = []
  5036.     @play_data = []
  5037.     @balloon_data = []
  5038.     @picture = false
  5039.     @timing = []
  5040.     @timing_targets = []
  5041.     @color_set = []
  5042.     @color = []
  5043.     @change_up = false
  5044.     @non_motion = false
  5045.     @graphics_change = false
  5046.     @hit = []
  5047.     @add_state = []
  5048.     @collapse = false
  5049.     @counter_id = 0
  5050.     @reflection_id = 0
  5051.     @result_damage = [0,0]
  5052.     @active = false
  5053.     @anime_off = false
  5054.     @command_action = false
  5055.  
  5056.     @base_x = 0
  5057.     @base_y = 0
  5058.     @base_z = 0
  5059.     @base_h = 0
  5060.     @max_pattern_w = 0
  5061.     @max_pattern_h = 0
  5062.     @pattern_kind = 0
  5063.     @pattern_count = 0
  5064.     @move_time = 0
  5065.     @mirror = false
  5066.     @battler.set_graphic(@pre_change_data[0], @pre_change_data[1], @pre_change_data[2], @pre_change_data[3]) if @pre_change_data != nil
  5067.     @pre_change_data = nil
  5068.   end  
  5069.   #--------------------------------------------------------------------------
  5070.   # ● セットアップ
  5071.   #--------------------------------------------------------------------------
  5072.   def setup(bitmap_width, bitmap_height, first_action_flag)
  5073.     reset if first_action_flag
  5074.     set_data
  5075.     set_base_position if !@graphics_change
  5076.     set_graphics(bitmap_width, bitmap_height)
  5077.     set_target
  5078.     setup_graphics_change if @graphics_change
  5079.     first_battler_anime_set if first_action_flag
  5080.   end  
  5081.   #--------------------------------------------------------------------------
  5082.   # ● バトラーデータ取得
  5083.   #--------------------------------------------------------------------------
  5084.   def set_data
  5085.     return if @battler == nil
  5086.     if @battler.actor?
  5087.       @graphic_name = @battler.character_name
  5088.       @graphic_index = @battler.character_index
  5089.     else
  5090.       @graphic_name = @battler.battler_name
  5091.       @graphic_index = 0
  5092.     end
  5093.     @max_pattern_w = max_pattern[0]
  5094.     @max_pattern_h = max_pattern[1]
  5095.   end
  5096.   #--------------------------------------------------------------------------
  5097.   # ● ベース座標をセット data = [X軸, Y軸, H軸]  moment_set…瞬間配置
  5098.   #--------------------------------------------------------------------------
  5099.   def set_base_position(moment_set = true)
  5100.     mirroring_reset
  5101.     if @battler.actor?
  5102.       data = N03::ACTOR_POSITION[@battler.index].dup
  5103.       @base_x = data[0] * 100 if !@mirror
  5104.       @base_x = (Graphics.width - data[0]) * 100 if @mirror
  5105.     else
  5106.       data = [@battler.screen_x, @battler.screen_y, 0].dup
  5107.       @base_x = data[0] * 100 if !$sv_camera.mirror
  5108.       @base_x = (Graphics.width - data[0]) * 100 if $sv_camera.mirror
  5109.     end
  5110.     @base_y = data[1] * 100
  5111.     @base_h = data[2] * 100
  5112.     @base_z = @y
  5113.     return if !moment_set
  5114.     @x = @base_x
  5115.     @y = @base_y
  5116.     @z = @base_z
  5117.   end
  5118.   #--------------------------------------------------------------------------
  5119.   # ● グラフィックデータ取得
  5120.   #--------------------------------------------------------------------------
  5121.   def set_graphics(bitmap_width, bitmap_height)
  5122.     sign = @graphic_name[/^[\!\$]./]
  5123.     if sign && sign.include?('$')
  5124.       @cw = bitmap_width / @max_pattern_w
  5125.       @ch = bitmap_height / @max_pattern_h
  5126.     elsif @max_pattern_w == 1 && @max_pattern_h == 1
  5127.       @cw = bitmap_width
  5128.       @ch = bitmap_height
  5129.     else
  5130.       @cw = bitmap_width / (@max_pattern_w * 4)
  5131.       @ch = bitmap_height / (@max_pattern_h * 2)
  5132.     end
  5133.     @ox = @cw / 2
  5134.     @oy = @ch
  5135.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  5136.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  5137.   end
  5138.   #--------------------------------------------------------------------------
  5139.   # ● ターゲットをセット
  5140.   #--------------------------------------------------------------------------
  5141.   def set_target(target = nil)
  5142.     @target_battler = target
  5143.     @target_battler = [@battler] if target == nil
  5144.     @second_targets = @target_battler
  5145.   end
  5146.   #--------------------------------------------------------------------------
  5147.   # ● 画像変更用のセットアップ
  5148.   #--------------------------------------------------------------------------
  5149.   def setup_graphics_change
  5150.     @graphics_change = false
  5151.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  5152.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  5153.   end  
  5154.   #--------------------------------------------------------------------------
  5155.   # ● 戦闘開始時の待機アニメ画像データ取得
  5156.   #--------------------------------------------------------------------------
  5157.   def first_battler_anime_set
  5158.     loop do
  5159.       update
  5160.       break if @action_data == nil
  5161.       break if @action_data[0] == "motion"
  5162.       break if @action_data[0] == "move" && @action_data[8] != ""
  5163.       break if @full_action == []
  5164.     end
  5165.     start_action(first_action) if @battler.movable?
  5166.   end
  5167.   #--------------------------------------------------------------------------
  5168.   # ● アクション開始
  5169.   #--------------------------------------------------------------------------
  5170.   def start_action(kind = nil)
  5171.     return if @event_fix && $game_troop.interpreter.running?
  5172.     # ウェイト中の場合キャンセル
  5173.     return @wait -= 1 if @wait > 0 && kind == nil
  5174.     action_setup(false) if kind != nil
  5175.     set_action(kind)
  5176.     @action = kind if @action == nil
  5177.     # 行動配列が無い場合は行動終了処理へ移行
  5178.     action_terminate if @action == nil
  5179.     # 次のアクション決定
  5180.     @action_data = N03::ACTION[@action]
  5181.     next_action
  5182.   end
  5183.   #--------------------------------------------------------------------------
  5184.   # ● 行動パラメータの初期化
  5185.   #--------------------------------------------------------------------------
  5186.   def action_setup(reset = true)
  5187.     @event_fix = false
  5188.     @set_damage = false
  5189.     @action_end = false
  5190.     @balloon_data = []
  5191.     @loop_act = []
  5192.     angle_reset if reset
  5193.     zoom_reset if reset
  5194.     opacity_reset if reset
  5195.     @curve = []
  5196.     @c = 0
  5197.     convert_jump
  5198.   end  
  5199.   #--------------------------------------------------------------------------
  5200.   # ● 行動終了処理
  5201.   #--------------------------------------------------------------------------
  5202.   def action_terminate
  5203.     @mirage = [] if @mirage_end
  5204.     mirroring_reset
  5205.     @picture = false
  5206.     @individual_targets = []
  5207.     action_setup if @active
  5208.     action_setup(false) if !@active
  5209.     # 待機アクションへ移行
  5210.     stand_by_action if !@non_motion
  5211.     # 戦闘行動のアクティブ権を終了
  5212.     next_battler
  5213.   end  
  5214.   #--------------------------------------------------------------------------
  5215.   # ● 新しいアクション内容の決定
  5216.   #--------------------------------------------------------------------------
  5217.   def set_action(kind = nil)
  5218.     full_act = N03::FULLACTION[kind]
  5219.     @full_action = full_act.dup if full_act != nil
  5220.     @action = @full_action.shift
  5221.     # 参照したアクションがフルアクションであれば全体のアクションを統合
  5222.     full_act2 = N03::FULLACTION[@action]
  5223.     @full_action = full_act2.dup + @full_action if full_act2 != nil
  5224.   end
  5225.   #--------------------------------------------------------------------------
  5226.   # ● 次のアクションへ
  5227.   #--------------------------------------------------------------------------
  5228.   def next_action
  5229.     @wait = 0
  5230.     # ショートカット確認
  5231.     eval(@action) if @action != nil && @action_data == nil && N03::FULLACTION[@action] == nil
  5232.     # ウエイト設定
  5233.     @wait = @action.to_i if @wait == 0 && @action_data == nil
  5234.     @wait = rand(@wait.abs + 1) if @wait < 0
  5235.     # アクション開始
  5236.     action_play
  5237.   end
  5238.   #--------------------------------------------------------------------------
  5239.   # ● 待機アクションへ移行
  5240.   #--------------------------------------------------------------------------
  5241.   def stand_by_action
  5242.     # 通常待機に
  5243.     stand_by_act = normal
  5244.     # HPが1/4でピンチアクションに
  5245.     stand_by_act = pinch if @battler.hp <= @battler.mhp / 4
  5246.     # ステートチェック
  5247.     stand_by_act = state(@battler.states[0].id) if @battler.states[0] != nil && state(@battler.states[0].id) != nil
  5248.     # コマンドチェック
  5249.     stand_by_act = command if @command_action && command != nil
  5250.     set_action(stand_by_act)
  5251.     @action = stand_by_act if @action == nil
  5252.   end
  5253.   #--------------------------------------------------------------------------
  5254.   # ● 強制アクション開始
  5255.   #--------------------------------------------------------------------------
  5256.   def start_force_action
  5257.     return if @active
  5258.     start_action(@force_action)
  5259.     @force_action = ""
  5260.   end  
  5261.   #--------------------------------------------------------------------------
  5262.   # ● アクション追加
  5263.   #--------------------------------------------------------------------------
  5264.   def add_action(kind)
  5265.     @full_action.push(kind)
  5266.   end  
  5267.   #--------------------------------------------------------------------------
  5268.   # ● アクションの挿入
  5269.   #--------------------------------------------------------------------------
  5270.   def unshift_action(kind)
  5271.     @full_action.unshift(kind)
  5272.   end  
  5273.   #--------------------------------------------------------------------------
  5274.   # ● フレーム更新
  5275.   #--------------------------------------------------------------------------
  5276.   def update
  5277.     # アクション開始
  5278.     start_action
  5279.     # 強制アクション開始
  5280.     start_force_action if @force_action != ""
  5281.     # アニメパターン更新
  5282.     update_pattern
  5283.     # 移動更新
  5284.     update_move
  5285.     # 回転更新
  5286.     update_angle if @angle_time != 0
  5287.     # 拡大縮小更新
  5288.     update_zoom if @zoom_time != 0
  5289.     # 透明度更新
  5290.     update_opacity if @opacity_data != []
  5291.   end
  5292.   #--------------------------------------------------------------------------
  5293.   # ● アニメパターン更新
  5294.   #--------------------------------------------------------------------------
  5295.   def update_pattern
  5296.     return @pattern_rest_time -= 1 if @pattern_rest_time != 0
  5297.     return if @max_pattern_w == 1 && @max_pattern_h == 1
  5298.     @pattern_rest_time = @pattern_time
  5299.     # 再生開始・終了セル位置を取得
  5300.     if @pattern_kind > 0 # 通常再生中
  5301.       @pattern_start = 0
  5302.       @pattern_end = @max_pattern_w - 1
  5303.     elsif @pattern_kind < 0 # 逆転再生中
  5304.       @pattern_start = @max_pattern_w - 1
  5305.       @pattern_end = 0
  5306.     end
  5307.     # 片道の再生が終了
  5308.     @pattern_count += 1 if @pattern_w == @pattern_end && @pattern_kind != 0
  5309.     # ループ処理
  5310.     case @pattern_type.abs
  5311.     when  1,3 # 片道
  5312.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type ==  1
  5313.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type == -1
  5314.       @pattern_kind =  1 if @pattern_count != 0 && @pattern_type ==  3
  5315.       @pattern_kind = -1 if @pattern_count != 0 && @pattern_type == -3
  5316.       @pattern_w = @pattern_start - @pattern_kind if @pattern_count != 0 && @pattern_type.abs == 3
  5317.       @pattern_count = 0
  5318.     when  2,4 # 往復
  5319.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  2
  5320.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -2
  5321.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type ==  2
  5322.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type == -2
  5323.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  4
  5324.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -4
  5325.       @pattern_kind =  1 if @pattern_count == 2 && @pattern_type ==  4
  5326.       @pattern_kind = -1 if @pattern_count == 2 && @pattern_type == -4
  5327.       @pattern_count = 0 if @pattern_count == 2
  5328.     end
  5329.     # セル更新
  5330.     @pattern_w += 1 * @pattern_kind
  5331.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  5332.   end
  5333.   #--------------------------------------------------------------------------
  5334.   # ● 移動の更新
  5335.   #--------------------------------------------------------------------------
  5336.   def update_move
  5337.     @z = @y / 100 + @z_plus
  5338.     return if @move_time == 0
  5339.     target_position_set if @horming_move
  5340.     @x = (@x * (@move_time - 1) + @target_x) / @move_time
  5341.     @y = (@y * (@move_time - 1) + @target_y) / @move_time
  5342.     @h = (@h * (@move_time - 1) + @target_h) / @move_time if @move_h != nil
  5343.     @c += @curve[@move_time - 1] if @curve[@move_time - 1] != nil
  5344.     @j += @jump[@move_time - 1] if @jump[@move_time - 1] != nil
  5345.     @move_time -= 1
  5346.     convert_jump if @move_time == 0
  5347.   end
  5348.   #--------------------------------------------------------------------------
  5349.   # ● 移動目標の更新
  5350.   #--------------------------------------------------------------------------
  5351.   def target_position_set
  5352.     target_position = N03.get_targets_position(@move_targets, @horming_move)
  5353.     @target_x = target_position[0] + @move_x
  5354.     @target_y = target_position[1] + @move_y
  5355.     @target_h = target_position[2] + @move_h if @move_h != nil
  5356.   end  
  5357.   #--------------------------------------------------------------------------
  5358.   # ● 回転更新
  5359.   #--------------------------------------------------------------------------
  5360.   def update_angle
  5361.     @angle += @angling
  5362.     @angle_time -= 1
  5363.     return if @angle_time != 0
  5364.     return angle_reset if @angle_data[4] == 0
  5365.     angling(@angle_data) if @angle_data[4] == 2
  5366.   end  
  5367.   #--------------------------------------------------------------------------
  5368.   # ● 拡大縮小更新
  5369.   #--------------------------------------------------------------------------
  5370.   def update_zoom
  5371.     @zoom_x += @zooming_x
  5372.     @zoom_y += @zooming_y
  5373.     @zoom_time -= 1
  5374.     return if @zoom_time != 0
  5375.     return zoom_reset if @zoom_data[4] == 0
  5376.     zooming(@zoom_data) if @zoom_data[4] == 2
  5377.   end
  5378.   #--------------------------------------------------------------------------
  5379.   # ● 透明度更新
  5380.   #--------------------------------------------------------------------------
  5381.   def update_opacity
  5382.     @opacity += @opacity_data[2]
  5383.     @opacity_data[0] -= 1
  5384.     return if @opacity_data[0] != 0
  5385.     return if !@opacity_data[5]
  5386.     @opacity_data[2] *= -1
  5387.     @opacity_data[0] = @opacity_data[1]
  5388.   end
  5389.   #--------------------------------------------------------------------------
  5390.   # ● アクション実行
  5391.   #--------------------------------------------------------------------------
  5392.   def action_play
  5393.     return if @action_data == nil
  5394.     action = @action_data[0]
  5395.     # バトラー反転の場合
  5396.     return mirroring                    if action == "mirror"
  5397.     # 残像の場合
  5398.     return mirage_set                   if action == "mirage"
  5399.     # 回転の場合  
  5400.     return angling                      if action == "angle"
  5401.     # 拡大縮小の場合  
  5402.     return zooming                      if action == "zoom"
  5403.     # 透明度操作の場合  
  5404.     return set_opacity                  if action == "opacity"
  5405.     # バトラーアニメの場合
  5406.     return battler_anime                if action == "motion"
  5407.     # 移動の場合
  5408.     return move                         if action == "move"
  5409.     # 武器アニメの場合
  5410.     return weapon_anime([@action_data]) if action == "wp"
  5411.     # アニメ飛ばしの場合
  5412.     return move_anime                   if action == "m_a"
  5413.     # 戦闘シーン通信の場合(コラプス)
  5414.     return set_play_data                if action == "collapse" or action == "no_collapse"
  5415.     # データベース戦闘アニメ表示の場合  
  5416.     return battle_anime                 if action == "anime"
  5417.     # カメラワークの場合
  5418.     return camera                       if action == "camera"
  5419.     # 画面のシェイクの場合
  5420.     return shake                        if action == "shake"
  5421.     # 画面色調変更の場合
  5422.     return color_effect                 if action == "color"
  5423.     # トランジションの場合
  5424.     return transition                   if action == "ts"
  5425.     # ふきだしアニメ表示の場合  
  5426.     return balloon_anime                if action == "balloon"
  5427.     # ピクチャ表示の場合
  5428.     return picture_set                  if action == "pic"
  5429.     # ステート操作の場合
  5430.     return state_set                    if action == "sta"
  5431.     # FPS変更の場合
  5432.     return fps                          if action == "fps"
  5433.     # バトラー画像変更の場合  
  5434.     return graphics_change              if action == "change"
  5435.     # スキル派生の場合  
  5436.     return derivating_skill             if action == "der"
  5437.     # BGM/BGS/SE演奏の場合  
  5438.     return sound                        if action == "sound"
  5439.     # ムービー再生の場合  
  5440.     return movie                        if action == "movie"
  5441.     # ゲームスイッチ操作の場合  
  5442.     return switches                     if action == "switch"
  5443.     # ゲーム変数操作の場合  
  5444.     return variable                     if action == "variable"
  5445.     # 条件分岐(ゲームスイッチ)の場合
  5446.     return nece_1                       if action == "n_1"
  5447.     # 条件分岐(ゲーム変数)の場合
  5448.     return nece_2                       if action == "n_2"
  5449.     # 条件分岐(ステート)の場合
  5450.     return nece_3                       if action == "n_3"
  5451.     # 条件分岐(スキル)の場合
  5452.     return nece_4                       if action == "n_4"
  5453.     # 条件分岐(パラメータ)の場合
  5454.     return nece_5                       if action == "n_5"
  5455.     # 条件分岐(装備)の場合
  5456.     return nece_6                       if action == "n_6"
  5457.     # 条件分岐(スクリプト)の場合
  5458.     return nece_7                       if action == "n_7"
  5459.     # セカンドターゲット操作の場合  
  5460.     return second_targets_set           if action == "s_t"
  5461.     # コモンイベント呼び出しの場合  
  5462.     return call_common_event            if action == "common"
  5463.     # 戦闘アニメ消去の場合  
  5464.     return @anime_off = true            if action == "anime_off"
  5465.     # 強制戦闘終了の場合  
  5466.     return BattleManager.process_abort  if action == "battle_end"
  5467.     # 画面固定の場合  
  5468.     return Graphics.freeze              if action == "graphics_freeze"
  5469.     # ダメージアニメの場合  
  5470.     return damage_anime                 if action == "damage_anime"
  5471.     # 武器消去の場合  
  5472.     return @weapon_visible = false      if action == "weapon_off"
  5473.     # 武器消去解除の場合  
  5474.     return @weapon_visible = true       if action == "weapon_on"
  5475.     # 待機キャンセルの場合
  5476.     return @non_motion = true           if action == "non_motion"
  5477.     # 待機キャンセル解除の場合
  5478.     return @non_motion = false          if action == "non_motion_cancel"
  5479.     # 初期位置変更の場合
  5480.     return change_base_position         if action == "change_base_position"
  5481.     # 初期位置変更解除の場合
  5482.     return set_base_position(false)     if action == "set_base_position"
  5483.     # 強制アクションの場合  
  5484.     return force_act                    if action == "force_action"
  5485.     # 強制アクションの場合 (セカンドターゲット)
  5486.     return force_act2                   if action == "force_action2"
  5487.     # 個別開始の場合
  5488.     return individual_start             if action == "individual_start"
  5489.     # 個別終了の場合
  5490.     return individual_end               if action == "individual_end"
  5491.     # ループ開始の場合
  5492.     return loop_start                   if action == "loop_start"
  5493.     # ループ終了の場合
  5494.     return loop_end                     if action == "loop_end"
  5495.     # 自分のみ更新の場合
  5496.     return only_action_on               if action == "only_action_on"
  5497.     # 自分のみ更新解除の場合
  5498.     return only_action_off              if action == "only_action_off"
  5499.     # 次の行動者へ移行の場合
  5500.     return next_battler                 if action == "next_battler"
  5501.     # 画像変更フラグの場合
  5502.     return set_change                   if action == "set_change"
  5503.     # スクリプト操作の場合   
  5504.     return eval(@action_data[0])
  5505.   end
  5506.   #--------------------------------------------------------------------------
  5507.   # ● バトラー反転実行
  5508.   #--------------------------------------------------------------------------
  5509.   def mirroring
  5510.     @mirror = !@mirror
  5511.   end  
  5512.   #--------------------------------------------------------------------------
  5513.   # ● 反転初期化
  5514.   #--------------------------------------------------------------------------
  5515.   def mirroring_reset
  5516.     @mirror = false
  5517.     mirroring if !@battler.actor? && N03::ENEMY_MIRROR
  5518.     mirroring if $sv_camera.mirror
  5519.   end  
  5520.   #--------------------------------------------------------------------------
  5521.   # ● 残像実行
  5522.   #--------------------------------------------------------------------------
  5523.   def mirage_set
  5524.     @mirage = @action_data.dup
  5525.     @mirage_end = @mirage[3]
  5526.     @mirage = [] if @mirage[1] == 0
  5527.   end  
  5528.   #--------------------------------------------------------------------------
  5529.   # ● 回転実行
  5530.   #--------------------------------------------------------------------------
  5531.   def angling(data = @action_data)
  5532.     @angle_data = data.dup
  5533.     @oy = @ch / 2
  5534.     @oy_adjust = @ch * 50
  5535.     @angle_time = data[1]
  5536.     start_angle = data[2] * N03.mirror_num(@mirror)
  5537.     end_angle = data[3] * N03.mirror_num(@mirror)
  5538.     # 時間が0以下なら即座に最終角度へ
  5539.     @angle_time = 1 if @angle_time <= 0
  5540.     # 回転時間から1フレームあたりの角度を出す
  5541.     @angling = (end_angle - start_angle) / @angle_time
  5542.     # 割り切れない余りを初期角度に
  5543.     @angle = (end_angle - start_angle) % @angle_time + start_angle
  5544.   end
  5545.   #--------------------------------------------------------------------------
  5546.   # ● 回転初期化
  5547.   #--------------------------------------------------------------------------
  5548.   def angle_reset
  5549.     @oy = @ch
  5550.     @angle = @angle_time = @oy_adjust = 0
  5551.   end  
  5552.   #--------------------------------------------------------------------------
  5553.   # ● 拡大縮小実行
  5554.   #--------------------------------------------------------------------------
  5555.   def zooming(data = @action_data)
  5556.     @zoom_data = data.dup
  5557.     @zoom_time = data[1]
  5558.     start_zoom_x = data[2][0]
  5559.     start_zoom_y = data[2][1]
  5560.     end_zoom_x = data[3][0]
  5561.     end_zoom_y = data[3][1]
  5562.     # 時間が0以下なら即座に最終サイズへ
  5563.     @zoom_time = 1 if @zoom_time <= 0
  5564.     # 拡大縮小時間から1フレームあたりの拡大縮小率を出す
  5565.     @zooming_x = (end_zoom_x - start_zoom_x) / @zoom_time
  5566.     @zooming_y = (end_zoom_y - start_zoom_y) / @zoom_time
  5567.     # 開始サイズに
  5568.     @zoom_x = start_zoom_x
  5569.     @zoom_y = start_zoom_y
  5570.   end  
  5571.   #--------------------------------------------------------------------------
  5572.   # ● 拡大縮小初期化
  5573.   #--------------------------------------------------------------------------
  5574.   def zoom_reset
  5575.     @zoom_x = @zoom_y = 1
  5576.     @zoom_time = 0
  5577.   end  
  5578.   #--------------------------------------------------------------------------
  5579.   # ● バトラー透明度操作
  5580.   #--------------------------------------------------------------------------
  5581.   def set_opacity
  5582.     data = @action_data.dup
  5583.     @opacity = data[2]
  5584.     opacity_move = (data[3] - data[2])/ data[1]
  5585.     @opacity_data = [data[1], data[1], opacity_move, data[4], data[5], data[6]]
  5586.     @wait = data[1] if data[7]
  5587.     @wait *= 2 if data[6] && data[7]
  5588.   end
  5589.   #--------------------------------------------------------------------------
  5590.   # ● 透明度操作初期化
  5591.   #--------------------------------------------------------------------------
  5592.   def opacity_reset
  5593.     @opacity = 255
  5594.     @opacity = 0 if @battler.hidden?
  5595.     @opacity_data = []
  5596.   end
  5597.   #--------------------------------------------------------------------------
  5598.   # ● バトラーアニメ実行
  5599.   #--------------------------------------------------------------------------
  5600.   def battler_anime(anime_data = nil)
  5601.     anime_data = @action_data.dup if anime_data == nil
  5602.     @graphic_file_index = anime_data[1] if !graphic_fix
  5603.     @pattern_h = anime_data[2]
  5604.     @pattern_w = anime_data[3]
  5605.     @pattern_h = 0 if @max_pattern_w == 1
  5606.     @pattern_w = 0 if @max_pattern_h == 1
  5607.     @pattern_type = anime_data[4]
  5608.     @pattern_time = anime_data[5]
  5609.     @pattern_rest_time = anime_data[5]
  5610.     @pattern_count = 0
  5611.     @pattern_kind = 1
  5612.     @pattern_kind = -1 if @pattern_type < 0
  5613.     @pattern_kind = 0 if @pattern_type == 0
  5614.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  5615.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  5616.     @z_plus = anime_data[6]
  5617.     @wait = set_anime_wait if anime_data[7]
  5618.     @shadow_visible = anime_data[8]
  5619.     weapon_anime(anime_data)
  5620.   end
  5621.   #--------------------------------------------------------------------------
  5622.   # ● アニメウエイト計算
  5623.   #--------------------------------------------------------------------------
  5624.   def set_anime_wait
  5625.     if @pattern_type > 0
  5626.       pattern_time_a = @max_pattern_w - @pattern_w.abs
  5627.     elsif @pattern_type < 0
  5628.       pattern_time_a = @pattern_w.abs + 1
  5629.     else
  5630.       return @pattern_time if @pattern_type == 0
  5631.     end
  5632.     case @pattern_type
  5633.     when 1,-1, 3,-3
  5634.       return pattern_time_a * @pattern_time
  5635.     when 2,-2, 4,-4
  5636.       return pattern_time_a * @pattern_time + (@max_pattern_w - 2) * @pattern_time
  5637.     end
  5638.   end  
  5639.   #--------------------------------------------------------------------------
  5640.   # ● 移動実行
  5641.   #--------------------------------------------------------------------------
  5642.   def move
  5643.     @move_targets = N03.get_targets(@action_data[1].abs, @battler)
  5644.     return if @move_targets == []
  5645.     @move_targets = [@battler] if @action_data[1].abs == 7
  5646.     @move_x = @action_data[2] * 100 * N03.mirror_num(@mirror)
  5647.     @move_y = @action_data[3] * 100
  5648.     @move_h = @action_data[4] * 100 if @action_data[4] != nil
  5649.     @move_h = nil if @action_data[4] == nil
  5650.     battler_anime(N03::ACTION[@action_data[8]].dup) if N03::ACTION[@action_data[8]] != nil
  5651.     @horming_move = true
  5652.     @horming_move = false if @action_data[1] < 0 or @action_data[1].abs == 7
  5653.     target_position_set
  5654.     target_position = [@target_x, @target_y, @target_z]
  5655.     distanse_move = @action_data[5] > 0
  5656.     @move_time = N03.distanse_calculation(@action_data[5].abs, target_position, [@x, @y, @z], distanse_move)
  5657.     @wait = @move_time
  5658.     curve
  5659.     jump
  5660.     @move_time = 1 if @move_time == 0
  5661.     @horming_move = false if !@move_targets or @move_targets.include?(@battler)
  5662.     update_move if @move_time == 1
  5663.   end  
  5664.   #--------------------------------------------------------------------------
  5665.   # ● カーブ実行
  5666.   #--------------------------------------------------------------------------
  5667.   def curve
  5668.     @c = 0
  5669.     return if @action_data[6] == 0
  5670.     @curve = N03.parabola([@action_data[6], -@action_data[6]], @move_time, 100, 4)
  5671.   end  
  5672.   #--------------------------------------------------------------------------
  5673.   # ● ジャンプ実行
  5674.   #--------------------------------------------------------------------------
  5675.   def jump
  5676.     convert_jump
  5677.     return if @action_data[7] == [0,0]
  5678.     @jump = N03.parabola(@action_data[7].dup, @move_time, 100)
  5679.   end  
  5680.   #--------------------------------------------------------------------------
  5681.   # ● J座標(ジャンプ高度)をH座標に変換
  5682.   #--------------------------------------------------------------------------
  5683.   def convert_jump
  5684.     @h += @j
  5685.     @j = 0
  5686.     @jump = []
  5687.   end  
  5688.   #--------------------------------------------------------------------------
  5689.   # ● データベース戦闘アニメ実行
  5690.   #--------------------------------------------------------------------------
  5691.   def battle_anime
  5692.     data = @action_data.dup
  5693.     targets = N03.get_targets(data[2], @battler)
  5694.     return if targets == []
  5695.     data[8] = !data[8] if @mirror
  5696.     @set_damage           = data[5]
  5697.     @damage_anime_data[0] = N03.get_attack_anime_id(data[1], @battler)
  5698.     @damage_anime_data[1] = data[8]
  5699.     @damage_anime_data[2] = data[7]
  5700.     @damage_anime_data[3] = data[6]
  5701.     @damage_anime_data[4] = data[9]
  5702.     @wait = N03.get_anime_time(@damage_anime_data[0]) - 2 if data[4]
  5703.     return if @set_damage
  5704.     for target in targets do display_anime(targets, target, data) end
  5705.   end
  5706.   #--------------------------------------------------------------------------
  5707.   # ● 武器アニメ開始
  5708.   #--------------------------------------------------------------------------
  5709.   def weapon_anime(anime_data)
  5710.     @weapon_end = true
  5711.     for i in 9...anime_data.size
  5712.       set_effect_data(anime_data[i]) if anime_data[i] != ""
  5713.     end
  5714.   end
  5715.   #--------------------------------------------------------------------------
  5716.   # ● アニメ飛ばし開始
  5717.   #--------------------------------------------------------------------------
  5718.   def move_anime
  5719.     @m_a_starter = []
  5720.     @m_a_targets = []
  5721.     starters = N03.get_targets(@action_data[2], @battler)
  5722.     targets = N03.get_targets(@action_data[3], @battler)
  5723.     return if starters == [] or targets == []
  5724.     single_start = true if starters != nil && @action_data[2] < 0
  5725.     single_start = true if @action_data[1][0] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][0], @battler)].position == 3
  5726.     starters = [starters[0]] if single_start
  5727.     single_end = true if targets != nil && @action_data[3] < 0
  5728.     single_end = true if @action_data[1][1] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][1], @battler)].position == 3
  5729.     targets = [targets[0]] if single_end
  5730.     se_flag = true
  5731.     for starter in starters
  5732.       for target in targets
  5733.         data = @action_data.dup
  5734.         data[17] = se_flag
  5735.         @effect_data.push(data)
  5736.         @m_a_targets.push(target)
  5737.         @m_a_starter.push(starter)
  5738.         se_flag = false
  5739.       end
  5740.     end  
  5741.   end
  5742.   #--------------------------------------------------------------------------
  5743.   # ● スプライトセット通信
  5744.   #--------------------------------------------------------------------------
  5745.   def set_effect_data(data = @action)
  5746.     action_data = N03::ACTION[data]
  5747.     return if action_data == nil
  5748.     @effect_data.push(action_data.dup)
  5749.   end
  5750.   #--------------------------------------------------------------------------
  5751.   # ● 戦闘シーン通信のデータを格納
  5752.   #--------------------------------------------------------------------------
  5753.   def set_play_data(data = @action_data)
  5754.     @play_data = data.dup
  5755.   end
  5756.   #--------------------------------------------------------------------------
  5757.   # ● 戦闘アニメの表示
  5758.   #--------------------------------------------------------------------------
  5759.   def display_anime(targets, target, data)
  5760.     return if !N03.first_of_all_screen_anime(data[1], target, targets)
  5761.     target.animation_id         = N03.get_attack_anime_id(data[1], @battler)
  5762.     target.animation_mirror     = data[8]
  5763.     target.sv.anime_horming     = data[3]
  5764.     target.sv.anime_camera_zoom = data[6]
  5765.     target.sv.anime_no_mirror   = data[7]
  5766.     target.sv.anime_plus_z      = data[9]
  5767.   end
  5768.   #--------------------------------------------------------------------------
  5769.   # ● 戦闘アニメ拡張データの初期化
  5770.   #--------------------------------------------------------------------------
  5771.   def reset_anime_data
  5772.     @anime_no_mirror = false
  5773.     @anime_horming = false
  5774.     @anime_camera_zoom = false
  5775.     @timing_targets = []
  5776.     @anime_plus_z = true
  5777.   end  
  5778.   #--------------------------------------------------------------------------
  5779.   # ● カメラワーク
  5780.   #--------------------------------------------------------------------------
  5781.   def camera
  5782.     data = @action_data.dup
  5783.     N03.camera(@battler, data)
  5784.     @wait = data[4] if data[5]
  5785.   end  
  5786.   #--------------------------------------------------------------------------
  5787.   # ● 画面のシェイク
  5788.   #--------------------------------------------------------------------------
  5789.   def shake
  5790.     data = @action_data.dup
  5791.     $sv_camera.shake(data[1], data[2], data[3])
  5792.     @wait = data[3] if data[4]
  5793.   end
  5794.   #--------------------------------------------------------------------------
  5795.   # ● 画面色調変更
  5796.   #--------------------------------------------------------------------------
  5797.   def color_effect
  5798.     case @action_data[1]
  5799.     when 0,1,2,3,4,5
  5800.       targets = N03.get_targets(@action_data[1], @battler)
  5801.     when 6
  5802.       screen = true
  5803.     when 7
  5804.       targets = [@battler] + @target_battler
  5805.     when 8
  5806.       screen = true
  5807.       targets = $game_troop.members + $game_party.battle_members - [@battler]
  5808.     when 9
  5809.       screen = true
  5810.       targets = $game_troop.members + $game_party.battle_members - [@battler] - @target_battler
  5811.     when 10
  5812.       screen = true
  5813.       targets = $game_troop.members + $game_party.battle_members
  5814.     end
  5815.     return if screen == nil && targets == []
  5816.     for target in targets do target.sv.color_set = @action_data[2] end if targets
  5817.     @wait = @action_data[2][4] if @action_data[3]
  5818.     return if !screen
  5819.     $sv_camera.color_set[1] = @action_data[2]
  5820.     $sv_camera.color_set[2] = @action_data[2]
  5821.   end  
  5822.   #--------------------------------------------------------------------------
  5823.   # ● トランジション
  5824.   #--------------------------------------------------------------------------
  5825.   def transition
  5826.     $sv_camera.perform_transition(@action_data)
  5827.   end  
  5828.   #--------------------------------------------------------------------------
  5829.   # ● ふきだしアニメ表示
  5830.   #--------------------------------------------------------------------------
  5831.   def balloon_anime
  5832.     @balloon_data = @action_data.dup
  5833.   end  
  5834.   #--------------------------------------------------------------------------
  5835.   # ● ピクチャ表示
  5836.   #--------------------------------------------------------------------------
  5837.   def picture_set
  5838.     @picture = true
  5839.     set_effect_data
  5840.   end
  5841.   #--------------------------------------------------------------------------
  5842.   # ● ステート操作
  5843.   #--------------------------------------------------------------------------
  5844.   def state_set
  5845.     targets = N03.get_targets(@action_data[1], @battler)
  5846.     return if targets == []
  5847.     case @action_data[2]
  5848.     when 1 ; targets = [targets[rand(targets.size)]]
  5849.     when 2 ; targets -= @battler if targets.include?(@battler)
  5850.     end
  5851.     for target in targets
  5852.       for id in @action_data[4]
  5853.         target.add_state(id) if @action_data[3] == "+"
  5854.         target.remove_state(id) if @action_data[3] == "-"
  5855.       end
  5856.     end
  5857.   end
  5858.   #--------------------------------------------------------------------------
  5859.   # ● FPS変更
  5860.   #--------------------------------------------------------------------------
  5861.   def fps
  5862.     Graphics.frame_rate = @action_data[1]
  5863.     start_action
  5864.   end
  5865.   #--------------------------------------------------------------------------
  5866.   # ● バトラー画像変更の場合
  5867.   #--------------------------------------------------------------------------
  5868.   def graphics_change
  5869.     @graphics_change = true
  5870.     return @battler.graphics_change(@action_data[3]) if !@battler.actor?
  5871.     @pre_change_data = [@battler.character_name, @battler.character_index, @battler.face_name, @battler.face_index] if @pre_change_data == nil && !@action_data[1]
  5872.     if @action_data[4] == []
  5873.       face_name = @battler.face_name
  5874.       face_index = @battler.face_index
  5875.     else
  5876.       face_name = @action_data[4][1]
  5877.       face_index = @action_data[4][0]
  5878.     end
  5879.     @battler.set_graphic(@action_data[3], @action_data[2], face_name, face_index)
  5880.   end
  5881.   #--------------------------------------------------------------------------
  5882.   # ● スキル派生
  5883.   #--------------------------------------------------------------------------
  5884.   def derivating_skill
  5885.     # 未修得スキルは派生不可なら
  5886.     return if !@action_data[1] && !@battler.skill_learn?($data_skills[@action_data[3]])
  5887.     # コスト不足は派生不可なら
  5888.     return if !@action_data[2] && !@battler.skill_cost_payable?($data_skills[@action_data[3]])
  5889.     # 派生
  5890.     @derivation_skill_id = @action_data[3]
  5891.     # 以降のアクションをキャンセル
  5892.     @full_action = []
  5893.   end
  5894.   #--------------------------------------------------------------------------
  5895.   # ● BGM/BGS/SE演奏
  5896.   #--------------------------------------------------------------------------
  5897.   def sound
  5898.     pitch = @action_data[2]
  5899.     vol   = @action_data[3]
  5900.     name  = @action_data[4]
  5901.     case @action_data[1]
  5902.     when "se"
  5903.       Audio.se_play("Audio/SE/" + name, vol, pitch)
  5904.     when "bgm"
  5905.       # 名前指定のない場合、現在のBGMを変えないように
  5906.       name = RPG::BGM.last.name if @action_data[4] == ""
  5907.       Audio.bgm_play("Audio/BGM/" + name, vol, pitch)
  5908.     when "bgs"
  5909.       name = RPG::BGS.last.name if @action_data[4] == ""
  5910.       Audio.bgs_play("Audio/BGS/" + name, vol, pitch)
  5911.     end
  5912.   end
  5913.   #--------------------------------------------------------------------------
  5914.   # ● ムービーの再生
  5915.   #--------------------------------------------------------------------------
  5916.   def movie
  5917.     Graphics.play_movie('Movies/' + @action_data[1])
  5918.   end
  5919.   #--------------------------------------------------------------------------
  5920.   # ● ゲームスイッチ操作
  5921.   #--------------------------------------------------------------------------
  5922.   def switches
  5923.     for id in @action_data[1]
  5924.       $game_switches[id] = true if id > 0
  5925.       $sv_camera.switches[id.abs] = true  if id < 0
  5926.     end
  5927.     for id in @action_data[2]
  5928.       $game_switches[id] = false if id > 0
  5929.       $sv_camera.switches[id.abs] = false  if id < 0
  5930.     end
  5931.     $sv_camera.program_check
  5932.   end
  5933.   #--------------------------------------------------------------------------
  5934.   # ● ゲーム変数操作
  5935.   #--------------------------------------------------------------------------
  5936.   def variable
  5937.     # オペランドチェック
  5938.     operand = @action_data[3]
  5939.     operand = $game_variables[@action_data[3].abs] if @action_data[3] < 0
  5940.     # 変数操作で分岐
  5941.     case @action_data[2]
  5942.     when 0 ; $game_variables[@action_data[1]] = operand  # 代入
  5943.     when 1 ; $game_variables[@action_data[1]] += operand # 加算
  5944.     when 2 ; $game_variables[@action_data[1]] -= operand # 減算
  5945.     when 3 ; $game_variables[@action_data[1]] *= operand # 乗算
  5946.     when 4 ; $game_variables[@action_data[1]] /= operand # 除算
  5947.     when 5 ; $game_variables[@action_data[1]] %= operand # 剰余
  5948.     end
  5949.   end  
  5950.   #--------------------------------------------------------------------------
  5951.   # ● 条件分岐 (ゲームスイッチ)
  5952.   #--------------------------------------------------------------------------
  5953.   def nece_1
  5954.     judgment = $game_switches[@action_data[1]] == @action_data[2] if @action_data[1] > 0
  5955.     judgment = $sv_camera.switches[@action_data[1].abs] == @action_data[2] if @action_data[1] < 0
  5956.     action_diverging(judgment, @action_data[3])
  5957.   end  
  5958.   #--------------------------------------------------------------------------
  5959.   # ● 条件分岐 (ゲーム変数)
  5960.   #--------------------------------------------------------------------------
  5961.   def nece_2
  5962.     variable = $game_variables[@action_data[1]]
  5963.     num = @action_data[2]
  5964.     num = $game_variables[@action_data[2].abs] if num < 0
  5965.     case @action_data[3]
  5966.     when 0 ; judgment = variable == num
  5967.     when 1 ; judgment = variable < num
  5968.     when 2 ; judgment = variable > num
  5969.     end  
  5970.     action_diverging(judgment, @action_data[4])
  5971.   end  
  5972.   #--------------------------------------------------------------------------
  5973.   # ● 条件分岐 (ステート)
  5974.   #--------------------------------------------------------------------------
  5975.   def nece_3
  5976.     targets = N03.get_targets(@action_data[1], @battler)
  5977.     return if targets == []
  5978.     member_num = @action_data[4]
  5979.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  5980.     hit_count = 0
  5981.     miss_count = 0
  5982.     for target in targets
  5983.       hit_count += 1 if target.state?(@action_data[2])
  5984.       miss_count += 1 if !target.state?(@action_data[2])
  5985.     end
  5986.     case @action_data[3]
  5987.     when 0 ; judgment = hit_count >= member_num
  5988.     when 1 ; judgment = miss_count >= member_num
  5989.     end
  5990.     action_diverging(judgment, @action_data[5])
  5991.   end  
  5992.   #--------------------------------------------------------------------------
  5993.   # ● 条件分岐 (スキル)
  5994.   #--------------------------------------------------------------------------
  5995.   def nece_4
  5996.     targets = N03.get_targets(@action_data[1], @battler)
  5997.     return if targets == []
  5998.     member_num = @action_data[4]
  5999.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  6000.     hit_count = 0
  6001.     miss_count = 0
  6002.     for target in targets
  6003.       hit_count += 1 if target.skill_learn?($data_skills[@action_data[2]]) && target.skill_conditions_met?($data_skills[@action_data[2]])
  6004.       miss_count += 1 if !target.skill_learn?($data_skills[@action_data[2]]) or !target.skill_conditions_met?($data_skills[@action_data[2]])
  6005.     end
  6006.     case @action_data[3]
  6007.     when 0 ; judgment = hit_count >= member_num
  6008.     when 1 ; judgment = miss_count >= member_num
  6009.     end
  6010.     action_diverging(judgment, @action_data[5])
  6011.   end  
  6012.   #--------------------------------------------------------------------------
  6013.   # ● 条件分岐 (パラメータ)
  6014.   #--------------------------------------------------------------------------
  6015.   def nece_5
  6016.     targets = N03.get_targets(@action_data[1], @battler)
  6017.     return if targets == []
  6018.     member_num = @action_data[5]
  6019.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  6020.     hit_count = 0
  6021.     for target in targets
  6022.       hit_count += 1 if target.comparison_parameter([@action_data[2],@action_data[3],@action_data[4]])
  6023.     end
  6024.     judgment = hit_count >= member_num
  6025.     action_diverging(judgment, @action_data[6])
  6026.   end  
  6027.   #--------------------------------------------------------------------------
  6028.   # ● 条件分岐 (装備)
  6029.   #--------------------------------------------------------------------------
  6030.   def nece_6
  6031.     targets = N03.get_targets(@action_data[1], @battler)
  6032.     return if targets == []
  6033.     member_num = @action_data[5]
  6034.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  6035.     hit_count = 0
  6036.     miss_count = 0
  6037.     for target in targets
  6038.       hit_count += 1 if target.comparison_equip([@action_data[2],@action_data[3]])
  6039.       miss_count += 1 if !target.comparison_equip([@action_data[2],@action_data[3]])
  6040.     end
  6041.     case @action_data[4]
  6042.     when 0 ; judgment = hit_count >= member_num
  6043.     when 1 ; judgment = miss_count >= member_num
  6044.     end
  6045.     action_diverging(judgment, @action_data[6])
  6046.   end  
  6047.   #--------------------------------------------------------------------------
  6048.   # ● 条件分岐 (スクリプト)
  6049.   #--------------------------------------------------------------------------
  6050.   def nece_7
  6051.     judgment = eval(@action_data[2])
  6052.     action_diverging(judgment, @action_data[1])
  6053.   end  
  6054.   #--------------------------------------------------------------------------
  6055.   # ● アクション分岐  
  6056.   #--------------------------------------------------------------------------
  6057.   def action_diverging(judgment, kind)
  6058.     result = 0
  6059.     if judgment
  6060.       result = 1 if kind == 1
  6061.       result = 2 if kind == 2
  6062.     else
  6063.       result = 1 if kind == 0
  6064.     end
  6065.     # フルアクション終了
  6066.     return @full_action = []  if result == 2
  6067.     # 次のアクションを除去
  6068.     @full_action.shift if result == 1
  6069.     set_action
  6070.     # 次のアクションを実行
  6071.     @action_data = N03::ACTION[@action]
  6072.     next_action
  6073.   end
  6074.   #--------------------------------------------------------------------------
  6075.   # ● セカンドターゲット操作
  6076.   #--------------------------------------------------------------------------
  6077.   def second_targets_set
  6078.     targets = N03.get_targets(@action_data[1], @battler)
  6079.     for target in targets
  6080.       targets.delete(target) if @action_data[2][1] == 1 && target.index != @action_data[2][0]
  6081.       targets.delete(target) if @action_data[2][1] == 2 && target.index == @action_data[2][0].abs
  6082.       targets.delete(target) if @action_data[3] > 0 && target.id != @action_data[3]
  6083.       targets.delete(target) if @action_data[3] < 0 && target.id == @action_data[3].abs
  6084.       targets.delete(target) if @action_data[4] > 0 && !target.state?(@action_data[4])
  6085.       targets.delete(target) if @action_data[4] < 0 && target.state?(@action_data[4].abs)
  6086.       targets.delete(target) if @action_data[5] > 0 && !target.skill_conditions_met?($data_skills[@action_data[5]])
  6087.       targets.delete(target) if @action_data[5] < 0 && target.skill_conditions_met?($data_skills[@action_data[5].abs])
  6088.       targets.delete(target) if !target.comparison_parameter(@action_data[6])
  6089.       targets.delete(target) if !@action_data[7][1].include?(0) && !target.comparison_equip(@action_data[7])
  6090.     end
  6091.     return @second_targets = [] if targets.size == 0
  6092.     case @action_data[8]
  6093.     when 1 ; targets = [targets[rand(targets.size)]]
  6094.     when 2 ; targets.delete(@battler)
  6095.     end
  6096.     return @second_targets = [] if targets.size == 0
  6097.     @second_targets = targets
  6098.     case @action_data[9]
  6099.     when 0 ; return
  6100.     when 1 ; set_play_data(["second_targets_set"])
  6101.     when 2 ; set_play_data(["targets_set"])
  6102.     end
  6103.     @wait += 1
  6104.   end
  6105.   #--------------------------------------------------------------------------
  6106.   # ● コモンイベント呼び出し
  6107.   #--------------------------------------------------------------------------
  6108.   def call_common_event
  6109.     $game_temp.reserve_common_event(@action_data[1])
  6110.     $sv_camera.event = true
  6111.     @event_fix = @action_data[2]
  6112.   end
  6113.   #--------------------------------------------------------------------------
  6114.   # ● ダメージアニメ
  6115.   #--------------------------------------------------------------------------
  6116.   def damage_anime(delay_time = 12)
  6117.     anime(N03.get_attack_anime_id(-3, @battler), wait = true)
  6118.     action_play
  6119.     @wait -= delay_time
  6120.     @full_action.unshift("eval('@damage_anime_data = []
  6121.     @set_damage = true')")
  6122.   end
  6123.   #--------------------------------------------------------------------------
  6124.   # ● 通常コラプス
  6125.   #--------------------------------------------------------------------------
  6126.   def normal_collapse
  6127.     @collapse = true
  6128.     return
  6129.   end
  6130.   #--------------------------------------------------------------------------
  6131.   # ● 初期位置変更
  6132.   #--------------------------------------------------------------------------
  6133.   def change_base_position
  6134.     @base_x = @x
  6135.     @base_y = @y
  6136.     @base_h = @h
  6137.   end  
  6138.   #--------------------------------------------------------------------------
  6139.   # ● 強制アクション実行
  6140.   #--------------------------------------------------------------------------
  6141.   def force_act
  6142.     target(@full_action.shift)
  6143.   end
  6144.   #--------------------------------------------------------------------------
  6145.   # ● 強制アクション実行 (セカンドターゲット)
  6146.   #--------------------------------------------------------------------------
  6147.   def force_act2
  6148.     target2(@full_action.shift)
  6149.   end
  6150.   #--------------------------------------------------------------------------
  6151.   # ● 個別処理開始
  6152.   #--------------------------------------------------------------------------
  6153.   def individual_start
  6154.     @individual_targets = @target_battler.dup
  6155.     @remain_targets = @target_battler.dup
  6156.     @target_battler = [@individual_targets[0]]
  6157.     # リピート部分のアクションを保持
  6158.     @individual_act = @full_action.dup
  6159.   end
  6160.   #--------------------------------------------------------------------------
  6161.   # ● 個別処理終了
  6162.   #--------------------------------------------------------------------------
  6163.   def individual_end
  6164.     @individual_targets.shift
  6165.     for target in @individual_targets
  6166.       @individual_targets.shift if target.dead?
  6167.     end
  6168.     # ターゲットが残っているなら行動リピート
  6169.     return @target_battler = @remain_targets if @individual_targets.size == 0
  6170.     @full_action = @individual_act.dup
  6171.     @target_battler = [@individual_targets[0]]
  6172.   end
  6173.   #--------------------------------------------------------------------------
  6174.   # ● ループ開始
  6175.   #--------------------------------------------------------------------------
  6176.   def loop_start
  6177.     # ループ部分のアクションを保持
  6178.     @loop_act = @full_action.dup
  6179.   end
  6180.   #--------------------------------------------------------------------------
  6181.   # ● ループ終了
  6182.   #--------------------------------------------------------------------------
  6183.   def loop_end
  6184.     # 行動リピート
  6185.     @full_action = @loop_act.dup if @loop_act != []
  6186.   end
  6187.   #--------------------------------------------------------------------------
  6188.   # ● 次の行動者へ移行
  6189.   #--------------------------------------------------------------------------
  6190.   def next_battler
  6191.     @action_end = true
  6192.     @active = false
  6193.   end
  6194.   #--------------------------------------------------------------------------
  6195.   # ● 画像変更フラグ
  6196.   #--------------------------------------------------------------------------
  6197.   def set_change
  6198.     @change_up = true
  6199.   end
  6200.   #--------------------------------------------------------------------------
  6201.   # ● 戦闘シーン通信
  6202.   #--------------------------------------------------------------------------
  6203.   def play_data
  6204.     data = @play_data
  6205.     @play_data = []
  6206.     return data
  6207.   end
  6208.   #--------------------------------------------------------------------------
  6209.   # ● ショートカットコマンド
  6210.   #--------------------------------------------------------------------------
  6211.   def anime(anime_id, wait = true)
  6212.     @action_data = ["anime",anime_id,1,false,wait,false,true,false]
  6213.   end
  6214.   def anime_me(anime_id, wait = true)
  6215.     @action_data = ["anime",anime_id,0,false,wait,false,true,false]
  6216.   end
  6217.   def se(file, pitch = 100)
  6218.     @action_data = ["sound",  "se", pitch, 100, file]
  6219.   end
  6220.   def target(act)
  6221.     for target in @target_battler do target.sv.force_action = act end
  6222.   end
  6223.   def target2(act)
  6224.     for target in @second_targets do target.sv.force_action = act end
  6225.   end
  6226.   def delay(time)
  6227.     @wait = @battler.index * time
  6228.   end
  6229.   #--------------------------------------------------------------------------
  6230.   # ● バトラーのIDを取得
  6231.   #--------------------------------------------------------------------------
  6232.   def id
  6233.     return @battler.id if @battler.actor?
  6234.     return [email]-@battler.id[/email]
  6235.   end
  6236.   #--------------------------------------------------------------------------
  6237.   # ● 被クリティカルフラグを取得
  6238.   #--------------------------------------------------------------------------
  6239.   def critical?
  6240.     return @battler.result.critical
  6241.   end
  6242.   #--------------------------------------------------------------------------
  6243.   # ● 被回復フラグを取得
  6244.   #--------------------------------------------------------------------------
  6245.   def recovery?
  6246.     recovery = false
  6247.     recovery = true if @battler.result.hp_damage < 0
  6248.     recovery = true if @battler.result.mp_damage < 0
  6249.     recovery = true if @battler.result.tp_damage < 0
  6250.     return recovery
  6251.   end
  6252.   #--------------------------------------------------------------------------
  6253.   # ● 被スキルIDを取得
  6254.   #--------------------------------------------------------------------------
  6255.   def damage_skill_id
  6256.     return @damage_skill_id
  6257.   end
  6258.   #--------------------------------------------------------------------------
  6259.   # ● 被アイテムIDを取得
  6260.   #--------------------------------------------------------------------------
  6261.   def damage_item_id
  6262.     return @damage_item_id
  6263.   end
  6264.   #--------------------------------------------------------------------------
  6265.   # ● 装備武器を取得
  6266.   #--------------------------------------------------------------------------
  6267.   def weapon_id
  6268.     return 0 if !@battler.weapons[0]
  6269.     return @battler.weapons[0].id
  6270.   end
  6271.   #--------------------------------------------------------------------------
  6272.   # ● 装備武器のタイプを取得
  6273.   #--------------------------------------------------------------------------
  6274.   def weapon_type
  6275.     return 0 if !@battler.weapons[0]
  6276.     return @battler.weapons[0].wtype_id
  6277.   end
  6278.   #--------------------------------------------------------------------------
  6279.   # ● 盾を装備しているか
  6280.   #--------------------------------------------------------------------------
  6281.   def shield?
  6282.     for armor in @battler.armors do return true if armor != nil && armor.etype_id == 1 end
  6283.     return false
  6284.   end
  6285.   #--------------------------------------------------------------------------
  6286.   # ● ダメージがあるか
  6287.   #--------------------------------------------------------------------------
  6288.   def damage_zero?
  6289.     return @battler.result.hp_damage == 0 && @battler.result.mp_damage == 0 && @battler.result.tp_damage == 0
  6290.   end
  6291.   #--------------------------------------------------------------------------
  6292.   # ● スキルIDを取得
  6293.   #--------------------------------------------------------------------------
  6294.   def skill_id
  6295.     return @counter_id if @counter_id != 0
  6296.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  6297.     return 0 if @battler.current_action.item.is_a?(RPG::Item)
  6298.     return @battler.current_action.item.id
  6299.   end
  6300.   #--------------------------------------------------------------------------
  6301.   # ● スキルのタイプを取得
  6302.   #--------------------------------------------------------------------------
  6303.   def skill_type
  6304.     return 0 if skill_id == 0
  6305.     return $data_skills[skill_id].stype_id
  6306.   end
  6307.   #--------------------------------------------------------------------------
  6308.   # ● スキル名を取得
  6309.   #--------------------------------------------------------------------------
  6310.   def skill_name
  6311.     return "" if skill_id == 0
  6312.     return $data_skills[skill_id].name
  6313.   end
  6314.   #--------------------------------------------------------------------------
  6315.   # ● アイテムIDを取得
  6316.   #--------------------------------------------------------------------------
  6317.   def item_id
  6318.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  6319.     return @battler.current_action.item.id
  6320.   end
  6321.   #--------------------------------------------------------------------------
  6322.   # ● 攻撃アクション
  6323.   #--------------------------------------------------------------------------
  6324.   def attack_action(item)
  6325.     return skill_action if item.is_a?(RPG::Skill)
  6326.     return item_action
  6327.   end
  6328.   #--------------------------------------------------------------------------
  6329.   # ● ダメージアクションベース
  6330.   #--------------------------------------------------------------------------
  6331.   def damage_action_base(item)
  6332.     @damage_skill_id = 0
  6333.     @damage_item_id = 0
  6334.     @damage_skill_id = item.id if item.is_a?(RPG::Skill)
  6335.     @damage_item_id = item.id if item.is_a?(RPG::Item)
  6336.   end  
  6337.   #--------------------------------------------------------------------------
  6338.   # ● ダメージアクション
  6339.   #--------------------------------------------------------------------------
  6340.   def damage_action(attacker, item)
  6341.     damage_action_base(item)
  6342.     act = damage(attacker)
  6343.     return if @active
  6344.     start_action(act) if act != nil
  6345.   end
  6346.   #--------------------------------------------------------------------------
  6347.   # ● 回避アクション
  6348.   #--------------------------------------------------------------------------
  6349.   def evasion_action(attacker, item)
  6350.     damage_action_base(item)
  6351.     act = evasion(attacker)
  6352.     return if @active
  6353.     start_action(act) if act != nil
  6354.   end
  6355.   #--------------------------------------------------------------------------
  6356.   # ● ミスアクション
  6357.   #--------------------------------------------------------------------------
  6358.   def miss_action(attacker, item)
  6359.     damage_action_base(item)
  6360.     act = miss(attacker)
  6361.     return if @active
  6362.     start_action(act) if act != nil
  6363.   end
  6364.   #--------------------------------------------------------------------------
  6365.   # ● 閃きスクリプト併用処理
  6366.   #--------------------------------------------------------------------------
  6367.   def flash_action
  6368.     return "閃き"
  6369.   end
  6370.  
  6371. end
  6372.  
  6373.  
  6374. #==============================================================================
  6375. # ■ module N03
  6376. #------------------------------------------------------------------------------
  6377. #  サイドビューバトルのモジュールです。
  6378. #==============================================================================
  6379. module N03
  6380.   #--------------------------------------------------------------------------
  6381.   # ● バトラーの敵グループを取得
  6382.   #--------------------------------------------------------------------------
  6383.   def self.get_enemy_unit(battler)
  6384.     return $game_troop if battler.actor?
  6385.     return $game_party
  6386.   end
  6387.   #--------------------------------------------------------------------------
  6388.   # ● バトラーの味方グループを取得
  6389.   #--------------------------------------------------------------------------
  6390.   def self.get_party_unit(battler)
  6391.     return $game_party if battler.actor?
  6392.     return $game_troop
  6393.   end
  6394.   #--------------------------------------------------------------------------
  6395.   # ● 戦闘アニメ時間の取得
  6396.   #--------------------------------------------------------------------------
  6397.   def self.get_anime_time(anime_id)
  6398.     return 0 if anime_id <= 0
  6399.     return $data_animations[anime_id].frame_max * 4
  6400.   end
  6401.   #--------------------------------------------------------------------------
  6402.   # ● 攻撃アニメの取得
  6403.   #--------------------------------------------------------------------------
  6404.   def self.get_attack_anime_id(kind, battler)
  6405.     return $data_skills[battler.sv.counter_id].animation_id if kind == -3 && battler.sv.counter_id != 0
  6406.     case kind
  6407.     when -1 ; anime_id = battler.atk_animation_id1
  6408.     when -2 ; anime_id = battler.atk_animation_id2
  6409.     when -3
  6410.       if battler.current_action != nil
  6411.         anime_id = battler.current_action.item.animation_id if battler.current_action.item != nil
  6412.       end
  6413.     else    ; anime_id = kind
  6414.     end
  6415.     case anime_id
  6416.     when -1 ; anime_id = battler.atk_animation_id1
  6417.     when -2 ; anime_id = battler.atk_animation_id2
  6418.     end
  6419.     return anime_id if anime_id
  6420.     return 0
  6421.   end  
  6422.   #--------------------------------------------------------------------------
  6423.   # ● 戦闘アニメデータをセット
  6424.   #--------------------------------------------------------------------------
  6425.   def self.set_damage_anime_data(targets, target, data)
  6426.     return if !first_of_all_screen_anime(data[0], target, targets)
  6427.     target.animation_id         = data[0]
  6428.     target.animation_mirror     = data[1]
  6429.     target.sv.anime_no_mirror   = data[2]
  6430.     target.sv.anime_camera_zoom = data[3]
  6431.     target.sv.anime_plus_z      = data[4]
  6432.   end   
  6433.   #--------------------------------------------------------------------------
  6434.   # ● ターゲットの取得
  6435.   #--------------------------------------------------------------------------
  6436.   def self.get_targets(kind, battler)
  6437.     case kind.abs
  6438.     when 0 ; return [battler].dup
  6439.     when 1 ; return battler.sv.target_battler.dup
  6440.     when 2 ; return get_enemy_unit(battler).members.dup
  6441.     when 3 ; return get_party_unit(battler).members.dup
  6442.     when 4 ; return $game_troop.members.dup + $game_party.battle_members.dup
  6443.     when 5 ; return battler.sv.second_targets.dup
  6444.     end
  6445.   end  
  6446.   #--------------------------------------------------------------------------
  6447.   # ● ターゲットの座標を取得
  6448.   #--------------------------------------------------------------------------
  6449.   def self.get_targets_position(targets, horming, m_a = nil)
  6450.     return [0,0,0] if targets == nil && !$sv_camera.mirror
  6451.     return [Graphics.width,0,0] if targets == nil && $sv_camera.mirror
  6452.     x = y = h = 0
  6453.     for i in 0...targets.size
  6454.       x += targets[i].sv.base_x if !horming
  6455.       y += targets[i].sv.base_y if !horming
  6456.       h += targets[i].sv.base_h if !horming
  6457.       x += targets[i].sv.x if horming
  6458.       y += targets[i].sv.y if horming
  6459.       h += targets[i].sv.h if horming
  6460.       y -= targets[i].sv.ch * 100 if m_a == 0
  6461.       y -= targets[i].sv.ch * 50 if m_a == 1
  6462.     end
  6463.     return [x / targets.size, y / targets.size, h / targets.size]
  6464.   end
  6465.   #--------------------------------------------------------------------------
  6466.   # ● 速度を時間に変換
  6467.   #--------------------------------------------------------------------------
  6468.   def self.distanse_calculation(time, target_position, self_position, distanse_move)
  6469.     return time if !distanse_move
  6470.     distanse_x = self_position[0] - target_position[0]
  6471.     distanse_x = target_position[0] - self_position[0] if target_position[0] > self_position[0]
  6472.     distanse_y = self_position[1] - target_position[1]
  6473.     distanse_y = target_position[1] - self_position[1] if target_position[1] > self_position[1]
  6474.     if self_position[2] != nil && target_position[2] != nil
  6475.       distanse_h = self_position[2] - target_position[2]
  6476.       distanse_h = target_position[2] - self_position[2] if target_position[2] > self_position[2]
  6477.     else
  6478.       distanse_h = 0
  6479.     end
  6480.     distanse = [distanse_x, distanse_y, distanse_h].max
  6481.     return distanse / (time * 100) + 1
  6482.   end
  6483.   #--------------------------------------------------------------------------
  6484.   # ● 放物線移動計算
  6485.   #--------------------------------------------------------------------------
  6486.   def self.parabola(data, time, size, type = 1)
  6487.     move_data = data
  6488.     move_data[0] *= size
  6489.     move_data[1] *= size
  6490.     move = []
  6491.     move_d = []
  6492.     for i in 0...time / 2
  6493.       move[i] = move_data[0]
  6494.       move_d[i] = move_data[1]
  6495.       move_data[0] = move_data[0] * type / (1 + type)
  6496.       move_data[1] = move_data[1] * type / (1 + type)
  6497.     end
  6498.     move = move + move_d.reverse!
  6499.     move.reverse!
  6500.     adjust = move.inject(0) {|result, item| result + item }
  6501.     move[move.size - 1] += adjust if data[0] == data[1] && adjust != 0
  6502.     move.unshift(0) if time % 2 != 0
  6503.     return move
  6504.   end
  6505.   #--------------------------------------------------------------------------
  6506.   # ● 反転値
  6507.   #--------------------------------------------------------------------------
  6508.   def self.mirror_num(mirror)
  6509.     return 1 if !mirror
  6510.     return -1
  6511.   end  
  6512.   #--------------------------------------------------------------------------
  6513.   # ● カメラワーク
  6514.   #--------------------------------------------------------------------------
  6515.   def self.camera(battler, data)
  6516.     battler = $game_party.battle_members[0] if !battler
  6517.     cx = data[2][0] * 100
  6518.     cy = data[2][1] * 100
  6519.     return $sv_camera.move(cx, cy, data[3], data[4], true) if data[1] == 6
  6520.     targets = self.get_targets(data[1], battler)
  6521.     return if targets == nil or targets == []
  6522.     position = self.get_targets_position(targets, true)
  6523.     $sv_camera.move(position[0], position[1] - position[2], data[3], data[4], false)
  6524.   end
  6525.   #--------------------------------------------------------------------------
  6526.   # ● コラプス禁止
  6527.   #--------------------------------------------------------------------------
  6528.   def self.immortaling
  6529.     # 全員に不死身付与
  6530.     for member in $game_party.battle_members + $game_troop.members
  6531.       # イベント操作等で不死身設定になっていたら解除を無効にするフラグを立てる
  6532.       member.sv.immortal = true if member.state?(N03::IMMORTAL_ID)
  6533.       member.add_state(N03::IMMORTAL_ID)
  6534.     end
  6535.     return true
  6536.   end  
  6537.   #--------------------------------------------------------------------------
  6538.   # ● コラプス許可
  6539.   #--------------------------------------------------------------------------
  6540.   def self.unimmortaling
  6541.     # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
  6542.     for member in $game_party.battle_members + $game_troop.members
  6543.       next if member.dead?
  6544.       # 不死身ステートが行動中に解除されていた場合、解除無効を解除
  6545.       member.sv.immortal = false if !member.state?(N03::IMMORTAL_ID) && member.sv.immortal
  6546.       next member.sv.immortal = false if member.sv.immortal
  6547.       member.remove_state(N03::IMMORTAL_ID)
  6548.       next if member.hp != 0
  6549.       member.add_state(1)
  6550.       member.perform_collapse_effect
  6551.       member.sv.action_terminate
  6552.     end
  6553.     return false
  6554.   end  
  6555.   #--------------------------------------------------------------------------
  6556.   # ● スキル派生
  6557.   #--------------------------------------------------------------------------
  6558.   def self.derived_skill(battler)
  6559.     battler.force_action(battler.sv.derivation_skill_id, -2)
  6560.     BattleManager.unshift_action_battlers(battler)
  6561.   end
  6562.   #--------------------------------------------------------------------------
  6563.   # ● ダメージの作成
  6564.   #--------------------------------------------------------------------------
  6565.   def self.set_damage(battler, hp_damage, mp_damage)
  6566.     battler.result.hp_damage = hp_damage
  6567.     battler.result.mp_damage = mp_damage
  6568.   end
  6569.   #--------------------------------------------------------------------------
  6570.   # ● ターゲット生死確認
  6571.   #--------------------------------------------------------------------------
  6572.   def self.targets_alive?(targets)
  6573.     return false if targets == []
  6574.     for target in targets do return true if !target.dead? end
  6575.     return false
  6576.   end
  6577.   #--------------------------------------------------------------------------
  6578.   # ● ターゲットをセカンドターゲットへ
  6579.   #--------------------------------------------------------------------------
  6580.   def self.s_targets(battler)
  6581.     battler.sv.target_battler = battler.sv.second_targets
  6582.     return battler.sv.second_targets
  6583.   end  
  6584.   #--------------------------------------------------------------------------
  6585.   # ● セカンドターゲットをターゲットへ
  6586.   #--------------------------------------------------------------------------
  6587.   def self.targets_set(battler)
  6588.     battler.sv.second_targets = battler.current_action.make_targets.compact
  6589.     battler.sv.target_battler = battler.sv.second_targets
  6590.   end  
  6591.   #--------------------------------------------------------------------------
  6592.   # ● 戦闘アニメ実行判定 (対象:画面時は最初のターゲットのみアニメ実行)
  6593.   #--------------------------------------------------------------------------
  6594.   def self.first_of_all_screen_anime(anime_id, target, targets)
  6595.     anime = $data_animations[anime_id]
  6596.     return false if !anime
  6597.     return true if anime.position != 3
  6598.     return false if anime.position == 3 && target != targets[0]
  6599.     targets.delete(target)
  6600.     target.sv.timing_targets = targets
  6601.     return true
  6602.   end
  6603.   #--------------------------------------------------------------------------
  6604.   # ● 戦闘不能付加攻撃か
  6605.   #--------------------------------------------------------------------------
  6606.   def self.dead_attack?(battler, item)
  6607.     for state in battler.atk_states
  6608.       return true if state == battler.death_state_id
  6609.     end
  6610.     for effect in item.effects
  6611.       return true if effect.code == 21 && effect.data_id == battler.death_state_id
  6612.     end
  6613.     return false
  6614.   end
  6615. end
  6616.  
  6617. #==============================================================================
  6618. # ■ Sprite_Weapon
  6619. #------------------------------------------------------------------------------
  6620. #  ウエポン表示用のスプライトです。
  6621. #==============================================================================
  6622. class Sprite_Weapon < Sprite_Base
  6623.   #--------------------------------------------------------------------------
  6624.   # ● 公開インスタンス変数 
  6625.   #--------------------------------------------------------------------------
  6626.   attr_reader   :index                       # ウエポン画像配列のインデックス
  6627.   attr_reader   :battler                     # 画像が参照しているバトラー
  6628.   attr_reader   :move_time                   # 画像が目標に到達するまでの時間
  6629.   attr_reader   :through                     # 貫通フラグ
  6630.   attr_reader   :action_end                  # 武器アクション終了フラグ
  6631.   attr_reader   :action_end_cancel                  # 武器アクション終了フラグ
  6632.   attr_reader   :hit_position                # 画像が目標に到達した時の座標
  6633.   attr_accessor :hit_anime_id                # 画像が目標に到達した時のアニメID
  6634.   #--------------------------------------------------------------------------
  6635.   # ● オブジェクト初期化
  6636.   #--------------------------------------------------------------------------
  6637.   def initialize(viewport, index, battler)
  6638.     super(viewport)
  6639.     @index = index
  6640.     @battler = battler
  6641.     @position_x = @position_y = 0
  6642.     @o = 0
  6643.     @real_x = @real_y = 0
  6644.     @mirror = @battler.sv.mirror
  6645.     reset
  6646.     set_action
  6647.   end
  6648.   #--------------------------------------------------------------------------
  6649.   # ● 初期化
  6650.   #--------------------------------------------------------------------------
  6651.   def reset
  6652.     @z_plus = 0
  6653.     @weapon_data = []
  6654.     @move_data = []
  6655.     @move_x = 0
  6656.     @move_y = 0
  6657.     @orbit = []
  6658.     @through = false
  6659.     @distanse_move = false
  6660.     @weapon_width = 0
  6661.     @weapon_height = 0
  6662.     @anime_time = 0
  6663.     @anime_position = 1
  6664.     @move_time = 0
  6665.     @hit_anime_id = 0
  6666.     @move_anime = true
  6667.     @action_end = false
  6668.     @action_end_cancel = false
  6669.     reset_position
  6670.   end  
  6671.   #--------------------------------------------------------------------------
  6672.   # ● アクションをセット
  6673.   #--------------------------------------------------------------------------
  6674.   def set_action
  6675.     return if @battler.sv.effect_data == []
  6676.     weapon_anime if @battler.sv.effect_data[0][0] == "wp"
  6677.     move_anime if @battler.sv.effect_data[0][0] == "m_a"
  6678.     @battler.sv.effect_data.shift
  6679.   end
  6680.   #--------------------------------------------------------------------------
  6681.   # ● 武器アニメ実行
  6682.   #--------------------------------------------------------------------------
  6683.   def weapon_anime
  6684.     @weapon_data = @battler.sv.effect_data[0].dup
  6685.     set_graphics
  6686.     set_ox
  6687.     set_weapon_move
  6688.   end
  6689.   #--------------------------------------------------------------------------
  6690.   # ● アニメ移動実行
  6691.   #--------------------------------------------------------------------------
  6692.   def move_anime
  6693.     @move_data = @battler.sv.effect_data[0].dup
  6694.     # ターゲットを取得
  6695.     @target_battler = [@battler.sv.m_a_targets.shift]
  6696.     @target_battler = N03.get_targets(@move_data[3], @battler) if @move_data[3] < 0
  6697.     set_move
  6698.     return if @move_data[16] == ""
  6699.     weapon_data = N03::ACTION[@move_data[16]]
  6700.     return if weapon_data == nil
  6701.     @weapon_data = weapon_data.dup
  6702.     set_graphics
  6703.     set_ox
  6704.     set_weapon_move
  6705.   end
  6706.   #--------------------------------------------------------------------------
  6707.   # ● 武器画像を取得
  6708.   #--------------------------------------------------------------------------  
  6709.   def set_graphics
  6710.     # 武器に依存しない画像設定がある場合
  6711.     if @weapon_data[13] != ""
  6712.       self.bitmap = Cache.character(@weapon_data[13]).dup
  6713.       @weapon_width = self.bitmap.width
  6714.       @weapon_height = self.bitmap.height
  6715.       return
  6716.     end
  6717.     # 武器を取得
  6718.     weapon = @battler.weapons[0]
  6719.     # 逆手装備を取得
  6720.     if @weapon_data[10]
  6721.       weapon = nil
  6722.       for armor in @battler.armors do break weapon = armor if armor.is_a?(RPG::Armor) && armor.etype_id == 1 end
  6723.       weapon = @battler.weapons[1] if !weapon
  6724.     end  
  6725.     # 武器がなければ処理をキャンセル
  6726.     return if weapon == nil
  6727.     # インデックスを取得
  6728.     file_index = @weapon_data[12]
  6729.     # アイコンを利用するなら
  6730.     if @weapon_data[1] == 0
  6731.       icon_index = weapon.icon_index
  6732.       self.bitmap = Cache.system("Iconset" + file_index).dup
  6733.       self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  6734.       @weapon_width = @weapon_height = 24
  6735.     # 独自画像指定
  6736.     else
  6737.       file_name = @battler.sv.weapon_graphic(weapon.id, weapon.wtype_id) if weapon.is_a?(RPG::Weapon)
  6738.       file_name = @battler.sv.shield_graphic(weapon.id, weapon.atype_id) if weapon.is_a?(RPG::Armor)
  6739.       self.bitmap = Cache.character(file_name + file_index).dup
  6740.       @weapon_width = self.bitmap.width
  6741.       @weapon_height = self.bitmap.height
  6742.       return if @weapon_data[1] == 1
  6743.       # 2003仕様の武器アニメ
  6744.       @weapon_width /= @battler.sv.max_pattern[0]
  6745.     end
  6746.   end
  6747.   #--------------------------------------------------------------------------
  6748.   # ● 画像の原点を取得
  6749.   #--------------------------------------------------------------------------  
  6750.   def set_ox
  6751.     # 反転時は設定を逆に
  6752.     if @mirror
  6753.       case @weapon_data[6]
  6754.       when 1 ; @weapon_data[6] = 2 # 左上→右上に
  6755.       when 2 ; @weapon_data[6] = 1 # 右上→左上に
  6756.       when 3 ; @weapon_data[6] = 4 # 左下→右下に
  6757.       when 4 ; @weapon_data[6] = 3 # 右下→左下に
  6758.       end
  6759.     end
  6760.     # 原点を設定
  6761.     case @weapon_data[6]
  6762.     when 0 # 中心
  6763.       self.ox = @weapon_width / 2
  6764.       self.oy = @weapon_height / 2
  6765.     when 1 # 左上
  6766.       self.ox = 0
  6767.       self.oy = 0
  6768.     when 2 # 右上
  6769.       self.ox = @weapon_width
  6770.       self.oy = 0
  6771.     when 3 # 左下
  6772.       self.ox = 0
  6773.       self.oy = @weapon_height
  6774.     when 4 # 右下
  6775.       self.ox = @weapon_width
  6776.       self.oy = @weapon_height
  6777.     when 5 # バトラーと同じ
  6778.       self.ox = @weapon_width / 2
  6779.       self.oy = @weapon_height
  6780.     end
  6781.   end  
  6782.   #--------------------------------------------------------------------------
  6783.   # ● バトラーの座標を取得
  6784.   #--------------------------------------------------------------------------  
  6785.   def set_battler_position
  6786.     @position_x = @battler.sv.x + @weapon_data[3][0] * N03.mirror_num(@mirror) * 100
  6787.     @position_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust) + @weapon_data[3][1] * 100
  6788.     reset_position
  6789.   end
  6790.   #--------------------------------------------------------------------------
  6791.   # ● 座標を初期化
  6792.   #--------------------------------------------------------------------------  
  6793.   def reset_position
  6794.     @real_x = @position_x / 100
  6795.     @real_y = @position_y / 100
  6796.     @real_zoom_x = 1
  6797.     @real_zoom_y = 1
  6798.   end
  6799.   #--------------------------------------------------------------------------
  6800.   # ● 戦闘アニメを表示
  6801.   #--------------------------------------------------------------------------  
  6802.   def set_animation(anime_id)
  6803.     return if $data_animations[anime_id] == nil
  6804.     @anime_position = $data_animations[anime_id].position
  6805.     @horming = true
  6806.     @horming = false if @anime_position == 3
  6807.     @anime_camera_zoom = true
  6808.     @anime_no_mirror = false
  6809.     start_animation($data_animations[anime_id], @mirror)
  6810.     timings = $data_animations[anime_id].timings
  6811.   end
  6812.   #--------------------------------------------------------------------------
  6813.   # ● ヒット時の戦闘アニメ実行
  6814.   #--------------------------------------------------------------------------  
  6815.   def set_hit_animation(position_data, hit_anime_id, target)
  6816.     return if $data_animations[hit_anime_id] == nil
  6817.     @real_x = position_data[0]
  6818.     @real_y = position_data[1]
  6819.     @position_x = position_data[0] * 100
  6820.     @position_y = position_data[1] * 100
  6821.     self.z = position_data[2]
  6822.     @z_plus = 1000
  6823.     @action_end = false
  6824.     @horming = true
  6825.     set_animation(hit_anime_id)
  6826.     @anime_time = $data_animations[hit_anime_id].frame_max * 4
  6827.     @timing_targets = [target]
  6828.     @move_time = @hit_anime_id = 0
  6829.     @weapon_data = []
  6830.   end
  6831.   #--------------------------------------------------------------------------
  6832.   # ● タイミングバトラー追加
  6833.   #--------------------------------------------------------------------------  
  6834.   def timing_battler_set(target)
  6835.     @timing_targets.push(target)
  6836.   end
  6837.   #--------------------------------------------------------------------------
  6838.   # ● 武器の動きを取得
  6839.   #--------------------------------------------------------------------------  
  6840.   def set_weapon_move
  6841.     # 開始位置を取得
  6842.     set_battler_position if @move_time == 0
  6843.     @z_plus = 50 if @z_plus == 0 && @weapon_data[9]
  6844.     self.z = @battler.sv.z + @z_plus
  6845.     # 反転処理
  6846.     @mirror = !@mirror if @weapon_data[7]
  6847.     self.mirror = @mirror
  6848.     # 更新パターンをセット
  6849.     set_pattern
  6850.     @max_pattern = 2 if @max_pattern == 1
  6851.     # 動きを計算
  6852.     @weapon_move_data = []
  6853.     @weapon_angle_data = []
  6854.     @weapon_zoom_data = []
  6855.     num = N03.mirror_num(@mirror)
  6856.     for i in 0...@max_pattern
  6857.       move_data_x = @weapon_data[2][0] * num * 100 * i / (@max_pattern - 1)
  6858.       move_data_y = @weapon_data[2][1] * 100 * i / (@max_pattern - 1)
  6859.       move_angle = @weapon_data[4] * num + (@weapon_data[5] * num - @weapon_data[4] * num) * i / (@max_pattern - 1)
  6860.       move_zoom_x = 1 + (@weapon_data[8][0] - 1) * i / (@max_pattern - 1)
  6861.       move_zoom_y = 1 + (@weapon_data[8][1] - 1) * i / (@max_pattern - 1)
  6862.       @weapon_move_data.push([move_data_x, move_data_y])
  6863.       @weapon_angle_data.push(move_angle)
  6864.       @weapon_zoom_data.push([move_zoom_x, move_zoom_y])
  6865.     end
  6866.   end  
  6867.   #--------------------------------------------------------------------------
  6868.   # ● 更新パターン
  6869.   #--------------------------------------------------------------------------
  6870.   def set_pattern
  6871.     if @weapon_data[11] == -1
  6872.       return @max_pattern = @battler.sv.max_pattern[0] if @battler.sv.pattern_type != 0
  6873.       @count = @battler.sv.pattern_time
  6874.       @max_count = @battler.sv.pattern_time
  6875.       @max_pattern = @battler.sv.max_pattern[0]
  6876.       @repeat = false
  6877.     else
  6878.       @count = @weapon_data[11][0]
  6879.       @max_count = @weapon_data[11][0]
  6880.       @max_pattern = @weapon_data[11][1]
  6881.       @repeat = @weapon_data[11][2]
  6882.     end
  6883.     @pattern = 0
  6884.   end
  6885.   #--------------------------------------------------------------------------
  6886.   # ● 移動実行
  6887.   #--------------------------------------------------------------------------
  6888.   def set_move
  6889.     # 戦闘アニメを取得
  6890.     set_animation(@move_data[1][0]) if $data_animations[@move_data[1][0]] != nil && $data_animations[@move_data[1][0]].position != 3
  6891.     @anime_camera_zoom = @move_data[13]
  6892.     @loop = @move_data[14]
  6893.     @loop = false if @move_data[1][0] == 0
  6894.     @anime_no_mirror = @move_data[15]
  6895.     @se_flag = @move_data[17]
  6896.     # 開始位置を取得
  6897.     start_position
  6898.     @z_plus = 1000 if @move_data[9]
  6899.     # ターゲットバトラー画像にこのアニメのSEとタイミング設定を反映させる
  6900.     @timing_targets = @target_battler
  6901.     # 座標計算
  6902.     @move_x = @move_data[5][0] * 100 * N03.mirror_num(@mirror)
  6903.     @move_y = @move_data[5][1] * 100
  6904.     # 時間計算か速度計算か
  6905.     @distanse_move = true if @move_data[6] > 0
  6906.     @move_time = @move_data[6].abs
  6907.     # 時間0の場合、アニメが設定されていればアニメ表示時間に合わせる
  6908.     if @move_time == 0
  6909.       @move_time = $data_animations[@move_data[1][0]].frame_max * 4 if $data_animations[@move_data[1][0]]
  6910.       @move_time = 1 if !$data_animations[@move_data[1][0]]
  6911.       @distanse_move = false
  6912.     end
  6913.     # 貫通タイプの場合
  6914.     @through = true if @move_data[7] == 1
  6915.     @auto_through_flag = false
  6916.     @auto_through_flag = true if @move_data[7] == 0
  6917.     # ターゲット座標計算
  6918.     if @target_battler == nil
  6919.       @target_x = @move_x * 100
  6920.       @target_x = (Graphics.width - @move_x) * 100 if @mirror
  6921.       @target_y = @move_y * 100
  6922.     else
  6923.       move_data_set
  6924.     end
  6925.     # ターゲットに到達するまでの時間を計算
  6926.     @move_time = distanse_calculation(@move_time, @target_x, @target_y)
  6927.     # 円軌道計算
  6928.     orbit
  6929.     # バトラーのウエイト設定
  6930.     @battler.sv.wait = @move_time - 1 if @move_data[10][0]
  6931.     @move_horming = @move_data[12]
  6932.   end  
  6933.   #--------------------------------------------------------------------------
  6934.   # ● 速度を時間に変換
  6935.   #--------------------------------------------------------------------------
  6936.   def distanse_calculation(time, target_x, target_y)
  6937.     return time if !@distanse_move
  6938.     distanse_x = @position_x - @target_x
  6939.     distanse_x = @target_x - @position_x if @target_x > @position_x
  6940.     distanse_y = @position_y - @target_y
  6941.     distanse_y = @target_y - @position_y if @target_y > @position_y
  6942.     distanse = [distanse_x, distanse_y].max
  6943.     return distanse / (time * 100) + 1
  6944.   end
  6945.   #--------------------------------------------------------------------------
  6946.   # ● 移動目標の更新
  6947.   #--------------------------------------------------------------------------
  6948.   def move_data_set
  6949.     return if @target_battler == nil
  6950.     position = N03.get_targets_position(@target_battler, true, @anime_position)
  6951.     @target_x = position[0] + @move_x
  6952.     @target_y = position[1] - position[2] + @move_y
  6953.   end
  6954.   #--------------------------------------------------------------------------
  6955.   # ● 開始位置を計算
  6956.   #--------------------------------------------------------------------------
  6957.   def start_position
  6958.     starter = [@battler.sv.m_a_starter.shift]
  6959.     starter = N03.get_targets(@move_data[2], @battler) if @move_data[2] < 0
  6960.     position = [0, 0]
  6961.     position = N03.get_targets_position(starter, true, @anime_position) if starter != nil
  6962.     @position_x = position[0] + @move_data[4][0] * 100
  6963.     @position_y = position[1] + position[2] + @move_data[4][1] * 100
  6964.     @position_z = @position_y
  6965.   end  
  6966.   #--------------------------------------------------------------------------
  6967.   # ● 円軌道計算
  6968.   #--------------------------------------------------------------------------
  6969.   def orbit
  6970.     orbit_data = @move_data[8].dup
  6971.     orbit_data[0] *= 100
  6972.     orbit_data[1] *= 100
  6973.     orbit_d = []
  6974.     for i in 0...@move_time / 2
  6975.       @orbit[i] = orbit_data[0]
  6976.       orbit_data[0] /= 2
  6977.       orbit_d[i] = orbit_data[1]
  6978.       orbit_data[1] /= 2
  6979.     end
  6980.     @orbit = @orbit + orbit_d.reverse!
  6981.     @orbit.reverse!
  6982.   end  
  6983.   #--------------------------------------------------------------------------
  6984.   # ● フレーム更新
  6985.   #--------------------------------------------------------------------------
  6986.   def update
  6987.     update_hit_anime if @anime_time != 0
  6988.     update_move if @move_time != 0
  6989.     update_weapon_move if @weapon_data != []
  6990.     update_position
  6991.     update_color
  6992.     self.visible = @battler.sv.weapon_visible
  6993.     super
  6994.   end
  6995.   #--------------------------------------------------------------------------
  6996.   # ● ヒット時の戦闘アニメ
  6997.   #--------------------------------------------------------------------------
  6998.   def update_hit_anime
  6999.     @anime_time -= 1
  7000.     @action_end = true if @anime_time == 0
  7001.   end
  7002.   #--------------------------------------------------------------------------
  7003.   # ● 移動の更新
  7004.   #--------------------------------------------------------------------------
  7005.   def update_move
  7006.     move_data_set if @move_horming && !@hit_position
  7007.     through_set(@move_time, @target_x, @target_y) if @move_time == 1 && !@hit_position
  7008.     @o += @orbit[@move_time - 1] if @orbit[@move_time - 1] != nil
  7009.     @position_x = (@position_x * (@move_time - 1) + @target_x) / @move_time
  7010.     @position_y = (@position_y * (@move_time - 1) + @target_y) / @move_time + @o
  7011.     reset_position
  7012.     set_animation(@move_data[1][0]) if @loop && !animation?
  7013.     @move_time -= 1
  7014.     return if @move_time != 0
  7015.     @action_end = true if !@action_end_cancel
  7016.   end
  7017.   #--------------------------------------------------------------------------
  7018.   # ● 武器の動きを更新
  7019.   #--------------------------------------------------------------------------
  7020.   def update_weapon_move
  7021.     pattern = update_pattern
  7022.     set_battler_position if @move_time == 0 && !@action_end_cancel
  7023.     @real_x = @position_x / 100 + @weapon_move_data[pattern][0] / 100
  7024.     @real_y = @position_y / 100 + @weapon_move_data[pattern][1] / 100
  7025.     @real_zoom_x = @weapon_zoom_data[pattern][0]
  7026.     @real_zoom_y = @weapon_zoom_data[pattern][1]
  7027.     self.angle = @weapon_angle_data[pattern]
  7028.     self.src_rect.set(@weapon_width * pattern, 0, @weapon_width, @weapon_height) if @weapon_data[1] == 2
  7029.   end
  7030.   #--------------------------------------------------------------------------
  7031.   # ● パターンを更新
  7032.   #--------------------------------------------------------------------------
  7033.   def update_pattern
  7034.     return @battler.sv.pattern_w if @count == nil
  7035.     @count -= 1
  7036.     return @pattern if @count != 0
  7037.     @count = @max_count
  7038.     @pattern += 1
  7039.     if !@repeat && @pattern == @max_pattern
  7040.       @pattern = @max_pattern - 1
  7041.     elsif @pattern == @max_pattern
  7042.       @pattern = 0
  7043.     end
  7044.     return @pattern
  7045.   end
  7046.   #--------------------------------------------------------------------------
  7047.   # ● 座標を更新
  7048.   #--------------------------------------------------------------------------
  7049.   def update_position
  7050.     self.x = (@real_x - $sv_camera.x) * $sv_camera.convert / 1000
  7051.     self.y = (@real_y - $sv_camera.y) * $sv_camera.convert / 1000
  7052.     self.x += $sv_camera.sx / 100 unless @battler.sv.h != 0 && @weapon_data != []
  7053.     self.y += $sv_camera.sy / 100 unless @battler.sv.h != 0 && @weapon_data != []
  7054.     self.z = @battler.sv.z + @z_plus - 10
  7055.     self.zoom_x = @real_zoom_x * $sv_camera.zoom
  7056.     self.zoom_y = @real_zoom_y * $sv_camera.zoom
  7057.     self.opacity = @battler.sv.opacity if @battler.sv.opacity_data[4]
  7058.   end
  7059.   #--------------------------------------------------------------------------
  7060.   # ● 貫通の処理
  7061.   #--------------------------------------------------------------------------
  7062.   def through_set(time, target_x, target_y)
  7063.     @hit_anime_id = N03.get_attack_anime_id(@move_data[1][1], @battler)
  7064.     @battler.sv.wait = N03.get_anime_time(@hit_anime_id) if @move_data[10][1]
  7065.     moving_x = (target_x / 100 - @position_x / 100) / time
  7066.     moving_y = (target_y / 100 - @position_y / 100) / time
  7067.     goal_x = $sv_camera.max_left - 100 if moving_x < 0
  7068.     goal_x = Graphics.width + $sv_camera.max_right + 100 if moving_x > 0
  7069.     goal_y = $sv_camera.max_top - 100 if moving_y < 0
  7070.     goal_y = Graphics.height + $sv_camera.max_bottom + 100 if moving_y > 0
  7071.     if goal_x == nil &&  goal_y == nil
  7072.       time = 0
  7073.       reset_position
  7074.     else
  7075.       time = move_calculation(moving_x, moving_y, goal_x, goal_y)
  7076.     end
  7077.     target_x = @position_x + moving_x * time * 100
  7078.     target_y = @position_y + moving_y * time * 100
  7079.     @pre_data = [time, target_x, target_y]
  7080.     @battler.sv.m_a_data.push([@move_data[11], @target_battler, @index, @auto_through_flag, []])
  7081.     @action_end_cancel = true
  7082.     @hit_position = [@real_x, @real_y, self.z]
  7083.   end  
  7084.   #--------------------------------------------------------------------------
  7085.   # ● 到達時間試算
  7086.   #--------------------------------------------------------------------------
  7087.   def move_calculation(moving_x, moving_y, goal_x, goal_y)
  7088.     move_x = @position_x / 100
  7089.     move_y = @position_y / 100
  7090.     time = 0
  7091.     loop do
  7092.       move_x += moving_x
  7093.       move_y += moving_y
  7094.       time += 1
  7095.       return time if moving_x < 0 && move_x < goal_x
  7096.       return time if moving_x > 0 && move_x > goal_x
  7097.       return time if moving_y < 0 && move_y < goal_y
  7098.       return time if moving_y > 0 && move_y > goal_y
  7099.     end
  7100.   end   
  7101.   #--------------------------------------------------------------------------
  7102.   # ● ミス時に消える処理から貫通処理に変換
  7103.   #--------------------------------------------------------------------------
  7104.   def through_change
  7105.     @action_end_cancel = false
  7106.     @through = true
  7107.     @move_time = @pre_data[0]
  7108.     @target_x = @pre_data[1]
  7109.     @target_y = @pre_data[2]
  7110.     @pre_data = nil
  7111.   end  
  7112.   #--------------------------------------------------------------------------
  7113.   # ● SE とフラッシュのタイミング処理
  7114.   #--------------------------------------------------------------------------
  7115.   def animation_process_timing(timing)
  7116.     return if !@timing_targets
  7117.     se_flag = true
  7118.     se_flag = @se_flag if @se_flag != nil
  7119.     for target in @timing_targets
  7120.       target.sv.timing.push([se_flag, timing.dup])
  7121.       se_flag = false if @animation.position == 3
  7122.     end  
  7123.   end
  7124.   #--------------------------------------------------------------------------
  7125.   # ● 色調の更新
  7126.   #--------------------------------------------------------------------------
  7127.   def update_color
  7128.     return if @battler.sv.color == []
  7129.     self.color.set(@battler.sv.color[0], @battler.sv.color[1], @battler.sv.color[2], @battler.sv.color[3])
  7130.   end
  7131.   #--------------------------------------------------------------------------
  7132.   # ● 解放
  7133.   #--------------------------------------------------------------------------
  7134.   def dispose
  7135.     super
  7136.     self.bitmap.dispose if self.bitmap != nil
  7137.   end
  7138. end
  7139.  
  7140. #==============================================================================
  7141. # ■ Sprite_Battle_Picture
  7142. #------------------------------------------------------------------------------
  7143. #  ピクチャ表示用のスプライトです。
  7144. #==============================================================================
  7145. class Sprite_Battle_Picture < Sprite
  7146.   #--------------------------------------------------------------------------
  7147.   # ● 公開インスタンス変数 
  7148.   #--------------------------------------------------------------------------
  7149.   attr_accessor   :action_end           # 終了フラグ
  7150.   #--------------------------------------------------------------------------
  7151.   # ● オブジェクト初期化
  7152.   #--------------------------------------------------------------------------
  7153.   def initialize(viewport = nil)
  7154.     super(viewport)
  7155.     @action_end = false
  7156.     self.ox = 0
  7157.   end
  7158.   #--------------------------------------------------------------------------
  7159.   # ● セット
  7160.   #--------------------------------------------------------------------------
  7161.   def set(battler)
  7162.     @battler = battler
  7163.     @data = @battler.sv.effect_data.shift
  7164.     @time = @data[4]
  7165.     @mirror = $sv_camera.mirror
  7166.     @mirror = false if !@data[8]
  7167.     self.opacity = @data[6][0]
  7168.     @s_x = @data[2][0] if @data[2] != []
  7169.     @s_x = Graphics.width - @data[2][0]  if @data[2] != [] && @mirror
  7170.     @s_y = @data[2][1] if @data[2] != []
  7171.     @e_x = @data[3][0] if @data[3] != []
  7172.     @e_x = Graphics.width - @data[3][0] if @data[3] != [] && @mirror
  7173.     @e_y = @data[3][1] if @data[3] != []
  7174.     @s_x = self.x if @data[2] == []
  7175.     @s_y = self.y if @data[2] == []
  7176.     @e_x = self.x if @data[3] == []
  7177.     @e_y = self.y if @data[3] == []
  7178.     self.x = @s_x
  7179.     self.y = @s_y
  7180.     return @action_end = true if @time == 0
  7181.     @move_x = (@e_x * 1.0 - @s_x) / @time
  7182.     @move_y = (@e_y * 1.0 - @s_y) / @time
  7183.     self.z = @data[5]
  7184.     return set_plane(battler) if @data[7] != []
  7185.     self.bitmap = Cache.picture(@data[9]) if !bitmap or @data[9] != ""
  7186.     return @action_end = true if !bitmap
  7187.     self.mirror = @mirror
  7188.     self.ox = self.bitmap.width if @mirror
  7189.   end
  7190.   #--------------------------------------------------------------------------
  7191.   # ● プレーン移行
  7192.   #--------------------------------------------------------------------------
  7193.   def set_plane(battler)
  7194.     @viewport = Viewport.new(@data[2][0],@data[2][1],@data[7][0],@data[7][1]) if !@viewport
  7195.     viewport = @viewport
  7196.     @plane = Plane.new(viewport) if !@plane
  7197.     @plane.bitmap = Cache.picture(@data[9]) if !@plane.bitmap or @data[9] != ""
  7198.     return @action_end = true if !@plane.bitmap
  7199.     @plane.ox = @data[7][0]
  7200.     @plane.oy = @data[7][1]
  7201.     @plane.opacity = @data[6][0]
  7202.     @move_x = @remain_move[0] if @data[2] == @data[3]
  7203.     @move_y = @remain_move[1] if @data[2] == @data[3]
  7204.     @remain_move = [@move_x, @move_y]
  7205.   end
  7206.   #--------------------------------------------------------------------------
  7207.   # ● フレーム更新
  7208.   #--------------------------------------------------------------------------
  7209.   def update
  7210.     @action_end = true if !@battler.sv.picture
  7211.     return if @time == 0
  7212.     return if @action_end
  7213.     @time -= 1
  7214.     return plane_update if @plane
  7215.     super
  7216.     self.x += @move_x
  7217.     self.y += @move_y
  7218.     self.opacity += @data[6][1]
  7219.     return if @time != 1
  7220.     self.x = @e_x
  7221.     self.y = @e_y
  7222.     @time = 0
  7223.   end
  7224.   #--------------------------------------------------------------------------
  7225.   # ● フレーム更新
  7226.   #--------------------------------------------------------------------------
  7227.   def plane_update
  7228.     @plane.ox += @move_x
  7229.     @plane.oy += @move_y
  7230.     @plane.opacity += @data[6][1]
  7231.     @time = @data[4] if @time == 0
  7232.   end
  7233.   #--------------------------------------------------------------------------
  7234.   # ● 解放
  7235.   #--------------------------------------------------------------------------
  7236.   def dispose
  7237.     bitmap.dispose if bitmap
  7238.     @plane.dispose if @plane
  7239.     @viewport.dispose if @viewport
  7240.     super
  7241.   end
  7242. end
  7243.  
  7244. #==============================================================================
  7245. # ■ Sprite_Back_Picture
  7246. #------------------------------------------------------------------------------
  7247. #  周期ピクチャ用のスプライトです。
  7248. #==============================================================================
  7249. class Sprite_Back_Picture < Plane
  7250.   #--------------------------------------------------------------------------
  7251.   # ● 公開インスタンス変数 
  7252.   #--------------------------------------------------------------------------
  7253.   attr_accessor   :action_end           # 終了フラグ
  7254.   #--------------------------------------------------------------------------
  7255.   # ● オブジェクト初期化
  7256.   #--------------------------------------------------------------------------
  7257.   def initialize(viewport = nil, index)
  7258.     super(viewport)
  7259.     @index = index
  7260.     @real_x = 0
  7261.     @real_y = 0
  7262.     @real_opacity = 0
  7263.     @move_x = 0
  7264.     @move_y = 0
  7265.     @move_opacity = 0
  7266.     @time = 0
  7267.     @switche = 0
  7268.     @action_end = false
  7269.   end
  7270.   #--------------------------------------------------------------------------
  7271.   # ● セットアップ
  7272.   #--------------------------------------------------------------------------
  7273.   def setup(data)
  7274.     self.bitmap = Cache.picture(data[9])
  7275.     self.z = data[6]
  7276.     @switche = data[1]
  7277.     mirror = $sv_camera.mirror
  7278.     mirror = false if !data[8]
  7279.     @move_x = data[3][0]
  7280.     @move_x *= -1 if mirror
  7281.     @move_y = data[3][1]
  7282.     @time = data[4]
  7283.     @time = -1 if @time == 0
  7284.     @real_opacity = (data[5][0] + 1) * 100
  7285.     @move_opacity = data[5][1]
  7286.     @start_opacity = data[5][0]
  7287.     @shake_ok = data[7]
  7288.   end
  7289.   #--------------------------------------------------------------------------
  7290.   # ● フレーム更新
  7291.   #--------------------------------------------------------------------------
  7292.   def update
  7293.     update_picture if @time != 0
  7294.     self.ox = $sv_camera.x - @real_x
  7295.     self.oy = $sv_camera.y - @real_y
  7296.     if @shake_ok
  7297.       self.ox -= $sv_camera.sx / 100
  7298.       self.oy -= $sv_camera.sy / 100
  7299.     end
  7300.     self.ox *= $sv_camera.zoom
  7301.     self.oy *= $sv_camera.zoom
  7302.     self.zoom_x = @zoom_x * $sv_camera.zoom
  7303.     self.zoom_y = @zoom_y * $sv_camera.zoom
  7304.     self.opacity = @real_opacity / 100
  7305.     @move_opacity *= -1 if self.opacity == 255 or self.opacity <= @start_opacity
  7306.     @switche
  7307.     @action_end = true if @switche > 0 && !$game_switches[@switche]
  7308.     @action_end = true if @switche < 0 && !$sv_camera.switches[@switche.abs]
  7309.   end
  7310.   #--------------------------------------------------------------------------
  7311.   # ● ピクチャの更新
  7312.   #--------------------------------------------------------------------------
  7313.   def update_picture
  7314.     @real_x += @move_x / 100
  7315.     @real_y += @move_y / 100
  7316.     @real_x = 0 if @real_x >= self.bitmap.width or @real_x <= -self.bitmap.width
  7317.     @real_y = 0 if @real_y >= self.bitmap.height or @real_y <= -self.bitmap.height
  7318.     @zoom_x = 1
  7319.     @zoom_y = 1
  7320.     @real_opacity += @move_opacity
  7321.     @time -= 1
  7322.     @time = -1 if @time < -100
  7323.   end
  7324. end
  7325.  
  7326. #==============================================================================
  7327. # ■ Sprite_Back_Picture
  7328. #------------------------------------------------------------------------------
  7329. #  ダメージ表示のスプライトです。
  7330. #==============================================================================
  7331. class Sprite_Damage < Sprite
  7332.   #--------------------------------------------------------------------------
  7333.   # ● 公開インスタンス変数 
  7334.   #--------------------------------------------------------------------------
  7335.   attr_reader   :action_end                  # POP終了フラグ
  7336.   #--------------------------------------------------------------------------
  7337.   # ● オブジェクト初期化
  7338.   #--------------------------------------------------------------------------
  7339.   def initialize(viewport = nil, battler)
  7340.     super(viewport)
  7341.     @battler = battler
  7342.     @time = 0
  7343.     return @action_end = true if !@battler
  7344.     @direction = -1
  7345.     @direction *= -1 if @battler.actor?
  7346.     @direction *= -1 if $sv_camera.mirror
  7347.     set_state
  7348.     set_damage
  7349.     update
  7350.   end
  7351.   #--------------------------------------------------------------------------
  7352.   # ● ステート表示
  7353.   #--------------------------------------------------------------------------
  7354.   def set_state
  7355.     return if !N03::STATE_POP
  7356.     states = @battler.result.added_state_objects
  7357.     states.delete($data_states[@battler.death_state_id]) if @battler.result.hp_damage != 0
  7358.     return if states == []
  7359.     return if @battler.sv.add_state == @battler.result.added_state_objects
  7360.     @battler.sv.add_state = states.dup
  7361.     @st = []
  7362.     @st_base = []
  7363.     for i in 0...states.size
  7364.       @st[i] = Sprite.new
  7365.       bitmap_state(@st[i], states[i])
  7366.       @st_base[i] = []
  7367.       @st_base[i][0] = @direction * (-20 + 5 * i) + @battler.sv.x / 100
  7368.       @st_base[i][1] = -40 - @state_height * i + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  7369.       @st[i].z = 1000 + i
  7370.       @st[i].opacity = 0
  7371.     end
  7372.     @time = @pop_time = 80
  7373.   end   
  7374.   #--------------------------------------------------------------------------
  7375.   # ● ステート画像
  7376.   #--------------------------------------------------------------------------
  7377.   def bitmap_state(state, state_object)
  7378.     name = state_object.name
  7379.     state.bitmap = Cache.system("Iconset").dup
  7380.     state.src_rect.set(state_object.icon_index % 16 * 24, state_object.icon_index / 16 * 24, 24, 24)
  7381.     @state_height = 24
  7382.   end
  7383.   #--------------------------------------------------------------------------
  7384.   # ● ダメージ表示
  7385.   #--------------------------------------------------------------------------
  7386.   def hit_count
  7387.     for i in [email]0...@battler.sv.hit.size[/email]
  7388.       if @battler.sv.hit[i] == nil
  7389.         @hit = i
  7390.         return @battler.sv.hit[i] = @hit
  7391.       end
  7392.     end
  7393.     @hit = @battler.sv.hit.size
  7394.     @battler.sv.hit.push(@hit)
  7395.   end  
  7396.   #--------------------------------------------------------------------------
  7397.   # ● ダメージ表示
  7398.   #--------------------------------------------------------------------------
  7399.   def set_damage
  7400.     return @action_end = true if !N03::DAMAGE_POP
  7401.     damage = @battler.result.hp_damage if @battler.result.hp_damage != 0
  7402.     damage = @battler.result.hp_drain  if @battler.result.hp_drain  != 0
  7403.     damage = @battler.result.mp_damage if @battler.result.mp_damage != 0
  7404.     damage = @battler.result.mp_drain  if @battler.result.mp_drain  != 0
  7405.     damage = @battler.result.tp_damage if @battler.result.tp_damage != 0
  7406.     if !damage or damage == 0
  7407.       @action_end = true if @st == nil
  7408.       return # ステートだけPOPする設定を考慮して@action_endは返さない
  7409.     end
  7410.     hit_count
  7411.     #@hit = @battler.sv.hit
  7412.     #@battler.sv.hit += 1 if damage != 0
  7413.     file = N03::DAMAGE_PLUS if damage > 0
  7414.     file = N03::DAMAGE_MINUS if damage < 0
  7415.     add_file = N03::DAMAGE_MP if @battler.result.mp_damage != 0
  7416.     add_file = N03::DAMAGE_TP if @battler.result.tp_damage != 0
  7417.     adjust_x = N03::DAMAGE_ADJUST
  7418.     @num = []
  7419.     @num_base = []
  7420.     damage = damage.abs
  7421.     max_num = damage.to_s.size
  7422.     max_num += 1 if add_file != nil
  7423.     for i in 0...max_num
  7424.       @num[i] = Sprite.new
  7425.       if add_file != nil && i == max_num - 1
  7426.         @num[i].bitmap = Cache.system(add_file)
  7427.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  7428.         sw = 0 if sw == nil
  7429.       else
  7430.         @num[i].bitmap = Cache.system(file)
  7431.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  7432.         sw = @num[i].bitmap.width / 10
  7433.         @num[i].src_rect.set(cw * sw, 0, sw, @num[i].bitmap.height)
  7434.       end
  7435.       @num_base[i] = []
  7436.       @num_base[i][0] = (sw + adjust_x) * i * -1 + (@battler.sv.x / 100)
  7437.       @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
  7438.       @num_base[i][0] -= @num[i].bitmap.width / 2 - adjust_x if add_file != nil && i == max_num - 1
  7439.       @num[i].z = 1000 + i + @hit * 10
  7440.     end
  7441.     @time = @pop_time = 80
  7442.   end
  7443.   #--------------------------------------------------------------------------
  7444.   # ● フレーム更新
  7445.   #--------------------------------------------------------------------------
  7446.   def update
  7447.     return if @time == 0
  7448.     for i in [email]0...@st.size[/email] do update_state_move(@st[i], i) end if @st != nil
  7449.     for i in [email]0...@num.size[/email] do update_num_move(@num[i], i) end if @num != nil
  7450.     @time -= 1
  7451.     @action_end = true if @time == 0
  7452.   end
  7453.   #--------------------------------------------------------------------------
  7454.   # ● ステート画像の更新
  7455.   #--------------------------------------------------------------------------
  7456.   def update_state_move(state, index)
  7457.     min = @pop_time - index * 2
  7458.     case @time
  7459.     when min-15..min
  7460.       @st_base[index][0] += @direction
  7461.       state.opacity += 25
  7462.     when min-80..min-50
  7463.       @st_base[index][0] += @direction
  7464.       state.opacity -= 25
  7465.     end
  7466.     state.x = (@st_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  7467.     state.y = (@st_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  7468.   end
  7469.   #--------------------------------------------------------------------------
  7470.   # ● 数値の更新
  7471.   #--------------------------------------------------------------------------
  7472.   def update_num_move(num, index)
  7473.     min = @pop_time - index * 2
  7474.     case @time
  7475.     when min-1..min
  7476.       @num_base[index][0] += @direction * @hit
  7477.       @num_base[index][1] -= 5 + @hit * 2
  7478.     when min-3..min-2
  7479.       @num_base[index][0] += @direction * @hit
  7480.       @num_base[index][1] -= 4 + @hit * 2
  7481.     when min-6..min-4
  7482.       @num_base[index][0] += @direction
  7483.       @num_base[index][1] -= 3 + @hit * 2
  7484.     when min-14..min-7
  7485.       @num_base[index][0] += @direction
  7486.       @num_base[index][1] += 2
  7487.     when min-17..min-15
  7488.       @num_base[index][1] -= 2 + @hit * 2
  7489.     when min-23..min-18
  7490.       @num_base[index][1] += 1
  7491.     when min-27..min-24
  7492.       @num_base[index][1] -= 1
  7493.     when min-30..min-28
  7494.       @num_base[index][1] += 1
  7495.     when min-33..min-31
  7496.       @num_base[index][1] -= 1
  7497.     when min-36..min-34
  7498.       @num_base[index][1] += 1
  7499.     end
  7500.     num.x = (@num_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  7501.     num.y = (@num_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  7502.     num.opacity = 256 - (12 - @time) * 32
  7503.     num.visible = false if @time == 0
  7504.   end
  7505.   #--------------------------------------------------------------------------
  7506.   # ● 解放
  7507.   #--------------------------------------------------------------------------
  7508.   def dispose
  7509.     @battler.sv.hit[@hit] = nil if @hit
  7510.     bitmap.dispose if bitmap
  7511.     for i in [email]0...@num.size[/email] do @num[i].dispose end if @num != nil
  7512.     for i in [email]0...@st.size[/email] do @st[i].dispose end if @st != nil
  7513.     super
  7514.   end
  7515. end
  7516.  
  7517. #==============================================================================
  7518. # ■ Window_Skill_name
  7519. #------------------------------------------------------------------------------
  7520. #  スキル名を表示するウィンドウです。
  7521. #==============================================================================
  7522. class Window_Skill_name < Window_Base
  7523.   #--------------------------------------------------------------------------
  7524.   # ● オブジェクト初期化
  7525.   #--------------------------------------------------------------------------
  7526.   def initialize(text)
  7527.     super(0, 0, Graphics.width, line_height + standard_padding * 2)
  7528.     draw_text(4, 0, Graphics.width - 64, line_height,text, 1)
  7529.   end
  7530. end
  7531.  
  7532. #==============================================================================
  7533. # ■ Spriteset_Sideview
  7534. #------------------------------------------------------------------------------
  7535. #  サイドビュー独自のスプライトをまとめたクラスです。
  7536. #==============================================================================
  7537. class Spriteset_Sideview
  7538.   #--------------------------------------------------------------------------
  7539.   # ● オブジェクト初期化
  7540.   #--------------------------------------------------------------------------
  7541.   def initialize(viewport)
  7542.     @viewport = viewport
  7543.     @weapons = []
  7544.     @pictures = []
  7545.     @back_pic = []
  7546.     @damage = []
  7547.     $sv_camera.setup
  7548.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup)
  7549.   end
  7550.   #--------------------------------------------------------------------------
  7551.   # ● フレーム更新
  7552.   #--------------------------------------------------------------------------
  7553.   def update
  7554.     update_battler_data
  7555.     update_damage
  7556.     update_pictures
  7557.     update_back_pic
  7558.     update_weapons
  7559.   end  
  7560.   #--------------------------------------------------------------------------
  7561.   # ● バトラーデータの更新
  7562.   #--------------------------------------------------------------------------
  7563.   def update_battler_data
  7564.     for battler in $game_party.battle_members + $game_troop.members
  7565.       weapon_end(battler) if battler.sv.weapon_end
  7566.       next if battler.sv.effect_data == []
  7567.       for effect_data in battler.sv.effect_data do set_effects(battler, effect_data) end
  7568.     end
  7569.   end
  7570.   #--------------------------------------------------------------------------
  7571.   # ● ダメージ画像の更新
  7572.   #--------------------------------------------------------------------------
  7573.   def update_damage
  7574.     for i in [email]0...@damage.size[/email]
  7575.       next if @damage[i] == nil
  7576.       @damage[i].update if @damage[i] != nil
  7577.       next if !@damage[i].action_end
  7578.       @damage[i].dispose
  7579.       @damage[i] = nil
  7580.     end
  7581.   end
  7582.   #--------------------------------------------------------------------------
  7583.   # ● ピクチャアクションの更新
  7584.   #--------------------------------------------------------------------------
  7585.   def update_pictures
  7586.     for i in [email]0...@pictures.size[/email]
  7587.       next if @pictures[i] == nil
  7588.       @pictures[i].update if @pictures[i] != nil
  7589.       next if !@pictures[i].action_end
  7590.       @pictures[i].dispose
  7591.       @pictures[i] = nil
  7592.     end
  7593.   end
  7594.   #--------------------------------------------------------------------------
  7595.   # ● 周期ピクチャの更新
  7596.   #--------------------------------------------------------------------------
  7597.   def update_back_pic
  7598.     set_back_pic if $sv_camera.program_picture != []
  7599.     for i in [email]0...@back_pic.size[/email]
  7600.       next if @back_pic[i] == nil
  7601.       @back_pic[i].update if @back_pic[i] != nil
  7602.       next if !@back_pic[i].action_end
  7603.       @back_pic[i].dispose
  7604.       @back_pic[i] = nil
  7605.     end
  7606.   end
  7607.   #--------------------------------------------------------------------------
  7608.   # ● 武器アクションの更新
  7609.   #--------------------------------------------------------------------------
  7610.   def update_weapons
  7611.     for i in [email]0...@weapons.size[/email]
  7612.       next if @weapons[i] == nil
  7613.       @weapons[i].update if @weapons[i] != nil
  7614.       next if !@weapons[i].action_end
  7615.       @weapons[i].dispose
  7616.       @weapons[i] = nil
  7617.     end
  7618.   end
  7619.   #--------------------------------------------------------------------------
  7620.   # ● ダメージ実行
  7621.   #--------------------------------------------------------------------------
  7622.   def set_damage_pop(target)
  7623.     for i in [email]0...@damage.size[/email]
  7624.       next if @damage[i] != nil
  7625.       return @damage[i] = Sprite_Damage.new(@viewport, target)
  7626.     end
  7627.     @damage.push(Sprite_Damage.new(@viewport, target))
  7628.   end
  7629.   #--------------------------------------------------------------------------
  7630.   # ● 周期ピクチャ実行
  7631.   #--------------------------------------------------------------------------
  7632.   def set_back_pic
  7633.     for data in $sv_camera.program_picture
  7634.       if @back_pic[data[2]] != nil
  7635.         @back_pic[data[2]].dispose
  7636.         @back_pic[data[2]] = nil
  7637.       end
  7638.       @back_pic[data[2]] = Sprite_Back_Picture.new(@viewport, data[2])
  7639.       @back_pic[data[2]].setup(data)
  7640.     end
  7641.     $sv_camera.program_picture = []
  7642.   end
  7643.   #--------------------------------------------------------------------------
  7644.   # ● エフェクト開始
  7645.   #--------------------------------------------------------------------------
  7646.   def set_effects(battler, effect_data)
  7647.     case effect_data[0]
  7648.     when "pic" ; set_pictures(battler, effect_data)
  7649.     when  "wp" ; set_weapons(battler,  true)
  7650.     when "m_a" ; set_weapons(battler, false)
  7651.     end
  7652.   end
  7653.   #--------------------------------------------------------------------------
  7654.   # ● ピクチャアクション実行
  7655.   #--------------------------------------------------------------------------
  7656.   def set_pictures(battler, effect_data)
  7657.     @pictures[effect_data[1]] = Sprite_Battle_Picture.new if @pictures[effect_data[1]] == nil
  7658.     @pictures[effect_data[1]].set(battler)
  7659.   end
  7660.   #--------------------------------------------------------------------------
  7661.   # ● 武器アクション実行
  7662.   #--------------------------------------------------------------------------
  7663.   def set_weapons(battler, weapon_flag, test = true)
  7664.     for i in [email]0...@weapons.size[/email]
  7665.       next if @weapons[i] != nil
  7666.       @weapons[i] = Sprite_Weapon.new(@viewport, i, battler)
  7667.       battler.sv.weapon_index.push(i) if weapon_flag
  7668.       return i
  7669.     end
  7670.     @weapons.push(Sprite_Weapon.new(@viewport, @weapons.size, battler))
  7671.     battler.sv.weapon_index.push(@weapons.size - 1) if weapon_flag
  7672.     return @weapons.size - 1
  7673.   end
  7674.   #--------------------------------------------------------------------------
  7675.   # ● バトラーの武器アクション終了
  7676.   #--------------------------------------------------------------------------
  7677.   def weapon_end(battler)
  7678.     battler.sv.weapon_end = false
  7679.     for index in battler.sv.weapon_index
  7680.       weapon_index = battler.sv.weapon_index.shift
  7681.       @weapons[weapon_index].dispose if @weapons[weapon_index] != nil
  7682.       @weapons[weapon_index] = nil
  7683.     end
  7684.     battler.sv.weapon_index.compact!
  7685.   end  
  7686.   #--------------------------------------------------------------------------
  7687.   # ● ヒット時の戦闘アニメ実行
  7688.   #--------------------------------------------------------------------------
  7689.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  7690.     weapon = @weapons[weapon_index]
  7691.     for target in hit_targets
  7692.       next @weapons[@hit_index].timing_battler_set(target) if @hit_index != nil
  7693.       @hit_index = set_weapons(battler, false, false)
  7694.       @weapons[@hit_index].set_hit_animation(weapon.hit_position, weapon.hit_anime_id, target)
  7695.     end
  7696.     @hit_index = nil
  7697.     if !weapon.through && !miss
  7698.       @weapons[weapon_index].dispose
  7699.       @weapons[weapon_index] = nil
  7700.     else
  7701.       @weapons[weapon_index].through_change
  7702.     end
  7703.   end
  7704.   #--------------------------------------------------------------------------
  7705.   # ● サイドビューデータの初期化
  7706.   #--------------------------------------------------------------------------
  7707.   def reset_sideview
  7708.     $sv_camera.reset
  7709.     for member in $game_troop.members + $game_party.battle_members do member.sv.reset end
  7710.   end  
  7711.   #--------------------------------------------------------------------------
  7712.   # ● 解放
  7713.   #--------------------------------------------------------------------------
  7714.   def dispose
  7715.     dispose_effects(@weapons)
  7716.     dispose_effects(@pictures)
  7717.     dispose_effects(@back_pic)
  7718.     dispose_effects(@damage)
  7719.     reset_sideview
  7720.   end
  7721.   #--------------------------------------------------------------------------
  7722.   # ● エフェクト画像の解放
  7723.   #--------------------------------------------------------------------------
  7724.   def dispose_effects(effects)
  7725.     for i in 0...effects.size
  7726.       effects[i].dispose if effects[i] != nil
  7727.       effects[i] = nil
  7728.     end
  7729.   end
  7730. end
  7731.  
  7732.  
  7733. #==============================================================================
  7734. # ■ Sprite_Battle_Back
  7735. #------------------------------------------------------------------------------
  7736. #  戦闘背景用のスプライトです。
  7737. #==============================================================================
  7738. class Sprite_Battle_Back < Plane
  7739.   #--------------------------------------------------------------------------
  7740.   # ● オブジェクト初期化
  7741.   #--------------------------------------------------------------------------
  7742.   def initialize(viewport = nil, index, battleback_name)
  7743.     super(viewport)
  7744.     @index = index
  7745.     if @index == 1
  7746.       data = N03::FLOOR1_DATA[battleback_name]
  7747.       data = N03::FLOOR1_DATA["全Battlebacks1"] if data == nil
  7748.     elsif @index == 2
  7749.       data = N03::FLOOR2_DATA[battleback_name]
  7750.       data = N03::FLOOR2_DATA["全Battlebacks2"] if data == nil
  7751.     end   
  7752.     data = data.dup
  7753.     @adjust_position = data[0]
  7754.     @zoom_x = data[1][0] / 100.0
  7755.     @zoom_y = data[1][1] / 100.0
  7756.     @shake_on = data[2]
  7757.     $game_switches[data[3]] = true if data[3] > 0
  7758.     $sv_camera.switches[data[3].abs] = true if data[3] < 0
  7759.     reset_scroll
  7760.     reset_back_data(battleback_name)
  7761.   end
  7762.   #--------------------------------------------------------------------------
  7763.   # ● 背景スクロールを初期化
  7764.   #--------------------------------------------------------------------------
  7765.   def reset_scroll
  7766.     @scroll_x = 0
  7767.     @scroll_y = 0
  7768.     @move_x = 0
  7769.     @move_y = 0
  7770.   end
  7771.   #--------------------------------------------------------------------------
  7772.   # ● 背景データを初期化
  7773.   #--------------------------------------------------------------------------
  7774.   def reset_back_data(battleback_name)
  7775.     @back_data = []
  7776.     @active_data = ["scroll",0, @move_x, @move_y, false, battleback_name,""]
  7777.     start_back_data(@active_data)
  7778.   end  
  7779.   #--------------------------------------------------------------------------
  7780.   # ● 背景画像のセッティング
  7781.   #--------------------------------------------------------------------------
  7782.   def set_graphics(new_bitmap)
  7783.     self.bitmap = new_bitmap
  7784.     @base_x = (self.bitmap.width * @zoom_x - Graphics.width) / 2 + @adjust_position[0]
  7785.     @base_y = (self.bitmap.height * @zoom_y - Graphics.height) / 2 + @adjust_position[1]
  7786.     # 限界座標を取得
  7787.     max_top =  0
  7788.     max_bottom = self.bitmap.height * @zoom_y - Graphics.height
  7789.     max_left = 0
  7790.     max_right = self.bitmap.width * @zoom_x - Graphics.width
  7791.     exist = true
  7792.     exist = false if self.bitmap.height == 32 && self.bitmap.width == 32
  7793.     $sv_camera.setting(@index, [max_top, max_bottom, max_left, max_right, @base_x, @base_y,exist])
  7794.   end
  7795.   #--------------------------------------------------------------------------
  7796.   # ● フレーム更新
  7797.   #--------------------------------------------------------------------------
  7798.   def update
  7799.     return if !bitmap
  7800.     update_back_data
  7801.     update_scroll unless @move_x == 0 && @move_y == 0
  7802.     update_color
  7803.     update_position
  7804.     update_back_adjust if @bt_back != nil
  7805.     create_back_adjust if @bt_back == nil && !@active_data[10] && @scroll_x == 0 && @scroll_y == 0
  7806.   end
  7807.   #--------------------------------------------------------------------------
  7808.   # ● 背景データを更新
  7809.   #--------------------------------------------------------------------------
  7810.   def update_back_data
  7811.     delete = true if @active_data[1] > 0 && !$game_switches[@active_data[1]]
  7812.     delete = true if @active_data[1] < 0 && !$sv_camera.switches[@active_data[1].abs]
  7813.     return if !delete
  7814.     for i in [email]0...@back_data.size[/email]
  7815.       @back_data[i] = nil if @back_data[i][1] > 0 && !$game_switches[@back_data[i][1]]
  7816.       @back_data[i] = nil if @back_data[i][1] < 0 && !$sv_camera.switches[@back_data[i][1].abs]
  7817.     end
  7818.     @back_data.compact!
  7819.     next_back_data
  7820.   end
  7821.   #--------------------------------------------------------------------------
  7822.   # ● 次の背景データをセット
  7823.   #--------------------------------------------------------------------------
  7824.   def next_back_data
  7825.     @back_data.delete(@active_data[11]) if @active_data[11] != nil
  7826.     @back_data.push(@active_data[11]) if @active_data[11] != nil
  7827.     @active_data = nil
  7828.     data = @back_data.pop
  7829.     @back_data = [@active_data] if @back_data.size == 0
  7830.     start_back_data(data)
  7831.   end  
  7832.   #--------------------------------------------------------------------------
  7833.   # ● 背景データを実行
  7834.   #--------------------------------------------------------------------------
  7835.   def start_back_data(data)
  7836.     return if back_data_remain(data)
  7837.     bt_back_dispose
  7838.     pre_active_data = @active_data
  7839.     @active_data[8] = [@back_name, @move_x, @move_y, @scroll_x, @scroll_y] if @active_data != nil
  7840.     @back_data.push(@active_data)     if @active_data != nil
  7841.     @active_data = data.dup
  7842.     @active_data[5] = @back_name      if @active_data[5] == ""
  7843.     @active_data[9] = set_back_adjust if @active_data[9] == nil
  7844.     back_data_scroll_on               if @active_data[8] == nil && @active_data[9][0] == false
  7845.     set_remain_back_data              if @active_data[8] != nil
  7846.     create_back(@active_data[5])      if @active_data[9][0] == false
  7847.     create_back_adjust                if @active_data[10]
  7848.     @active_data[11] = pre_active_data if pre_active_data && @active_data[7] == false
  7849.   end  
  7850.   #--------------------------------------------------------------------------
  7851.   # ● 背景データの保留
  7852.   #--------------------------------------------------------------------------
  7853.   def back_data_remain(data)
  7854.     remain = false
  7855.     remain = true if data[6] != "" && @active_data != nil && @active_data[9] != nil && @active_data[9][0] != false
  7856.     remain = true if @active_data != nil && @active_data[7] == false
  7857.     return remain if !remain
  7858.     @remain = true
  7859.     @back_data.push(data)
  7860.     return remain
  7861.   end  
  7862.   #--------------------------------------------------------------------------
  7863.   # ● 背景変更補正データをセット
  7864.   #--------------------------------------------------------------------------
  7865.   def set_back_adjust
  7866.     bt_adjust = []
  7867.     sign = -1
  7868.     if @active_data[6] == ""
  7869.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  7870.       bt_adjust = [false,false,0,0]
  7871.       return bt_adjust
  7872.     elsif @move_x != 0 or @active_data[3][0] != 0
  7873.       sign = 1 if @move_x < 0
  7874.       bt_adjust[0] = [self.bitmap.width * @zoom_x * sign, 0]
  7875.       bt_adjust[1] = [self.bitmap.width * @zoom_x * sign * 2, 0]
  7876.     elsif @move_y != 0 or @active_data[3][1] != 0
  7877.       sign = 1 if @move_y < 0
  7878.       bt_adjust[0] = [0, self.bitmap.height * @zoom_y * sign]
  7879.       bt_adjust[1] = [0, self.bitmap.height * @zoom_y * sign * 2]
  7880.     else
  7881.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  7882.       bt_adjust = [false,false,0,0]
  7883.       return bt_adjust
  7884.     end
  7885.     bt_adjust[2] = [bt_adjust[0][0], bt_adjust[0][1]]
  7886.     return bt_adjust
  7887.   end
  7888.   #--------------------------------------------------------------------------
  7889.   # ● 背景スクロールデータを実行
  7890.   #--------------------------------------------------------------------------
  7891.   def back_data_scroll_on
  7892.     mirror = $sv_camera.mirror
  7893.     mirror = false if !@active_data[4]
  7894.     @move_x = @active_data[3][0]
  7895.     @move_x *= -1 if mirror
  7896.     @move_y = @active_data[3][1]
  7897.   end
  7898.   #--------------------------------------------------------------------------
  7899.   # ● 保持している背景データを実行
  7900.   #--------------------------------------------------------------------------
  7901.   def set_remain_back_data
  7902.     return back_data_scroll_on if @move_x != 0 or @move_y != 0
  7903.     create_back(@active_data[8][0])
  7904.     @move_x    = @active_data[8][1]
  7905.     @move_y    = @active_data[8][2]
  7906.     @scroll_x  = @active_data[8][3]
  7907.     @scroll_y  = @active_data[8][4]
  7908.   end  
  7909.   #--------------------------------------------------------------------------
  7910.   # ● 背景画像の作成
  7911.   #--------------------------------------------------------------------------
  7912.   def create_back(back_name)
  7913.     return if back_name == @back_name or back_name == ""
  7914.     self.bitmap = Cache.battleback1(back_name) if @index == 1
  7915.     self.bitmap = Cache.battleback2(back_name) if @index == 2
  7916.     @back_name = back_name
  7917.   end  
  7918.   #--------------------------------------------------------------------------
  7919.   # ● 背景変更補正画像の作成
  7920.   #--------------------------------------------------------------------------
  7921.   def create_back_adjust
  7922.     return if @active_data[9][0] == false
  7923.     @active_data[10] = true
  7924.     mirror = $sv_camera.mirror
  7925.     mirror = false if !@active_data[4]
  7926.     @bt_back = []
  7927.     @bt_back[0] = Sprite.new(viewport)
  7928.     @bt_back[0].bitmap = Cache.battleback1(@active_data[6]) if @index == 1
  7929.     @bt_back[0].bitmap = Cache.battleback2(@active_data[6]) if @index == 2
  7930.     @bt_back[0].mirror = mirror
  7931.     @bt_back[1] = Sprite.new(viewport)
  7932.     @bt_back[1].bitmap = Cache.battleback1(@active_data[5]) if @index == 1
  7933.     @bt_back[1].bitmap = Cache.battleback2(@active_data[5]) if @index == 2
  7934.     @bt_back[1].mirror = mirror
  7935.   end
  7936.   #--------------------------------------------------------------------------
  7937.   # ● 背景スクロールの更新
  7938.   #--------------------------------------------------------------------------
  7939.   def update_scroll
  7940.     @scroll_x += @move_x
  7941.     @scroll_y += @move_y
  7942.     @scroll_x = 0 if @scroll_x / 100 >= self.bitmap.width * @zoom_x or @scroll_x / 100 <= -self.bitmap.width * @zoom_x
  7943.     @scroll_y = 0 if @scroll_y / 100 >= self.bitmap.height * @zoom_y or @scroll_y / 100 <= -self.bitmap.height * @zoom_y
  7944.   end
  7945.   #--------------------------------------------------------------------------
  7946.   # ● 色調変更の更新
  7947.   #--------------------------------------------------------------------------
  7948.   def update_color
  7949.     color_set if $sv_camera.color_set[@index] != nil
  7950.     return if @color_data == nil
  7951.     @color_data[4] -= 1
  7952.     if @color_data[4] == 0 && @color_data[5] != 0
  7953.       @color_data[4] = @color_data[5]
  7954.       @color_data[5] = 0
  7955.       @color_data[6] = [0,0,0,0]
  7956.     elsif @color_data[4] == 0
  7957.       @remain_color_data = @color_data
  7958.       return @color_data = nil
  7959.     end  
  7960.     for i in 0..3
  7961.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  7962.     end  
  7963.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  7964.   end
  7965.   #--------------------------------------------------------------------------
  7966.   # ● 座標の更新
  7967.   #--------------------------------------------------------------------------
  7968.   def update_position
  7969.     self.ox = $sv_camera.x + @base_x - @scroll_x / 100
  7970.     self.oy = $sv_camera.y + @base_y - @scroll_y / 100
  7971.     self.ox -= $sv_camera.sx / 100 if @shake_on
  7972.     self.oy -= $sv_camera.sy / 100 if @shake_on
  7973.     self.zoom_x = @zoom_x * $sv_camera.zoom
  7974.     self.zoom_y = @zoom_y * $sv_camera.zoom
  7975.     self.ox *= $sv_camera.zoom
  7976.     self.oy *= $sv_camera.zoom
  7977.     self.z = @index * 10
  7978.   end
  7979.   #--------------------------------------------------------------------------
  7980.   # ● 背景変更補正画像を更新
  7981.   #--------------------------------------------------------------------------
  7982.   def update_back_adjust
  7983.     @active_data[9][0][0] = 0 if @scroll_x == 0
  7984.     @active_data[9][0][1] = 0 if @scroll_y == 0
  7985.     @active_data[9][1][0] -= @active_data[9][2][0] if @scroll_x == 0
  7986.     @active_data[9][1][1] -= @active_data[9][2][1] if @scroll_y == 0
  7987.     for i in [email]0...@bt_back.size[/email]
  7988.       @bt_back[i].x = -self.ox + @active_data[9][i][0] * $sv_camera.zoom
  7989.       @bt_back[i].y = -self.oy + @active_data[9][i][1] * $sv_camera.zoom
  7990.       @bt_back[i].zoom_x = self.zoom_x
  7991.       @bt_back[i].zoom_y = self.zoom_y
  7992.       @bt_back[i].z = self.z + 1
  7993.       @bt_back[i].color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  7994.     end
  7995.     back_data_scroll_on if @active_data[9][0][0] == 0 && @active_data[9][0][1] == 0
  7996.     return unless @active_data[9][1][0] == 0 && @active_data[9][1][1] == 0
  7997.     bt_back_dispose
  7998.     create_back(@active_data[5])
  7999.     @active_data[9][0] = false
  8000.     next_back_data if @remain && @back_data.size != 1
  8001.     @remain = false
  8002.   end
  8003.   #--------------------------------------------------------------------------
  8004.   # ● 色調変更
  8005.   #--------------------------------------------------------------------------
  8006.   def color_set
  8007.     set = $sv_camera.color_set[@index]
  8008.     $sv_camera.color_set[@index] = nil
  8009.     set[4] = 1 if set[4] == 0
  8010.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  8011.     @color_data = @remain_color_data
  8012.     @color_data[4] = set[4]
  8013.     @color_data[5] = set[5]
  8014.     @color_data[6] = set
  8015.   end
  8016.   #--------------------------------------------------------------------------
  8017.   # ● 背景変更補正画像の解放
  8018.   #--------------------------------------------------------------------------
  8019.   def bt_back_dispose
  8020.     for i in [email]0...@bt_back.size[/email] do @bt_back[i].dispose end if @bt_back != nil
  8021.     @bt_back = nil
  8022.   end  
  8023.   #--------------------------------------------------------------------------
  8024.   # ● 解放
  8025.   #--------------------------------------------------------------------------
  8026.   def dispose
  8027.     bitmap.dispose if bitmap
  8028.     bt_back_dispose
  8029.     super
  8030.   end
  8031. end  
  8032.  
  8033. #==============================================================================
  8034. # ■ Battle_Camera
  8035. #------------------------------------------------------------------------------
  8036. #  戦闘カメラやバトルプログラムを扱うクラスです。
  8037. #==============================================================================
  8038. class Battle_Camera
  8039.   #--------------------------------------------------------------------------
  8040.   # ● 公開インスタンス変数 
  8041.   #--------------------------------------------------------------------------
  8042.   attr_reader   :sx                 # シェイクX座標
  8043.   attr_reader   :sy                 # シェイクY座標
  8044.   attr_reader   :max_top            # 上限界座標
  8045.   attr_reader   :max_bottom         # 下限界座標
  8046.   attr_reader   :max_left           # 左限界座標
  8047.   attr_reader   :max_right          # 右限界座標
  8048.   attr_accessor :switches           # サイドビュー専用スイッチ
  8049.   attr_accessor :color_set          # 色調変更データ
  8050.   attr_accessor :wait               # 戦闘シーンの強制ウエイト
  8051.   attr_accessor :win_wait           # 戦闘勝利前のウエイト
  8052.   attr_accessor :mirror             # 画面反転フラグ
  8053.   attr_accessor :program_scroll     # バトルプログラム 背景の自動スクロール
  8054.   attr_accessor :program_picture    # バトルプログラム 周期ピクチャ
  8055.   attr_accessor :event              # コモンイベント呼び出し
  8056.   #--------------------------------------------------------------------------
  8057.   # ● オブジェクト初期化
  8058.   #--------------------------------------------------------------------------
  8059.   def initialize
  8060.     @switches = []
  8061.     @max_data = []
  8062.     @color_set = []
  8063.     @wait = 0
  8064.     @win_wait = false
  8065.     @mirror = false
  8066.     @event = false
  8067.     setup
  8068.   end
  8069.   #--------------------------------------------------------------------------
  8070.   # ● カメラX座標
  8071.   #--------------------------------------------------------------------------
  8072.   def x
  8073.     return @x / 100
  8074.   end
  8075.   #--------------------------------------------------------------------------
  8076.   # ● カメラY座標
  8077.   #--------------------------------------------------------------------------
  8078.   def y
  8079.     return @y / 100
  8080.   end
  8081.   #--------------------------------------------------------------------------
  8082.   # ● ズーム率
  8083.   #--------------------------------------------------------------------------
  8084.   def zoom
  8085.     return @zoom * 0.001
  8086.   end
  8087.   #--------------------------------------------------------------------------
  8088.   # ● ズーム率による座標変換
  8089.   #--------------------------------------------------------------------------
  8090.   def convert
  8091.     return @zoom
  8092.   end
  8093.   #--------------------------------------------------------------------------
  8094.   # ● カメラセットアップ
  8095.   #--------------------------------------------------------------------------
  8096.   def setup
  8097.     @x = 0
  8098.     @y = 0
  8099.     @sx = 0
  8100.     @sy = 0
  8101.     @zoom = 1000
  8102.     @time = 0
  8103.     @shake_time = 0
  8104.     program_setup
  8105.   end
  8106.   #--------------------------------------------------------------------------
  8107.   # ● カメラ初期化
  8108.   #--------------------------------------------------------------------------
  8109.   def reset
  8110.     @switches = []
  8111.     @max_data = []
  8112.     @color_set = []
  8113.     @wait = 0
  8114.     @win_wait = false
  8115.     @mirror = false
  8116.     program_setup(false)
  8117.   end  
  8118.   #--------------------------------------------------------------------------
  8119.   # ● バトルプログラムのセットアップ
  8120.   #--------------------------------------------------------------------------
  8121.   def program_setup(check = true)
  8122.     @played_program  = []
  8123.     @program_switch  = []
  8124.     @program_sound   = []
  8125.     @program_scroll  = []
  8126.     @program_se      = []
  8127.     @program_shake   = []
  8128.     @program_color   = []
  8129.     @program_picture = []
  8130.     @program_base = N03::BATTLE_PROGRAM.values.dup
  8131.     program_check if check
  8132.   end  
  8133.   #--------------------------------------------------------------------------
  8134.   # ● バトルプログラムのチェック
  8135.   #--------------------------------------------------------------------------
  8136.   def program_check
  8137.     for data in @program_base
  8138.       if program_start?(data) && !@played_program.include?(data)
  8139.         @played_program.push(data.dup)
  8140.         @program_scroll.push(data.dup)  if data[0] == "scroll"
  8141.         @program_picture.push(data.dup) if data[0] == "kpic"
  8142.         start_sound(data.dup)           if data[0] == "sound"
  8143.         start_program_switch(data.dup)  if data[0] == "switch"
  8144.         start_program_se(data.dup)      if data[0] == "keep_se"
  8145.         start_program_shake(data.dup)   if data[0] == "keep_sk"
  8146.         start_program_color(data.dup)   if data[0] == "keep_c"
  8147.       else
  8148.         @played_program.delete(data)  if !program_start?(data)
  8149.         @program_scroll.delete(data)  if data[0] == "scroll"
  8150.         @program_picture.delete(data) if data[0] == "kpic"
  8151.         @program_switch.delete(data)  if data[0] == "switch"
  8152.         @program_sound.delete(data)   if data[0] == "sound"
  8153.         @program_se.delete(data)      if data[0] == "keep_se"
  8154.         @program_shake.delete(data)   if data[0] == "keep_sk"
  8155.         @program_color.delete(data)   if data[0] == "keep_c"
  8156.       end
  8157.     end
  8158.   end
  8159.   #--------------------------------------------------------------------------
  8160.   # ● バトルプログラムの開始
  8161.   #--------------------------------------------------------------------------
  8162.   def program_start?(data)
  8163.     start = false
  8164.     start = true if $game_switches[data[1].abs] && data[1] > 0
  8165.     start = true if @switches[data[1].abs] && data[1] < 0
  8166.     return start
  8167.   end  
  8168.   #--------------------------------------------------------------------------
  8169.   # ● バトルプログラム スイッチ操作の開始
  8170.   #--------------------------------------------------------------------------
  8171.   def start_program_switch(data)
  8172.     data[4] = data[4] + rand(data[5] + 1)
  8173.     data[4] = 1 if data[4] <= 0
  8174.     @program_switch.push(data)
  8175.   end
  8176.   #--------------------------------------------------------------------------
  8177.   # ● スイッチ操作の更新
  8178.   #--------------------------------------------------------------------------
  8179.   def update_program_switch
  8180.     for data in @program_switch
  8181.       data[4] -= 1
  8182.       next @program_switch.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  8183.       next @program_switch.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  8184.       next if data[4] != 0
  8185.       for id in data[2]
  8186.         $game_switches[id] = true if id > 0
  8187.         @switches[id.abs] = true  if id < 0
  8188.       end
  8189.       for id in data[3]
  8190.         $game_switches[id] = false if id > 0
  8191.         @switches[id.abs] = false  if id < 0
  8192.       end
  8193.       @program_switch.delete(data)
  8194.       program_check
  8195.     end  
  8196.   end
  8197.   #--------------------------------------------------------------------------
  8198.   # ● バトルプログラム BGM/BGSの開始
  8199.   #--------------------------------------------------------------------------
  8200.   def start_sound(data)
  8201.     @program_sound.push(data)
  8202.     name = data[5]
  8203.     case data[2]
  8204.     when "se"
  8205.       Audio.se_play("Audio/SE/" + name, data[4], data[3])
  8206.     when "bgm"
  8207.       name = RPG::BGM.last.name if data[5] == ""
  8208.       Audio.bgm_play("Audio/BGM/" + name, data[4], data[3])
  8209.     when "bgs"
  8210.       name = RPG::BGS.last.name if data[5] == ""
  8211.       Audio.bgs_play("Audio/BGS/" + name, data[4], data[3])
  8212.     end
  8213.   end
  8214.   #--------------------------------------------------------------------------
  8215.   # ● バトルプログラム 周期SEの開始
  8216.   #--------------------------------------------------------------------------
  8217.   def start_program_se(data)
  8218.     data[3] = [data[2], data[3]]
  8219.     data[2] = data[3][0] + rand(data[3][1] + 1)
  8220.     @program_se.push(data)
  8221.     Audio.se_play("Audio/SE/" + data[7], data[5], data[4]) if data[6]
  8222.   end
  8223.   #--------------------------------------------------------------------------
  8224.   # ● 周期SEの更新
  8225.   #--------------------------------------------------------------------------
  8226.   def update_program_se
  8227.     for data in @program_se
  8228.       data[2] -= 1
  8229.       next @program_se.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  8230.       next @program_se.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  8231.       next if data[2] != 0
  8232.       Audio.se_play("Audio/SE/" + data[7], data[5], data[4])
  8233.       data[2] = data[3][0] + rand(data[3][1] + 1)
  8234.     end  
  8235.   end
  8236.   #--------------------------------------------------------------------------
  8237.   # ● バトルプログラム 周期シェイクの開始
  8238.   #--------------------------------------------------------------------------
  8239.   def start_program_shake(data)
  8240.     data[3] = [data[2], data[3]]
  8241.     data[2] = data[3][0] + rand(data[3][1] + 1)
  8242.     @program_shake.push(data)
  8243.     shake(data[4], data[5], data[6]) if data[7]
  8244.   end
  8245.   #--------------------------------------------------------------------------
  8246.   # ● 周期シェイクの更新
  8247.   #--------------------------------------------------------------------------
  8248.   def update_program_shake
  8249.     for data in @program_shake
  8250.       data[2] -= 1
  8251.       next @program_shake.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  8252.       next @program_shake.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  8253.       next if data[2] != 0
  8254.       shake(data[4], data[5], data[6])
  8255.       data[2] = data[3][0] + rand(data[3][1] + 1)
  8256.     end  
  8257.   end
  8258.   #--------------------------------------------------------------------------
  8259.   # ● バトルプログラム 周期色調変更の開始
  8260.   #--------------------------------------------------------------------------
  8261.   def start_program_color(data)
  8262.     data[3] = [data[2], data[3]]
  8263.     data[2] = data[3][0] + rand(data[3][1] + 1)
  8264.     data[7] = true if data[4] == 0 or data[4] == 4
  8265.     case data[4]
  8266.     when 1   ;data[4] = $game_troop.members
  8267.     when 2   ;data[4] = $game_party.battle_members
  8268.     when 3,4 ;data[4] = $game_troop.members + $game_party.battle_members
  8269.     else ;data[4] = []
  8270.     end
  8271.     @program_color.push(data)
  8272.     return if !data[6]
  8273.     for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  8274.     @color_set[1] = data[5] if data[7]
  8275.     @color_set[2] = data[5] if data[7]
  8276.   end
  8277.   #--------------------------------------------------------------------------
  8278.   # ● 周期色調変更の更新
  8279.   #--------------------------------------------------------------------------
  8280.   def update_program_color
  8281.     for data in @program_color
  8282.       data[2] -= 1
  8283.       next @program_color.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  8284.       next @program_color.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  8285.       next if data[2] != 0
  8286.       for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  8287.       @color_set[1] = data[5] if data[7]
  8288.       @color_set[2] = data[5] if data[7]
  8289.       data[2] = data[3][0] + rand(data[3][1] + 1)
  8290.     end
  8291.   end
  8292.   #--------------------------------------------------------------------------
  8293.   # ● トランジション実行
  8294.   #--------------------------------------------------------------------------
  8295.   def perform_transition(data)
  8296.     Graphics.transition(data[2], "Graphics/Pictures/" + data[3], data[1])
  8297.   end  
  8298.   #--------------------------------------------------------------------------
  8299.   # ● 背景からカメラの限界値を取得  data = [max_top, max_bottom, max_left, max_right]
  8300.   #--------------------------------------------------------------------------
  8301.   def setting(index, data)
  8302.     @max_data[index - 1] = data
  8303.     return if index != 2
  8304.     setup
  8305.     # カメラの中心座標
  8306.     @center_x     = (Graphics.width / 2 + N03::CAMERA_POSITION[0]) * 100
  8307.     @center_y     = (Graphics.height / 2 + N03::CAMERA_POSITION[1]) * 100
  8308.     # 上下左右の移動限界距離
  8309.     @max_top    = [@max_data[0][5], @max_data[1][5]].min * -1
  8310.     @max_bottom = [@max_data[0][1], @max_data[1][1]].min + @max_top
  8311.     @max_left   = [@max_data[0][4], @max_data[1][4]].min  * -1
  8312.     @max_right  = [@max_data[0][3], @max_data[1][3]].min + @max_left
  8313.     exist_data = @max_data[0] if !@max_data[1][6]
  8314.     exist_data = @max_data[1] if !@max_data[0][6]
  8315.     @max_top    = exist_data[5] * -1        if exist_data != nil
  8316.     @max_bottom = exist_data[1] + @max_top  if exist_data != nil
  8317.     @max_left   = exist_data[4] * -1        if exist_data != nil
  8318.     @max_right  = exist_data[3] + @max_left if exist_data != nil
  8319.     @max_top = @max_bottom = @max_left = @max_right = 0 if !@max_data[1][6] && !@max_data[0][6]
  8320.     @max_width    = @max_right - @max_left + Graphics.width
  8321.     @max_height   = @max_bottom - @max_top + Graphics.height
  8322.     # ズームアウト限界値
  8323.     max_zoom_x    = 100 * Graphics.width / @max_width
  8324.     max_zoom_y    = 100 * Graphics.height / @max_height
  8325.     @max_zoom_out = [max_zoom_x, max_zoom_y].max
  8326.   end
  8327.   #--------------------------------------------------------------------------
  8328.   # ● カメラ移動
  8329.   #--------------------------------------------------------------------------
  8330.   def move(target_x, target_y, zoom, time, screen = true)
  8331.     # 戦闘背景以上のサイズまでズームアウトしないよう調整
  8332.     @target_zoom = [zoom * 0.01, @max_zoom_out * 0.01].max
  8333.     target_x *= -1 if screen && @mirror
  8334.     # ズーム分の中心座標補正
  8335.     if screen && @target_zoom != 1
  8336.       target_x = target_x + @center_x
  8337.       target_y = target_y + @center_y
  8338.     end
  8339.     adjust_x = @center_x * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  8340.     adjust_y = @center_y * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  8341.     adjust_x = 0 if adjust_x.nan?
  8342.     adjust_y = 0 if adjust_y.nan?
  8343.     adjust_x = @center_x if !screen && adjust_x == 0
  8344.     adjust_y = @center_y if !screen && adjust_y == 0
  8345.     @target_x = target_x - adjust_x.to_i
  8346.     @target_y = target_y - adjust_y.to_i
  8347.     @target_zoom = (@target_zoom * 1000).to_i
  8348.     @zoom = @zoom.to_i
  8349.     limit_test
  8350.     # 時間0の場合は即実行
  8351.     return @time = time.abs if time != 0
  8352.     @time = 1
  8353.     update
  8354.   end
  8355.   #--------------------------------------------------------------------------
  8356.   # ● 限界座標の試算
  8357.   #--------------------------------------------------------------------------
  8358.   def limit_test
  8359.     new_width = @max_width * @target_zoom / 1000
  8360.     new_height = @max_height * @target_zoom / 1000
  8361.     new_max_right = @max_right - (@max_width - new_width)
  8362.     new_max_bottom = @max_bottom - (@max_height - new_height)
  8363.     # 画面の移動先が限界の場合、限界座標をセット
  8364.     if @target_x < @max_left * 100
  8365.       @target_x = @max_left * 100
  8366.     end
  8367.     if @target_x > new_max_right * 100
  8368.       @target_x = new_max_right * 100
  8369.     end
  8370.     if @target_y < @max_top * 100
  8371.       @target_y = @max_top * 100
  8372.     end
  8373.     if @target_y > new_max_bottom * 100
  8374.       @target_y = new_max_bottom * 100
  8375.     end
  8376.   end
  8377.   #--------------------------------------------------------------------------
  8378.   # ● 画面のシェイク
  8379.   #--------------------------------------------------------------------------
  8380.   def shake(power, speed, time)
  8381.     @shake_x = power[0] * 100
  8382.     @shake_y = power[1] * 100
  8383.     @power_time_base = @power_time = speed
  8384.     @shake_time = time
  8385.     update_shake
  8386.   end
  8387.   #--------------------------------------------------------------------------
  8388.   # ● シェイクの更新
  8389.   #--------------------------------------------------------------------------
  8390.   def update_shake
  8391.     @sx = (@sx * (@power_time - 1) + @shake_x) / @power_time
  8392.     @sy = (@sy * (@power_time - 1) + @shake_y) / @power_time
  8393.     @power_time -= 1
  8394.     @shake_time -= 1
  8395.     return @sx = @sy = 0 if @shake_time == 0
  8396.     return if @power_time != 0
  8397.     @power_time = @power_time_base
  8398.     @shake_x = @shake_x * -4 / 5
  8399.     @shake_y = @shake_y * -4 / 5
  8400.   end
  8401.   #--------------------------------------------------------------------------
  8402.   # ● フレーム更新
  8403.   #--------------------------------------------------------------------------
  8404.   def update
  8405.     update_shake if @shake_time != 0
  8406.     update_program
  8407.     return if @time == 0
  8408.     @x = (@x * (@time - 1) + @target_x) / @time
  8409.     @y = (@y * (@time - 1) + @target_y) / @time
  8410.     @zoom = (@zoom * (@time - 1) + @target_zoom) / @time
  8411.     @time -= 1
  8412.   end
  8413.   #--------------------------------------------------------------------------
  8414.   # ● フレーム更新
  8415.   #--------------------------------------------------------------------------
  8416.   def update_program
  8417.     update_program_switch if @program_switch != []
  8418.     update_program_se     if @program_se != []
  8419.     update_program_shake  if @program_shake != []
  8420.     update_program_color  if @program_color != []
  8421.   end
  8422. end
  8423.  
  8424. #==============================================================================
  8425. # ■ Scene_Battle
  8426. #------------------------------------------------------------------------------
  8427. #  バトル画面の処理を行うクラスです。
  8428. #==============================================================================
  8429. class Scene_Battle < Scene_Base
  8430.   #--------------------------------------------------------------------------
  8431.   # ● フレーム更新(基本)
  8432.   #--------------------------------------------------------------------------
  8433.   alias update_basic_scene_battle_n03 update_basic
  8434.   def update_basic
  8435.     update_basic_scene_battle_n03
  8436.     $sv_camera.update
  8437.     $sv_camera.wait = N03::TURN_END_WAIT + 1 if $sv_camera.win_wait
  8438.     camera_wait
  8439.   end
  8440.   #--------------------------------------------------------------------------
  8441.   # ● カメラウェイト
  8442.   #--------------------------------------------------------------------------
  8443.   def camera_wait
  8444.     process_event if $sv_camera.event
  8445.     $sv_camera.event = false if $sv_camera.event
  8446.     while $sv_camera.wait != 0
  8447.       Graphics.update
  8448.       Input.update
  8449.       update_all_windows
  8450.       $game_timer.update
  8451.       $game_troop.update
  8452.       $sv_camera.update
  8453.       @spriteset.update
  8454.       update_info_viewport
  8455.       update_message_open
  8456.       $sv_camera.wait -= 1 if $sv_camera.wait > 0
  8457.       $sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
  8458.       BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
  8459.     end
  8460.   end
  8461.   #--------------------------------------------------------------------------
  8462.   # ● カメラウェイトのセット
  8463.   #--------------------------------------------------------------------------
  8464.   def set_camera_wait(time)
  8465.     $sv_camera.wait = time
  8466.     camera_wait
  8467.   end  
  8468.   #--------------------------------------------------------------------------
  8469.   # ● エフェクト実行が終わるまでウェイト ★再定義
  8470.   #--------------------------------------------------------------------------
  8471.   def wait_for_effect
  8472.   end
  8473.   #--------------------------------------------------------------------------
  8474.   # ● ターン開始
  8475.   #--------------------------------------------------------------------------
  8476.   alias turn_start_scene_battle_n03 turn_start
  8477.   def turn_start
  8478.     turn_start_scene_battle_n03
  8479.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始後"].dup)
  8480.   end
  8481.   #--------------------------------------------------------------------------
  8482.   # ● ターン終了
  8483.   #--------------------------------------------------------------------------
  8484.   alias turn_end_scene_battle_n03 turn_end
  8485.   def turn_end
  8486.     turn_end_scene_battle_n03
  8487.     for member in $game_troop.members + $game_party.members
  8488.       N03.set_damage(member, member.sv.result_damage[0],member.sv.result_damage[1])
  8489.       member.sv.result_damage = [0,0]
  8490.       @spriteset.set_damage_pop(member) if member.result.hp_damage != 0 or member.result.mp_damage != 0
  8491.     end
  8492.     set_camera_wait(N03::TURN_END_WAIT)
  8493.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup) if $game_party.inputable?
  8494.     @log_window.clear
  8495.   end
  8496.   #--------------------------------------------------------------------------
  8497.   # ● スキル/アイテムの使用 ★再定義
  8498.   #--------------------------------------------------------------------------
  8499.   def use_item
  8500.     item = @subject.current_action.item
  8501.     display_item(item)
  8502.     @subject.use_item(item)
  8503.     refresh_status
  8504.     @targets = @subject.current_action.make_targets.compact
  8505.     @targets = [@subject] if @targets.size == 0
  8506.     set_substitute(item)
  8507.     for time in item.repeats.times do play_sideview(@targets, item) end
  8508.     end_reaction(item)
  8509.     display_end_item
  8510.   end
  8511.   #--------------------------------------------------------------------------
  8512.   # ● スキル/アイテム名の表示
  8513.   #--------------------------------------------------------------------------
  8514.   def display_item(item)
  8515.     return @log_window.display_use_item(@subject, item) if N03::BATTLE_LOG
  8516.     @log_window.off
  8517.     @skill_name_window = Window_Skill_name.new(item.name) unless N03::NO_DISPLAY_SKILL_ID.include?(item.id) && item.is_a?(RPG::Skill)
  8518.   end  
  8519.   #--------------------------------------------------------------------------
  8520.   # ● スキル/アイテム名の表示終了
  8521.   #--------------------------------------------------------------------------
  8522.   def display_end_item
  8523.     @skill_name_window.dispose if @skill_name_window != nil
  8524.     @skill_name_window = nil
  8525.     set_camera_wait(N03::ACTION_END_WAIT) if @subject.sv.derivation_skill_id == 0
  8526.     @log_window.clear if N03::BATTLE_LOG
  8527.   end  
  8528.   #--------------------------------------------------------------------------
  8529.   # ● 反撃/魔法反射/身代わり処理
  8530.   #--------------------------------------------------------------------------
  8531.   def end_reaction(item)
  8532.     end_substitute if @substitute != nil
  8533.     set_reflection(item) if @reflection_data != nil
  8534.     set_counter_attack if @counter_attacker != nil
  8535.   end  
  8536.   #--------------------------------------------------------------------------
  8537.   # ● 反撃の発動 ★再定義
  8538.   #--------------------------------------------------------------------------
  8539.   def invoke_counter_attack(target, item)
  8540.     return if @subject.sv.counter_id != 0
  8541.     @counter_attacker = [] if @counter_attacker == nil
  8542.     return apply_item_effects(apply_substitute(target, item), item) if !target.movable?
  8543.     @log_window.add_text(sprintf(Vocab::CounterAttack, target.name)) if N03::BATTLE_LOG
  8544.     target.sv.counter_id = target.sv.counter_skill_id
  8545.     @counter_attacker.push(target)
  8546.   end
  8547.   #--------------------------------------------------------------------------
  8548.   # ● 魔法反射の発動 ★再定義
  8549.   #--------------------------------------------------------------------------
  8550.   def invoke_magic_reflection(target, item)
  8551.     return if @subject.sv.reflection_id != 0
  8552.     @log_window.add_text(sprintf(Vocab::MagicReflection, target.name)) if N03::BATTLE_LOG
  8553.     target.sv.reflection_id = target.sv.reflection_anime_id
  8554.   end
  8555.   #--------------------------------------------------------------------------
  8556.   # ● 身代わりの適用 ★再定義
  8557.   #--------------------------------------------------------------------------
  8558.   def apply_substitute(target, item)
  8559.     return target if @substitute == nil
  8560.     return target if !check_substitute(target, item)
  8561.     return @substitute
  8562.   end
  8563.   #--------------------------------------------------------------------------
  8564.   # ● 身代わりセット
  8565.   #--------------------------------------------------------------------------
  8566.   def set_substitute(item)
  8567.     @substitute = N03.get_enemy_unit(@subject).substitute_battler
  8568.     return if @substitute == nil
  8569.     s_targets = []
  8570.     for i in [email]0...@targets.size[/email]
  8571.       next if @targets[i] == @substitute
  8572.       next if !check_substitute(@targets[i], item)
  8573.       @log_window.add_text(sprintf(Vocab::Substitute, @substitute.name, @targets[i].name))
  8574.       @targets[i].sv.start_action(@targets[i].sv.substitute_receiver_start_action)
  8575.       s_targets.push(@targets[i])
  8576.       @targets[i] = @substitute
  8577.     end
  8578.     return @substitute = nil if s_targets == []
  8579.     @substitute.sv.set_target(s_targets)
  8580.     @substitute.sv.start_action(@substitute.sv.substitute_start_action)
  8581.   end  
  8582.   #--------------------------------------------------------------------------
  8583.   # ● 身代わり終了
  8584.   #--------------------------------------------------------------------------
  8585.   def end_substitute
  8586.     for member in @substitute.sv.target_battler
  8587.       member.sv.start_action(member.sv.substitute_receiver_end_action)
  8588.     end  
  8589.     @substitute.sv.start_action(@substitute.sv.substitute_end_action)
  8590.     @substitute = nil
  8591.   end
  8592.   #--------------------------------------------------------------------------
  8593.   # ● 反撃
  8594.   #--------------------------------------------------------------------------
  8595.   def set_counter_attack
  8596.     pre_subject = @subject
  8597.     for attacker in @counter_attacker
  8598.       @subject = attacker
  8599.       item = $data_skills[attacker.sv.counter_skill_id]
  8600.       play_sideview([pre_subject], item)
  8601.     end
  8602.     # 同一カウンター者を考慮してカウンターIDの初期化はアクション後に実行
  8603.     for attacker in @counter_attacker do attacker.sv.counter_id = 0 end
  8604.     @subject = pre_subject
  8605.     @counter_attacker = nil
  8606.   end
  8607.   #--------------------------------------------------------------------------
  8608.   # ● 魔法反射
  8609.   #--------------------------------------------------------------------------
  8610.   def set_reflection(item)
  8611.     @log_window.back_to(1)
  8612.     for data in @reflection_data
  8613.       @subject.sv.damage_action(@subject, item)
  8614.       N03.set_damage_anime_data([@subject], @subject, data)
  8615.       apply_item_effects(@subject, item)
  8616.       @spriteset.set_damage_pop(@subject)
  8617.     end
  8618.     set_camera_wait(N03.get_anime_time(@reflection_data[0][0]))
  8619.     @reflection_data = nil
  8620.   end
  8621.   #--------------------------------------------------------------------------
  8622.   # ● サイドビューアクション実行
  8623.   #--------------------------------------------------------------------------
  8624.   def play_sideview(targets, item)
  8625.     @subject.sv.set_target(targets)
  8626.     return if @subject.sv.attack_action(item) == nil
  8627.     return if !@subject.movable?
  8628.     return if item.scope != 9 && item.scope != 10 && !N03.targets_alive?(targets)
  8629.     @subject.sv.start_action(@subject.sv.attack_action(item))
  8630.     @subject.sv.unshift_action(@subject.sv.flash_action) if @subject.flash_flg
  8631.     @subject.sv.active = true
  8632.     @subject.sv.command_action = false
  8633.     loop do
  8634.       update_basic
  8635.       data = @subject.sv.play_data
  8636.       @targets = N03.s_targets(@subject) if data[0] == "second_targets_set"
  8637.       N03.targets_set(@subject)          if data[0] == "targets_set"
  8638.       @immortal = N03.immortaling        if data[0] == "no_collapse" && !N03.dead_attack?(@subject, item)
  8639.       @immortal = N03.unimmortaling      if data[0] == "collapse"
  8640.       next set_move_anime(item)          if @subject.sv.m_a_data != []
  8641.       set_damage(item)                   if @subject.sv.set_damage
  8642.       break N03.derived_skill(@subject)  if @subject.sv.derivation_skill_id != 0
  8643.       break                              if @subject.sv.action_end or @subject.hidden?
  8644.     end
  8645.     @immortal = N03.unimmortaling        if @immortal
  8646.   end
  8647.   #--------------------------------------------------------------------------
  8648.   # ● ダメージの実行
  8649.   #--------------------------------------------------------------------------
  8650.   def set_damage(item)
  8651.     targets = @targets
  8652.     targets = [@subject.sv.individual_targets[0]] if @subject.sv.individual_targets.size != 0
  8653.     for target in targets do damage_anime(targets.dup, target, item) end
  8654.     @subject.sv.set_damage = false
  8655.     @subject.sv.damage_anime_data = []
  8656.   end
  8657.   #--------------------------------------------------------------------------
  8658.   # ● ダメージ戦闘アニメ処理
  8659.   #--------------------------------------------------------------------------
  8660.   def damage_anime(targets, target, item)
  8661.     @log_window.back_to(1) if @log_window.line_number == 5
  8662.     return if item.scope != 9 && item.scope != 10 && target.dead?
  8663.     @miss = false
  8664.     invoke_item(target,item)
  8665.     if target.result.missed
  8666.       target.sv.miss_action(@subject, item)
  8667.       return @miss = true
  8668.     elsif target.result.evaded or target.sv.counter_id != 0
  8669.       target.sv.evasion_action(@subject, item)
  8670.       return @miss = true
  8671.     elsif target.sv.reflection_id != 0
  8672.       N03.set_damage_anime_data(targets, target, [target.sv.reflection_id, false, false, true])
  8673.       target.sv.reflection_id = 0
  8674.       @reflection_data = [] if @reflection_data == nil
  8675.       return @reflection_data.push([N03.get_attack_anime_id(-3, @subject), false, false, true])
  8676.     end
  8677.     target.sv.damage_action(@subject, item)
  8678.     N03.set_damage(@subject, -target.result.hp_drain, -target.result.mp_drain) if target != @subject
  8679.     @spriteset.set_damage_pop(target)
  8680.     @spriteset.set_damage_pop(@subject) if target != @subject && @subject.result.hp_damage != 0 or @subject.result.mp_damage != 0
  8681.     N03.set_damage_anime_data(targets, target, @subject.sv.damage_anime_data) if @subject.sv.damage_anime_data != []
  8682.   end
  8683.   #--------------------------------------------------------------------------
  8684.   # ● 飛ばしアニメ処理
  8685.   #--------------------------------------------------------------------------
  8686.   def set_move_anime(item)
  8687.     for data in @subject.sv.m_a_data
  8688.       @subject.sv.damage_anime_data = data[4]
  8689.       hit_targets = []
  8690.       for target in data[1]
  8691.         damage_anime(data[1], target, item) if data[0]
  8692.         hit_targets.push(target) if !@miss
  8693.       end
  8694.       @miss = false if !data[3]
  8695.       @spriteset.set_hit_animation(@subject, data[2], hit_targets, @miss)
  8696.     end
  8697.     @subject.sv.set_damage = false
  8698.     @subject.sv.m_a_data = []
  8699.   end
  8700. end
  8701.  
  8702. #==============================================================================
  8703. # ■ DataManager
  8704. #------------------------------------------------------------------------------
  8705. #  データベースとゲームオブジェクトを管理するモジュールです。
  8706. #==============================================================================
  8707. module DataManager
  8708.   #--------------------------------------------------------------------------
  8709.   # ● 各種ゲームオブジェクトの作成 ★再定義
  8710.   #--------------------------------------------------------------------------
  8711.   def self.create_game_objects
  8712.     $game_temp          = Game_Temp.new
  8713.     $game_system        = Game_System.new
  8714.     $game_timer         = Game_Timer.new
  8715.     $game_message       = Game_Message.new
  8716.     $game_switches      = Game_Switches.new
  8717.     $game_variables     = Game_Variables.new
  8718.     $game_self_switches = Game_SelfSwitches.new
  8719.     $game_actors        = Game_Actors.new
  8720.     $game_party         = Game_Party.new
  8721.     $game_troop         = Game_Troop.new
  8722.     $game_map           = Game_Map.new
  8723.     $game_player        = Game_Player.new
  8724.     $sv_camera          = Battle_Camera.new
  8725.   end
  8726. end
  8727.  
  8728. #==============================================================================
  8729. # ■ BattleManager
  8730. #------------------------------------------------------------------------------
  8731. #  戦闘の進行を管理するモジュールです。
  8732. #==============================================================================
  8733. module BattleManager
  8734.   #--------------------------------------------------------------------------
  8735.   # ● エンカウント時の処理 ★再定義
  8736.   #--------------------------------------------------------------------------
  8737.   def self.on_encounter
  8738.     @preemptive = (rand < rate_preemptive)
  8739.     @surprise = (rand < rate_surprise && !@preemptive)
  8740.     $sv_camera.mirror = @surprise if N03::BACK_ATTACK
  8741.   end
  8742.   #--------------------------------------------------------------------------
  8743.   # ● 勝利の処理 ★再定義
  8744.   #--------------------------------------------------------------------------
  8745.   def self.process_victory
  8746.     $sv_camera.win_wait = true
  8747.   end  
  8748.   #--------------------------------------------------------------------------
  8749.   # ● 勝利
  8750.   #--------------------------------------------------------------------------
  8751.   def self.victory
  8752.     $sv_camera.win_wait = false
  8753.     N03.camera(nil, N03::BATTLE_CAMERA["戦闘終了時"].dup)
  8754.     for member in $game_party.members do member.sv.start_action(member.sv.win) if member.movable? end
  8755.     play_battle_end_me
  8756.     replay_bgm_and_bgs
  8757.     $game_message.add(sprintf(Vocab::Victory, $game_party.name))
  8758.     display_exp
  8759.     gain_gold
  8760.     gain_drop_items
  8761.     gain_exp
  8762.     SceneManager.return
  8763.     battle_end(0)
  8764.     return true
  8765.   end
  8766.   #--------------------------------------------------------------------------
  8767.   # ● 逃走の処理 ★再定義
  8768.   #--------------------------------------------------------------------------
  8769.   def self.process_escape
  8770.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  8771.     success = @preemptive ? true : (rand < @escape_ratio)
  8772.     Sound.play_escape
  8773.     if success
  8774.       process_abort
  8775.       for member in $game_party.members do member.sv.start_action(member.sv.escape) if member.movable? end
  8776.     else
  8777.       @escape_ratio += 0.1
  8778.       $game_message.add('\.' + Vocab::EscapeFailure)
  8779.       $game_party.clear_actions
  8780.       for member in $game_party.members do member.sv.start_action(member.sv.escape_ng) if member.movable? end
  8781.     end
  8782.     wait_for_message
  8783.     return success
  8784.   end
  8785.   #--------------------------------------------------------------------------
  8786.   # ● 次のコマンド入力へ ★再定義
  8787.   #--------------------------------------------------------------------------
  8788.   def self.next_command
  8789.     begin
  8790.       if !actor || !actor.next_command
  8791.         $game_party.battle_members[@actor_index].sv.command_action = true
  8792.         @actor_index += 1
  8793.         if @actor_index >= $game_party.members.size
  8794.           for member in $game_party.battle_members.reverse
  8795.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  8796.           end
  8797.           return false
  8798.         end
  8799.       end
  8800.     end until actor.inputable?
  8801.     actor.sv.start_action(actor.sv.command_b) if actor != nil && actor.inputable?
  8802.     if pre_actor
  8803.       pre_actor.sv.start_action(pre_actor.sv.command_a) if pre_actor != nil && pre_actor.inputable?
  8804.     end
  8805.     return true
  8806.   end
  8807.   #--------------------------------------------------------------------------
  8808.   # ● 前のコマンド入力へ ★再定義
  8809.   #--------------------------------------------------------------------------
  8810.   def self.prior_command
  8811.     begin
  8812.       if !actor || !actor.prior_command
  8813.         $game_party.battle_members[@actor_index].sv.command_action = false
  8814.         @actor_index -= 1
  8815.         if @actor_index < 0
  8816.           for member in $game_party.battle_members
  8817.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  8818.           end
  8819.           return false
  8820.         end
  8821.       end
  8822.     end until actor.inputable?
  8823.     actor.make_actions if actor.inputable?
  8824.     actor.sv.start_action(actor.sv.command_b) if actor.inputable?
  8825.     after_actor.sv.start_action(after_actor.sv.command_a) if after_actor != nil && after_actor.inputable?
  8826.     return true
  8827.   end
  8828.   #--------------------------------------------------------------------------
  8829.   # ● コマンド入力前のアクターを取得
  8830.   #--------------------------------------------------------------------------
  8831.   def self.pre_actor
  8832.     return if @actor_index == 0
  8833.     $game_party.members[@actor_index - 1]
  8834.   end
  8835.   #--------------------------------------------------------------------------
  8836.   # ● コマンド入力後のアクターを取得
  8837.   #--------------------------------------------------------------------------
  8838.   def self.after_actor
  8839.     $game_party.members[@actor_index + 1]
  8840.   end
  8841.   #--------------------------------------------------------------------------
  8842.   # ● 戦闘行動者を前に追加
  8843.   #--------------------------------------------------------------------------
  8844.   def self.unshift_action_battlers(battler)
  8845.     @action_battlers.unshift(battler)
  8846.   end
  8847. end  
  8848.  
  8849. #==============================================================================
  8850. # ■ Game_Battler
  8851. #------------------------------------------------------------------------------
  8852. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。
  8853. #==============================================================================
  8854. class Game_Battler < Game_BattlerBase
  8855.   #--------------------------------------------------------------------------
  8856.   # ● 公開インスタンス変数
  8857.   #--------------------------------------------------------------------------
  8858.   attr_reader   :sv                     # サイドビューデータ
  8859.   attr_accessor :flash_flg              # 閃きフラグ
  8860.   #--------------------------------------------------------------------------
  8861.   # ● オブジェクト初期化
  8862.   #--------------------------------------------------------------------------
  8863.   alias initialize_game_battler_n03 initialize
  8864.   def initialize
  8865.     initialize_game_battler_n03
  8866.     @sv = SideView.new(self)
  8867.   end
  8868.   #--------------------------------------------------------------------------
  8869.   # ● 現在の戦闘行動を除去
  8870.   #--------------------------------------------------------------------------
  8871.   alias remove_current_action_game_battler_n03 remove_current_action
  8872.   def remove_current_action
  8873.     return @sv.derivation_skill_id = 0 if @sv.derivation_skill_id != 0
  8874.     remove_current_action_game_battler_n03
  8875.   end
  8876.   #--------------------------------------------------------------------------
  8877.   # ● ターン終了処理
  8878.   #--------------------------------------------------------------------------
  8879.   alias on_turn_end_game_battler_n03 on_turn_end
  8880.   def on_turn_end
  8881.     on_turn_end_game_battler_n03
  8882.     @sv.add_state = []
  8883.     @sv.result_damage = [@result.hp_damage, @result.mp_damage]
  8884.   end
  8885.   #--------------------------------------------------------------------------
  8886.   # ● パラメータ条件比較 data = [種別, 数値, 判別]
  8887.   #--------------------------------------------------------------------------
  8888.   def comparison_parameter(data)
  8889.     return true if data[0][0] == 0
  8890.     kind = data[0]
  8891.     num = data[1]
  8892.     select = data[2]
  8893.     case kind
  8894.     when  1 ; par = level
  8895.     when  2 ; par = mhp
  8896.     when  3 ; par = mmp
  8897.     when  4 ; par = hp
  8898.     when  5 ; par = mp
  8899.     when  6 ; par = tp
  8900.     when  7 ; par = atk
  8901.     when  8 ; par = self.def
  8902.     when  9 ; par = mat
  8903.     when 10 ; par = mdf
  8904.     when 11 ; par = agi
  8905.     when 12 ; par = luk
  8906.     end
  8907.     if num < 0
  8908.       case kind
  8909.       when  4 ; num = mhp * num / 100
  8910.       when  5 ; num = mmp * num / 100
  8911.       when  6 ; num = max_tp * num / 100
  8912.       end
  8913.       num = num.abs
  8914.     end  
  8915.     case select
  8916.     when  0 ; return par == num
  8917.     when  1 ; return par < num
  8918.     when  2 ; return par > num
  8919.     end
  8920.   end
  8921.   #--------------------------------------------------------------------------
  8922.   # ● 装備条件比較 data = [装備種別, タイプID]
  8923.   #--------------------------------------------------------------------------
  8924.   def comparison_equip(data)
  8925.     kind = data[0]
  8926.     items = weapons if kind == 0
  8927.     items = armors  if kind == 1
  8928.     for item in items
  8929.       for id in data[1]
  8930.         return true if id > 0 && item.is_a?(RPG::Weapon) && item == $data_weapons[id.abs]
  8931.         return true if id > 0 && item.is_a?(RPG::Armor) && item == $data_armors[id.abs]
  8932.         return true if id < 0 && item.is_a?(RPG::Weapon) && item.wtype_id == id.abs
  8933.         return true if id < 0 && item.is_a?(RPG::Armor) && item.stype_id == id.abs
  8934.       end
  8935.     end
  8936.     return false
  8937.   end
  8938.  
  8939. end  
  8940. #==============================================================================
  8941. # ■ Game_Actor
  8942. #------------------------------------------------------------------------------
  8943. #  アクターを扱うクラスです。
  8944. #==============================================================================
  8945. class Game_Actor < Game_Battler
  8946.   #--------------------------------------------------------------------------
  8947.   # ● 公開インスタンス変数
  8948.   #--------------------------------------------------------------------------
  8949.   attr_reader :actor_id                    # ID
  8950.   #--------------------------------------------------------------------------
  8951.   # ● ID
  8952.   #--------------------------------------------------------------------------
  8953.   def id
  8954.     return @actor_id
  8955.   end
  8956.   #--------------------------------------------------------------------------
  8957.   # ● スプライトを使うか? ★再定義
  8958.   #--------------------------------------------------------------------------
  8959.   def use_sprite?
  8960.     return true
  8961.   end
  8962.   #--------------------------------------------------------------------------
  8963.   # ● ダメージ効果の実行 ★再定義
  8964.   #--------------------------------------------------------------------------
  8965.   def perform_damage_effect
  8966.     return if !N03::ACTOR_DAMAGE
  8967.     $game_troop.screen.start_shake(5, 5, 10)
  8968.     @sprite_effect_type = :blink
  8969.     Sound.play_actor_damage
  8970.   end
  8971.  
  8972. end
  8973.  
  8974. #==============================================================================
  8975. # ■ Game_Enemy
  8976. #------------------------------------------------------------------------------
  8977. #  敵キャラを扱うクラスです。
  8978. #==============================================================================
  8979. class Game_Enemy < Game_Battler
  8980.   #--------------------------------------------------------------------------
  8981.   # ● 公開インスタンス変数
  8982.   #--------------------------------------------------------------------------
  8983.   attr_reader :enemy_id                    # ID
  8984.   #--------------------------------------------------------------------------
  8985.   # ● ID
  8986.   #--------------------------------------------------------------------------
  8987.   def id
  8988.     return @enemy_id
  8989.   end
  8990.   #--------------------------------------------------------------------------
  8991.   # ● レベル
  8992.   #--------------------------------------------------------------------------
  8993.   def level
  8994.     return @sv.level
  8995.   end
  8996.   #--------------------------------------------------------------------------
  8997.   # ● ダメージ効果の実行 ★再定義
  8998.   #--------------------------------------------------------------------------
  8999.   def perform_damage_effect
  9000.     return if !N03::ENEMY_DAMAGE
  9001.     @sprite_effect_type = :blink
  9002.     Sound.play_enemy_damage
  9003.   end
  9004.   #--------------------------------------------------------------------------
  9005.   # ● 武器
  9006.   #--------------------------------------------------------------------------
  9007.   def weapons
  9008.     weapon1 = $data_weapons[@sv.enemy_weapon1_id]
  9009.     weapon2 = $data_weapons[@sv.enemy_weapon2_id]
  9010.     return [weapon1, weapon2]
  9011.   end
  9012.   #--------------------------------------------------------------------------
  9013.   # ● 防具
  9014.   #--------------------------------------------------------------------------
  9015.   def armors
  9016.     return [$data_armors[@sv.enemy_shield_id]]
  9017.   end
  9018.   #--------------------------------------------------------------------------
  9019.   # ● 二刀流の判定
  9020.   #--------------------------------------------------------------------------
  9021.   def dual_wield?
  9022.     return $data_weapons[@sv.enemy_weapon2_id] != nil
  9023.   end
  9024.   #--------------------------------------------------------------------------
  9025.   # ● バトラー画像変更
  9026.   #--------------------------------------------------------------------------
  9027.   def graphics_change(battler_name)
  9028.     @battler_name = battler_name
  9029.   end
  9030.   #--------------------------------------------------------------------------
  9031.   # ● 通常攻撃 アニメーション ID の取得
  9032.   #--------------------------------------------------------------------------
  9033.   def atk_animation_id1
  9034.     return weapons[0].animation_id if weapons[0]
  9035.     return weapons[1] ? 0 : 1
  9036.   end
  9037.   #--------------------------------------------------------------------------
  9038.   # ● 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  9039.   #--------------------------------------------------------------------------
  9040.   def atk_animation_id2
  9041.     return weapons[1] ? weapons[1].animation_id : 0
  9042.   end
  9043. end
  9044.  
  9045. #==============================================================================
  9046. # ■ Sprite_Base
  9047. #------------------------------------------------------------------------------
  9048. #  アニメーションの表示処理を追加したスプライトのクラスです。
  9049. #==============================================================================
  9050. class Sprite_Base < Sprite
  9051.   #--------------------------------------------------------------------------
  9052.   # ● アニメーションの座標更新 (ホーミングあり)
  9053.   #--------------------------------------------------------------------------
  9054.   def update_animation_position_horming
  9055.     return if @action_end_cancel
  9056.     ani_ox_set if @horming
  9057.     camera_zoom = $sv_camera.zoom
  9058.     camera_zoom = 1 if @move_anime
  9059.     kind = 1
  9060.     kind = -1 if @ani_mirror && !@anime_no_mirror
  9061.     cell_data = @animation.frames[@animation.frame_max - (@ani_duration + @ani_rate - 1) / @ani_rate].cell_data
  9062.     for i in 0..15
  9063.       @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
  9064.       @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
  9065.     end
  9066.   end
  9067.   #--------------------------------------------------------------------------
  9068.   # ● アニメーション元の座標をセット
  9069.   #--------------------------------------------------------------------------
  9070.   def ani_ox_set
  9071.     if !SceneManager.scene_is?(Scene_Battle)
  9072.       @real_x = x
  9073.       @real_y = y
  9074.     end
  9075.     @ani_ox = @real_x - ox + width / 2
  9076.     @ani_oy = @real_y - oy + height / 2
  9077.     @ani_oy -= height / 2 if @animation.position == 0
  9078.     @ani_oy += height / 2 if @animation.position == 2
  9079.   end
  9080.   #--------------------------------------------------------------------------
  9081.   # ● アニメーションの更新
  9082.   #--------------------------------------------------------------------------
  9083.   alias update_animation_sprite_base_n03 update_animation
  9084.   def update_animation
  9085.     update_animation_position_horming if animation? && SceneManager.scene_is?(Scene_Battle) && @animation.position != 3
  9086.     update_animation_sprite_base_n03
  9087.   end
  9088.   #--------------------------------------------------------------------------
  9089.   # ● アニメーションの原点設定 ★再定義
  9090.   #--------------------------------------------------------------------------
  9091.   def set_animation_origin
  9092.     return ani_ox_set if @animation.position != 3
  9093.     if viewport == nil
  9094.       @ani_ox = Graphics.width / 2
  9095.       @ani_oy = Graphics.height / 2
  9096.     else
  9097.       @ani_ox = viewport.rect.width / 2
  9098.       @ani_oy = viewport.rect.height / 2
  9099.     end
  9100.   end
  9101.   #--------------------------------------------------------------------------
  9102.   # ● アニメーションスプライトの設定 ★再定義
  9103.   #--------------------------------------------------------------------------
  9104.   def animation_set_sprites(frame)
  9105.     camera_zoom = 1
  9106.     camera_zoom = $sv_camera.zoom if @anime_camera_zoom && @animation.position != 3 && SceneManager.scene_is?(Scene_Battle)
  9107.     camera_x = $sv_camera.x
  9108.     camera_y = $sv_camera.y
  9109.     camera_x = camera_y = 0 if @animation.position == 3 or !SceneManager.scene_is?(Scene_Battle)
  9110.     plus_z = 5
  9111.     plus_z = 1000 if @animation.position == 3
  9112.     plus_z = -17 if @plus_z != nil && @plus_z == false
  9113.     plus_z = -self.z + 10 if @plus_z != nil && @plus_z == false && @animation.position == 3
  9114.     cell_data = frame.cell_data
  9115.     @ani_sprites.each_with_index do |sprite, i|
  9116.       next unless sprite
  9117.       pattern = cell_data[i, 0]
  9118.       if !pattern || pattern < 0
  9119.         sprite.visible = false
  9120.         next
  9121.       end
  9122.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  9123.       sprite.visible = true
  9124.       sprite.src_rect.set(pattern % 5 * 192,
  9125.         pattern % 100 / 5 * 192, 192, 192)
  9126.       if @ani_mirror && !@anime_no_mirror
  9127.         sprite.x = (@ani_ox - cell_data[i, 1] - camera_x) * camera_zoom
  9128.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  9129.         sprite.angle = (360 - cell_data[i, 4])
  9130.         sprite.mirror = (cell_data[i, 5] == 0)
  9131.       else
  9132.         sprite.x = (@ani_ox + cell_data[i, 1] - camera_x) * camera_zoom
  9133.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  9134.         sprite.angle = cell_data[i, 4]
  9135.         sprite.mirror = (cell_data[i, 5] == 1)
  9136.       end
  9137.       sprite.z = self.z + plus_z + i
  9138.       sprite.ox = 96
  9139.       sprite.oy = 96
  9140.       sprite.zoom_x = cell_data[i, 3] * camera_zoom / 100.0
  9141.       sprite.zoom_y = cell_data[i, 3] * camera_zoom/ 100.0
  9142.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  9143.       sprite.blend_type = cell_data[i, 7]
  9144.     end
  9145.   end
  9146.   #--------------------------------------------------------------------------
  9147.   # ● 子スプライトフラグ
  9148.   #--------------------------------------------------------------------------
  9149.   def set(battler, horming, camera_zoom, no_mirror)
  9150.     @battler = battler
  9151.     @next = true
  9152.     self.bitmap = Bitmap.new(@battler.sv.cw, @battler.sv.ch)
  9153.     self.ox = bitmap.width / 2
  9154.     self.oy = bitmap.height
  9155.     @horming = horming
  9156.     @anime_camera_zoom = camera_zoom
  9157.     @anime_no_mirror = no_mirror
  9158.     @battler.sv.reset_anime_data
  9159.   end  
  9160.   #--------------------------------------------------------------------------
  9161.   # ● 子スプライト座標セット
  9162.   #--------------------------------------------------------------------------
  9163.   def set_position(z, zoom_x, zoom_y, real_x, real_y)
  9164.     self.z = z
  9165.     self.zoom_x = zoom_x
  9166.     self.zoom_y = zoom_y
  9167.     @real_x = real_x
  9168.     @real_y = real_y
  9169.   end
  9170.   #--------------------------------------------------------------------------
  9171.   # ● 他スプライトへのタイミング処理
  9172.   #--------------------------------------------------------------------------
  9173.   def other_process_timing(timing)
  9174.     se_flag = true
  9175.     se_flag = @se_flag if @se_flag != nil
  9176.     @battler.sv.timing.push([se_flag, timing.dup])
  9177.   end
  9178.   #--------------------------------------------------------------------------
  9179.   # ● 他バトラーへのタイミング処理
  9180.   #--------------------------------------------------------------------------
  9181.   def target_battler_process_timing(timing)
  9182.     for target in @timing_targets
  9183.       target.sv.timing.push([false, timing.dup])
  9184.     end  
  9185.   end
  9186.   #--------------------------------------------------------------------------
  9187.   # ● SE とフラッシュのタイミング処理
  9188.   #--------------------------------------------------------------------------
  9189.   alias animation_process_timing_sprite_base_n03 animation_process_timing
  9190.   def animation_process_timing(timing)
  9191.     target_battler_process_timing(timing) if @timing_targets && @timing_targets != []
  9192.     return other_process_timing(timing) if @next != nil
  9193.     animation_process_timing_sprite_base_n03(timing)
  9194.   end
  9195.   #--------------------------------------------------------------------------
  9196.   # ● アニメーションの解放
  9197.   #--------------------------------------------------------------------------
  9198.   alias dispose_animation_sprite_base_n03 dispose_animation
  9199.   def dispose_animation
  9200.     dispose_animation_sprite_base_n03
  9201.   end
  9202. end
  9203.  
  9204.  
  9205. #==============================================================================
  9206. # ■ Sprite_Battler
  9207. #------------------------------------------------------------------------------
  9208. #  バトラー表示用のスプライトです。
  9209. #==============================================================================
  9210. class Sprite_Battler < Sprite_Base
  9211.   #--------------------------------------------------------------------------
  9212.   # ● 公開インスタンス変数 
  9213.   #--------------------------------------------------------------------------
  9214.   attr_accessor   :removing             # パーティ離脱中
  9215.   #--------------------------------------------------------------------------
  9216.   # ● オブジェクト初期化
  9217.   #--------------------------------------------------------------------------
  9218.   alias initialize_sprite_battler_n03 initialize
  9219.   def initialize(viewport, battler = nil)
  9220.     initialize_sprite_battler_n03(viewport, battler)
  9221.     @real_x = @real_y = 0
  9222.     update_bitmap if @battler != nil
  9223.   end
  9224.   #--------------------------------------------------------------------------
  9225.   # ● アニメーションの開始 ★再定義
  9226.   #--------------------------------------------------------------------------
  9227.   def start_animation(animation, mirror = false)
  9228.     return next_animation(animation, mirror) if animation?
  9229.     @animation = animation
  9230.     if @animation
  9231.       @horming = @battler.sv.anime_horming
  9232.       @anime_camera_zoom = @battler.sv.anime_camera_zoom
  9233.       @anime_no_mirror = @battler.sv.anime_no_mirror
  9234.       @timing_targets = @battler.sv.timing_targets
  9235.       @plus_z = @battler.sv.anime_plus_z
  9236.       @battler.sv.reset_anime_data
  9237.       @ani_mirror = mirror
  9238.       set_animation_rate
  9239.       @ani_duration = @animation.frame_max * @ani_rate + 1
  9240.       load_animation_bitmap
  9241.       make_animation_sprites
  9242.       set_animation_origin
  9243.     end
  9244.   end
  9245.   #--------------------------------------------------------------------------
  9246.   # ● 次のアニメを開始
  9247.   #--------------------------------------------------------------------------
  9248.   def next_animation(animation, mirror)
  9249.     @next_anime = [] if @next_anime == nil
  9250.     @next_anime.push(Sprite_Base.new(viewport))
  9251.     @next_anime[@next_anime.size - 1].set(battler, @battler.sv.anime_horming, @battler.sv.anime_camera_zoom, @battler.sv.anime_no_mirror)
  9252.     @next_anime[@next_anime.size - 1].set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y)
  9253.     @next_anime[@next_anime.size - 1].start_animation(animation, mirror)
  9254.   end
  9255.   #--------------------------------------------------------------------------
  9256.   # ● 影グラフィック作成
  9257.   #--------------------------------------------------------------------------
  9258.   def create_shadow
  9259.     reset_shadow
  9260.     return if @battler.sv.shadow == false
  9261.     @shadow = Sprite.new(viewport) if @shadow == nil
  9262.     @shadow.bitmap = Cache.character(@battler.sv.shadow)
  9263.     @shadow.ox = @shadow.bitmap.width / 2
  9264.     @shadow.oy = @shadow.bitmap.height / 2
  9265.   end
  9266.   #--------------------------------------------------------------------------
  9267.   # ● 影グラフィック初期化
  9268.   #--------------------------------------------------------------------------
  9269.   def reset_shadow
  9270.     return if @shadow == nil
  9271.     @shadow.dispose
  9272.     @shadow = nil
  9273.   end  
  9274.   #--------------------------------------------------------------------------
  9275.   # ● 転送元ビットマップの更新 ★再定義
  9276.   #--------------------------------------------------------------------------
  9277.   def update_bitmap
  9278.     update_bitmap_enemy if !@battler.actor?
  9279.     update_bitmap_actor if @battler.actor?
  9280.     update_src_rect if @battler != nil
  9281.     update_color if @battler != nil
  9282.   end
  9283.   #--------------------------------------------------------------------------
  9284.   # ● 転送元ビットマップ:エネミー
  9285.   #--------------------------------------------------------------------------
  9286.   def update_bitmap_enemy
  9287.     if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
  9288.       @battler_name = @battler.battler_name
  9289.       @battler_hue = @battler.battler_hue
  9290.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  9291.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  9292.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue)
  9293.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  9294.       create_shadow
  9295.       init_visibility
  9296.       @battler_id = @battler.id
  9297.     end
  9298.   end  
  9299.   #--------------------------------------------------------------------------
  9300.   # ● 転送元ビットマップ:アクター
  9301.   #--------------------------------------------------------------------------
  9302.   def update_bitmap_actor
  9303.     if @battler.character_name != @battler_name or @battler.character_index != @battler_index
  9304.       @battler_name = @battler.character_name
  9305.       @battler_index = @battler.character_index
  9306.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  9307.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  9308.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
  9309.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  9310.       create_shadow
  9311.       init_visibility
  9312.       @battler_id = @battler.id
  9313.     end
  9314.   end
  9315.   #--------------------------------------------------------------------------
  9316.   # ● 可視状態の初期化 ★再定義
  9317.   #--------------------------------------------------------------------------
  9318.   def init_visibility
  9319.     @battler_visible = @battler.alive?
  9320.     @battler_visible = true if @battler.sv.state(1) != "敵コラプス"
  9321.     @battler_visible = false if @battler.hidden?
  9322.     @battler.sv.opacity = 0 unless @battler_visible
  9323.     self.opacity = 0 unless @battler_visible
  9324.     self.opacity = 255 if @battler_visible
  9325.     @battler.sv.weapon_visible = @battler_visible
  9326.   end
  9327.   #--------------------------------------------------------------------------
  9328.   # ● 転送元矩形の更新
  9329.   #--------------------------------------------------------------------------
  9330.   def update_src_rect
  9331.     return if @battler.sv.collapse
  9332.     if @battler_graphic_file_index != @battler.sv.graphic_file_index
  9333.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  9334.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index) if @battler.actor?
  9335.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue) if !@battler.actor?
  9336.       @battler.sv.set_graphics(self.bitmap.width, self.bitmap.height)
  9337.     end
  9338.     anime_off if @battler.sv.anime_off
  9339.     self.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  9340.     self.opacity = @battler.sv.opacity if @battler_visible
  9341.     set_process_timing(@battler.sv.timing) if @battler && @battler.sv.timing != []
  9342.   end
  9343.   #--------------------------------------------------------------------------
  9344.   # ● 位置の更新 ★再定義
  9345.   #--------------------------------------------------------------------------
  9346.   def update_position
  9347.     @real_x = @battler.sv.x / 100
  9348.     @real_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust)/ 100
  9349.     self.x = @real_x - $sv_camera.x
  9350.     self.y = @real_y - $sv_camera.y
  9351.     self.z = @battler.sv.z - @battler.sv.c / 100
  9352.     if @battler.sv.h <= 0
  9353.       self.x += $sv_camera.sx / 100
  9354.       self.y += $sv_camera.sy / 100
  9355.     end  
  9356.     self.x *= $sv_camera.zoom
  9357.     self.y *= $sv_camera.zoom
  9358.   end
  9359.   #--------------------------------------------------------------------------
  9360.   # ● 原点の更新 ★再定義
  9361.   #--------------------------------------------------------------------------
  9362.   def update_origin
  9363.     return if !bitmap or @battler.sv.collapse
  9364.     self.ox = @battler.sv.ox
  9365.     self.oy = @battler.sv.oy
  9366.     self.angle = @battler.sv.angle
  9367.     self.zoom_x = @battler.sv.zoom_x * $sv_camera.zoom
  9368.     self.zoom_y = @battler.sv.zoom_y * $sv_camera.zoom
  9369.     self.mirror = @battler.sv.mirror if !@graphic_mirror_flag
  9370.     self.mirror = !@battler.sv.mirror if @graphic_mirror_flag
  9371.   end
  9372.   #--------------------------------------------------------------------------
  9373.   # ● 影グラフィックの更新
  9374.   #--------------------------------------------------------------------------
  9375.   def update_shadow
  9376.     @shadow.visible = @battler.sv.shadow_visible
  9377.     @shadow.opacity = @battler.sv.opacity if @battler.sv.opacity_data[3]
  9378.     @shadow.opacity = self.opacity if !@battler.sv.opacity_data[3]
  9379.     @shadow.x = @real_x - $sv_camera.x
  9380.     @shadow.y = (@battler.sv.y - @battler.sv.c)/ 100 - $sv_camera.y
  9381.     @shadow.z = @battler.sv.z - 10
  9382.     @shadow.zoom_x = $sv_camera.zoom
  9383.     @shadow.zoom_y = $sv_camera.zoom
  9384.     @shadow.x += $sv_camera.sx / 100
  9385.     @shadow.y += $sv_camera.sy / 100
  9386.     @shadow.x *= $sv_camera.zoom
  9387.     @shadow.y *= $sv_camera.zoom
  9388.     @shadow.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  9389.   end
  9390.   #--------------------------------------------------------------------------
  9391.   # ● ふきだしの更新
  9392.   #--------------------------------------------------------------------------
  9393.   def update_balloon
  9394.     if @battler.sv.balloon_data == [] && @balloon
  9395.       @balloon_data = []
  9396.       @balloon.dispose
  9397.       return @balloon = nil
  9398.     elsif @battler.sv.balloon_data != [] && @battler.sv.balloon_data != @balloon_data
  9399.       @balloon_data = @battler.sv.balloon_data
  9400.       @balloon = Sprite.new(self.viewport)
  9401.       @balloon.bitmap = Cache.system("Balloon")
  9402.       @balloon.zoom_x = @balloon_data[3]
  9403.       @balloon.zoom_y = @balloon_data[3]
  9404.       @balloon.ox = 32 if @battler.sv.mirror
  9405.       @balloon.oy = 16
  9406.       @balloon_count = 0
  9407.     end
  9408.     return if !@balloon
  9409.     @balloon.opacity = self.opacity
  9410.     @balloon.x = self.x
  9411.     @balloon.y = self.y - @battler.sv.ch * $sv_camera.zoom
  9412.     @balloon.z = self.z + 20
  9413.     @balloon.src_rect.set(32 + @balloon_count / @balloon_data[2] * 32, @balloon_data[1] * 32, 32, 32) if @balloon_count % @balloon_data[2] == 0
  9414.     @balloon.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  9415.     @balloon_count += 1
  9416.     @balloon_count = 0 if @balloon_count == @balloon_data[2] * 7
  9417.   end
  9418.   #--------------------------------------------------------------------------
  9419.   # ● 色調変更の更新
  9420.   #--------------------------------------------------------------------------
  9421.   def update_color
  9422.     color_set if @battler.sv.color_set != []
  9423.     return if @color_data == nil
  9424.     @color_data[4] -= 1
  9425.     if @color_data[4] == 0 && @color_data[5] != 0
  9426.       @color_data[4] = @color_data[5]
  9427.       @color_data[5] = 0
  9428.       @color_data[6] = [0,0,0,0]
  9429.     elsif @color_data[4] == 0
  9430.       @remain_color_data = @color_data
  9431.       @battler.sv.color = @color_data.dup
  9432.       return @color_data = nil
  9433.     end  
  9434.     for i in 0..3
  9435.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  9436.     end  
  9437.     @battler.sv.color = @color_data.dup
  9438.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  9439.   end
  9440.   #--------------------------------------------------------------------------
  9441.   # ● 残像の更新
  9442.   #--------------------------------------------------------------------------
  9443.   def update_mirage
  9444.     if @battler.sv.mirage == [] && @mirages
  9445.       @mirage_data = []
  9446.       for mirage in @mirages do mirage.dispose end
  9447.       return @mirages = nil
  9448.     elsif @battler.sv.mirage != [] && @battler.sv.mirage != @mirage_data
  9449.       @mirage_data = @battler.sv.mirage
  9450.       @mirages = []
  9451.       for i in 0...@mirage_data[1] do @mirages[i] = Sprite.new(self.viewport) end
  9452.       @mirage_count = 0
  9453.     end
  9454.     return if !@mirages
  9455.     @mirage_count += 1
  9456.     @mirage_count = 0 if @mirage_count == @mirage_data[2] * @mirages.size
  9457.     for i in [email]0...@mirages.size[/email]
  9458.       mirage_body(@mirages[i], @mirage_data[4]) if @mirage_count == 1 + i * @mirage_data[2]
  9459.     end
  9460.   end
  9461.   #--------------------------------------------------------------------------
  9462.   # ● 残像本体
  9463.   #--------------------------------------------------------------------------
  9464.   def mirage_body(body, opacity)
  9465.     body.bitmap = self.bitmap.dup
  9466.     body.x = self.x
  9467.     body.y = self.y
  9468.     body.ox = self.ox
  9469.     body.oy = self.oy
  9470.     body.z = self.z - 20
  9471.     body.mirror = self.mirror
  9472.     body.angle = self.angle
  9473.     body.opacity = opacity * self.opacity / 255
  9474.     body.zoom_x = self.zoom_x
  9475.     body.zoom_y = self.zoom_y   
  9476.     body.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  9477.     body.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  9478.   end   
  9479.   #--------------------------------------------------------------------------
  9480.   # ● 次のアニメを更新
  9481.   #--------------------------------------------------------------------------
  9482.   def update_next_anime
  9483.     return if !@next_anime
  9484.     for anime in @next_anime
  9485.       anime.update
  9486.       anime.set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y) if @horming
  9487.       anime.dispose if !anime.animation?
  9488.       @next_anime.delete(anime) if !anime.animation?
  9489.     end  
  9490.   end
  9491.   #--------------------------------------------------------------------------
  9492.   # ● フレーム更新
  9493.   #--------------------------------------------------------------------------
  9494.   alias update_sprite_battler_n03 update
  9495.   def update
  9496.     @battler.sv.update if @battler
  9497.     update_sprite_battler_n03
  9498.     update_next_anime
  9499.     update_shadow  if @battler && @shadow
  9500.     update_mirage  if @battler
  9501.     update_balloon if @battler
  9502.     update_remove if @battler && @removing && @battler.sv.change_up
  9503.   end
  9504.   #--------------------------------------------------------------------------
  9505.   # ● 戦闘アニメ消去
  9506.   #--------------------------------------------------------------------------
  9507.   def anime_off
  9508.     @battler.sv.anime_off = false
  9509.     dispose_animation
  9510.     for anime in @next_anime do anime.dispose_animation end if @next_anime
  9511.   end
  9512.   #--------------------------------------------------------------------------
  9513.   # ● バトラー入れ替え
  9514.   #--------------------------------------------------------------------------
  9515.   def remove
  9516.     @battler.sv.start_action(@battler.sv.remove_action)
  9517.     $sv_camera.wait = 40
  9518.     @battler.sv.add_action("eval('set_change')")
  9519.     @removing = true
  9520.   end
  9521.   #--------------------------------------------------------------------------
  9522.   # ● バトラー入れ替えの更新
  9523.   #--------------------------------------------------------------------------
  9524.   def update_remove
  9525.     @battler.sv.change_up = false
  9526.     @removing = false
  9527.     @battler = nil
  9528.   end  
  9529.   #--------------------------------------------------------------------------
  9530.   # ● バトラー加入
  9531.   #--------------------------------------------------------------------------
  9532.   def join(join_battler)
  9533.     $sv_camera.wait = 30
  9534.     @battler = join_battler
  9535.     @battler_name = @battler.character_name
  9536.     @battler_index = @battler.character_index
  9537.     @battler_graphic_file_index = @battler.sv.graphic_file_index
  9538.     self.bitmap = Cache.character(@battler_name)
  9539.     @battler.sv.setup(self.bitmap.width, self.bitmap.height, true)
  9540.     create_shadow
  9541.     init_visibility
  9542.   end
  9543.   #--------------------------------------------------------------------------
  9544.   # ● 通常の設定に戻す ★再定義
  9545.   #--------------------------------------------------------------------------
  9546.   def revert_to_normal
  9547.     self.blend_type = 0
  9548.     self.opacity = 255
  9549.   end
  9550.   #--------------------------------------------------------------------------
  9551.   # ● 崩壊エフェクトの更新
  9552.   #--------------------------------------------------------------------------
  9553.   alias update_collapse_sprite_battler_n03 update_collapse
  9554.   def update_collapse
  9555.     return if @battler.sv.state(1) != "敵コラプス"
  9556.     update_collapse_sprite_battler_n03
  9557.     @battler.sv.weapon_visible = false
  9558.   end
  9559.   #--------------------------------------------------------------------------
  9560.   # ● ボス崩壊エフェクトの更新 ★再定義
  9561.   #--------------------------------------------------------------------------
  9562.   def update_boss_collapse
  9563.     @effect_duration = @battler.sv.ch if @effect_duration >= @battler.sv.ch
  9564.     alpha = @effect_duration * 120 / @battler.sv.ch
  9565.     self.ox = @battler.sv.cw / 2 + @effect_duration % 2 * 4 - 2
  9566.     self.blend_type = 1
  9567.     self.color.set(255, 255, 255, 255 - alpha)
  9568.     self.opacity = alpha
  9569.     self.src_rect.y -= 1
  9570.     Sound.play_boss_collapse2 if @effect_duration % 20 == 19
  9571.   end
  9572.   #--------------------------------------------------------------------------
  9573.   # ● 別スプライトからのタイミング処理
  9574.   #--------------------------------------------------------------------------
  9575.   def set_process_timing(timing_data)
  9576.     for data in timing_data
  9577.       set_timing(data[0],data[1])
  9578.     end
  9579.     @battler.sv.timing = []
  9580.   end
  9581.   #--------------------------------------------------------------------------
  9582.   # ● タイミング処理
  9583.   #--------------------------------------------------------------------------
  9584.   def set_timing(se_flag, data)
  9585.     @ani_rate = 4
  9586.     data.se.play if se_flag
  9587.     case data.flash_scope
  9588.     when 1 ;self.flash(data.flash_color, data.flash_duration * @ani_rate)
  9589.     when 2 ;viewport.flash(data.flash_color, data.flash_duration * @ani_rate) if viewport
  9590.     when 3 ;self.flash(nil, data.flash_duration * @ani_rate)
  9591.     end
  9592.   end
  9593.   #--------------------------------------------------------------------------
  9594.   # ● 色調変更
  9595.   #--------------------------------------------------------------------------
  9596.   def color_set
  9597.     set = @battler.sv.color_set
  9598.     @battler.sv.color_set= []
  9599.     set[4] = 1 if set[4] == 0
  9600.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  9601.     @color_data = @remain_color_data
  9602.     @color_data[4] = set[4]
  9603.     @color_data[5] = set[5]
  9604.     @color_data[6] = set
  9605.   end
  9606.   #--------------------------------------------------------------------------
  9607.   # ● 解放
  9608.   #--------------------------------------------------------------------------
  9609.   alias dispose_sprite_battler_n03 dispose
  9610.   def dispose
  9611.     dispose_sprite_battler_n03
  9612.     @shadow.dispose if @shadow != nil
  9613.     @balloon.dispose if @balloon != nil
  9614.     for mirage in @mirages do mirage.dispose end if @mirages != nil
  9615.     for anime in @next_anime do anime.dispose end if @next_anime
  9616.   end
  9617. end
  9618.  
  9619.  
  9620. #==============================================================================
  9621. # ■ Spriteset_Battle
  9622. #------------------------------------------------------------------------------
  9623. #  バトル画面のスプライトをまとめたクラスです。
  9624. #==============================================================================
  9625. class Spriteset_Battle
  9626.   #--------------------------------------------------------------------------
  9627.   # ● 戦闘背景(床)スプライトの作成 ★再定義
  9628.   #--------------------------------------------------------------------------
  9629.   def create_battleback1
  9630.     @back1_sprite = Sprite_Battle_Back.new(@viewport1, 1, battleback1_name)
  9631.     @back1_sprite.set_graphics(battleback1_bitmap) if battleback1_name != nil
  9632.     @back1_sprite.z = 0
  9633.   end
  9634.   #--------------------------------------------------------------------------
  9635.   # ● 戦闘背景(壁)スプライトの作成 ★再定義
  9636.   #--------------------------------------------------------------------------
  9637.   def create_battleback2
  9638.     @back2_sprite = Sprite_Battle_Back.new(@viewport1, 2, battleback2_name)
  9639.     @back2_sprite.set_graphics(battleback2_bitmap) if battleback2_name != nil
  9640.     @back2_sprite.z = 1
  9641.   end
  9642.   #--------------------------------------------------------------------------
  9643.   # ● アクタースプライトの作成 ★再定義
  9644.   #--------------------------------------------------------------------------
  9645.   def create_actors
  9646.     @actor_sprites = []
  9647.     for i in 0...$game_party.max_battle_members
  9648.       @actor_sprites[i] = Sprite_Battler.new(@viewport1, $game_party.members[i])
  9649.     end
  9650.     @effect_sprites = Spriteset_Sideview.new(@viewport1)
  9651.   end
  9652.   #--------------------------------------------------------------------------
  9653.   # ● アクタースプライトの更新 ★再定義
  9654.   #--------------------------------------------------------------------------
  9655.   def update_actors
  9656.     @actor_sprites.each_with_index do |sprite, i|
  9657.       sprite_join($game_party.members[i], sprite) if sprite.battler == nil && sprite.battler != $game_party.members[i]
  9658.       sprite.remove if sprite.battler != nil && !sprite.removing && sprite.battler != $game_party.members[i]
  9659.       sprite.update
  9660.     end
  9661.     @effect_sprites.update
  9662.     update_program
  9663.   end
  9664.   #--------------------------------------------------------------------------
  9665.   # ● メンバーを加える
  9666.   #--------------------------------------------------------------------------
  9667.   def sprite_join(member, sprite)
  9668.     for sp in @actor_sprites
  9669.       sp.update_remove if member == sp.battler && !sp.battler.sv.change_up
  9670.     end
  9671.     sprite.join(member)
  9672.   end
  9673.   #--------------------------------------------------------------------------
  9674.   # ● バトルプログラムの更新
  9675.   #--------------------------------------------------------------------------
  9676.   def update_program
  9677.     return if $sv_camera.program_scroll == []
  9678.     for data in  $sv_camera.program_scroll
  9679.       @back1_sprite.start_back_data(data) if data[2] == 1
  9680.       @back2_sprite.start_back_data(data) if data[2] == 2
  9681.     end
  9682.     $sv_camera.program_scroll = []
  9683.   end
  9684.   #--------------------------------------------------------------------------
  9685.   # ● ヒット時の戦闘アニメ実行
  9686.   #--------------------------------------------------------------------------
  9687.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  9688.     @effect_sprites.set_hit_animation(battler, weapon_index, hit_targets, miss)
  9689.   end
  9690.   #--------------------------------------------------------------------------
  9691.   # ● ダメージPOP
  9692.   #--------------------------------------------------------------------------
  9693.   def set_damage_pop(target)
  9694.     @effect_sprites.set_damage_pop(target)
  9695.   end
  9696.   #--------------------------------------------------------------------------
  9697.   # ● 解放
  9698.   #--------------------------------------------------------------------------
  9699.   alias dispose_spriteset_battle_n03 dispose
  9700.   def dispose
  9701.     dispose_spriteset_battle_n03
  9702.     @effect_sprites.dispose
  9703.   end
  9704.  
  9705.  
  9706.  
  9707. end
  9708.  
  9709.  
  9710. #==============================================================================
  9711. # ■ Window_BattleLog
  9712. #------------------------------------------------------------------------------
  9713. #  戦闘の進行を実況表示するウィンドウです。
  9714. #==============================================================================
  9715. class Window_BattleLog < Window_Selectable
  9716.   #--------------------------------------------------------------------------
  9717.   # ● ウェイト ★再定義
  9718.   #--------------------------------------------------------------------------
  9719.   def wait
  9720.   end
  9721.   #--------------------------------------------------------------------------
  9722.   # ● ウェイトとクリア ★再定義
  9723.   #--------------------------------------------------------------------------
  9724.   def wait_and_clear
  9725.     $sv_camera.wait = 10
  9726.   end
  9727.   #--------------------------------------------------------------------------
  9728.   # ● 行動結果の表示 ★再定義
  9729.   #--------------------------------------------------------------------------
  9730.   def display_action_results(target, item)
  9731.     if target.result.used
  9732.       last_line_number = line_number
  9733.       display_critical(target, item)
  9734.       display_damage(target, item)
  9735.       display_affected_status(target, item)
  9736.       display_failure(target, item)
  9737.     end
  9738.     off if !N03::BATTLE_LOG
  9739.   end
  9740.   #--------------------------------------------------------------------------
  9741.   # ● ウインドウ非表示
  9742.   #--------------------------------------------------------------------------
  9743.   def off
  9744.     @back_sprite.visible = self.visible = false
  9745.   end
  9746. end
  9747. #==============================================================================
  9748. # ■ Game_Interpreter
  9749. #------------------------------------------------------------------------------
  9750. #  イベントコマンドを実行するインタプリタです。
  9751. #==============================================================================
  9752. class Game_Interpreter
  9753.   #--------------------------------------------------------------------------
  9754.   # ● スイッチの操作
  9755.   #--------------------------------------------------------------------------
  9756.   alias command_121_game_interpreter_n03 command_121
  9757.   def command_121
  9758.     command_121_game_interpreter_n03
  9759.     $sv_camera.program_check
  9760.   end
  9761. end

点评

发现您的脚本里有好多url  发表于 2014-8-15 15:27

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

2
发表于 2014-8-15 14:54:59 | 只看该作者

评分

参与人数 1星屑 +66 收起 理由
VIPArcher + 66 解决方法就是这个

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
113 小时
注册时间
2013-8-7
帖子
32
3
 楼主| 发表于 2014-8-15 15:18:40 | 只看该作者
taroxd 发表于 2014-8-15 14:54
https://rpg.blue/thread-369813-1-1.html

错误是在848层,我试过,没用
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
99
在线时间
900 小时
注册时间
2012-11-13
帖子
893
4
发表于 2014-8-15 15:30:20 | 只看该作者
废弃
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
113 小时
注册时间
2013-8-7
帖子
32
5
 楼主| 发表于 2014-8-15 15:41:53 | 只看该作者
3106345123 发表于 2014-8-15 15:30
sideview100新手向使用指导

不懂啊......
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
113 小时
注册时间
2013-8-7
帖子
32
6
 楼主| 发表于 2014-8-15 15:56:59 | 只看该作者
谢谢楼上的各位了,我还是算了,不用复制的,自己弄动作,谢谢你们

点评

848发生什么错误,是怎么发生的错误,请详细解说==我又来水贴了  发表于 2014-8-15 16:12
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-25 21:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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