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

Project1

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

[有事请教] ACE横版战斗--阵型 出错,附工程

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1362
在线时间
102 小时
注册时间
2023-12-26
帖子
190
跳转到指定楼层
1
发表于 5 天前 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 djs789783 于 2025-3-6 04:14 编辑

ACE横版战斗--阵型  出错,有没大佬看下怎么弄好。
谢谢你

阵型.rar

1.87 MB, 下载次数: 6

出错的阵型.rar

769.92 KB, 下载次数: 3

RGSS300.rar

1.13 MB, 下载次数: 0

Lv3.寻梦者

梦石
0
星屑
2364
在线时间
606 小时
注册时间
2012-5-3
帖子
102

开拓者

2
发表于 5 天前 | 只看该作者
  1.   #--------------------------------------------------------------------------
  2.   # ● 获取当前状态的实例数组
  3.   #--------------------------------------------------------------------------
  4.   def states
  5.     @states.collect {|id| $data_states[id] }.compact
  6.   end

  7.   #--------------------------------------------------------------------------
  8.   # ● 获取所有特性实例的数组
  9.   #--------------------------------------------------------------------------
  10.   def all_features
  11.     feature_objects.inject([]) {|r, obj| r + obj.features rescue r }
  12.   end
复制代码

在Game_BattlerBase类找到同名方法,然后按照上面方法修改即可。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1362
在线时间
102 小时
注册时间
2023-12-26
帖子
190
3
 楼主| 发表于 4 天前 | 只看该作者
邱小谦 发表于 2025-3-5 18:52
在Game_BattlerBase类找到同名方法,然后按照上面方法修改即可。

好家伙,居然是大佬,大佬啊~抱大腿(泪流满脸的抱大腿~香)。谢谢啊。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1362
在线时间
102 小时
注册时间
2023-12-26
帖子
190
4
 楼主| 发表于 4 天前 | 只看该作者
邱小谦 发表于 2025-3-5 18:52
在Game_BattlerBase类找到同名方法,然后按照上面方法修改即可。

又出错了我重新编辑一下上面的附件,麻烦您 看看吧
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2364
在线时间
606 小时
注册时间
2012-5-3
帖子
102

开拓者

