Project1

标题: 如何以速度来决定行动顺序 [打印本页]

作者: srder    时间: 2015-10-23 23:03
标题: 如何以速度来决定行动顺序
RMXP里面的默认战斗系统中,敌人的速度慢于我方,但是又在我方之前出手。
本人小白一只,想只以敌我之间的速度快慢来决定出手顺序(速度快先行动),欲请教一下高手。
作者: 无忧谷主幻    时间: 2015-10-23 23:32
你的意思的半即时吗?
RUBY 代码复制
  1. ========================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #========================================================================
  4. #========================================================================
  5. # ▼▲▼ XRXS_BP 1. CP制導入 ver..23 ▼▲▼
  6. # by 桜雅 在土, 和希
  7. #------------------------------------------------------------------------
  8. # □ カスタマイズポイント
  9. #========================================================================
  10. module XRXS_BP1
  11.   #
  12.   # 对齐方式。0:左 1:中央 2:右
  13.   #
  14.   ALIGN = 0
  15.   #
  16.   # 人数
  17.   #
  18.   MAX = 4
  19. end
  20. class Scene_Battle_CP
  21.   #
  22.   # 战斗速度
  23.   #
  24.   BATTLE_SPEED = 2.0
  25.   #
  26.   # 战斗开始的时候气槽百分比
  27.   #
  28.   START_CP_PERCENT = 100
  29. end
  30. class Scene_Battle
  31.   # 效果音效,可以自己添加
  32.   DATA_SYSTEM_COMMAND_UP_SE = ""
  33.   # 各项数值功能消耗的CP值
  34.   CP_COST_BASIC_ACTIONS = 0 # 基础共同
  35.   CP_COST_SKILL_ACTION = 65535 # 技能
  36.   CP_COST_ITEM_ACTION = 65535 # 物品
  37.   CP_COST_BASIC_ATTACK = 65535 # 攻撃
  38.   CP_COST_BASIC_GUARD = 32768 # 防御
  39.   CP_COST_BASIC_NOTHING = 65535 # 不做任何事情
  40.   CP_COST_BASIC_ESCAPE = 65535 # 逃跑
  41. end
  42. #========================================================================
  43. # --- XRXS.コマンドウィンドウ?コマンド追加機構 ---
  44. #------------------------------------------------------------------------
  45. # Window_Commandクラスに add_command メソッドを追加します。
  46. #========================================================================
  47. module XRXS_Window_Command_Add_Command
  48.   #----------------------------------------------------------------------
  49.   # ○ コマンドを追加
  50.   #----------------------------------------------------------------------
  51.   def add_command(command)
  52.     # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  53.     #
  54.     if @disabled == nil
  55.       @disabled = []
  56.     end
  57.     if @commands.size != @disabled.size
  58.       for i in [email]0...@commands.size[/email]
  59.         @disabled[i] = false
  60.       end
  61.     end
  62.     #
  63.     # 追加
  64.     #
  65.     @commands.push(command)
  66.     @disabled.push(false)
  67.     @item_max = @commands.size
  68.     self.y -= 32
  69.     self.height += 32
  70.     self.contents.dispose
  71.     self.contents = nil
  72.     self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  73.     refresh
  74.     for i in [email]0...@commands.size[/email]
  75.       if @disabled[i]
  76.         disable_item(i)
  77.       end
  78.     end
  79.   end
  80.   #----------------------------------------------------------------------
  81.   # ○ 項目の無効化
  82.   # index : 項目番号
  83.   #----------------------------------------------------------------------
  84.   def disable_item(index)
  85.     if @disabled == nil
  86.       @disabled = []
  87.     end
  88.     @disabled[index] = true
  89.     draw_item(index, disabled_color)
  90.   end
  91. end
  92. class Window_Command < Window_Selectable
  93.   #----------------------------------------------------------------------
  94.   # ○ インクルード
  95.   #----------------------------------------------------------------------
  96.   include XRXS_Window_Command_Add_Command
  97.   #----------------------------------------------------------------------
  98.   # ● 項目の無効化
  99.   # index : 項目番号
  100.   #----------------------------------------------------------------------
  101.   def disable_item(index)
  102.     super
  103.   end
  104. end
  105. #========================================================================
  106. # □ Scene_Battle_CP
  107. #========================================================================
  108. class Scene_Battle_CP
  109.   #----------------------------------------------------------------------
  110.   # ○ 公開インスタンス変数
  111.   #----------------------------------------------------------------------
  112.   attr_accessor :stop # CP加算ストップ
  113.   #----------------------------------------------------------------------
  114.   # ○ オブジェクトの初期化
  115.   #----------------------------------------------------------------------
  116.   def initialize
  117.     @battlers = []
  118.     @cancel = false
  119.     @stop = false
  120.     @agi_total = 0
  121.     # 配列 count_battlers を初期化
  122.     count_battlers = []
  123.     # エネミーを配列 count_battlers に追加
  124.     for enemy in $game_troop.enemies
  125.       count_battlers.push(enemy)
  126.     end
  127.     # アクターを配列 count_battlers に追加
  128.     for actor in $game_party.actors
  129.       count_battlers.push(actor)
  130.     end
  131.     for battler in count_battlers
  132.       @agi_total += battler.agi
  133.     end
  134.     for battler in count_battlers
  135.       battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
  136.     end
  137.   end
  138.   #----------------------------------------------------------------------
  139.   # ○ CPカウントアップ
  140.   #----------------------------------------------------------------------
  141.   def update
  142.     # ストップされているならリターン
  143.     return if @stop
  144.     #
  145.     for battler in $game_party.actors + $game_troop.enemies
  146.       # 行動出来なければ無視
  147.       if battler.dead? == true
  148.         battler.cp = 0
  149.         next
  150.       end
  151.       battler.cp = [[battler.cp + BATTLE_SPEED * 4096 * battler.agi / @agi_total, 0].max, 65535].min
  152.     end
  153.   end
  154.   #----------------------------------------------------------------------
  155.   # ○ CPカウントの開始
  156.   #----------------------------------------------------------------------
  157.   def stop
  158.     @cancel = true
  159.     if @cp_thread != nil then
  160.       @cp_thread.join
  161.       @cp_thread = nil
  162.     end
  163.   end
  164. end
  165. #========================================================================
  166. # ■ Game_Battler
  167. #========================================================================
  168. class Game_Battler
  169.   attr_accessor :now_guarding # 現在防御中フラグ
  170.   attr_accessor :cp # 現在CP
  171.   attr_accessor :slip_state_update_ban # スリップ?ステート自動処理の禁止
  172.   #----------------------------------------------------------------------
  173.   # ○ CP の変更
  174.   #-----------------------------------------------------------------------
  175.   def cp=(p)
  176.     @cp = [[p, 0].max, 65535].min
  177.   end
  178.   #----------------------------------------------------------------------
  179.   # ● 防御中判定 [ 再定義 ]
  180.   #----------------------------------------------------------------------
  181.   def guarding?
  182.     return @now_guarding
  183.   end
  184.   #----------------------------------------------------------------------
  185.   # ● コマンド入力可能判定
  186.   #----------------------------------------------------------------------
  187.   alias xrxs_bp1_inputable? inputable?
  188.   def inputable?
  189.     bool = xrxs_bp1_inputable?
  190.     return (bool and (@cp >= 65535))
  191.   end
  192.   #----------------------------------------------------------------------
  193.   # ● ステート [スリップダメージ] 判定
  194.   #----------------------------------------------------------------------
  195.   alias xrxs_bp1_slip_damage? slip_damage?
  196.   def slip_damage?
  197.     return false if @slip_state_update_ban
  198.     return xrxs_bp1_slip_damage?
  199.   end
  200.   #----------------------------------------------------------------------
  201.   # ● ステート自然解除 (ターンごとに呼び出し)
  202.   #----------------------------------------------------------------------
  203.   alias xrxs_bp1_remove_states_auto remove_states_auto
  204.   def remove_states_auto
  205.     return if @slip_state_update_ban
  206.     xrxs_bp1_remove_states_auto
  207.   end
  208. end
  209. #========================================================================
  210. # ■ Game_Actor
  211. #========================================================================
  212. class Game_Actor < Game_Battler
  213.   #----------------------------------------------------------------------
  214.   # ● セットアップ
  215.   #----------------------------------------------------------------------
  216.   alias xrxs_bp1_setup setup
  217.   def setup(actor_id)
  218.     xrxs_bp1_setup(actor_id)
  219.     @cp = 0
  220.     @now_guarding = false
  221.     @slip_state_update_ban = false
  222.   end
  223. end
  224. #========================================================================
  225. # ■ Game_Enemy
  226. #========================================================================
  227. class Game_Enemy < Game_Battler
  228.   #----------------------------------------------------------------------
  229.   # ● オブジェクト初期化
  230.   #----------------------------------------------------------------------
  231.   alias xrxs_bp1_initialize initialize
  232.   def initialize(troop_id, member_index)
  233.     xrxs_bp1_initialize(troop_id, member_index)
  234.     @cp = 0
  235.     @now_guarding = false
  236.     @slip_state_update_ban = false
  237.   end
  238. end
  239. class Window_All < Window_Base
  240.   def initialize
  241.     super(0,0,640,480)
  242.     self.opacity = 0
  243.     self.contents = Bitmap.new(width - 32, height - 32)
  244.     self.z = 50
  245.     refresh
  246.   end
  247.   def refresh
  248.     self.contents.clear
  249.     for actor in $game_troop.enemies
  250.       next if !actor.exist?
  251.       draw_actor_cp_meter(actor, actor.screen_x-50, actor.screen_y-50, 60, 0)
  252.     end
  253.   end
  254. #----------------------------------------------------------------------
  255.   # ○ CPメーター の描画
  256.   #----------------------------------------------------------------------
  257. # def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
  258. def draw_actor_cp_meter(actor, x, y, width = 144, type = 0)
  259.     self.contents.font.color = system_color
  260.     self.contents.fill_rect(x, y+27, width+4,6, Color.new(0, 0, 0, 255))
  261.     self.contents.fill_rect(x+1, y+28, width+2,4, Color.new(192, 220, 192, 255))
  262.     self.contents.fill_rect(x+2, y+29, width,2, Color.new(30, 30, 0, 255))
  263.     if actor.cp == nil
  264.       actor.cp = 0
  265.     end
  266.     w = width * [actor.cp,65535].min / 65535
  267.    # self.contents.fill_rect(x+1, y+28, w,1, Color.new(255, 255, 128, 255))
  268.    # self.contents.fill_rect(x+1, y+29, w,1, Color.new(255, 255, 0, 255))
  269.     self.contents.fill_rect(x+2, y+29, w,1, Color.new(0, 192, 0, 255))
  270.     self.contents.fill_rect(x+2, y+30, w,1, Color.new(0, 128, 0, 255))
  271.   end  
  272. end
  273.  
  274. #========================================================================
  275. # ■ Window_BattleStatus
  276. #========================================================================
  277. class Window_BattleStatus < Window_Base
  278.   #-----------------------------------------------------------------------
  279.   # ○ 公開インスタンス変数
  280.   #----------------------------------------------------------------------
  281.   attr_accessor :update_cp_only # CPメーターのみの更新
  282.   #----------------------------------------------------------------------
  283.   # ● オブジェクト初期化
  284.   #----------------------------------------------------------------------
  285.   alias xrxs_bp1_initialize initialize
  286.   def initialize
  287.     @update_cp_only = false
  288.     @wall = Window_All.new
  289.     xrxs_bp1_initialize
  290.   end
  291.   def dispose
  292.     super
  293.     @wall.dispose
  294.   end
  295.   #----------------------------------------------------------------------
  296.   # ● リフレッシュ
  297.   #----------------------------------------------------------------------
  298.   alias xrxs_bp1_refresh refresh
  299.   def refresh
  300.     unless @update_cp_only
  301.       xrxs_bp1_refresh
  302.     end
  303.     refresh_cp
  304.     @wall.refresh
  305.   end
  306.   #----------------------------------------------------------------------
  307.   # ○ リフレッシュ(CPのみ)
  308.   #----------------------------------------------------------------------
  309.   def refresh_cp
  310.     for i in 0...$game_party.actors.size
  311.       actor = $game_party.actors[i]
  312.       width = [self.width*3/4 / XRXS_BP1::MAX, 80].max
  313.       space = self.width / XRXS_BP1::MAX
  314.       case XRXS_BP1::ALIGN
  315.       when 0
  316.         actor_x = i * space + 4
  317.       when 1
  318.         actor_x = (space * ((XRXS_BP1::MAX - $game_party.actors.size)/2.0 + i)).floor
  319.       when 2
  320.         actor_x = (i + XRXS_BP1::MAX - $game_party.actors.size) * space + 4
  321.       end
  322.       actor_x += self.x
  323.       draw_actor_cp_meter(actor, actor_x, 96, width, 0)
  324.     end
  325.   end
  326. #----------------------------------------------------------------------
  327.   # ○ CPメーター の描画
  328.   #----------------------------------------------------------------------
  329. # def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
  330. def draw_actor_cp_meter(actor, x, y, width = 144, type = 0)
  331.     self.contents.font.color = system_color
  332.     self.contents.fill_rect(x, y+27, width+4,6, Color.new(0, 0, 0, 255))
  333.     self.contents.fill_rect(x+1, y+28, width+2,4, Color.new(192, 220, 192, 255))
  334.     self.contents.fill_rect(x+2, y+29, width,2, Color.new(30, 30, 0, 255))
  335.     if actor.cp == nil
  336.       actor.cp = 0
  337.     end
  338.     w = width * [actor.cp,65535].min / 65535
  339.    # self.contents.fill_rect(x+1, y+28, w,1, Color.new(255, 255, 128, 255))
  340.    # self.contents.fill_rect(x+1, y+29, w,1, Color.new(255, 255, 0, 255))
  341.     self.contents.fill_rect(x+2, y+29, w,1, Color.new(0, 192, 0, 255))
  342.     self.contents.fill_rect(x+2, y+30, w,1, Color.new(0, 128, 0, 255))
  343.   end  
  344. end
  345.  
  346. #========================================================================
  347. # ■ Scene_Battle
  348. #========================================================================
  349. class Scene_Battle
  350.   #----------------------------------------------------------------------
  351.   # ● フレーム更新
  352.   #----------------------------------------------------------------------
  353.   alias xrxs_bp1_update update
  354.   def update
  355.     xrxs_bp1_update
  356.     # CP更新
  357.     @cp_thread.update
  358.   end
  359.   #----------------------------------------------------------------------
  360.   # ● バトル終了
  361.   # result : 結果 (0:勝利 1:敗北 2:逃走)
  362.   #----------------------------------------------------------------------
  363.   alias xrxs_bp1_battle_end battle_end
  364.   def battle_end(result)
  365.     # CPカウントを停止する
  366.     @cp_thread.stop
  367.     # 呼び戻す
  368.     xrxs_bp1_battle_end(result)
  369.   end
  370.   #----------------------------------------------------------------------
  371.   # ● プレバトルフェーズ開始
  372.   #----------------------------------------------------------------------
  373.   alias xrxs_bp1_start_phase1 start_phase1
  374.   def start_phase1
  375.     @agi_total = 0
  376.     # CP加算を開始する
  377.     @cp_thread = Scene_Battle_CP.new
  378.     # インデックスを計算
  379.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  380.     # アクターコマンドウィンドウに追加
  381.     @actor_command_window.add_command("逃跑")
  382.     if !$game_temp.battle_can_escape
  383.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  384.     end
  385.     # 呼び戻す
  386.     xrxs_bp1_start_phase1
  387.   end
  388.   #----------------------------------------------------------------------
  389.   # ● パーティコマンドフェーズ開始
  390.   #----------------------------------------------------------------------
  391.   alias xrxs_bp1_start_phase2 start_phase2
  392.   def start_phase2
  393.     xrxs_bp1_start_phase2
  394.     @party_command_window.active = false
  395.     @party_command_window.visible = false
  396.     # CP加算を再開する
  397.     @cp_thread.stop = false
  398.     # 次へ
  399.     start_phase3
  400.   end
  401.   #----------------------------------------------------------------------
  402.   # ● アクターコマンドウィンドウのセットアップ
  403.   #----------------------------------------------------------------------
  404.   alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
  405.   def phase3_setup_command_window
  406.     # CPスレッドを一時停止する
  407.     @cp_thread.stop = true
  408.     # ウィンドウのCP更新
  409.     @status_window.refresh_cp
  410.     # @active_battlerの防御を解除
  411.     @active_battler.now_guarding = false
  412.     # 効果音の再生
  413.     Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE != ""
  414.     # 呼び戻す
  415.     xrxs_bp1_phase3_setup_command_window
  416.   end
  417.   #----------------------------------------------------------------------
  418.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  419.   #----------------------------------------------------------------------
  420.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  421.   def update_phase3_basic_command
  422.     # C ボタンが押された場合
  423.     if Input.trigger?(Input::C)
  424.       # アクターコマンドウィンドウのカーソル位置で分岐
  425.       case @actor_command_window.index
  426.       when @cp_escape_actor_command_index # 逃げる
  427.         if $game_temp.battle_can_escape
  428.           # 決定 SE を演奏
  429.           $game_system.se_play($data_system.decision_se)
  430.           # アクションを設定
  431.           @active_battler.current_action.kind = 0
  432.           @active_battler.current_action.basic = 4
  433.           # 次のアクターのコマンド入力へ
  434.           phase3_next_actor
  435.         else
  436.           # ブザー SE を演奏
  437.           $game_system.se_play($data_system.buzzer_se)
  438.         end
  439.         return
  440.       end
  441.     end
  442.     xrxs_bsp1_update_phase3_basic_command
  443.   end
  444.   #----------------------------------------------------------------------
  445.   # ● メインフェーズ開始
  446.   #----------------------------------------------------------------------
  447.   alias xrxs_bp1_start_phase4 start_phase4
  448.   def start_phase4
  449.     # 呼び戻す
  450.     xrxs_bp1_start_phase4
  451.     # CPスレッドを一時停止する
  452.     unless @action_battlers.empty?
  453.       @cp_thread.stop = true
  454.     end
  455.   end
  456.   #----------------------------------------------------------------------
  457.   # ● 行動順序作成
  458.   #----------------------------------------------------------------------
  459.   alias xrxs_bp1_make_action_orders make_action_orders
  460.   def make_action_orders
  461.     xrxs_bp1_make_action_orders
  462.     # 全員のCPを確認
  463.     exclude_battler = []
  464.     for battler in @action_battlers
  465.       # CPが不足している場合は @action_battlers から除外する
  466.       if battler.cp < 65535
  467.         exclude_battler.push(battler)
  468.       end
  469.     end
  470.     @action_battlers -= exclude_battler
  471.   end
  472.   #----------------------------------------------------------------------
  473.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  474.   #----------------------------------------------------------------------
  475.   alias xrxs_bp1_update_phase4_step1 update_phase4_step1
  476.   def update_phase4_step1
  477.     # 初期化
  478.     @phase4_act_continuation = 0
  479.     # 勝敗判定
  480.     if judge
  481.       @cp_thread.stop
  482.       # 勝利または敗北の場合 : メソッド終了
  483.       return
  484.     end
  485.     # 未行動バトラー配列の先頭から取得
  486.     @active_battler = @action_battlers[0]
  487.     # ステータス更新をCPだけに限定。
  488.     @status_window.update_cp_only = true
  489.     # ステート更新を禁止。
  490.     @active_battler.slip_state_update_ban = true if @active_battler != nil
  491.     # 戻す
  492.     xrxs_bp1_update_phase4_step1
  493.     # @status_windowがリフレッシュされなかった場合は手動でリフレッシュ(CPのみ)
  494.     if @phase4_step != 2
  495.       # リフレッシュ
  496.       @status_window.refresh
  497.       # 軽量化:たったコレだけΣ(?w?
  498.       Graphics.frame_reset
  499.     end
  500.     # 禁止を解除
  501.     @status_window.update_cp_only = false
  502.     @active_battler.slip_state_update_ban = false if @active_battler != nil
  503.   end
  504.   #----------------------------------------------------------------------
  505.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  506.   #----------------------------------------------------------------------
  507.   alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  508.   def update_phase4_step2
  509.     # 強制アクションでなければ
  510.     unless @active_battler.current_action.forcing
  511.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  512.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  513.         # アクションに攻撃を設定
  514.         @active_battler.current_action.kind = 0
  515.         @active_battler.current_action.basic = 0
  516.       end
  517.       # 制約が [行動できない] の場合
  518.       if @active_battler.restriction == 4
  519.         # アクション強制対象のバトラーをクリア
  520.         $game_temp.forcing_battler = nil
  521.         if @phase4_act_continuation == 0 and @active_battler.cp >= 65535
  522.           # ステート自然解除
  523.           @active_battler.remove_states_auto
  524.           # CP消費
  525.           @active_battler.cp -= 65535
  526.           # ステータスウィンドウをリフレッシュ
  527.           @status_window.refresh
  528.         end
  529.         # ステップ 1 に移行
  530.         @phase4_step = 1
  531.         return
  532.       end
  533.     end
  534.     # アクションの種別で分岐
  535.     case @active_battler.current_action.kind
  536.     when 0
  537.       # 攻撃?防御?逃げる?何もしない時の共通消費CP
  538.       @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
  539.     when 1
  540.       # スキル使用時の消費CP
  541.       @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
  542.     when 2
  543.       # アイテム使用時の消費CP
  544.       @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
  545.     end
  546.     # ステート自然解除
  547.     @active_battler.remove_states_auto
  548.     # 呼び戻す
  549.     xrxs_bp1_update_phase4_step2
  550.   end
  551.   #----------------------------------------------------------------------
  552.   # ● 基本アクション 結果作成
  553.   #----------------------------------------------------------------------
  554.   alias xrxs_bp1_make_basic_action_result make_basic_action_result
  555.   def make_basic_action_result
  556.     # 攻撃の場合
  557.     if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
  558.       @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
  559.     end
  560.     # 防御の場合
  561.     if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
  562.       @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
  563.       # @active_battlerの防御をON
  564.       @active_battler.now_guarding = true
  565.     end
  566.     # 敵の逃げるの場合
  567.     if @active_battler.is_a?(Game_Enemy) and
  568.         @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
  569.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  570.     end
  571.     # 何もしないの場合
  572.     if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
  573.       @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
  574.     end
  575.     # 逃げるの場合
  576.     if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
  577.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  578.       # 逃走可能ではない場合
  579.       if $game_temp.battle_can_escape == false
  580.         # ブザー SE を演奏
  581.         $game_system.se_play($data_system.buzzer_se)
  582.         return
  583.       end
  584.       # 逃走処理
  585.       update_phase2_escape
  586.       return
  587.     end
  588.     # 呼び戻す
  589.     xrxs_bp1_make_basic_action_result
  590.   end
  591.   #----------------------------------------------------------------------
  592.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  593.   #----------------------------------------------------------------------
  594.   alias xrxs_bp1_update_phase4_step6 update_phase4_step6
  595.   def update_phase4_step6
  596.     # スリップダメージ
  597.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  598.       @active_battler.slip_damage_effect
  599.       @active_battler.damage_pop = true
  600.       # ステータスウィンドウをリフレッシュ
  601.       @status_window.refresh
  602.     end
  603.     # 呼び戻す
  604.     xrxs_bp1_update_phase4_step6
  605.   end
  606. end
  607. #======================================================================
  608. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  609. #======================================================================

作者: RyanBern    时间: 2015-10-23 23:34
默认战斗系统行动的顺序和战斗者的速度(AGI)有非常强的关系,但是并不意味着速度大的一定先行动。这是因为在确定最终行动顺序时,会将原始速度随机波动一下。这个过程在Game_Battler1#make_action_speed方法里。
在默认Game_Battler1的262行有如下内容:
RUBY 代码复制
  1. def make_action_speed
  2.     @current_action.speed = agi + rand(10 + agi / 4)
  3.   end

其中的agi表示速度,这里明显看到后面还有个偏移值,如果想让速度完全决定行动顺序,就删掉rand(10 + agi / 4)
作者: 汪汪    时间: 2015-10-24 01:11
搜索cp比较好。
作者: srder    时间: 2015-10-24 11:42
RyanBern 发表于 2015-10-23 23:34
默认战斗系统行动的顺序和战斗者的速度(AGI)有非常强的关系,但是并不意味着速度大的一定先行动。这是因 ...

问题解决了,十分感谢您的帮助
作者: yang1zhi    时间: 2015-10-26 22:02
给你。RTAB战斗系统,就是你说的用速度决定的那个。
我下载的原件已经找不到了。这是我从我工程里挖的。




RTAB战斗系统 Ver 1.16 我改了毒
RUBY 代码复制
  1. # リアルタイム・アクティブバトル(RTAB) Ver 1.16
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  4.  
  5. class Scene_Battle
  6.   #--------------------------------------------------------------------------
  7.   # ● 公開インスタンス変数
  8.   #--------------------------------------------------------------------------
  9.   attr_reader   :status_window            # ステータスウィンドウ
  10.   attr_reader   :spriteset                # バトルスプライト
  11.   attr_reader   :scroll_time              # スクリーン移動基本時間
  12.   attr_reader   :zoom_rate                # 敵バトラー基本位置
  13.   attr_reader   :drive                    # カメラ駆動
  14.   attr_accessor :force                    # アクション強制度
  15.   attr_accessor :camera                   # 現在のカメラ所持者
  16.   #--------------------------------------------------------------------------
  17.   # ● ATB基礎セットアップ
  18.   #--------------------------------------------------------------------------
  19.   def atb_setup
  20.     # ATB初期化
  21.     # speed   : バトルスピード決定。値が小さいほど早い
  22.     # @active : アクティブ度設定
  23.     #           3 : 常にアクティブ状態
  24.     #           2 : スキル・アイテム選択中のみアクティブゲージが止まる
  25.     #           1 : 2の状態に加え、ターゲット選択時もウェイトが掛かる
  26.     #           0 : 1の状態に加え、コマンド入力時にもウェイトが掛かる
  27.     # @action : 他人が行動中に自分も行動を起こすことを許すか
  28.     #           3 : 自分が行動不能でない限り限り許す
  29.     #           2 : 自分がダメージを受けていない限り許す
  30.     #           1 : 2の状態に加え、ターゲットが行動していない限り許す
  31.     #           0 : 行動を許さない。順番に行動し終えるまで待つ
  32.     # @anime_wait : trueにするとバトルアニメ・ダメージ表示中はウェイトが掛かる
  33.     # @damage_wait : ダメージ表示待ち時間(単位はフレーム)
  34.     # @after_wait : 味方・敵全滅時、次の処理に移るまでの待ち時間
  35.     #               [a, b] a は味方全滅時、b は敵全滅時(単位はフレーム)
  36.     # @enemy_speed : 敵の思考速度。1なら即時行動。
  37.     #                1フレーム毎に、1/@enemy_speedの確率で行動を起こす
  38.     # @force : 強制アクションでスキル使用時の強制具合
  39.     #          2:スキルは全て詠唱せず、必ず即時実行
  40.     #          1:単独スキルは詠唱し、連携スキルのみ即時実行
  41.     #          0:全スキル詠唱を行うだけ
  42.     # ($scene.force = x とすることにより、通常イベントのスクリプトから変更可能)
  43.     # @drive : カメラ駆動ON/OFF。trueで駆動ON、falseで駆動OFF
  44.     # @scroll_time : スクリーン移動に要する基本時間
  45.     # @zoom_rate = [i, j] : エネミーのズーム率
  46.     #                       i が画面最上部に配置した時の拡大率
  47.     #                       j が画面最下部に配置した時の拡大率
  48.     #                       1 倍としたいときも、1.0 と必ず小数で設定すること
  49.     speed = 100
  50.     @active = 1
  51.     @action = 0
  52.     @anime_wait = false
  53.     @damage_wait = 10
  54.     @after_wait = [80, 0]
  55.     @enemy_speed = 40
  56.     @force = 2
  57.     @drive = true
  58.     @scroll_time = 15
  59.     @zoom_rate = [0.2, 1.0]
  60.     @help_time = 40
  61.     @escape == false
  62.     @camera = nil
  63.     @max = 0
  64.     @turn_cnt = 0
  65.     @help_wait = 0
  66.     @action_battlers = []
  67.     @synthe = []
  68.     @spell_p = {}
  69.     @spell_e = {}
  70.     @command_a = false
  71.     @command = []
  72. #------------------------------------------------------------------------------   
  73. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  74. #    @party = false
  75. #------------------------------------------------------------------------------
  76.     for battler in $game_party.actors + $game_troop.enemies
  77.       spell_reset(battler)
  78.       battler.at = battler.agi * rand(speed / 2)
  79.       battler.damage_pop = {}
  80.       battler.damage = {}
  81.       battler.damage_sp = {}
  82.       battler.critical = {}
  83.       battler.recover_hp = {}
  84.       battler.recover_sp = {}
  85.       battler.state_p = {}
  86.       battler.state_m = {}
  87.       battler.animation = []
  88.       if battler.is_a?(Game_Actor)
  89.         @max += battler.agi
  90.       end
  91.     end
  92.     @max *= speed
  93.     @max /= $game_party.actors.size
  94.     for battler in $game_party.actors + $game_troop.enemies
  95.       battler.atp = 100 * battler.at / @max
  96.     end
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● ATゲージMax時SE
  100.   #--------------------------------------------------------------------------
  101.   def fullat_se
  102.     Audio.se_play("Audio/SE/033-switch02", 80, 100)
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● レベルアップSE
  106.   #--------------------------------------------------------------------------
  107.   def levelup_se
  108.     Audio.se_play("Audio/SE/056-Right02", 80, 100)
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● スキル習得SE
  112.   #--------------------------------------------------------------------------
  113.   def skill_se
  114.     Audio.se_play("Audio/SE/056-Right02", 80, 150)
  115.   end
  116. end
  117.  
  118. class Window_Base < Window
  119.   #--------------------------------------------------------------------------
  120.   # ● ATG の描画
  121.   #     actor : アクター
  122.   #     x     : 描画先 X 座標
  123.   #     y     : 描画先 Y 座標
  124.   #     width : 描画先の幅
  125.   #--------------------------------------------------------------------------
  126.   def draw_actor_atg(actor, x, y, width = 144)
  127.     if @at_gauge == nil
  128.       # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  129.       # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  130.       # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  131.       # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  132.       # align3:ゲージタイプ 0:左詰め 1:右詰め
  133.       @plus_x = 0
  134.       @rate_x = 0
  135.       @plus_y = 16
  136.       @plus_width = 0
  137.       @rate_width = 100
  138.       @width = @plus_width + width * @rate_width / 100
  139.       @height = 16
  140.       @align1 = 0
  141.       @align2 = 1
  142.       @align3 = 0
  143.       # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  144.       # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション)
  145.       grade1 = 1
  146.       grade2 = 0
  147.       # 色設定。color1:最外枠,color2:中枠
  148.       # color3:空枠ダークカラー,color4:空枠ライトカラー
  149.       color1 = Color.new(0, 0, 0)
  150.       color2 = Color.new(255, 255, 192)
  151.       color3 = Color.new(0, 0, 0, 192)
  152.       color4 = Color.new(0, 0, 64, 192)
  153.       # ゲージの色設定
  154.       # 通常時の色設定
  155.       color5 = Color.new(0, 64, 80)
  156.       color6 = Color.new(0, 128, 160)
  157.       # ゲージがMAXの時の色設定
  158.       color7 = Color.new(80, 0, 0)
  159.       color8 = Color.new(240, 0, 0)
  160.       # 連携スキル使用時の色設定
  161.       color9 = Color.new(80, 64, 32)
  162.       color10 = Color.new(240, 192, 96)
  163.       # スキル詠唱時の色設定
  164.       color11 = Color.new(80, 0, 64)
  165.       color12 = Color.new(240, 0, 192)
  166.       # ゲージの描画
  167.       gauge_rect_at(@width, @height, @align3, color1, color2,
  168.                   color3, color4, color5, color6, color7, color8,
  169.                   color9, color10, color11, color12, grade1, grade2)
  170.     end
  171.     # 変数atに描画するゲージの幅を代入
  172.     if actor.rtp == 0
  173.       at = (width + @plus_width) * actor.atp * @rate_width / 10000
  174.     else
  175.       at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
  176.     end
  177.     if at > width
  178.       at = width
  179.     end
  180.     # ゲージの左詰・中央構え等の補正
  181.     case @align1
  182.     when 1
  183.       x += (@rect_width - width) / 2
  184.     when 2
  185.       x += @rect_width - width
  186.     end
  187.     case @align2
  188.     when 1
  189.       y -= @height / 2
  190.     when 2
  191.       y -= @height
  192.     end
  193.     self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
  194.                       @at_gauge, Rect.new(0, 0, @width, @height))
  195.     if @align3 == 0
  196.       rect_x = 0
  197.     else
  198.       x += @width - at - 1
  199.       rect_x = @width - at - 1
  200.     end
  201.     # ゲージの色設定
  202.     if at == width
  203.         # MAX時のゲージ描画
  204.       self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  205.                         @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
  206.     else
  207.       if actor.rtp == 0
  208.         # 通常時のゲージ描画
  209.         self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  210.                           @at_gauge, Rect.new(rect_x, @height, at, @height))
  211.       else
  212.         if actor.spell == true
  213.           # 連携スキル使用時のゲージ描画
  214.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  215.                         @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
  216.         else
  217.           # スキル詠唱時のゲージ描画
  218.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  219.                         @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
  220.         end
  221.       end
  222.     end
  223.   end
  224. end
  225.  
  226. #==============================================================================
  227. # ■ Scene_Battle (分割定義 1)
  228. #------------------------------------------------------------------------------
  229. #  バトル画面の処理を行うクラスです。
  230. #==============================================================================
  231.  
  232. class Scene_Battle
  233.   #--------------------------------------------------------------------------
  234.   # ● メイン処理
  235.   #--------------------------------------------------------------------------
  236.   def main
  237.     # 戦闘用の各種一時データを初期化
  238.    # Graphics.frame_rate = 60
  239.     $game_temp.in_battle = true
  240.     $game_temp.battle_turn = 0
  241.     $game_temp.battle_event_flags.clear
  242.     $game_temp.battle_abort = false
  243.     $game_temp.battle_main_phase = false
  244.     $game_temp.battleback_name = $game_map.battleback_name
  245.     $game_temp.forcing_battler = nil
  246.     # バトルイベント用インタプリタを初期化
  247.     $game_system.battle_interpreter.setup(nil, 0)
  248.     # トループを準備
  249.     @troop_id = $game_temp.battle_troop_id
  250.     $game_troop.setup(@troop_id)
  251.     atb_setup
  252.     # アクターコマンドウィンドウを作成
  253. #==============================================================================
  254. #RTAB观光游第三站,战斗菜单增加逃跑选项
  255. #==============================================================================   
  256.     s1 = $data_system.words.attack
  257.     s2 = $data_system.words.skill
  258.     s3 = $data_system.words.guard
  259.     s4 = $data_system.words.item
  260.     s5 = "逃跑"
  261.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])   
  262. #   @actor_command_window.y = 160
  263.     @actor_command_window.y = 128
  264.     @actor_command_window.back_opacity = 160
  265.     @actor_command_window.active = false
  266.     @actor_command_window.visible = false
  267. #==============================================================================   
  268.     # その他のウィンドウを作成
  269. #------------------------------------------------------------------------------
  270. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  271. #    @party_command_window = Window_PartyCommand.new
  272. #------------------------------------------------------------------------------   
  273.     @help_window = Window_Help.new
  274.     @help_window.back_opacity = 160
  275.     @help_window.visible = false
  276.     @status_window = Window_BattleStatus.new
  277.     @message_window = Window_Message.new
  278.     # スプライトセットを作成
  279.     @spriteset = Spriteset_Battle.new
  280.     # ウェイトカウントを初期化
  281.     @wait_count = 0
  282.     # トランジション実行
  283.     if $data_system.battle_transition == ""
  284.       Graphics.transition(20)
  285.     else
  286.       Graphics.transition(40, "Graphics/Transitions/" +
  287.         $data_system.battle_transition)
  288.     end
  289.     # プレバトルフェーズ開始
  290.     start_phase1
  291.     # メインループ
  292.     loop do
  293.       # ゲーム画面を更新
  294.       Graphics.update
  295.       # 入力情報を更新
  296.       Input.update
  297.       # フレーム更新
  298.       update
  299.       # 画面が切り替わったらループを中断
  300.       if $scene != self
  301.         break
  302.       end
  303.     end
  304.     # マップをリフレッシュ
  305.     $game_map.refresh
  306.     # トランジション準備
  307.     Graphics.freeze
  308.     # ウィンドウを解放
  309.     @actor_command_window.dispose
  310. #------------------------------------------------------------------------------
  311. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  312. #    @party_command_window.dispose
  313. #------------------------------------------------------------------------------   
  314.     @help_window.dispose
  315.     @status_window.dispose
  316.     @message_window.dispose
  317.     if @skill_window != nil
  318.       @skill_window.dispose
  319.     end
  320.     if @item_window != nil
  321.       @item_window.dispose
  322.     end
  323.     if @result_window != nil
  324.       @result_window.dispose
  325.     end
  326.     # スプライトセットを解放
  327.     @spriteset.dispose
  328.     # タイトル画面に切り替え中の場合
  329.     if $scene.is_a?(Scene_Title)
  330.       # 画面をフェードアウト
  331.       Graphics.transition
  332.       Graphics.freeze
  333.     end
  334.     # 戦闘テストからゲームオーバー画面以外に切り替え中の場合
  335.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  336.       $scene = nil
  337.     end
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 勝敗判定
  341.   #--------------------------------------------------------------------------
  342.   def judge
  343.     # 全滅判定が真、またはパーティ人数が 0 人の場合
  344.     if $game_party.all_dead? or $game_party.actors.size == 0
  345.       # 敗北可能の場合
  346.       if $game_temp.battle_can_lose
  347.         # バトル開始前の BGM に戻す
  348.         $game_system.bgm_play($game_temp.map_bgm)
  349.         # バトル終了
  350.         battle_end(2)
  351.         # true を返す
  352.         return true
  353.       end
  354.       # ゲームオーバーフラグをセット
  355.       $game_temp.gameover = true
  356.       # true を返す
  357.       return true
  358.     end
  359.     # エネミーが 1 体でも存在すれば false を返す
  360.     for enemy in $game_troop.enemies
  361.       if enemy.exist?
  362.         return false
  363.       end
  364.     end
  365.     # アフターバトルフェーズ開始 (勝利)
  366.     start_phase5
  367.     # true を返す
  368.     return true
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● フレーム更新
  372.   #--------------------------------------------------------------------------
  373.   def update
  374.     # バトルイベント実行中の場合
  375.     if $game_system.battle_interpreter.running?
  376.       if @command.size > 0
  377.         @command_a = false
  378.         @command = []
  379.         command_delete
  380.       end
  381.       @status_window.at_refresh
  382.       # インタプリタを更新
  383.       $game_system.battle_interpreter.update
  384.       # アクションを強制されているバトラーが存在しない場合
  385.       if $game_temp.forcing_battler == nil
  386.         # バトルイベントの実行が終わった場合
  387.         unless $game_system.battle_interpreter.running?
  388.           # バトルイベントのセットアップを再実行
  389.           @status_window.refresh
  390.           setup_battle_event
  391.         end
  392.       end
  393.     end
  394.     # システム (タイマー)、画面を更新
  395.     $game_system.update
  396.     $game_screen.update
  397.     # タイマーが 0 になった場合
  398.     if $game_system.timer_working and $game_system.timer == 0
  399.       # バトル中断
  400.       $game_temp.battle_abort = true
  401.     end
  402.     # ウィンドウを更新
  403.     @help_window.update
  404. #------------------------------------------------------------------------------
  405. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  406. #    @party_command_window.update
  407. #------------------------------------------------------------------------------
  408.     @actor_command_window.update
  409.     @status_window.update
  410.     @message_window.update
  411.     # スプライトセットを更新
  412.     @spriteset.update
  413.     # トランジション処理中の場合
  414.     if $game_temp.transition_processing
  415.       # トランジション処理中フラグをクリア
  416.       $game_temp.transition_processing = false
  417.       # トランジション実行
  418.       if $game_temp.transition_name == ""
  419.         Graphics.transition(20)
  420.       else
  421.         Graphics.transition(40, "Graphics/Transitions/" +
  422.           $game_temp.transition_name)
  423.       end
  424.     end
  425.     # メッセージウィンドウ表示中の場合
  426.     if $game_temp.message_window_showing
  427.       return
  428.     end
  429.     # ゲームオーバーの場合
  430.     if $game_temp.gameover
  431.       # ゲームオーバー画面に切り替え
  432.       $scene = Scene_Gameover.new
  433.       return
  434.     end
  435.     # タイトル画面に戻す場合
  436.     if $game_temp.to_title
  437.       # タイトル画面に切り替え
  438.       $scene = Scene_Title.new
  439.       return
  440.     end
  441.     # バトル中断の場合
  442.     if $game_temp.battle_abort
  443.       # バトル開始前の BGM に戻す
  444.       $game_system.bgm_play($game_temp.map_bgm)
  445.       # バトル終了
  446.       battle_end(1)
  447.       return
  448.     end
  449.     # ヘルプウィンドウ表示中の場合
  450.     if @help_wait > 0
  451.       @help_wait -= 1
  452.       if @help_wait == 0
  453.         # ヘルプウィンドウを隠す
  454.         @help_window.visible = false
  455.       end
  456.     end
  457.     # アクションを強制されているバトラーが存在せず、
  458.     # かつバトルイベントが実行中の場合
  459.     if $game_temp.forcing_battler == nil and
  460.        $game_system.battle_interpreter.running?
  461.       return
  462.     end
  463.     # フェーズによって分岐
  464.     case @phase
  465.     when 0  # ATゲージ更新フェーズ
  466.       if anime_wait_return
  467.         update_phase0
  468.       end
  469.     when 1  # プレバトルフェーズ
  470.       update_phase1
  471.       return
  472.     when 2  # パーティコマンドフェーズ
  473.       update_phase2
  474.       return
  475.     when 5  # アフターバトルフェーズ
  476.       update_phase5
  477.       return
  478.     end
  479.     if $scene != self
  480.       return
  481.     end
  482.     if @phase == 0
  483.       if @command.size != 0  # アクターコマンドフェーズ
  484.         if @command_a == false
  485.           start_phase3
  486.         end
  487.         update_phase3
  488.       end
  489.       # ウェイト中の場合
  490.       if @wait_count > 0
  491.         # ウェイトカウントを減らす
  492.         @wait_count -= 1
  493.         return
  494.       end
  495.       update_phase4
  496.     end
  497.   end
  498.  
  499. #==============================================================================
  500. # ■ Scene_Battle (分割定義 2)
  501. #------------------------------------------------------------------------------
  502. #  バトル画面の処理を行うクラスです。
  503. #==============================================================================
  504.  
  505.   #--------------------------------------------------------------------------
  506.   # ● フレーム更新 (ATゲージ更新フェーズ)
  507.   #--------------------------------------------------------------------------
  508.   def update_phase0
  509.     if $game_temp.battle_turn == 0
  510.       $game_temp.battle_turn = 1
  511.     end
  512.     # B ボタンが押された場合
  513.   #  if @command_a == false and @party == false
  514.    #   if Input.trigger?(Input::B)
  515.         # キャンセル SE を演奏
  516.    #     $game_system.se_play($data_system.cancel_se)
  517.    #     @party = true
  518.    #   end
  519.    # end
  520.    # if @party == true and
  521.    #     ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  522.    #     (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  523.       # パーティコマンドフェーズへ
  524.    #   start_phase2
  525.    #   return
  526.    # end
  527.     # ATゲージ増加処理
  528.     cnt = 0
  529.     for battler in $game_party.actors + $game_troop.enemies
  530.       active?(battler)
  531.       if battler.rtp == 0
  532.         if battler.at >= @max
  533.           if battler.is_a?(Game_Actor)
  534.             if battler.inputable?
  535.               unless @action_battlers.include?(battler) or
  536.                   @command.include?(battler) or @escape == true
  537.                 if battler.current_action.forcing
  538.                   fullat_se
  539.                   force_action(battler)
  540.                   action_start(battler)
  541.                 else
  542.                   fullat_se
  543.                   @command.push(battler)
  544.                 end
  545.               end
  546.             else
  547.               unless @action_battlers.include?(battler) or
  548.                       battler == @command[0]
  549.                 battler.current_action.clear
  550.                 if @command.include?(battler)
  551.                   @command.delete(battler)
  552.                 else
  553.                   if battler.movable?
  554.                     fullat_se
  555.                   end
  556.                 end
  557.                 action_start(battler)
  558.               end
  559.             end
  560.           else
  561.             unless @action_battlers.include?(battler)
  562.               if battler.current_action.forcing
  563.                 force_action(battler)
  564.                 action_start(battler)
  565.               else
  566.                 if @enemy_speed != 0
  567.                   if rand(@enemy_speed) == 0
  568.                     number = cnt - $game_party.actors.size
  569.                     enemy_action(number)
  570.                   end
  571.                 else
  572.                   number = cnt - $game_party.actors.size
  573.                   enemy_action(number)
  574.                 end
  575.               end
  576.             end
  577.           end
  578.         else
  579.           battler.at += battler.agi
  580.           if battler.guarding?
  581.             battler.at += battler.agi
  582.           end
  583.           if battler.movable?
  584.             battler.atp = 100 * battler.at / @max
  585.           end
  586.         end
  587.       else
  588.         if battler.rt >= battler.rtp
  589.           speller = synthe?(battler)
  590.           if speller != nil
  591.             battler = speller[0]
  592.           end
  593.           unless @action_battlers.include?(battler)
  594.             if battler.is_a?(Game_Actor)
  595.               fullat_se
  596.             end
  597.             battler.rt = battler.rtp
  598.             action_start(battler)
  599.           end
  600.         else
  601.           battler.rt += battler.agi
  602.           speller = synthe?(battler)
  603.           if speller != nil
  604.             for spell in speller
  605.               if spell != battler
  606.                 spell.rt += battler.agi
  607.               end
  608.             end
  609.           end
  610.         end
  611.       end
  612.       cnt += 1
  613.     end
  614.     # ATゲージをリフレッシュ
  615.     @status_window.at_refresh
  616.     # 逃走処理
  617.     if @escape == true and
  618.         ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  619.         (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  620.       temp = false
  621.       for battler in $game_party.actors
  622.         if battler.inputable?
  623.           temp = true
  624.         end
  625.       end
  626.       if temp == true
  627.         for battler in $game_party.actors
  628.           if battler.at < @max and battler.inputable?
  629.             temp = false
  630.             break
  631.           end
  632.         end
  633.         if temp == true
  634.           @escape = false
  635.           for battler in $game_party.actors
  636.             battler.at %= @max
  637.           end
  638.           $game_temp.battle_main_phase = false
  639.           update_phase2_escape
  640.         end
  641.       end
  642.     end
  643.   end
  644. #------------------------------------------------------------------------------
  645. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  646.   #--------------------------------------------------------------------------
  647.   # ● パーティコマンドフェーズ開始
  648.   #--------------------------------------------------------------------------
  649. #  def start_phase2
  650.     # フェーズ 2 に移行
  651. #    @phase = 2
  652. #    @party = false
  653.     # パーティコマンドウィンドウを有効化
  654. #    @party_command_window.active = true
  655. #    @party_command_window.visible = true
  656.     # アクターを非選択状態に設定
  657. #    @actor_index = -1
  658.     # アクターコマンドウィンドウを無効化
  659. #    @actor_command_window.active = false
  660. #    @actor_command_window.visible = false
  661. #    if @command.size != 0
  662.       # アクターの明滅エフェクト OFF
  663. #      if @active_actor != nil
  664. #        @active_actor.blink = false
  665. #      end
  666. #    end
  667.     # カメラセット
  668. #    @camera == "party"
  669. #    @spriteset.screen_target(0, 0, 1)
  670.     # メインフェーズフラグをクリア
  671. #    $game_temp.battle_main_phase = false
  672. #  end
  673. #------------------------------------------------------------------------------
  674.   #--------------------------------------------------------------------------
  675.   # ● フレーム更新 (パーティコマンドフェーズ)
  676.   #--------------------------------------------------------------------------
  677.   def update_phase2
  678. #------------------------------------------------------------------------------
  679. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  680.     # C ボタンが押された場合
  681.    # 去掉“战斗/逃跑”选项
  682. #    if Input.trigger?(Input::C)
  683.       # パーティコマンドウィンドウのカーソル位置で分岐
  684. #      case @party_command_window.index
  685. #      when 0  # 戦う
  686.         # パーティコマンドウィンドウを無効化
  687. #        @party_command_window.active = false
  688. #        @party_command_window.visible = false
  689.         # 決定 SE を演奏
  690. #        $game_system.se_play($data_system.decision_se)
  691. #------------------------------------------------------------------------------
  692.         @escape = false
  693.         @phase = 0
  694.         if $game_temp.battle_turn == 0
  695.           $game_temp.battle_turn = 1
  696.         end
  697.         if @command_a == true
  698.           # アクターコマンドフェーズ開始
  699.           start_phase3
  700.         else
  701.           $game_temp.battle_main_phase = true
  702.         end
  703. end         
  704. #------------------------------------------------------------------------------
  705. #RTAB观光游第一站,去除“战斗/逃跑”选项部分         
  706. #      when 1  # 逃げる
  707.         # 逃走可能ではない場合
  708. #        if $game_temp.battle_can_escape == false
  709.           # ブザー SE を演奏
  710. #          $game_system.se_play($data_system.buzzer_se)
  711. #          return
  712. #        end
  713.         # 決定 SE を演奏
  714. #        $game_system.se_play($data_system.decision_se)
  715. #        @phase = 0
  716.         # パーティコマンドウィンドウを無効化
  717. #        @party_command_window.active = false
  718. #        @party_command_window.visible = false
  719. #        $game_temp.battle_main_phase = true
  720. #        if $game_temp.battle_turn == 0
  721. #          update_phase2_escape
  722. #          $game_temp.battle_turn = 1
  723. #        for battler in $game_party.actors
  724. #           battler.at -= @max / 2
  725. #         end
  726. #         return
  727. #      end
  728.         # 決定 SE を演奏
  729. #       $game_system.se_play($data_system.decision_se)
  730. #       @escape = true
  731. #       for battler in $game_party.actors
  732. #         @command_a = false
  733. #         @command.delete(battler)
  734. #         @action_battlers.delete(battler)
  735. #         skill_reset(battler)
  736. #       end
  737. #     end
  738. #     return
  739. #   end
  740. #end
  741. #------------------------------------------------------------------------------
  742.   #--------------------------------------------------------------------------
  743.   # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
  744.   #--------------------------------------------------------------------------
  745.   def update_phase2_escape
  746.     # エネミーの素早さ平均値を計算
  747.     enemies_agi = 0
  748.     enemies_number = 0
  749.     for enemy in $game_troop.enemies
  750.       if enemy.exist?
  751.         enemies_agi += enemy.agi
  752.         enemies_number += 1
  753.       end
  754.     end
  755.     if enemies_number > 0
  756.       enemies_agi /= enemies_number
  757.     end
  758.     # アクターの素早さ平均値を計算
  759.     actors_agi = 0
  760.     actors_number = 0
  761.     for actor in $game_party.actors
  762.       if actor.exist?
  763.         actors_agi += actor.agi
  764.         actors_number += 1
  765.       end
  766.     end
  767.     if actors_number > 0
  768.       actors_agi /= actors_number
  769.     end
  770.     # 逃走成功判定
  771.     success = rand(100) < 50 * actors_agi / enemies_agi
  772.     # 逃走成功の場合
  773.     if success
  774.       # 逃走 SE を演奏
  775.       $game_system.se_play($data_system.escape_se)
  776.       # バトル開始前の BGM に戻す
  777.       $game_system.bgm_play($game_temp.map_bgm)
  778.       # バトル終了
  779.       battle_end(1)
  780.     # 逃走失敗の場合
  781.     else
  782.       @help_window.set_text("逃走失敗", 1)
  783.       @help_wait = @help_time
  784.       # パーティ全員のアクションをクリア
  785.       $game_party.clear_actions
  786.       # メインフェーズ開始
  787.       start_phase4
  788.     end
  789.   end
  790.   #--------------------------------------------------------------------------
  791.   # ● アフターバトルフェーズ開始
  792.   #--------------------------------------------------------------------------
  793.   def start_phase5
  794.     # フェーズ 5 に移行
  795.     @phase = 5
  796.     # バトル終了 ME を演奏
  797.     $game_system.me_play($game_system.battle_end_me)
  798.     # バトル開始前の BGM に戻す
  799.     $game_system.bgm_play($game_temp.map_bgm)
  800.     # EXP、ゴールド、トレジャーを初期化
  801.     exp = 0
  802.     gold = 0
  803.     treasures = []
  804.     if @active_actor != nil
  805.       @active_actor.blink = false
  806.     end
  807.     # メインフェーズフラグをセット
  808.     $game_temp.battle_main_phase = true
  809. #------------------------------------------------------------------------------
  810. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  811.     # パーティコマンドウィンドウを無効化
  812. #    @party_command_window.active = false
  813. #    @party_command_window.visible = false
  814. #------------------------------------------------------------------------------
  815.     # アクターコマンドウィンドウを無効化
  816.     @actor_command_window.active = false
  817.     @actor_command_window.visible = false
  818.     if @skill_window != nil
  819.       # スキルウィンドウを解放
  820.       @skill_window.dispose
  821.       @skill_window = nil
  822.     end
  823.     if @item_window != nil
  824.       # アイテムウィンドウを解放
  825.       @item_window.dispose
  826.       @item_window = nil
  827.     end
  828.     # ヘルプウィンドウを隠す
  829.     @help_window.visible = false
  830.     # ループ
  831.     for enemy in $game_troop.enemies
  832.       # エネミーが隠れ状態でない場合
  833.       unless enemy.hidden
  834.         # 獲得 EXP、ゴールドを追加
  835.         exp += enemy.exp
  836.         gold += enemy.gold
  837.         # トレジャー出現判定
  838.         if rand(100) < enemy.treasure_prob
  839.           if enemy.item_id > 0
  840.             treasures.push($data_items[enemy.item_id])
  841.           end
  842.           if enemy.weapon_id > 0
  843.             treasures.push($data_weapons[enemy.weapon_id])
  844.           end
  845.           if enemy.armor_id > 0
  846.             treasures.push($data_armors[enemy.armor_id])
  847.           end
  848.         end
  849.       end
  850.     end
  851.     # トレジャーの数を 6 個までに限定
  852.     treasures = treasures[0..5]
  853.     # EXP 獲得
  854.     for i in 0...$game_party.actors.size
  855.       actor = $game_party.actors[i]
  856.       if actor.cant_get_exp? == false
  857.         last_level = actor.level
  858.         actor.exp += exp
  859.         if actor.level > last_level
  860.           @status_window.level_up(i)
  861.           actor.damage[[actor, -1]] = "Level up!"
  862.           actor.up_level = actor.level - last_level
  863.         end
  864.       end
  865.     end
  866.     # ゴールド獲得
  867.     $game_party.gain_gold(gold)
  868.     # トレジャー獲得
  869.     for item in treasures
  870.       case item
  871.       when RPG::Item
  872.         $game_party.gain_item(item.id, 1)
  873.       when RPG::Weapon
  874.         $game_party.gain_weapon(item.id, 1)
  875.       when RPG::Armor
  876.         $game_party.gain_armor(item.id, 1)
  877.       end
  878.     end
  879.     # バトルリザルトウィンドウを作成
  880.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  881.     # ウェイトカウントを設定
  882.     @phase5_wait_count = 100
  883.   end
  884.   #--------------------------------------------------------------------------
  885.   # ● フレーム更新 (アフターバトルフェーズ)
  886.   #--------------------------------------------------------------------------
  887.   def update_phase5
  888.     # ウェイトカウントが 0 より大きい場合
  889.     if @phase5_wait_count > 0
  890.       # ウェイトカウントを減らす
  891.       @phase5_wait_count -= 1
  892.       # ウェイトカウントが 0 になった場合
  893.       if @phase5_wait_count == 0
  894.         # リザルトウィンドウを表示
  895.         @result_window.visible = true
  896.         # メインフェーズフラグをクリア
  897.         $game_temp.battle_main_phase = false
  898.         # ステータスウィンドウをリフレッシュ
  899.         @status_window.refresh
  900.         for actor in $game_party.actors
  901.           if actor.damage.include?([actor, 0])
  902.             @phase5_wait_count = 20
  903.             actor.damage_pop[[actor, 0]] = true
  904.           end
  905.           if actor.damage.include?([actor, -1])
  906.             @phase5_wait_count = 20
  907.             actor.damage_pop[[actor, -1]] = true
  908.             for level in actor.level - actor.up_level + 1..actor.level
  909.               for skill in $data_classes[actor.class_id].learnings
  910.                 if level == skill.level and not actor.skill_learn?(skill.id)
  911.                   actor.damage[[actor, 0]] = "New Skill!"
  912.                   break
  913.                 end
  914.               end
  915.             end
  916.           end
  917.         end
  918.       end
  919.       return
  920.     end
  921.     # C ボタンが押された場合
  922.     if Input.trigger?(Input::C)
  923.       # バトル終了
  924.       battle_end(0)
  925.     end
  926.   end
  927.  
  928. #==============================================================================
  929. # ■ Scene_Battle (分割定義 3)
  930. #------------------------------------------------------------------------------
  931. #  バトル画面の処理を行うクラスです。
  932. #==============================================================================
  933.  
  934.   #--------------------------------------------------------------------------
  935.   # ● アクターコマンドフェーズ開始
  936.   #--------------------------------------------------------------------------
  937.   def start_phase3
  938.     if victory?
  939.       return
  940.     end
  941.     # メインフェーズフラグをクリア
  942.     $game_temp.battle_main_phase = false
  943.     @command_a = true
  944.     @active_actor = @command[0]
  945.     cnt = 0
  946.     for actor in $game_party.actors
  947.       if actor == @active_actor
  948.         @actor_index = cnt
  949.       end
  950.       cnt += 1
  951.     end
  952.     @active_actor.blink = true
  953.     unless @active_actor.inputable?
  954.       @active_actor.current_action.clear
  955.       phase3_next_actor
  956.       return
  957.     end
  958.     phase3_setup_command_window
  959.     # カメラの設定
  960.     @camera = "command"
  961.     plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  962.     y = [(plus.abs - 1.5) * 10 , 0].min
  963.     @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ● アクターのコマンド入力終了
  967.   #--------------------------------------------------------------------------
  968.   def phase3_next_actor
  969.     @command.shift
  970.     @command_a = false
  971.     # メインフェーズフラグをセット
  972.     $game_temp.battle_main_phase = true
  973.     # アクターコマンドウィンドウを無効化
  974.     @actor_command_window.active = false
  975.     @actor_command_window.visible = false
  976.     # アクターの明滅エフェクト OFF
  977.     if @active_actor != nil
  978.       @active_actor.blink = false
  979.     end
  980.     action_start(@active_actor)
  981.     # カメラを元に戻す
  982.     if @camera == "command"
  983.       @spriteset.screen_target(0, 0, 1)
  984.     end
  985.     return
  986.   end
  987.   #--------------------------------------------------------------------------
  988.   # ● アクターコマンドウィンドウのセットアップ
  989.   #--------------------------------------------------------------------------
  990.   def phase3_setup_command_window
  991. #------------------------------------------------------------------------------
  992. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  993.     # パーティコマンドウィンドウを無効化
  994. #    @party_command_window.active = false
  995. #    @party_command_window.visible = false
  996. #------------------------------------------------------------------------------  
  997.     # アクターコマンドウィンドウを有効化
  998.     @actor_command_window.active = true
  999.     @actor_command_window.visible = true
  1000.     # アクターコマンドウィンドウの位置を設定
  1001.     @actor_command_window.x = @actor_index * 160 +
  1002.                               (4 - $game_party.actors.size) * 80
  1003.     # インデックスを 0 に設定
  1004.     @actor_command_window.index = 0
  1005.   end
  1006.   #--------------------------------------------------------------------------
  1007.   # ● エネミーアクション作成
  1008.   #--------------------------------------------------------------------------
  1009.   def enemy_action(number)
  1010.     enemy = $game_troop.enemies[number]
  1011.     unless enemy.current_action.forcing
  1012.       enemy.make_action
  1013.     end
  1014.     action_start(enemy)
  1015.   end
  1016.   #--------------------------------------------------------------------------
  1017.   # ● フレーム更新 (アクターコマンドフェーズ)
  1018.   #--------------------------------------------------------------------------
  1019.   def update_phase3
  1020.     if victory? and @command_a
  1021.       command_delete
  1022.       @command.push(@active_actor)
  1023.       return
  1024.     end
  1025.     # エネミーアローが有効の場合
  1026.     if @enemy_arrow != nil
  1027.       update_phase3_enemy_select
  1028.     # アクターアローが有効の場合
  1029.     elsif @actor_arrow != nil
  1030.       update_phase3_actor_select
  1031.     # スキルウィンドウが有効の場合
  1032.     elsif @skill_window != nil
  1033.       update_phase3_skill_select
  1034.     # アイテムウィンドウが有効の場合
  1035.     elsif @item_window != nil
  1036.       update_phase3_item_select
  1037.     # アクターコマンドウィンドウが有効の場合
  1038.     elsif @actor_command_window.active
  1039.       update_phase3_basic_command
  1040.     end
  1041.   end
  1042.   #--------------------------------------------------------------------------
  1043.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  1044.   #--------------------------------------------------------------------------
  1045.   def update_phase3_basic_command
  1046.     unless @active_actor.inputable?
  1047.       @active_actor.current_action.clear
  1048.       phase3_next_actor
  1049.       return
  1050.     end
  1051. #--------------------------------------------------------------------------
  1052. #RTAB观光游第一站,去除“战斗/逃跑”选项部分
  1053. # B ボタンが押された場合
  1054. #   if Input.trigger?(Input::B) and @party == false
  1055.       # キャンセル SE を演奏
  1056. #     $game_system.se_play($data_system.cancel_se)
  1057. #     @party = true
  1058. #   end
  1059. #   if @party == true and
  1060. #       ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  1061. #       (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  1062.       # パーティコマンドフェーズへ
  1063. #     start_phase2
  1064. #     return
  1065. #   end
  1066. #==============================================================================
  1067. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1068. #==============================================================================
  1069.     # A : SKILL
  1070.     if Input.trigger?(Input::X)
  1071.       # 決定 SE を演奏
  1072.       $game_system.se_play($data_system.decision_se)
  1073.       # スキルの選択を開始
  1074.       start_skill_select
  1075.       return
  1076.     end
  1077.     # S : 防御
  1078.     if Input.trigger?(Input::Y)
  1079.       # 決定 SE を演奏
  1080.       $game_system.se_play($data_system.decision_se)
  1081.       # アクションを設定
  1082.       @active_actor.current_action.kind = 0
  1083.       @active_actor.current_action.basic = 1
  1084.       # 次のアクターのコマンド入力へ
  1085.       phase3_next_actor
  1086.       return
  1087.     end
  1088.     # D : ITEM
  1089.     if Input.trigger?(Input::Z)
  1090.       # 決定 SE を演奏
  1091.       $game_system.se_play($data_system.decision_se)
  1092.       # アイテムの選択を開始
  1093.       start_item_select
  1094.       return
  1095.     end
  1096. #==============================================================================
  1097.     # C ボタンが押された場合
  1098.     if Input.trigger?(Input::C)
  1099. #------------------------------------------------------------------------------
  1100. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1101. #      @party = false
  1102. #------------------------------------------------------------------------------
  1103.       # アクターコマンドウィンドウのカーソル位置で分岐
  1104.       case @actor_command_window.index
  1105.       when 0  # 攻撃
  1106. #==============================================================================
  1107. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1108. #==============================================================================        
  1109.         if victory?
  1110.           # ブザー SE を演奏
  1111.           $game_system.se_play($data_system.buzzer_se)
  1112.           return
  1113.         end
  1114. #==============================================================================        
  1115.         # 決定 SE を演奏
  1116.         $game_system.se_play($data_system.decision_se)
  1117.         # エネミーの選択を開始
  1118.         start_enemy_select
  1119.       when 1  # スキル
  1120.         # 決定 SE を演奏
  1121.         $game_system.se_play($data_system.decision_se)
  1122.         # スキルの選択を開始
  1123.         start_skill_select
  1124.       when 2  # 防御
  1125.         # 決定 SE を演奏
  1126.         $game_system.se_play($data_system.decision_se)
  1127.         # アクションを設定
  1128.         @active_actor.current_action.kind = 0
  1129.         @active_actor.current_action.basic = 1
  1130.         # 次のアクターのコマンド入力へ
  1131.         phase3_next_actor
  1132.       when 3  # アイテム
  1133.         # 決定 SE を演奏
  1134.         $game_system.se_play($data_system.decision_se)
  1135.         # アイテムの選択を開始
  1136.         start_item_select
  1137. #==============================================================================
  1138. #RTAB观光游第三站,战斗菜单增加逃跑选项
  1139. #==============================================================================
  1140.       when 4 #逃跑(添加内容)
  1141.         if $game_temp.battle_can_escape == false
  1142.           # ブザー SE を演奏
  1143.           $game_system.se_play($data_system.buzzer_se)
  1144.           return
  1145.        end
  1146.         # 決定 SE を演奏
  1147.         $game_system.se_play($data_system.decision_se)
  1148.        @phase = 0
  1149.         # パーティコマンドウィンドウを無効化
  1150.         @actor_command_window.active = false
  1151.         @actor_command_window.visible = false
  1152.         $game_temp.battle_main_phase = true
  1153.         if $game_temp.battle_turn == 0
  1154.           update_phase2_escape
  1155.          $game_temp.battle_turn = 1
  1156.          for battler in $game_party.actors
  1157.             battler.at -= @max / 2
  1158.           end
  1159.           return
  1160.        end
  1161.        # 決定 SE を演奏
  1162.         $game_system.se_play($data_system.decision_se)
  1163.         @escape = true
  1164.         for battler in $game_party.actors
  1165.           @command_a = false
  1166.           @command.delete(battler)
  1167.           @action_battlers.delete(battler)
  1168.           skill_reset(battler)
  1169.         end
  1170. #==============================================================================        
  1171.       end
  1172.       return
  1173.     end
  1174.     # キャラチェンジ
  1175.     if @command.size > 1
  1176.       # R ボタンが押された場合
  1177.       if Input.trigger?(Input::L)
  1178.         $game_system.se_play($data_system.cursor_se)
  1179. #------------------------------------------------------------------------------
  1180. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1181.        # @party = false
  1182. #------------------------------------------------------------------------------      
  1183.         # アクターの明滅エフェクト OFF
  1184.         if @active_actor != nil
  1185.           @active_actor.blink = false
  1186.         end
  1187.         @command.push(@command[0])
  1188.         @command.shift
  1189.         @command_a = false
  1190.         # 新たなコマンドウィンドウの立ち上げ
  1191.         start_phase3
  1192.       end
  1193.       # L ボタンが押された場合
  1194.       if Input.trigger?(Input::R)
  1195.         $game_system.se_play($data_system.cursor_se)
  1196. #------------------------------------------------------------------------------
  1197. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1198.      #   @party = false
  1199. #------------------------------------------------------------------------------      
  1200.         # アクターの明滅エフェクト OFF
  1201.         if @active_actor != nil
  1202.           @active_actor.blink = false
  1203.         end
  1204.         @command.unshift(@command[@command.size - 1])
  1205.         @command.delete_at(@command.size - 1)
  1206.         @command_a = false
  1207.         # 新たなコマンドウィンドウの立ち上げ
  1208.         start_phase3
  1209.       end
  1210.       # 右 ボタンが押された場合
  1211.       if Input.trigger?(Input::RIGHT)
  1212.         $game_system.se_play($data_system.cursor_se)
  1213. #------------------------------------------------------------------------------
  1214. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1215.    #     @party = false
  1216. #------------------------------------------------------------------------------      
  1217.         # アクターの明滅エフェクト OFF
  1218.         if @active_actor != nil
  1219.           @active_actor.blink = false
  1220.         end
  1221.         actor = $game_party.actors[@actor_index]
  1222.         while actor == @command[0] or (not @command.include?(actor))
  1223.           @actor_index += 1
  1224.           @actor_index %= $game_party.actors.size
  1225.           actor = $game_party.actors[@actor_index]
  1226.           if actor == @command[0]
  1227.             break
  1228.           end
  1229.         end
  1230.         while actor != @command[0]
  1231.           @command.push(@command.shift)
  1232.         end
  1233.         @command_a = false
  1234.         # 新たなコマンドウィンドウの立ち上げ
  1235.         start_phase3
  1236.       end
  1237.       # 左 ボタンが押された場合
  1238.       if Input.trigger?(Input::LEFT)
  1239.         $game_system.se_play($data_system.cursor_se)
  1240. #------------------------------------------------------------------------------
  1241. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1242.    #     @party = false
  1243. #------------------------------------------------------------------------------
  1244.         # アクターの明滅エフェクト OFF
  1245.         if @active_actor != nil
  1246.           @active_actor.blink = false
  1247.         end
  1248.         actor = $game_party.actors[@actor_index]
  1249.         while actor == @command[0] or (not @command.include?(actor))
  1250.           @actor_index -= 1
  1251.           @actor_index %= $game_party.actors.size
  1252.           actor = $game_party.actors[@actor_index]
  1253.           if actor == @command[0]
  1254.             break
  1255.           end
  1256.         end
  1257.         while actor != @command[0]
  1258.           @command.push(@command.shift)
  1259.         end
  1260.         @command_a = false
  1261.         # 新たなコマンドウィンドウの立ち上げ
  1262.         start_phase3
  1263.       end
  1264.     end
  1265.   end
  1266.   #--------------------------------------------------------------------------
  1267.   # ● フレーム更新 (アクターコマンドフェーズ : スキル選択)
  1268.   #--------------------------------------------------------------------------
  1269.   def update_phase3_skill_select
  1270.     # コマンド選択中に行動不能になった場合
  1271.     unless @active_actor.inputable?
  1272.       @active_actor.current_action.clear
  1273.       command_delete
  1274.       # 次のアクターのコマンド入力へ
  1275.       phase3_next_actor
  1276.       return
  1277.     end
  1278.     # スキルウィンドウを可視状態にする
  1279.     @skill_window.visible = true
  1280.     # スキルウィンドウを更新
  1281.     @skill_window.update
  1282.     # B ボタンが押された場合
  1283.     if Input.trigger?(Input::B)
  1284.       # キャンセル SE を演奏
  1285.       $game_system.se_play($data_system.cancel_se)
  1286.       # スキルの選択を終了
  1287.       end_skill_select
  1288.       return
  1289.     end
  1290.     # C ボタンが押された場合
  1291.     if Input.trigger?(Input::C)
  1292.       # スキルウィンドウで現在選択されているデータを取得
  1293.       @skill = @skill_window.skill
  1294.       # 使用できない場合
  1295.       if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
  1296.         # ブザー SE を演奏
  1297.         $game_system.se_play($data_system.buzzer_se)
  1298.         return
  1299.       end
  1300.       # 決定 SE を演奏
  1301.       $game_system.se_play($data_system.decision_se)
  1302.       # アクションを設定
  1303.       @active_actor.current_action.skill_id = @skill.id
  1304.       # スキルウィンドウを不可視状態にする
  1305.       @skill_window.visible = false
  1306.       # 効果範囲が敵単体の場合
  1307.       if @skill.scope == 1
  1308.         # エネミーの選択を開始
  1309.         start_enemy_select
  1310.       # 効果範囲が味方単体の場合
  1311.       elsif @skill.scope == 3 or @skill.scope == 5
  1312.         # アクターの選択を開始
  1313.         start_actor_select
  1314.       # 効果範囲が単体ではない場合
  1315.       else
  1316.         # アクションを設定
  1317.         @active_actor.current_action.kind = 1
  1318.         # スキルの選択を終了
  1319.         end_skill_select
  1320.         # 次のアクターのコマンド入力へ
  1321.         phase3_next_actor
  1322.       end
  1323.       return
  1324.     end
  1325.   end
  1326.   #--------------------------------------------------------------------------
  1327.   # ● フレーム更新 (アクターコマンドフェーズ : アイテム選択)
  1328.   #--------------------------------------------------------------------------
  1329.   def update_phase3_item_select
  1330.     # コマンド選択中に行動不能になった場合
  1331.     unless @active_actor.inputable?
  1332.       @active_actor.current_action.clear
  1333.       command_delete
  1334.       # 次のアクターのコマンド入力へ
  1335.       phase3_next_actor
  1336.       return
  1337.     end
  1338.     # アイテムウィンドウを可視状態にする
  1339.     @item_window.visible = true
  1340.     # アイテムウィンドウを更新
  1341.     @item_window.update
  1342.     # B ボタンが押された場合
  1343.     if Input.trigger?(Input::B)
  1344.       # キャンセル SE を演奏
  1345.       $game_system.se_play($data_system.cancel_se)
  1346.       # アイテムの選択を終了
  1347.       end_item_select
  1348.       return
  1349.     end
  1350.     # C ボタンが押された場合
  1351.     if Input.trigger?(Input::C)
  1352.       # アイテムウィンドウで現在選択されているデータを取得
  1353.       @item = @item_window.item
  1354.       # 使用できない場合
  1355.       unless $game_party.item_can_use?(@item.id)
  1356.         # ブザー SE を演奏
  1357.         $game_system.se_play($data_system.buzzer_se)
  1358.         return
  1359.       end
  1360.       # 決定 SE を演奏
  1361.       $game_system.se_play($data_system.decision_se)
  1362.       # アクションを設定
  1363.       @active_actor.current_action.item_id = @item.id
  1364.       # アイテムウィンドウを不可視状態にする
  1365.       @item_window.visible = false
  1366.       # 効果範囲が敵単体の場合
  1367.       if @item.scope == 1
  1368.         # エネミーの選択を開始
  1369.         start_enemy_select
  1370.       # 効果範囲が味方単体の場合
  1371.       elsif @item.scope == 3 or @item.scope == 5
  1372.         # アクターの選択を開始
  1373.         start_actor_select
  1374.       # 効果範囲が単体ではない場合
  1375.       else
  1376.         # アクションを設定
  1377.         @active_actor.current_action.kind = 2
  1378.         # アイテムの選択を終了
  1379.         end_item_select
  1380.         # 次のアクターのコマンド入力へ
  1381.         phase3_next_actor
  1382.       end
  1383.       return
  1384.     end
  1385.   end
  1386.   #--------------------------------------------------------------------------
  1387.   # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  1388.   #--------------------------------------------------------------------------
  1389.   def update_phase3_enemy_select
  1390.     # コマンド選択中に行動不能になった場合
  1391.     unless @active_actor.inputable?
  1392.       # カメラを元に戻す
  1393.       if @camera == "select"
  1394.         @spriteset.screen_target(0, 0, 1)
  1395.       end
  1396.       @active_actor.current_action.clear
  1397.       command_delete
  1398.       # 次のアクターのコマンド入力へ
  1399.       phase3_next_actor
  1400.       return
  1401.     end
  1402.     # エネミーアローを更新
  1403.     @enemy_arrow.update
  1404.     # B ボタンが押された場合
  1405.     if Input.trigger?(Input::B)
  1406.       # キャンセル SE を演奏
  1407.       $game_system.se_play($data_system.cancel_se)
  1408.       # カメラを元に戻す
  1409.       if @camera == "select"
  1410.         # カメラの設定
  1411.         @camera = "command"
  1412.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  1413.         y = [(plus.abs - 1.5) * 10 , 0].min
  1414.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  1415.       end
  1416.       # エネミーの選択を終了
  1417.       end_enemy_select
  1418.       return
  1419.     end
  1420.     # C ボタンが押された場合
  1421.     if Input.trigger?(Input::C)
  1422.       # 決定 SE を演奏
  1423.       $game_system.se_play($data_system.decision_se)
  1424.       # アクションを設定
  1425.       @active_actor.current_action.kind = 0
  1426.       @active_actor.current_action.basic = 0
  1427.       @active_actor.current_action.target_index = @enemy_arrow.index
  1428.       # スキルウィンドウ表示中の場合
  1429.       if @skill_window != nil
  1430.         # アクションを再設定
  1431.         @active_actor.current_action.kind = 1
  1432.         # スキルの選択を終了
  1433.         end_skill_select
  1434.       end
  1435.       # アイテムウィンドウ表示中の場合
  1436.       if @item_window != nil
  1437.         # アクションを再設定
  1438.         @active_actor.current_action.kind = 2
  1439.         # アイテムの選択を終了
  1440.         end_item_select
  1441.       end
  1442.       # エネミーの選択を終了
  1443.       end_enemy_select
  1444.       # 次のアクターのコマンド入力へ
  1445.       phase3_next_actor
  1446.     end
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
  1450.   #--------------------------------------------------------------------------
  1451.   def update_phase3_actor_select
  1452.     # コマンド選択中に行動不能になった場合
  1453.     unless @active_actor.inputable?
  1454.       @active_actor.current_action.clear
  1455.       command_delete
  1456.       # 次のアクターのコマンド入力へ
  1457.       phase3_next_actor
  1458.       return
  1459.     end
  1460.     # アクターアローを更新
  1461.     @actor_arrow.update
  1462.     # B ボタンが押された場合
  1463.     if Input.trigger?(Input::B)
  1464.       # キャンセル SE を演奏
  1465.       $game_system.se_play($data_system.cancel_se)
  1466.       # アクターの選択を終了
  1467.       end_actor_select
  1468.       return
  1469.     end
  1470.     # C ボタンが押された場合
  1471.     if Input.trigger?(Input::C)
  1472.       # 決定 SE を演奏
  1473.       $game_system.se_play($data_system.decision_se)
  1474.       # アクションを設定
  1475.       @active_actor.current_action.kind = 0
  1476.       @active_actor.current_action.basic = 0
  1477.       @active_actor.current_action.target_index = @actor_arrow.index
  1478.       # アクターの選択を終了
  1479.       end_actor_select
  1480.       # スキルウィンドウ表示中の場合
  1481.       if @skill_window != nil
  1482.         # アクションを再設定
  1483.         @active_actor.current_action.kind = 1
  1484.         # スキルの選択を終了
  1485.         end_skill_select
  1486.       end
  1487.       # アイテムウィンドウ表示中の場合
  1488.       if @item_window != nil
  1489.         # アクションを再設定
  1490.         @active_actor.current_action.kind = 2
  1491.         # アイテムの選択を終了
  1492.         end_item_select
  1493.       end
  1494.       # 次のアクターのコマンド入力へ
  1495.       phase3_next_actor
  1496.     end
  1497.   end
  1498.   #--------------------------------------------------------------------------
  1499.   # ● エネミー選択開始
  1500.   #--------------------------------------------------------------------------
  1501.   alias :start_enemy_select_rtab :start_enemy_select
  1502.   def start_enemy_select
  1503.     @camera = "select"
  1504.     for enemy in $game_troop.enemies
  1505.       if enemy.exist?
  1506.         zoom = 1 / enemy.zoom
  1507.         @spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
  1508.                                   enemy.attack_y(zoom) * 0.75, zoom)
  1509.         break
  1510.       end
  1511.     end
  1512.     # オリジナルの処理
  1513.     start_enemy_select_rtab
  1514.   end
  1515.   #--------------------------------------------------------------------------
  1516.   # ● エネミー選択終了
  1517.   #--------------------------------------------------------------------------
  1518.   alias :end_enemy_select_rtab :end_enemy_select
  1519.   def end_enemy_select
  1520.     # オリジナルの処理
  1521.     end_enemy_select_rtab
  1522.     if (@action == 0 and not @action_battlers.empty?) or
  1523.           (@camera == "select" and (@active_actor.current_action.kind != 0 or
  1524.                                             @active_actor.animation1_id != 0))
  1525.       @spriteset.screen_target(0, 0, 1)
  1526.     end
  1527.   end
  1528.   #--------------------------------------------------------------------------
  1529.   # ● スキル選択開始
  1530.   #--------------------------------------------------------------------------
  1531.   def start_skill_select
  1532.     # スキルウィンドウを作成
  1533.     @skill_window = Window_Skill.new(@active_actor)
  1534.     # ヘルプウィンドウを関連付け
  1535.     @skill_window.help_window = @help_window
  1536.     # アクターコマンドウィンドウを無効化
  1537.     @actor_command_window.active = false
  1538.     @actor_command_window.visible = false
  1539.   end
  1540.  
  1541. #==============================================================================
  1542. # ■ Scene_Battle (分割定義 4)
  1543. #------------------------------------------------------------------------------
  1544. #  バトル画面の処理を行うクラスです。
  1545. #==============================================================================
  1546.  
  1547.   #--------------------------------------------------------------------------
  1548.   # ● メインフェーズ開始
  1549.   #--------------------------------------------------------------------------
  1550.   def start_phase4
  1551.     $game_temp.battle_main_phase = true
  1552.   end
  1553.   #--------------------------------------------------------------------------
  1554.   # ● フレーム更新 (メインフェーズ)
  1555.   #--------------------------------------------------------------------------
  1556.   def update_phase4
  1557.     # アクションを強制されているバトラーが存在する場合
  1558.     if $game_temp.forcing_battler != nil
  1559.       battler = $game_temp.forcing_battler
  1560.       if battler.current_action.forcing == false
  1561.         if @action_battlers.include?(battler)
  1562.           if @action > 0 or @action_battlers[0].phase == 1
  1563.             @action_battlers.delete(battler)
  1564.             @action_battlers.push(battler)
  1565.           end
  1566.           if battler.phase == 1
  1567.             battler.current_action.forcing = true
  1568.             force_action(battler)
  1569.           end
  1570.         else
  1571.           battler.current_action.forcing = true
  1572.           force_action(battler)
  1573.           action_start(battler)
  1574.           @action_battlers.delete(battler)
  1575.           @action_battlers.push(battler)
  1576.         end
  1577.         battler.at = @max
  1578.         battler.atp = 100 * battler.at / @max
  1579.       end
  1580.     end
  1581.     # action が1以上の場合、一斉に行動を起こす
  1582.     for battler in @action_battlers.reverse
  1583.       # ウェイト中の場合
  1584.       if battler.wait > 0
  1585.         # ウェイトカウントを減らす
  1586.         battler.wait -= 1
  1587.         break if @action == 0
  1588.         next
  1589.       end
  1590.       unless fin? and battler.phase < 3 and
  1591.           not $game_system.battle_interpreter.running?
  1592.         action_phase(battler)
  1593.       end
  1594.       break if @action == 0
  1595.     end
  1596.     # アクションを強制されているバトラーが存在しない場合
  1597.     if $game_temp.forcing_battler == nil
  1598.       # バトルイベントをセットアップ
  1599.       setup_battle_event
  1600.       # バトルイベント実行中の場合
  1601.       if $game_system.battle_interpreter.running?
  1602.         return
  1603.       end
  1604.     end
  1605.     # 勝敗を決した際の処理
  1606.     if fin?
  1607.       # 敗北時、指定時間ウェイト
  1608.       if $game_party.all_dead? and @after_wait[0] > 0
  1609.         @after_wait[0] -= 1
  1610.         return
  1611.       end
  1612.       # 勝利時、指定時間ウェイト
  1613.       if victory? and @after_wait[1] > 0
  1614.         @after_wait[1] -= 1
  1615.         return
  1616.       end
  1617.       # 戦闘が終了し、かつアクターが行動直前の場合はアクターの行動を消去
  1618.       for battler in @action_battlers.reverse
  1619.         if battler.phase < 3 and not $game_system.battle_interpreter.running?
  1620.           @action_battlers.delete(battler)
  1621.         end
  1622.       end
  1623.       # 勝敗判定
  1624.       if @action_battlers.empty? and
  1625.           not $game_system.battle_interpreter.running?
  1626.         judge
  1627.       end
  1628.     end
  1629.   end
  1630.   #--------------------------------------------------------------------------
  1631.   # ● アクション更新 (メインフェーズ)
  1632.   #--------------------------------------------------------------------------
  1633.   def action_phase(battler)
  1634.     # action が 1 の場合、バトラーが行動中かどうか確認
  1635.     if @action == 1 and battler.phase <= 3
  1636.       for target in battler.target
  1637.         speller = synthe?(target)
  1638.         if speller == nil
  1639.           # ターゲットが通常行動中の場合
  1640.           if @action_battlers.include?(target)
  1641.             if target.phase > 2
  1642.               return
  1643.             end
  1644.           end
  1645.         else
  1646.           # ターゲットが連携スキル発動中の場合
  1647.           for spell in speller
  1648.             if @action_battlers.include?(spell)
  1649.               if spell.phase > 2
  1650.                 return
  1651.               end
  1652.             end
  1653.           end
  1654.         end
  1655.       end
  1656.     end
  1657.     case battler.phase
  1658.     when 1
  1659.       update_phase4_step1(battler)
  1660.     when 2
  1661.       update_phase4_step2(battler)
  1662.     when 3
  1663.       update_phase4_step3(battler)
  1664.     when 4
  1665.       update_phase4_step4(battler)
  1666.     when 5
  1667.       update_phase4_step5(battler)
  1668.     when 6
  1669.       update_phase4_step6(battler)
  1670.     end
  1671.   end
  1672.   #--------------------------------------------------------------------------
  1673.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  1674.   #--------------------------------------------------------------------------
  1675.   def update_phase4_step1(battler)
  1676.     # すでに戦闘から外されている場合
  1677.     if battler.index == nil
  1678.       @action_battlers.delete(battler)
  1679.       anime_wait_return
  1680.       return
  1681.     end
  1682.     speller = synthe?(battler)
  1683.     if speller == nil
  1684.       # ダメージ食らい中の場合
  1685.       unless battler.damage.empty? or @action > 2
  1686.         return
  1687.       end
  1688.       # 行動可能かどうか判定
  1689.       unless battler.movable?
  1690.         battler.phase = 6
  1691.         return
  1692.       end
  1693.     else
  1694.       # ダメージ食らい中の場合
  1695.       for spell in speller
  1696.         unless spell.damage.empty? or @action > 2
  1697.           return
  1698.         end
  1699.         # 行動可能かどうか判定
  1700.         unless spell.movable?
  1701.           battler.phase = 6
  1702.           return
  1703.         end
  1704.       end
  1705.     end
  1706.     # スキル使用時、詠唱時間設定
  1707.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  1708.     if battler.current_action.kind == 1 and
  1709.       (not battler.current_action.forcing or @force != 2)
  1710.       if battler.rtp == 0
  1711.         # スキル詠唱中ならば、解除
  1712.         skill_reset(battler)
  1713.         # スキル詠唱時間設定
  1714.         recite_time(battler)
  1715.         # 連携技設定
  1716.         synthe_spell(battler)
  1717.         # スキルを詠唱する場合
  1718.         if battler.rtp > 0
  1719.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  1720.           speller = synthe?(battler)
  1721.           if battler.current_action.forcing and @force > 0 and speller != nil
  1722.             for spell in speller
  1723.               spell.rt = spell.rtp
  1724.             end
  1725.           else
  1726.             battler.blink = true
  1727.             if battler.current_action.forcing
  1728.               $game_temp.forcing_battler = nil
  1729.               battler.current_action.forcing = false
  1730.             end
  1731.             @action_battlers.delete(battler)
  1732.             return
  1733.           end
  1734.         end
  1735.       end
  1736.     end
  1737.     # アクターの明滅エフェクト OFF
  1738.     if battler != nil
  1739.       battler.blink = false
  1740.     end
  1741.     speller = synthe?(battler)
  1742.     if speller == nil
  1743.       @spell_p.delete(battler)
  1744.       @spell_e.delete(battler)
  1745.     else
  1746.       for spell in speller
  1747.         spell.blink = false
  1748.         @spell_p.delete(spell)
  1749.         @spell_e.delete(spell)
  1750.       end
  1751.     end
  1752.     # ステップ 2 に移行
  1753.     battler.phase = 2
  1754.   end
  1755.   #--------------------------------------------------------------------------
  1756.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1757.   #--------------------------------------------------------------------------
  1758.   def update_phase4_step2(battler)
  1759.     # 強制アクションでなければ
  1760.     unless battler.current_action.forcing
  1761.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  1762.       if battler.restriction == 2 or battler.restriction == 3
  1763.         # アクションに攻撃を設定
  1764.         battler.current_action.kind = 0
  1765.         battler.current_action.basic = 0
  1766.       end
  1767.     end
  1768.     # アクションの種別で分岐
  1769.     case battler.current_action.kind
  1770.     when 0  # 基本
  1771.       if fin?
  1772.         battler.phase = 6
  1773.         return
  1774.       end
  1775.       make_basic_action_result(battler)
  1776.     when 1  # スキル
  1777.       if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
  1778.         battler.phase = 6
  1779.         return
  1780.       end
  1781.       make_skill_action_result(battler)
  1782.     when 2  # アイテム
  1783.       if fin? and $data_items[battler.current_action.item_id].scope == 1..2
  1784.         battler.phase = 6
  1785.         return
  1786.       end
  1787.       make_item_action_result(battler)
  1788.     end
  1789.     if battler.phase == 2
  1790.       # ステップ 3 に移行
  1791.       battler.phase = 3
  1792.     end
  1793.   end
  1794.   #--------------------------------------------------------------------------
  1795.   # ● 基本アクション 結果作成
  1796.   #--------------------------------------------------------------------------
  1797.   def make_basic_action_result(battler)
  1798.     # 攻撃の場合
  1799.     if battler.current_action.basic == 0
  1800.       # アニメーション ID を設定
  1801.       battler.anime1 = battler.animation1_id
  1802.       battler.anime2 = battler.animation2_id
  1803.       # 行動側バトラーがエネミーの場合
  1804.       if battler.is_a?(Game_Enemy)
  1805.         if battler.restriction == 3
  1806.           target = $game_troop.random_target_enemy
  1807.         elsif battler.restriction == 2
  1808.           target = $game_party.random_target_actor
  1809.         else
  1810.           index = battler.current_action.target_index
  1811.           target = $game_party.smooth_target_actor(index)
  1812.         end
  1813.       end
  1814.       # 行動側バトラーがアクターの場合
  1815.       if battler.is_a?(Game_Actor)
  1816.         if battler.restriction == 3
  1817.           target = $game_party.random_target_actor
  1818.         elsif battler.restriction == 2
  1819.           target = $game_troop.random_target_enemy
  1820.         else
  1821.           index = battler.current_action.target_index
  1822.           target = $game_troop.smooth_target_enemy(index)
  1823.         end
  1824.       end
  1825.       # 対象側バトラーの配列を設定
  1826.       battler.target = [target]
  1827.       # 通常攻撃の効果を適用
  1828.       for target in battler.target
  1829.         target.attack_effect(battler)
  1830.       end
  1831.       return
  1832.     end
  1833.     # 防御の場合
  1834.     if battler.current_action.basic == 1
  1835.       return
  1836.     end
  1837.     # 逃げるの場合
  1838. #    if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1839.       # 逃げる
  1840. #      @help_window.set_text("逃げる", 1)
  1841. #      @help_wait = @help_time
  1842. #      battler.escape
  1843. #      return
  1844. #    end
  1845. #========RTAB 1.16=====================================================   
  1846.     # 逃げるの場合
  1847.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1848.       return
  1849.     end
  1850. #======================================================================
  1851.     # 何もしないの場合
  1852.     if battler.current_action.basic == 3
  1853.       # ステップ 6 に移行
  1854.       battler.phase = 6
  1855.       return
  1856.     end
  1857.   end
  1858.   #--------------------------------------------------------------------------
  1859.   # ● スキルまたはアイテムの対象側バトラー設定
  1860.   #     scope : スキルまたはアイテムの効果範囲
  1861.   #--------------------------------------------------------------------------
  1862.   def set_target_battlers(scope, battler)
  1863.     # 行動側バトラーがエネミーの場合
  1864.     if battler.is_a?(Game_Enemy)
  1865.       # 効果範囲で分岐
  1866.       case scope
  1867.       when 1  # 敵単体
  1868.         index =battler.current_action.target_index
  1869.         battler.target.push($game_party.smooth_target_actor(index))
  1870.       when 2  # 敵全体
  1871.         for actor in $game_party.actors
  1872.           if actor.exist?
  1873.             battler.target.push(actor)
  1874.           end
  1875.         end
  1876.       when 3  # 味方単体
  1877.         index = battler.current_action.target_index
  1878.         battler.target.push($game_troop.smooth_target_enemy(index))
  1879.       when 4  # 味方全体
  1880.         for enemy in $game_troop.enemies
  1881.           if enemy.exist?
  1882.             battler.target.push(enemy)
  1883.           end
  1884.         end
  1885.       when 5  # 味方単体 (HP 0)
  1886.         index = battler.current_action.target_index
  1887.         enemy = $game_troop.enemies[index]
  1888.         if enemy != nil and enemy.hp0?
  1889.           battler.target.push(enemy)
  1890.         end
  1891.       when 6  # 味方全体 (HP 0)
  1892.         for enemy in $game_troop.enemies
  1893.           if enemy != nil and enemy.hp0?
  1894.             battler.target.push(enemy)
  1895.           end
  1896.         end
  1897.       when 7  # 使用者
  1898.         battler.target.push(battler)
  1899.       end
  1900.     end
  1901.     # 行動側バトラーがアクターの場合
  1902.     if battler.is_a?(Game_Actor)
  1903.       # 効果範囲で分岐
  1904.       case scope
  1905.       when 1  # 敵単体
  1906.         index = battler.current_action.target_index
  1907.         battler.target.push($game_troop.smooth_target_enemy(index))
  1908.       when 2  # 敵全体
  1909.         for enemy in $game_troop.enemies
  1910.           if enemy.exist?
  1911.             battler.target.push(enemy)
  1912.           end
  1913.         end
  1914.       when 3  # 味方単体
  1915.         index = battler.current_action.target_index
  1916.         battler.target.push($game_party.smooth_target_actor(index))
  1917.       when 4  # 味方全体
  1918.         for actor in $game_party.actors
  1919.           if actor.exist?
  1920.             battler.target.push(actor)
  1921.           end
  1922.         end
  1923.       when 5  # 味方単体 (HP 0)
  1924.         index = battler.current_action.target_index
  1925.         actor = $game_party.actors[index]
  1926.         if actor != nil and actor.hp0?
  1927.           battler.target.push(actor)
  1928.         end
  1929.       when 6  # 味方全体 (HP 0)
  1930.         for actor in $game_party.actors
  1931.           if actor != nil and actor.hp0?
  1932.             battler.target.push(actor)
  1933.           end
  1934.         end
  1935.       when 7  # 使用者
  1936.         battler.target.push(battler)
  1937.       end
  1938.     end
  1939.   end
  1940.   #--------------------------------------------------------------------------
  1941.   # ● スキルアクション 結果作成
  1942.   #--------------------------------------------------------------------------
  1943.   def make_skill_action_result(battler)
  1944.     # スキルを取得
  1945.     @skill = $data_skills[battler.current_action.skill_id]
  1946.     # 連携スキルであるかどうか確認
  1947.     speller = synthe?(battler)
  1948.     # 強制アクションでなければ
  1949.     unless battler.current_action.forcing
  1950.       # SP 切れなどで使用できなくなった場合
  1951.       if speller == nil
  1952.         unless battler.skill_can_use?(@skill.id)
  1953.           # ステップ 6 に移行
  1954.           battler.phase = 6
  1955.          return
  1956.         end
  1957.       end
  1958.     end
  1959.     # SP 消費
  1960.     temp = false
  1961.     if speller != nil
  1962.       for spell in speller
  1963.         if spell.current_action.spell_id == 0
  1964.           spell.sp -= @skill.sp_cost
  1965.         else
  1966.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  1967.         end
  1968.         # ステータスウィンドウをリフレッシュ
  1969.         status_refresh(spell)
  1970.       end
  1971.     else
  1972.       battler.sp -= @skill.sp_cost
  1973.       # ステータスウィンドウをリフレッシュ
  1974.       status_refresh(battler)
  1975.     end
  1976.     # アニメーション ID を設定
  1977.     battler.anime1 = @skill.animation1_id
  1978.     battler.anime2 = @skill.animation2_id
  1979.     # コモンイベント ID を設定
  1980.     battler.event = @skill.common_event_id
  1981.     # 対象側バトラーを設定
  1982.     set_target_battlers(@skill.scope, battler)
  1983.     # スキルの効果を適用
  1984.     for target in battler.target
  1985.       if speller != nil
  1986.         damage = 0
  1987.         d_result = false
  1988.         effective = false
  1989.         state_p = []
  1990.         state_m = []
  1991.         for spell in speller
  1992.           if spell.current_action.spell_id != 0
  1993.             @skill = $data_skills[spell.current_action.spell_id]
  1994.           end
  1995.           effective |= target.skill_effect(spell, @skill)
  1996.           if target.damage[spell].class != String
  1997.             d_result = true
  1998.             damage += target.damage[spell]
  1999.           elsif effective
  2000.             effect = target.damage[spell]
  2001.           end
  2002.           state_p += target.state_p[spell]
  2003.           state_m += target.state_m[spell]
  2004.           target.damage.delete(spell)
  2005.           target.state_p.delete(spell)
  2006.           target.state_m.delete(spell)
  2007.         end
  2008.         if d_result
  2009.           target.damage[battler] = damage
  2010.         elsif effective
  2011.           target.damage[battler] = effect
  2012.         else
  2013.           target.damage[battler] = 0
  2014.         end
  2015.         target.state_p[battler] = state_p
  2016.         target.state_m[battler] = state_m
  2017.       else
  2018.         target.skill_effect(battler, @skill)
  2019.       end
  2020.     end
  2021.   end
  2022.   #--------------------------------------------------------------------------
  2023.   # ● アイテムアクション 結果作成
  2024.   #--------------------------------------------------------------------------
  2025.   def make_item_action_result(battler)
  2026.     # アイテムを取得
  2027.     @item = $data_items[battler.current_action.item_id]
  2028.     # アイテム切れなどで使用できなくなった場合
  2029.     unless $game_party.item_can_use?(@item.id)
  2030.       # ステップ 6 に移行
  2031.       battler.phase = 6
  2032.       return
  2033.     end
  2034.     # 消耗品の場合
  2035.     if @item.consumable
  2036.      # 使用したアイテムを 1 減らす
  2037.       $game_party.lose_item(@item.id, 1)
  2038.     end
  2039.  
  2040.     # アニメーション ID を設定
  2041.     battler.anime1 = @item.animation1_id
  2042.     battler.anime2 = @item.animation2_id
  2043.     # コモンイベント ID を設定
  2044.     battler.event = @item.common_event_id
  2045.     # 対象を決定
  2046.     index = battler.current_action.target_index
  2047.     target = $game_party.smooth_target_actor(index)
  2048.     # 対象側バトラーを設定
  2049.     set_target_battlers(@item.scope, battler)
  2050.     # アイテムの効果を適用
  2051.     for target in battler.target
  2052.       target.item_effect(@item, battler)
  2053.     end
  2054.   end
  2055.   #--------------------------------------------------------------------------
  2056.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2057.   #--------------------------------------------------------------------------
  2058.   def update_phase4_step3(battler)
  2059.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2060.     case battler.current_action.kind
  2061.     when 0  # 基本
  2062.       if battler.current_action.basic == 1
  2063.         @help_window.set_text($data_system.words.guard, 1)
  2064.         @help_wait = @help_time
  2065.       end
  2066. #========RTAB 1.16==================================      
  2067.       if battler.current_action.basic == 2
  2068.         # 逃げる
  2069.         @help_window.set_text("逃げる", 1)
  2070.         @help_wait = @help_time
  2071.         battler.escape
  2072.         battler.phase = 4
  2073.         return
  2074.       end
  2075. #===================================================        
  2076.     when 1  # スキル
  2077.       skill =  $data_skills[battler.current_action.skill_id]
  2078.       @help_window.set_text(skill.name, 1)
  2079.       @help_wait = @help_time
  2080.     when 2  # アイテム
  2081.       item = $data_items[battler.current_action.item_id]
  2082.       @help_window.set_text(item.name, 1)
  2083.       @help_wait = @help_time
  2084.     end
  2085.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2086.     if battler.anime1 == 0
  2087.       battler.white_flash = true
  2088.       battler.wait = 5
  2089.       # カメラ設定
  2090.       if battler.target[0].is_a?(Game_Enemy)
  2091.         camera_set(battler)
  2092.       end
  2093.     else
  2094.       battler.animation.push([battler.anime1, true])
  2095.       speller = synthe?(battler)
  2096.       if speller != nil
  2097.         for spell in speller
  2098.           if spell != battler
  2099.             if spell.current_action.spell_id == 0
  2100.               spell.animation.push([battler.anime1, true])
  2101.             else
  2102.               skill = spell.current_action.spell_id
  2103.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2104.               spell.current_action.spell_id = 0
  2105.             end
  2106.           end
  2107.         end
  2108.       end
  2109.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2110.     end
  2111.     # ステップ 4 に移行
  2112.     battler.phase = 4
  2113.   end
  2114.   #--------------------------------------------------------------------------
  2115.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2116.   #--------------------------------------------------------------------------
  2117.   def update_phase4_step4(battler)
  2118.     # カメラ設定
  2119.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  2120.        camera_set(battler)
  2121.     end
  2122.     # 対象側アニメーション
  2123.     for target in battler.target
  2124.       target.animation.push([battler.anime2,
  2125.                                           (target.damage[battler] != "Miss")])
  2126.       unless battler.anime2 == 0
  2127.         battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
  2128.       end
  2129.     end
  2130.     # ステップ 5 に移行
  2131.     battler.phase = 5
  2132.   end
  2133.   #--------------------------------------------------------------------------
  2134.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  2135.   #--------------------------------------------------------------------------
  2136.   def update_phase4_step5(battler)
  2137.     # ダメージ表示
  2138.     for target in battler.target
  2139.       if target.damage[battler] != nil
  2140.         target.damage_pop[battler] = true
  2141.         target.damage_effect( battler)
  2142.         target.damage_effect(battler, battler.current_action.kind)
  2143.           battler.wait = @damage_wait
  2144.         # ステータスウィンドウをリフレッシュ
  2145.         status_refresh(target)
  2146.       end
  2147.     end
  2148.     # ステップ 6 に移行
  2149.     battler.phase = 6
  2150.   end
  2151.   #--------------------------------------------------------------------------
  2152.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  2153.   #--------------------------------------------------------------------------
  2154.   def update_phase4_step6(battler)
  2155.     # カメラを戻す
  2156.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  2157.       @spriteset.screen_target(0, 0, 1)
  2158.     end
  2159.     # スキルラーニング
  2160.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  2161.       for target in battler.target
  2162.         skill_learning(target, target.class_id,
  2163.                         battler.current_action.skill_id)
  2164.       end
  2165.     end
  2166.     # アクション強制対象のバトラーをクリア
  2167.     if battler.current_action.forcing == true and
  2168.         battler.current_action.force_kind == 0 and
  2169.         battler.current_action.force_basic == 0 and
  2170.         battler.current_action.force_skill_id == 0
  2171.       $game_temp.forcing_battler = nil
  2172.       battler.current_action.forcing = false
  2173.     end
  2174.     refresh_phase(battler)
  2175.     speller = synthe?(battler)
  2176.     if speller != nil
  2177.       for spell in speller
  2178.         if spell != battler
  2179.           refresh_phase(spell)
  2180.         end
  2181.       end
  2182.       synthe_delete(speller)
  2183.     end
  2184.     # コモンイベント ID が有効の場合
  2185.     if battler.event > 0
  2186.       # イベントをセットアップ
  2187.       common_event = $data_common_events[battler.event]
  2188.       $game_system.battle_interpreter.setup(common_event.list, 0)
  2189.     end
  2190.     act = 0
  2191.     for actor in $game_party.actors + $game_troop.enemies
  2192.       if actor.movable?
  2193.         act += 1
  2194.       end
  2195.     end
  2196.     if @turn_cnt >= act and act > 0
  2197.       @turn_cnt %= act
  2198.       $game_temp.battle_turn += 1
  2199.       # バトルイベントの全ページを検索
  2200.       for index in 0...$data_troops[@troop_id].pages.size
  2201.         # イベントページを取得
  2202.         page = $data_troops[@troop_id].pages[index]
  2203.         # このページのスパンが [ターン] の場合
  2204.         if page.span == 1
  2205.           # 実行済みフラグをクリア
  2206.           $game_temp.battle_event_flags[index] = false
  2207.         end
  2208.       end
  2209.     end
  2210.     battler.phase = 1
  2211.     @action_battlers.delete(battler)
  2212.   end
  2213.   #--------------------------------------------------------------------------
  2214.   # ● リフレッシュ
  2215.   #--------------------------------------------------------------------------
  2216.   def refresh_phase(battler)
  2217.     battler.at -= @max
  2218.     if battler.movable?
  2219.       battler.atp = 100 * battler.at / @max
  2220.     end
  2221.     spell_reset(battler)
  2222.     # スリップダメージ
  2223.     if battler.hp > 0 and battler.slip_damage?
  2224.       battler.slip_damage_effect
  2225.       battler.damage_pop["slip"] = true
  2226.     end
  2227.     # ステート自然解除
  2228.     battler.remove_states_auto
  2229.     # ステータスウィンドウをリフレッシュ
  2230.     status_refresh(battler, true)
  2231.     unless battler.movable?
  2232.       return
  2233.     end
  2234.     # ターン数カウント
  2235.     @turn_cnt += 1
  2236.   end
  2237.   #--------------------------------------------------------------------------
  2238.   # ● バトラーアクションスタート
  2239.   #--------------------------------------------------------------------------
  2240.   def action_start(battler)
  2241.     battler.phase = 1
  2242.     battler.anime1 = 0
  2243.     battler.anime2 = 0
  2244.     battler.target = []
  2245.     battler.event = 0
  2246.     @action_battlers.unshift(battler)
  2247.   end
  2248.   #--------------------------------------------------------------------------
  2249.   # ● ステータスウィンドウをリフレッシュ
  2250.   #--------------------------------------------------------------------------
  2251.   def status_refresh(battler, at = false)
  2252.     if battler.is_a?(Game_Actor)
  2253.       for i in 0...$game_party.actors.size
  2254.         if battler == $game_party.actors[i]
  2255.           number = i + 1
  2256.         end
  2257.       end
  2258.       @status_window.refresh(number)
  2259.       if at == true
  2260.         @status_window.at_refresh(number)
  2261.       end
  2262.     end
  2263.   end
  2264.   #--------------------------------------------------------------------------
  2265.   # ● アニメウェイト判断処理
  2266.   #--------------------------------------------------------------------------
  2267.   def anime_wait_return
  2268.     if (@action_battlers.empty? or @anime_wait == false) and
  2269.         not $game_system.battle_interpreter.running?
  2270.       # エネミーアローが有効の場合
  2271.       if @enemy_arrow != nil
  2272.         return [@active - 2, 0].min == 0
  2273.       # アクターアローが有効の場合
  2274.       elsif @actor_arrow != nil
  2275.         return [@active - 2, 0].min == 0
  2276.       # スキルウィンドウが有効の場合
  2277.       elsif @skill_window != nil
  2278.         return [@active - 3, 0].min == 0
  2279.       # アイテムウィンドウが有効の場合
  2280.       elsif @item_window != nil
  2281.         return [@active - 3, 0].min == 0
  2282.       # アクターコマンドウィンドウが有効の場合
  2283.       elsif @actor_command_window.active
  2284.         return [@active - 1, 0].min == 0
  2285.       else
  2286.         return true
  2287.       end
  2288.     else
  2289.       return false
  2290.     end
  2291.   end
  2292.   #--------------------------------------------------------------------------
  2293.   # ● アクターコマンド消去判断
  2294.   #--------------------------------------------------------------------------
  2295.   def command_delete
  2296.     # エネミーアローが有効の場合
  2297.     if @enemy_arrow != nil
  2298.       end_enemy_select
  2299.     # アクターアローが有効の場合
  2300.     elsif @actor_arrow != nil
  2301.       end_actor_select
  2302.     end
  2303.     # スキルウィンドウが有効の場合
  2304.     if @skill_window != nil
  2305.       end_skill_select
  2306.     # アイテムウィンドウが有効の場合
  2307.     elsif @item_window != nil
  2308.       end_item_select
  2309.     end
  2310.     # アクターコマンドウィンドウが有効の場合
  2311.     if @actor_command_window.active
  2312.       @command.shift
  2313.       @command_a = false
  2314.       # メインフェーズフラグをセット
  2315.       $game_temp.battle_main_phase = true
  2316.       # アクターコマンドウィンドウを無効化
  2317.       @actor_command_window.active = false
  2318.       @actor_command_window.visible = false
  2319.       # アクターの明滅エフェクト OFF
  2320.       if @active_actor != nil
  2321.         @active_actor.blink = false
  2322.       end
  2323.     end
  2324.   end
  2325.   #--------------------------------------------------------------------------
  2326.   # ● 強制アクション設定
  2327.   #--------------------------------------------------------------------------
  2328.   def force_action(battler)
  2329.     battler.current_action.kind = battler.current_action.force_kind
  2330.     battler.current_action.basic = battler.current_action.force_basic
  2331.     battler.current_action.skill_id = battler.current_action.force_skill_id
  2332.     battler.current_action.force_kind = 0
  2333.     battler.current_action.force_basic = 0
  2334.     battler.current_action.force_skill_id = 0
  2335.   end
  2336.   #--------------------------------------------------------------------------
  2337.   # ● カメラセット
  2338.   #--------------------------------------------------------------------------
  2339.   def camera_set(battler)
  2340.     @camera = battler
  2341.     if battler.target.size == 1
  2342.       if battler.current_action.kind == 0
  2343.         zoom = 1.2 / battler.target[0].zoom
  2344.       elsif synthe?(battler) == nil
  2345.         zoom = 1.5 / battler.target[0].zoom
  2346.       else
  2347.         zoom = 2.0 / battler.target[0].zoom
  2348.       end
  2349.       @spriteset.screen_target(battler.target[0].attack_x(zoom),
  2350.                                 battler.target[0].attack_y(zoom), zoom)
  2351.     else
  2352.       @spriteset.screen_target(0, 0, 0.75)
  2353.     end
  2354.   end
  2355.   #--------------------------------------------------------------------------
  2356.   # ● スキル詠唱タイム作成
  2357.   #--------------------------------------------------------------------------
  2358.   def recite_time(battler)
  2359.   end
  2360.   #--------------------------------------------------------------------------
  2361.   # ● 連携スキル判別
  2362.   #--------------------------------------------------------------------------
  2363.   def synthe_spell(battler)
  2364.   end
  2365.   #--------------------------------------------------------------------------
  2366.   # ● スキルラーニングシステム
  2367.   #--------------------------------------------------------------------------
  2368.   def skill_learning(actor, class_id, skill_id)
  2369.   end
  2370.   #--------------------------------------------------------------------------
  2371.   # ● 行動可能判定
  2372.   #--------------------------------------------------------------------------
  2373.   def active?(battler)
  2374.     speller = synthe?(battler)
  2375.     if speller != nil
  2376.       if synthe_delete?(speller)
  2377.         return false
  2378.       end
  2379.     else
  2380.       unless battler.inputable?
  2381.         spell_reset(battler)
  2382.         unless battler.movable?
  2383.           battler.atp = 0
  2384.           return false
  2385.         end
  2386.       end
  2387.       if battler.current_action.forcing
  2388.         spell_reset(battler)
  2389.       end
  2390.     end
  2391.     return true
  2392.   end
  2393.   #--------------------------------------------------------------------------
  2394.   # ● 合成スキル詠唱中か?
  2395.   #--------------------------------------------------------------------------
  2396.   def synthe?(battler)
  2397.     for speller in @synthe
  2398.       if speller.include?(battler)
  2399.         return speller
  2400.       end
  2401.     end
  2402.     return nil
  2403.   end
  2404.   #--------------------------------------------------------------------------
  2405.   # ● 合成スキル消去判断
  2406.   #--------------------------------------------------------------------------
  2407.   def synthe_delete?(speller)
  2408.     for battler in speller
  2409.       if not battler.inputable? and dead_ok?(battler)
  2410.         synthe_delete(speller)
  2411.         return true
  2412.       end
  2413.     end
  2414.     return false
  2415.   end
  2416.   #--------------------------------------------------------------------------
  2417.   # ● 合成スキル消去
  2418.   #--------------------------------------------------------------------------
  2419.   def synthe_delete(speller)
  2420.     for battler in speller
  2421.       spell_reset(battler)
  2422.       if dead_ok?(battler)
  2423.         @action_battlers.delete(battler)
  2424.       end
  2425.     end
  2426.     @synthe.delete(speller)
  2427.   end
  2428.   #--------------------------------------------------------------------------
  2429.   # ● 連携含むスキル詠唱解除
  2430.   #--------------------------------------------------------------------------
  2431.   def skill_reset(battler)
  2432.     speller = synthe?(battler)
  2433.     if speller != nil
  2434.       synthe_delete(speller)
  2435.     else
  2436.       spell_reset(battler)
  2437.     end
  2438.   end
  2439.   #--------------------------------------------------------------------------
  2440.   # ● スキル詠唱解除
  2441.   #--------------------------------------------------------------------------
  2442.   def spell_reset(battler)
  2443.     battler.rt = 0
  2444.     battler.rtp = 0
  2445.     battler.blink = false
  2446.     battler.spell = false
  2447.     battler.current_action.spell_id = 0
  2448.     @spell_p.delete(battler)
  2449.     @spell_e.delete(battler)
  2450.   end
  2451.   #--------------------------------------------------------------------------
  2452.   # ● 戦闘終了判定
  2453.   #--------------------------------------------------------------------------
  2454.   def fin?
  2455.    return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  2456.   end
  2457.   #--------------------------------------------------------------------------
  2458.   # ● 敵全滅判定
  2459.   #--------------------------------------------------------------------------
  2460.   def victory?
  2461.     for battler in $game_troop.enemies
  2462.       if not battler.hidden and (battler.rest_hp > 0 or
  2463.           battler.immortal or battler.damage_pop.size > 0)
  2464.         return false
  2465.       end
  2466.     end
  2467.     return true
  2468.   end
  2469.   #--------------------------------------------------------------------------
  2470.   # ● 死亡許可判定
  2471.   #--------------------------------------------------------------------------
  2472.   def dead_ok?(battler)
  2473.     speller = synthe?(battler)
  2474.     if speller == nil
  2475.       if @action_battlers.include?(battler)
  2476.         if battler.phase > 2
  2477.           return false
  2478.         end
  2479.       end
  2480.     else
  2481.       for battler in speller
  2482.         if @action_battlers.include?(battler)
  2483.           if battler.phase > 2
  2484.             return false
  2485.           end
  2486.         end
  2487.       end
  2488.     end
  2489.     return true
  2490.   end
  2491. end
  2492.  
  2493. #==============================================================================
  2494. # ■ Game_Actor
  2495. #------------------------------------------------------------------------------
  2496. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2497. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2498. #==============================================================================
  2499.  
  2500. class Game_Actor < Game_Battler
  2501.   #--------------------------------------------------------------------------
  2502.   # ● バトル画面 X 座標の取得
  2503.   #--------------------------------------------------------------------------
  2504.   def screen_x
  2505.     # パーティ内の並び順から X 座標を計算して返す
  2506.     if self.index != nil
  2507.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2508.     else
  2509.       return 0
  2510.     end
  2511.   end
  2512. end
  2513.  
  2514. #==============================================================================
  2515. # ■ Spriteset_Battle
  2516. #------------------------------------------------------------------------------
  2517. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2518. # スの内部で使用されます。
  2519. #==============================================================================
  2520.  
  2521. class Spriteset_Battle
  2522.   #--------------------------------------------------------------------------
  2523.   # ● 公開インスタンス変数
  2524.   #--------------------------------------------------------------------------
  2525.   attr_reader   :real_x                   # x座標補正(現在値)
  2526.   attr_reader   :real_y                   # y座標補正(現在値)
  2527.   attr_reader   :real_zoom                # 拡大率(現在値)
  2528.   #--------------------------------------------------------------------------
  2529.   # ● オブジェクト初期化
  2530.   #--------------------------------------------------------------------------
  2531.   def initialize
  2532.     # ビューポートを作成
  2533.     @viewport1 = Viewport.new(0, 0, 640, 480)
  2534.     @viewport2 = Viewport.new(0, 0, 640, 480)
  2535.     @viewport3 = Viewport.new(0, 0, 640, 480)
  2536.     @viewport4 = Viewport.new(0, 0, 640, 480)
  2537.     @viewport2.z = 101
  2538.     @viewport3.z = 200
  2539.     @viewport4.z = 5000
  2540.     @wait = 0
  2541.     @real_x = 0
  2542.     @real_y = 0
  2543.     @real_zoom = 1.0
  2544.     @target_x = 0
  2545.     @target_y = 0
  2546.     @target_zoom = 1.0
  2547.     @gap_x = 0
  2548.     @gap_y = 0
  2549.     @gap_zoom = 0.0
  2550.     # バトルバックスプライトを作成
  2551.     @battleback_sprite = Sprite.new(@viewport1)
  2552.     # エネミースプライトを作成
  2553.     @enemy_sprites = []
  2554.     for enemy in $game_troop.enemies.reverse
  2555.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2556.     end
  2557.     # アクタースプライトを作成
  2558.     @actor_sprites = []
  2559.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2560.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2561.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2562.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2563.     # 天候を作成
  2564.     @weather = RPG::Weather.new(@viewport1)
  2565.     # ピクチャスプライトを作成
  2566.     @picture_sprites = []
  2567.     for i in 51..100
  2568.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  2569.         $game_screen.pictures[i]))
  2570.     end
  2571.     # タイマースプライトを作成
  2572.     @timer_sprite = Sprite_Timer.new
  2573.     # フレーム更新
  2574.     update
  2575.   end
  2576.   #--------------------------------------------------------------------------
  2577.   # ● フレーム更新
  2578.   #--------------------------------------------------------------------------
  2579.   def update
  2580.     # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
  2581.     @actor_sprites[0].battler = $game_party.actors[0]
  2582.     @actor_sprites[1].battler = $game_party.actors[1]
  2583.     @actor_sprites[2].battler = $game_party.actors[2]
  2584.     @actor_sprites[3].battler = $game_party.actors[3]
  2585.     # バトルバックのファイル名が現在のものと違う場合
  2586.     if @battleback_name != $game_temp.battleback_name
  2587.       make_battleback
  2588.     end
  2589.     # 画面のスクロール
  2590.     screen_scroll
  2591.     # モンスターの位置補正
  2592.     for enemy in $game_troop.enemies
  2593.       enemy.real_x = @real_x
  2594.       enemy.real_y = @real_y
  2595.       enemy.real_zoom = @real_zoom
  2596.     end
  2597.     # バトラースプライトを更新
  2598.     for sprite in @enemy_sprites + @actor_sprites
  2599.       sprite.update
  2600.     end
  2601.     # 天候グラフィックを更新
  2602.     @weather.type = $game_screen.weather_type
  2603.     @weather.max = $game_screen.weather_max
  2604.     @weather.update
  2605.     # ピクチャスプライトを更新
  2606.     for sprite in @picture_sprites
  2607.       sprite.update
  2608.     end
  2609.     # タイマースプライトを更新
  2610.     @timer_sprite.update
  2611.     # 画面の色調とシェイク位置を設定
  2612.     @viewport1.tone = $game_screen.tone
  2613.     @viewport1.ox = $game_screen.shake
  2614.     # 画面のフラッシュ色を設定
  2615.     @viewport4.color = $game_screen.flash_color
  2616.     # ビューポートを更新
  2617.     @viewport1.update
  2618.     @viewport2.update
  2619.     @viewport4.update
  2620.   end
  2621.   #--------------------------------------------------------------------------
  2622.   # ● バトル背景の設定
  2623.   #--------------------------------------------------------------------------
  2624.   def make_battleback
  2625.     @battleback_name = $game_temp.battleback_name
  2626.     if @battleback_sprite.bitmap != nil
  2627.       @battleback_sprite.bitmap.dispose
  2628.     end
  2629.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  2630.     if @battleback_sprite.bitmap.width == 640 and
  2631.        @battleback_sprite.bitmap.height == 320
  2632.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  2633.       @base_zoom = 2.0
  2634.       @battleback_sprite.zoom_x = @base_zoom
  2635.       @battleback_sprite.zoom_y = @base_zoom
  2636.       @real_y = 4
  2637.       @battleback_sprite.x = 320
  2638.       @battleback_sprite.y = @real_y
  2639.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2640.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2641.     elsif @battleback_sprite.bitmap.width == 640 and
  2642.           @battleback_sprite.bitmap.height == 480
  2643.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  2644.       @base_zoom = 1.5
  2645.       @battleback_sprite.zoom_x = @base_zoom
  2646.       @battleback_sprite.zoom_y = @base_zoom
  2647.       @battleback_sprite.x = 320
  2648.       @battleback_sprite.y = 0
  2649.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2650.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2651.     else
  2652.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  2653.                                       @battleback_sprite.bitmap.height)
  2654.       @base_zoom = 1.0
  2655.       @battleback_sprite.zoom_x = @base_zoom
  2656.       @battleback_sprite.zoom_y = @base_zoom
  2657.       @battleback_sprite.x = 320
  2658.       @battleback_sprite.y = 0
  2659.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2660.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2661.     end
  2662.   end
  2663.   #--------------------------------------------------------------------------
  2664.   # ● 画面のスクロール目標の位置・拡大率設定
  2665.   #--------------------------------------------------------------------------
  2666.   def screen_target(x, y, zoom)
  2667.     return unless $scene.drive
  2668.     @wait = $scene.scroll_time
  2669.     @target_x = x
  2670.     @target_y = y
  2671.     @target_zoom = zoom
  2672.     screen_over
  2673.     @gap_x = @target_x - @real_x
  2674.     @gap_y = @target_y - @real_y
  2675.     @gap_zoom = @target_zoom - @real_zoom
  2676.   end
  2677.   #--------------------------------------------------------------------------
  2678.   # ● 画面のスクロール
  2679.   #--------------------------------------------------------------------------
  2680.   def screen_scroll
  2681.     if @wait > 0
  2682.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  2683.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  2684.       @real_zoom = @target_zoom -
  2685.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  2686.       @battleback_sprite.x = 320 + @real_x
  2687.       @battleback_sprite.y = @real_y
  2688.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  2689.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  2690.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2691.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2692.       @wait -= 1
  2693.     end
  2694.   end
  2695.   #--------------------------------------------------------------------------
  2696.   # ● スクリーンが画面外に出た時の補正処理
  2697.   #--------------------------------------------------------------------------
  2698.   def screen_over
  2699.     width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
  2700.     unless 324 + @target_x > width and 324 - @target_x > width
  2701.       if 324 + @target_x > width
  2702.         @target_x = width - 324
  2703.       elsif 324 - @target_x > width
  2704.         @target_x = 324 - width
  2705.       end
  2706.     end
  2707.     height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
  2708.     unless @target_y > height - 4 and 484 - @target_y > 3 * height
  2709.       if @target_y > height - 4
  2710.         @target_y = height - 4
  2711.       elsif 484 - @target_y > 3 * height
  2712.         @target_y = 484 - 3 * height
  2713.       end
  2714.     end
  2715.   end
  2716. end
  2717.  
  2718. #==============================================================================
  2719. # ■ Game_Battler (分割定義 1)
  2720. #------------------------------------------------------------------------------
  2721. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2722. # スのスーパークラスとして使用されます。
  2723. #==============================================================================
  2724.  
  2725. class Game_Battler
  2726.   #--------------------------------------------------------------------------
  2727.   # ● 公開インスタンス変数追加
  2728.   #--------------------------------------------------------------------------
  2729.   attr_accessor :up_level                  # レベルアップ数
  2730.   attr_accessor :at                        # AT(タイムゲージ)
  2731.   attr_accessor :atp                       # AT(表示用)
  2732.   attr_accessor :rt                        # RP(詠唱ゲージ)
  2733.   attr_accessor :rtp                       # RP(詠唱必要量)
  2734.   attr_accessor :spell                     # 合成スキル発動中
  2735.   attr_accessor :recover_hp                # HP回復量
  2736.   attr_accessor :recover_sp                # SP回復量
  2737.   attr_accessor :state_p                   # ステータス異常配列
  2738.   attr_accessor :state_m                   # ステータス異常配列
  2739.   attr_accessor :damage_sp                 # SPダメージ表示フラグ
  2740.   attr_accessor :animation                 # アニメーション ID, Hitの配列
  2741.   attr_accessor :phase
  2742.   attr_accessor :wait
  2743.   attr_accessor :target
  2744.   attr_accessor :anime1
  2745.   attr_accessor :anime2
  2746.   attr_accessor :event
  2747.   #--------------------------------------------------------------------------
  2748.   # ● オブジェクト初期化
  2749.   #--------------------------------------------------------------------------
  2750.   alias :initialize_rtab :initialize
  2751.   def initialize
  2752.     initialize_rtab
  2753.     @damage_pop = {}
  2754.     @damage = {}
  2755.     @damage_sp = {}
  2756.     @critical = {}
  2757.     @recover_hp = {}
  2758.     @recover_sp = {}
  2759.     @state_p = {}
  2760.     @state_m = {}
  2761.     @animation = []
  2762.     @phase = 1
  2763.     @wait = 0
  2764.     @target = []
  2765.     @anime1 = 0
  2766.     @anime2 = 0
  2767.     @event = 0
  2768.   end
  2769.   #--------------------------------------------------------------------------
  2770.   # ● 存在判定
  2771.   #--------------------------------------------------------------------------
  2772.   def exist?
  2773.     return (not @hidden and (@hp > 0 or @immortal or @damage.size > 0))
  2774.   end
  2775.   #--------------------------------------------------------------------------
  2776.   # ● 残HP予測
  2777.   #--------------------------------------------------------------------------
  2778.   def rest_hp
  2779.     # rest_hp に現HPを代入
  2780.     rest_hp = @hp
  2781.     # バトラーが受ける全ダメージをrest_hpに反映させる
  2782.     for pre_damage in @damage
  2783.       if pre_damage[1].is_a?(Numeric)
  2784.         rest_hp -= pre_damage[1]
  2785.       end
  2786.     end
  2787.     return rest_hp
  2788.   end
  2789.   #--------------------------------------------------------------------------
  2790.   # ● ステートの解除
  2791.   #     state_id : ステート ID
  2792.   #     force    : 強制解除フラグ (オートステートの処理で使用)
  2793.   #--------------------------------------------------------------------------
  2794.   def remove_state(state_id, force = false)
  2795.     # このステートが付加されている場合
  2796.     if state?(state_id)
  2797.       # 強制付加されたステートで、かつ解除が強制ではない場合
  2798.       if @states_turn[state_id] == -1 and not force
  2799.         # メソッド終了
  2800.         return
  2801.       end
  2802.       # 現在の HP が 0 かつ オプション [HP 0 の状態とみなす] が有効の場合
  2803.       if @hp == 0 and $data_states[state_id].zero_hp
  2804.         # ほかに [HP 0 の状態とみなす] ステートがあるかどうか判定
  2805.         zero_hp = false
  2806.         for i in @states
  2807.           if i != state_id and $data_states[i].zero_hp
  2808.             zero_hp = true
  2809.           end
  2810.         end
  2811.         # 戦闘不能を解除してよければ、HP を 1 に変更
  2812.         if zero_hp == false
  2813.           @hp = 1
  2814.         end
  2815.       end
  2816.       unless self.movable?
  2817.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2818.         @states.delete(state_id)
  2819.         @states_turn.delete(state_id)
  2820.         if self.movable?
  2821.           self.at = 0
  2822.         end
  2823.       else
  2824.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2825.         @states.delete(state_id)
  2826.         @states_turn.delete(state_id)
  2827.       end
  2828.     end
  2829.     # HP および SP の最大値チェック
  2830.     @hp = [@hp, self.maxhp].min
  2831.     @sp = [@sp, self.maxsp].min
  2832.   end
  2833.   #--------------------------------------------------------------------------
  2834.   # ● 通常攻撃の効果適用
  2835.   #     attacker : 攻撃者 (バトラー)
  2836.   #--------------------------------------------------------------------------
  2837.   def attack_effect(attacker)
  2838.     # クリティカルフラグをクリア
  2839.     self.critical[attacker] = false
  2840.     state_p[attacker] = []
  2841.     state_m[attacker] = []
  2842.     # 第一命中判定
  2843.     hit_result = (rand(100) < attacker.hit)
  2844.     # 命中の場合
  2845.     if hit_result == true
  2846.       # 基本ダメージを計算
  2847.       atk = [attacker.atk - self.pdef / 2, 0].max
  2848.       self.damage[attacker] = atk * (20 + attacker.str) / 20
  2849.       # 属性修正
  2850.       self.damage[attacker] *= elements_correct(attacker.element_set)
  2851.       self.damage[attacker] /= 100
  2852.       # ダメージの符号が正の場合
  2853.       if self.damage[attacker] > 0
  2854.         # クリティカル修正
  2855.         if rand(100) < 4 * attacker.dex / self.agi
  2856.           self.damage[attacker] *= 2
  2857.           self.critical[attacker] = true
  2858.         end
  2859.         # 防御修正
  2860.         if self.guarding?
  2861.           self.damage[attacker] /= 2
  2862.         end
  2863.       end
  2864.       # 分散
  2865.       if self.damage[attacker].abs > 0
  2866.         amp = [self.damage[attacker].abs * 15 / 100, 1].max
  2867.         self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
  2868.       end
  2869.       # 第二命中判定
  2870.       eva = 8 * self.agi / attacker.dex + self.eva
  2871.       hit = self.damage[attacker] < 0 ? 100 : 100 - eva
  2872.       hit = self.cant_evade? ? 100 : hit
  2873.       hit_result = (rand(100) < hit)
  2874.     end
  2875.     # 命中の場合
  2876.     if hit_result == true
  2877.       # ステート衝撃解除
  2878.       remove_states_shock
  2879.       # HP からダメージを減算
  2880.       # ステート変化
  2881.       @state_changed = false
  2882.       states_plus(attacker, attacker.plus_state_set)
  2883.       states_minus(attacker, attacker.minus_state_set)
  2884.     # ミスの場合
  2885.     else
  2886.       # ダメージに "Miss" を設定
  2887.       self.damage[attacker] = "Miss"
  2888.       # クリティカルフラグをクリア
  2889.       self.critical[attacker] = false
  2890.     end
  2891.     # メソッド終了
  2892.     return true
  2893.   end
  2894.   #--------------------------------------------------------------------------
  2895.   # ● スキルの効果適用
  2896.   #     user  : スキルの使用者 (バトラー)
  2897.   #     skill : スキル
  2898.   #--------------------------------------------------------------------------
  2899.   def skill_effect(user, skill)
  2900.     # クリティカルフラグをクリア
  2901.     self.critical[user] = false
  2902.     state_p[user] = []
  2903.     state_m[user] = []
  2904.     # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  2905.     # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  2906.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0)# or
  2907.   #     ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  2908.       # メソッド終了
  2909.       return false
  2910.     end
  2911.     # 有効フラグをクリア
  2912.     effective = false
  2913.     # コモンイベント ID が有効の場合は有効フラグをセット
  2914.     effective |= skill.common_event_id > 0
  2915.     # 第一命中判定
  2916.     hit = skill.hit
  2917.     if skill.atk_f > 0
  2918.       hit *= user.hit / 100
  2919.     end
  2920.     hit_result = (rand(100) < hit)
  2921.     # 不確実なスキルの場合は有効フラグをセット
  2922.     effective |= hit < 100
  2923.     # 命中の場合
  2924.     if hit_result == true
  2925.       # 威力を計算
  2926.       power = skill.power + user.atk * skill.atk_f / 100
  2927.       if power > 0
  2928.         power -= self.pdef * skill.pdef_f / 200
  2929.         power -= self.mdef * skill.mdef_f / 200
  2930.         power = [power, 0].max
  2931.       end
  2932.       # 倍率を計算
  2933.       rate = 20
  2934.       rate += (user.str * skill.str_f / 100)
  2935.       rate += (user.dex * skill.dex_f / 100)
  2936.       rate += (user.agi * skill.agi_f / 100)
  2937.       rate += (user.int * skill.int_f / 100)
  2938.       # 基本ダメージを計算
  2939.       self.damage[user] = power * rate / 20
  2940.       # 属性修正
  2941.       self.damage[user] *= elements_correct(skill.element_set)
  2942.       self.damage[user] /= 100
  2943.       # ダメージの符号が正の場合
  2944.       if self.damage[user] > 0
  2945.         # 防御修正
  2946.         if self.guarding?
  2947.           self.damage[user] /= 2
  2948.         end
  2949.       end
  2950.       # 分散
  2951.       if skill.variance > 0 and self.damage[user].abs > 0
  2952.         amp = [self.damage[user].abs * skill.variance / 100, 1].max
  2953.         self.damage[user] += rand(amp+1) + rand(amp+1) - amp
  2954.       end
  2955.       # 第二命中判定
  2956.       eva = 8 * self.agi / user.dex + self.eva
  2957.       hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
  2958.       hit = self.cant_evade? ? 100 : hit
  2959.       hit_result = (rand(100) < hit)
  2960.       # 不確実なスキルの場合は有効フラグをセット
  2961.       effective |= hit < 100
  2962.     end
  2963.     # 命中の場合
  2964.     if hit_result == true
  2965.       # 威力 0 以外の物理攻撃の場合
  2966.       if skill.power != 0 and skill.atk_f > 0
  2967.         # ステート衝撃解除
  2968.         remove_states_shock
  2969.         # 有効フラグをセット
  2970.         effective = true
  2971.       end
  2972.       # HP の変動判定
  2973.       last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
  2974.       # 効果判定
  2975.       effective |= self.hp != last_hp
  2976.       # ステート変化
  2977.       @state_changed = false
  2978.       effective |= states_plus(user, skill.plus_state_set)
  2979.       effective |= states_minus(user, skill.minus_state_set)
  2980.       unless $game_temp.in_battle
  2981.         self.damage_effect(user,1, skill )
  2982.       end
  2983.       # 威力が 0 の場合
  2984.       if skill.power == 0
  2985.         # ダメージに空文字列を設定
  2986.         self.damage[user] = ""
  2987.         # ステートに変化がない場合
  2988.         unless @state_changed
  2989.           # ダメージに "Miss" を設定
  2990.           self.damage[user] = "Miss"
  2991.         end
  2992.       end
  2993.     # ミスの場合
  2994.     else
  2995.       # ダメージに "Miss" を設定
  2996.       self.damage[user] = "Miss"
  2997.     end
  2998.     # 戦闘中でない場合
  2999.     unless $game_temp.in_battle
  3000.       # ダメージに nil を設定
  3001.       self.damage[user] = nil
  3002.     end
  3003.     # メソッド終了
  3004.     return effective
  3005.   end
  3006.   #--------------------------------------------------------------------------
  3007.   # ● アイテムの効果適用
  3008.   #     item : アイテム
  3009.   #--------------------------------------------------------------------------
  3010.   def item_effect(item, user = $game_party.actors[0])
  3011.     # クリティカルフラグをクリア
  3012.     self.critical[user] = false
  3013.     state_p[user] = []
  3014.     state_m[user] = []
  3015.     self.recover_hp[user] = 0
  3016.     self.recover_sp[user] = 0
  3017.     # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  3018.     # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  3019.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0)# or
  3020.     #   ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  3021.       # メソッド終了
  3022.       return false
  3023.     end
  3024.     # 有効フラグをクリア
  3025.     effective = false
  3026.     # コモンイベント ID が有効の場合は有効フラグをセット
  3027.     effective |= item.common_event_id > 0
  3028.     # 命中判定
  3029.     hit_result = (rand(100) < item.hit)
  3030.     # 不確実なスキルの場合は有効フラグをセット
  3031.     effective |= item.hit < 100
  3032.     # 命中の場合
  3033.     if hit_result == true
  3034.       # 回復量を計算
  3035.       self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
  3036.                               item.recover_hp
  3037.       self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
  3038.                               item.recover_sp
  3039.       if self.recover_hp[user] < 0
  3040.         self.recover_hp[user] += self.pdef * item.pdef_f / 20
  3041.         self.recover_hp[user] += self.mdef * item.mdef_f / 20
  3042.         self.recover_hp[user] = [self.recover_hp[user], 0].min
  3043.       end
  3044.       # 属性修正
  3045.       self.recover_hp[user] *= elements_correct(item.element_set)
  3046.       self.recover_hp[user] /= 100
  3047.       self.recover_sp[user] *= elements_correct(item.element_set)
  3048.       self.recover_sp[user] /= 100
  3049.       # 分散
  3050.       if item.variance > 0 and self.recover_hp[user].abs > 0
  3051.         amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
  3052.         self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
  3053.       end
  3054.       if item.variance > 0 and self.recover_sp[user].abs > 0
  3055.         amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
  3056.         self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
  3057.       end
  3058.       # 回復量の符号が負の場合
  3059.       if self.recover_hp[user] < 0
  3060.         # 防御修正
  3061.         if self.guarding?
  3062.           self.recover_hp[user] /= 2
  3063.         end
  3064.       end
  3065.       # HP 回復量の符号を反転し、ダメージの値に設定
  3066.       self.damage[user] = -self.recover_hp[user]
  3067.       # HP および SP の変動判定
  3068.       last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
  3069.       last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
  3070.       effective |= self.hp != last_hp
  3071.       effective |= self.sp != last_sp
  3072.       # ステート変化
  3073.       @state_changed = false
  3074.       effective |= states_plus(user, item.plus_state_set)
  3075.       effective |= states_minus(user, item.minus_state_set)
  3076.       unless $game_temp.in_battle
  3077.         self.damage_effect(user,2, nil)
  3078.       end
  3079.       # パラメータ上昇値が有効の場合
  3080.       if item.parameter_type > 0 and item.parameter_points != 0
  3081.         # パラメータで分岐
  3082.         case item.parameter_type
  3083.         when 1  # MaxHP
  3084.           @maxhp_plus += item.parameter_points
  3085.         when 2  # MaxSP
  3086.           @maxsp_plus += item.parameter_points
  3087.         when 3  # 腕力
  3088.           @str_plus += item.parameter_points
  3089.         when 4  # 器用さ
  3090.           @dex_plus += item.parameter_points
  3091.         when 5  # 素早さ
  3092.           @agi_plus += item.parameter_points
  3093.         when 6  # 魔力
  3094.           @int_plus += item.parameter_points
  3095.         end
  3096.         # 有効フラグをセット
  3097.         effective = true
  3098.       end
  3099.       # HP 回復率と回復量が 0 の場合
  3100.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  3101.         # ダメージに空文字列を設定
  3102.         self.damage[user] = ""
  3103.         # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合
  3104.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  3105.            (item.parameter_type == 0 or item.parameter_points == 0)
  3106.           # ステートに変化がない場合
  3107.           unless @state_changed
  3108.             # ダメージに "Miss" を設定
  3109.             self.damage[user] = "Miss"
  3110.           end
  3111.         end
  3112.       end
  3113.     # ミスの場合
  3114.     else
  3115.       # ダメージに "Miss" を設定
  3116.       self.damage[user] = "Miss"
  3117.     end
  3118.     # 戦闘中でない場合
  3119.     unless $game_temp.in_battle
  3120.       # ダメージに nil を設定
  3121.       self.damage[user] = nil
  3122.     end
  3123.     # メソッド終了
  3124.     return effective
  3125.   end
  3126.   #--------------------------------------------------------------------------
  3127.   # ● ステート変化 (+) の適用
  3128.   #     plus_state_set  : ステート変化 (+)
  3129.   #--------------------------------------------------------------------------
  3130.   def states_plus(battler, plus_state_set)
  3131.     # 有効フラグをクリア
  3132.     effective = false
  3133.     # ループ (付加するステート)
  3134.     for i in plus_state_set
  3135.       # このステートが防御されていない場合
  3136.       unless self.state_guard?(i)
  3137.         # このステートがフルでなければ有効フラグをセット
  3138.         effective |= self.state_full?(i) == false
  3139.         # ステートが [抵抗しない] の場合
  3140.         if $data_states[i].nonresistance
  3141.           # ステート変化フラグをセット
  3142.           @state_changed = true
  3143.           # ステートを付加
  3144.           self.state_p[battler].push(i)
  3145.         # このステートがフルではない場合
  3146.         elsif self.state_full?(i) == false
  3147.           # ステート有効度を確率に変換し、乱数と比較
  3148.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  3149.             # ステート変化フラグをセット
  3150.             @state_changed = true
  3151.             # ステートを付加
  3152.             self.state_p[battler].push(i)
  3153.           end
  3154.         end
  3155.       end
  3156.     end
  3157.     # メソッド終了
  3158.     return effective
  3159.   end
  3160.   #--------------------------------------------------------------------------
  3161.   # ● ステート変化 (-) の適用
  3162.   #     minus_state_set : ステート変化 (-)
  3163.   #--------------------------------------------------------------------------
  3164.   def states_minus(battler, minus_state_set)
  3165.     # 有効フラグをクリア
  3166.     effective = false
  3167.     # ループ (解除するステート)
  3168.     for i in minus_state_set
  3169.       # このステートが付加されていれば有効フラグをセット
  3170.       effective |= self.state?(i)
  3171.       # ステート変化フラグをセット
  3172.       @state_changed = true
  3173.       # ステートを解除
  3174.       self.state_m[battler].push(i)
  3175.     end
  3176.     # メソッド終了
  3177.     return effective
  3178.   end
  3179.   #--------------------------------------------------------------------------
  3180.   # ● ダメージ演算
  3181.   #--------------------------------------------------------------------------
  3182.   def damage_effect(battler, item)
  3183.     if item == 2
  3184.       self.hp += self.recover_hp[battler]
  3185.       self.sp += self.recover_sp[battler]
  3186.       if self.recover_sp[battler] != 0
  3187.         self.damage_sp[battler] = -self.recover_sp[battler]
  3188.       end
  3189.       self.recover_hp.delete(battler)
  3190.       self.recover_sp.delete(battler)
  3191.     else
  3192.       if self.damage[battler].class != String
  3193.         self.hp -= self.damage[battler]
  3194.       end
  3195.     end
  3196.     for i in self.state_p[battler]
  3197.       add_state(i)
  3198.     end
  3199.     for i in self.state_m[battler]
  3200.       remove_state(i)
  3201.     end
  3202.   end
  3203.   #--------------------------------------------------------------------------
  3204.   # ● スリップダメージの効果適用
  3205.   #--------------------------------------------------------------------------
  3206. # 3=>毒
  3207. # 24=>回血
  3208. # 32=>烧伤
  3209. # 33=>冻伤
  3210. # 45=>回蓝
  3211. def slip_damage_effect
  3212.   hp_v = {3 => self.maxhp / 30, 24 => -self.hp / 20, 32 => self.maxhp / 10,33 => self.maxhp / 10}
  3213.   sp_v = {45 => -self.maxsp / 20}
  3214.   hp_damage = 0
  3215.   sp_damage = 0
  3216.   hp_v.keys.each do |id|
  3217.     hp_damage += hp_v[id] if self.state?(id)
  3218.   end
  3219.   sp_v.keys.each do |id|
  3220.     sp_damage += sp_v[id] if self.state?(id)
  3221.   end
  3222.   self.damage["slip"] = hp_damage if hp_damage != 0
  3223.   self.hp -= hp_damage
  3224.   self.damage_sp["slip"] = sp_damage if sp_damage != 0
  3225.   self.sp -= sp_damage
  3226. end
  3227. end
  3228. #######################################
  3229. #==============================================================================
  3230. # ■ Game_BattleAction
  3231. #------------------------------------------------------------------------------
  3232. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3233. # スの内部で使用されます。
  3234. #==============================================================================
  3235.  
  3236. class Game_BattleAction
  3237.   #--------------------------------------------------------------------------
  3238.   # ● 公開インスタンス変数
  3239.   #--------------------------------------------------------------------------
  3240.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3241.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3242.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3243.   attr_accessor :force_skill_id           # スキル ID
  3244.   #--------------------------------------------------------------------------
  3245.   # ● 有効判定
  3246.   #--------------------------------------------------------------------------
  3247.   def valid?
  3248.     return (not (@force_kind == 0 and @force_basic == 3))
  3249.   end
  3250. end
  3251.  
  3252. #==============================================================================
  3253. # ■ Game_Actor
  3254. #------------------------------------------------------------------------------
  3255. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3256. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3257. #==============================================================================
  3258.  
  3259. class Game_Actor < Game_Battler
  3260.   def skill_can_use?(skill_id)
  3261.     return super
  3262.   end
  3263. end
  3264.  
  3265. #==============================================================================
  3266. # ■ Game_Enemy
  3267. #------------------------------------------------------------------------------
  3268. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3269. # 内部で使用されます。
  3270. #==============================================================================
  3271.  
  3272. class Game_Enemy < Game_Battler
  3273.   #--------------------------------------------------------------------------
  3274.   # ● 公開インスタンス変数
  3275.   #--------------------------------------------------------------------------
  3276.   attr_accessor :height                  # 画像の高さ
  3277.   attr_accessor :real_x                  # X座標補正
  3278.   attr_accessor :real_y                  # Y座標補正
  3279.   attr_accessor :real_zoom               # 拡大率
  3280.   #--------------------------------------------------------------------------
  3281.   # ● オブジェクト初期化
  3282.   #     troop_id     : トループ ID
  3283.   #     member_index : トループメンバーのインデックス
  3284.   #--------------------------------------------------------------------------
  3285.   def initialize(troop_id, member_index)
  3286.     super()
  3287.     @troop_id = troop_id
  3288.     @member_index = member_index
  3289.     troop = $data_troops[@troop_id]
  3290.     @enemy_id = troop.members[@member_index].enemy_id
  3291.     enemy = $data_enemies[@enemy_id]
  3292.     @battler_name = enemy.battler_name
  3293.     @battler_hue = enemy.battler_hue
  3294.     @hp = maxhp
  3295.     @sp = maxsp
  3296.     @real_x = 0
  3297.     @real_y = 0
  3298.     @real_zoom = 1.0
  3299.     @fly = 0
  3300.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3301.     @hidden = troop.members[@member_index].hidden
  3302.     @immortal = troop.members[@member_index].immortal
  3303.   end
  3304.   alias :true_x :screen_x
  3305.   alias :true_y :screen_y
  3306.   #--------------------------------------------------------------------------
  3307.   # ● バトル画面 X 座標の取得
  3308.   #--------------------------------------------------------------------------
  3309.   def screen_x
  3310.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3311.   end
  3312.   #--------------------------------------------------------------------------
  3313.   # ● バトル画面 Y 座標の取得
  3314.   #--------------------------------------------------------------------------
  3315.   def screen_y
  3316.     return true_y * @real_zoom + @real_y
  3317.   end
  3318.   #--------------------------------------------------------------------------
  3319.   # ● バトル画面 Z 座標の取得
  3320.   #--------------------------------------------------------------------------
  3321.   def screen_z
  3322.     return true_y + @fly
  3323.   end
  3324.   #--------------------------------------------------------------------------
  3325.   # ● バトル画面 拡大率の取得
  3326.   #--------------------------------------------------------------------------
  3327.   def zoom
  3328.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3329.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3330.   end
  3331.   #--------------------------------------------------------------------------
  3332.   # ● 攻撃用、バトル画面 X 座標の取得
  3333.   #--------------------------------------------------------------------------
  3334.   def attack_x(z)
  3335.     return (320 - true_x) * z * 0.75
  3336.   end
  3337.   #--------------------------------------------------------------------------
  3338.   # ● 攻撃用、バトル画面 Y 座標の取得
  3339.   #--------------------------------------------------------------------------
  3340.   def attack_y(z)
  3341.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3342.   end
  3343.   #--------------------------------------------------------------------------
  3344.   # ● アクション作成
  3345.   #--------------------------------------------------------------------------
  3346.   def make_action
  3347.     # カレントアクションをクリア
  3348.     self.current_action.clear
  3349.     # 動けない場合
  3350.     unless self.inputable?
  3351.       # メソッド終了
  3352.       return
  3353.     end
  3354.     # 現在有効なアクションを抽出
  3355.     available_actions = []
  3356.     rating_max = 0
  3357.     for action in self.actions
  3358.       # ターン 条件確認
  3359.       n = $game_temp.battle_turn
  3360.       a = action.condition_turn_a
  3361.       b = action.condition_turn_b
  3362.       if (b == 0 and n != a) or
  3363.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3364.         next
  3365.       end
  3366.       # HP 条件確認
  3367.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3368.         next
  3369.       end
  3370.       # レベル 条件確認
  3371.       if $game_party.max_level < action.condition_level
  3372.         next
  3373.       end
  3374.       # スイッチ 条件確認
  3375.       switch_id = action.condition_switch_id
  3376.       if switch_id > 0 and $game_switches[switch_id] == false
  3377.         next
  3378.       end
  3379.       # スキル使用可能 条件確認
  3380.       if action.kind == 1
  3381.         unless self.skill_can_use?(action.skill_id)
  3382.           next
  3383.         end
  3384.       end
  3385.       # 条件に該当 : このアクションを追加
  3386.       available_actions.push(action)
  3387.       if action.rating > rating_max
  3388.         rating_max = action.rating
  3389.       end
  3390.     end
  3391.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3392.     ratings_total = 0
  3393.     for action in available_actions
  3394.       if action.rating > rating_max - 3
  3395.         ratings_total += action.rating - (rating_max - 3)
  3396.       end
  3397.     end
  3398.     # レーティングの合計が 0 ではない場合
  3399.     if ratings_total > 0
  3400.       # 乱数を作成
  3401.       value = rand(ratings_total)
  3402.       # 作成した乱数に対応するものをカレントアクションに設定
  3403.       for action in available_actions
  3404.         if action.rating > rating_max - 3
  3405.           if value < action.rating - (rating_max - 3)
  3406.             self.current_action.kind = action.kind
  3407.             self.current_action.basic = action.basic
  3408.             self.current_action.skill_id = action.skill_id
  3409.             self.current_action.decide_random_target_for_enemy
  3410.             return
  3411.           else
  3412.             value -= action.rating - (rating_max - 3)
  3413.           end
  3414.         end
  3415.       end
  3416.     end
  3417.   end
  3418. end
  3419.  
  3420. #==============================================================================
  3421. # ■ Game_Party
  3422. #------------------------------------------------------------------------------
  3423. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3424. # ラスのインスタンスは $game_party で参照されます。
  3425. #==============================================================================
  3426.  
  3427. class Game_Party
  3428.   #--------------------------------------------------------------------------
  3429.   # ● 全滅判定
  3430.   #--------------------------------------------------------------------------
  3431.   def all_dead?
  3432.     # パーティ人数が 0 人の場合
  3433.     if $game_party.actors.size == 0
  3434.       return false
  3435.     end
  3436.     # HP 0 以上のアクターがパーティにいる場合
  3437.     for actor in @actors
  3438.       if actor.rest_hp > 0
  3439.         return false
  3440.       end
  3441.     end
  3442.     # 全滅
  3443.     return true
  3444.   end
  3445.   #--------------------------------------------------------------------------
  3446.   # ● 対象アクターのランダムな決定
  3447.   #     hp0 : HP 0 のアクターに限る
  3448.   #--------------------------------------------------------------------------
  3449.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3450.   alias :random_target_actor_rtab :random_target_actor
  3451.   def random_target_actor(hp0 = false)
  3452.     # ルーレットを初期化
  3453.     roulette = []
  3454.     # ループ
  3455.     for actor in @actors
  3456.       # 条件に該当する場合
  3457.       if (not hp0 and actor.exist? and actor.rest_hp > 0) or
  3458.           (hp0 and actor.hp0?)
  3459.         # アクターのクラスの [位置] を取得
  3460.         position = $data_classes[actor.class_id].position
  3461.         # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  3462.         n = 4 - position
  3463.         # ルーレットにアクターを n 回追加
  3464.         n.times do
  3465.           roulette.push(actor)
  3466.         end
  3467.       end
  3468.     end
  3469.     # ルーレットのサイズが 0 の場合
  3470.     if roulette.size == 0
  3471.       return random_target_actor_rtab(hp0)
  3472.     end
  3473.     # ルーレットを回し、アクターを決定
  3474.     return roulette[rand(roulette.size)]
  3475.   end
  3476.   #--------------------------------------------------------------------------
  3477.   # ● 対象アクターのスムーズな決定
  3478.   #     actor_index : アクターインデックス
  3479.   #--------------------------------------------------------------------------
  3480.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3481.   alias :smooth_target_actor_rtab :smooth_target_actor
  3482.   def smooth_target_actor(actor_index)
  3483.     # アクターを取得
  3484.     actor = @actors[actor_index]
  3485.     # アクターが存在する場合
  3486.     if actor != nil and actor.exist? and actor.rest_hp > 0
  3487.       return actor
  3488.     end
  3489.     # ループ
  3490.     for actor in @actors
  3491.       # アクターが存在する場合
  3492.       if actor.exist? and actor.rest_hp > 0
  3493.         return actor
  3494.       end
  3495.     end
  3496.     # 味方が全滅している場合、オリジナルのターゲット決定ルーチンを実行する
  3497.     return smooth_target_actor_rtab(actor_index)
  3498.   end
  3499. end
  3500.  
  3501. #==============================================================================
  3502. # ■ Game_Troop
  3503. #------------------------------------------------------------------------------
  3504. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3505. # れます。
  3506. #==============================================================================
  3507.  
  3508. class Game_Troop
  3509.   #--------------------------------------------------------------------------
  3510.   # ● 対象エネミーのランダムな決定
  3511.   #     hp0 : HP 0 のエネミーに限る
  3512.   #--------------------------------------------------------------------------
  3513.   # オリジナルのターゲット決定ルーチンを random_target_enemy_rtab と名前変更
  3514.   alias :random_target_enemy_rtab :random_target_enemy
  3515.   def random_target_enemy(hp0 = false)
  3516.     # ルーレットを初期化
  3517.     roulette = []
  3518.     # ループ
  3519.     for enemy in @enemies
  3520.       # 条件に該当する場合
  3521.       if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
  3522.           (hp0 and enemy.hp0?)
  3523.         # ルーレットにエネミーを追加
  3524.         roulette.push(enemy)
  3525.       end
  3526.     end
  3527.     # ルーレットのサイズが 0 の場合
  3528.     if roulette.size == 0
  3529.       return random_target_enemy_rtab(hp0)
  3530.     end
  3531.     # ルーレットを回し、エネミーを決定
  3532.     return roulette[rand(roulette.size)]
  3533.   end
  3534.   #--------------------------------------------------------------------------
  3535.   # ● 対象エネミーのスムーズな決定
  3536.   #     enemy_index : エネミーインデックス
  3537.   #--------------------------------------------------------------------------
  3538.   # オリジナルのターゲット決定ルーチンを smooth_target_enemy_rtab と名前変更
  3539.   alias :smooth_target_enemy_rtab :smooth_target_enemy
  3540.   def smooth_target_enemy(enemy_index)
  3541.     # エネミーを取得
  3542.     enemy = @enemies[enemy_index]
  3543.     # エネミーが存在する場合
  3544.     if enemy != nil and enemy.exist? and enemy.rest_hp > 0
  3545.       return enemy
  3546.     end
  3547.     # ループ
  3548.     for enemy in @enemies
  3549.       # エネミーが存在する場合
  3550.       if enemy.exist? and enemy.rest_hp > 0
  3551.         return enemy
  3552.       end
  3553.     end
  3554.     # 敵が全滅している場合、再度敵の検索を行う
  3555.     return smooth_target_enemy_rtab(enemy_index)
  3556.   end
  3557. end
  3558.  
  3559. #==============================================================================
  3560. # ■ Sprite_Battler
  3561. #------------------------------------------------------------------------------
  3562. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3563. # スプライトの状態を自動的に変化させます。
  3564. #==============================================================================
  3565.  
  3566. class Sprite_Battler < RPG::Sprite
  3567.   #--------------------------------------------------------------------------
  3568.   # ● フレーム更新
  3569.   #--------------------------------------------------------------------------
  3570.   def update
  3571.     super
  3572.     # バトラーが nil の場合
  3573.     if @battler == nil
  3574.       self.bitmap = nil
  3575.       loop_animation(nil)
  3576.       return
  3577.     end
  3578.     # ファイル名か色相が現在のものと異なる場合
  3579.     if @battler.battler_name != @battler_name or
  3580.        @battler.battler_hue != @battler_hue
  3581.       # ビットマップを取得、設定
  3582.       @battler_name = @battler.battler_name
  3583.       @battler_hue = @battler.battler_hue
  3584.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3585.       @width = bitmap.width
  3586.       @height = bitmap.height
  3587.       self.ox = @width / 2
  3588.       self.oy = @height
  3589.       if @battler.is_a?(Game_Enemy)
  3590.         @battler.height = @height
  3591.       end
  3592.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3593.       if @battler.dead? or @battler.hidden
  3594.         self.opacity = 0
  3595.       end
  3596.     end
  3597.     # アニメーション ID が現在のものと異なる場合
  3598.     if @battler.state_animation_id != @state_animation_id
  3599.       @state_animation_id = @battler.state_animation_id
  3600.       loop_animation($data_animations[@state_animation_id])
  3601.     end
  3602.     # 表示されるべきアクターの場合
  3603.     if @battler.is_a?(Game_Actor) and @battler_visible
  3604.       # メインフェーズでないときは不透明度をやや下げる
  3605.       if $game_temp.battle_main_phase
  3606.         self.opacity += 3 if self.opacity < 255
  3607.       else
  3608.         self.opacity -= 3 if self.opacity > 207
  3609.       end
  3610.     end
  3611.     # 明滅
  3612.     if @battler.blink
  3613.       blink_on
  3614.     else
  3615.       blink_off
  3616.     end
  3617.     # 不可視の場合
  3618.     unless @battler_visible
  3619.       # 出現
  3620.       if not @battler.hidden and not @battler.dead? and
  3621.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3622.         appear
  3623.         @battler_visible = true
  3624.       end
  3625.     end
  3626.     # ダメージ
  3627.     for battler in @battler.damage_pop
  3628.       if battler[0].class == Array
  3629.         if battler[0][1] >= 0
  3630.           $scene.skill_se
  3631.         else
  3632.           $scene.levelup_se
  3633.         end
  3634.         damage(@battler.damage[battler[0]], false, 2)
  3635.       else
  3636.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3637.       end
  3638.       if @battler.damage_sp.include?(battler[0])
  3639.         damage(@battler.damage_sp[battler[0]],
  3640.                 @battler.critical[battler[0]], 1)
  3641.         @battler.damage_sp.delete(battler[0])
  3642.       end
  3643.       @battler.damage_pop.delete(battler[0])
  3644.       @battler.damage.delete(battler[0])
  3645.       @battler.critical.delete(battler[0])
  3646.     end
  3647.     # 可視の場合
  3648.     if @battler_visible
  3649.       # 逃走
  3650.       if @battler.hidden
  3651.         $game_system.se_play($data_system.escape_se)
  3652.         escape
  3653.         @battler_visible = false
  3654.       end
  3655.       # 白フラッシュ
  3656.       if @battler.white_flash
  3657.         whiten
  3658.         @battler.white_flash = false
  3659.       end
  3660.       # アニメーション
  3661.       unless @battler.animation.empty?
  3662.         for animation in @battler.animation.reverse
  3663.           animation($data_animations[animation[0]], animation[1])
  3664.           @battler.animation.delete(animation)
  3665.         end
  3666.       end
  3667.       # コラプス
  3668.       if @battler.damage.empty? and @battler.dead?
  3669.         if $scene.dead_ok?(@battler)
  3670.           if @battler.is_a?(Game_Enemy)
  3671.             $game_system.se_play($data_system.enemy_collapse_se)
  3672.           else
  3673.             $game_system.se_play($data_system.actor_collapse_se)
  3674.           end
  3675.           collapse
  3676.           @battler_visible = false
  3677.         end
  3678.       end
  3679.     end
  3680.     # スプライトの座標を設定
  3681.     self.x = @battler.screen_x
  3682.     self.y = @battler.screen_y
  3683.     self.z = @battler.screen_z
  3684.     if @battler.is_a?(Game_Enemy)
  3685.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3686.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3687.     end
  3688.   end
  3689. end
  3690.  
  3691. #==============================================================================
  3692. # ■ Window_Base
  3693. #------------------------------------------------------------------------------
  3694. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3695. #==============================================================================
  3696.  
  3697. class Window_Base < Window
  3698.   #--------------------------------------------------------------------------
  3699.   # ● ゲージの描画
  3700.   #--------------------------------------------------------------------------
  3701.   def gauge_rect_at(width, height, align3,
  3702.                     color1, color2, color3, color4, color5, color6, color7,
  3703.                     color8, color9, color10, color11, color12, grade1, grade2)
  3704.     # 枠描画
  3705.     @at_gauge = Bitmap.new(width, height * 5)
  3706.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3707.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3708.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3709.       color = color3
  3710.       color3 = color4
  3711.       color4 = color
  3712.     end
  3713.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3714.       color = color5
  3715.       color5 = color6
  3716.       color6 = color
  3717.       color = color7
  3718.       color7 = color8
  3719.       color8 = color
  3720.       color = color9
  3721.       color9 = color10
  3722.       color10 = color
  3723.       color = color11
  3724.       color11 = color12
  3725.       color12 = color
  3726.     end
  3727.     if align3 == 0
  3728.       if grade1 == 2
  3729.         grade1 = 3
  3730.       end
  3731.       if grade2 == 2
  3732.         grade2 = 3
  3733.       end
  3734.     end
  3735.     # 空ゲージの描画 縦にグラデーション表示
  3736.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3737.                                   color3, color4, grade1)
  3738.     # 実ゲージの描画
  3739.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3740.                                   color5, color6, grade2)
  3741.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3742.                                   color7, color8, grade2)
  3743.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3744.                                   color9, color10, grade2)
  3745.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3746.                                   color11, color12, grade2)
  3747.   end
  3748. end
  3749.  
  3750. #==============================================================================
  3751. # ■ Window_Help
  3752. #------------------------------------------------------------------------------
  3753. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3754. #==============================================================================
  3755.  
  3756. class Window_Help < Window_Base
  3757.   #--------------------------------------------------------------------------
  3758.   # ● エネミー設定
  3759.   #     enemy : 名前とステートを表示するエネミー
  3760.   #--------------------------------------------------------------------------
  3761.   def set_enemy(enemy)
  3762.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3763.     state_text = make_battler_state_text(enemy, 112, false)
  3764.     if state_text != ""
  3765.       text += "  " + state_text
  3766.     end
  3767.     set_text(text, 1)
  3768.   end
  3769. end
  3770.  
  3771. #==============================================================================
  3772. # ■ Window_BattleStatus
  3773. #------------------------------------------------------------------------------
  3774. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3775. #==============================================================================
  3776.  
  3777. class Window_BattleStatus < Window_Base
  3778.   #--------------------------------------------------------------------------
  3779.   # ● オブジェクト初期化
  3780.   #--------------------------------------------------------------------------
  3781.   def initialize
  3782.     x = (4 - $game_party.actors.size) * 80
  3783.     width = $game_party.actors.size * 160
  3784.     super(x, 320, width, 160)
  3785.     self.back_opacity = 160
  3786.     @actor_window = []
  3787.     for i in 0...$game_party.actors.size
  3788.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3789.     end
  3790.     @level_up_flags = [false, false, false, false]
  3791.     refresh
  3792.   end
  3793.   #--------------------------------------------------------------------------
  3794.   # ● 解放
  3795.   #--------------------------------------------------------------------------
  3796.   def dispose
  3797.     for window in @actor_window
  3798.       window.dispose
  3799.     end
  3800.     super
  3801.   end
  3802.   #--------------------------------------------------------------------------
  3803.   # ● リフレッシュ
  3804.   #--------------------------------------------------------------------------
  3805.   def refresh(number = 0)
  3806.     if number == 0
  3807.       cnt = 0
  3808.       for window in @actor_window
  3809.         window.refresh(@level_up_flags[cnt])
  3810.         cnt += 1
  3811.       end
  3812.     else
  3813.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3814.     end
  3815.   end
  3816.   #--------------------------------------------------------------------------
  3817.   # ● ATゲージリフレッシュ
  3818.   #--------------------------------------------------------------------------
  3819.   def at_refresh(number = 0)
  3820.     if number == 0
  3821.       for window in @actor_window
  3822.         window.at_refresh
  3823.       end
  3824.     else
  3825.       @actor_window[number - 1].at_refresh
  3826.     end
  3827.   end
  3828.   #--------------------------------------------------------------------------
  3829.   # ● フレーム更新
  3830.   #--------------------------------------------------------------------------
  3831.   def update
  3832.     super
  3833.     if self.x != (4 - $game_party.actors.size) * 80
  3834.       self.x = (4 - $game_party.actors.size) * 80
  3835.       self.width = $game_party.actors.size * 160
  3836.       for window in @actor_window
  3837.         window.dispose
  3838.       end
  3839.       @actor_window = []
  3840.       for i in 0...$game_party.actors.size
  3841.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3842.       end
  3843.       refresh
  3844.     end
  3845.     for window in @actor_window
  3846.       window.update
  3847.     end
  3848.   end
  3849. end
  3850.  
  3851. #==============================================================================
  3852. # ■ Window_ActorStatus
  3853. #------------------------------------------------------------------------------
  3854. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3855. #==============================================================================
  3856.  
  3857. class Window_ActorStatus < Window_Base
  3858.   #--------------------------------------------------------------------------
  3859.   # ● オブジェクト初期化
  3860.   #--------------------------------------------------------------------------
  3861.   def initialize(id, x)
  3862.     @actor_num = id
  3863.     super(x, 320, 160, 160)
  3864.     self.contents = Bitmap.new(width - 32, height - 32)
  3865.     self.opacity = 0
  3866.     self.back_opacity = 0
  3867.     actor = $game_party.actors[@actor_num]
  3868.     @actor_nm = actor.name
  3869.     @actor_mhp = actor.maxhp
  3870.     @actor_msp = actor.maxsp
  3871.     @actor_hp = actor.hp
  3872.     @actor_sp = actor.sp
  3873.     @actor_st = make_battler_state_text(actor, 120, true)
  3874.     @status_window = []
  3875.     for i in 0...5
  3876.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3877.     end
  3878.     refresh(false)
  3879.   end
  3880.   #--------------------------------------------------------------------------
  3881.   # ● 解放
  3882.   #--------------------------------------------------------------------------
  3883.   def dispose
  3884.     for i in 0...5
  3885.       @status_window[i].dispose
  3886.     end
  3887.     super
  3888.   end
  3889.   #--------------------------------------------------------------------------
  3890.   # ● リフレッシュ
  3891.   #--------------------------------------------------------------------------
  3892.   def refresh(level_up_flags)
  3893.     self.contents.clear
  3894.     actor = $game_party.actors[@actor_num]
  3895.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3896.     @status_window[1].refresh(actor) if
  3897.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3898.     @status_window[2].refresh(actor) if
  3899.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3900.     @status_window[3].refresh(actor, level_up_flags) if
  3901.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3902.     @actor_nm = actor.name
  3903.     @actor_mhp = actor.maxhp
  3904.     @actor_msp = actor.maxsp
  3905.     @actor_hp = actor.hp
  3906.     @actor_sp = actor.sp
  3907.     @actor_st = make_battler_state_text(actor, 120, true)
  3908.   end
  3909.   #--------------------------------------------------------------------------
  3910.   # ● ATゲージリフレッシュ
  3911.   #--------------------------------------------------------------------------
  3912.   def at_refresh
  3913.     @status_window[4].refresh($game_party.actors[@actor_num])
  3914.   end
  3915.   #--------------------------------------------------------------------------
  3916.   # ● フレーム更新
  3917.   #--------------------------------------------------------------------------
  3918.   def update
  3919.     for window in @status_window
  3920.       window.update
  3921.     end
  3922.   end
  3923. end
  3924.  
  3925. #==============================================================================
  3926. # ■ Window_DetailsStatus
  3927. #------------------------------------------------------------------------------
  3928. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3929. #==============================================================================
  3930.  
  3931. class Window_DetailsStatus < Window_Base
  3932.   #--------------------------------------------------------------------------
  3933.   # ● オブジェクト初期化
  3934.   #--------------------------------------------------------------------------
  3935.   def initialize(actor, id, x)
  3936.     @status_id = id
  3937.     super(x, 320 + id * 26, 160, 64)
  3938.     self.contents = Bitmap.new(width - 32, height - 32)
  3939.     self.opacity = 0
  3940.     self.back_opacity = 0
  3941.     refresh(actor, false)
  3942.   end
  3943.   #--------------------------------------------------------------------------
  3944.   # ● 解放
  3945.   #--------------------------------------------------------------------------
  3946.   def dispose
  3947.     super
  3948.   end
  3949.   #--------------------------------------------------------------------------
  3950.   # ● リフレッシュ
  3951.   #--------------------------------------------------------------------------
  3952.   def refresh(actor, level_up_flags = false)
  3953.     self.contents.clear
  3954.     case @status_id
  3955.     when 0
  3956.       draw_actor_name(actor, 4, 0)
  3957.     when 1
  3958.       draw_actor_hp(actor, 4, 0, 120)
  3959.     when 2
  3960.       draw_actor_sp(actor, 4, 0, 120)
  3961.     when 3
  3962.       if level_up_flags
  3963.         self.contents.font.color = normal_color
  3964.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3965.       else
  3966.         draw_actor_state(actor, 4, 0)
  3967.       end
  3968.     when 4
  3969.       draw_actor_atg(actor, 4, 0, 120)
  3970.     end
  3971.   end
  3972.   #--------------------------------------------------------------------------
  3973.   # ● フレーム更新
  3974.   #--------------------------------------------------------------------------
  3975.   def update
  3976.     # メインフェーズのときは不透明度をやや下げる
  3977.     if $game_temp.battle_main_phase
  3978.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3979.     else
  3980.       self.contents_opacity += 4 if self.contents_opacity < 255
  3981.     end
  3982.   end
  3983. end
  3984.  
  3985. #==============================================================================
  3986. # ■ Arrow_Base
  3987. #------------------------------------------------------------------------------
  3988. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3989. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3990. #==============================================================================
  3991.  
  3992. class Arrow_Base < Sprite
  3993.   #--------------------------------------------------------------------------
  3994.   # ● オブジェクト初期化
  3995.   #     viewport : ビューポート
  3996.   #--------------------------------------------------------------------------
  3997.   def initialize(viewport)
  3998.     super(viewport)
  3999.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  4000.     self.ox = 16
  4001.     self.oy = 32
  4002.     self.z = 2500
  4003.     @blink_count = 0
  4004.     @index = 0
  4005.     @help_window = nil
  4006.     update
  4007.   end
  4008. end
  4009.  
  4010. #==============================================================================
  4011. # ■ Arrow_Enemy
  4012. #------------------------------------------------------------------------------
  4013. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  4014. # スを継承します。
  4015. #==============================================================================
  4016.  
  4017. class Arrow_Enemy < Arrow_Base
  4018.   #--------------------------------------------------------------------------
  4019.   # ● フレーム更新
  4020.   #--------------------------------------------------------------------------
  4021.   def update
  4022.     super
  4023.     # 存在しないエネミーを指していたら飛ばす
  4024.     $game_troop.enemies.size.times do
  4025.       break if self.enemy.exist?
  4026.       @index += 1
  4027.       @index %= $game_troop.enemies.size
  4028.     end
  4029.     # カーソル右
  4030.     if Input.repeat?(Input::RIGHT)
  4031.       $game_system.se_play($data_system.cursor_se)
  4032.       $game_troop.enemies.size.times do
  4033.         @index += 1
  4034.         @index %= $game_troop.enemies.size
  4035.         break if self.enemy.exist?
  4036.       end
  4037.       $scene.camera = "select"
  4038.       zoom = 1 / self.enemy.zoom
  4039.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4040.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4041.     end
  4042.     # カーソル左
  4043.     if Input.repeat?(Input::LEFT)
  4044.       $game_system.se_play($data_system.cursor_se)
  4045.       $game_troop.enemies.size.times do
  4046.         @index += $game_troop.enemies.size - 1
  4047.         @index %= $game_troop.enemies.size
  4048.         break if self.enemy.exist?
  4049.       end
  4050.       $scene.camera = "select"
  4051.       zoom = 1 / self.enemy.zoom
  4052.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4053.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4054.     end
  4055.     # スプライトの座標を設定
  4056.     if self.enemy != nil
  4057.       self.x = self.enemy.screen_x
  4058.       self.y = self.enemy.screen_y
  4059.     end
  4060.   end
  4061. end
  4062.  
  4063. #==============================================================================
  4064. # ■ Interpreter
  4065. #------------------------------------------------------------------------------
  4066. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4067. # スや Game_Event クラスの内部で使用されます。
  4068. #==============================================================================
  4069.  
  4070. class Interpreter
  4071.   #--------------------------------------------------------------------------
  4072.   # ● アクターの入れ替え
  4073.   #--------------------------------------------------------------------------
  4074.   def command_129
  4075.     # アクターを取得
  4076.     actor = $game_actors[@parameters[0]]
  4077.     # アクターが有効の場合
  4078.     if actor != nil
  4079.       # 操作で分岐
  4080.       if @parameters[1] == 0
  4081.         if @parameters[2] == 1
  4082.           $game_actors[@parameters[0]].setup(@parameters[0])
  4083.         end
  4084.         $game_party.add_actor(@parameters[0])
  4085.         if $game_temp.in_battle
  4086.           $game_actors[@parameters[0]].at = 0
  4087.           $game_actors[@parameters[0]].atp = 0
  4088.           $scene.spell_reset($game_actors[@parameters[0]])
  4089.           $game_actors[@parameters[0]].damage_pop = {}
  4090.           $game_actors[@parameters[0]].damage = {}
  4091.           $game_actors[@parameters[0]].damage_sp = {}
  4092.           $game_actors[@parameters[0]].critical = {}
  4093.           $game_actors[@parameters[0]].recover_hp = {}
  4094.           $game_actors[@parameters[0]].recover_sp = {}
  4095.           $game_actors[@parameters[0]].state_p = {}
  4096.           $game_actors[@parameters[0]].state_m = {}
  4097.           $game_actors[@parameters[0]].animation = []
  4098.         end
  4099.       else
  4100.         $game_party.remove_actor(@parameters[0])
  4101.       end
  4102.     end
  4103.     if $game_temp.in_battle
  4104.       $scene.status_window.update
  4105.     end
  4106.     # 継続
  4107.     return true
  4108.   end
  4109.   #--------------------------------------------------------------------------
  4110.   # ● HP の増減
  4111.   #--------------------------------------------------------------------------
  4112.   alias :command_311_rtab :command_311
  4113.   def command_311
  4114.     command_311_rtab
  4115.     if $game_temp.in_battle
  4116.       $scene.status_window.refresh
  4117.     end
  4118.   end
  4119.   #--------------------------------------------------------------------------
  4120.   # ● SP の増減
  4121.   #--------------------------------------------------------------------------
  4122.   alias :command_312_rtab :command_312
  4123.   def command_312
  4124.     command_312_rtab
  4125.     if $game_temp.in_battle
  4126.       $scene.status_window.refresh
  4127.     end
  4128.   end
  4129.   #--------------------------------------------------------------------------
  4130.   # ● ステートの変更
  4131.   #--------------------------------------------------------------------------
  4132.   alias :command_313_rtab :command_313
  4133.   def command_313
  4134.     command_313_rtab
  4135.     if $game_temp.in_battle
  4136.       $scene.status_window.refresh
  4137.     end
  4138.   end
  4139.   #--------------------------------------------------------------------------
  4140.   # ● 全回復
  4141.   #--------------------------------------------------------------------------
  4142.   alias :command_314_rtab :command_314
  4143.   def command_314
  4144.     command_314_rtab
  4145.     if $game_temp.in_battle
  4146.       $scene.status_window.refresh
  4147.     end
  4148.   end
  4149.   #--------------------------------------------------------------------------
  4150.   # ● EXP の増減
  4151.   #--------------------------------------------------------------------------
  4152.   alias :command_315_rtab :command_315
  4153.   def command_315
  4154.     command_315_rtab
  4155.     if $game_temp.in_battle
  4156.       $scene.status_window.refresh
  4157.     end
  4158.   end
  4159.   #--------------------------------------------------------------------------
  4160.   # ● レベルの増減
  4161.   #--------------------------------------------------------------------------
  4162.   alias :command_316_rtab :command_316
  4163.   def command_316
  4164.     command_316_rtab
  4165.     if $game_temp.in_battle
  4166.       $scene.status_window.refresh
  4167.     end
  4168.   end
  4169.   #--------------------------------------------------------------------------
  4170.   # ● パラメータの増減
  4171.   #--------------------------------------------------------------------------
  4172.   alias :command_317_rtab :command_317
  4173.   def command_317
  4174.     command_317_rtab
  4175.     if $game_temp.in_battle
  4176.       $scene.status_window.refresh
  4177.     end
  4178.   end
  4179.   #--------------------------------------------------------------------------
  4180.   # ● 装備の変更
  4181.   #--------------------------------------------------------------------------
  4182.   alias :command_319_rtab :command_319
  4183.   def command_319
  4184.     command_319_rtab
  4185.     if $game_temp.in_battle
  4186.       $scene.status_window.refresh
  4187.     end
  4188.   end
  4189.   #--------------------------------------------------------------------------
  4190.   # ● アクターの名前変更
  4191.   #--------------------------------------------------------------------------
  4192.   alias :command_320_rtab :command_320
  4193.   def command_320
  4194.     command_320_rtab
  4195.     if $game_temp.in_battle
  4196.       $scene.status_window.refresh
  4197.     end
  4198.   end
  4199.   #--------------------------------------------------------------------------
  4200.   # ● アクターのクラス変更
  4201.   #--------------------------------------------------------------------------
  4202.   alias :command_321_rtab :command_321
  4203.   def command_321
  4204.     command_321_rtab
  4205.     if $game_temp.in_battle
  4206.       $scene.status_window.refresh
  4207.     end
  4208.   end
  4209.   #--------------------------------------------------------------------------
  4210.   # ● アニメーションの表示
  4211.   #--------------------------------------------------------------------------
  4212.   def command_337
  4213.     # イテレータで処理
  4214.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4215.       # バトラーが存在する場合
  4216.       if battler.exist?
  4217.         # アニメーション ID を設定
  4218.         battler.animation.push([@parameters[2], true])
  4219.       end
  4220.     end
  4221.     # 継続
  4222.     return true
  4223.   end
  4224.   #--------------------------------------------------------------------------
  4225.   # ● ダメージの処理
  4226.   #--------------------------------------------------------------------------
  4227.   def command_338
  4228.     # 操作する値を取得
  4229.     value = operate_value(0, @parameters[2], @parameters[3])
  4230.     # イテレータで処理
  4231.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4232.       # バトラーが存在する場合
  4233.       if battler.exist?
  4234.         # HP を変更
  4235.         battler.hp -= value
  4236.         # 戦闘中なら
  4237.         if $game_temp.in_battle
  4238.           # ダメージを設定
  4239.           battler.damage["event"] = value
  4240.           battler.damage_pop["event"] = true
  4241.         end
  4242.       end
  4243.     end
  4244.     if $game_temp.in_battle
  4245.       $scene.status_window.refresh
  4246.     end
  4247.     # 継続
  4248.     return true
  4249.   end
  4250.   #--------------------------------------------------------------------------
  4251.   # ● アクションの強制
  4252.   #--------------------------------------------------------------------------
  4253.   def command_339
  4254.     # 戦闘中でなければ無視
  4255.     unless $game_temp.in_battle
  4256.       return true
  4257.     end
  4258.     # ターン数が 0 なら無視
  4259.     if $game_temp.battle_turn == 0
  4260.       return true
  4261.     end
  4262.     # イテレータで処理 (便宜的なもので、複数になることはない)
  4263.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4264.       # バトラーが存在する場合
  4265.       if battler.exist?
  4266.         # アクションを設定
  4267.         battler.current_action.force_kind = @parameters[2]
  4268.         if battler.current_action.force_kind == 0
  4269.           battler.current_action.force_basic = @parameters[3]
  4270.         else
  4271.           battler.current_action.force_skill_id = @parameters[3]
  4272.         end
  4273.         # 行動対象を設定
  4274.         if @parameters[4] == -2
  4275.           if battler.is_a?(Game_Enemy)
  4276.             battler.current_action.decide_last_target_for_enemy
  4277.           else
  4278.             battler.current_action.decide_last_target_for_actor
  4279.           end
  4280.         elsif @parameters[4] == -1
  4281.           if battler.is_a?(Game_Enemy)
  4282.             battler.current_action.decide_random_target_for_enemy
  4283.           else
  4284.             battler.current_action.decide_random_target_for_actor
  4285.           end
  4286.         elsif @parameters[4] >= 0
  4287.           battler.current_action.target_index = @parameters[4]
  4288.         end
  4289.         # アクションが有効かつ [すぐに実行] の場合
  4290.         if battler.current_action.valid? and @parameters[5] == 1
  4291.           # 強制対象のバトラーを設定
  4292.           $game_temp.forcing_battler = battler
  4293.           # インデックスを進める
  4294.           @index += 1
  4295.           # 終了
  4296.           return false
  4297.         elsif battler.current_action.valid? and @parameters[5] == 0
  4298.           battler.current_action.forcing = true
  4299.         end
  4300.       end
  4301.     end
  4302.     # 継続
  4303.     return true
  4304.   end
  4305. end
  4306.  
  4307. #==============================================================================
  4308. # ■ Spriteモジュール
  4309. #------------------------------------------------------------------------------
  4310. #  アニメーションの管理を行うモジュールです。
  4311. #==============================================================================
  4312.  
  4313. module RPG
  4314.   class Sprite < ::Sprite
  4315.     def initialize(viewport = nil)
  4316.       super(viewport)
  4317.       @_whiten_duration = 0
  4318.       @_appear_duration = 0
  4319.       @_escape_duration = 0
  4320.       @_collapse_duration = 0
  4321.       @_damage = []
  4322.       @_animation = []
  4323.       @_animation_duration = 0
  4324.       @_blink = false
  4325.     end
  4326.     def damage(value, critical, type = 0)
  4327.       if value.is_a?(Numeric)
  4328.         damage_string = value.abs.to_s
  4329.       else
  4330.         damage_string = value.to_s
  4331.       end
  4332.       bitmap = Bitmap.new(160, 48)
  4333.       bitmap.font.name = "Arial Black"
  4334.       bitmap.font.size = 32
  4335.       bitmap.font.color.set(0, 0, 0)
  4336.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  4337.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  4338.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  4339.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  4340.       if value.is_a?(Numeric) and value < 0
  4341.         if type == 0
  4342.           bitmap.font.color.set(176, 255, 144)
  4343.         else
  4344.           bitmap.font.color.set(176, 144, 255)
  4345.         end
  4346.       else
  4347.         if type == 0
  4348.           bitmap.font.color.set(255, 255, 255)
  4349.         else
  4350.           bitmap.font.color.set(255, 176, 144)
  4351.         end
  4352.       end
  4353.       if type == 2
  4354.         bitmap.font.color.set(255, 224, 128)
  4355.       end
  4356.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4357.       if critical
  4358.         string = "CRITICAL"
  4359.         bitmap.font.size = 20
  4360.         bitmap.font.color.set(0, 0, 0)
  4361.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4362.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4363.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4364.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4365.         bitmap.font.color.set(255, 255, 255)
  4366.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4367.       end
  4368.       num = @_damage.size
  4369.       if type != 2
  4370.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4371.       else
  4372.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4373.       end
  4374.       @_damage[num][0].bitmap = bitmap
  4375.       @_damage[num][0].ox = 80 + self.viewport.ox
  4376.       @_damage[num][0].oy = 20 + self.viewport.oy
  4377.       if self.battler.is_a?(Game_Actor)
  4378.         @_damage[num][0].x = self.x
  4379.         @_damage[num][0].y = self.y - self.oy / 2
  4380.       else
  4381.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4382.                             self.ox + self.src_rect.width / 2
  4383.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4384.                             self.viewport.rect.y
  4385.         @_damage[num][0].zoom_x = self.zoom_x
  4386.         @_damage[num][0].zoom_y = self.zoom_y
  4387.         @_damage[num][0].z = 3000
  4388.       end
  4389.     end
  4390.     def animation(animation, hit)
  4391.       return if animation == nil
  4392.       num = @_animation.size
  4393.       @_animation.push([animation, hit, animation.frame_max, []])
  4394.       bitmap = RPG::Cache.animation(animation.animation_name,
  4395.                                     animation.animation_hue)
  4396.       if @@_reference_count.include?(bitmap)
  4397.         @@_reference_count[bitmap] += 1
  4398.       else
  4399.         @@_reference_count[bitmap] = 1
  4400.       end
  4401.       if @_animation[num][0].position != 3 or
  4402.           not @@_animations.include?(animation)
  4403.         for i in 0..15
  4404.           sprite = ::Sprite.new
  4405.           sprite.bitmap = bitmap
  4406.           sprite.visible = false
  4407.           @_animation[num][3].push(sprite)
  4408.         end
  4409.         unless @@_animations.include?(animation)
  4410.           @@_animations.push(animation)
  4411.         end
  4412.       end
  4413.       update_animation(@_animation[num])
  4414.     end
  4415.     def loop_animation(animation)
  4416.       return if animation == @_loop_animation
  4417.       dispose_loop_animation
  4418.       @_loop_animation = animation
  4419.       return if @_loop_animation == nil
  4420.       @_loop_animation_index = 0
  4421.       animation_name = @_loop_animation.animation_name
  4422.       animation_hue = @_loop_animation.animation_hue
  4423.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4424.       if @@_reference_count.include?(bitmap)
  4425.         @@_reference_count[bitmap] += 1
  4426.       else
  4427.         @@_reference_count[bitmap] = 1
  4428.       end
  4429.       @_loop_animation_sprites = []
  4430.       for i in 0..15
  4431.         sprite = ::Sprite.new
  4432.         sprite.bitmap = bitmap
  4433.         sprite.visible = false
  4434.         @_loop_animation_sprites.push(sprite)
  4435.       end
  4436.       # update_loop_animation
  4437.     end
  4438.     def dispose_damage
  4439.       for damage in @_damage.reverse
  4440.         damage[0].bitmap.dispose
  4441.         damage[0].dispose
  4442.         @_damage.delete(damage)
  4443.       end
  4444.     end
  4445.     def dispose_animation
  4446.       for anime in @_animation.reverse
  4447.         sprite = anime[3][0]
  4448.         if sprite != nil
  4449.           @@_reference_count[sprite.bitmap] -= 1
  4450.           if @@_reference_count[sprite.bitmap] == 0
  4451.             sprite.bitmap.dispose
  4452.           end
  4453.         end
  4454.         for sprite in anime[3]
  4455.           sprite.dispose
  4456.         end
  4457.         @_animation.delete(anime)
  4458.       end
  4459.     end
  4460.     def effect?
  4461.       @_whiten_duration > 0 or
  4462.       @_appear_duration > 0 or
  4463.       @_escape_duration > 0 or
  4464.       @_collapse_duration > 0 or
  4465.       @_damage.size == 0 or
  4466.       @_animation.size == 0
  4467.     end
  4468.     def update
  4469.       super
  4470.       if @_whiten_duration > 0
  4471.         @_whiten_duration -= 1
  4472.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4473.       end
  4474.       if @_appear_duration > 0
  4475.         @_appear_duration -= 1
  4476.         self.opacity = (16 - @_appear_duration) * 16
  4477.       end
  4478.       if @_escape_duration > 0
  4479.         @_escape_duration -= 1
  4480.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4481.       end
  4482.       if @_collapse_duration > 0
  4483.         @_collapse_duration -= 1
  4484.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4485.       end
  4486.       for damage in @_damage
  4487.         if damage[1] > 0
  4488.           damage[1] -= 1
  4489.           damage[4] -= 3
  4490.           damage[2] -= damage[4]
  4491.           if self.battler.is_a?(Game_Actor)
  4492.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4493.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4494.           else
  4495.             damage[0].x = self.x + self.viewport.rect.x -
  4496.                           self.ox + self.src_rect.width / 2 +
  4497.                           (40 - damage[1]) * damage[3] / 10
  4498.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4499.                           self.viewport.rect.y + damage[2] / 10
  4500.             damage[0].zoom_x = self.zoom_x
  4501.             damage[0].zoom_y = self.zoom_y
  4502.           end
  4503.           damage[0].z = 2960 + damage[1]
  4504.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4505.           if damage[1] == 0
  4506.             damage[0].bitmap.dispose
  4507.             damage[0].dispose
  4508.             @_damage.delete(damage)
  4509.           end
  4510.         end
  4511.       end
  4512.       for anime in @_animation
  4513.         if (Graphics.frame_count % 2 == 0)
  4514.           anime[2] -= 1
  4515.           update_animation(anime)
  4516.         end
  4517.       end
  4518.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4519.         update_loop_animation
  4520.         @_loop_animation_index += 1
  4521.         @_loop_animation_index %= @_loop_animation.frame_max
  4522.       end
  4523.       if @_blink
  4524.         @_blink_count = (@_blink_count + 1) % 32
  4525.         if @_blink_count < 16
  4526.           alpha = (16 - @_blink_count) * 6
  4527.         else
  4528.           alpha = (@_blink_count - 16) * 6
  4529.         end
  4530.         self.color.set(255, 255, 255, alpha)
  4531.       end
  4532.       @@_animations.clear
  4533.     end
  4534.     def update_animation(anime)
  4535.       if anime[2] > 0
  4536.         frame_index = anime[0].frame_max - anime[2]
  4537.         cell_data = anime[0].frames[frame_index].cell_data
  4538.         position = anime[0].position
  4539.         animation_set_sprites(anime[3], cell_data, position)
  4540.         for timing in anime[0].timings
  4541.           if timing.frame == frame_index
  4542.             animation_process_timing(timing, anime[1])
  4543.           end
  4544.         end
  4545.       else
  4546.         @@_reference_count[anime[3][0].bitmap] -= 1
  4547.         if @@_reference_count[anime[3][0].bitmap] == 0
  4548.             anime[3][0].bitmap.dispose
  4549.         end
  4550.         for sprite in anime[3]
  4551.           sprite.dispose
  4552.         end
  4553.         @_animation.delete(anime)
  4554.       end
  4555.     end
  4556.     def animation_set_sprites(sprites, cell_data, position)
  4557.       for i in 0..15
  4558.         sprite = sprites[i]
  4559.         pattern = cell_data[i, 0]
  4560.         if sprite == nil or pattern == nil or pattern == -1
  4561.           sprite.visible = false if sprite != nil
  4562.           next
  4563.         end
  4564.         sprite.visible = true
  4565.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4566.         if position == 3
  4567.           if self.viewport != nil
  4568.             sprite.x = self.viewport.rect.width / 2
  4569.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4570.               sprite.y = self.viewport.rect.height - 320
  4571.             else
  4572.               sprite.y = self.viewport.rect.height - 160
  4573.             end
  4574.           else
  4575.             sprite.x = 320
  4576.             sprite.y = 240
  4577.           end
  4578.         else
  4579.           sprite.x = self.x + self.viewport.rect.x -
  4580.                       self.ox + self.src_rect.width / 2
  4581.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4582.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4583.                         self.viewport.rect.y
  4584.             if position == 0
  4585.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4586.             elsif position == 2
  4587.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4588.             end
  4589.           else
  4590.             sprite.y = self.y + self.viewport.rect.y -
  4591.                         self.oy + self.src_rect.height / 2
  4592.             sprite.y -= self.src_rect.height / 4 if position == 0
  4593.             sprite.y += self.src_rect.height / 4 if position == 2
  4594.           end
  4595.         end
  4596.         sprite.x += cell_data[i, 1]
  4597.         sprite.y += cell_data[i, 2]
  4598.         sprite.z = 2000
  4599.         sprite.ox = 96
  4600.         sprite.oy = 96
  4601.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4602.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4603.         if position != 3
  4604.           sprite.zoom_x *= self.zoom_x
  4605.           sprite.zoom_y *= self.zoom_y
  4606.         end
  4607.         sprite.angle = cell_data[i, 4]
  4608.         sprite.mirror = (cell_data[i, 5] == 1)
  4609.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4610.         sprite.blend_type = cell_data[i, 7]
  4611.       end
  4612.     end
  4613.     def x=(x)
  4614.       sx = x - self.x
  4615.       if sx != 0
  4616.         for anime in @_animation
  4617.           if anime[3] != nil
  4618.             for i in 0..15
  4619.               anime[3][i].x += sx
  4620.             end
  4621.           end
  4622.         end
  4623.         if @_loop_animation_sprites != nil
  4624.           for i in 0..15
  4625.             @_loop_animation_sprites[i].x += sx
  4626.           end
  4627.         end
  4628.       end
  4629.       super
  4630.     end
  4631.     def y=(y)
  4632.       sy = y - self.y
  4633.       if sy != 0
  4634.         for anime in @_animation
  4635.           if anime[3] != nil
  4636.             for i in 0..15
  4637.               anime[3][i].y += sy
  4638.             end
  4639.           end
  4640.         end
  4641.         if @_loop_animation_sprites != nil
  4642.           for i in 0..15
  4643.             @_loop_animation_sprites[i].y += sy
  4644.           end
  4645.         end
  4646.       end
  4647.       super
  4648.     end
  4649.   end
  4650. end
  4651.  
  4652. #------------------------------------------------------------------------------
  4653. #  Bitmapクラスに新たな機能を追加します。
  4654. #==============================================================================
  4655.  
  4656. class Bitmap
  4657.   #--------------------------------------------------------------------------
  4658.   # ● 矩形をグラデーション表示
  4659.   #     color1 : スタートカラー
  4660.   #     color2 : エンドカラー
  4661.   #     align  :  0:横にグラデーション
  4662.   #               1:縦にグラデーション
  4663.   #               2:斜めにグラデーション(激重につき注意)
  4664.   #--------------------------------------------------------------------------
  4665.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4666.     if align == 0
  4667.       for i in x...x + width
  4668.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4669.         green = color1.green +
  4670.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4671.         blue  = color1.blue +
  4672.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4673.         alpha = color1.alpha +
  4674.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4675.         color = Color.new(red, green, blue, alpha)
  4676.         fill_rect(i, y, 1, height, color)
  4677.       end
  4678.     elsif align == 1
  4679.       for i in y...y + height
  4680.         red   = color1.red +
  4681.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4682.         green = color1.green +
  4683.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4684.         blue  = color1.blue +
  4685.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4686.         alpha = color1.alpha +
  4687.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4688.         color = Color.new(red, green, blue, alpha)
  4689.         fill_rect(x, i, width, 1, color)
  4690.       end
  4691.     elsif align == 2
  4692.       for i in x...x + width
  4693.         for j in y...y + height
  4694.           red   = color1.red + (color2.red - color1.red) *
  4695.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4696.           green = color1.green + (color2.green - color1.green) *
  4697.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4698.           blue  = color1.blue + (color2.blue - color1.blue) *
  4699.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4700.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4701.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4702.           color = Color.new(red, green, blue, alpha)
  4703.           set_pixel(i, j, color)
  4704.         end
  4705.       end
  4706.     elsif align == 3
  4707.       for i in x...x + width
  4708.         for j in y...y + height
  4709.           red   = color1.red + (color2.red - color1.red) *
  4710.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4711.           green = color1.green + (color2.green - color1.green) *
  4712.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4713.           blue  = color1.blue + (color2.blue - color1.blue) *
  4714.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4715.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4716.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4717.           color = Color.new(red, green, blue, alpha)
  4718.           set_pixel(i, j, color)
  4719.         end
  4720.       end
  4721.     end
  4722.     end
  4723.       end



RTAB连击数-显示部分
RUBY 代码复制
  1. #==============================================================================
  2. #RTAB观光游第六站,连击效果+连击数显示 (显示部分)
  3. #==============================================================================
  4. # ▼▲▼ XRXS_BP19. コンボ表示+ヒットボーナス ver.3β ▼▲▼ built 201409
  5. # by 桜雅 在土
  6.  
  7. #==============================================================================
  8. # □ カスタマイズポイント
  9. #==============================================================================
  10. class XRXS_BP19
  11.   #
  12.   # コンボ持続時間[単位:F](40F が 一秒)
  13.   #
  14.   COMBOHIT_DURATION = 90
  15.   #
  16.   # スキン ファイル名
  17.   #
  18.   SKIN_NUMBER = "SixRice_Number.png"
  19.   SKIN_HIT    = "SixRice_HITS.png"
  20. end
  21. class Game_Battler
  22.   #
  23.   # コンボヒットによるダメージ補正力/ヒット数[単位:%]
  24.   #
  25.   DAMAGE_INCREASE_PER_HIT = 1
  26. end
  27. #==============================================================================
  28. # --- XRXS.ナンバースプライト スキン対応!  ---
  29. #==============================================================================
  30. class NumberSprite
  31.   #--------------------------------------------------------------------------
  32.   # ○ オブジェクト初期化
  33.   #--------------------------------------------------------------------------
  34.   def initialize(skin)
  35.     @skin = skin
  36.     @sprites = []
  37.     @width  = skin.width/10
  38.     @height = skin.height
  39.     set_digit(4) # 基本設定値
  40.     set(0)
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ○ 桁の設定
  44.   #--------------------------------------------------------------------------
  45.   def set_digit(digit)
  46.     @sprites.each{|sprite| sprite.dispose}
  47.     @sprites.clear
  48.     digit.times do
  49.       sprite = Sprite.new
  50.       sprite.bitmap = @skin
  51.       sprite.z = 999
  52.       sprite.src_rect.set(0, 0, @width, @height)
  53.       @sprites.push(sprite)
  54.     end
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ○ 値の設定
  58.   #--------------------------------------------------------------------------
  59.   def set(number)
  60.     # 例外補正 0.17b更新
  61.     digit = (number ==0) ? 0 : Math.log10(number)
  62.     if digit > @sprites.size
  63.       set_digit(digit)
  64.     end
  65.     # 各桁の適用
  66.     for sprite in @sprites
  67.       sprite.src_rect.x = number%10 * @width
  68.       number /= 10
  69.     end
  70.     # ゼロ表示 上から判定し、一度でも 0 でなければそこから表示
  71.     zero_display = false
  72.     for sprite in @sprites.reverse
  73.       zero_display |= (sprite.src_rect.x != 0)
  74.       sprite.visible = zero_display
  75.     end
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ○ 座標などの設定の経由
  79.   #--------------------------------------------------------------------------
  80.   def x=(n)
  81.     @sprites.each{|sprite|
  82.       sprite.x = n
  83.       n -= @width
  84.     }
  85.   end
  86.   def y=(n)
  87.     @sprites.each{|sprite| sprite.y = n }
  88.   end
  89.   def opacity=(n)
  90.     @sprites.each{|sprite| sprite.opacity = n }
  91.   end
  92.   def dispose
  93.     @sprites.each{|sprite| sprite.dispose }
  94.   end
  95. end
  96.  
  97. #==============================================================================
  98. # □ Window_ComboHit
  99. #------------------------------------------------------------------------------
  100. #     戦闘中にコンボ数を表示する透明なウィンドウです。
  101. #==============================================================================
  102. class Window_ComboHit < Window_Base
  103.   #--------------------------------------------------------------------------
  104.   # ○ オブジェクト初期化
  105.   #--------------------------------------------------------------------------
  106.   def initialize
  107.     @number = NumberSprite.new(RPG::Cache.windowskin(XRXS_BP19::SKIN_NUMBER))
  108.      super(200, 80, 200, 80)
  109.     self.opacity = 0
  110.     self.z = 999
  111.     self.visible = false
  112.     self.contents = RPG::Cache.windowskin(XRXS_BP19::SKIN_HIT).dup
  113.     @active = false
  114.     @show_duration = 0
  115.     @sliding_duration = 0
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ○ クリア ほか
  119.   #--------------------------------------------------------------------------
  120.   def clear
  121.     self.visible = false
  122.   end
  123.   def x=(n)
  124.     super
  125.     @number.x = n if @number != nil
  126.   end
  127.   def y=(n)
  128.     super
  129.     @number.y = n if @number != nil
  130.   end
  131.   def contents_opacity=(n)
  132.     super
  133.     @number.opacity = n if @number != nil
  134.   end
  135.   def dispose
  136.     @number.dispose
  137.     super
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ○ リフレッシュ
  141.   #--------------------------------------------------------------------------
  142.   def refresh(hit_combo, duration)
  143.     # 可視化
  144.     self.contents_opacity = 255
  145.     self.visible = true
  146.     # 設定
  147.     @show_duration    = duration
  148.     @sliding_duration = 0
  149.     # 描写
  150.     @number.set(hit_combo)
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ○ フレーム更新
  154.   #--------------------------------------------------------------------------
  155.   def update
  156.     if @sliding_duration > 0
  157.       @sliding_duration -= 1
  158.       self.contents_opacity -= 32
  159.       self.x += 1
  160.       if @sliding_duration == 0
  161.         self.visible = false
  162.       end
  163.     elsif @show_duration > 0
  164.       @show_duration -= 1
  165.       if @show_duration == 0
  166.         @sliding_duration = 8
  167.       end
  168.     end
  169.   end
  170. end


RTAB连击数-计算部分
RUBY 代码复制
  1. #==============================================================================
  2. #RTAB观光游第六站,连击效果+连击数显示 (计算部分)
  3. #==============================================================================
  4. # 連撃 Ver 1.03
  5. # 配布元・サポートURL
  6. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  7.  
  8. #==============================================================================
  9. # ■ Scene_Battle (分割定義 4)
  10. #------------------------------------------------------------------------------
  11. #  バトル画面の処理を行うクラスです。
  12. #==============================================================================
  13. # アニメに強さ0のフラッシュが存在した場合、
  14. # 赤:倍率 緑:+スキル・アイテムID でダメージ計算を行う。
  15. #
  16. # 连击数,每次伤害比率如何设置,参考动画“千裂斩”
  17.  
  18. class Scene_Battle
  19. attr_reader :skill#到此一游
  20. #--------------------------------------------------------------------------
  21. # ● ATB基礎セットアップ
  22. #--------------------------------------------------------------------------
  23.   alias :atb_setup_straight :atb_setup
  24.   def atb_setup
  25.     atb_setup_straight
  26.     for battler in $game_party.actors + $game_troop.enemies
  27.       battler.total_damage = {}
  28.     end
  29.   end
  30. #--------------------------------------------------------------------------
  31. # ● アクション更新 (メインフェーズ)
  32. #--------------------------------------------------------------------------
  33.   def action_phase(battler)
  34.     while true
  35.       # action が 1 の場合、バトラーが行動中かどうか確認
  36.       if @action == 1 and battler.phase < 3
  37.         for target in battler.target
  38.           speller = synthe?(target)
  39.           if speller == nil
  40.             # ターゲットが通常行動中の場合
  41.             if @action_battlers.include?(target)
  42.               if target.phase > 2
  43.                 return
  44.               end
  45.             end
  46.           else
  47.             # ターゲットが連携スキル発動中の場合
  48.             for spell in speller
  49.               if @action_battlers.include?(spell)
  50.                 if spell.phase > 2
  51.                   return
  52.                 end
  53.               end
  54.             end
  55.           end
  56.         end
  57.       end
  58.       case battler.phase
  59.       when 1
  60.         update_phase4_step1(battler)
  61.       when 2
  62.         update_phase4_step2(battler)
  63.       when 3
  64.         update_phase4_step3(battler)
  65.       when 4
  66.         update_phase4_step4(battler)
  67.       when 5
  68.         update_phase4_step5(battler)
  69.       when 6
  70.         update_phase4_step6(battler)
  71.       end
  72.       # ウェイトが入った場合
  73.       if battler.wait > 0
  74.         # ウェイトカウントを減らして終了
  75.         battler.wait -= 1
  76.         break
  77.       end
  78.       # 行動終了した場合ループを抜ける
  79.       unless @action_battlers.include?(battler)
  80.         break
  81.       end
  82.     end
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  86.   #--------------------------------------------------------------------------
  87.   def update_phase4_step1(battler)
  88.     # すでに戦闘から外されている場合
  89.     if battler.index == nil
  90.       @action_battlers.delete(battler)
  91.       anime_wait_return
  92.       battler.wait = 1
  93.       return
  94.     end
  95.     speller = synthe?(battler)
  96.     if speller == nil
  97.       # ダメージ食らい中の場合
  98.       unless battler.damage.empty? or @action > 2
  99.         battler.wait = 1
  100.         return
  101.       end
  102.       # 行動可能かどうか判定
  103.       unless battler.movable?
  104.         battler.phase = 6
  105.         return
  106.       end
  107.     else
  108.       # ダメージ食らい中の場合
  109.       for spell in speller
  110.         unless spell.damage.empty? or @action > 2
  111.           battler.wait = 1
  112.           return
  113.         end
  114.         # 行動可能かどうか判定
  115.         unless spell.movable?
  116.           battler.phase = 6
  117.           return
  118.         end
  119.       end
  120.     end
  121.     # スキル使用時、詠唱時間設定
  122.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  123.     if battler.current_action.kind == 1 and
  124.       (not battler.current_action.forcing or @force != 2)
  125.       if battler.rtp == 0
  126.         # スキル詠唱中ならば、解除
  127.         skill_reset(battler)
  128.         # スキル詠唱時間設定
  129.         recite_time(battler)
  130.         # 連携技設定
  131.         synthe_spell(battler)
  132.         # スキルを詠唱する場合
  133.         if battler.rtp > 0
  134.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  135.           speller = synthe?(battler)
  136.           if battler.current_action.forcing and @force > 0 and speller != nil
  137.             for spell in speller
  138.               spell.rt = spell.rtp
  139.             end
  140.           else
  141.             battler.blink = true
  142.             if battler.current_action.forcing
  143.               $game_temp.forcing_battler = nil
  144.               battler.current_action.forcing = false
  145.             end
  146.             @action_battlers.delete(battler)
  147.             return
  148.           end
  149.         end
  150.       end
  151.     end
  152.     # アクターの明滅エフェクト OFF
  153.     if battler != nil
  154.       battler.blink = false
  155.     end
  156.     speller = synthe?(battler)
  157.     if speller == nil
  158.       @spell_p.delete(battler)
  159.       @spell_e.delete(battler)
  160.     else
  161.       for spell in speller
  162.         spell.blink = false
  163.         @spell_p.delete(spell)
  164.         @spell_e.delete(spell)
  165.       end
  166.     end
  167.     # ステップ 2 に移行
  168.     battler.phase = 2
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  172.   #--------------------------------------------------------------------------
  173.   def update_phase4_step2(battler)
  174.     # 強制アクションでなければ
  175.     unless battler.current_action.forcing
  176.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  177.       if battler.restriction == 2 or battler.restriction == 3
  178.         # アクションに攻撃を設定
  179.         battler.current_action.kind = 0
  180.         battler.current_action.basic = 0
  181.       end
  182.     end
  183.     # アクションの種別より攻撃アニメーションを取得する
  184.     case battler.current_action.kind
  185.     when 0 # 基本
  186.       if battler.is_a?(Game_Actor)
  187.         base_id = battler.weapon_id
  188.       end
  189.       anime_id = battler.animation2_id
  190.       # 防御など特殊行動の場合は次のステップへ
  191.       unless make_basic_action_preparation(battler)
  192.         return
  193.       end
  194.       # 戦闘が終了した場合は行動をキャンセル
  195.       if fin?
  196.         battler.phase = 6
  197.         return
  198.       end
  199.     when 1 # スキル
  200.       base_id = battler.current_action.skill_id
  201.       anime_id = $data_skills[battler.current_action.skill_id].animation2_id
  202.       # スキルが使用できない場合は行動をキャンセル
  203.       unless make_skill_action_preparation(battler)
  204.         return
  205.       end
  206.       # 戦闘が終了した場合は行動をキャンセル
  207.       if fin? and $data_skills[anime_id].scope == 1..2
  208.         battler.phase = 6
  209.         return
  210.       end
  211.     when 2 # アイテム
  212.       base_id = battler.current_action.item_id
  213.       anime_id = $data_items[battler.current_action.item_id].animation2_id
  214.       # アイテムが使用できない場合は行動をキャンセル
  215.       unless make_item_action_preparation(battler)
  216.         return
  217.       end
  218.       # 戦闘が終了した場合は行動をキャンセル
  219.       if fin? and $data_items[anime_id].scope == 1..2
  220.         battler.phase = 6
  221.         return
  222.       end
  223.     end
  224.     # アニメーションを検索し、連撃性を変数serialに代入する
  225.     serial = []
  226.     frame = 0
  227.     if $data_animations[anime_id] != nil
  228.       for animation in $data_animations[anime_id].timings
  229.         color = animation.flash_color
  230.         # アニメーション・フラッシュの強さが0の場合
  231.         if color.alpha == 0
  232.           serial.push([color.red.to_i, color.green, animation.frame - frame])
  233.           frame = animation.frame
  234.         end
  235.       end
  236.       # 連撃性がない場合単発攻撃
  237.       if serial.empty?
  238.         serial = [[20, 100, $data_animations[anime_id].frame_max - 5]]
  239.       end
  240.     else
  241.       # アニメーションが存在しない場合
  242.       serial = [[20, 100, 0]]
  243.     end
  244.     # ハッシュ total_damage の作成
  245.     total_damage = {}
  246.     for target in battler.target
  247.       total_damage[target] = []
  248.     end
  249.     # 連撃回数分ダメージ計算を行う
  250.     for attack in serial
  251.       # アクションの種別で分岐
  252.       case battler.current_action.kind
  253.       when 0  # 基本
  254.         if battler.is_a?(Game_Actor)
  255.           # バトラーがアクターの場合、攻撃時に武器を変更する
  256.           battler.change_weapon(base_id + attack[1] - 100)
  257.         end
  258.         make_basic_action_result(battler)
  259.       when 1  # スキル
  260.         # 連携スキルのことを考え、スキルIDの変更は内部処理で行う
  261.         make_skill_action_result(battler, attack[1] - 100)
  262.       when 2  # アイテム
  263.         # アイテムIDを設定分変化させる
  264.         battler.current_action.item_id = base_id + attack[1] - 100
  265.         make_item_action_result(battler)
  266.       end
  267.       # total_damage へダメージを代入
  268.       for target in battler.target
  269.         # ダメージがある場合、ダメージをX/20倍する。
  270.         if target.damage[battler].is_a?(Numeric)
  271.           damage = target.damage[battler] * attack[0] / 20
  272.         else
  273.           damage = target.damage[battler]
  274.         end
  275.         # 回復HP量がある場合、回復HP量をX/20倍する。
  276.         if target.recover_hp[battler].is_a?(Numeric)
  277.           recover_hp = target.recover_hp[battler] * attack[0] / 20
  278.         end
  279.         # 回復SP量がある場合、回復SP量をX/20倍する。
  280.         if target.recover_sp[battler].is_a?(Numeric)
  281.           recover_sp = target.recover_sp[battler] * attack[0] / 20
  282.         end
  283.         critical = target.critical[battler]
  284.         # total_damage = [ダメージ, クリティカルフラグ, 回復HP量, 回復SP量,
  285.         #                 ステート変化, ステート回復, 待ちフレーム時間]
  286.         total_damage[target].push([damage, critical, recover_hp, recover_sp,
  287.           target.state_p[battler], target.state_m[battler], attack[2]])
  288.       end
  289.     end
  290.     # トータルダメージを、バトラーのインスタンスに代入
  291.     for target in battler.target
  292.       target.total_damage[battler] = total_damage[target]
  293.     end
  294.     # 武器・スキル・アイテムIDを通常に戻す
  295.     case battler.current_action.kind
  296.     when 0  # 基本
  297.       if battler.is_a?(Game_Actor)
  298.         battler.change_weapon(base_id)
  299.       end
  300.     when 1  # スキル
  301.       battler.current_action.skill_id = base_id
  302.     when 2  # アイテム
  303.       battler.current_action.item_id = base_id
  304.     end
  305.     if battler.phase == 2
  306.       # ステップ 3 に移行
  307.       battler.phase = 3
  308.     end
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 基本アクション 準備
  312.   #--------------------------------------------------------------------------
  313.   def make_basic_action_preparation(battler)
  314.     # 攻撃の場合
  315.     if battler.current_action.basic == 0
  316.       # アニメーション ID を設定
  317.       battler.anime1 = battler.animation1_id
  318.       battler.anime2 = battler.animation2_id
  319.       # 行動側バトラーがエネミーの場合
  320.       if battler.is_a?(Game_Enemy)
  321.         if battler.restriction == 3
  322.           target = $game_troop.random_target_enemy
  323.         elsif battler.restriction == 2
  324.           target = $game_party.random_target_actor
  325.         else
  326.           index = battler.current_action.target_index
  327.           target = $game_party.smooth_target_actor(index)
  328.         end
  329.       end
  330.       # 行動側バトラーがアクターの場合
  331.       if battler.is_a?(Game_Actor)
  332.         if battler.restriction == 3
  333.           target = $game_party.random_target_actor
  334.         elsif battler.restriction == 2
  335.           target = $game_troop.random_target_enemy
  336.         else
  337.           index = battler.current_action.target_index
  338.           target = $game_troop.smooth_target_enemy(index)
  339.         end
  340.       end
  341.       # 対象側バトラーの配列を設定
  342.       battler.target = [target]
  343.       return true
  344.     end
  345.     # 防御の場合
  346.     if battler.current_action.basic == 1
  347.       # ステップ 3 に移行
  348.       battler.phase = 3
  349.       return false
  350.     end
  351. #===============0.15b(RTAB官方更新)===========================================   
  352.     # 逃げるの場合
  353.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  354.       # ステップ 3 に移行
  355.       battler.phase = 3
  356.       return false
  357.     end
  358. #=============================================================================
  359.     # 何もしないの場合
  360.     if battler.current_action.basic == 3
  361.       # ステップ 6 に移行
  362.       battler.phase = 6
  363.       return false
  364.     end
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● スキルアクション 準備
  368.   #--------------------------------------------------------------------------
  369.   def make_skill_action_preparation(battler)
  370.     # スキルを取得
  371.     @skill = $data_skills[battler.current_action.skill_id]
  372.     # 連携スキルであるかどうか確認
  373.     speller = synthe?(battler)
  374.     # 強制アクションでなければ
  375.     unless battler.current_action.forcing
  376.       # SP 切れなどで使用できなくなった場合
  377.       if speller == nil
  378.         unless battler.skill_can_use?(@skill.id)
  379.           # ステップ 6 に移行
  380.           battler.phase = 6
  381.          return false
  382.         end
  383.       end
  384.     end
  385.     # SP 消費
  386.     temp = false
  387.     if speller != nil
  388.       for spell in speller
  389.         if spell.current_action.spell_id == 0
  390.           spell.sp -= @skill.sp_cost
  391.         else
  392.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  393.         end
  394.         # ステータスウィンドウをリフレッシュ
  395.         status_refresh(spell)
  396.       end
  397.     else
  398.       battler.sp -= @skill.sp_cost
  399.       # ステータスウィンドウをリフレッシュ
  400.       status_refresh(battler)
  401.     end
  402.     # アニメーション ID を設定
  403.     battler.anime1 = @skill.animation1_id
  404.     battler.anime2 = @skill.animation2_id
  405.     # コモンイベント ID を設定
  406.     battler.event = @skill.common_event_id
  407.     # 対象側バトラーを設定
  408.     set_target_battlers(@skill.scope, battler)
  409.     return true
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● アイテムアクション 準備
  413.   #--------------------------------------------------------------------------
  414.   def make_item_action_preparation(battler)
  415.     # アイテムを取得
  416.     @item = $data_items[battler.current_action.item_id]
  417.     # アイテム切れなどで使用できなくなった場合
  418.     unless $game_party.item_can_use?(@item.id)
  419.       # ステップ 6 に移行
  420.       battler.phase = 6
  421.       return false
  422.     end
  423.     # 消耗品の場合
  424.     if @item.consumable
  425.       # 使用したアイテムを 1 減らす
  426.       $game_party.lose_item(@item.id, 1)
  427.     end
  428.     # アニメーション ID を設定
  429.     battler.anime1 = @item.animation1_id
  430.     battler.anime2 = @item.animation2_id
  431.     # コモンイベント ID を設定
  432.     battler.event = @item.common_event_id
  433.     # 対象を決定
  434.     index = battler.current_action.target_index
  435.     target = $game_party.smooth_target_actor(index)
  436.     # 対象側バトラーを設定
  437.     set_target_battlers(@item.scope, battler)
  438.     return true
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 基本アクション 結果作成
  442.   #--------------------------------------------------------------------------
  443.   def make_basic_action_result(battler)
  444.     # 通常攻撃の効果を適用
  445.     for target in battler.target
  446.       target.attack_effect(battler)
  447.     end
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ● スキルアクション 結果作成
  451.   #--------------------------------------------------------------------------
  452.   def make_skill_action_result(battler, plus_id)
  453.     # スキルを取得
  454.     @skill = $data_skills[battler.current_action.skill_id + plus_id]
  455.     # 連携スキルであるかどうか確認
  456.     speller = synthe?(battler)
  457.     # スキルの効果を適用
  458.     for target in battler.target
  459.       if speller != nil
  460.         damage = 0
  461.         effective = false
  462.         state_p = []
  463.         state_m = []
  464.         d_result = false
  465.         for spell in speller
  466.           if spell.current_action.spell_id != 0
  467.             @skill = $data_skills[spell.current_action.spell_id + plus_id]
  468.           end
  469.           effective |= target.skill_effect(spell, @skill)
  470.           if target.damage[spell].class != String
  471.             d_result = true
  472.             damage += target.damage[spell]
  473.           elsif effective
  474.             effect = target.damage[spell]
  475.           end
  476.           state_p += target.state_p[spell]
  477.           state_m += target.state_m[spell]
  478.           target.damage.delete(spell)
  479.           target.state_p.delete(spell)
  480.           target.state_m.delete(spell)
  481.         end
  482.         if d_result
  483.           target.damage[battler] = damage
  484.         elsif effective
  485.           target.damage[battler] = effect
  486.         end
  487.         target.state_p[battler] = state_p
  488.         target.state_m[battler] = state_m
  489.       else
  490.         target.skill_effect(battler, @skill)
  491.       end
  492.     end
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● アイテムアクション 結果作成
  496.   #--------------------------------------------------------------------------
  497.   def make_item_action_result(battler)
  498.     # アイテムを取得
  499.     @item = $data_items[battler.current_action.item_id]
  500.     # アイテムの効果を適用
  501.     for target in battler.target
  502.       target.item_effect(@item, battler)
  503.     end
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  507.   #--------------------------------------------------------------------------
  508.   def update_phase4_step4(battler)
  509.     # カメラ設定
  510.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  511.       camera_set(battler)
  512.     end
  513.     # 対象側アニメーション
  514.     for target in battler.target
  515.       target.animation.push([battler.anime2,
  516.                                           (target.damage[battler] != "Miss")])
  517.       unless battler.anime2 == 0
  518.         battler.wait = 2 * target.total_damage[battler][0][6] - 1 +
  519.           Graphics.frame_count % 2
  520.       end
  521.     end
  522.     # ステップ 5 に移行
  523.     battler.phase = 5
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  527.   #--------------------------------------------------------------------------
  528.   def update_phase4_step5(battler)
  529.     next_step = true
  530.     # ダメージ表示
  531.     for target in battler.target
  532.       # total_damage より全ダメージを算出
  533.       total_damage = target.total_damage[battler].shift
  534.       target.damage[battler] = total_damage[0]
  535.       target.critical[battler] = total_damage[1]
  536.       target.recover_hp[battler] = total_damage[2]
  537.       target.recover_sp[battler] = total_damage[3]
  538.       target.state_p[battler] = total_damage[4]
  539.       target.state_m[battler] = total_damage[5]
  540.       # ダメージ表示フラグをON
  541.       target.damage_pop[battler] = true
  542.       # 恭喜你发现了连击计算的关键一行!
  543.       target.combohit_count if target.damage[battler].to_i > 0 and target.damage[battler] != "Miss"
  544.       # 実際にダメージを与える
  545. #      target.damage_effect(battler, battler.current_action.kind)
  546.       target.damage_effect(battler, battler.current_action.kind,skill)#到此一游
  547.       # 余計なハッシュを削除
  548.       target.recover_hp.delete(battler)
  549.       target.recover_sp.delete(battler)
  550.       target.state_p.delete(battler)
  551.       target.state_m.delete(battler)
  552.       # ダメージを全て与えきった場合
  553.       if target.total_damage[battler].empty?
  554.         # ターゲットへの全ダメージを削除
  555.         target.total_damage.delete(battler)
  556.         # 指定時間ウェイトする
  557.         battler.wait = @damage_wait
  558.       else
  559.         # 指定時間ウェイトする
  560.         next_step = false
  561.         battler.wait = 2 * target.total_damage[battler][0][6]
  562.       end
  563.       # ステータスウィンドウをリフレッシュ
  564.       status_refresh(target)
  565.     end
  566.     if next_step
  567.       # ステップ 6 に移行
  568.       battler.phase = 6
  569.     end
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  573.   #--------------------------------------------------------------------------
  574.   def update_phase4_step6(battler)
  575.     # カメラを戻す
  576.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  577.       @spriteset.screen_target(0, 0, 1)
  578.     end
  579.     # スキルラーニング
  580.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  581.       for target in battler.target        
  582.         if target.is_a?(Game_Actor)#(0.16)
  583.         skill_learning(target, target.class_id,
  584.                         battler.current_action.skill_id)
  585.         end #(0.16)               
  586.       end
  587.     end
  588.     # アクション強制対象のバトラーをクリア
  589.     if battler.current_action.forcing == true and
  590.         battler.current_action.force_kind == 0 and
  591.         battler.current_action.force_basic == 0 and
  592.         battler.current_action.force_skill_id == 0
  593.       $game_temp.forcing_battler = nil
  594.       battler.current_action.forcing = false
  595.     end
  596.     refresh_phase(battler)
  597.     speller = synthe?(battler)
  598.     if speller != nil
  599.       for spell in speller
  600.         if spell != battler
  601.           refresh_phase(spell)
  602.         end
  603.       end
  604.       synthe_delete(speller)
  605.     end
  606.     # コモンイベント ID が有効の場合
  607.     if battler.event > 0
  608.       # イベントをセットアップ
  609.       common_event = $data_common_events[battler.event]
  610.       $game_system.battle_interpreter.setup(common_event.list, 0)
  611.     end
  612.     act = 0
  613.     for actor in $game_party.actors + $game_troop.enemies
  614.       if actor.movable?
  615.         act += 1
  616.       end
  617.     end
  618.     if @turn_cnt >= act and act > 0
  619.       @turn_cnt %= act
  620.       $game_temp.battle_turn += 1
  621.       # バトルイベントの全ページを検索
  622.       for index in 0...$data_troops[@troop_id].pages.size
  623.         # イベントページを取得
  624.         page = $data_troops[@troop_id].pages[index]
  625.         # このページのスパンが [ターン] の場合
  626.         if page.span == 1
  627.           # 実行済みフラグをクリア
  628.           $game_temp.battle_event_flags[index] = false
  629.         end
  630.       end
  631.     end
  632.     battler.phase = 1
  633.     @action_battlers.delete(battler)
  634.   end
  635. #//////////////////////////////////////////////////////////////////////////////
  636. #连击数计算的基础部分Part1  by 桜雅 在土
  637. #------------------------------------------------------------------------------
  638. # ● メイン処理
  639. #------------------------------------------------------------------------------
  640.   alias xrxs_bp19_main main
  641.   def main
  642.     # コンボヒットウィンドウを作成
  643.     @combohit_window = Window_ComboHit.new
  644.     # 呼び戻す
  645.     xrxs_bp19_main
  646.     # ウィンドウを解放
  647.     @combohit_window.dispose
  648.     # コンボクリア
  649.     $game_party.actors.each {|actor| actor.combohit_clear}
  650.   end
  651. #------------------------------------------------------------------------------
  652. # ● フレーム更新
  653. #------------------------------------------------------------------------------
  654.   alias xrxs_bp19_update update
  655.   def update
  656.     # フレーム更新
  657.     @combohit_window.update
  658.     $game_party.actors.each {|actor| actor.combohit_update}
  659.     $game_troop.enemies.each{|enemy| enemy.combohit_update}
  660.     # 呼び戻す
  661.     xrxs_bp19_update
  662.   end
  663. #------------------------------------------------------------------------------
  664. # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  665. #------------------------------------------------------------------------------
  666.   alias xrxs_bp19_update_phase4_step5 update_phase4_step5
  667.   def update_phase4_step5(battler)
  668.     # 呼び戻す
  669.     xrxs_bp19_update_phase4_step5(battler)
  670.     # コンボ数の最も高いターゲットを探す
  671.     max = 0
  672.     hit_target = nil
  673.     for target in battler.target
  674.       if target.combohit > max
  675.         max = target.combohit
  676.         hit_target = target
  677.       end
  678.     end
  679.     if max >= 2 and !hit_target.nil?
  680.       @combohit_window.x = hit_target.is_a?(Game_Enemy) ? 512 : 512
  681.       @combohit_window.refresh(max, hit_target.combohit_duration)
  682.     end
  683.   end  
  684. end
  685. #//////////////////////////////////////////////////////////////////////////////
  686. #==============================================================================
  687. # ■ Game_Battler (分割定義 1)
  688. #------------------------------------------------------------------------------
  689. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  690. # スのスーパークラスとして使用されます。
  691. #==============================================================================
  692.  
  693. class Game_Battler
  694.   #--------------------------------------------------------------------------
  695.   # ● 公開インスタンス変数追加
  696.   #--------------------------------------------------------------------------
  697.   attr_accessor :total_damage              # 総ダメージ
  698.   #--------------------------------------------------------------------------
  699.   # ● オブジェクト初期化
  700.   #--------------------------------------------------------------------------
  701.   alias :initialize_straight :initialize
  702.   def initialize
  703.     initialize_straight
  704.     @total_damage = {}
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # ● 存在判定
  708.   #--------------------------------------------------------------------------
  709.   def exist?
  710.     return (not @hidden and (@hp > 0 or @immortal or not @total_damage.empty?))
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # ● 残HP予測
  714.   #--------------------------------------------------------------------------
  715.   def rest_hp
  716.     # rest_hp に現HPを代入
  717.     rest_hp = @hp
  718.     # バトラーが受ける全ダメージをrest_hpに反映させる
  719.     for total in @total_damage
  720.       for pre_damage in total[1]
  721.         if pre_damage[0].is_a?(Numeric)
  722.           rest_hp -= pre_damage[0]
  723.         end
  724.         if pre_damage[2].is_a?(Numeric)
  725.           rest_hp += pre_damage[2]
  726.         end
  727.       end
  728.     end
  729.     return rest_hp
  730.   end
  731. end
  732. #//////////////////////////////////////////////////////////////////////////////
  733. #连击数计算的基础部分Part2  by 桜雅 在土
  734. #------------------------------------------------------------------------------
  735. # ● 公開インスタンス変数
  736. #------------------------------------------------------------------------------
  737.   def combohit
  738.     @combohit = 0 if @combohit.nil?
  739.     return @combohit
  740.   end
  741.   def combohit_duration
  742.     @combohit_duration = 0 if @combohit_duration.nil?
  743.     return @combohit_duration
  744.   end
  745. #------------------------------------------------------------------------------
  746. # ○ コンボヒットを更新
  747. #------------------------------------------------------------------------------  
  748.   def combohit_update
  749.     # 例外補正
  750.     @combohit_duration = 0 if @combohit_duration.nil?
  751.     # カウント
  752.     if @combohit_duration > 0
  753.       @combohit_duration -= 1
  754.       # のけぞり時間終了時、コンボ数をリセット
  755.       @combohit = 0 if @combohit_duration == 0
  756.     end
  757.   end
  758. #------------------------------------------------------------------------------
  759. # ○ コンボヒットをカウント
  760. #------------------------------------------------------------------------------
  761.   def combohit_count
  762.     # 例外補正
  763.     @combohit = 0 if @combohit.nil?  
  764.     # カウント
  765.     @combohit += 1
  766.     @combohit_duration = XRXS_BP19::COMBOHIT_DURATION
  767.   end
  768. #------------------------------------------------------------------------------
  769. # ○ コンボヒットをクリア
  770. #------------------------------------------------------------------------------  
  771.   def combohit_clear
  772.     @combohit = nil
  773.     @combohit_duration = nil
  774.   end
  775.  
  776. #//////////////////////////////////////////////////////////////////////////////
  777. #==============================================================================
  778. # ■ Game_Actor
  779. #------------------------------------------------------------------------------
  780. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  781. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  782. #==============================================================================
  783.  
  784. class Game_Actor < Game_Battler
  785.   #--------------------------------------------------------------------------
  786.   # ● 公開インスタンス変数
  787.   #--------------------------------------------------------------------------
  788.   def change_weapon(id)
  789.     @weapon_id = id
  790.   end
  791. end
  792.  
  793. #==============================================================================
  794. # ■ Sprite_Battler
  795. #------------------------------------------------------------------------------
  796. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  797. # スプライトの状態を自動的に変化させます。
  798. #==============================================================================
  799.  
  800. class Sprite_Battler < RPG::Sprite
  801.   #--------------------------------------------------------------------------
  802.   # ● フレーム更新
  803.   #--------------------------------------------------------------------------
  804.   def update
  805.     super
  806.     # バトラーが nil の場合
  807.     if @battler == nil
  808.       self.bitmap = nil
  809.       loop_animation(nil)
  810.       return
  811.     end
  812.     # ファイル名か色相が現在のものと異なる場合
  813.     if @battler.battler_name != @battler_name or
  814.        @battler.battler_hue != @battler_hue
  815.       # ビットマップを取得、設定
  816.       @battler_name = @battler.battler_name
  817.       @battler_hue = @battler.battler_hue
  818.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  819.       @width = bitmap.width
  820.       @height = bitmap.height
  821.       self.ox = @width / 2
  822.       self.oy = @height
  823.       if @battler.is_a?(Game_Enemy)
  824.         @battler.height = @height
  825.       end
  826.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  827.       if @battler.dead? or @battler.hidden
  828.         self.opacity = 0
  829.       end
  830.     end
  831.     # アニメーション ID が現在のものと異なる場合
  832.     if @battler.state_animation_id != @state_animation_id
  833.       @state_animation_id = @battler.state_animation_id
  834.       loop_animation($data_animations[@state_animation_id])
  835.     end
  836.     # 表示されるべきアクターの場合
  837.     if @battler.is_a?(Game_Actor) and @battler_visible
  838.       # メインフェーズでないときは不透明度をやや下げる
  839.       if $game_temp.battle_main_phase
  840.         self.opacity += 3 if self.opacity < 255
  841.       else
  842.         self.opacity -= 3 if self.opacity > 207
  843.       end
  844.     end
  845.     # 明滅
  846.     if @battler.blink
  847.       blink_on
  848.     else
  849.       blink_off
  850.     end
  851.     # 不可視の場合
  852.     unless @battler_visible
  853.       # 出現
  854.       if not @battler.hidden and not @battler.dead? and
  855.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  856.         appear
  857.         @battler_visible = true
  858.       end
  859.     end
  860.     # ダメージ
  861.     for battler in @battler.damage_pop
  862.       if battler[0].class == Array
  863.         if battler[0][1] >= 0
  864.           $scene.skill_se
  865.         else
  866.           $scene.levelup_se
  867.         end
  868.         damage(@battler.damage[battler[0]], false, 2)
  869.       else
  870.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  871.       end
  872.       if @battler.damage_sp.include?(battler[0])
  873.         damage(@battler.damage_sp[battler[0]],
  874.                 @battler.critical[battler[0]], 1)
  875.         @battler.damage_sp.delete(battler[0])
  876.       end
  877.       @battler.damage_pop.delete(battler[0])
  878.       @battler.damage.delete(battler[0])
  879.       @battler.critical.delete(battler[0])
  880.     end
  881.     # 可視の場合
  882.     if @battler_visible
  883.       # 逃走
  884.       if @battler.hidden
  885.         $game_system.se_play($data_system.escape_se)
  886.         escape
  887.         @battler_visible = false
  888.       end
  889.       # 白フラッシュ
  890.       if @battler.white_flash
  891.         whiten
  892.         @battler.white_flash = false
  893.       end
  894.       # アニメーション
  895.       unless @battler.animation.empty?
  896.         for animation in @battler.animation.reverse
  897.           animation($data_animations[animation[0]], animation[1])
  898.           @battler.animation.delete(animation)
  899.         end
  900.       end
  901.       # コラプス
  902.       if @battler.total_damage.empty? and @battler.dead?
  903.         if $scene.dead_ok?(@battler)
  904.           if @battler.is_a?(Game_Enemy)
  905.             $game_system.se_play($data_system.enemy_collapse_se)
  906.           else
  907.             $game_system.se_play($data_system.actor_collapse_se)
  908.           end
  909.           collapse
  910.           @battler_visible = false
  911.         end
  912.       end
  913.     end
  914.     # スプライトの座標を設定
  915.     self.x = @battler.screen_x
  916.     self.y = @battler.screen_y
  917.     self.z = @battler.screen_z
  918.     if @battler.is_a?(Game_Enemy)
  919.       self.zoom_x = @battler.real_zoom * @battler.zoom
  920.       self.zoom_y = @battler.real_zoom * @battler.zoom
  921.     end
  922.   end
  923. end



RTAB特技吟唱 Ver 1.00
RUBY 代码复制
  1. #==============================================================================
  2. # RTAB观光游第四站,特技吟唱(官方特效,0.16b 更新为完全汉化版)
  3. #
  4. # 解说+汉化 by SixRice
  5. #==============================================================================
  6. # スキル詠唱 Ver 1.00
  7. # 配布元・サポートURL
  8. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  9.  
  10. class Scene_Battle
  11. #------------------------------------------------------------------------------
  12. # 特技吟唱
  13. #
  14. # 吟唱所需时间设为100的时候,吟唱所需时间与通常一次行动时间相等。
  15. #------------------------------------------------------------------------------
  16. # rt与rtp的解释
  17. #
  18. # rt (recite_time)       = 吟唱时间值,简称“吟唱值”;
  19. # rtp(recite_time_point) = 吟唱所需时间量,简称“吟唱时间”。
  20. #
  21. # 当发动吟唱特技时,行动槽变为吟唱槽,战斗者开始累积吟唱值(rt),
  22. #
  23. # 当吟唱值(rt) = 吟唱时间(rtp)的时候,完成吟唱,特技生效。
  24. #------------------------------------------------------------------------------
  25. def recite_time(battler)
  26. #------------------------------------------------------------------------------
  27. # 发动合成特技的时候,吟唱速度与通常情况下会发生变化,
  28. #
  29. # 比如一个“吟唱时间”为60的特技:
  30. # 一个人发动,“吟唱时间”即为60;
  31. # 两个人连携发动,“吟唱时间”就会变为30;
  32. # 三个人连携发动,“吟唱时间”就会变为20;
  33. # 四个人连携发动,“吟唱时间”就会变为15;
  34. #------------------------------------------------------------------------------
  35.     case $data_skills[battler.current_action.skill_id].id
  36. #考虑到可能会存在同名特技,将默认的根据name判断改成id判断则不会重复了(0.16b)
  37.     when 1 #1号特技(下同)
  38.       battler.rtp = 30
  39.       when 2
  40.       battler.rtp = 15
  41.       when 3
  42.       battler.rtp = 30
  43.       when 4
  44.       battler.rtp = 15
  45.     when 10
  46.       battler.rtp = 80
  47.     when 19
  48.       battler.rtp = 70
  49.     when 33
  50.       battler.rtp = 30
  51.     when 34
  52.       battler.rtp = 60
  53.       when 58
  54.       battler.rtp = 30
  55.     when 82
  56.       battler.rtp = 60  
  57.     when 83
  58.       battler.rtp = 20
  59.       when 91
  60.       battler.rtp = 30
  61.       when 92
  62.       battler.rtp = 50
  63.       when 93
  64.       battler.rtp = 40
  65.       when 94
  66.       battler.rtp = 120
  67.       when 95
  68.       battler.rtp = 30
  69.       when 96
  70.       battler.rtp = 20
  71.       when 97
  72.       battler.rtp = 60
  73.       when 98
  74.       battler.rtp = 20
  75.       when 101
  76.       battler.rtp = 15
  77.     #以上为举例说明,有需要请在下面自行设定  
  78.  
  79.     else
  80.     battler.rtp = 0 #如不设定,默认为无吟唱效果
  81.     end
  82.     battler.rtp *= @max  / 100
  83.   end
  84.   end



RTAB特技连携 Ver 1.02
RUBY 代码复制
  1. #==============================================================================
  2. # RTAB 特技连携 (0.16b新增官方特效,必须配合RTAB特技吟唱)
  3. #
  4. # 解说+汉化 by SixRice
  5. #==============================================================================
  6. # 連携スキル Ver 1.02
  7. # 配布元・サポートURL
  8. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  9.  
  10. class Scene_Battle
  11. #------------------------------------------------------------------------------
  12. # 合成特技判定
  13. #
  14. # 考虑到可能会存在同名特技,将默认的根据name判断改成id判断则不会重复了(0.16b)
  15. #------------------------------------------------------------------------------
  16.   def synthe_spell(battler)
  17.     if battler.is_a?(Game_Actor)
  18.       @spell_p[battler] = $data_skills[battler.current_action.skill_id].id
  19.     end
  20.     if battler.is_a?(Game_Enemy)
  21.       @spell_e[battler] = $data_skills[battler.current_action.skill_id].id
  22.     end
  23. #------------------------------------------------------------------------------   
  24.   synthe_s = []#合成特技判定数组
  25. #------------------------------------------------------------------------------
  26. # 官方说明:
  27. # 设定为『synthe_s.push([["特技idA","特技idB"],"特技idC"]』的情况下,
  28. # 特技A和特技B同时使用时会发动特技C,称为“合成特技”。
  29. #------------------------------------------------------------------------------
  30. # 以下是官方设置范例(这里一样给出翻译,当作创作参考也不错,不用则删):
  31. #------------------------------------------------------------------------------   
  32.  
  33.   synthe_s.push([[83,83],81])# 技能 + 技能 = 技能
  34.   synthe_s.push([[57,22],59])
  35.   synthe_s.push([[61,13],63])
  36.   synthe_s.push([[57,63],64])
  37.   synthe_s.push([[57,61,7],72])
  38.   synthe_s.push([[16,16],17])
  39.   synthe_s.push([[16,17],18])
  40.   synthe_s.push([[17,17],18])
  41.   synthe_s.push([[60,18],74])
  42. #------------------------------------------------------------------------------
  43. # 初级教学——A + B = C:
  44. #
  45. # 就拿第一个例子来说,57号特技+22号特技 = 59号特技
  46. # 也就是“十字斩” + “风” = “旋风斩”
  47. # 但实际使用起来存在一个时间差的问题,同一时间内,不可能同时打出两招,总有个先后。
  48. # 因此就必须用到“RTAB特技吟唱”这个特效,来弥补所谓的时间差。
  49. #------------------------------------------------------------------------------
  50. # 接续上面的例子,将“风”这个魔法,在“RTAB特技吟唱”中设置一个吟唱时间,
  51. # 则选择发动“风”的时候就不会即时发动,而会进入“吟唱时间”,
  52. # 然后再在“风”的“吟唱时间”内发动“十字斩” ,这一连携就成立了。
  53. # 也就是说,这个连携一定要先出“风”,后出“十字斩”,才会判定成立。
  54. # 如果需要无视先后顺序的话,给“十字斩”也加个“吟唱时间”判定就可以了。
  55. #------------------------------------------------------------------------------
  56. # 再次接续上面的例子,如果给合成特技“旋风斩”也加上“吟唱时间”,
  57. # 则符合连携判定时,几个特技的发动者会同时进入“连携吟唱时间”,
  58. # 此时的吟唱速度是根据发动者速度叠加计算的,吟唱时间槽也会变成一种新的颜色,
  59. # ……貌似很有趣的样子哦。(详细说明参见“RTAB特技吟唱”第27行)
  60. #------------------------------------------------------------------------------
  61. # 中级教学——合成特技的作用目标:
  62. #
  63. # 敌方全体,己方全体的情况就不解释了……
  64. # 敌方单体,己方单体的情况,判定己方领队的指定对象为作用目标;(官方解释)
  65. #
  66. # 另外一些情况:(官方解释 + RP解说)
  67. #
  68. # 其一,当我方一号位队员(领队),二号位队员,三号位队员发动连携的时候;
  69. # 三个人分别指向三个目标,最后以领队的指向为准。
  70. #
  71. # 其二,比较无聊的情况,当连携的构成要素全部指向对方,而合成特技的作用范围
  72. # 却是与其相反(比如指敌方,合成作用己方;指自方,合成却作用敌方)的时候,
  73. # 或者构成要素的作用范围全都是全体,合成的作用范围却是单体……
  74. # 此类情况判定为失去作用目标,此时作用对象随机确定。
  75. #
  76. # 其三,特技附带了“RTAB战斗特效”中的出招收招效果的情况;
  77. # 参考其一,效果会全部作用在领队身上。
  78. #------------------------------------------------------------------------------
  79. # 高级教学——多人连携:(是不是在数学课本上见过以下公式?……)
  80. #
  81. #1. A + B + C + D = E
  82. #
  83. #2.(A + B) + (C + D) = E
  84. #
  85. #3.{[(A + B) + C] + D} = E
  86. #
  87. #3的顺序是锁死的,必须这样排。
  88. #另外需要指出的是,A+B的合成结果必须也是有吟唱时间的,
  89. #这样才能在这段时间中完成与C的连携判定,下同,具体自己体会一下吧。
  90. #
  91. #2是双重连携,但也有可能出现(A+C)+(B+D)=F,(A+D)+(B+C)=G(貌似越来越混乱了……)
  92. #
  93. #1的顺序看似任意,但是其中任何数量的要素存在其他连携方式的话,就要注意顺序了。
  94. #
  95. #比如上面的例子中:
  96. #synthe_s.push([[57,22],59]) # 十字斩 + 风 = 旋风斩
  97. #synthe_s.push([[59,61],60]) # 扫荡 + 旋风斩 = 螺旋斩
  98. #synthe_s.push([[57,22,61],88])#十字斩 + 风 + 扫荡 = 暗黑十字斩
  99. #设 57 = A , 22 = B , 59 = C , 61 = D , 88 = E
  100. #如果要达成“暗黑十字斩”,( A + B + D ) = E
  101. #则必须绕过“旋风斩”A+B=C和“螺旋斩”C+D=E的连携成立判定。
  102. #正确的出招顺序是 D + B + A = E
  103. #反之 A + B + D 的顺序则会打出“螺旋斩”。
  104. #
  105. #------------------------------------------------------------------------------   
  106.     temp = [@spell_p, @spell_e]
  107.     for spell in temp
  108.       for spells in synthe_s
  109.         magic = spells[1]
  110.         spell_c = spell.clone
  111.         for id in spells[0]
  112.           if spell_c.has_value?(id)
  113.             spell_c.delete(spell_c.index(id))
  114.           else
  115.             magic = nil
  116.             break
  117.           end
  118.         end
  119.         # 连携成立判定
  120.         if magic != nil
  121.           for skill in $data_skills
  122.             if magic == $data_skills[skill.id].id
  123.               break
  124.             end
  125.           end
  126.           if magic != $data_skills[skill.id].id
  127.             p  "注意:特技编号在数据库中不存在!请重新设置!"
  128.           end
  129.           rt = 0
  130.           synthe_b = []
  131.           spell_c = spell.clone
  132.           for id in spells[0]
  133.             actor = spell_c.index(id)
  134.             speller = synthe?(actor)
  135.             if speller != nil
  136.               for battlers in speller
  137.                 synthe_b.push(battlers)
  138.                 spell_c.delete(battlers)
  139.               end
  140.               rt += battlers.rt
  141.             end
  142.             unless synthe_b.include?(actor)
  143.               synthe_b.push(actor)
  144.               spell_c.delete(actor)
  145.               rt += actor.rt
  146.             end
  147.           end
  148. #------------------------------------------------------------------------------
  149. # 特技连携的消费SP设置:
  150. #(A号连携者消费等同于特技A,B号连携者消费等同于特技B,下同……。)
  151. # 如果不在这里设置,则参与连携的战斗者每人消费的SP等于合成特技所需消费的SP。
  152. #------------------------------------------------------------------------------
  153.           case magic #合成特技id
  154.           when 59
  155.             spells = [59,23]
  156.             success = spell_effect(battler, synthe_b, spells)
  157.           when 63
  158.             spells = [63,14]
  159.             success = spell_effect(battler, synthe_b, spells)
  160.           when 60
  161.             spells = [62,59,23]
  162.             success = spell_effect(battler, synthe_b, spells)
  163.           when 64
  164.             spells = [58,63,14]
  165.             success = spell_effect(battler, synthe_b, spells)
  166.           when 72
  167.             spells = [59,63,8]
  168.             success = spell_effect(battler, synthe_b, spells)
  169.           else
  170.             spells = [magic]
  171.             success = spell_effect(battler, synthe_b, spells)
  172.           end
  173.           if success == true
  174.             for actor in synthe_b
  175.               speller = synthe?(actor)
  176.               if speller != nil
  177.                 @synthe.delete(speller)
  178.               end
  179.               if battler != actor
  180.                 @action_battlers.delete(actor)
  181.               end
  182.               actor.spell = true
  183.               if actor == synthe_b[0]
  184.                 spell[actor] = $data_skills[skill.id].id
  185.               else
  186.                 spell.delete(actor)
  187.               end
  188.               actor.current_action.skill_id = skill.id
  189.               recite_time(actor)
  190.               actor.rtp = 1 if actor.rtp == 0
  191. #------------------------------------------------------------------------------              
  192. # 当特技为无吟唱特技的情况下,连携发动者的吟唱所需时间代入1,
  193. # 防止可能因即时发动而导致连携失败。
  194. # 合成特技发动时发动者吟唱槽清零重新进入计算,
  195. # 所有参与连携的发动者的吟唱值带入整体吟唱值。
  196. #------------------------------------------------------------------------------
  197.               actor.rt = rt
  198.             end
  199.             @synthe.push(synthe_b)
  200.           else
  201.             for actor in synthe_b
  202.               actor.current_action.spell_id = 0
  203.             end
  204.           end
  205.         end
  206.       end
  207.     end
  208.   end
  209.   def spell_effect(battler, synthe, spells)
  210.     spell_id = []
  211.     for actor in synthe
  212.       if spells.size != 0
  213.         spell = spells.shift
  214.       end
  215.       for skill in $data_skills
  216.         if spell == $data_skills[skill.id].id
  217.           break
  218.         end
  219.       end
  220.       if spell != $data_skills[skill.id].id
  221.         p "注意:特技编号在数据库中不存在!请重新设置!"
  222.       end
  223.       if actor.skill_can_use?(skill.id) or
  224.           battler.current_action.forcing == true
  225.         spell_id.push(skill.id)
  226.       else
  227.         return false
  228.       end
  229.     end
  230.     for actor in synthe
  231.       actor.current_action.spell_id = spell_id.shift
  232.     end
  233.     return true
  234.   end
  235. end



RTAB特技学习 Ver 1.00
RUBY 代码复制
  1. #==============================================================================
  2. # RTAB观光游第五站,特技学习(官方特效,0.16b 更新为完全汉化版)
  3. #
  4. # 解说+汉化 by SixRice
  5. #==============================================================================
  6. # Skill_learning Ver 1.00
  7. # 配布元・サポートURL
  8. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  9.  
  10. class Scene_Battle
  11. #------------------------------------------------------------------------------
  12. # ● 特技学习(战斗中被特定招式攻击,可习得该招式)
  13. #------------------------------------------------------------------------------
  14.   def skill_learning(actor, class_id, skill_id)
  15.     effect = false
  16. case actor.class_id
  17. #考虑到可能会存在同名职业,将默认的根据name判断改成id判断则不会重复了(0.16b)      
  18.     when 8 #8号职业
  19.       case $data_skills[skill_id].id
  20.       when 10 #10号特技
  21.         effect = learn_skill(actor, skill_id)
  22.       when 13 #13号特技
  23.         effect = learn_skill(actor, skill_id)
  24.       #以上为举例说明,有需要请自行设定,职业,可习得特技  
  25.       end
  26.  
  27.  
  28.     when 1 #1号职业
  29.       case $data_skills[skill_id].id
  30.       when 60 #60号特技
  31.         #这里举个例子,可以设置一定几率      
  32.         effect = learn_skill(actor, skill_id) if rand(100) < 20
  33.       end
  34.  
  35. end   
  36.     if effect
  37.       actor.damage[[actor, skill_id]] = "Learning!"
  38.       actor.damage_pop[[actor, skill_id]] = true
  39.     end
  40.   end
  41.   def learn_skill(actor, skill_id)
  42.     unless actor.skill_learn?(skill_id)
  43.       actor.learn_skill(skill_id)
  44.       return true
  45.     end
  46.     return false
  47.   end
  48. end



RTAB伤害美化 Ver 1.02
RUBY 代码复制
  1. # ダメージ表示改造(RTAB用) ver 1.02
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  4.  
  5. class Scene_Battle
  6.   alias :atb_setup_original :atb_setup
  7.   def atb_setup
  8.     for path in ["num", "critical", "miss", "levelup", "newskill", "learning"]
  9.       RPG::Cache.numeric(path)
  10.     end
  11.     atb_setup_original
  12.   end
  13. end
  14.  
  15. module RPG
  16.   class Sprite < ::Sprite
  17.     WIDTH = 18                  # 文字幅
  18.     HEIGHT = 20                 # クリティカルの文字・高さ
  19.     def damage(value, critical, type = 0)
  20.       if value.is_a?(Numeric)
  21.         damage_string = value.abs.to_s
  22.       else
  23.         damage_string = value.to_s
  24.       end
  25.       if value.is_a?(Numeric) and value >= 0
  26.         if type == 0
  27.           if critical
  28.             d_bitmap = draw_damage(value, 1)
  29.           else
  30.             d_bitmap = draw_damage(value, 0)
  31.           end
  32.         else
  33.           d_bitmap = draw_damage(value, 2)
  34.         end
  35.       else
  36.         if type == 0
  37.           d_bitmap = draw_damage(value, 3)
  38.         else
  39.           d_bitmap = draw_damage(value, 4)
  40.         end
  41.       end
  42.       if type == 2
  43.         d_bitmap = draw_damage(value, 5)
  44.       end
  45.       num = @_damage.size
  46.       if type != 2
  47.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  48.       else
  49.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  50.       end
  51.       @_damage[num][0].bitmap = d_bitmap
  52.       @_damage[num][0].ox = d_bitmap.width / 2
  53.       @_damage[num][0].oy = d_bitmap.height / 2
  54.       if self.battler.is_a?(Game_Actor)
  55.         @_damage[num][0].x = self.x + self.viewport.ox
  56.         @_damage[num][0].y = self.y - self.oy / 2
  57.       else
  58.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  59.                             self.ox + self.src_rect.width / 2
  60.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  61.                             self.viewport.rect.y
  62.         @_damage[num][0].zoom_x = self.zoom_x
  63.         @_damage[num][0].zoom_y = self.zoom_y
  64.         @_damage[num][0].z = 3000
  65.       end
  66.     end
  67.     def draw_damage(value, element)
  68.       width = 0
  69.       if value.is_a?(Numeric)
  70.         value = value.abs
  71.         fig = value.to_s.size - 1
  72.         file = RPG::Cache.numeric("num")
  73.         d_width = WIDTH * fig + file.rect.width / 10
  74.         if element == 1
  75.           critical = RPG::Cache.numeric("critical")
  76.           d_width = [d_width, critical.rect.width].max
  77.           d_bitmap = Bitmap.new(d_width+36, HEIGHT + file.rect.height / 5)
  78.           d_x = 0#(width - critical.rect.width / 10) / 2
  79.           d_bitmap.blt(d_x+fig*(fig/1.6), 0, critical, critical.rect)
  80.           Audio.se_play("Audio/SE/"+"Clip10",100,100)
  81.     #  $game_screen.start_flash(Color.new(255,255,255),2)
  82.        $game_screen.start_shake(3,9,2)
  83.         else
  84.           d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 5)
  85.         end
  86.         d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2
  87.         while fig >= 0
  88.           d_bitmap.blt(d_x, HEIGHT, file, Rect.new((value / (10 ** fig)) *
  89.             file.rect.width / 10, element * file.rect.height / 5,
  90.             file.rect.width / 10, file.rect.height / 5))
  91.           d_x += WIDTH
  92.           value %= 10 ** fig
  93.           fig -= 1
  94.         end
  95.       else
  96.         case value
  97.         when "Miss"
  98.           file = RPG::Cache.numeric("miss")
  99.         when "Level up!"
  100.           file = RPG::Cache.numeric("levelup")
  101.         when "New Skill!"
  102.           file = RPG::Cache.numeric("newskill")
  103.         when "Learning!"
  104.           file = RPG::Cache.numeric("learning")
  105.         else
  106.           return Bitmap.new(1, 1)
  107.         end
  108.         d_bitmap = file
  109.       end
  110.       return d_bitmap
  111.     end
  112.   end
  113.   module Cache
  114.     def self.numeric(filename)
  115.       self.load_bitmap("Graphics/String/", filename)
  116.     end
  117.   end
  118. end



XRXS.付加属性名称判定
RUBY 代码复制
  1. # ▽△▽ XRXS.付加属性名称判定 ▽△▽  built 091221
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # --- XRXS. 付加属性名称判定モジュール ---
  6. #==============================================================================
  7. module XRXS
  8.   #--------------------------------------------------------------------------
  9.   # ○ 配列が指定名の属性を持つか判定
  10.   #--------------------------------------------------------------------------
  11.   def XRXS.element_check(set, element_name)
  12.     returnar = [false, 0, 0, []] # 存在したか?, 固定値の合計、%値の合計
  13.     return returnar if !set.is_a?(Array) or set.size == 0 or element_name == ""
  14.     for i in set
  15.       if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
  16.         returnar[0] = true
  17.         if $2 == nil
  18.           returnar[1] += $1.to_i
  19.           returnar[3].push($1.to_i)
  20.         else
  21.           returnar[2] += $1.to_i
  22.         end
  23.       end
  24.     end
  25.     return returnar
  26.   end
  27.   def XRXS.element_include?(set, element_name)
  28.     return element_check(set, element_name)[0]
  29.   end
  30.   def XRXS.element_amount(set, element_name)
  31.     return element_check(set, element_name)[1]
  32.   end
  33.   def XRXS.element_percent(set, element_name)
  34.     return element_check(set, element_name)[2]
  35.   end
  36.   def XRXS.element_numbers(set, element_name)
  37.     return element_check(set, element_name)[3]
  38.   end
  39. end



XRXS.装备属性取得机构
RUBY 代码复制
  1. # ▽△▽ XRXS. 装備属性取得機構 ▽△▽ built 221114
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # --- XRXS. 装備属性取得機構 ---
  6. #==============================================================================
  7. class Game_Battler
  8.   #--------------------------------------------------------------------------
  9.   # ○ スキルの属性取得
  10.   #--------------------------------------------------------------------------
  11.   def skill_element_set(skill)
  12.     return skill.nil? ? [] : skill.element_set
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ○ 全装備の属性取得
  16.   #--------------------------------------------------------------------------
  17.   def equip_element_set
  18.     return self.element_set + self.guard_element_set
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ○ 全防具の属性取得
  22.   #--------------------------------------------------------------------------
  23.   def guard_element_set
  24.     return []
  25.   end
  26. end
  27. class Game_Actor < Game_Battler
  28.   def guard_element_set
  29.     set = []
  30.     for id in self.armor_ids
  31.       next if id.nil?
  32.       armor = $data_armors[id]
  33.       set += (armor != nil ? armor.guard_element_set : [])
  34.     end
  35.     return set
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ○ 武器 ID配列
  39.   #--------------------------------------------------------------------------
  40.   def weapon_ids
  41.     @weapon_ids = [] if @weapon_ids == nil
  42.     @weapon_ids[0] = @weapon_id
  43.     return @weapon_ids
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ○ 防具 ID配列
  47.   #--------------------------------------------------------------------------
  48.   def armor_ids
  49.     @armor_ids = [] if @armor_ids == nil
  50.     @armor_ids[0] = @armor1_id
  51.     @armor_ids[1] = @armor2_id
  52.     @armor_ids[2] = @armor3_id
  53.     @armor_ids[3] = @armor4_id
  54.     return @armor_ids
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ○ 装備配列の取得
  58.   #--------------------------------------------------------------------------
  59.   def equipments
  60.     equipments = []
  61.     self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
  62.     self.armor_ids.each {|id| equipments.push($data_armors[id])}
  63.     return equipments
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ○ 装備中?
  67.   #--------------------------------------------------------------------------
  68.   def equiping?(item)
  69.     case item
  70.     when RPG::Weapon
  71.       return self.weapon_ids.include?(item.id)
  72.     when RPG::Armor
  73.       return self.armor_ids.include?(item.id)
  74.     else
  75.       return false
  76.     end   
  77.   end
  78. end



XRXS.属性修正计数限制
RUBY 代码复制
  1. # ▼▲▼ XRXS38. 属性修正计算数限制 ▼▲▼ built 081012
  2. # by 桜雅 在土 (原作)
  3. #    Tetra-Z   (強化)
  4. #==============================================================================
  5. # 简介:此脚本会将“系统默认的属性修正”和“战斗特殊效果属性”分开计算;
  6. #       插入此脚本后,“战斗特殊效果属性”将“不计算属性有效度”。
  7. #==============================================================================
  8. # □ カスタマイズポイント
  9. #==============================================================================
  10. module XRXS38
  11.   # 属性的限制数量
  12.   ELEMENTS_NUMBER_LIMIT = 16
  13.   # 属性修正的计算方法
  14.   #        0 : 最大(默认的计算方法)
  15.   #        1 : 乘法
  16.   #        2 : 平均
  17.   #        3 : 最小
  18.   ELEMENT_CORRECT_METHOD = 1
  19. end
  20. #==============================================================================
  21. # ■ Game_Battler
  22. #==============================================================================
  23. class Game_Battler
  24. #--------------------------------------------------------------------------
  25. # ● 属性修正的计算 + 倍率计算公式
  26. #--------------------------------------------------------------------------
  27.   alias xrxs38_elements_correct elements_correct
  28.   def elements_correct(element_set)
  29.     elements = element_set.dup
  30.     # 属性数量的限制
  31.     for element_id in element_set
  32.       if element_id >XRXS38:: ELEMENTS_NUMBER_LIMIT
  33.         elements.delete(element_id)
  34.       end
  35.     end
  36.     #无属性的场合返回100
  37.     return 100 if elements.size == 0
  38.     #
  39.     case XRXS38::ELEMENT_CORRECT_METHOD
  40.     when 0 # 最大
  41.       return xrxs38_elements_correct(elements)
  42.     when 1 # 乘法
  43.       result = 100.0
  44.       minus_enable = false
  45.       for i in elements
  46.         n = self.element_rate(i)
  47.         minus_enable |= (n < 0)
  48.         result *= n / 100.0
  49.       end
  50.       result = -1 * result.abs if minus_enable
  51.       return result.to_i
  52.     when 2 # 平均
  53.       rates = []
  54.       result = 0
  55.       for i in elements
  56.         rates.push(self.element_rate(i))
  57.       end
  58.       for rate in rates
  59.         result += rate
  60.       end
  61.       return result / rates.size
  62.     when 3 # 最小
  63.       for i in elements
  64.         n = self.element_rate(i)
  65.         result = n if result.nil? or result > n
  66.       end
  67.       return result
  68.     end
  69.   end  
  70. end



RTAB战斗特效 Ver 1.03
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. # 基础脚本▼▲▼ XRXS19. 特殊効果詰め合わせ DamageEX ver.2 ▼▲▼ built 220920
  5. # by 桜雅 在土 (基本) Tetra-Z   (修正)  [url]http://scriptself.jpn.org/x/XRXS19.htm[/url]
  6. #==============================================================================
  7. # ▼▲▼ 战斗特殊效果属性 DamageEX - Plus × RTAB ▼▲▼
  8. #
  9. # 适用环境:RTAB Ver 1.16
  10. #
  11. # by SixRice  (Plus × RTAB改造)     Ver.1.03 2006/8/18
  12. # 从1.03版开始记录每次更新。
  13. #==============================================================================
  14. # 伤害计算流程:
  15. # 1  基础伤害计算                   (Game Battler)
  16. # 2  忽视躲闪判定                   (IGNORE_EVADE)
  17. # 3  修正基础伤害                   (HP_RATE,SP_RATE,CRITICAL_HIT,ADD_VARIANCE)
  18. # 4  固定伤害(取消基础)             (FIXDAMAGE)
  19. # 5  追加伤害计算                   (追加伤害效果类)
  20. # -> 基础伤害(或固定伤害)+追加伤害
  21. # =  总伤害
  22. # 6  修正总伤害                     (HP_DAMAGE,SP_DAMAGE)
  23. # -> 最终伤害
  24. # 7  收招修正使用者的HP/SP          (HP_CORRECT,SP_CORRECT)(1.03)
  25. # 8  根据最终伤害修正使用者的HP/SP  (HP_DRAIN,SP_DRAIN)
  26. #------------------------------------------------------------------------------
  27. module XRXS19
  28. #------------------------------------------------------------------------------
  29. # 一:特殊伤害效果类的属性名称设定
  30. #------------------------------------------------------------------------------  
  31. # 提示:本类属性名称后请添加自定义数值,然后才会生效。(数据库)
  32. #------------------------------------------------------------------------------  
  33. # 提示:本类属性请设为“不计算属性有效度”(XRXS38. 属性修正计算数限制)。
  34. #------------------------------------------------------------------------------  
  35. # 提示:本类属性中如果存在同属性,效果也叠加。
  36. #
  37. # 举例:一个东西同时包含HP吸收50%,HP吸收25%,实际效果为HP吸收75%.
  38. #------------------------------------------------------------------------------
  39.   AT_DAMAGE         = "AT伤害"         # 「修正目标的AT值(行动值)」(1.03)
  40.   HP_DAMAGE         = "HP伤害"         # 「将本次造成的总伤害的x%修正为HP伤害」
  41.   SP_DAMAGE         = "SP伤害"         # 「将本次造成的总伤害的x%修正为SP伤害」
  42.   HP_DRAIN          = "HP吸收"         # 「根据本次最终伤害的x%修正使用者的HP」
  43.   SP_DRAIN          = "SP吸收"         # 「根据本次最终伤害的x%修正使用者的SP」
  44.   HP_RATE           = "现HP威力"       # 「根据使用者HP/MAXHP修正本次基础伤害」
  45.   SP_RATE           = "现SP威力"       # 「根据使用者SP/MAXSP修正本次基础伤害」
  46.   CRITICAL_HIT      = "必杀"           # 「会心一击」   (武器效果通用化)
  47.   IGNORE_EVADE      = "忽视躲闪"       # 「忽视躲闪」   (特技效果武器化)
  48.   ADD_VARIANCE      = "分散度"         # 「追加分散度」 (特技效果武器化)
  49.   FIXDAMAGE         = "固定伤害"       # 「固定伤害值」 (特技效果武器化)
  50. #------------------------------------------------------------------------------
  51. # 提示:本类中“固定伤害值”不能和“会心一击”、“追加分散度”叠加;
  52. #       其余效果均可叠加。   
  53. #------------------------------------------------------------------------------  
  54.   AREA_EXTEND       = "敌方全体"      # 「敌方全体」属性名2
  55.   AREA_ACTOR        = "己方单体"      # 「己方单体」属性名3
  56.   AREA_ACTOR_ALL    = "己方全体"      # 「己方全体」属性名4
  57.   AREA_SELF         = "使用者"        # 「 使用者 」属性名7
  58.   AREA_WHOLE        = "全域化"        # 「 全域化 」属性名8
  59.   AREA_ENEMY_RAND   = "敌方随机"      # 「敌方随机」属性名9
  60.   AREA_ACTOR_RAND   = "己方随机"      # 「己方随机」属性名10
  61.   AREA_ALL_RAND     = "对象随机"      # 「对象随机」属性名11
  62.   SELF_INCLUSION    = "诸刃"          # 「  诸刃  」属性名
  63.   SELF_EXCLUSION    = "自身以外"      # 「自身以外」(与使用者,己方单体叠加无效)
  64. #------------------------------------------------------------------------------  
  65. # 提示:「诸刃」与
  66. #   「使用者」,「己方单体」,「己方全体」,「己方随机」,「对象随机」叠加无效。
  67. #------------------------------------------------------------------------------
  68.   P_STATE           = "发动状态P"      # 「行动时附加自身状态」属性名
  69.   M_STATE           = "发动状态M"      # 「行动时解除自身状态」属性名
  70.   HP_CORRECT        = "收招修正H"      # 「收招时修正使用者HP」属性名(1.03)
  71.   SP_CORRECT        = "收招修正S"      # 「收招时修正使用者SP」属性名(1.03)
  72. #------------------------------------------------------------------------------
  73. # 提示:在这个版本的战斗特殊效果属性中,
  74. #       除了"会心一击" 、"忽视躲闪"、"追加分散度" 这三个效果以外,
  75. #       其他的效果都支持负数,也就是逆转效果。
  76. #
  77. # 举例:想设置一个“敌我皆伤”的特技,只要附带HP吸收属性,效果设为负数就OK了。
  78. #
  79. # 举例:如果把"HP伤害负数" + "作用范围己方"设置为武器属性,
  80. #       就可以设置出回复己方HP的BT武器来。
  81. #
  82. # 更多创意想法等你来发挥!!
  83. #------------------------------------------------------------------------------
  84. # 二:追加伤害效果类的属性名称设定
  85. #------------------------------------------------------------------------------
  86. # 本类采用的英文单词缩写
  87. # NOW(N) = 当前 ;MAX(M) = 最大;DIF(D) = 差值 ;
  88. # HP(H) = 生命 ;SP(S) = 精力 ;  
  89. # TA(T) = target = 目标方;US(U) = user = 使用者 。
  90. #------------------------------------------------------------------------------
  91.   FIXDAMAGE_NOWHPTA = "NHT"            # 「目标方当前HP比例」属性名
  92.   FIXDAMAGE_MAXHPTA = "MHT"            # 「目标方最大HP比例」属性名
  93.   FIXDAMAGE_DIFHPTA = "DHT"            # 「目标方HP差值比例」属性名
  94.   FIXDAMAGE_NOWHPUS = "NHU"            # 「使用者当前HP比例」属性名  
  95.   FIXDAMAGE_MAXHPUS = "MHU"            # 「使用者最大HP比例」属性名
  96.   FIXDAMAGE_DIFHPUS = "DHU"            # 「使用者HP差值比例」属性名
  97.   FIXDAMAGE_NOWSPTA = "NST"            # 「目标方当前SP比例」属性名
  98.   FIXDAMAGE_MAXSPTA = "MST"            # 「目标方最大SP比例」属性名
  99.   FIXDAMAGE_DIFSPTA = "DST"            # 「目标方SP差值比例」属性名
  100.   FIXDAMAGE_NOWSPUS = "NSU"            # 「使用者当前SP比例」属性名
  101.   FIXDAMAGE_MAXSPUS = "MSU"            # 「使用者最大SP比例」属性名
  102.   FIXDAMAGE_DIFSPUS = "DSU"            # 「使用者SP差值比例」属性名
  103. #------------------------------------------------------------------------------
  104. # 提示:本类所有效果均不能互相叠加,具有唯一性;
  105. #       若特技属性中存在多个本类效果,则取最前面一个效果。  
  106. #------------------------------------------------------------------------------
  107. # 提示:特技附加本类属性的情况下,设特技的威力(pow)为比例基数,
  108. #       武器附加本类属性的情况下,设武器攻击力(atk)为比例基数,
  109. #       因此比例基数请通过数据库来设定。
  110. #------------------------------------------------------------------------------
  111. # 提示:本类所有效果均为普通伤害计算之后的追加伤害;
  112. #       本类所有效果“独立计算属性有效度”,不与其他属性有效度进行混合运算。
  113. #------------------------------------------------------------------------------
  114. # 举例1:某特技属性附加"NHT" ,威力为20,其实际效果为:
  115. #        造成 [目标方][当前][HP][20%] 的等量伤害。
  116. #------------------------------------------------------------------------------
  117. # 举例2:由于威力(power)这个值可以设为负数,
  118. #        因此MHT这个属性也可用于制作比例回复HP的特技效果。
  119. #------------------------------------------------------------------------------
  120. end
  121. #==============================================================================
  122. # ■ Game_BattleAction
  123. #==============================================================================
  124. class Game_BattleAction
  125.   attr_accessor :at_damage                # 「AT伤害值」    (Numeric)(1.03)
  126.   attr_accessor :hp_damage                # 「HP伤害率」    (Numeric)
  127.   attr_accessor :sp_damage                # 「SP伤害率」    (Numeric)
  128.   attr_accessor :hp_drain                 # 「HP吸收率」    (Numeric)
  129.   attr_accessor :sp_drain                 # 「SP吸收率」    (Numeric)
  130.   attr_accessor :hp_rate                  # 「现HP威力」    (true/false)
  131.   attr_accessor :sp_rate                  # 「现SP威力」    (true/false)
  132.   attr_accessor :critical_hit             # 「会心一击」    (Numeric)
  133.   attr_accessor :ignore_evade             # 「忽视躲闪」    (true/false)
  134.   attr_accessor :add_variance             # 「追加分散度」  (Numeric)
  135.   attr_accessor :fix_damage               # 「固定伤害值」 (Numeric)
  136.   attr_accessor :special_damage_kind      # 「追加伤害类」  (Numeric)
  137.   attr_accessor :scope_force              # 「对象强制值」  (Numeric)
  138.   attr_accessor :self_inclusion           # 「诸刃」        (true/false)
  139.   attr_accessor :self_exclusion           # 「自身以外」    (true/false)
  140.   attr_accessor :p_state                  # 「行动时附加自身状态」(Numeric)
  141.   attr_accessor :m_state                  # 「行动时解除自身状态」(Numeric)
  142.   attr_accessor :hp_correct               # 「收招时修正使用者HP」(Numeric)(1.03)
  143.   attr_accessor :sp_correct               # 「收招时修正使用者SP」(Numeric)(1.03)
  144.   def at_damage
  145.     return @at_damage.nil? ? 0 : @at_damage
  146. end
  147. #--------------------------------------------------------------------------
  148. # ● clear
  149. #--------------------------------------------------------------------------
  150.   alias xrxs19_clear clear
  151.   def clear
  152.     # recall
  153.     xrxs19_clear
  154.     # 初始化特殊效果
  155.     initialize_xrxs19_special_effect
  156.   end
  157. #--------------------------------------------------------------------------
  158. # ○ 初始化特殊效果
  159. #--------------------------------------------------------------------------
  160.   def initialize_xrxs19_special_effect
  161.     self.at_damage = 0#(1.03)
  162.     self.hp_damage = 0
  163.     self.sp_damage = 0
  164.     self.hp_drain  = 0
  165.     self.sp_drain  = 0
  166.     self.hp_rate  = false
  167.     self.sp_rate  = false
  168.     self.critical_hit = 0
  169.     self.ignore_evade = false
  170.     self.add_variance = 0
  171.     self.fix_damage = 0
  172.     self.special_damage_kind = 0
  173.     self.p_state = 0
  174.     self.m_state = 0
  175.     self.hp_correct = 0#(1.03)
  176.     self.sp_correct = 0#(1.03)
  177.   end
  178. #--------------------------------------------------------------------------
  179. # ○ 特殊效果设置
  180. #--------------------------------------------------------------------------
  181.   def set_xrxs19_special_effect(set)
  182.     # AT伤害值(数值)(1.03)
  183.     self.at_damage = XRXS.element_amount(set, XRXS19::AT_DAMAGE)
  184.     # HP/SP伤害率(数值%)
  185.     self.hp_damage = XRXS.element_percent(set, XRXS19::HP_DAMAGE)
  186.     self.sp_damage = XRXS.element_percent(set, XRXS19::SP_DAMAGE)
  187.     # HP/SP吸收率(数值%)
  188.     self.hp_drain  = XRXS.element_percent(set, XRXS19::HP_DRAIN)
  189.     self.sp_drain  = XRXS.element_percent(set, XRXS19::SP_DRAIN)
  190.     # 现HP/SP威力 (true/false)
  191.     self.hp_rate = XRXS.element_include?(set, XRXS19::HP_RATE)
  192.     self.sp_rate = XRXS.element_include?(set, XRXS19::SP_RATE)
  193.     # 会心一击率(数值%)
  194.     returnar = XRXS.element_check(set, XRXS19::CRITICAL_HIT)
  195.     percent = returnar[0] ? (returnar[2] == 0 ? 100 : returnar[2]) : 0
  196.     self.critical_hit = percent
  197.     # 忽视躲闪 (true/false)
  198.     self.ignore_evade = XRXS.element_include?(set, XRXS19::IGNORE_EVADE)
  199.     # 追加分散度(数值)
  200.     self.add_variance = XRXS.element_amount(set, XRXS19::ADD_VARIANCE)
  201.     # 固定伤害值(数值)
  202.     self.fix_damage = XRXS.element_amount(set, XRXS19::FIXDAMAGE)
  203.     # 追加伤害类
  204.     self.special_damage_kind =
  205.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_NOWHPTA) ? 1 :
  206.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_MAXHPTA) ? 2 :
  207.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_DIFHPTA) ? 3 :
  208.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_NOWHPUS) ? 4 :
  209.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_MAXHPUS) ? 5 :
  210.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_DIFHPUS) ? 6 :
  211.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_NOWSPTA) ? 7 :
  212.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_MAXSPTA) ? 8 :
  213.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_DIFSPTA) ? 9 :
  214.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_NOWSPUS) ? 10 :
  215.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_MAXSPUS) ? 11 :
  216.       XRXS.element_include?(set, XRXS19::FIXDAMAGE_DIFSPUS) ? 12 :      
  217.       0
  218.     # 行动时附加/解除自身状态(ID)
  219.     self.p_state = XRXS.element_amount(set, XRXS19::P_STATE)
  220.     self.m_state = XRXS.element_amount(set, XRXS19::M_STATE)
  221.     # 收招时修正使用者HP/SP(数值)(1.03)
  222.     self.hp_correct = XRXS.element_amount(set, XRXS19::HP_CORRECT)
  223.     self.sp_correct = XRXS.element_amount(set, XRXS19::SP_CORRECT)
  224.   end
  225. #--------------------------------------------------------------------------
  226. # ○ 特殊效果clear
  227. #--------------------------------------------------------------------------
  228.   def clear_xrxs19_special_effect
  229.     self.at_damage = nil#(1.03)
  230.     self.hp_damage = nil
  231.     self.sp_damage = nil
  232.     self.hp_drain  = nil
  233.     self.sp_drain  = nil
  234.     self.hp_rate  = false
  235.     self.sp_rate  = false
  236.     self.critical_hit = nil
  237.     self.ignore_evade = false
  238.     self.add_variance = nil
  239.     self.fix_damage = nil
  240.     self.special_damage_kind = nil
  241.     self.scope_force = 0
  242.     self.self_exclusion = false
  243.     self.self_inclusion = false
  244.     self.p_state = nil
  245.     self.m_state = nil
  246.     self.hp_correct = 0#(1.03)
  247.     self.sp_correct = 0#(1.03)
  248.   end
  249. #--------------------------------------------------------------------------
  250. # ○ 无效化特殊效果
  251. #--------------------------------------------------------------------------
  252.   def nillize_xrxs19_special_effect
  253.     self.scope_force = nil
  254.     self.self_inclusion = nil
  255.     self.self_exclusion = nil
  256.   end
  257. end  
  258. #==============================================================================
  259. # □□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
  260. #==============================================================================
  261. # ■ Game_Battler
  262. #==============================================================================
  263. class Game_Battler
  264. #--------------------------------------------------------------------------
  265. # ○ 公开实例变量
  266. #--------------------------------------------------------------------------
  267.   attr_accessor :maxat                  # 最大AT#(1.03)
  268.   attr_writer :ignore_evade             #(True为忽视对方躲闪判定)
  269.   attr_writer :hp_rate                  #(True为基础伤害根据HP/MAXHP比例修正)
  270.   attr_writer :sp_rate                  #(True为基础伤害根据SP/MAXSP比例修正)
  271. #--------------------------------------------------------------------------
  272. # ○特殊范围效果设定
  273. #--------------------------------------------------------------------------  
  274.   def set_xrxs19_special_scope(set)
  275. # 范围强制值
  276. self.current_action.scope_force =
  277. XRXS.element_include?(set, XRXS19::AREA_EXTEND)     ? 2 :
  278. XRXS.element_include?(set, XRXS19::AREA_ACTOR)      ? 3 :
  279. XRXS.element_include?(set, XRXS19::AREA_ACTOR_ALL)  ? 4 :
  280. XRXS.element_include?(set, XRXS19::AREA_SELF)       ? 7 :
  281. XRXS.element_include?(set, XRXS19::AREA_WHOLE)      ? 8 :
  282. XRXS.element_include?(set, XRXS19::AREA_ENEMY_RAND) ? 9 :
  283. XRXS.element_include?(set, XRXS19::AREA_ACTOR_RAND) ? 10 :
  284. XRXS.element_include?(set, XRXS19::AREA_ALL_RAND)   ? 11 :
  285. 0
  286. # 诸刃
  287. self.current_action.self_inclusion = XRXS.element_include?(set, XRXS19::SELF_INCLUSION)
  288. # 自身以外
  289. self.current_action.self_exclusion = XRXS.element_include?(set, XRXS19::SELF_EXCLUSION)
  290. end
  291. #--------------------------------------------------------------------------
  292. # ● 新定义状态变化 (+) 发动状态适用
  293. #--------------------------------------------------------------------------
  294.   def pp_state(battler, i)
  295.     # 清除有效标志
  296.     effective = false
  297.       # 无法防御本状态的情况下
  298.       unless self.state_guard?(i)
  299.         # 这个状态如果不是 full 的话就设置有效标志
  300.         effective |= self.state_full?(i) == false
  301.         # 状态为 [不能抵抗] 的情况下
  302.         if $data_states[i].nonresistance
  303.           # 设置状态变化标志
  304.           @state_changed = true
  305.           # 附加状态
  306.           self.state_p[battler].push(i)
  307.         # 这个状态不是 full 的情况下
  308.         elsif self.state_full?(i) == false
  309.           # 将状态的有效度变换为概率、与随机数比较
  310.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  311.             # 设置状态变化标志
  312.             @state_changed = true
  313.             # ステートを付加
  314.             self.add_state(i)
  315.         end
  316.       end
  317.     end
  318.     # 过程结束
  319.     return effective
  320.   end
  321. #--------------------------------------------------------------------------
  322. # ● 可以使用特技的判定
  323. #    skill_id : 特技 ID
  324. #--------------------------------------------------------------------------
  325.   alias xrxs19_skill_can_use? skill_can_use?
  326.   def skill_can_use?(skill_id)
  327.   # 获取特技
  328.   @skill = $data_skills[skill_id]
  329.   # 范围计算
  330.   set_xrxs19_special_scope(self.skill_element_set(@skill))
  331.   $data_skills[skill_id].scope = self.current_action.scope_force if self.current_action.scope_force > 0
  332.     # 范围是「自身以外」的情况
  333.     if self.current_action.self_exclusion
  334.       # 获取战斗者
  335.       battlers = (self.is_a?(Game_Actor) ? $game_party.actors : $game_troop.enemies)
  336.       # 范围的分歧
  337.       case $data_skills[skill_id].scope
  338.       when 3,4,10
  339.         # 获取生存的战斗者数量
  340.         n = 0
  341.         battlers.each {|battler| n += 1 unless battler.dead?}
  342.       when 5,6
  343.         # 获取战斗者总数
  344.         n = battlers.size
  345.       else
  346.         n = 2
  347.       end
  348.       # 对象不存在的情况
  349.       return false if n <= 1
  350.     end
  351.     # recall
  352.     return xrxs19_skill_can_use?(skill_id)
  353.   end   
  354. #--------------------------------------------------------------------------
  355. # ● 判断状态 [无法回避攻击]
  356. #--------------------------------------------------------------------------
  357. alias xrxs19_cant_evade? cant_evade?
  358. def cant_evade?
  359. return true if @ignore_evade
  360. return xrxs19_cant_evade?
  361. end
  362. #--------------------------------------------------------------------------
  363. # ○ 特殊效果设置
  364. #--------------------------------------------------------------------------
  365.   def set_xrxs19_special_effect(set)
  366.     self.current_action.set_xrxs19_special_effect(set)
  367.   end
  368. #--------------------------------------------------------------------------
  369. # ● 应用通常攻击效果
  370. #    attacker : 攻击者 (battler)
  371. #--------------------------------------------------------------------------
  372.   alias xrxs19_attack_effect attack_effect
  373.   def attack_effect(attacker)   
  374.     # 特殊效果:忽视躲闪
  375.       if  attacker.current_action.ignore_evade
  376.       self.ignore_evade = true
  377.     end
  378.     return xrxs19_attack_effect(attacker)
  379.   end
  380. #--------------------------------------------------------------------------
  381. # ● 应用特技效果
  382. #     user  : 特技的使用者 (battler)
  383. #     skill : 特技
  384. #--------------------------------------------------------------------------
  385.   alias xrxs19_skill_effect skill_effect
  386.   def skill_effect(user, skill)
  387.     # 特殊效果:忽视躲闪
  388.     if  user.current_action.ignore_evade
  389.     self.ignore_evade = true
  390.   end
  391.     return xrxs19_skill_effect(user, skill)
  392.   end
  393. #------------------------------------------------------------------------------
  394. # ○ 伤害计算(属于对基本伤害的再处理)
  395. #------------------------------------------------------------------------------
  396. # ● 基础伤害计算请在“应用通常攻击效果” 和“应用特技效果”部分定义  
  397. #------------------------------------------------------------------------------
  398.   alias xrxs19co_x1_damage_effect damage_effect
  399.   def damage_effect(battler, item, skill)
  400.     # recall
  401.     if item == 2 or self.damage[battler].class == String
  402.       return xrxs19co_x1_damage_effect(battler, item)
  403.     end
  404.     # 初始化
  405.     battler.current_action.at_damage    = 0 if battler.current_action.at_damage.nil?#(1.03)
  406.     battler.current_action.hp_damage    = 0 if battler.current_action.hp_damage.nil?
  407.     battler.current_action.sp_damage    = 0 if battler.current_action.sp_damage.nil?
  408.     battler.current_action.hp_drain     = 0 if battler.current_action.hp_drain.nil?
  409.     battler.current_action.sp_drain     = 0 if battler.current_action.sp_drain.nil?
  410.     battler.current_action.critical_hit = 0 if battler.current_action.critical_hit.nil?
  411.     battler.current_action.add_variance = 0 if battler.current_action.add_variance.nil?
  412.     battler.current_action.fix_damage   = 0 if battler.current_action.fix_damage.nil?
  413.     battler.current_action.special_damage_kind = 0 if battler.current_action.special_damage_kind.nil?
  414.     battler.current_action.p_state = 0 if battler.current_action.p_state.nil?
  415.     battler.current_action.m_state = 0 if battler.current_action.m_state.nil?
  416.     battler.current_action.hp_correct = 0 if battler.current_action.hp_correct.nil?#(1.03)
  417.     battler.current_action.sp_correct = 0 if battler.current_action.sp_correct.nil?#(1.03)
  418.     # 解除忽视躲闪
  419.     self.ignore_evade = false         
  420.  
  421.     # 基本伤害
  422.     self.damage[battler] = self.damage[battler].to_i
  423.  
  424.  
  425.     # 特殊效果:追加分散度
  426.   if battler.current_action.add_variance > 0 and self.damage[battler].abs > 0
  427.   amp = [self.damage[battler].abs * battler.current_action.add_variance / 100, 1].max
  428.   self.damage[battler]  += rand(amp+1) + rand(amp+1) - amp
  429. end
  430.     # 特殊效果:现HP威力
  431.     if battler.current_action.hp_rate
  432. self.damage[battler] = self.damage[battler] * battler.hp / battler.maxhp
  433. end
  434.     # 特殊效果:现SP威力
  435.     if battler.current_action.sp_rate
  436. self.damage[battler] = self.damage[battler] * battler.sp / battler.maxsp
  437. end
  438.  
  439.     # 特殊效果:会心一击
  440.     if battler.current_action.critical_hit > 0
  441.   if self.critical[battler]
  442. self.critical[battler] = false      
  443. self.damage[battler] /= 2           
  444. end
  445.     # critical重新判定
  446.     if rand(100) < battler.current_action.critical_hit
  447. self.critical[battler] = true
  448. self.damage[battler] *= 2
  449. end
  450. end
  451.     # 特殊效果:固定伤害
  452.     if battler.current_action.fix_damage != 0
  453. self.damage[battler] = battler.current_action.fix_damage.to_i
  454. self.critical[battler] = false
  455. end
  456. #------------------------------------------------------------------------------
  457. # 特殊效果:追加伤害效果类计算
  458. #------------------------------------------------------------------------------
  459. case battler.current_action.special_damage_kind
  460.     when 1# 「目标方当前HP比例」
  461.       if skill != nil
  462.       self.damage[battler] += self.hp * skill.power / 100
  463.     else
  464.       self.damage[battler] += self.hp * battler.atk / 10000
  465.     end
  466. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWHPTA))/100
  467. when 2# 「目标方最大HP比例」
  468.       if skill != nil
  469.       self.damage[battler] += self.maxhp * skill.power / 100
  470.     else
  471.       self.damage[battler] += self.maxhp * battler.atk / 10000
  472.     end   
  473. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXHPTA))/100
  474.     when 3# 「目标方HP差值比例」
  475.       if skill != nil
  476.       self.damage[battler] += (self.maxhp - self.hp) * skill.power / 100
  477.     else
  478.       self.damage[battler] += (self.maxhp - self.hp) * battler.atk / 10000
  479.     end      
  480. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFHPTA))/100
  481.     when 4# 「使用者当前HP比例」
  482.       if skill != nil
  483.       self.damage[battler] += battler.hp * skill.power / 100
  484.     else
  485.       self.damage[battler] += battler.hp * battler.atk / 10000
  486.     end
  487. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWHPUS))/100   
  488.     when 5# 「使用者最大HP比例」
  489.       if skill != nil
  490.       self.damage[battler] += battler.maxhp * skill.power / 100
  491.     else
  492.       self.damage[battler] += battler.maxhp * battler.atk / 10000
  493.     end
  494. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXHPUS))/100
  495.     when 6# 「使用者HP差值比例」
  496.       if skill != nil
  497.       self.damage[battler] += (battler.maxhp - battler.hp) * skill.power / 100
  498.     else
  499.       self.damage[battler] += (battler.maxhp - battler.hp) * battler.atk / 10000
  500.     end      
  501. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFHPUS))/100   
  502.     when 7# 「目标方当前SP比例」
  503.       if skill != nil
  504.       self.damage[battler] += self.sp * skill.power / 100
  505.     else
  506.       self.damage[battler] += self.sp * battler.atk / 10000
  507.     end
  508. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWSPTA))/100
  509.     when 8# 「目标方最大SP比例」   
  510.       if skill != nil
  511.       self.damage[battler] += self.maxsp * skill.power / 100
  512.     else
  513.       self.damage[battler] += self.maxsp * battler.atk / 10000
  514.     end   
  515. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXSPTA))/100
  516.     when 9# 「目标方SP差值比例」      
  517.       if skill != nil
  518.       self.damage[battler] += (self.maxsp - self.sp) * skill.power / 100
  519.     else
  520.       self.damage[battler] += (self.maxsp - self.sp) * battler.atk / 10000
  521.     end   
  522. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFSPTA))/100
  523.     when 10# 「使用者当前SP比例」  
  524.       if skill != nil
  525.       self.damage[battler] += battler.sp * skill.power / 100
  526.     else
  527.       self.damage[battler] += battler.sp * battler.atk / 10000
  528.     end
  529. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWSPUS))/100
  530.     when 11# 「使用者最大SP比例」     
  531.       if skill != nil
  532.       self.damage[battler] += battler.maxsp * skill.power / 100
  533.     else
  534.       self.damage[battler] += battler.maxsp * battler.atk / 10000
  535.     end
  536. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXSPUS))/100
  537.     when 12# 「使用者SP差值比例」   
  538.       if skill != nil
  539.       self.damage[battler] += (battler.maxsp - battler.sp) * skill.power / 100
  540.     else
  541.       self.damage[battler] += (battler.maxsp - battler.sp) * battler.atk / 10000
  542.     end  
  543. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFSPUS))/100
  544. end
  545. #------------------------------------------------------------------------------
  546. # 特殊效果:AT伤害值(1.03)
  547.   if battler.current_action.at_damage != 0
  548.   self.at -= battler.current_action.at_damage * self.maxat / 100
  549.   self.at  = 0 if self.at < 0
  550.   self.atp = 100 * self.at / self.maxat
  551. end
  552. # 特殊效果:HP伤害率
  553.   if battler.current_action.hp_damage != 0 and battler.current_action.sp_damage == 0
  554. self.damage[battler] = self.damage[battler] * battler.current_action.hp_damage / 100
  555. end
  556. # 特殊效果:SP伤害率
  557.   if battler.current_action.sp_damage != 0
  558. self.damage_sp[battler] = self.damage[battler] * battler.current_action.sp_damage / 100
  559. self.damage_sp[battler] = self.sp if self.damage_sp[battler] > self.sp
  560. self.damage_sp[battler] = "" if self.sp == 0
  561. self.sp      -= self.damage_sp[battler] if self.damage_sp[battler] != ""
  562.   if battler.current_action.hp_damage != 0 # 特殊效果:HP伤害率
  563. self.damage[battler] = self.damage[battler] * battler.current_action.hp_damage / 100
  564. else
  565. self.damage[battler] = ""
  566. end
  567. end
  568. #------------------------------------------------------------------------------
  569. # 特殊效果:收招修正(1.03)
  570. battler.hp = battler.current_action.hp_correct.to_i if battler.current_action.hp_correct != 0
  571. battler.sp = battler.current_action.sp_correct.to_i if battler.current_action.sp_correct != 0
  572. #------------------------------------------------------------------------------   
  573. # 特殊效果:HP吸收
  574. if battler.current_action.hp_drain != 0
  575.    battler.damage[battler] = 0 if battler.damage[battler] == nil
  576.    drain_point = -1 * self.damage[battler].to_i * battler.current_action.hp_drain / 100
  577.    battler.damage[battler] += drain_point
  578.    battler.hp -= drain_point
  579. if battler.damage[battler] == 0
  580.    battler.damage[battler] = nil
  581.   end
  582. end
  583. # 特殊效果:SP吸收
  584. if battler.current_action.sp_drain != 0
  585.    battler.damage_sp[battler] = 0 if battler.damage_sp[battler] == nil
  586.    drain_point = -1 * self.damage_sp[battler].to_i * battler.current_action.sp_drain / 100
  587.    battler.damage_sp[battler] += drain_point
  588.    battler.sp -= drain_point
  589.    battler.damage_sp[battler] = drain_point
  590. if battler.damage_sp[battler] == 0
  591.    battler.damage_sp[battler] = nil
  592.   end
  593. end
  594.     # recall
  595.     xrxs19co_x1_damage_effect(battler, item)
  596.   end
  597. end
  598.  
  599. #==============================================================================
  600. # ■ Scene_Battle
  601. #==============================================================================
  602. class Scene_Battle
  603. #------------------------------------------------------------------------------
  604. # ○ ATB_SETUP (ATB = AT Bar,意思不要和RTAB搞错)(1.03)
  605. #------------------------------------------------------------------------------
  606.   alias xrxs19_atb_setup atb_setup
  607.   def atb_setup
  608.     # recall
  609.     xrxs19_atb_setup
  610.     # 保存最大AT
  611.     for battler in $game_party.actors + $game_troop.enemies
  612.       battler.maxat = @max
  613.     end
  614.   end  
  615. #--------------------------------------------------------------------------
  616. # ● 主处理
  617. #--------------------------------------------------------------------------
  618.   alias xrxs19_main main
  619.   def main
  620.     # 清空角色的伤害值
  621.     for actor in $game_party.actors
  622.       actor.damage = nil
  623.     end
  624.     # recall
  625.     xrxs19_main
  626.     # 清空角色的特殊效果设置
  627.     for actor in $game_party.actors
  628.       actor.current_action.clear_xrxs19_special_effect
  629.       actor.current_action.nillize_xrxs19_special_effect
  630.     end
  631.   end
  632. #--------------------------------------------------------------------------
  633. # ● 刷新画面 (主回合步骤 1 : 准备行动)
  634. #--------------------------------------------------------------------------
  635.   alias xrxs19co_x1_update_phase4_step1 update_phase4_step1
  636.   def update_phase4_step1(battler)
  637.     # 清空行动者的伤害值
  638.     battler.damage.clear
  639.     # recall
  640.     xrxs19co_x1_update_phase4_step1(battler)
  641.   end
  642.  
  643. #--------------------------------------------------------------------------
  644. # ● 刷新画面 (主回合步骤 2 : 开始行动)
  645. #--------------------------------------------------------------------------
  646.   alias xrxs19_update_phase4_step2 update_phase4_step2
  647.   def update_phase4_step2(battler)
  648.     # 清空行动者的伤害值
  649.     battler.damage.clear
  650.     # recall
  651.     xrxs19_update_phase4_step2(battler)   
  652.   end
  653. #--------------------------------------------------------------------------
  654. # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  655. #(武器范围定义必须)
  656. #--------------------------------------------------------------------------
  657.   def update_phase3_enemy_select
  658.     # コマンド選択中に行動不能になった場合
  659.     unless @active_actor.inputable?
  660.       # カメラを元に戻す
  661.       if @camera == "select"
  662.         @spriteset.screen_target(0, 0, 1)
  663.       end
  664.       @active_actor.current_action.clear
  665.       command_delete
  666.       # 次のアクターのコマンド入力へ
  667.       phase3_next_actor
  668.       return
  669.     end
  670.     @active_actor.set_xrxs19_special_scope(@active_actor.equip_element_set) if @skill_window == nil
  671.     @active_actor.set_xrxs19_special_scope(@active_actor.skill_element_set(@skill)) if @skill_window != nil
  672.   case @active_actor.current_action.scope_force
  673.   when 2,4,6,7,8,9,10,11
  674.         # アクションを設定
  675.         @active_actor.current_action.kind = 0
  676.         @active_actor.current_action.basic = 0
  677.         # スキルの選択を終了
  678.         end_enemy_select
  679.         # 次のアクターのコマンド入力へ
  680.         phase3_next_actor
  681.   when 3
  682.         # アクターアローを更新
  683.     @actor_arrow.update
  684.     # B ボタンが押された場合
  685.     if Input.trigger?(Input::B)
  686.       # キャンセル SE を演奏
  687.       $game_system.se_play($data_system.cancel_se)
  688.       # アクターの選択を終了
  689.       end_enemy_select
  690.       return
  691.     end
  692.     # C ボタンが押された場合
  693.     if Input.trigger?(Input::C)
  694.     # 決定 SE を演奏
  695.       $game_system.se_play($data_system.decision_se)
  696.       # アクションを設定
  697.       @active_actor.current_action.kind = 0
  698.       @active_actor.current_action.basic = 0
  699.       @active_actor.current_action.target_index = @actor_arrow.index
  700.       # アクターの選択を終了
  701.       end_enemy_select
  702.       # 次のアクターのコマンド入力へ
  703.         phase3_next_actor
  704.      end
  705.      else
  706.     # エネミーアローを更新
  707.     @enemy_arrow.update
  708.     # B ボタンが押された場合
  709.     if Input.trigger?(Input::B)
  710.       # キャンセル SE を演奏
  711.       $game_system.se_play($data_system.cancel_se)
  712.       # カメラを元に戻す
  713.       if @camera == "select"
  714.         # カメラの設定
  715.         @camera = "command"
  716.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  717.         y = [(plus.abs - 1.5) * 10 , 0].min
  718.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  719.       end
  720.       # エネミーの選択を終了
  721.       end_enemy_select
  722.       return
  723.     end
  724.     # C ボタンが押された場合
  725.     if Input.trigger?(Input::C)
  726.       # 決定 SE を演奏
  727.       $game_system.se_play($data_system.decision_se)
  728.       # アクションを設定
  729.       @active_actor.current_action.kind = 0
  730.       @active_actor.current_action.basic = 0
  731.       @active_actor.current_action.target_index = @enemy_arrow.index
  732.       # スキルウィンドウ表示中の場合
  733.       if @skill_window != nil
  734.         # アクションを再設定
  735.         @active_actor.current_action.kind = 1
  736.         # スキルの選択を終了
  737.         end_skill_select
  738.       end
  739.       # アイテムウィンドウ表示中の場合
  740.       if @item_window != nil
  741.         # アクションを再設定
  742.         @active_actor.current_action.kind = 2
  743.         # アイテムの選択を終了
  744.         end_item_select
  745.       end
  746.       # エネミーの選択を終了
  747.       end_enemy_select
  748.       # 次のアクターのコマンド入力へ
  749.       phase3_next_actor
  750.       end
  751.     end
  752.   end
  753. #--------------------------------------------------------------------------
  754. # ● 开始选择敌人#(武器范围定义必须)(1.03修正显示BUG)
  755. #--------------------------------------------------------------------------
  756.   def start_enemy_select   
  757.     @active_actor.set_xrxs19_special_scope(@active_actor.equip_element_set) if @skill_window == nil
  758.     @active_actor.set_xrxs19_special_scope(@active_actor.skill_element_set(@skill)) if @skill_window != nil
  759. if @active_actor.current_action.scope_force == 3
  760.    # 生成敌人箭头
  761.    @actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
  762.    # 关联帮助窗口
  763.     @actor_arrow.help_window = @help_window
  764.   else
  765.     # 生成敌人箭头
  766.      @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
  767.      # 关联帮助窗口
  768.     @enemy_arrow.help_window = @help_window
  769.     end
  770.     # 无效化角色指令窗口
  771.     @actor_command_window.active = false
  772.     @actor_command_window.visible = false
  773.   end
  774. #--------------------------------------------------------------------------
  775. # ● 结束选择敌人#武器范围定义必须)
  776. #--------------------------------------------------------------------------
  777.   def end_enemy_select
  778.     # 释放敌人箭头
  779.     @enemy_arrow.dispose if @enemy_arrow != nil
  780.     @actor_arrow.dispose if @actor_arrow != nil
  781.     @enemy_arrow = nil
  782.     @actor_arrow = nil
  783.     # 指令为 [战斗] 的情况下
  784.     if @actor_command_window.index == 0
  785.       # 有效化角色指令窗口
  786.       @actor_command_window.active = true
  787.       @actor_command_window.visible = true
  788.       # 隐藏帮助窗口
  789.       @help_window.visible = false
  790.     end
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   # ● 基本アクション 準備#(武器范围定义必须)
  794.   #--------------------------------------------------------------------------
  795.   def make_basic_action_preparation(battler)
  796.     # 攻撃の場合
  797.     if battler.current_action.basic == 0
  798.       # アニメーション ID を設定
  799.       battler.anime1 = battler.animation1_id
  800.       battler.anime2 = battler.animation2_id
  801.       # 行動側バトラーがエネミーの場合
  802.       if battler.is_a?(Game_Enemy)
  803.         if battler.restriction == 3
  804.           target = $game_troop.random_target_enemy
  805.         elsif battler.restriction == 2
  806.           target = $game_party.random_target_actor
  807.         else
  808.           index = battler.current_action.target_index
  809.           target = $game_party.smooth_target_actor(index)
  810.         end
  811.       end
  812.       # 行動側バトラーがアクターの場合
  813. battler.set_xrxs19_special_scope(battler.equip_element_set)   
  814.       if battler.is_a?(Game_Actor)
  815.         if battler.restriction == 3
  816.           target = $game_party.random_target_actor
  817.         elsif battler.restriction == 2
  818.           target = $game_troop.random_target_enemy
  819.         elsif battler.current_action.scope_force == 3 # 己方单体
  820.           index = battler.current_action.target_index
  821.           target = $game_party.smooth_target_actor(index)
  822.         else
  823.  
  824.           index = battler.current_action.target_index
  825.           target = $game_troop.smooth_target_enemy(index)
  826.         end
  827.       end
  828.  
  829.       # 対象側バトラーの配列を設定
  830.     case  battler.current_action.scope_force
  831.     when 2 # 敌方全体
  832.         for enemy in $game_troop.enemies
  833.           if enemy.exist?
  834.             battler.target.push(enemy)
  835.           end
  836.         end
  837.     battler.target.push(battler) if battler.current_action.self_inclusion     
  838.     when 4 # 己方全体
  839.         for actor in $game_party.actors
  840.           if actor.exist?
  841.             battler.target.push(actor)
  842.           end
  843.         end
  844.     battler.target -=[battler] if battler.current_action.self_exclusion   
  845.     when 7  # 使用者
  846.       battler.target.push(battler)
  847.          when 8  # 全域化
  848.         for enemy in $game_troop.enemies
  849.           if enemy.exist?
  850.             battler.target.push(enemy)
  851.           end
  852.         end
  853.       for actor in $game_party.actors
  854.           if actor.exist?
  855.             battler.target.push(actor)
  856.           end
  857.         end
  858. battler.target -=[battler] if battler.current_action.self_exclusion
  859.      when 9  # 敌方随机        
  860.         for enemy in $game_troop.enemies
  861.           if enemy.exist?
  862.             battler.target = [$game_troop.random_target_enemy]
  863.           end
  864.         end
  865. battler.target.push(battler) if battler.current_action.self_inclusion
  866.       when 10  # 己方随机
  867.       for actor in $game_party.actors
  868.           if actor.exist?
  869.             battler.target.push(actor)
  870.           end
  871.         end      
  872. battler.target -=[battler] if battler.current_action.self_exclusion
  873. battler.target = [battler.target[rand(battler.target.size)]]
  874.         when 11 #对象随机
  875.       battler.target = []
  876.         for enemy in $game_troop.enemies
  877.           if enemy.exist?
  878.             battler.target.push(enemy)
  879.           end
  880.         end
  881.       for actor in $game_party.actors
  882.           if actor.exist?
  883.             battler.target.push(actor)
  884.           end
  885.         end
  886. battler.target -=[battler] if battler.current_action.self_exclusion
  887. battler.target = [battler.target[rand(battler.target.size)]]
  888. else
  889.       battler.target = [target]
  890. battler.target.push(battler) if battler.current_action.self_inclusion and
  891. battler.current_action.scope_force != 3 and
  892. battler.restriction != 2 and
  893. battler.restriction != 3
  894.       end
  895.       return true
  896.     end
  897.     # 防御の場合
  898.     if battler.current_action.basic == 1
  899.       # ステップ 3 に移行
  900.       battler.phase = 3
  901.       return false
  902.     end
  903. #===============0.15b(RTAB官方更新)===========================================   
  904.     # 逃げるの場合
  905.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  906.       # ステップ 3 に移行
  907.       battler.phase = 3
  908.       return false
  909.     end
  910. #=============================================================================
  911.     # 何もしないの場合
  912.     if battler.current_action.basic == 3
  913.       # ステップ 6 に移行
  914.       battler.phase = 6
  915.       return false
  916.     end
  917.   end  
  918. #--------------------------------------------------------------------------
  919. # ● 生成基本行动结果
  920. #--------------------------------------------------------------------------
  921.   alias xrxs19_make_basic_action_result make_basic_action_result
  922.    def make_basic_action_result(battler)
  923.     # 攻击的情况
  924.     if battler.current_action.basic == 0
  925.       # 获取行动者武器附加的战斗特效
  926.       if battler.is_a?(Game_Actor)
  927.         battler.set_xrxs19_special_effect(battler.equip_element_set)
  928.       # 行动时附加自身状态
  929.         if battler.current_action.p_state > 0
  930.         battler.pp_state(battler,battler.current_action.p_state)
  931.       end
  932.       # 行动时解除自身状态
  933.       if battler.current_action.m_state > 0
  934.         battler.remove_state(battler.current_action.m_state)
  935.       end
  936.       end
  937. end
  938.     # recall
  939.     xrxs19_make_basic_action_result(battler)
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # ● スキルまたはアイテムの対象側バトラー設定
  943.   #     scope : スキルまたはアイテムの効果範囲
  944.   # (武器范围定义必须)特技/道具的范围定义
  945.   #--------------------------------------------------------------------------
  946.   def set_target_battlers(scope, battler)
  947.     #行动方战斗者是敌方的情况
  948.     if battler.is_a?(Game_Enemy)
  949.      # 效果范围的分歧
  950.       case scope
  951.       when 1  # 敌单体
  952. battler.target.push(battler) if battler.current_action.self_inclusion           
  953.         index =battler.current_action.target_index
  954.         battler.target.push($game_party.smooth_target_actor(index))
  955.  
  956.       when 2  # 敌全体
  957. battler.target.push(battler) if battler.current_action.self_inclusion   
  958.         for actor in $game_party.actors
  959.           if actor.exist?
  960.             battler.target.push(actor)
  961.           end
  962.         end
  963.  
  964.       when 3  # 己方单体
  965.  
  966.         index = battler.current_action.target_index
  967.         battler.target.push($game_troop.smooth_target_enemy(index))
  968.  
  969.       when 4  # 己方全体
  970.         for enemy in $game_troop.enemies
  971.           if enemy.exist?
  972.             battler.target.push(enemy)
  973.           end
  974.         end
  975. battler.target -=[battler] if battler.current_action.self_exclusion        
  976.       when 5  # 己方单体 (HP 0)   
  977.  
  978.         index = battler.current_action.target_index
  979.         enemy = $game_troop.enemies[index]
  980.         if enemy != nil# and enemy.hp0?# 复活类特技/道具对生存者有效
  981.           battler.target.push(enemy)
  982.         end
  983.  
  984.       when 6  # 己方全体 (HP 0)
  985.         for enemy in $game_troop.enemies
  986.           if enemy != nil# and enemy.hp0?# 复活类特技/道具对生存者有效
  987.             battler.target.push(enemy)
  988.           end
  989.         end
  990. battler.target -=[battler] if battler.current_action.self_exclusion        
  991.       when 7  # 使用者
  992.         battler.target.push(battler)
  993.       when 8  # 全域化
  994.         for enemy in $game_troop.enemies
  995.           if enemy.exist?
  996.             battler.target.push(enemy)
  997.           end
  998.         end
  999.       for actor in $game_party.actors
  1000.           if actor.exist?
  1001.             battler.target.push(actor)
  1002.           end
  1003.         end
  1004. battler.target -=[battler] if battler.current_action.self_exclusion        
  1005.      when 9  # 敌方随机
  1006. battler.target.push(battler) if battler.current_action.self_inclusion        
  1007.              for actor in $game_party.actors
  1008.           if actor.exist?
  1009.             battler.target = [$game_party.random_target_actor]
  1010.           end
  1011.         end
  1012.  
  1013.           when 10  # 己方随机
  1014.         for enemy in $game_troop.enemies
  1015.           if enemy.exist?
  1016.             battler.target.push(enemy)
  1017.           end
  1018.         end
  1019. battler.target -=[battler] if battler.current_action.self_exclusion
  1020. battler.target = [battler.target[rand(battler.target.size)]]
  1021.         when 11 #对象随机
  1022.       battler.target = []
  1023.         for enemy in $game_troop.enemies
  1024.           if enemy.exist?
  1025.             battler.target.push(enemy)
  1026.           end
  1027.         end
  1028.       for actor in $game_party.actors
  1029.           if actor.exist?
  1030.             battler.target.push(actor)
  1031.           end
  1032.         end
  1033. battler.target -=[battler] if battler.current_action.self_exclusion        
  1034. battler.target = [battler.target[rand(battler.target.size)]]         
  1035.       end
  1036.     end
  1037.  
  1038.  
  1039.     #行动方战斗者是己方的情况
  1040.     if battler.is_a?(Game_Actor)
  1041.       # 效果范围的分歧
  1042.       case scope
  1043.       when 1  # 敌单体
  1044.  
  1045.         index = battler.current_action.target_index
  1046.         battler.target.push($game_troop.smooth_target_enemy(index))
  1047. battler.target.push(battler) if battler.current_action.self_inclusion         
  1048.       when 2  # 敌全体
  1049.  
  1050.         for enemy in $game_troop.enemies
  1051.           if enemy.exist?
  1052.             battler.target.push(enemy)
  1053.           end
  1054.         end
  1055. battler.target.push(battler) if battler.current_action.self_inclusion        
  1056.       when 3  # 己方单体
  1057.  
  1058.         index = battler.current_action.target_index
  1059.         battler.target.push($game_party.smooth_target_actor(index))
  1060.  
  1061.       when 4  # 己方全体
  1062.         for actor in $game_party.actors
  1063.           if actor.exist?
  1064.             battler.target.push(actor)
  1065.           end
  1066.         end
  1067. battler.target -=[battler] if battler.current_action.self_exclusion        
  1068.       when 5  # 己方单体 (HP 0)
  1069.  
  1070.         index = battler.current_action.target_index
  1071.         actor = $game_party.actors[index]
  1072.         if actor != nil# and actor.hp0?# 复活类特技/道具对生存者有效
  1073.           battler.target.push(actor)
  1074.         end
  1075.  
  1076.       when 6  # 己方全体 (HP 0)
  1077.         for actor in $game_party.actors
  1078.           if actor != nil# and actor.hp0?# 复活类特技/道具对生存者有效
  1079.             battler.target.push(actor)
  1080.           end
  1081.         end
  1082. battler.target -=[battler] if battler.current_action.self_exclusion        
  1083.       when 7  # 使用者
  1084.         battler.target.push(battler)
  1085.       when 8  # 全域化
  1086.         for enemy in $game_troop.enemies
  1087.           if enemy.exist?
  1088.             battler.target.push(enemy)
  1089.           end
  1090.         end
  1091.       for actor in $game_party.actors
  1092.           if actor.exist?
  1093.             battler.target.push(actor)
  1094.           end
  1095.         end            
  1096. battler.target -=[battler] if battler.current_action.self_exclusion
  1097.      when 9  # 敌方随机
  1098.  
  1099.         for enemy in $game_troop.enemies
  1100.           if enemy.exist?
  1101.             battler.target = [$game_troop.random_target_enemy]
  1102.           end
  1103.         end
  1104. battler.target.push(battler) if battler.current_action.self_inclusion         
  1105.       when 10  # 己方随机
  1106.       for actor in $game_party.actors
  1107.           if actor.exist?
  1108.             battler.target.push(actor)
  1109.           end
  1110.         end      
  1111. battler.target -=[battler] if battler.current_action.self_exclusion
  1112. battler.target = [battler.target[rand(battler.target.size)]]
  1113.         when 11 #对象随机
  1114.       battler.target = []
  1115.         for enemy in $game_troop.enemies
  1116.           if enemy.exist?
  1117.             battler.target.push(enemy)
  1118.           end
  1119.         end
  1120.       for actor in $game_party.actors
  1121.           if actor.exist?
  1122.             battler.target.push(actor)
  1123.           end
  1124.         end
  1125. battler.target -=[battler] if battler.current_action.self_exclusion
  1126. battler.target = [battler.target[rand(battler.target.size)]]
  1127. end
  1128. end
  1129. end   
  1130. #--------------------------------------------------------------------------
  1131. # ● 生成特技行动结果
  1132. #--------------------------------------------------------------------------
  1133.   alias xrxs19_make_skill_action_result make_skill_action_result
  1134.     def make_skill_action_result(battler, plus_id)
  1135.     # 获取特技
  1136.     @skill = $data_skills[battler.current_action.skill_id + plus_id]
  1137.     # 获取行动者特技附加的战斗特效
  1138.     battler.set_xrxs19_special_effect(battler.skill_element_set(@skill))
  1139.     # 行动时附加自身状态
  1140.           if battler.current_action.p_state > 0
  1141.         battler.pp_state(battler,battler.current_action.p_state)
  1142.       end
  1143.     # 行动时解除自身状态  
  1144.       if battler.current_action.m_state > 0
  1145.         battler.remove_state(battler.current_action.m_state)
  1146.       end
  1147.     # recall
  1148.     xrxs19_make_skill_action_result(battler, plus_id)
  1149.   end
  1150. #--------------------------------------------------------------------------
  1151. # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  1152. #--------------------------------------------------------------------------
  1153.   alias xrxs19_update_phase4_step5 update_phase4_step5
  1154.   def update_phase4_step5(battler)
  1155.     # recall
  1156.     xrxs19_update_phase4_step5(battler)
  1157.     # 行动者伤害表示(HP/SP吸收的表示用)
  1158.     if battler.damage[battler] != nil or
  1159.        battler.damage_sp[battler] != nil
  1160.        battler.damage_pop[battler] = true
  1161.     # 行动者状态栏刷新
  1162.       status_refresh(battler)
  1163.     end
  1164.   end
  1165. end
  1166. #==============================================================================
  1167. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1168. #==============================================================================



RTAB特殊状态[魔法反射]
RUBY 代码复制
  1. # ▼▲▼ XRXS27. 特殊効果 SuperEX「魔法反射」 ver.1.03 ▼▲▼
  2. # by 桜雅 在土, clum-sea
  3.  
  4. #==============================================================================
  5. # □ カスタマイズポイント
  6. #==============================================================================
  7. class Scene_Battle
  8.   MAGIC_REFREX_STATE_NAME         = "魔法反射"   # 「魔法反射」状态名
  9.   MAGIC_REFREX_ANIMATION_ID       =  64          #  魔法反射的动画ID
  10.   REFREX_PENETRATION_ELEMENT_NAME = "魔法贯通"   # 「反射貫通」属性名
  11. end
  12. class Scene_Battle
  13.   #--------------------------------------------------------------------------
  14.   # ○ スキルが魔法であるかどうか
  15.   #--------------------------------------------------------------------------
  16.   def skill_is_a_magic?(skill)
  17.     return false unless skill.is_a?(RPG::Skill)
  18.     return (skill.int_f > skill.str_f)
  19.   end
  20. end
  21.  
  22. #=============================================================================
  23. # ◇ 「魔法反射」ステート by 桜雅 在土
  24. #=============================================================================
  25. class Scene_Battle
  26.   #--------------------------------------------------------------------------
  27.   # ● スキルまたはアイテムの対象側バトラー設定
  28.   #--------------------------------------------------------------------------
  29.   alias xrxs_magic_refrex_set_target_battlers set_target_battlers
  30.   def set_target_battlers(scope,battler)
  31.     xrxs_magic_refrex_set_target_battlers(scope,battler)
  32.     # スキル使用時
  33.     if battler.current_action.kind == 1
  34.       # 魔法である場合
  35.       if skill_is_a_magic?(@skill)
  36.         element_id = get_refrex_penetration_id
  37.         # スキルに反射貫通が付加されているか。
  38.         skill_state_penetration(@skill, element_id, battler)
  39.         if battler.penetration != true
  40.           # 検索
  41.           for target in battler.target.dup
  42.             # 魔法反射ステートにかかっているか?
  43.             state_id = get_magical_refrex_id
  44.             if state_id != nil and target.state?(state_id)
  45.               # 反射---
  46.               target.refrexed = true
  47.               battler.target.delete(target)
  48.               unless battler.target.include?(battler)
  49.                 battler.target.push(battler)
  50.               end
  51.               # ---反射の設定完了
  52.             end
  53.           end
  54.         end
  55.       end
  56.     end
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● スキルに反射貫通属性が付加されているか
  60.   #--------------------------------------------------------------------------
  61.   def skill_state_penetration(skill, element_id, user)
  62.     if skill.element_set.include?(element_id)
  63.       # 反射フラグリセット
  64.       user.refrexed = false
  65.       # 貫通フラグをセット
  66.       user.penetration = true
  67.     end
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  71.   #--------------------------------------------------------------------------
  72.   alias xrxs_magic_refrex_update_phase4_step4 update_phase4_step4
  73.   def update_phase4_step4(battler)
  74.     # 対象側アニメーション
  75.     xrxs_magic_refrex_update_phase4_step4(battler)
  76.     # 魔法反射(貫通しない場合)
  77.     for target in $game_party.actors + $game_troop.enemies - battler.target
  78.       next if target.refrexed == nil or target.refrexed == false
  79.     #  target.animation_id = MAGIC_REFREX_ANIMATION_ID
  80.     #  target.animation_hit = (target.damage != "Miss")
  81.       target.animation.push([MAGIC_REFREX_ANIMATION_ID,
  82.                                           (target.damage[battler] != "Miss")])
  83.       # 反射フラグリセット
  84.       target.refrexed = false
  85.     end
  86.     for target in battler.target
  87.       # 反射フラグリセット
  88.       target.refrexed = false
  89.     end
  90.     # 貫通フラグリセット
  91.     battler.penetration = false
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ○ 魔法反射ステートのID取得
  95.   #--------------------------------------------------------------------------
  96.   def get_magical_refrex_id
  97.     if @xrxs27_magic_refrex_state_id == nil
  98.       result = nil
  99.       for i in 1 ... $data_states.size
  100.         if $data_states[i].name[/\A#{MAGIC_REFREX_STATE_NAME}\Z/]
  101.           result = $data_states[i].id
  102.           break
  103.         end
  104.       end
  105.       @xrxs27_magic_refrex_state_id = result
  106.     end
  107.     return @xrxs27_magic_refrex_state_id
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ○ 反射貫通属性のID取得
  111.   #--------------------------------------------------------------------------
  112.   def get_refrex_penetration_id
  113.     if @xrxs27_refrex_penetration_element_id == nil
  114.       result = nil
  115.       for i in 1 ... $data_system.elements.size
  116.         if $data_system.elements[i] == REFREX_PENETRATION_ELEMENT_NAME
  117.           result = i
  118.           break
  119.         end
  120.       end
  121.       @xrxs27_refrex_penetration_element_id = result
  122.     end
  123.     return @xrxs27_refrex_penetration_element_id
  124.   end
  125. end
  126. #==============================================================================
  127. # ■ Game_Battler
  128. #==============================================================================
  129. class Game_Battler
  130.   attr_accessor :refrexed
  131.   attr_accessor :penetration
  132. end



容错
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 容错脚本第3版                                              BY 轮回者
  3. #------------------------------------------------------------------------------
  4. #  本脚本基于星大叔的容错脚本第2版,区别只是“下手”的地方不同而已。
  5. #  说明请参看星大叔的容错脚本第2版。
  6. #==============================================================================
  7.  
  8. $need_file_bitmap = []
  9. if FileTest.exist?("log_bitmap.txt")
  10. f = File.open("./log_bitmap.txt","r")
  11. $need_file_bitmap = f.read.split(/\n/)
  12. f.close
  13. end
  14.  
  15. module Graphics
  16. @transition = method("transition")
  17. def self.transition(*arg)
  18.    begin
  19.      @transition.call(*arg)
  20.    rescue Errno::ENOENT
  21.      ary=[*arg]
  22.      filename=ary[1]
  23.      unless $need_file_bitmap.include?(filename)
  24.        $need_file_bitmap.push(filename)
  25.        f = File.open("./log_bitmap.txt","a")
  26.        f.write(filename + "\n")
  27.        f.close
  28.      end
  29.      @transition.call(ary[0])
  30.    end
  31. end
  32. end
  33.  
  34. class Bitmap < Object
  35. alias ini initialize
  36. def initialize(*arg)
  37.    begin
  38.      ini(*arg)
  39.    rescue Errno::ENOENT
  40.      filename=[*arg][0]
  41.      unless $need_file_bitmap.include?(filename)
  42.        $need_file_bitmap.push(filename)
  43.        f = File.open("./log_bitmap.txt","a")
  44.        f.write(filename + "\n")
  45.        f.close
  46.      end
  47.      ini(32,32)
  48.    end
  49. end
  50. end
  51.  
  52. $need_file_audio = []
  53. if FileTest.exist?("log_audio.txt")
  54. f = File.open("./log_audio.txt","r")
  55. $need_file_audio = f.read.split(/\n/)
  56. f.close
  57. end
  58.  
  59. module Audio
  60. @me_play = method("me_play")
  61. def self.me_play(*arg)
  62.    begin
  63.      @me_play.call(*arg)
  64.    rescue Errno::ENOENT
  65.      filename=[*arg][0]
  66.      unless $need_file_audio.include?(filename)
  67.        $need_file_audio.push(filename)
  68.        f = File.open("./log_audio.txt","a")
  69.        f.write(filename + "\n")
  70.        f.close
  71.      end
  72.      me_stop
  73.    end
  74. end
  75. @bgm_play = method("bgm_play")
  76. def self.bgm_play(*arg)
  77.    begin
  78.      @bgm_play.call(*arg)
  79.    rescue Errno::ENOENT
  80.      filename=[*arg][0]
  81.      unless $need_file_audio.include?(filename)
  82.        $need_file_audio.push(filename)
  83.        f = File.open("./log_audio.txt","a")
  84.        f.write(filename + "\n")
  85.        f.close
  86.      end
  87.      bgm_stop
  88.    end
  89. end
  90. @se_play = method("se_play")
  91. def self.se_play(*arg)
  92.    begin
  93.      @se_play.call(*arg)
  94.    rescue Errno::ENOENT
  95.      filename=[*arg][0]
  96.      unless $need_file_audio.include?(filename)
  97.        $need_file_audio.push(filename)
  98.        f = File.open("./log_audio.txt","a")
  99.        f.write(filename + "\n")
  100.        f.close
  101.      end
  102.      se_stop
  103.    end
  104. end
  105. @bgs_play = method("bgs_play")
  106. def self.bgs_play(*arg)
  107.    begin
  108.      @bgs_play.call(*arg)
  109.    rescue Errno::ENOENT
  110.      filename=[*arg][0]
  111.      unless $need_file_audio.include?(filename)
  112.        $need_file_audio.push(filename)
  113.        f = File.open("./log_audio.txt","a")
  114.        f.write(filename + "\n")
  115.        f.close
  116.      end
  117.      bgs_stop
  118.    end
  119. end
  120. end










欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1