查看: 1625|回复: 0

[已经过期] 请问这个速度条脚本的刷新页面事件脚本怎么写?

[复制链接]

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
回帖
6325
发表于 2015-3-9 13:03:09 | 显示全部楼层 |阅读模式

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

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

×
这是一个控制行动条的脚本 如何在事件中写一条刷新页面的命令?
@怪蜀黍 @正太君 @丁凯乐 @铃仙·优昙华院·因幡 @taroxd @魔法教授
脚本

  1. #==============================================================================
  2. class Scene_Battle < Scene_Base
  3.   #--------------------------------------------------------------------------
  4.   # ● 開始処理
  5.   #--------------------------------------------------------------------------
  6.   alias start_n02 start
  7.   def start
  8.     $gauge_stop = true
  9.     $game_party.atb_customize
  10.     start_n02
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● 戦闘開始の処理
  14.   #--------------------------------------------------------------------------
  15.   alias process_battle_start_n02 process_battle_start
  16.   def process_battle_start
  17.     @end_member = 0
  18.     preemptive if $game_troop.preemptive
  19.     surprise if $game_troop.surprise
  20.     @status_window.visible = true
  21.     process_battle_start_n02
  22.     @status_window.refresh
  23.     $gauge_stop = false
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 先制処理
  27.   #--------------------------------------------------------------------------
  28.   def preemptive
  29.     $game_troop.preemptive = false
  30.     for member in $game_party.members + $game_troop.members
  31.       member.at_count = 1000 if member.actor?
  32.       member.at_count = N02::ATB_BACKATTACK * -10 if !member.actor?
  33.     end  
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 不意打ち処理
  37.   #--------------------------------------------------------------------------
  38.   def surprise
  39.     $game_troop.surprise = false
  40.     for member in $game_party.members + $game_troop.members
  41.       member.at_count = N02::ATB_BACKATTACK * -10 if member.actor?
  42.       member.at_count = 1000 if !member.actor?
  43.     end
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 情報表示ビューポートの解放
  47.   #--------------------------------------------------------------------------
  48.   alias dispose_info_viewport_n02 dispose_info_viewport
  49.   def dispose_info_viewport
  50.     dispose_info_viewport_n02
  51.     @cursor.dispose if @cursor != nil && !@cursor.disposed?
  52.     @help_window.dispose if @help_window != nil && !@help_window.disposed?
  53.     @help_window = nil
  54.     @help_window2.dispose if @help_window2 != nil && !@help_window2.disposed?
  55.     @help_window2 = nil
  56.     @skill_window.dispose if @skill_window != nil && !@skill_window.disposed?
  57.     @skill_window = nil
  58.     @item_window.dispose if @item_window != nil && !@item_window.disposed?
  59.     @skill_window = nil
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● フレーム更新  ※再定義
  63.   #--------------------------------------------------------------------------
  64.   def update
  65.     super
  66.     update_basic(true)
  67.     unless $game_message.visible                # メッセージ表示中以外
  68.       return if judge_win_loss if @judge == nil # 勝敗判定
  69.       update_scene_change
  70.       process_battle_event                      # バトルイベントの処理
  71.     end  
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 基本更新処理  ※再定義
  75.   #--------------------------------------------------------------------------
  76.   def update_basic(main = false)
  77.     Graphics.update unless main                 # ゲーム画面を更新
  78.     Input.update unless main                    # 入力情報を更新
  79.     $game_system.update                         # タイマーを更新
  80.     $game_troop.update                          # 敵グループを更新
  81.     @spriteset.update                           # スプライトセットを更新
  82.     @message_window.update                      # メッセージウィンドウを更新
  83.     update_info_viewport if !$gauge_stop        # 情報表示ビューポートを更新
  84.     # カーソル更新
  85.     @cursor.update if @cursor != nil && @cursor.visible
  86.     # メッセージ表示中はこれ以降処理させない
  87.     if $game_message.visible
  88.       @spriteset.gauge_off
  89.       @info_viewport.visible = false
  90.       return @message_window.visible = true
  91.     end
  92.     return if $gauge_stop
  93.     # 戦闘中断、シーン切り替えの際これ以降は処理させない
  94.     return if @judge
  95.     return if $game_temp.next_scene != nil
  96.     # ATBを更新
  97.     update_atb
  98.     # ターゲット更新
  99.     update_target if @target_members != nil
  100.     # コマンド入力フェイズ
  101.     start_actor_command_selection if @command_members.size != 0 && !@command_phase
  102.     if @skill_window != nil
  103.       update_skill_selection                    # スキル選択
  104.     elsif @item_window != nil
  105.       update_item_selection                     # アイテム選択
  106.     elsif @party_command_window.visible && @party_command_window.active
  107.       update_party_command_selection            # パーティコマンド選択
  108.     elsif @actor_command_window.active
  109.       update_actor_command_selection            # アクターコマンド選択
  110.     end
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● ATB更新
  114.   #--------------------------------------------------------------------------
  115.   def update_atb
  116.     for member in $game_party.members + $game_troop.members
  117.       # ACT更新
  118.       return start_main(member) if member.act_active && !@action_battlers.include?(member) && !member.union_battler
  119.       # ATBアクター更新
  120.       if member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
  121.         return start_auto_action(member) if member.auto_action?
  122.         return @command_members.push(member)
  123.       # ATBエネミー更新
  124.       elsif !member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
  125.         return start_auto_action(member)
  126.       end
  127.     end
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● 自動行動開始
  131.   #--------------------------------------------------------------------------
  132.   def start_auto_action(member)
  133.     return if @judge
  134.     # 戦闘行動の作成
  135.     member.make_action if member.union_skill_id == 0
  136.     # チャージ設定
  137.     act_type = charge_set(member)
  138.     # 複数回行動の作成
  139.     member.act_time = member.action_time[0] if !member.actor?
  140.     # 行動ゲージに切り替え
  141.     @spriteset.change_act(act_type, member.actor?, member.index)
  142.     # チャージアクション
  143.     make_charge_action(member)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● チャージ設定
  147.   #--------------------------------------------------------------------------
  148.   def charge_set(member)
  149.     act_type = member.charge
  150.     # 通常攻撃(二刀のチャージ時間は双方武器の平均)
  151.     if member.actor? && member.action.attack? && member.weapon_id != 0
  152.       act_type = member.weapons[0].charge if member.weapons[0] != nil
  153.       act_type2 = member.weapons[1].charge if member.weapons[1] != nil
  154.       act_type[1] = (act_type[1] + act_type2[1]) / 2 if act_type2 != nil
  155.     elsif member.action.attack?
  156.       act_type = $data_weapons[member.weapon_id].charge if member.actor? && member.weapon_id != 0
  157.       act_type = $data_weapons[member.weapon].charge if !member.actor? && member.weapon != 0
  158.     end
  159.     act_type = $data_skills[member.action.skill_id].charge if member.action.skill?
  160.     act_type = $data_items[member.action.item_id].charge if member.action.item?
  161.     # チャージボーナス加算
  162.     if member.actor?
  163.       act_type[1] += $data_weapons[member.weapon_id].charge_bonus if member.weapon_id != 0
  164.       for i in 0...member.armors.size
  165.         # 二刀はキャンセル
  166.         next if member.two_swords_style && member.armors[0] != nil && member.armors[0]
  167.         act_type[1] += member.armors[i].charge_bonus if member.armors[i] != nil
  168.       end
  169.     end
  170.     return act_type
  171.   end   
  172.   #--------------------------------------------------------------------------
  173.   # ● 戦闘行動者の準備  ※再定義
  174.   #--------------------------------------------------------------------------
  175.   def start_main(member)
  176.     return if @judge
  177.     @message_window.clear
  178.     @action_battlers.push(member)
  179.     process_battle_event
  180.     @status_window.refresh
  181.     member.charge_start = false
  182.     # アクティブバトラーがいなければ次の行動者をセット
  183.     set_next_active_battler if @active_battler == nil
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● ヘルプウインドウの表示  ※再定義
  187.   #--------------------------------------------------------------------------
  188.   def pop_help(obj)
  189.     return if @help_window == nil && obj.extension.include?("ヘルプ非表示")
  190.     return @help_window.visible = false if obj.extension.include?("ヘルプ非表示")
  191.     return if @skill_window != nil && @skill_window.visible
  192.     return if @item_window != nil && @item_window.visible
  193.     @help_window = Window_Help.new if @help_window == nil
  194.     @help_window.set_text(obj.name, 1)
  195.     #————————————————————————————
  196.      #★将帮助窗口X坐标设为0
  197.     @help_window.x = 0
  198.     #——————————————————————————————
  199.     @help_window.visible = true
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● チャージアクション作成
  203.   #--------------------------------------------------------------------------
  204.   def make_charge_action(member)
  205.     action = ""
  206.     case member.action.kind
  207.     when 0
  208.       if member.actor?
  209.         action = member.charge[3] if member.weapon_id == 0
  210.         action = $data_weapons[member.weapon_id].charge[3] if member.weapon_id != 0
  211.       else
  212.         action = member.charge[3] if member.weapon == 0
  213.         action = $data_weapons[member.weapon].charge[3] if member.weapon != 0
  214.       end
  215.     when 1;action = member.action.skill.charge[3]
  216.     when 2;action = member.action.item.charge[3]
  217.     end
  218.     member.charge_action = action
  219.     return if action == ""
  220.     member.charge_start = true
  221.     @spriteset.set_action(member.actor?, member.index, member.charge_action)
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● アクション実行中  ※再定義
  225.   #--------------------------------------------------------------------------
  226.   def playing_action
  227.     loop do
  228.       break if @judge
  229.       update_basic
  230.       # アクティブバトラーに格納されているアクション情報を見る
  231.       action = @active_battler.play
  232.       next if action == 0
  233.       @active_battler.play = 0
  234.       if action[0] == "個別処理"
  235.         individual
  236.       elsif action == "コラプス許可"
  237.         unimmortaling
  238.       elsif action == "アクティブ解除"
  239.         break action_end
  240.       elsif action == "終了"
  241.         break action_end
  242.       elsif action[0] == "対象アニメ"
  243.         damage_action(action[1])
  244.       end
  245.     end  
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● 戦闘アクション実行
  249.   #--------------------------------------------------------------------------
  250.   def process_action
  251.     # スリップダメージ
  252.     hp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
  253.     # 合体攻撃処理
  254.     union_possibility?
  255.     process_union_skill if @active_battler.union_skill_id != 0
  256.     return set_next_active_battler if @active_battler.union_battler
  257.     # 暴走混乱処理
  258.     @active_battler.action.prepare unless @active_battler.action.forcing
  259.     # 戦闘行動開始
  260.     $in_action = true
  261.     @message_window.clear
  262.     @active_battler.white_flash = true
  263.     # ヘルプウインドウ表示
  264.     help_on
  265.     # 戦闘アクション実行
  266.     execute_action if @active_battler.action.valid?
  267.     # ヘルプウインドウ隠蔽
  268.     help_off
  269.     # 強制行動などでバトラーが空になったら次の行動者へ
  270.     return set_next_active_battler if @active_battler == nil
  271.     # スリップダメージ
  272.     mp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
  273.     # 戦闘アクション終了
  274.     @message_window.clear
  275.     @active_battler.white_flash = false
  276.     $in_action = false
  277.     @spriteset.gauge_update
  278.     # 合体攻撃終了処理
  279.     end_union_skill if @active_battler.union_skill_id != 0
  280.     # スキル派生がある場合、行動続行
  281.     return set_next_active_battler if @active_battler.derivation != 0 && !@forcing_battler
  282.     # エネミーの複数回行動
  283.     return set_next_active_battler if enemy_order
  284.     # 戦闘行動終了
  285.     turn_end(@active_battler)
  286.     # 次の行動者へ
  287.     @action_battlers.delete(@active_battler)
  288.     set_next_active_battler
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● ヘルプウインドウ表示
  292.   #--------------------------------------------------------------------------
  293.   def help_on
  294.     @help_window = Window_Help.new if @help_window == nil
  295.     @help_window.visible = false
  296.     return @help_window.visible = true if @skill_window != nil && @skill_window.visible
  297.     return @help_window.visible = true if @item_window != nil && @item_window.visible
  298.     return @help_window.visible = true if @active_battler.action.guard?
  299.     return @help_window.visible = true if @active_battler.action.kind == 0 && @active_battler.action.basic == 2
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● ヘルプウインドウ隠蔽
  303.   #--------------------------------------------------------------------------
  304.   def help_off
  305.     return if @help_window == nil
  306.     return @help_window.visible = true if @skill_window != nil && @skill_window.visible
  307.     return @help_window.visible = true if @item_window != nil && @item_window.visible
  308.     @help_window.visible = false
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● アクション終了  ※再定義
  312.   #--------------------------------------------------------------------------
  313.   def action_end
  314.     # 初期化
  315.     @individual_target = nil
  316.     @help_window.visible = false if @help_window != nil && @help_window.visible
  317.     @active_battler.active = false
  318.     @active_battler.clear_action_results
  319.     # 念のため不死身化解除
  320.     @targets.each{|i| i.individual = false if i.is_a?(Game_Battler)}#聪聪
  321.     @active_battler.individual = false
  322.     unimmortaling
  323.    
  324.     # 反射されていた場合
  325.     if @active_battler.reflex != nil
  326.       if @active_battler.action.skill?
  327.         obj = @active_battler.action.skill
  328.         @active_battler.perfect_skill_effect(@active_battler, obj)
  329.       elsif @active_battler.action.item?
  330.         obj = @active_battler.action.item
  331.         @active_battler.item_effect(@active_battler, obj)
  332.       else
  333.         @active_battler.perfect_attack_effect(@active_battler)
  334.       end
  335.       pop_damage(@active_battler, obj, @active_battler.reflex)
  336.       @active_battler.perform_collapse
  337.       @active_battler.reflex = nil
  338.       wait(N01::COLLAPSE_WAIT)
  339.     end
  340.     # 逆吸収で戦闘不能になった場合
  341.     if @absorb_dead
  342.       @active_battler.perform_collapse
  343.       @absorb_dead = false
  344.       wait(N01::COLLAPSE_WAIT)
  345.     end
  346.     # 次の行動までウエイトを挟む
  347.     wait(N01::ACTION_WAIT)
  348.   end  
  349.   #--------------------------------------------------------------------------
  350.   # ● 合体攻撃判定
  351.   #--------------------------------------------------------------------------
  352.   def union_skill?(member)
  353.     # スキルに合体攻撃設定があるかチェック
  354.     for union_action in member.action.skill.union_action
  355.       union_skills = union_action if union_action.size != 0 && union_action.include?(member.action.skill_id)
  356.     end
  357.     return if union_skills == nil
  358.     @partners = []
  359.     @union_targets = union_target_decision(member, member.action.skill)
  360.     @union_target_index = member.action.target_index
  361.     # 合体攻撃メンバーが使用可能かチェック
  362.     for skill_id in union_skills
  363.       for actor in $game_party.members
  364.         if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
  365.           @partners.push(actor)
  366.           actor.union_skill_id = skill_id
  367.         end
  368.       end
  369.     end
  370.     # 合体攻撃使用不可
  371.     if @partners.size != union_skills.size
  372.       for actor in @partners do actor.union_skill_id = 0 end
  373.       @partners = nil
  374.       member.action.clear if !member.action.guard?
  375.       return
  376.     end
  377.     # 合体攻撃使用可
  378.     for actor in @partners
  379.       # パートナーアクション決定
  380.       actor.action.kind = 1
  381.       actor.action.skill_id = actor.union_skill_id
  382.       actor.action.target_index = member.action.target_index
  383.       # コマンド強制キャンセル
  384.       if @command_members.include?(actor)
  385.         force_action_command_cansel(actor)
  386.         start_auto_action(member)
  387.       end
  388.     end
  389.     $in_union_action = true
  390.     @union_size = 0
  391.   end  
  392.   #--------------------------------------------------------------------------
  393.   # ● 合体攻撃可能か
  394.   #--------------------------------------------------------------------------
  395.   def union_possibility?
  396.     return if @partners == nil
  397.     for member in @partners
  398.       union_cansel = true unless member.inputable?
  399.     end
  400.     return if !union_cansel
  401.     end_union_skill
  402.     @active_battler.action.clear if !@active_battler.action.guard?
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 合体攻撃ターゲット決定
  406.   #--------------------------------------------------------------------------
  407.   def union_target_decision(member, obj)
  408.     targets = member.action.make_targets
  409.     # デフォルトの複数回攻撃が設定されていれば単体ターゲットに変換
  410.     targets = [targets[0]] if obj.for_two? or obj.for_three? or obj.dual?
  411.     # ランダムターゲットの場合、一体を選択しランダム範囲を保持
  412.     if obj.extension.include?("ランダムターゲット")
  413.       randum_targets = targets.dup
  414.       targets = [randum_targets[rand(randum_targets.size)]]
  415.     end
  416.     # ターゲット情報をバトラースプライトに送る
  417.     @spriteset.set_target(member.actor?, member.index, targets)
  418.     return targets
  419.   end   
  420.   #--------------------------------------------------------------------------
  421.   # ● 合体攻撃処理
  422.   #--------------------------------------------------------------------------
  423.   def process_union_skill
  424.     @union_size += 1
  425.     if @union_size != @partners.size
  426.       return @active_battler.union_battler = true
  427.     end
  428.     # 合体攻撃スタート
  429.     @action_battlers.delete(@active_battler)
  430.     @active_battler.active = false
  431.     @active_battler = @partners.shift
  432.     @active_battler.act_active = true
  433.     @active_battler.active = true
  434.     @active_battler.union_battler = false
  435.     @active_battler.action.kind = 1
  436.     @active_battler.action.skill_id = @active_battler.union_skill_id
  437.     @active_battler.action.target_index = @union_target_index
  438.     for member in @partners
  439.       member.action.kind = 1
  440.       member.action.skill_id = member.union_skill_id
  441.       member.action.target_index = @union_target_index
  442.       member.force_target = ["N01target_change", @union_targets]
  443.       @spriteset.update_target(true, member.index)
  444.       # アクション実行
  445.       @spriteset.set_action(true, member.index, member.action.skill.base_action)
  446.     end
  447.   end  
  448.   #--------------------------------------------------------------------------
  449.   # ● 合体攻撃終了処理
  450.   #--------------------------------------------------------------------------
  451.   def end_union_skill
  452.     @active_battler.union_skill_id = 0
  453.     @active_battler.union_battler = false
  454.     for member in @partners
  455.       member.union_skill_id = 0
  456.       member.union_battler = false
  457.       member.action.clear
  458.       @action_battlers.delete(member)
  459.       turn_end(member)
  460.     end
  461.     @union_size = 0
  462.     @partners = nil
  463.     $in_union_action = false
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● エネミーの行動回数作成
  467.   #--------------------------------------------------------------------------
  468.   def enemy_order
  469.     return false if @active_battler.actor?
  470.     return false if @active_battler.act_time == 0 or !@active_battler.action.valid?
  471.     return true if rand(100) < @active_battler.action_time[1]
  472.   end
  473.   #--------------------------------------------------------------------------
  474.   # ● ターン終了(経過)  ※再定義
  475.   #--------------------------------------------------------------------------
  476.   def turn_end(member)
  477.     $in_action = false
  478.     # アクション終了時のATBゲージ設定
  479.     recharge_action(member)
  480.     member.action.clear if !member.action.guard?
  481.     # ターン経過カウント
  482.     @end_member += 1
  483.     passage = true if N02::ATB_TURN_COUNT == 2
  484.     if @end_member >= $game_party.members.size + $game_troop.members.size
  485.       passage = true if N02::ATB_TURN_COUNT == 0
  486.       passage = true if N02::ATB_TURN_COUNT == 1 && @end_member == 2
  487.     elsif @end_member == ($game_party.members.size + $game_troop.members.size) / 2
  488.       passage = true if N02::ATB_TURN_COUNT == 1
  489.     end
  490.     # スリップダメージ
  491.     if @slip_all_damage
  492.       for battlers in $game_party.members + $game_troop.members do mp_slip_damage(battlers) end
  493.       @slip_all_damage = false
  494.       @slip_all_damaged = true
  495.     end
  496.     return if !passage
  497.     # スリップダメージ
  498.     if N02::ATB_SLIP_DAMAGE == 1 && !@slip_all_damaged
  499.       for battlers in $game_party.members + $game_troop.members do hp_slip_damage(battlers) end
  500.       @slip_all_damage = true
  501.     end
  502.     @slip_all_damaged = false
  503.     @end_member = 0
  504.     $game_troop.increase_turn
  505.     $game_troop.turn_ending = true
  506.     process_battle_event
  507.     $game_troop.turn_ending = false
  508.     @status_window.refresh
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● アクション終了時のATBゲージ設定
  512.   #--------------------------------------------------------------------------
  513.   def recharge_action(member)
  514.     member.act_count = 0
  515.     recharge = member.recharge
  516.     # 通常攻撃(二刀のチャージ時間は双方武器の平均)
  517.     if member.actor? && member.action.attack?
  518.       recharge = member.weapons[0].recharge if member.weapons[0] != nil
  519.       recharge2 = member.weapons[1].recharge if member.weapons[1] != nil
  520.       recharge = (recharge + recharge2) / 2 if recharge2 != nil
  521.     elsif member.action.attack?
  522.       act_type = $data_weapons[member.weapon].charge if member.weapon != 0
  523.     end
  524.     recharge = $data_skills[member.action.skill_id].recharge if member.action.skill?
  525.     recharge = $data_items[member.action.item_id].recharge if member.action.item?
  526.     recharge = N02::ATB_GUARD_RESET if member.action.guard?
  527.     # ATBゲージに切り替え
  528.     @spriteset.change_atb(10 * recharge, member.actor?, member.index)
  529.     @spriteset.gauge_refresh(member.actor?, member.index)
  530.   end   
  531.   #--------------------------------------------------------------------------
  532.   # ● 次の行動者へ
  533.   #--------------------------------------------------------------------------
  534.   def set_next_active_battler
  535.     return if $game_party.all_dead? or $game_troop.all_dead?
  536.     # エネミー複数回行動時
  537.     @action_battlers.shift if @active_battler != nil && !@active_battler.actor? && @active_battler.act_time != 0
  538.     loop do
  539.       if $game_troop.forcing_battler != nil
  540.         @active_battler = $game_troop.forcing_battler
  541.         @action_battlers.delete(@active_battler)
  542.         $game_troop.forcing_battler = nil
  543.       else
  544.         @active_battler = @action_battlers.shift
  545.       end
  546.       @active_battler.action.clear if @active_battler != nil && @active_battler.dead?
  547.       return if @active_battler == nil
  548.       # 戦闘行動開始
  549.       return process_action if @active_battler.index != nil
  550.     end
  551.   end
  552.   #--------------------------------------------------------------------------
  553.   # ● バトルイベントの処理  ※再定義
  554.   #--------------------------------------------------------------------------
  555.   def process_battle_event
  556.     members_size = $game_party.members.size
  557.     loop do
  558.       return if judge_win_loss
  559.       return if $game_temp.next_scene != nil
  560.       $game_troop.interpreter.update
  561.       $game_troop.setup_battle_event
  562.       @message_window.update
  563.       if $game_message.visible
  564.         @message_window.visible = true
  565.         @status_window.visible = false
  566.       end
  567.       wait_for_message
  568.       @message_window.visible = false
  569.       @status_window.visible = true
  570.       reset_atb_actor if members_size != $game_party.members.size
  571.       if $game_troop.forcing_battler != nil
  572.         set_next_active_battler
  573.       end
  574.       return unless $game_troop.interpreter.running?
  575.       update_basic
  576.     end
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● HPスリップダメージ
  580.   #--------------------------------------------------------------------------
  581.   def hp_slip_damage(member)
  582.     member.clear_action_results
  583.     return if !member.exist? or member.states.size == 0
  584.     member.slip_damage = false
  585.     damage = 0
  586.     # 0ターン解除のステートがあるかチェック
  587.     for state in member.states
  588.       member.remove_state(state.id) if state.extension.include?("0ターン解除")
  589.       # スリップダメージ実行 state = [ 対象, 定数, 割合, POP, 戦闘不能許可]
  590.       next unless state.extension.include?("スリップダメージ")
  591.       for ext in state.slip_extension
  592.         if ext[0] == "hp"
  593.           base_damage = ext[1] + member.maxhp * ext[2] / 100
  594.           damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
  595.           slip_pop = ext[3]
  596.           slip_dead = ext[4]
  597.           slip_damage_flug = true
  598.           member.slip_damage = true
  599.         end
  600.       end  
  601.     end
  602.     # デフォルトのスリップダメージ
  603.     if member.slip_damage? && member.exist? && !slip_damage_flug
  604.       damage += member.apply_variance(member.maxhp / 10, 10)
  605.       slip_dead = false
  606.       slip_pop = true
  607.       slip_damage_flug = true
  608.       member.slip_damage = true
  609.     end
  610.     # 防具の自動回復があるか
  611.     damage -= member.maxhp / 20 if member.actor? && member.auto_hp_recover && member.exist?
  612.     # 戦闘不能不許可
  613.     damage = member.hp - 1 if damage >= member.hp && slip_dead = false
  614.     member.hp -= damage
  615.     @spriteset.set_damage_pop(member.actor?, member.index, damage) if slip_pop
  616.     member.perform_collapse if member.dead? && member.slip_damage
  617.     member.clear_action_results
  618.     @status_window.refresh
  619.   end
  620.   #--------------------------------------------------------------------------
  621.   # ● MPスリップダメージ
  622.   #--------------------------------------------------------------------------
  623.   def mp_slip_damage(member)
  624.     member.clear_action_results
  625.     return if !member.exist? or member.states.size == 0
  626.     member.slip_damage = false
  627.     mp_damage = 0
  628.     for state in member.states
  629.       next unless state.extension.include?("スリップダメージ")
  630.       for ext in state.slip_extension
  631.         if ext[0] == "mp"
  632.           base_damage = ext[1] + member.maxmp * ext[2] / 100
  633.           mp_damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
  634.           slip_pop = ext[2]
  635.           slip_damage_flug = true
  636.         end
  637.       end
  638.     end  
  639.     member.mp_damage = mp_damage
  640.     member.mp -= mp_damage
  641.     @spriteset.set_damage_pop(member.actor?, member.index, mp_damage) if slip_pop
  642.     member.clear_action_results
  643.     @status_window.refresh
  644.   end  
  645.   #--------------------------------------------------------------------------
  646.   # ● 戦闘行動の実行 : 防御  ※再定義
  647.   #--------------------------------------------------------------------------
  648.   def execute_action_guard
  649.     @help_window.set_text("防御", 1)
  650.     @help_window.visible = true
  651.     # バトラーのアクティブ化を解除
  652.     @active_battler.active = false
  653.     wait(45)
  654.     @help_window.visible = false if @help_window != nil
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 戦闘行動の実行 : 逃走  ※再定義
  658.   #--------------------------------------------------------------------------
  659.   def execute_action_escape
  660.     @spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
  661.     @help_window.set_text("逃走", 1)
  662.     @help_window.visible = true
  663.     # バトラーのアクティブ化を解除
  664.     @active_battler.active = false
  665.     @active_battler.escape
  666.     Sound.play_escape
  667.     wait(45)
  668.     @help_window.visible = false if @help_window != nil
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ● パーティコマンド選択の開始  ※再定義
  672.   #--------------------------------------------------------------------------
  673.   def start_party_command_selection
  674.     @info_viewport.visible = true
  675.     @status_window.index = @actor_index = -1
  676.   end
  677.   #--------------------------------------------------------------------------
  678.   # ● 次のアクターのコマンド入力へ  ※再定義
  679.   #--------------------------------------------------------------------------
  680.   def next_actor
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # ● 前のアクターのコマンド入力へ  ※再定義
  684.   #--------------------------------------------------------------------------
  685.   def prior_actor
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ● アクターコマンド選択の開始  ※再定義
  689.   #--------------------------------------------------------------------------
  690.   def start_actor_command_selection
  691.     $in_command = true
  692.     @command_phase = true
  693.     @command_member_index = 0
  694.     @commander = @command_members[@command_member_index]
  695.     @status_window.active = true
  696.     @status_window.index = @commander.index
  697.     # カーソルセット
  698.     @cursor = Sprite_Cursor.new if @cursor == nil
  699.     @cursor.set(@commander)
  700.     # 動けるキャラのみコマンドアクションを
  701.     @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  702.     @party_command_window.active = false
  703.     @actor_command_window.setup(@commander)
  704.     @actor_command_window.active = true
  705.     @actor_command_window.index = 0
  706.     @actor_command_window_on = true
  707.     @status_window.refresh
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● コマンド更新  ※再定義
  711.   #--------------------------------------------------------------------------
  712.   def update_actor_command_selection
  713.     # コマンド入力できる状態でなくなればキャンセル
  714.     return reset_command unless commanding?
  715.     if Input.trigger?(Input::B)
  716.       Input.update
  717.       Sound.play_decision
  718.       start_party_command
  719.     elsif Input.trigger?(Input::C)
  720.       Input.update
  721.       case @actor_command_window.index
  722.       when 0  # 攻撃
  723.         Sound.play_decision
  724.         @commander.action.set_attack
  725.         start_target_enemy_selection
  726.       when 1  # スキル
  727.         Sound.play_decision
  728.         $in_select = true
  729.         start_skill_selection
  730.       when 2  # 防御
  731.         Sound.play_decision
  732.         @commander.action.set_guard
  733.         end_command
  734.       when 3  # アイテム
  735.         Sound.play_decision
  736.         $in_select = true
  737.         start_item_selection
  738.       end
  739.     # →キーでコマンドキャラ送り
  740.     elsif Input.trigger?(Input::RIGHT)
  741.       next_commander
  742.     # ←キーでコマンドキャラ戻し
  743.     elsif Input.trigger?(Input::LEFT)
  744.       back_commander
  745.     end
  746.   end
  747.   #--------------------------------------------------------------------------
  748.   # ● コマンド入力できる状態か
  749.   #--------------------------------------------------------------------------
  750.   def commanding?
  751.     return false if @judge or $gauge_stop
  752.     return false if @commander != nil && !@commander.inputable?
  753.     return false if @commander != nil && @commander.union_skill_id != 0
  754.     return false if @commander != nil && @commander.at_count < 1000
  755.     return true
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ● コマンドキャラ送り
  759.   #--------------------------------------------------------------------------
  760.   def next_commander
  761.     return if @command_members.size == 1 or @commander == nil
  762.     Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1],  N02::NEXT_SOUND01[0])
  763.     # 動けるキャラのみコマンド戻りアクションを
  764.     @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
  765.     # コマンド待ちメンバーのインデックスが最後なら
  766.     if @command_member_index == @command_members.size - 1
  767.       @command_member_index = 0
  768.     # 次のキャラにコマンドを送る
  769.     else
  770.       @command_member_index += 1
  771.     end
  772.     @commander = @command_members[@command_member_index]
  773.     @status_window.index = @commander.index
  774.     @actor_command_window.setup(@commander)
  775.     # カーソルセット
  776.     @cursor.set(@commander)
  777.     # 動けるキャラのみコマンドアクションを
  778.     @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  779.   end  
  780.   #--------------------------------------------------------------------------
  781.   # ● コマンドキャラ戻し
  782.   #--------------------------------------------------------------------------
  783.   def back_commander
  784.     return if @command_members.size == 1 or @commander == nil
  785.     Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1],  N02::NEXT_SOUND01[0])
  786.     # 動けるキャラのみコマンド戻りアクションを
  787.     @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
  788.     # コマンド待ちメンバーのインデックスが最初なら
  789.     if @command_member_index == 0
  790.       @command_member_index = @command_members.size - 1
  791.     # 前のキャラにコマンドを送る
  792.     else
  793.       @command_member_index -= 1
  794.     end
  795.     @commander = @command_members[@command_member_index]
  796.     @status_window.index = @commander.index
  797.     # カーソルセット
  798.     @cursor.set(@commander)
  799.     # 動けるキャラのみコマンドアクションを
  800.     @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  801.   end  
  802.   #--------------------------------------------------------------------------
  803.   # ● パーティコマンド選択の開始
  804.   #--------------------------------------------------------------------------
  805.   def start_party_command
  806.     $in_party_command = true
  807.     $in_command = false
  808.     @status_window.refresh
  809.     @status_window.index = @actor_index = -1
  810.     @info_viewport.visible = true
  811.     @message_window.visible = false
  812.     @pre_a_index = @actor_command_window.index
  813.     @actor_command_window.active = false
  814.     @actor_command_window.index = -1
  815.     @party_command_window.active = true
  816.     @party_command_window.index = 0
  817.     @party_command_window.visible = true
  818.   end
  819.   #--------------------------------------------------------------------------
  820.   # ● パーティコマンド選択の更新
  821.   #--------------------------------------------------------------------------
  822.   def update_party_command_selection
  823.     # コマンド入力できる状態でなくなればキャンセル
  824.     return reset_command unless commanding?
  825.     if Input.trigger?(Input::C)
  826.       case @party_command_window.index
  827.       when 0  # 戦う
  828.         Sound.play_decision
  829.         @status_window.index = @actor_index = -1
  830.         end_party_command
  831.       when 1  # 逃げる
  832.         return Sound.play_buzzer if $game_troop.can_escape == false
  833.         Sound.play_decision
  834.         end_party_command
  835.         process_escape if !@escape
  836.       end
  837.     elsif Input.trigger?(Input::B)
  838.       Sound.play_cancel
  839.       end_party_command
  840.     end
  841.   end
  842.   #--------------------------------------------------------------------------
  843.   # ● パーティコマンド選択の終了
  844.   #--------------------------------------------------------------------------
  845.   def end_party_command
  846.     $in_party_command = false
  847.     $in_command = true
  848.     @status_window.refresh
  849.     @message_window.visible = false
  850.     @party_command_window.active = false
  851.     @actor_command_window.active = true
  852.     @party_command_window.visible = false
  853.     @actor_command_window.index = @pre_a_index
  854.     @status_window.index = @commander.index
  855.     @status_window.active = true
  856.   end
  857.   #--------------------------------------------------------------------------
  858.   # ● 逃走の処理  ※再定義
  859.   #--------------------------------------------------------------------------
  860.   def process_escape
  861.     @escape = true
  862.     closed_window
  863.     @info_viewport.visible = false
  864.     @message_window.visible = true
  865.     text = sprintf(Vocab::EscapeStart, $game_party.name)
  866.     $game_message.texts.push(text)
  867.     if $game_troop.preemptive
  868.       success = true
  869.     else
  870.       success = (rand(100) < @escape_ratio)
  871.     end
  872.     Sound.play_escape
  873.     # 動けないアクターを除いて逃走成功アクション
  874.     if success
  875.       for actor in $game_party.members
  876.         unless actor.restriction >= 100
  877.           @spriteset.set_action(true, actor.index,actor.run_success)
  878.         end
  879.       end  
  880.       wait_for_message
  881.       @judge = true
  882.       $game_troop.clear_actions
  883.       $game_party.clear_actions
  884.       battle_end(1)
  885.     # 動けないアクターを除いて逃走失敗アクション
  886.     else
  887.       for actor in $game_party.members
  888.         unless actor.restriction >= 100
  889.           @spriteset.set_action(true, actor.index,actor.run_ng)
  890.         end
  891.       end
  892.       @escape_ratio += 10
  893.       $game_message.texts.push('\.' + Vocab::EscapeFailure)
  894.       wait_for_message
  895.       $game_party.clear_actions
  896.     end
  897.     reset_atb_actor
  898.     @info_viewport.visible = true
  899.     @escape = false
  900.   end  
  901.   #--------------------------------------------------------------------------
  902.   # ● アクターのATBを初期化
  903.   #--------------------------------------------------------------------------
  904.   def reset_atb_actor
  905.     @command_members = []
  906.     @commander = nil
  907.     $in_action = @command_phase = false
  908.     $in_command = $in_target = $in_select = false
  909.     @message_window.clear
  910.     for member in $game_party.members
  911.       @action_battlers.delete(member)
  912.       member.white_flash = false
  913.       member.action.clear
  914.       # ATBゲージに切り替え
  915.       @spriteset.change_atb(N02::ATB_RUN_NG * -10, member.actor?, member.index)
  916.     end
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ● 開いているウインドウを閉じる
  920.   #--------------------------------------------------------------------------
  921.   def closed_window
  922.     @cursor.dispose if @cursor != nil
  923.     @cursor = nil
  924.     @help_window.dispose if @help_window != nil
  925.     @help_window = nil
  926.     @help_window2.dispose if @help_window2 != nil
  927.     @help_window2 = nil
  928.     @skill_window.dispose if @skill_window != nil
  929.     @skill_window = nil
  930.     @item_window.dispose if @item_window != nil
  931.     @item_window = nil
  932.     @actor_command_window_on = false if @actor_command_window != nil
  933.     @actor_command_window.active = false if @actor_command_window != nil
  934.     @party_command_window.visible = false if @party_command_window != nil
  935.     @party_command_window.active = false if @party_command_window != nil
  936.     @status_window.index = @actor_index = @actor_command_window.index = -1
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ● ターゲット選択の開始  ※再定義
  940.   #--------------------------------------------------------------------------
  941.   def start_target_selection(actor = false)
  942.     $in_target = true
  943.     $in_command = $in_select = false
  944.     @target_actors = actor
  945.     @target_members = $game_party.members if @target_actors
  946.     @target_members = $game_troop.members unless @target_actors
  947.     # 不要なウインドウを消す
  948.     @actor_command_window.active = false
  949.     @skill_window.visible = false if @skill_window != nil
  950.     @item_window.visible = false if @item_window != nil
  951.     # 存在しているターゲットで最も番号の低い対象を最初に指すように
  952.     @index = 0
  953.     @max_index = @target_members.size - 1
  954.     # アクターは戦闘不能者でもターゲットできるようにエネミーと区別
  955.     unless @target_actors
  956.       @target_members.size.times do
  957.         break if @target_members[@index].exist?
  958.         @index += 1
  959.       end
  960.     end  
  961.     # カーソルセット
  962.     @cursor.set(@target_members[@index])
  963.     @help_window.visible = false if @help_window != nil
  964.     @help_window2 = Window_Help.new if @help_window2 == nil
  965.     @help_window2.set_text_n02add(@target_members[@index])
  966.   end
  967.   #--------------------------------------------------------------------------
  968.   # ● ターゲット選択更新  ※再定義
  969.   #--------------------------------------------------------------------------
  970.   def update_target
  971.     # コマンド入力できる状態でなくなればキャンセル
  972.     return reset_command unless commanding?
  973.     return end_target_selection(cansel = true) if $game_troop.all_dead?
  974.     cursor_down if !@target_members[@index].actor? && !@target_members[@index].exist?
  975.     if Input.trigger?(Input::B)
  976.       Input.update
  977.       Sound.play_cancel
  978.       end_target_selection(cansel = true)
  979.     elsif Input.trigger?(Input::C)
  980.       Input.update
  981.       Sound.play_decision
  982.       @commander.action.target_index = @index
  983.       end_target_selection
  984.       end_skill_selection
  985.       end_item_selection
  986.       @actor_command_window.active = false
  987.       next_actor
  988.     end
  989.     if Input.repeat?(Input::LEFT)
  990.       if @target_actors
  991.         cursor_down if $back_attack
  992.         cursor_up unless $back_attack
  993.       else
  994.         cursor_up if $back_attack
  995.         cursor_down unless $back_attack
  996.       end  
  997.     end
  998.     if Input.repeat?(Input::RIGHT)
  999.       if @target_actors
  1000.         cursor_up if $back_attack
  1001.         cursor_down unless $back_attack
  1002.       else
  1003.         cursor_down if $back_attack
  1004.         cursor_up unless $back_attack
  1005.       end
  1006.     end
  1007.     cursor_up if Input.repeat?(Input::UP)
  1008.     cursor_down if Input.repeat?(Input::DOWN)
  1009.   end
  1010.   #--------------------------------------------------------------------------
  1011.   # ● カーソルを前に移動  ※再定義
  1012.   #--------------------------------------------------------------------------
  1013.   def cursor_up
  1014.     Sound.play_cursor
  1015.     @target_members.size.times do
  1016.       @index += @target_members.size - 1
  1017.       @index %= @target_members.size
  1018.       break if @target_actors
  1019.       break if @target_members[@index].exist?
  1020.     end
  1021.     # カーソルセット
  1022.     @cursor.set(@target_members[@index])
  1023.     @help_window2.set_text_n02add(@target_members[@index]) if @help_window2 != nil
  1024.   end
  1025.   #--------------------------------------------------------------------------
  1026.   # ● カーソルを次に移動  ※再定義
  1027.   #--------------------------------------------------------------------------
  1028.   def cursor_down
  1029.     Sound.play_cursor
  1030.     @target_members.size.times do
  1031.       @index += 1
  1032.       @index %= @target_members.size
  1033.       break if @target_actors
  1034.       break if @target_members[@index].exist?
  1035.     end
  1036.     # カーソルセット
  1037.     @cursor.set(@target_members[@index])
  1038.     @help_window2.set_text_n02add(@target_members[@index]) if @help_window2 != nil
  1039.   end
  1040.   #--------------------------------------------------------------------------
  1041.   # ● ターゲット選択の終了  再定義
  1042.   #--------------------------------------------------------------------------
  1043.   def end_target_selection(cansel = false)
  1044.     $in_target = false
  1045.     @help_window2.dispose if @help_window2 != nil
  1046.     @help_window2 = nil
  1047.     @help_window.visible = false if @help_window != nil
  1048.     if @skill_window != nil
  1049.       @skill_window.visible = @skill_window.active = true
  1050.       @help_window.visible = true if @help_window != nil
  1051.       @actor_command_window.active = false if cansel
  1052.       $in_select = true if cansel
  1053.     elsif @item_window != nil
  1054.       @item_window.visible = @item_window.active = true
  1055.       @help_window.visible = true if @help_window != nil
  1056.       @actor_command_window.active = false if cansel
  1057.       $in_select = true if cansel
  1058.     end
  1059.     @target_members = nil
  1060.     end_command if !cansel
  1061.     # カーソルセット
  1062.     @cursor.set(@commander) if cansel
  1063.     $in_command = true if cansel && @actor_command_window.index == 0
  1064.     @actor_command_window.active = true if cansel && @actor_command_window.index == 0
  1065.   end
  1066.   #--------------------------------------------------------------------------
  1067.   # ● コマンド初期化
  1068.   #--------------------------------------------------------------------------
  1069.   def reset_command
  1070.     @message_window.visible = false
  1071.     @party_command_window.active = false
  1072.     @commander.action.clear
  1073.     @party_command_window.visible = false
  1074.     $in_command = $in_select = $in_target = false
  1075.     @target_members = nil
  1076.     @actor_command_window.active = false
  1077.     @cursor.visible = false
  1078.     @command_phase = false
  1079.     end_skill_selection
  1080.     end_item_selection
  1081.     @party_command_window.active = @actor_command_window.active = false
  1082.     @actor_command_window_on = false
  1083.     @status_window.index = @actor_index = @actor_command_window.index = -1
  1084.     @command_members.delete(@commander)
  1085.     @commander = nil
  1086.   end  
  1087.   #--------------------------------------------------------------------------
  1088.   # ● 強制行動によるコマンドキャンセル
  1089.   #--------------------------------------------------------------------------
  1090.   def force_action_command_cansel(member)
  1091.     return if !member.inputable?
  1092.     # チャージ設定
  1093.     act_type = charge_set(member)
  1094.     # 行動ゲージに切り替え
  1095.     @spriteset.change_act(act_type, member.actor?, member.index)
  1096.     # 動けるキャラのみコマンド戻りアクションを
  1097.     @spriteset.set_action(true, member.index,member.command_a) if member.actor? && member.inputable?
  1098.     # チャージアクション
  1099.     make_charge_action(member)
  1100.     # 以下の処理はコマンド入力中のアクター限定
  1101.     return if !member.actor? or @commander != member
  1102.     # カーソル消去
  1103.     @cursor.visible = false
  1104.     @command_phase = false
  1105.     # ウインドウ初期化
  1106.     end_skill_selection
  1107.     end_item_selection
  1108.     $in_target = false
  1109.     @help_window2.dispose if @help_window2 != nil
  1110.     @help_window2 = nil
  1111.     @help_window.visible = false if @help_window != nil
  1112.     @party_command_window.active = @actor_command_window.active = false
  1113.     @actor_command_window_on = false
  1114.     @status_window.index = @actor_index = @actor_command_window.index = -1
  1115.     @command_members.delete(member)
  1116.     @commander = nil
  1117.     @message_window.visible = false
  1118.     @party_command_window.active = false
  1119.     @party_command_window.visible = false
  1120.     $in_command = $in_select = $in_target = false
  1121.     @target_members = nil
  1122.   end  
  1123.   #--------------------------------------------------------------------------
  1124.   # ● コマンド入力終了
  1125.   #--------------------------------------------------------------------------
  1126.   def end_command
  1127.     return if !@commander.inputable?
  1128.     $in_command = false
  1129.     $in_select = false
  1130.     # カーソル消去
  1131.     @cursor.visible = false
  1132.     @command_phase = false
  1133.     # アクション実行時間チェック
  1134.     act_type = charge_set(@commander)
  1135.     # 行動ゲージに切り替え
  1136.     @spriteset.change_act(act_type, true, @commander.index)
  1137.     # 動けるキャラのみコマンド戻りアクションを
  1138.     @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
  1139.     # チャージアクション
  1140.     make_charge_action(@commander)
  1141.     # 合体攻撃チェック
  1142.     union_skill?(@commander) if @commander.action.skill? && @partners == nil
  1143.     # ウインドウ初期化
  1144.     @party_command_window.active = @actor_command_window.active = false
  1145.     @actor_command_window_on = false
  1146.     @status_window.index = @actor_index = @actor_command_window.index = -1
  1147.     @command_members.delete(@commander)
  1148.     @commander = nil
  1149.   end
  1150.   #--------------------------------------------------------------------------
  1151.   # ● 情報表示ビューポートの作成  ※再定義
  1152.   #--------------------------------------------------------------------------
  1153.   def create_info_viewport
  1154.     @command_members = []
  1155.     @action_battlers = []
  1156.     @info_viewport = Viewport.new(0, 0, 608, 480)
  1157.     #@info_viewport = Viewport.new(0, 288, 608, 128)
  1158.     @info_viewport.z = 100
  1159.     @status_window = Window_BattleStatus.new
  1160.     @party_command_window = Window_PartyCommand2.new
  1161.     @actor_command_window = Window_ActorCommand.new
  1162.     @status_window.viewport = @info_viewport
  1163.     @actor_command_window.viewport = @info_viewport
  1164.     @status_window.x = 128
  1165.     @actor_command_window.x = 672
  1166.     @info_viewport.visible = false
  1167.     @party_command_window.visible = false
  1168.     @info_viewport.ox = 128
  1169.   end
  1170.   
  1171.   #--------------------------------------------------------------------------
  1172.   # ● 情報表示ビューポートの更新   ※再定義
  1173.   #--------------------------------------------------------------------------
  1174.   def update_info_viewport
  1175.     @party_command_window.update if @party_command_window.active
  1176.     @actor_command_window.update if @actor_command_window.active
  1177.     @status_window.update if @status_window.active
  1178.     @message_window.visible = false if !$game_message.visible
  1179.     @info_viewport.visible = true if !@message_window.visible
  1180.     @actor_command_window.x += 32 if @actor_command_window.x < 672 && !@actor_command_window_on
  1181.     @actor_command_window.x -= 32 if @actor_command_window.x > 608 && @actor_command_window_on
  1182.   end
  1183.   #--------------------------------------------------------------------------
  1184.   # ● スキル選択の開始  ※再定義
  1185.   #--------------------------------------------------------------------------
  1186.   def start_skill_selection
  1187.     @help_window = Window_Help.new if @help_window == nil
  1188.     @help_window.visible = true
  1189.     @skill_window = Window_Skill.new(0, 0, 608, 232, @commander)
  1190.     @skill_window.z = 5
  1191.     @skill_window.help_window = @help_window
  1192.     @actor_command_window.active = false
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # ● スキル選択の更新  ※再定義
  1196.   #--------------------------------------------------------------------------
  1197.   def update_skill_selection
  1198.     # コマンド入力できる状態でなくなればキャンセル
  1199.     return reset_command unless commanding?
  1200.     @skill_window.active = true
  1201.     @skill_window.update
  1202.     @help_window.update
  1203.     if Input.trigger?(Input::B)
  1204.       Sound.play_cancel
  1205.       end_skill_selection
  1206.       $in_command = true
  1207.     elsif Input.trigger?(Input::C)
  1208.       @skill = @skill_window.skill
  1209.       if @skill != nil
  1210.         @commander.last_skill_id = @skill.id
  1211.       end
  1212.       if @commander.skill_can_use?(@skill)
  1213.         return Sound.play_buzzer if @commander.union_skill?(@skill.id) && !@commander.union_skill_can_use?(@skill.id)
  1214.         Sound.play_decision
  1215.         determine_skill
  1216.       else
  1217.         Sound.play_buzzer
  1218.       end
  1219.     end
  1220.   end
  1221.   #--------------------------------------------------------------------------
  1222.   # ● スキルの決定  ※再定義
  1223.   #--------------------------------------------------------------------------
  1224.   def determine_skill
  1225.     @commander.action.set_skill(@skill.id)
  1226.     @skill_window.active = false
  1227.     if @skill.need_selection?
  1228.       if @skill.for_opponent?
  1229.         start_target_enemy_selection
  1230.       else
  1231.         start_target_actor_selection
  1232.       end
  1233.     else
  1234.       end_skill_selection
  1235.       end_target_selection
  1236.     end
  1237.   end
  1238.   #--------------------------------------------------------------------------
  1239.   # ● スキル選択の終了
  1240.   #--------------------------------------------------------------------------
  1241.   alias end_skill_selection_n01 end_skill_selection
  1242.   def end_skill_selection
  1243.     end_skill_selection_n01
  1244.     $in_select = false
  1245.   end
  1246.   #--------------------------------------------------------------------------
  1247.   # ● アイテム選択の開始  ※再定義
  1248.   #--------------------------------------------------------------------------
  1249.   def start_item_selection
  1250.     @help_window = Window_Help.new if @help_window == nil
  1251.     @help_window.visible = true
  1252.     @item_window = Window_Item.new(0, 0, 608, 232)
  1253.     @item_window.z = 5
  1254.     @item_window.help_window = @help_window
  1255.     @actor_command_window.active = false
  1256.   end
  1257.   #--------------------------------------------------------------------------
  1258.   # ● アイテム選択の更新  ※再定義
  1259.   #--------------------------------------------------------------------------
  1260.   def update_item_selection
  1261.     # コマンド入力できる状態でなくなればキャンセル
  1262.     return reset_command unless commanding?
  1263.     @item_window.active = true
  1264.     @item_window.update
  1265.     @help_window.update
  1266.     if Input.trigger?(Input::B)
  1267.       Sound.play_cancel
  1268.       end_item_selection
  1269.       $in_select = true
  1270.     elsif Input.trigger?(Input::C)
  1271.       @item = @item_window.item
  1272.       if @item != nil
  1273.         $game_party.last_item_id = @item.id
  1274.       end
  1275.       if $game_party.item_can_use?(@item)
  1276.         Sound.play_decision
  1277.         determine_item
  1278.       else
  1279.         Sound.play_buzzer
  1280.       end
  1281.     end
  1282.   end
  1283.   #--------------------------------------------------------------------------
  1284.   # ● アイテムの決定  ※再定義
  1285.   #--------------------------------------------------------------------------
  1286.   def determine_item
  1287.     @commander.action.set_item(@item.id)
  1288.     @item_window.active = false
  1289.     if @item.need_selection?
  1290.       if @item.for_opponent?
  1291.         start_target_enemy_selection
  1292.       else
  1293.         start_target_actor_selection
  1294.       end
  1295.     else
  1296.       end_item_selection
  1297.       end_target_selection
  1298.     end
  1299.   end
  1300.   #--------------------------------------------------------------------------
  1301.   # ● アイテム選択の終了
  1302.   #--------------------------------------------------------------------------
  1303.   alias end_item_selection_n01 end_item_selection
  1304.   def end_item_selection
  1305.     end_item_selection_n01
  1306.     $in_select = false
  1307.   end
  1308.   #--------------------------------------------------------------------------
  1309.   # ● 勝敗判定  ※再定義
  1310.   #--------------------------------------------------------------------------
  1311.   def judge_win_loss
  1312.     return true unless $game_temp.in_battle
  1313.     if $game_party.all_dead?
  1314.       @judge = true
  1315.       $gauge_stop = true
  1316.       closed_window
  1317.       @spriteset.atb_dispose
  1318.       $game_troop.clear_actions
  1319.       $game_party.clear_actions
  1320.       process_defeat
  1321.       return true
  1322.     elsif $game_troop.all_dead?
  1323.       @judge = true
  1324.       $gauge_stop = true
  1325.       closed_window
  1326.       @spriteset.atb_dispose
  1327.       $game_troop.clear_actions
  1328.       $game_party.clear_actions
  1329.       process_victory
  1330.       return true
  1331.     else
  1332.       return false
  1333.     end
  1334.   end
  1335. end  
  1336. #==============================================================================
  1337. # ■ Game_Battler (分割定義 1)
  1338. #------------------------------------------------------------------------------
  1339. #  バトラーを扱うクラスです。
  1340. #==============================================================================
  1341. class Game_Battler
  1342.   #--------------------------------------------------------------------------
  1343.   # ● 公開インスタンス変数
  1344.   #--------------------------------------------------------------------------
  1345.   attr_accessor :at_count         # コマンド待ちゲージ(1000がMAX)
  1346.   attr_accessor :at_active        # コマンド入力可能
  1347.   attr_accessor :atb_count_up     # ATBカウントアップ中
  1348.   attr_accessor :act_count        # 行動待ちゲージ(1000がMAX)
  1349.   attr_accessor :act_active       # 行動可能
  1350.   attr_accessor :at_speed         # ゲージアップスピード基準値
  1351.   attr_accessor :charge_action    # チャージアクション
  1352.   attr_accessor :charge_start     # チャージ中か
  1353.   attr_accessor :union_skill_id   # 合体攻撃スキルID
  1354.   attr_accessor :union_battler    # 合体攻撃参加者か
  1355.   attr_accessor :speed_level      # 戦闘参加者の最速スピード基準
  1356.   attr_accessor :low_speed_level  # 戦闘参加者の最遅スピード基準
  1357.   attr_accessor :graphics_width   # バトラー画像1セルあたりの横幅
  1358.   attr_accessor :graphics_height  # バトラー画像1セルあたりの縦幅
  1359.   #--------------------------------------------------------------------------
  1360.   # ● ステートの付加  ATBダメージ処理を追加
  1361.   #--------------------------------------------------------------------------
  1362.   alias add_state_n02 add_state
  1363.   def add_state(state_id)
  1364.     add_state_n02(state_id)
  1365.     if $data_states[state_id].atb_damage != 0
  1366.       @at_count = @at_count + $data_states[state_id].atb_damage * 10
  1367.       @at_count = 0 if @at_count < 0 && !$data_states[state_id].atb_minus_damage
  1368.       @at_count = 1000 if @at_count > 1000
  1369.       # ATBダメージでチャージキャンセル
  1370.       if $data_states[state_id].atb_damage < 0
  1371.         @act_count = 0
  1372.         @act_active = false
  1373.         @at_active = false
  1374.         @atb_count_up = true
  1375.       end
  1376.     end  
  1377.   end
  1378.   #--------------------------------------------------------------------------
  1379.   # ● 戦闘開始時のAT設定
  1380.   #--------------------------------------------------------------------------
  1381.   def atb_setting
  1382.     # 初期化
  1383.     @at_count = @act_count = @speed_level = @low_speed_level = @union_skill_id = 0
  1384.     @at_active = @act_active = @atb_count_up = @charge_start = @union_battler = false
  1385.     $in_party_command = $in_command = $in_target = $in_select = $in_action = false
  1386.     @charge_action = normal
  1387.     $in_union_action = false
  1388.     # ゲージアップスピード(戦闘速度)
  1389.     @at_speed = $game_party.atb_control[1]
  1390.     # ユーザー設定を使わない場合
  1391.     return if N02::ATB_CUSTOMIZE
  1392.     @at_speed = N02::ATB_SPEED
  1393.   end
  1394.   #--------------------------------------------------------------------------
  1395.   # ● ATBスピード基準値リフレッシュ
  1396.   #--------------------------------------------------------------------------
  1397.   def atb_base_speed_refresh
  1398.     battle_members = $game_party.members + $game_troop.members
  1399.     battle_members.sort! do |a,b|
  1400.       b.agi - a.agi
  1401.     end
  1402.     self.speed_level = battle_members[0].agi
  1403.     self.low_speed_level = battle_members[battle_members.size - 1].agi
  1404.   end
  1405.   #--------------------------------------------------------------------------
  1406.   # ● 自動行動判定
  1407.   #--------------------------------------------------------------------------
  1408.   def auto_action?
  1409.     return true if berserker? or confusion? or auto_battle or @union_skill_id != 0
  1410.     return false
  1411.   end
  1412.   #--------------------------------------------------------------------------
  1413.   # ● 合体攻撃スキル判定
  1414.   #--------------------------------------------------------------------------
  1415.   def union_skill?(skill_id)
  1416.     # スキルに合体攻撃設定があるかチェック
  1417.     for union_action in $data_skills[skill_id].union_action
  1418.       union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
  1419.     end
  1420.     return false if union_skills == nil
  1421.     return true
  1422.   end  
  1423.   #--------------------------------------------------------------------------
  1424.   # ● 合体攻撃使用可能判定
  1425.   #--------------------------------------------------------------------------
  1426.   def union_skill_can_use?(skill_id)
  1427.     return false if $in_union_action
  1428.     for union_action in $data_skills[skill_id].union_action
  1429.       union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
  1430.     end
  1431.     return false if union_skills == nil
  1432.     partners = []
  1433.     # 合体攻撃メンバーが使用可能かチェック
  1434.     for skill_id in union_skills
  1435.       for actor in $game_party.members
  1436.         if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
  1437.           partners.push(actor)
  1438.         end
  1439.       end
  1440.     end
  1441.     return false if partners.size != union_skills.size
  1442.     return true
  1443.   end
  1444. end  
  1445. #==============================================================================
  1446. # ■ Game_Party
  1447. #------------------------------------------------------------------------------
  1448. #  パーティを扱うクラスです。
  1449. #==============================================================================
  1450. class Game_Party < Game_Unit
  1451.   #--------------------------------------------------------------------------
  1452.   # ● 公開インスタンス変数
  1453.   #--------------------------------------------------------------------------
  1454.   attr_accessor   :atb_custom                       # ATBユーザー設定
  1455.   attr_accessor   :atb_control                      # ATB設定
  1456.   #--------------------------------------------------------------------------
  1457.   # ● オブジェクト初期化
  1458.   #--------------------------------------------------------------------------
  1459.   alias initialize_n02 initialize
  1460.   def initialize
  1461.     initialize_n02
  1462.     @atb_control = []
  1463.     @atb_custom = [N02::ATB_NEWGAME_MODE, N02::ATB_NEWGAME_SPEED - 1]
  1464.   end
  1465.   #--------------------------------------------------------------------------
  1466.   # ● ユーザー設定をATB設定に反映
  1467.   #--------------------------------------------------------------------------
  1468.   def atb_customize
  1469.     # ウエイト・アクティブ設定を格納
  1470.     case @atb_custom[0]
  1471.     when 0;@atb_control[0] = N02::ATB_MODE1
  1472.     when 1;@atb_control[0] = N02::ATB_MODE2
  1473.     when 2;@atb_control[0] = N02::ATB_MODE3
  1474.     end
  1475.     # 戦闘速度を格納
  1476.     @atb_control[1] = N02::ATB_SPEED_MODE[@atb_custom[1]]
  1477.     # ユーザー設定を使わない場合
  1478.     return if N02::ATB_CUSTOMIZE
  1479.     @atb_control[0] = ["",N02::ATB_PARTY_COMMAND_WAIT, N02::ATB_COMMAND_WAIT, N02::ATB_TARGET_WAIT, N02::ATB_SELECT_WAIT, N02::ATB_ACTION_WAIT]
  1480.     @atb_control[1] = N02::ATB_SPEED
  1481.   end
  1482. end
  1483. #==============================================================================
  1484. # ■ Sprite_MoveAnime
  1485. #------------------------------------------------------------------------------
  1486. #  ATBゲージ用のスプライトです。
  1487. #==============================================================================
  1488. class Sprite_ATB < Sprite_Base
  1489.   #--------------------------------------------------------------------------
  1490.   # ● 公開インスタンス変数
  1491.   #--------------------------------------------------------------------------
  1492.   attr_accessor :battler
  1493.   attr_accessor :count            # 更新カウント
  1494.   #--------------------------------------------------------------------------
  1495.   # ● オブジェクト初期化
  1496.   #--------------------------------------------------------------------------
  1497.   def initialize(viewport,battler = nil)
  1498.     super(viewport)
  1499.     @battler = battler
  1500.     @count = 0
  1501.     @base_atb_count = 1
  1502.     @restriction_count = 0
  1503.     @state_freeze = false
  1504.     @update = 0
  1505.     @pre_width = 0
  1506.     make_gauge
  1507.     start_atb
  1508.     @party_command_wait = $game_party.atb_control[0][1]
  1509.     @command_wait = $game_party.atb_control[0][2]
  1510.     @target_wait = $game_party.atb_control[0][3]
  1511.     @select_wait = $game_party.atb_control[0][4]
  1512.     @action_wait = $game_party.atb_control[0][5]
  1513.   end
  1514.   #--------------------------------------------------------------------------
  1515.   # ● ATB初期値セッティング
  1516.   #--------------------------------------------------------------------------
  1517.   def start_atb
  1518.     atb = battler.atb_base * 10 + rand(N02::ATB_BASE_ADD) * 10
  1519.     if battler.actor?
  1520.       atb1 = battler.weapons[0].atb_base * 10 if battler.weapons[0] != nil
  1521.       atb2 = battler.weapons[1].atb_base * 10 if battler.weapons[1] != nil
  1522.       atb1 = atb if atb1 == nil
  1523.       atb2 = atb1 if atb2 == nil
  1524.       atb += (atb1 + atb2) / 2
  1525.       for i in 0...battler.armors.size
  1526.         # 二刀はキャンセル
  1527.         next if battler.two_swords_style && battler.armors[0] != nil && battler.armors[0]
  1528.         atb += battler.armors[i].atb_base * 10 if battler.armors[i] != nil
  1529.       end  
  1530.     end
  1531.     change_atb(atb)
  1532.   end
  1533.   #--------------------------------------------------------------------------
  1534.   # ● ゲージ作成
  1535.   #--------------------------------------------------------------------------
  1536.   def make_gauge
  1537.     self.bitmap = Cache.system("atb_bar_skin")
  1538.     @gauge = Sprite.new(viewport)
  1539.     @gauge.bitmap = Cache.system("atb_bar")
  1540.     @gauge_max = Sprite.new(viewport)
  1541.     @gauge_max.bitmap = Cache.system("atb_bar_active")
  1542.     @gauge_max.visible = false
  1543.     @gauge_division = 1000 / N02::ATB_WIDTH
  1544.     @gauge_space = N02::ATB_SPACE
  1545.   end
  1546.   #--------------------------------------------------------------------------
  1547.   # ● 座標セット
  1548.   #--------------------------------------------------------------------------
  1549.   def set(x, y)
  1550.     self.ox = @gauge.ox = @gauge_max.ox = self.bitmap.width / 2
  1551.     self.oy = @gauge.oy = @gauge_max.oy = self.bitmap.height / 2
  1552.     self.visible = @gauge.visible = @gauge_max.visible = false
  1553.     if @battler.actor? && N02::ATB_POSITION_HPWINDOW
  1554.       self.z = @gauge.z = @gauge_max.z = 0
  1555.       self.x = @gauge.x = @gauge_max.x = N02::ATB_PARTY_POSITION[@battler.index][0]
  1556.       self.y = @gauge.y = @gauge_max.y = N02::ATB_PARTY_POSITION[@battler.index][1]
  1557.       return
  1558.     end
  1559.     adjust = N02::ATB_POSITION_ENEMY
  1560.     adjust = N02::ATB_POSITION_ACTOR if battler.actor?
  1561.     self.x = @gauge.x = @gauge_max.x = x + adjust[0]
  1562.     self.x = @gauge.x = @gauge_max.x = x - adjust[0] if $back_attack
  1563.     self.y = @gauge.y = @gauge_max.y = y + adjust[1]
  1564.     self.z = @gauge.z = @gauge_max.z = battler.position_z + 10
  1565.     @gauge_max.z += 1
  1566.   end
  1567.   #--------------------------------------------------------------------------
  1568.   # ● ATBゲージ切り替え
  1569.   #--------------------------------------------------------------------------
  1570.   def change_atb(restart_gauge = 0)
  1571.     @battler.atb_base_speed_refresh
  1572.     case N02::ATB_BASE_SPEED
  1573.     when 0
  1574.       return @base_atb_count = @battler.at_speed * battler.agi if N02::ATB_ABSOLUTE_SPEED == 0
  1575.       @base_atb_count = @battler.at_speed * battler.agi / N02::ATB_ABSOLUTE_SPEED
  1576.     when 1
  1577.       return @base_atb_count = @battler.at_speed * battler.agi if @battler.speed_level == 0
  1578.       @base_atb_count = @battler.at_speed * battler.agi / @battler.speed_level
  1579.     when 2
  1580.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
  1581.       @base_atb_count = @battler.at_speed * @battler.agi / @battler.low_speed_level
  1582.     when 3
  1583.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1584.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1585.     when 4
  1586.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1587.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1588.     when 5
  1589.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1590.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1591.     when 6
  1592.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1593.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1594.     when 7
  1595.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1596.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1597.     when 8
  1598.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1599.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1600.     when 9
  1601.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1602.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1603.       end
  1604.     @base_atb_count = 1 if @base_atb_count == 0
  1605.     @battler.at_count = restart_gauge
  1606.     @battler.act_count = 0
  1607.     @gauge.bitmap = Cache.system("atb_bar")
  1608.     @battler.act_active = false
  1609.     @battler.at_active = false
  1610.     @battler.atb_count_up = true
  1611.   end
  1612.   #--------------------------------------------------------------------------
  1613.   # ● ACTゲージ切り替え
  1614.   #--------------------------------------------------------------------------
  1615.   def change_act(act_type)
  1616.     change_atb
  1617.     case act_type[0]
  1618.     when 0
  1619.       base = @battler.at_speed * @battler.agi
  1620.       base = @battler.at_speed * @battler.agi / act_type[2] if act_type[2] != 0
  1621.     when 1
  1622.       base = @battler.at_speed * @battler.agi / @battler.speed_level
  1623.     when 2
  1624.       base = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
  1625.       base = @battler.at_speed * @battler.agi / @battler.low_speed_level
  1626.     when 3
  1627.       base = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1628.       base = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1629.     when 4
  1630.       base = @battler.at_speed
  1631.     end
  1632.     if act_type[1] <= 0
  1633.       @base_act_count = 1000
  1634.     else
  1635.       @base_act_count = base *  100 / act_type[1]
  1636.     end
  1637.     @base_act_count = 1 if @base_act_count == 0
  1638.     @battler.act_count = 0
  1639.     @gauge.bitmap = Cache.system("act_bar")
  1640.     @battler.atb_count_up = false
  1641.     @battler.at_active = false
  1642.   end
  1643.   #--------------------------------------------------------------------------
  1644.   # ● フレーム更新
  1645.   #--------------------------------------------------------------------------
  1646.   def update
  1647.     # ステート管理
  1648.     states_control
  1649.     # 強制ゲージストップ
  1650.     return if $gauge_stop or !@battler.exist? or $game_message.visible
  1651.     # アクションウエイト
  1652.     wait = true if $in_action && !@action_wait
  1653.     wait = false if $in_action && @action_wait
  1654.     # パーティコマンド選択中ウエイト
  1655.     wait = true if $in_party_command && !@party_command_wait
  1656.     wait = false if $in_party_command && @party_command_wait
  1657.     # 戦闘コマンド選択中ウエイト
  1658.     wait = true if $in_command && !@command_wait
  1659.     wait = false if $in_command && @command_wait
  1660.     # ターゲット選択中ウエイト
  1661.     wait = true if $in_target && !@target_wait
  1662.     wait = false if $in_target && @target_wait
  1663.     # スキル/アイテム選択中ウエイト
  1664.     wait = true if $in_select && !@select_wait
  1665.     wait = false if $in_select && @select_wait
  1666.     # アクション中はゲージを消すか
  1667.     self.visible = @gauge.visible = true
  1668.     self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ENEMY_OFF && !@battler.actor? && @battler.union_skill_id == 0
  1669.     self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ACTOR_OFF && @battler.actor? && @battler.union_skill_id == 0
  1670.     # ゲージ表示設定
  1671.     self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.atb_on
  1672.     self.visible = @gauge.visible = @gauge_max.visible = false if @battler.actor? && $game_message.visible && N02::ATB_POSITION_HPWINDOW
  1673.     # 見えないエネミーはゲージ隠蔽
  1674.     self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.actor? && !@battler.exist?
  1675.     # ボタン入力によるゲージ制御
  1676.     wait = true if Input.press?(Input::ALT) && N02::ATB_ALT_WAIT
  1677.     wait = false if Input.press?(Input::CTRL) && N02::ATB_CTRL_ACTIVE
  1678.     # 自身のみアクションウエイト
  1679.     wait = true if @battler.act_active
  1680.     # ゲージウエイト
  1681.     return if wait
  1682.     # ステートによるゲージストップ処理
  1683.     return recover_states_freeze if @state_freeze
  1684.     # ゲージカウントアップ
  1685.     gauge_update
  1686.     # ゲージ描画
  1687.     return if @pre_width == @gauge_space + @battler.act_count / @gauge_division && !@battler.atb_count_up
  1688.     return if @pre_width == @gauge_space + @battler.at_count / @gauge_division && @battler.atb_count_up
  1689.     gauge_refresh
  1690.   end
  1691.   #--------------------------------------------------------------------------
  1692.   # ● ゲージカウントアップ
  1693.   #--------------------------------------------------------------------------
  1694.   def gauge_update
  1695.     # ACTカウントアップ
  1696.     act if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
  1697.     # ATBカウントアップ
  1698.     atb if @battler.atb_count_up
  1699.   end
  1700.   #--------------------------------------------------------------------------
  1701.   # ● ゲージリフレッシュ
  1702.   #--------------------------------------------------------------------------
  1703.   def gauge_refresh
  1704.     @gauge_max.visible = false if !@battler.act_active && !@battler.at_active
  1705.     @gauge.src_rect.width = @pre_width = @gauge_space + @battler.act_count / @gauge_division if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
  1706.     @gauge.src_rect.width = @pre_width = @gauge_space + @battler.at_count / @gauge_division if @battler.atb_count_up
  1707.   end
  1708.   #--------------------------------------------------------------------------
  1709.   # ● ゲージ隠蔽
  1710.   #--------------------------------------------------------------------------
  1711.   def off
  1712.     self.visible = @gauge.visible = @gauge_max.visible = false
  1713.   end
  1714.   #--------------------------------------------------------------------------
  1715.   # ● ゲージ表示
  1716.   #--------------------------------------------------------------------------
  1717.   def on
  1718.     self.visible = @gauge.visible = @gauge_max.visible = true
  1719.     gauge_refresh
  1720.   end
  1721.   #--------------------------------------------------------------------------
  1722.   # ● ステート管理
  1723.   #--------------------------------------------------------------------------
  1724.   def states_control
  1725.     if !@state_freeze && !@battler.movable?
  1726.       # 行動不能はゲージを0に
  1727.       @restriction_count = @battler.at_count
  1728.       @state_freeze = true
  1729.       @atb_dead = true if @battler.dead? && !@atb_dead
  1730.       change_atb(0)
  1731.       gauge_refresh
  1732.       self.visible = @gauge_max.visible = @gauge.visible = false if !@battler.actor? && !@battler.exist?
  1733.     # ステート復帰時
  1734.     elsif @battler.movable? && @state_freeze
  1735.       @state_freeze = false
  1736.       # 戦闘不能復帰時のゲージ処理
  1737.       return if !@atb_dead
  1738.       change_atb(N02::ATB_DEAD_COUNT * 10)
  1739.       @atb_dead = false
  1740.       gauge_refresh
  1741.     end
  1742.   end
  1743.   #--------------------------------------------------------------------------
  1744.   # ● ステートによるゲージストップ回復
  1745.   #--------------------------------------------------------------------------
  1746.   def recover_states_freeze
  1747.     @restriction_count += @base_atb_count
  1748.     @restriction_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
  1749.     if @restriction_count >= 1000
  1750.       # ステート自然回復許可
  1751.       @battler.remove_states_auto
  1752.       @restriction_count = 0
  1753.     end
  1754.   end
  1755.   #--------------------------------------------------------------------------
  1756.   # ● ATBカウント
  1757.   #--------------------------------------------------------------------------
  1758.   def atb
  1759.     if @battler.at_count <= 1000
  1760.       @gauge_max.visible = false
  1761.       @battler.at_count += @base_atb_count
  1762.       @battler.at_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
  1763.     end
  1764.     # ATBゲージMAX
  1765.     if @battler.at_count >= 1000
  1766.       # ステート自然回復
  1767.       @battler.remove_states_auto
  1768.       @battler.atb_count_up = false
  1769.       @battler.at_active = true
  1770.       @gauge.src_rect.width = 52
  1771.       return if !@battler.atb_on
  1772.       Audio.se_play("Audio/SE/" + N02::ATB_MAX_SOUND01[2], N02::ATB_MAX_SOUND01[1],  N02::ATB_MAX_SOUND01[0])
  1773.       @gauge_max.visible = true
  1774.     end
  1775.     @battler.act_active = false
  1776.   end  
  1777.   #--------------------------------------------------------------------------
  1778.   # ● ACTカウント
  1779.   #--------------------------------------------------------------------------
  1780.   def act
  1781.     if @battler.act_count <= 1000
  1782.       @gauge_max.visible = false
  1783.       @battler.act_count += @base_act_count
  1784.       @battler.at_count += @base_atb_count * 3 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
  1785.     end
  1786.     # ACTゲージMAX
  1787.     if @battler.act_count >= 1000 && !@battler.act_active
  1788.       @battler.act_active = true
  1789.       @gauge.src_rect.width = 52
  1790.       return if !@battler.atb_on
  1791.       Audio.se_play("Audio/SE/" + N02::ACT_MAX_SOUND01[2], N02::ACT_MAX_SOUND01[1],  N02::ACT_MAX_SOUND01[0])
  1792.       @gauge_max.visible = true
  1793.     end
  1794.   end  
  1795.   #--------------------------------------------------------------------------
  1796.   # ● 解放
  1797.   #--------------------------------------------------------------------------
  1798.   def dispose
  1799.     super
  1800.     @gauge.dispose
  1801.     @gauge_max.dispose
  1802.   end
  1803. end
  1804. #==============================================================================
  1805. # ■ Sprite_Cursor
  1806. #------------------------------------------------------------------------------
  1807. #  カーソルのスプライトです。
  1808. #==============================================================================
  1809. class Sprite_Cursor < Sprite_Base
  1810.   #--------------------------------------------------------------------------
  1811.   # ● オブジェクト初期化
  1812.   #--------------------------------------------------------------------------
  1813.   def initialize
  1814.     super
  1815.     create_target_cursor
  1816.   end
  1817.   #--------------------------------------------------------------------------
  1818.   # ● ターゲットカーソルスプライトの作成
  1819.   #--------------------------------------------------------------------------
  1820.   def create_target_cursor
  1821.     self.bitmap = Cache.system("cursor")
  1822.     @width = self.bitmap.width
  1823.     @height = self.bitmap.height / 3
  1824.     self.src_rect.set(0, 0, @width, @height)
  1825.     @cursor_flame = 0
  1826.     self.x = @pre_x = 272
  1827.     self.y = @pre_y = 208
  1828.     self.z = 1
  1829.     self.ox = @width
  1830.     self.oy = @height
  1831.     self.visible = false
  1832.     @time = 0
  1833.     @flash_time = 0
  1834.   end
  1835.   #--------------------------------------------------------------------------
  1836.   # ● フレーム更新
  1837.   #--------------------------------------------------------------------------
  1838.   def update
  1839.     # カーソル画像更新
  1840.     @cursor_flame = 0 if @cursor_flame == 40
  1841.     self.src_rect.set(0,           0, @width, @height) if @cursor_flame == 0
  1842.     self.src_rect.set(0,     @height, @width, @height) if @cursor_flame == 10
  1843.     self.src_rect.set(0, 2 * @height, @width, @height) if @cursor_flame == 20
  1844.     self.src_rect.set(0,     @height, @width, @height) if @cursor_flame == 30
  1845.     @cursor_flame += 1
  1846.     # カーソル座標更新
  1847.     return if @battler == nil
  1848.     # ターゲットを光らせる
  1849.     @flash_time -= 1
  1850.     if @flash_time == 0 && @battler.exist? && !@battler.collapse
  1851.       @battler.white_flash = true
  1852.       @flash_time = 20
  1853.     end
  1854.     if @time == 0
  1855.       self.x = @battler.position_x
  1856.       return self.y = @battler.position_y - @battler.graphics_width / 5
  1857.     end  
  1858.     @time -= 1
  1859.     self.x = @pre_x + (@battler.position_x - @pre_x) * (9 - @time) / 9
  1860.     self.y = @pre_y + (@battler.position_y - @battler.graphics_width / 5 - @pre_y) * (9 - @time) / 9
  1861.   end
  1862.   #--------------------------------------------------------------------------
  1863.   # ● カーソル移動情報セット
  1864.   #--------------------------------------------------------------------------
  1865.   def set(battler)
  1866.     self.visible = true
  1867.     @battler = battler
  1868.     return if @battler == nil
  1869.     @battler.white_flash = true if @battler.exist? && !@battler.collapse
  1870.     @time = 9
  1871.     @flash_time = 20
  1872.     @pre_x = self.x
  1873.     @pre_y = self.y
  1874.   end
  1875. end
  1876. #==============================================================================
  1877. # ■ Sprite_Battler
  1878. #------------------------------------------------------------------------------
  1879. #  バトラー表示用のスプライトです。
  1880. #==============================================================================
  1881. class Sprite_Battler < Sprite_Base
  1882.   #--------------------------------------------------------------------------
  1883.   # ● バトラー作成
  1884.   #--------------------------------------------------------------------------
  1885.   alias make_battler_n01 make_battler
  1886.   def make_battler
  1887.     make_battler_n01
  1888.     @battler.graphics_width = @width
  1889.     @battler.graphics_height = @height
  1890.     make_atb
  1891.   end  
  1892.   #--------------------------------------------------------------------------
  1893.   # ● 解放
  1894.   #--------------------------------------------------------------------------
  1895.   alias dispose_n01 dispose
  1896.   def dispose
  1897.     dispose_n01
  1898.     @atb_gauge.dispose if @atb_gauge != nil
  1899.   end  
  1900.   #--------------------------------------------------------------------------
  1901.   # ● 待機アクション  ※再定義
  1902.   #--------------------------------------------------------------------------
  1903.   def stand_by
  1904.     # チャージアクションを優先
  1905.     @battler.charge_start = false if @battler.charge_start && !@battler.exist?
  1906.     return @repeat_action = @battler.charge_action if @battler.charge_start
  1907.     # 通常待機に
  1908.     @repeat_action = @battler.normal
  1909.     # HPが1/4でピンチモーションに
  1910.     @repeat_action = @battler.pinch if @battler.hp <= @battler.maxhp / 4
  1911.     # 防御中
  1912.     @repeat_action = @battler.defence if @battler.guarding?
  1913.     # 何もステートがなければ終了
  1914.     return if @battler.state_id == nil
  1915.     for state in @battler.states.reverse
  1916.       # アクション禁止のステートだったらスキップ
  1917.       next if state.extension.include?("ステートアクション禁止")
  1918.       # エネミーで禁止されているステートアクションだったらスキップ
  1919.       next if @battler.is_a?(Game_Enemy) && state.extension.include?("エネミー除外")
  1920.       # ステートのモーションに
  1921.       @repeat_action = state.base_action
  1922.     end
  1923.   end
  1924.   #--------------------------------------------------------------------------
  1925.   # ● ATBゲージ作成
  1926.   #--------------------------------------------------------------------------
  1927.   def make_atb
  1928.     return if battler == nil
  1929.     battler.atb_setting
  1930.     if battler.actor? && N02::ATB_POSITION_HPWINDOW
  1931.       @atb_gauge = Sprite_ATB.new(@viewport2,battler)
  1932.     else
  1933.       @atb_gauge = Sprite_ATB.new(viewport,battler)
  1934.     end
  1935.     @atb_gauge.set(self.x, self.y)
  1936.   end  
  1937.   #--------------------------------------------------------------------------
  1938.   # ● ATBゲージビューポート作成
  1939.   #--------------------------------------------------------------------------
  1940.   def make_atb_viewport(new_viewport)
  1941.     @viewport2 = new_viewport
  1942.   end  
  1943.   #--------------------------------------------------------------------------
  1944.   # ● フレーム更新
  1945.   #--------------------------------------------------------------------------
  1946.   alias update_n01 update
  1947.   def update
  1948.     update_n01
  1949.     # ATB更新
  1950.     @atb_gauge.update if @atb_gauge != nil
  1951.   end
  1952.   #--------------------------------------------------------------------------
  1953.   # ● ゲージ更新
  1954.   #--------------------------------------------------------------------------
  1955.   def gauge_update
  1956.     @atb_gauge.gauge_update if @atb_gauge != nil
  1957.   end
  1958.   #--------------------------------------------------------------------------
  1959.   # ● ゲージリフレッシュ
  1960.   #--------------------------------------------------------------------------
  1961.   def gauge_refresh
  1962.     @atb_gauge.gauge_refresh if @atb_gauge != nil
  1963.   end
  1964.   #--------------------------------------------------------------------------
  1965.   # ● ゲージ表示
  1966.   #--------------------------------------------------------------------------
  1967.   def gauge_on
  1968.     @atb_gauge.on if @atb_gauge != nil
  1969.   end
  1970.   #--------------------------------------------------------------------------
  1971.   # ● ゲージ隠蔽
  1972.   #--------------------------------------------------------------------------
  1973.   def gauge_off
  1974.     @atb_gauge.off if @atb_gauge != nil
  1975.   end
  1976.   #--------------------------------------------------------------------------
  1977.   # ● ATBゲージ切り替え
  1978.   #--------------------------------------------------------------------------
  1979.   def change_atb(restart_gauge)
  1980.     @atb_gauge.change_atb(restart_gauge) if @atb_gauge != nil
  1981.   end
  1982.   #--------------------------------------------------------------------------
  1983.   # ● ACTゲージ切り替え
  1984.   #--------------------------------------------------------------------------
  1985.   def change_act(act_type)
  1986.     @atb_gauge.change_act(act_type) if @atb_gauge != nil
  1987.   end
  1988.   #--------------------------------------------------------------------------
  1989.   # ● ATBゲージ開放
  1990.   #--------------------------------------------------------------------------
  1991.   def atb_dispose
  1992.     @atb_gauge.dispose if @atb_gauge != nil
  1993.     @atb_gauge = nil
  1994.   end
  1995. end
  1996. #==============================================================================
  1997. # ■ Spriteset_Battle
  1998. #------------------------------------------------------------------------------
  1999. #  バトル画面のスプライトをまとめたクラスです。
  2000. #==============================================================================
  2001. class Spriteset_Battle
  2002.   #--------------------------------------------------------------------------
  2003.   # ● アクタースプライトの作成
  2004.   #--------------------------------------------------------------------------
  2005.   alias create_actors_n01 create_actors
  2006.   def create_actors
  2007.     create_actors_n01
  2008.     if N02::ATB_POSITION_HPWINDOW
  2009.       for sprites in @actor_sprites + @enemy_sprites
  2010.         sprites.make_atb_viewport(@viewport4)
  2011.       end
  2012.     end  
  2013.   end
  2014.   #--------------------------------------------------------------------------
  2015.   # ● ターゲット情報リフレッシュ
  2016.   #--------------------------------------------------------------------------
  2017.   def update_target(actor, index)
  2018.     @actor_sprites[index].update_target if actor
  2019.     @enemy_sprites[index].update_target unless actor
  2020.   end
  2021.   #--------------------------------------------------------------------------
  2022.   # ● ゲージ更新
  2023.   #--------------------------------------------------------------------------
  2024.   def gauge_update
  2025.     for sprites in @actor_sprites + @enemy_sprites
  2026.       sprites.gauge_update if sprites != nil
  2027.     end
  2028.   end
  2029.   #--------------------------------------------------------------------------
  2030.   # ● ゲージリフレッシュ
  2031.   #--------------------------------------------------------------------------
  2032.   def gauge_refresh(actor, index)
  2033.     @actor_sprites[index].gauge_refresh if actor
  2034.     @enemy_sprites[index].gauge_refresh unless actor
  2035.   end
  2036.   #--------------------------------------------------------------------------
  2037.   # ● ゲージ表示
  2038.   #--------------------------------------------------------------------------
  2039.   def gauge_on
  2040.     for sprites in @actor_sprites + @enemy_sprites
  2041.       sprites.gauge_on if sprites != nil
  2042.     end
  2043.   end
  2044.   #--------------------------------------------------------------------------
  2045.   # ● ゲージ隠蔽
  2046.   #--------------------------------------------------------------------------
  2047.   def gauge_off
  2048.     for sprites in @actor_sprites + @enemy_sprites
  2049.       sprites.gauge_off if sprites != nil
  2050.     end
  2051.   end
  2052.   #--------------------------------------------------------------------------
  2053.   # ● ATBゲージ切り替え
  2054.   #--------------------------------------------------------------------------
  2055.   def change_atb(restart_gauge, actor, index)#
  2056.     @actor_sprites[index].change_atb(restart_gauge) if actor
  2057.     @enemy_sprites[index].change_atb(restart_gauge) unless actor
  2058.   end
  2059.   #--------------------------------------------------------------------------
  2060.   # ● ACTゲージ切り替え
  2061.   #--------------------------------------------------------------------------
  2062.   def change_act(act_type, actor, index)
  2063.     @actor_sprites[index].change_act(act_type) if actor
  2064.     @enemy_sprites[index].change_act(act_type) unless actor
  2065.   end
  2066.   #--------------------------------------------------------------------------
  2067.   # ● ATBゲージ一斉開放
  2068.   #--------------------------------------------------------------------------
  2069.   def atb_dispose
  2070.     for sprites in @actor_sprites + @enemy_sprites
  2071.       sprites.atb_dispose if sprites != nil
  2072.     end
  2073.   end
  2074. end
  2075. #==============================================================================
  2076. # ■ Window_Help
  2077. #------------------------------------------------------------------------------
  2078. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  2079. #==============================================================================
  2080. class Window_Help < Window_Base
  2081.   #--------------------------------------------------------------------------
  2082.   # ● テキスト設定
  2083.   #--------------------------------------------------------------------------
  2084.   def set_text_n02add(member)
  2085.     return if member == nil
  2086.     self.contents.clear
  2087.     self.contents.font.color = normal_color
  2088.     if !member.actor? && N02::ENEMY_NON_DISPLAY.include?(member.enemy_id)
  2089.       return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
  2090.     elsif member.actor? && !N02::ACTOR_DISPLAY
  2091.       return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
  2092.     end
  2093.     if N02::WORD_STATE_DISPLAY && N02::HP_DISPLAY
  2094.       self.contents.draw_text(0, 0, 180, WLH, member.name, 1)
  2095.       draw_actor_hp(member, 182, 0, 120)
  2096.       text = "["
  2097.       for state in member.states
  2098.         next if N02::STATE_NON_DISPLAY.include?(state.id)
  2099.         text += " " if text != "["
  2100.         text += state.name
  2101.       end
  2102.       text += N02::WORD_NORMAL_STATE if text == "["
  2103.       text += "]"
  2104.       text = "" if text == "[]"
  2105.       self.contents.draw_text(315, 0, 195, WLH, text, 0)
  2106.     elsif N02::WORD_STATE_DISPLAY
  2107.       text = member.name + "  ["
  2108.       for state in member.states
  2109.         next if N02::STATE_NON_DISPLAY.include?(state.id)
  2110.         text += " " if text != member.name + "  ["
  2111.         text += state.name
  2112.       end
  2113.       text += N02::WORD_NORMAL_STATE if text == member.name + "  ["
  2114.       text += "]"
  2115.       text = "" if text == "[]"
  2116.       self.contents.draw_text(4, 0, self.width - 40, WLH, text, 1)
  2117.     elsif N02::HP_DISPLAY
  2118.       self.contents.draw_text(4, 0, 240, WLH, member.name, 1)
  2119.       draw_actor_hp(member, 262, 0, 120)
  2120.     end
  2121.   end
  2122. end
  2123. #==============================================================================
  2124. # ■ Window_Skill
  2125. #------------------------------------------------------------------------------
  2126. #  スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。
  2127. #==============================================================================
  2128. class Window_Skill < Window_Selectable
  2129.   #--------------------------------------------------------------------------
  2130.   # ● 項目の描画  ※再定義
  2131.   #--------------------------------------------------------------------------
  2132.   def draw_item(index)
  2133.     rect = item_rect(index)
  2134.     self.contents.clear_rect(rect)
  2135.     skill = @data[index]
  2136.     if skill != nil
  2137.       rect.width -= 4
  2138.       enabled = @actor.skill_can_use?(skill)
  2139.       enabled = @actor.union_skill_can_use?(skill.id) if @actor.union_skill?(skill.id)
  2140.       draw_item_name(skill, rect.x, rect.y, enabled)
  2141.       self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
  2142.     end
  2143.   end
  2144. end  
  2145. #==============================================================================
  2146. # ■ Window_BattleStatus
  2147. #------------------------------------------------------------------------------
  2148. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  2149. #==============================================================================
  2150. class Window_BattleStatus < Window_Selectable
  2151.   #--------------------------------------------------------------------------
  2152.   # ● カーソルを下に移動  ※再定義
  2153.   #--------------------------------------------------------------------------
  2154.   def cursor_down(wrap = false)
  2155.   end
  2156.   #--------------------------------------------------------------------------
  2157.   # ● カーソルを上に移動  ※再定義
  2158.   #--------------------------------------------------------------------------
  2159.   def cursor_up(wrap = false)
  2160.   end
  2161.   #--------------------------------------------------------------------------
  2162.   # ● フレーム更新  ※再定義
  2163.   #--------------------------------------------------------------------------
  2164.   def update
  2165.     super
  2166.     update_cursor
  2167.     call_update_help
  2168.   end
  2169. end
  2170. #==============================================================================
  2171. # ■ Window_PartyCommand2
  2172. #------------------------------------------------------------------------------
  2173. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  2174. #==============================================================================
  2175. class Window_PartyCommand2 < Window_Selectable
  2176.   #--------------------------------------------------------------------------
  2177.   # ● オブジェクト初期化
  2178.   #--------------------------------------------------------------------------
  2179.   def initialize
  2180.     super(1, 250, 608, 56)
  2181.     @item_max = 2
  2182.     @column_max = 2
  2183.     self.opacity = 0
  2184.     self.contents.draw_text(32, 0, 96, WLH, "战斗", 2)
  2185.     self.contents.draw_text(310, 0, 96, WLH, "逃跑", 2) if $game_troop.can_escape
  2186.     self.contents.font.color.alpha = 128
  2187.     self.contents.draw_text(310, 0, 96, WLH, "逃跑", 2) if !$game_troop.can_escape
  2188.     self.active = false
  2189.   end
  2190. end
  2191. #==============================================================================
  2192. # ■ Window_MenuATB
  2193. #------------------------------------------------------------------------------
  2194. #  メニュー画面でATB設定を表示するウィンドウです。
  2195. #==============================================================================
  2196. class Window_ATB_active < Window_Selectable
  2197.   # アクティブタイムバトルのカスタマイズ項目からのテキスト
  2198.   ATB_MODE_NAME = N02::ATB_MODE_NAME
  2199.   ATB_MODE1 = N02::ATB_MODE1[0]
  2200.   ATB_MODE2 = N02::ATB_MODE2[0]
  2201.   ATB_MODE3 = N02::ATB_MODE3[0]
  2202.   #--------------------------------------------------------------------------
  2203.   # ● オブジェクト初期化
  2204.   #--------------------------------------------------------------------------
  2205.   def initialize
  2206.     super(0, 174, 608, 56)
  2207.     @item_max = 3
  2208.     @column_max = 3
  2209.     set_active
  2210.     self.active = true
  2211.     self.index = $game_party.atb_custom[0]
  2212.   end
  2213.   #--------------------------------------------------------------------------
  2214.   # ● アクティブ化
  2215.   #--------------------------------------------------------------------------
  2216.   def set_active
  2217.     self.contents.clear
  2218.     self.contents.font.size = 15
  2219.     self.contents.font.color = crisis_color
  2220.     self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0)
  2221.     self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0)
  2222.     self.contents.font.size = 20
  2223.     self.contents.font.color = normal_color
  2224.     refresh
  2225.   end  
  2226.   #--------------------------------------------------------------------------
  2227.   # ● アクティブ解除
  2228.   #--------------------------------------------------------------------------
  2229.   def non_active
  2230.     self.contents.clear
  2231.     self.contents.font.size = 15
  2232.     self.contents.font.color = system_color
  2233.     self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0)
  2234.     self.contents.font.size = 20
  2235.     self.contents.font.color = normal_color
  2236.     refresh
  2237.   end  
  2238.   #--------------------------------------------------------------------------
  2239.   # ● 項目を描画する矩形の取得
  2240.   #--------------------------------------------------------------------------
  2241.   def refresh
  2242.     case $game_party.atb_custom[0]
  2243.     when 0
  2244.       self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
  2245.       self.contents.font.color.alpha = 100
  2246.       self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
  2247.       self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
  2248.     when 1
  2249.       self.contents.font.color.alpha = 100
  2250.       self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
  2251.       self.contents.font.color = normal_color
  2252.       self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
  2253.       self.contents.font.color.alpha = 100
  2254.       self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
  2255.     when 2
  2256.       self.contents.font.color.alpha = 100
  2257.       self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
  2258.       self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
  2259.       self.contents.font.color = normal_color
  2260.       self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
  2261.     end
  2262.   end
  2263.   #--------------------------------------------------------------------------
  2264.   # ● 項目を描画する矩形の取得
  2265.   #--------------------------------------------------------------------------
  2266.   def item_rect(index)
  2267.     rect = Rect.new(0, 0, 0, 0)
  2268.     rect.width = 140
  2269.     rect.height = 24
  2270.     rect.x = index % @column_max * rect.width + 100
  2271.     rect.y = index / @column_max * WLH
  2272.     return rect
  2273.   end
  2274. end  
  2275. #==============================================================================
  2276. # ■ Window_MenuATB
  2277. #------------------------------------------------------------------------------
  2278. #  メニュー画面でATB設定を表示するウィンドウです。
  2279. #==============================================================================
  2280. class Window_ATB_speed < Window_Selectable
  2281.   # アクティブタイムバトルのカスタマイズ項目からのテキスト
  2282.   ATB_MODE_NAME = N02::ATB_SPEED_NAME
  2283.   #--------------------------------------------------------------------------
  2284.   # ● オブジェクト初期化
  2285.   #--------------------------------------------------------------------------
  2286.   def initialize
  2287.     super(0, 230, 608, 56)
  2288.     @item_max = 9
  2289.     @column_max = 9
  2290.     non_active
  2291.     self.active = false
  2292.     self.index = -1
  2293.   end
  2294.   #--------------------------------------------------------------------------
  2295.   # ● アクティブ化
  2296.   #--------------------------------------------------------------------------
  2297.   def set_active
  2298.     self.contents.clear
  2299.     self.contents.font.size = 15
  2300.     self.contents.font.color = crisis_color
  2301.     self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
  2302.     self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
  2303.     self.contents.font.size = 22
  2304.     self.contents.font.color = normal_color
  2305.     refresh
  2306.   end  
  2307.   #--------------------------------------------------------------------------
  2308.   # ● アクティブ解除
  2309.   #--------------------------------------------------------------------------
  2310.   def non_active
  2311.     self.contents.clear
  2312.     self.contents.font.size = 15
  2313.     self.contents.font.color = system_color
  2314.     self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
  2315.     self.contents.font.size = 22
  2316.     self.contents.font.color = normal_color
  2317.     refresh
  2318.   end  
  2319.   #--------------------------------------------------------------------------
  2320.   # ● 項目を描画する矩形の取得
  2321.   #--------------------------------------------------------------------------
  2322.   def refresh
  2323.     self.contents.font.color.alpha = 96
  2324.     self.contents.draw_text(94 + 38 * 0, 0, 140, WLH, "1", 1)
  2325.     self.contents.draw_text(94 + 38 * 1, 0, 140, WLH, "2", 1)
  2326.     self.contents.draw_text(94 + 38 * 2, 0, 140, WLH, "3", 1)
  2327.     self.contents.draw_text(94 + 38 * 3, 0, 140, WLH, "4", 1)
  2328.     self.contents.draw_text(94 + 38 * 4, 0, 140, WLH, "5", 1)
  2329.     self.contents.draw_text(94 + 38 * 5, 0, 140, WLH, "6", 1)
  2330.     self.contents.draw_text(94 + 38 * 6, 0, 140, WLH, "7", 1)
  2331.     self.contents.draw_text(94 + 38 * 7, 0, 140, WLH, "8", 1)
  2332.     self.contents.draw_text(94 + 38 * 8, 0, 140, WLH, "9", 1)
  2333.     self.contents.font.color.alpha = 256
  2334.     case $game_party.atb_custom[1]
  2335.     when 0;self.contents.draw_text(94 + 38 * 0, 0, 140, WLH, "1", 1)
  2336.     when 1;self.contents.draw_text(94 + 38 * 1, 0, 140, WLH, "2", 1)
  2337.     when 2;self.contents.draw_text(94 + 38 * 2, 0, 140, WLH, "3", 1)
  2338.     when 3;self.contents.draw_text(94 + 38 * 3, 0, 140, WLH, "4", 1)
  2339.     when 4;self.contents.draw_text(94 + 38 * 4, 0, 140, WLH, "5", 1)
  2340.     when 5;self.contents.draw_text(94 + 38 * 5, 0, 140, WLH, "6", 1)
  2341.     when 6;self.contents.draw_text(94 + 38 * 6, 0, 140, WLH, "7", 1)
  2342.     when 7;self.contents.draw_text(94 + 38 * 7, 0, 140, WLH, "8", 1)
  2343.     when 8;self.contents.draw_text(94 + 38 * 8, 0, 140, WLH, "9", 1)
  2344.     end
  2345.   end
  2346.   #--------------------------------------------------------------------------
  2347.   # ● 項目を描画する矩形の取得
  2348.   #--------------------------------------------------------------------------
  2349.   def item_rect(index)
  2350.     rect = Rect.new(0, 0, 0, 0)
  2351.     rect.width = 38
  2352.     rect.height = 24
  2353.     rect.x = index % @column_max * rect.width + 145
  2354.     rect.y = index / @column_max * WLH
  2355.     return rect
  2356.   end
  2357. end  
  2358. #==============================================================================
  2359. # ■ Window_ATB_Help
  2360. #------------------------------------------------------------------------------
  2361. #  ATB設定の説明を表示するウィンドウです。
  2362. #==============================================================================
  2363. class Window_ATB_Help < Window_Base
  2364.   # アクティブタイムバトルのカスタマイズ項目からのテキスト
  2365.   ATB_MODE_NAME = N02::ATB_MODE_NAME
  2366.   ATB_MODE1 = N02::ATB_MODE1[0]
  2367.   ATB_MODE2 = N02::ATB_MODE2[0]
  2368.   ATB_MODE3 = N02::ATB_MODE3[0]
  2369.   ATB_MODE1_HELP = N02::ATB_MODE1_HELP
  2370.   ATB_MODE2_HELP = N02::ATB_MODE2_HELP
  2371.   ATB_MODE3_HELP = N02::ATB_MODE3_HELP
  2372.   ATB_SPEED_NAME = N02::ATB_SPEED_NAME
  2373.   ATB_SPEED_HELP = N02::ATB_SPEED_HELP
  2374.   #--------------------------------------------------------------------------
  2375.   # ● オブジェクト初期化
  2376.   #--------------------------------------------------------------------------
  2377.   def initialize
  2378.     super(0, 56, 608, 96)
  2379.   end
  2380.   #--------------------------------------------------------------------------
  2381.   # ● テキスト設定
  2382.   #--------------------------------------------------------------------------
  2383.   def set_text_active(index)
  2384.     text1 = ATB_MODE_NAME + "  ["
  2385.     case index
  2386.     when 0
  2387.       text1 += ATB_MODE1 + "]"
  2388.       text2 = ATB_MODE1_HELP
  2389.     when 1
  2390.       text1 += ATB_MODE2 + "]"
  2391.       text2 = ATB_MODE2_HELP
  2392.     when 2
  2393.       text1 += ATB_MODE3 + "]"
  2394.       text2 = ATB_MODE3_HELP
  2395.     end
  2396.     self.contents.clear
  2397.     self.contents.font.color = crisis_color
  2398.     self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
  2399.     self.contents.font.color = normal_color
  2400.     self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
  2401.   end
  2402.   #--------------------------------------------------------------------------
  2403.   # ● テキスト設定
  2404.   #--------------------------------------------------------------------------
  2405.   def set_text_speed
  2406.     text1 = ATB_SPEED_NAME
  2407.     text2 = ATB_SPEED_HELP
  2408.     self.contents.clear
  2409.     self.contents.font.color = crisis_color
  2410.     self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
  2411.     self.contents.font.color = normal_color
  2412.     self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
  2413.   end
  2414. end
  2415. #==============================================================================
  2416. # ■ Window_ATB_Help
  2417. #------------------------------------------------------------------------------
  2418. #  ATB設定タイトル・操作を表示するウィンドウです。
  2419. #==============================================================================
  2420. class Window_ATB_Title < Window_Base
  2421.   #--------------------------------------------------------------------------
  2422.   # ● オブジェクト初期化
  2423.   #--------------------------------------------------------------------------
  2424.   def initialize
  2425.     super(0, 0, 608, 56)
  2426.     refresh
  2427.   end
  2428.   #--------------------------------------------------------------------------
  2429.   # ● テキスト設定
  2430.   #--------------------------------------------------------------------------
  2431.   def refresh
  2432.     text1 = N02::ATB_CUSTOMIZE_NAME
  2433.     text2 = "↑↓キーで移動 ←→キーで選択 決定キーで設定"
  2434.     self.contents.clear
  2435.     self.contents.font.color = system_color
  2436.     self.contents.draw_text(4, 0, 96, WLH, text1, 0)
  2437.     self.contents.font.color = normal_color
  2438.     self.contents.draw_text(110, 0, 420, WLH, text2, 0)
  2439.   end
  2440. end
  2441. #==============================================================================
  2442. # ■ Scene_ATB
  2443. #------------------------------------------------------------------------------
  2444. #  ATB設定を行うクラスです。
  2445. #==============================================================================
  2446. class Scene_ATB < Scene_Base
  2447.   #--------------------------------------------------------------------------
  2448.   # ● 開始処理
  2449.   #--------------------------------------------------------------------------
  2450.   def start
  2451.     super
  2452.     create_menu_background
  2453.     @title_window = Window_ATB_Title.new
  2454.     @help_window = Window_ATB_Help.new
  2455.     @active_window = Window_ATB_active.new
  2456.     @speed_window = Window_ATB_speed.new
  2457.     @help_window.set_text_active(@active_window.index)
  2458.     @active_window_index = @active_window.index
  2459.     @speed_window_index = $game_party.atb_custom[1]
  2460.   end
  2461.   #--------------------------------------------------------------------------
  2462.   # ● 終了処理
  2463.   #--------------------------------------------------------------------------
  2464.   def terminate
  2465.     super
  2466.     $game_party.atb_customize
  2467.     dispose_menu_background
  2468.     @title_window.dispose
  2469.     @help_window.dispose
  2470.     @active_window.dispose
  2471.     @speed_window.dispose
  2472.   end
  2473.   #--------------------------------------------------------------------------
  2474.   # ● 元の画面へ戻る
  2475.   #--------------------------------------------------------------------------
  2476.   def return_scene
  2477.     $scene = Scene_Menu.new(4)
  2478.   end
  2479.   #--------------------------------------------------------------------------
  2480.   # ● フレーム更新
  2481.   #--------------------------------------------------------------------------
  2482.   def update
  2483.     super
  2484.     update_menu_background
  2485.     @help_window.update
  2486.     @active_window.update
  2487.     @speed_window.update
  2488.     if @active_window.active
  2489.       update_active_selection
  2490.     elsif @speed_window.active
  2491.       update_speed_selection
  2492.     end
  2493.   end
  2494.   #--------------------------------------------------------------------------
  2495.   # ● アイテム選択の更新
  2496.   #--------------------------------------------------------------------------
  2497.   def update_active_selection
  2498.     if Input.trigger?(Input::B)
  2499.       Sound.play_cancel
  2500.       return_scene
  2501.     elsif Input.trigger?(Input::C)
  2502.       Sound.play_decision
  2503.       $game_party.atb_custom[0] = @active_window.index
  2504.       @active_window.set_active
  2505.     elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  2506.       Sound.play_cursor
  2507.       @speed_window.active = true
  2508.       @speed_window.set_active
  2509.       @speed_window.index = @speed_window_index
  2510.       @active_window.active = false
  2511.       @active_window.non_active
  2512.       @active_window_index = @active_window.index
  2513.       @active_window.index = -1
  2514.       @help_window.set_text_speed
  2515.     elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
  2516.       @help_window.set_text_active(@active_window.index)
  2517.     end
  2518.   end
  2519.   #--------------------------------------------------------------------------
  2520.   # ● ターゲット選択の更新
  2521.   #--------------------------------------------------------------------------
  2522.   def update_speed_selection
  2523.     if Input.trigger?(Input::B)
  2524.       Sound.play_cancel
  2525.       return_scene
  2526.     elsif Input.trigger?(Input::C)
  2527.       Sound.play_decision
  2528.       $game_party.atb_custom[1] = @speed_window.index
  2529.       @speed_window.set_active
  2530.     elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  2531.       Sound.play_cursor
  2532.       @active_window.active = true
  2533.       @active_window.set_active
  2534.       @active_window.index = @active_window_index
  2535.       @speed_window.active = false
  2536.       @speed_window.non_active
  2537.       @speed_window_index = @speed_window.index
  2538.       @speed_window.index = -1
  2539.       @help_window.set_text_active(@active_window.index)
  2540.     end
  2541.   end
  2542. end
  2543. #==============================================================================
  2544. # ■ Scene_File
  2545. #------------------------------------------------------------------------------
  2546. #  ファイル画面の処理を行うクラスです。
  2547. #==============================================================================
  2548. class Scene_File < Scene_Base
  2549.   #--------------------------------------------------------------------------
  2550.   # ● 元の画面へ戻る  ※再定義
  2551.   #--------------------------------------------------------------------------
  2552.   def return_scene
  2553.     if @from_title
  2554.       $scene = Scene_Title.new
  2555.     elsif @from_event
  2556.       $scene = Scene_Map.new
  2557.     else
  2558.       $scene = Scene_Menu.new(5)
  2559.     end
  2560.   end
  2561. end  
  2562. #==============================================================================
  2563. # ■ Scene_End
  2564. #------------------------------------------------------------------------------
  2565. #  ゲーム終了画面の処理を行うクラスです。
  2566. #==============================================================================
  2567. class Scene_End < Scene_Base
  2568.   #--------------------------------------------------------------------------
  2569.   # ● 元の画面へ戻る  ※再定義
  2570.   #--------------------------------------------------------------------------
  2571.   def return_scene
  2572.     $scene = Scene_Menu.new(6)
  2573.   end
  2574. end
  2575. #==============================================================================
  2576. # ■ Scene_Menu
  2577. #------------------------------------------------------------------------------
  2578. #  メニュー画面の処理を行うクラスです。
  2579. #==============================================================================
  2580. class Scene_Menu < Scene_Base
  2581.   #--------------------------------------------------------------------------
  2582.   # ● コマンドウィンドウの作成
  2583.   #--------------------------------------------------------------------------
  2584.   alias create_command_window_n02 create_command_window
  2585.   def create_command_window
  2586.     return create_command_window_n02 if !N02::ATB_CUSTOMIZE
  2587.     s1 = Vocab::item
  2588.     s2 = Vocab::skill
  2589.     s3 = Vocab::equip
  2590.     s4 = Vocab::status
  2591.     s5 = N02::ATB_CUSTOMIZE_NAME
  2592.     s6 = Vocab::save
  2593.     s7 = Vocab::game_end
  2594.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  2595.     @command_window.index = @menu_index
  2596.     if $game_party.members.size == 0          # パーティ人数が 0 人の場合
  2597.       @command_window.draw_item(0, false)     # アイテムを無効化
  2598.       @command_window.draw_item(1, false)     # スキルを無効化
  2599.       @command_window.draw_item(2, false)     # 装備を無効化
  2600.       @command_window.draw_item(3, false)     # ステータスを無効化
  2601.     end
  2602.     if $game_system.save_disabled             # セーブ禁止の場合
  2603.       @command_window.draw_item(5, false)     # セーブを無効化
  2604.     end
  2605.   end
  2606.   #--------------------------------------------------------------------------
  2607.   # ● コマンド選択の更新
  2608.   #--------------------------------------------------------------------------
  2609.   alias update_command_selection_n02 update_command_selection
  2610.   def update_command_selection
  2611.     return update_command_selection_n02 if !N02::ATB_CUSTOMIZE
  2612.     if Input.trigger?(Input::B)
  2613.       Sound.play_cancel
  2614.       $scene = Scene_Map.new
  2615.     elsif Input.trigger?(Input::C)
  2616.       if $game_party.members.size == 0 and @command_window.index < 4
  2617.         Sound.play_buzzer
  2618.         return
  2619.       elsif $game_system.save_disabled and @command_window.index == 5
  2620.         Sound.play_buzzer
  2621.         return
  2622.       end
  2623.       Sound.play_decision
  2624.       case @command_window.index
  2625.       when 0      # アイテム
  2626.         $scene = Scene_Item.new
  2627.       when 1,2,3  # スキル、装備、ステータス
  2628.         start_actor_selection
  2629.       when 4      # ATB設定
  2630.         $scene = Scene_ATB.new
  2631.       when 5      # セーブ
  2632.         $scene = Scene_File.new(true, false, false)
  2633.       when 6      # ゲーム終了
  2634.         $scene = Scene_End.new
  2635.       end
  2636.     end
  2637.   end
  2638. end
复制代码

点评

润叔大人,不是聪聪不想帮你,而是一展开折叠,浏览器就卡死...你还是给个工简易工程吧...  发表于 2015-3-9 22:15
长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部