查看: 1539|回复: 2

[已经解决] 两个脚本的冲突

[复制链接]
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
发表于 2020-7-20 19:50:48 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 fjm 于 2020-7-20 19:53 编辑

敌人血条脚本和SideView100 脚本发生了冲突,大佬帮忙看下哪里出了问题


  1. [code][code]#==============================================================================
  2. # 功能:战斗中显示敌人血和蓝于敌人脚下
  3. # 适用:RMVX Ace
  4. # 作者:殇殃 2012.3.10
  5. # 使用方法:复制整个脚本插入到Main之前
  6. # 注意:由于血条是显示在敌人脚下,所以敌群的位置不能太靠底部,不然会被挡住。
  7. #       可以自行更改坐标修改显示位置、血条的颜色等。
  8. #==============================================================================
  9. # ■ Window_Base
  10. #------------------------------------------------------------------------------
  11. #  游戏中全部窗口的超级类。
  12. #==============================================================================

  13. class Window_Base < Window
  14.   #--------------------------------------------------------------------------
  15.   # ● 描绘敌人HP
  16.   #--------------------------------------------------------------------------
  17.   def draw_enemy_hp(enemy, x, y, width = 80)
  18.     draw_gauge(x, y, width, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2)
  19.     self.contents.font.color = system_color
  20.     self.contents.draw_text(x, y, 30, line_height, Vocab::hp_a)
  21.     self.contents.font.color = hp_color(enemy)
  22.     self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.hp, 2)
  23.     #一个数字占16像素
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 绘制敌人MP
  27.   #--------------------------------------------------------------------------
  28.   def draw_enemy_mp(enemy, x, y, width = 80)
  29.     draw_gauge(x, y, width, enemy.mp_rate, mp_gauge_color1, mp_gauge_color2)
  30.     self.contents.font.color = system_color
  31.     self.contents.draw_text(x, y, 30, line_height, Vocab::mp_a)
  32.     self.contents.font.color = mp_color(enemy)
  33.     self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.mp, 2)
  34.   end
  35. end
  36. #==============================================================================
  37. # ■ Sprite_Battler
  38. #------------------------------------------------------------------------------
  39. #  战斗显示用活动块。Game_Battler 类的实例监视、
  40. # 活动块的状态的监视、活动块状态自动变化。
  41. #==============================================================================

  42. class Sprite_Battler < Sprite_Base
  43.   #--------------------------------------------------------------------------
  44.   # ● 初始化对象
  45.   #     viewport : 视区
  46.   #     battler  : 战斗者 (Game_Battler)
  47.   #--------------------------------------------------------------------------
  48.   def initialize(viewport, battler = nil)
  49.     super(viewport)
  50.     @battler = battler
  51.     @battler_visible = false
  52.     @effect_type = nil      
  53.     @effect_duration = 0   
  54.     if @battler.is_a?(Game_Enemy)
  55.       width = 24 + 80
  56.       height = 24 + 24 * 3
  57.       x = @battler.screen_x - 12 - width * 3 / 2
  58.       y = @battler.screen_y - 12 - height / 2
  59.       @enemy_hpmp_window = Window_Base.new(x, y, width, height)
  60.       @enemy_hpmp_window.opacity = 0
  61.        @enemy_hpmp_window.contents = Bitmap.new(width - 24, height - 48)
  62.       @enemy_hpmp_window.draw_text_ex(-20, 20, @battler.name)
  63.       @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 48)
  64.       @old_hp = -1
  65.       @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 48)
  66.       @old_mp = -1
  67.     end
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 释放
  71.   #--------------------------------------------------------------------------
  72.   def dispose
  73.     if self.bitmap != nil
  74.       self.bitmap.dispose
  75.     @enemy_hpmp_window.dispose
  76.     end
  77.     super
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 更新画面
  81.   #--------------------------------------------------------------------------
  82.   def update
  83.     super
  84.     if @battler == nil
  85.       self.bitmap = nil
  86.     else
  87.       @use_sprite = @battler.use_sprite?
  88.       if @use_sprite
  89.         update_bitmap
  90.         update_origin
  91.         update_position
  92.       end
  93.       setup_new_effect
  94.       setup_new_animation
  95.       update_effect
  96.       if @enemy_hpmp_window != nil and (@old_hp != @battler.hp or @old_mp != @battler.mp)
  97.         if @battler.hp == 0
  98.           @enemy_hpmp_window.hide
  99.         else
  100.           @enemy_hpmp_window.contents.clear
  101.           @enemy_hpmp_window.draw_text_ex(0, 10, @battler.name)
  102.           @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 24)
  103.           @old_hp = @battler.hp
  104.           @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 48)
  105.           @old_mp = @battler.mp
  106.           @enemy_hpmp_window.show #怪物死后再被复活
  107.         end #if battler.hp == 0
  108.       end
  109.     end #if @battler == nil
  110.   end

  111. end


  112. [pre lang="ruby"]#==============================================================================
  113. # ■ Sideview Ver100
  114. #------------------------------------------------------------------------------
  115. #  サイドビューバトラーを管理するクラスです。
  116. #==============================================================================
  117. class SideView
  118.   #--------------------------------------------------------------------------
  119.   # ● 公開インスタンス変数 
  120.   #--------------------------------------------------------------------------
  121.   attr_accessor   :x                    # 画面X座標
  122.   attr_accessor   :y                    # 画面Y座標
  123.   attr_accessor   :z                    # 画面Z座標
  124.   attr_accessor   :h                    # 高さ座標
  125.   attr_accessor   :j                    # ジャンプ座標
  126.   attr_accessor   :c                    # カーブ座標
  127.   attr_accessor   :ox                   # 横原点
  128.   attr_accessor   :oy                   # 縦原点
  129.   attr_accessor   :oy_adjust            # 縦原点補正
  130.   attr_accessor   :angle                # 回転角度
  131.   attr_accessor   :zoom_x               # 横の拡大率
  132.   attr_accessor   :zoom_y               # 縦の拡大率
  133.   attr_accessor   :pattern_w            # セル横位置(矩形内)
  134.   attr_accessor   :pattern_h            # セル縦位置(矩形内)
  135.   attr_accessor   :sx                   # セル横位置(画像全体)
  136.   attr_accessor   :sy                   # セル縦位置(画像全体)
  137.   attr_accessor   :pattern_type         # セル更新タイプ
  138.   attr_accessor   :pattern_time         # セル更新間隔
  139.   attr_accessor   :graphic_name         # バトラー画像ファイル名
  140.   attr_accessor   :graphic_file_index   # バトラー画像ファイル名インデックス
  141.   attr_accessor   :graphic_index        # バトラー画像インデックス
  142.   attr_accessor   :cw                   # セル横矩形
  143.   attr_accessor   :ch                   # セル縦矩形
  144.   attr_accessor   :shadow_visible       # 影表示
  145.   attr_accessor   :weapon_visible       # 武器表示
  146.   
  147.   attr_accessor   :wait                 # 次の動作待ち時間
  148.   attr_accessor   :weapon_index         # 表示中の武器画像インデックス配列
  149.   attr_accessor   :weapon_end           # 武器アニメ終了フラグ
  150.   attr_accessor   :force_action         # 強制アクション
  151.   attr_accessor   :target_battler       # ターゲットバトラー情報
  152.   attr_accessor   :second_targets       # セカンドターゲット情報
  153.   attr_accessor   :m_a_targets          # アニメ飛ばしターゲット情報
  154.   attr_accessor   :individual_targets   # 個別処理ターゲットバトラー情報
  155.   attr_accessor   :effect_data          # エフェクトデータ
  156.   attr_accessor   :anime_id             # アニメID配列
  157.   attr_accessor   :anime_move_id        # 飛ばしアニメID配列
  158.   attr_accessor   :mirror               # 反転フラグ
  159.   attr_accessor   :opacity              # 透明度
  160.   attr_accessor   :opacity_data         # 透明度操作情報
  161.   attr_accessor   :set_damage           # バトルシーンでのダメージ処理
  162.   attr_accessor   :m_a_data             # アニメ飛ばし情報
  163.   attr_accessor   :m_a_starter          # アニメ飛ばし開始ターゲット情報
  164.   attr_accessor   :action_end           # バトルシーンでの行動終了
  165.   attr_accessor   :damage_anime_data    # ダメージ戦闘アニメのデータ
  166.   attr_accessor   :anime_no_mirror      # 戦闘アニメの反転禁止フラグ
  167.   attr_accessor   :anime_horming        # 戦闘アニメのホーミングフラグ
  168.   attr_accessor   :anime_camera_zoom    # 戦闘アニメがカメラに合わせて拡大縮小するか
  169.   attr_accessor   :anime_plus_z         # 戦闘アニメZ座標補正
  170.   attr_accessor   :derivation_skill_id  # スキル派生ID
  171.   attr_accessor   :immortal             # 不死身フラグ
  172.   attr_accessor   :mirage               # 残像データ
  173.   attr_accessor   :balloon_data         # ふきだしデータ
  174.   attr_accessor   :timing               # 別バトラーからのタイミングデータ
  175.   attr_accessor   :timing_targets       # タイミングデータを渡す別バトラー
  176.   attr_accessor   :color_set            # 色調変更データ
  177.   attr_accessor   :color                # 色調データ
  178.   attr_accessor   :change_up            # 画像変更フラグ
  179.   attr_accessor   :hit                  # 被攻撃回数
  180.   attr_accessor   :add_state            # 何度も付加ステートの表示を防ぐフラグ
  181.   attr_accessor   :counter_id           # カウンター時のスキルID
  182.   attr_accessor   :reflection_id        # 魔法反射時のアニメID
  183.   attr_accessor   :result_damage        # ターン終了時のHP変動データ
  184.   attr_accessor   :active               # 行動権
  185.   attr_accessor   :anime_off            # 戦闘アニメ消去
  186.   attr_accessor   :command_action       # コマンドアクションフラグ
  187.    
  188.   attr_accessor   :base_x               # 初期位置 X座標
  189.   attr_accessor   :base_y               # 初期位置 Y座標
  190.   attr_accessor   :base_h               # 初期位置 高さ座標
  191.   attr_accessor   :max_pattern_w        # セルの横分割数
  192.   attr_accessor   :max_pattern_h        # セルの縦分割数
  193.   
  194.   attr_reader     :collapse             # コラプスフラグ
  195.   attr_reader     :picture              # ピクチャ表示フラグ
  196.   #--------------------------------------------------------------------------
  197.   # ● オブジェクト初期化
  198.   #--------------------------------------------------------------------------
  199.   def initialize(battler)
  200.     @battler = battler
  201.     reset
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 初期化
  205.   #--------------------------------------------------------------------------
  206.   def reset
  207.     @x = 0
  208.     @y = 0
  209.     @z = 0
  210.     @h = 0
  211.     @j = 0
  212.     @c = 0
  213.     @jump = []
  214.     @curve = []
  215.     @ox = 0
  216.     @oy = 0
  217.     @oy_adjust = 0
  218.     @z_plus = 0
  219.     @move_time = 0
  220.     @angle = 0
  221.     @angle_time = 0
  222.     @zoom_x = 1
  223.     @zoom_y = 1
  224.     @zoom_time = 0
  225.     @pattern_w = 0
  226.     @pattern_h = 0
  227.     @sx = 0
  228.     @sy = 0
  229.     @pattern_type = 0
  230.     @pattern_time = 0
  231.     @pattern_rest_time = 0
  232.     @graphic_name = ""
  233.     @graphic_file_index = ""
  234.     @graphic_index = 0
  235.     @cw = 0
  236.     @ch = 0
  237.     @shadow_visible = false
  238.     @weapon_visible = true
  239.    
  240.     @wait = 0
  241.     @weapon_index = []
  242.     @weapon_end = true
  243.     @full_action = []
  244.     @action = []
  245.     @force_action = ""
  246.     @target_battler = []
  247.     @second_targets = []
  248.     @individual_targets = []
  249.     @m_a_targets = []
  250.     @effect_data = []
  251.     @anime_id = []
  252.     @anime_move_id = []
  253.     @opacity = 255
  254.     @opacity_data = []
  255.     @set_damage = false
  256.     @m_a_data = []
  257.     @m_a_starter = []
  258.     @action_end = false
  259.     @damage_anime_data = []
  260.     @anime_no_mirror = false
  261.     @anime_horming = false
  262.     @anime_camera_zoom = false
  263.     @anime_plus_z = true
  264.     @derivation_skill_id = 0
  265.     @immortal = false
  266.     @mirage = []
  267.     @play_data = []
  268.     @balloon_data = []
  269.     @picture = false
  270.     @timing = []
  271.     @timing_targets = []
  272.     @color_set = []
  273.     @color = []
  274.     @change_up = false
  275.     @non_motion = false
  276.     @graphics_change = false
  277.     @hit = []
  278.     @add_state = []
  279.     @collapse = false
  280.     @counter_id = 0
  281.     @reflection_id = 0
  282.     @result_damage = [0,0]
  283.     @active = false
  284.     @anime_off = false
  285.     @command_action = false
  286.    
  287.     @base_x = 0
  288.     @base_y = 0
  289.     @base_z = 0
  290.     @base_h = 0
  291.     @max_pattern_w = 0
  292.     @max_pattern_h = 0
  293.     @pattern_kind = 0
  294.     @pattern_count = 0
  295.     @move_time = 0
  296.     @mirror = false
  297.     @battler.set_graphic(@pre_change_data[0], @pre_change_data[1], @pre_change_data[2], @pre_change_data[3]) if @pre_change_data != nil
  298.     @pre_change_data = nil
  299.   end  
  300.   #--------------------------------------------------------------------------
  301.   # ● セットアップ
  302.   #--------------------------------------------------------------------------
  303.   def setup(bitmap_width, bitmap_height, first_action_flag)
  304.     reset if first_action_flag
  305.     set_data
  306.     set_base_position if !@graphics_change
  307.     set_graphics(bitmap_width, bitmap_height)
  308.     set_target
  309.     setup_graphics_change if @graphics_change
  310.     first_battler_anime_set if first_action_flag
  311.   end  
  312.   #--------------------------------------------------------------------------
  313.   # ● バトラーデータ取得
  314.   #--------------------------------------------------------------------------
  315.   def set_data
  316.     return if @battler == nil
  317.     if @battler.actor?
  318.       @graphic_name = @battler.character_name
  319.       @graphic_index = @battler.character_index
  320.     else
  321.       @graphic_name = @battler.battler_name
  322.       @graphic_index = 0
  323.     end
  324.     @max_pattern_w = max_pattern[0]
  325.     @max_pattern_h = max_pattern[1]
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ● ベース座標をセット data = [X軸, Y軸, H軸]  moment_set…瞬間配置
  329.   #--------------------------------------------------------------------------
  330.   def set_base_position(moment_set = true)
  331.     mirroring_reset
  332.     if @battler.actor?
  333.       data = N03::ACTOR_POSITION[@battler.index].dup
  334.       @base_x = data[0] * 100 if !@mirror
  335.       @base_x = (Graphics.width - data[0]) * 100 if @mirror
  336.     else
  337.       data = [@battler.screen_x, @battler.screen_y, 0].dup
  338.       @base_x = data[0] * 100 if !$sv_camera.mirror
  339.       @base_x = (Graphics.width - data[0]) * 100 if $sv_camera.mirror
  340.     end
  341.     @base_y = data[1] * 100
  342.     @base_h = data[2] * 100
  343.     @base_z = @y
  344.     return if !moment_set
  345.     @x = @base_x
  346.     @y = @base_y
  347.     @z = @base_z
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● グラフィックデータ取得
  351.   #--------------------------------------------------------------------------
  352.   def set_graphics(bitmap_width, bitmap_height)
  353.     sign = @graphic_name[/^[\!\$]./]
  354.     if sign && sign.include?('$')
  355.       @cw = bitmap_width / @max_pattern_w
  356.       @ch = bitmap_height / @max_pattern_h
  357.     elsif @max_pattern_w == 1 && @max_pattern_h == 1
  358.       @cw = bitmap_width
  359.       @ch = bitmap_height
  360.     else
  361.       @cw = bitmap_width / (@max_pattern_w * 4)
  362.       @ch = bitmap_height / (@max_pattern_h * 2)
  363.     end
  364.     @ox = @cw / 2
  365.     @oy = @ch
  366.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  367.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● ターゲットをセット
  371.   #--------------------------------------------------------------------------
  372.   def set_target(target = nil)
  373.     @target_battler = target
  374.     @target_battler = [@battler] if target == nil
  375.     @second_targets = @target_battler
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # ● 画像変更用のセットアップ
  379.   #--------------------------------------------------------------------------
  380.   def setup_graphics_change
  381.     @graphics_change = false
  382.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  383.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  384.   end  
  385.   #--------------------------------------------------------------------------
  386.   # ● 戦闘開始時の待機アニメ画像データ取得
  387.   #--------------------------------------------------------------------------
  388.   def first_battler_anime_set
  389.     loop do
  390.       update
  391.       break if @action_data == nil
  392.       break if @action_data[0] == "motion"
  393.       break if @action_data[0] == "move" && @action_data[8] != ""
  394.       break if @full_action == []
  395.     end
  396.     start_action(first_action) if @battler.movable?
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # ● アクション開始
  400.   #--------------------------------------------------------------------------
  401.   def start_action(kind = nil)
  402.     return if @event_fix && $game_troop.interpreter.running?
  403.     # ウェイト中の場合キャンセル
  404.     return @wait -= 1 if @wait > 0 && kind == nil
  405.     action_setup(false) if kind != nil
  406.     set_action(kind)
  407.     @action = kind if @action == nil
  408.     # 行動配列が無い場合は行動終了処理へ移行
  409.     action_terminate if @action == nil
  410.     # 次のアクション決定
  411.     @action_data = N03::ACTION[@action]
  412.     next_action
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 行動パラメータの初期化
  416.   #--------------------------------------------------------------------------
  417.   def action_setup(reset = true)
  418.     @event_fix = false
  419.     @set_damage = false
  420.     @action_end = false
  421.     @balloon_data = []
  422.     @loop_act = []
  423.     angle_reset if reset
  424.     zoom_reset if reset
  425.     opacity_reset if reset
  426.     @curve = []
  427.     @c = 0
  428.     convert_jump
  429.   end  
  430.   #--------------------------------------------------------------------------
  431.   # ● 行動終了処理
  432.   #--------------------------------------------------------------------------
  433.   def action_terminate
  434.     @mirage = [] if @mirage_end
  435.     mirroring_reset
  436.     @picture = false
  437.     @individual_targets = []
  438.     action_setup if @active
  439.     action_setup(false) if !@active
  440.     # 待機アクションへ移行
  441.     stand_by_action if !@non_motion
  442.     # 戦闘行動のアクティブ権を終了
  443.     next_battler
  444.   end  
  445.   #--------------------------------------------------------------------------
  446.   # ● 新しいアクション内容の決定
  447.   #--------------------------------------------------------------------------
  448.   def set_action(kind = nil)
  449.     full_act = N03::FULLACTION[kind]
  450.     @full_action = full_act.dup if full_act != nil
  451.     @action = @full_action.shift
  452.     # 参照したアクションがフルアクションであれば全体のアクションを統合
  453.     full_act2 = N03::FULLACTION[@action]
  454.     @full_action = full_act2.dup + @full_action if full_act2 != nil
  455.   end
  456.   #--------------------------------------------------------------------------
  457.   # ● 次のアクションへ
  458.   #--------------------------------------------------------------------------
  459.   def next_action
  460.     @wait = 0
  461.     # ショートカット確認
  462.     eval(@action) if @action != nil && @action_data == nil && N03::FULLACTION[@action] == nil
  463.     # ウエイト設定
  464.     @wait = @action.to_i if @wait == 0 && @action_data == nil
  465.     @wait = rand(@wait.abs + 1) if @wait < 0
  466.     # アクション開始
  467.     action_play
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # ● 待機アクションへ移行
  471.   #--------------------------------------------------------------------------
  472.   def stand_by_action
  473.     # 通常待機に
  474.     stand_by_act = normal
  475.     # HPが1/4でピンチアクションに
  476.     stand_by_act = pinch if @battler.hp <= @battler.mhp / 4
  477.     # ステートチェック
  478.     stand_by_act = state(@battler.states[0].id) if @battler.states[0] != nil && state(@battler.states[0].id) != nil
  479.     # コマンドチェック
  480.     stand_by_act = command if @command_action && command != nil
  481.     set_action(stand_by_act)
  482.     @action = stand_by_act if @action == nil
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ● 強制アクション開始
  486.   #--------------------------------------------------------------------------
  487.   def start_force_action
  488.     return if @active
  489.     start_action(@force_action)
  490.     @force_action = ""
  491.   end  
  492.   #--------------------------------------------------------------------------
  493.   # ● アクション追加
  494.   #--------------------------------------------------------------------------
  495.   def add_action(kind)
  496.     @full_action.push(kind)
  497.   end  
  498.   #--------------------------------------------------------------------------
  499.   # ● アクションの挿入
  500.   #--------------------------------------------------------------------------
  501.   def unshift_action(kind)
  502.     @full_action.unshift(kind)
  503.   end  
  504.   #--------------------------------------------------------------------------
  505.   # ● フレーム更新
  506.   #--------------------------------------------------------------------------
  507.   def update
  508.     # アクション開始
  509.     start_action
  510.     # 強制アクション開始
  511.     start_force_action if @force_action != ""
  512.     # アニメパターン更新
  513.     update_pattern
  514.     # 移動更新
  515.     update_move
  516.     # 回転更新
  517.     update_angle if @angle_time != 0
  518.     # 拡大縮小更新
  519.     update_zoom if @zoom_time != 0
  520.     # 透明度更新
  521.     update_opacity if @opacity_data != []
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● アニメパターン更新
  525.   #--------------------------------------------------------------------------
  526.   def update_pattern
  527.     return @pattern_rest_time -= 1 if @pattern_rest_time != 0
  528.     return if @max_pattern_w == 1 && @max_pattern_h == 1
  529.     @pattern_rest_time = @pattern_time
  530.     # 再生開始・終了セル位置を取得
  531.     if @pattern_kind > 0 # 通常再生中
  532.       @pattern_start = 0
  533.       @pattern_end = @max_pattern_w - 1
  534.     elsif @pattern_kind < 0 # 逆転再生中
  535.       @pattern_start = @max_pattern_w - 1
  536.       @pattern_end = 0
  537.     end
  538.     # 片道の再生が終了
  539.     @pattern_count += 1 if @pattern_w == @pattern_end && @pattern_kind != 0
  540.     # ループ処理
  541.     case @pattern_type.abs
  542.     when  1,3 # 片道
  543.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type ==  1
  544.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type == -1
  545.       @pattern_kind =  1 if @pattern_count != 0 && @pattern_type ==  3
  546.       @pattern_kind = -1 if @pattern_count != 0 && @pattern_type == -3
  547.       @pattern_w = @pattern_start - @pattern_kind if @pattern_count != 0 && @pattern_type.abs == 3
  548.       @pattern_count = 0
  549.     when  2,4 # 往復
  550.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  2
  551.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -2
  552.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type ==  2
  553.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type == -2
  554.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  4
  555.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -4
  556.       @pattern_kind =  1 if @pattern_count == 2 && @pattern_type ==  4
  557.       @pattern_kind = -1 if @pattern_count == 2 && @pattern_type == -4
  558.       @pattern_count = 0 if @pattern_count == 2
  559.     end
  560.     # セル更新
  561.     @pattern_w += 1 * @pattern_kind
  562.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● 移動の更新
  566.   #--------------------------------------------------------------------------
  567.   def update_move
  568.     @z = @y / 100 + @z_plus
  569.     return if @move_time == 0
  570.     target_position_set if @horming_move
  571.     @x = (@x * (@move_time - 1) + @target_x) / @move_time
  572.     @y = (@y * (@move_time - 1) + @target_y) / @move_time
  573.     @h = (@h * (@move_time - 1) + @target_h) / @move_time if @move_h != nil
  574.     @c += @curve[@move_time - 1] if @curve[@move_time - 1] != nil
  575.     @j += @jump[@move_time - 1] if @jump[@move_time - 1] != nil
  576.     @move_time -= 1
  577.     convert_jump if @move_time == 0
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # ● 移動目標の更新
  581.   #--------------------------------------------------------------------------
  582.   def target_position_set
  583.     target_position = N03.get_targets_position(@move_targets, @horming_move)
  584.     @target_x = target_position[0] + @move_x
  585.     @target_y = target_position[1] + @move_y
  586.     @target_h = target_position[2] + @move_h if @move_h != nil
  587.   end  
  588.   #--------------------------------------------------------------------------
  589.   # ● 回転更新
  590.   #--------------------------------------------------------------------------
  591.   def update_angle
  592.     @angle += @angling
  593.     @angle_time -= 1
  594.     return if @angle_time != 0
  595.     return angle_reset if @angle_data[4] == 0
  596.     angling(@angle_data) if @angle_data[4] == 2
  597.   end  
  598.   #--------------------------------------------------------------------------
  599.   # ● 拡大縮小更新
  600.   #--------------------------------------------------------------------------
  601.   def update_zoom
  602.     @zoom_x += @zooming_x
  603.     @zoom_y += @zooming_y
  604.     @zoom_time -= 1
  605.     return if @zoom_time != 0
  606.     return zoom_reset if @zoom_data[4] == 0
  607.     zooming(@zoom_data) if @zoom_data[4] == 2
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ● 透明度更新
  611.   #--------------------------------------------------------------------------
  612.   def update_opacity
  613.     @opacity += @opacity_data[2]
  614.     @opacity_data[0] -= 1
  615.     return if @opacity_data[0] != 0
  616.     return if !@opacity_data[5]
  617.     @opacity_data[2] *= -1
  618.     @opacity_data[0] = @opacity_data[1]
  619.   end
  620.   #--------------------------------------------------------------------------
  621.   # ● アクション実行
  622.   #--------------------------------------------------------------------------
  623.   def action_play
  624.     return if @action_data == nil
  625.     action = @action_data[0]
  626.     # バトラー反転の場合
  627.     return mirroring                    if action == "mirror"
  628.     # 残像の場合
  629.     return mirage_set                   if action == "mirage"
  630.     # 回転の場合  
  631.     return angling                      if action == "angle"
  632.     # 拡大縮小の場合  
  633.     return zooming                      if action == "zoom"
  634.     # 透明度操作の場合  
  635.     return set_opacity                  if action == "opacity"
  636.     # バトラーアニメの場合
  637.     return battler_anime                if action == "motion"
  638.     # 移動の場合
  639.     return move                         if action == "move"
  640.     # 武器アニメの場合
  641.     return weapon_anime([@action_data]) if action == "wp"
  642.     # アニメ飛ばしの場合
  643.     return move_anime                   if action == "m_a"
  644.     # 戦闘シーン通信の場合(コラプス)
  645.     return set_play_data                if action == "collapse" or action == "no_collapse"
  646.     # データベース戦闘アニメ表示の場合  
  647.     return battle_anime                 if action == "anime"
  648.     # カメラワークの場合
  649.     return camera                       if action == "camera"
  650.     # 画面のシェイクの場合
  651.     return shake                        if action == "shake"
  652.     # 画面色調変更の場合
  653.     return color_effect                 if action == "color"
  654.     # トランジションの場合
  655.     return transition                   if action == "ts"
  656.     # ふきだしアニメ表示の場合  
  657.     return balloon_anime                if action == "balloon"
  658.     # ピクチャ表示の場合
  659.     return picture_set                  if action == "pic"
  660.     # ステート操作の場合
  661.     return state_set                    if action == "sta"
  662.     # FPS変更の場合
  663.     return fps                          if action == "fps"
  664.     # バトラー画像変更の場合  
  665.     return graphics_change              if action == "change"
  666.     # スキル派生の場合  
  667.     return derivating_skill             if action == "der"
  668.     # BGM/BGS/SE演奏の場合  
  669.     return sound                        if action == "sound"
  670.     # ムービー再生の場合  
  671.     return movie                        if action == "movie"
  672.     # ゲームスイッチ操作の場合  
  673.     return switches                     if action == "switch"
  674.     # ゲーム変数操作の場合  
  675.     return variable                     if action == "variable"
  676.     # 条件分岐(ゲームスイッチ)の場合
  677.     return nece_1                       if action == "n_1"
  678.     # 条件分岐(ゲーム変数)の場合
  679.     return nece_2                       if action == "n_2"
  680.     # 条件分岐(ステート)の場合
  681.     return nece_3                       if action == "n_3"
  682.     # 条件分岐(スキル)の場合
  683.     return nece_4                       if action == "n_4"
  684.     # 条件分岐(パラメータ)の場合
  685.     return nece_5                       if action == "n_5"
  686.     # 条件分岐(装備)の場合
  687.     return nece_6                       if action == "n_6"
  688.     # 条件分岐(スクリプト)の場合
  689.     return nece_7                       if action == "n_7"
  690.     # セカンドターゲット操作の場合  
  691.     return second_targets_set           if action == "s_t"
  692.     # コモンイベント呼び出しの場合  
  693.     return call_common_event            if action == "common"
  694.     # 戦闘アニメ消去の場合  
  695.     return @anime_off = true            if action == "anime_off"
  696.     # 強制戦闘終了の場合  
  697.     return BattleManager.process_abort  if action == "battle_end"
  698.     # 画面固定の場合  
  699.     return Graphics.freeze              if action == "graphics_freeze"
  700.     # ダメージアニメの場合  
  701.     return damage_anime                 if action == "damage_anime"
  702.     # 武器消去の場合  
  703.     return @weapon_visible = false      if action == "weapon_off"
  704.     # 武器消去解除の場合  
  705.     return @weapon_visible = true       if action == "weapon_on"
  706.     # 待機キャンセルの場合
  707.     return @non_motion = true           if action == "non_motion"
  708.     # 待機キャンセル解除の場合
  709.     return @non_motion = false          if action == "non_motion_cancel"
  710.     # 初期位置変更の場合
  711.     return change_base_position         if action == "change_base_position"
  712.     # 初期位置変更解除の場合
  713.     return set_base_position(false)     if action == "set_base_position"
  714.     # 強制アクションの場合  
  715.     return force_act                    if action == "force_action"
  716.     # 強制アクションの場合 (セカンドターゲット)
  717.     return force_act2                   if action == "force_action2"
  718.     # 個別開始の場合
  719.     return individual_start             if action == "individual_start"
  720.     # 個別終了の場合
  721.     return individual_end               if action == "individual_end"
  722.     # ループ開始の場合
  723.     return loop_start                   if action == "loop_start"
  724.     # ループ終了の場合
  725.     return loop_end                     if action == "loop_end"
  726.     # 自分のみ更新の場合
  727.     return only_action_on               if action == "only_action_on"
  728.     # 自分のみ更新解除の場合
  729.     return only_action_off              if action == "only_action_off"
  730.     # 次の行動者へ移行の場合
  731.     return next_battler                 if action == "next_battler"
  732.     # 画像変更フラグの場合
  733.     return set_change                   if action == "set_change"
  734.     # スクリプト操作の場合   
  735.     return eval(@action_data[0])
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● バトラー反転実行
  739.   #--------------------------------------------------------------------------
  740.   def mirroring
  741.     @mirror = !@mirror
  742.   end  
  743.   #--------------------------------------------------------------------------
  744.   # ● 反転初期化
  745.   #--------------------------------------------------------------------------
  746.   def mirroring_reset
  747.     @mirror = false
  748.     mirroring if !@battler.actor? && N03::ENEMY_MIRROR
  749.     mirroring if $sv_camera.mirror
  750.   end  
  751.   #--------------------------------------------------------------------------
  752.   # ● 残像実行
  753.   #--------------------------------------------------------------------------
  754.   def mirage_set
  755.     @mirage = @action_data.dup
  756.     @mirage_end = @mirage[3]
  757.     @mirage = [] if @mirage[1] == 0
  758.   end  
  759.   #--------------------------------------------------------------------------
  760.   # ● 回転実行
  761.   #--------------------------------------------------------------------------
  762.   def angling(data = @action_data)
  763.     @angle_data = data.dup
  764.     @oy = @ch / 2
  765.     @oy_adjust = @ch * 50
  766.     @angle_time = data[1]
  767.     start_angle = data[2] * N03.mirror_num(@mirror)
  768.     end_angle = data[3] * N03.mirror_num(@mirror)
  769.     # 時間が0以下なら即座に最終角度へ
  770.     @angle_time = 1 if @angle_time <= 0
  771.     # 回転時間から1フレームあたりの角度を出す
  772.     @angling = (end_angle - start_angle) / @angle_time
  773.     # 割り切れない余りを初期角度に
  774.     @angle = (end_angle - start_angle) % @angle_time + start_angle
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # ● 回転初期化
  778.   #--------------------------------------------------------------------------
  779.   def angle_reset
  780.     @oy = @ch
  781.     @angle = @angle_time = @oy_adjust = 0
  782.   end  
  783.   #--------------------------------------------------------------------------
  784.   # ● 拡大縮小実行
  785.   #--------------------------------------------------------------------------
  786.   def zooming(data = @action_data)
  787.     @zoom_data = data.dup
  788.     @zoom_time = data[1]
  789.     start_zoom_x = data[2][0]
  790.     start_zoom_y = data[2][1]
  791.     end_zoom_x = data[3][0]
  792.     end_zoom_y = data[3][1]
  793.     # 時間が0以下なら即座に最終サイズへ
  794.     @zoom_time = 1 if @zoom_time <= 0
  795.     # 拡大縮小時間から1フレームあたりの拡大縮小率を出す
  796.     @zooming_x = (end_zoom_x - start_zoom_x) / @zoom_time
  797.     @zooming_y = (end_zoom_y - start_zoom_y) / @zoom_time
  798.     # 開始サイズに
  799.     @zoom_x = start_zoom_x
  800.     @zoom_y = start_zoom_y
  801.   end  
  802.   #--------------------------------------------------------------------------
  803.   # ● 拡大縮小初期化
  804.   #--------------------------------------------------------------------------
  805.   def zoom_reset
  806.     @zoom_x = @zoom_y = 1
  807.     @zoom_time = 0
  808.   end  
  809.   #--------------------------------------------------------------------------
  810.   # ● バトラー透明度操作
  811.   #--------------------------------------------------------------------------
  812.   def set_opacity
  813.     data = @action_data.dup
  814.     @opacity = data[2]
  815.     opacity_move = (data[3] - data[2])/ data[1]
  816.     @opacity_data = [data[1], data[1], opacity_move, data[4], data[5], data[6]]
  817.     @wait = data[1] if data[7]
  818.     @wait *= 2 if data[6] && data[7]
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # ● 透明度操作初期化
  822.   #--------------------------------------------------------------------------
  823.   def opacity_reset
  824.     @opacity = 255
  825.     @opacity = 0 if @battler.hidden?
  826.     @opacity_data = []
  827.   end
  828.   #--------------------------------------------------------------------------
  829.   # ● バトラーアニメ実行
  830.   #--------------------------------------------------------------------------
  831.   def battler_anime(anime_data = nil)
  832.     anime_data = @action_data.dup if anime_data == nil
  833.     @graphic_file_index = anime_data[1] if !graphic_fix
  834.     @pattern_h = anime_data[2]
  835.     @pattern_w = anime_data[3]
  836.     @pattern_h = 0 if @max_pattern_w == 1
  837.     @pattern_w = 0 if @max_pattern_h == 1
  838.     @pattern_type = anime_data[4]
  839.     @pattern_time = anime_data[5]
  840.     @pattern_rest_time = anime_data[5]
  841.     @pattern_count = 0
  842.     @pattern_kind = 1
  843.     @pattern_kind = -1 if @pattern_type < 0
  844.     @pattern_kind = 0 if @pattern_type == 0
  845.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  846.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  847.     @z_plus = anime_data[6]
  848.     @wait = set_anime_wait if anime_data[7]
  849.     @shadow_visible = anime_data[8]
  850.     weapon_anime(anime_data)
  851.   end
  852.   #--------------------------------------------------------------------------
  853.   # ● アニメウエイト計算
  854.   #--------------------------------------------------------------------------
  855.   def set_anime_wait
  856.     if @pattern_type > 0
  857.       pattern_time_a = @max_pattern_w - @pattern_w.abs
  858.     elsif @pattern_type < 0
  859.       pattern_time_a = @pattern_w.abs + 1
  860.     else
  861.       return @pattern_time if @pattern_type == 0
  862.     end
  863.     case @pattern_type
  864.     when 1,-1, 3,-3
  865.       return pattern_time_a * @pattern_time
  866.     when 2,-2, 4,-4
  867.       return pattern_time_a * @pattern_time + (@max_pattern_w - 2) * @pattern_time
  868.     end
  869.   end  
  870.   #--------------------------------------------------------------------------
  871.   # ● 移動実行
  872.   #--------------------------------------------------------------------------
  873.   def move
  874.     @move_targets = N03.get_targets(@action_data[1].abs, @battler)
  875.     return if @move_targets == []
  876.     @move_targets = [@battler] if @action_data[1].abs == 7
  877.     @move_x = @action_data[2] * 100 * N03.mirror_num(@mirror)
  878.     @move_y = @action_data[3] * 100
  879.     @move_h = @action_data[4] * 100 if @action_data[4] != nil
  880.     @move_h = nil if @action_data[4] == nil
  881.     battler_anime(N03::ACTION[@action_data[8]].dup) if N03::ACTION[@action_data[8]] != nil
  882.     @horming_move = true
  883.     @horming_move = false if @action_data[1] < 0 or @action_data[1].abs == 7
  884.     target_position_set
  885.     target_position = [@target_x, @target_y, @target_z]
  886.     distanse_move = @action_data[5] > 0
  887.     @move_time = N03.distanse_calculation(@action_data[5].abs, target_position, [@x, @y, @z], distanse_move)
  888.     @wait = @move_time
  889.     curve
  890.     jump
  891.     @move_time = 1 if @move_time == 0
  892.     @horming_move = false if !@move_targets or @move_targets.include?(@battler)
  893.     update_move if @move_time == 1
  894.   end  
  895.   #--------------------------------------------------------------------------
  896.   # ● カーブ実行
  897.   #--------------------------------------------------------------------------
  898.   def curve
  899.     @c = 0
  900.     return if @action_data[6] == 0
  901.     @curve = N03.parabola([@action_data[6], -@action_data[6]], @move_time, 100, 4)
  902.   end  
  903.   #--------------------------------------------------------------------------
  904.   # ● ジャンプ実行
  905.   #--------------------------------------------------------------------------
  906.   def jump
  907.     convert_jump
  908.     return if @action_data[7] == [0,0]
  909.     @jump = N03.parabola(@action_data[7].dup, @move_time, 100)
  910.   end  
  911.   #--------------------------------------------------------------------------
  912.   # ● J座標(ジャンプ高度)をH座標に変換
  913.   #--------------------------------------------------------------------------
  914.   def convert_jump
  915.     @h += @j
  916.     @j = 0
  917.     @jump = []
  918.   end  
  919.   #--------------------------------------------------------------------------
  920.   # ● データベース戦闘アニメ実行
  921.   #--------------------------------------------------------------------------
  922.   def battle_anime
  923.     data = @action_data.dup
  924.     targets = N03.get_targets(data[2], @battler)
  925.     return if targets == []
  926.     data[8] = !data[8] if @mirror
  927.     @set_damage           = data[5]
  928.     @damage_anime_data[0] = N03.get_attack_anime_id(data[1], @battler)
  929.     @damage_anime_data[1] = data[8]
  930.     @damage_anime_data[2] = data[7]
  931.     @damage_anime_data[3] = data[6]
  932.     @damage_anime_data[4] = data[9]
  933.     @wait = N03.get_anime_time(@damage_anime_data[0]) - 2 if data[4]
  934.     return if @set_damage
  935.     for target in targets do display_anime(targets, target, data) end
  936.   end
  937.   #--------------------------------------------------------------------------
  938.   # ● 武器アニメ開始
  939.   #--------------------------------------------------------------------------
  940.   def weapon_anime(anime_data)
  941.     @weapon_end = true
  942.     for i in 9...anime_data.size
  943.       set_effect_data(anime_data[i]) if anime_data[i] != ""
  944.     end
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # ● アニメ飛ばし開始
  948.   #--------------------------------------------------------------------------
  949.   def move_anime
  950.     @m_a_starter = []
  951.     @m_a_targets = []
  952.     starters = N03.get_targets(@action_data[2], @battler)
  953.     targets = N03.get_targets(@action_data[3], @battler)
  954.     return if starters == [] or targets == []
  955.     single_start = true if starters != nil && @action_data[2] < 0
  956.     single_start = true if @action_data[1][0] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][0], @battler)].position == 3
  957.     starters = [starters[0]] if single_start
  958.     single_end = true if targets != nil && @action_data[3] < 0
  959.     single_end = true if @action_data[1][1] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][1], @battler)].position == 3
  960.     targets = [targets[0]] if single_end
  961.     se_flag = true
  962.     for starter in starters
  963.       for target in targets
  964.         data = @action_data.dup
  965.         data[17] = se_flag
  966.         @effect_data.push(data)
  967.         @m_a_targets.push(target)
  968.         @m_a_starter.push(starter)
  969.         se_flag = false
  970.       end
  971.     end  
  972.   end
  973.   #--------------------------------------------------------------------------
  974.   # ● スプライトセット通信
  975.   #--------------------------------------------------------------------------
  976.   def set_effect_data(data = @action)
  977.     action_data = N03::ACTION[data]
  978.     return if action_data == nil
  979.     @effect_data.push(action_data.dup)
  980.   end
  981.   #--------------------------------------------------------------------------
  982.   # ● 戦闘シーン通信のデータを格納
  983.   #--------------------------------------------------------------------------
  984.   def set_play_data(data = @action_data)
  985.     @play_data = data.dup
  986.   end
  987.   #--------------------------------------------------------------------------
  988.   # ● 戦闘アニメの表示
  989.   #--------------------------------------------------------------------------
  990.   def display_anime(targets, target, data)
  991.     return if !N03.first_of_all_screen_anime(data[1], target, targets)
  992.     target.animation_id         = N03.get_attack_anime_id(data[1], @battler)
  993.     target.animation_mirror     = data[8]
  994.     target.sv.anime_horming     = data[3]
  995.     target.sv.anime_camera_zoom = data[6]
  996.     target.sv.anime_no_mirror   = data[7]
  997.     target.sv.anime_plus_z      = data[9]
  998.   end
  999.   #--------------------------------------------------------------------------
  1000.   # ● 戦闘アニメ拡張データの初期化
  1001.   #--------------------------------------------------------------------------
  1002.   def reset_anime_data
  1003.     @anime_no_mirror = false
  1004.     @anime_horming = false
  1005.     @anime_camera_zoom = false
  1006.     @timing_targets = []
  1007.     @anime_plus_z = true
  1008.   end  
  1009.   #--------------------------------------------------------------------------
  1010.   # ● カメラワーク
  1011.   #--------------------------------------------------------------------------
  1012.   def camera
  1013.     data = @action_data.dup
  1014.     N03.camera(@battler, data)
  1015.     @wait = data[4] if data[5]
  1016.   end  
  1017.   #--------------------------------------------------------------------------
  1018.   # ● 画面のシェイク
  1019.   #--------------------------------------------------------------------------
  1020.   def shake
  1021.     data = @action_data.dup
  1022.     $sv_camera.shake(data[1], data[2], data[3])
  1023.     @wait = data[3] if data[4]
  1024.   end
  1025.   #--------------------------------------------------------------------------
  1026.   # ● 画面色調変更
  1027.   #--------------------------------------------------------------------------
  1028.   def color_effect
  1029.     case @action_data[1]
  1030.     when 0,1,2,3,4,5
  1031.       targets = N03.get_targets(@action_data[1], @battler)
  1032.     when 6
  1033.       screen = true
  1034.     when 7
  1035.       targets = [@battler] + @target_battler
  1036.     when 8
  1037.       screen = true
  1038.       targets = $game_troop.members + $game_party.battle_members - [@battler]
  1039.     when 9
  1040.       screen = true
  1041.       targets = $game_troop.members + $game_party.battle_members - [@battler] - @target_battler
  1042.     when 10
  1043.       screen = true
  1044.       targets = $game_troop.members + $game_party.battle_members
  1045.     end
  1046.     return if screen == nil && targets == []
  1047.     for target in targets do target.sv.color_set = @action_data[2] end if targets
  1048.     @wait = @action_data[2][4] if @action_data[3]
  1049.     return if !screen
  1050.     $sv_camera.color_set[1] = @action_data[2]
  1051.     $sv_camera.color_set[2] = @action_data[2]
  1052.   end  
  1053.   #--------------------------------------------------------------------------
  1054.   # ● トランジション
  1055.   #--------------------------------------------------------------------------
  1056.   def transition
  1057.     $sv_camera.perform_transition(@action_data)
  1058.   end  
  1059.   #--------------------------------------------------------------------------
  1060.   # ● ふきだしアニメ表示
  1061.   #--------------------------------------------------------------------------
  1062.   def balloon_anime
  1063.     @balloon_data = @action_data.dup
  1064.   end  
  1065.   #--------------------------------------------------------------------------
  1066.   # ● ピクチャ表示
  1067.   #--------------------------------------------------------------------------
  1068.   def picture_set
  1069.     @picture = true
  1070.     set_effect_data
  1071.   end
  1072.   #--------------------------------------------------------------------------
  1073.   # ● ステート操作
  1074.   #--------------------------------------------------------------------------
  1075.   def state_set
  1076.     targets = N03.get_targets(@action_data[1], @battler)
  1077.     return if targets == []
  1078.     case @action_data[2]
  1079.     when 1 ; targets = [targets[rand(targets.size)]]
  1080.     when 2 ; targets -= @battler if targets.include?(@battler)
  1081.     end
  1082.     for target in targets
  1083.       for id in @action_data[4]
  1084.         target.add_state(id) if @action_data[3] == "+"
  1085.         target.remove_state(id) if @action_data[3] == "-"
  1086.       end
  1087.     end
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # ● FPS変更
  1091.   #--------------------------------------------------------------------------
  1092.   def fps
  1093.     Graphics.frame_rate = @action_data[1]
  1094.     start_action
  1095.   end
  1096.   #--------------------------------------------------------------------------
  1097.   # ● バトラー画像変更の場合
  1098.   #--------------------------------------------------------------------------
  1099.   def graphics_change
  1100.     @graphics_change = true
  1101.     return @battler.graphics_change(@action_data[3]) if !@battler.actor?
  1102.     @pre_change_data = [@battler.character_name, @battler.character_index, @battler.face_name, @battler.face_index] if @pre_change_data == nil && !@action_data[1]
  1103.     if @action_data[4] == []
  1104.       face_name = @battler.face_name
  1105.       face_index = @battler.face_index
  1106.     else
  1107.       face_name = @action_data[4][1]
  1108.       face_index = @action_data[4][0]
  1109.     end
  1110.     @battler.set_graphic(@action_data[3], @action_data[2], face_name, face_index)
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # ● スキル派生
  1114.   #--------------------------------------------------------------------------
  1115.   def derivating_skill
  1116.     # 未修得スキルは派生不可なら
  1117.     return if !@action_data[1] && !@battler.skill_learn?($data_skills[@action_data[3]])
  1118.     # コスト不足は派生不可なら
  1119.     return if !@action_data[2] && !@battler.skill_cost_payable?($data_skills[@action_data[3]])
  1120.     # 派生
  1121.     @derivation_skill_id = @action_data[3]
  1122.     # 以降のアクションをキャンセル
  1123.     @full_action = []
  1124.   end
  1125.   #--------------------------------------------------------------------------
  1126.   # ● BGM/BGS/SE演奏
  1127.   #--------------------------------------------------------------------------
  1128.   def sound
  1129.     pitch = @action_data[2]
  1130.     vol   = @action_data[3]
  1131.     name  = @action_data[4]
  1132.     case @action_data[1]
  1133.     when "se"
  1134.       Audio.se_play("Audio/SE/" + name, vol, pitch)
  1135.     when "bgm"
  1136.       # 名前指定のない場合、現在のBGMを変えないように
  1137.       name = RPG::BGM.last.name if @action_data[4] == ""
  1138.       Audio.bgm_play("Audio/BGM/" + name, vol, pitch)
  1139.     when "bgs"
  1140.       name = RPG::BGS.last.name if @action_data[4] == ""
  1141.       Audio.bgs_play("Audio/BGS/" + name, vol, pitch)
  1142.     end
  1143.   end
  1144.   #--------------------------------------------------------------------------
  1145.   # ● ムービーの再生
  1146.   #--------------------------------------------------------------------------
  1147.   def movie
  1148.     Graphics.play_movie('Movies/' + @action_data[1])
  1149.   end
  1150.   #--------------------------------------------------------------------------
  1151.   # ● ゲームスイッチ操作
  1152.   #--------------------------------------------------------------------------
  1153.   def switches
  1154.     for id in @action_data[1]
  1155.       $game_switches[id] = true if id > 0
  1156.       $sv_camera.switches[id.abs] = true  if id < 0
  1157.     end
  1158.     for id in @action_data[2]
  1159.       $game_switches[id] = false if id > 0
  1160.       $sv_camera.switches[id.abs] = false  if id < 0
  1161.     end
  1162.     $sv_camera.program_check
  1163.   end
  1164.   #--------------------------------------------------------------------------
  1165.   # ● ゲーム変数操作
  1166.   #--------------------------------------------------------------------------
  1167.   def variable
  1168.     # オペランドチェック
  1169.     operand = @action_data[3]
  1170.     operand = $game_variables[@action_data[3].abs] if @action_data[3] < 0
  1171.     # 変数操作で分岐
  1172.     case @action_data[2]
  1173.     when 0 ; $game_variables[@action_data[1]] = operand  # 代入
  1174.     when 1 ; $game_variables[@action_data[1]] += operand # 加算
  1175.     when 2 ; $game_variables[@action_data[1]] -= operand # 減算
  1176.     when 3 ; $game_variables[@action_data[1]] *= operand # 乗算
  1177.     when 4 ; $game_variables[@action_data[1]] /= operand # 除算
  1178.     when 5 ; $game_variables[@action_data[1]] %= operand # 剰余
  1179.     end
  1180.   end  
  1181.   #--------------------------------------------------------------------------
  1182.   # ● 条件分岐 (ゲームスイッチ)
  1183.   #--------------------------------------------------------------------------
  1184.   def nece_1
  1185.     judgment = $game_switches[@action_data[1]] == @action_data[2] if @action_data[1] > 0
  1186.     judgment = $sv_camera.switches[@action_data[1].abs] == @action_data[2] if @action_data[1] < 0
  1187.     action_diverging(judgment, @action_data[3])
  1188.   end  
  1189.   #--------------------------------------------------------------------------
  1190.   # ● 条件分岐 (ゲーム変数)
  1191.   #--------------------------------------------------------------------------
  1192.   def nece_2
  1193.     variable = $game_variables[@action_data[1]]
  1194.     num = @action_data[2]
  1195.     num = $game_variables[@action_data[2].abs] if num < 0
  1196.     case @action_data[3]
  1197.     when 0 ; judgment = variable == num
  1198.     when 1 ; judgment = variable < num
  1199.     when 2 ; judgment = variable > num
  1200.     end  
  1201.     action_diverging(judgment, @action_data[4])
  1202.   end  
  1203.   #--------------------------------------------------------------------------
  1204.   # ● 条件分岐 (ステート)
  1205.   #--------------------------------------------------------------------------
  1206.   def nece_3
  1207.     targets = N03.get_targets(@action_data[1], @battler)
  1208.     return if targets == []
  1209.     member_num = @action_data[4]
  1210.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1211.     hit_count = 0
  1212.     miss_count = 0
  1213.     for target in targets
  1214.       hit_count += 1 if target.state?(@action_data[2])
  1215.       miss_count += 1 if !target.state?(@action_data[2])
  1216.     end
  1217.     case @action_data[3]
  1218.     when 0 ; judgment = hit_count >= member_num
  1219.     when 1 ; judgment = miss_count >= member_num
  1220.     end
  1221.     action_diverging(judgment, @action_data[5])
  1222.   end  
  1223.   #--------------------------------------------------------------------------
  1224.   # ● 条件分岐 (スキル)
  1225.   #--------------------------------------------------------------------------
  1226.   def nece_4
  1227.     targets = N03.get_targets(@action_data[1], @battler)
  1228.     return if targets == []
  1229.     member_num = @action_data[4]
  1230.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1231.     hit_count = 0
  1232.     miss_count = 0
  1233.     for target in targets
  1234.       hit_count += 1 if target.skill_learn?($data_skills[@action_data[2]]) && target.skill_conditions_met?($data_skills[@action_data[2]])
  1235.       miss_count += 1 if !target.skill_learn?($data_skills[@action_data[2]]) or !target.skill_conditions_met?($data_skills[@action_data[2]])
  1236.     end
  1237.     case @action_data[3]
  1238.     when 0 ; judgment = hit_count >= member_num
  1239.     when 1 ; judgment = miss_count >= member_num
  1240.     end
  1241.     action_diverging(judgment, @action_data[5])
  1242.   end  
  1243.   #--------------------------------------------------------------------------
  1244.   # ● 条件分岐 (パラメータ)
  1245.   #--------------------------------------------------------------------------
  1246.   def nece_5
  1247.     targets = N03.get_targets(@action_data[1], @battler)
  1248.     return if targets == []
  1249.     member_num = @action_data[5]
  1250.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1251.     hit_count = 0
  1252.     for target in targets
  1253.       hit_count += 1 if target.comparison_parameter([@action_data[2],@action_data[3],@action_data[4]])
  1254.     end
  1255.     judgment = hit_count >= member_num
  1256.     action_diverging(judgment, @action_data[6])
  1257.   end  
  1258.   #--------------------------------------------------------------------------
  1259.   # ● 条件分岐 (装備)
  1260.   #--------------------------------------------------------------------------
  1261.   def nece_6
  1262.     targets = N03.get_targets(@action_data[1], @battler)
  1263.     return if targets == []
  1264.     member_num = @action_data[5]
  1265.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1266.     hit_count = 0
  1267.     miss_count = 0
  1268.     for target in targets
  1269.       hit_count += 1 if target.comparison_equip([@action_data[2],@action_data[3]])
  1270.       miss_count += 1 if !target.comparison_equip([@action_data[2],@action_data[3]])
  1271.     end
  1272.     case @action_data[4]
  1273.     when 0 ; judgment = hit_count >= member_num
  1274.     when 1 ; judgment = miss_count >= member_num
  1275.     end
  1276.     action_diverging(judgment, @action_data[6])
  1277.   end  
  1278.   #--------------------------------------------------------------------------
  1279.   # ● 条件分岐 (スクリプト)
  1280.   #--------------------------------------------------------------------------
  1281.   def nece_7
  1282.     judgment = eval(@action_data[2])
  1283.     action_diverging(judgment, @action_data[1])
  1284.   end  
  1285.   #--------------------------------------------------------------------------
  1286.   # ● アクション分岐  
  1287.   #--------------------------------------------------------------------------
  1288.   def action_diverging(judgment, kind)
  1289.     result = 0
  1290.     if judgment
  1291.       result = 1 if kind == 1
  1292.       result = 2 if kind == 2
  1293.     else
  1294.       result = 1 if kind == 0
  1295.     end
  1296.     # フルアクション終了
  1297.     return @full_action = []  if result == 2
  1298.     # 次のアクションを除去
  1299.     @full_action.shift if result == 1
  1300.     set_action
  1301.     # 次のアクションを実行
  1302.     @action_data = N03::ACTION[@action]
  1303.     next_action
  1304.   end
  1305.   #--------------------------------------------------------------------------
  1306.   # ● セカンドターゲット操作
  1307.   #--------------------------------------------------------------------------
  1308.   def second_targets_set
  1309.     targets = N03.get_targets(@action_data[1], @battler)
  1310.     for target in targets
  1311.       targets.delete(target) if @action_data[2][1] == 1 && target.index != @action_data[2][0]
  1312.       targets.delete(target) if @action_data[2][1] == 2 && target.index == @action_data[2][0].abs
  1313.       targets.delete(target) if @action_data[3] > 0 && target.id != @action_data[3]
  1314.       targets.delete(target) if @action_data[3] < 0 && target.id == @action_data[3].abs
  1315.       targets.delete(target) if @action_data[4] > 0 && !target.state?(@action_data[4])
  1316.       targets.delete(target) if @action_data[4] < 0 && target.state?(@action_data[4].abs)
  1317.       targets.delete(target) if @action_data[5] > 0 && !target.skill_conditions_met?($data_skills[@action_data[5]])
  1318.       targets.delete(target) if @action_data[5] < 0 && target.skill_conditions_met?($data_skills[@action_data[5].abs])
  1319.       targets.delete(target) if !target.comparison_parameter(@action_data[6])
  1320.       targets.delete(target) if !@action_data[7][1].include?(0) && !target.comparison_equip(@action_data[7])
  1321.     end
  1322.     return @second_targets = [] if targets.size == 0
  1323.     case @action_data[8]
  1324.     when 1 ; targets = [targets[rand(targets.size)]]
  1325.     when 2 ; targets.delete(@battler)
  1326.     end
  1327.     return @second_targets = [] if targets.size == 0
  1328.     @second_targets = targets
  1329.     case @action_data[9]
  1330.     when 0 ; return
  1331.     when 1 ; set_play_data(["second_targets_set"])
  1332.     when 2 ; set_play_data(["targets_set"])
  1333.     end
  1334.     @wait += 1
  1335.   end
  1336.   #--------------------------------------------------------------------------
  1337.   # ● コモンイベント呼び出し
  1338.   #--------------------------------------------------------------------------
  1339.   def call_common_event
  1340.     $game_temp.reserve_common_event(@action_data[1])
  1341.     $sv_camera.event = true
  1342.     @event_fix = @action_data[2]
  1343.   end
  1344.   #--------------------------------------------------------------------------
  1345.   # ● ダメージアニメ
  1346.   #--------------------------------------------------------------------------
  1347.   def damage_anime(delay_time = 12)
  1348.     anime(N03.get_attack_anime_id(-3, @battler), wait = true)
  1349.     action_play
  1350.     @wait -= delay_time
  1351.     @full_action.unshift("eval('@damage_anime_data = []
  1352.     @set_damage = true')")
  1353.   end
  1354.   #--------------------------------------------------------------------------
  1355.   # ● 通常コラプス
  1356.   #--------------------------------------------------------------------------
  1357.   def normal_collapse
  1358.     @collapse = true
  1359.     return
  1360.   end
  1361.   #--------------------------------------------------------------------------
  1362.   # ● 初期位置変更
  1363.   #--------------------------------------------------------------------------
  1364.   def change_base_position
  1365.     @base_x = @x
  1366.     @base_y = @y
  1367.     @base_h = @h
  1368.   end  
  1369.   #--------------------------------------------------------------------------
  1370.   # ● 強制アクション実行
  1371.   #--------------------------------------------------------------------------
  1372.   def force_act
  1373.     target(@full_action.shift)
  1374.   end
  1375.   #--------------------------------------------------------------------------
  1376.   # ● 強制アクション実行 (セカンドターゲット)
  1377.   #--------------------------------------------------------------------------
  1378.   def force_act2
  1379.     target2(@full_action.shift)
  1380.   end
  1381.   #--------------------------------------------------------------------------
  1382.   # ● 個別処理開始
  1383.   #--------------------------------------------------------------------------
  1384.   def individual_start
  1385.     @individual_targets = @target_battler.dup
  1386.     @remain_targets = @target_battler.dup
  1387.     @target_battler = [@individual_targets[0]]
  1388.     # リピート部分のアクションを保持
  1389.     @individual_act = @full_action.dup
  1390.   end
  1391.   #--------------------------------------------------------------------------
  1392.   # ● 個別処理終了
  1393.   #--------------------------------------------------------------------------
  1394.   def individual_end
  1395.     @individual_targets.shift
  1396.     for target in @individual_targets
  1397.       @individual_targets.shift if target.dead?
  1398.     end
  1399.     # ターゲットが残っているなら行動リピート
  1400.     return @target_battler = @remain_targets if @individual_targets.size == 0
  1401.     @full_action = @individual_act.dup
  1402.     @target_battler = [@individual_targets[0]]
  1403.   end
  1404.   #--------------------------------------------------------------------------
  1405.   # ● ループ開始
  1406.   #--------------------------------------------------------------------------
  1407.   def loop_start
  1408.     # ループ部分のアクションを保持
  1409.     @loop_act = @full_action.dup
  1410.   end
  1411.   #--------------------------------------------------------------------------
  1412.   # ● ループ終了
  1413.   #--------------------------------------------------------------------------
  1414.   def loop_end
  1415.     # 行動リピート
  1416.     @full_action = @loop_act.dup if @loop_act != []
  1417.   end
  1418.   #--------------------------------------------------------------------------
  1419.   # ● 次の行動者へ移行
  1420.   #--------------------------------------------------------------------------
  1421.   def next_battler
  1422.     @action_end = true
  1423.     @active = false
  1424.   end
  1425.   #--------------------------------------------------------------------------
  1426.   # ● 画像変更フラグ
  1427.   #--------------------------------------------------------------------------
  1428.   def set_change
  1429.     @change_up = true
  1430.   end
  1431.   #--------------------------------------------------------------------------
  1432.   # ● 戦闘シーン通信
  1433.   #--------------------------------------------------------------------------
  1434.   def play_data
  1435.     data = @play_data
  1436.     @play_data = []
  1437.     return data
  1438.   end
  1439.   #--------------------------------------------------------------------------
  1440.   # ● ショートカットコマンド
  1441.   #--------------------------------------------------------------------------
  1442.   def anime(anime_id, wait = true)
  1443.     @action_data = ["anime",anime_id,1,false,wait,false,true,false]
  1444.   end
  1445.   def anime_me(anime_id, wait = true)
  1446.     @action_data = ["anime",anime_id,0,false,wait,false,true,false]
  1447.   end
  1448.   def se(file, pitch = 100)
  1449.     @action_data = ["sound",  "se", pitch, 100, file]
  1450.   end
  1451.   def target(act)
  1452.     for target in @target_battler do target.sv.force_action = act end
  1453.   end
  1454.   def target2(act)
  1455.     for target in @second_targets do target.sv.force_action = act end
  1456.   end
  1457.   def delay(time)
  1458.     @wait = @battler.index * time
  1459.   end
  1460.   #--------------------------------------------------------------------------
  1461.   # ● バトラーのIDを取得
  1462.   #--------------------------------------------------------------------------
  1463.   def id
  1464.     return @battler.id if @battler.actor?
  1465.     return -@battler.id
  1466.   end
  1467.   #--------------------------------------------------------------------------
  1468.   # ● 被クリティカルフラグを取得
  1469.   #--------------------------------------------------------------------------
  1470.   def critical?
  1471.     return @battler.result.critical
  1472.   end
  1473.   #--------------------------------------------------------------------------
  1474.   # ● 被回復フラグを取得
  1475.   #--------------------------------------------------------------------------
  1476.   def recovery?
  1477.     recovery = false
  1478.     recovery = true if @battler.result.hp_damage < 0
  1479.     recovery = true if @battler.result.mp_damage < 0
  1480.     recovery = true if @battler.result.tp_damage < 0
  1481.     return recovery
  1482.   end
  1483.   #--------------------------------------------------------------------------
  1484.   # ● 被スキルIDを取得
  1485.   #--------------------------------------------------------------------------
  1486.   def damage_skill_id
  1487.     return @damage_skill_id
  1488.   end
  1489.   #--------------------------------------------------------------------------
  1490.   # ● 被アイテムIDを取得
  1491.   #--------------------------------------------------------------------------
  1492.   def damage_item_id
  1493.     return @damage_item_id
  1494.   end
  1495.   #--------------------------------------------------------------------------
  1496.   # ● 装備武器を取得
  1497.   #--------------------------------------------------------------------------
  1498.   def weapon_id
  1499.     return 0 if !@battler.weapons[0]
  1500.     return @battler.weapons[0].id
  1501.   end
  1502.   #--------------------------------------------------------------------------
  1503.   # ● 装備武器のタイプを取得
  1504.   #--------------------------------------------------------------------------
  1505.   def weapon_type
  1506.     return 0 if !@battler.weapons[0]
  1507.     return @battler.weapons[0].wtype_id
  1508.   end
  1509.   #--------------------------------------------------------------------------
  1510.   # ● 盾を装備しているか
  1511.   #--------------------------------------------------------------------------
  1512.   def shield?
  1513.     for armor in @battler.armors do return true if armor != nil && armor.etype_id == 1 end
  1514.     return false
  1515.   end
  1516.   #--------------------------------------------------------------------------
  1517.   # ● ダメージがあるか
  1518.   #--------------------------------------------------------------------------
  1519.   def damage_zero?
  1520.     return @battler.result.hp_damage == 0 && @battler.result.mp_damage == 0 && @battler.result.tp_damage == 0
  1521.   end
  1522.   #--------------------------------------------------------------------------
  1523.   # ● スキルIDを取得
  1524.   #--------------------------------------------------------------------------
  1525.   def skill_id
  1526.     return @counter_id if @counter_id != 0
  1527.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1528.     return 0 if @battler.current_action.item.is_a?(RPG::Item)
  1529.     return @battler.current_action.item.id
  1530.   end
  1531.   #--------------------------------------------------------------------------
  1532.   # ● スキルのタイプを取得
  1533.   #--------------------------------------------------------------------------
  1534.   def skill_type
  1535.     return 0 if skill_id == 0
  1536.     return $data_skills[skill_id].stype_id
  1537.   end
  1538.   #--------------------------------------------------------------------------
  1539.   # ● スキル名を取得
  1540.   #--------------------------------------------------------------------------
  1541.   def skill_name
  1542.     return "" if skill_id == 0
  1543.     return $data_skills[skill_id].name
  1544.   end
  1545.   #--------------------------------------------------------------------------
  1546.   # ● アイテムIDを取得
  1547.   #--------------------------------------------------------------------------
  1548.   def item_id
  1549.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1550.     return @battler.current_action.item.id
  1551.   end
  1552.   #--------------------------------------------------------------------------
  1553.   # ● 攻撃アクション
  1554.   #--------------------------------------------------------------------------
  1555.   def attack_action(item)
  1556.     return skill_action if item.is_a?(RPG::Skill)
  1557.     return item_action
  1558.   end
  1559.   #--------------------------------------------------------------------------
  1560.   # ● ダメージアクションベース
  1561.   #--------------------------------------------------------------------------
  1562.   def damage_action_base(item)
  1563.     @damage_skill_id = 0
  1564.     @damage_item_id = 0
  1565.     @damage_skill_id = item.id if item.is_a?(RPG::Skill)
  1566.     @damage_item_id = item.id if item.is_a?(RPG::Item)
  1567.   end  
  1568.   #--------------------------------------------------------------------------
  1569.   # ● ダメージアクション
  1570.   #--------------------------------------------------------------------------
  1571.   def damage_action(attacker, item)
  1572.     damage_action_base(item)
  1573.     act = damage(attacker)
  1574.     return if @active
  1575.     start_action(act) if act != nil
  1576.   end
  1577.   #--------------------------------------------------------------------------
  1578.   # ● 回避アクション
  1579.   #--------------------------------------------------------------------------
  1580.   def evasion_action(attacker, item)
  1581.     damage_action_base(item)
  1582.     act = evasion(attacker)
  1583.     return if @active
  1584.     start_action(act) if act != nil
  1585.   end
  1586.   #--------------------------------------------------------------------------
  1587.   # ● ミスアクション
  1588.   #--------------------------------------------------------------------------
  1589.   def miss_action(attacker, item)
  1590.     damage_action_base(item)
  1591.     act = miss(attacker)
  1592.     return if @active
  1593.     start_action(act) if act != nil
  1594.   end
  1595.   #--------------------------------------------------------------------------
  1596.   # ● 閃きスクリプト併用処理
  1597.   #--------------------------------------------------------------------------
  1598.   def flash_action
  1599.     return "閃き"
  1600.   end
  1601.   
  1602. end


  1603. #==============================================================================
  1604. # ■ module N03
  1605. #------------------------------------------------------------------------------
  1606. #  サイドビューバトルのモジュールです。
  1607. #==============================================================================
  1608. module N03
  1609.   #--------------------------------------------------------------------------
  1610.   # ● バトラーの敵グループを取得
  1611.   #--------------------------------------------------------------------------
  1612.   def self.get_enemy_unit(battler)
  1613.     return $game_troop if battler.actor?
  1614.     return $game_party
  1615.   end
  1616.   #--------------------------------------------------------------------------
  1617.   # ● バトラーの味方グループを取得
  1618.   #--------------------------------------------------------------------------
  1619.   def self.get_party_unit(battler)
  1620.     return $game_party if battler.actor?
  1621.     return $game_troop
  1622.   end
  1623.   #--------------------------------------------------------------------------
  1624.   # ● 戦闘アニメ時間の取得
  1625.   #--------------------------------------------------------------------------
  1626.   def self.get_anime_time(anime_id)
  1627.     return 0 if anime_id <= 0
  1628.     return $data_animations[anime_id].frame_max * 4
  1629.   end
  1630.   #--------------------------------------------------------------------------
  1631.   # ● 攻撃アニメの取得
  1632.   #--------------------------------------------------------------------------
  1633.   def self.get_attack_anime_id(kind, battler)
  1634.     return $data_skills[battler.sv.counter_id].animation_id if kind == -3 && battler.sv.counter_id != 0
  1635.     case kind
  1636.     when -1 ; anime_id = battler.atk_animation_id1
  1637.     when -2 ; anime_id = battler.atk_animation_id2
  1638.     when -3
  1639.       if battler.current_action != nil
  1640.         anime_id = battler.current_action.item.animation_id if battler.current_action.item != nil
  1641.       end
  1642.     else    ; anime_id = kind
  1643.     end
  1644.     case anime_id
  1645.     when -1 ; anime_id = battler.atk_animation_id1
  1646.     when -2 ; anime_id = battler.atk_animation_id2
  1647.     end
  1648.     return anime_id if anime_id
  1649.     return 0
  1650.   end  
  1651.   #--------------------------------------------------------------------------
  1652.   # ● 戦闘アニメデータをセット
  1653.   #--------------------------------------------------------------------------
  1654.   def self.set_damage_anime_data(targets, target, data)
  1655.     return if !first_of_all_screen_anime(data[0], target, targets)
  1656.     target.animation_id         = data[0]
  1657.     target.animation_mirror     = data[1]
  1658.     target.sv.anime_no_mirror   = data[2]
  1659.     target.sv.anime_camera_zoom = data[3]
  1660.     target.sv.anime_plus_z      = data[4]
  1661.   end   
  1662.   #--------------------------------------------------------------------------
  1663.   # ● ターゲットの取得
  1664.   #--------------------------------------------------------------------------
  1665.   def self.get_targets(kind, battler)
  1666.     case kind.abs
  1667.     when 0 ; return [battler].dup
  1668.     when 1 ; return battler.sv.target_battler.dup
  1669.     when 2 ; return get_enemy_unit(battler).members.dup
  1670.     when 3 ; return get_party_unit(battler).members.dup
  1671.     when 4 ; return $game_troop.members.dup + $game_party.battle_members.dup
  1672.     when 5 ; return battler.sv.second_targets.dup
  1673.     end
  1674.   end  
  1675.   #--------------------------------------------------------------------------
  1676.   # ● ターゲットの座標を取得
  1677.   #--------------------------------------------------------------------------
  1678.   def self.get_targets_position(targets, horming, m_a = nil)
  1679.     return [0,0,0] if targets == nil && !$sv_camera.mirror
  1680.     return [Graphics.width,0,0] if targets == nil && $sv_camera.mirror
  1681.     x = y = h = 0
  1682.     for i in 0...targets.size
  1683.       x += targets[i].sv.base_x if !horming
  1684.       y += targets[i].sv.base_y if !horming
  1685.       h += targets[i].sv.base_h if !horming
  1686.       x += targets[i].sv.x if horming
  1687.       y += targets[i].sv.y if horming
  1688.       h += targets[i].sv.h if horming
  1689.       y -= targets[i].sv.ch * 100 if m_a == 0
  1690.       y -= targets[i].sv.ch * 50 if m_a == 1
  1691.     end
  1692.     return [x / targets.size, y / targets.size, h / targets.size]
  1693.   end
  1694.   #--------------------------------------------------------------------------
  1695.   # ● 速度を時間に変換
  1696.   #--------------------------------------------------------------------------
  1697.   def self.distanse_calculation(time, target_position, self_position, distanse_move)
  1698.     return time if !distanse_move
  1699.     distanse_x = self_position[0] - target_position[0]
  1700.     distanse_x = target_position[0] - self_position[0] if target_position[0] > self_position[0]
  1701.     distanse_y = self_position[1] - target_position[1]
  1702.     distanse_y = target_position[1] - self_position[1] if target_position[1] > self_position[1]
  1703.     if self_position[2] != nil && target_position[2] != nil
  1704.       distanse_h = self_position[2] - target_position[2]
  1705.       distanse_h = target_position[2] - self_position[2] if target_position[2] > self_position[2]
  1706.     else
  1707.       distanse_h = 0
  1708.     end
  1709.     distanse = [distanse_x, distanse_y, distanse_h].max
  1710.     return distanse / (time * 100) + 1
  1711.   end
  1712.   #--------------------------------------------------------------------------
  1713.   # ● 放物線移動計算
  1714.   #--------------------------------------------------------------------------
  1715.   def self.parabola(data, time, size, type = 1)
  1716.     move_data = data
  1717.     move_data[0] *= size
  1718.     move_data[1] *= size
  1719.     move = []
  1720.     move_d = []
  1721.     for i in 0...time / 2
  1722.       move[i] = move_data[0]
  1723.       move_d[i] = move_data[1]
  1724.       move_data[0] = move_data[0] * type / (1 + type)
  1725.       move_data[1] = move_data[1] * type / (1 + type)
  1726.     end
  1727.     move = move + move_d.reverse!
  1728.     move.reverse!
  1729.     adjust = move.inject(0) {|result, item| result + item }
  1730.     move[move.size - 1] += adjust if data[0] == data[1] && adjust != 0
  1731.     move.unshift(0) if time % 2 != 0
  1732.     return move
  1733.   end
  1734.   #--------------------------------------------------------------------------
  1735.   # ● 反転値
  1736.   #--------------------------------------------------------------------------
  1737.   def self.mirror_num(mirror)
  1738.     return 1 if !mirror
  1739.     return -1
  1740.   end  
  1741.   #--------------------------------------------------------------------------
  1742.   # ● カメラワーク
  1743.   #--------------------------------------------------------------------------
  1744.   def self.camera(battler, data)
  1745.     battler = $game_party.battle_members[0] if !battler
  1746.     cx = data[2][0] * 100
  1747.     cy = data[2][1] * 100
  1748.     return $sv_camera.move(cx, cy, data[3], data[4], true) if data[1] == 6
  1749.     targets = self.get_targets(data[1], battler)
  1750.     return if targets == nil or targets == []
  1751.     position = self.get_targets_position(targets, true)
  1752.     $sv_camera.move(position[0], position[1] - position[2], data[3], data[4], false)
  1753.   end
  1754.   #--------------------------------------------------------------------------
  1755.   # ● コラプス禁止
  1756.   #--------------------------------------------------------------------------
  1757.   def self.immortaling
  1758.     # 全員に不死身付与
  1759.     for member in $game_party.battle_members + $game_troop.members
  1760.       # イベント操作等で不死身設定になっていたら解除を無効にするフラグを立てる
  1761.       member.sv.immortal = true if member.state?(N03::IMMORTAL_ID)
  1762.       member.add_state(N03::IMMORTAL_ID)
  1763.     end
  1764.     return true
  1765.   end  
  1766.   #--------------------------------------------------------------------------
  1767.   # ● コラプス許可
  1768.   #--------------------------------------------------------------------------
  1769.   def self.unimmortaling
  1770.     # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
  1771.     for member in $game_party.battle_members + $game_troop.members
  1772.       next if member.dead?
  1773.       # 不死身ステートが行動中に解除されていた場合、解除無効を解除
  1774.       member.sv.immortal = false if !member.state?(N03::IMMORTAL_ID) && member.sv.immortal
  1775.       next member.sv.immortal = false if member.sv.immortal
  1776.       member.remove_state(N03::IMMORTAL_ID)
  1777.       next if member.hp != 0
  1778.       member.add_state(1)
  1779.       member.perform_collapse_effect
  1780.       member.sv.action_terminate
  1781.     end
  1782.     return false
  1783.   end  
  1784.   #--------------------------------------------------------------------------
  1785.   # ● スキル派生
  1786.   #--------------------------------------------------------------------------
  1787.   def self.derived_skill(battler)
  1788.     battler.force_action(battler.sv.derivation_skill_id, -2)
  1789.     BattleManager.unshift_action_battlers(battler)
  1790.   end
  1791.   #--------------------------------------------------------------------------
  1792.   # ● ダメージの作成
  1793.   #--------------------------------------------------------------------------
  1794.   def self.set_damage(battler, hp_damage, mp_damage)
  1795.     battler.result.hp_damage = hp_damage
  1796.     battler.result.mp_damage = mp_damage
  1797.   end
  1798.   #--------------------------------------------------------------------------
  1799.   # ● ターゲット生死確認
  1800.   #--------------------------------------------------------------------------
  1801.   def self.targets_alive?(targets)
  1802.     return false if targets == []
  1803.     for target in targets do return true if !target.dead? end
  1804.     return false
  1805.   end
  1806.   #--------------------------------------------------------------------------
  1807.   # ● ターゲットをセカンドターゲットへ
  1808.   #--------------------------------------------------------------------------
  1809.   def self.s_targets(battler)
  1810.     battler.sv.target_battler = battler.sv.second_targets
  1811.     return battler.sv.second_targets
  1812.   end  
  1813.   #--------------------------------------------------------------------------
  1814.   # ● セカンドターゲットをターゲットへ
  1815.   #--------------------------------------------------------------------------
  1816.   def self.targets_set(battler)
  1817.     battler.sv.second_targets = battler.current_action.make_targets.compact
  1818.     battler.sv.target_battler = battler.sv.second_targets
  1819.   end  
  1820.   #--------------------------------------------------------------------------
  1821.   # ● 戦闘アニメ実行判定 (対象:画面時は最初のターゲットのみアニメ実行)
  1822.   #--------------------------------------------------------------------------
  1823.   def self.first_of_all_screen_anime(anime_id, target, targets)
  1824.     anime = $data_animations[anime_id]
  1825.     return false if !anime
  1826.     return true if anime.position != 3
  1827.     return false if anime.position == 3 && target != targets[0]
  1828.     targets.delete(target)
  1829.     target.sv.timing_targets = targets
  1830.     return true
  1831.   end
  1832.   #--------------------------------------------------------------------------
  1833.   # ● 戦闘不能付加攻撃か
  1834.   #--------------------------------------------------------------------------
  1835.   def self.dead_attack?(battler, item)
  1836.     for state in battler.atk_states
  1837.       return true if state == battler.death_state_id
  1838.     end
  1839.     for effect in item.effects
  1840.       return true if effect.code == 21 && effect.data_id == battler.death_state_id
  1841.     end
  1842.     return false
  1843.   end
  1844. end

  1845. #==============================================================================
  1846. # ■ Sprite_Weapon
  1847. #------------------------------------------------------------------------------
  1848. #  ウエポン表示用のスプライトです。
  1849. #==============================================================================
  1850. class Sprite_Weapon < Sprite_Base
  1851.   #--------------------------------------------------------------------------
  1852.   # ● 公開インスタンス変数 
  1853.   #--------------------------------------------------------------------------
  1854.   attr_reader   :index                       # ウエポン画像配列のインデックス
  1855.   attr_reader   :battler                     # 画像が参照しているバトラー
  1856.   attr_reader   :move_time                   # 画像が目標に到達するまでの時間
  1857.   attr_reader   :through                     # 貫通フラグ
  1858.   attr_reader   :action_end                  # 武器アクション終了フラグ
  1859.   attr_reader   :action_end_cancel                  # 武器アクション終了フラグ
  1860.   attr_reader   :hit_position                # 画像が目標に到達した時の座標
  1861.   attr_accessor :hit_anime_id                # 画像が目標に到達した時のアニメID
  1862.   #--------------------------------------------------------------------------
  1863.   # ● オブジェクト初期化
  1864.   #--------------------------------------------------------------------------
  1865.   def initialize(viewport, index, battler)
  1866.     super(viewport)
  1867.     @index = index
  1868.     @battler = battler
  1869.     @position_x = @position_y = 0
  1870.     @o = 0
  1871.     @real_x = @real_y = 0
  1872.     @mirror = @battler.sv.mirror
  1873.     reset
  1874.     set_action
  1875.   end
  1876.   #--------------------------------------------------------------------------
  1877.   # ● 初期化
  1878.   #--------------------------------------------------------------------------
  1879.   def reset
  1880.     @z_plus = 0
  1881.     @weapon_data = []
  1882.     @move_data = []
  1883.     @move_x = 0
  1884.     @move_y = 0
  1885.     @orbit = []
  1886.     @through = false
  1887.     @distanse_move = false
  1888.     @weapon_width = 0
  1889.     @weapon_height = 0
  1890.     @anime_time = 0
  1891.     @anime_position = 1
  1892.     @move_time = 0
  1893.     @hit_anime_id = 0
  1894.     @move_anime = true
  1895.     @action_end = false
  1896.     @action_end_cancel = false
  1897.     reset_position
  1898.   end  
  1899.   #--------------------------------------------------------------------------
  1900.   # ● アクションをセット
  1901.   #--------------------------------------------------------------------------
  1902.   def set_action
  1903.     return if @battler.sv.effect_data == []
  1904.     weapon_anime if @battler.sv.effect_data[0][0] == "wp"
  1905.     move_anime if @battler.sv.effect_data[0][0] == "m_a"
  1906.     @battler.sv.effect_data.shift
  1907.   end
  1908.   #--------------------------------------------------------------------------
  1909.   # ● 武器アニメ実行
  1910.   #--------------------------------------------------------------------------
  1911.   def weapon_anime
  1912.     @weapon_data = @battler.sv.effect_data[0].dup
  1913.     set_graphics
  1914.     set_ox
  1915.     set_weapon_move
  1916.   end
  1917.   #--------------------------------------------------------------------------
  1918.   # ● アニメ移動実行
  1919.   #--------------------------------------------------------------------------
  1920.   def move_anime
  1921.     @move_data = @battler.sv.effect_data[0].dup
  1922.     # ターゲットを取得
  1923.     @target_battler = [@battler.sv.m_a_targets.shift]
  1924.     @target_battler = N03.get_targets(@move_data[3], @battler) if @move_data[3] < 0
  1925.     set_move
  1926.     return if @move_data[16] == ""
  1927.     weapon_data = N03::ACTION[@move_data[16]]
  1928.     return if weapon_data == nil
  1929.     @weapon_data = weapon_data.dup
  1930.     set_graphics
  1931.     set_ox
  1932.     set_weapon_move
  1933.   end
  1934.   #--------------------------------------------------------------------------
  1935.   # ● 武器画像を取得
  1936.   #--------------------------------------------------------------------------  
  1937.   def set_graphics
  1938.     # 武器に依存しない画像設定がある場合
  1939.     if @weapon_data[13] != ""
  1940.       self.bitmap = Cache.character(@weapon_data[13]).dup
  1941.       @weapon_width = self.bitmap.width
  1942.       @weapon_height = self.bitmap.height
  1943.       return
  1944.     end
  1945.     # 武器を取得
  1946.     weapon = @battler.weapons[0]
  1947.     # 逆手装備を取得
  1948.     if @weapon_data[10]
  1949.       weapon = nil
  1950.       for armor in @battler.armors do break weapon = armor if armor.is_a?(RPG::Armor) && armor.etype_id == 1 end
  1951.       weapon = @battler.weapons[1] if !weapon
  1952.     end  
  1953.     # 武器がなければ処理をキャンセル
  1954.     return if weapon == nil
  1955.     # インデックスを取得
  1956.     file_index = @weapon_data[12]
  1957.     # アイコンを利用するなら
  1958.     if @weapon_data[1] == 0
  1959.       icon_index = weapon.icon_index
  1960.       self.bitmap = Cache.system("Iconset" + file_index).dup
  1961.       self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1962.       @weapon_width = @weapon_height = 24
  1963.     # 独自画像指定
  1964.     else
  1965.       file_name = @battler.sv.weapon_graphic(weapon.id, weapon.wtype_id) if weapon.is_a?(RPG::Weapon)
  1966.       file_name = @battler.sv.shield_graphic(weapon.id, weapon.atype_id) if weapon.is_a?(RPG::Armor)
  1967.       self.bitmap = Cache.character(file_name + file_index).dup
  1968.       @weapon_width = self.bitmap.width
  1969.       @weapon_height = self.bitmap.height
  1970.       return if @weapon_data[1] == 1
  1971.       # 2003仕様の武器アニメ
  1972.       @weapon_width /= @battler.sv.max_pattern[0]
  1973.     end
  1974.   end
  1975.   #--------------------------------------------------------------------------
  1976.   # ● 画像の原点を取得
  1977.   #--------------------------------------------------------------------------  
  1978.   def set_ox
  1979.     # 反転時は設定を逆に
  1980.     if @mirror
  1981.       case @weapon_data[6]
  1982.       when 1 ; @weapon_data[6] = 2 # 左上→右上に
  1983.       when 2 ; @weapon_data[6] = 1 # 右上→左上に
  1984.       when 3 ; @weapon_data[6] = 4 # 左下→右下に
  1985.       when 4 ; @weapon_data[6] = 3 # 右下→左下に
  1986.       end
  1987.     end
  1988.     # 原点を設定
  1989.     case @weapon_data[6]
  1990.     when 0 # 中心
  1991.       self.ox = @weapon_width / 2
  1992.       self.oy = @weapon_height / 2
  1993.     when 1 # 左上
  1994.       self.ox = 0
  1995.       self.oy = 0
  1996.     when 2 # 右上
  1997.       self.ox = @weapon_width
  1998.       self.oy = 0
  1999.     when 3 # 左下
  2000.       self.ox = 0
  2001.       self.oy = @weapon_height
  2002.     when 4 # 右下
  2003.       self.ox = @weapon_width
  2004.       self.oy = @weapon_height
  2005.     when 5 # バトラーと同じ
  2006.       self.ox = @weapon_width / 2
  2007.       self.oy = @weapon_height
  2008.     end
  2009.   end  
  2010.   #--------------------------------------------------------------------------
  2011.   # ● バトラーの座標を取得
  2012.   #--------------------------------------------------------------------------  
  2013.   def set_battler_position
  2014.     @position_x = @battler.sv.x + @weapon_data[3][0] * N03.mirror_num(@mirror) * 100
  2015.     @position_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust) + @weapon_data[3][1] * 100
  2016.     reset_position
  2017.   end
  2018.   #--------------------------------------------------------------------------
  2019.   # ● 座標を初期化
  2020.   #--------------------------------------------------------------------------  
  2021.   def reset_position
  2022.     @real_x = @position_x / 100
  2023.     @real_y = @position_y / 100
  2024.     @real_zoom_x = 1
  2025.     @real_zoom_y = 1
  2026.   end
  2027.   #--------------------------------------------------------------------------
  2028.   # ● 戦闘アニメを表示
  2029.   #--------------------------------------------------------------------------  
  2030.   def set_animation(anime_id)
  2031.     return if $data_animations[anime_id] == nil
  2032.     @anime_position = $data_animations[anime_id].position
  2033.     @horming = true
  2034.     @horming = false if @anime_position == 3
  2035.     @anime_camera_zoom = true
  2036.     @anime_no_mirror = false
  2037.     start_animation($data_animations[anime_id], @mirror)
  2038.     timings = $data_animations[anime_id].timings
  2039.   end
  2040.   #--------------------------------------------------------------------------
  2041.   # ● ヒット時の戦闘アニメ実行
  2042.   #--------------------------------------------------------------------------  
  2043.   def set_hit_animation(position_data, hit_anime_id, target)
  2044.     return if $data_animations[hit_anime_id] == nil
  2045.     @real_x = position_data[0]
  2046.     @real_y = position_data[1]
  2047.     @position_x = position_data[0] * 100
  2048.     @position_y = position_data[1] * 100
  2049.     self.z = position_data[2]
  2050.     @z_plus = 1000
  2051.     @action_end = false
  2052.     @horming = true
  2053.     set_animation(hit_anime_id)
  2054.     @anime_time = $data_animations[hit_anime_id].frame_max * 4
  2055.     @timing_targets = [target]
  2056.     @move_time = @hit_anime_id = 0
  2057.     @weapon_data = []
  2058.   end
  2059.   #--------------------------------------------------------------------------
  2060.   # ● タイミングバトラー追加
  2061.   #--------------------------------------------------------------------------  
  2062.   def timing_battler_set(target)
  2063.     @timing_targets.push(target)
  2064.   end
  2065.   #--------------------------------------------------------------------------
  2066.   # ● 武器の動きを取得
  2067.   #--------------------------------------------------------------------------  
  2068.   def set_weapon_move
  2069.     # 開始位置を取得
  2070.     set_battler_position if @move_time == 0
  2071.     @z_plus = 50 if @z_plus == 0 && @weapon_data[9]
  2072.     self.z = @battler.sv.z + @z_plus
  2073.     # 反転処理
  2074.     @mirror = !@mirror if @weapon_data[7]
  2075.     self.mirror = @mirror
  2076.     # 更新パターンをセット
  2077.     set_pattern
  2078.     @max_pattern = 2 if @max_pattern == 1
  2079.     # 動きを計算
  2080.     @weapon_move_data = []
  2081.     @weapon_angle_data = []
  2082.     @weapon_zoom_data = []
  2083.     num = N03.mirror_num(@mirror)
  2084.     for i in 0...@max_pattern
  2085.       move_data_x = @weapon_data[2][0] * num * 100 * i / (@max_pattern - 1)
  2086.       move_data_y = @weapon_data[2][1] * 100 * i / (@max_pattern - 1)
  2087.       move_angle = @weapon_data[4] * num + (@weapon_data[5] * num - @weapon_data[4] * num) * i / (@max_pattern - 1)
  2088.       move_zoom_x = 1 + (@weapon_data[8][0] - 1) * i / (@max_pattern - 1)
  2089.       move_zoom_y = 1 + (@weapon_data[8][1] - 1) * i / (@max_pattern - 1)
  2090.       @weapon_move_data.push([move_data_x, move_data_y])
  2091.       @weapon_angle_data.push(move_angle)
  2092.       @weapon_zoom_data.push([move_zoom_x, move_zoom_y])
  2093.     end
  2094.   end  
  2095.   #--------------------------------------------------------------------------
  2096.   # ● 更新パターン
  2097.   #--------------------------------------------------------------------------
  2098.   def set_pattern
  2099.     if @weapon_data[11] == -1
  2100.       return @max_pattern = @battler.sv.max_pattern[0] if @battler.sv.pattern_type != 0
  2101.       @count = @battler.sv.pattern_time
  2102.       @max_count = @battler.sv.pattern_time
  2103.       @max_pattern = @battler.sv.max_pattern[0]
  2104.       @repeat = false
  2105.     else
  2106.       @count = @weapon_data[11][0]
  2107.       @max_count = @weapon_data[11][0]
  2108.       @max_pattern = @weapon_data[11][1]
  2109.       @repeat = @weapon_data[11][2]
  2110.     end
  2111.     @pattern = 0
  2112.   end
  2113.   #--------------------------------------------------------------------------
  2114.   # ● 移動実行
  2115.   #--------------------------------------------------------------------------
  2116.   def set_move
  2117.     # 戦闘アニメを取得
  2118.     set_animation(@move_data[1][0]) if $data_animations[@move_data[1][0]] != nil && $data_animations[@move_data[1][0]].position != 3
  2119.     @anime_camera_zoom = @move_data[13]
  2120.     @loop = @move_data[14]
  2121.     @loop = false if @move_data[1][0] == 0
  2122.     @anime_no_mirror = @move_data[15]
  2123.     @se_flag = @move_data[17]
  2124.     # 開始位置を取得
  2125.     start_position
  2126.     @z_plus = 1000 if @move_data[9]
  2127.     # ターゲットバトラー画像にこのアニメのSEとタイミング設定を反映させる
  2128.     @timing_targets = @target_battler
  2129.     # 座標計算
  2130.     @move_x = @move_data[5][0] * 100 * N03.mirror_num(@mirror)
  2131.     @move_y = @move_data[5][1] * 100
  2132.     # 時間計算か速度計算か
  2133.     @distanse_move = true if @move_data[6] > 0
  2134.     @move_time = @move_data[6].abs
  2135.     # 時間0の場合、アニメが設定されていればアニメ表示時間に合わせる
  2136.     if @move_time == 0
  2137.       @move_time = $data_animations[@move_data[1][0]].frame_max * 4 if $data_animations[@move_data[1][0]]
  2138.       @move_time = 1 if !$data_animations[@move_data[1][0]]
  2139.       @distanse_move = false
  2140.     end
  2141.     # 貫通タイプの場合
  2142.     @through = true if @move_data[7] == 1
  2143.     @auto_through_flag = false
  2144.     @auto_through_flag = true if @move_data[7] == 0
  2145.     # ターゲット座標計算
  2146.     if @target_battler == nil
  2147.       @target_x = @move_x * 100
  2148.       @target_x = (Graphics.width - @move_x) * 100 if @mirror
  2149.       @target_y = @move_y * 100
  2150.     else
  2151.       move_data_set
  2152.     end
  2153.     # ターゲットに到達するまでの時間を計算
  2154.     @move_time = distanse_calculation(@move_time, @target_x, @target_y)
  2155.     # 円軌道計算
  2156.     orbit
  2157.     # バトラーのウエイト設定
  2158.     @battler.sv.wait = @move_time - 1 if @move_data[10][0]
  2159.     @move_horming = @move_data[12]
  2160.   end  
  2161.   #--------------------------------------------------------------------------
  2162.   # ● 速度を時間に変換
  2163.   #--------------------------------------------------------------------------
  2164.   def distanse_calculation(time, target_x, target_y)
  2165.     return time if !@distanse_move
  2166.     distanse_x = @position_x - @target_x
  2167.     distanse_x = @target_x - @position_x if @target_x > @position_x
  2168.     distanse_y = @position_y - @target_y
  2169.     distanse_y = @target_y - @position_y if @target_y > @position_y
  2170.     distanse = [distanse_x, distanse_y].max
  2171.     return distanse / (time * 100) + 1
  2172.   end
  2173.   #--------------------------------------------------------------------------
  2174.   # ● 移動目標の更新
  2175.   #--------------------------------------------------------------------------
  2176.   def move_data_set
  2177.     return if @target_battler == nil
  2178.     position = N03.get_targets_position(@target_battler, true, @anime_position)
  2179.     @target_x = position[0] + @move_x
  2180.     @target_y = position[1] - position[2] + @move_y
  2181.   end
  2182.   #--------------------------------------------------------------------------
  2183.   # ● 開始位置を計算
  2184.   #--------------------------------------------------------------------------
  2185.   def start_position
  2186.     starter = [@battler.sv.m_a_starter.shift]
  2187.     starter = N03.get_targets(@move_data[2], @battler) if @move_data[2] < 0
  2188.     position = [0, 0]
  2189.     position = N03.get_targets_position(starter, true, @anime_position) if starter != nil
  2190.     @position_x = position[0] + @move_data[4][0] * 100
  2191.     @position_y = position[1] + position[2] + @move_data[4][1] * 100
  2192.     @position_z = @position_y
  2193.   end  
  2194.   #--------------------------------------------------------------------------
  2195.   # ● 円軌道計算
  2196.   #--------------------------------------------------------------------------
  2197.   def orbit
  2198.     orbit_data = @move_data[8].dup
  2199.     orbit_data[0] *= 100
  2200.     orbit_data[1] *= 100
  2201.     orbit_d = []
  2202.     for i in 0...@move_time / 2
  2203.       @orbit[i] = orbit_data[0]
  2204.       orbit_data[0] /= 2
  2205.       orbit_d[i] = orbit_data[1]
  2206.       orbit_data[1] /= 2
  2207.     end
  2208.     @orbit = @orbit + orbit_d.reverse!
  2209.     @orbit.reverse!
  2210.   end  
  2211.   #--------------------------------------------------------------------------
  2212.   # ● フレーム更新
  2213.   #--------------------------------------------------------------------------
  2214.   def update
  2215.     update_hit_anime if @anime_time != 0
  2216.     update_move if @move_time != 0
  2217.     update_weapon_move if @weapon_data != []
  2218.     update_position
  2219.     update_color
  2220.     self.visible = @battler.sv.weapon_visible
  2221.     super
  2222.   end
  2223.   #--------------------------------------------------------------------------
  2224.   # ● ヒット時の戦闘アニメ
  2225.   #--------------------------------------------------------------------------
  2226.   def update_hit_anime
  2227.     @anime_time -= 1
  2228.     @action_end = true if @anime_time == 0
  2229.   end
  2230.   #--------------------------------------------------------------------------
  2231.   # ● 移動の更新
  2232.   #--------------------------------------------------------------------------
  2233.   def update_move
  2234.     move_data_set if @move_horming && !@hit_position
  2235.     through_set(@move_time, @target_x, @target_y) if @move_time == 1 && !@hit_position
  2236.     @o += @orbit[@move_time - 1] if @orbit[@move_time - 1] != nil
  2237.     @position_x = (@position_x * (@move_time - 1) + @target_x) / @move_time
  2238.     @position_y = (@position_y * (@move_time - 1) + @target_y) / @move_time + @o
  2239.     reset_position
  2240.     set_animation(@move_data[1][0]) if @loop && !animation?
  2241.     @move_time -= 1
  2242.     return if @move_time != 0
  2243.     @action_end = true if !@action_end_cancel
  2244.   end
  2245.   #--------------------------------------------------------------------------
  2246.   # ● 武器の動きを更新
  2247.   #--------------------------------------------------------------------------
  2248.   def update_weapon_move
  2249.     pattern = update_pattern
  2250.     set_battler_position if @move_time == 0 && !@action_end_cancel
  2251.     @real_x = @position_x / 100 + @weapon_move_data[pattern][0] / 100
  2252.     @real_y = @position_y / 100 + @weapon_move_data[pattern][1] / 100
  2253.     @real_zoom_x = @weapon_zoom_data[pattern][0]
  2254.     @real_zoom_y = @weapon_zoom_data[pattern][1]
  2255.     self.angle = @weapon_angle_data[pattern]
  2256.     self.src_rect.set(@weapon_width * pattern, 0, @weapon_width, @weapon_height) if @weapon_data[1] == 2
  2257.   end
  2258.   #--------------------------------------------------------------------------
  2259.   # ● パターンを更新
  2260.   #--------------------------------------------------------------------------
  2261.   def update_pattern
  2262.     return @battler.sv.pattern_w if @count == nil
  2263.     @count -= 1
  2264.     return @pattern if @count != 0
  2265.     @count = @max_count
  2266.     @pattern += 1
  2267.     if !@repeat && @pattern == @max_pattern
  2268.       @pattern = @max_pattern - 1
  2269.     elsif @pattern == @max_pattern
  2270.       @pattern = 0
  2271.     end
  2272.     return @pattern
  2273.   end
  2274.   #--------------------------------------------------------------------------
  2275.   # ● 座標を更新
  2276.   #--------------------------------------------------------------------------
  2277.   def update_position
  2278.     self.x = (@real_x - $sv_camera.x) * $sv_camera.convert / 1000
  2279.     self.y = (@real_y - $sv_camera.y) * $sv_camera.convert / 1000
  2280.     self.x += $sv_camera.sx / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2281.     self.y += $sv_camera.sy / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2282.     self.z = @battler.sv.z + @z_plus - 10
  2283.     self.zoom_x = @real_zoom_x * $sv_camera.zoom
  2284.     self.zoom_y = @real_zoom_y * $sv_camera.zoom
  2285.     self.opacity = @battler.sv.opacity if @battler.sv.opacity_data[4]
  2286.   end
  2287.   #--------------------------------------------------------------------------
  2288.   # ● 貫通の処理
  2289.   #--------------------------------------------------------------------------
  2290.   def through_set(time, target_x, target_y)
  2291.     @hit_anime_id = N03.get_attack_anime_id(@move_data[1][1], @battler)
  2292.     @battler.sv.wait = N03.get_anime_time(@hit_anime_id) if @move_data[10][1]
  2293.     moving_x = (target_x / 100 - @position_x / 100) / time
  2294.     moving_y = (target_y / 100 - @position_y / 100) / time
  2295.     goal_x = $sv_camera.max_left - 100 if moving_x < 0
  2296.     goal_x = Graphics.width + $sv_camera.max_right + 100 if moving_x > 0
  2297.     goal_y = $sv_camera.max_top - 100 if moving_y < 0
  2298.     goal_y = Graphics.height + $sv_camera.max_bottom + 100 if moving_y > 0
  2299.     if goal_x == nil &&  goal_y == nil
  2300.       time = 0
  2301.       reset_position
  2302.     else
  2303.       time = move_calculation(moving_x, moving_y, goal_x, goal_y)
  2304.     end
  2305.     target_x = @position_x + moving_x * time * 100
  2306.     target_y = @position_y + moving_y * time * 100
  2307.     @pre_data = [time, target_x, target_y]
  2308.     @battler.sv.m_a_data.push([@move_data[11], @target_battler, @index, @auto_through_flag, []])
  2309.     @action_end_cancel = true
  2310.     @hit_position = [@real_x, @real_y, self.z]
  2311.   end  
  2312.   #--------------------------------------------------------------------------
  2313.   # ● 到達時間試算
  2314.   #--------------------------------------------------------------------------
  2315.   def move_calculation(moving_x, moving_y, goal_x, goal_y)
  2316.     move_x = @position_x / 100
  2317.     move_y = @position_y / 100
  2318.     time = 0
  2319.     loop do
  2320.       move_x += moving_x
  2321.       move_y += moving_y
  2322.       time += 1
  2323.       return time if moving_x < 0 && move_x < goal_x
  2324.       return time if moving_x > 0 && move_x > goal_x
  2325.       return time if moving_y < 0 && move_y < goal_y
  2326.       return time if moving_y > 0 && move_y > goal_y
  2327.     end
  2328.   end   
  2329.   #--------------------------------------------------------------------------
  2330.   # ● ミス時に消える処理から貫通処理に変換
  2331.   #--------------------------------------------------------------------------
  2332.   def through_change
  2333.     @action_end_cancel = false
  2334.     @through = true
  2335.     @move_time = @pre_data[0]
  2336.     @target_x = @pre_data[1]
  2337.     @target_y = @pre_data[2]
  2338.     @pre_data = nil
  2339.   end  
  2340.   #--------------------------------------------------------------------------
  2341.   # ● SE とフラッシュのタイミング処理
  2342.   #--------------------------------------------------------------------------
  2343.   def animation_process_timing(timing)
  2344.     return if !@timing_targets
  2345.     se_flag = true
  2346.     se_flag = @se_flag if @se_flag != nil
  2347.     for target in @timing_targets
  2348.       target.sv.timing.push([se_flag, timing.dup])
  2349.       se_flag = false if @animation.position == 3
  2350.     end  
  2351.   end
  2352.   #--------------------------------------------------------------------------
  2353.   # ● 色調の更新
  2354.   #--------------------------------------------------------------------------
  2355.   def update_color
  2356.     return if @battler.sv.color == []
  2357.     self.color.set(@battler.sv.color[0], @battler.sv.color[1], @battler.sv.color[2], @battler.sv.color[3])
  2358.   end
  2359.   #--------------------------------------------------------------------------
  2360.   # ● 解放
  2361.   #--------------------------------------------------------------------------
  2362.   def dispose
  2363.     super
  2364.     self.bitmap.dispose if self.bitmap != nil
  2365.   end
  2366. end

  2367. #==============================================================================
  2368. # ■ Sprite_Battle_Picture
  2369. #------------------------------------------------------------------------------
  2370. #  ピクチャ表示用のスプライトです。
  2371. #==============================================================================
  2372. class Sprite_Battle_Picture < Sprite
  2373.   #--------------------------------------------------------------------------
  2374.   # ● 公開インスタンス変数 
  2375.   #--------------------------------------------------------------------------
  2376.   attr_accessor   :action_end           # 終了フラグ
  2377.   #--------------------------------------------------------------------------
  2378.   # ● オブジェクト初期化
  2379.   #--------------------------------------------------------------------------
  2380.   def initialize(viewport = nil)
  2381.     super(viewport)
  2382.     @action_end = false
  2383.     self.ox = 0
  2384.   end
  2385.   #--------------------------------------------------------------------------
  2386.   # ● セット
  2387.   #--------------------------------------------------------------------------
  2388.   def set(battler)
  2389.     @battler = battler
  2390.     @data = @battler.sv.effect_data.shift
  2391.     @time = @data[4]
  2392.     @mirror = $sv_camera.mirror
  2393.     @mirror = false if !@data[8]
  2394.     self.opacity = @data[6][0]
  2395.     @s_x = @data[2][0] if @data[2] != []
  2396.     @s_x = Graphics.width - @data[2][0]  if @data[2] != [] && @mirror
  2397.     @s_y = @data[2][1] if @data[2] != []
  2398.     @e_x = @data[3][0] if @data[3] != []
  2399.     @e_x = Graphics.width - @data[3][0] if @data[3] != [] && @mirror
  2400.     @e_y = @data[3][1] if @data[3] != []
  2401.     @s_x = self.x if @data[2] == []
  2402.     @s_y = self.y if @data[2] == []
  2403.     @e_x = self.x if @data[3] == []
  2404.     @e_y = self.y if @data[3] == []
  2405.     self.x = @s_x
  2406.     self.y = @s_y
  2407.     return @action_end = true if @time == 0
  2408.     @move_x = (@e_x * 1.0 - @s_x) / @time
  2409.     @move_y = (@e_y * 1.0 - @s_y) / @time
  2410.     self.z = @data[5]
  2411.     return set_plane(battler) if @data[7] != []
  2412.     self.bitmap = Cache.picture(@data[9]) if !bitmap or @data[9] != ""
  2413.     return @action_end = true if !bitmap
  2414.     self.mirror = @mirror
  2415.     self.ox = self.bitmap.width if @mirror
  2416.   end
  2417.   #--------------------------------------------------------------------------
  2418.   # ● プレーン移行
  2419.   #--------------------------------------------------------------------------
  2420.   def set_plane(battler)
  2421.     @viewport = Viewport.new(@data[2][0],@data[2][1],@data[7][0],@data[7][1]) if !@viewport
  2422.     viewport = @viewport
  2423.     @plane = Plane.new(viewport) if !@plane
  2424.     @plane.bitmap = Cache.picture(@data[9]) if !@plane.bitmap or @data[9] != ""
  2425.     return @action_end = true if !@plane.bitmap
  2426.     @plane.ox = @data[7][0]
  2427.     @plane.oy = @data[7][1]
  2428.     @plane.opacity = @data[6][0]
  2429.     @move_x = @remain_move[0] if @data[2] == @data[3]
  2430.     @move_y = @remain_move[1] if @data[2] == @data[3]
  2431.     @remain_move = [@move_x, @move_y]
  2432.   end
  2433.   #--------------------------------------------------------------------------
  2434.   # ● フレーム更新
  2435.   #--------------------------------------------------------------------------
  2436.   def update
  2437.     @action_end = true if !@battler.sv.picture
  2438.     return if @time == 0
  2439.     return if @action_end
  2440.     @time -= 1
  2441.     return plane_update if @plane
  2442.     super
  2443.     self.x += @move_x
  2444.     self.y += @move_y
  2445.     self.opacity += @data[6][1]
  2446.     return if @time != 1
  2447.     self.x = @e_x
  2448.     self.y = @e_y
  2449.     @time = 0
  2450.   end
  2451.   #--------------------------------------------------------------------------
  2452.   # ● フレーム更新
  2453.   #--------------------------------------------------------------------------
  2454.   def plane_update
  2455.     @plane.ox += @move_x
  2456.     @plane.oy += @move_y
  2457.     @plane.opacity += @data[6][1]
  2458.     @time = @data[4] if @time == 0
  2459.   end
  2460.   #--------------------------------------------------------------------------
  2461.   # ● 解放
  2462.   #--------------------------------------------------------------------------
  2463.   def dispose
  2464.     bitmap.dispose if bitmap
  2465.     @plane.dispose if @plane
  2466.     @viewport.dispose if @viewport
  2467.     super
  2468.   end
  2469. end

  2470. #==============================================================================
  2471. # ■ Sprite_Back_Picture
  2472. #------------------------------------------------------------------------------
  2473. #  周期ピクチャ用のスプライトです。
  2474. #==============================================================================
  2475. class Sprite_Back_Picture < Plane
  2476.   #--------------------------------------------------------------------------
  2477.   # ● 公開インスタンス変数 
  2478.   #--------------------------------------------------------------------------
  2479.   attr_accessor   :action_end           # 終了フラグ
  2480.   #--------------------------------------------------------------------------
  2481.   # ● オブジェクト初期化
  2482.   #--------------------------------------------------------------------------
  2483.   def initialize(viewport = nil, index)
  2484.     super(viewport)
  2485.     @index = index
  2486.     @real_x = 0
  2487.     @real_y = 0
  2488.     @real_opacity = 0
  2489.     @move_x = 0
  2490.     @move_y = 0
  2491.     @move_opacity = 0
  2492.     @time = 0
  2493.     @switche = 0
  2494.     @action_end = false
  2495.   end
  2496.   #--------------------------------------------------------------------------
  2497.   # ● セットアップ
  2498.   #--------------------------------------------------------------------------
  2499.   def setup(data)
  2500.     self.bitmap = Cache.picture(data[9])
  2501.     self.z = data[6]
  2502.     @switche = data[1]
  2503.     mirror = $sv_camera.mirror
  2504.     mirror = false if !data[8]
  2505.     @move_x = data[3][0]
  2506.     @move_x *= -1 if mirror
  2507.     @move_y = data[3][1]
  2508.     @time = data[4]
  2509.     @time = -1 if @time == 0
  2510.     @real_opacity = (data[5][0] + 1) * 100
  2511.     @move_opacity = data[5][1]
  2512.     @start_opacity = data[5][0]
  2513.     @shake_ok = data[7]
  2514.   end
  2515.   #--------------------------------------------------------------------------
  2516.   # ● フレーム更新
  2517.   #--------------------------------------------------------------------------
  2518.   def update
  2519.     update_picture if @time != 0
  2520.     self.ox = $sv_camera.x - @real_x
  2521.     self.oy = $sv_camera.y - @real_y
  2522.     if @shake_ok
  2523.       self.ox -= $sv_camera.sx / 100
  2524.       self.oy -= $sv_camera.sy / 100
  2525.     end
  2526.     self.ox *= $sv_camera.zoom
  2527.     self.oy *= $sv_camera.zoom
  2528.     self.zoom_x = @zoom_x * $sv_camera.zoom
  2529.     self.zoom_y = @zoom_y * $sv_camera.zoom
  2530.     self.opacity = @real_opacity / 100
  2531.     @move_opacity *= -1 if self.opacity == 255 or self.opacity <= @start_opacity
  2532.     @switche
  2533.     @action_end = true if @switche > 0 && !$game_switches[@switche]
  2534.     @action_end = true if @switche < 0 && !$sv_camera.switches[@switche.abs]
  2535.   end
  2536.   #--------------------------------------------------------------------------
  2537.   # ● ピクチャの更新
  2538.   #--------------------------------------------------------------------------
  2539.   def update_picture
  2540.     @real_x += @move_x / 100
  2541.     @real_y += @move_y / 100
  2542.     @real_x = 0 if @real_x >= self.bitmap.width or @real_x <= -self.bitmap.width
  2543.     @real_y = 0 if @real_y >= self.bitmap.height or @real_y <= -self.bitmap.height
  2544.     @zoom_x = 1
  2545.     @zoom_y = 1
  2546.     @real_opacity += @move_opacity
  2547.     @time -= 1
  2548.     @time = -1 if @time < -100
  2549.   end
  2550. end

  2551. #==============================================================================
  2552. # ■ Sprite_Back_Picture
  2553. #------------------------------------------------------------------------------
  2554. #  ダメージ表示のスプライトです。
  2555. #==============================================================================
  2556. class Sprite_Damage < Sprite
  2557.   #--------------------------------------------------------------------------
  2558.   # ● 公開インスタンス変数 
  2559.   #--------------------------------------------------------------------------
  2560.   attr_reader   :action_end                  # POP終了フラグ
  2561.   #--------------------------------------------------------------------------
  2562.   # ● オブジェクト初期化
  2563.   #--------------------------------------------------------------------------
  2564.   def initialize(viewport = nil, battler)
  2565.     super(viewport)
  2566.     @battler = battler
  2567.     @time = 0
  2568.     return @action_end = true if !@battler
  2569.     @direction = -1
  2570.     @direction *= -1 if @battler.actor?
  2571.     @direction *= -1 if $sv_camera.mirror
  2572.     set_state
  2573.     set_damage
  2574.     update
  2575.   end
  2576.   #--------------------------------------------------------------------------
  2577.   # ● ステート表示
  2578.   #--------------------------------------------------------------------------
  2579.   def set_state
  2580.     return if !N03::STATE_POP
  2581.     states = @battler.result.added_state_objects
  2582.     states.delete($data_states[@battler.death_state_id]) if @battler.result.hp_damage != 0
  2583.     return if states == []
  2584.     return if @battler.sv.add_state == @battler.result.added_state_objects
  2585.     @battler.sv.add_state = states.dup
  2586.     @st = []
  2587.     @st_base = []
  2588.     for i in 0...states.size
  2589.       @st[i] = Sprite.new
  2590.       bitmap_state(@st[i], states[i])
  2591.       @st_base[i] = []
  2592.       @st_base[i][0] = @direction * (-20 + 5 * i) + @battler.sv.x / 100
  2593.       @st_base[i][1] = -40 - @state_height * i + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2594.       @st[i].z = 1000 + i
  2595.       @st[i].opacity = 0
  2596.     end
  2597.     @time = @pop_time = 80
  2598.   end   
  2599.   #--------------------------------------------------------------------------
  2600.   # ● ステート画像
  2601.   #--------------------------------------------------------------------------
  2602.   def bitmap_state(state, state_object)
  2603.     name = state_object.name
  2604.     state.bitmap = Cache.system("Iconset").dup
  2605.     state.src_rect.set(state_object.icon_index % 16 * 24, state_object.icon_index / 16 * 24, 24, 24)
  2606.     @state_height = 24
  2607.   end
  2608.   #--------------------------------------------------------------------------
  2609.   # ● ダメージ表示
  2610.   #--------------------------------------------------------------------------
  2611.   def hit_count
  2612.     for i in 0...@battler.sv.hit.size
  2613.       if @battler.sv.hit[i] == nil
  2614.         @hit = i
  2615.         return @battler.sv.hit[i] = @hit
  2616.       end
  2617.     end
  2618.     @hit = @battler.sv.hit.size
  2619.     @battler.sv.hit.push(@hit)
  2620.   end  
  2621.   #--------------------------------------------------------------------------
  2622.   # ● ダメージ表示
  2623.   #--------------------------------------------------------------------------
  2624.   def set_damage
  2625.     return @action_end = true if !N03::DAMAGE_POP
  2626.     damage = @battler.result.hp_damage if @battler.result.hp_damage != 0
  2627.     damage = @battler.result.hp_drain  if @battler.result.hp_drain  != 0
  2628.     damage = @battler.result.mp_damage if @battler.result.mp_damage != 0
  2629.     damage = @battler.result.mp_drain  if @battler.result.mp_drain  != 0
  2630.     damage = @battler.result.tp_damage if @battler.result.tp_damage != 0
  2631.     if !damage or damage == 0
  2632.       @action_end = true if @st == nil
  2633.       return # ステートだけPOPする設定を考慮して@action_endは返さない
  2634.     end
  2635.     hit_count
  2636.     #@hit = @battler.sv.hit
  2637.     #@battler.sv.hit += 1 if damage != 0
  2638.     file = N03::DAMAGE_PLUS if damage > 0
  2639.     file = N03::DAMAGE_MINUS if damage < 0
  2640.     add_file = N03::DAMAGE_MP if @battler.result.mp_damage != 0
  2641.     add_file = N03::DAMAGE_TP if @battler.result.tp_damage != 0
  2642.     adjust_x = N03::DAMAGE_ADJUST
  2643.     @num = []
  2644.     @num_base = []
  2645.     damage = damage.abs
  2646.     max_num = damage.to_s.size
  2647.     max_num += 1 if add_file != nil
  2648.     for i in 0...max_num
  2649.       @num[i] = Sprite.new
  2650.       if add_file != nil && i == max_num - 1
  2651.         @num[i].bitmap = Cache.system(add_file)
  2652.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2653.         sw = 0 if sw == nil
  2654.       else
  2655.         @num[i].bitmap = Cache.system(file)
  2656.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2657.         sw = @num[i].bitmap.width / 10
  2658.         @num[i].src_rect.set(cw * sw, 0, sw, @num[i].bitmap.height)
  2659.       end
  2660.       @num_base[i] = []
  2661.       @num_base[i][0] = (sw + adjust_x) * i * -1 + (@battler.sv.x / 100)
  2662.       @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
  2663.       @num_base[i][0] -= @num[i].bitmap.width / 2 - adjust_x if add_file != nil && i == max_num - 1
  2664.       @num[i].z = 1000 + i + @hit * 10
  2665.     end
  2666.     @time = @pop_time = 80
  2667.   end
  2668.   #--------------------------------------------------------------------------
  2669.   # ● フレーム更新
  2670.   #--------------------------------------------------------------------------
  2671.   def update
  2672.     return if @time == 0
  2673.     for i in 0...@st.size do update_state_move(@st[i], i) end if @st != nil
  2674.     for i in 0...@num.size do update_num_move(@num[i], i) end if @num != nil
  2675.     @time -= 1
  2676.     @action_end = true if @time == 0
  2677.   end
  2678.   #--------------------------------------------------------------------------
  2679.   # ● ステート画像の更新
  2680.   #--------------------------------------------------------------------------
  2681.   def update_state_move(state, index)
  2682.     min = @pop_time - index * 2
  2683.     case @time
  2684.     when min-15..min
  2685.       @st_base[index][0] += @direction
  2686.       state.opacity += 25
  2687.     when min-80..min-50
  2688.       @st_base[index][0] += @direction
  2689.       state.opacity -= 25
  2690.     end
  2691.     state.x = (@st_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2692.     state.y = (@st_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2693.   end
  2694.   #--------------------------------------------------------------------------
  2695.   # ● 数値の更新
  2696.   #--------------------------------------------------------------------------
  2697.   def update_num_move(num, index)
  2698.     min = @pop_time - index * 2
  2699.     case @time
  2700.     when min-1..min
  2701.       @num_base[index][0] += @direction * @hit
  2702.       @num_base[index][1] -= 5 + @hit * 2
  2703.     when min-3..min-2
  2704.       @num_base[index][0] += @direction * @hit
  2705.       @num_base[index][1] -= 4 + @hit * 2
  2706.     when min-6..min-4
  2707.       @num_base[index][0] += @direction
  2708.       @num_base[index][1] -= 3 + @hit * 2
  2709.     when min-14..min-7
  2710.       @num_base[index][0] += @direction
  2711.       @num_base[index][1] += 2
  2712.     when min-17..min-15
  2713.       @num_base[index][1] -= 2 + @hit * 2
  2714.     when min-23..min-18
  2715.       @num_base[index][1] += 1
  2716.     when min-27..min-24
  2717.       @num_base[index][1] -= 1
  2718.     when min-30..min-28
  2719.       @num_base[index][1] += 1
  2720.     when min-33..min-31
  2721.       @num_base[index][1] -= 1
  2722.     when min-36..min-34
  2723.       @num_base[index][1] += 1
  2724.     end
  2725.     num.x = (@num_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2726.     num.y = (@num_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2727.     num.opacity = 256 - (12 - @time) * 32
  2728.     num.visible = false if @time == 0
  2729.   end
  2730.   #--------------------------------------------------------------------------
  2731.   # ● 解放
  2732.   #--------------------------------------------------------------------------
  2733.   def dispose
  2734.     @battler.sv.hit[@hit] = nil if @hit
  2735.     bitmap.dispose if bitmap
  2736.     for i in 0...@num.size do @num[i].dispose end if @num != nil
  2737.     for i in 0...@st.size do @st[i].dispose end if @st != nil
  2738.     super
  2739.   end
  2740. end

  2741. #==============================================================================
  2742. # ■ Window_Skill_name
  2743. #------------------------------------------------------------------------------
  2744. #  スキル名を表示するウィンドウです。
  2745. #==============================================================================
  2746. class Window_Skill_name < Window_Base
  2747.   #--------------------------------------------------------------------------
  2748.   # ● オブジェクト初期化
  2749.   #--------------------------------------------------------------------------
  2750.   def initialize(text)
  2751.     super(0, 0, Graphics.width, line_height + standard_padding * 2)
  2752.     draw_text(4, 0, Graphics.width - 64, line_height,text, 1)
  2753.   end
  2754. end

  2755. #==============================================================================
  2756. # ■ Spriteset_Sideview
  2757. #------------------------------------------------------------------------------
  2758. #  サイドビュー独自のスプライトをまとめたクラスです。
  2759. #==============================================================================
  2760. class Spriteset_Sideview
  2761.   #--------------------------------------------------------------------------
  2762.   # ● オブジェクト初期化
  2763.   #--------------------------------------------------------------------------
  2764.   def initialize(viewport)
  2765.     @viewport = viewport
  2766.     @weapons = []
  2767.     @pictures = []
  2768.     @back_pic = []
  2769.     @damage = []
  2770.     $sv_camera.setup
  2771.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup)
  2772.   end
  2773.   #--------------------------------------------------------------------------
  2774.   # ● フレーム更新
  2775.   #--------------------------------------------------------------------------
  2776.   def update
  2777.     update_battler_data
  2778.     update_damage
  2779.     update_pictures
  2780.     update_back_pic
  2781.     update_weapons
  2782.   end  
  2783.   #--------------------------------------------------------------------------
  2784.   # ● バトラーデータの更新
  2785.   #--------------------------------------------------------------------------
  2786.   def update_battler_data
  2787.     for battler in $game_party.battle_members + $game_troop.members
  2788.       weapon_end(battler) if battler.sv.weapon_end
  2789.       next if battler.sv.effect_data == []
  2790.       for effect_data in battler.sv.effect_data do set_effects(battler, effect_data) end
  2791.     end
  2792.   end
  2793.   #--------------------------------------------------------------------------
  2794.   # ● ダメージ画像の更新
  2795.   #--------------------------------------------------------------------------
  2796.   def update_damage
  2797.     for i in 0...@damage.size
  2798.       next if @damage[i] == nil
  2799.       @damage[i].update if @damage[i] != nil
  2800.       next if !@damage[i].action_end
  2801.       @damage[i].dispose
  2802.       @damage[i] = nil
  2803.     end
  2804.   end
  2805.   #--------------------------------------------------------------------------
  2806.   # ● ピクチャアクションの更新
  2807.   #--------------------------------------------------------------------------
  2808.   def update_pictures
  2809.     for i in 0...@pictures.size
  2810.       next if @pictures[i] == nil
  2811.       @pictures[i].update if @pictures[i] != nil
  2812.       next if !@pictures[i].action_end
  2813.       @pictures[i].dispose
  2814.       @pictures[i] = nil
  2815.     end
  2816.   end
  2817.   #--------------------------------------------------------------------------
  2818.   # ● 周期ピクチャの更新
  2819.   #--------------------------------------------------------------------------
  2820.   def update_back_pic
  2821.     set_back_pic if $sv_camera.program_picture != []
  2822.     for i in 0...@back_pic.size
  2823.       next if @back_pic[i] == nil
  2824.       @back_pic[i].update if @back_pic[i] != nil
  2825.       next if !@back_pic[i].action_end
  2826.       @back_pic[i].dispose
  2827.       @back_pic[i] = nil
  2828.     end
  2829.   end
  2830.   #--------------------------------------------------------------------------
  2831.   # ● 武器アクションの更新
  2832.   #--------------------------------------------------------------------------
  2833.   def update_weapons
  2834.     for i in 0...@weapons.size
  2835.       next if @weapons[i] == nil
  2836.       @weapons[i].update if @weapons[i] != nil
  2837.       next if !@weapons[i].action_end
  2838.       @weapons[i].dispose
  2839.       @weapons[i] = nil
  2840.     end
  2841.   end
  2842.   #--------------------------------------------------------------------------
  2843.   # ● ダメージ実行
  2844.   #--------------------------------------------------------------------------
  2845.   def set_damage_pop(target)
  2846.     for i in 0...@damage.size
  2847.       next if @damage[i] != nil
  2848.       return @damage[i] = Sprite_Damage.new(@viewport, target)
  2849.     end
  2850.     @damage.push(Sprite_Damage.new(@viewport, target))
  2851.   end
  2852.   #--------------------------------------------------------------------------
  2853.   # ● 周期ピクチャ実行
  2854.   #--------------------------------------------------------------------------
  2855.   def set_back_pic
  2856.     for data in $sv_camera.program_picture
  2857.       if @back_pic[data[2]] != nil
  2858.         @back_pic[data[2]].dispose
  2859.         @back_pic[data[2]] = nil
  2860.       end
  2861.       @back_pic[data[2]] = Sprite_Back_Picture.new(@viewport, data[2])
  2862.       @back_pic[data[2]].setup(data)
  2863.     end
  2864.     $sv_camera.program_picture = []
  2865.   end
  2866.   #--------------------------------------------------------------------------
  2867.   # ● エフェクト開始
  2868.   #--------------------------------------------------------------------------
  2869.   def set_effects(battler, effect_data)
  2870.     case effect_data[0]
  2871.     when "pic" ; set_pictures(battler, effect_data)
  2872.     when  "wp" ; set_weapons(battler,  true)
  2873.     when "m_a" ; set_weapons(battler, false)
  2874.     end
  2875.   end
  2876.   #--------------------------------------------------------------------------
  2877.   # ● ピクチャアクション実行
  2878.   #--------------------------------------------------------------------------
  2879.   def set_pictures(battler, effect_data)
  2880.     @pictures[effect_data[1]] = Sprite_Battle_Picture.new if @pictures[effect_data[1]] == nil
  2881.     @pictures[effect_data[1]].set(battler)
  2882.   end
  2883.   #--------------------------------------------------------------------------
  2884.   # ● 武器アクション実行
  2885.   #--------------------------------------------------------------------------
  2886.   def set_weapons(battler, weapon_flag, test = true)
  2887.     for i in 0...@weapons.size
  2888.       next if @weapons[i] != nil
  2889.       @weapons[i] = Sprite_Weapon.new(@viewport, i, battler)
  2890.       battler.sv.weapon_index.push(i) if weapon_flag
  2891.       return i
  2892.     end
  2893.     @weapons.push(Sprite_Weapon.new(@viewport, @weapons.size, battler))
  2894.     battler.sv.weapon_index.push(@weapons.size - 1) if weapon_flag
  2895.     return @weapons.size - 1
  2896.   end
  2897.   #--------------------------------------------------------------------------
  2898.   # ● バトラーの武器アクション終了
  2899.   #--------------------------------------------------------------------------
  2900.   def weapon_end(battler)
  2901.     battler.sv.weapon_end = false
  2902.     for index in battler.sv.weapon_index
  2903.       weapon_index = battler.sv.weapon_index.shift
  2904.       @weapons[weapon_index].dispose if @weapons[weapon_index] != nil
  2905.       @weapons[weapon_index] = nil
  2906.     end
  2907.     battler.sv.weapon_index.compact!
  2908.   end  
  2909.   #--------------------------------------------------------------------------
  2910.   # ● ヒット時の戦闘アニメ実行
  2911.   #--------------------------------------------------------------------------
  2912.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  2913.     weapon = @weapons[weapon_index]
  2914.     for target in hit_targets
  2915.       next @weapons[@hit_index].timing_battler_set(target) if @hit_index != nil
  2916.       @hit_index = set_weapons(battler, false, false)
  2917.       @weapons[@hit_index].set_hit_animation(weapon.hit_position, weapon.hit_anime_id, target)
  2918.     end
  2919.     @hit_index = nil
  2920.     if !weapon.through && !miss
  2921.       @weapons[weapon_index].dispose
  2922.       @weapons[weapon_index] = nil
  2923.     else
  2924.       @weapons[weapon_index].through_change
  2925.     end
  2926.   end
  2927.   #--------------------------------------------------------------------------
  2928.   # ● サイドビューデータの初期化
  2929.   #--------------------------------------------------------------------------
  2930.   def reset_sideview
  2931.     $sv_camera.reset
  2932.     for member in $game_troop.members + $game_party.battle_members do member.sv.reset end
  2933.   end  
  2934.   #--------------------------------------------------------------------------
  2935.   # ● 解放
  2936.   #--------------------------------------------------------------------------
  2937.   def dispose
  2938.     dispose_effects(@weapons)
  2939.     dispose_effects(@pictures)
  2940.     dispose_effects(@back_pic)
  2941.     dispose_effects(@damage)
  2942.     reset_sideview
  2943.   end
  2944.   #--------------------------------------------------------------------------
  2945.   # ● エフェクト画像の解放
  2946.   #--------------------------------------------------------------------------
  2947.   def dispose_effects(effects)
  2948.     for i in 0...effects.size
  2949.       effects[i].dispose if effects[i] != nil
  2950.       effects[i] = nil
  2951.     end
  2952.   end
  2953. end


  2954. #==============================================================================
  2955. # ■ Sprite_Battle_Back
  2956. #------------------------------------------------------------------------------
  2957. #  戦闘背景用のスプライトです。
  2958. #==============================================================================
  2959. class Sprite_Battle_Back < Plane
  2960.   #--------------------------------------------------------------------------
  2961.   # ● オブジェクト初期化
  2962.   #--------------------------------------------------------------------------
  2963.   def initialize(viewport = nil, index, battleback_name)
  2964.     super(viewport)
  2965.     @index = index
  2966.     if @index == 1
  2967.       data = N03::FLOOR1_DATA[battleback_name]
  2968.       data = N03::FLOOR1_DATA["全Battlebacks1"] if data == nil
  2969.     elsif @index == 2
  2970.       data = N03::FLOOR2_DATA[battleback_name]
  2971.       data = N03::FLOOR2_DATA["全Battlebacks2"] if data == nil
  2972.     end   
  2973.     data = data.dup
  2974.     @adjust_position = data[0]
  2975.     @zoom_x = data[1][0] / 100.0
  2976.     @zoom_y = data[1][1] / 100.0
  2977.     @shake_on = data[2]
  2978.     $game_switches[data[3]] = true if data[3] > 0
  2979.     $sv_camera.switches[data[3].abs] = true if data[3] < 0
  2980.     reset_scroll
  2981.     reset_back_data(battleback_name)
  2982.   end
  2983.   #--------------------------------------------------------------------------
  2984.   # ● 背景スクロールを初期化
  2985.   #--------------------------------------------------------------------------
  2986.   def reset_scroll
  2987.     @scroll_x = 0
  2988.     @scroll_y = 0
  2989.     @move_x = 0
  2990.     @move_y = 0
  2991.   end
  2992.   #--------------------------------------------------------------------------
  2993.   # ● 背景データを初期化
  2994.   #--------------------------------------------------------------------------
  2995.   def reset_back_data(battleback_name)
  2996.     @back_data = []
  2997.     @active_data = ["scroll",0, @move_x, @move_y, false, battleback_name,""]
  2998.     start_back_data(@active_data)
  2999.   end  
  3000.   #--------------------------------------------------------------------------
  3001.   # ● 背景画像のセッティング
  3002.   #--------------------------------------------------------------------------
  3003.   def set_graphics(new_bitmap)
  3004.     self.bitmap = new_bitmap
  3005.     @base_x = (self.bitmap.width * @zoom_x - Graphics.width) / 2 + @adjust_position[0]
  3006.     @base_y = (self.bitmap.height * @zoom_y - Graphics.height) / 2 + @adjust_position[1]
  3007.     # 限界座標を取得
  3008.     max_top =  0
  3009.     max_bottom = self.bitmap.height * @zoom_y - Graphics.height
  3010.     max_left = 0
  3011.     max_right = self.bitmap.width * @zoom_x - Graphics.width
  3012.     exist = true
  3013.     exist = false if self.bitmap.height == 32 && self.bitmap.width == 32
  3014.     $sv_camera.setting(@index, [max_top, max_bottom, max_left, max_right, @base_x, @base_y,exist])
  3015.   end
  3016.   #--------------------------------------------------------------------------
  3017.   # ● フレーム更新
  3018.   #--------------------------------------------------------------------------
  3019.   def update
  3020.     return if !bitmap
  3021.     update_back_data
  3022.     update_scroll unless @move_x == 0 && @move_y == 0
  3023.     update_color
  3024.     update_position
  3025.     update_back_adjust if @bt_back != nil
  3026.     create_back_adjust if @bt_back == nil && !@active_data[10] && @scroll_x == 0 && @scroll_y == 0
  3027.   end
  3028.   #--------------------------------------------------------------------------
  3029.   # ● 背景データを更新
  3030.   #--------------------------------------------------------------------------
  3031.   def update_back_data
  3032.     delete = true if @active_data[1] > 0 && !$game_switches[@active_data[1]]
  3033.     delete = true if @active_data[1] < 0 && !$sv_camera.switches[@active_data[1].abs]
  3034.     return if !delete
  3035.     for i in 0...@back_data.size
  3036.       @back_data[i] = nil if @back_data[i][1] > 0 && !$game_switches[@back_data[i][1]]
  3037.       @back_data[i] = nil if @back_data[i][1] < 0 && !$sv_camera.switches[@back_data[i][1].abs]
  3038.     end
  3039.     @back_data.compact!
  3040.     next_back_data
  3041.   end
  3042.   #--------------------------------------------------------------------------
  3043.   # ● 次の背景データをセット
  3044.   #--------------------------------------------------------------------------
  3045.   def next_back_data
  3046.     @back_data.delete(@active_data[11]) if @active_data[11] != nil
  3047.     @back_data.push(@active_data[11]) if @active_data[11] != nil
  3048.     @active_data = nil
  3049.     data = @back_data.pop
  3050.     @back_data = [@active_data] if @back_data.size == 0
  3051.     start_back_data(data)
  3052.   end  
  3053.   #--------------------------------------------------------------------------
  3054.   # ● 背景データを実行
  3055.   #--------------------------------------------------------------------------
  3056.   def start_back_data(data)
  3057.     return if back_data_remain(data)
  3058.     bt_back_dispose
  3059.     pre_active_data = @active_data
  3060.     @active_data[8] = [@back_name, @move_x, @move_y, @scroll_x, @scroll_y] if @active_data != nil
  3061.     @back_data.push(@active_data)     if @active_data != nil
  3062.     @active_data = data.dup
  3063.     @active_data[5] = @back_name      if @active_data[5] == ""
  3064.     @active_data[9] = set_back_adjust if @active_data[9] == nil
  3065.     back_data_scroll_on               if @active_data[8] == nil && @active_data[9][0] == false
  3066.     set_remain_back_data              if @active_data[8] != nil
  3067.     create_back(@active_data[5])      if @active_data[9][0] == false
  3068.     create_back_adjust                if @active_data[10]
  3069.     @active_data[11] = pre_active_data if pre_active_data && @active_data[7] == false
  3070.   end  
  3071.   #--------------------------------------------------------------------------
  3072.   # ● 背景データの保留
  3073.   #--------------------------------------------------------------------------
  3074.   def back_data_remain(data)
  3075.     remain = false
  3076.     remain = true if data[6] != "" && @active_data != nil && @active_data[9] != nil && @active_data[9][0] != false
  3077.     remain = true if @active_data != nil && @active_data[7] == false
  3078.     return remain if !remain
  3079.     @remain = true
  3080.     @back_data.push(data)
  3081.     return remain
  3082.   end  
  3083.   #--------------------------------------------------------------------------
  3084.   # ● 背景変更補正データをセット
  3085.   #--------------------------------------------------------------------------
  3086.   def set_back_adjust
  3087.     bt_adjust = []
  3088.     sign = -1
  3089.     if @active_data[6] == ""
  3090.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  3091.       bt_adjust = [false,false,0,0]
  3092.       return bt_adjust
  3093.     elsif @move_x != 0 or @active_data[3][0] != 0
  3094.       sign = 1 if @move_x < 0
  3095.       bt_adjust[0] = [self.bitmap.width * @zoom_x * sign, 0]
  3096.       bt_adjust[1] = [self.bitmap.width * @zoom_x * sign * 2, 0]
  3097.     elsif @move_y != 0 or @active_data[3][1] != 0
  3098.       sign = 1 if @move_y < 0
  3099.       bt_adjust[0] = [0, self.bitmap.height * @zoom_y * sign]
  3100.       bt_adjust[1] = [0, self.bitmap.height * @zoom_y * sign * 2]
  3101.     else
  3102.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  3103.       bt_adjust = [false,false,0,0]
  3104.       return bt_adjust
  3105.     end
  3106.     bt_adjust[2] = [bt_adjust[0][0], bt_adjust[0][1]]
  3107.     return bt_adjust
  3108.   end
  3109.   #--------------------------------------------------------------------------
  3110.   # ● 背景スクロールデータを実行
  3111.   #--------------------------------------------------------------------------
  3112.   def back_data_scroll_on
  3113.     mirror = $sv_camera.mirror
  3114.     mirror = false if !@active_data[4]
  3115.     @move_x = @active_data[3][0]
  3116.     @move_x *= -1 if mirror
  3117.     @move_y = @active_data[3][1]
  3118.   end
  3119.   #--------------------------------------------------------------------------
  3120.   # ● 保持している背景データを実行
  3121.   #--------------------------------------------------------------------------
  3122.   def set_remain_back_data
  3123.     return back_data_scroll_on if @move_x != 0 or @move_y != 0
  3124.     create_back(@active_data[8][0])
  3125.     @move_x    = @active_data[8][1]
  3126.     @move_y    = @active_data[8][2]
  3127.     @scroll_x  = @active_data[8][3]
  3128.     @scroll_y  = @active_data[8][4]
  3129.   end  
  3130.   #--------------------------------------------------------------------------
  3131.   # ● 背景画像の作成
  3132.   #--------------------------------------------------------------------------
  3133.   def create_back(back_name)
  3134.     return if back_name == @back_name or back_name == ""
  3135.     self.bitmap = Cache.battleback1(back_name) if @index == 1
  3136.     self.bitmap = Cache.battleback2(back_name) if @index == 2
  3137.     @back_name = back_name
  3138.   end  
  3139.   #--------------------------------------------------------------------------
  3140.   # ● 背景変更補正画像の作成
  3141.   #--------------------------------------------------------------------------
  3142.   def create_back_adjust
  3143.     return if @active_data[9][0] == false
  3144.     @active_data[10] = true
  3145.     mirror = $sv_camera.mirror
  3146.     mirror = false if !@active_data[4]
  3147.     @bt_back = []
  3148.     @bt_back[0] = Sprite.new(viewport)
  3149.     @bt_back[0].bitmap = Cache.battleback1(@active_data[6]) if @index == 1
  3150.     @bt_back[0].bitmap = Cache.battleback2(@active_data[6]) if @index == 2
  3151.     @bt_back[0].mirror = mirror
  3152.     @bt_back[1] = Sprite.new(viewport)
  3153.     @bt_back[1].bitmap = Cache.battleback1(@active_data[5]) if @index == 1
  3154.     @bt_back[1].bitmap = Cache.battleback2(@active_data[5]) if @index == 2
  3155.     @bt_back[1].mirror = mirror
  3156.   end
  3157.   #--------------------------------------------------------------------------
  3158.   # ● 背景スクロールの更新
  3159.   #--------------------------------------------------------------------------
  3160.   def update_scroll
  3161.     @scroll_x += @move_x
  3162.     @scroll_y += @move_y
  3163.     @scroll_x = 0 if @scroll_x / 100 >= self.bitmap.width * @zoom_x or @scroll_x / 100 <= -self.bitmap.width * @zoom_x
  3164.     @scroll_y = 0 if @scroll_y / 100 >= self.bitmap.height * @zoom_y or @scroll_y / 100 <= -self.bitmap.height * @zoom_y
  3165.   end
  3166.   #--------------------------------------------------------------------------
  3167.   # ● 色調変更の更新
  3168.   #--------------------------------------------------------------------------
  3169.   def update_color
  3170.     color_set if $sv_camera.color_set[@index] != nil
  3171.     return if @color_data == nil
  3172.     @color_data[4] -= 1
  3173.     if @color_data[4] == 0 && @color_data[5] != 0
  3174.       @color_data[4] = @color_data[5]
  3175.       @color_data[5] = 0
  3176.       @color_data[6] = [0,0,0,0]
  3177.     elsif @color_data[4] == 0
  3178.       @remain_color_data = @color_data
  3179.       return @color_data = nil
  3180.     end  
  3181.     for i in 0..3
  3182.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  3183.     end  
  3184.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  3185.   end
  3186.   #--------------------------------------------------------------------------
  3187.   # ● 座標の更新
  3188.   #--------------------------------------------------------------------------
  3189.   def update_position
  3190.     self.ox = $sv_camera.x + @base_x - @scroll_x / 100
  3191.     self.oy = $sv_camera.y + @base_y - @scroll_y / 100
  3192.     self.ox -= $sv_camera.sx / 100 if @shake_on
  3193.     self.oy -= $sv_camera.sy / 100 if @shake_on
  3194.     self.zoom_x = @zoom_x * $sv_camera.zoom
  3195.     self.zoom_y = @zoom_y * $sv_camera.zoom
  3196.     self.ox *= $sv_camera.zoom
  3197.     self.oy *= $sv_camera.zoom
  3198.     self.z = @index * 10
  3199.   end
  3200.   #--------------------------------------------------------------------------
  3201.   # ● 背景変更補正画像を更新
  3202.   #--------------------------------------------------------------------------
  3203.   def update_back_adjust
  3204.     @active_data[9][0][0] = 0 if @scroll_x == 0
  3205.     @active_data[9][0][1] = 0 if @scroll_y == 0
  3206.     @active_data[9][1][0] -= @active_data[9][2][0] if @scroll_x == 0
  3207.     @active_data[9][1][1] -= @active_data[9][2][1] if @scroll_y == 0
  3208.     for i in 0...@bt_back.size
  3209.       @bt_back[i].x = -self.ox + @active_data[9][i][0] * $sv_camera.zoom
  3210.       @bt_back[i].y = -self.oy + @active_data[9][i][1] * $sv_camera.zoom
  3211.       @bt_back[i].zoom_x = self.zoom_x
  3212.       @bt_back[i].zoom_y = self.zoom_y
  3213.       @bt_back[i].z = self.z + 1
  3214.       @bt_back[i].color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  3215.     end
  3216.     back_data_scroll_on if @active_data[9][0][0] == 0 && @active_data[9][0][1] == 0
  3217.     return unless @active_data[9][1][0] == 0 && @active_data[9][1][1] == 0
  3218.     bt_back_dispose
  3219.     create_back(@active_data[5])
  3220.     @active_data[9][0] = false
  3221.     next_back_data if @remain && @back_data.size != 1
  3222.     @remain = false
  3223.   end
  3224.   #--------------------------------------------------------------------------
  3225.   # ● 色調変更
  3226.   #--------------------------------------------------------------------------
  3227.   def color_set
  3228.     set = $sv_camera.color_set[@index]
  3229.     $sv_camera.color_set[@index] = nil
  3230.     set[4] = 1 if set[4] == 0
  3231.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  3232.     @color_data = @remain_color_data
  3233.     @color_data[4] = set[4]
  3234.     @color_data[5] = set[5]
  3235.     @color_data[6] = set
  3236.   end
  3237.   #--------------------------------------------------------------------------
  3238.   # ● 背景変更補正画像の解放
  3239.   #--------------------------------------------------------------------------
  3240.   def bt_back_dispose
  3241.     for i in 0...@bt_back.size do @bt_back[i].dispose end if @bt_back != nil
  3242.     @bt_back = nil
  3243.   end  
  3244.   #--------------------------------------------------------------------------
  3245.   # ● 解放
  3246.   #--------------------------------------------------------------------------
  3247.   def dispose
  3248.     bitmap.dispose if bitmap
  3249.     bt_back_dispose
  3250.     super
  3251.   end
  3252. end  
  3253.   
  3254. #==============================================================================
  3255. # ■ Battle_Camera
  3256. #------------------------------------------------------------------------------
  3257. #  戦闘カメラやバトルプログラムを扱うクラスです。
  3258. #==============================================================================
  3259. class Battle_Camera
  3260.   #--------------------------------------------------------------------------
  3261.   # ● 公開インスタンス変数 
  3262.   #--------------------------------------------------------------------------
  3263.   attr_reader   :sx                 # シェイクX座標
  3264.   attr_reader   :sy                 # シェイクY座標
  3265.   attr_reader   :max_top            # 上限界座標
  3266.   attr_reader   :max_bottom         # 下限界座標
  3267.   attr_reader   :max_left           # 左限界座標
  3268.   attr_reader   :max_right          # 右限界座標
  3269.   attr_accessor :switches           # サイドビュー専用スイッチ
  3270.   attr_accessor :color_set          # 色調変更データ
  3271.   attr_accessor :wait               # 戦闘シーンの強制ウエイト
  3272.   attr_accessor :win_wait           # 戦闘勝利前のウエイト
  3273.   attr_accessor :mirror             # 画面反転フラグ
  3274.   attr_accessor :program_scroll     # バトルプログラム 背景の自動スクロール
  3275.   attr_accessor :program_picture    # バトルプログラム 周期ピクチャ
  3276.   attr_accessor :event              # コモンイベント呼び出し
  3277.   #--------------------------------------------------------------------------
  3278.   # ● オブジェクト初期化
  3279.   #--------------------------------------------------------------------------
  3280.   def initialize
  3281.     @switches = []
  3282.     @max_data = []
  3283.     @color_set = []
  3284.     @wait = 0
  3285.     @win_wait = false
  3286.     @mirror = false
  3287.     @event = false
  3288.     setup
  3289.   end
  3290.   #--------------------------------------------------------------------------
  3291.   # ● カメラX座標
  3292.   #--------------------------------------------------------------------------
  3293.   def x
  3294.     return @x / 100
  3295.   end
  3296.   #--------------------------------------------------------------------------
  3297.   # ● カメラY座標
  3298.   #--------------------------------------------------------------------------
  3299.   def y
  3300.     return @y / 100
  3301.   end
  3302.   #--------------------------------------------------------------------------
  3303.   # ● ズーム率
  3304.   #--------------------------------------------------------------------------
  3305.   def zoom
  3306.     return @zoom * 0.001
  3307.   end
  3308.   #--------------------------------------------------------------------------
  3309.   # ● ズーム率による座標変換
  3310.   #--------------------------------------------------------------------------
  3311.   def convert
  3312.     return @zoom
  3313.   end
  3314.   #--------------------------------------------------------------------------
  3315.   # ● カメラセットアップ
  3316.   #--------------------------------------------------------------------------
  3317.   def setup
  3318.     @x = 0
  3319.     @y = 0
  3320.     @sx = 0
  3321.     @sy = 0
  3322.     @zoom = 1000
  3323.     @time = 0
  3324.     @shake_time = 0
  3325.     program_setup
  3326.   end
  3327.   #--------------------------------------------------------------------------
  3328.   # ● カメラ初期化
  3329.   #--------------------------------------------------------------------------
  3330.   def reset
  3331.     @switches = []
  3332.     @max_data = []
  3333.     @color_set = []
  3334.     @wait = 0
  3335.     @win_wait = false
  3336.     @mirror = false
  3337.     program_setup(false)
  3338.   end  
  3339.   #--------------------------------------------------------------------------
  3340.   # ● バトルプログラムのセットアップ
  3341.   #--------------------------------------------------------------------------
  3342.   def program_setup(check = true)
  3343.     @played_program  = []
  3344.     @program_switch  = []
  3345.     @program_sound   = []
  3346.     @program_scroll  = []
  3347.     @program_se      = []
  3348.     @program_shake   = []
  3349.     @program_color   = []
  3350.     @program_picture = []
  3351.     @program_base = N03::BATTLE_PROGRAM.values.dup
  3352.     program_check if check
  3353.   end  
  3354.   #--------------------------------------------------------------------------
  3355.   # ● バトルプログラムのチェック
  3356.   #--------------------------------------------------------------------------
  3357.   def program_check
  3358.     for data in @program_base
  3359.       if program_start?(data) && !@played_program.include?(data)
  3360.         @played_program.push(data.dup)
  3361.         @program_scroll.push(data.dup)  if data[0] == "scroll"
  3362.         @program_picture.push(data.dup) if data[0] == "kpic"
  3363.         start_sound(data.dup)           if data[0] == "sound"
  3364.         start_program_switch(data.dup)  if data[0] == "switch"
  3365.         start_program_se(data.dup)      if data[0] == "keep_se"
  3366.         start_program_shake(data.dup)   if data[0] == "keep_sk"
  3367.         start_program_color(data.dup)   if data[0] == "keep_c"
  3368.       else
  3369.         @played_program.delete(data)  if !program_start?(data)
  3370.         @program_scroll.delete(data)  if data[0] == "scroll"
  3371.         @program_picture.delete(data) if data[0] == "kpic"
  3372.         @program_switch.delete(data)  if data[0] == "switch"
  3373.         @program_sound.delete(data)   if data[0] == "sound"
  3374.         @program_se.delete(data)      if data[0] == "keep_se"
  3375.         @program_shake.delete(data)   if data[0] == "keep_sk"
  3376.         @program_color.delete(data)   if data[0] == "keep_c"
  3377.       end
  3378.     end
  3379.   end
  3380.   #--------------------------------------------------------------------------
  3381.   # ● バトルプログラムの開始
  3382.   #--------------------------------------------------------------------------
  3383.   def program_start?(data)
  3384.     start = false
  3385.     start = true if $game_switches[data[1].abs] && data[1] > 0
  3386.     start = true if @switches[data[1].abs] && data[1] < 0
  3387.     return start
  3388.   end  
  3389.   #--------------------------------------------------------------------------
  3390.   # ● バトルプログラム スイッチ操作の開始
  3391.   #--------------------------------------------------------------------------
  3392.   def start_program_switch(data)
  3393.     data[4] = data[4] + rand(data[5] + 1)
  3394.     data[4] = 1 if data[4] <= 0
  3395.     @program_switch.push(data)
  3396.   end
  3397.   #--------------------------------------------------------------------------
  3398.   # ● スイッチ操作の更新
  3399.   #--------------------------------------------------------------------------
  3400.   def update_program_switch
  3401.     for data in @program_switch
  3402.       data[4] -= 1
  3403.       next @program_switch.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3404.       next @program_switch.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3405.       next if data[4] != 0
  3406.       for id in data[2]
  3407.         $game_switches[id] = true if id > 0
  3408.         @switches[id.abs] = true  if id < 0
  3409.       end
  3410.       for id in data[3]
  3411.         $game_switches[id] = false if id > 0
  3412.         @switches[id.abs] = false  if id < 0
  3413.       end
  3414.       @program_switch.delete(data)
  3415.       program_check
  3416.     end  
  3417.   end
  3418.   #--------------------------------------------------------------------------
  3419.   # ● バトルプログラム BGM/BGSの開始
  3420.   #--------------------------------------------------------------------------
  3421.   def start_sound(data)
  3422.     @program_sound.push(data)
  3423.     name = data[5]
  3424.     case data[2]
  3425.     when "se"
  3426.       Audio.se_play("Audio/SE/" + name, data[4], data[3])
  3427.     when "bgm"
  3428.       name = RPG::BGM.last.name if data[5] == ""
  3429.       Audio.bgm_play("Audio/BGM/" + name, data[4], data[3])
  3430.     when "bgs"
  3431.       name = RPG::BGS.last.name if data[5] == ""
  3432.       Audio.bgs_play("Audio/BGS/" + name, data[4], data[3])
  3433.     end
  3434.   end
  3435.   #--------------------------------------------------------------------------
  3436.   # ● バトルプログラム 周期SEの開始
  3437.   #--------------------------------------------------------------------------
  3438.   def start_program_se(data)
  3439.     data[3] = [data[2], data[3]]
  3440.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3441.     @program_se.push(data)
  3442.     Audio.se_play("Audio/SE/" + data[7], data[5], data[4]) if data[6]
  3443.   end
  3444.   #--------------------------------------------------------------------------
  3445.   # ● 周期SEの更新
  3446.   #--------------------------------------------------------------------------
  3447.   def update_program_se
  3448.     for data in @program_se
  3449.       data[2] -= 1
  3450.       next @program_se.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3451.       next @program_se.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3452.       next if data[2] != 0
  3453.       Audio.se_play("Audio/SE/" + data[7], data[5], data[4])
  3454.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3455.     end  
  3456.   end
  3457.   #--------------------------------------------------------------------------
  3458.   # ● バトルプログラム 周期シェイクの開始
  3459.   #--------------------------------------------------------------------------
  3460.   def start_program_shake(data)
  3461.     data[3] = [data[2], data[3]]
  3462.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3463.     @program_shake.push(data)
  3464.     shake(data[4], data[5], data[6]) if data[7]
  3465.   end
  3466.   #--------------------------------------------------------------------------
  3467.   # ● 周期シェイクの更新
  3468.   #--------------------------------------------------------------------------
  3469.   def update_program_shake
  3470.     for data in @program_shake
  3471.       data[2] -= 1
  3472.       next @program_shake.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3473.       next @program_shake.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3474.       next if data[2] != 0
  3475.       shake(data[4], data[5], data[6])
  3476.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3477.     end  
  3478.   end
  3479.   #--------------------------------------------------------------------------
  3480.   # ● バトルプログラム 周期色調変更の開始
  3481.   #--------------------------------------------------------------------------
  3482.   def start_program_color(data)
  3483.     data[3] = [data[2], data[3]]
  3484.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3485.     data[7] = true if data[4] == 0 or data[4] == 4
  3486.     case data[4]
  3487.     when 1   ;data[4] = $game_troop.members
  3488.     when 2   ;data[4] = $game_party.battle_members
  3489.     when 3,4 ;data[4] = $game_troop.members + $game_party.battle_members
  3490.     else ;data[4] = []
  3491.     end
  3492.     @program_color.push(data)
  3493.     return if !data[6]
  3494.     for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3495.     @color_set[1] = data[5] if data[7]
  3496.     @color_set[2] = data[5] if data[7]
  3497.   end
  3498.   #--------------------------------------------------------------------------
  3499.   # ● 周期色調変更の更新
  3500.   #--------------------------------------------------------------------------
  3501.   def update_program_color
  3502.     for data in @program_color
  3503.       data[2] -= 1
  3504.       next @program_color.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3505.       next @program_color.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3506.       next if data[2] != 0
  3507.       for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3508.       @color_set[1] = data[5] if data[7]
  3509.       @color_set[2] = data[5] if data[7]
  3510.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3511.     end
  3512.   end
  3513.   #--------------------------------------------------------------------------
  3514.   # ● トランジション実行
  3515.   #--------------------------------------------------------------------------
  3516.   def perform_transition(data)
  3517.     Graphics.transition(data[2], "Graphics/Pictures/" + data[3], data[1])
  3518.   end  
  3519.   #--------------------------------------------------------------------------
  3520.   # ● 背景からカメラの限界値を取得  data = [max_top, max_bottom, max_left, max_right]
  3521.   #--------------------------------------------------------------------------
  3522.   def setting(index, data)
  3523.     @max_data[index - 1] = data
  3524.     return if index != 2
  3525.     setup
  3526.     # カメラの中心座標
  3527.     @center_x     = (Graphics.width / 2 + N03::CAMERA_POSITION[0]) * 100
  3528.     @center_y     = (Graphics.height / 2 + N03::CAMERA_POSITION[1]) * 100
  3529.     # 上下左右の移動限界距離
  3530.     @max_top    = [@max_data[0][5], @max_data[1][5]].min * -1
  3531.     @max_bottom = [@max_data[0][1], @max_data[1][1]].min + @max_top
  3532.     @max_left   = [@max_data[0][4], @max_data[1][4]].min  * -1
  3533.     @max_right  = [@max_data[0][3], @max_data[1][3]].min + @max_left
  3534.     exist_data = @max_data[0] if !@max_data[1][6]
  3535.     exist_data = @max_data[1] if !@max_data[0][6]
  3536.     @max_top    = exist_data[5] * -1        if exist_data != nil
  3537.     @max_bottom = exist_data[1] + @max_top  if exist_data != nil
  3538.     @max_left   = exist_data[4] * -1        if exist_data != nil
  3539.     @max_right  = exist_data[3] + @max_left if exist_data != nil
  3540.     @max_top = @max_bottom = @max_left = @max_right = 0 if !@max_data[1][6] && !@max_data[0][6]
  3541.     @max_width    = @max_right - @max_left + Graphics.width
  3542.     @max_height   = @max_bottom - @max_top + Graphics.height
  3543.     # ズームアウト限界値
  3544.     max_zoom_x    = 100 * Graphics.width / @max_width
  3545.     max_zoom_y    = 100 * Graphics.height / @max_height
  3546.     @max_zoom_out = [max_zoom_x, max_zoom_y].max
  3547.   end
  3548.   #--------------------------------------------------------------------------
  3549.   # ● カメラ移動
  3550.   #--------------------------------------------------------------------------
  3551.   def move(target_x, target_y, zoom, time, screen = true)
  3552.     # 戦闘背景以上のサイズまでズームアウトしないよう調整
  3553.     @target_zoom = [zoom * 0.01, @max_zoom_out * 0.01].max
  3554.     target_x *= -1 if screen && @mirror
  3555.     # ズーム分の中心座標補正
  3556.     if screen && @target_zoom != 1
  3557.       target_x = target_x + @center_x
  3558.       target_y = target_y + @center_y
  3559.     end
  3560.     adjust_x = @center_x * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3561.     adjust_y = @center_y * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3562.     adjust_x = 0 if adjust_x.nan?
  3563.     adjust_y = 0 if adjust_y.nan?
  3564.     adjust_x = @center_x if !screen && adjust_x == 0
  3565.     adjust_y = @center_y if !screen && adjust_y == 0
  3566.     @target_x = target_x - adjust_x.to_i
  3567.     @target_y = target_y - adjust_y.to_i
  3568.     @target_zoom = (@target_zoom * 1000).to_i
  3569.     @zoom = @zoom.to_i
  3570.     limit_test
  3571.     # 時間0の場合は即実行
  3572.     return @time = time.abs if time != 0
  3573.     @time = 1
  3574.     update
  3575.   end
  3576.   #--------------------------------------------------------------------------
  3577.   # ● 限界座標の試算
  3578.   #--------------------------------------------------------------------------
  3579.   def limit_test
  3580.     new_width = @max_width * @target_zoom / 1000
  3581.     new_height = @max_height * @target_zoom / 1000
  3582.     new_max_right = @max_right - (@max_width - new_width)
  3583.     new_max_bottom = @max_bottom - (@max_height - new_height)
  3584.     # 画面の移動先が限界の場合、限界座標をセット
  3585.     if @target_x < @max_left * 100
  3586.       @target_x = @max_left * 100
  3587.     end
  3588.     if @target_x > new_max_right * 100
  3589.       @target_x = new_max_right * 100
  3590.     end
  3591.     if @target_y < @max_top * 100
  3592.       @target_y = @max_top * 100
  3593.     end
  3594.     if @target_y > new_max_bottom * 100
  3595.       @target_y = new_max_bottom * 100
  3596.     end
  3597.   end
  3598.   #--------------------------------------------------------------------------
  3599.   # ● 画面のシェイク
  3600.   #--------------------------------------------------------------------------
  3601.   def shake(power, speed, time)
  3602.     @shake_x = power[0] * 100
  3603.     @shake_y = power[1] * 100
  3604.     @power_time_base = @power_time = speed
  3605.     @shake_time = time
  3606.     update_shake
  3607.   end
  3608.   #--------------------------------------------------------------------------
  3609.   # ● シェイクの更新
  3610.   #--------------------------------------------------------------------------
  3611.   def update_shake
  3612.     @sx = (@sx * (@power_time - 1) + @shake_x) / @power_time
  3613.     @sy = (@sy * (@power_time - 1) + @shake_y) / @power_time
  3614.     @power_time -= 1
  3615.     @shake_time -= 1
  3616.     return @sx = @sy = 0 if @shake_time == 0
  3617.     return if @power_time != 0
  3618.     @power_time = @power_time_base
  3619.     @shake_x = @shake_x * -4 / 5
  3620.     @shake_y = @shake_y * -4 / 5
  3621.   end
  3622.   #--------------------------------------------------------------------------
  3623.   # ● フレーム更新
  3624.   #--------------------------------------------------------------------------
  3625.   def update
  3626.     update_shake if @shake_time != 0
  3627.     update_program
  3628.     return if @time == 0
  3629.     @x = (@x * (@time - 1) + @target_x) / @time
  3630.     @y = (@y * (@time - 1) + @target_y) / @time
  3631.     @zoom = (@zoom * (@time - 1) + @target_zoom) / @time
  3632.     @time -= 1
  3633.   end
  3634.   #--------------------------------------------------------------------------
  3635.   # ● フレーム更新
  3636.   #--------------------------------------------------------------------------
  3637.   def update_program
  3638.     update_program_switch if @program_switch != []
  3639.     update_program_se     if @program_se != []
  3640.     update_program_shake  if @program_shake != []
  3641.     update_program_color  if @program_color != []
  3642.   end
  3643. end

  3644. #==============================================================================
  3645. # ■ Scene_Battle
  3646. #------------------------------------------------------------------------------
  3647. #  バトル画面の処理を行うクラスです。
  3648. #==============================================================================
  3649. class Scene_Battle < Scene_Base
  3650.   #--------------------------------------------------------------------------
  3651.   # ● フレーム更新(基本)
  3652.   #--------------------------------------------------------------------------
  3653.   alias update_basic_scene_battle_n03 update_basic
  3654.   def update_basic
  3655.     update_basic_scene_battle_n03
  3656.     $sv_camera.update
  3657.     $sv_camera.wait = N03::TURN_END_WAIT + 1 if $sv_camera.win_wait
  3658.     camera_wait
  3659.   end
  3660.   #--------------------------------------------------------------------------
  3661.   # ● カメラウェイト
  3662.   #--------------------------------------------------------------------------
  3663.   def camera_wait
  3664.     process_event if $sv_camera.event
  3665.     $sv_camera.event = false if $sv_camera.event
  3666.     while $sv_camera.wait != 0
  3667.       Graphics.update
  3668.       Input.update
  3669.       update_all_windows
  3670.       $game_timer.update
  3671.       $game_troop.update
  3672.       $sv_camera.update
  3673.       @spriteset.update
  3674.       update_info_viewport
  3675.       update_message_open
  3676.       $sv_camera.wait -= 1 if $sv_camera.wait > 0
  3677.       $sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
  3678.       BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
  3679.     end
  3680.   end
  3681.   #--------------------------------------------------------------------------
  3682.   # ● カメラウェイトのセット
  3683.   #--------------------------------------------------------------------------
  3684.   def set_camera_wait(time)
  3685.     $sv_camera.wait = time
  3686.     camera_wait
  3687.   end  
  3688.   #--------------------------------------------------------------------------
  3689.   # ● エフェクト実行が終わるまでウェイト ★再定義
  3690.   #--------------------------------------------------------------------------
  3691.   def wait_for_effect
  3692.   end
  3693.   #--------------------------------------------------------------------------
  3694.   # ● ターン開始
  3695.   #--------------------------------------------------------------------------
  3696.   alias turn_start_scene_battle_n03 turn_start
  3697.   def turn_start
  3698.     turn_start_scene_battle_n03
  3699.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始後"].dup)
  3700.   end
  3701.   #--------------------------------------------------------------------------
  3702.   # ● ターン終了
  3703.   #--------------------------------------------------------------------------
  3704.   alias turn_end_scene_battle_n03 turn_end
  3705.   def turn_end
  3706.     turn_end_scene_battle_n03
  3707.     for member in $game_troop.members + $game_party.members
  3708.       N03.set_damage(member, member.sv.result_damage[0],member.sv.result_damage[1])
  3709.       member.sv.result_damage = [0,0]
  3710.       @spriteset.set_damage_pop(member) if member.result.hp_damage != 0 or member.result.mp_damage != 0
  3711.     end
  3712.     set_camera_wait(N03::TURN_END_WAIT)
  3713.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup) if $game_party.inputable?
  3714.     @log_window.clear
  3715.   end
  3716.   #--------------------------------------------------------------------------
  3717.   # ● スキル/アイテムの使用 ★再定義
  3718.   #--------------------------------------------------------------------------
  3719.   def use_item
  3720.     item = @subject.current_action.item
  3721.     display_item(item)
  3722.     @subject.use_item(item)
  3723.     refresh_status
  3724.     @targets = @subject.current_action.make_targets.compact
  3725.     @targets = [@subject] if @targets.size == 0
  3726.     set_substitute(item)
  3727.     for time in item.repeats.times do play_sideview(@targets, item) end
  3728.     end_reaction(item)
  3729.     display_end_item
  3730.   end
  3731.   #--------------------------------------------------------------------------
  3732.   # ● スキル/アイテム名の表示
  3733.   #--------------------------------------------------------------------------
  3734.   def display_item(item)
  3735.     return @log_window.display_use_item(@subject, item) if N03::BATTLE_LOG
  3736.     @log_window.off
  3737.     @skill_name_window = Window_Skill_name.new(item.name) unless N03::NO_DISPLAY_SKILL_ID.include?(item.id) && item.is_a?(RPG::Skill)
  3738.   end  
  3739.   #--------------------------------------------------------------------------
  3740.   # ● スキル/アイテム名の表示終了
  3741.   #--------------------------------------------------------------------------
  3742.   def display_end_item
  3743.     @skill_name_window.dispose if @skill_name_window != nil
  3744.     @skill_name_window = nil
  3745.     set_camera_wait(N03::ACTION_END_WAIT) if @subject.sv.derivation_skill_id == 0
  3746.     @log_window.clear if N03::BATTLE_LOG
  3747.   end  
  3748.   #--------------------------------------------------------------------------
  3749.   # ● 反撃/魔法反射/身代わり処理
  3750.   #--------------------------------------------------------------------------
  3751.   def end_reaction(item)
  3752.     end_substitute if @substitute != nil
  3753.     set_reflection(item) if @reflection_data != nil
  3754.     set_counter_attack if @counter_attacker != nil
  3755.   end  
  3756.   #--------------------------------------------------------------------------
  3757.   # ● 反撃の発動 ★再定義
  3758.   #--------------------------------------------------------------------------
  3759.   def invoke_counter_attack(target, item)
  3760.     return if @subject.sv.counter_id != 0
  3761.     @counter_attacker = [] if @counter_attacker == nil
  3762.     return apply_item_effects(apply_substitute(target, item), item) if !target.movable?
  3763.     @log_window.add_text(sprintf(Vocab::CounterAttack, target.name)) if N03::BATTLE_LOG
  3764.     target.sv.counter_id = target.sv.counter_skill_id
  3765.     @counter_attacker.push(target)
  3766.   end
  3767.   #--------------------------------------------------------------------------
  3768.   # ● 魔法反射の発動 ★再定義
  3769.   #--------------------------------------------------------------------------
  3770.   def invoke_magic_reflection(target, item)
  3771.     return if @subject.sv.reflection_id != 0
  3772.     @log_window.add_text(sprintf(Vocab::MagicReflection, target.name)) if N03::BATTLE_LOG
  3773.     target.sv.reflection_id = target.sv.reflection_anime_id
  3774.   end
  3775.   #--------------------------------------------------------------------------
  3776.   # ● 身代わりの適用 ★再定義
  3777.   #--------------------------------------------------------------------------
  3778.   def apply_substitute(target, item)
  3779.     return target if @substitute == nil
  3780.     return target if !check_substitute(target, item)
  3781.     return @substitute
  3782.   end
  3783.   #--------------------------------------------------------------------------
  3784.   # ● 身代わりセット
  3785.   #--------------------------------------------------------------------------
  3786.   def set_substitute(item)
  3787.     @substitute = N03.get_enemy_unit(@subject).substitute_battler
  3788.     return if @substitute == nil
  3789.     s_targets = []
  3790.     for i in 0...@targets.size
  3791.       next if @targets[i] == @substitute
  3792.       next if !check_substitute(@targets[i], item)
  3793.       @log_window.add_text(sprintf(Vocab::Substitute, @substitute.name, @targets[i].name))
  3794.       @targets[i].sv.start_action(@targets[i].sv.substitute_receiver_start_action)
  3795.       s_targets.push(@targets[i])
  3796.       @targets[i] = @substitute
  3797.     end
  3798.     return @substitute = nil if s_targets == []
  3799.     @substitute.sv.set_target(s_targets)
  3800.     @substitute.sv.start_action(@substitute.sv.substitute_start_action)
  3801.   end  
  3802.   #--------------------------------------------------------------------------
  3803.   # ● 身代わり終了
  3804.   #--------------------------------------------------------------------------
  3805.   def end_substitute
  3806.     for member in @substitute.sv.target_battler
  3807.       member.sv.start_action(member.sv.substitute_receiver_end_action)
  3808.     end  
  3809.     @substitute.sv.start_action(@substitute.sv.substitute_end_action)
  3810.     @substitute = nil
  3811.   end
  3812.   #--------------------------------------------------------------------------
  3813.   # ● 反撃
  3814.   #--------------------------------------------------------------------------
  3815.   def set_counter_attack
  3816.     pre_subject = @subject
  3817.     for attacker in @counter_attacker
  3818.       @subject = attacker
  3819.       item = $data_skills[attacker.sv.counter_skill_id]
  3820.       play_sideview([pre_subject], item)
  3821.     end
  3822.     # 同一カウンター者を考慮してカウンターIDの初期化はアクション後に実行
  3823.     for attacker in @counter_attacker do attacker.sv.counter_id = 0 end
  3824.     @subject = pre_subject
  3825.     @counter_attacker = nil
  3826.   end
  3827.   #--------------------------------------------------------------------------
  3828.   # ● 魔法反射
  3829.   #--------------------------------------------------------------------------
  3830.   def set_reflection(item)
  3831.     @log_window.back_to(1)
  3832.     for data in @reflection_data
  3833.       @subject.sv.damage_action(@subject, item)
  3834.       N03.set_damage_anime_data([@subject], @subject, data)
  3835.       apply_item_effects(@subject, item)
  3836.       @spriteset.set_damage_pop(@subject)
  3837.     end
  3838.     set_camera_wait(N03.get_anime_time(@reflection_data[0][0]))
  3839.     @reflection_data = nil
  3840.   end
  3841.   #--------------------------------------------------------------------------
  3842.   # ● サイドビューアクション実行
  3843.   #--------------------------------------------------------------------------
  3844.   def play_sideview(targets, item)
  3845.     @subject.sv.set_target(targets)
  3846.     return if @subject.sv.attack_action(item) == nil
  3847.     return if !@subject.movable?
  3848.     return if item.scope != 9 && item.scope != 10 && !N03.targets_alive?(targets)
  3849.     @subject.sv.start_action(@subject.sv.attack_action(item))
  3850.     @subject.sv.unshift_action(@subject.sv.flash_action) if @subject.flash_flg
  3851.     @subject.sv.active = true
  3852.     @subject.sv.command_action = false
  3853.     loop do
  3854.       update_basic
  3855.       data = @subject.sv.play_data
  3856.       @targets = N03.s_targets(@subject) if data[0] == "second_targets_set"
  3857.       N03.targets_set(@subject)          if data[0] == "targets_set"
  3858.       @immortal = N03.immortaling        if data[0] == "no_collapse" && !N03.dead_attack?(@subject, item)
  3859.       @immortal = N03.unimmortaling      if data[0] == "collapse"
  3860.       next set_move_anime(item)          if @subject.sv.m_a_data != []
  3861.       set_damage(item)                   if @subject.sv.set_damage
  3862.       break N03.derived_skill(@subject)  if @subject.sv.derivation_skill_id != 0
  3863.       break                              if @subject.sv.action_end or @subject.hidden?
  3864.     end
  3865.     @immortal = N03.unimmortaling        if @immortal
  3866.   end
  3867.   #--------------------------------------------------------------------------
  3868.   # ● ダメージの実行
  3869.   #--------------------------------------------------------------------------
  3870.   def set_damage(item)
  3871.     targets = @targets
  3872.     targets = [@subject.sv.individual_targets[0]] if @subject.sv.individual_targets.size != 0
  3873.     for target in targets do damage_anime(targets.dup, target, item) end
  3874.     @subject.sv.set_damage = false
  3875.     @subject.sv.damage_anime_data = []
  3876.   end
  3877.   #--------------------------------------------------------------------------
  3878.   # ● ダメージ戦闘アニメ処理
  3879.   #--------------------------------------------------------------------------
  3880.   def damage_anime(targets, target, item)
  3881.     @log_window.back_to(1) if @log_window.line_number == 5
  3882.     return if item.scope != 9 && item.scope != 10 && target.dead?
  3883.     @miss = false
  3884.     invoke_item(target,item)
  3885.     if target.result.missed
  3886.       target.sv.miss_action(@subject, item)
  3887.       return @miss = true
  3888.     elsif target.result.evaded or target.sv.counter_id != 0
  3889.       target.sv.evasion_action(@subject, item)
  3890.       return @miss = true
  3891.     elsif target.sv.reflection_id != 0
  3892.       N03.set_damage_anime_data(targets, target, [target.sv.reflection_id, false, false, true])
  3893.       target.sv.reflection_id = 0
  3894.       @reflection_data = [] if @reflection_data == nil
  3895.       return @reflection_data.push([N03.get_attack_anime_id(-3, @subject), false, false, true])
  3896.     end
  3897.     target.sv.damage_action(@subject, item)
  3898.     N03.set_damage(@subject, -target.result.hp_drain, -target.result.mp_drain) if target != @subject
  3899.     @spriteset.set_damage_pop(target)
  3900.     @spriteset.set_damage_pop(@subject) if target != @subject && @subject.result.hp_damage != 0 or @subject.result.mp_damage != 0
  3901.     N03.set_damage_anime_data(targets, target, @subject.sv.damage_anime_data) if @subject.sv.damage_anime_data != []
  3902.   end
  3903.   #--------------------------------------------------------------------------
  3904.   # ● 飛ばしアニメ処理
  3905.   #--------------------------------------------------------------------------
  3906.   def set_move_anime(item)
  3907.     for data in @subject.sv.m_a_data
  3908.       @subject.sv.damage_anime_data = data[4]
  3909.       hit_targets = []
  3910.       for target in data[1]
  3911.         damage_anime(data[1], target, item) if data[0]
  3912.         hit_targets.push(target) if !@miss
  3913.       end
  3914.       @miss = false if !data[3]
  3915.       @spriteset.set_hit_animation(@subject, data[2], hit_targets, @miss)
  3916.     end
  3917.     @subject.sv.set_damage = false
  3918.     @subject.sv.m_a_data = []
  3919.   end
  3920. end

  3921. #==============================================================================
  3922. # ■ DataManager
  3923. #------------------------------------------------------------------------------
  3924. #  データベースとゲームオブジェクトを管理するモジュールです。
  3925. #==============================================================================
  3926. module DataManager
  3927.   #--------------------------------------------------------------------------
  3928.   # ● 各種ゲームオブジェクトの作成 ★再定義
  3929.   #--------------------------------------------------------------------------
  3930.   def self.create_game_objects
  3931.     $game_temp          = Game_Temp.new
  3932.     $game_system        = Game_System.new
  3933.     $game_timer         = Game_Timer.new
  3934.     $game_message       = Game_Message.new
  3935.     $game_switches      = Game_Switches.new
  3936.     $game_variables     = Game_Variables.new
  3937.     $game_self_switches = Game_SelfSwitches.new
  3938.     $game_actors        = Game_Actors.new
  3939.     $game_party         = Game_Party.new
  3940.     $game_troop         = Game_Troop.new
  3941.     $game_map           = Game_Map.new
  3942.     $game_player        = Game_Player.new
  3943.     $sv_camera          = Battle_Camera.new
  3944.   end
  3945. end

  3946. #==============================================================================
  3947. # ■ BattleManager
  3948. #------------------------------------------------------------------------------
  3949. #  戦闘の進行を管理するモジュールです。
  3950. #==============================================================================
  3951. module BattleManager
  3952.   #--------------------------------------------------------------------------
  3953.   # ● エンカウント時の処理 ★再定義
  3954.   #--------------------------------------------------------------------------
  3955.   def self.on_encounter
  3956.     @preemptive = (rand < rate_preemptive)
  3957.     @surprise = (rand < rate_surprise && !@preemptive)
  3958.     $sv_camera.mirror = @surprise if N03::BACK_ATTACK
  3959.   end
  3960.   #--------------------------------------------------------------------------
  3961.   # ● 勝利の処理 ★再定義
  3962.   #--------------------------------------------------------------------------
  3963.   def self.process_victory
  3964.     $sv_camera.win_wait = true
  3965.   end  
  3966.   #--------------------------------------------------------------------------
  3967.   # ● 勝利
  3968.   #--------------------------------------------------------------------------
  3969.   def self.victory
  3970.     $sv_camera.win_wait = false
  3971.     N03.camera(nil, N03::BATTLE_CAMERA["戦闘終了時"].dup)
  3972.     for member in $game_party.members do member.sv.start_action(member.sv.win) if member.movable? end
  3973.     play_battle_end_me
  3974.     replay_bgm_and_bgs
  3975.     $game_message.add(sprintf(Vocab::Victory, $game_party.name))
  3976.     display_exp
  3977.     gain_gold
  3978.     gain_drop_items
  3979.     gain_exp
  3980.     SceneManager.return
  3981.     battle_end(0)
  3982.     return true
  3983.   end
  3984.   #--------------------------------------------------------------------------
  3985.   # ● 逃走の処理 ★再定義
  3986.   #--------------------------------------------------------------------------
  3987.   def self.process_escape
  3988.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  3989.     success = @preemptive ? true : (rand < @escape_ratio)
  3990.     Sound.play_escape
  3991.     if success
  3992.       process_abort
  3993.       for member in $game_party.members do member.sv.start_action(member.sv.escape) if member.movable? end
  3994.     else
  3995.       @escape_ratio += 0.1
  3996.       $game_message.add('\.' + Vocab::EscapeFailure)
  3997.       $game_party.clear_actions
  3998.       for member in $game_party.members do member.sv.start_action(member.sv.escape_ng) if member.movable? end
  3999.     end
  4000.     wait_for_message
  4001.     return success
  4002.   end
  4003.   #--------------------------------------------------------------------------
  4004.   # ● 次のコマンド入力へ ★再定義
  4005.   #--------------------------------------------------------------------------
  4006.   def self.next_command
  4007.     begin
  4008.       if !actor || !actor.next_command
  4009.         $game_party.battle_members[@actor_index].sv.command_action = true
  4010.         @actor_index += 1
  4011.         if @actor_index >= $game_party.members.size
  4012.           for member in $game_party.battle_members.reverse
  4013.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  4014.           end
  4015.           return false
  4016.         end
  4017.       end
  4018.     end until actor.inputable?
  4019.     actor.sv.start_action(actor.sv.command_b) if actor != nil && actor.inputable?
  4020.     if pre_actor
  4021.       pre_actor.sv.start_action(pre_actor.sv.command_a) if pre_actor != nil && pre_actor.inputable?
  4022.     end
  4023.     return true
  4024.   end
  4025.   #--------------------------------------------------------------------------
  4026.   # ● 前のコマンド入力へ ★再定義
  4027.   #--------------------------------------------------------------------------
  4028.   def self.prior_command
  4029.     begin
  4030.       if !actor || !actor.prior_command
  4031.         $game_party.battle_members[@actor_index].sv.command_action = false
  4032.         @actor_index -= 1
  4033.         if @actor_index < 0
  4034.           for member in $game_party.battle_members
  4035.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  4036.           end
  4037.           return false
  4038.         end
  4039.       end
  4040.     end until actor.inputable?
  4041.     actor.make_actions if actor.inputable?
  4042.     actor.sv.start_action(actor.sv.command_b) if actor.inputable?
  4043.     after_actor.sv.start_action(after_actor.sv.command_a) if after_actor != nil && after_actor.inputable?
  4044.     return true
  4045.   end
  4046.   #--------------------------------------------------------------------------
  4047.   # ● コマンド入力前のアクターを取得
  4048.   #--------------------------------------------------------------------------
  4049.   def self.pre_actor
  4050.     return if @actor_index == 0
  4051.     $game_party.members[@actor_index - 1]
  4052.   end
  4053.   #--------------------------------------------------------------------------
  4054.   # ● コマンド入力後のアクターを取得
  4055.   #--------------------------------------------------------------------------
  4056.   def self.after_actor
  4057.     $game_party.members[@actor_index + 1]
  4058.   end
  4059.   #--------------------------------------------------------------------------
  4060.   # ● 戦闘行動者を前に追加
  4061.   #--------------------------------------------------------------------------
  4062.   def self.unshift_action_battlers(battler)
  4063.     @action_battlers.unshift(battler)
  4064.   end
  4065. end  

  4066. #==============================================================================
  4067. # ■ Game_Battler
  4068. #------------------------------------------------------------------------------
  4069. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。
  4070. #==============================================================================
  4071. class Game_Battler < Game_BattlerBase
  4072.   #--------------------------------------------------------------------------
  4073.   # ● 公開インスタンス変数
  4074.   #--------------------------------------------------------------------------
  4075.   attr_reader   :sv                     # サイドビューデータ
  4076.   attr_accessor :flash_flg              # 閃きフラグ
  4077.   #--------------------------------------------------------------------------
  4078.   # ● オブジェクト初期化
  4079.   #--------------------------------------------------------------------------
  4080.   alias initialize_game_battler_n03 initialize
  4081.   def initialize
  4082.     initialize_game_battler_n03
  4083.     @sv = SideView.new(self)
  4084.   end
  4085.   #--------------------------------------------------------------------------
  4086.   # ● 現在の戦闘行動を除去
  4087.   #--------------------------------------------------------------------------
  4088.   alias remove_current_action_game_battler_n03 remove_current_action
  4089.   def remove_current_action
  4090.     return @sv.derivation_skill_id = 0 if @sv.derivation_skill_id != 0
  4091.     remove_current_action_game_battler_n03
  4092.   end
  4093.   #--------------------------------------------------------------------------
  4094.   # ● ターン終了処理
  4095.   #--------------------------------------------------------------------------
  4096.   alias on_turn_end_game_battler_n03 on_turn_end
  4097.   def on_turn_end
  4098.     on_turn_end_game_battler_n03
  4099.     @sv.add_state = []
  4100.     @sv.result_damage = [@result.hp_damage, @result.mp_damage]
  4101.   end
  4102.   #--------------------------------------------------------------------------
  4103.   # ● パラメータ条件比較 data = [種別, 数値, 判別]
  4104.   #--------------------------------------------------------------------------
  4105.   def comparison_parameter(data)
  4106.     return true if data[0][0] == 0
  4107.     kind = data[0]
  4108.     num = data[1]
  4109.     select = data[2]
  4110.     case kind
  4111.     when  1 ; par = level
  4112.     when  2 ; par = mhp
  4113.     when  3 ; par = mmp
  4114.     when  4 ; par = hp
  4115.     when  5 ; par = mp
  4116.     when  6 ; par = tp
  4117.     when  7 ; par = atk
  4118.     when  8 ; par = self.def
  4119.     when  9 ; par = mat
  4120.     when 10 ; par = mdf
  4121.     when 11 ; par = agi
  4122.     when 12 ; par = luk
  4123.     end
  4124.     if num < 0
  4125.       case kind
  4126.       when  4 ; num = mhp * num / 100
  4127.       when  5 ; num = mmp * num / 100
  4128.       when  6 ; num = max_tp * num / 100
  4129.       end
  4130.       num = num.abs
  4131.     end  
  4132.     case select
  4133.     when  0 ; return par == num
  4134.     when  1 ; return par < num
  4135.     when  2 ; return par > num
  4136.     end
  4137.   end
  4138.   #--------------------------------------------------------------------------
  4139.   # ● 装備条件比較 data = [装備種別, タイプID]
  4140.   #--------------------------------------------------------------------------
  4141.   def comparison_equip(data)
  4142.     kind = data[0]
  4143.     items = weapons if kind == 0
  4144.     items = armors  if kind == 1
  4145.     for item in items
  4146.       for id in data[1]
  4147.         return true if id > 0 && item.is_a?(RPG::Weapon) && item == $data_weapons[id.abs]
  4148.         return true if id > 0 && item.is_a?(RPG::Armor) && item == $data_armors[id.abs]
  4149.         return true if id < 0 && item.is_a?(RPG::Weapon) && item.wtype_id == id.abs
  4150.         return true if id < 0 && item.is_a?(RPG::Armor) && item.stype_id == id.abs
  4151.       end
  4152.     end
  4153.     return false
  4154.   end
  4155.   
  4156. end  
  4157. #==============================================================================
  4158. # ■ Game_Actor
  4159. #------------------------------------------------------------------------------
  4160. #  アクターを扱うクラスです。
  4161. #==============================================================================
  4162. class Game_Actor < Game_Battler
  4163.   #--------------------------------------------------------------------------
  4164.   # ● 公開インスタンス変数
  4165.   #--------------------------------------------------------------------------
  4166.   attr_reader :actor_id                    # ID
  4167.   #--------------------------------------------------------------------------
  4168.   # ● ID
  4169.   #--------------------------------------------------------------------------
  4170.   def id
  4171.     return @actor_id
  4172.   end
  4173.   #--------------------------------------------------------------------------
  4174.   # ● スプライトを使うか? ★再定義
  4175.   #--------------------------------------------------------------------------
  4176.   def use_sprite?
  4177.     return true
  4178.   end
  4179.   #--------------------------------------------------------------------------
  4180.   # ● ダメージ効果の実行 ★再定義
  4181.   #--------------------------------------------------------------------------
  4182.   def perform_damage_effect
  4183.     return if !N03::ACTOR_DAMAGE
  4184.     $game_troop.screen.start_shake(5, 5, 10)
  4185.     @sprite_effect_type = :blink
  4186.     Sound.play_actor_damage
  4187.   end
  4188.   
  4189. end

  4190. #==============================================================================
  4191. # ■ Game_Enemy
  4192. #------------------------------------------------------------------------------
  4193. #  敵キャラを扱うクラスです。
  4194. #==============================================================================
  4195. class Game_Enemy < Game_Battler
  4196.   #--------------------------------------------------------------------------
  4197.   # ● 公開インスタンス変数
  4198.   #--------------------------------------------------------------------------
  4199.   attr_reader :enemy_id                    # ID
  4200.   #--------------------------------------------------------------------------
  4201.   # ● ID
  4202.   #--------------------------------------------------------------------------
  4203.   def id
  4204.     return @enemy_id
  4205.   end
  4206.   #--------------------------------------------------------------------------
  4207.   # ● レベル
  4208.   #--------------------------------------------------------------------------
  4209.   def level
  4210.     return @sv.level
  4211.   end
  4212.   #--------------------------------------------------------------------------
  4213.   # ● ダメージ効果の実行 ★再定義
  4214.   #--------------------------------------------------------------------------
  4215.   def perform_damage_effect
  4216.     return if !N03::ENEMY_DAMAGE
  4217.     @sprite_effect_type = :blink
  4218.     Sound.play_enemy_damage
  4219.   end
  4220.   #--------------------------------------------------------------------------
  4221.   # ● 武器
  4222.   #--------------------------------------------------------------------------
  4223.   def weapons
  4224.     weapon1 = $data_weapons[@sv.enemy_weapon1_id]
  4225.     weapon2 = $data_weapons[@sv.enemy_weapon2_id]
  4226.     return [weapon1, weapon2]
  4227.   end
  4228.   #--------------------------------------------------------------------------
  4229.   # ● 防具
  4230.   #--------------------------------------------------------------------------
  4231.   def armors
  4232.     return [$data_armors[@sv.enemy_shield_id]]
  4233.   end
  4234.   #--------------------------------------------------------------------------
  4235.   # ● 二刀流の判定
  4236.   #--------------------------------------------------------------------------
  4237.   def dual_wield?
  4238.     return $data_weapons[@sv.enemy_weapon2_id] != nil
  4239.   end
  4240.   #--------------------------------------------------------------------------
  4241.   # ● バトラー画像変更
  4242.   #--------------------------------------------------------------------------
  4243.   def graphics_change(battler_name)
  4244.     @battler_name = battler_name
  4245.   end
  4246.   #--------------------------------------------------------------------------
  4247.   # ● 通常攻撃 アニメーション ID の取得
  4248.   #--------------------------------------------------------------------------
  4249.   def atk_animation_id1
  4250.     return weapons[0].animation_id if weapons[0]
  4251.     return weapons[1] ? 0 : 1
  4252.   end
  4253.   #--------------------------------------------------------------------------
  4254.   # ● 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  4255.   #--------------------------------------------------------------------------
  4256.   def atk_animation_id2
  4257.     return weapons[1] ? weapons[1].animation_id : 0
  4258.   end
  4259. end

  4260. #==============================================================================
  4261. # ■ Sprite_Base
  4262. #------------------------------------------------------------------------------
  4263. #  アニメーションの表示処理を追加したスプライトのクラスです。
  4264. #==============================================================================
  4265. class Sprite_Base < Sprite
  4266.   #--------------------------------------------------------------------------
  4267.   # ● アニメーションの座標更新 (ホーミングあり)
  4268.   #--------------------------------------------------------------------------
  4269.   def update_animation_position_horming
  4270.     return if @action_end_cancel
  4271.     ani_ox_set if @horming
  4272.     camera_zoom = $sv_camera.zoom
  4273.     camera_zoom = 1 if @move_anime
  4274.     kind = 1
  4275.     kind = -1 if @ani_mirror && !@anime_no_mirror
  4276.     cell_data = @animation.frames[@animation.frame_max - (@ani_duration + @ani_rate - 1) / @ani_rate].cell_data
  4277.     for i in 0..15
  4278.       @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
  4279.       @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
  4280.     end
  4281.   end
  4282.   #--------------------------------------------------------------------------
  4283.   # ● アニメーション元の座標をセット
  4284.   #--------------------------------------------------------------------------
  4285.   def ani_ox_set
  4286.     if !SceneManager.scene_is?(Scene_Battle)
  4287.       @real_x = x
  4288.       @real_y = y
  4289.     end
  4290.     @ani_ox = @real_x - ox + width / 2
  4291.     @ani_oy = @real_y - oy + height / 2
  4292.     @ani_oy -= height / 2 if @animation.position == 0
  4293.     @ani_oy += height / 2 if @animation.position == 2
  4294.   end
  4295.   #--------------------------------------------------------------------------
  4296.   # ● アニメーションの更新
  4297.   #--------------------------------------------------------------------------
  4298.   alias update_animation_sprite_base_n03 update_animation
  4299.   def update_animation
  4300.     update_animation_position_horming if animation? && SceneManager.scene_is?(Scene_Battle) && @animation.position != 3
  4301.     update_animation_sprite_base_n03
  4302.   end
  4303.   #--------------------------------------------------------------------------
  4304.   # ● アニメーションの原点設定 ★再定義
  4305.   #--------------------------------------------------------------------------
  4306.   def set_animation_origin
  4307.     return ani_ox_set if @animation.position != 3
  4308.     if viewport == nil
  4309.       @ani_ox = Graphics.width / 2
  4310.       @ani_oy = Graphics.height / 2
  4311.     else
  4312.       @ani_ox = viewport.rect.width / 2
  4313.       @ani_oy = viewport.rect.height / 2
  4314.     end
  4315.   end
  4316.   #--------------------------------------------------------------------------
  4317.   # ● アニメーションスプライトの設定 ★再定義
  4318.   #--------------------------------------------------------------------------
  4319.   def animation_set_sprites(frame)
  4320.     camera_zoom = 1
  4321.     camera_zoom = $sv_camera.zoom if @anime_camera_zoom && @animation.position != 3 && SceneManager.scene_is?(Scene_Battle)
  4322.     camera_x = $sv_camera.x
  4323.     camera_y = $sv_camera.y
  4324.     camera_x = camera_y = 0 if @animation.position == 3 or !SceneManager.scene_is?(Scene_Battle)
  4325.     plus_z = 5
  4326.     plus_z = 1000 if @animation.position == 3
  4327.     plus_z = -17 if @plus_z != nil && @plus_z == false
  4328.     plus_z = -self.z + 10 if @plus_z != nil && @plus_z == false && @animation.position == 3
  4329.     cell_data = frame.cell_data
  4330.     @ani_sprites.each_with_index do |sprite, i|
  4331.       next unless sprite
  4332.       pattern = cell_data[i, 0]
  4333.       if !pattern || pattern < 0
  4334.         sprite.visible = false
  4335.         next
  4336.       end
  4337.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  4338.       sprite.visible = true
  4339.       sprite.src_rect.set(pattern % 5 * 192,
  4340.         pattern % 100 / 5 * 192, 192, 192)
  4341.       if @ani_mirror && !@anime_no_mirror
  4342.         sprite.x = (@ani_ox - cell_data[i, 1] - camera_x) * camera_zoom
  4343.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4344.         sprite.angle = (360 - cell_data[i, 4])
  4345.         sprite.mirror = (cell_data[i, 5] == 0)
  4346.       else
  4347.         sprite.x = (@ani_ox + cell_data[i, 1] - camera_x) * camera_zoom
  4348.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4349.         sprite.angle = cell_data[i, 4]
  4350.         sprite.mirror = (cell_data[i, 5] == 1)
  4351.       end
  4352.       sprite.z = self.z + plus_z + i
  4353.       sprite.ox = 96
  4354.       sprite.oy = 96
  4355.       sprite.zoom_x = cell_data[i, 3] * camera_zoom / 100.0
  4356.       sprite.zoom_y = cell_data[i, 3] * camera_zoom/ 100.0
  4357.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4358.       sprite.blend_type = cell_data[i, 7]
  4359.     end
  4360.   end
  4361.   #--------------------------------------------------------------------------
  4362.   # ● 子スプライトフラグ
  4363.   #--------------------------------------------------------------------------
  4364.   def set(battler, horming, camera_zoom, no_mirror)
  4365.     @battler = battler
  4366.     @next = true
  4367.     self.bitmap = Bitmap.new(@battler.sv.cw, @battler.sv.ch)
  4368.     self.ox = bitmap.width / 2
  4369.     self.oy = bitmap.height
  4370.     @horming = horming
  4371.     @anime_camera_zoom = camera_zoom
  4372.     @anime_no_mirror = no_mirror
  4373.     @battler.sv.reset_anime_data
  4374.   end  
  4375.   #--------------------------------------------------------------------------
  4376.   # ● 子スプライト座標セット
  4377.   #--------------------------------------------------------------------------
  4378.   def set_position(z, zoom_x, zoom_y, real_x, real_y)
  4379.     self.z = z
  4380.     self.zoom_x = zoom_x
  4381.     self.zoom_y = zoom_y
  4382.     @real_x = real_x
  4383.     @real_y = real_y
  4384.   end
  4385.   #--------------------------------------------------------------------------
  4386.   # ● 他スプライトへのタイミング処理
  4387.   #--------------------------------------------------------------------------
  4388.   def other_process_timing(timing)
  4389.     se_flag = true
  4390.     se_flag = @se_flag if @se_flag != nil
  4391.     @battler.sv.timing.push([se_flag, timing.dup])
  4392.   end
  4393.   #--------------------------------------------------------------------------
  4394.   # ● 他バトラーへのタイミング処理
  4395.   #--------------------------------------------------------------------------
  4396.   def target_battler_process_timing(timing)
  4397.     for target in @timing_targets
  4398.       target.sv.timing.push([false, timing.dup])
  4399.     end  
  4400.   end
  4401.   #--------------------------------------------------------------------------
  4402.   # ● SE とフラッシュのタイミング処理
  4403.   #--------------------------------------------------------------------------
  4404.   alias animation_process_timing_sprite_base_n03 animation_process_timing
  4405.   def animation_process_timing(timing)
  4406.     target_battler_process_timing(timing) if @timing_targets && @timing_targets != []
  4407.     return other_process_timing(timing) if @next != nil
  4408.     animation_process_timing_sprite_base_n03(timing)
  4409.   end
  4410.   #--------------------------------------------------------------------------
  4411.   # ● アニメーションの解放
  4412.   #--------------------------------------------------------------------------
  4413.   alias dispose_animation_sprite_base_n03 dispose_animation
  4414.   def dispose_animation
  4415.     dispose_animation_sprite_base_n03
  4416.   end
  4417. end


  4418. #==============================================================================
  4419. # ■ Sprite_Battler
  4420. #------------------------------------------------------------------------------
  4421. #  バトラー表示用のスプライトです。
  4422. #==============================================================================
  4423. class Sprite_Battler < Sprite_Base
  4424.   #--------------------------------------------------------------------------
  4425.   # ● 公開インスタンス変数 
  4426.   #--------------------------------------------------------------------------
  4427.   attr_accessor   :removing             # パーティ離脱中
  4428.   #--------------------------------------------------------------------------
  4429.   # ● オブジェクト初期化
  4430.   #--------------------------------------------------------------------------
  4431.   alias initialize_sprite_battler_n03 initialize
  4432.   def initialize(viewport, battler = nil)
  4433.     initialize_sprite_battler_n03(viewport, battler)
  4434.     @real_x = @real_y = 0
  4435.     update_bitmap if @battler != nil
  4436.   end
  4437.   #--------------------------------------------------------------------------
  4438.   # ● アニメーションの開始 ★再定義
  4439.   #--------------------------------------------------------------------------
  4440.   def start_animation(animation, mirror = false)
  4441.     return next_animation(animation, mirror) if animation?
  4442.     @animation = animation
  4443.     if @animation
  4444.       @horming = @battler.sv.anime_horming
  4445.       @anime_camera_zoom = @battler.sv.anime_camera_zoom
  4446.       @anime_no_mirror = @battler.sv.anime_no_mirror
  4447.       @timing_targets = @battler.sv.timing_targets
  4448.       @plus_z = @battler.sv.anime_plus_z
  4449.       @battler.sv.reset_anime_data
  4450.       @ani_mirror = mirror
  4451.       set_animation_rate
  4452.       @ani_duration = @animation.frame_max * @ani_rate + 1
  4453.       load_animation_bitmap
  4454.       make_animation_sprites
  4455.       set_animation_origin
  4456.     end
  4457.   end
  4458.   #--------------------------------------------------------------------------
  4459.   # ● 次のアニメを開始
  4460.   #--------------------------------------------------------------------------
  4461.   def next_animation(animation, mirror)
  4462.     @next_anime = [] if @next_anime == nil
  4463.     @next_anime.push(Sprite_Base.new(viewport))
  4464.     @next_anime[@next_anime.size - 1].set(battler, @battler.sv.anime_horming, @battler.sv.anime_camera_zoom, @battler.sv.anime_no_mirror)
  4465.     @next_anime[@next_anime.size - 1].set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y)
  4466.     @next_anime[@next_anime.size - 1].start_animation(animation, mirror)
  4467.   end
  4468.   #--------------------------------------------------------------------------
  4469.   # ● 影グラフィック作成
  4470.   #--------------------------------------------------------------------------
  4471.   def create_shadow
  4472.     reset_shadow
  4473.     return if @battler.sv.shadow == false
  4474.     @shadow = Sprite.new(viewport) if @shadow == nil
  4475.     @shadow.bitmap = Cache.character(@battler.sv.shadow)
  4476.     @shadow.ox = @shadow.bitmap.width / 2
  4477.     @shadow.oy = @shadow.bitmap.height / 2
  4478.   end
  4479.   #--------------------------------------------------------------------------
  4480.   # ● 影グラフィック初期化
  4481.   #--------------------------------------------------------------------------
  4482.   def reset_shadow
  4483.     return if @shadow == nil
  4484.     @shadow.dispose
  4485.     @shadow = nil
  4486.   end  
  4487.   #--------------------------------------------------------------------------
  4488.   # ● 転送元ビットマップの更新 ★再定義
  4489.   #--------------------------------------------------------------------------
  4490.   def update_bitmap
  4491.     update_bitmap_enemy if !@battler.actor?
  4492.     update_bitmap_actor if @battler.actor?
  4493.     update_src_rect if @battler != nil
  4494.     update_color if @battler != nil
  4495.   end
  4496.   #--------------------------------------------------------------------------
  4497.   # ● 転送元ビットマップ:エネミー
  4498.   #--------------------------------------------------------------------------
  4499.   def update_bitmap_enemy
  4500.     if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
  4501.       @battler_name = @battler.battler_name
  4502.       @battler_hue = @battler.battler_hue
  4503.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4504.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4505.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue)
  4506.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4507.       create_shadow
  4508.       init_visibility
  4509.       @battler_id = @battler.id
  4510.     end
  4511.   end  
  4512.   #--------------------------------------------------------------------------
  4513.   # ● 転送元ビットマップ:アクター
  4514.   #--------------------------------------------------------------------------
  4515.   def update_bitmap_actor
  4516.     if @battler.character_name != @battler_name or @battler.character_index != @battler_index
  4517.       @battler_name = @battler.character_name
  4518.       @battler_index = @battler.character_index
  4519.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4520.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4521.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
  4522.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4523.       create_shadow
  4524.       init_visibility
  4525.       @battler_id = @battler.id
  4526.     end
  4527.   end
  4528.   #--------------------------------------------------------------------------
  4529.   # ● 可視状態の初期化 ★再定義
  4530.   #--------------------------------------------------------------------------
  4531.   def init_visibility
  4532.     @battler_visible = @battler.alive?
  4533.     @battler_visible = true if @battler.sv.state(1) != "敵コラプス"
  4534.     @battler_visible = false if @battler.hidden?
  4535.     @battler.sv.opacity = 0 unless @battler_visible
  4536.     self.opacity = 0 unless @battler_visible
  4537.     self.opacity = 255 if @battler_visible
  4538.     @battler.sv.weapon_visible = @battler_visible
  4539.   end
  4540.   #--------------------------------------------------------------------------
  4541.   # ● 転送元矩形の更新
  4542.   #--------------------------------------------------------------------------
  4543.   def update_src_rect
  4544.     return if @battler.sv.collapse
  4545.     if @battler_graphic_file_index != @battler.sv.graphic_file_index
  4546.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4547.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index) if @battler.actor?
  4548.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue) if !@battler.actor?
  4549.       @battler.sv.set_graphics(self.bitmap.width, self.bitmap.height)
  4550.     end
  4551.     anime_off if @battler.sv.anime_off
  4552.     self.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4553.     self.opacity = @battler.sv.opacity if @battler_visible
  4554.     set_process_timing(@battler.sv.timing) if @battler && @battler.sv.timing != []
  4555.   end
  4556.   #--------------------------------------------------------------------------
  4557.   # ● 位置の更新 ★再定義
  4558.   #--------------------------------------------------------------------------
  4559.   def update_position
  4560.     @real_x = @battler.sv.x / 100
  4561.     @real_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust)/ 100
  4562.     self.x = @real_x - $sv_camera.x
  4563.     self.y = @real_y - $sv_camera.y
  4564.     self.z = @battler.sv.z - @battler.sv.c / 100
  4565.     if @battler.sv.h <= 0
  4566.       self.x += $sv_camera.sx / 100
  4567.       self.y += $sv_camera.sy / 100
  4568.     end  
  4569.     self.x *= $sv_camera.zoom
  4570.     self.y *= $sv_camera.zoom
  4571.   end
  4572.   #--------------------------------------------------------------------------
  4573.   # ● 原点の更新 ★再定義
  4574.   #--------------------------------------------------------------------------
  4575.   def update_origin
  4576.     return if !bitmap or @battler.sv.collapse
  4577.     self.ox = @battler.sv.ox
  4578.     self.oy = @battler.sv.oy
  4579.     self.angle = @battler.sv.angle
  4580.     self.zoom_x = @battler.sv.zoom_x * $sv_camera.zoom
  4581.     self.zoom_y = @battler.sv.zoom_y * $sv_camera.zoom
  4582.     self.mirror = @battler.sv.mirror if !@graphic_mirror_flag
  4583.     self.mirror = !@battler.sv.mirror if @graphic_mirror_flag
  4584.   end
  4585.   #--------------------------------------------------------------------------
  4586.   # ● 影グラフィックの更新
  4587.   #--------------------------------------------------------------------------
  4588.   def update_shadow
  4589.     @shadow.visible = @battler.sv.shadow_visible
  4590.     @shadow.opacity = @battler.sv.opacity if @battler.sv.opacity_data[3]
  4591.     @shadow.opacity = self.opacity if !@battler.sv.opacity_data[3]
  4592.     @shadow.x = @real_x - $sv_camera.x
  4593.     @shadow.y = (@battler.sv.y - @battler.sv.c)/ 100 - $sv_camera.y
  4594.     @shadow.z = @battler.sv.z - 10
  4595.     @shadow.zoom_x = $sv_camera.zoom
  4596.     @shadow.zoom_y = $sv_camera.zoom
  4597.     @shadow.x += $sv_camera.sx / 100
  4598.     @shadow.y += $sv_camera.sy / 100
  4599.     @shadow.x *= $sv_camera.zoom
  4600.     @shadow.y *= $sv_camera.zoom
  4601.     @shadow.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4602.   end
  4603.   #--------------------------------------------------------------------------
  4604.   # ● ふきだしの更新
  4605.   #--------------------------------------------------------------------------
  4606.   def update_balloon
  4607.     if @battler.sv.balloon_data == [] && @balloon
  4608.       @balloon_data = []
  4609.       @balloon.dispose
  4610.       return @balloon = nil
  4611.     elsif @battler.sv.balloon_data != [] && @battler.sv.balloon_data != @balloon_data
  4612.       @balloon_data = @battler.sv.balloon_data
  4613.       @balloon = Sprite.new(self.viewport)
  4614.       @balloon.bitmap = Cache.system("Balloon")
  4615.       @balloon.zoom_x = @balloon_data[3]
  4616.       @balloon.zoom_y = @balloon_data[3]
  4617.       @balloon.ox = 32 if @battler.sv.mirror
  4618.       @balloon.oy = 16
  4619.       @balloon_count = 0
  4620.     end
  4621.     return if !@balloon
  4622.     @balloon.opacity = self.opacity
  4623.     @balloon.x = self.x
  4624.     @balloon.y = self.y - @battler.sv.ch * $sv_camera.zoom
  4625.     @balloon.z = self.z + 20
  4626.     @balloon.src_rect.set(32 + @balloon_count / @balloon_data[2] * 32, @balloon_data[1] * 32, 32, 32) if @balloon_count % @balloon_data[2] == 0
  4627.     @balloon.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4628.     @balloon_count += 1
  4629.     @balloon_count = 0 if @balloon_count == @balloon_data[2] * 7
  4630.   end
  4631.   #--------------------------------------------------------------------------
  4632.   # ● 色調変更の更新
  4633.   #--------------------------------------------------------------------------
  4634.   def update_color
  4635.     color_set if @battler.sv.color_set != []
  4636.     return if @color_data == nil
  4637.     @color_data[4] -= 1
  4638.     if @color_data[4] == 0 && @color_data[5] != 0
  4639.       @color_data[4] = @color_data[5]
  4640.       @color_data[5] = 0
  4641.       @color_data[6] = [0,0,0,0]
  4642.     elsif @color_data[4] == 0
  4643.       @remain_color_data = @color_data
  4644.       @battler.sv.color = @color_data.dup
  4645.       return @color_data = nil
  4646.     end  
  4647.     for i in 0..3
  4648.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  4649.     end  
  4650.     @battler.sv.color = @color_data.dup
  4651.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  4652.   end
  4653.   #--------------------------------------------------------------------------
  4654.   # ● 残像の更新
  4655.   #--------------------------------------------------------------------------
  4656.   def update_mirage
  4657.     if @battler.sv.mirage == [] && @mirages
  4658.       @mirage_data = []
  4659.       for mirage in @mirages do mirage.dispose end
  4660.       return @mirages = nil
  4661.     elsif @battler.sv.mirage != [] && @battler.sv.mirage != @mirage_data
  4662.       @mirage_data = @battler.sv.mirage
  4663.       @mirages = []
  4664.       for i in 0...@mirage_data[1] do @mirages[i] = Sprite.new(self.viewport) end
  4665.       @mirage_count = 0
  4666.     end
  4667.     return if !@mirages
  4668.     @mirage_count += 1
  4669.     @mirage_count = 0 if @mirage_count == @mirage_data[2] * @mirages.size
  4670.     for i in 0...@mirages.size
  4671.       mirage_body(@mirages[i], @mirage_data[4]) if @mirage_count == 1 + i * @mirage_data[2]
  4672.     end
  4673.   end
  4674.   #--------------------------------------------------------------------------
  4675.   # ● 残像本体
  4676.   #--------------------------------------------------------------------------
  4677.   def mirage_body(body, opacity)
  4678.     body.bitmap = self.bitmap.dup
  4679.     body.x = self.x
  4680.     body.y = self.y
  4681.     body.ox = self.ox
  4682.     body.oy = self.oy
  4683.     body.z = self.z - 20
  4684.     body.mirror = self.mirror
  4685.     body.angle = self.angle
  4686.     body.opacity = opacity * self.opacity / 255
  4687.     body.zoom_x = self.zoom_x
  4688.     body.zoom_y = self.zoom_y   
  4689.     body.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4690.     body.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4691.   end   
  4692.   #--------------------------------------------------------------------------
  4693.   # ● 次のアニメを更新
  4694.   #--------------------------------------------------------------------------
  4695.   def update_next_anime
  4696.     return if !@next_anime
  4697.     for anime in @next_anime
  4698.       anime.update
  4699.       anime.set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y) if @horming
  4700.       anime.dispose if !anime.animation?
  4701.       @next_anime.delete(anime) if !anime.animation?
  4702.     end  
  4703.   end
  4704.   #--------------------------------------------------------------------------
  4705.   # ● フレーム更新
  4706.   #--------------------------------------------------------------------------
  4707.   alias update_sprite_battler_n03 update
  4708.   def update
  4709.     @battler.sv.update if @battler
  4710.     update_sprite_battler_n03
  4711.     update_next_anime
  4712.     update_shadow  if @battler && @shadow
  4713.     update_mirage  if @battler
  4714.     update_balloon if @battler
  4715.     update_remove if @battler && @removing && @battler.sv.change_up
  4716.   end
  4717.   #--------------------------------------------------------------------------
  4718.   # ● 戦闘アニメ消去
  4719.   #--------------------------------------------------------------------------
  4720.   def anime_off
  4721.     @battler.sv.anime_off = false
  4722.     dispose_animation
  4723.     for anime in @next_anime do anime.dispose_animation end if @next_anime
  4724.   end
  4725.   #--------------------------------------------------------------------------
  4726.   # ● バトラー入れ替え
  4727.   #--------------------------------------------------------------------------
  4728.   def remove
  4729.     @battler.sv.start_action(@battler.sv.remove_action)
  4730.     $sv_camera.wait = 40
  4731.     @battler.sv.add_action("eval('set_change')")
  4732.     @removing = true
  4733.   end
  4734.   #--------------------------------------------------------------------------
  4735.   # ● バトラー入れ替えの更新
  4736.   #--------------------------------------------------------------------------
  4737.   def update_remove
  4738.     @battler.sv.change_up = false
  4739.     @removing = false
  4740.     @battler = nil
  4741.   end  
  4742.   #--------------------------------------------------------------------------
  4743.   # ● バトラー加入
  4744.   #--------------------------------------------------------------------------
  4745.   def join(join_battler)
  4746.     $sv_camera.wait = 30
  4747.     @battler = join_battler
  4748.     @battler_name = @battler.character_name
  4749.     @battler_index = @battler.character_index
  4750.     @battler_graphic_file_index = @battler.sv.graphic_file_index
  4751.     self.bitmap = Cache.character(@battler_name)
  4752.     @battler.sv.setup(self.bitmap.width, self.bitmap.height, true)
  4753.     create_shadow
  4754.     init_visibility
  4755.   end
  4756.   #--------------------------------------------------------------------------
  4757.   # ● 通常の設定に戻す ★再定義
  4758.   #--------------------------------------------------------------------------
  4759.   def revert_to_normal
  4760.     self.blend_type = 0
  4761.     self.opacity = 255
  4762.   end
  4763.   #--------------------------------------------------------------------------
  4764.   # ● 崩壊エフェクトの更新
  4765.   #--------------------------------------------------------------------------
  4766.   alias update_collapse_sprite_battler_n03 update_collapse
  4767.   def update_collapse
  4768.     return if @battler.sv.state(1) != "敵コラプス"
  4769.     update_collapse_sprite_battler_n03
  4770.     @battler.sv.weapon_visible = false
  4771.   end
  4772.   #--------------------------------------------------------------------------
  4773.   # ● ボス崩壊エフェクトの更新 ★再定義
  4774.   #--------------------------------------------------------------------------
  4775.   def update_boss_collapse
  4776.     @effect_duration = @battler.sv.ch if @effect_duration >= @battler.sv.ch
  4777.     alpha = @effect_duration * 120 / @battler.sv.ch
  4778.     self.ox = @battler.sv.cw / 2 + @effect_duration % 2 * 4 - 2
  4779.     self.blend_type = 1
  4780.     self.color.set(255, 255, 255, 255 - alpha)
  4781.     self.opacity = alpha
  4782.     self.src_rect.y -= 1
  4783.     Sound.play_boss_collapse2 if @effect_duration % 20 == 19
  4784.   end
  4785.   #--------------------------------------------------------------------------
  4786.   # ● 別スプライトからのタイミング処理
  4787.   #--------------------------------------------------------------------------
  4788.   def set_process_timing(timing_data)
  4789.     for data in timing_data
  4790.       set_timing(data[0],data[1])
  4791.     end
  4792.     @battler.sv.timing = []
  4793.   end
  4794.   #--------------------------------------------------------------------------
  4795.   # ● タイミング処理
  4796.   #--------------------------------------------------------------------------
  4797.   def set_timing(se_flag, data)
  4798.     @ani_rate = 4
  4799.     data.se.play if se_flag
  4800.     case data.flash_scope
  4801.     when 1 ;self.flash(data.flash_color, data.flash_duration * @ani_rate)
  4802.     when 2 ;viewport.flash(data.flash_color, data.flash_duration * @ani_rate) if viewport
  4803.     when 3 ;self.flash(nil, data.flash_duration * @ani_rate)
  4804.     end
  4805.   end
  4806.   #--------------------------------------------------------------------------
  4807.   # ● 色調変更
  4808.   #--------------------------------------------------------------------------
  4809.   def color_set
  4810.     set = @battler.sv.color_set
  4811.     @battler.sv.color_set= []
  4812.     set[4] = 1 if set[4] == 0
  4813.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  4814.     @color_data = @remain_color_data
  4815.     @color_data[4] = set[4]
  4816.     @color_data[5] = set[5]
  4817.     @color_data[6] = set
  4818.   end
  4819.   #--------------------------------------------------------------------------
  4820.   # ● 解放
  4821.   #--------------------------------------------------------------------------
  4822.   alias dispose_sprite_battler_n03 dispose
  4823.   def dispose
  4824.     dispose_sprite_battler_n03
  4825.     @shadow.dispose if @shadow != nil
  4826.     @balloon.dispose if @balloon != nil
  4827.     for mirage in @mirages do mirage.dispose end if @mirages != nil
  4828.     for anime in @next_anime do anime.dispose end if @next_anime
  4829.   end
  4830. end


  4831. #==============================================================================
  4832. # ■ Spriteset_Battle
  4833. #------------------------------------------------------------------------------
  4834. #  バトル画面のスプライトをまとめたクラスです。
  4835. #==============================================================================
  4836. class Spriteset_Battle
  4837.   #--------------------------------------------------------------------------
  4838.   # ● 戦闘背景(床)スプライトの作成 ★再定義
  4839.   #--------------------------------------------------------------------------
  4840.   def create_battleback1
  4841.     @back1_sprite = Sprite_Battle_Back.new(@viewport1, 1, battleback1_name)
  4842.     @back1_sprite.set_graphics(battleback1_bitmap) if battleback1_name != nil
  4843.     @back1_sprite.z = 0
  4844.   end
  4845.   #--------------------------------------------------------------------------
  4846.   # ● 戦闘背景(壁)スプライトの作成 ★再定義
  4847.   #--------------------------------------------------------------------------
  4848.   def create_battleback2
  4849.     @back2_sprite = Sprite_Battle_Back.new(@viewport1, 2, battleback2_name)
  4850.     @back2_sprite.set_graphics(battleback2_bitmap) if battleback2_name != nil
  4851.     @back2_sprite.z = 1
  4852.   end
  4853.   #--------------------------------------------------------------------------
  4854.   # ● アクタースプライトの作成 ★再定義
  4855.   #--------------------------------------------------------------------------
  4856.   def create_actors
  4857.     @actor_sprites = []
  4858.     for i in 0...$game_party.max_battle_members
  4859.       @actor_sprites[i] = Sprite_Battler.new(@viewport1, $game_party.members[i])
  4860.     end
  4861.     @effect_sprites = Spriteset_Sideview.new(@viewport1)
  4862.   end
  4863.   #--------------------------------------------------------------------------
  4864.   # ● アクタースプライトの更新 ★再定義
  4865.   #--------------------------------------------------------------------------
  4866.   def update_actors
  4867.     @actor_sprites.each_with_index do |sprite, i|
  4868.       sprite_join($game_party.members[i], sprite) if sprite.battler == nil && sprite.battler != $game_party.members[i]
  4869.       sprite.remove if sprite.battler != nil && !sprite.removing && sprite.battler != $game_party.members[i]
  4870.       sprite.update
  4871.     end
  4872.     @effect_sprites.update
  4873.     update_program
  4874.   end
  4875.   #--------------------------------------------------------------------------
  4876.   # ● メンバーを加える
  4877.   #--------------------------------------------------------------------------
  4878.   def sprite_join(member, sprite)
  4879.     for sp in @actor_sprites
  4880.       sp.update_remove if member == sp.battler && !sp.battler.sv.change_up
  4881.     end
  4882.     sprite.join(member)
  4883.   end
  4884.   #--------------------------------------------------------------------------
  4885.   # ● バトルプログラムの更新
  4886.   #--------------------------------------------------------------------------
  4887.   def update_program
  4888.     return if $sv_camera.program_scroll == []
  4889.     for data in  $sv_camera.program_scroll
  4890.       @back1_sprite.start_back_data(data) if data[2] == 1
  4891.       @back2_sprite.start_back_data(data) if data[2] == 2
  4892.     end
  4893.     $sv_camera.program_scroll = []
  4894.   end
  4895.   #--------------------------------------------------------------------------
  4896.   # ● ヒット時の戦闘アニメ実行
  4897.   #--------------------------------------------------------------------------
  4898.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  4899.     @effect_sprites.set_hit_animation(battler, weapon_index, hit_targets, miss)
  4900.   end
  4901.   #--------------------------------------------------------------------------
  4902.   # ● ダメージPOP
  4903.   #--------------------------------------------------------------------------
  4904.   def set_damage_pop(target)
  4905.     @effect_sprites.set_damage_pop(target)
  4906.   end
  4907.   #--------------------------------------------------------------------------
  4908.   # ● 解放
  4909.   #--------------------------------------------------------------------------
  4910.   alias dispose_spriteset_battle_n03 dispose
  4911.   def dispose
  4912.     dispose_spriteset_battle_n03
  4913.     @effect_sprites.dispose
  4914.   end
  4915.   
  4916.   
  4917.   
  4918. end


  4919. #==============================================================================
  4920. # ■ Window_BattleLog
  4921. #------------------------------------------------------------------------------
  4922. #  戦闘の進行を実況表示するウィンドウです。
  4923. #==============================================================================
  4924. class Window_BattleLog < Window_Selectable
  4925.   #--------------------------------------------------------------------------
  4926.   # ● ウェイト ★再定義
  4927.   #--------------------------------------------------------------------------
  4928.   def wait
  4929.   end
  4930.   #--------------------------------------------------------------------------
  4931.   # ● ウェイトとクリア ★再定義
  4932.   #--------------------------------------------------------------------------
  4933.   def wait_and_clear
  4934.     $sv_camera.wait = 10
  4935.   end
  4936.   #--------------------------------------------------------------------------
  4937.   # ● 行動結果の表示 ★再定義
  4938.   #--------------------------------------------------------------------------
  4939.   def display_action_results(target, item)
  4940.     if target.result.used
  4941.       last_line_number = line_number
  4942.       display_critical(target, item)
  4943.       display_damage(target, item)
  4944.       display_affected_status(target, item)
  4945.       display_failure(target, item)
  4946.     end
  4947.     off if !N03::BATTLE_LOG
  4948.   end
  4949.   #--------------------------------------------------------------------------
  4950.   # ● ウインドウ非表示
  4951.   #--------------------------------------------------------------------------
  4952.   def off
  4953.     @back_sprite.visible = self.visible = false
  4954.   end
  4955. end
  4956. #==============================================================================
  4957. # ■ Game_Interpreter
  4958. #------------------------------------------------------------------------------
  4959. #  イベントコマンドを実行するインタプリタです。
  4960. #==============================================================================
  4961. class Game_Interpreter
  4962.   #--------------------------------------------------------------------------
  4963.   # ● スイッチの操作
  4964.   #--------------------------------------------------------------------------
  4965.   alias command_121_game_interpreter_n03 command_121
  4966.   def command_121
  4967.     command_121_game_interpreter_n03
  4968.     $sv_camera.program_check
  4969.   end
  4970. end
复制代码
QQ图片122222.png

老鹰

梦石
40
星屑
38044
在线时间
7127 小时
注册时间
2012-5-26
回帖
3306

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2020-7-20 22:51:09 | 显示全部楼层
74到80行改成
  1.   #--------------------------------------------------------------------------
  2.   # ● 释放
  3.   #--------------------------------------------------------------------------
  4.   alias enemy_hp_dispose dispose
  5.   def dispose
  6.     enemy_hp_dispose
  7.     @enemy_hpmp_window.dispose if @enemy_hpmp_window
  8.   end
复制代码

并且确保这个粗糙的敌人血条脚本,放置于 Sideview 之上……

点评

fjm
非常感谢,问题解决了  发表于 2020-7-20 23:20

评分

参与人数 1赞 +1 收起 理由
fjm + 1 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部