5
发表于 4 天前 | 只看该作者
djs789783 发表于 2025-3-6 04:12
又出错了我重新编辑一下上面的附件,麻烦您 看看吧

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


  1520. #==============================================================================
  1521. # ■ module N03
  1522. #------------------------------------------------------------------------------
  1523. #  サイドビューバトルのモジュールです。
  1524. #==============================================================================
  1525. module N03
  1526.   #--------------------------------------------------------------------------
  1527.   # ● バトラーの敵グループを取得
  1528.   #--------------------------------------------------------------------------
  1529.   def self.get_enemy_unit(battler)
  1530.     return $game_troop if battler.actor?
  1531.     return $game_party
  1532.   end
  1533.   #--------------------------------------------------------------------------
  1534.   # ● バトラーの味方グループを取得
  1535.   #--------------------------------------------------------------------------
  1536.   def self.get_party_unit(battler)
  1537.     return $game_party if battler.actor?
  1538.     return $game_troop
  1539.   end
  1540.   #--------------------------------------------------------------------------
  1541.   # ● 戦闘アニメ時間の取得
  1542.   #--------------------------------------------------------------------------
  1543.   def self.get_anime_time(anime_id)
  1544.     return 0 if anime_id <= 0
  1545.     return $data_animations[anime_id] ? $data_animations[anime_id].frame_max * 4 : 0
  1546.   end
  1547.   #--------------------------------------------------------------------------
  1548.   # ● 攻撃アニメの取得
  1549.   #--------------------------------------------------------------------------
  1550.   def self.get_attack_anime_id(kind, battler)
  1551.     return $data_skills[battler.sv.counter_id].animation_id if kind == -3 && battler.sv.counter_id != 0
  1552.     case kind
  1553.     when -1 ; anime_id = battler.atk_animation_id1
  1554.     when -2 ; anime_id = battler.atk_animation_id2
  1555.     when -3
  1556.       if battler.current_action != nil
  1557.         anime_id = battler.current_action.item.animation_id if battler.current_action.item != nil
  1558.       end
  1559.     else    ; anime_id = kind
  1560.     end
  1561.     case anime_id
  1562.     when -1 ; anime_id = battler.atk_animation_id1
  1563.     when -2 ; anime_id = battler.atk_animation_id2
  1564.     end
  1565.     return anime_id if anime_id
  1566.     return 0
  1567.   end  
  1568.   #--------------------------------------------------------------------------
  1569.   # ● 戦闘アニメデータをセット
  1570.   #--------------------------------------------------------------------------
  1571.   def self.set_damage_anime_data(targets, target, data)
  1572.     return if !first_of_all_screen_anime(data[0], target, targets)
  1573.     target.animation_id         = data[0]
  1574.     target.animation_mirror     = data[1]
  1575.     target.sv.anime_no_mirror   = data[2]
  1576.     target.sv.anime_camera_zoom = data[3]
  1577.     target.sv.anime_plus_z      = data[4]
  1578.   end   
  1579.   #--------------------------------------------------------------------------
  1580.   # ● ターゲットの取得
  1581.   #--------------------------------------------------------------------------
  1582.   def self.get_targets(kind, battler)
  1583.     case kind.abs
  1584.     when 0 ; return [battler].dup
  1585.     when 1 ; return battler.sv.target_battler.dup
  1586.     when 2 ; return get_enemy_unit(battler).members.dup
  1587.     when 3 ; return get_party_unit(battler).members.dup
  1588.     when 4 ; return $game_troop.members.dup + $game_party.battle_members.dup
  1589.     when 5 ; return battler.sv.second_targets.dup
  1590.     end
  1591.   end  
  1592.   #--------------------------------------------------------------------------
  1593.   # ● ターゲットの座標を取得
  1594.   #--------------------------------------------------------------------------
  1595.   def self.get_targets_position(targets, horming, m_a = nil)
  1596.     return [0,0,0] if targets == nil && !$sv_camera.mirror
  1597.     return [Graphics.width,0,0] if targets == nil && $sv_camera.mirror
  1598.     x = y = h = 0
  1599.     for i in 0...targets.size
  1600.       x += targets[i].sv.base_x if !horming
  1601.       y += targets[i].sv.base_y if !horming
  1602.       h += targets[i].sv.base_h if !horming
  1603.       x += targets[i].sv.x if horming
  1604.       y += targets[i].sv.y if horming
  1605.       h += targets[i].sv.h if horming
  1606.       y -= targets[i].sv.ch * 100 if m_a == 0
  1607.       y -= targets[i].sv.ch * 50 if m_a == 1
  1608.     end
  1609.     return [x / targets.size, y / targets.size, h / targets.size]
  1610.   end
  1611.   #--------------------------------------------------------------------------
  1612.   # ● 速度を時間に変換
  1613.   #--------------------------------------------------------------------------
  1614.   def self.distanse_calculation(time, target_position, self_position, distanse_move)
  1615.     return time if !distanse_move
  1616.     distanse_x = self_position[0] - target_position[0]
  1617.     distanse_x = target_position[0] - self_position[0] if target_position[0] > self_position[0]
  1618.     distanse_y = self_position[1] - target_position[1]
  1619.     distanse_y = target_position[1] - self_position[1] if target_position[1] > self_position[1]
  1620.     if self_position[2] != nil && target_position[2] != nil
  1621.       distanse_h = self_position[2] - target_position[2]
  1622.       distanse_h = target_position[2] - self_position[2] if target_position[2] > self_position[2]
  1623.     else
  1624.       distanse_h = 0
  1625.     end
  1626.     distanse = [distanse_x, distanse_y, distanse_h].max
  1627.     return distanse / (time * 100) + 1
  1628.   end
  1629.   #--------------------------------------------------------------------------
  1630.   # ● 放物線移動計算
  1631.   #--------------------------------------------------------------------------
  1632.   def self.parabola(data, time, size, type = 1)
  1633.     move_data = data
  1634.     move_data[0] *= size
  1635.     move_data[1] *= size
  1636.     move = []
  1637.     move_d = []
  1638.     for i in 0...time / 2
  1639.       move[i] = move_data[0]
  1640.       move_d[i] = move_data[1]
  1641.       move_data[0] = move_data[0] * type / (1 + type)
  1642.       move_data[1] = move_data[1] * type / (1 + type)
  1643.     end
  1644.     move = move + move_d.reverse!
  1645.     move.reverse!
  1646.     adjust = move.inject(0) {|result, item| result + item }
  1647.     move[move.size - 1] += adjust if data[0] == data[1] && adjust != 0
  1648.     move.unshift(0) if time % 2 != 0
  1649.     return move
  1650.   end
  1651.   #--------------------------------------------------------------------------
  1652.   # ● 反転値
  1653.   #--------------------------------------------------------------------------
  1654.   def self.mirror_num(mirror)
  1655.     return 1 if !mirror
  1656.     return -1
  1657.   end  
  1658.   #--------------------------------------------------------------------------
  1659.   # ● カメラワーク
  1660.   #--------------------------------------------------------------------------
  1661.   def self.camera(battler, data)
  1662.     battler = $game_party.battle_members[0] if !battler
  1663.     cx = data[2][0] * 100
  1664.     cy = data[2][1] * 100
  1665.     return $sv_camera.move(cx, cy, data[3], data[4], true) if data[1] == 6
  1666.     targets = self.get_targets(data[1], battler)
  1667.     return if targets == nil or targets == []
  1668.     position = self.get_targets_position(targets, true)
  1669.     $sv_camera.move(position[0], position[1] - position[2], data[3], data[4], false)
  1670.   end
  1671.   #--------------------------------------------------------------------------
  1672.   # ● コラプス禁止
  1673.   #--------------------------------------------------------------------------
  1674.   def self.immortaling
  1675.     # 全員に不死身付与
  1676.     for member in $game_party.battle_members + $game_troop.members
  1677.       # イベント操作等で不死身設定になっていたら解除を無効にするフラグを立てる
  1678.       member.sv.immortal = true if member.state?(N03::IMMORTAL_ID)
  1679.       member.add_state(N03::IMMORTAL_ID)
  1680.     end
  1681.     return true
  1682.   end  
  1683.   #--------------------------------------------------------------------------
  1684.   # ● コラプス許可
  1685.   #--------------------------------------------------------------------------
  1686.   def self.unimmortaling
  1687.     # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
  1688.     for member in $game_party.battle_members + $game_troop.members
  1689.       next if member.dead?
  1690.       # 不死身ステートが行動中に解除されていた場合、解除無効を解除
  1691.       member.sv.immortal = false if !member.state?(N03::IMMORTAL_ID) && member.sv.immortal
  1692.       next member.sv.immortal = false if member.sv.immortal
  1693.       member.remove_state(N03::IMMORTAL_ID)
  1694.       next if member.hp != 0
  1695.       member.add_state(1)
  1696.       member.perform_collapse_effect
  1697.       member.sv.action_terminate
  1698.     end
  1699.     return false
  1700.   end  
  1701.   #--------------------------------------------------------------------------
  1702.   # ● スキル派生
  1703.   #--------------------------------------------------------------------------
  1704.   def self.derived_skill(battler)
  1705.     battler.force_action(battler.sv.derivation_skill_id, -2)
  1706.     BattleManager.unshift_action_battlers(battler)
  1707.   end
  1708.   #--------------------------------------------------------------------------
  1709.   # ● ダメージの作成
  1710.   #--------------------------------------------------------------------------
  1711.   def self.set_damage(battler, hp_damage, mp_damage)
  1712.     battler.result.hp_damage = hp_damage
  1713.     battler.result.mp_damage = mp_damage
  1714.   end
  1715.   #--------------------------------------------------------------------------
  1716.   # ● ターゲット生死確認
  1717.   #--------------------------------------------------------------------------
  1718.   def self.targets_alive?(targets)
  1719.     return false if targets == []
  1720.     for target in targets do return true if !target.dead? end
  1721. #~     for target in targets do return true if target.alive? end   #PannyDD
  1722.     return false
  1723.   end
  1724.   #--------------------------------------------------------------------------
  1725.   # ● ターゲットをセカンドターゲットへ
  1726.   #--------------------------------------------------------------------------
  1727.   def self.s_targets(battler)
  1728.     battler.sv.target_battler = battler.sv.second_targets
  1729.     return battler.sv.second_targets
  1730.   end  
  1731.   #--------------------------------------------------------------------------
  1732.   # ● セカンドターゲットをターゲットへ
  1733.   #--------------------------------------------------------------------------
  1734.   def self.targets_set(battler)
  1735.     battler.sv.second_targets = battler.current_action.make_targets.compact
  1736.     battler.sv.target_battler = battler.sv.second_targets
  1737.   end  
  1738.   #--------------------------------------------------------------------------
  1739.   # ● 戦闘アニメ実行判定 (対象:画面時は最初のターゲットのみアニメ実行)
  1740.   #--------------------------------------------------------------------------
  1741.   def self.first_of_all_screen_anime(anime_id, target, targets)
  1742.     anime = $data_animations[anime_id]
  1743.     return false if !anime
  1744.     return true if anime.position != 3
  1745.     return false if anime.position == 3 && target != targets[0]
  1746.     targets.delete(target)
  1747.     target.sv.timing_targets = targets
  1748.     return true
  1749.   end
  1750.   #--------------------------------------------------------------------------
  1751.   # ● 戦闘不能付加攻撃か
  1752.   #--------------------------------------------------------------------------
  1753.   def self.dead_attack?(battler, item)
  1754.     for state in battler.atk_states
  1755.       return true if state == battler.death_state_id
  1756.     end
  1757.     for effect in item.effects
  1758.       return true if effect.code == 21 && effect.data_id == battler.death_state_id
  1759.     end
  1760.     return false
  1761.   end
  1762. end

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

  2285. #==============================================================================
  2286. # ■ Sprite_Battle_Picture
  2287. #------------------------------------------------------------------------------
  2288. #  ピクチャ表示用のスプライトです。
  2289. #==============================================================================
  2290. class Sprite_Battle_Picture < Sprite
  2291.   #--------------------------------------------------------------------------
  2292.   # ● 公開インスタンス変数 
  2293.   #--------------------------------------------------------------------------
  2294.   attr_accessor   :action_end           # 終了フラグ
  2295.   #--------------------------------------------------------------------------
  2296.   # ● オブジェクト初期化
  2297.   #--------------------------------------------------------------------------
  2298.   def initialize(viewport = nil)
  2299.     super(viewport)
  2300.     @action_end = false
  2301.     self.ox = 0
  2302.   end
  2303.   #--------------------------------------------------------------------------
  2304.   # ● セット
  2305.   #--------------------------------------------------------------------------
  2306.   def set(battler)
  2307.     @battler = battler
  2308.     @data = @battler.sv.effect_data.shift
  2309.     @time = @data[4]
  2310.     @mirror = $sv_camera.mirror
  2311.     @mirror = false if !@data[8]
  2312.     self.opacity = @data[6][0]
  2313.     @s_x = @data[2][0] if @data[2] != []
  2314.     @s_x = Graphics.width - @data[2][0]  if @data[2] != [] && @mirror
  2315.     @s_y = @data[2][1] if @data[2] != []
  2316.     @e_x = @data[3][0] if @data[3] != []
  2317.     @e_x = Graphics.width - @data[3][0] if @data[3] != [] && @mirror
  2318.     @e_y = @data[3][1] if @data[3] != []
  2319.     @s_x = self.x if @data[2] == []
  2320.     @s_y = self.y if @data[2] == []
  2321.     @e_x = self.x if @data[3] == []
  2322.     @e_y = self.y if @data[3] == []
  2323.     self.x = @s_x
  2324.     self.y = @s_y
  2325.     return @action_end = true if @time == 0
  2326.     @move_x = (@e_x * 1.0 - @s_x) / @time
  2327.     @move_y = (@e_y * 1.0 - @s_y) / @time
  2328.     self.z = @data[5]
  2329.     return set_plane(battler) if @data[7] != []
  2330.     self.bitmap = Cache.picture(@data[9]) if !bitmap or @data[9] != ""
  2331.     return @action_end = true if !bitmap
  2332.     self.mirror = @mirror
  2333.     self.ox = self.bitmap.width if @mirror
  2334.   end
  2335.   #--------------------------------------------------------------------------
  2336.   # ● プレーン移行
  2337.   #--------------------------------------------------------------------------
  2338.   def set_plane(battler)
  2339.     @viewport = Viewport.new(@data[2][0],@data[2][1],@data[7][0],@data[7][1]) if !@viewport
  2340.     viewport = @viewport
  2341.     @plane = Plane.new(viewport) if !@plane
  2342.     @plane.bitmap = Cache.picture(@data[9]) if [email protected] or @data[9] != ""
  2343.     return @action_end = true if [email protected]
  2344.     @plane.ox = @data[7][0]
  2345.     @plane.oy = @data[7][1]
  2346.     @plane.opacity = @data[6][0]
  2347.     @move_x = @remain_move[0] if @data[2] == @data[3]
  2348.     @move_y = @remain_move[1] if @data[2] == @data[3]
  2349.     @remain_move = [@move_x, @move_y]
  2350.   end
  2351.   #--------------------------------------------------------------------------
  2352.   # ● フレーム更新
  2353.   #--------------------------------------------------------------------------
  2354.   def update
  2355.     @action_end = true if [email protected]
  2356.     return if @time == 0
  2357.     return if @action_end
  2358.     @time -= 1
  2359.     return plane_update if @plane
  2360.     super
  2361.     self.x += @move_x
  2362.     self.y += @move_y
  2363.     self.opacity += @data[6][1]
  2364.     return if @time != 1
  2365.     self.x = @e_x
  2366.     self.y = @e_y
  2367.     @time = 0
  2368.   end
  2369.   #--------------------------------------------------------------------------
  2370.   # ● フレーム更新
  2371.   #--------------------------------------------------------------------------
  2372.   def plane_update
  2373.     @plane.ox += @move_x
  2374.     @plane.oy += @move_y
  2375.     @plane.opacity += @data[6][1]
  2376.     @time = @data[4] if @time == 0
  2377.   end
  2378.   #--------------------------------------------------------------------------
  2379.   # ● 解放
  2380.   #--------------------------------------------------------------------------
  2381.   def dispose
  2382.     bitmap.dispose if bitmap
  2383.     @plane.dispose if @plane
  2384.     @viewport.dispose if @viewport
  2385.     super
  2386.   end
  2387. end

  2388. #==============================================================================
  2389. # ■ Sprite_Back_Picture
  2390. #------------------------------------------------------------------------------
  2391. #  周期ピクチャ用のスプライトです。
  2392. #==============================================================================
  2393. class Sprite_Back_Picture < Plane
  2394.   #--------------------------------------------------------------------------
  2395.   # ● 公開インスタンス変数 
  2396.   #--------------------------------------------------------------------------
  2397.   attr_accessor   :action_end           # 終了フラグ
  2398.   #--------------------------------------------------------------------------
  2399.   # ● オブジェクト初期化
  2400.   #--------------------------------------------------------------------------
  2401.   def initialize(viewport = nil, index)
  2402.     super(viewport)
  2403.     @index = index
  2404.     @real_x = 0
  2405.     @real_y = 0
  2406.     @real_opacity = 0
  2407.     @move_x = 0
  2408.     @move_y = 0
  2409.     @move_opacity = 0
  2410.     @time = 0
  2411.     @switche = 0
  2412.     @action_end = false
  2413.   end
  2414.   #--------------------------------------------------------------------------
  2415.   # ● セットアップ
  2416.   #--------------------------------------------------------------------------
  2417.   def setup(data)
  2418.     self.bitmap = Cache.picture(data[9])
  2419.     self.z = data[6]
  2420.     @switche = data[1]
  2421.     mirror = $sv_camera.mirror
  2422.     mirror = false if !data[8]
  2423.     @move_x = data[3][0]
  2424.     @move_x *= -1 if mirror
  2425.     @move_y = data[3][1]
  2426.     @time = data[4]
  2427.     @time = -1 if @time == 0
  2428.     @real_opacity = (data[5][0] + 1) * 100
  2429.     @move_opacity = data[5][1]
  2430.     @start_opacity = data[5][0]
  2431.     @shake_ok = data[7]
  2432.   end
  2433.   #--------------------------------------------------------------------------
  2434.   # ● フレーム更新
  2435.   #--------------------------------------------------------------------------
  2436.   def update
  2437.     update_picture if @time != 0
  2438.     self.ox = $sv_camera.x - @real_x
  2439.     self.oy = $sv_camera.y - @real_y
  2440.     if @shake_ok
  2441.       self.ox -= $sv_camera.sx / 100
  2442.       self.oy -= $sv_camera.sy / 100
  2443.     end
  2444.     self.ox *= $sv_camera.zoom
  2445.     self.oy *= $sv_camera.zoom
  2446.     self.zoom_x = @zoom_x * $sv_camera.zoom
  2447.     self.zoom_y = @zoom_y * $sv_camera.zoom
  2448.     self.opacity = @real_opacity / 100
  2449.     @move_opacity *= -1 if self.opacity == 255 or self.opacity <= @start_opacity
  2450.     @switche
  2451.     @action_end = true if @switche > 0 && !$game_switches[@switche]
  2452.     @action_end = true if @switche < 0 && !$sv_camera.switches[@switche.abs]
  2453.   end
  2454.   #--------------------------------------------------------------------------
  2455.   # ● ピクチャの更新
  2456.   #--------------------------------------------------------------------------
  2457.   def update_picture
  2458.     @real_x += @move_x / 100
  2459.     @real_y += @move_y / 100
  2460.     @real_x = 0 if @real_x >= self.bitmap.width or @real_x <= -self.bitmap.width
  2461.     @real_y = 0 if @real_y >= self.bitmap.height or @real_y <= -self.bitmap.height
  2462.     @zoom_x = 1
  2463.     @zoom_y = 1
  2464.     @real_opacity += @move_opacity
  2465.     @time -= 1
  2466.     @time = -1 if @time < -100
  2467.   end
  2468. end

  2469. #==============================================================================
  2470. # ■ Sprite_Back_Picture
  2471. #------------------------------------------------------------------------------
  2472. #  ダメージ表示のスプライトです。
  2473. #==============================================================================
  2474. class Sprite_Damage < Sprite
  2475.   #--------------------------------------------------------------------------
  2476.   # ● 公開インスタンス変数 
  2477.   #--------------------------------------------------------------------------
  2478.   attr_reader   :action_end                  # POP終了フラグ
  2479.   #--------------------------------------------------------------------------
  2480.   # ● オブジェクト初期化
  2481.   #--------------------------------------------------------------------------
  2482.   def initialize(viewport = nil, battler)
  2483.     super(viewport)
  2484.     @battler = battler
  2485.     @time = 0
  2486.     return @action_end = true if !@battler
  2487.     @direction = -1
  2488.     @direction *= -1 if @battler.actor?
  2489.     @direction *= -1 if $sv_camera.mirror
  2490.     set_state
  2491.     set_damage
  2492.     update
  2493.   end
  2494.   #--------------------------------------------------------------------------
  2495.   # ● ステート表示
  2496.   #--------------------------------------------------------------------------
  2497.   def set_state
  2498.     return if !N03::STATE_POP
  2499.     states = @battler.result.added_state_objects
  2500.     states.delete($data_states[@battler.death_state_id]) if @battler.result.hp_damage != 0
  2501.     return if states == []
  2502.     return if @battler.sv.add_state == @battler.result.added_state_objects
  2503.     @battler.sv.add_state = states.dup
  2504.     @st = []
  2505.     @st_base = []
  2506.     for i in 0...states.size
  2507.       @st[i] = Sprite.new
  2508.       bitmap_state(@st[i], states[i])
  2509.       @st_base[i] = []
  2510.       @st_base[i][0] = @direction * (-20 + 5 * i) + @battler.sv.x / 100
  2511.       @st_base[i][1] = -40 - @state_height * i + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2512.       @st[i].z = 1000 + i
  2513.       @st[i].opacity = 0
  2514.     end
  2515.     @time = @pop_time = 80
  2516.   end   
  2517.   #--------------------------------------------------------------------------
  2518.   # ● ステート画像
  2519.   #--------------------------------------------------------------------------
  2520.   def bitmap_state(state, state_object)
  2521.     name = state_object.name
  2522.     state.bitmap = Cache.system("Iconset").dup
  2523.     state.src_rect.set(state_object.icon_index % 16 * 24, state_object.icon_index / 16 * 24, 24, 24)
  2524.     @state_height = 24
  2525.   end
  2526.   #--------------------------------------------------------------------------
  2527.   # ● ダメージ表示
  2528.   #--------------------------------------------------------------------------
  2529.   def hit_count
  2530.     for i in [email protected]
  2531.       if @battler.sv.hit[i] == nil
  2532.         @hit = i
  2533.         return @battler.sv.hit[i] = @hit
  2534.       end
  2535.     end
  2536.     @hit = @battler.sv.hit.size
  2537.     @battler.sv.hit.push(@hit)
  2538.   end  
  2539.   #--------------------------------------------------------------------------
  2540.   # ● ダメージ表示
  2541.   #--------------------------------------------------------------------------
  2542.   def set_damage
  2543.     return @action_end = true if !N03::DAMAGE_POP
  2544.     damage = @battler.result.hp_damage if @battler.result.hp_damage != 0
  2545.     damage = @battler.result.hp_drain  if @battler.result.hp_drain  != 0
  2546.     damage = @battler.result.mp_damage if @battler.result.mp_damage != 0
  2547.     damage = @battler.result.mp_drain  if @battler.result.mp_drain  != 0
  2548.     damage = @battler.result.tp_damage if @battler.result.tp_damage != 0
  2549.     if !damage or damage == 0
  2550.       @action_end = true if @st == nil
  2551.       return # ステートだけPOPする設定を考慮して@action_endは返さない
  2552.     end
  2553.     hit_count
  2554.     #@hit = @battler.sv.hit
  2555.     #@battler.sv.hit += 1 if damage != 0
  2556.     file = N03::DAMAGE_PLUS if damage > 0
  2557.     file = "damage_num_critical" if damage > 0 && @battler.result.critical
  2558.     file = N03::DAMAGE_MINUS if damage < 0
  2559.     add_file = N03::DAMAGE_MP if @battler.result.mp_damage != 0
  2560.     add_file = N03::DAMAGE_TP if @battler.result.tp_damage != 0
  2561.     adjust_x = N03::DAMAGE_ADJUST
  2562.     @num = []
  2563.     @num_base = []
  2564.     damage = damage.abs
  2565.     max_num = damage.to_s.size
  2566.     max_num += 1 if add_file != nil
  2567.     for i in 0...max_num
  2568.       @num[i] = Sprite.new
  2569.       if add_file != nil && i == max_num - 1
  2570.         @num[i].bitmap = Cache.system(add_file)
  2571.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2572.         sw = 0 if sw == nil
  2573.       else
  2574.         @num[i].bitmap = Cache.system(file)
  2575.         cw = (damage % (10 * 10 ** i))/(10 ** i)
  2576.         sw = @num[i].bitmap.width / 10
  2577.         @num[i].src_rect.set(cw * sw, 0, sw, @num[i].bitmap.height)
  2578.       end
  2579.       @num_base[i] = []
  2580.       @num_base[i][0] = (sw + adjust_x) * i * -1 + (@battler.sv.x / 100)
  2581.       @num_base[i][1] =  -(@num[i].bitmap.height / 3) - i * 2 - @hit * 2 + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 100
  2582.       @num_base[i][0] -= @num[i].bitmap.width / 2 - adjust_x if add_file != nil && i == max_num - 1
  2583.       @num[i].z = 1000 + i + @hit * 10
  2584.     end
  2585.     @time = @pop_time = 80
  2586.   end
  2587.   #--------------------------------------------------------------------------
  2588.   # ● フレーム更新
  2589.   #--------------------------------------------------------------------------
  2590.   def update
  2591.     return if @time == 0
  2592.     for i in [email protected] do update_state_move(@st[i], i) end if @st != nil
  2593.     for i in [email protected] do update_num_move(@num[i], i) end if @num != nil
  2594.     @time -= 1
  2595.     @action_end = true if @time == 0
  2596.   end
  2597.   #--------------------------------------------------------------------------
  2598.   # ● ステート画像の更新
  2599.   #--------------------------------------------------------------------------
  2600.   def update_state_move(state, index)
  2601.     min = @pop_time - index * 2
  2602.     case @time
  2603.     when min-15..min
  2604.       @st_base[index][0] += @direction
  2605.       state.opacity += 25
  2606.     when min-80..min-50
  2607.       @st_base[index][0] += @direction
  2608.       state.opacity -= 25
  2609.     end
  2610.     state.x = (@st_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2611.     state.y = (@st_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2612.   end
  2613.   #--------------------------------------------------------------------------
  2614.   # ● 数値の更新
  2615.   #--------------------------------------------------------------------------
  2616.   def update_num_move(num, index)
  2617.     min = @pop_time - index * 2
  2618.     case @time
  2619.     when min-1..min
  2620.       @num_base[index][0] += @direction * @hit
  2621.       @num_base[index][1] -= 5 + @hit * 2
  2622.     when min-3..min-2
  2623.       @num_base[index][0] += @direction * @hit
  2624.       @num_base[index][1] -= 4 + @hit * 2
  2625.     when min-6..min-4
  2626.       @num_base[index][0] += @direction
  2627.       @num_base[index][1] -= 3 + @hit * 2
  2628.     when min-14..min-7
  2629.       @num_base[index][0] += @direction
  2630.       @num_base[index][1] += 2
  2631.     when min-17..min-15
  2632.       @num_base[index][1] -= 2 + @hit * 2
  2633.     when min-23..min-18
  2634.       @num_base[index][1] += 1
  2635.     when min-27..min-24
  2636.       @num_base[index][1] -= 1
  2637.     when min-30..min-28
  2638.       @num_base[index][1] += 1
  2639.     when min-33..min-31
  2640.       @num_base[index][1] -= 1
  2641.     when min-36..min-34
  2642.       @num_base[index][1] += 1
  2643.     end
  2644.     num.x = (@num_base[index][0] - $sv_camera.x) * $sv_camera.zoom
  2645.     num.y = (@num_base[index][1] - $sv_camera.y) * $sv_camera.zoom
  2646.     num.opacity = 256 - (12 - @time) * 32
  2647.     num.visible = false if @time == 0
  2648.   end
  2649.   #--------------------------------------------------------------------------
  2650.   # ● 解放
  2651.   #--------------------------------------------------------------------------
  2652.   def dispose
  2653.     @battler.sv.hit[@hit] = nil if @hit
  2654.     bitmap.dispose if bitmap
  2655.     for i in [email protected] do @num[i].dispose end if @num != nil
  2656.     for i in [email protected] do @st[i].dispose end if @st != nil
  2657.     super
  2658.   end
  2659. end

  2660. #==============================================================================
  2661. # ■ Window_Skill_name
  2662. #------------------------------------------------------------------------------
  2663. #  スキル名を表示するウィンドウです。
  2664. #==============================================================================
  2665. class Window_Skill_name < Window_Base
  2666.   #--------------------------------------------------------------------------
  2667.   # ● オブジェクト初期化
  2668.   #--------------------------------------------------------------------------
  2669.   def initialize(text)
  2670.     super(0, 0, Graphics.width, line_height + standard_padding * 2)
  2671.     draw_text(4, 0, Graphics.width - 64, line_height,text, 1)
  2672.   end
  2673. end

  2674. #==============================================================================
  2675. # ■ Spriteset_Sideview
  2676. #------------------------------------------------------------------------------
  2677. #  サイドビュー独自のスプライトをまとめたクラスです。
  2678. #==============================================================================
  2679. class Spriteset_Sideview
  2680.   #--------------------------------------------------------------------------
  2681.   # ● オブジェクト初期化
  2682.   #--------------------------------------------------------------------------
  2683.   def initialize(viewport)
  2684.     @viewport = viewport
  2685.     @weapons = []
  2686.     @pictures = []
  2687.     @back_pic = []
  2688.     @damage = []
  2689.     $sv_camera.setup
  2690.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup)
  2691.   end
  2692.   #--------------------------------------------------------------------------
  2693.   # ● フレーム更新
  2694.   #--------------------------------------------------------------------------
  2695.   def update
  2696.     update_battler_data
  2697.     update_damage
  2698.     update_pictures
  2699.     update_back_pic
  2700.     update_weapons
  2701.   end  
  2702.   #--------------------------------------------------------------------------
  2703.   # ● バトラーデータの更新
  2704.   #--------------------------------------------------------------------------
  2705.   def update_battler_data
  2706.     for battler in $game_party.battle_members + $game_troop.members
  2707.       weapon_end(battler) if battler.sv.weapon_end
  2708.       next if battler.sv.effect_data == []
  2709.       for effect_data in battler.sv.effect_data do set_effects(battler, effect_data) end
  2710.     end
  2711.   end
  2712.   #--------------------------------------------------------------------------
  2713.   # ● ダメージ画像の更新
  2714.   #--------------------------------------------------------------------------
  2715.   def update_damage
  2716.     for i in [email protected]
  2717.       next if @damage[i] == nil
  2718.       @damage[i].update if @damage[i] != nil
  2719.       next if !@damage[i].action_end
  2720.       @damage[i].dispose
  2721.       @damage[i] = nil
  2722.     end
  2723.   end
  2724.   #--------------------------------------------------------------------------
  2725.   # ● ピクチャアクションの更新
  2726.   #--------------------------------------------------------------------------
  2727.   def update_pictures
  2728.     for i in [email protected]
  2729.       next if @pictures[i] == nil
  2730.       @pictures[i].update if @pictures[i] != nil
  2731.       next if !@pictures[i].action_end
  2732.       @pictures[i].dispose
  2733.       @pictures[i] = nil
  2734.     end
  2735.   end
  2736.   #--------------------------------------------------------------------------
  2737.   # ● 周期ピクチャの更新
  2738.   #--------------------------------------------------------------------------
  2739.   def update_back_pic
  2740.     set_back_pic if $sv_camera.program_picture != []
  2741.     for i in 0...@back_pic.size
  2742.       next if @back_pic[i] == nil
  2743.       @back_pic[i].update if @back_pic[i] != nil
  2744.       next if !@back_pic[i].action_end
  2745.       @back_pic[i].dispose
  2746.       @back_pic[i] = nil
  2747.     end
  2748.   end
  2749.   #--------------------------------------------------------------------------
  2750.   # ● 武器アクションの更新
  2751.   #--------------------------------------------------------------------------
  2752.   def update_weapons
  2753.     for i in [email protected]
  2754.       next if @weapons[i] == nil
  2755.       @weapons[i].update if @weapons[i] != nil
  2756.       next if !@weapons[i].action_end
  2757.       @weapons[i].dispose
  2758.       @weapons[i] = nil
  2759.     end
  2760.   end
  2761.   #--------------------------------------------------------------------------
  2762.   # ● ダメージ実行
  2763.   #--------------------------------------------------------------------------
  2764.   def set_damage_pop(target)
  2765.     for i in [email protected]
  2766.       next if @damage[i] != nil
  2767.       return @damage[i] = Sprite_Damage.new(@viewport, target)
  2768.     end
  2769.     @damage.push(Sprite_Damage.new(@viewport, target))
  2770.   end
  2771.   #--------------------------------------------------------------------------
  2772.   # ● 周期ピクチャ実行
  2773.   #--------------------------------------------------------------------------
  2774.   def set_back_pic
  2775.     for data in $sv_camera.program_picture
  2776.       if @back_pic[data[2]] != nil
  2777.         @back_pic[data[2]].dispose
  2778.         @back_pic[data[2]] = nil
  2779.       end
  2780.       @back_pic[data[2]] = Sprite_Back_Picture.new(@viewport, data[2])
  2781.       @back_pic[data[2]].setup(data)
  2782.     end
  2783.     $sv_camera.program_picture = []
  2784.   end
  2785.   #--------------------------------------------------------------------------
  2786.   # ● エフェクト開始
  2787.   #--------------------------------------------------------------------------
  2788.   def set_effects(battler, effect_data)
  2789.     case effect_data[0]
  2790.     when "pic" ; set_pictures(battler, effect_data)
  2791.     when  "wp" ; set_weapons(battler,  true)
  2792.     when "m_a" ; set_weapons(battler, false)
  2793.     end
  2794.   end
  2795.   #--------------------------------------------------------------------------
  2796.   # ● ピクチャアクション実行
  2797.   #--------------------------------------------------------------------------
  2798.   def set_pictures(battler, effect_data)
  2799.     @pictures[effect_data[1]] = Sprite_Battle_Picture.new if @pictures[effect_data[1]] == nil
  2800.     @pictures[effect_data[1]].set(battler)
  2801.   end
  2802.   #--------------------------------------------------------------------------
  2803.   # ● 武器アクション実行
  2804.   #--------------------------------------------------------------------------
  2805.   def set_weapons(battler, weapon_flag, test = true)
  2806.     for i in [email protected]
  2807.       next if @weapons[i] != nil
  2808.       @weapons[i] = Sprite_Weapon.new(@viewport, i, battler)
  2809.       battler.sv.weapon_index.push(i) if weapon_flag
  2810.       return i
  2811.     end
  2812.     @weapons.push(Sprite_Weapon.new(@viewport, @weapons.size, battler))
  2813.     battler.sv.weapon_index.push(@weapons.size - 1) if weapon_flag
  2814.     return @weapons.size - 1
  2815.   end
  2816.   #--------------------------------------------------------------------------
  2817.   # ● バトラーの武器アクション終了
  2818.   #--------------------------------------------------------------------------
  2819.   def weapon_end(battler)
  2820.     battler.sv.weapon_end = false
  2821.     for index in battler.sv.weapon_index
  2822.       weapon_index = battler.sv.weapon_index.shift
  2823.       @weapons[weapon_index].dispose if @weapons[weapon_index] != nil
  2824.       @weapons[weapon_index] = nil
  2825.     end
  2826.     battler.sv.weapon_index.compact!
  2827.   end  
  2828.   #--------------------------------------------------------------------------
  2829.   # ● ヒット時の戦闘アニメ実行
  2830.   #--------------------------------------------------------------------------
  2831.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  2832.     weapon = @weapons[weapon_index]
  2833.     for target in hit_targets
  2834.       next @weapons[@hit_index].timing_battler_set(target) if @hit_index != nil
  2835.       @hit_index = set_weapons(battler, false, false)
  2836.       @weapons[@hit_index].set_hit_animation(weapon.hit_position, weapon.hit_anime_id, target)
  2837.     end
  2838.     @hit_index = nil
  2839.     if !weapon.through && !miss
  2840.       @weapons[weapon_index].dispose
  2841.       @weapons[weapon_index] = nil
  2842.     else
  2843.       @weapons[weapon_index].through_change
  2844.     end
  2845.   end
  2846.   #--------------------------------------------------------------------------
  2847.   # ● サイドビューデータの初期化
  2848.   #--------------------------------------------------------------------------
  2849.   def reset_sideview
  2850.     $sv_camera.reset
  2851.     for member in $game_troop.members + $game_party.battle_members do member.sv.reset end
  2852.   end  
  2853.   #--------------------------------------------------------------------------
  2854.   # ● 解放
  2855.   #--------------------------------------------------------------------------
  2856.   def dispose
  2857.     dispose_effects(@weapons)
  2858.     dispose_effects(@pictures)
  2859.     dispose_effects(@back_pic)
  2860.     dispose_effects(@damage)
  2861.     reset_sideview
  2862.   end
  2863.   #--------------------------------------------------------------------------
  2864.   # ● エフェクト画像の解放
  2865.   #--------------------------------------------------------------------------
  2866.   def dispose_effects(effects)
  2867.     for i in 0...effects.size
  2868.       effects[i].dispose if effects[i] != nil
  2869.       effects[i] = nil
  2870.     end
  2871.   end
  2872. end


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

  3563. #==============================================================================
  3564. # ■ Scene_Battle
  3565. #------------------------------------------------------------------------------
  3566. #  バトル画面の処理を行うクラスです。
  3567. #==============================================================================
  3568. class Scene_Battle < Scene_Base
  3569.   #--------------------------------------------------------------------------
  3570.   # ● フレーム更新(基本)
  3571.   #--------------------------------------------------------------------------
  3572.   alias update_basic_scene_battle_n03 update_basic
  3573.   def update_basic
  3574.     update_basic_scene_battle_n03
  3575.     $sv_camera.update
  3576.     $sv_camera.wait = N03::TURN_END_WAIT + 1 if $sv_camera.win_wait
  3577.     camera_wait
  3578.   end
  3579.   #--------------------------------------------------------------------------
  3580.   # ● カメラウェイト
  3581.   #--------------------------------------------------------------------------
  3582.   def camera_wait
  3583.     process_event if $sv_camera.event
  3584.     $sv_camera.event = false if $sv_camera.event
  3585.     while $sv_camera.wait != 0
  3586.       Graphics.update
  3587.       Input.update
  3588.       update_all_windows
  3589.       $game_timer.update
  3590.       $game_troop.update
  3591.       $sv_camera.update
  3592.       @spriteset.update
  3593.       update_info_viewport
  3594.       update_message_open
  3595.       $sv_camera.wait -= 1 if $sv_camera.wait > 0
  3596.       $sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
  3597.       BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
  3598.     end
  3599.   end
  3600.   #--------------------------------------------------------------------------
  3601.   # ● カメラウェイトのセット
  3602.   #--------------------------------------------------------------------------
  3603.   def set_camera_wait(time)
  3604.     $sv_camera.wait = time
  3605.     camera_wait
  3606.   end  
  3607.   #--------------------------------------------------------------------------
  3608.   # ● エフェクト実行が終わるまでウェイト ★再定義
  3609.   #--------------------------------------------------------------------------
  3610.   def wait_for_effect
  3611.   end
  3612.   #--------------------------------------------------------------------------
  3613.   # ● ターン開始
  3614.   #--------------------------------------------------------------------------
  3615.   alias turn_start_scene_battle_n03 turn_start
  3616.   def turn_start
  3617.     turn_start_scene_battle_n03
  3618.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始後"].dup)
  3619.   end
  3620.   #--------------------------------------------------------------------------
  3621.   # ● ターン終了
  3622.   #--------------------------------------------------------------------------
  3623.   alias turn_end_scene_battle_n03 turn_end
  3624.   def turn_end
  3625.     turn_end_scene_battle_n03
  3626.     for member in $game_troop.members + $game_party.battle_members
  3627.       N03.set_damage(member, member.sv.result_damage[0],member.sv.result_damage[1])
  3628.       member.sv.result_damage = [0,0]
  3629.       @spriteset.set_damage_pop(member) if member.result.hp_damage != 0 or member.result.mp_damage != 0
  3630.     end
  3631.     set_camera_wait(N03::TURN_END_WAIT)
  3632.     N03.camera(nil, N03::BATTLE_CAMERA["ターン開始前"].dup) if $game_party.inputable?
  3633.     @log_window.clear
  3634.   end
  3635.   #--------------------------------------------------------------------------
  3636.   # ● スキル/アイテムの使用 ★再定義
  3637.   #--------------------------------------------------------------------------
  3638.   def use_item
  3639.     item = @subject.current_action.item
  3640.     display_item(item)
  3641.     @subject.use_item(item)
  3642.     refresh_status
  3643.     @targets = @subject.current_action.make_targets.compact
  3644.     @targets = [@subject] if @targets.size == 0
  3645.     set_substitute(item)
  3646.     for time in item.repeats.times do play_sideview(@targets, item) end
  3647.     end_reaction(item)
  3648.     display_end_item
  3649.   end
  3650.   #--------------------------------------------------------------------------
  3651.   # ● スキル/アイテム名の表示
  3652.   #--------------------------------------------------------------------------
  3653.   def display_item(item)
  3654.     return @log_window.display_use_item(@subject, item) if N03::BATTLE_LOG
  3655.     @log_window.off
  3656.     @skill_name_window = Window_Skill_name.new(item.name) unless N03::NO_DISPLAY_SKILL_ID.include?(item.id) && item.is_a?(RPG::Skill)
  3657.   end  
  3658.   #--------------------------------------------------------------------------
  3659.   # ● スキル/アイテム名の表示終了
  3660.   #--------------------------------------------------------------------------
  3661.   def display_end_item
  3662.     @skill_name_window.dispose if @skill_name_window != nil
  3663.     @skill_name_window = nil
  3664.     set_camera_wait(N03::ACTION_END_WAIT) if @subject.sv.derivation_skill_id == 0
  3665.     @log_window.clear if N03::BATTLE_LOG
  3666.   end  
  3667.   #--------------------------------------------------------------------------
  3668.   # ● 反撃/魔法反射/身代わり処理
  3669.   #--------------------------------------------------------------------------
  3670.   def end_reaction(item)
  3671.     end_substitute if @substitute != nil
  3672.     set_reflection(item) if @reflection_data != nil
  3673.     set_counter_attack if @counter_attacker != nil
  3674.   end  
  3675.   #--------------------------------------------------------------------------
  3676.   # ● 反撃の発動 ★再定義
  3677.   #--------------------------------------------------------------------------
  3678.   def invoke_counter_attack(target, item)
  3679.     return if @subject.sv.counter_id != 0
  3680.     @counter_attacker = [] if @counter_attacker == nil
  3681.     return apply_item_effects(apply_substitute(target, item), item) if !target.movable?
  3682.     @log_window.add_text(sprintf(Vocab::CounterAttack, target.name)) if N03::BATTLE_LOG
  3683.     target.sv.counter_id = target.sv.counter_skill_id
  3684.     @counter_attacker.push(target)
  3685.   end
  3686.   #--------------------------------------------------------------------------
  3687.   # ● 魔法反射の発動 ★再定義
  3688.   #--------------------------------------------------------------------------
  3689.   def invoke_magic_reflection(target, item)
  3690.     return if @subject.sv.reflection_id != 0
  3691.     @log_window.add_text(sprintf(Vocab::MagicReflection, target.name)) if N03::BATTLE_LOG
  3692.     target.sv.reflection_id = target.sv.reflection_anime_id
  3693.   end
  3694.   #--------------------------------------------------------------------------
  3695.   # ● 身代わりの適用 ★再定義
  3696.   #--------------------------------------------------------------------------
  3697.   def apply_substitute(target, item)
  3698.     return target if @substitute == nil
  3699.     return target if !check_substitute(target, item)
  3700.     return @substitute
  3701.   end
  3702.   #--------------------------------------------------------------------------
  3703.   # ● 身代わりセット
  3704.   #--------------------------------------------------------------------------
  3705.   def set_substitute(item)
  3706.     @substitute = N03.get_enemy_unit(@subject).substitute_battler
  3707.     return if @substitute == nil
  3708.     s_targets = []
  3709.     for i in [email protected]
  3710.       next if @targets[i] == @substitute
  3711.       next if !check_substitute(@targets[i], item)
  3712.       @log_window.add_text(sprintf(Vocab::Substitute, @substitute.name, @targets[i].name))
  3713.       @targets[i].sv.start_action(@targets[i].sv.substitute_receiver_start_action)
  3714.       s_targets.push(@targets[i])
  3715.       @targets[i] = @substitute
  3716.     end
  3717.     return @substitute = nil if s_targets == []
  3718.     @substitute.sv.set_target(s_targets)
  3719.     @substitute.sv.start_action(@substitute.sv.substitute_start_action)
  3720.   end  
  3721.   #--------------------------------------------------------------------------
  3722.   # ● 身代わり終了
  3723.   #--------------------------------------------------------------------------
  3724.   def end_substitute
  3725.     for member in @substitute.sv.target_battler
  3726.       member.sv.start_action(member.sv.substitute_receiver_end_action)
  3727.     end  
  3728.     @substitute.sv.start_action(@substitute.sv.substitute_end_action)
  3729.     @substitute = nil
  3730.   end
  3731.   #--------------------------------------------------------------------------
  3732.   # ● 反撃
  3733.   #--------------------------------------------------------------------------
  3734.   def set_counter_attack
  3735.     pre_subject = @subject
  3736.     for attacker in @counter_attacker
  3737.       @subject = attacker
  3738.       item = $data_skills[attacker.sv.counter_skill_id]
  3739.       play_sideview([pre_subject], item)
  3740.     end
  3741.     # 同一カウンター者を考慮してカウンターIDの初期化はアクション後に実行
  3742.     for attacker in @counter_attacker do attacker.sv.counter_id = 0 end
  3743.     @subject = pre_subject
  3744.     @counter_attacker = nil
  3745.   end
  3746.   #--------------------------------------------------------------------------
  3747.   # ● 魔法反射
  3748.   #--------------------------------------------------------------------------
  3749.   def set_reflection(item)
  3750.     @log_window.back_to(1)
  3751.     for data in @reflection_data
  3752.       @subject.sv.damage_action(@subject, item)
  3753.       N03.set_damage_anime_data([@subject], @subject, data)
  3754.       apply_item_effects(@subject, item)
  3755.       @spriteset.set_damage_pop(@subject)
  3756.     end
  3757.     set_camera_wait(N03.get_anime_time(@reflection_data[0][0]))
  3758.     @reflection_data = nil
  3759.   end
  3760.   #--------------------------------------------------------------------------
  3761.   # ● サイドビューアクション実行
  3762.   #--------------------------------------------------------------------------
  3763.   def play_sideview(targets, item)
  3764.     @subject.sv.set_target(targets)
  3765.     return if @subject.sv.attack_action(item) == nil
  3766.     return if [email protected]?
  3767.     return if item.scope != 9 && item.scope != 10 && !N03.targets_alive?(targets)
  3768.     @subject.sv.start_action(@subject.sv.attack_action(item))
  3769.     @subject.sv.unshift_action(@subject.sv.flash_action) if @subject.flash_flg
  3770.     @subject.sv.active = true
  3771.     @subject.sv.command_action = false
  3772.     loop do
  3773.       update_basic
  3774.       data = @subject.sv.play_data
  3775.       @targets = N03.s_targets(@subject) if data[0] == "second_targets_set"
  3776.       N03.targets_set(@subject)          if data[0] == "targets_set"
  3777.       @immortal = N03.immortaling        if data[0] == "no_collapse" && !N03.dead_attack?(@subject, item)
  3778.       @immortal = N03.unimmortaling      if data[0] == "collapse"
  3779.       next set_move_anime(item)          if @subject.sv.m_a_data != []
  3780.       set_damage(item)                   if @subject.sv.set_damage
  3781.       break N03.derived_skill(@subject)  if @subject.sv.derivation_skill_id != 0
  3782.       break                              if @subject.sv.action_end or @subject.hidden?
  3783.     end
  3784.     @immortal = N03.unimmortaling        if @immortal
  3785.   end
  3786.   #--------------------------------------------------------------------------
  3787.   # ● ダメージの実行
  3788.   #--------------------------------------------------------------------------
  3789.   def set_damage(item)
  3790.     targets = @targets
  3791.     targets = [@subject.sv.individual_targets[0]] if @subject.sv.individual_targets.size != 0
  3792.     for target in targets do damage_anime(targets.dup, target, item) end
  3793.     @subject.sv.set_damage = false
  3794.     @subject.sv.damage_anime_data = []
  3795.   end
  3796.   #--------------------------------------------------------------------------
  3797.   # ● ダメージ戦闘アニメ処理
  3798.   #--------------------------------------------------------------------------
  3799.   def damage_anime(targets, target, item)
  3800.     @log_window.back_to(1) if @log_window.line_number == 5
  3801.     return if item.scope != 9 && item.scope != 10 && target.dead?
  3802.     @miss = false
  3803.     invoke_item(target,item)
  3804.     if target.result.missed
  3805.       target.sv.miss_action(@subject, item)
  3806.       return @miss = true
  3807.     elsif target.result.evaded or target.sv.counter_id != 0
  3808.       target.sv.evasion_action(@subject, item)
  3809.       return @miss = true
  3810.     elsif target.sv.reflection_id != 0
  3811.       N03.set_damage_anime_data(targets, target, [target.sv.reflection_id, false, false, true])
  3812.       target.sv.reflection_id = 0
  3813.       @reflection_data = [] if @reflection_data == nil
  3814.       return @reflection_data.push([N03.get_attack_anime_id(-3, @subject), false, false, true])
  3815.     end
  3816.     target.sv.damage_action(@subject, item)
  3817.     N03.set_damage(@subject, -target.result.hp_drain, -target.result.mp_drain) if target != @subject
  3818.     @spriteset.set_damage_pop(target)
  3819. #    @spriteset.set_damage_pop(@subject) if target != @subject && @subject.result.hp_damage != 0 or @subject.result.mp_damage != 0
  3820.      @spriteset.set_damage_pop(@subject) if target != @subject && (@subject.result.hp_damage != 0 || @subject.result.mp_damage != 0)  #pannyDD
  3821.     N03.set_damage_anime_data(targets, target, @subject.sv.damage_anime_data) if @subject.sv.damage_anime_data != []
  3822.   end
  3823.   #--------------------------------------------------------------------------
  3824.   # ● 飛ばしアニメ処理
  3825.   #--------------------------------------------------------------------------
  3826.   def set_move_anime(item)
  3827.     for data in @subject.sv.m_a_data
  3828.       @subject.sv.damage_anime_data = data[4]
  3829.       hit_targets = []
  3830.       for target in data[1]
  3831.         damage_anime(data[1], target, item) if data[0]
  3832.         hit_targets.push(target) if !@miss
  3833.       end
  3834.       @miss = false if !data[3]
  3835.       @spriteset.set_hit_animation(@subject, data[2], hit_targets, @miss)
  3836.     end
  3837.     @subject.sv.set_damage = false
  3838.     @subject.sv.m_a_data = []
  3839.   end
  3840. end

  3841. #==============================================================================
  3842. # ■ DataManager
  3843. #------------------------------------------------------------------------------
  3844. #  データベースとゲームオブジェクトを管理するモジュールです。
  3845. #==============================================================================
  3846. module DataManager
  3847.   #--------------------------------------------------------------------------
  3848.   # ● 各種ゲームオブジェクトの作成 ★再定義
  3849.   #--------------------------------------------------------------------------
  3850.   def self.create_game_objects
  3851.     $game_temp          = Game_Temp.new
  3852.     $game_system        = Game_System.new
  3853.     $game_timer         = Game_Timer.new
  3854.     $game_message       = Game_Message.new
  3855.     $game_switches      = Game_Switches.new
  3856.     $game_variables     = Game_Variables.new
  3857.     $game_self_switches = Game_SelfSwitches.new
  3858.     $game_actors        = Game_Actors.new
  3859.     $game_party         = Game_Party.new
  3860.     $game_troop         = Game_Troop.new
  3861.     $game_map           = Game_Map.new
  3862.     $game_player        = Game_Player.new
  3863.     $sv_camera          = Battle_Camera.new
  3864.   end
  3865. end

  3866. #==============================================================================
  3867. # ■ BattleManager
  3868. #------------------------------------------------------------------------------
  3869. #  戦闘の進行を管理するモジュールです。
  3870. #==============================================================================
  3871. module BattleManager
  3872.   #--------------------------------------------------------------------------
  3873.   # ● エンカウント時の処理 ★再定義
  3874.   #--------------------------------------------------------------------------
  3875.   def self.on_encounter
  3876.     @preemptive = (rand < rate_preemptive)
  3877.     @surprise = (rand < rate_surprise && !@preemptive)
  3878.     $sv_camera.mirror = @surprise if N03::BACK_ATTACK
  3879.   end
  3880.   #--------------------------------------------------------------------------
  3881.   # ● 勝利の処理 ★再定義
  3882.   #--------------------------------------------------------------------------
  3883.   def self.process_victory
  3884.     $sv_camera.win_wait = true
  3885.     #execute_battle_cry(1, nil, nil)# 胜利语音
  3886.   end  
  3887.   #--------------------------------------------------------------------------
  3888.   # ● 勝利
  3889.   #--------------------------------------------------------------------------
  3890.   def self.victory
  3891.     $sv_camera.win_wait = false
  3892.     N03.camera(nil, N03::BATTLE_CAMERA["戦闘終了時"].dup)
  3893.     for member in $game_party.members do member.sv.start_action(member.sv.win) if member.movable? end
  3894.     play_battle_end_me
  3895.     replay_bgm_and_bgs
  3896.     $game_message.add(sprintf(Vocab::Victory, $game_party.name))
  3897.     display_exp
  3898.     gain_gold
  3899.     gain_drop_items
  3900.     gain_exp
  3901.     SceneManager.return
  3902.     battle_end(0)
  3903.     return true
  3904.   end
  3905.   #--------------------------------------------------------------------------
  3906.   # ● 逃走の処理 ★再定義
  3907.   #--------------------------------------------------------------------------
  3908.   def self.process_escape
  3909.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  3910.     success = @preemptive ? true : (rand < @escape_ratio)
  3911.     Sound.play_escape
  3912.     if success
  3913.       process_abort
  3914.       for member in $game_party.members do member.sv.start_action(member.sv.escape) if member.movable? end
  3915.     else
  3916.       @escape_ratio += 0.1
  3917.       $game_message.add('\.' + Vocab::EscapeFailure)
  3918.       $game_party.clear_actions
  3919.       for member in $game_party.members do member.sv.start_action(member.sv.escape_ng) if member.movable? end
  3920.     end
  3921.     wait_for_message
  3922.     return success
  3923.   end
  3924.   #--------------------------------------------------------------------------
  3925.   # ● 次のコマンド入力へ ★再定義
  3926.   #--------------------------------------------------------------------------
  3927.   def self.next_command
  3928.     begin
  3929.       if !actor || !actor.next_command
  3930.         $game_party.battle_members[@actor_index].sv.command_action = true
  3931.         @actor_index += 1
  3932.         if @actor_index >= $game_party.members.size
  3933.           for member in $game_party.battle_members.reverse
  3934.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3935.           end
  3936.           return false
  3937.         end
  3938.       end
  3939.     end until actor.inputable?
  3940.     actor.sv.start_action(actor.sv.command_b) if actor != nil && actor.inputable?
  3941.     if pre_actor
  3942.       pre_actor.sv.start_action(pre_actor.sv.command_a) if pre_actor != nil && pre_actor.inputable?
  3943.     end
  3944.     return true
  3945.   end
  3946.   #--------------------------------------------------------------------------
  3947.   # ● 前のコマンド入力へ ★再定義
  3948.   #--------------------------------------------------------------------------
  3949.   def self.prior_command
  3950.     begin
  3951.       if !actor || !actor.prior_command
  3952.         $game_party.battle_members[@actor_index].sv.command_action = false
  3953.         @actor_index -= 1
  3954.         if @actor_index < 0
  3955.           for member in $game_party.battle_members
  3956.             break member.sv.start_action(member.sv.command_a) if member.inputable?
  3957.           end
  3958.           return false
  3959.         end
  3960.       end
  3961.     end until actor.inputable?
  3962.     actor.make_actions if actor.inputable?
  3963.     actor.sv.start_action(actor.sv.command_b) if actor.inputable?
  3964.     after_actor.sv.start_action(after_actor.sv.command_a) if after_actor != nil && after_actor.inputable?
  3965.     return true
  3966.   end
  3967.   #--------------------------------------------------------------------------
  3968.   # ● コマンド入力前のアクターを取得
  3969.   #--------------------------------------------------------------------------
  3970.   def self.pre_actor
  3971.     return if @actor_index == 0
  3972.     $game_party.members[@actor_index - 1]
  3973.   end
  3974.   #--------------------------------------------------------------------------
  3975.   # ● コマンド入力後のアクターを取得
  3976.   #--------------------------------------------------------------------------
  3977.   def self.after_actor
  3978.     $game_party.members[@actor_index + 1]
  3979.   end
  3980.   #--------------------------------------------------------------------------
  3981.   # ● 戦闘行動者を前に追加
  3982.   #--------------------------------------------------------------------------
  3983.   def self.unshift_action_battlers(battler)
  3984.     @action_battlers.unshift(battler)
  3985.   end
  3986. end  

  3987. #==============================================================================
  3988. # ■ Game_Battler
  3989. #------------------------------------------------------------------------------
  3990. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。
  3991. #==============================================================================
  3992. class Game_Battler < Game_BattlerBase
  3993.   #--------------------------------------------------------------------------
  3994.   # ● 公開インスタンス変数
  3995.   #--------------------------------------------------------------------------
  3996.   attr_reader   :sv                     # サイドビューデータ
  3997.   attr_accessor :flash_flg              # 閃きフラグ
  3998.   #--------------------------------------------------------------------------
  3999.   # ● オブジェクト初期化
  4000.   #--------------------------------------------------------------------------
  4001.   alias initialize_game_battler_n03 initialize
  4002.   def initialize
  4003.     initialize_game_battler_n03
  4004.     @sv = SideView.new(self)
  4005.   end
  4006.   #--------------------------------------------------------------------------
  4007.   # ● 現在の戦闘行動を除去
  4008.   #--------------------------------------------------------------------------
  4009.   alias remove_current_action_game_battler_n03 remove_current_action
  4010.   def remove_current_action
  4011.     return @sv.derivation_skill_id = 0 if @sv.derivation_skill_id != 0
  4012.     remove_current_action_game_battler_n03
  4013.   end
  4014.   #--------------------------------------------------------------------------
  4015.   # ● ターン終了処理
  4016.   #--------------------------------------------------------------------------
  4017.   alias on_turn_end_game_battler_n03 on_turn_end
  4018.   def on_turn_end
  4019.     on_turn_end_game_battler_n03
  4020.     @sv.add_state = []
  4021.     @sv.result_damage = [@result.hp_damage, @result.mp_damage]
  4022.   end
  4023.   #--------------------------------------------------------------------------
  4024.   # ● パラメータ条件比較 data = [種別, 数値, 判別]
  4025.   #--------------------------------------------------------------------------
  4026.   def comparison_parameter(data)
  4027.     return true if data[0][0] == 0
  4028.     kind = data[0]
  4029.     num = data[1]
  4030.     select = data[2]
  4031.     case kind
  4032.     when  1 ; par = level
  4033.     when  2 ; par = mhp
  4034.     when  3 ; par = mmp
  4035.     when  4 ; par = hp
  4036.     when  5 ; par = mp
  4037.     when  6 ; par = tp
  4038.     when  7 ; par = atk
  4039.     when  8 ; par = self.def
  4040.     when  9 ; par = mat
  4041.     when 10 ; par = mdf
  4042.     when 11 ; par = agi
  4043.     when 12 ; par = luk
  4044.     end
  4045.     if num < 0
  4046.       case kind
  4047.       when  4 ; num = mhp * num / 100
  4048.       when  5 ; num = mmp * num / 100
  4049.       when  6 ; num = max_tp * num / 100
  4050.       end
  4051.       num = num.abs
  4052.     end  
  4053.     case select
  4054.     when  0 ; return par == num
  4055.     when  1 ; return par < num
  4056.     when  2 ; return par > num
  4057.     end
  4058.   end
  4059.   #--------------------------------------------------------------------------
  4060.   # ● 装備条件比較 data = [装備種別, タイプID]
  4061.   #--------------------------------------------------------------------------
  4062.   def comparison_equip(data)
  4063.     kind = data[0]
  4064.     items = weapons if kind == 0
  4065.     items = armors  if kind == 1
  4066.     for item in items
  4067.       for id in data[1]
  4068.         return true if id > 0 && item.is_a?(RPG::Weapon) && item == $data_weapons[id.abs]
  4069.         return true if id > 0 && item.is_a?(RPG::Armor) && item == $data_armors[id.abs]
  4070.         return true if id < 0 && item.is_a?(RPG::Weapon) && item.wtype_id == id.abs
  4071.         return true if id < 0 && item.is_a?(RPG::Armor) && item.stype_id == id.abs
  4072.       end
  4073.     end
  4074.     return false
  4075.   end
  4076.   
  4077. end  
  4078. #==============================================================================
  4079. # ■ Game_Actor
  4080. #------------------------------------------------------------------------------
  4081. #  アクターを扱うクラスです。
  4082. #==============================================================================
  4083. class Game_Actor < Game_Battler
  4084.   #--------------------------------------------------------------------------
  4085.   # ● 公開インスタンス変数
  4086.   #--------------------------------------------------------------------------
  4087.   attr_reader :actor_id                    # ID
  4088.   #--------------------------------------------------------------------------
  4089.   # ● ID
  4090.   #--------------------------------------------------------------------------
  4091.   def id
  4092.     return @actor_id
  4093.   end
  4094.   #--------------------------------------------------------------------------
  4095.   # ● スプライトを使うか? ★再定義
  4096.   #--------------------------------------------------------------------------
  4097.   def use_sprite?
  4098.     return true
  4099.   end
  4100.   #--------------------------------------------------------------------------
  4101.   # ● ダメージ効果の実行 ★再定義
  4102.   #--------------------------------------------------------------------------
  4103.   def perform_damage_effect
  4104.     return if !N03::ACTOR_DAMAGE
  4105.     $game_troop.screen.start_shake(5, 5, 10)
  4106.     @sprite_effect_type = :blink
  4107.     Sound.play_actor_damage
  4108.   end
  4109.   
  4110. end

  4111. #==============================================================================
  4112. # ■ Game_Enemy
  4113. #------------------------------------------------------------------------------
  4114. #  敵キャラを扱うクラスです。
  4115. #==============================================================================
  4116. class Game_Enemy < Game_Battler
  4117.   #--------------------------------------------------------------------------
  4118.   # ● 公開インスタンス変数
  4119.   #--------------------------------------------------------------------------
  4120.   attr_reader :enemy_id                    # ID
  4121.   #--------------------------------------------------------------------------
  4122.   # ● ID
  4123.   #--------------------------------------------------------------------------
  4124.   def id
  4125.     return @enemy_id
  4126.   end
  4127.   #--------------------------------------------------------------------------
  4128.   # ● レベル
  4129.   #--------------------------------------------------------------------------
  4130.   def level
  4131.     return @sv.level
  4132.   end
  4133.   #--------------------------------------------------------------------------
  4134.   # ● ダメージ効果の実行 ★再定義
  4135.   #--------------------------------------------------------------------------
  4136.   def perform_damage_effect
  4137.     return if !N03::ENEMY_DAMAGE
  4138.     @sprite_effect_type = :blink
  4139.     Sound.play_enemy_damage
  4140.   end
  4141.   #--------------------------------------------------------------------------
  4142.   # ● 武器
  4143.   #--------------------------------------------------------------------------
  4144.   def weapons
  4145.     weapon1 = $data_weapons[@sv.enemy_weapon1_id]
  4146.     weapon2 = $data_weapons[@sv.enemy_weapon2_id]
  4147.     return [weapon1, weapon2]
  4148.   end
  4149.   #--------------------------------------------------------------------------
  4150.   # ● 防具
  4151.   #--------------------------------------------------------------------------
  4152.   def armors
  4153.     return [$data_armors[@sv.enemy_shield_id]]
  4154.   end
  4155.   #--------------------------------------------------------------------------
  4156.   # ● 二刀流の判定
  4157.   #--------------------------------------------------------------------------
  4158.   def dual_wield?
  4159.     return $data_weapons[@sv.enemy_weapon2_id] != nil
  4160.   end
  4161.   #--------------------------------------------------------------------------
  4162.   # ● バトラー画像変更
  4163.   #--------------------------------------------------------------------------
  4164.   def graphics_change(battler_name)
  4165.     @battler_name = battler_name
  4166.   end
  4167.   #--------------------------------------------------------------------------
  4168.   # ● 通常攻撃 アニメーション ID の取得
  4169.   #--------------------------------------------------------------------------
  4170.   def atk_animation_id1
  4171.     return weapons[0].animation_id if weapons[0]
  4172.     return weapons[1] ? 0 : 1
  4173.   end
  4174.   #--------------------------------------------------------------------------
  4175.   # ● 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  4176.   #--------------------------------------------------------------------------
  4177.   def atk_animation_id2
  4178.     return weapons[1] ? weapons[1].animation_id : 0
  4179.   end
  4180. end

  4181. #==============================================================================
  4182. # ■ Sprite_Base
  4183. #------------------------------------------------------------------------------
  4184. #  アニメーションの表示処理を追加したスプライトのクラスです。
  4185. #==============================================================================
  4186. class Sprite_Base < Sprite
  4187.   #--------------------------------------------------------------------------
  4188.   # ● アニメーションの座標更新 (ホーミングあり)
  4189.   #--------------------------------------------------------------------------
  4190.   def update_animation_position_horming
  4191.     return if @action_end_cancel
  4192.     ani_ox_set if @horming
  4193.     camera_zoom = $sv_camera.zoom
  4194.     camera_zoom = 1 if @move_anime
  4195.     kind = 1
  4196.     kind = -1 if @ani_mirror && !@anime_no_mirror
  4197.     cell_data = @animation.frames[@animation.frame_max - (@ani_duration + @ani_rate - 1) / @ani_rate].cell_data
  4198.     for i in 0..15
  4199.       @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
  4200.       @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
  4201.     end
  4202.   end
  4203.   #--------------------------------------------------------------------------
  4204.   # ● アニメーション元の座標をセット
  4205.   #--------------------------------------------------------------------------
  4206.   def ani_ox_set
  4207.     if !SceneManager.scene_is?(Scene_Battle)
  4208.       @real_x = x
  4209.       @real_y = y
  4210.     end
  4211.     @ani_ox = @real_x - ox + width / 2
  4212.     @ani_oy = @real_y - oy + height / 2
  4213.     @ani_oy -= height / 2 if @animation.position == 0
  4214.     @ani_oy += height / 2 if @animation.position == 2
  4215.   end
  4216.   #--------------------------------------------------------------------------
  4217.   # ● アニメーションの更新
  4218.   #--------------------------------------------------------------------------
  4219.   alias update_animation_sprite_base_n03 update_animation
  4220.   def update_animation
  4221.     update_animation_position_horming if animation? && SceneManager.scene_is?(Scene_Battle) && @animation.position != 3
  4222.     update_animation_sprite_base_n03
  4223.   end
  4224.   #--------------------------------------------------------------------------
  4225.   # ● アニメーションの原点設定 ★再定義
  4226.   #--------------------------------------------------------------------------
  4227.   def set_animation_origin
  4228.     return ani_ox_set if @animation.position != 3
  4229.     if viewport == nil
  4230.       @ani_ox = Graphics.width / 2
  4231.       @ani_oy = Graphics.height / 2
  4232.     else
  4233.       @ani_ox = viewport.rect.width / 2
  4234.       @ani_oy = viewport.rect.height / 2
  4235.     end
  4236.   end
  4237.   #--------------------------------------------------------------------------
  4238.   # ● アニメーションスプライトの設定 ★再定義
  4239.   #--------------------------------------------------------------------------
  4240.   def animation_set_sprites(frame)
  4241.     camera_zoom = 1
  4242.     camera_zoom = $sv_camera.zoom if @anime_camera_zoom && @animation.position != 3 && SceneManager.scene_is?(Scene_Battle)
  4243.     camera_x = $sv_camera.x
  4244.     camera_y = $sv_camera.y
  4245.     camera_x = camera_y = 0 if @animation.position == 3 or !SceneManager.scene_is?(Scene_Battle)
  4246.     plus_z = 5
  4247.     plus_z = 1000 if @animation.position == 3
  4248.     plus_z = -17 if @plus_z != nil && @plus_z == false
  4249.     plus_z = -self.z + 10 if @plus_z != nil && @plus_z == false && @animation.position == 3
  4250.     cell_data = frame.cell_data
  4251.     @ani_sprites.each_with_index do |sprite, i|
  4252.       next unless sprite
  4253.       pattern = cell_data[i, 0]
  4254.       if !pattern || pattern < 0
  4255.         sprite.visible = false
  4256.         next
  4257.       end
  4258.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  4259.       sprite.visible = true
  4260.       sprite.src_rect.set(pattern % 5 * 192,
  4261.         pattern % 100 / 5 * 192, 192, 192)
  4262.       if @ani_mirror && !@anime_no_mirror
  4263.         sprite.x = (@ani_ox - cell_data[i, 1] - camera_x) * camera_zoom
  4264.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4265.         sprite.angle = (360 - cell_data[i, 4])
  4266.         sprite.mirror = (cell_data[i, 5] == 0)
  4267.       else
  4268.         sprite.x = (@ani_ox + cell_data[i, 1] - camera_x) * camera_zoom
  4269.         sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
  4270.         sprite.angle = cell_data[i, 4]
  4271.         sprite.mirror = (cell_data[i, 5] == 1)
  4272.       end
  4273.       sprite.z = self.z + plus_z + i
  4274.       sprite.ox = 96
  4275.       sprite.oy = 96
  4276.       sprite.zoom_x = cell_data[i, 3] * camera_zoom / 100.0
  4277.       sprite.zoom_y = cell_data[i, 3] * camera_zoom/ 100.0
  4278.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4279.       sprite.blend_type = cell_data[i, 7]
  4280.     end
  4281.   end
  4282.   #--------------------------------------------------------------------------
  4283.   # ● 子スプライトフラグ
  4284.   #--------------------------------------------------------------------------
  4285.   def set(battler, horming, camera_zoom, no_mirror)
  4286.     @battler = battler
  4287.     @next = true
  4288.     self.bitmap = Bitmap.new(@battler.sv.cw, @battler.sv.ch)
  4289.     self.ox = bitmap.width / 2
  4290.     self.oy = bitmap.height
  4291.     @horming = horming
  4292.     @anime_camera_zoom = camera_zoom
  4293.     @anime_no_mirror = no_mirror
  4294.     @battler.sv.reset_anime_data
  4295.   end  
  4296.   #--------------------------------------------------------------------------
  4297.   # ● 子スプライト座標セット
  4298.   #--------------------------------------------------------------------------
  4299.   def set_position(z, zoom_x, zoom_y, real_x, real_y)
  4300.     self.z = z
  4301.     self.zoom_x = zoom_x
  4302.     self.zoom_y = zoom_y
  4303.     @real_x = real_x
  4304.     @real_y = real_y
  4305.   end
  4306.   #--------------------------------------------------------------------------
  4307.   # ● 他スプライトへのタイミング処理
  4308.   #--------------------------------------------------------------------------
  4309.   def other_process_timing(timing)
  4310.     se_flag = true
  4311.     se_flag = @se_flag if @se_flag != nil
  4312.     @battler.sv.timing.push([se_flag, timing.dup])
  4313.   end
  4314.   #--------------------------------------------------------------------------
  4315.   # ● 他バトラーへのタイミング処理
  4316.   #--------------------------------------------------------------------------
  4317.   def target_battler_process_timing(timing)
  4318.     for target in @timing_targets
  4319.       target.sv.timing.push([false, timing.dup])
  4320.     end  
  4321.   end
  4322.   #--------------------------------------------------------------------------
  4323.   # ● SE とフラッシュのタイミング処理
  4324.   #--------------------------------------------------------------------------
  4325.   alias animation_process_timing_sprite_base_n03 animation_process_timing
  4326.   def animation_process_timing(timing)
  4327.     target_battler_process_timing(timing) if @timing_targets && @timing_targets != []
  4328.     return other_process_timing(timing) if @next != nil
  4329.     animation_process_timing_sprite_base_n03(timing)
  4330.   end
  4331.   #--------------------------------------------------------------------------
  4332.   # ● アニメーションの解放
  4333.   #--------------------------------------------------------------------------
  4334.   alias dispose_animation_sprite_base_n03 dispose_animation
  4335.   def dispose_animation
  4336.     dispose_animation_sprite_base_n03
  4337.   end
  4338. end


  4339. #==============================================================================
  4340. # ■ Sprite_Battler
  4341. #------------------------------------------------------------------------------
  4342. #  バトラー表示用のスプライトです。
  4343. #==============================================================================
  4344. class Sprite_Battler < Sprite_Base
  4345.   #--------------------------------------------------------------------------
  4346.   # ● 公開インスタンス変数 
  4347.   #--------------------------------------------------------------------------
  4348.   attr_accessor   :removing             # パーティ離脱中
  4349.   #--------------------------------------------------------------------------
  4350.   # ● オブジェクト初期化
  4351.   #--------------------------------------------------------------------------
  4352.   alias initialize_sprite_battler_n03 initialize
  4353.   def initialize(viewport, battler = nil)
  4354.     initialize_sprite_battler_n03(viewport, battler)
  4355.     @real_x = @real_y = 0
  4356.     update_bitmap if @battler != nil
  4357.   end
  4358.   #--------------------------------------------------------------------------
  4359.   # ● アニメーションの開始 ★再定義
  4360.   #--------------------------------------------------------------------------
  4361.   def start_animation(animation, mirror = false)
  4362.     return next_animation(animation, mirror) if animation?
  4363.     @animation = animation
  4364.     if @animation
  4365.       @horming = @battler.sv.anime_horming
  4366.       @anime_camera_zoom = @battler.sv.anime_camera_zoom
  4367.       @anime_no_mirror = @battler.sv.anime_no_mirror
  4368.       @timing_targets = @battler.sv.timing_targets
  4369.       @plus_z = @battler.sv.anime_plus_z
  4370.       @battler.sv.reset_anime_data
  4371.       @ani_mirror = mirror
  4372.       set_animation_rate
  4373.       @ani_duration = @animation.frame_max * @ani_rate + 1
  4374.       load_animation_bitmap
  4375.       make_animation_sprites
  4376.       set_animation_origin
  4377.     end
  4378.   end
  4379.   #--------------------------------------------------------------------------
  4380.   # ● 次のアニメを開始
  4381.   #--------------------------------------------------------------------------
  4382.   def next_animation(animation, mirror)
  4383.     @next_anime = [] if @next_anime == nil
  4384.     @next_anime.push(Sprite_Base.new(viewport))
  4385.     @next_anime[@next_anime.size - 1].set(battler, @battler.sv.anime_horming, @battler.sv.anime_camera_zoom, @battler.sv.anime_no_mirror)
  4386.     @next_anime[@next_anime.size - 1].set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y)
  4387.     @next_anime[@next_anime.size - 1].start_animation(animation, mirror)
  4388.   end
  4389.   #--------------------------------------------------------------------------
  4390.   # ● 影グラフィック作成
  4391.   #--------------------------------------------------------------------------
  4392.   def create_shadow
  4393.     reset_shadow
  4394.     return if @battler.sv.shadow == false
  4395.     @shadow = Sprite.new(viewport) if @shadow == nil
  4396.     @shadow.bitmap = Cache.character(@battler.sv.shadow)
  4397.     @shadow.ox = @shadow.bitmap.width / 2
  4398.     @shadow.oy = @shadow.bitmap.height / 2
  4399.   end
  4400.   #--------------------------------------------------------------------------
  4401.   # ● 影グラフィック初期化
  4402.   #--------------------------------------------------------------------------
  4403.   def reset_shadow
  4404.     return if @shadow == nil
  4405.     @shadow.dispose
  4406.     @shadow = nil
  4407.   end  
  4408.   #--------------------------------------------------------------------------
  4409.   # ● 転送元ビットマップの更新 ★再定義
  4410.   #--------------------------------------------------------------------------
  4411.   def update_bitmap
  4412.     update_bitmap_enemy if [email protected]?
  4413.     update_bitmap_actor if @battler.actor?
  4414.     update_src_rect if @battler != nil
  4415.     update_color if @battler != nil
  4416.   end
  4417.   
  4418.   
  4419.   #--------------------------------------------------------------------------
  4420.   # ● 転送元ビットマップ:エネミー
  4421.   #--------------------------------------------------------------------------
  4422.   def update_bitmap_enemy
  4423.     if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
  4424.       @battler_name = @battler.battler_name
  4425.       @battler_hue = @battler.battler_hue
  4426.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4427.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4428.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue)
  4429.       #self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index, @battler_hue)
  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 update_bitmap_actor
  4440.     if @battler.character_name != @battler_name or @battler.character_index != @battler_index
  4441.       @battler_name = @battler.character_name
  4442.       @battler_index = @battler.character_index
  4443.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4444.       @graphic_mirror_flag = @battler.sv.graphic_mirror_flag
  4445.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
  4446.       @battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
  4447.       create_shadow
  4448.       init_visibility
  4449.       @battler_id = @battler.id
  4450.     end
  4451.   end
  4452.   #--------------------------------------------------------------------------
  4453.   # ● 可視状態の初期化 ★再定義
  4454.   #--------------------------------------------------------------------------
  4455.   def init_visibility
  4456.     @battler_visible = @battler.alive?
  4457.     @battler_visible = true if @battler.sv.state(1) != "敵コラプス"
  4458.     @battler_visible = false if @battler.hidden?
  4459.     @battler.sv.opacity = 0 unless @battler_visible
  4460.     self.opacity = 0 unless @battler_visible
  4461.     self.opacity = 255 if @battler_visible
  4462.     @battler.sv.weapon_visible = @battler_visible
  4463.   end
  4464.   #--------------------------------------------------------------------------
  4465.   # ● 転送元矩形の更新
  4466.   #--------------------------------------------------------------------------
  4467.   def update_src_rect
  4468.     return if @battler.sv.collapse
  4469.     if @battler_graphic_file_index != @battler.sv.graphic_file_index
  4470.       @battler_graphic_file_index = @battler.sv.graphic_file_index
  4471.       self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index) if @battler.actor?
  4472.       self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue) if [email protected]?
  4473.       #self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
  4474.       @battler.sv.set_graphics(self.bitmap.width, self.bitmap.height)
  4475.     end
  4476.     anime_off if @battler.sv.anime_off
  4477.     self.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4478.     self.opacity = @battler.sv.opacity if @battler_visible
  4479.     set_process_timing(@battler.sv.timing) if @battler && @battler.sv.timing != []
  4480.   end
  4481.   #--------------------------------------------------------------------------
  4482.   # ● 位置の更新 ★再定義
  4483.   #--------------------------------------------------------------------------
  4484.   def update_position
  4485.     @real_x = @battler.sv.x / 100
  4486.     @real_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust)/ 100
  4487.     self.x = @real_x - $sv_camera.x
  4488.     self.y = @real_y - $sv_camera.y
  4489.     self.z = @battler.sv.z - @battler.sv.c / 100
  4490.     if @battler.sv.h <= 0
  4491.       self.x += $sv_camera.sx / 100
  4492.       self.y += $sv_camera.sy / 100
  4493.     end  
  4494.     self.x *= $sv_camera.zoom
  4495.     self.y *= $sv_camera.zoom
  4496.   end
  4497.   #--------------------------------------------------------------------------
  4498.   # ● 原点の更新 ★再定義
  4499.   #--------------------------------------------------------------------------
  4500.   def update_origin
  4501.     return if !bitmap or @battler.sv.collapse
  4502.     self.ox = @battler.sv.ox
  4503.     self.oy = @battler.sv.oy
  4504.     self.angle = @battler.sv.angle
  4505.     self.zoom_x = @battler.sv.zoom_x * $sv_camera.zoom
  4506.     self.zoom_y = @battler.sv.zoom_y * $sv_camera.zoom
  4507.     self.mirror = @battler.sv.mirror if !@graphic_mirror_flag
  4508.     self.mirror = [email protected] if @graphic_mirror_flag
  4509.   end
  4510.   #--------------------------------------------------------------------------
  4511.   # ● 影グラフィックの更新
  4512.   #--------------------------------------------------------------------------
  4513.   def update_shadow
  4514.     @shadow.visible = @battler.sv.shadow_visible
  4515.     @shadow.opacity = @battler.sv.opacity if @battler.sv.opacity_data[3]
  4516.     @shadow.opacity = self.opacity if [email protected]_data[3]
  4517.     @shadow.x = @real_x - $sv_camera.x
  4518.     @shadow.y = (@battler.sv.y - @battler.sv.c)/ 100 - $sv_camera.y
  4519.     @shadow.z = @battler.sv.z - 10
  4520.     @shadow.zoom_x = $sv_camera.zoom
  4521.     @shadow.zoom_y = $sv_camera.zoom
  4522.     @shadow.x += $sv_camera.sx / 100
  4523.     @shadow.y += $sv_camera.sy / 100
  4524.     @shadow.x *= $sv_camera.zoom
  4525.     @shadow.y *= $sv_camera.zoom
  4526.     @shadow.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4527.   end
  4528.   #--------------------------------------------------------------------------
  4529.   # ● ふきだしの更新
  4530.   #--------------------------------------------------------------------------
  4531.   def update_balloon
  4532.     if @battler.sv.balloon_data == [] && @balloon
  4533.       @balloon_data = []
  4534.       @balloon.dispose
  4535.       return @balloon = nil
  4536.     elsif @battler.sv.balloon_data != [] && @battler.sv.balloon_data != @balloon_data
  4537.       @balloon_data = @battler.sv.balloon_data
  4538.       @balloon = Sprite.new(self.viewport)
  4539.       @balloon.bitmap = Cache.system("Balloon")
  4540.       @balloon.zoom_x = @balloon_data[3]
  4541.       @balloon.zoom_y = @balloon_data[3]
  4542.       @balloon.ox = 32 if @battler.sv.mirror
  4543.       @balloon.oy = 16
  4544.       @balloon_count = 0
  4545.     end
  4546.     return if !@balloon
  4547.     @balloon.opacity = self.opacity
  4548.     @balloon.x = self.x
  4549.     @balloon.y = self.y - @battler.sv.ch * $sv_camera.zoom
  4550.     @balloon.z = self.z + 20
  4551.     @balloon.src_rect.set(32 + @balloon_count / @balloon_data[2] * 32, @balloon_data[1] * 32, 32, 32) if @balloon_count % @balloon_data[2] == 0
  4552.     @balloon.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4553.     @balloon_count += 1
  4554.     @balloon_count = 0 if @balloon_count == @balloon_data[2] * 7
  4555.   end
  4556.   #--------------------------------------------------------------------------
  4557.   # ● 色調変更の更新
  4558.   #--------------------------------------------------------------------------
  4559.   def update_color
  4560.     color_set if @battler.sv.color_set != []
  4561.     return if @color_data == nil
  4562.     @color_data[4] -= 1
  4563.     if @color_data[4] == 0 && @color_data[5] != 0
  4564.       @color_data[4] = @color_data[5]
  4565.       @color_data[5] = 0
  4566.       @color_data[6] = [0,0,0,0]
  4567.     elsif @color_data[4] == 0
  4568.       @remain_color_data = @color_data
  4569.       @battler.sv.color = @color_data.dup
  4570.       return @color_data = nil
  4571.     end  
  4572.     for i in 0..3
  4573.       @color_data[i] = (@color_data[i] * (@color_data[4] - 1) + @color_data[6][i]) / @color_data[4]
  4574.     end  
  4575.     @battler.sv.color = @color_data.dup
  4576.     self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
  4577.   end
  4578.   #--------------------------------------------------------------------------
  4579.   # ● 残像の更新
  4580.   #--------------------------------------------------------------------------
  4581.   def update_mirage
  4582.     if @battler.sv.mirage == [] && @mirages
  4583.       @mirage_data = []
  4584.       for mirage in @mirages do mirage.dispose end
  4585.       return @mirages = nil
  4586.     elsif @battler.sv.mirage != [] && @battler.sv.mirage != @mirage_data
  4587.       @mirage_data = @battler.sv.mirage
  4588.       @mirages = []
  4589.       for i in 0...@mirage_data[1] do @mirages[i] = Sprite.new(self.viewport) end
  4590.       @mirage_count = 0
  4591.     end
  4592.     return if !@mirages
  4593.     @mirage_count += 1
  4594.     @mirage_count = 0 if @mirage_count == @mirage_data[2] * @mirages.size
  4595.     for i in [email protected]
  4596.       mirage_body(@mirages[i], @mirage_data[4]) if @mirage_count == 1 + i * @mirage_data[2]
  4597.     end
  4598.   end
  4599.   #--------------------------------------------------------------------------
  4600.   # ● 残像本体
  4601.   #--------------------------------------------------------------------------
  4602.   def mirage_body(body, opacity)
  4603.     body.bitmap = self.bitmap.dup
  4604.     body.x = self.x
  4605.     body.y = self.y
  4606.     body.ox = self.ox
  4607.     body.oy = self.oy
  4608.     body.z = self.z - 20
  4609.     body.mirror = self.mirror
  4610.     body.angle = self.angle
  4611.     body.opacity = opacity * self.opacity / 255
  4612.     body.zoom_x = self.zoom_x
  4613.     body.zoom_y = self.zoom_y   
  4614.     body.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
  4615.     body.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
  4616.   end   
  4617.   #--------------------------------------------------------------------------
  4618.   # ● 次のアニメを更新
  4619.   #--------------------------------------------------------------------------
  4620.   def update_next_anime
  4621.     return if !@next_anime
  4622.     for anime in @next_anime
  4623.       anime.update
  4624.       anime.set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y) if @horming
  4625.       anime.dispose if !anime.animation?
  4626.       @next_anime.delete(anime) if !anime.animation?
  4627.     end  
  4628.   end
  4629.   #--------------------------------------------------------------------------
  4630.   # ● フレーム更新
  4631.   #--------------------------------------------------------------------------
  4632.   alias update_sprite_battler_n03 update
  4633.   def update
  4634.     @battler.sv.update if @battler
  4635.     update_sprite_battler_n03
  4636.     update_next_anime
  4637.     update_shadow  if @battler && @shadow
  4638.     update_mirage  if @battler
  4639.     update_balloon if @battler
  4640.     update_remove if @battler && @removing && @battler.sv.change_up
  4641.   end
  4642.   #--------------------------------------------------------------------------
  4643.   # ● 戦闘アニメ消去
  4644.   #--------------------------------------------------------------------------
  4645.   def anime_off
  4646.     @battler.sv.anime_off = false
  4647.     dispose_animation
  4648.     for anime in @next_anime do anime.dispose_animation end if @next_anime
  4649.   end
  4650.   #--------------------------------------------------------------------------
  4651.   # ● バトラー入れ替え
  4652.   #--------------------------------------------------------------------------
  4653.   def remove
  4654.     @battler.sv.start_action(@battler.sv.remove_action)
  4655.     $sv_camera.wait = 40
  4656.     @battler.sv.add_action("eval('set_change')")
  4657.     @removing = true
  4658.   end
  4659.   #--------------------------------------------------------------------------
  4660.   # ● バトラー入れ替えの更新
  4661.   #--------------------------------------------------------------------------
  4662.   def update_remove
  4663.     @battler.sv.change_up = false
  4664.     @removing = false
  4665.     @battler = nil
  4666.   end  
  4667.   #--------------------------------------------------------------------------
  4668.   # ● バトラー加入
  4669.   #--------------------------------------------------------------------------
  4670.   def join(join_battler)
  4671.     $sv_camera.wait = 30
  4672.     @battler = join_battler
  4673.     @battler_name = @battler.character_name
  4674.     @battler_index = @battler.character_index
  4675.     @battler_graphic_file_index = @battler.sv.graphic_file_index
  4676.     self.bitmap = Cache.character(@battler_name)
  4677.     @battler.sv.setup(self.bitmap.width, self.bitmap.height, true)
  4678.     create_shadow
  4679.     init_visibility
  4680.   end
  4681.   #--------------------------------------------------------------------------
  4682.   # ● 通常の設定に戻す ★再定義
  4683.   #--------------------------------------------------------------------------
  4684.   def revert_to_normal
  4685.     self.blend_type = 0
  4686.     self.opacity = 255
  4687.   end
  4688.   #--------------------------------------------------------------------------
  4689.   # ● 崩壊エフェクトの更新
  4690.   #--------------------------------------------------------------------------
  4691.   alias update_collapse_sprite_battler_n03 update_collapse
  4692.   def update_collapse
  4693.     return if @battler.sv.state(1) != "敵コラプス"
  4694.     update_collapse_sprite_battler_n03
  4695.     @battler.sv.weapon_visible = false
  4696.   end
  4697.   #--------------------------------------------------------------------------
  4698.   # ● ボス崩壊エフェクトの更新 ★再定義
  4699.   #--------------------------------------------------------------------------
  4700.   def update_boss_collapse
  4701.     @effect_duration = @battler.sv.ch if @effect_duration >= @battler.sv.ch
  4702.     alpha = @effect_duration * 120 / @battler.sv.ch
  4703.     self.ox = @battler.sv.cw / 2 + @effect_duration % 2 * 4 - 2
  4704.     self.blend_type = 1
  4705.     self.color.set(255, 255, 255, 255 - alpha)
  4706.     self.opacity = alpha
  4707.     self.src_rect.y -= 1
  4708.     Sound.play_boss_collapse2 if @effect_duration % 20 == 19
  4709.   end
  4710.   #--------------------------------------------------------------------------
  4711.   # ● 別スプライトからのタイミング処理
  4712.   #--------------------------------------------------------------------------
  4713.   def set_process_timing(timing_data)
  4714.     for data in timing_data
  4715.       set_timing(data[0],data[1])
  4716.     end
  4717.     @battler.sv.timing = []
  4718.   end
  4719.   #--------------------------------------------------------------------------
  4720.   # ● タイミング処理
  4721.   #--------------------------------------------------------------------------
  4722.   def set_timing(se_flag, data)
  4723.     @ani_rate = 4
  4724.     data.se.play if se_flag
  4725.     case data.flash_scope
  4726.     when 1 ;self.flash(data.flash_color, data.flash_duration * @ani_rate)
  4727.     when 2 ;viewport.flash(data.flash_color, data.flash_duration * @ani_rate) if viewport
  4728.     when 3 ;self.flash(nil, data.flash_duration * @ani_rate)
  4729.     end
  4730.   end
  4731.   #--------------------------------------------------------------------------
  4732.   # ● 色調変更
  4733.   #--------------------------------------------------------------------------
  4734.   def color_set
  4735.     set = @battler.sv.color_set
  4736.     @battler.sv.color_set= []
  4737.     set[4] = 1 if set[4] == 0
  4738.     @remain_color_data = [0,0,0,0] if @remain_color_data == nil
  4739.     @color_data = @remain_color_data
  4740.     @color_data[4] = set[4]
  4741.     @color_data[5] = set[5]
  4742.     @color_data[6] = set
  4743.   end
  4744.   #--------------------------------------------------------------------------
  4745.   # ● 解放
  4746.   #--------------------------------------------------------------------------
  4747.   alias dispose_sprite_battler_n03 dispose
  4748.   def dispose
  4749.     dispose_sprite_battler_n03
  4750.     @shadow.dispose if @shadow != nil
  4751.     @balloon.dispose if @balloon != nil
  4752.     for mirage in @mirages do mirage.dispose end if @mirages != nil
  4753.     for anime in @next_anime do anime.dispose end if @next_anime
  4754.   end
  4755. end


  4756. #==============================================================================
  4757. # ■ Spriteset_Battle
  4758. #------------------------------------------------------------------------------
  4759. #  バトル画面のスプライトをまとめたクラスです。
  4760. #==============================================================================
  4761. class Spriteset_Battle
  4762.   #--------------------------------------------------------------------------
  4763.   # ● 戦闘背景(床)スプライトの作成 ★再定義
  4764.   #--------------------------------------------------------------------------
  4765.   def create_battleback1
  4766.     @back1_sprite = Sprite_Battle_Back.new(@viewport1, 1, battleback1_name)
  4767.     @back1_sprite.set_graphics(battleback1_bitmap) if battleback1_name != nil
  4768.     @back1_sprite.z = 0
  4769.   end
  4770.   #--------------------------------------------------------------------------
  4771.   # ● 戦闘背景(壁)スプライトの作成 ★再定義
  4772.   #--------------------------------------------------------------------------
  4773.   def create_battleback2
  4774.     @back2_sprite = Sprite_Battle_Back.new(@viewport1, 2, battleback2_name)
  4775.     @back2_sprite.set_graphics(battleback2_bitmap) if battleback2_name != nil
  4776.     @back2_sprite.z = 1
  4777.   end
  4778.   #--------------------------------------------------------------------------
  4779.   # ● アクタースプライトの作成 ★再定義
  4780.   #--------------------------------------------------------------------------
  4781.   def create_actors
  4782.     @actor_sprites = []
  4783.     for i in 0...$game_party.max_battle_members
  4784.       @actor_sprites[i] = Sprite_Battler.new(@viewport1, $game_party.members[i])
  4785.     end
  4786.     @effect_sprites = Spriteset_Sideview.new(@viewport1)
  4787.   end
  4788.   #--------------------------------------------------------------------------
  4789.   # ● アクタースプライトの更新 ★再定義
  4790.   #--------------------------------------------------------------------------
  4791.   def update_actors
  4792.     @actor_sprites.each_with_index do |sprite, i|
  4793.       sprite_join($game_party.members[i], sprite) if sprite.battler == nil && sprite.battler != $game_party.members[i]
  4794.       sprite.remove if sprite.battler != nil && !sprite.removing && sprite.battler != $game_party.members[i]
  4795.       sprite.update
  4796.     end
  4797.     @effect_sprites.update
  4798.     update_program
  4799.   end
  4800.   #--------------------------------------------------------------------------
  4801.   # ● メンバーを加える
  4802.   #--------------------------------------------------------------------------
  4803.   def sprite_join(member, sprite)
  4804.     for sp in @actor_sprites
  4805.       sp.update_remove if member == sp.battler && !sp.battler.sv.change_up
  4806.     end
  4807.     sprite.join(member)
  4808.   end
  4809.   #--------------------------------------------------------------------------
  4810.   # ● バトルプログラムの更新
  4811.   #--------------------------------------------------------------------------
  4812.   def update_program
  4813.     return if $sv_camera.program_scroll == []
  4814.     for data in  $sv_camera.program_scroll
  4815.       @back1_sprite.start_back_data(data) if data[2] == 1
  4816.       @back2_sprite.start_back_data(data) if data[2] == 2
  4817.     end
  4818.     $sv_camera.program_scroll = []
  4819.   end
  4820.   #--------------------------------------------------------------------------
  4821.   # ● ヒット時の戦闘アニメ実行
  4822.   #--------------------------------------------------------------------------
  4823.   def set_hit_animation(battler, weapon_index, hit_targets, miss)
  4824.     @effect_sprites.set_hit_animation(battler, weapon_index, hit_targets, miss)
  4825.   end
  4826.   #--------------------------------------------------------------------------
  4827.   # ● ダメージPOP
  4828.   #--------------------------------------------------------------------------
  4829.   def set_damage_pop(target)
  4830.     @effect_sprites.set_damage_pop(target)
  4831.   end
  4832.   #--------------------------------------------------------------------------
  4833.   # ● 解放
  4834.   #--------------------------------------------------------------------------
  4835.   alias dispose_spriteset_battle_n03 dispose
  4836.   def dispose
  4837.     dispose_spriteset_battle_n03
  4838.     @effect_sprites.dispose
  4839.   end
  4840.   
  4841.   
  4842.   
  4843. end


  4844. #==============================================================================
  4845. # ■ Window_BattleLog
  4846. #------------------------------------------------------------------------------
  4847. #  戦闘の進行を実況表示するウィンドウです。
  4848. #==============================================================================
  4849. class Window_BattleLog < Window_Selectable
  4850.   #--------------------------------------------------------------------------
  4851.   # ● ウェイト ★再定義
  4852.   #--------------------------------------------------------------------------
  4853.   def wait
  4854.   end
  4855.   #--------------------------------------------------------------------------
  4856.   # ● ウェイトとクリア ★再定義
  4857.   #--------------------------------------------------------------------------
  4858.   def wait_and_clear
  4859.     $sv_camera.wait = 10
  4860.   end
  4861.   #--------------------------------------------------------------------------
  4862.   # ● 行動結果の表示 ★再定義
  4863.   #--------------------------------------------------------------------------
  4864.   def display_action_results(target, item)
  4865.     if target.result.used
  4866.       last_line_number = line_number
  4867.       display_critical(target, item)
  4868.       display_damage(target, item)
  4869.       display_affected_status(target, item)
  4870.       display_failure(target, item)
  4871.     end
  4872.     off if !N03::BATTLE_LOG
  4873.   end
  4874.   #--------------------------------------------------------------------------
  4875.   # ● ウインドウ非表示
  4876.   #--------------------------------------------------------------------------
  4877.   def off
  4878.     @back_sprite.visible = self.visible = false
  4879.   end
  4880. end
  4881. #==============================================================================
  4882. # ■ Game_Interpreter
  4883. #------------------------------------------------------------------------------
  4884. #  イベントコマンドを実行するインタプリタです。
  4885. #==============================================================================
  4886. class Game_Interpreter
  4887.   #--------------------------------------------------------------------------
  4888.   # ● スイッチの操作
  4889.   #--------------------------------------------------------------------------
  4890.   alias command_121_game_interpreter_n03 command_121
  4891.   def command_121
  4892.     command_121_game_interpreter_n03
  4893.     $sv_camera.program_check
  4894.   end
  4895. end
