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

Project1

 找回密码
 注册会员
搜索
查看: 735|回复: 1

[已经过期] 关于战斗中闪避、防御、暴击显示的问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
417
在线时间
78 小时
注册时间
2017-10-25
帖子
50
发表于 2019-9-15 00:45:21 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 VIPArcher 于 2022-6-16 15:55 编辑

各位大佬
我现在用的是Sideview100横版战斗系统
1.不知怎么才能实现闪避or防御敌人攻击后角色头上能冒出“闪避”“防御”俩字~就像显示伤害数字一样的那种~
2.还有一个好像比较复杂的问题,就是显示暴击数字的时候,怎么才能让暴击数字先大后小(先5000接着缩小成5000然后消失),实现那种暴击的感觉呢???

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Sideview Ver100
  3. #------------------------------------------------------------------------------
  4. #  サイドビューバトラーを管理するクラスです。
  5. #==============================================================================
  6. class SideView
  7.   #--------------------------------------------------------------------------
  8.   # ● 公開インスタンス変数 
  9.   #--------------------------------------------------------------------------
  10.   attr_accessor   :x                    # 画面X座標
  11.   attr_accessor   :y                    # 画面Y座標
  12.   attr_accessor   :z                    # 画面Z座標
  13.   attr_accessor   :h                    # 高さ座標
  14.   attr_accessor   :j                    # ジャンプ座標
  15.   attr_accessor   :c                    # カーブ座標
  16.   attr_accessor   :ox                   # 横原点
  17.   attr_accessor   :oy                   # 縦原点
  18.   attr_accessor   :oy_adjust            # 縦原点補正
  19.   attr_accessor   :angle                # 回転角度
  20.   attr_accessor   :zoom_x               # 横の拡大率
  21.   attr_accessor   :zoom_y               # 縦の拡大率
  22.   attr_accessor   :pattern_w            # セル横位置(矩形内)
  23.   attr_accessor   :pattern_h            # セル縦位置(矩形内)
  24.   attr_accessor   :sx                   # セル横位置(画像全体)
  25.   attr_accessor   :sy                   # セル縦位置(画像全体)
  26.   attr_accessor   :pattern_type         # セル更新タイプ
  27.   attr_accessor   :pattern_time         # セル更新間隔
  28.   attr_accessor   :graphic_name         # バトラー画像ファイル名
  29.   attr_accessor   :graphic_file_index   # バトラー画像ファイル名インデックス
  30.   attr_accessor   :graphic_index        # バトラー画像インデックス
  31.   attr_accessor   :cw                   # セル横矩形
  32.   attr_accessor   :ch                   # セル縦矩形
  33.   attr_accessor   :shadow_visible       # 影表示
  34.   attr_accessor   :weapon_visible       # 武器表示
  35.  
  36.   attr_accessor   :wait                 # 次の動作待ち時間
  37.   attr_accessor   :weapon_index         # 表示中の武器画像インデックス配列
  38.   attr_accessor   :weapon_end           # 武器アニメ終了フラグ
  39.   attr_accessor   :force_action         # 強制アクション
  40.   attr_accessor   :target_battler       # ターゲットバトラー情報
  41.   attr_accessor   :second_targets       # セカンドターゲット情報
  42.   attr_accessor   :m_a_targets          # アニメ飛ばしターゲット情報
  43.   attr_accessor   :individual_targets   # 個別処理ターゲットバトラー情報
  44.   attr_accessor   :effect_data          # エフェクトデータ
  45.   attr_accessor   :anime_id             # アニメID配列
  46.   attr_accessor   :anime_move_id        # 飛ばしアニメID配列
  47.   attr_accessor   :mirror               # 反転フラグ
  48.   attr_accessor   :opacity              # 透明度
  49.   attr_accessor   :opacity_data         # 透明度操作情報
  50.   attr_accessor   :set_damage           # バトルシーンでのダメージ処理
  51.   attr_accessor   :m_a_data             # アニメ飛ばし情報
  52.   attr_accessor   :m_a_starter          # アニメ飛ばし開始ターゲット情報
  53.   attr_accessor   :action_end           # バトルシーンでの行動終了
  54.   attr_accessor   :damage_anime_data    # ダメージ戦闘アニメのデータ
  55.   attr_accessor   :anime_no_mirror      # 戦闘アニメの反転禁止フラグ
  56.   attr_accessor   :anime_horming        # 戦闘アニメのホーミングフラグ
  57.   attr_accessor   :anime_camera_zoom    # 戦闘アニメがカメラに合わせて拡大縮小するか
  58.   attr_accessor   :anime_plus_z         # 戦闘アニメZ座標補正
  59.   attr_accessor   :derivation_skill_id  # スキル派生ID
  60.   attr_accessor   :immortal             # 不死身フラグ
  61.   attr_accessor   :mirage               # 残像データ
  62.   attr_accessor   :balloon_data         # ふきだしデータ
  63.   attr_accessor   :timing               # 別バトラーからのタイミングデータ
  64.   attr_accessor   :timing_targets       # タイミングデータを渡す別バトラー
  65.   attr_accessor   :color_set            # 色調変更データ
  66.   attr_accessor   :color                # 色調データ
  67.   attr_accessor   :change_up            # 画像変更フラグ
  68.   attr_accessor   :hit                  # 被攻撃回数
  69.   attr_accessor   :add_state            # 何度も付加ステートの表示を防ぐフラグ
  70.   attr_accessor   :counter_id           # カウンター時のスキルID
  71.   attr_accessor   :reflection_id        # 魔法反射時のアニメID
  72.   attr_accessor   :result_damage        # ターン終了時のHP変動データ
  73.   attr_accessor   :active               # 行動権
  74.   attr_accessor   :anime_off            # 戦闘アニメ消去
  75.   attr_accessor   :command_action       # コマンドアクションフラグ
  76.  
  77.   attr_accessor   :base_x               # 初期位置 X座標
  78.   attr_accessor   :base_y               # 初期位置 Y座標
  79.   attr_accessor   :base_h               # 初期位置 高さ座標
  80.   attr_accessor   :max_pattern_w        # セルの横分割数
  81.   attr_accessor   :max_pattern_h        # セルの縦分割数
  82.  
  83.   attr_reader     :collapse             # コラプスフラグ
  84.   attr_reader     :picture              # ピクチャ表示フラグ
  85.   #--------------------------------------------------------------------------
  86.   # ● オブジェクト初期化
  87.   #--------------------------------------------------------------------------
  88.   def initialize(battler)
  89.     @battler = battler
  90.     reset
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 初期化
  94.   #--------------------------------------------------------------------------
  95.   def reset
  96.     @x = 0
  97.     @y = 0
  98.     @z = 0
  99.     @h = 0
  100.     @j = 0
  101.     @c = 0
  102.     @jump = []
  103.     @curve = []
  104.     @ox = 0
  105.     @oy = 0
  106.     @oy_adjust = 0
  107.     @z_plus = 0
  108.     @move_time = 0
  109.     @angle = 0
  110.     @angle_time = 0
  111.     @zoom_x = 1
  112.     @zoom_y = 1
  113.     @zoom_time = 0
  114.     @pattern_w = 0
  115.     @pattern_h = 0
  116.     @sx = 0
  117.     @sy = 0
  118.     @pattern_type = 0
  119.     @pattern_time = 0
  120.     @pattern_rest_time = 0
  121.     @graphic_name = ""
  122.     @graphic_file_index = ""
  123.     @graphic_index = 0
  124.     @cw = 0
  125.     @ch = 0
  126.     @shadow_visible = false
  127.     @weapon_visible = true
  128.  
  129.     @wait = 0
  130.     @weapon_index = []
  131.     @weapon_end = true
  132.     @full_action = []
  133.     @action = []
  134.     @force_action = ""
  135.     @target_battler = []
  136.     @second_targets = []
  137.     @individual_targets = []
  138.     @m_a_targets = []
  139.     @effect_data = []
  140.     @anime_id = []
  141.     @anime_move_id = []
  142.     @opacity = 255
  143.     @opacity_data = []
  144.     @set_damage = false
  145.     @m_a_data = []
  146.     @m_a_starter = []
  147.     @action_end = false
  148.     @damage_anime_data = []
  149.     @anime_no_mirror = false
  150.     @anime_horming = false
  151.     @anime_camera_zoom = false
  152.     @anime_plus_z = true
  153.     @derivation_skill_id = 0
  154.     @immortal = false
  155.     @mirage = []
  156.     @play_data = []
  157.     @balloon_data = []
  158.     @picture = false
  159.     @timing = []
  160.     @timing_targets = []
  161.     @color_set = []
  162.     @color = []
  163.     @change_up = false
  164.     @non_motion = false
  165.     @graphics_change = false
  166.     @hit = []
  167.     @add_state = []
  168.     @collapse = false
  169.     @counter_id = 0
  170.     @reflection_id = 0
  171.     @result_damage = [0,0]
  172.     @active = false
  173.     @anime_off = false
  174.     @command_action = false
  175.  
  176.     @base_x = 0
  177.     @base_y = 0
  178.     @base_z = 0
  179.     @base_h = 0
  180.     @max_pattern_w = 0
  181.     @max_pattern_h = 0
  182.     @pattern_kind = 0
  183.     @pattern_count = 0
  184.     @move_time = 0
  185.     @mirror = false
  186.     @battler.set_graphic(@pre_change_data[0], @pre_change_data[1], @pre_change_data[2], @pre_change_data[3]) if @pre_change_data != nil
  187.     @pre_change_data = nil
  188.   end  
  189.   #--------------------------------------------------------------------------
  190.   # ● セットアップ
  191.   #--------------------------------------------------------------------------
  192.   def setup(bitmap_width, bitmap_height, first_action_flag)
  193.     reset if first_action_flag
  194.     set_data
  195.     set_base_position if !@graphics_change
  196.     set_graphics(bitmap_width, bitmap_height)
  197.     set_target
  198.     setup_graphics_change if @graphics_change
  199.     first_battler_anime_set if first_action_flag
  200.   end  
  201.   #--------------------------------------------------------------------------
  202.   # ● バトラーデータ取得
  203.   #--------------------------------------------------------------------------
  204.   def set_data
  205.     return if @battler == nil
  206.     if @battler.actor?
  207.       @graphic_name = @battler.character_name
  208.       @graphic_index = @battler.character_index
  209.     else
  210.       @graphic_name = @battler.battler_name
  211.       @graphic_index = 0
  212.     end
  213.     @max_pattern_w = max_pattern[0]
  214.     @max_pattern_h = max_pattern[1]
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● ベース座標をセット data = [X軸, Y軸, H軸]  moment_set…瞬間配置
  218.   #--------------------------------------------------------------------------
  219.   def set_base_position(moment_set = true)
  220.     mirroring_reset
  221.     if @battler.actor?
  222.       data = N03::ACTOR_POSITION[@battler.index].dup
  223.       @base_x = data[0] * 100 if !@mirror
  224.       @base_x = (Graphics.width - data[0]) * 100 if @mirror
  225.     else
  226.       data = [@battler.screen_x, @battler.screen_y, 0].dup
  227.       @base_x = data[0] * 100 if !$sv_camera.mirror
  228.       @base_x = (Graphics.width - data[0]) * 100 if $sv_camera.mirror
  229.     end
  230.     @base_y = data[1] * 100
  231.     @base_h = data[2] * 100
  232.     @base_z = @y
  233.     return if !moment_set
  234.     @x = @base_x
  235.     @y = @base_y
  236.     @z = @base_z
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● グラフィックデータ取得
  240.   #--------------------------------------------------------------------------
  241.   def set_graphics(bitmap_width, bitmap_height)
  242.     sign = @graphic_name[/^[\!\$]./]
  243.     if sign && sign.include?(')
  244.       @cw = bitmap_width / @max_pattern_w
  245.       @ch = bitmap_height / @max_pattern_h
  246.     elsif @max_pattern_w == 1 && @max_pattern_h == 1
  247.       @cw = bitmap_width
  248.       @ch = bitmap_height
  249.     else
  250.       @cw = bitmap_width / (@max_pattern_w * 4)
  251.       @ch = bitmap_height / (@max_pattern_h * 2)
  252.     end
  253.     @ox = @cw / 2
  254.     @oy = @ch
  255.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  256.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ● ターゲットをセット
  260.   #--------------------------------------------------------------------------
  261.   def set_target(target = nil)
  262.     @target_battler = target
  263.     @target_battler = [@battler] if target == nil
  264.     @second_targets = @target_battler
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● 画像変更用のセットアップ
  268.   #--------------------------------------------------------------------------
  269.   def setup_graphics_change
  270.     @graphics_change = false
  271.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  272.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  273.   end  
  274.   #--------------------------------------------------------------------------
  275.   # ● 戦闘開始時の待機アニメ画像データ取得
  276.   #--------------------------------------------------------------------------
  277.   def first_battler_anime_set
  278.     loop do
  279.       update
  280.       break if @action_data == nil
  281.       break if @action_data[0] == "motion"
  282.       break if @action_data[0] == "move" && @action_data[8] != ""
  283.       break if @full_action == []
  284.     end
  285.     start_action(first_action) if @battler.movable?
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● アクション開始
  289.   #--------------------------------------------------------------------------
  290.   def start_action(kind = nil)
  291.     return if @event_fix && $game_troop.interpreter.running?
  292.     # ウェイト中の場合キャンセル
  293.     return @wait -= 1 if @wait > 0 && kind == nil
  294.     action_setup(false) if kind != nil
  295.     set_action(kind)
  296.     @action = kind if @action == nil
  297.     # 行動配列が無い場合は行動終了処理へ移行
  298.     action_terminate if @action == nil
  299.     # 次のアクション決定
  300.     @action_data = N03::ACTION[@action]
  301.     next_action
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 行動パラメータの初期化
  305.   #--------------------------------------------------------------------------
  306.   def action_setup(reset = true)
  307.     @event_fix = false
  308.     @set_damage = false
  309.     @action_end = false
  310.     @balloon_data = []
  311.     @loop_act = []
  312.     angle_reset if reset
  313.     zoom_reset if reset
  314.     opacity_reset if reset
  315.     @curve = []
  316.     @c = 0
  317.     convert_jump
  318.   end  
  319.   #--------------------------------------------------------------------------
  320.   # ● 行動終了処理
  321.   #--------------------------------------------------------------------------
  322.   def action_terminate
  323.     @mirage = [] if @mirage_end
  324.     mirroring_reset
  325.     @picture = false
  326.     @individual_targets = []
  327.     action_setup if @active
  328.     action_setup(false) if !@active
  329.     # 待機アクションへ移行
  330.     stand_by_action if !@non_motion
  331.     # 戦闘行動のアクティブ権を終了
  332.     next_battler
  333.   end  
  334.   #--------------------------------------------------------------------------
  335.   # ● 新しいアクション内容の決定
  336.   #--------------------------------------------------------------------------
  337.   def set_action(kind = nil)
  338.     full_act = N03::FULLACTION[kind]
  339.     @full_action = full_act.dup if full_act != nil
  340.     @action = @full_action.shift
  341.     # 参照したアクションがフルアクションであれば全体のアクションを統合
  342.     full_act2 = N03::FULLACTION[@action]
  343.     @full_action = full_act2.dup + @full_action if full_act2 != nil
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 次のアクションへ
  347.   #--------------------------------------------------------------------------
  348.   def next_action
  349.     @wait = 0
  350.     # ショートカット確認
  351.     eval(@action) if @action != nil && @action_data == nil && N03::FULLACTION[@action] == nil
  352.     # ウエイト設定
  353.     @wait = @action.to_i if @wait == 0 && @action_data == nil
  354.     @wait = rand(@wait.abs + 1) if @wait < 0
  355.     # アクション開始
  356.     action_play
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● 待機アクションへ移行
  360.   #--------------------------------------------------------------------------
  361.   def stand_by_action
  362.     # 通常待機に
  363.     stand_by_act = normal
  364.     # HPが1/4でピンチアクションに
  365.     stand_by_act = pinch if @battler.hp <= @battler.mhp / 4
  366.     # ステートチェック
  367.     stand_by_act = state(@battler.states[0].id) if @battler.states[0] != nil && state(@battler.states[0].id) != nil
  368.     # コマンドチェック
  369.     stand_by_act = command if @command_action && command != nil
  370.     set_action(stand_by_act)
  371.     @action = stand_by_act if @action == nil
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 強制アクション開始
  375.   #--------------------------------------------------------------------------
  376.   def start_force_action
  377.     return if @active
  378.     start_action(@force_action)
  379.     @force_action = ""
  380.   end  
  381.   #--------------------------------------------------------------------------
  382.   # ● アクション追加
  383.   #--------------------------------------------------------------------------
  384.   def add_action(kind)
  385.     @full_action.push(kind)
  386.   end  
  387.   #--------------------------------------------------------------------------
  388.   # ● アクションの挿入
  389.   #--------------------------------------------------------------------------
  390.   def unshift_action(kind)
  391.     @full_action.unshift(kind)
  392.   end  
  393.   #--------------------------------------------------------------------------
  394.   # ● フレーム更新
  395.   #--------------------------------------------------------------------------
  396.   def update
  397.     # アクション開始
  398.     start_action
  399.     # 強制アクション開始
  400.     start_force_action if @force_action != ""
  401.     # アニメパターン更新
  402.     update_pattern
  403.     # 移動更新
  404.     update_move
  405.     # 回転更新
  406.     update_angle if @angle_time != 0
  407.     # 拡大縮小更新
  408.     update_zoom if @zoom_time != 0
  409.     # 透明度更新
  410.     update_opacity if @opacity_data != []
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ● アニメパターン更新
  414.   #--------------------------------------------------------------------------
  415.   def update_pattern
  416.     return @pattern_rest_time -= 1 if @pattern_rest_time != 0
  417.     return if @max_pattern_w == 1 && @max_pattern_h == 1
  418.     @pattern_rest_time = @pattern_time
  419.     # 再生開始・終了セル位置を取得
  420.     if @pattern_kind > 0 # 通常再生中
  421.       @pattern_start = 0
  422.       @pattern_end = @max_pattern_w - 1
  423.     elsif @pattern_kind < 0 # 逆転再生中
  424.       @pattern_start = @max_pattern_w - 1
  425.       @pattern_end = 0
  426.     end
  427.     # 片道の再生が終了
  428.     @pattern_count += 1 if @pattern_w == @pattern_end && @pattern_kind != 0
  429.     # ループ処理
  430.     case @pattern_type.abs
  431.     when  1,3 # 片道
  432.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type ==  1
  433.       @pattern_kind =  0 if @pattern_count != 0 && @pattern_type == -1
  434.       @pattern_kind =  1 if @pattern_count != 0 && @pattern_type ==  3
  435.       @pattern_kind = -1 if @pattern_count != 0 && @pattern_type == -3
  436.       @pattern_w = @pattern_start - @pattern_kind if @pattern_count != 0 && @pattern_type.abs == 3
  437.       @pattern_count = 0
  438.     when  2,4 # 往復
  439.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  2
  440.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -2
  441.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type ==  2
  442.       @pattern_kind =  0 if @pattern_count == 2 && @pattern_type == -2
  443.       @pattern_kind = -1 if @pattern_count == 1 && @pattern_type ==  4
  444.       @pattern_kind =  1 if @pattern_count == 1 && @pattern_type == -4
  445.       @pattern_kind =  1 if @pattern_count == 2 && @pattern_type ==  4
  446.       @pattern_kind = -1 if @pattern_count == 2 && @pattern_type == -4
  447.       @pattern_count = 0 if @pattern_count == 2
  448.     end
  449.     # セル更新
  450.     @pattern_w += 1 * @pattern_kind
  451.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ● 移動の更新
  455.   #--------------------------------------------------------------------------
  456.   def update_move
  457.     @z = @y / 100 + @z_plus
  458.     return if @move_time == 0
  459.     target_position_set if @horming_move
  460.     @x = (@x * (@move_time - 1) + @target_x) / @move_time
  461.     @y = (@y * (@move_time - 1) + @target_y) / @move_time
  462.     @h = (@h * (@move_time - 1) + @target_h) / @move_time if @move_h != nil
  463.     @c += @curve[@move_time - 1] if @curve[@move_time - 1] != nil
  464.     @j += @jump[@move_time - 1] if @jump[@move_time - 1] != nil
  465.     @move_time -= 1
  466.     convert_jump if @move_time == 0
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # ● 移動目標の更新
  470.   #--------------------------------------------------------------------------
  471.   def target_position_set
  472.     target_position = N03.get_targets_position(@move_targets, @horming_move)
  473.     @target_x = target_position[0] + @move_x
  474.     @target_y = target_position[1] + @move_y
  475.     @target_h = target_position[2] + @move_h if @move_h != nil
  476.   end  
  477.   #--------------------------------------------------------------------------
  478.   # ● 回転更新
  479.   #--------------------------------------------------------------------------
  480.   def update_angle
  481.     @angle += @angling
  482.     @angle_time -= 1
  483.     return if @angle_time != 0
  484.     return angle_reset if @angle_data[4] == 0
  485.     angling(@angle_data) if @angle_data[4] == 2
  486.   end  
  487.   #--------------------------------------------------------------------------
  488.   # ● 拡大縮小更新
  489.   #--------------------------------------------------------------------------
  490.   def update_zoom
  491.     @zoom_x += @zooming_x
  492.     @zoom_y += @zooming_y
  493.     @zoom_time -= 1
  494.     return if @zoom_time != 0
  495.     return zoom_reset if @zoom_data[4] == 0
  496.     zooming(@zoom_data) if @zoom_data[4] == 2
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ● 透明度更新
  500.   #--------------------------------------------------------------------------
  501.   def update_opacity
  502.     @opacity += @opacity_data[2]
  503.     @opacity_data[0] -= 1
  504.     return if @opacity_data[0] != 0
  505.     return if !@opacity_data[5]
  506.     @opacity_data[2] *= -1
  507.     @opacity_data[0] = @opacity_data[1]
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # ● アクション実行
  511.   #--------------------------------------------------------------------------
  512.   def action_play
  513.     return if @action_data == nil
  514.     action = @action_data[0]
  515.     # バトラー反転の場合
  516.     return mirroring                    if action == "mirror"
  517.     # 残像の場合
  518.     return mirage_set                   if action == "mirage"
  519.     # 回転の場合  
  520.     return angling                      if action == "angle"
  521.     # 拡大縮小の場合  
  522.     return zooming                      if action == "zoom"
  523.     # 透明度操作の場合  
  524.     return set_opacity                  if action == "opacity"
  525.     # バトラーアニメの場合
  526.     return battler_anime                if action == "motion"
  527.     # 移動の場合
  528.     return move                         if action == "move"
  529.     # 武器アニメの場合
  530.     return weapon_anime([@action_data]) if action == "wp"
  531.     # アニメ飛ばしの場合
  532.     return move_anime                   if action == "m_a"
  533.     # 戦闘シーン通信の場合(コラプス)
  534.     return set_play_data                if action == "collapse" or action == "no_collapse"
  535.     # データベース戦闘アニメ表示の場合  
  536.     return battle_anime                 if action == "anime"
  537.     # カメラワークの場合
  538.     return camera                       if action == "camera"
  539.     # 画面のシェイクの場合
  540.     return shake                        if action == "shake"
  541.     # 画面色調変更の場合
  542.     return color_effect                 if action == "color"
  543.     # トランジションの場合
  544.     return transition                   if action == "ts"
  545.     # ふきだしアニメ表示の場合  
  546.     return balloon_anime                if action == "balloon"
  547.     # ピクチャ表示の場合
  548.     return picture_set                  if action == "pic"
  549.     # ステート操作の場合
  550.     return state_set                    if action == "sta"
  551.     # FPS変更の場合
  552.     return fps                          if action == "fps"
  553.     # バトラー画像変更の場合  
  554.     return graphics_change              if action == "change"
  555.     # スキル派生の場合  
  556.     return derivating_skill             if action == "der"
  557.     # BGM/BGS/SE演奏の場合  
  558.     return sound                        if action == "sound"
  559.     # ムービー再生の場合  
  560.     return movie                        if action == "movie"
  561.     # ゲームスイッチ操作の場合  
  562.     return switches                     if action == "switch"
  563.     # ゲーム変数操作の場合  
  564.     return variable                     if action == "variable"
  565.     # 条件分岐(ゲームスイッチ)の場合
  566.     return nece_1                       if action == "n_1"
  567.     # 条件分岐(ゲーム変数)の場合
  568.     return nece_2                       if action == "n_2"
  569.     # 条件分岐(ステート)の場合
  570.     return nece_3                       if action == "n_3"
  571.     # 条件分岐(スキル)の場合
  572.     return nece_4                       if action == "n_4"
  573.     # 条件分岐(パラメータ)の場合
  574.     return nece_5                       if action == "n_5"
  575.     # 条件分岐(装備)の場合
  576.     return nece_6                       if action == "n_6"
  577.     # 条件分岐(スクリプト)の場合
  578.     return nece_7                       if action == "n_7"
  579.     # セカンドターゲット操作の場合  
  580.     return second_targets_set           if action == "s_t"
  581.     # コモンイベント呼び出しの場合  
  582.     return call_common_event            if action == "common"
  583.     # 戦闘アニメ消去の場合  
  584.     return @anime_off = true            if action == "anime_off"
  585.     # 強制戦闘終了の場合  
  586.     return BattleManager.process_abort  if action == "battle_end"
  587.     # 画面固定の場合  
  588.     return Graphics.freeze              if action == "graphics_freeze"
  589.     # ダメージアニメの場合  
  590.     return damage_anime                 if action == "damage_anime"
  591.     # 武器消去の場合  
  592.     return @weapon_visible = false      if action == "weapon_off"
  593.     # 武器消去解除の場合  
  594.     return @weapon_visible = true       if action == "weapon_on"
  595.     # 待機キャンセルの場合
  596.     return @non_motion = true           if action == "non_motion"
  597.     # 待機キャンセル解除の場合
  598.     return @non_motion = false          if action == "non_motion_cancel"
  599.     # 初期位置変更の場合
  600.     return change_base_position         if action == "change_base_position"
  601.     # 初期位置変更解除の場合
  602.     return set_base_position(false)     if action == "set_base_position"
  603.     # 強制アクションの場合  
  604.     return force_act                    if action == "force_action"
  605.     # 強制アクションの場合 (セカンドターゲット)
  606.     return force_act2                   if action == "force_action2"
  607.     # 個別開始の場合
  608.     return individual_start             if action == "individual_start"
  609.     # 個別終了の場合
  610.     return individual_end               if action == "individual_end"
  611.     # ループ開始の場合
  612.     return loop_start                   if action == "loop_start"
  613.     # ループ終了の場合
  614.     return loop_end                     if action == "loop_end"
  615.     # 自分のみ更新の場合
  616.     return only_action_on               if action == "only_action_on"
  617.     # 自分のみ更新解除の場合
  618.     return only_action_off              if action == "only_action_off"
  619.     # 次の行動者へ移行の場合
  620.     return next_battler                 if action == "next_battler"
  621.     # 画像変更フラグの場合
  622.     return set_change                   if action == "set_change"
  623.     # スクリプト操作の場合   
  624.     return eval(@action_data[0])
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # ● バトラー反転実行
  628.   #--------------------------------------------------------------------------
  629.   def mirroring
  630.     @mirror = !@mirror
  631.   end  
  632.   #--------------------------------------------------------------------------
  633.   # ● 反転初期化
  634.   #--------------------------------------------------------------------------
  635.   def mirroring_reset
  636.     @mirror = false
  637.     mirroring if [email protected]? && N03::ENEMY_MIRROR
  638.     mirroring if $sv_camera.mirror
  639.   end  
  640.   #--------------------------------------------------------------------------
  641.   # ● 残像実行
  642.   #--------------------------------------------------------------------------
  643.   def mirage_set
  644.     @mirage = @action_data.dup
  645.     @mirage_end = @mirage[3]
  646.     @mirage = [] if @mirage[1] == 0
  647.   end  
  648.   #--------------------------------------------------------------------------
  649.   # ● 回転実行
  650.   #--------------------------------------------------------------------------
  651.   def angling(data = @action_data)
  652.     @angle_data = data.dup
  653.     @oy = @ch / 2
  654.     @oy_adjust = @ch * 50
  655.     @angle_time = data[1]
  656.     start_angle = data[2] * N03.mirror_num(@mirror)
  657.     end_angle = data[3] * N03.mirror_num(@mirror)
  658.     # 時間が0以下なら即座に最終角度へ
  659.     @angle_time = 1 if @angle_time <= 0
  660.     # 回転時間から1フレームあたりの角度を出す
  661.     @angling = (end_angle - start_angle) / @angle_time
  662.     # 割り切れない余りを初期角度に
  663.     @angle = (end_angle - start_angle) % @angle_time + start_angle
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ● 回転初期化
  667.   #--------------------------------------------------------------------------
  668.   def angle_reset
  669.     @oy = @ch
  670.     @angle = @angle_time = @oy_adjust = 0
  671.   end  
  672.   #--------------------------------------------------------------------------
  673.   # ● 拡大縮小実行
  674.   #--------------------------------------------------------------------------
  675.   def zooming(data = @action_data)
  676.     @zoom_data = data.dup
  677.     @zoom_time = data[1]
  678.     start_zoom_x = data[2][0]
  679.     start_zoom_y = data[2][1]
  680.     end_zoom_x = data[3][0]
  681.     end_zoom_y = data[3][1]
  682.     # 時間が0以下なら即座に最終サイズへ
  683.     @zoom_time = 1 if @zoom_time <= 0
  684.     # 拡大縮小時間から1フレームあたりの拡大縮小率を出す
  685.     @zooming_x = (end_zoom_x - start_zoom_x) / @zoom_time
  686.     @zooming_y = (end_zoom_y - start_zoom_y) / @zoom_time
  687.     # 開始サイズに
  688.     @zoom_x = start_zoom_x
  689.     @zoom_y = start_zoom_y
  690.   end  
  691.   #--------------------------------------------------------------------------
  692.   # ● 拡大縮小初期化
  693.   #--------------------------------------------------------------------------
  694.   def zoom_reset
  695.     @zoom_x = @zoom_y = 1
  696.     @zoom_time = 0
  697.   end  
  698.   #--------------------------------------------------------------------------
  699.   # ● バトラー透明度操作
  700.   #--------------------------------------------------------------------------
  701.   def set_opacity
  702.     data = @action_data.dup
  703.     @opacity = data[2]
  704.     opacity_move = (data[3] - data[2])/ data[1]
  705.     @opacity_data = [data[1], data[1], opacity_move, data[4], data[5], data[6]]
  706.     @wait = data[1] if data[7]
  707.     @wait *= 2 if data[6] && data[7]
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● 透明度操作初期化
  711.   #--------------------------------------------------------------------------
  712.   def opacity_reset
  713.     @opacity = 255
  714.     @opacity = 0 if @battler.hidden?
  715.     @opacity_data = []
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ● バトラーアニメ実行
  719.   #--------------------------------------------------------------------------
  720.   def battler_anime(anime_data = nil)
  721.     anime_data = @action_data.dup if anime_data == nil
  722.     @graphic_file_index = anime_data[1] if !graphic_fix
  723.     @pattern_h = anime_data[2]
  724.     @pattern_w = anime_data[3]
  725.     @pattern_h = 0 if @max_pattern_w == 1
  726.     @pattern_w = 0 if @max_pattern_h == 1
  727.     @pattern_type = anime_data[4]
  728.     @pattern_time = anime_data[5]
  729.     @pattern_rest_time = anime_data[5]
  730.     @pattern_count = 0
  731.     @pattern_kind = 1
  732.     @pattern_kind = -1 if @pattern_type < 0
  733.     @pattern_kind = 0 if @pattern_type == 0
  734.     @sx = (@graphic_index % 4 * @max_pattern_w + @pattern_w) * @cw
  735.     @sy = (@graphic_index / 4 * @max_pattern_h + @pattern_h) * @ch
  736.     @z_plus = anime_data[6]
  737.     @wait = set_anime_wait if anime_data[7]
  738.     @shadow_visible = anime_data[8]
  739.     weapon_anime(anime_data)
  740.   end
  741.   #--------------------------------------------------------------------------
  742.   # ● アニメウエイト計算
  743.   #--------------------------------------------------------------------------
  744.   def set_anime_wait
  745.     if @pattern_type > 0
  746.       pattern_time_a = @max_pattern_w - @pattern_w.abs
  747.     elsif @pattern_type < 0
  748.       pattern_time_a = @pattern_w.abs + 1
  749.     else
  750.       return @pattern_time if @pattern_type == 0
  751.     end
  752.     case @pattern_type
  753.     when 1,-1, 3,-3
  754.       return pattern_time_a * @pattern_time
  755.     when 2,-2, 4,-4
  756.       return pattern_time_a * @pattern_time + (@max_pattern_w - 2) * @pattern_time
  757.     end
  758.   end  
  759.   #--------------------------------------------------------------------------
  760.   # ● 移動実行
  761.   #--------------------------------------------------------------------------
  762.   def move
  763.     @move_targets = N03.get_targets(@action_data[1].abs, @battler)
  764.     return if @move_targets == []
  765.     @move_targets = [@battler] if @action_data[1].abs == 7
  766.     @move_x = @action_data[2] * 100 * N03.mirror_num(@mirror)
  767.     @move_y = @action_data[3] * 100
  768.     @move_h = @action_data[4] * 100 if @action_data[4] != nil
  769.     @move_h = nil if @action_data[4] == nil
  770.     battler_anime(N03::ACTION[@action_data[8]].dup) if N03::ACTION[@action_data[8]] != nil
  771.     @horming_move = true
  772.     @horming_move = false if @action_data[1] < 0 or @action_data[1].abs == 7
  773.     target_position_set
  774.     target_position = [@target_x, @target_y, @target_z]
  775.     distanse_move = @action_data[5] > 0
  776.     @move_time = N03.distanse_calculation(@action_data[5].abs, target_position, [@x, @y, @z], distanse_move)
  777.     @wait = @move_time
  778.     curve
  779.     jump
  780.     @move_time = 1 if @move_time == 0
  781.     @horming_move = false if !@move_targets or @move_targets.include?(@battler)
  782.     update_move if @move_time == 1
  783.   end  
  784.   #--------------------------------------------------------------------------
  785.   # ● カーブ実行
  786.   #--------------------------------------------------------------------------
  787.   def curve
  788.     @c = 0
  789.     return if @action_data[6] == 0
  790.     @curve = N03.parabola([@action_data[6], -@action_data[6]], @move_time, 100, 4)
  791.   end  
  792.   #--------------------------------------------------------------------------
  793.   # ● ジャンプ実行
  794.   #--------------------------------------------------------------------------
  795.   def jump
  796.     convert_jump
  797.     return if @action_data[7] == [0,0]
  798.     @jump = N03.parabola(@action_data[7].dup, @move_time, 100)
  799.   end  
  800.   #--------------------------------------------------------------------------
  801.   # ● J座標(ジャンプ高度)をH座標に変換
  802.   #--------------------------------------------------------------------------
  803.   def convert_jump
  804.     @h += @j
  805.     @j = 0
  806.     @jump = []
  807.   end  
  808.   #--------------------------------------------------------------------------
  809.   # ● データベース戦闘アニメ実行
  810.   #--------------------------------------------------------------------------
  811.   def battle_anime
  812.     data = @action_data.dup
  813.     targets = N03.get_targets(data[2], @battler)
  814.     return if targets == []
  815.     data[8] = !data[8] if @mirror
  816.     @set_damage           = data[5]
  817.     @damage_anime_data[0] = N03.get_attack_anime_id(data[1], @battler)
  818.     @damage_anime_data[1] = data[8]
  819.     @damage_anime_data[2] = data[7]
  820.     @damage_anime_data[3] = data[6]
  821.     @damage_anime_data[4] = data[9]
  822.     @wait = N03.get_anime_time(@damage_anime_data[0]) - 2 if data[4]
  823.     return if @set_damage
  824.     for target in targets do display_anime(targets, target, data) end
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # ● 武器アニメ開始
  828.   #--------------------------------------------------------------------------
  829.   def weapon_anime(anime_data)
  830.     @weapon_end = true
  831.     for i in 9...anime_data.size
  832.       set_effect_data(anime_data[i]) if anime_data[i] != ""
  833.     end
  834.   end
  835.   #--------------------------------------------------------------------------
  836.   # ● アニメ飛ばし開始
  837.   #--------------------------------------------------------------------------
  838.   def move_anime
  839.     @m_a_starter = []
  840.     @m_a_targets = []
  841.     starters = N03.get_targets(@action_data[2], @battler)
  842.     targets = N03.get_targets(@action_data[3], @battler)
  843.     return if starters == [] or targets == []
  844.     single_start = true if starters != nil && @action_data[2] < 0
  845.     single_start = true if @action_data[1][0] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][0], @battler)].position == 3
  846.     starters = [starters[0]] if single_start
  847.     single_end = true if targets != nil && @action_data[3] < 0
  848.     single_end = true if @action_data[1][1] != 0 && $data_animations[N03.get_attack_anime_id(@action_data[1][1], @battler)].position == 3
  849.     targets = [targets[0]] if single_end
  850.     se_flag = true
  851.     for starter in starters
  852.       for target in targets
  853.         data = @action_data.dup
  854.         data[17] = se_flag
  855.         @effect_data.push(data)
  856.         @m_a_targets.push(target)
  857.         @m_a_starter.push(starter)
  858.         se_flag = false
  859.       end
  860.     end  
  861.   end
  862.   #--------------------------------------------------------------------------
  863.   # ● スプライトセット通信
  864.   #--------------------------------------------------------------------------
  865.   def set_effect_data(data = @action)
  866.     action_data = N03::ACTION[data]
  867.     return if action_data == nil
  868.     @effect_data.push(action_data.dup)
  869.   end
  870.   #--------------------------------------------------------------------------
  871.   # ● 戦闘シーン通信のデータを格納
  872.   #--------------------------------------------------------------------------
  873.   def set_play_data(data = @action_data)
  874.     @play_data = data.dup
  875.   end
  876.   #--------------------------------------------------------------------------
  877.   # ● 戦闘アニメの表示
  878.   #--------------------------------------------------------------------------
  879.   def display_anime(targets, target, data)
  880.     return if !N03.first_of_all_screen_anime(data[1], target, targets)
  881.     target.animation_id         = N03.get_attack_anime_id(data[1], @battler)
  882.     target.animation_mirror     = data[8]
  883.     target.sv.anime_horming     = data[3]
  884.     target.sv.anime_camera_zoom = data[6]
  885.     target.sv.anime_no_mirror   = data[7]
  886.     target.sv.anime_plus_z      = data[9]
  887.   end
  888.   #--------------------------------------------------------------------------
  889.   # ● 戦闘アニメ拡張データの初期化
  890.   #--------------------------------------------------------------------------
  891.   def reset_anime_data
  892.     @anime_no_mirror = false
  893.     @anime_horming = false
  894.     @anime_camera_zoom = false
  895.     @timing_targets = []
  896.     @anime_plus_z = true
  897.   end  
  898.   #--------------------------------------------------------------------------
  899.   # ● カメラワーク
  900.   #--------------------------------------------------------------------------
  901.   def camera
  902.     data = @action_data.dup
  903.     N03.camera(@battler, data)
  904.     @wait = data[4] if data[5]
  905.   end  
  906.   #--------------------------------------------------------------------------
  907.   # ● 画面のシェイク
  908.   #--------------------------------------------------------------------------
  909.   def shake
  910.     data = @action_data.dup
  911.     $sv_camera.shake(data[1], data[2], data[3])
  912.     @wait = data[3] if data[4]
  913.   end
  914.   #--------------------------------------------------------------------------
  915.   # ● 画面色調変更
  916.   #--------------------------------------------------------------------------
  917.   def color_effect
  918.     case @action_data[1]
  919.     when 0,1,2,3,4,5
  920.       targets = N03.get_targets(@action_data[1], @battler)
  921.     when 6
  922.       screen = true
  923.     when 7
  924.       targets = [@battler] + @target_battler
  925.     when 8
  926.       screen = true
  927.       targets = $game_troop.members + $game_party.battle_members - [@battler]
  928.     when 9
  929.       screen = true
  930.       targets = $game_troop.members + $game_party.battle_members - [@battler] - @target_battler
  931.     when 10
  932.       screen = true
  933.       targets = $game_troop.members + $game_party.battle_members
  934.     end
  935.     return if screen == nil && targets == []
  936.     for target in targets do target.sv.color_set = @action_data[2] end if targets
  937.     @wait = @action_data[2][4] if @action_data[3]
  938.     return if !screen
  939.     $sv_camera.color_set[1] = @action_data[2]
  940.     $sv_camera.color_set[2] = @action_data[2]
  941.   end  
  942.   #--------------------------------------------------------------------------
  943.   # ● トランジション
  944.   #--------------------------------------------------------------------------
  945.   def transition
  946.     $sv_camera.perform_transition(@action_data)
  947.   end  
  948.   #--------------------------------------------------------------------------
  949.   # ● ふきだしアニメ表示
  950.   #--------------------------------------------------------------------------
  951.   def balloon_anime
  952.     @balloon_data = @action_data.dup
  953.   end  
  954.   #--------------------------------------------------------------------------
  955.   # ● ピクチャ表示
  956.   #--------------------------------------------------------------------------
  957.   def picture_set
  958.     @picture = true
  959.     set_effect_data
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● ステート操作
  963.   #--------------------------------------------------------------------------
  964.   def state_set
  965.     targets = N03.get_targets(@action_data[1], @battler)
  966.     return if targets == []
  967.     case @action_data[2]
  968.     when 1 ; targets = [targets[rand(targets.size)]]
  969.     when 2 ; targets -= @battler if targets.include?(@battler)
  970.     end
  971.     for target in targets
  972.       for id in @action_data[4]
  973.         target.add_state(id) if @action_data[3] == "+"
  974.         target.remove_state(id) if @action_data[3] == "-"
  975.       end
  976.     end
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ● FPS変更
  980.   #--------------------------------------------------------------------------
  981.   def fps
  982.     Graphics.frame_rate = @action_data[1]
  983.     start_action
  984.   end
  985.   #--------------------------------------------------------------------------
  986.   # ● バトラー画像変更の場合
  987.   #--------------------------------------------------------------------------
  988.   def graphics_change
  989.     @graphics_change = true
  990.     return @battler.graphics_change(@action_data[3]) if [email protected]?
  991.     @pre_change_data = [@battler.character_name, @battler.character_index, @battler.face_name, @battler.face_index] if @pre_change_data == nil && !@action_data[1]
  992.     if @action_data[4] == []
  993.       face_name = @battler.face_name
  994.       face_index = @battler.face_index
  995.     else
  996.       face_name = @action_data[4][1]
  997.       face_index = @action_data[4][0]
  998.     end
  999.     @battler.set_graphic(@action_data[3], @action_data[2], face_name, face_index)
  1000.   end
  1001.   #--------------------------------------------------------------------------
  1002.   # ● スキル派生
  1003.   #--------------------------------------------------------------------------
  1004.   def derivating_skill
  1005.     # 未修得スキルは派生不可なら
  1006.     return if !@action_data[1] && [email protected]_learn?($data_skills[@action_data[3]])
  1007.     # コスト不足は派生不可なら
  1008.     return if !@action_data[2] && [email protected]_cost_payable?($data_skills[@action_data[3]])
  1009.     # 派生
  1010.     @derivation_skill_id = @action_data[3]
  1011.     # 以降のアクションをキャンセル
  1012.     @full_action = []
  1013.   end
  1014.   #--------------------------------------------------------------------------
  1015.   # ● BGM/BGS/SE演奏
  1016.   #--------------------------------------------------------------------------
  1017.   def sound
  1018.     pitch = @action_data[2]
  1019.     vol   = @action_data[3]
  1020.     name  = @action_data[4]
  1021.     case @action_data[1]
  1022.     when "se"
  1023.       Audio.se_play("Audio/SE/" + name, vol, pitch)
  1024.     when "bgm"
  1025.       # 名前指定のない場合、現在のBGMを変えないように
  1026.       name = RPG::BGM.last.name if @action_data[4] == ""
  1027.       Audio.bgm_play("Audio/BGM/" + name, vol, pitch)
  1028.     when "bgs"
  1029.       name = RPG::BGS.last.name if @action_data[4] == ""
  1030.       Audio.bgs_play("Audio/BGS/" + name, vol, pitch)
  1031.     end
  1032.   end
  1033.   #--------------------------------------------------------------------------
  1034.   # ● ムービーの再生
  1035.   #--------------------------------------------------------------------------
  1036.   def movie
  1037.     Graphics.play_movie('Movies/' + @action_data[1])
  1038.   end
  1039.   #--------------------------------------------------------------------------
  1040.   # ● ゲームスイッチ操作
  1041.   #--------------------------------------------------------------------------
  1042.   def switches
  1043.     for id in @action_data[1]
  1044.       $game_switches[id] = true if id > 0
  1045.       $sv_camera.switches[id.abs] = true  if id < 0
  1046.     end
  1047.     for id in @action_data[2]
  1048.       $game_switches[id] = false if id > 0
  1049.       $sv_camera.switches[id.abs] = false  if id < 0
  1050.     end
  1051.     $sv_camera.program_check
  1052.   end
  1053.   #--------------------------------------------------------------------------
  1054.   # ● ゲーム変数操作
  1055.   #--------------------------------------------------------------------------
  1056.   def variable
  1057.     # オペランドチェック
  1058.     operand = @action_data[3]
  1059.     operand = $game_variables[@action_data[3].abs] if @action_data[3] < 0
  1060.     # 変数操作で分岐
  1061.     case @action_data[2]
  1062.     when 0 ; $game_variables[@action_data[1]] = operand  # 代入
  1063.     when 1 ; $game_variables[@action_data[1]] += operand # 加算
  1064.     when 2 ; $game_variables[@action_data[1]] -= operand # 減算
  1065.     when 3 ; $game_variables[@action_data[1]] *= operand # 乗算
  1066.     when 4 ; $game_variables[@action_data[1]] /= operand # 除算
  1067.     when 5 ; $game_variables[@action_data[1]] %= operand # 剰余
  1068.     end
  1069.   end  
  1070.   #--------------------------------------------------------------------------
  1071.   # ● 条件分岐 (ゲームスイッチ)
  1072.   #--------------------------------------------------------------------------
  1073.   def nece_1
  1074.     judgment = $game_switches[@action_data[1]] == @action_data[2] if @action_data[1] > 0
  1075.     judgment = $sv_camera.switches[@action_data[1].abs] == @action_data[2] if @action_data[1] < 0
  1076.     action_diverging(judgment, @action_data[3])
  1077.   end  
  1078.   #--------------------------------------------------------------------------
  1079.   # ● 条件分岐 (ゲーム変数)
  1080.   #--------------------------------------------------------------------------
  1081.   def nece_2
  1082.     variable = $game_variables[@action_data[1]]
  1083.     num = @action_data[2]
  1084.     num = $game_variables[@action_data[2].abs] if num < 0
  1085.     case @action_data[3]
  1086.     when 0 ; judgment = variable == num
  1087.     when 1 ; judgment = variable < num
  1088.     when 2 ; judgment = variable > num
  1089.     end  
  1090.     action_diverging(judgment, @action_data[4])
  1091.   end  
  1092.   #--------------------------------------------------------------------------
  1093.   # ● 条件分岐 (ステート)
  1094.   #--------------------------------------------------------------------------
  1095.   def nece_3
  1096.     targets = N03.get_targets(@action_data[1], @battler)
  1097.     return if targets == []
  1098.     member_num = @action_data[4]
  1099.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1100.     hit_count = 0
  1101.     miss_count = 0
  1102.     for target in targets
  1103.       hit_count += 1 if target.state?(@action_data[2])
  1104.       miss_count += 1 if !target.state?(@action_data[2])
  1105.     end
  1106.     case @action_data[3]
  1107.     when 0 ; judgment = hit_count >= member_num
  1108.     when 1 ; judgment = miss_count >= member_num
  1109.     end
  1110.     action_diverging(judgment, @action_data[5])
  1111.   end  
  1112.   #--------------------------------------------------------------------------
  1113.   # ● 条件分岐 (スキル)
  1114.   #--------------------------------------------------------------------------
  1115.   def nece_4
  1116.     targets = N03.get_targets(@action_data[1], @battler)
  1117.     return if targets == []
  1118.     member_num = @action_data[4]
  1119.     member_num = targets.size if @action_data[4] == 0 && targets.size > 1
  1120.     hit_count = 0
  1121.     miss_count = 0
  1122.     for target in targets
  1123.       hit_count += 1 if target.skill_learn?($data_skills[@action_data[2]]) && target.skill_conditions_met?($data_skills[@action_data[2]])
  1124.       miss_count += 1 if !target.skill_learn?($data_skills[@action_data[2]]) or !target.skill_conditions_met?($data_skills[@action_data[2]])
  1125.     end
  1126.     case @action_data[3]
  1127.     when 0 ; judgment = hit_count >= member_num
  1128.     when 1 ; judgment = miss_count >= member_num
  1129.     end
  1130.     action_diverging(judgment, @action_data[5])
  1131.   end  
  1132.   #--------------------------------------------------------------------------
  1133.   # ● 条件分岐 (パラメータ)
  1134.   #--------------------------------------------------------------------------
  1135.   def nece_5
  1136.     targets = N03.get_targets(@action_data[1], @battler)
  1137.     return if targets == []
  1138.     member_num = @action_data[5]
  1139.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1140.     hit_count = 0
  1141.     for target in targets
  1142.       hit_count += 1 if target.comparison_parameter([@action_data[2],@action_data[3],@action_data[4]])
  1143.     end
  1144.     judgment = hit_count >= member_num
  1145.     action_diverging(judgment, @action_data[6])
  1146.   end  
  1147.   #--------------------------------------------------------------------------
  1148.   # ● 条件分岐 (装備)
  1149.   #--------------------------------------------------------------------------
  1150.   def nece_6
  1151.     targets = N03.get_targets(@action_data[1], @battler)
  1152.     return if targets == []
  1153.     member_num = @action_data[5]
  1154.     member_num = targets.size if @action_data[5] == 0 && targets.size > 1
  1155.     hit_count = 0
  1156.     miss_count = 0
  1157.     for target in targets
  1158.       hit_count += 1 if target.comparison_equip([@action_data[2],@action_data[3]])
  1159.       miss_count += 1 if !target.comparison_equip([@action_data[2],@action_data[3]])
  1160.     end
  1161.     case @action_data[4]
  1162.     when 0 ; judgment = hit_count >= member_num
  1163.     when 1 ; judgment = miss_count >= member_num
  1164.     end
  1165.     action_diverging(judgment, @action_data[6])
  1166.   end  
  1167.   #--------------------------------------------------------------------------
  1168.   # ● 条件分岐 (スクリプト)
  1169.   #--------------------------------------------------------------------------
  1170.   def nece_7
  1171.     judgment = eval(@action_data[2])
  1172.     action_diverging(judgment, @action_data[1])
  1173.   end  
  1174.   #--------------------------------------------------------------------------
  1175.   # ● アクション分岐  
  1176.   #--------------------------------------------------------------------------
  1177.   def action_diverging(judgment, kind)
  1178.     result = 0
  1179.     if judgment
  1180.       result = 1 if kind == 1
  1181.       result = 2 if kind == 2
  1182.     else
  1183.       result = 1 if kind == 0
  1184.     end
  1185.     # フルアクション終了
  1186.     return @full_action = []  if result == 2
  1187.     # 次のアクションを除去
  1188.     @full_action.shift if result == 1
  1189.     set_action
  1190.     # 次のアクションを実行
  1191.     @action_data = N03::ACTION[@action]
  1192.     next_action
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # ● セカンドターゲット操作
  1196.   #--------------------------------------------------------------------------
  1197.   def second_targets_set
  1198.     targets = N03.get_targets(@action_data[1], @battler)
  1199.     for target in targets
  1200.       targets.delete(target) if @action_data[2][1] == 1 && target.index != @action_data[2][0]
  1201.       targets.delete(target) if @action_data[2][1] == 2 && target.index == @action_data[2][0].abs
  1202.       targets.delete(target) if @action_data[3] > 0 && target.id != @action_data[3]
  1203.       targets.delete(target) if @action_data[3] < 0 && target.id == @action_data[3].abs
  1204.       targets.delete(target) if @action_data[4] > 0 && !target.state?(@action_data[4])
  1205.       targets.delete(target) if @action_data[4] < 0 && target.state?(@action_data[4].abs)
  1206.       targets.delete(target) if @action_data[5] > 0 && !target.skill_conditions_met?($data_skills[@action_data[5]])
  1207.       targets.delete(target) if @action_data[5] < 0 && target.skill_conditions_met?($data_skills[@action_data[5].abs])
  1208.       targets.delete(target) if !target.comparison_parameter(@action_data[6])
  1209.       targets.delete(target) if !@action_data[7][1].include?(0) && !target.comparison_equip(@action_data[7])
  1210.     end
  1211.     return @second_targets = [] if targets.size == 0
  1212.     case @action_data[8]
  1213.     when 1 ; targets = [targets[rand(targets.size)]]
  1214.     when 2 ; targets.delete(@battler)
  1215.     end
  1216.     return @second_targets = [] if targets.size == 0
  1217.     @second_targets = targets
  1218.     case @action_data[9]
  1219.     when 0 ; return
  1220.     when 1 ; set_play_data(["second_targets_set"])
  1221.     when 2 ; set_play_data(["targets_set"])
  1222.     end
  1223.     @wait += 1
  1224.   end
  1225.   #--------------------------------------------------------------------------
  1226.   # ● コモンイベント呼び出し
  1227.   #--------------------------------------------------------------------------
  1228.   def call_common_event
  1229.     $game_temp.reserve_common_event(@action_data[1])
  1230.     $sv_camera.event = true
  1231.     @event_fix = @action_data[2]
  1232.   end
  1233.   #--------------------------------------------------------------------------
  1234.   # ● ダメージアニメ
  1235.   #--------------------------------------------------------------------------
  1236.   def damage_anime(delay_time = 12)
  1237.     anime(N03.get_attack_anime_id(-3, @battler), wait = true)
  1238.     action_play
  1239.     @wait -= delay_time
  1240.     @full_action.unshift("eval('@damage_anime_data = []
  1241.     @set_damage = true')")
  1242.   end
  1243.   #--------------------------------------------------------------------------
  1244.   # ● 通常コラプス
  1245.   #--------------------------------------------------------------------------
  1246.   def normal_collapse
  1247.     @collapse = true
  1248.     return
  1249.   end
  1250.   #--------------------------------------------------------------------------
  1251.   # ● 初期位置変更
  1252.   #--------------------------------------------------------------------------
  1253.   def change_base_position
  1254.     @base_x = @x
  1255.     @base_y = @y
  1256.     @base_h = @h
  1257.   end  
  1258.   #--------------------------------------------------------------------------
  1259.   # ● 強制アクション実行
  1260.   #--------------------------------------------------------------------------
  1261.   def force_act
  1262.     target(@full_action.shift)
  1263.   end
  1264.   #--------------------------------------------------------------------------
  1265.   # ● 強制アクション実行 (セカンドターゲット)
  1266.   #--------------------------------------------------------------------------
  1267.   def force_act2
  1268.     target2(@full_action.shift)
  1269.   end
  1270.   #--------------------------------------------------------------------------
  1271.   # ● 個別処理開始
  1272.   #--------------------------------------------------------------------------
  1273.   def individual_start
  1274.     @individual_targets = @target_battler.dup
  1275.     @remain_targets = @target_battler.dup
  1276.     @target_battler = [@individual_targets[0]]
  1277.     # リピート部分のアクションを保持
  1278.     @individual_act = @full_action.dup
  1279.   end
  1280.   #--------------------------------------------------------------------------
  1281.   # ● 個別処理終了
  1282.   #--------------------------------------------------------------------------
  1283.   def individual_end
  1284.     @individual_targets.shift
  1285.     for target in @individual_targets
  1286.       @individual_targets.shift if target.dead?
  1287.     end
  1288.     # ターゲットが残っているなら行動リピート
  1289.     return @target_battler = @remain_targets if @individual_targets.size == 0
  1290.     @full_action = @individual_act.dup
  1291.     @target_battler = [@individual_targets[0]]
  1292.   end
  1293.   #--------------------------------------------------------------------------
  1294.   # ● ループ開始
  1295.   #--------------------------------------------------------------------------
  1296.   def loop_start
  1297.     # ループ部分のアクションを保持
  1298.     @loop_act = @full_action.dup
  1299.   end
  1300.   #--------------------------------------------------------------------------
  1301.   # ● ループ終了
  1302.   #--------------------------------------------------------------------------
  1303.   def loop_end
  1304.     # 行動リピート
  1305.     @full_action = @loop_act.dup if @loop_act != []
  1306.   end
  1307.   #--------------------------------------------------------------------------
  1308.   # ● 次の行動者へ移行
  1309.   #--------------------------------------------------------------------------
  1310.   def next_battler
  1311.     @action_end = true
  1312.     @active = false
  1313.   end
  1314.   #--------------------------------------------------------------------------
  1315.   # ● 画像変更フラグ
  1316.   #--------------------------------------------------------------------------
  1317.   def set_change
  1318.     @change_up = true
  1319.   end
  1320.   #--------------------------------------------------------------------------
  1321.   # ● 戦闘シーン通信
  1322.   #--------------------------------------------------------------------------
  1323.   def play_data
  1324.     data = @play_data
  1325.     @play_data = []
  1326.     return data
  1327.   end
  1328.   #--------------------------------------------------------------------------
  1329.   # ● ショートカットコマンド
  1330.   #--------------------------------------------------------------------------
  1331.   def anime(anime_id, wait = true)
  1332.     @action_data = ["anime",anime_id,1,false,wait,false,true,false]
  1333.   end
  1334.   def anime_me(anime_id, wait = true)
  1335.     @action_data = ["anime",anime_id,0,false,wait,false,true,false]
  1336.   end
  1337.   def se(file, pitch = 100)
  1338.     @action_data = ["sound",  "se", pitch, 100, file]
  1339.   end
  1340.   def target(act)
  1341.     for target in @target_battler do target.sv.force_action = act end
  1342.   end
  1343.   def target2(act)
  1344.     for target in @second_targets do target.sv.force_action = act end
  1345.   end
  1346.   def delay(time)
  1347.     @wait = @battler.index * time
  1348.   end
  1349.   #--------------------------------------------------------------------------
  1350.   # ● バトラーのIDを取得
  1351.   #--------------------------------------------------------------------------
  1352.   def id
  1353.     return @battler.id if @battler.actor?
  1354.     return [email protected]
  1355.   end
  1356.   #--------------------------------------------------------------------------
  1357.   # ● 被クリティカルフラグを取得
  1358.   #--------------------------------------------------------------------------
  1359.   def critical?
  1360.     return @battler.result.critical
  1361.   end
  1362.   #--------------------------------------------------------------------------
  1363.   # ● 被回復フラグを取得
  1364.   #--------------------------------------------------------------------------
  1365.   def recovery?
  1366.     recovery = false
  1367.     recovery = true if @battler.result.hp_damage < 0
  1368.     recovery = true if @battler.result.mp_damage < 0
  1369.     recovery = true if @battler.result.tp_damage < 0
  1370.     return recovery
  1371.   end
  1372.   #--------------------------------------------------------------------------
  1373.   # ● 被スキルIDを取得
  1374.   #--------------------------------------------------------------------------
  1375.   def damage_skill_id
  1376.     return @damage_skill_id
  1377.   end
  1378.   #--------------------------------------------------------------------------
  1379.   # ● 被アイテムIDを取得
  1380.   #--------------------------------------------------------------------------
  1381.   def damage_item_id
  1382.     return @damage_item_id
  1383.   end
  1384.   #--------------------------------------------------------------------------
  1385.   # ● 装備武器を取得
  1386.   #--------------------------------------------------------------------------
  1387.   def weapon_id
  1388.     return 0 if [email protected][0]
  1389.     return @battler.weapons[0].id
  1390.   end
  1391.   #--------------------------------------------------------------------------
  1392.   # ● 装備武器のタイプを取得
  1393.   #--------------------------------------------------------------------------
  1394.   def weapon_type
  1395.     return 0 if [email protected][0]
  1396.     return @battler.weapons[0].wtype_id
  1397.   end
  1398.   #--------------------------------------------------------------------------
  1399.   # ● 盾を装備しているか
  1400.   #--------------------------------------------------------------------------
  1401.   def shield?
  1402.     for armor in @battler.armors do return true if armor != nil && armor.etype_id == 1 end
  1403.     return false
  1404.   end
  1405.   #--------------------------------------------------------------------------
  1406.   # ● ダメージがあるか
  1407.   #--------------------------------------------------------------------------
  1408.   def damage_zero?
  1409.     return @battler.result.hp_damage == 0 && @battler.result.mp_damage == 0 && @battler.result.tp_damage == 0
  1410.   end
  1411.   #--------------------------------------------------------------------------
  1412.   # ● スキルIDを取得
  1413.   #--------------------------------------------------------------------------
  1414.   def skill_id
  1415.     return @counter_id if @counter_id != 0
  1416.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1417.     return 0 if @battler.current_action.item.is_a?(RPG::Item)
  1418.     return @battler.current_action.item.id
  1419.   end
  1420.   #--------------------------------------------------------------------------
  1421.   # ● スキルのタイプを取得
  1422.   #--------------------------------------------------------------------------
  1423.   def skill_type
  1424.     return 0 if skill_id == 0
  1425.     return $data_skills[skill_id].stype_id
  1426.   end
  1427.   #--------------------------------------------------------------------------
  1428.   # ● スキル名を取得
  1429.   #--------------------------------------------------------------------------
  1430.   def skill_name
  1431.     return "" if skill_id == 0
  1432.     return $data_skills[skill_id].name
  1433.   end
  1434.   #--------------------------------------------------------------------------
  1435.   # ● アイテムIDを取得
  1436.   #--------------------------------------------------------------------------
  1437.   def item_id
  1438.     return 0 if @battler.current_action == nil or @battler.current_action.item == nil
  1439.     return @battler.current_action.item.id
  1440.   end
  1441.   #--------------------------------------------------------------------------
  1442.   # ● 攻撃アクション
  1443.   #--------------------------------------------------------------------------
  1444.   def attack_action(item)
  1445.     return skill_action if item.is_a?(RPG::Skill)
  1446.     return item_action
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # ● ダメージアクションベース
  1450.   #--------------------------------------------------------------------------
  1451.   def damage_action_base(item)
  1452.     @damage_skill_id = 0
  1453.     @damage_item_id = 0
  1454.     @damage_skill_id = item.id if item.is_a?(RPG::Skill)
  1455.     @damage_item_id = item.id if item.is_a?(RPG::Item)
  1456.   end  
  1457.   #--------------------------------------------------------------------------
  1458.   # ● ダメージアクション
  1459.   #--------------------------------------------------------------------------
  1460.   def damage_action(attacker, item)
  1461.     damage_action_base(item)
  1462.     act = damage(attacker)
  1463.     return if @active
  1464.     start_action(act) if act != nil
  1465.   end
  1466.   #--------------------------------------------------------------------------
  1467.   # ● 回避アクション
  1468.   #--------------------------------------------------------------------------
  1469.   def evasion_action(attacker, item)
  1470.     damage_action_base(item)
  1471.     act = evasion(attacker)
  1472.     return if @active
  1473.     start_action(act) if act != nil
  1474.   end
  1475.   #--------------------------------------------------------------------------
  1476.   # ● ミスアクション
  1477.   #--------------------------------------------------------------------------
  1478.   def miss_action(attacker, item)
  1479.     damage_action_base(item)
  1480.     act = miss(attacker)
  1481.     return if @active
  1482.     start_action(act) if act != nil
  1483.   end
  1484.   #--------------------------------------------------------------------------
  1485.   # ● 閃きスクリプト併用処理
  1486.   #--------------------------------------------------------------------------
  1487.   def flash_action
  1488.     return "閃き"
  1489.   end
  1490.  
  1491. end
  1492.  
  1493.  
  1494. #==============================================================================
  1495. # ■ module N03
  1496. #------------------------------------------------------------------------------
  1497. #  サイドビューバトルのモジュールです。
  1498. #==============================================================================
  1499. module N03
  1500.   #--------------------------------------------------------------------------
  1501.   # ● バトラーの敵グループを取得
  1502.   #--------------------------------------------------------------------------
  1503.   def self.get_enemy_unit(battler)
  1504.     return $game_troop if battler.actor?
  1505.     return $game_party
  1506.   end
  1507.   #--------------------------------------------------------------------------
  1508.   # ● バトラーの味方グループを取得
  1509.   #--------------------------------------------------------------------------
  1510.   def self.get_party_unit(battler)
  1511.     return $game_party if battler.actor?
  1512.     return $game_troop
  1513.   end
  1514.   #--------------------------------------------------------------------------
  1515.   # ● 戦闘アニメ時間の取得
  1516.   #--------------------------------------------------------------------------
  1517.   def self.get_anime_time(anime_id)
  1518.     return 0 if anime_id <= 0
  1519.     return $data_animations[anime_id].frame_max * 4
  1520.   end
  1521.   #--------------------------------------------------------------------------
  1522.   # ● 攻撃アニメの取得
  1523.   #--------------------------------------------------------------------------
  1524.   def self.get_attack_anime_id(kind, battler)
  1525.     return $data_skills[battler.sv.counter_id].animation_id if kind == -3 && battler.sv.counter_id != 0
  1526.     case kind
  1527.     when -1 ; anime_id = battler.atk_animation_id1
  1528.     when -2 ; anime_id = battler.atk_animation_id2
  1529.     when -3
  1530.       if battler.current_action != nil
  1531.         anime_id = battler.current_action.item.animation_id if battler.current_action.item != nil
  1532.       end
  1533.     else    ; anime_id = kind
  1534.     end
  1535.     case anime_id
  1536.     when -1 ; anime_id = battler.atk_animation_id1
  1537.     when -2 ; anime_id = battler.atk_animation_id2
  1538.     end
  1539.     return anime_id if anime_id
  1540.     return 0
  1541.   end  
  1542.   #--------------------------------------------------------------------------
  1543.   # ● 戦闘アニメデータをセット
  1544.   #--------------------------------------------------------------------------
  1545.   def self.set_damage_anime_data(targets, target, data)
  1546.     return if !first_of_all_screen_anime(data[0], target, targets)
  1547.     target.animation_id         = data[0]
  1548.     target.animation_mirror     = data[1]
  1549.     target.sv.anime_no_mirror   = data[2]
  1550.     target.sv.anime_camera_zoom = data[3]
  1551.     target.sv.anime_plus_z      = data[4]
  1552.   end   
  1553.   #--------------------------------------------------------------------------
  1554.   # ● ターゲットの取得
  1555.   #--------------------------------------------------------------------------
  1556.   def self.get_targets(kind, battler)
  1557.     case kind.abs
  1558.     when 0 ; return [battler].dup
  1559.     when 1 ; return battler.sv.target_battler.dup
  1560.     when 2 ; return get_enemy_unit(battler).members.dup
  1561.     when 3 ; return get_party_unit(battler).members.dup
  1562.     when 4 ; return $game_troop.members.dup + $game_party.battle_members.dup
  1563.     when 5 ; return battler.sv.second_targets.dup
  1564.     end
  1565.   end  
  1566.   #--------------------------------------------------------------------------
  1567.   # ● ターゲットの座標を取得
  1568.   #--------------------------------------------------------------------------
  1569.   def self.get_targets_position(targets, horming, m_a = nil)
  1570.     return [0,0,0] if targets == nil && !$sv_camera.mirror
  1571.     return [Graphics.width,0,0] if targets == nil && $sv_camera.mirror
  1572.     x = y = h = 0
  1573.     for i in 0...targets.size
  1574.       x += targets[i].sv.base_x if !horming
  1575.       y += targets[i].sv.base_y if !horming
  1576.       h += targets[i].sv.base_h if !horming
  1577.       x += targets[i].sv.x if horming
  1578.       y += targets[i].sv.y if horming
  1579.       h += targets[i].sv.h if horming
  1580.       y -= targets[i].sv.ch * 100 if m_a == 0
  1581.       y -= targets[i].sv.ch * 50 if m_a == 1
  1582.     end
  1583.     return [x / targets.size, y / targets.size, h / targets.size]
  1584.   end
  1585.   #--------------------------------------------------------------------------
  1586.   # ● 速度を時間に変換
  1587.   #--------------------------------------------------------------------------
  1588.   def self.distanse_calculation(time, target_position, self_position, distanse_move)
  1589.     return time if !distanse_move
  1590.     distanse_x = self_position[0] - target_position[0]
  1591.     distanse_x = target_position[0] - self_position[0] if target_position[0] > self_position[0]
  1592.     distanse_y = self_position[1] - target_position[1]
  1593.     distanse_y = target_position[1] - self_position[1] if target_position[1] > self_position[1]
  1594.     if self_position[2] != nil && target_position[2] != nil
  1595.       distanse_h = self_position[2] - target_position[2]
  1596.       distanse_h = target_position[2] - self_position[2] if target_position[2] > self_position[2]
  1597.     else
  1598.       distanse_h = 0
  1599.     end
  1600.     distanse = [distanse_x, distanse_y, distanse_h].max
  1601.     return distanse / (time * 100) + 1
  1602.   end
  1603.   #--------------------------------------------------------------------------
  1604.   # ● 放物線移動計算
  1605.   #--------------------------------------------------------------------------
  1606.   def self.parabola(data, time, size, type = 1)
  1607.     move_data = data
  1608.     move_data[0] *= size
  1609.     move_data[1] *= size
  1610.     move = []
  1611.     move_d = []
  1612.     for i in 0...time / 2
  1613.       move[i] = move_data[0]
  1614.       move_d[i] = move_data[1]
  1615.       move_data[0] = move_data[0] * type / (1 + type)
  1616.       move_data[1] = move_data[1] * type / (1 + type)
  1617.     end
  1618.     move = move + move_d.reverse!
  1619.     move.reverse!
  1620.     adjust = move.inject(0) {|result, item| result + item }
  1621.     move[move.size - 1] += adjust if data[0] == data[1] && adjust != 0
  1622.     move.unshift(0) if time % 2 != 0
  1623.     return move
  1624.   end
  1625.   #--------------------------------------------------------------------------
  1626.   # ● 反転値
  1627.   #--------------------------------------------------------------------------
  1628.   def self.mirror_num(mirror)
  1629.     return 1 if !mirror
  1630.     return -1
  1631.   end  
  1632.   #--------------------------------------------------------------------------
  1633.   # ● カメラワーク
  1634.   #--------------------------------------------------------------------------
  1635.   def self.camera(battler, data)
  1636.     battler = $game_party.battle_members[0] if !battler
  1637.     cx = data[2][0] * 100
  1638.     cy = data[2][1] * 100
  1639.     return $sv_camera.move(cx, cy, data[3], data[4], true) if data[1] == 6
  1640.     targets = self.get_targets(data[1], battler)
  1641.     return if targets == nil or targets == []
  1642.     position = self.get_targets_position(targets, true)
  1643.     $sv_camera.move(position[0], position[1] - position[2], data[3], data[4], false)
  1644.   end
  1645.   #--------------------------------------------------------------------------
  1646.   # ● コラプス禁止
  1647.   #--------------------------------------------------------------------------
  1648.   def self.immortaling
  1649.     # 全員に不死身付与
  1650.     for member in $game_party.battle_members + $game_troop.members
  1651.       # イベント操作等で不死身設定になっていたら解除を無効にするフラグを立てる
  1652.       member.sv.immortal = true if member.state?(N03::IMMORTAL_ID)
  1653.       member.add_state(N03::IMMORTAL_ID)
  1654.     end
  1655.     return true
  1656.   end  
  1657.   #--------------------------------------------------------------------------
  1658.   # ● コラプス許可
  1659.   #--------------------------------------------------------------------------
  1660.   def self.unimmortaling
  1661.     # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
  1662.     for member in $game_party.battle_members + $game_troop.members
  1663.       next if member.dead?
  1664.       # 不死身ステートが行動中に解除されていた場合、解除無効を解除
  1665.       member.sv.immortal = false if !member.state?(N03::IMMORTAL_ID) && member.sv.immortal
  1666.       next member.sv.immortal = false if member.sv.immortal
  1667.       member.remove_state(N03::IMMORTAL_ID)
  1668.       next if member.hp != 0
  1669.       member.add_state(1)
  1670.       member.perform_collapse_effect
  1671.       member.sv.action_terminate
  1672.     end
  1673.     return false
  1674.   end  
  1675.   #--------------------------------------------------------------------------
  1676.   # ● スキル派生
  1677.   #--------------------------------------------------------------------------
  1678.   def self.derived_skill(battler)
  1679.     battler.force_action(battler.sv.derivation_skill_id, -2)
  1680.     BattleManager.unshift_action_battlers(battler)
  1681.   end
  1682.   #--------------------------------------------------------------------------
  1683.   # ● ダメージの作成
  1684.   #--------------------------------------------------------------------------
  1685.   def self.set_damage(battler, hp_damage, mp_damage)
  1686.     battler.result.hp_damage = hp_damage
  1687.     battler.result.mp_damage = mp_damage
  1688.   end
  1689.   #--------------------------------------------------------------------------
  1690.   # ● ターゲット生死確認
  1691.   #--------------------------------------------------------------------------
  1692.   def self.targets_alive?(targets)
  1693.     return false if targets == []
  1694.     for target in targets do return true if !target.dead? end
  1695.     return false
  1696.   end
  1697.   #--------------------------------------------------------------------------
  1698.   # ● ターゲットをセカンドターゲットへ
  1699.   #--------------------------------------------------------------------------
  1700.   def self.s_targets(battler)
  1701.     battler.sv.target_battler = battler.sv.second_targets
  1702.     return battler.sv.second_targets
  1703.   end  
  1704.   #--------------------------------------------------------------------------
  1705.   # ● セカンドターゲットをターゲットへ
  1706.   #--------------------------------------------------------------------------
  1707.   def self.targets_set(battler)
  1708.     battler.sv.second_targets = battler.current_action.make_targets.compact
  1709.     battler.sv.target_battler = battler.sv.second_targets
  1710.   end  
  1711.   #--------------------------------------------------------------------------
  1712.   # ● 戦闘アニメ実行判定 (対象:画面時は最初のターゲットのみアニメ実行)
  1713.   #--------------------------------------------------------------------------
  1714.   def self.first_of_all_screen_anime(anime_id, target, targets)
  1715.     anime = $data_animations[anime_id]
  1716.     return false if !anime
  1717.     return true if anime.position != 3
  1718.     return false if anime.position == 3 && target != targets[0]
  1719.     targets.delete(target)
  1720.     target.sv.timing_targets = targets
  1721.     return true
  1722.   end
  1723.   #--------------------------------------------------------------------------
  1724.   # ● 戦闘不能付加攻撃か
  1725.   #--------------------------------------------------------------------------
  1726.   def self.dead_attack?(battler, item)
  1727.     for state in battler.atk_states
  1728.       return true if state == battler.death_state_id
  1729.     end
  1730.     for effect in item.effects
  1731.       return true if effect.code == 21 && effect.data_id == battler.death_state_id
  1732.     end
  1733.     return false
  1734.   end
  1735. end
  1736.  
  1737. #==============================================================================
  1738. # ■ Sprite_Weapon
  1739. #------------------------------------------------------------------------------
  1740. #  ウエポン表示用のスプライトです。
  1741. #==============================================================================
  1742. class Sprite_Weapon < Sprite_Base
  1743.   #--------------------------------------------------------------------------
  1744.   # ● 公開インスタンス変数 
  1745.   #--------------------------------------------------------------------------
  1746.   attr_reader   :index                       # ウエポン画像配列のインデックス
  1747.   attr_reader   :battler                     # 画像が参照しているバトラー
  1748.   attr_reader   :move_time                   # 画像が目標に到達するまでの時間
  1749.   attr_reader   :through                     # 貫通フラグ
  1750.   attr_reader   :action_end                  # 武器アクション終了フラグ
  1751.   attr_reader   :action_end_cancel                  # 武器アクション終了フラグ
  1752.   attr_reader   :hit_position                # 画像が目標に到達した時の座標
  1753.   attr_accessor :hit_anime_id                # 画像が目標に到達した時のアニメID
  1754.   #--------------------------------------------------------------------------
  1755.   # ● オブジェクト初期化
  1756.   #--------------------------------------------------------------------------
  1757.   def initialize(viewport, index, battler)
  1758.     super(viewport)
  1759.     @index = index
  1760.     @battler = battler
  1761.     @position_x = @position_y = 0
  1762.     @o = 0
  1763.     @real_x = @real_y = 0
  1764.     @mirror = @battler.sv.mirror
  1765.     reset
  1766.     set_action
  1767.   end
  1768.   #--------------------------------------------------------------------------
  1769.   # ● 初期化
  1770.   #--------------------------------------------------------------------------
  1771.   def reset
  1772.     @z_plus = 0
  1773.     @weapon_data = []
  1774.     @move_data = []
  1775.     @move_x = 0
  1776.     @move_y = 0
  1777.     @orbit = []
  1778.     @through = false
  1779.     @distanse_move = false
  1780.     @weapon_width = 0
  1781.     @weapon_height = 0
  1782.     @anime_time = 0
  1783.     @anime_position = 1
  1784.     @move_time = 0
  1785.     @hit_anime_id = 0
  1786.     @move_anime = true
  1787.     @action_end = false
  1788.     @action_end_cancel = false
  1789.     reset_position
  1790.   end  
  1791.   #--------------------------------------------------------------------------
  1792.   # ● アクションをセット
  1793.   #--------------------------------------------------------------------------
  1794.   def set_action
  1795.     return if @battler.sv.effect_data == []
  1796.     weapon_anime if @battler.sv.effect_data[0][0] == "wp"
  1797.     move_anime if @battler.sv.effect_data[0][0] == "m_a"
  1798.     @battler.sv.effect_data.shift
  1799.   end
  1800.   #--------------------------------------------------------------------------
  1801.   # ● 武器アニメ実行
  1802.   #--------------------------------------------------------------------------
  1803.   def weapon_anime
  1804.     @weapon_data = @battler.sv.effect_data[0].dup
  1805.     set_graphics
  1806.     set_ox
  1807.     set_weapon_move
  1808.   end
  1809.   #--------------------------------------------------------------------------
  1810.   # ● アニメ移動実行
  1811.   #--------------------------------------------------------------------------
  1812.   def move_anime
  1813.     @move_data = @battler.sv.effect_data[0].dup
  1814.     # ターゲットを取得
  1815.     @target_battler = [@battler.sv.m_a_targets.shift]
  1816.     @target_battler = N03.get_targets(@move_data[3], @battler) if @move_data[3] < 0
  1817.     set_move
  1818.     return if @move_data[16] == ""
  1819.     weapon_data = N03::ACTION[@move_data[16]]
  1820.     return if weapon_data == nil
  1821.     @weapon_data = weapon_data.dup
  1822.     set_graphics
  1823.     set_ox
  1824.     set_weapon_move
  1825.   end
  1826.   #--------------------------------------------------------------------------
  1827.   # ● 武器画像を取得
  1828.   #--------------------------------------------------------------------------  
  1829.   def set_graphics
  1830.     # 武器に依存しない画像設定がある場合
  1831.     if @weapon_data[13] != ""
  1832.       self.bitmap = Cache.character(@weapon_data[13]).dup
  1833.       @weapon_width = self.bitmap.width
  1834.       @weapon_height = self.bitmap.height
  1835.       return
  1836.     end
  1837.     # 武器を取得
  1838.     weapon = @battler.weapons[0]
  1839.     # 逆手装備を取得
  1840.     if @weapon_data[10]
  1841.       weapon = nil
  1842.       for armor in @battler.armors do break weapon = armor if armor.is_a?(RPG::Armor) && armor.etype_id == 1 end
  1843.       weapon = @battler.weapons[1] if !weapon
  1844.     end  
  1845.     # 武器がなければ処理をキャンセル
  1846.     return if weapon == nil
  1847.     # インデックスを取得
  1848.     file_index = @weapon_data[12]
  1849.     # アイコンを利用するなら
  1850.     if @weapon_data[1] == 0
  1851.       icon_index = weapon.icon_index
  1852.       self.bitmap = Cache.system("Iconset" + file_index).dup
  1853.       self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1854.       @weapon_width = @weapon_height = 24
  1855.     # 独自画像指定
  1856.     else
  1857.       file_name = @battler.sv.weapon_graphic(weapon.id, weapon.wtype_id) if weapon.is_a?(RPG::Weapon)
  1858.       file_name = @battler.sv.shield_graphic(weapon.id, weapon.atype_id) if weapon.is_a?(RPG::Armor)
  1859.       self.bitmap = Cache.character(file_name + file_index).dup
  1860.       @weapon_width = self.bitmap.width
  1861.       @weapon_height = self.bitmap.height
  1862.       return if @weapon_data[1] == 1
  1863.       # 2003仕様の武器アニメ
  1864.       @weapon_width /= @battler.sv.max_pattern[0]
  1865.     end
  1866.   end
  1867.   #--------------------------------------------------------------------------
  1868.   # ● 画像の原点を取得
  1869.   #--------------------------------------------------------------------------  
  1870.   def set_ox
  1871.     # 反転時は設定を逆に
  1872.     if @mirror
  1873.       case @weapon_data[6]
  1874.       when 1 ; @weapon_data[6] = 2 # 左上→右上に
  1875.       when 2 ; @weapon_data[6] = 1 # 右上→左上に
  1876.       when 3 ; @weapon_data[6] = 4 # 左下→右下に
  1877.       when 4 ; @weapon_data[6] = 3 # 右下→左下に
  1878.       end
  1879.     end
  1880.     # 原点を設定
  1881.     case @weapon_data[6]
  1882.     when 0 # 中心
  1883.       self.ox = @weapon_width / 2
  1884.       self.oy = @weapon_height / 2
  1885.     when 1 # 左上
  1886.       self.ox = 0
  1887.       self.oy = 0
  1888.     when 2 # 右上
  1889.       self.ox = @weapon_width
  1890.       self.oy = 0
  1891.     when 3 # 左下
  1892.       self.ox = 0
  1893.       self.oy = @weapon_height
  1894.     when 4 # 右下
  1895.       self.ox = @weapon_width
  1896.       self.oy = @weapon_height
  1897.     when 5 # バトラーと同じ
  1898.       self.ox = @weapon_width / 2
  1899.       self.oy = @weapon_height
  1900.     end
  1901.   end  
  1902.   #--------------------------------------------------------------------------
  1903.   # ● バトラーの座標を取得
  1904.   #--------------------------------------------------------------------------  
  1905.   def set_battler_position
  1906.     @position_x = @battler.sv.x + @weapon_data[3][0] * N03.mirror_num(@mirror) * 100
  1907.     @position_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust) + @weapon_data[3][1] * 100
  1908.     reset_position
  1909.   end
  1910.   #--------------------------------------------------------------------------
  1911.   # ● 座標を初期化
  1912.   #--------------------------------------------------------------------------  
  1913.   def reset_position
  1914.     @real_x = @position_x / 100
  1915.     @real_y = @position_y / 100
  1916.     @real_zoom_x = 1
  1917.     @real_zoom_y = 1
  1918.   end
  1919.   #--------------------------------------------------------------------------
  1920.   # ● 戦闘アニメを表示
  1921.   #--------------------------------------------------------------------------  
  1922.   def set_animation(anime_id)
  1923.     return if $data_animations[anime_id] == nil
  1924.     @anime_position = $data_animations[anime_id].position
  1925.     @horming = true
  1926.     @horming = false if @anime_position == 3
  1927.     @anime_camera_zoom = true
  1928.     @anime_no_mirror = false
  1929.     start_animation($data_animations[anime_id], @mirror)
  1930.     timings = $data_animations[anime_id].timings
  1931.   end
  1932.   #--------------------------------------------------------------------------
  1933.   # ● ヒット時の戦闘アニメ実行
  1934.   #--------------------------------------------------------------------------  
  1935.   def set_hit_animation(position_data, hit_anime_id, target)
  1936.     return if $data_animations[hit_anime_id] == nil
  1937.     @real_x = position_data[0]
  1938.     @real_y = position_data[1]
  1939.     @position_x = position_data[0] * 100
  1940.     @position_y = position_data[1] * 100
  1941.     self.z = position_data[2]
  1942.     @z_plus = 1000
  1943.     @action_end = false
  1944.     @horming = true
  1945.     set_animation(hit_anime_id)
  1946.     @anime_time = $data_animations[hit_anime_id].frame_max * 4
  1947.     @timing_targets = [target]
  1948.     @move_time = @hit_anime_id = 0
  1949.     @weapon_data = []
  1950.   end
  1951.   #--------------------------------------------------------------------------
  1952.   # ● タイミングバトラー追加
  1953.   #--------------------------------------------------------------------------  
  1954.   def timing_battler_set(target)
  1955.     @timing_targets.push(target)
  1956.   end
  1957.   #--------------------------------------------------------------------------
  1958.   # ● 武器の動きを取得
  1959.   #--------------------------------------------------------------------------  
  1960.   def set_weapon_move
  1961.     # 開始位置を取得
  1962.     set_battler_position if @move_time == 0
  1963.     @z_plus = 50 if @z_plus == 0 && @weapon_data[9]
  1964.     self.z = @battler.sv.z + @z_plus
  1965.     # 反転処理
  1966.     @mirror = !@mirror if @weapon_data[7]
  1967.     self.mirror = @mirror
  1968.     # 更新パターンをセット
  1969.     set_pattern
  1970.     @max_pattern = 2 if @max_pattern == 1
  1971.     # 動きを計算
  1972.     @weapon_move_data = []
  1973.     @weapon_angle_data = []
  1974.     @weapon_zoom_data = []
  1975.     num = N03.mirror_num(@mirror)
  1976.     for i in 0...@max_pattern
  1977.       move_data_x = @weapon_data[2][0] * num * 100 * i / (@max_pattern - 1)
  1978.       move_data_y = @weapon_data[2][1] * 100 * i / (@max_pattern - 1)
  1979.       move_angle = @weapon_data[4] * num + (@weapon_data[5] * num - @weapon_data[4] * num) * i / (@max_pattern - 1)
  1980.       move_zoom_x = 1 + (@weapon_data[8][0] - 1) * i / (@max_pattern - 1)
  1981.       move_zoom_y = 1 + (@weapon_data[8][1] - 1) * i / (@max_pattern - 1)
  1982.       @weapon_move_data.push([move_data_x, move_data_y])
  1983.       @weapon_angle_data.push(move_angle)
  1984.       @weapon_zoom_data.push([move_zoom_x, move_zoom_y])
  1985.     end
  1986.   end  
  1987.   #--------------------------------------------------------------------------
  1988.   # ● 更新パターン
  1989.   #--------------------------------------------------------------------------
  1990.   def set_pattern
  1991.     if @weapon_data[11] == -1
  1992.       return @max_pattern = @battler.sv.max_pattern[0] if @battler.sv.pattern_type != 0
  1993.       @count = @battler.sv.pattern_time
  1994.       @max_count = @battler.sv.pattern_time
  1995.       @max_pattern = @battler.sv.max_pattern[0]
  1996.       @repeat = false
  1997.     else
  1998.       @count = @weapon_data[11][0]
  1999.       @max_count = @weapon_data[11][0]
  2000.       @max_pattern = @weapon_data[11][1]
  2001.       @repeat = @weapon_data[11][2]
  2002.     end
  2003.     @pattern = 0
  2004.   end
  2005.   #--------------------------------------------------------------------------
  2006.   # ● 移動実行
  2007.   #--------------------------------------------------------------------------
  2008.   def set_move
  2009.     # 戦闘アニメを取得
  2010.     set_animation(@move_data[1][0]) if $data_animations[@move_data[1][0]] != nil && $data_animations[@move_data[1][0]].position != 3
  2011.     @anime_camera_zoom = @move_data[13]
  2012.     @loop = @move_data[14]
  2013.     @loop = false if @move_data[1][0] == 0
  2014.     @anime_no_mirror = @move_data[15]
  2015.     @se_flag = @move_data[17]
  2016.     # 開始位置を取得
  2017.     start_position
  2018.     @z_plus = 1000 if @move_data[9]
  2019.     # ターゲットバトラー画像にこのアニメのSEとタイミング設定を反映させる
  2020.     @timing_targets = @target_battler
  2021.     # 座標計算
  2022.     @move_x = @move_data[5][0] * 100 * N03.mirror_num(@mirror)
  2023.     @move_y = @move_data[5][1] * 100
  2024.     # 時間計算か速度計算か
  2025.     @distanse_move = true if @move_data[6] > 0
  2026.     @move_time = @move_data[6].abs
  2027.     # 時間0の場合、アニメが設定されていればアニメ表示時間に合わせる
  2028.     if @move_time == 0
  2029.       @move_time = $data_animations[@move_data[1][0]].frame_max * 4 if $data_animations[@move_data[1][0]]
  2030.       @move_time = 1 if !$data_animations[@move_data[1][0]]
  2031.       @distanse_move = false
  2032.     end
  2033.     # 貫通タイプの場合
  2034.     @through = true if @move_data[7] == 1
  2035.     @auto_through_flag = false
  2036.     @auto_through_flag = true if @move_data[7] == 0
  2037.     # ターゲット座標計算
  2038.     if @target_battler == nil
  2039.       @target_x = @move_x * 100
  2040.       @target_x = (Graphics.width - @move_x) * 100 if @mirror
  2041.       @target_y = @move_y * 100
  2042.     else
  2043.       move_data_set
  2044.     end
  2045.     # ターゲットに到達するまでの時間を計算
  2046.     @move_time = distanse_calculation(@move_time, @target_x, @target_y)
  2047.     # 円軌道計算
  2048.     orbit
  2049.     # バトラーのウエイト設定
  2050.     @battler.sv.wait = @move_time - 1 if @move_data[10][0]
  2051.     @move_horming = @move_data[12]
  2052.   end  
  2053.   #--------------------------------------------------------------------------
  2054.   # ● 速度を時間に変換
  2055.   #--------------------------------------------------------------------------
  2056.   def distanse_calculation(time, target_x, target_y)
  2057.     return time if !@distanse_move
  2058.     distanse_x = @position_x - @target_x
  2059.     distanse_x = @target_x - @position_x if @target_x > @position_x
  2060.     distanse_y = @position_y - @target_y
  2061.     distanse_y = @target_y - @position_y if @target_y > @position_y
  2062.     distanse = [distanse_x, distanse_y].max
  2063.     return distanse / (time * 100) + 1
  2064.   end
  2065.   #--------------------------------------------------------------------------
  2066.   # ● 移動目標の更新
  2067.   #--------------------------------------------------------------------------
  2068.   def move_data_set
  2069.     return if @target_battler == nil
  2070.     position = N03.get_targets_position(@target_battler, true, @anime_position)
  2071.     @target_x = position[0] + @move_x
  2072.     @target_y = position[1] - position[2] + @move_y
  2073.   end
  2074.   #--------------------------------------------------------------------------
  2075.   # ● 開始位置を計算
  2076.   #--------------------------------------------------------------------------
  2077.   def start_position
  2078.     starter = [@battler.sv.m_a_starter.shift]
  2079.     starter = N03.get_targets(@move_data[2], @battler) if @move_data[2] < 0
  2080.     position = [0, 0]
  2081.     position = N03.get_targets_position(starter, true, @anime_position) if starter != nil
  2082.     @position_x = position[0] + @move_data[4][0] * 100
  2083.     @position_y = position[1] + position[2] + @move_data[4][1] * 100
  2084.     @position_z = @position_y
  2085.   end  
  2086.   #--------------------------------------------------------------------------
  2087.   # ● 円軌道計算
  2088.   #--------------------------------------------------------------------------
  2089.   def orbit
  2090.     orbit_data = @move_data[8].dup
  2091.     orbit_data[0] *= 100
  2092.     orbit_data[1] *= 100
  2093.     orbit_d = []
  2094.     for i in 0...@move_time / 2
  2095.       @orbit[i] = orbit_data[0]
  2096.       orbit_data[0] /= 2
  2097.       orbit_d[i] = orbit_data[1]
  2098.       orbit_data[1] /= 2
  2099.     end
  2100.     @orbit = @orbit + orbit_d.reverse!
  2101.     @orbit.reverse!
  2102.   end  
  2103.   #--------------------------------------------------------------------------
  2104.   # ● フレーム更新
  2105.   #--------------------------------------------------------------------------
  2106.   def update
  2107.     update_hit_anime if @anime_time != 0
  2108.     update_move if @move_time != 0
  2109.     update_weapon_move if @weapon_data != []
  2110.     update_position
  2111.     update_color
  2112.     self.visible = @battler.sv.weapon_visible
  2113.     super
  2114.   end
  2115.   #--------------------------------------------------------------------------
  2116.   # ● ヒット時の戦闘アニメ
  2117.   #--------------------------------------------------------------------------
  2118.   def update_hit_anime
  2119.     @anime_time -= 1
  2120.     @action_end = true if @anime_time == 0
  2121.   end
  2122.   #--------------------------------------------------------------------------
  2123.   # ● 移動の更新
  2124.   #--------------------------------------------------------------------------
  2125.   def update_move
  2126.     move_data_set if @move_horming && !@hit_position
  2127.     through_set(@move_time, @target_x, @target_y) if @move_time == 1 && !@hit_position
  2128.     @o += @orbit[@move_time - 1] if @orbit[@move_time - 1] != nil
  2129.     @position_x = (@position_x * (@move_time - 1) + @target_x) / @move_time
  2130.     @position_y = (@position_y * (@move_time - 1) + @target_y) / @move_time + @o
  2131.     reset_position
  2132.     set_animation(@move_data[1][0]) if @loop && !animation?
  2133.     @move_time -= 1
  2134.     return if @move_time != 0
  2135.     @action_end = true if !@action_end_cancel
  2136.   end
  2137.   #--------------------------------------------------------------------------
  2138.   # ● 武器の動きを更新
  2139.   #--------------------------------------------------------------------------
  2140.   def update_weapon_move
  2141.     pattern = update_pattern
  2142.     set_battler_position if @move_time == 0 && !@action_end_cancel
  2143.     @real_x = @position_x / 100 + @weapon_move_data[pattern][0] / 100
  2144.     @real_y = @position_y / 100 + @weapon_move_data[pattern][1] / 100
  2145.     @real_zoom_x = @weapon_zoom_data[pattern][0]
  2146.     @real_zoom_y = @weapon_zoom_data[pattern][1]
  2147.     self.angle = @weapon_angle_data[pattern]
  2148.     self.src_rect.set(@weapon_width * pattern, 0, @weapon_width, @weapon_height) if @weapon_data[1] == 2
  2149.   end
  2150.   #--------------------------------------------------------------------------
  2151.   # ● パターンを更新
  2152.   #--------------------------------------------------------------------------
  2153.   def update_pattern
  2154.     return @battler.sv.pattern_w if @count == nil
  2155.     @count -= 1
  2156.     return @pattern if @count != 0
  2157.     @count = @max_count
  2158.     @pattern += 1
  2159.     if !@repeat && @pattern == @max_pattern
  2160.       @pattern = @max_pattern - 1
  2161.     elsif @pattern == @max_pattern
  2162.       @pattern = 0
  2163.     end
  2164.     return @pattern
  2165.   end
  2166.   #--------------------------------------------------------------------------
  2167.   # ● 座標を更新
  2168.   #--------------------------------------------------------------------------
  2169.   def update_position
  2170.     self.x = (@real_x - $sv_camera.x) * $sv_camera.convert / 1000
  2171.     self.y = (@real_y - $sv_camera.y) * $sv_camera.convert / 1000
  2172.     self.x += $sv_camera.sx / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2173.     self.y += $sv_camera.sy / 100 unless @battler.sv.h != 0 && @weapon_data != []
  2174.     self.z = @battler.sv.z + @z_plus - 10
  2175.     self.zoom_x = @real_zoom_x * $sv_camera.zoom
  2176.     self.zoom_y = @real_zoom_y * $sv_camera.zoom
  2177.     self.opacity = @battler.sv.opacity if @battler.sv.opacity_data[4]
  2178.   end
  2179.   #--------------------------------------------------------------------------
  2180.   # ● 貫通の処理
  2181.   #--------------------------------------------------------------------------
  2182.   def through_set(time, target_x, target_y)
  2183.     @hit_anime_id = N03.get_attack_anime_id(@move_data[1][1], @battler)
  2184.     @battler.sv.wait = N03.get_anime_time(@hit_anime_id) if @move_data[10][1]
  2185.     moving_x = (target_x / 100 - @position_x / 100) / time
  2186.     moving_y = (target_y / 100 - @position_y / 100) / time
  2187.     goal_x = $sv_camera.max_left - 100 if moving_x < 0
  2188.     goal_x = Graphics.width + $sv_camera.max_right + 100 if moving_x > 0
  2189.     goal_y = $sv_camera.max_top - 100 if moving_y < 0
  2190.     goal_y = Graphics.height + $sv_camera.max_bottom + 100 if moving_y > 0
  2191.     if goal_x == nil &&  goal_y == nil
  2192.       time = 0
  2193.       reset_position
  2194.     else
  2195.       time = move_calculation(moving_x, moving_y, goal_x, goal_y)
  2196.     end
  2197.     target_x = @position_x + moving_x * time * 100
  2198.     target_y = @position_y + moving_y * time * 100
  2199.     @pre_data = [time, target_x, target_y]
  2200.     @battler.sv.m_a_data.push([@move_data[11], @target_battler, @index, @auto_through_flag, []])
  2201.     @action_end_cancel = true
  2202.     @hit_position = [@real_x, @real_y, self.z]
  2203.   end  
  2204.   #--------------------------------------------------------------------------
  2205.   # ● 到達時間試算
  2206.   #--------------------------------------------------------------------------
  2207.   def move_calculation(moving_x, moving_y, goal_x, goal_y)
  2208.     move_x = @position_x / 100
  2209.     move_y = @position_y / 100
  2210.     time = 0
  2211.     loop do
  2212.       move_x += moving_x
  2213.       move_y += moving_y
  2214.       time += 1
  2215.       return time if moving_x < 0 && move_x < goal_x
  2216.       return time if moving_x > 0 && move_x > goal_x
  2217.       return time if moving_y < 0 && move_y < goal_y
  2218.       return time if moving_y > 0 && move_y > goal_y
  2219.     end
  2220.   end   
  2221.   #--------------------------------------------------------------------------
  2222.   # ● ミス時に消える処理から貫通処理に変換
  2223.   #--------------------------------------------------------------------------
  2224.   def through_change
  2225.     @action_end_cancel = false
  2226.     @through = true
  2227.     @move_time = @pre_data[0]
  2228.     @target_x = @pre_data[1]
  2229.     @target_y = @pre_data[2]
  2230.     @pre_data = nil
  2231.   end  
  2232.   #--------------------------------------------------------------------------
  2233.   # ● SE とフラッシュのタイミング処理
  2234.   #--------------------------------------------------------------------------
  2235.   def animation_process_timing(timing)
  2236.     return if !@timing_targets
  2237.     se_flag = true
  2238.     se_flag = @se_flag if @se_flag != nil
  2239.     for target in @timing_targets
  2240.       target.sv.timing.push([se_flag, timing.dup])
  2241.       se_flag = false if @animation.position == 3
  2242.     end  
  2243.   end
  2244.   #--------------------------------------------------------------------------
  2245.   # ● 色調の更新
  2246.   #--------------------------------------------------------------------------
  2247.   def update_color
  2248.     return if @battler.sv.color == []
  2249.     self.color.set(@battler.sv.color[0], @battler.sv.color[1], @battler.sv.color[2], @battler.sv.color[3])
  2250.   end
  2251.   #--------------------------------------------------------------------------
  2252.   # ● 解放
  2253.   #--------------------------------------------------------------------------
  2254.   def dispose
  2255.     super
  2256.     self.bitmap.dispose if self.bitmap != nil
  2257.   end
  2258. end
  2259.  
  2260. #==============================================================================
  2261. # ■ Sprite_Battle_Picture
  2262. #------------------------------------------------------------------------------
  2263. #  ピクチャ表示用のスプライトです。
  2264. #==============================================================================
  2265. class Sprite_Battle_Picture < Sprite
  2266.   #--------------------------------------------------------------------------
  2267.   # ● 公開インスタンス変数 
  2268.   #--------------------------------------------------------------------------
  2269.   attr_accessor   :action_end           # 終了フラグ
  2270.   #--------------------------------------------------------------------------
  2271.   # ● オブジェクト初期化
  2272.   #--------------------------------------------------------------------------
  2273.   def initialize(viewport = nil)
  2274.     super(viewport)
  2275.     @action_end = false
  2276.     self.ox = 0
  2277.   end
  2278.   #--------------------------------------------------------------------------
  2279.   # ● セット
  2280.   #--------------------------------------------------------------------------
  2281.   def set(battler)
  2282.     @battler = battler
  2283.     @data = @battler.sv.effect_data.shift
  2284.     @time = @data[4]
  2285.     @mirror = $sv_camera.mirror
  2286.     @mirror = false if !@data[8]
  2287.     self.opacity = @data[6][0]
  2288.     @s_x = @data[2][0] if @data[2] != []
  2289.     @s_x = Graphics.width - @data[2][0]  if @data[2] != [] && @mirror
  2290.     @s_y = @data[2][1] if @data[2] != []
  2291.     @e_x = @data[3][0] if @data[3] != []
  2292.     @e_x = Graphics.width - @data[3][0] if @data[3] != [] && @mirror
  2293.     @e_y = @data[3][1] if @data[3] != []
  2294.     @s_x = self.x if @data[2] == []
  2295.     @s_y = self.y if @data[2] == []
  2296.     @e_x = self.x if @data[3] == []
  2297.     @e_y = self.y if @data[3] == []
  2298.     self.x = @s_x
  2299.     self.y = @s_y
  2300.     return @action_end = true if @time == 0
  2301.     @move_x = (@e_x * 1.0 - @s_x) / @time
  2302.     @move_y = (@e_y * 1.0 - @s_y) / @time
  2303.     self.z = @data[5]
  2304.     return set_plane(battler) if @data[7] != []
  2305.     self.bitmap = Cache.picture(@data[9]) if !bitmap or @data[9] != ""
  2306.     return @action_end = true if !bitmap
  2307.     self.mirror = @mirror
  2308.     self.ox = self.bitmap.width if @mirror
  2309.   end
  2310.   #--------------------------------------------------------------------------
  2311.   # ● プレーン移行
  2312.   #--------------------------------------------------------------------------
  2313.   def set_plane(battler)
  2314.     @viewport = Viewport.new(@data[2][0],@data[2][1],@data[7][0],@data[7][1]) if !@viewport
  2315.     viewport = @viewport
  2316.     @plane = Plane.new(viewport) if !@plane
  2317.     @plane.bitmap = Cache.picture(@data[9]) if [email protected] or @data[9] != ""
  2318.     return @action_end = true if [email protected]
  2319.     @plane.ox = @data[7][0]
  2320.     @plane.oy = @data[7][1]
  2321.     @plane.opacity = @data[6][0]
  2322.     @move_x = @remain_move[0] if @data[2] == @data[3]
  2323.     @move_y = @remain_move[1] if @data[2] == @data[3]
  2324.     @remain_move = [@move_x, @move_y]
  2325.   end
  2326.   #--------------------------------------------------------------------------
  2327.   # ● フレーム更新
  2328.   #--------------------------------------------------------------------------
  2329.   def update
  2330.     @action_end = true if [email protected]
  2331.     return if @time == 0
  2332.     return if @action_end
  2333.     @time -= 1
  2334.     return plane_update if @plane
  2335.     super
  2336.     self.x += @move_x
  2337.     self.y += @move_y
  2338.     self.opacity += @data[6][1]
  2339.     return if @time != 1
  2340.     self.x = @e_x
  2341.     self.y = @e_y
  2342.     @time = 0
  2343.   end
  2344.   #--------------------------------------------------------------------------
  2345.   # ● フレーム更新
  2346.   #--------------------------------------------------------------------------
  2347.   def plane_update
  2348.     @plane.ox += @move_x
  2349.     @plane.oy += @move_y
  2350.     @plane.opacity += @data[6][1]
  2351.     @time = @data[4] if @time == 0
  2352.   end
  2353.   #--------------------------------------------------------------------------
  2354.   # ● 解放
  2355.   #--------------------------------------------------------------------------
  2356.   def dispose
  2357.     bitmap.dispose if bitmap
  2358.     @plane.dispose if @plane
  2359.     @viewport.dispose if @viewport
  2360.     super
  2361.   end
  2362. end
  2363.  
  2364. #==============================================================================
  2365. # ■ Sprite_Back_Picture
  2366. #------------------------------------------------------------------------------
  2367. #  周期ピクチャ用のスプライトです。
  2368. #==============================================================================
  2369. class Sprite_Back_Picture < Plane
  2370.   #--------------------------------------------------------------------------
  2371.   # ● 公開インスタンス変数 
  2372.   #--------------------------------------------------------------------------
  2373.   attr_accessor   :action_end           # 終了フラグ
  2374.   #--------------------------------------------------------------------------
  2375.   # ● オブジェクト初期化
  2376.   #--------------------------------------------------------------------------
  2377.   def initialize(viewport = nil, index)
  2378.     super(viewport)
  2379.     @index = index
  2380.     @real_x = 0
  2381.     @real_y = 0
  2382.     @real_opacity = 0
  2383.     @move_x = 0
  2384.     @move_y = 0
  2385.     @move_opacity = 0
  2386.     @time = 0
  2387.     @switche = 0
  2388.     @action_end = false
  2389.   end
  2390.   #--------------------------------------------------------------------------
  2391.   # ● セットアップ
  2392.   #--------------------------------------------------------------------------
  2393.   def setup(data)
  2394.     self.bitmap = Cache.picture(data[9])
  2395.     self.z = data[6]
  2396.     @switche = data[1]
  2397.     mirror = $sv_camera.mirror
  2398.     mirror = false if !data[8]
  2399.     @move_x = data[3][0]
  2400.     @move_x *= -1 if mirror
  2401.     @move_y = data[3][1]
  2402.     @time = data[4]
  2403.     @time = -1 if @time == 0
  2404.     @real_opacity = (data[5][0] + 1) * 100
  2405.     @move_opacity = data[5][1]
  2406.     @start_opacity = data[5][0]
  2407.     @shake_ok = data[7]
  2408.   end
  2409.   #--------------------------------------------------------------------------
  2410.   # ● フレーム更新
  2411.   #--------------------------------------------------------------------------
  2412.   def update
  2413.     update_picture if @time != 0
  2414.     self.ox = $sv_camera.x - @real_x
  2415.     self.oy = $sv_camera.y - @real_y
  2416.     if @shake_ok
  2417.       self.ox -= $sv_camera.sx / 100
  2418.       self.oy -= $sv_camera.sy / 100
  2419.     end
  2420.     self.ox *= $sv_camera.zoom
  2421.     self.oy *= $sv_camera.zoom
  2422.     self.zoom_x = @zoom_x * $sv_camera.zoom
  2423.     self.zoom_y = @zoom_y * $sv_camera.zoom
  2424.     self.opacity = @real_opacity / 100
  2425.     @move_opacity *= -1 if self.opacity == 255 or self.opacity <= @start_opacity
  2426.     @switche
  2427.     @action_end = true if @switche > 0 && !$game_switches[@switche]
  2428.     @action_end = true if @switche < 0 && !$sv_camera.switches[@switche.abs]
  2429.   end
  2430.   #--------------------------------------------------------------------------
  2431.   # ● ピクチャの更新
  2432.   #--------------------------------------------------------------------------
  2433.   def update_picture
  2434.     @real_x += @move_x / 100
  2435.     @real_y += @move_y / 100
  2436.     @real_x = 0 if @real_x >= self.bitmap.width or @real_x <= -self.bitmap.width
  2437.     @real_y = 0 if @real_y >= self.bitmap.height or @real_y <= -self.bitmap.height
  2438.     @zoom_x = 1
  2439.     @zoom_y = 1
  2440.     @real_opacity += @move_opacity
  2441.     @time -= 1
  2442.     @time = -1 if @time < -100
  2443.   end
  2444. end
  2445.  
  2446. #==============================================================================
  2447. # ■ Sprite_Back_Picture
  2448. #------------------------------------------------------------------------------
  2449. #  ダメージ表示のスプライトです。
  2450. #==============================================================================
  2451. class Sprite_Damage < Sprite
  2452.   #--------------------------------------------------------------------------
  2453.   # ● 公開インスタンス変数 
  2454.   #--------------------------------------------------------------------------
  2455.   attr_reader   :action_end                  # POP終了フラグ
  2456.   #--------------------------------------------------------------------------
  2457.   # ● オブジェクト初期化
  2458.   #--------------------------------------------------------------------------
  2459.   def initialize(viewport = nil, battler)
  2460.     super(viewport)
  2461.     @battler = battler
  2462.     @time = 0
  2463.     return @action_end = true if !@battler
  2464.     @direction = -1
  2465.     @direction *= -1 if @battler.actor?
  2466.     @direction *= -1 if $sv_camera.mirror
  2467.     set_state
  2468.     set_damage
  2469.     update
  2470.   end
  2471.   #--------------------------------------------------------------------------
  2472.   # ● ステート表示
  2473.   #--------------------------------------------------------------------------
  2474.   def set_state
  2475.     return if !N03::STATE_POP
  2476.     states = @battler.result.added_state_objects
  2477.     states.delete($data_states[@battler.death_state_id]) if @battler.result.hp_damage != 0
  2478.     return if states == []
  2479.     return if @battler.sv.add_state == @battler.result.added_state_objects
  2480.     @battler.sv.add_state = states.dup
  2481.     @st = []
  2482.     @st_base = []
  2483.     for i in 0...states.size
  2484.       @st[i] = Sprite.new
  2485.       bitmap_state(@st[i], states[i])
  2486.       @st_base[i] = []
  2487.       @st_base[i][0] = @direction * (-20 + 5 * i) + @battler.sv.x / 100
  2488.       @st_base[i][1] = -40 - @state_height * i + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2489.       @st[i].z = 1000 + i
  2490.       @st[i].opacity = 0
  2491.     end
  2492.     @time = @pop_time = 80
  2493.   end   
  2494.   #--------------------------------------------------------------------------
  2495.   # ● ステート画像
  2496.   #--------------------------------------------------------------------------
  2497.   def bitmap_state(state, state_object)
  2498.     name = state_object.name
  2499.     state.bitmap = Cache.system("Iconset").dup
  2500.     state.src_rect.set(state_object.icon_index % 16 * 24, state_object.icon_index / 16 * 24, 24, 24)
  2501.     @state_height = 24
  2502.   end
  2503.   #--------------------------------------------------------------------------
  2504.   # ● ダメージ表示
  2505.   #--------------------------------------------------------------------------
  2506.   def hit_count
  2507.     for i in [email protected]
  2508.       if @battler.sv.hit[i] == nil
  2509.         @hit = i
  2510.         return @battler.sv.hit[i] = @hit
  2511.       end
  2512.     end
  2513.     @hit = @battler.sv.hit.size
  2514.     @battler.sv.hit.push(@hit)
  2515.   end  
  2516.   #--------------------------------------------------------------------------
  2517.   # ● ダメージ表示
  2518.   #--------------------------------------------------------------------------
  2519.   def set_damage
  2520.     return @action_end = true if !N03::DAMAGE_POP
  2521.     damage = @battler.result.hp_damage if @battler.result.hp_damage != 0
  2522.     damage = @battler.result.hp_drain  if @battler.result.hp_drain  != 0
  2523.     damage = @battler.result.mp_damage if @battler.result.mp_damage != 0
  2524.     damage = @battler.result.mp_drain  if @battler.result.mp_drain  != 0
  2525.     damage = @battler.result.tp_damage if @battler.result.tp_damage != 0
  2526.     if !damage or damage == 0
  2527.       @action_end = true if @st == nil
  2528.       return # ステートだけPOPする設定を考慮して@action_endは返さない
  2529.     end
  2530.     hit_count
  2531.     #@hit = @battler.sv.hit
  2532.     #@battler.sv.hit += 1 if damage != 0
  2533.     file = N03::DAMAGE_PLUS if damage > 0
  2534.     file = "damage_num_critical" if damage > 0 && @battler.result.critical
  2535.     file = N03::DAMAGE_MINUS if damage < 0
  2536.     add_file = N03::DAMAGE_MP if @battler.result.mp_damage != 0
  2537.     add_file = N03::DAMAGE_TP if @battler.result.tp_damage != 0
  2538.     adjust_x = N03::DAMAGE_ADJUST
  2539.     @num = []
  2540.     @num_base = []
  2541.     damage = damage.abs
  2542.     max_num = damage.to_s.size
  2543.     max_num += 1 if add_file != nil
  2544.     for i in 0...max_num
  2545.       @num[i] = Sprite.new
  2546.       if add_file != nil && i == max_num - 1
  2547.         @num[i].bitmap = Cache.system(add_file)
  2548.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2549.         sw = 0 if sw == nil
  2550.       else
  2551.         @num[i].bitmap = Cache.system(file)
  2552.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2553.         sw = @num[i].bitmap.width / 10
  2554.         @num[i].src_rect.set(cw * sw, 0, sw, @num[i].bitmap.height)
  2555.       end
  2556.       @num_base[i] = []
  2557.       @num_base[i][0] = (sw + adjust_x) * i * -1 + (@battler.sv.x / 100)
  2558.       @num_base[i][1] =  -(@num[i].bitmap.height * 9) - i * 0 - @hit * 2 + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2559.       @num_base[i][0] -= @num[i].bitmap.width / 2 - adjust_x if add_file != nil && i == max_num - 1
  2560.       @num[i].z = 1000 + i + @hit * 10
  2561.     end
  2562.     @time = @pop_time = 60
  2563.   end
  2564.   #--------------------------------------------------------------------------
  2565.   # ● フレーム更新
  2566.   #--------------------------------------------------------------------------
  2567.   def update
  2568.     return if @time == 0
  2569.     for i in [email protected] do update_state_move(@st[i], i) end if @st != nil
  2570.     for i in [email protected] do update_num_move(@num[i], i) end if @num != nil
  2571.     @time -= 1
  2572.     @action_end = true if @time == 0
  2573.   end
  2574.   #--------------------------------------------------------------------------
  2575.   # ● ステート画像の更新
  2576.   #--------------------------------------------------------------------------
  2577.   def update_state_move(state, index)
  2578.     min = @pop_time - index * 2
  2579.     case @time
  2580.     when min-15..min
  2581.       @st_base[index][0] += @direction
  2582.       state.opacity += 25
  2583.     when min-80..min-50
  2584.       @st_base[index][0] += @direction
  2585.       state.opacity -= 25
  2586.     end
  2587.     state.x = (@st_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2588.     state.y = (@st_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2589.   end
  2590.   #--------------------------------------------------------------------------
  2591.   # ● 数値の更新
  2592.   #--------------------------------------------------------------------------
  2593.   def update_num_move(num, index)
  2594.     min = @pop_time - index * 0
  2595.     case @time
  2596.     when min-1..min
  2597.       @num_base[index][0] += @direction * @hit
  2598.       @num_base[index][1] -= 5 + @hit * 2
  2599.     when min-3..min-2
  2600.       @num_base[index][0] += @direction * @hit
  2601.       @num_base[index][1] -= 4 + @hit * 2
  2602.     when min-6..min-4
  2603.       @num_base[index][0] += @direction
  2604.       @num_base[index][1] -= 3 + @hit * 2
  2605.     when min-14..min-7
  2606.       @num_base[index][0] += @direction
  2607.       @num_base[index][1] += 2
  2608.     when min-17..min-15
  2609.       @num_base[index][1] -= 2 + @hit * 2
  2610.     when min-23..min-18
  2611.       @num_base[index][1] += 1
  2612.     when min-27..min-24
  2613.       @num_base[index][1] -= 1
  2614.     when min-30..min-28
  2615.       @num_base[index][1] += 1
  2616.     when min-33..min-31
  2617.       @num_base[index][1] -= 1
  2618.     when min-36..min-34
  2619.       @num_base[index][1] += 1
  2620.     end
  2621.     num.x = (@num_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2622.     num.y = (@num_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2623.     num.opacity = 256 - (12 - @time) * 32
  2624.     num.visible = false if @time == 0
  2625.   end
  2626.   #--------------------------------------------------------------------------
  2627.   # ● 解放
  2628.   #--------------------------------------------------------------------------
  2629.   def dispose
  2630.     @battler.sv.hit[@hit] = nil if @hit
  2631.     bitmap.dispose if bitmap
  2632.     for i in [email protected] do @num[i].dispose end if @num != nil
  2633.     for i in [email protected] do @st[i].dispose end if @st != nil
  2634.     super
  2635.   end
  2636. end
  2637.  
  2638. #==============================================================================
  2639. # ■ Window_Skill_name
  2640. #------------------------------------------------------------------------------
  2641. #  スキル名を表示するウィンドウです。
  2642. #==============================================================================
  2643. class Window_Skill_name < Window_Base
  2644.   #--------------------------------------------------------------------------
  2645.   # ● オブジェクト初期化
  2646.   #--------------------------------------------------------------------------
  2647.   def initialize(text)
  2648.     super(0, 0, Graphics.width, line_height + standard_padding * 2)
  2649.     draw_text(4, 0, Graphics.width - 64, line_height,text, 1)
  2650.   end
  2651. end
  2652.  
  2653. #==============================================================================
  2654. # ■ Spriteset_Sideview
  2655. #------------------------------------------------------------------------------
  2656. #  サイドビュー独自のスプライトをまとめたクラスです。
  2657. #==============================================================================
  2658. class Spriteset_Sideview
  2659.   #--------------------------------------------------------------------------
  2660.   # ● オブジェクト初期化
  2661.   #--------------------------------------------------------------------------
  2662.   def initialize(viewport)
  2663.     @viewport = viewport
  2664.     @weapons = []
  2665.     @pictures = []
  2666.     @back_pic = []
  2667.     @damage = []
  2668.     $sv_camera.setup
  2669.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup)
  2670.   end
  2671.   #--------------------------------------------------------------------------
  2672.   # ● フレーム更新
  2673.   #--------------------------------------------------------------------------
  2674.   def update
  2675.     update_battler_data
  2676.     update_damage
  2677.     update_pictures
  2678.     update_back_pic
  2679.     update_weapons
  2680.   end  
  2681.   #--------------------------------------------------------------------------
  2682.   # ● バトラーデータの更新
  2683.   #--------------------------------------------------------------------------
  2684.   def update_battler_data
  2685.     for battler in $game_party.battle_members + $game_troop.members
  2686.       weapon_end(battler) if battler.sv.weapon_end
  2687.       next if battler.sv.effect_data == []
  2688.       for effect_data in battler.sv.effect_data do set_effects(battler, effect_data) end
  2689.     end
  2690.   end
  2691.   #--------------------------------------------------------------------------
  2692.   # ● ダメージ画像の更新
  2693.   #--------------------------------------------------------------------------
  2694.   def update_damage
  2695.     for i in [email protected]
  2696.       next if @damage[i] == nil
  2697.       @damage[i].update if @damage[i] != nil
  2698.       next if !@damage[i].action_end
  2699.       @damage[i].dispose
  2700.       @damage[i] = nil
  2701.     end
  2702.   end
  2703.   #--------------------------------------------------------------------------
  2704.   # ● ピクチャアクションの更新
  2705.   #--------------------------------------------------------------------------
  2706.   def update_pictures
  2707.     for i in [email protected]
  2708.       next if @pictures[i] == nil
  2709.       @pictures[i].update if @pictures[i] != nil
  2710.       next if !@pictures[i].action_end
  2711.       @pictures[i].dispose
  2712.       @pictures[i] = nil
  2713.     end
  2714.   end
  2715.   #--------------------------------------------------------------------------
  2716.   # ● 周期ピクチャの更新
  2717.   #--------------------------------------------------------------------------
  2718.   def update_back_pic
  2719.     set_back_pic if $sv_camera.program_picture != []
  2720.     for i in 0...@back_pic.size
  2721.       next if @back_pic[i] == nil
  2722.       @back_pic[i].update if @back_pic[i] != nil
  2723.       next if !@back_pic[i].action_end
  2724.       @back_pic[i].dispose
  2725.       @back_pic[i] = nil
  2726.     end
  2727.   end
  2728.   #--------------------------------------------------------------------------
  2729.   # ● 武器アクションの更新
  2730.   #--------------------------------------------------------------------------
  2731.   def update_weapons
  2732.     for i in [email protected]
  2733.       next if @weapons[i] == nil
  2734.       @weapons[i].update if @weapons[i] != nil
  2735.       next if !@weapons[i].action_end
  2736.       @weapons[i].dispose
  2737.       @weapons[i] = nil
  2738.     end
  2739.   end
  2740.   #--------------------------------------------------------------------------
  2741.   # ● ダメージ実行
  2742.   #--------------------------------------------------------------------------
  2743.   def set_damage_pop(target)
  2744.     for i in [email protected]
  2745.       next if @damage[i] != nil
  2746.       return @damage[i] = Sprite_Damage.new(@viewport, target)
  2747.     end
  2748.     @damage.push(Sprite_Damage.new(@viewport, target))
  2749.   end
  2750.   #--------------------------------------------------------------------------
  2751.   # ● 周期ピクチャ実行
  2752.   #--------------------------------------------------------------------------
  2753.   def set_back_pic
  2754.     for data in $sv_camera.program_picture
  2755.       if @back_pic[data[2]] != nil
  2756.         @back_pic[data[2]].dispose
  2757.         @back_pic[data[2]] = nil
  2758.       end
  2759.       @back_pic[data[2]] = Sprite_Back_Picture.new(@viewport, data[2])
  2760.       @back_pic[data[2]].setup(data)
  2761.     end
  2762.     $sv_camera.program_picture = []
  2763.   end
  2764.   #--------------------------------------------------------------------------
  2765.   # ● エフェクト開始
  2766.   #--------------------------------------------------------------------------
  2767.   def set_effects(battler, effect_data)
  2768.     case effect_data[0]
  2769.     when "pic" ; set_pictures(battler, effect_data)
  2770.     when  "wp" ; set_weapons(battler,  true)
  2771.     when "m_a" ; set_weapons(battler, false)
  2772.     end
  2773.   end
  2774.   #--------------------------------------------------------------------------
  2775.   # ● ピクチャアクション実行
  2776.   #--------------------------------------------------------------------------
  2777.   def set_pictures(battler, effect_data)
  2778.     @pictures[effect_data[1]] = Sprite_Battle_Picture.new if @pictures[effect_data[1]] == nil
  2779.     @pictures[effect_data[1]].set(battler)
  2780.   end
  2781.   #--------------------------------------------------------------------------
  2782.   # ● 武器アクション実行
  2783.   #--------------------------------------------------------------------------
  2784.   def set_weapons(battler, weapon_flag, test = true)
  2785.     for i in [email protected]
  2786.       next if @weapons[i] != nil
  2787.       @weapons[i] = Sprite_Weapon.new(@viewport, i, battler)
  2788.       battler.sv.weapon_index.push(i) if weapon_flag
  2789.       return i
  2790.     end
  2791.     @weapons.push(Sprite_Weapon.new(@viewport, @weapons.size, battler))
  2792.     battler.sv.weapon_index.push(@weapons.size - 1) if weapon_flag
  2793.     return @weapons.size - 1
  2794.   end
  2795.   #--------------------------------------------------------------------------
  2796.   # ● バトラーの武器アクション終了
  2797.   #--------------------------------------------------------------------------
  2798.   def weapon_end(battler)
  2799.     battler.sv.weapon_end = false
  2800.     for index in battler.sv.weapon_index
  2801.       weapon_index = battler.sv.weapon_index.shift
  2802.       @weapons[weapon_index].dispose if @weapons[weapon_index] != nil
  2803.       @weapons[weapon_index] = nil
  2804.     end
  2805.     battler.sv.weapon_index.compact!
  2806.   end  
  2807.   #--------------------------------------------------------------------------
  2808.   # ● ヒット時の戦闘アニメ実行
  2809.   #--------------------------------------------------------------------------
  2810.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  2811.     weapon = @weapons[weapon_index]
  2812.     for target in hit_targets
  2813.       next @weapons[@hit_index].timing_battler_set(target) if @hit_index != nil
  2814.       @hit_index = set_weapons(battler, false, false)
  2815.       @weapons[@hit_index].set_hit_animation(weapon.hit_position, weapon.hit_anime_id, target)
  2816.     end
  2817.     @hit_index = nil
  2818.     if !weapon.through && !miss
  2819.       @weapons[weapon_index].dispose
  2820.       @weapons[weapon_index] = nil
  2821.     else
  2822.       @weapons[weapon_index].through_change
  2823.     end
  2824.   end
  2825.   #--------------------------------------------------------------------------
  2826.   # ● サイドビューデータの初期化
  2827.   #--------------------------------------------------------------------------
  2828.   def reset_sideview
  2829.     $sv_camera.reset
  2830.     for member in $game_troop.members + $game_party.battle_members do member.sv.reset end
  2831.   end  
  2832.   #--------------------------------------------------------------------------
  2833.   # ● 解放
  2834.   #--------------------------------------------------------------------------
  2835.   def dispose
  2836.     dispose_effects(@weapons)
  2837.     dispose_effects(@pictures)
  2838.     dispose_effects(@back_pic)
  2839.     dispose_effects(@damage)
  2840.     reset_sideview
  2841.   end
  2842.   #--------------------------------------------------------------------------
  2843.   # ● エフェクト画像の解放
  2844.   #--------------------------------------------------------------------------
  2845.   def dispose_effects(effects)
  2846.     for i in 0...effects.size
  2847.       effects[i].dispose if effects[i] != nil
  2848.       effects[i] = nil
  2849.     end
  2850.   end
  2851. end
  2852.  
  2853.  
  2854. #==============================================================================
  2855. # ■ Sprite_Battle_Back
  2856. #------------------------------------------------------------------------------
  2857. #  戦闘背景用のスプライトです。
  2858. #==============================================================================
  2859. class Sprite_Battle_Back < Plane
  2860.   #--------------------------------------------------------------------------
  2861.   # ● オブジェクト初期化
  2862.   #--------------------------------------------------------------------------
  2863.   def initialize(viewport = nil, index, battleback_name)
  2864.     super(viewport)
  2865.     @index = index
  2866.     if @index == 1
  2867.       data = N03::FLOOR1_DATA[battleback_name]
  2868.       data = N03::FLOOR1_DATA["全Battlebacks1"] if data == nil
  2869.     elsif @index == 2
  2870.       data = N03::FLOOR2_DATA[battleback_name]
  2871.       data = N03::FLOOR2_DATA["全Battlebacks2"] if data == nil
  2872.     end   
  2873.     data = data.dup
  2874.     @adjust_position = data[0]
  2875.     @zoom_x = data[1][0] / 100.0
  2876.     @zoom_y = data[1][1] / 100.0
  2877.     @shake_on = data[2]
  2878.     $game_switches[data[3]] = true if data[3] > 0
  2879.     $sv_camera.switches[data[3].abs] = true if data[3] < 0
  2880.     reset_scroll
  2881.     reset_back_data(battleback_name)
  2882.   end
  2883.   #--------------------------------------------------------------------------
  2884.   # ● 背景スクロールを初期化
  2885.   #--------------------------------------------------------------------------
  2886.   def reset_scroll
  2887.     @scroll_x = 0
  2888.     @scroll_y = 0
  2889.     @move_x = 0
  2890.     @move_y = 0
  2891.   end
  2892.   #--------------------------------------------------------------------------
  2893.   # ● 背景データを初期化
  2894.   #--------------------------------------------------------------------------
  2895.   def reset_back_data(battleback_name)
  2896.     @back_data = []
  2897.     @active_data = ["scroll",0, @move_x, @move_y, false, battleback_name,""]
  2898.     start_back_data(@active_data)
  2899.   end  
  2900.   #--------------------------------------------------------------------------
  2901.   # ● 背景画像のセッティング
  2902.   #--------------------------------------------------------------------------
  2903.   def set_graphics(new_bitmap)
  2904.     self.bitmap = new_bitmap
  2905.     @base_x = (self.bitmap.width * @zoom_x - Graphics.width) / 2 + @adjust_position[0]
  2906.     @base_y = (self.bitmap.height * @zoom_y - Graphics.height) / 2 + @adjust_position[1]
  2907.     # 限界座標を取得
  2908.     max_top =  0
  2909.     max_bottom = self.bitmap.height * @zoom_y - Graphics.height
  2910.     max_left = 0
  2911.     max_right = self.bitmap.width * @zoom_x - Graphics.width
  2912.     exist = true
  2913.     exist = false if self.bitmap.height == 32 && self.bitmap.width == 32
  2914.     $sv_camera.setting(@index, [max_top, max_bottom, max_left, max_right, @base_x, @base_y,exist])
  2915.   end
  2916.   #--------------------------------------------------------------------------
  2917.   # ● フレーム更新
  2918.   #--------------------------------------------------------------------------
  2919.   def update
  2920.     return if !bitmap
  2921.     update_back_data
  2922.     update_scroll unless @move_x == 0 && @move_y == 0
  2923.     update_color
  2924.     update_position
  2925.     update_back_adjust if @bt_back != nil
  2926.     create_back_adjust if @bt_back == nil && !@active_data[10] && @scroll_x == 0 && @scroll_y == 0
  2927.   end
  2928.   #--------------------------------------------------------------------------
  2929.   # ● 背景データを更新
  2930.   #--------------------------------------------------------------------------
  2931.   def update_back_data
  2932.     delete = true if @active_data[1] > 0 && !$game_switches[@active_data[1]]
  2933.     delete = true if @active_data[1] < 0 && !$sv_camera.switches[@active_data[1].abs]
  2934.     return if !delete
  2935.     for i in 0...@back_data.size
  2936.       @back_data[i] = nil if @back_data[i][1] > 0 && !$game_switches[@back_data[i][1]]
  2937.       @back_data[i] = nil if @back_data[i][1] < 0 && !$sv_camera.switches[@back_data[i][1].abs]
  2938.     end
  2939.     @back_data.compact!
  2940.     next_back_data
  2941.   end
  2942.   #--------------------------------------------------------------------------
  2943.   # ● 次の背景データをセット
  2944.   #--------------------------------------------------------------------------
  2945.   def next_back_data
  2946.     @back_data.delete(@active_data[11]) if @active_data[11] != nil
  2947.     @back_data.push(@active_data[11]) if @active_data[11] != nil
  2948.     @active_data = nil
  2949.     data = @back_data.pop
  2950.     @back_data = [@active_data] if @back_data.size == 0
  2951.     start_back_data(data)
  2952.   end  
  2953.   #--------------------------------------------------------------------------
  2954.   # ● 背景データを実行
  2955.   #--------------------------------------------------------------------------
  2956.   def start_back_data(data)
  2957.     return if back_data_remain(data)
  2958.     bt_back_dispose
  2959.     pre_active_data = @active_data
  2960.     @active_data[8] = [@back_name, @move_x, @move_y, @scroll_x, @scroll_y] if @active_data != nil
  2961.     @back_data.push(@active_data)     if @active_data != nil
  2962.     @active_data = data.dup
  2963.     @active_data[5] = @back_name      if @active_data[5] == ""
  2964.     @active_data[9] = set_back_adjust if @active_data[9] == nil
  2965.     back_data_scroll_on               if @active_data[8] == nil && @active_data[9][0] == false
  2966.     set_remain_back_data              if @active_data[8] != nil
  2967.     create_back(@active_data[5])      if @active_data[9][0] == false
  2968.     create_back_adjust                if @active_data[10]
  2969.     @active_data[11] = pre_active_data if pre_active_data && @active_data[7] == false
  2970.   end  
  2971.   #--------------------------------------------------------------------------
  2972.   # ● 背景データの保留
  2973.   #--------------------------------------------------------------------------
  2974.   def back_data_remain(data)
  2975.     remain = false
  2976.     remain = true if data[6] != "" && @active_data != nil && @active_data[9] != nil && @active_data[9][0] != false
  2977.     remain = true if @active_data != nil && @active_data[7] == false
  2978.     return remain if !remain
  2979.     @remain = true
  2980.     @back_data.push(data)
  2981.     return remain
  2982.   end  
  2983.   #--------------------------------------------------------------------------
  2984.   # ● 背景変更補正データをセット
  2985.   #--------------------------------------------------------------------------
  2986.   def set_back_adjust
  2987.     bt_adjust = []
  2988.     sign = -1
  2989.     if @active_data[6] == ""
  2990.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  2991.       bt_adjust = [false,false,0,0]
  2992.       return bt_adjust
  2993.     elsif @move_x != 0 or @active_data[3][0] != 0
  2994.       sign = 1 if @move_x < 0
  2995.       bt_adjust[0] = [self.bitmap.width * @zoom_x * sign, 0]
  2996.       bt_adjust[1] = [self.bitmap.width * @zoom_x * sign * 2, 0]
  2997.     elsif @move_y != 0 or @active_data[3][1] != 0
  2998.       sign = 1 if @move_y < 0
  2999.       bt_adjust[0] = [0, self.bitmap.height * @zoom_y * sign]
  3000.       bt_adjust[1] = [0, self.bitmap.height * @zoom_y * sign * 2]
  3001.     else
  3002.       reset_scroll if @active_data[3][0] == 0 &&  @active_data[3][1] == 0
  3003.       bt_adjust = [false,false,0,0]
  3004.       return bt_adjust
  3005.     end
  3006.     bt_adjust[2] = [bt_adjust[0][0], bt_adjust[0][1]]
  3007.     return bt_adjust
  3008.   end
  3009.   #--------------------------------------------------------------------------
  3010.   # ● 背景スクロールデータを実行
  3011.   #--------------------------------------------------------------------------
  3012.   def back_data_scroll_on
  3013.     mirror = $sv_camera.mirror
  3014.     mirror = false if !@active_data[4]
  3015.     @move_x = @active_data[3][0]
  3016.     @move_x *= -1 if mirror
  3017.     @move_y = @active_data[3][1]
  3018.   end
  3019.   #--------------------------------------------------------------------------
  3020.   # ● 保持している背景データを実行
  3021.   #--------------------------------------------------------------------------
  3022.   def set_remain_back_data
  3023.     return back_data_scroll_on if @move_x != 0 or @move_y != 0
  3024.     create_back(@active_data[8][0])
  3025.     @move_x    = @active_data[8][1]
  3026.     @move_y    = @active_data[8][2]
  3027.     @scroll_x  = @active_data[8][3]
  3028.     @scroll_y  = @active_data[8][4]
  3029.   end  
  3030.   #--------------------------------------------------------------------------
  3031.   # ● 背景画像の作成
  3032.   #--------------------------------------------------------------------------
  3033.   def create_back(back_name)
  3034.     return if back_name == @back_name or back_name == ""
  3035.     self.bitmap = Cache.battleback1(back_name) if @index == 1
  3036.     self.bitmap = Cache.battleback2(back_name) if @index == 2
  3037.     @back_name = back_name
  3038.   end  
  3039.   #--------------------------------------------------------------------------
  3040.   # ● 背景変更補正画像の作成
  3041.   #--------------------------------------------------------------------------
  3042.   def create_back_adjust
  3043.     return if @active_data[9][0] == false
  3044.     @active_data[10] = true
  3045.     mirror = $sv_camera.mirror
  3046.     mirror = false if !@active_data[4]
  3047.     @bt_back = []
  3048.     @bt_back[0] = Sprite.new(viewport)
  3049.     @bt_back[0].bitmap = Cache.battleback1(@active_data[6]) if @index == 1
  3050.     @bt_back[0].bitmap = Cache.battleback2(@active_data[6]) if @index == 2
  3051.     @bt_back[0].mirror = mirror
  3052.     @bt_back[1] = Sprite.new(viewport)
  3053.     @bt_back[1].bitmap = Cache.battleback1(@active_data[5]) if @index == 1
  3054.     @bt_back[1].bitmap = Cache.battleback2(@active_data[5]) if @index == 2
  3055.     @bt_back[1].mirror = mirror
  3056.   end
  3057.   #--------------------------------------------------------------------------
  3058.   # ● 背景スクロールの更新
  3059.   #--------------------------------------------------------------------------
  3060.   def update_scroll
  3061.     @scroll_x += @move_x
  3062.     @scroll_y += @move_y
  3063.     @scroll_x = 0 if @scroll_x / 100 >= self.bitmap.width * @zoom_x or @scroll_x / 100 <= -self.bitmap.width * @zoom_x
  3064.     @scroll_y = 0 if @scroll_y / 100 >= self.bitmap.height * @zoom_y or @scroll_y / 100 <= -self.bitmap.height * @zoom_y
  3065.   end
  3066.   #--------------------------------------------------------------------------
  3067.   # ● 色調変更の更新
  3068.   #--------------------------------------------------------------------------
  3069.   def update_color
  3070.     color_set if $sv_camera.color_set[@index] != nil
  3071.     return if @color_data == nil
  3072.     @color_data[4] -= 1
  3073.     if @color_data[4] == 0 && @color_data[5] != 0
  3074.       @color_data[4] = @color_data[5]
  3075.       @color_data[5] = 0
  3076.       @color_data[6] = [0,0,0,0]
  3077.     elsif @color_data[4] == 0
  3078.       @remain_color_data = @color_data
  3079.       return @color_data = nil
  3080.     end  
  3081.     for i in 0..3
  3082.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  3083.     end  
  3084.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  3085.   end
  3086.   #--------------------------------------------------------------------------
  3087.   # ● 座標の更新
  3088.   #--------------------------------------------------------------------------
  3089.   def update_position
  3090.     self.ox = $sv_camera.x + @base_x - @scroll_x / 100
  3091.     self.oy = $sv_camera.y + @base_y - @scroll_y / 100
  3092.     self.ox -= $sv_camera.sx / 100 if @shake_on
  3093.     self.oy -= $sv_camera.sy / 100 if @shake_on
  3094.     self.zoom_x = @zoom_x * $sv_camera.zoom
  3095.     self.zoom_y = @zoom_y * $sv_camera.zoom
  3096.     self.ox *= $sv_camera.zoom
  3097.     self.oy *= $sv_camera.zoom
  3098.     self.z = @index * 10
  3099.   end
  3100.   #--------------------------------------------------------------------------
  3101.   # ● 背景変更補正画像を更新
  3102.   #--------------------------------------------------------------------------
  3103.   def update_back_adjust
  3104.     @active_data[9][0][0] = 0 if @scroll_x == 0
  3105.     @active_data[9][0][1] = 0 if @scroll_y == 0
  3106.     @active_data[9][1][0] -= @active_data[9][2][0] if @scroll_x == 0
  3107.     @active_data[9][1][1] -= @active_data[9][2][1] if @scroll_y == 0
  3108.     for i in 0...@bt_back.size
  3109.       @bt_back[i].x = -self.ox + @active_data[9][i][0] * $sv_camera.zoom
  3110.       @bt_back[i].y = -self.oy + @active_data[9][i][1] * $sv_camera.zoom
  3111.       @bt_back[i].zoom_x = self.zoom_x
  3112.       @bt_back[i].zoom_y = self.zoom_y
  3113.       @bt_back[i].z = self.z + 1
  3114.       @bt_back[i].color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  3115.     end
  3116.     back_data_scroll_on if @active_data[9][0][0] == 0 && @active_data[9][0][1] == 0
  3117.     return unless @active_data[9][1][0] == 0 && @active_data[9][1][1] == 0
  3118.     bt_back_dispose
  3119.     create_back(@active_data[5])
  3120.     @active_data[9][0] = false
  3121.     next_back_data if @remain && @back_data.size != 1
  3122.     @remain = false
  3123.   end
  3124.   #--------------------------------------------------------------------------
  3125.   # ● 色調変更
  3126.   #--------------------------------------------------------------------------
  3127.   def color_set
  3128.     set = $sv_camera.color_set[@index]
  3129.     $sv_camera.color_set[@index] = nil
  3130.     set[4] = 1 if set[4] == 0
  3131.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  3132.     @color_data = @remain_color_data
  3133.     @color_data[4] = set[4]
  3134.     @color_data[5] = set[5]
  3135.     @color_data[6] = set
  3136.   end
  3137.   #--------------------------------------------------------------------------
  3138.   # ● 背景変更補正画像の解放
  3139.   #--------------------------------------------------------------------------
  3140.   def bt_back_dispose
  3141.     for i in 0...@bt_back.size do @bt_back[i].dispose end if @bt_back != nil
  3142.     @bt_back = nil
  3143.   end  
  3144.   #--------------------------------------------------------------------------
  3145.   # ● 解放
  3146.   #--------------------------------------------------------------------------
  3147.   def dispose
  3148.     bitmap.dispose if bitmap
  3149.     bt_back_dispose
  3150.     super
  3151.   end
  3152. end  
  3153.  
  3154. #==============================================================================
  3155. # ■ Battle_Camera
  3156. #------------------------------------------------------------------------------
  3157. #  戦闘カメラやバトルプログラムを扱うクラスです。
  3158. #==============================================================================
  3159. class Battle_Camera
  3160.   #--------------------------------------------------------------------------
  3161.   # ● 公開インスタンス変数 
  3162.   #--------------------------------------------------------------------------
  3163.   attr_reader   :sx                 # シェイクX座標
  3164.   attr_reader   :sy                 # シェイクY座標
  3165.   attr_reader   :max_top            # 上限界座標
  3166.   attr_reader   :max_bottom         # 下限界座標
  3167.   attr_reader   :max_left           # 左限界座標
  3168.   attr_reader   :max_right          # 右限界座標
  3169.   attr_accessor :switches           # サイドビュー専用スイッチ
  3170.   attr_accessor :color_set          # 色調変更データ
  3171.   attr_accessor :wait               # 戦闘シーンの強制ウエイト
  3172.   attr_accessor :win_wait           # 戦闘勝利前のウエイト
  3173.   attr_accessor :mirror             # 画面反転フラグ
  3174.   attr_accessor :program_scroll     # バトルプログラム 背景の自動スクロール
  3175.   attr_accessor :program_picture    # バトルプログラム 周期ピクチャ
  3176.   attr_accessor :event              # コモンイベント呼び出し
  3177.   #--------------------------------------------------------------------------
  3178.   # ● オブジェクト初期化
  3179.   #--------------------------------------------------------------------------
  3180.   def initialize
  3181.     @switches = []
  3182.     @max_data = []
  3183.     @color_set = []
  3184.     @wait = 0
  3185.     @win_wait = false
  3186.     @mirror = false
  3187.     @event = false
  3188.     setup
  3189.   end
  3190.   #--------------------------------------------------------------------------
  3191.   # ● カメラX座標
  3192.   #--------------------------------------------------------------------------
  3193.   def x
  3194.     return @x / 100
  3195.   end
  3196.   #--------------------------------------------------------------------------
  3197.   # ● カメラY座標
  3198.   #--------------------------------------------------------------------------
  3199.   def y
  3200.     return @y / 100
  3201.   end
  3202.   #--------------------------------------------------------------------------
  3203.   # ● ズーム率
  3204.   #--------------------------------------------------------------------------
  3205.   def zoom
  3206.     return @zoom * 0.001
  3207.   end
  3208.   #--------------------------------------------------------------------------
  3209.   # ● ズーム率による座標変換
  3210.   #--------------------------------------------------------------------------
  3211.   def convert
  3212.     return @zoom
  3213.   end
  3214.   #--------------------------------------------------------------------------
  3215.   # ● カメラセットアップ
  3216.   #--------------------------------------------------------------------------
  3217.   def setup
  3218.     @x = 0
  3219.     @y = 0
  3220.     @sx = 0
  3221.     @sy = 0
  3222.     @zoom = 1000
  3223.     @time = 0
  3224.     @shake_time = 0
  3225.     program_setup
  3226.   end
  3227.   #--------------------------------------------------------------------------
  3228.   # ● カメラ初期化
  3229.   #--------------------------------------------------------------------------
  3230.   def reset
  3231.     @switches = []
  3232.     @max_data = []
  3233.     @color_set = []
  3234.     @wait = 0
  3235.     @win_wait = false
  3236.     @mirror = false
  3237.     program_setup(false)
  3238.   end  
  3239.   #--------------------------------------------------------------------------
  3240.   # ● バトルプログラムのセットアップ
  3241.   #--------------------------------------------------------------------------
  3242.   def program_setup(check = true)
  3243.     @played_program  = []
  3244.     @program_switch  = []
  3245.     @program_sound   = []
  3246.     @program_scroll  = []
  3247.     @program_se      = []
  3248.     @program_shake   = []
  3249.     @program_color   = []
  3250.     @program_picture = []
  3251.     @program_base = N03::BATTLE_PROGRAM.values.dup
  3252.     program_check if check
  3253.   end  
  3254.   #--------------------------------------------------------------------------
  3255.   # ● バトルプログラムのチェック
  3256.   #--------------------------------------------------------------------------
  3257.   def program_check
  3258.     for data in @program_base
  3259.       if program_start?(data) && !@played_program.include?(data)
  3260.         @played_program.push(data.dup)
  3261.         @program_scroll.push(data.dup)  if data[0] == "scroll"
  3262.         @program_picture.push(data.dup) if data[0] == "kpic"
  3263.         start_sound(data.dup)           if data[0] == "sound"
  3264.         start_program_switch(data.dup)  if data[0] == "switch"
  3265.         start_program_se(data.dup)      if data[0] == "keep_se"
  3266.         start_program_shake(data.dup)   if data[0] == "keep_sk"
  3267.         start_program_color(data.dup)   if data[0] == "keep_c"
  3268.       else
  3269.         @played_program.delete(data)  if !program_start?(data)
  3270.         @program_scroll.delete(data)  if data[0] == "scroll"
  3271.         @program_picture.delete(data) if data[0] == "kpic"
  3272.         @program_switch.delete(data)  if data[0] == "switch"
  3273.         @program_sound.delete(data)   if data[0] == "sound"
  3274.         @program_se.delete(data)      if data[0] == "keep_se"
  3275.         @program_shake.delete(data)   if data[0] == "keep_sk"
  3276.         @program_color.delete(data)   if data[0] == "keep_c"
  3277.       end
  3278.     end
  3279.   end
  3280.   #--------------------------------------------------------------------------
  3281.   # ● バトルプログラムの開始
  3282.   #--------------------------------------------------------------------------
  3283.   def program_start?(data)
  3284.     start = false
  3285.     start = true if $game_switches[data[1].abs] && data[1] > 0
  3286.     start = true if @switches[data[1].abs] && data[1] < 0
  3287.     return start
  3288.   end  
  3289.   #--------------------------------------------------------------------------
  3290.   # ● バトルプログラム スイッチ操作の開始
  3291.   #--------------------------------------------------------------------------
  3292.   def start_program_switch(data)
  3293.     data[4] = data[4] + rand(data[5] + 1)
  3294.     data[4] = 1 if data[4] <= 0
  3295.     @program_switch.push(data)
  3296.   end
  3297.   #--------------------------------------------------------------------------
  3298.   # ● スイッチ操作の更新
  3299.   #--------------------------------------------------------------------------
  3300.   def update_program_switch
  3301.     for data in @program_switch
  3302.       data[4] -= 1
  3303.       next @program_switch.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3304.       next @program_switch.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3305.       next if data[4] != 0
  3306.       for id in data[2]
  3307.         $game_switches[id] = true if id > 0
  3308.         @switches[id.abs] = true  if id < 0
  3309.       end
  3310.       for id in data[3]
  3311.         $game_switches[id] = false if id > 0
  3312.         @switches[id.abs] = false  if id < 0
  3313.       end
  3314.       @program_switch.delete(data)
  3315.       program_check
  3316.     end  
  3317.   end
  3318.   #--------------------------------------------------------------------------
  3319.   # ● バトルプログラム BGM/BGSの開始
  3320.   #--------------------------------------------------------------------------
  3321.   def start_sound(data)
  3322.     @program_sound.push(data)
  3323.     name = data[5]
  3324.     case data[2]
  3325.     when "se"
  3326.       Audio.se_play("Audio/SE/" + name, data[4], data[3])
  3327.     when "bgm"
  3328.       name = RPG::BGM.last.name if data[5] == ""
  3329.       Audio.bgm_play("Audio/BGM/" + name, data[4], data[3])
  3330.     when "bgs"
  3331.       name = RPG::BGS.last.name if data[5] == ""
  3332.       Audio.bgs_play("Audio/BGS/" + name, data[4], data[3])
  3333.     end
  3334.   end
  3335.   #--------------------------------------------------------------------------
  3336.   # ● バトルプログラム 周期SEの開始
  3337.   #--------------------------------------------------------------------------
  3338.   def start_program_se(data)
  3339.     data[3] = [data[2], data[3]]
  3340.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3341.     @program_se.push(data)
  3342.     Audio.se_play("Audio/SE/" + data[7], data[5], data[4]) if data[6]
  3343.   end
  3344.   #--------------------------------------------------------------------------
  3345.   # ● 周期SEの更新
  3346.   #--------------------------------------------------------------------------
  3347.   def update_program_se
  3348.     for data in @program_se
  3349.       data[2] -= 1
  3350.       next @program_se.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3351.       next @program_se.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3352.       next if data[2] != 0
  3353.       Audio.se_play("Audio/SE/" + data[7], data[5], data[4])
  3354.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3355.     end  
  3356.   end
  3357.   #--------------------------------------------------------------------------
  3358.   # ● バトルプログラム 周期シェイクの開始
  3359.   #--------------------------------------------------------------------------
  3360.   def start_program_shake(data)
  3361.     data[3] = [data[2], data[3]]
  3362.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3363.     @program_shake.push(data)
  3364.     shake(data[4], data[5], data[6]) if data[7]
  3365.   end
  3366.   #--------------------------------------------------------------------------
  3367.   # ● 周期シェイクの更新
  3368.   #--------------------------------------------------------------------------
  3369.   def update_program_shake
  3370.     for data in @program_shake
  3371.       data[2] -= 1
  3372.       next @program_shake.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3373.       next @program_shake.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3374.       next if data[2] != 0
  3375.       shake(data[4], data[5], data[6])
  3376.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3377.     end  
  3378.   end
  3379.   #--------------------------------------------------------------------------
  3380.   # ● バトルプログラム 周期色調変更の開始
  3381.   #--------------------------------------------------------------------------
  3382.   def start_program_color(data)
  3383.     data[3] = [data[2], data[3]]
  3384.     data[2] = data[3][0] + rand(data[3][1] + 1)
  3385.     data[7] = true if data[4] == 0 or data[4] == 4
  3386.     case data[4]
  3387.     when 1   ;data[4] = $game_troop.members
  3388.     when 2   ;data[4] = $game_party.battle_members
  3389.     when 3,4 ;data[4] = $game_troop.members + $game_party.battle_members
  3390.     else ;data[4] = []
  3391.     end
  3392.     @program_color.push(data)
  3393.     return if !data[6]
  3394.     for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3395.     @color_set[1] = data[5] if data[7]
  3396.     @color_set[2] = data[5] if data[7]
  3397.   end
  3398.   #--------------------------------------------------------------------------
  3399.   # ● 周期色調変更の更新
  3400.   #--------------------------------------------------------------------------
  3401.   def update_program_color
  3402.     for data in @program_color
  3403.       data[2] -= 1
  3404.       next @program_color.delete(data) if data[1] > 0 && !$game_switches[data[1]]
  3405.       next @program_color.delete(data) if data[1] < 0 && !@switches[data[1].abs]
  3406.       next if data[2] != 0
  3407.       for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
  3408.       @color_set[1] = data[5] if data[7]
  3409.       @color_set[2] = data[5] if data[7]
  3410.       data[2] = data[3][0] + rand(data[3][1] + 1)
  3411.     end
  3412.   end
  3413.   #--------------------------------------------------------------------------
  3414.   # ● トランジション実行
  3415.   #--------------------------------------------------------------------------
  3416.   def perform_transition(data)
  3417.     Graphics.transition(data[2], "Graphics/Pictures/" + data[3], data[1])
  3418.   end  
  3419.   #--------------------------------------------------------------------------
  3420.   # ● 背景からカメラの限界値を取得  data = [max_top, max_bottom, max_left, max_right]
  3421.   #--------------------------------------------------------------------------
  3422.   def setting(index, data)
  3423.     @max_data[index - 1] = data
  3424.     return if index != 2
  3425.     setup
  3426.     # カメラの中心座標
  3427.     @center_x     = (Graphics.width / 2 + N03::CAMERA_POSITION[0]) * 100
  3428.     @center_y     = (Graphics.height / 2 + N03::CAMERA_POSITION[1]) * 100
  3429.     # 上下左右の移動限界距離
  3430.     @max_top    = [@max_data[0][5], @max_data[1][5]].min * -1
  3431.     @max_bottom = [@max_data[0][1], @max_data[1][1]].min + @max_top
  3432.     @max_left   = [@max_data[0][4], @max_data[1][4]].min  * -1
  3433.     @max_right  = [@max_data[0][3], @max_data[1][3]].min + @max_left
  3434.     exist_data = @max_data[0] if !@max_data[1][6]
  3435.     exist_data = @max_data[1] if !@max_data[0][6]
  3436.     @max_top    = exist_data[5] * -1        if exist_data != nil
  3437.     @max_bottom = exist_data[1] + @max_top  if exist_data != nil
  3438.     @max_left   = exist_data[4] * -1        if exist_data != nil
  3439.     @max_right  = exist_data[3] + @max_left if exist_data != nil
  3440.     @max_top = @max_bottom = @max_left = @max_right = 0 if !@max_data[1][6] && !@max_data[0][6]
  3441.     @max_width    = @max_right - @max_left + Graphics.width
  3442.     @max_height   = @max_bottom - @max_top + Graphics.height
  3443.     # ズームアウト限界値
  3444.     max_zoom_x    = 100 * Graphics.width / @max_width
  3445.     max_zoom_y    = 100 * Graphics.height / @max_height
  3446.     @max_zoom_out = [max_zoom_x, max_zoom_y].max
  3447.   end
  3448.   #--------------------------------------------------------------------------
  3449.   # ● カメラ移動
  3450.   #--------------------------------------------------------------------------
  3451.   def move(target_x, target_y, zoom, time, screen = true)
  3452.     # 戦闘背景以上のサイズまでズームアウトしないよう調整
  3453.     @target_zoom = [zoom * 0.01, @max_zoom_out * 0.01].max
  3454.     target_x *= -1 if screen && @mirror
  3455.     # ズーム分の中心座標補正
  3456.     if screen && @target_zoom != 1
  3457.       target_x = target_x + @center_x
  3458.       target_y = target_y + @center_y
  3459.     end
  3460.     adjust_x = @center_x * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3461.     adjust_y = @center_y * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
  3462.     adjust_x = 0 if adjust_x.nan?
  3463.     adjust_y = 0 if adjust_y.nan?
  3464.     adjust_x = @center_x if !screen && adjust_x == 0
  3465.     adjust_y = @center_y if !screen && adjust_y == 0
  3466.     @target_x = target_x - adjust_x.to_i
  3467.     @target_y = target_y - adjust_y.to_i
  3468.     @target_zoom = (@target_zoom * 1000).to_i
  3469.     @zoom = @zoom.to_i
  3470.     limit_test
  3471.     # 時間0の場合は即実行
  3472.     return @time = time.abs if time != 0
  3473.     @time = 1
  3474.     update
  3475.   end
  3476.   #--------------------------------------------------------------------------
  3477.   # ● 限界座標の試算
  3478.   #--------------------------------------------------------------------------
  3479.   def limit_test
  3480.     new_width = @max_width * @target_zoom / 1000
  3481.     new_height = @max_height * @target_zoom / 1000
  3482.     new_max_right = @max_right - (@max_width - new_width)
  3483.     new_max_bottom = @max_bottom - (@max_height - new_height)
  3484.     # 画面の移動先が限界の場合、限界座標をセット
  3485.     if @target_x < @max_left * 100
  3486.       @target_x = @max_left * 100
  3487.     end
  3488.     if @target_x > new_max_right * 100
  3489.       @target_x = new_max_right * 100
  3490.     end
  3491.     if @target_y < @max_top * 100
  3492.       @target_y = @max_top * 100
  3493.     end
  3494.     if @target_y > new_max_bottom * 100
  3495.       @target_y = new_max_bottom * 100
  3496.     end
  3497.   end
  3498.   #--------------------------------------------------------------------------
  3499.   # ● 画面のシェイク
  3500.   #--------------------------------------------------------------------------
  3501.   def shake(power, speed, time)
  3502.     @shake_x = power[0] * 100
  3503.     @shake_y = power[1] * 100
  3504.     @power_time_base = @power_time = speed
  3505.     @shake_time = time
  3506.     update_shake
  3507.   end
  3508.   #--------------------------------------------------------------------------
  3509.   # ● シェイクの更新
  3510.   #--------------------------------------------------------------------------
  3511.   def update_shake
  3512.     @sx = (@sx * (@power_time - 1) + @shake_x) / @power_time
  3513.     @sy = (@sy * (@power_time - 1) + @shake_y) / @power_time
  3514.     @power_time -= 1
  3515.     @shake_time -= 1
  3516.     return @sx = @sy = 0 if @shake_time == 0
  3517.     return if @power_time != 0
  3518.     @power_time = @power_time_base
  3519.     @shake_x = @shake_x * -4 / 5
  3520.     @shake_y = @shake_y * -4 / 5
  3521.   end
  3522.   #--------------------------------------------------------------------------
  3523.   # ● フレーム更新
  3524.   #--------------------------------------------------------------------------
  3525.   def update
  3526.     update_shake if @shake_time != 0
  3527.     update_program
  3528.     return if @time == 0
  3529.     @x = (@x * (@time - 1) + @target_x) / @time
  3530.     @y = (@y * (@time - 1) + @target_y) / @time
  3531.     @zoom = (@zoom * (@time - 1) + @target_zoom) / @time
  3532.     @time -= 1
  3533.   end
  3534.   #--------------------------------------------------------------------------
  3535.   # ● フレーム更新
  3536.   #--------------------------------------------------------------------------
  3537.   def update_program
  3538.     update_program_switch if @program_switch != []
  3539.     update_program_se     if @program_se != []
  3540.     update_program_shake  if @program_shake != []
  3541.     update_program_color  if @program_color != []
  3542.   end
  3543. end
  3544.  
  3545. #==============================================================================
  3546. # ■ Scene_Battle
  3547. #------------------------------------------------------------------------------
  3548. #  バトル画面の処理を行うクラスです。
  3549. #==============================================================================
  3550. class Scene_Battle < Scene_Base
  3551.   #--------------------------------------------------------------------------
  3552.   # ● フレーム更新(基本)
  3553.   #--------------------------------------------------------------------------
  3554.   alias update_basic_scene_battle_n03 update_basic
  3555.   def update_basic
  3556.     update_basic_scene_battle_n03
  3557.     $sv_camera.update
  3558.     $sv_camera.wait = N03::TURN_END_WAIT + 1 if $sv_camera.win_wait
  3559.     camera_wait
  3560.   end
  3561.   #--------------------------------------------------------------------------
  3562.   # ● カメラウェイト
  3563.   #--------------------------------------------------------------------------
  3564.   def camera_wait
  3565.     process_event if $sv_camera.event
  3566.     $sv_camera.event = false if $sv_camera.event
  3567.     while $sv_camera.wait != 0
  3568.       Graphics.update
  3569.       Input.update
  3570.       update_all_windows
  3571.       $game_timer.update
  3572.       $game_troop.update
  3573.       $sv_camera.update
  3574.       @spriteset.update
  3575.       update_info_viewport
  3576.       update_message_open
  3577.       $sv_camera.wait -= 1 if $sv_camera.wait > 0
  3578.       $sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
  3579.       BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
  3580.     end
  3581.   end
  3582.   #--------------------------------------------------------------------------
  3583.   # ● カメラウェイトのセット
  3584.   #--------------------------------------------------------------------------
  3585.   def set_camera_wait(time)
  3586.     $sv_camera.wait = time
  3587.     camera_wait
  3588.   end  
  3589.   #--------------------------------------------------------------------------
  3590.   # ● エフェクト実行が終わるまでウェイト ★再定義
  3591.   #--------------------------------------------------------------------------
  3592.   def wait_for_effect
  3593.   end
  3594.   #--------------------------------------------------------------------------
  3595.   # ● ターン開始
  3596.   #--------------------------------------------------------------------------
  3597.   alias turn_start_scene_battle_n03 turn_start
  3598.   def turn_start
  3599.     turn_start_scene_battle_n03
  3600.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始後"].dup)
  3601.   end
  3602.   #--------------------------------------------------------------------------
  3603.   # ● ターン終了
  3604.   #--------------------------------------------------------------------------
  3605.   alias turn_end_scene_battle_n03 turn_end
  3606.   def turn_end
  3607.     turn_end_scene_battle_n03
  3608.     for member in $game_troop.members + $game_party.members
  3609.       N03.set_damage(member, member.sv.result_damage[0],member.sv.result_damage[1])
  3610.       member.sv.result_damage = [0,0]
  3611.       @spriteset.set_damage_pop(member) if member.result.hp_damage != 0 or member.result.mp_damage != 0
  3612.     end
  3613.     set_camera_wait(N03::TURN_END_WAIT)
  3614.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup) if $game_party.inputable?
  3615.     @log_window.clear
  3616.   end
  3617.   #--------------------------------------------------------------------------
  3618.   # ● スキル/アイテムの使用 ★再定義
  3619.   #--------------------------------------------------------------------------
  3620.   def use_item
  3621.     item = @subject.current_action.item
  3622.     display_item(item)
  3623.     @subject.use_item(item)
  3624.     refresh_status
  3625.     @targets = @subject.current_action.make_targets.compact
  3626.     @targets = [@subject] if @targets.size == 0
  3627.     set_substitute(item)
  3628.     for time in item.repeats.times do play_sideview(@targets, item) end
  3629.     end_reaction(item)
  3630.     display_end_item
  3631.   end
  3632.   #--------------------------------------------------------------------------
  3633.   # ● スキル/アイテム名の表示
  3634.   #--------------------------------------------------------------------------
  3635.   def display_item(item)
  3636.     return @log_window.display_use_item(@subject, item) if N03::BATTLE_LOG
  3637.     @log_window.off
  3638.     @skill_name_window = Window_Skill_name.new(item.name) unless N03::NO_DISPLAY_SKILL_ID.include?(item.id) && item.is_a?(RPG::Skill)
  3639.   end  
  3640.   #--------------------------------------------------------------------------
  3641.   # ● スキル/アイテム名の表示終了
  3642.   #--------------------------------------------------------------------------
  3643.   def display_end_item
  3644.     @skill_name_window.dispose if @skill_name_window != nil
  3645.     @skill_name_window = nil
  3646.     set_camera_wait(N03::ACTION_END_WAIT) if @subject.sv.derivation_skill_id == 0
  3647.     @log_window.clear if N03::BATTLE_LOG
  3648.   end  
  3649.   #--------------------------------------------------------------------------
  3650.   # ● 反撃/魔法反射/身代わり処理
  3651.   #--------------------------------------------------------------------------
  3652.   def end_reaction(item)
  3653.     end_substitute if @substitute != nil
  3654.     set_reflection(item) if @reflection_data != nil
  3655.     set_counter_attack if @counter_attacker != nil
  3656.   end  
  3657.   #--------------------------------------------------------------------------
  3658.   # ● 反撃の発動 ★再定義
  3659.   #--------------------------------------------------------------------------
  3660.   def invoke_counter_attack(target, item)
  3661.     return if @subject.sv.counter_id != 0
  3662.     @counter_attacker = [] if @counter_attacker == nil
  3663.     return apply_item_effects(apply_substitute(target, item), item) if !target.movable?
  3664.     @log_window.add_text(sprintf(Vocab::CounterAttack, target.name)) if N03::BATTLE_LOG
  3665.     target.sv.counter_id = target.sv.counter_skill_id
  3666.     @counter_attacker.push(target)
  3667.   end
  3668.   #--------------------------------------------------------------------------
  3669.   # ● 魔法反射の発動 ★再定義
  3670.   #--------------------------------------------------------------------------
  3671.   def invoke_magic_reflection(target, item)
  3672.     return if @subject.sv.reflection_id != 0
  3673.     @log_window.add_text(sprintf(Vocab::MagicReflection, target.name)) if N03::BATTLE_LOG
  3674.     target.sv.reflection_id = target.sv.reflection_anime_id
  3675.   end
  3676.   #--------------------------------------------------------------------------
  3677.   # ● 身代わりの適用 ★再定義
  3678.   #--------------------------------------------------------------------------
  3679.   def apply_substitute(target, item)
  3680.     return target if @substitute == nil
  3681.     return target if !check_substitute(target, item)
  3682.     return @substitute
  3683.   end
  3684.   #--------------------------------------------------------------------------
  3685.   # ● 身代わりセット
  3686.   #--------------------------------------------------------------------------
  3687.   def set_substitute(item)
  3688.     @substitute = N03.get_enemy_unit(@subject).substitute_battler
  3689.     return if @substitute == nil
  3690.     s_targets = []
  3691.     for i in [email protected]
  3692.       next if @targets[i] == @substitute
  3693.       next if !check_substitute(@targets[i], item)
  3694.       @log_window.add_text(sprintf(Vocab::Substitute, @substitute.name, @targets[i].name))
  3695.       @targets[i].sv.start_action(@targets[i].sv.substitute_receiver_start_action)
  3696.       s_targets.push(@targets[i])
  3697.       @targets[i] = @substitute
  3698.     end
  3699.     return @substitute = nil if s_targets == []
  3700.     @substitute.sv.set_target(s_targets)
  3701.     @substitute.sv.start_action(@substitute.sv.substitute_start_action)
  3702.   end  
  3703.   #--------------------------------------------------------------------------
  3704.   # ● 身代わり終了
  3705.   #--------------------------------------------------------------------------
  3706.   def end_substitute
  3707.     for member in @substitute.sv.target_battler
  3708.       member.sv.start_action(member.sv.substitute_receiver_end_action)
  3709.     end  
  3710.     @substitute.sv.start_action(@substitute.sv.substitute_end_action)
  3711.     @substitute = nil
  3712.   end
  3713.   #--------------------------------------------------------------------------
  3714.   # ● 反撃
  3715.   #--------------------------------------------------------------------------
  3716.   def set_counter_attack
  3717.     pre_subject = @subject
  3718.     for attacker in @counter_attacker
  3719.       @subject = attacker
  3720.       item = $data_skills[attacker.sv.counter_skill_id]
  3721.       play_sideview([pre_subject], item)
  3722.     end
  3723.     # 同一カウンター者を考慮してカウンターIDの初期化はアクション後に実行
  3724.     for attacker in @counter_attacker do attacker.sv.counter_id = 0 end
  3725.     @subject = pre_subject
  3726.     @counter_attacker = nil
  3727.   end
  3728.   #--------------------------------------------------------------------------
  3729.   # ● 魔法反射
  3730.   #--------------------------------------------------------------------------
  3731.   def set_reflection(item)
  3732.     @log_window.back_to(1)
  3733.     for data in @reflection_data
  3734.       @subject.sv.damage_action(@subject, item)
  3735.       N03.set_damage_anime_data([@subject], @subject, data)
  3736.       apply_item_effects(@subject, item)
  3737.       @spriteset.set_damage_pop(@subject)
  3738.     end
  3739.     set_camera_wait(N03.get_anime_time(@reflection_data[0][0]))
  3740.     @reflection_data = nil
  3741.   end
  3742.   #--------------------------------------------------------------------------
  3743.   # ● サイドビューアクション実行
  3744.   #--------------------------------------------------------------------------
  3745.   def play_sideview(targets, item)
  3746.     @subject.sv.set_target(targets)
  3747.     return if @subject.sv.attack_action(item) == nil
  3748.     return if [email protected]?
  3749.     return if item.scope != 9 && item.scope != 10 && !N03.targets_alive?(targets)
  3750.     @subject.sv.start_action(@subject.sv.attack_action(item))
  3751.     @subject.sv.unshift_action(@subject.sv.flash_action) if @subject.flash_flg
  3752.     @subject.sv.active = true
  3753.     @subject.sv.command_action = false
  3754.     loop do
  3755.       update_basic
  3756.       data = @subject.sv.play_data
  3757.       @targets = N03.s_targets(@subject) if data[0] == "second_targets_set"
  3758.       N03.targets_set(@subject)          if data[0] == "targets_set"
  3759.       @immortal = N03.immortaling        if data[0] == "no_collapse" && !N03.dead_attack?(@subject, item)
  3760.       @immortal = N03.unimmortaling      if data[0] == "collapse"
  3761.       next set_move_anime(item)          if @subject.sv.m_a_data != []
  3762.       set_damage(item)                   if @subject.sv.set_damage
  3763.       break N03.derived_skill(@subject)  if @subject.sv.derivation_skill_id != 0
  3764.       break                              if @subject.sv.action_end or @subject.hidden?
  3765.     end
  3766.     @immortal = N03.unimmortaling        if @immortal
  3767.   end
  3768.   #--------------------------------------------------------------------------
  3769.   # ● ダメージの実行
  3770.   #--------------------------------------------------------------------------
  3771.   def set_damage(item)
  3772.     targets = @targets
  3773.     targets = [@subject.sv.individual_targets[0]] if @subject.sv.individual_targets.size != 0
  3774.     for target in targets do damage_anime(targets.dup, target, item) end
  3775.     @subject.sv.set_damage = false
  3776.     @subject.sv.damage_anime_data = []
  3777.   end
  3778.   #--------------------------------------------------------------------------
  3779.   # ● ダメージ戦闘アニメ処理
  3780.   #--------------------------------------------------------------------------
  3781.   def damage_anime(targets, target, item)
  3782.     @log_window.back_to(1) if @log_window.line_number == 5
  3783.     return if item.scope != 9 && item.scope != 10 && target.dead?
  3784.     @miss = false
  3785.     invoke_item(target,item)
  3786.     if target.result.missed
  3787.       target.sv.miss_action(@subject, item)
  3788.       return @miss = true
  3789.     elsif target.result.evaded or target.sv.counter_id != 0
  3790.       target.sv.evasion_action(@subject, item)
  3791.       return @miss = true
  3792.     elsif target.sv.reflection_id != 0
  3793.       N03.set_damage_anime_data(targets, target, [target.sv.reflection_id, false, false, true])
  3794.       target.sv.reflection_id = 0
  3795.       @reflection_data = [] if @reflection_data == nil
  3796.       return @reflection_data.push([N03.get_attack_anime_id(-3, @subject), false, false, true])
  3797.     end
  3798.     target.sv.damage_action(@subject, item)
  3799.     N03.set_damage(@subject, -target.result.hp_drain, -target.result.mp_drain) if target != @subject
  3800.     @spriteset.set_damage_pop(target)
  3801.     @spriteset.set_damage_pop(@subject) if target != @subject && @subject.result.hp_damage != 0 or @subject.result.mp_damage != 0
  3802.     N03.set_damage_anime_data(targets, target, @subject.sv.damage_anime_data) if @subject.sv.damage_anime_data != []
  3803.   end
  3804.   #--------------------------------------------------------------------------
  3805.   # ● 飛ばしアニメ処理
  3806.   #--------------------------------------------------------------------------
  3807.   def set_move_anime(item)
  3808.     for data in @subject.sv.m_a_data
  3809.       @subject.sv.damage_anime_data = data[4]
  3810.       hit_targets = []
  3811.       for target in data[1]
  3812.         damage_anime(data[1], target, item) if data[0]
  3813.         hit_targets.push(target) if !@miss
  3814.       end
  3815.       @miss = false if !data[3]
  3816.       @spriteset.set_hit_animation(@subject, data[2], hit_targets, @miss)
  3817.     end
  3818.     @subject.sv.set_damage = false
  3819.     @subject.sv.m_a_data = []
  3820.   end
  3821. end
  3822.  
  3823. #==============================================================================
  3824. # ■ DataManager
  3825. #------------------------------------------------------------------------------
  3826. #  データベースとゲームオブジェクトを管理するモジュールです。
  3827. #==============================================================================
  3828. module DataManager
  3829.   #--------------------------------------------------------------------------
  3830.   # ● 各種ゲームオブジェクトの作成 ★再定義
  3831.   #--------------------------------------------------------------------------
  3832.   def self.create_game_objects
  3833.     $game_temp          = Game_Temp.new
  3834.     $game_system        = Game_System.new
  3835.     $game_timer         = Game_Timer.new
  3836.     $game_message       = Game_Message.new
  3837.     $game_switches      = Game_Switches.new
  3838.     $game_variables     = Game_Variables.new
  3839.     $game_self_switches = Game_SelfSwitches.new
  3840.     $game_actors        = Game_Actors.new
  3841.     $game_party         = Game_Party.new
  3842.     $game_troop         = Game_Troop.new
  3843.     $game_map           = Game_Map.new
  3844.     $game_player        = Game_Player.new
  3845.     $sv_camera          = Battle_Camera.new
  3846.   end
  3847. end
  3848.  
  3849. #==============================================================================
  3850. # ■ BattleManager
  3851. #------------------------------------------------------------------------------
  3852. #  戦闘の進行を管理するモジュールです。
  3853. #==============================================================================
  3854. module BattleManager
  3855.   #--------------------------------------------------------------------------
  3856.   # ● エンカウント時の処理 ★再定義
  3857.   #--------------------------------------------------------------------------
  3858.   def self.on_encounter
  3859.     @preemptive = (rand < rate_preemptive)
  3860.     @surprise = (rand < rate_surprise && !@preemptive)
  3861.     $sv_camera.mirror = @surprise if N03::BACK_ATTACK
  3862.   end
  3863.   #--------------------------------------------------------------------------
  3864.   # ● 勝利の処理 ★再定義
  3865.   #--------------------------------------------------------------------------
  3866.   def self.process_victory
  3867.     $sv_camera.win_wait = true
  3868.   end  
  3869.   #--------------------------------------------------------------------------
  3870.   # ● 勝利
  3871.   #--------------------------------------------------------------------------
  3872.   def self.victory
  3873.     $sv_camera.win_wait = false
  3874.     N03.camera(nil, N03::BATTLE_CAMERA["戦闘終了時"].dup)
  3875.     for member in $game_party.members do member.sv.start_action(member.sv.win) if member.movable? end
  3876.     play_battle_end_me
  3877.     replay_bgm_and_bgs
  3878.     $game_message.add(sprintf(Vocab::Victory, $game_party.name))
  3879.     display_exp
  3880.     gain_gold
  3881.     gain_drop_items
  3882.     gain_exp
  3883.     SceneManager.return
  3884.     battle_end(0)
  3885.     return true
  3886.   end
  3887.   #--------------------------------------------------------------------------
  3888.   # ● 逃走の処理 ★再定義
  3889.   #--------------------------------------------------------------------------
  3890.   def self.process_escape
  3891.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  3892.     success = @preemptive ? true : (rand < @escape_ratio)
  3893.     Sound.play_escape
  3894.     if success
  3895.       process_abort
  3896.       for member in $game_party.members do member.sv.start_action(member.sv.escape) if member.movable? end
  3897.     else
  3898.       @escape_ratio += 0.1
  3899.       $game_message.add('\.' + Vocab::EscapeFailure)
  3900.       $game_party.clear_actions
  3901.       for member in $game_party.members do member.sv.start_action(member.sv.escape_ng) if member.movable? end
  3902.     end
  3903.     wait_for_message
  3904.     return success
  3905.   end
  3906.   #--------------------------------------------------------------------------
  3907.   # ● 次のコマンド入力へ ★再定義
  3908.   #--------------------------------------------------------------------------
  3909.   def self.next_command
  3910.     begin
  3911.       if !actor || !actor.next_command
  3912.         $game_party.battle_members[@actor_index].sv.command_action = true
  3913.         @actor_index += 1
  3914.         if @actor_index >= $game_party.members.size
  3915.           for member in $game_party.battle_members.reverse
  3916.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3917.           end
  3918.           return false
  3919.         end
  3920.       end
  3921.     end until actor.inputable?
  3922.     actor.sv.start_action(actor.sv.command_b) if actor != nil && actor.inputable?
  3923.     if pre_actor
  3924.       pre_actor.sv.start_action(pre_actor.sv.command_a) if pre_actor != nil && pre_actor.inputable?
  3925.     end
  3926.     return true
  3927.   end
  3928.   #--------------------------------------------------------------------------
  3929.   # ● 前のコマンド入力へ ★再定義
  3930.   #--------------------------------------------------------------------------
  3931.   def self.prior_command
  3932.     begin
  3933.       if !actor || !actor.prior_command
  3934.         $game_party.battle_members[@actor_index].sv.command_action = false
  3935.         @actor_index -= 1
  3936.         if @actor_index < 0
  3937.           for member in $game_party.battle_members
  3938.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3939.           end
  3940.           return false
  3941.         end
  3942.       end
  3943.     end until actor.inputable?
  3944.     actor.make_actions if actor.inputable?
  3945.     actor.sv.start_action(actor.sv.command_b) if actor.inputable?
  3946.     after_actor.sv.start_action(after_actor.sv.command_a) if after_actor != nil && after_actor.inputable?
  3947.     return true
  3948.   end
  3949.   #--------------------------------------------------------------------------
  3950.   # ● コマンド入力前のアクターを取得
  3951.   #--------------------------------------------------------------------------
  3952.   def self.pre_actor
  3953.     return if @actor_index == 0
  3954.     $game_party.members[@actor_index - 1]
  3955.   end
  3956.   #--------------------------------------------------------------------------
  3957.   # ● コマンド入力後のアクターを取得
  3958.   #--------------------------------------------------------------------------
  3959.   def self.after_actor
  3960.     $game_party.members[@actor_index + 1]
  3961.   end
  3962.   #--------------------------------------------------------------------------
  3963.   # ● 戦闘行動者を前に追加
  3964.   #--------------------------------------------------------------------------
  3965.   def self.unshift_action_battlers(battler)
  3966.     @action_battlers.unshift(battler)
  3967.   end
  3968. end  
  3969.  
  3970. #==============================================================================
  3971. # ■ Game_Battler
  3972. #------------------------------------------------------------------------------
  3973. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。
  3974. #==============================================================================
  3975. class Game_Battler < Game_BattlerBase
  3976.   #--------------------------------------------------------------------------
  3977.   # ● 公開インスタンス変数
  3978.   #--------------------------------------------------------------------------
  3979.   attr_reader   :sv                     # サイドビューデータ
  3980.   attr_accessor :flash_flg              # 閃きフラグ
  3981.   #--------------------------------------------------------------------------
  3982.   # ● オブジェクト初期化
  3983.   #--------------------------------------------------------------------------
  3984.   alias initialize_game_battler_n03 initialize
  3985.   def initialize
  3986.     initialize_game_battler_n03
  3987.     @sv = SideView.new(self)
  3988.   end
  3989.   #--------------------------------------------------------------------------
  3990.   # ● 現在の戦闘行動を除去
  3991.   #--------------------------------------------------------------------------
  3992.   alias remove_current_action_game_battler_n03 remove_current_action
  3993.   def remove_current_action
  3994.     return @sv.derivation_skill_id = 0 if @sv.derivation_skill_id != 0
  3995.     remove_current_action_game_battler_n03
  3996.   end
  3997.   #--------------------------------------------------------------------------
  3998.   # ● ターン終了処理
  3999.   #--------------------------------------------------------------------------
  4000.   alias on_turn_end_game_battler_n03 on_turn_end
  4001.   def on_turn_end
  4002.     on_turn_end_game_battler_n03
  4003.     @sv.add_state = []
  4004.     @sv.result_damage = [@result.hp_damage, @result.mp_damage]
  4005.   end
  4006.   #--------------------------------------------------------------------------
  4007.   # ● パラメータ条件比較 data = [種別, 数値, 判別]
  4008.   #--------------------------------------------------------------------------
  4009.   def comparison_parameter(data)
  4010.     return true if data[0][0] == 0
  4011.     kind = data[0]
  4012.     num = data[1]
  4013.     select = data[2]
  4014.     case kind
  4015.     when  1 ; par = level
  4016.     when  2 ; par = mhp
  4017.     when  3 ; par = mmp
  4018.     when  4 ; par = hp
  4019.     when  5 ; par = mp
  4020.     when  6 ; par = tp
  4021.     when  7 ; par = atk
  4022.     when  8 ; par = self.def
  4023.     when  9 ; par = mat
  4024.     when 10 ; par = mdf
  4025.     when 11 ; par = agi
  4026.     when 12 ; par = luk
  4027.     end
  4028.     if num < 0
  4029.       case kind
  4030.       when  4 ; num = mhp * num / 100
  4031.       when  5 ; num = mmp * num / 100
  4032.       when  6 ; num = max_tp * num / 100
  4033.       end
  4034.       num = num.abs
  4035.     end  
  4036.     case select
  4037.     when  0 ; return par == num
  4038.     when  1 ; return par < num
  4039.     when  2 ; return par > num
  4040.     end
  4041.   end
  4042.   #--------------------------------------------------------------------------
  4043.   # ● 装備条件比較 data = [装備種別, タイプID]
  4044.   #--------------------------------------------------------------------------
  4045.   def comparison_equip(data)
  4046.     kind = data[0]
  4047.     items = weapons if kind == 0
  4048.     items = armors  if kind == 1
  4049.     for item in items
  4050.       for id in data[1]
  4051.         return true if id > 0 && item.is_a?(RPG::Weapon) && item == $data_weapons[id.abs]
  4052.         return true if id > 0 && item.is_a?(RPG::Armor) && item == $data_armors[id.abs]
  4053.         return true if id < 0 && item.is_a?(RPG::Weapon) && item.wtype_id == id.abs
  4054.         return true if id < 0 && item.is_a?(RPG::Armor) && item.stype_id == id.abs
  4055.       end
  4056.     end
  4057.     return false
  4058.   end
  4059.  
  4060. end  
  4061. #==============================================================================
  4062. # ■ Game_Actor
  4063. #------------------------------------------------------------------------------
  4064. #  アクターを扱うクラスです。
  4065. #==============================================================================
  4066. class Game_Actor < Game_Battler
  4067.   #--------------------------------------------------------------------------
  4068.   # ● 公開インスタンス変数
  4069.   #--------------------------------------------------------------------------
  4070.   attr_reader :actor_id                    # ID
  4071.   #--------------------------------------------------------------------------
  4072.   # ● ID
  4073.   #--------------------------------------------------------------------------
  4074.   def id
  4075.     return @actor_id
  4076.   end
  4077.   #--------------------------------------------------------------------------
  4078.   # ● スプライトを使うか? ★再定義
  4079.   #--------------------------------------------------------------------------
  4080.   def use_sprite?
  4081.     return true
  4082.   end
  4083.   #--------------------------------------------------------------------------
  4084.   # ● ダメージ効果の実行 ★再定義
  4085.   #--------------------------------------------------------------------------
  4086.   def perform_damage_effect
  4087.     return if !N03::ACTOR_DAMAGE
  4088.     $game_troop.screen.start_shake(5, 5, 10)
  4089.     @sprite_effect_type = :blink
  4090.     Sound.play_actor_damage
  4091.   end
  4092.  
  4093. end
  4094.  
  4095. #==============================================================================
  4096. # ■ Game_Enemy
  4097. #------------------------------------------------------------------------------
  4098. #  敵キャラを扱うクラスです。
  4099. #==============================================================================
  4100. class Game_Enemy < Game_Battler
  4101.   #--------------------------------------------------------------------------
  4102.   # ● 公開インスタンス変数
  4103.   #--------------------------------------------------------------------------
  4104.   attr_reader :enemy_id                    # ID
  4105.   #--------------------------------------------------------------------------
  4106.   # ● ID
  4107.   #--------------------------------------------------------------------------
  4108.   def id
  4109.     return @enemy_id
  4110.   end
  4111.   #--------------------------------------------------------------------------
  4112.   # ● レベル
  4113.   #--------------------------------------------------------------------------
  4114.   def level
  4115.     return @sv.level
  4116.   end
  4117.   #--------------------------------------------------------------------------
  4118.   # ● ダメージ効果の実行 ★再定義
  4119.   #--------------------------------------------------------------------------
  4120.   def perform_damage_effect
  4121.     return if !N03::ENEMY_DAMAGE
  4122.     @sprite_effect_type = :blink
  4123.     Sound.play_enemy_damage
  4124.   end
  4125.   #--------------------------------------------------------------------------
  4126.   # ● 武器
  4127.   #--------------------------------------------------------------------------
  4128.   def weapons
  4129.     weapon1 = $data_weapons[@sv.enemy_weapon1_id]
  4130.     weapon2 = $data_weapons[@sv.enemy_weapon2_id]
  4131.     return [weapon1, weapon2]
  4132.   end
  4133.   #--------------------------------------------------------------------------
  4134.   # ● 防具
  4135.   #--------------------------------------------------------------------------
  4136.   def armors
  4137.     return [$data_armors[@sv.enemy_shield_id]]
  4138.   end
  4139.   #--------------------------------------------------------------------------
  4140.   # ● 二刀流の判定
  4141.   #--------------------------------------------------------------------------
  4142.   def dual_wield?
  4143.     return $data_weapons[@sv.enemy_weapon2_id] != nil
  4144.   end
  4145.   #--------------------------------------------------------------------------
  4146.   # ● バトラー画像変更
  4147.   #--------------------------------------------------------------------------
  4148.   def graphics_change(battler_name)
  4149.     @battler_name = battler_name
  4150.   end
  4151.   #--------------------------------------------------------------------------
  4152.   # ● 通常攻撃 アニメーション ID の取得
  4153.   #--------------------------------------------------------------------------
  4154.   def atk_animation_id1
  4155.     return weapons[0].animation_id if weapons[0]
  4156.     return weapons[1] ? 0 : 1
  4157.   end
  4158.   #--------------------------------------------------------------------------
  4159.   # ● 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  4160.   #--------------------------------------------------------------------------
  4161.   def atk_animation_id2
  4162.     return weapons[1] ? weapons[1].animation_id : 0
  4163.   end
  4164. end
  4165.  
  4166. #==============================================================================
  4167. # ■ Sprite_Base
  4168. #------------------------------------------------------------------------------
  4169. #  アニメーションの表示処理を追加したスプライトのクラスです。
  4170. #==============================================================================
  4171. class Sprite_Base < Sprite
  4172.   #--------------------------------------------------------------------------
  4173.   # ● アニメーションの座標更新 (ホーミングあり)
  4174.   #--------------------------------------------------------------------------
  4175.   def update_animation_position_horming
  4176.     return if @action_end_cancel
  4177.     ani_ox_set if @horming
  4178.     camera_zoom = $sv_camera.zoom
  4179.     camera_zoom = 1 if @move_anime
  4180.     kind = 1
  4181.     kind = -1 if @ani_mirror && !@anime_no_mirror
  4182.     cell_data = @animation.frames[@animation.frame_max - (@ani_duration + @ani_rate - 1) / @ani_rate].cell_data
  4183.     for i in 0..15
  4184.       @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
  4185.       @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
  4186.     end
  4187.   end
  4188.   #--------------------------------------------------------------------------
  4189.   # ● アニメーション元の座標をセット
  4190.   #--------------------------------------------------------------------------
  4191.   def ani_ox_set
  4192.     if !SceneManager.scene_is?(Scene_Battle)
  4193.       @real_x = x
  4194.       @real_y = y
  4195.     end
  4196.     @ani_ox = @real_x - ox + width / 2
  4197.     @ani_oy = @real_y - oy + height / 2
  4198.     @ani_oy -= height / 2 if @animation.position == 0
  4199.     @ani_oy += height / 2 if @animation.position == 2
  4200.   end
  4201.   #--------------------------------------------------------------------------
  4202.   # ● アニメーションの更新
  4203.   #--------------------------------------------------------------------------
  4204.   alias update_animation_sprite_base_n03 update_animation
  4205.   def update_animation
  4206.     update_animation_position_horming if animation? && SceneManager.scene_is?(Scene_Battle) && @animation.position != 3
  4207.     update_animation_sprite_base_n03
  4208.   end
  4209.   #--------------------------------------------------------------------------
  4210.   # ● アニメーションの原点設定 ★再定義
  4211.   #--------------------------------------------------------------------------
  4212.   def set_animation_origin
  4213.     return ani_ox_set if @animation.position != 3
  4214.     if viewport == nil
  4215.       @ani_ox = Graphics.width / 2
  4216.       @ani_oy = Graphics.height / 2
  4217.     else
  4218.       @ani_ox = viewport.rect.width / 2
  4219.       @ani_oy = viewport.rect.height / 2
  4220.     end
  4221.   end
  4222.   #--------------------------------------------------------------------------
  4223.   # ● アニメーションスプライトの設定 ★再定義
  4224.   #--------------------------------------------------------------------------
  4225.   def animation_set_sprites(frame)
  4226.     camera_zoom = 1
  4227.     camera_zoom = $sv_camera.zoom if @anime_camera_zoom && @animation.position != 3 && SceneManager.scene_is?(Scene_Battle)
  4228.     camera_x = $sv_camera.x
  4229.     camera_y = $sv_camera.y
  4230.     camera_x = camera_y = 0 if @animation.position == 3 or !SceneManager.scene_is?(Scene_Battle)
  4231.     plus_z = 5
  4232.     plus_z = 1000 if @animation.position == 3
  4233.     plus_z = -17 if @plus_z != nil && @plus_z == false
  4234.     plus_z = -self.z + 10 if @plus_z != nil && @plus_z == false && @animation.position == 3
  4235.     cell_data = frame.cell_data
  4236.     @ani_sprites.each_with_index do |sprite, i|
  4237.       next unless sprite
  4238.       pattern = cell_data[i, 0]
  4239.       if !pattern || pattern < 0
  4240.         sprite.visible = false
  4241.         next
  4242.       end
  4243.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  4244.       sprite.visible = true
  4245.       sprite.src_rect.set(pattern % 5 * 192,
  4246.         pattern % 100 / 5 * 192, 192, 192)
  4247.       if @ani_mirror && !@anime_no_mirror
  4248.         sprite.x = (@ani_ox - cell_data[i, 1] - camera_x) * camera_zoom
  4249.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4250.         sprite.angle = (360 - cell_data[i, 4])
  4251.         sprite.mirror = (cell_data[i, 5] == 0)
  4252.       else
  4253.         sprite.x = (@ani_ox + cell_data[i, 1] - camera_x) * camera_zoom
  4254.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4255.         sprite.angle = cell_data[i, 4]
  4256.         sprite.mirror = (cell_data[i, 5] == 1)
  4257.       end
  4258.       sprite.z = self.z + plus_z + i
  4259.       sprite.ox = 96
  4260.       sprite.oy = 96
  4261.       sprite.zoom_x = cell_data[i, 3] * camera_zoom / 100.0
  4262.       sprite.zoom_y = cell_data[i, 3] * camera_zoom/ 100.0
  4263.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4264.       sprite.blend_type = cell_data[i, 7]
  4265.     end
  4266.   end
  4267.   #--------------------------------------------------------------------------
  4268.   # ● 子スプライトフラグ
  4269.   #--------------------------------------------------------------------------
  4270.   def set(battler, horming, camera_zoom, no_mirror)
  4271.     @battler = battler
  4272.     @next = true
  4273.     self.bitmap = Bitmap.new(@battler.sv.cw, @battler.sv.ch)
  4274.     self.ox = bitmap.width / 2
  4275.     self.oy = bitmap.height
  4276.     @horming = horming
  4277.     @anime_camera_zoom = camera_zoom
  4278.     @anime_no_mirror = no_mirror
  4279.     @battler.sv.reset_anime_data
  4280.   end  
  4281.   #--------------------------------------------------------------------------
  4282.   # ● 子スプライト座標セット
  4283.   #--------------------------------------------------------------------------
  4284.   def set_position(z, zoom_x, zoom_y, real_x, real_y)
  4285.     self.z = z
  4286.     self.zoom_x = zoom_x
  4287.     self.zoom_y = zoom_y
  4288.     @real_x = real_x
  4289.     @real_y = real_y
  4290.   end
  4291.   #--------------------------------------------------------------------------
  4292.   # ● 他スプライトへのタイミング処理
  4293.   #--------------------------------------------------------------------------
  4294.   def other_process_timing(timing)
  4295.     se_flag = true
  4296.     se_flag = @se_flag if @se_flag != nil
  4297.     @battler.sv.timing.push([se_flag, timing.dup])
  4298.   end
  4299.   #--------------------------------------------------------------------------
  4300.   # ● 他バトラーへのタイミング処理
  4301.   #--------------------------------------------------------------------------
  4302.   def target_battler_process_timing(timing)
  4303.     for target in @timing_targets
  4304.       target.sv.timing.push([false, timing.dup])
  4305.     end  
  4306.   end
  4307.   #--------------------------------------------------------------------------
  4308.   # ● SE とフラッシュのタイミング処理
  4309.   #--------------------------------------------------------------------------
  4310.   alias animation_process_timing_sprite_base_n03 animation_process_timing
  4311.   def animation_process_timing(timing)
  4312.     target_battler_process_timing(timing) if @timing_targets && @timing_targets != []
  4313.     return other_process_timing(timing) if @next != nil
  4314.     animation_process_timing_sprite_base_n03(timing)
  4315.   end
  4316.   #--------------------------------------------------------------------------
  4317.   # ● アニメーションの解放
  4318.   #--------------------------------------------------------------------------
  4319.   alias dispose_animation_sprite_base_n03 dispose_animation
  4320.   def dispose_animation
  4321.     dispose_animation_sprite_base_n03
  4322.   end
  4323. end
  4324.  
  4325.  
  4326. #==============================================================================
  4327. # ■ Sprite_Battler
  4328. #------------------------------------------------------------------------------
  4329. #  バトラー表示用のスプライトです。
  4330. #==============================================================================
  4331. class Sprite_Battler < Sprite_Base
  4332.   #--------------------------------------------------------------------------
  4333.   # ● 公開インスタンス変数 
  4334.   #--------------------------------------------------------------------------
  4335.   attr_accessor   :removing             # パーティ離脱中
  4336.   #--------------------------------------------------------------------------
  4337.   # ● オブジェクト初期化
  4338.   #--------------------------------------------------------------------------
  4339.   alias initialize_sprite_battler_n03 initialize
  4340.   def initialize(viewport, battler = nil)
  4341.     initialize_sprite_battler_n03(viewport, battler)
  4342.     @real_x = @real_y = 0
  4343.     update_bitmap if @battler != nil
  4344.   end
  4345.   #--------------------------------------------------------------------------
  4346.   # ● アニメーションの開始 ★再定義
  4347.   #--------------------------------------------------------------------------
  4348.   def start_animation(animation, mirror = false)
  4349.     return next_animation(animation, mirror) if animation?
  4350.     @animation = animation
  4351.     if @animation
  4352.       @horming = @battler.sv.anime_horming
  4353.       @anime_camera_zoom = @battler.sv.anime_camera_zoom
  4354.       @anime_no_mirror = @battler.sv.anime_no_mirror
  4355.       @timing_targets = @battler.sv.timing_targets
  4356.       @plus_z = @battler.sv.anime_plus_z
  4357.       @battler.sv.reset_anime_data
  4358.       @ani_mirror = mirror
  4359.       set_animation_rate
  4360.       @ani_duration = @animation.frame_max * @ani_rate + 1
  4361.       load_animation_bitmap
  4362.       make_animation_sprites
  4363.       set_animation_origin
  4364.     end
  4365.   end
  4366.   #--------------------------------------------------------------------------
  4367.   # ● 次のアニメを開始
  4368.   #--------------------------------------------------------------------------
  4369.   def next_animation(animation, mirror)
  4370.     @next_anime = [] if @next_anime == nil
  4371.     @next_anime.push(Sprite_Base.new(viewport))
  4372.     @next_anime[@next_anime.size - 1].set(battler, @battler.sv.anime_horming, @battler.sv.anime_camera_zoom, @battler.sv.anime_no_mirror)
  4373.     @next_anime[@next_anime.size - 1].set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y)
  4374.     @next_anime[@next_anime.size - 1].start_animation(animation, mirror)
  4375.   end
  4376.   #--------------------------------------------------------------------------
  4377.   # ● 影グラフィック作成
  4378.   #--------------------------------------------------------------------------
  4379.   def create_shadow
  4380.     reset_shadow
  4381.     return if @battler.sv.shadow == false
  4382.     @shadow = Sprite.new(viewport) if @shadow == nil
  4383.     @shadow.bitmap = Cache.character(@battler.sv.shadow)
  4384.     @shadow.ox = @shadow.bitmap.width / 2
  4385.     @shadow.oy = @shadow.bitmap.height / 2
  4386.   end
  4387.   #--------------------------------------------------------------------------
  4388.   # ● 影グラフィック初期化
  4389.   #--------------------------------------------------------------------------
  4390.   def reset_shadow
  4391.     return if @shadow == nil
  4392.     @shadow.dispose
  4393.     @shadow = nil
  4394.   end  
  4395.   #--------------------------------------------------------------------------
  4396.   # ● 転送元ビットマップの更新 ★再定義
  4397.   #--------------------------------------------------------------------------
  4398.   def update_bitmap
  4399.     update_bitmap_enemy if [email protected]?
  4400.     update_bitmap_actor if @battler.actor?
  4401.     update_src_rect if @battler != nil
  4402.     update_color if @battler != nil
  4403.   end
  4404.   #--------------------------------------------------------------------------
  4405.   # ● 転送元ビットマップ:エネミー
  4406.   #--------------------------------------------------------------------------
  4407.   def update_bitmap_enemy
  4408.     if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
  4409.       @battler_name = @battler.battler_name
  4410.       @battler_hue = @battler.battler_hue
  4411.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4412.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4413.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue)
  4414.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4415.       create_shadow
  4416.       init_visibility
  4417.       @battler_id = @battler.id
  4418.     end
  4419.   end  
  4420.   #--------------------------------------------------------------------------
  4421.   # ● 転送元ビットマップ:アクター
  4422.   #--------------------------------------------------------------------------
  4423.   def update_bitmap_actor
  4424.     if @battler.character_name != @battler_name or @battler.character_index != @battler_index
  4425.       @battler_name = @battler.character_name
  4426.       @battler_index = @battler.character_index
  4427.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4428.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4429.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
  4430.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4431.       create_shadow
  4432.       init_visibility
  4433.       @battler_id = @battler.id
  4434.     end
  4435.   end
  4436.   #--------------------------------------------------------------------------
  4437.   # ● 可視状態の初期化 ★再定義
  4438.   #--------------------------------------------------------------------------
  4439.   def init_visibility
  4440.     @battler_visible = @battler.alive?
  4441.     @battler_visible = true if @battler.sv.state(1) != "敵コラプス"
  4442.     @battler_visible = false if @battler.hidden?
  4443.     @battler.sv.opacity = 0 unless @battler_visible
  4444.     self.opacity = 0 unless @battler_visible
  4445.     self.opacity = 255 if @battler_visible
  4446.     @battler.sv.weapon_visible = @battler_visible
  4447.   end
  4448.   #--------------------------------------------------------------------------
  4449.   # ● 転送元矩形の更新
  4450.   #--------------------------------------------------------------------------
  4451.   def update_src_rect
  4452.     return if @battler.sv.collapse
  4453.     if @battler_graphic_file_index != @battler.sv.graphic_file_index
  4454.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4455.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index) if @battler.actor?
  4456.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue) if [email protected]?
  4457.       @battler.sv.set_graphics(self.bitmap.width, self.bitmap.height)
  4458.     end
  4459.     anime_off if @battler.sv.anime_off
  4460.     self.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4461.     self.opacity = @battler.sv.opacity if @battler_visible
  4462.     set_process_timing(@battler.sv.timing) if @battler && @battler.sv.timing != []
  4463.   end
  4464.   #--------------------------------------------------------------------------
  4465.   # ● 位置の更新 ★再定義
  4466.   #--------------------------------------------------------------------------
  4467.   def update_position
  4468.     @real_x = @battler.sv.x / 100
  4469.     @real_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust)/ 100
  4470.     self.x = @real_x - $sv_camera.x
  4471.     self.y = @real_y - $sv_camera.y
  4472.     self.z = @battler.sv.z - @battler.sv.c / 100
  4473.     if @battler.sv.h <= 0
  4474.       self.x += $sv_camera.sx / 100
  4475.       self.y += $sv_camera.sy / 100
  4476.     end  
  4477.     self.x *= $sv_camera.zoom
  4478.     self.y *= $sv_camera.zoom
  4479.   end
  4480.   #--------------------------------------------------------------------------
  4481.   # ● 原点の更新 ★再定義
  4482.   #--------------------------------------------------------------------------
  4483.   def update_origin
  4484.     return if !bitmap or @battler.sv.collapse
  4485.     self.ox = @battler.sv.ox
  4486.     self.oy = @battler.sv.oy
  4487.     self.angle = @battler.sv.angle
  4488.     self.zoom_x = @battler.sv.zoom_x * $sv_camera.zoom
  4489.     self.zoom_y = @battler.sv.zoom_y * $sv_camera.zoom
  4490.     self.mirror = @battler.sv.mirror if !@graphic_mirror_flag
  4491.     self.mirror = [email protected] if @graphic_mirror_flag
  4492.   end
  4493.   #--------------------------------------------------------------------------
  4494.   # ● 影グラフィックの更新
  4495.   #--------------------------------------------------------------------------
  4496.   def update_shadow
  4497.     @shadow.visible = @battler.sv.shadow_visible
  4498.     @shadow.opacity = @battler.sv.opacity if @battler.sv.opacity_data[3]
  4499.     @shadow.opacity = self.opacity if [email protected]_data[3]
  4500.     @shadow.x = @real_x - $sv_camera.x
  4501.     @shadow.y = (@battler.sv.y - @battler.sv.c)/ 100 - $sv_camera.y
  4502.     @shadow.z = @battler.sv.z - 10
  4503.     @shadow.zoom_x = $sv_camera.zoom
  4504.     @shadow.zoom_y = $sv_camera.zoom
  4505.     @shadow.x += $sv_camera.sx / 100
  4506.     @shadow.y += $sv_camera.sy / 100
  4507.     @shadow.x *= $sv_camera.zoom
  4508.     @shadow.y *= $sv_camera.zoom
  4509.     @shadow.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4510.   end
  4511.   #--------------------------------------------------------------------------
  4512.   # ● ふきだしの更新
  4513.   #--------------------------------------------------------------------------
  4514.   def update_balloon
  4515.     if @battler.sv.balloon_data == [] && @balloon
  4516.       @balloon_data = []
  4517.       @balloon.dispose
  4518.       return @balloon = nil
  4519.     elsif @battler.sv.balloon_data != [] && @battler.sv.balloon_data != @balloon_data
  4520.       @balloon_data = @battler.sv.balloon_data
  4521.       @balloon = Sprite.new(self.viewport)
  4522.       @balloon.bitmap = Cache.system("Balloon")
  4523.       @balloon.zoom_x = @balloon_data[3]
  4524.       @balloon.zoom_y = @balloon_data[3]
  4525.       @balloon.ox = 32 if @battler.sv.mirror
  4526.       @balloon.oy = 16
  4527.       @balloon_count = 0
  4528.     end
  4529.     return if !@balloon
  4530.     @balloon.opacity = self.opacity
  4531.     @balloon.x = self.x
  4532.     @balloon.y = self.y - @battler.sv.ch * $sv_camera.zoom
  4533.     @balloon.z = self.z + 20
  4534.     @balloon.src_rect.set(32 + @balloon_count / @balloon_data[2] * 32, @balloon_data[1] * 32, 32, 32) if @balloon_count % @balloon_data[2] == 0
  4535.     @balloon.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4536.     @balloon_count += 1
  4537.     @balloon_count = 0 if @balloon_count == @balloon_data[2] * 7
  4538.   end
  4539.   #--------------------------------------------------------------------------
  4540.   # ● 色調変更の更新
  4541.   #--------------------------------------------------------------------------
  4542.   def update_color
  4543.     color_set if @battler.sv.color_set != []
  4544.     return if @color_data == nil
  4545.     @color_data[4] -= 1
  4546.     if @color_data[4] == 0 && @color_data[5] != 0
  4547.       @color_data[4] = @color_data[5]
  4548.       @color_data[5] = 0
  4549.       @color_data[6] = [0,0,0,0]
  4550.     elsif @color_data[4] == 0
  4551.       @remain_color_data = @color_data
  4552.       @battler.sv.color = @color_data.dup
  4553.       return @color_data = nil
  4554.     end  
  4555.     for i in 0..3
  4556.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  4557.     end  
  4558.     @battler.sv.color = @color_data.dup
  4559.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  4560.   end
  4561.   #--------------------------------------------------------------------------
  4562.   # ● 残像の更新
  4563.   #--------------------------------------------------------------------------
  4564.   def update_mirage
  4565.     if @battler.sv.mirage == [] && @mirages
  4566.       @mirage_data = []
  4567.       for mirage in @mirages do mirage.dispose end
  4568.       return @mirages = nil
  4569.     elsif @battler.sv.mirage != [] && @battler.sv.mirage != @mirage_data
  4570.       @mirage_data = @battler.sv.mirage
  4571.       @mirages = []
  4572.       for i in 0...@mirage_data[1] do @mirages[i] = Sprite.new(self.viewport) end
  4573.       @mirage_count = 0
  4574.     end
  4575.     return if !@mirages
  4576.     @mirage_count += 1
  4577.     @mirage_count = 0 if @mirage_count == @mirage_data[2] * @mirages.size
  4578.     for i in [email protected]
  4579.       mirage_body(@mirages[i], @mirage_data[4]) if @mirage_count == 1 + i * @mirage_data[2]
  4580.     end
  4581.   end
  4582.   #--------------------------------------------------------------------------
  4583.   # ● 残像本体
  4584.   #--------------------------------------------------------------------------
  4585.   def mirage_body(body, opacity)
  4586.     body.bitmap = self.bitmap.dup
  4587.     body.x = self.x
  4588.     body.y = self.y
  4589.     body.ox = self.ox
  4590.     body.oy = self.oy
  4591.     body.z = self.z - 20
  4592.     body.mirror = self.mirror
  4593.     body.angle = self.angle
  4594.     body.opacity = opacity * self.opacity / 255
  4595.     body.zoom_x = self.zoom_x
  4596.     body.zoom_y = self.zoom_y   
  4597.     body.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4598.     body.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4599.   end   
  4600.   #--------------------------------------------------------------------------
  4601.   # ● 次のアニメを更新
  4602.   #--------------------------------------------------------------------------
  4603.   def update_next_anime
  4604.     return if !@next_anime
  4605.     for anime in @next_anime
  4606.       anime.update
  4607.       anime.set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y) if @horming
  4608.       anime.dispose if !anime.animation?
  4609.       @next_anime.delete(anime) if !anime.animation?
  4610.     end  
  4611.   end
  4612.   #--------------------------------------------------------------------------
  4613.   # ● フレーム更新
  4614.   #--------------------------------------------------------------------------
  4615.   alias update_sprite_battler_n03 update
  4616.   def update
  4617.     @battler.sv.update if @battler
  4618.     update_sprite_battler_n03
  4619.     update_next_anime
  4620.     update_shadow  if @battler && @shadow
  4621.     update_mirage  if @battler
  4622.     update_balloon if @battler
  4623.     update_remove if @battler && @removing && @battler.sv.change_up
  4624.   end
  4625.   #--------------------------------------------------------------------------
  4626.   # ● 戦闘アニメ消去
  4627.   #--------------------------------------------------------------------------
  4628.   def anime_off
  4629.     @battler.sv.anime_off = false
  4630.     dispose_animation
  4631.     for anime in @next_anime do anime.dispose_animation end if @next_anime
  4632.   end
  4633.   #--------------------------------------------------------------------------
  4634.   # ● バトラー入れ替え
  4635.   #--------------------------------------------------------------------------
  4636.   def remove
  4637.     @battler.sv.start_action(@battler.sv.remove_action)
  4638.     $sv_camera.wait = 40
  4639.     @battler.sv.add_action("eval('set_change')")
  4640.     @removing = true
  4641.   end
  4642.   #--------------------------------------------------------------------------
  4643.   # ● バトラー入れ替えの更新
  4644.   #--------------------------------------------------------------------------
  4645.   def update_remove
  4646.     @battler.sv.change_up = false
  4647.     @removing = false
  4648.     @battler = nil
  4649.   end  
  4650.   #--------------------------------------------------------------------------
  4651.   # ● バトラー加入
  4652.   #--------------------------------------------------------------------------
  4653.   def join(join_battler)
  4654.     $sv_camera.wait = 30
  4655.     @battler = join_battler
  4656.     @battler_name = @battler.character_name
  4657.     @battler_index = @battler.character_index
  4658.     @battler_graphic_file_index = @battler.sv.graphic_file_index
  4659.     self.bitmap = Cache.character(@battler_name)
  4660.     @battler.sv.setup(self.bitmap.width, self.bitmap.height, true)
  4661.     create_shadow
  4662.     init_visibility
  4663.   end
  4664.   #--------------------------------------------------------------------------
  4665.   # ● 通常の設定に戻す ★再定義
  4666.   #--------------------------------------------------------------------------
  4667.   def revert_to_normal
  4668.     self.blend_type = 0
  4669.     self.opacity = 255
  4670.   end
  4671.   #--------------------------------------------------------------------------
  4672.   # ● 崩壊エフェクトの更新
  4673.   #--------------------------------------------------------------------------
  4674.   alias update_collapse_sprite_battler_n03 update_collapse
  4675.   def update_collapse
  4676.     return if @battler.sv.state(1) != "敵コラプス"
  4677.     update_collapse_sprite_battler_n03
  4678.     @battler.sv.weapon_visible = false
  4679.   end
  4680.   #--------------------------------------------------------------------------
  4681.   # ● ボス崩壊エフェクトの更新 ★再定義
  4682.   #--------------------------------------------------------------------------
  4683.   def update_boss_collapse
  4684.     @effect_duration = @battler.sv.ch if @effect_duration >= @battler.sv.ch
  4685.     alpha = @effect_duration * 120 / @battler.sv.ch
  4686.     self.ox = @battler.sv.cw / 2 + @effect_duration % 2 * 4 - 2
  4687.     self.blend_type = 1
  4688.     self.color.set(255, 255, 255, 255 - alpha)
  4689.     self.opacity = alpha
  4690.     self.src_rect.y -= 1
  4691.     Sound.play_boss_collapse2 if @effect_duration % 20 == 19
  4692.   end
  4693.   #--------------------------------------------------------------------------
  4694.   # ● 別スプライトからのタイミング処理
  4695.   #--------------------------------------------------------------------------
  4696.   def set_process_timing(timing_data)
  4697.     for data in timing_data
  4698.       set_timing(data[0],data[1])
  4699.     end
  4700.     @battler.sv.timing = []
  4701.   end
  4702.   #--------------------------------------------------------------------------
  4703.   # ● タイミング処理
  4704.   #--------------------------------------------------------------------------
  4705.   def set_timing(se_flag, data)
  4706.     @ani_rate = 4
  4707.     data.se.play if se_flag
  4708.     case data.flash_scope
  4709.     when 1 ;self.flash(data.flash_color, data.flash_duration * @ani_rate)
  4710.     when 2 ;viewport.flash(data.flash_color, data.flash_duration * @ani_rate) if viewport
  4711.     when 3 ;self.flash(nil, data.flash_duration * @ani_rate)
  4712.     end
  4713.   end
  4714.   #--------------------------------------------------------------------------
  4715.   # ● 色調変更
  4716.   #--------------------------------------------------------------------------
  4717.   def color_set
  4718.     set = @battler.sv.color_set
  4719.     @battler.sv.color_set= []
  4720.     set[4] = 1 if set[4] == 0
  4721.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  4722.     @color_data = @remain_color_data
  4723.     @color_data[4] = set[4]
  4724.     @color_data[5] = set[5]
  4725.     @color_data[6] = set
  4726.   end
  4727.   #--------------------------------------------------------------------------
  4728.   # ● 解放
  4729.   #--------------------------------------------------------------------------
  4730.   alias dispose_sprite_battler_n03 dispose
  4731.   def dispose
  4732.     dispose_sprite_battler_n03
  4733.     @shadow.dispose if @shadow != nil
  4734.     @balloon.dispose if @balloon != nil
  4735.     for mirage in @mirages do mirage.dispose end if @mirages != nil
  4736.     for anime in @next_anime do anime.dispose end if @next_anime
  4737.   end
  4738. end
  4739.  
  4740.  
  4741. #==============================================================================
  4742. # ■ Spriteset_Battle
  4743. #------------------------------------------------------------------------------
  4744. #  バトル画面のスプライトをまとめたクラスです。
  4745. #==============================================================================
  4746. class Spriteset_Battle
  4747.   #--------------------------------------------------------------------------
  4748.   # ● 戦闘背景(床)スプライトの作成 ★再定義
  4749.   #--------------------------------------------------------------------------
  4750.   def create_battleback1
  4751.     @back1_sprite = Sprite_Battle_Back.new(@viewport1, 1, battleback1_name)
  4752.     @back1_sprite.set_graphics(battleback1_bitmap) if battleback1_name != nil
  4753.     @back1_sprite.z = 0
  4754.   end
  4755.   #--------------------------------------------------------------------------
  4756.   # ● 戦闘背景(壁)スプライトの作成 ★再定義
  4757.   #--------------------------------------------------------------------------
  4758.   def create_battleback2
  4759.     @back2_sprite = Sprite_Battle_Back.new(@viewport1, 2, battleback2_name)
  4760.     @back2_sprite.set_graphics(battleback2_bitmap) if battleback2_name != nil
  4761.     @back2_sprite.z = 1
  4762.   end
  4763.   #--------------------------------------------------------------------------
  4764.   # ● アクタースプライトの作成 ★再定義
  4765.   #--------------------------------------------------------------------------
  4766.   def create_actors
  4767.     @actor_sprites = []
  4768.     for i in 0...$game_party.max_battle_members
  4769.       @actor_sprites[i] = Sprite_Battler.new(@viewport1, $game_party.members[i])
  4770.     end
  4771.     @effect_sprites = Spriteset_Sideview.new(@viewport1)
  4772.   end
  4773.   #--------------------------------------------------------------------------
  4774.   # ● アクタースプライトの更新 ★再定義
  4775.   #--------------------------------------------------------------------------
  4776.   def update_actors
  4777.     @actor_sprites.each_with_index do |sprite, i|
  4778.       sprite_join($game_party.members[i], sprite) if sprite.battler == nil && sprite.battler != $game_party.members[i]
  4779.       sprite.remove if sprite.battler != nil && !sprite.removing && sprite.battler != $game_party.members[i]
  4780.       sprite.update
  4781.     end
  4782.     @effect_sprites.update
  4783.     update_program
  4784.   end
  4785.   #--------------------------------------------------------------------------
  4786.   # ● メンバーを加える
  4787.   #--------------------------------------------------------------------------
  4788.   def sprite_join(member, sprite)
  4789.     for sp in @actor_sprites
  4790.       sp.update_remove if member == sp.battler && !sp.battler.sv.change_up
  4791.     end
  4792.     sprite.join(member)
  4793.   end
  4794.   #--------------------------------------------------------------------------
  4795.   # ● バトルプログラムの更新
  4796.   #--------------------------------------------------------------------------
  4797.   def update_program
  4798.     return if $sv_camera.program_scroll == []
  4799.     for data in  $sv_camera.program_scroll
  4800.       @back1_sprite.start_back_data(data) if data[2] == 1
  4801.       @back2_sprite.start_back_data(data) if data[2] == 2
  4802.     end
  4803.     $sv_camera.program_scroll = []
  4804.   end
  4805.   #--------------------------------------------------------------------------
  4806.   # ● ヒット時の戦闘アニメ実行
  4807.   #--------------------------------------------------------------------------
  4808.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  4809.     @effect_sprites.set_hit_animation(battler, weapon_index, hit_targets, miss)
  4810.   end
  4811.   #--------------------------------------------------------------------------
  4812.   # ● ダメージPOP
  4813.   #--------------------------------------------------------------------------
  4814.   def set_damage_pop(target)
  4815.     @effect_sprites.set_damage_pop(target)
  4816.   end
  4817.   #--------------------------------------------------------------------------
  4818.   # ● 解放
  4819.   #--------------------------------------------------------------------------
  4820.   alias dispose_spriteset_battle_n03 dispose
  4821.   def dispose
  4822.     dispose_spriteset_battle_n03
  4823.     @effect_sprites.dispose
  4824.   end
  4825.  
  4826.  
  4827.  
  4828. end
  4829.  
  4830.  
  4831. #==============================================================================
  4832. # ■ Window_BattleLog
  4833. #------------------------------------------------------------------------------
  4834. #  戦闘の進行を実況表示するウィンドウです。
  4835. #==============================================================================
  4836. class Window_BattleLog < Window_Selectable
  4837.   #--------------------------------------------------------------------------
  4838.   # ● ウェイト ★再定義
  4839.   #--------------------------------------------------------------------------
  4840.   def wait
  4841.   end
  4842.   #--------------------------------------------------------------------------
  4843.   # ● ウェイトとクリア ★再定義
  4844.   #--------------------------------------------------------------------------
  4845.   def wait_and_clear
  4846.     $sv_camera.wait = 10
  4847.   end
  4848.   #--------------------------------------------------------------------------
  4849.   # ● 行動結果の表示 ★再定義
  4850.   #--------------------------------------------------------------------------
  4851.   def display_action_results(target, item)
  4852.     if target.result.used
  4853.       last_line_number = line_number
  4854.       display_critical(target, item)
  4855.       display_damage(target, item)
  4856.       display_affected_status(target, item)
  4857.       display_failure(target, item)
  4858.     end
  4859.     off if !N03::BATTLE_LOG
  4860.   end
  4861.   #--------------------------------------------------------------------------
  4862.   # ● ウインドウ非表示
  4863.   #--------------------------------------------------------------------------
  4864.   def off
  4865.     @back_sprite.visible = self.visible = false
  4866.   end
  4867. end
  4868. #==============================================================================
  4869. # ■ Game_Interpreter
  4870. #------------------------------------------------------------------------------
  4871. #  イベントコマンドを実行するインタプリタです。
  4872. #==============================================================================
  4873. class Game_Interpreter
  4874.   #--------------------------------------------------------------------------
  4875.   # ● スイッチの操作
  4876.   #--------------------------------------------------------------------------
  4877.   alias command_121_game_interpreter_n03 command_121
  4878.   def command_121
  4879.     command_121_game_interpreter_n03
  4880.     $sv_camera.program_check
  4881.   end
  4882. end
我想做游戏 可我啥都不会 所以我找到了这里

Lv2.观梦者

梦石
0
星屑
417
在线时间
78 小时
注册时间
2017-10-25
帖子
50
 楼主| 发表于 2019-9-16 13:53:48 | 显示全部楼层
大佬们还在假期 还是我这个问题有点过分呢
我想做游戏 可我啥都不会 所以我找到了这里
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 00:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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