复制代码

覆盖原来所有代码,整个粘贴即可。如果还是报错,把你之前工程的相同的代码(带有汉化字样的,不是全部汉化字样,只是单纯这一个)给全部注释掉。
最后我想说,你到底要做什么类型的游戏?先把系统框架搞好再说,我看你一个个到处添加进来,然后各种报错。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
228
在线时间
66 小时
注册时间
2024-4-13
帖子
27
6
发表于 4 天前 | 只看该作者
本帖最后由 chen12311 于 2025-3-6 18:26 编辑

问问题之前确定是脚本问题还是你的其他插件冲突的问题
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1362
在线时间
102 小时
注册时间
2023-12-26
帖子
190
7
 楼主| 发表于 4 天前 | 只看该作者
邱小谦 发表于 2025-3-6 18:14
覆盖原来所有代码,整个粘贴即可。如果还是报错,把你之前工程的相同的代码(带有汉化字样的,不是全部 ...

唉,不弄了,谢谢谢谢,本来想弄个阵型底板,就是先准备一个可以选择各种阵型的底板,再来制作游戏。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1362
在线时间
102 小时
注册时间
2023-12-26
帖子
190
8
 楼主| 发表于 4 天前 | 只看该作者
chen12311 发表于 2025-3-6 18:16
问问题之前确定是脚本问题还是你的其他插件冲突的问题

唉,不弄了,谢谢谢谢,本来想弄个阵型底板,就是先准备一个可以选择各种阵型的底板,再来制作游戏。
3个人,5个人,6个人,7个人,8个人。。。阵型 。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-3-10 22:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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