查看: 1364|回复: 5

[已经解决] 如何以速度来决定行动顺序

[复制链接]
梦石
0
星屑
50
在线时间
10 小时
注册时间
2015-10-23
回帖
3
发表于 2015-10-23 23:03:29 | 显示全部楼层 |阅读模式

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

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

×
RMXP里面的默认战斗系统中,敌人的速度慢于我方,但是又在我方之前出手。
本人小白一只,想只以敌我之间的速度快慢来决定出手顺序(速度快先行动),欲请教一下高手。

素材区好人

梦石
5
星屑
12712
在线时间
4359 小时
注册时间
2011-7-21
回帖
2270

超评测参与极短28参与极短27参与极短26参与极短25参与极短24参与极短23参与极短22参与极短21参与

发表于 2015-10-23 23:32:25 | 显示全部楼层
你的意思的半即时吗?
  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. # ■ Window_BattleStatus
  275. #========================================================================
  276. class Window_BattleStatus < Window_Base
  277.   #-----------------------------------------------------------------------
  278.   # ○ 公開インスタンス変数
  279.   #----------------------------------------------------------------------
  280.   attr_accessor :update_cp_only # CPメーターのみの更新
  281.   #----------------------------------------------------------------------
  282.   # ● オブジェクト初期化
  283.   #----------------------------------------------------------------------
  284.   alias xrxs_bp1_initialize initialize
  285.   def initialize
  286.     @update_cp_only = false
  287.     @wall = Window_All.new
  288.     xrxs_bp1_initialize
  289.   end
  290.   def dispose
  291.     super
  292.     @wall.dispose
  293.   end
  294.   #----------------------------------------------------------------------
  295.   # ● リフレッシュ
  296.   #----------------------------------------------------------------------
  297.   alias xrxs_bp1_refresh refresh
  298.   def refresh
  299.     unless @update_cp_only
  300.       xrxs_bp1_refresh
  301.     end
  302.     refresh_cp
  303.     @wall.refresh
  304.   end
  305.   #----------------------------------------------------------------------
  306.   # ○ リフレッシュ(CPのみ)
  307.   #----------------------------------------------------------------------
  308.   def refresh_cp
  309.     for i in 0...$game_party.actors.size
  310.       actor = $game_party.actors[i]
  311.       width = [self.width*3/4 / XRXS_BP1::MAX, 80].max
  312.       space = self.width / XRXS_BP1::MAX
  313.       case XRXS_BP1::ALIGN
  314.       when 0
  315.         actor_x = i * space + 4
  316.       when 1
  317.         actor_x = (space * ((XRXS_BP1::MAX - $game_party.actors.size)/2.0 + i)).floor
  318.       when 2
  319.         actor_x = (i + XRXS_BP1::MAX - $game_party.actors.size) * space + 4
  320.       end
  321.       actor_x += self.x
  322.       draw_actor_cp_meter(actor, actor_x, 96, width, 0)
  323.     end
  324.   end
  325. #----------------------------------------------------------------------
  326.   # ○ CPメーター の描画
  327.   #----------------------------------------------------------------------
  328. # def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
  329. def draw_actor_cp_meter(actor, x, y, width = 144, type = 0)
  330.     self.contents.font.color = system_color
  331.     self.contents.fill_rect(x, y+27, width+4,6, Color.new(0, 0, 0, 255))
  332.     self.contents.fill_rect(x+1, y+28, width+2,4, Color.new(192, 220, 192, 255))
  333.     self.contents.fill_rect(x+2, y+29, width,2, Color.new(30, 30, 0, 255))
  334.     if actor.cp == nil
  335.       actor.cp = 0
  336.     end
  337.     w = width * [actor.cp,65535].min / 65535
  338.    # self.contents.fill_rect(x+1, y+28, w,1, Color.new(255, 255, 128, 255))
  339.    # self.contents.fill_rect(x+1, y+29, w,1, Color.new(255, 255, 0, 255))
  340.     self.contents.fill_rect(x+2, y+29, w,1, Color.new(0, 192, 0, 255))
  341.     self.contents.fill_rect(x+2, y+30, w,1, Color.new(0, 128, 0, 255))
  342.   end  
  343. end

  344. #========================================================================
  345. # ■ Scene_Battle
  346. #========================================================================
  347. class Scene_Battle
  348.   #----------------------------------------------------------------------
  349.   # ● フレーム更新
  350.   #----------------------------------------------------------------------
  351.   alias xrxs_bp1_update update
  352.   def update
  353.     xrxs_bp1_update
  354.     # CP更新
  355.     @cp_thread.update
  356.   end
  357.   #----------------------------------------------------------------------
  358.   # ● バトル終了
  359.   # result : 結果 (0:勝利 1:敗北 2:逃走)
  360.   #----------------------------------------------------------------------
  361.   alias xrxs_bp1_battle_end battle_end
  362.   def battle_end(result)
  363.     # CPカウントを停止する
  364.     @cp_thread.stop
  365.     # 呼び戻す
  366.     xrxs_bp1_battle_end(result)
  367.   end
  368.   #----------------------------------------------------------------------
  369.   # ● プレバトルフェーズ開始
  370.   #----------------------------------------------------------------------
  371.   alias xrxs_bp1_start_phase1 start_phase1
  372.   def start_phase1
  373.     @agi_total = 0
  374.     # CP加算を開始する
  375.     @cp_thread = Scene_Battle_CP.new
  376.     # インデックスを計算
  377.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  378.     # アクターコマンドウィンドウに追加
  379.     @actor_command_window.add_command("逃跑")
  380.     if !$game_temp.battle_can_escape
  381.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  382.     end
  383.     # 呼び戻す
  384.     xrxs_bp1_start_phase1
  385.   end
  386.   #----------------------------------------------------------------------
  387.   # ● パーティコマンドフェーズ開始
  388.   #----------------------------------------------------------------------
  389.   alias xrxs_bp1_start_phase2 start_phase2
  390.   def start_phase2
  391.     xrxs_bp1_start_phase2
  392.     @party_command_window.active = false
  393.     @party_command_window.visible = false
  394.     # CP加算を再開する
  395.     @cp_thread.stop = false
  396.     # 次へ
  397.     start_phase3
  398.   end
  399.   #----------------------------------------------------------------------
  400.   # ● アクターコマンドウィンドウのセットアップ
  401.   #----------------------------------------------------------------------
  402.   alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
  403.   def phase3_setup_command_window
  404.     # CPスレッドを一時停止する
  405.     @cp_thread.stop = true
  406.     # ウィンドウのCP更新
  407.     @status_window.refresh_cp
  408.     # @active_battlerの防御を解除
  409.     @active_battler.now_guarding = false
  410.     # 効果音の再生
  411.     Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE != ""
  412.     # 呼び戻す
  413.     xrxs_bp1_phase3_setup_command_window
  414.   end
  415.   #----------------------------------------------------------------------
  416.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  417.   #----------------------------------------------------------------------
  418.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  419.   def update_phase3_basic_command
  420.     # C ボタンが押された場合
  421.     if Input.trigger?(Input::C)
  422.       # アクターコマンドウィンドウのカーソル位置で分岐
  423.       case @actor_command_window.index
  424.       when @cp_escape_actor_command_index # 逃げる
  425.         if $game_temp.battle_can_escape
  426.           # 決定 SE を演奏
  427.           $game_system.se_play($data_system.decision_se)
  428.           # アクションを設定
  429.           @active_battler.current_action.kind = 0
  430.           @active_battler.current_action.basic = 4
  431.           # 次のアクターのコマンド入力へ
  432.           phase3_next_actor
  433.         else
  434.           # ブザー SE を演奏
  435.           $game_system.se_play($data_system.buzzer_se)
  436.         end
  437.         return
  438.       end
  439.     end
  440.     xrxs_bsp1_update_phase3_basic_command
  441.   end
  442.   #----------------------------------------------------------------------
  443.   # ● メインフェーズ開始
  444.   #----------------------------------------------------------------------
  445.   alias xrxs_bp1_start_phase4 start_phase4
  446.   def start_phase4
  447.     # 呼び戻す
  448.     xrxs_bp1_start_phase4
  449.     # CPスレッドを一時停止する
  450.     unless @action_battlers.empty?
  451.       @cp_thread.stop = true
  452.     end
  453.   end
  454.   #----------------------------------------------------------------------
  455.   # ● 行動順序作成
  456.   #----------------------------------------------------------------------
  457.   alias xrxs_bp1_make_action_orders make_action_orders
  458.   def make_action_orders
  459.     xrxs_bp1_make_action_orders
  460.     # 全員のCPを確認
  461.     exclude_battler = []
  462.     for battler in @action_battlers
  463.       # CPが不足している場合は @action_battlers から除外する
  464.       if battler.cp < 65535
  465.         exclude_battler.push(battler)
  466.       end
  467.     end
  468.     @action_battlers -= exclude_battler
  469.   end
  470.   #----------------------------------------------------------------------
  471.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  472.   #----------------------------------------------------------------------
  473.   alias xrxs_bp1_update_phase4_step1 update_phase4_step1
  474.   def update_phase4_step1
  475.     # 初期化
  476.     @phase4_act_continuation = 0
  477.     # 勝敗判定
  478.     if judge
  479.       @cp_thread.stop
  480.       # 勝利または敗北の場合 : メソッド終了
  481.       return
  482.     end
  483.     # 未行動バトラー配列の先頭から取得
  484.     @active_battler = @action_battlers[0]
  485.     # ステータス更新をCPだけに限定。
  486.     @status_window.update_cp_only = true
  487.     # ステート更新を禁止。
  488.     @active_battler.slip_state_update_ban = true if @active_battler != nil
  489.     # 戻す
  490.     xrxs_bp1_update_phase4_step1
  491.     # @status_windowがリフレッシュされなかった場合は手動でリフレッシュ(CPのみ)
  492.     if @phase4_step != 2
  493.       # リフレッシュ
  494.       @status_window.refresh
  495.       # 軽量化:たったコレだけΣ(?w?
  496.       Graphics.frame_reset
  497.     end
  498.     # 禁止を解除
  499.     @status_window.update_cp_only = false
  500.     @active_battler.slip_state_update_ban = false if @active_battler != nil
  501.   end
  502.   #----------------------------------------------------------------------
  503.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  504.   #----------------------------------------------------------------------
  505.   alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  506.   def update_phase4_step2
  507.     # 強制アクションでなければ
  508.     unless @active_battler.current_action.forcing
  509.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  510.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  511.         # アクションに攻撃を設定
  512.         @active_battler.current_action.kind = 0
  513.         @active_battler.current_action.basic = 0
  514.       end
  515.       # 制約が [行動できない] の場合
  516.       if @active_battler.restriction == 4
  517.         # アクション強制対象のバトラーをクリア
  518.         $game_temp.forcing_battler = nil
  519.         if @phase4_act_continuation == 0 and @active_battler.cp >= 65535
  520.           # ステート自然解除
  521.           @active_battler.remove_states_auto
  522.           # CP消費
  523.           @active_battler.cp -= 65535
  524.           # ステータスウィンドウをリフレッシュ
  525.           @status_window.refresh
  526.         end
  527.         # ステップ 1 に移行
  528.         @phase4_step = 1
  529.         return
  530.       end
  531.     end
  532.     # アクションの種別で分岐
  533.     case @active_battler.current_action.kind
  534.     when 0
  535.       # 攻撃?防御?逃げる?何もしない時の共通消費CP
  536.       @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
  537.     when 1
  538.       # スキル使用時の消費CP
  539.       @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
  540.     when 2
  541.       # アイテム使用時の消費CP
  542.       @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
  543.     end
  544.     # ステート自然解除
  545.     @active_battler.remove_states_auto
  546.     # 呼び戻す
  547.     xrxs_bp1_update_phase4_step2
  548.   end
  549.   #----------------------------------------------------------------------
  550.   # ● 基本アクション 結果作成
  551.   #----------------------------------------------------------------------
  552.   alias xrxs_bp1_make_basic_action_result make_basic_action_result
  553.   def make_basic_action_result
  554.     # 攻撃の場合
  555.     if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
  556.       @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
  557.     end
  558.     # 防御の場合
  559.     if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
  560.       @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
  561.       # @active_battlerの防御をON
  562.       @active_battler.now_guarding = true
  563.     end
  564.     # 敵の逃げるの場合
  565.     if @active_battler.is_a?(Game_Enemy) and
  566.         @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
  567.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  568.     end
  569.     # 何もしないの場合
  570.     if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
  571.       @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
  572.     end
  573.     # 逃げるの場合
  574.     if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
  575.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  576.       # 逃走可能ではない場合
  577.       if $game_temp.battle_can_escape == false
  578.         # ブザー SE を演奏
  579.         $game_system.se_play($data_system.buzzer_se)
  580.         return
  581.       end
  582.       # 逃走処理
  583.       update_phase2_escape
  584.       return
  585.     end
  586.     # 呼び戻す
  587.     xrxs_bp1_make_basic_action_result
  588.   end
  589.   #----------------------------------------------------------------------
  590.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  591.   #----------------------------------------------------------------------
  592.   alias xrxs_bp1_update_phase4_step6 update_phase4_step6
  593.   def update_phase4_step6
  594.     # スリップダメージ
  595.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  596.       @active_battler.slip_damage_effect
  597.       @active_battler.damage_pop = true
  598.       # ステータスウィンドウをリフレッシュ
  599.       @status_window.refresh
  600.     end
  601.     # 呼び戻す
  602.     xrxs_bp1_update_phase4_step6
  603.   end
  604. end
  605. #======================================================================
  606. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  607. #======================================================================
复制代码

点评

好吧,理解错了  发表于 2015-10-24 12:43
不不不,我是想用回合制,谢谢您的回答  发表于 2015-10-24 11:39

评分

参与人数 1梦石 +1 收起 理由
myownroc + 1 感谢对xp区的支持,我是说我不在的时候替我.

查看全部评分

回复

使用道具 举报

梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

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

其中的agi表示速度,这里明显看到后面还有个偏移值,如果想让速度完全决定行动顺序,就删掉rand(10 + agi / 4)

评分

参与人数 1星屑 +150 收起 理由
无忧谷主幻 + 150 认可答案(虽然不应该由我来发).

查看全部评分

回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-10-24 01:11:18 | 显示全部楼层
搜索cp比较好。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
10 小时
注册时间
2015-10-23
回帖
3
 楼主| 发表于 2015-10-24 11:42:21 | 显示全部楼层
RyanBern 发表于 2015-10-23 23:34
默认战斗系统行动的顺序和战斗者的速度(AGI)有非常强的关系,但是并不意味着速度大的一定先行动。这是因 ...

问题解决了,十分感谢您的帮助
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2015-10-26 22:02:32 | 显示全部楼层
给你。RTAB战斗系统,就是你说的用速度决定的那个。
我下载的原件已经找不到了。这是我从我工程里挖的。




RTAB战斗系统 Ver 1.16 我改了毒
  1. # リアルタイム・アクティブバトル(RTAB) Ver 1.16
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

  4. class Scene_Battle
  5.   #--------------------------------------------------------------------------
  6.   # ● 公開インスタンス変数
  7.   #--------------------------------------------------------------------------
  8.   attr_reader   :status_window            # ステータスウィンドウ
  9.   attr_reader   :spriteset                # バトルスプライト
  10.   attr_reader   :scroll_time              # スクリーン移動基本時間
  11.   attr_reader   :zoom_rate                # 敵バトラー基本位置
  12.   attr_reader   :drive                    # カメラ駆動
  13.   attr_accessor :force                    # アクション強制度
  14.   attr_accessor :camera                   # 現在のカメラ所持者
  15.   #--------------------------------------------------------------------------
  16.   # ● ATB基礎セットアップ
  17.   #--------------------------------------------------------------------------
  18.   def atb_setup
  19.     # ATB初期化
  20.     # speed   : バトルスピード決定。値が小さいほど早い
  21.     # @active : アクティブ度設定
  22.     #           3 : 常にアクティブ状態
  23.     #           2 : スキル・アイテム選択中のみアクティブゲージが止まる
  24.     #           1 : 2の状態に加え、ターゲット選択時もウェイトが掛かる
  25.     #           0 : 1の状態に加え、コマンド入力時にもウェイトが掛かる
  26.     # @action : 他人が行動中に自分も行動を起こすことを許すか
  27.     #           3 : 自分が行動不能でない限り限り許す
  28.     #           2 : 自分がダメージを受けていない限り許す
  29.     #           1 : 2の状態に加え、ターゲットが行動していない限り許す
  30.     #           0 : 行動を許さない。順番に行動し終えるまで待つ
  31.     # @anime_wait : trueにするとバトルアニメ・ダメージ表示中はウェイトが掛かる
  32.     # @damage_wait : ダメージ表示待ち時間(単位はフレーム)
  33.     # @after_wait : 味方・敵全滅時、次の処理に移るまでの待ち時間
  34.     #               [a, b] a は味方全滅時、b は敵全滅時(単位はフレーム)
  35.     # @enemy_speed : 敵の思考速度。1なら即時行動。
  36.     #                1フレーム毎に、1/@enemy_speedの確率で行動を起こす
  37.     # @force : 強制アクションでスキル使用時の強制具合
  38.     #          2:スキルは全て詠唱せず、必ず即時実行
  39.     #          1:単独スキルは詠唱し、連携スキルのみ即時実行
  40.     #          0:全スキル詠唱を行うだけ
  41.     # ($scene.force = x とすることにより、通常イベントのスクリプトから変更可能)
  42.     # @drive : カメラ駆動ON/OFF。trueで駆動ON、falseで駆動OFF
  43.     # @scroll_time : スクリーン移動に要する基本時間
  44.     # @zoom_rate = [i, j] : エネミーのズーム率
  45.     #                       i が画面最上部に配置した時の拡大率
  46.     #                       j が画面最下部に配置した時の拡大率
  47.     #                       1 倍としたいときも、1.0 と必ず小数で設定すること
  48.     speed = 100
  49.     @active = 1
  50.     @action = 0
  51.     @anime_wait = false
  52.     @damage_wait = 10
  53.     @after_wait = [80, 0]
  54.     @enemy_speed = 40
  55.     @force = 2
  56.     @drive = true
  57.     @scroll_time = 15
  58.     @zoom_rate = [0.2, 1.0]
  59.     @help_time = 40
  60.     @escape == false
  61.     @camera = nil
  62.     @max = 0
  63.     @turn_cnt = 0
  64.     @help_wait = 0
  65.     @action_battlers = []
  66.     @synthe = []
  67.     @spell_p = {}
  68.     @spell_e = {}
  69.     @command_a = false
  70.     @command = []
  71. #------------------------------------------------------------------------------   
  72. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  73. #    @party = false
  74. #------------------------------------------------------------------------------
  75.     for battler in $game_party.actors + $game_troop.enemies
  76.       spell_reset(battler)
  77.       battler.at = battler.agi * rand(speed / 2)
  78.       battler.damage_pop = {}
  79.       battler.damage = {}
  80.       battler.damage_sp = {}
  81.       battler.critical = {}
  82.       battler.recover_hp = {}
  83.       battler.recover_sp = {}
  84.       battler.state_p = {}
  85.       battler.state_m = {}
  86.       battler.animation = []
  87.       if battler.is_a?(Game_Actor)
  88.         @max += battler.agi
  89.       end
  90.     end
  91.     @max *= speed
  92.     @max /= $game_party.actors.size
  93.     for battler in $game_party.actors + $game_troop.enemies
  94.       battler.atp = 100 * battler.at / @max
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● ATゲージMax時SE
  99.   #--------------------------------------------------------------------------
  100.   def fullat_se
  101.     Audio.se_play("Audio/SE/033-switch02", 80, 100)
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● レベルアップSE
  105.   #--------------------------------------------------------------------------
  106.   def levelup_se
  107.     Audio.se_play("Audio/SE/056-Right02", 80, 100)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● スキル習得SE
  111.   #--------------------------------------------------------------------------
  112.   def skill_se
  113.     Audio.se_play("Audio/SE/056-Right02", 80, 150)
  114.   end
  115. end

  116. class Window_Base < Window
  117.   #--------------------------------------------------------------------------
  118.   # ● ATG の描画
  119.   #     actor : アクター
  120.   #     x     : 描画先 X 座標
  121.   #     y     : 描画先 Y 座標
  122.   #     width : 描画先の幅
  123.   #--------------------------------------------------------------------------
  124.   def draw_actor_atg(actor, x, y, width = 144)
  125.     if @at_gauge == nil
  126.       # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  127.       # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  128.       # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  129.       # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  130.       # align3:ゲージタイプ 0:左詰め 1:右詰め
  131.       @plus_x = 0
  132.       @rate_x = 0
  133.       @plus_y = 16
  134.       @plus_width = 0
  135.       @rate_width = 100
  136.       @width = @plus_width + width * @rate_width / 100
  137.       @height = 16
  138.       @align1 = 0
  139.       @align2 = 1
  140.       @align3 = 0
  141.       # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  142.       # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション)
  143.       grade1 = 1
  144.       grade2 = 0
  145.       # 色設定。color1:最外枠,color2:中枠
  146.       # color3:空枠ダークカラー,color4:空枠ライトカラー
  147.       color1 = Color.new(0, 0, 0)
  148.       color2 = Color.new(255, 255, 192)
  149.       color3 = Color.new(0, 0, 0, 192)
  150.       color4 = Color.new(0, 0, 64, 192)
  151.       # ゲージの色設定
  152.       # 通常時の色設定
  153.       color5 = Color.new(0, 64, 80)
  154.       color6 = Color.new(0, 128, 160)
  155.       # ゲージがMAXの時の色設定
  156.       color7 = Color.new(80, 0, 0)
  157.       color8 = Color.new(240, 0, 0)
  158.       # 連携スキル使用時の色設定
  159.       color9 = Color.new(80, 64, 32)
  160.       color10 = Color.new(240, 192, 96)
  161.       # スキル詠唱時の色設定
  162.       color11 = Color.new(80, 0, 64)
  163.       color12 = Color.new(240, 0, 192)
  164.       # ゲージの描画
  165.       gauge_rect_at(@width, @height, @align3, color1, color2,
  166.                   color3, color4, color5, color6, color7, color8,
  167.                   color9, color10, color11, color12, grade1, grade2)
  168.     end
  169.     # 変数atに描画するゲージの幅を代入
  170.     if actor.rtp == 0
  171.       at = (width + @plus_width) * actor.atp * @rate_width / 10000
  172.     else
  173.       at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
  174.     end
  175.     if at > width
  176.       at = width
  177.     end
  178.     # ゲージの左詰・中央構え等の補正
  179.     case @align1
  180.     when 1
  181.       x += (@rect_width - width) / 2
  182.     when 2
  183.       x += @rect_width - width
  184.     end
  185.     case @align2
  186.     when 1
  187.       y -= @height / 2
  188.     when 2
  189.       y -= @height
  190.     end
  191.     self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
  192.                       @at_gauge, Rect.new(0, 0, @width, @height))
  193.     if @align3 == 0
  194.       rect_x = 0
  195.     else
  196.       x += @width - at - 1
  197.       rect_x = @width - at - 1
  198.     end
  199.     # ゲージの色設定
  200.     if at == width
  201.         # MAX時のゲージ描画
  202.       self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  203.                         @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
  204.     else
  205.       if actor.rtp == 0
  206.         # 通常時のゲージ描画
  207.         self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  208.                           @at_gauge, Rect.new(rect_x, @height, at, @height))
  209.       else
  210.         if actor.spell == true
  211.           # 連携スキル使用時のゲージ描画
  212.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  213.                         @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
  214.         else
  215.           # スキル詠唱時のゲージ描画
  216.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  217.                         @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
  218.         end
  219.       end
  220.     end
  221.   end
  222. end

  223. #==============================================================================
  224. # ■ Scene_Battle (分割定義 1)
  225. #------------------------------------------------------------------------------
  226. #  バトル画面の処理を行うクラスです。
  227. #==============================================================================

  228. class Scene_Battle
  229.   #--------------------------------------------------------------------------
  230.   # ● メイン処理
  231.   #--------------------------------------------------------------------------
  232.   def main
  233.     # 戦闘用の各種一時データを初期化
  234.    # Graphics.frame_rate = 60
  235.     $game_temp.in_battle = true
  236.     $game_temp.battle_turn = 0
  237.     $game_temp.battle_event_flags.clear
  238.     $game_temp.battle_abort = false
  239.     $game_temp.battle_main_phase = false
  240.     $game_temp.battleback_name = $game_map.battleback_name
  241.     $game_temp.forcing_battler = nil
  242.     # バトルイベント用インタプリタを初期化
  243.     $game_system.battle_interpreter.setup(nil, 0)
  244.     # トループを準備
  245.     @troop_id = $game_temp.battle_troop_id
  246.     $game_troop.setup(@troop_id)
  247.     atb_setup
  248.     # アクターコマンドウィンドウを作成
  249. #==============================================================================
  250. #RTAB观光游第三站,战斗菜单增加逃跑选项
  251. #==============================================================================   
  252.     s1 = $data_system.words.attack
  253.     s2 = $data_system.words.skill
  254.     s3 = $data_system.words.guard
  255.     s4 = $data_system.words.item
  256.     s5 = "逃跑"
  257.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])   
  258. #   @actor_command_window.y = 160
  259.     @actor_command_window.y = 128
  260.     @actor_command_window.back_opacity = 160
  261.     @actor_command_window.active = false
  262.     @actor_command_window.visible = false
  263. #==============================================================================   
  264.     # その他のウィンドウを作成
  265. #------------------------------------------------------------------------------
  266. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  267. #    @party_command_window = Window_PartyCommand.new
  268. #------------------------------------------------------------------------------   
  269.     @help_window = Window_Help.new
  270.     @help_window.back_opacity = 160
  271.     @help_window.visible = false
  272.     @status_window = Window_BattleStatus.new
  273.     @message_window = Window_Message.new
  274.     # スプライトセットを作成
  275.     @spriteset = Spriteset_Battle.new
  276.     # ウェイトカウントを初期化
  277.     @wait_count = 0
  278.     # トランジション実行
  279.     if $data_system.battle_transition == ""
  280.       Graphics.transition(20)
  281.     else
  282.       Graphics.transition(40, "Graphics/Transitions/" +
  283.         $data_system.battle_transition)
  284.     end
  285.     # プレバトルフェーズ開始
  286.     start_phase1
  287.     # メインループ
  288.     loop do
  289.       # ゲーム画面を更新
  290.       Graphics.update
  291.       # 入力情報を更新
  292.       Input.update
  293.       # フレーム更新
  294.       update
  295.       # 画面が切り替わったらループを中断
  296.       if $scene != self
  297.         break
  298.       end
  299.     end
  300.     # マップをリフレッシュ
  301.     $game_map.refresh
  302.     # トランジション準備
  303.     Graphics.freeze
  304.     # ウィンドウを解放
  305.     @actor_command_window.dispose
  306. #------------------------------------------------------------------------------
  307. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  308. #    @party_command_window.dispose
  309. #------------------------------------------------------------------------------   
  310.     @help_window.dispose
  311.     @status_window.dispose
  312.     @message_window.dispose
  313.     if @skill_window != nil
  314.       @skill_window.dispose
  315.     end
  316.     if @item_window != nil
  317.       @item_window.dispose
  318.     end
  319.     if @result_window != nil
  320.       @result_window.dispose
  321.     end
  322.     # スプライトセットを解放
  323.     @spriteset.dispose
  324.     # タイトル画面に切り替え中の場合
  325.     if $scene.is_a?(Scene_Title)
  326.       # 画面をフェードアウト
  327.       Graphics.transition
  328.       Graphics.freeze
  329.     end
  330.     # 戦闘テストからゲームオーバー画面以外に切り替え中の場合
  331.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  332.       $scene = nil
  333.     end
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 勝敗判定
  337.   #--------------------------------------------------------------------------
  338.   def judge
  339.     # 全滅判定が真、またはパーティ人数が 0 人の場合
  340.     if $game_party.all_dead? or $game_party.actors.size == 0
  341.       # 敗北可能の場合
  342.       if $game_temp.battle_can_lose
  343.         # バトル開始前の BGM に戻す
  344.         $game_system.bgm_play($game_temp.map_bgm)
  345.         # バトル終了
  346.         battle_end(2)
  347.         # true を返す
  348.         return true
  349.       end
  350.       # ゲームオーバーフラグをセット
  351.       $game_temp.gameover = true
  352.       # true を返す
  353.       return true
  354.     end
  355.     # エネミーが 1 体でも存在すれば false を返す
  356.     for enemy in $game_troop.enemies
  357.       if enemy.exist?
  358.         return false
  359.       end
  360.     end
  361.     # アフターバトルフェーズ開始 (勝利)
  362.     start_phase5
  363.     # true を返す
  364.     return true
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● フレーム更新
  368.   #--------------------------------------------------------------------------
  369.   def update
  370.     # バトルイベント実行中の場合
  371.     if $game_system.battle_interpreter.running?
  372.       if @command.size > 0
  373.         @command_a = false
  374.         @command = []
  375.         command_delete
  376.       end
  377.       @status_window.at_refresh
  378.       # インタプリタを更新
  379.       $game_system.battle_interpreter.update
  380.       # アクションを強制されているバトラーが存在しない場合
  381.       if $game_temp.forcing_battler == nil
  382.         # バトルイベントの実行が終わった場合
  383.         unless $game_system.battle_interpreter.running?
  384.           # バトルイベントのセットアップを再実行
  385.           @status_window.refresh
  386.           setup_battle_event
  387.         end
  388.       end
  389.     end
  390.     # システム (タイマー)、画面を更新
  391.     $game_system.update
  392.     $game_screen.update
  393.     # タイマーが 0 になった場合
  394.     if $game_system.timer_working and $game_system.timer == 0
  395.       # バトル中断
  396.       $game_temp.battle_abort = true
  397.     end
  398.     # ウィンドウを更新
  399.     @help_window.update
  400. #------------------------------------------------------------------------------
  401. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  402. #    @party_command_window.update
  403. #------------------------------------------------------------------------------
  404.     @actor_command_window.update
  405.     @status_window.update
  406.     @message_window.update
  407.     # スプライトセットを更新
  408.     @spriteset.update
  409.     # トランジション処理中の場合
  410.     if $game_temp.transition_processing
  411.       # トランジション処理中フラグをクリア
  412.       $game_temp.transition_processing = false
  413.       # トランジション実行
  414.       if $game_temp.transition_name == ""
  415.         Graphics.transition(20)
  416.       else
  417.         Graphics.transition(40, "Graphics/Transitions/" +
  418.           $game_temp.transition_name)
  419.       end
  420.     end
  421.     # メッセージウィンドウ表示中の場合
  422.     if $game_temp.message_window_showing
  423.       return
  424.     end
  425.     # ゲームオーバーの場合
  426.     if $game_temp.gameover
  427.       # ゲームオーバー画面に切り替え
  428.       $scene = Scene_Gameover.new
  429.       return
  430.     end
  431.     # タイトル画面に戻す場合
  432.     if $game_temp.to_title
  433.       # タイトル画面に切り替え
  434.       $scene = Scene_Title.new
  435.       return
  436.     end
  437.     # バトル中断の場合
  438.     if $game_temp.battle_abort
  439.       # バトル開始前の BGM に戻す
  440.       $game_system.bgm_play($game_temp.map_bgm)
  441.       # バトル終了
  442.       battle_end(1)
  443.       return
  444.     end
  445.     # ヘルプウィンドウ表示中の場合
  446.     if @help_wait > 0
  447.       @help_wait -= 1
  448.       if @help_wait == 0
  449.         # ヘルプウィンドウを隠す
  450.         @help_window.visible = false
  451.       end
  452.     end
  453.     # アクションを強制されているバトラーが存在せず、
  454.     # かつバトルイベントが実行中の場合
  455.     if $game_temp.forcing_battler == nil and
  456.        $game_system.battle_interpreter.running?
  457.       return
  458.     end
  459.     # フェーズによって分岐
  460.     case @phase
  461.     when 0  # ATゲージ更新フェーズ
  462.       if anime_wait_return
  463.         update_phase0
  464.       end
  465.     when 1  # プレバトルフェーズ
  466.       update_phase1
  467.       return
  468.     when 2  # パーティコマンドフェーズ
  469.       update_phase2
  470.       return
  471.     when 5  # アフターバトルフェーズ
  472.       update_phase5
  473.       return
  474.     end
  475.     if $scene != self
  476.       return
  477.     end
  478.     if @phase == 0
  479.       if @command.size != 0  # アクターコマンドフェーズ
  480.         if @command_a == false
  481.           start_phase3
  482.         end
  483.         update_phase3
  484.       end
  485.       # ウェイト中の場合
  486.       if @wait_count > 0
  487.         # ウェイトカウントを減らす
  488.         @wait_count -= 1
  489.         return
  490.       end
  491.       update_phase4
  492.     end
  493.   end

  494. #==============================================================================
  495. # ■ Scene_Battle (分割定義 2)
  496. #------------------------------------------------------------------------------
  497. #  バトル画面の処理を行うクラスです。
  498. #==============================================================================

  499.   #--------------------------------------------------------------------------
  500.   # ● フレーム更新 (ATゲージ更新フェーズ)
  501.   #--------------------------------------------------------------------------
  502.   def update_phase0
  503.     if $game_temp.battle_turn == 0
  504.       $game_temp.battle_turn = 1
  505.     end
  506.     # B ボタンが押された場合
  507.   #  if @command_a == false and @party == false
  508.    #   if Input.trigger?(Input::B)
  509.         # キャンセル SE を演奏
  510.    #     $game_system.se_play($data_system.cancel_se)
  511.    #     @party = true
  512.    #   end
  513.    # end
  514.    # if @party == true and
  515.    #     ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  516.    #     (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  517.       # パーティコマンドフェーズへ
  518.    #   start_phase2
  519.    #   return
  520.    # end
  521.     # ATゲージ増加処理
  522.     cnt = 0
  523.     for battler in $game_party.actors + $game_troop.enemies
  524.       active?(battler)
  525.       if battler.rtp == 0
  526.         if battler.at >= @max
  527.           if battler.is_a?(Game_Actor)
  528.             if battler.inputable?
  529.               unless @action_battlers.include?(battler) or
  530.                   @command.include?(battler) or @escape == true
  531.                 if battler.current_action.forcing
  532.                   fullat_se
  533.                   force_action(battler)
  534.                   action_start(battler)
  535.                 else
  536.                   fullat_se
  537.                   @command.push(battler)
  538.                 end
  539.               end
  540.             else
  541.               unless @action_battlers.include?(battler) or
  542.                       battler == @command[0]
  543.                 battler.current_action.clear
  544.                 if @command.include?(battler)
  545.                   @command.delete(battler)
  546.                 else
  547.                   if battler.movable?
  548.                     fullat_se
  549.                   end
  550.                 end
  551.                 action_start(battler)
  552.               end
  553.             end
  554.           else
  555.             unless @action_battlers.include?(battler)
  556.               if battler.current_action.forcing
  557.                 force_action(battler)
  558.                 action_start(battler)
  559.               else
  560.                 if @enemy_speed != 0
  561.                   if rand(@enemy_speed) == 0
  562.                     number = cnt - $game_party.actors.size
  563.                     enemy_action(number)
  564.                   end
  565.                 else
  566.                   number = cnt - $game_party.actors.size
  567.                   enemy_action(number)
  568.                 end
  569.               end
  570.             end
  571.           end
  572.         else
  573.           battler.at += battler.agi
  574.           if battler.guarding?
  575.             battler.at += battler.agi
  576.           end
  577.           if battler.movable?
  578.             battler.atp = 100 * battler.at / @max
  579.           end
  580.         end
  581.       else
  582.         if battler.rt >= battler.rtp
  583.           speller = synthe?(battler)
  584.           if speller != nil
  585.             battler = speller[0]
  586.           end
  587.           unless @action_battlers.include?(battler)
  588.             if battler.is_a?(Game_Actor)
  589.               fullat_se
  590.             end
  591.             battler.rt = battler.rtp
  592.             action_start(battler)
  593.           end
  594.         else
  595.           battler.rt += battler.agi
  596.           speller = synthe?(battler)
  597.           if speller != nil
  598.             for spell in speller
  599.               if spell != battler
  600.                 spell.rt += battler.agi
  601.               end
  602.             end
  603.           end
  604.         end
  605.       end
  606.       cnt += 1
  607.     end
  608.     # ATゲージをリフレッシュ
  609.     @status_window.at_refresh
  610.     # 逃走処理
  611.     if @escape == true and
  612.         ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  613.         (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  614.       temp = false
  615.       for battler in $game_party.actors
  616.         if battler.inputable?
  617.           temp = true
  618.         end
  619.       end
  620.       if temp == true
  621.         for battler in $game_party.actors
  622.           if battler.at < @max and battler.inputable?
  623.             temp = false
  624.             break
  625.           end
  626.         end
  627.         if temp == true
  628.           @escape = false
  629.           for battler in $game_party.actors
  630.             battler.at %= @max
  631.           end
  632.           $game_temp.battle_main_phase = false
  633.           update_phase2_escape
  634.         end
  635.       end
  636.     end
  637.   end
  638. #------------------------------------------------------------------------------
  639. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  640.   #--------------------------------------------------------------------------
  641.   # ● パーティコマンドフェーズ開始
  642.   #--------------------------------------------------------------------------
  643. #  def start_phase2
  644.     # フェーズ 2 に移行
  645. #    @phase = 2
  646. #    @party = false
  647.     # パーティコマンドウィンドウを有効化
  648. #    @party_command_window.active = true
  649. #    @party_command_window.visible = true
  650.     # アクターを非選択状態に設定
  651. #    @actor_index = -1
  652.     # アクターコマンドウィンドウを無効化
  653. #    @actor_command_window.active = false
  654. #    @actor_command_window.visible = false
  655. #    if @command.size != 0
  656.       # アクターの明滅エフェクト OFF
  657. #      if @active_actor != nil
  658. #        @active_actor.blink = false
  659. #      end
  660. #    end
  661.     # カメラセット
  662. #    @camera == "party"
  663. #    @spriteset.screen_target(0, 0, 1)
  664.     # メインフェーズフラグをクリア
  665. #    $game_temp.battle_main_phase = false
  666. #  end
  667. #------------------------------------------------------------------------------
  668.   #--------------------------------------------------------------------------
  669.   # ● フレーム更新 (パーティコマンドフェーズ)
  670.   #--------------------------------------------------------------------------
  671.   def update_phase2
  672. #------------------------------------------------------------------------------
  673. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  674.     # C ボタンが押された場合
  675.    # 去掉“战斗/逃跑”选项
  676. #    if Input.trigger?(Input::C)
  677.       # パーティコマンドウィンドウのカーソル位置で分岐
  678. #      case @party_command_window.index
  679. #      when 0  # 戦う
  680.         # パーティコマンドウィンドウを無効化
  681. #        @party_command_window.active = false
  682. #        @party_command_window.visible = false
  683.         # 決定 SE を演奏
  684. #        $game_system.se_play($data_system.decision_se)
  685. #------------------------------------------------------------------------------
  686.         @escape = false
  687.         @phase = 0
  688.         if $game_temp.battle_turn == 0
  689.           $game_temp.battle_turn = 1
  690.         end
  691.         if @command_a == true
  692.           # アクターコマンドフェーズ開始
  693.           start_phase3
  694.         else
  695.           $game_temp.battle_main_phase = true
  696.         end
  697. end         
  698. #------------------------------------------------------------------------------
  699. #RTAB观光游第一站,去除“战斗/逃跑”选项部分         
  700. #      when 1  # 逃げる
  701.         # 逃走可能ではない場合
  702. #        if $game_temp.battle_can_escape == false
  703.           # ブザー SE を演奏
  704. #          $game_system.se_play($data_system.buzzer_se)
  705. #          return
  706. #        end
  707.         # 決定 SE を演奏
  708. #        $game_system.se_play($data_system.decision_se)
  709. #        @phase = 0
  710.         # パーティコマンドウィンドウを無効化
  711. #        @party_command_window.active = false
  712. #        @party_command_window.visible = false
  713. #        $game_temp.battle_main_phase = true
  714. #        if $game_temp.battle_turn == 0
  715. #          update_phase2_escape
  716. #          $game_temp.battle_turn = 1
  717. #        for battler in $game_party.actors
  718. #           battler.at -= @max / 2
  719. #         end
  720. #         return
  721. #      end
  722.         # 決定 SE を演奏
  723. #       $game_system.se_play($data_system.decision_se)
  724. #       @escape = true
  725. #       for battler in $game_party.actors
  726. #         @command_a = false
  727. #         @command.delete(battler)
  728. #         @action_battlers.delete(battler)
  729. #         skill_reset(battler)
  730. #       end
  731. #     end
  732. #     return
  733. #   end
  734. #end
  735. #------------------------------------------------------------------------------
  736.   #--------------------------------------------------------------------------
  737.   # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
  738.   #--------------------------------------------------------------------------
  739.   def update_phase2_escape
  740.     # エネミーの素早さ平均値を計算
  741.     enemies_agi = 0
  742.     enemies_number = 0
  743.     for enemy in $game_troop.enemies
  744.       if enemy.exist?
  745.         enemies_agi += enemy.agi
  746.         enemies_number += 1
  747.       end
  748.     end
  749.     if enemies_number > 0
  750.       enemies_agi /= enemies_number
  751.     end
  752.     # アクターの素早さ平均値を計算
  753.     actors_agi = 0
  754.     actors_number = 0
  755.     for actor in $game_party.actors
  756.       if actor.exist?
  757.         actors_agi += actor.agi
  758.         actors_number += 1
  759.       end
  760.     end
  761.     if actors_number > 0
  762.       actors_agi /= actors_number
  763.     end
  764.     # 逃走成功判定
  765.     success = rand(100) < 50 * actors_agi / enemies_agi
  766.     # 逃走成功の場合
  767.     if success
  768.       # 逃走 SE を演奏
  769.       $game_system.se_play($data_system.escape_se)
  770.       # バトル開始前の BGM に戻す
  771.       $game_system.bgm_play($game_temp.map_bgm)
  772.       # バトル終了
  773.       battle_end(1)
  774.     # 逃走失敗の場合
  775.     else
  776.       @help_window.set_text("逃走失敗", 1)
  777.       @help_wait = @help_time
  778.       # パーティ全員のアクションをクリア
  779.       $game_party.clear_actions
  780.       # メインフェーズ開始
  781.       start_phase4
  782.     end
  783.   end
  784.   #--------------------------------------------------------------------------
  785.   # ● アフターバトルフェーズ開始
  786.   #--------------------------------------------------------------------------
  787.   def start_phase5
  788.     # フェーズ 5 に移行
  789.     @phase = 5
  790.     # バトル終了 ME を演奏
  791.     $game_system.me_play($game_system.battle_end_me)
  792.     # バトル開始前の BGM に戻す
  793.     $game_system.bgm_play($game_temp.map_bgm)
  794.     # EXP、ゴールド、トレジャーを初期化
  795.     exp = 0
  796.     gold = 0
  797.     treasures = []
  798.     if @active_actor != nil
  799.       @active_actor.blink = false
  800.     end
  801.     # メインフェーズフラグをセット
  802.     $game_temp.battle_main_phase = true
  803. #------------------------------------------------------------------------------
  804. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  805.     # パーティコマンドウィンドウを無効化
  806. #    @party_command_window.active = false
  807. #    @party_command_window.visible = false
  808. #------------------------------------------------------------------------------
  809.     # アクターコマンドウィンドウを無効化
  810.     @actor_command_window.active = false
  811.     @actor_command_window.visible = false
  812.     if @skill_window != nil
  813.       # スキルウィンドウを解放
  814.       @skill_window.dispose
  815.       @skill_window = nil
  816.     end
  817.     if @item_window != nil
  818.       # アイテムウィンドウを解放
  819.       @item_window.dispose
  820.       @item_window = nil
  821.     end
  822.     # ヘルプウィンドウを隠す
  823.     @help_window.visible = false
  824.     # ループ
  825.     for enemy in $game_troop.enemies
  826.       # エネミーが隠れ状態でない場合
  827.       unless enemy.hidden
  828.         # 獲得 EXP、ゴールドを追加
  829.         exp += enemy.exp
  830.         gold += enemy.gold
  831.         # トレジャー出現判定
  832.         if rand(100) < enemy.treasure_prob
  833.           if enemy.item_id > 0
  834.             treasures.push($data_items[enemy.item_id])
  835.           end
  836.           if enemy.weapon_id > 0
  837.             treasures.push($data_weapons[enemy.weapon_id])
  838.           end
  839.           if enemy.armor_id > 0
  840.             treasures.push($data_armors[enemy.armor_id])
  841.           end
  842.         end
  843.       end
  844.     end
  845.     # トレジャーの数を 6 個までに限定
  846.     treasures = treasures[0..5]
  847.     # EXP 獲得
  848.     for i in 0...$game_party.actors.size
  849.       actor = $game_party.actors[i]
  850.       if actor.cant_get_exp? == false
  851.         last_level = actor.level
  852.         actor.exp += exp
  853.         if actor.level > last_level
  854.           @status_window.level_up(i)
  855.           actor.damage[[actor, -1]] = "Level up!"
  856.           actor.up_level = actor.level - last_level
  857.         end
  858.       end
  859.     end
  860.     # ゴールド獲得
  861.     $game_party.gain_gold(gold)
  862.     # トレジャー獲得
  863.     for item in treasures
  864.       case item
  865.       when RPG::Item
  866.         $game_party.gain_item(item.id, 1)
  867.       when RPG::Weapon
  868.         $game_party.gain_weapon(item.id, 1)
  869.       when RPG::Armor
  870.         $game_party.gain_armor(item.id, 1)
  871.       end
  872.     end
  873.     # バトルリザルトウィンドウを作成
  874.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  875.     # ウェイトカウントを設定
  876.     @phase5_wait_count = 100
  877.   end
  878.   #--------------------------------------------------------------------------
  879.   # ● フレーム更新 (アフターバトルフェーズ)
  880.   #--------------------------------------------------------------------------
  881.   def update_phase5
  882.     # ウェイトカウントが 0 より大きい場合
  883.     if @phase5_wait_count > 0
  884.       # ウェイトカウントを減らす
  885.       @phase5_wait_count -= 1
  886.       # ウェイトカウントが 0 になった場合
  887.       if @phase5_wait_count == 0
  888.         # リザルトウィンドウを表示
  889.         @result_window.visible = true
  890.         # メインフェーズフラグをクリア
  891.         $game_temp.battle_main_phase = false
  892.         # ステータスウィンドウをリフレッシュ
  893.         @status_window.refresh
  894.         for actor in $game_party.actors
  895.           if actor.damage.include?([actor, 0])
  896.             @phase5_wait_count = 20
  897.             actor.damage_pop[[actor, 0]] = true
  898.           end
  899.           if actor.damage.include?([actor, -1])
  900.             @phase5_wait_count = 20
  901.             actor.damage_pop[[actor, -1]] = true
  902.             for level in actor.level - actor.up_level + 1..actor.level
  903.               for skill in $data_classes[actor.class_id].learnings
  904.                 if level == skill.level and not actor.skill_learn?(skill.id)
  905.                   actor.damage[[actor, 0]] = "New Skill!"
  906.                   break
  907.                 end
  908.               end
  909.             end
  910.           end
  911.         end
  912.       end
  913.       return
  914.     end
  915.     # C ボタンが押された場合
  916.     if Input.trigger?(Input::C)
  917.       # バトル終了
  918.       battle_end(0)
  919.     end
  920.   end

  921. #==============================================================================
  922. # ■ Scene_Battle (分割定義 3)
  923. #------------------------------------------------------------------------------
  924. #  バトル画面の処理を行うクラスです。
  925. #==============================================================================

  926.   #--------------------------------------------------------------------------
  927.   # ● アクターコマンドフェーズ開始
  928.   #--------------------------------------------------------------------------
  929.   def start_phase3
  930.     if victory?
  931.       return
  932.     end
  933.     # メインフェーズフラグをクリア
  934.     $game_temp.battle_main_phase = false
  935.     @command_a = true
  936.     @active_actor = @command[0]
  937.     cnt = 0
  938.     for actor in $game_party.actors
  939.       if actor == @active_actor
  940.         @actor_index = cnt
  941.       end
  942.       cnt += 1
  943.     end
  944.     @active_actor.blink = true
  945.     unless @active_actor.inputable?
  946.       @active_actor.current_action.clear
  947.       phase3_next_actor
  948.       return
  949.     end
  950.     phase3_setup_command_window
  951.     # カメラの設定
  952.     @camera = "command"
  953.     plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  954.     y = [(plus.abs - 1.5) * 10 , 0].min
  955.     @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # ● アクターのコマンド入力終了
  959.   #--------------------------------------------------------------------------
  960.   def phase3_next_actor
  961.     @command.shift
  962.     @command_a = false
  963.     # メインフェーズフラグをセット
  964.     $game_temp.battle_main_phase = true
  965.     # アクターコマンドウィンドウを無効化
  966.     @actor_command_window.active = false
  967.     @actor_command_window.visible = false
  968.     # アクターの明滅エフェクト OFF
  969.     if @active_actor != nil
  970.       @active_actor.blink = false
  971.     end
  972.     action_start(@active_actor)
  973.     # カメラを元に戻す
  974.     if @camera == "command"
  975.       @spriteset.screen_target(0, 0, 1)
  976.     end
  977.     return
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ● アクターコマンドウィンドウのセットアップ
  981.   #--------------------------------------------------------------------------
  982.   def phase3_setup_command_window
  983. #------------------------------------------------------------------------------
  984. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  985.     # パーティコマンドウィンドウを無効化
  986. #    @party_command_window.active = false
  987. #    @party_command_window.visible = false
  988. #------------------------------------------------------------------------------  
  989.     # アクターコマンドウィンドウを有効化
  990.     @actor_command_window.active = true
  991.     @actor_command_window.visible = true
  992.     # アクターコマンドウィンドウの位置を設定
  993.     @actor_command_window.x = @actor_index * 160 +
  994.                               (4 - $game_party.actors.size) * 80
  995.     # インデックスを 0 に設定
  996.     @actor_command_window.index = 0
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # ● エネミーアクション作成
  1000.   #--------------------------------------------------------------------------
  1001.   def enemy_action(number)
  1002.     enemy = $game_troop.enemies[number]
  1003.     unless enemy.current_action.forcing
  1004.       enemy.make_action
  1005.     end
  1006.     action_start(enemy)
  1007.   end
  1008.   #--------------------------------------------------------------------------
  1009.   # ● フレーム更新 (アクターコマンドフェーズ)
  1010.   #--------------------------------------------------------------------------
  1011.   def update_phase3
  1012.     if victory? and @command_a
  1013.       command_delete
  1014.       @command.push(@active_actor)
  1015.       return
  1016.     end
  1017.     # エネミーアローが有効の場合
  1018.     if @enemy_arrow != nil
  1019.       update_phase3_enemy_select
  1020.     # アクターアローが有効の場合
  1021.     elsif @actor_arrow != nil
  1022.       update_phase3_actor_select
  1023.     # スキルウィンドウが有効の場合
  1024.     elsif @skill_window != nil
  1025.       update_phase3_skill_select
  1026.     # アイテムウィンドウが有効の場合
  1027.     elsif @item_window != nil
  1028.       update_phase3_item_select
  1029.     # アクターコマンドウィンドウが有効の場合
  1030.     elsif @actor_command_window.active
  1031.       update_phase3_basic_command
  1032.     end
  1033.   end
  1034.   #--------------------------------------------------------------------------
  1035.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  1036.   #--------------------------------------------------------------------------
  1037.   def update_phase3_basic_command
  1038.     unless @active_actor.inputable?
  1039.       @active_actor.current_action.clear
  1040.       phase3_next_actor
  1041.       return
  1042.     end
  1043. #--------------------------------------------------------------------------
  1044. #RTAB观光游第一站,去除“战斗/逃跑”选项部分
  1045. # B ボタンが押された場合
  1046. #   if Input.trigger?(Input::B) and @party == false
  1047.       # キャンセル SE を演奏
  1048. #     $game_system.se_play($data_system.cancel_se)
  1049. #     @party = true
  1050. #   end
  1051. #   if @party == true and
  1052. #       ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  1053. #       (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  1054.       # パーティコマンドフェーズへ
  1055. #     start_phase2
  1056. #     return
  1057. #   end
  1058. #==============================================================================
  1059. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1060. #==============================================================================
  1061.     # A : SKILL
  1062.     if Input.trigger?(Input::X)
  1063.       # 決定 SE を演奏
  1064.       $game_system.se_play($data_system.decision_se)
  1065.       # スキルの選択を開始
  1066.       start_skill_select
  1067.       return
  1068.     end
  1069.     # S : 防御
  1070.     if Input.trigger?(Input::Y)
  1071.       # 決定 SE を演奏
  1072.       $game_system.se_play($data_system.decision_se)
  1073.       # アクションを設定
  1074.       @active_actor.current_action.kind = 0
  1075.       @active_actor.current_action.basic = 1
  1076.       # 次のアクターのコマンド入力へ
  1077.       phase3_next_actor
  1078.       return
  1079.     end
  1080.     # D : ITEM
  1081.     if Input.trigger?(Input::Z)
  1082.       # 決定 SE を演奏
  1083.       $game_system.se_play($data_system.decision_se)
  1084.       # アイテムの選択を開始
  1085.       start_item_select
  1086.       return
  1087.     end
  1088. #==============================================================================
  1089.     # C ボタンが押された場合
  1090.     if Input.trigger?(Input::C)
  1091. #------------------------------------------------------------------------------
  1092. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1093. #      @party = false
  1094. #------------------------------------------------------------------------------
  1095.       # アクターコマンドウィンドウのカーソル位置で分岐
  1096.       case @actor_command_window.index
  1097.       when 0  # 攻撃
  1098. #==============================================================================
  1099. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1100. #==============================================================================        
  1101.         if victory?
  1102.           # ブザー SE を演奏
  1103.           $game_system.se_play($data_system.buzzer_se)
  1104.           return
  1105.         end
  1106. #==============================================================================        
  1107.         # 決定 SE を演奏
  1108.         $game_system.se_play($data_system.decision_se)
  1109.         # エネミーの選択を開始
  1110.         start_enemy_select
  1111.       when 1  # スキル
  1112.         # 決定 SE を演奏
  1113.         $game_system.se_play($data_system.decision_se)
  1114.         # スキルの選択を開始
  1115.         start_skill_select
  1116.       when 2  # 防御
  1117.         # 決定 SE を演奏
  1118.         $game_system.se_play($data_system.decision_se)
  1119.         # アクションを設定
  1120.         @active_actor.current_action.kind = 0
  1121.         @active_actor.current_action.basic = 1
  1122.         # 次のアクターのコマンド入力へ
  1123.         phase3_next_actor
  1124.       when 3  # アイテム
  1125.         # 決定 SE を演奏
  1126.         $game_system.se_play($data_system.decision_se)
  1127.         # アイテムの選択を開始
  1128.         start_item_select
  1129. #==============================================================================
  1130. #RTAB观光游第三站,战斗菜单增加逃跑选项
  1131. #==============================================================================
  1132.       when 4 #逃跑(添加内容)
  1133.         if $game_temp.battle_can_escape == false
  1134.           # ブザー SE を演奏
  1135.           $game_system.se_play($data_system.buzzer_se)
  1136.           return
  1137.        end
  1138.         # 決定 SE を演奏
  1139.         $game_system.se_play($data_system.decision_se)
  1140.        @phase = 0
  1141.         # パーティコマンドウィンドウを無効化
  1142.         @actor_command_window.active = false
  1143.         @actor_command_window.visible = false
  1144.         $game_temp.battle_main_phase = true
  1145.         if $game_temp.battle_turn == 0
  1146.           update_phase2_escape
  1147.          $game_temp.battle_turn = 1
  1148.          for battler in $game_party.actors
  1149.             battler.at -= @max / 2
  1150.           end
  1151.           return
  1152.        end
  1153.        # 決定 SE を演奏
  1154.         $game_system.se_play($data_system.decision_se)
  1155.         @escape = true
  1156.         for battler in $game_party.actors
  1157.           @command_a = false
  1158.           @command.delete(battler)
  1159.           @action_battlers.delete(battler)
  1160.           skill_reset(battler)
  1161.         end
  1162. #==============================================================================        
  1163.       end
  1164.       return
  1165.     end
  1166.     # キャラチェンジ
  1167.     if @command.size > 1
  1168.       # R ボタンが押された場合
  1169.       if Input.trigger?(Input::L)
  1170.         $game_system.se_play($data_system.cursor_se)
  1171. #------------------------------------------------------------------------------
  1172. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1173.        # @party = false
  1174. #------------------------------------------------------------------------------      
  1175.         # アクターの明滅エフェクト OFF
  1176.         if @active_actor != nil
  1177.           @active_actor.blink = false
  1178.         end
  1179.         @command.push(@command[0])
  1180.         @command.shift
  1181.         @command_a = false
  1182.         # 新たなコマンドウィンドウの立ち上げ
  1183.         start_phase3
  1184.       end
  1185.       # L ボタンが押された場合
  1186.       if Input.trigger?(Input::R)
  1187.         $game_system.se_play($data_system.cursor_se)
  1188. #------------------------------------------------------------------------------
  1189. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1190.      #   @party = false
  1191. #------------------------------------------------------------------------------      
  1192.         # アクターの明滅エフェクト OFF
  1193.         if @active_actor != nil
  1194.           @active_actor.blink = false
  1195.         end
  1196.         @command.unshift(@command[@command.size - 1])
  1197.         @command.delete_at(@command.size - 1)
  1198.         @command_a = false
  1199.         # 新たなコマンドウィンドウの立ち上げ
  1200.         start_phase3
  1201.       end
  1202.       # 右 ボタンが押された場合
  1203.       if Input.trigger?(Input::RIGHT)
  1204.         $game_system.se_play($data_system.cursor_se)
  1205. #------------------------------------------------------------------------------
  1206. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1207.    #     @party = false
  1208. #------------------------------------------------------------------------------      
  1209.         # アクターの明滅エフェクト OFF
  1210.         if @active_actor != nil
  1211.           @active_actor.blink = false
  1212.         end
  1213.         actor = $game_party.actors[@actor_index]
  1214.         while actor == @command[0] or (not @command.include?(actor))
  1215.           @actor_index += 1
  1216.           @actor_index %= $game_party.actors.size
  1217.           actor = $game_party.actors[@actor_index]
  1218.           if actor == @command[0]
  1219.             break
  1220.           end
  1221.         end
  1222.         while actor != @command[0]
  1223.           @command.push(@command.shift)
  1224.         end
  1225.         @command_a = false
  1226.         # 新たなコマンドウィンドウの立ち上げ
  1227.         start_phase3
  1228.       end
  1229.       # 左 ボタンが押された場合
  1230.       if Input.trigger?(Input::LEFT)
  1231.         $game_system.se_play($data_system.cursor_se)
  1232. #------------------------------------------------------------------------------
  1233. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1234.    #     @party = false
  1235. #------------------------------------------------------------------------------
  1236.         # アクターの明滅エフェクト OFF
  1237.         if @active_actor != nil
  1238.           @active_actor.blink = false
  1239.         end
  1240.         actor = $game_party.actors[@actor_index]
  1241.         while actor == @command[0] or (not @command.include?(actor))
  1242.           @actor_index -= 1
  1243.           @actor_index %= $game_party.actors.size
  1244.           actor = $game_party.actors[@actor_index]
  1245.           if actor == @command[0]
  1246.             break
  1247.           end
  1248.         end
  1249.         while actor != @command[0]
  1250.           @command.push(@command.shift)
  1251.         end
  1252.         @command_a = false
  1253.         # 新たなコマンドウィンドウの立ち上げ
  1254.         start_phase3
  1255.       end
  1256.     end
  1257.   end
  1258.   #--------------------------------------------------------------------------
  1259.   # ● フレーム更新 (アクターコマンドフェーズ : スキル選択)
  1260.   #--------------------------------------------------------------------------
  1261.   def update_phase3_skill_select
  1262.     # コマンド選択中に行動不能になった場合
  1263.     unless @active_actor.inputable?
  1264.       @active_actor.current_action.clear
  1265.       command_delete
  1266.       # 次のアクターのコマンド入力へ
  1267.       phase3_next_actor
  1268.       return
  1269.     end
  1270.     # スキルウィンドウを可視状態にする
  1271.     @skill_window.visible = true
  1272.     # スキルウィンドウを更新
  1273.     @skill_window.update
  1274.     # B ボタンが押された場合
  1275.     if Input.trigger?(Input::B)
  1276.       # キャンセル SE を演奏
  1277.       $game_system.se_play($data_system.cancel_se)
  1278.       # スキルの選択を終了
  1279.       end_skill_select
  1280.       return
  1281.     end
  1282.     # C ボタンが押された場合
  1283.     if Input.trigger?(Input::C)
  1284.       # スキルウィンドウで現在選択されているデータを取得
  1285.       @skill = @skill_window.skill
  1286.       # 使用できない場合
  1287.       if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
  1288.         # ブザー SE を演奏
  1289.         $game_system.se_play($data_system.buzzer_se)
  1290.         return
  1291.       end
  1292.       # 決定 SE を演奏
  1293.       $game_system.se_play($data_system.decision_se)
  1294.       # アクションを設定
  1295.       @active_actor.current_action.skill_id = @skill.id
  1296.       # スキルウィンドウを不可視状態にする
  1297.       @skill_window.visible = false
  1298.       # 効果範囲が敵単体の場合
  1299.       if @skill.scope == 1
  1300.         # エネミーの選択を開始
  1301.         start_enemy_select
  1302.       # 効果範囲が味方単体の場合
  1303.       elsif @skill.scope == 3 or @skill.scope == 5
  1304.         # アクターの選択を開始
  1305.         start_actor_select
  1306.       # 効果範囲が単体ではない場合
  1307.       else
  1308.         # アクションを設定
  1309.         @active_actor.current_action.kind = 1
  1310.         # スキルの選択を終了
  1311.         end_skill_select
  1312.         # 次のアクターのコマンド入力へ
  1313.         phase3_next_actor
  1314.       end
  1315.       return
  1316.     end
  1317.   end
  1318.   #--------------------------------------------------------------------------
  1319.   # ● フレーム更新 (アクターコマンドフェーズ : アイテム選択)
  1320.   #--------------------------------------------------------------------------
  1321.   def update_phase3_item_select
  1322.     # コマンド選択中に行動不能になった場合
  1323.     unless @active_actor.inputable?
  1324.       @active_actor.current_action.clear
  1325.       command_delete
  1326.       # 次のアクターのコマンド入力へ
  1327.       phase3_next_actor
  1328.       return
  1329.     end
  1330.     # アイテムウィンドウを可視状態にする
  1331.     @item_window.visible = true
  1332.     # アイテムウィンドウを更新
  1333.     @item_window.update
  1334.     # B ボタンが押された場合
  1335.     if Input.trigger?(Input::B)
  1336.       # キャンセル SE を演奏
  1337.       $game_system.se_play($data_system.cancel_se)
  1338.       # アイテムの選択を終了
  1339.       end_item_select
  1340.       return
  1341.     end
  1342.     # C ボタンが押された場合
  1343.     if Input.trigger?(Input::C)
  1344.       # アイテムウィンドウで現在選択されているデータを取得
  1345.       @item = @item_window.item
  1346.       # 使用できない場合
  1347.       unless $game_party.item_can_use?(@item.id)
  1348.         # ブザー SE を演奏
  1349.         $game_system.se_play($data_system.buzzer_se)
  1350.         return
  1351.       end
  1352.       # 決定 SE を演奏
  1353.       $game_system.se_play($data_system.decision_se)
  1354.       # アクションを設定
  1355.       @active_actor.current_action.item_id = @item.id
  1356.       # アイテムウィンドウを不可視状態にする
  1357.       @item_window.visible = false
  1358.       # 効果範囲が敵単体の場合
  1359.       if @item.scope == 1
  1360.         # エネミーの選択を開始
  1361.         start_enemy_select
  1362.       # 効果範囲が味方単体の場合
  1363.       elsif @item.scope == 3 or @item.scope == 5
  1364.         # アクターの選択を開始
  1365.         start_actor_select
  1366.       # 効果範囲が単体ではない場合
  1367.       else
  1368.         # アクションを設定
  1369.         @active_actor.current_action.kind = 2
  1370.         # アイテムの選択を終了
  1371.         end_item_select
  1372.         # 次のアクターのコマンド入力へ
  1373.         phase3_next_actor
  1374.       end
  1375.       return
  1376.     end
  1377.   end
  1378.   #--------------------------------------------------------------------------
  1379.   # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  1380.   #--------------------------------------------------------------------------
  1381.   def update_phase3_enemy_select
  1382.     # コマンド選択中に行動不能になった場合
  1383.     unless @active_actor.inputable?
  1384.       # カメラを元に戻す
  1385.       if @camera == "select"
  1386.         @spriteset.screen_target(0, 0, 1)
  1387.       end
  1388.       @active_actor.current_action.clear
  1389.       command_delete
  1390.       # 次のアクターのコマンド入力へ
  1391.       phase3_next_actor
  1392.       return
  1393.     end
  1394.     # エネミーアローを更新
  1395.     @enemy_arrow.update
  1396.     # B ボタンが押された場合
  1397.     if Input.trigger?(Input::B)
  1398.       # キャンセル SE を演奏
  1399.       $game_system.se_play($data_system.cancel_se)
  1400.       # カメラを元に戻す
  1401.       if @camera == "select"
  1402.         # カメラの設定
  1403.         @camera = "command"
  1404.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  1405.         y = [(plus.abs - 1.5) * 10 , 0].min
  1406.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  1407.       end
  1408.       # エネミーの選択を終了
  1409.       end_enemy_select
  1410.       return
  1411.     end
  1412.     # C ボタンが押された場合
  1413.     if Input.trigger?(Input::C)
  1414.       # 決定 SE を演奏
  1415.       $game_system.se_play($data_system.decision_se)
  1416.       # アクションを設定
  1417.       @active_actor.current_action.kind = 0
  1418.       @active_actor.current_action.basic = 0
  1419.       @active_actor.current_action.target_index = @enemy_arrow.index
  1420.       # スキルウィンドウ表示中の場合
  1421.       if @skill_window != nil
  1422.         # アクションを再設定
  1423.         @active_actor.current_action.kind = 1
  1424.         # スキルの選択を終了
  1425.         end_skill_select
  1426.       end
  1427.       # アイテムウィンドウ表示中の場合
  1428.       if @item_window != nil
  1429.         # アクションを再設定
  1430.         @active_actor.current_action.kind = 2
  1431.         # アイテムの選択を終了
  1432.         end_item_select
  1433.       end
  1434.       # エネミーの選択を終了
  1435.       end_enemy_select
  1436.       # 次のアクターのコマンド入力へ
  1437.       phase3_next_actor
  1438.     end
  1439.   end
  1440.   #--------------------------------------------------------------------------
  1441.   # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
  1442.   #--------------------------------------------------------------------------
  1443.   def update_phase3_actor_select
  1444.     # コマンド選択中に行動不能になった場合
  1445.     unless @active_actor.inputable?
  1446.       @active_actor.current_action.clear
  1447.       command_delete
  1448.       # 次のアクターのコマンド入力へ
  1449.       phase3_next_actor
  1450.       return
  1451.     end
  1452.     # アクターアローを更新
  1453.     @actor_arrow.update
  1454.     # B ボタンが押された場合
  1455.     if Input.trigger?(Input::B)
  1456.       # キャンセル SE を演奏
  1457.       $game_system.se_play($data_system.cancel_se)
  1458.       # アクターの選択を終了
  1459.       end_actor_select
  1460.       return
  1461.     end
  1462.     # C ボタンが押された場合
  1463.     if Input.trigger?(Input::C)
  1464.       # 決定 SE を演奏
  1465.       $game_system.se_play($data_system.decision_se)
  1466.       # アクションを設定
  1467.       @active_actor.current_action.kind = 0
  1468.       @active_actor.current_action.basic = 0
  1469.       @active_actor.current_action.target_index = @actor_arrow.index
  1470.       # アクターの選択を終了
  1471.       end_actor_select
  1472.       # スキルウィンドウ表示中の場合
  1473.       if @skill_window != nil
  1474.         # アクションを再設定
  1475.         @active_actor.current_action.kind = 1
  1476.         # スキルの選択を終了
  1477.         end_skill_select
  1478.       end
  1479.       # アイテムウィンドウ表示中の場合
  1480.       if @item_window != nil
  1481.         # アクションを再設定
  1482.         @active_actor.current_action.kind = 2
  1483.         # アイテムの選択を終了
  1484.         end_item_select
  1485.       end
  1486.       # 次のアクターのコマンド入力へ
  1487.       phase3_next_actor
  1488.     end
  1489.   end
  1490.   #--------------------------------------------------------------------------
  1491.   # ● エネミー選択開始
  1492.   #--------------------------------------------------------------------------
  1493.   alias :start_enemy_select_rtab :start_enemy_select
  1494.   def start_enemy_select
  1495.     @camera = "select"
  1496.     for enemy in $game_troop.enemies
  1497.       if enemy.exist?
  1498.         zoom = 1 / enemy.zoom
  1499.         @spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
  1500.                                   enemy.attack_y(zoom) * 0.75, zoom)
  1501.         break
  1502.       end
  1503.     end
  1504.     # オリジナルの処理
  1505.     start_enemy_select_rtab
  1506.   end
  1507.   #--------------------------------------------------------------------------
  1508.   # ● エネミー選択終了
  1509.   #--------------------------------------------------------------------------
  1510.   alias :end_enemy_select_rtab :end_enemy_select
  1511.   def end_enemy_select
  1512.     # オリジナルの処理
  1513.     end_enemy_select_rtab
  1514.     if (@action == 0 and not @action_battlers.empty?) or
  1515.           (@camera == "select" and (@active_actor.current_action.kind != 0 or
  1516.                                             @active_actor.animation1_id != 0))
  1517.       @spriteset.screen_target(0, 0, 1)
  1518.     end
  1519.   end
  1520.   #--------------------------------------------------------------------------
  1521.   # ● スキル選択開始
  1522.   #--------------------------------------------------------------------------
  1523.   def start_skill_select
  1524.     # スキルウィンドウを作成
  1525.     @skill_window = Window_Skill.new(@active_actor)
  1526.     # ヘルプウィンドウを関連付け
  1527.     @skill_window.help_window = @help_window
  1528.     # アクターコマンドウィンドウを無効化
  1529.     @actor_command_window.active = false
  1530.     @actor_command_window.visible = false
  1531.   end

  1532. #==============================================================================
  1533. # ■ Scene_Battle (分割定義 4)
  1534. #------------------------------------------------------------------------------
  1535. #  バトル画面の処理を行うクラスです。
  1536. #==============================================================================

  1537.   #--------------------------------------------------------------------------
  1538.   # ● メインフェーズ開始
  1539.   #--------------------------------------------------------------------------
  1540.   def start_phase4
  1541.     $game_temp.battle_main_phase = true
  1542.   end
  1543.   #--------------------------------------------------------------------------
  1544.   # ● フレーム更新 (メインフェーズ)
  1545.   #--------------------------------------------------------------------------
  1546.   def update_phase4
  1547.     # アクションを強制されているバトラーが存在する場合
  1548.     if $game_temp.forcing_battler != nil
  1549.       battler = $game_temp.forcing_battler
  1550.       if battler.current_action.forcing == false
  1551.         if @action_battlers.include?(battler)
  1552.           if @action > 0 or @action_battlers[0].phase == 1
  1553.             @action_battlers.delete(battler)
  1554.             @action_battlers.push(battler)
  1555.           end
  1556.           if battler.phase == 1
  1557.             battler.current_action.forcing = true
  1558.             force_action(battler)
  1559.           end
  1560.         else
  1561.           battler.current_action.forcing = true
  1562.           force_action(battler)
  1563.           action_start(battler)
  1564.           @action_battlers.delete(battler)
  1565.           @action_battlers.push(battler)
  1566.         end
  1567.         battler.at = @max
  1568.         battler.atp = 100 * battler.at / @max
  1569.       end
  1570.     end
  1571.     # action が1以上の場合、一斉に行動を起こす
  1572.     for battler in @action_battlers.reverse
  1573.       # ウェイト中の場合
  1574.       if battler.wait > 0
  1575.         # ウェイトカウントを減らす
  1576.         battler.wait -= 1
  1577.         break if @action == 0
  1578.         next
  1579.       end
  1580.       unless fin? and battler.phase < 3 and
  1581.           not $game_system.battle_interpreter.running?
  1582.         action_phase(battler)
  1583.       end
  1584.       break if @action == 0
  1585.     end
  1586.     # アクションを強制されているバトラーが存在しない場合
  1587.     if $game_temp.forcing_battler == nil
  1588.       # バトルイベントをセットアップ
  1589.       setup_battle_event
  1590.       # バトルイベント実行中の場合
  1591.       if $game_system.battle_interpreter.running?
  1592.         return
  1593.       end
  1594.     end
  1595.     # 勝敗を決した際の処理
  1596.     if fin?
  1597.       # 敗北時、指定時間ウェイト
  1598.       if $game_party.all_dead? and @after_wait[0] > 0
  1599.         @after_wait[0] -= 1
  1600.         return
  1601.       end
  1602.       # 勝利時、指定時間ウェイト
  1603.       if victory? and @after_wait[1] > 0
  1604.         @after_wait[1] -= 1
  1605.         return
  1606.       end
  1607.       # 戦闘が終了し、かつアクターが行動直前の場合はアクターの行動を消去
  1608.       for battler in @action_battlers.reverse
  1609.         if battler.phase < 3 and not $game_system.battle_interpreter.running?
  1610.           @action_battlers.delete(battler)
  1611.         end
  1612.       end
  1613.       # 勝敗判定
  1614.       if @action_battlers.empty? and
  1615.           not $game_system.battle_interpreter.running?
  1616.         judge
  1617.       end
  1618.     end
  1619.   end
  1620.   #--------------------------------------------------------------------------
  1621.   # ● アクション更新 (メインフェーズ)
  1622.   #--------------------------------------------------------------------------
  1623.   def action_phase(battler)
  1624.     # action が 1 の場合、バトラーが行動中かどうか確認
  1625.     if @action == 1 and battler.phase <= 3
  1626.       for target in battler.target
  1627.         speller = synthe?(target)
  1628.         if speller == nil
  1629.           # ターゲットが通常行動中の場合
  1630.           if @action_battlers.include?(target)
  1631.             if target.phase > 2
  1632.               return
  1633.             end
  1634.           end
  1635.         else
  1636.           # ターゲットが連携スキル発動中の場合
  1637.           for spell in speller
  1638.             if @action_battlers.include?(spell)
  1639.               if spell.phase > 2
  1640.                 return
  1641.               end
  1642.             end
  1643.           end
  1644.         end
  1645.       end
  1646.     end
  1647.     case battler.phase
  1648.     when 1
  1649.       update_phase4_step1(battler)
  1650.     when 2
  1651.       update_phase4_step2(battler)
  1652.     when 3
  1653.       update_phase4_step3(battler)
  1654.     when 4
  1655.       update_phase4_step4(battler)
  1656.     when 5
  1657.       update_phase4_step5(battler)
  1658.     when 6
  1659.       update_phase4_step6(battler)
  1660.     end
  1661.   end
  1662.   #--------------------------------------------------------------------------
  1663.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  1664.   #--------------------------------------------------------------------------
  1665.   def update_phase4_step1(battler)
  1666.     # すでに戦闘から外されている場合
  1667.     if battler.index == nil
  1668.       @action_battlers.delete(battler)
  1669.       anime_wait_return
  1670.       return
  1671.     end
  1672.     speller = synthe?(battler)
  1673.     if speller == nil
  1674.       # ダメージ食らい中の場合
  1675.       unless battler.damage.empty? or @action > 2
  1676.         return
  1677.       end
  1678.       # 行動可能かどうか判定
  1679.       unless battler.movable?
  1680.         battler.phase = 6
  1681.         return
  1682.       end
  1683.     else
  1684.       # ダメージ食らい中の場合
  1685.       for spell in speller
  1686.         unless spell.damage.empty? or @action > 2
  1687.           return
  1688.         end
  1689.         # 行動可能かどうか判定
  1690.         unless spell.movable?
  1691.           battler.phase = 6
  1692.           return
  1693.         end
  1694.       end
  1695.     end
  1696.     # スキル使用時、詠唱時間設定
  1697.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  1698.     if battler.current_action.kind == 1 and
  1699.       (not battler.current_action.forcing or @force != 2)
  1700.       if battler.rtp == 0
  1701.         # スキル詠唱中ならば、解除
  1702.         skill_reset(battler)
  1703.         # スキル詠唱時間設定
  1704.         recite_time(battler)
  1705.         # 連携技設定
  1706.         synthe_spell(battler)
  1707.         # スキルを詠唱する場合
  1708.         if battler.rtp > 0
  1709.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  1710.           speller = synthe?(battler)
  1711.           if battler.current_action.forcing and @force > 0 and speller != nil
  1712.             for spell in speller
  1713.               spell.rt = spell.rtp
  1714.             end
  1715.           else
  1716.             battler.blink = true
  1717.             if battler.current_action.forcing
  1718.               $game_temp.forcing_battler = nil
  1719.               battler.current_action.forcing = false
  1720.             end
  1721.             @action_battlers.delete(battler)
  1722.             return
  1723.           end
  1724.         end
  1725.       end
  1726.     end
  1727.     # アクターの明滅エフェクト OFF
  1728.     if battler != nil
  1729.       battler.blink = false
  1730.     end
  1731.     speller = synthe?(battler)
  1732.     if speller == nil
  1733.       @spell_p.delete(battler)
  1734.       @spell_e.delete(battler)
  1735.     else
  1736.       for spell in speller
  1737.         spell.blink = false
  1738.         @spell_p.delete(spell)
  1739.         @spell_e.delete(spell)
  1740.       end
  1741.     end
  1742.     # ステップ 2 に移行
  1743.     battler.phase = 2
  1744.   end
  1745.   #--------------------------------------------------------------------------
  1746.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1747.   #--------------------------------------------------------------------------
  1748.   def update_phase4_step2(battler)
  1749.     # 強制アクションでなければ
  1750.     unless battler.current_action.forcing
  1751.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  1752.       if battler.restriction == 2 or battler.restriction == 3
  1753.         # アクションに攻撃を設定
  1754.         battler.current_action.kind = 0
  1755.         battler.current_action.basic = 0
  1756.       end
  1757.     end
  1758.     # アクションの種別で分岐
  1759.     case battler.current_action.kind
  1760.     when 0  # 基本
  1761.       if fin?
  1762.         battler.phase = 6
  1763.         return
  1764.       end
  1765.       make_basic_action_result(battler)
  1766.     when 1  # スキル
  1767.       if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
  1768.         battler.phase = 6
  1769.         return
  1770.       end
  1771.       make_skill_action_result(battler)
  1772.     when 2  # アイテム
  1773.       if fin? and $data_items[battler.current_action.item_id].scope == 1..2
  1774.         battler.phase = 6
  1775.         return
  1776.       end
  1777.       make_item_action_result(battler)
  1778.     end
  1779.     if battler.phase == 2
  1780.       # ステップ 3 に移行
  1781.       battler.phase = 3
  1782.     end
  1783.   end
  1784.   #--------------------------------------------------------------------------
  1785.   # ● 基本アクション 結果作成
  1786.   #--------------------------------------------------------------------------
  1787.   def make_basic_action_result(battler)
  1788.     # 攻撃の場合
  1789.     if battler.current_action.basic == 0
  1790.       # アニメーション ID を設定
  1791.       battler.anime1 = battler.animation1_id
  1792.       battler.anime2 = battler.animation2_id
  1793.       # 行動側バトラーがエネミーの場合
  1794.       if battler.is_a?(Game_Enemy)
  1795.         if battler.restriction == 3
  1796.           target = $game_troop.random_target_enemy
  1797.         elsif battler.restriction == 2
  1798.           target = $game_party.random_target_actor
  1799.         else
  1800.           index = battler.current_action.target_index
  1801.           target = $game_party.smooth_target_actor(index)
  1802.         end
  1803.       end
  1804.       # 行動側バトラーがアクターの場合
  1805.       if battler.is_a?(Game_Actor)
  1806.         if battler.restriction == 3
  1807.           target = $game_party.random_target_actor
  1808.         elsif battler.restriction == 2
  1809.           target = $game_troop.random_target_enemy
  1810.         else
  1811.           index = battler.current_action.target_index
  1812.           target = $game_troop.smooth_target_enemy(index)
  1813.         end
  1814.       end
  1815.       # 対象側バトラーの配列を設定
  1816.       battler.target = [target]
  1817.       # 通常攻撃の効果を適用
  1818.       for target in battler.target
  1819.         target.attack_effect(battler)
  1820.       end
  1821.       return
  1822.     end
  1823.     # 防御の場合
  1824.     if battler.current_action.basic == 1
  1825.       return
  1826.     end
  1827.     # 逃げるの場合
  1828. #    if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1829.       # 逃げる
  1830. #      @help_window.set_text("逃げる", 1)
  1831. #      @help_wait = @help_time
  1832. #      battler.escape
  1833. #      return
  1834. #    end
  1835. #========RTAB 1.16=====================================================   
  1836.     # 逃げるの場合
  1837.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1838.       return
  1839.     end
  1840. #======================================================================
  1841.     # 何もしないの場合
  1842.     if battler.current_action.basic == 3
  1843.       # ステップ 6 に移行
  1844.       battler.phase = 6
  1845.       return
  1846.     end
  1847.   end
  1848.   #--------------------------------------------------------------------------
  1849.   # ● スキルまたはアイテムの対象側バトラー設定
  1850.   #     scope : スキルまたはアイテムの効果範囲
  1851.   #--------------------------------------------------------------------------
  1852.   def set_target_battlers(scope, battler)
  1853.     # 行動側バトラーがエネミーの場合
  1854.     if battler.is_a?(Game_Enemy)
  1855.       # 効果範囲で分岐
  1856.       case scope
  1857.       when 1  # 敵単体
  1858.         index =battler.current_action.target_index
  1859.         battler.target.push($game_party.smooth_target_actor(index))
  1860.       when 2  # 敵全体
  1861.         for actor in $game_party.actors
  1862.           if actor.exist?
  1863.             battler.target.push(actor)
  1864.           end
  1865.         end
  1866.       when 3  # 味方単体
  1867.         index = battler.current_action.target_index
  1868.         battler.target.push($game_troop.smooth_target_enemy(index))
  1869.       when 4  # 味方全体
  1870.         for enemy in $game_troop.enemies
  1871.           if enemy.exist?
  1872.             battler.target.push(enemy)
  1873.           end
  1874.         end
  1875.       when 5  # 味方単体 (HP 0)
  1876.         index = battler.current_action.target_index
  1877.         enemy = $game_troop.enemies[index]
  1878.         if enemy != nil and enemy.hp0?
  1879.           battler.target.push(enemy)
  1880.         end
  1881.       when 6  # 味方全体 (HP 0)
  1882.         for enemy in $game_troop.enemies
  1883.           if enemy != nil and enemy.hp0?
  1884.             battler.target.push(enemy)
  1885.           end
  1886.         end
  1887.       when 7  # 使用者
  1888.         battler.target.push(battler)
  1889.       end
  1890.     end
  1891.     # 行動側バトラーがアクターの場合
  1892.     if battler.is_a?(Game_Actor)
  1893.       # 効果範囲で分岐
  1894.       case scope
  1895.       when 1  # 敵単体
  1896.         index = battler.current_action.target_index
  1897.         battler.target.push($game_troop.smooth_target_enemy(index))
  1898.       when 2  # 敵全体
  1899.         for enemy in $game_troop.enemies
  1900.           if enemy.exist?
  1901.             battler.target.push(enemy)
  1902.           end
  1903.         end
  1904.       when 3  # 味方単体
  1905.         index = battler.current_action.target_index
  1906.         battler.target.push($game_party.smooth_target_actor(index))
  1907.       when 4  # 味方全体
  1908.         for actor in $game_party.actors
  1909.           if actor.exist?
  1910.             battler.target.push(actor)
  1911.           end
  1912.         end
  1913.       when 5  # 味方単体 (HP 0)
  1914.         index = battler.current_action.target_index
  1915.         actor = $game_party.actors[index]
  1916.         if actor != nil and actor.hp0?
  1917.           battler.target.push(actor)
  1918.         end
  1919.       when 6  # 味方全体 (HP 0)
  1920.         for actor in $game_party.actors
  1921.           if actor != nil and actor.hp0?
  1922.             battler.target.push(actor)
  1923.           end
  1924.         end
  1925.       when 7  # 使用者
  1926.         battler.target.push(battler)
  1927.       end
  1928.     end
  1929.   end
  1930.   #--------------------------------------------------------------------------
  1931.   # ● スキルアクション 結果作成
  1932.   #--------------------------------------------------------------------------
  1933.   def make_skill_action_result(battler)
  1934.     # スキルを取得
  1935.     @skill = $data_skills[battler.current_action.skill_id]
  1936.     # 連携スキルであるかどうか確認
  1937.     speller = synthe?(battler)
  1938.     # 強制アクションでなければ
  1939.     unless battler.current_action.forcing
  1940.       # SP 切れなどで使用できなくなった場合
  1941.       if speller == nil
  1942.         unless battler.skill_can_use?(@skill.id)
  1943.           # ステップ 6 に移行
  1944.           battler.phase = 6
  1945.          return
  1946.         end
  1947.       end
  1948.     end
  1949.     # SP 消費
  1950.     temp = false
  1951.     if speller != nil
  1952.       for spell in speller
  1953.         if spell.current_action.spell_id == 0
  1954.           spell.sp -= @skill.sp_cost
  1955.         else
  1956.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  1957.         end
  1958.         # ステータスウィンドウをリフレッシュ
  1959.         status_refresh(spell)
  1960.       end
  1961.     else
  1962.       battler.sp -= @skill.sp_cost
  1963.       # ステータスウィンドウをリフレッシュ
  1964.       status_refresh(battler)
  1965.     end
  1966.     # アニメーション ID を設定
  1967.     battler.anime1 = @skill.animation1_id
  1968.     battler.anime2 = @skill.animation2_id
  1969.     # コモンイベント ID を設定
  1970.     battler.event = @skill.common_event_id
  1971.     # 対象側バトラーを設定
  1972.     set_target_battlers(@skill.scope, battler)
  1973.     # スキルの効果を適用
  1974.     for target in battler.target
  1975.       if speller != nil
  1976.         damage = 0
  1977.         d_result = false
  1978.         effective = false
  1979.         state_p = []
  1980.         state_m = []
  1981.         for spell in speller
  1982.           if spell.current_action.spell_id != 0
  1983.             @skill = $data_skills[spell.current_action.spell_id]
  1984.           end
  1985.           effective |= target.skill_effect(spell, @skill)
  1986.           if target.damage[spell].class != String
  1987.             d_result = true
  1988.             damage += target.damage[spell]
  1989.           elsif effective
  1990.             effect = target.damage[spell]
  1991.           end
  1992.           state_p += target.state_p[spell]
  1993.           state_m += target.state_m[spell]
  1994.           target.damage.delete(spell)
  1995.           target.state_p.delete(spell)
  1996.           target.state_m.delete(spell)
  1997.         end
  1998.         if d_result
  1999.           target.damage[battler] = damage
  2000.         elsif effective
  2001.           target.damage[battler] = effect
  2002.         else
  2003.           target.damage[battler] = 0
  2004.         end
  2005.         target.state_p[battler] = state_p
  2006.         target.state_m[battler] = state_m
  2007.       else
  2008.         target.skill_effect(battler, @skill)
  2009.       end
  2010.     end
  2011.   end
  2012.   #--------------------------------------------------------------------------
  2013.   # ● アイテムアクション 結果作成
  2014.   #--------------------------------------------------------------------------
  2015.   def make_item_action_result(battler)
  2016.     # アイテムを取得
  2017.     @item = $data_items[battler.current_action.item_id]
  2018.     # アイテム切れなどで使用できなくなった場合
  2019.     unless $game_party.item_can_use?(@item.id)
  2020.       # ステップ 6 に移行
  2021.       battler.phase = 6
  2022.       return
  2023.     end
  2024.     # 消耗品の場合
  2025.     if @item.consumable
  2026.      # 使用したアイテムを 1 減らす
  2027.       $game_party.lose_item(@item.id, 1)
  2028.     end
  2029.    
  2030.     # アニメーション ID を設定
  2031.     battler.anime1 = @item.animation1_id
  2032.     battler.anime2 = @item.animation2_id
  2033.     # コモンイベント ID を設定
  2034.     battler.event = @item.common_event_id
  2035.     # 対象を決定
  2036.     index = battler.current_action.target_index
  2037.     target = $game_party.smooth_target_actor(index)
  2038.     # 対象側バトラーを設定
  2039.     set_target_battlers(@item.scope, battler)
  2040.     # アイテムの効果を適用
  2041.     for target in battler.target
  2042.       target.item_effect(@item, battler)
  2043.     end
  2044.   end
  2045.   #--------------------------------------------------------------------------
  2046.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2047.   #--------------------------------------------------------------------------
  2048.   def update_phase4_step3(battler)
  2049.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2050.     case battler.current_action.kind
  2051.     when 0  # 基本
  2052.       if battler.current_action.basic == 1
  2053.         @help_window.set_text($data_system.words.guard, 1)
  2054.         @help_wait = @help_time
  2055.       end
  2056. #========RTAB 1.16==================================      
  2057.       if battler.current_action.basic == 2
  2058.         # 逃げる
  2059.         @help_window.set_text("逃げる", 1)
  2060.         @help_wait = @help_time
  2061.         battler.escape
  2062.         battler.phase = 4
  2063.         return
  2064.       end
  2065. #===================================================        
  2066.     when 1  # スキル
  2067.       skill =  $data_skills[battler.current_action.skill_id]
  2068.       @help_window.set_text(skill.name, 1)
  2069.       @help_wait = @help_time
  2070.     when 2  # アイテム
  2071.       item = $data_items[battler.current_action.item_id]
  2072.       @help_window.set_text(item.name, 1)
  2073.       @help_wait = @help_time
  2074.     end
  2075.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2076.     if battler.anime1 == 0
  2077.       battler.white_flash = true
  2078.       battler.wait = 5
  2079.       # カメラ設定
  2080.       if battler.target[0].is_a?(Game_Enemy)
  2081.         camera_set(battler)
  2082.       end
  2083.     else
  2084.       battler.animation.push([battler.anime1, true])
  2085.       speller = synthe?(battler)
  2086.       if speller != nil
  2087.         for spell in speller
  2088.           if spell != battler
  2089.             if spell.current_action.spell_id == 0
  2090.               spell.animation.push([battler.anime1, true])
  2091.             else
  2092.               skill = spell.current_action.spell_id
  2093.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2094.               spell.current_action.spell_id = 0
  2095.             end
  2096.           end
  2097.         end
  2098.       end
  2099.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2100.     end
  2101.     # ステップ 4 に移行
  2102.     battler.phase = 4
  2103.   end
  2104.   #--------------------------------------------------------------------------
  2105.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2106.   #--------------------------------------------------------------------------
  2107.   def update_phase4_step4(battler)
  2108.     # カメラ設定
  2109.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  2110.        camera_set(battler)
  2111.     end
  2112.     # 対象側アニメーション
  2113.     for target in battler.target
  2114.       target.animation.push([battler.anime2,
  2115.                                           (target.damage[battler] != "Miss")])
  2116.       unless battler.anime2 == 0
  2117.         battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
  2118.       end
  2119.     end
  2120.     # ステップ 5 に移行
  2121.     battler.phase = 5
  2122.   end
  2123.   #--------------------------------------------------------------------------
  2124.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  2125.   #--------------------------------------------------------------------------
  2126.   def update_phase4_step5(battler)
  2127.     # ダメージ表示
  2128.     for target in battler.target
  2129.       if target.damage[battler] != nil
  2130.         target.damage_pop[battler] = true
  2131.         target.damage_effect( battler)
  2132.         target.damage_effect(battler, battler.current_action.kind)
  2133.           battler.wait = @damage_wait
  2134.         # ステータスウィンドウをリフレッシュ
  2135.         status_refresh(target)
  2136.       end
  2137.     end
  2138.     # ステップ 6 に移行
  2139.     battler.phase = 6
  2140.   end
  2141.   #--------------------------------------------------------------------------
  2142.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  2143.   #--------------------------------------------------------------------------
  2144.   def update_phase4_step6(battler)
  2145.     # カメラを戻す
  2146.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  2147.       @spriteset.screen_target(0, 0, 1)
  2148.     end
  2149.     # スキルラーニング
  2150.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  2151.       for target in battler.target
  2152.         skill_learning(target, target.class_id,
  2153.                         battler.current_action.skill_id)
  2154.       end
  2155.     end
  2156.     # アクション強制対象のバトラーをクリア
  2157.     if battler.current_action.forcing == true and
  2158.         battler.current_action.force_kind == 0 and
  2159.         battler.current_action.force_basic == 0 and
  2160.         battler.current_action.force_skill_id == 0
  2161.       $game_temp.forcing_battler = nil
  2162.       battler.current_action.forcing = false
  2163.     end
  2164.     refresh_phase(battler)
  2165.     speller = synthe?(battler)
  2166.     if speller != nil
  2167.       for spell in speller
  2168.         if spell != battler
  2169.           refresh_phase(spell)
  2170.         end
  2171.       end
  2172.       synthe_delete(speller)
  2173.     end
  2174.     # コモンイベント ID が有効の場合
  2175.     if battler.event > 0
  2176.       # イベントをセットアップ
  2177.       common_event = $data_common_events[battler.event]
  2178.       $game_system.battle_interpreter.setup(common_event.list, 0)
  2179.     end
  2180.     act = 0
  2181.     for actor in $game_party.actors + $game_troop.enemies
  2182.       if actor.movable?
  2183.         act += 1
  2184.       end
  2185.     end
  2186.     if @turn_cnt >= act and act > 0
  2187.       @turn_cnt %= act
  2188.       $game_temp.battle_turn += 1
  2189.       # バトルイベントの全ページを検索
  2190.       for index in 0...$data_troops[@troop_id].pages.size
  2191.         # イベントページを取得
  2192.         page = $data_troops[@troop_id].pages[index]
  2193.         # このページのスパンが [ターン] の場合
  2194.         if page.span == 1
  2195.           # 実行済みフラグをクリア
  2196.           $game_temp.battle_event_flags[index] = false
  2197.         end
  2198.       end
  2199.     end
  2200.     battler.phase = 1
  2201.     @action_battlers.delete(battler)
  2202.   end
  2203.   #--------------------------------------------------------------------------
  2204.   # ● リフレッシュ
  2205.   #--------------------------------------------------------------------------
  2206.   def refresh_phase(battler)
  2207.     battler.at -= @max
  2208.     if battler.movable?
  2209.       battler.atp = 100 * battler.at / @max
  2210.     end
  2211.     spell_reset(battler)
  2212.     # スリップダメージ
  2213.     if battler.hp > 0 and battler.slip_damage?
  2214.       battler.slip_damage_effect
  2215.       battler.damage_pop["slip"] = true
  2216.     end
  2217.     # ステート自然解除
  2218.     battler.remove_states_auto
  2219.     # ステータスウィンドウをリフレッシュ
  2220.     status_refresh(battler, true)
  2221.     unless battler.movable?
  2222.       return
  2223.     end
  2224.     # ターン数カウント
  2225.     @turn_cnt += 1
  2226.   end
  2227.   #--------------------------------------------------------------------------
  2228.   # ● バトラーアクションスタート
  2229.   #--------------------------------------------------------------------------
  2230.   def action_start(battler)
  2231.     battler.phase = 1
  2232.     battler.anime1 = 0
  2233.     battler.anime2 = 0
  2234.     battler.target = []
  2235.     battler.event = 0
  2236.     @action_battlers.unshift(battler)
  2237.   end
  2238.   #--------------------------------------------------------------------------
  2239.   # ● ステータスウィンドウをリフレッシュ
  2240.   #--------------------------------------------------------------------------
  2241.   def status_refresh(battler, at = false)
  2242.     if battler.is_a?(Game_Actor)
  2243.       for i in 0...$game_party.actors.size
  2244.         if battler == $game_party.actors[i]
  2245.           number = i + 1
  2246.         end
  2247.       end
  2248.       @status_window.refresh(number)
  2249.       if at == true
  2250.         @status_window.at_refresh(number)
  2251.       end
  2252.     end
  2253.   end
  2254.   #--------------------------------------------------------------------------
  2255.   # ● アニメウェイト判断処理
  2256.   #--------------------------------------------------------------------------
  2257.   def anime_wait_return
  2258.     if (@action_battlers.empty? or @anime_wait == false) and
  2259.         not $game_system.battle_interpreter.running?
  2260.       # エネミーアローが有効の場合
  2261.       if @enemy_arrow != nil
  2262.         return [@active - 2, 0].min == 0
  2263.       # アクターアローが有効の場合
  2264.       elsif @actor_arrow != nil
  2265.         return [@active - 2, 0].min == 0
  2266.       # スキルウィンドウが有効の場合
  2267.       elsif @skill_window != nil
  2268.         return [@active - 3, 0].min == 0
  2269.       # アイテムウィンドウが有効の場合
  2270.       elsif @item_window != nil
  2271.         return [@active - 3, 0].min == 0
  2272.       # アクターコマンドウィンドウが有効の場合
  2273.       elsif @actor_command_window.active
  2274.         return [@active - 1, 0].min == 0
  2275.       else
  2276.         return true
  2277.       end
  2278.     else
  2279.       return false
  2280.     end
  2281.   end
  2282.   #--------------------------------------------------------------------------
  2283.   # ● アクターコマンド消去判断
  2284.   #--------------------------------------------------------------------------
  2285.   def command_delete
  2286.     # エネミーアローが有効の場合
  2287.     if @enemy_arrow != nil
  2288.       end_enemy_select
  2289.     # アクターアローが有効の場合
  2290.     elsif @actor_arrow != nil
  2291.       end_actor_select
  2292.     end
  2293.     # スキルウィンドウが有効の場合
  2294.     if @skill_window != nil
  2295.       end_skill_select
  2296.     # アイテムウィンドウが有効の場合
  2297.     elsif @item_window != nil
  2298.       end_item_select
  2299.     end
  2300.     # アクターコマンドウィンドウが有効の場合
  2301.     if @actor_command_window.active
  2302.       @command.shift
  2303.       @command_a = false
  2304.       # メインフェーズフラグをセット
  2305.       $game_temp.battle_main_phase = true
  2306.       # アクターコマンドウィンドウを無効化
  2307.       @actor_command_window.active = false
  2308.       @actor_command_window.visible = false
  2309.       # アクターの明滅エフェクト OFF
  2310.       if @active_actor != nil
  2311.         @active_actor.blink = false
  2312.       end
  2313.     end
  2314.   end
  2315.   #--------------------------------------------------------------------------
  2316.   # ● 強制アクション設定
  2317.   #--------------------------------------------------------------------------
  2318.   def force_action(battler)
  2319.     battler.current_action.kind = battler.current_action.force_kind
  2320.     battler.current_action.basic = battler.current_action.force_basic
  2321.     battler.current_action.skill_id = battler.current_action.force_skill_id
  2322.     battler.current_action.force_kind = 0
  2323.     battler.current_action.force_basic = 0
  2324.     battler.current_action.force_skill_id = 0
  2325.   end
  2326.   #--------------------------------------------------------------------------
  2327.   # ● カメラセット
  2328.   #--------------------------------------------------------------------------
  2329.   def camera_set(battler)
  2330.     @camera = battler
  2331.     if battler.target.size == 1
  2332.       if battler.current_action.kind == 0
  2333.         zoom = 1.2 / battler.target[0].zoom
  2334.       elsif synthe?(battler) == nil
  2335.         zoom = 1.5 / battler.target[0].zoom
  2336.       else
  2337.         zoom = 2.0 / battler.target[0].zoom
  2338.       end
  2339.       @spriteset.screen_target(battler.target[0].attack_x(zoom),
  2340.                                 battler.target[0].attack_y(zoom), zoom)
  2341.     else
  2342.       @spriteset.screen_target(0, 0, 0.75)
  2343.     end
  2344.   end
  2345.   #--------------------------------------------------------------------------
  2346.   # ● スキル詠唱タイム作成
  2347.   #--------------------------------------------------------------------------
  2348.   def recite_time(battler)
  2349.   end
  2350.   #--------------------------------------------------------------------------
  2351.   # ● 連携スキル判別
  2352.   #--------------------------------------------------------------------------
  2353.   def synthe_spell(battler)
  2354.   end
  2355.   #--------------------------------------------------------------------------
  2356.   # ● スキルラーニングシステム
  2357.   #--------------------------------------------------------------------------
  2358.   def skill_learning(actor, class_id, skill_id)
  2359.   end
  2360.   #--------------------------------------------------------------------------
  2361.   # ● 行動可能判定
  2362.   #--------------------------------------------------------------------------
  2363.   def active?(battler)
  2364.     speller = synthe?(battler)
  2365.     if speller != nil
  2366.       if synthe_delete?(speller)
  2367.         return false
  2368.       end
  2369.     else
  2370.       unless battler.inputable?
  2371.         spell_reset(battler)
  2372.         unless battler.movable?
  2373.           battler.atp = 0
  2374.           return false
  2375.         end
  2376.       end
  2377.       if battler.current_action.forcing
  2378.         spell_reset(battler)
  2379.       end
  2380.     end
  2381.     return true
  2382.   end
  2383.   #--------------------------------------------------------------------------
  2384.   # ● 合成スキル詠唱中か?
  2385.   #--------------------------------------------------------------------------
  2386.   def synthe?(battler)
  2387.     for speller in @synthe
  2388.       if speller.include?(battler)
  2389.         return speller
  2390.       end
  2391.     end
  2392.     return nil
  2393.   end
  2394.   #--------------------------------------------------------------------------
  2395.   # ● 合成スキル消去判断
  2396.   #--------------------------------------------------------------------------
  2397.   def synthe_delete?(speller)
  2398.     for battler in speller
  2399.       if not battler.inputable? and dead_ok?(battler)
  2400.         synthe_delete(speller)
  2401.         return true
  2402.       end
  2403.     end
  2404.     return false
  2405.   end
  2406.   #--------------------------------------------------------------------------
  2407.   # ● 合成スキル消去
  2408.   #--------------------------------------------------------------------------
  2409.   def synthe_delete(speller)
  2410.     for battler in speller
  2411.       spell_reset(battler)
  2412.       if dead_ok?(battler)
  2413.         @action_battlers.delete(battler)
  2414.       end
  2415.     end
  2416.     @synthe.delete(speller)
  2417.   end
  2418.   #--------------------------------------------------------------------------
  2419.   # ● 連携含むスキル詠唱解除
  2420.   #--------------------------------------------------------------------------
  2421.   def skill_reset(battler)
  2422.     speller = synthe?(battler)
  2423.     if speller != nil
  2424.       synthe_delete(speller)
  2425.     else
  2426.       spell_reset(battler)
  2427.     end
  2428.   end
  2429.   #--------------------------------------------------------------------------
  2430.   # ● スキル詠唱解除
  2431.   #--------------------------------------------------------------------------
  2432.   def spell_reset(battler)
  2433.     battler.rt = 0
  2434.     battler.rtp = 0
  2435.     battler.blink = false
  2436.     battler.spell = false
  2437.     battler.current_action.spell_id = 0
  2438.     @spell_p.delete(battler)
  2439.     @spell_e.delete(battler)
  2440.   end
  2441.   #--------------------------------------------------------------------------
  2442.   # ● 戦闘終了判定
  2443.   #--------------------------------------------------------------------------
  2444.   def fin?
  2445.    return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  2446.   end
  2447.   #--------------------------------------------------------------------------
  2448.   # ● 敵全滅判定
  2449.   #--------------------------------------------------------------------------
  2450.   def victory?
  2451.     for battler in $game_troop.enemies
  2452.       if not battler.hidden and (battler.rest_hp > 0 or
  2453.           battler.immortal or battler.damage_pop.size > 0)
  2454.         return false
  2455.       end
  2456.     end
  2457.     return true
  2458.   end
  2459.   #--------------------------------------------------------------------------
  2460.   # ● 死亡許可判定
  2461.   #--------------------------------------------------------------------------
  2462.   def dead_ok?(battler)
  2463.     speller = synthe?(battler)
  2464.     if speller == nil
  2465.       if @action_battlers.include?(battler)
  2466.         if battler.phase > 2
  2467.           return false
  2468.         end
  2469.       end
  2470.     else
  2471.       for battler in speller
  2472.         if @action_battlers.include?(battler)
  2473.           if battler.phase > 2
  2474.             return false
  2475.           end
  2476.         end
  2477.       end
  2478.     end
  2479.     return true
  2480.   end
  2481. end

  2482. #==============================================================================
  2483. # ■ Game_Actor
  2484. #------------------------------------------------------------------------------
  2485. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2486. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2487. #==============================================================================

  2488. class Game_Actor < Game_Battler
  2489.   #--------------------------------------------------------------------------
  2490.   # ● バトル画面 X 座標の取得
  2491.   #--------------------------------------------------------------------------
  2492.   def screen_x
  2493.     # パーティ内の並び順から X 座標を計算して返す
  2494.     if self.index != nil
  2495.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2496.     else
  2497.       return 0
  2498.     end
  2499.   end
  2500. end

  2501. #==============================================================================
  2502. # ■ Spriteset_Battle
  2503. #------------------------------------------------------------------------------
  2504. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2505. # スの内部で使用されます。
  2506. #==============================================================================

  2507. class Spriteset_Battle
  2508.   #--------------------------------------------------------------------------
  2509.   # ● 公開インスタンス変数
  2510.   #--------------------------------------------------------------------------
  2511.   attr_reader   :real_x                   # x座標補正(現在値)
  2512.   attr_reader   :real_y                   # y座標補正(現在値)
  2513.   attr_reader   :real_zoom                # 拡大率(現在値)
  2514.   #--------------------------------------------------------------------------
  2515.   # ● オブジェクト初期化
  2516.   #--------------------------------------------------------------------------
  2517.   def initialize
  2518.     # ビューポートを作成
  2519.     @viewport1 = Viewport.new(0, 0, 640, 480)
  2520.     @viewport2 = Viewport.new(0, 0, 640, 480)
  2521.     @viewport3 = Viewport.new(0, 0, 640, 480)
  2522.     @viewport4 = Viewport.new(0, 0, 640, 480)
  2523.     @viewport2.z = 101
  2524.     @viewport3.z = 200
  2525.     @viewport4.z = 5000
  2526.     @wait = 0
  2527.     @real_x = 0
  2528.     @real_y = 0
  2529.     @real_zoom = 1.0
  2530.     @target_x = 0
  2531.     @target_y = 0
  2532.     @target_zoom = 1.0
  2533.     @gap_x = 0
  2534.     @gap_y = 0
  2535.     @gap_zoom = 0.0
  2536.     # バトルバックスプライトを作成
  2537.     @battleback_sprite = Sprite.new(@viewport1)
  2538.     # エネミースプライトを作成
  2539.     @enemy_sprites = []
  2540.     for enemy in $game_troop.enemies.reverse
  2541.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2542.     end
  2543.     # アクタースプライトを作成
  2544.     @actor_sprites = []
  2545.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2546.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2547.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2548.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2549.     # 天候を作成
  2550.     @weather = RPG::Weather.new(@viewport1)
  2551.     # ピクチャスプライトを作成
  2552.     @picture_sprites = []
  2553.     for i in 51..100
  2554.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  2555.         $game_screen.pictures[i]))
  2556.     end
  2557.     # タイマースプライトを作成
  2558.     @timer_sprite = Sprite_Timer.new
  2559.     # フレーム更新
  2560.     update
  2561.   end
  2562.   #--------------------------------------------------------------------------
  2563.   # ● フレーム更新
  2564.   #--------------------------------------------------------------------------
  2565.   def update
  2566.     # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
  2567.     @actor_sprites[0].battler = $game_party.actors[0]
  2568.     @actor_sprites[1].battler = $game_party.actors[1]
  2569.     @actor_sprites[2].battler = $game_party.actors[2]
  2570.     @actor_sprites[3].battler = $game_party.actors[3]
  2571.     # バトルバックのファイル名が現在のものと違う場合
  2572.     if @battleback_name != $game_temp.battleback_name
  2573.       make_battleback
  2574.     end
  2575.     # 画面のスクロール
  2576.     screen_scroll
  2577.     # モンスターの位置補正
  2578.     for enemy in $game_troop.enemies
  2579.       enemy.real_x = @real_x
  2580.       enemy.real_y = @real_y
  2581.       enemy.real_zoom = @real_zoom
  2582.     end
  2583.     # バトラースプライトを更新
  2584.     for sprite in @enemy_sprites + @actor_sprites
  2585.       sprite.update
  2586.     end
  2587.     # 天候グラフィックを更新
  2588.     @weather.type = $game_screen.weather_type
  2589.     @weather.max = $game_screen.weather_max
  2590.     @weather.update
  2591.     # ピクチャスプライトを更新
  2592.     for sprite in @picture_sprites
  2593.       sprite.update
  2594.     end
  2595.     # タイマースプライトを更新
  2596.     @timer_sprite.update
  2597.     # 画面の色調とシェイク位置を設定
  2598.     @viewport1.tone = $game_screen.tone
  2599.     @viewport1.ox = $game_screen.shake
  2600.     # 画面のフラッシュ色を設定
  2601.     @viewport4.color = $game_screen.flash_color
  2602.     # ビューポートを更新
  2603.     @viewport1.update
  2604.     @viewport2.update
  2605.     @viewport4.update
  2606.   end
  2607.   #--------------------------------------------------------------------------
  2608.   # ● バトル背景の設定
  2609.   #--------------------------------------------------------------------------
  2610.   def make_battleback
  2611.     @battleback_name = $game_temp.battleback_name
  2612.     if @battleback_sprite.bitmap != nil
  2613.       @battleback_sprite.bitmap.dispose
  2614.     end
  2615.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  2616.     if @battleback_sprite.bitmap.width == 640 and
  2617.        @battleback_sprite.bitmap.height == 320
  2618.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  2619.       @base_zoom = 2.0
  2620.       @battleback_sprite.zoom_x = @base_zoom
  2621.       @battleback_sprite.zoom_y = @base_zoom
  2622.       @real_y = 4
  2623.       @battleback_sprite.x = 320
  2624.       @battleback_sprite.y = @real_y
  2625.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2626.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2627.     elsif @battleback_sprite.bitmap.width == 640 and
  2628.           @battleback_sprite.bitmap.height == 480
  2629.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  2630.       @base_zoom = 1.5
  2631.       @battleback_sprite.zoom_x = @base_zoom
  2632.       @battleback_sprite.zoom_y = @base_zoom
  2633.       @battleback_sprite.x = 320
  2634.       @battleback_sprite.y = 0
  2635.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2636.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2637.     else
  2638.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  2639.                                       @battleback_sprite.bitmap.height)
  2640.       @base_zoom = 1.0
  2641.       @battleback_sprite.zoom_x = @base_zoom
  2642.       @battleback_sprite.zoom_y = @base_zoom
  2643.       @battleback_sprite.x = 320
  2644.       @battleback_sprite.y = 0
  2645.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2646.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2647.     end
  2648.   end
  2649.   #--------------------------------------------------------------------------
  2650.   # ● 画面のスクロール目標の位置・拡大率設定
  2651.   #--------------------------------------------------------------------------
  2652.   def screen_target(x, y, zoom)
  2653.     return unless $scene.drive
  2654.     @wait = $scene.scroll_time
  2655.     @target_x = x
  2656.     @target_y = y
  2657.     @target_zoom = zoom
  2658.     screen_over
  2659.     @gap_x = @target_x - @real_x
  2660.     @gap_y = @target_y - @real_y
  2661.     @gap_zoom = @target_zoom - @real_zoom
  2662.   end
  2663.   #--------------------------------------------------------------------------
  2664.   # ● 画面のスクロール
  2665.   #--------------------------------------------------------------------------
  2666.   def screen_scroll
  2667.     if @wait > 0
  2668.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  2669.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  2670.       @real_zoom = @target_zoom -
  2671.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  2672.       @battleback_sprite.x = 320 + @real_x
  2673.       @battleback_sprite.y = @real_y
  2674.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  2675.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  2676.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2677.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2678.       @wait -= 1
  2679.     end
  2680.   end
  2681.   #--------------------------------------------------------------------------
  2682.   # ● スクリーンが画面外に出た時の補正処理
  2683.   #--------------------------------------------------------------------------
  2684.   def screen_over
  2685.     width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
  2686.     unless 324 + @target_x > width and 324 - @target_x > width
  2687.       if 324 + @target_x > width
  2688.         @target_x = width - 324
  2689.       elsif 324 - @target_x > width
  2690.         @target_x = 324 - width
  2691.       end
  2692.     end
  2693.     height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
  2694.     unless @target_y > height - 4 and 484 - @target_y > 3 * height
  2695.       if @target_y > height - 4
  2696.         @target_y = height - 4
  2697.       elsif 484 - @target_y > 3 * height
  2698.         @target_y = 484 - 3 * height
  2699.       end
  2700.     end
  2701.   end
  2702. end

  2703. #==============================================================================
  2704. # ■ Game_Battler (分割定義 1)
  2705. #------------------------------------------------------------------------------
  2706. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2707. # スのスーパークラスとして使用されます。
  2708. #==============================================================================

  2709. class Game_Battler
  2710.   #--------------------------------------------------------------------------
  2711.   # ● 公開インスタンス変数追加
  2712.   #--------------------------------------------------------------------------
  2713.   attr_accessor :up_level                  # レベルアップ数
  2714.   attr_accessor :at                        # AT(タイムゲージ)
  2715.   attr_accessor :atp                       # AT(表示用)
  2716.   attr_accessor :rt                        # RP(詠唱ゲージ)
  2717.   attr_accessor :rtp                       # RP(詠唱必要量)
  2718.   attr_accessor :spell                     # 合成スキル発動中
  2719.   attr_accessor :recover_hp                # HP回復量
  2720.   attr_accessor :recover_sp                # SP回復量
  2721.   attr_accessor :state_p                   # ステータス異常配列
  2722.   attr_accessor :state_m                   # ステータス異常配列
  2723.   attr_accessor :damage_sp                 # SPダメージ表示フラグ
  2724.   attr_accessor :animation                 # アニメーション ID, Hitの配列
  2725.   attr_accessor :phase
  2726.   attr_accessor :wait
  2727.   attr_accessor :target
  2728.   attr_accessor :anime1
  2729.   attr_accessor :anime2
  2730.   attr_accessor :event
  2731.   #--------------------------------------------------------------------------
  2732.   # ● オブジェクト初期化
  2733.   #--------------------------------------------------------------------------
  2734.   alias :initialize_rtab :initialize
  2735.   def initialize
  2736.     initialize_rtab
  2737.     @damage_pop = {}
  2738.     @damage = {}
  2739.     @damage_sp = {}
  2740.     @critical = {}
  2741.     @recover_hp = {}
  2742.     @recover_sp = {}
  2743.     @state_p = {}
  2744.     @state_m = {}
  2745.     @animation = []
  2746.     @phase = 1
  2747.     @wait = 0
  2748.     @target = []
  2749.     @anime1 = 0
  2750.     @anime2 = 0
  2751.     @event = 0
  2752.   end
  2753.   #--------------------------------------------------------------------------
  2754.   # ● 存在判定
  2755.   #--------------------------------------------------------------------------
  2756.   def exist?
  2757.     return (not @hidden and (@hp > 0 or @immortal or @damage.size > 0))
  2758.   end
  2759.   #--------------------------------------------------------------------------
  2760.   # ● 残HP予測
  2761.   #--------------------------------------------------------------------------
  2762.   def rest_hp
  2763.     # rest_hp に現HPを代入
  2764.     rest_hp = @hp
  2765.     # バトラーが受ける全ダメージをrest_hpに反映させる
  2766.     for pre_damage in @damage
  2767.       if pre_damage[1].is_a?(Numeric)
  2768.         rest_hp -= pre_damage[1]
  2769.       end
  2770.     end
  2771.     return rest_hp
  2772.   end
  2773.   #--------------------------------------------------------------------------
  2774.   # ● ステートの解除
  2775.   #     state_id : ステート ID
  2776.   #     force    : 強制解除フラグ (オートステートの処理で使用)
  2777.   #--------------------------------------------------------------------------
  2778.   def remove_state(state_id, force = false)
  2779.     # このステートが付加されている場合
  2780.     if state?(state_id)
  2781.       # 強制付加されたステートで、かつ解除が強制ではない場合
  2782.       if @states_turn[state_id] == -1 and not force
  2783.         # メソッド終了
  2784.         return
  2785.       end
  2786.       # 現在の HP が 0 かつ オプション [HP 0 の状態とみなす] が有効の場合
  2787.       if @hp == 0 and $data_states[state_id].zero_hp
  2788.         # ほかに [HP 0 の状態とみなす] ステートがあるかどうか判定
  2789.         zero_hp = false
  2790.         for i in @states
  2791.           if i != state_id and $data_states[i].zero_hp
  2792.             zero_hp = true
  2793.           end
  2794.         end
  2795.         # 戦闘不能を解除してよければ、HP を 1 に変更
  2796.         if zero_hp == false
  2797.           @hp = 1
  2798.         end
  2799.       end
  2800.       unless self.movable?
  2801.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2802.         @states.delete(state_id)
  2803.         @states_turn.delete(state_id)
  2804.         if self.movable?
  2805.           self.at = 0
  2806.         end
  2807.       else
  2808.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2809.         @states.delete(state_id)
  2810.         @states_turn.delete(state_id)
  2811.       end
  2812.     end
  2813.     # HP および SP の最大値チェック
  2814.     @hp = [@hp, self.maxhp].min
  2815.     @sp = [@sp, self.maxsp].min
  2816.   end
  2817.   #--------------------------------------------------------------------------
  2818.   # ● 通常攻撃の効果適用
  2819.   #     attacker : 攻撃者 (バトラー)
  2820.   #--------------------------------------------------------------------------
  2821.   def attack_effect(attacker)
  2822.     # クリティカルフラグをクリア
  2823.     self.critical[attacker] = false
  2824.     state_p[attacker] = []
  2825.     state_m[attacker] = []
  2826.     # 第一命中判定
  2827.     hit_result = (rand(100) < attacker.hit)
  2828.     # 命中の場合
  2829.     if hit_result == true
  2830.       # 基本ダメージを計算
  2831.       atk = [attacker.atk - self.pdef / 2, 0].max
  2832.       self.damage[attacker] = atk * (20 + attacker.str) / 20
  2833.       # 属性修正
  2834.       self.damage[attacker] *= elements_correct(attacker.element_set)
  2835.       self.damage[attacker] /= 100
  2836.       # ダメージの符号が正の場合
  2837.       if self.damage[attacker] > 0
  2838.         # クリティカル修正
  2839.         if rand(100) < 4 * attacker.dex / self.agi
  2840.           self.damage[attacker] *= 2
  2841.           self.critical[attacker] = true
  2842.         end
  2843.         # 防御修正
  2844.         if self.guarding?
  2845.           self.damage[attacker] /= 2
  2846.         end
  2847.       end
  2848.       # 分散
  2849.       if self.damage[attacker].abs > 0
  2850.         amp = [self.damage[attacker].abs * 15 / 100, 1].max
  2851.         self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
  2852.       end
  2853.       # 第二命中判定
  2854.       eva = 8 * self.agi / attacker.dex + self.eva
  2855.       hit = self.damage[attacker] < 0 ? 100 : 100 - eva
  2856.       hit = self.cant_evade? ? 100 : hit
  2857.       hit_result = (rand(100) < hit)
  2858.     end
  2859.     # 命中の場合
  2860.     if hit_result == true
  2861.       # ステート衝撃解除
  2862.       remove_states_shock
  2863.       # HP からダメージを減算
  2864.       # ステート変化
  2865.       @state_changed = false
  2866.       states_plus(attacker, attacker.plus_state_set)
  2867.       states_minus(attacker, attacker.minus_state_set)
  2868.     # ミスの場合
  2869.     else
  2870.       # ダメージに "Miss" を設定
  2871.       self.damage[attacker] = "Miss"
  2872.       # クリティカルフラグをクリア
  2873.       self.critical[attacker] = false
  2874.     end
  2875.     # メソッド終了
  2876.     return true
  2877.   end
  2878.   #--------------------------------------------------------------------------
  2879.   # ● スキルの効果適用
  2880.   #     user  : スキルの使用者 (バトラー)
  2881.   #     skill : スキル
  2882.   #--------------------------------------------------------------------------
  2883.   def skill_effect(user, skill)
  2884.     # クリティカルフラグをクリア
  2885.     self.critical[user] = false
  2886.     state_p[user] = []
  2887.     state_m[user] = []
  2888.     # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  2889.     # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  2890.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0)# or
  2891.   #     ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  2892.       # メソッド終了
  2893.       return false
  2894.     end
  2895.     # 有効フラグをクリア
  2896.     effective = false
  2897.     # コモンイベント ID が有効の場合は有効フラグをセット
  2898.     effective |= skill.common_event_id > 0
  2899.     # 第一命中判定
  2900.     hit = skill.hit
  2901.     if skill.atk_f > 0
  2902.       hit *= user.hit / 100
  2903.     end
  2904.     hit_result = (rand(100) < hit)
  2905.     # 不確実なスキルの場合は有効フラグをセット
  2906.     effective |= hit < 100
  2907.     # 命中の場合
  2908.     if hit_result == true
  2909.       # 威力を計算
  2910.       power = skill.power + user.atk * skill.atk_f / 100
  2911.       if power > 0
  2912.         power -= self.pdef * skill.pdef_f / 200
  2913.         power -= self.mdef * skill.mdef_f / 200
  2914.         power = [power, 0].max
  2915.       end
  2916.       # 倍率を計算
  2917.       rate = 20
  2918.       rate += (user.str * skill.str_f / 100)
  2919.       rate += (user.dex * skill.dex_f / 100)
  2920.       rate += (user.agi * skill.agi_f / 100)
  2921.       rate += (user.int * skill.int_f / 100)
  2922.       # 基本ダメージを計算
  2923.       self.damage[user] = power * rate / 20
  2924.       # 属性修正
  2925.       self.damage[user] *= elements_correct(skill.element_set)
  2926.       self.damage[user] /= 100
  2927.       # ダメージの符号が正の場合
  2928.       if self.damage[user] > 0
  2929.         # 防御修正
  2930.         if self.guarding?
  2931.           self.damage[user] /= 2
  2932.         end
  2933.       end
  2934.       # 分散
  2935.       if skill.variance > 0 and self.damage[user].abs > 0
  2936.         amp = [self.damage[user].abs * skill.variance / 100, 1].max
  2937.         self.damage[user] += rand(amp+1) + rand(amp+1) - amp
  2938.       end
  2939.       # 第二命中判定
  2940.       eva = 8 * self.agi / user.dex + self.eva
  2941.       hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
  2942.       hit = self.cant_evade? ? 100 : hit
  2943.       hit_result = (rand(100) < hit)
  2944.       # 不確実なスキルの場合は有効フラグをセット
  2945.       effective |= hit < 100
  2946.     end
  2947.     # 命中の場合
  2948.     if hit_result == true
  2949.       # 威力 0 以外の物理攻撃の場合
  2950.       if skill.power != 0 and skill.atk_f > 0
  2951.         # ステート衝撃解除
  2952.         remove_states_shock
  2953.         # 有効フラグをセット
  2954.         effective = true
  2955.       end
  2956.       # HP の変動判定
  2957.       last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
  2958.       # 効果判定
  2959.       effective |= self.hp != last_hp
  2960.       # ステート変化
  2961.       @state_changed = false
  2962.       effective |= states_plus(user, skill.plus_state_set)
  2963.       effective |= states_minus(user, skill.minus_state_set)
  2964.       unless $game_temp.in_battle
  2965.         self.damage_effect(user,1, skill )
  2966.       end
  2967.       # 威力が 0 の場合
  2968.       if skill.power == 0
  2969.         # ダメージに空文字列を設定
  2970.         self.damage[user] = ""
  2971.         # ステートに変化がない場合
  2972.         unless @state_changed
  2973.           # ダメージに "Miss" を設定
  2974.           self.damage[user] = "Miss"
  2975.         end
  2976.       end
  2977.     # ミスの場合
  2978.     else
  2979.       # ダメージに "Miss" を設定
  2980.       self.damage[user] = "Miss"
  2981.     end
  2982.     # 戦闘中でない場合
  2983.     unless $game_temp.in_battle
  2984.       # ダメージに nil を設定
  2985.       self.damage[user] = nil
  2986.     end
  2987.     # メソッド終了
  2988.     return effective
  2989.   end
  2990.   #--------------------------------------------------------------------------
  2991.   # ● アイテムの効果適用
  2992.   #     item : アイテム
  2993.   #--------------------------------------------------------------------------
  2994.   def item_effect(item, user = $game_party.actors[0])
  2995.     # クリティカルフラグをクリア
  2996.     self.critical[user] = false
  2997.     state_p[user] = []
  2998.     state_m[user] = []
  2999.     self.recover_hp[user] = 0
  3000.     self.recover_sp[user] = 0
  3001.     # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  3002.     # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  3003.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0)# or
  3004.     #   ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  3005.       # メソッド終了
  3006.       return false
  3007.     end
  3008.     # 有効フラグをクリア
  3009.     effective = false
  3010.     # コモンイベント ID が有効の場合は有効フラグをセット
  3011.     effective |= item.common_event_id > 0
  3012.     # 命中判定
  3013.     hit_result = (rand(100) < item.hit)
  3014.     # 不確実なスキルの場合は有効フラグをセット
  3015.     effective |= item.hit < 100
  3016.     # 命中の場合
  3017.     if hit_result == true
  3018.       # 回復量を計算
  3019.       self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
  3020.                               item.recover_hp
  3021.       self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
  3022.                               item.recover_sp
  3023.       if self.recover_hp[user] < 0
  3024.         self.recover_hp[user] += self.pdef * item.pdef_f / 20
  3025.         self.recover_hp[user] += self.mdef * item.mdef_f / 20
  3026.         self.recover_hp[user] = [self.recover_hp[user], 0].min
  3027.       end
  3028.       # 属性修正
  3029.       self.recover_hp[user] *= elements_correct(item.element_set)
  3030.       self.recover_hp[user] /= 100
  3031.       self.recover_sp[user] *= elements_correct(item.element_set)
  3032.       self.recover_sp[user] /= 100
  3033.       # 分散
  3034.       if item.variance > 0 and self.recover_hp[user].abs > 0
  3035.         amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
  3036.         self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
  3037.       end
  3038.       if item.variance > 0 and self.recover_sp[user].abs > 0
  3039.         amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
  3040.         self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
  3041.       end
  3042.       # 回復量の符号が負の場合
  3043.       if self.recover_hp[user] < 0
  3044.         # 防御修正
  3045.         if self.guarding?
  3046.           self.recover_hp[user] /= 2
  3047.         end
  3048.       end
  3049.       # HP 回復量の符号を反転し、ダメージの値に設定
  3050.       self.damage[user] = -self.recover_hp[user]
  3051.       # HP および SP の変動判定
  3052.       last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
  3053.       last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
  3054.       effective |= self.hp != last_hp
  3055.       effective |= self.sp != last_sp
  3056.       # ステート変化
  3057.       @state_changed = false
  3058.       effective |= states_plus(user, item.plus_state_set)
  3059.       effective |= states_minus(user, item.minus_state_set)
  3060.       unless $game_temp.in_battle
  3061.         self.damage_effect(user,2, nil)
  3062.       end
  3063.       # パラメータ上昇値が有効の場合
  3064.       if item.parameter_type > 0 and item.parameter_points != 0
  3065.         # パラメータで分岐
  3066.         case item.parameter_type
  3067.         when 1  # MaxHP
  3068.           @maxhp_plus += item.parameter_points
  3069.         when 2  # MaxSP
  3070.           @maxsp_plus += item.parameter_points
  3071.         when 3  # 腕力
  3072.           @str_plus += item.parameter_points
  3073.         when 4  # 器用さ
  3074.           @dex_plus += item.parameter_points
  3075.         when 5  # 素早さ
  3076.           @agi_plus += item.parameter_points
  3077.         when 6  # 魔力
  3078.           @int_plus += item.parameter_points
  3079.         end
  3080.         # 有効フラグをセット
  3081.         effective = true
  3082.       end
  3083.       # HP 回復率と回復量が 0 の場合
  3084.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  3085.         # ダメージに空文字列を設定
  3086.         self.damage[user] = ""
  3087.         # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合
  3088.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  3089.            (item.parameter_type == 0 or item.parameter_points == 0)
  3090.           # ステートに変化がない場合
  3091.           unless @state_changed
  3092.             # ダメージに "Miss" を設定
  3093.             self.damage[user] = "Miss"
  3094.           end
  3095.         end
  3096.       end
  3097.     # ミスの場合
  3098.     else
  3099.       # ダメージに "Miss" を設定
  3100.       self.damage[user] = "Miss"
  3101.     end
  3102.     # 戦闘中でない場合
  3103.     unless $game_temp.in_battle
  3104.       # ダメージに nil を設定
  3105.       self.damage[user] = nil
  3106.     end
  3107.     # メソッド終了
  3108.     return effective
  3109.   end
  3110.   #--------------------------------------------------------------------------
  3111.   # ● ステート変化 (+) の適用
  3112.   #     plus_state_set  : ステート変化 (+)
  3113.   #--------------------------------------------------------------------------
  3114.   def states_plus(battler, plus_state_set)
  3115.     # 有効フラグをクリア
  3116.     effective = false
  3117.     # ループ (付加するステート)
  3118.     for i in plus_state_set
  3119.       # このステートが防御されていない場合
  3120.       unless self.state_guard?(i)
  3121.         # このステートがフルでなければ有効フラグをセット
  3122.         effective |= self.state_full?(i) == false
  3123.         # ステートが [抵抗しない] の場合
  3124.         if $data_states[i].nonresistance
  3125.           # ステート変化フラグをセット
  3126.           @state_changed = true
  3127.           # ステートを付加
  3128.           self.state_p[battler].push(i)
  3129.         # このステートがフルではない場合
  3130.         elsif self.state_full?(i) == false
  3131.           # ステート有効度を確率に変換し、乱数と比較
  3132.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  3133.             # ステート変化フラグをセット
  3134.             @state_changed = true
  3135.             # ステートを付加
  3136.             self.state_p[battler].push(i)
  3137.           end
  3138.         end
  3139.       end
  3140.     end
  3141.     # メソッド終了
  3142.     return effective
  3143.   end
  3144.   #--------------------------------------------------------------------------
  3145.   # ● ステート変化 (-) の適用
  3146.   #     minus_state_set : ステート変化 (-)
  3147.   #--------------------------------------------------------------------------
  3148.   def states_minus(battler, minus_state_set)
  3149.     # 有効フラグをクリア
  3150.     effective = false
  3151.     # ループ (解除するステート)
  3152.     for i in minus_state_set
  3153.       # このステートが付加されていれば有効フラグをセット
  3154.       effective |= self.state?(i)
  3155.       # ステート変化フラグをセット
  3156.       @state_changed = true
  3157.       # ステートを解除
  3158.       self.state_m[battler].push(i)
  3159.     end
  3160.     # メソッド終了
  3161.     return effective
  3162.   end
  3163.   #--------------------------------------------------------------------------
  3164.   # ● ダメージ演算
  3165.   #--------------------------------------------------------------------------
  3166.   def damage_effect(battler, item)
  3167.     if item == 2
  3168.       self.hp += self.recover_hp[battler]
  3169.       self.sp += self.recover_sp[battler]
  3170.       if self.recover_sp[battler] != 0
  3171.         self.damage_sp[battler] = -self.recover_sp[battler]
  3172.       end
  3173.       self.recover_hp.delete(battler)
  3174.       self.recover_sp.delete(battler)
  3175.     else
  3176.       if self.damage[battler].class != String
  3177.         self.hp -= self.damage[battler]
  3178.       end
  3179.     end
  3180.     for i in self.state_p[battler]
  3181.       add_state(i)
  3182.     end
  3183.     for i in self.state_m[battler]
  3184.       remove_state(i)
  3185.     end
  3186.   end
  3187.   #--------------------------------------------------------------------------
  3188.   # ● スリップダメージの効果適用
  3189.   #--------------------------------------------------------------------------
  3190. # 3=>毒
  3191. # 24=>回血
  3192. # 32=>烧伤
  3193. # 33=>冻伤
  3194. # 45=>回蓝
  3195. def slip_damage_effect
  3196.   hp_v = {3 => self.maxhp / 30, 24 => -self.hp / 20, 32 => self.maxhp / 10,33 => self.maxhp / 10}
  3197.   sp_v = {45 => -self.maxsp / 20}
  3198.   hp_damage = 0
  3199.   sp_damage = 0
  3200.   hp_v.keys.each do |id|
  3201.     hp_damage += hp_v[id] if self.state?(id)
  3202.   end
  3203.   sp_v.keys.each do |id|
  3204.     sp_damage += sp_v[id] if self.state?(id)
  3205.   end
  3206.   self.damage["slip"] = hp_damage if hp_damage != 0
  3207.   self.hp -= hp_damage
  3208.   self.damage_sp["slip"] = sp_damage if sp_damage != 0
  3209.   self.sp -= sp_damage
  3210. end
  3211. end
  3212. #######################################
  3213. #==============================================================================
  3214. # ■ Game_BattleAction
  3215. #------------------------------------------------------------------------------
  3216. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3217. # スの内部で使用されます。
  3218. #==============================================================================

  3219. class Game_BattleAction
  3220.   #--------------------------------------------------------------------------
  3221.   # ● 公開インスタンス変数
  3222.   #--------------------------------------------------------------------------
  3223.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3224.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3225.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3226.   attr_accessor :force_skill_id           # スキル ID
  3227.   #--------------------------------------------------------------------------
  3228.   # ● 有効判定
  3229.   #--------------------------------------------------------------------------
  3230.   def valid?
  3231.     return (not (@force_kind == 0 and @force_basic == 3))
  3232.   end
  3233. end

  3234. #==============================================================================
  3235. # ■ Game_Actor
  3236. #------------------------------------------------------------------------------
  3237. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3238. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3239. #==============================================================================

  3240. class Game_Actor < Game_Battler
  3241.   def skill_can_use?(skill_id)
  3242.     return super
  3243.   end
  3244. end

  3245. #==============================================================================
  3246. # ■ Game_Enemy
  3247. #------------------------------------------------------------------------------
  3248. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3249. # 内部で使用されます。
  3250. #==============================================================================

  3251. class Game_Enemy < Game_Battler
  3252.   #--------------------------------------------------------------------------
  3253.   # ● 公開インスタンス変数
  3254.   #--------------------------------------------------------------------------
  3255.   attr_accessor :height                  # 画像の高さ
  3256.   attr_accessor :real_x                  # X座標補正
  3257.   attr_accessor :real_y                  # Y座標補正
  3258.   attr_accessor :real_zoom               # 拡大率
  3259.   #--------------------------------------------------------------------------
  3260.   # ● オブジェクト初期化
  3261.   #     troop_id     : トループ ID
  3262.   #     member_index : トループメンバーのインデックス
  3263.   #--------------------------------------------------------------------------
  3264.   def initialize(troop_id, member_index)
  3265.     super()
  3266.     @troop_id = troop_id
  3267.     @member_index = member_index
  3268.     troop = $data_troops[@troop_id]
  3269.     @enemy_id = troop.members[@member_index].enemy_id
  3270.     enemy = $data_enemies[@enemy_id]
  3271.     @battler_name = enemy.battler_name
  3272.     @battler_hue = enemy.battler_hue
  3273.     @hp = maxhp
  3274.     @sp = maxsp
  3275.     @real_x = 0
  3276.     @real_y = 0
  3277.     @real_zoom = 1.0
  3278.     @fly = 0
  3279.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3280.     @hidden = troop.members[@member_index].hidden
  3281.     @immortal = troop.members[@member_index].immortal
  3282.   end
  3283.   alias :true_x :screen_x
  3284.   alias :true_y :screen_y
  3285.   #--------------------------------------------------------------------------
  3286.   # ● バトル画面 X 座標の取得
  3287.   #--------------------------------------------------------------------------
  3288.   def screen_x
  3289.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3290.   end
  3291.   #--------------------------------------------------------------------------
  3292.   # ● バトル画面 Y 座標の取得
  3293.   #--------------------------------------------------------------------------
  3294.   def screen_y
  3295.     return true_y * @real_zoom + @real_y
  3296.   end
  3297.   #--------------------------------------------------------------------------
  3298.   # ● バトル画面 Z 座標の取得
  3299.   #--------------------------------------------------------------------------
  3300.   def screen_z
  3301.     return true_y + @fly
  3302.   end
  3303.   #--------------------------------------------------------------------------
  3304.   # ● バトル画面 拡大率の取得
  3305.   #--------------------------------------------------------------------------
  3306.   def zoom
  3307.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3308.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3309.   end
  3310.   #--------------------------------------------------------------------------
  3311.   # ● 攻撃用、バトル画面 X 座標の取得
  3312.   #--------------------------------------------------------------------------
  3313.   def attack_x(z)
  3314.     return (320 - true_x) * z * 0.75
  3315.   end
  3316.   #--------------------------------------------------------------------------
  3317.   # ● 攻撃用、バトル画面 Y 座標の取得
  3318.   #--------------------------------------------------------------------------
  3319.   def attack_y(z)
  3320.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3321.   end
  3322.   #--------------------------------------------------------------------------
  3323.   # ● アクション作成
  3324.   #--------------------------------------------------------------------------
  3325.   def make_action
  3326.     # カレントアクションをクリア
  3327.     self.current_action.clear
  3328.     # 動けない場合
  3329.     unless self.inputable?
  3330.       # メソッド終了
  3331.       return
  3332.     end
  3333.     # 現在有効なアクションを抽出
  3334.     available_actions = []
  3335.     rating_max = 0
  3336.     for action in self.actions
  3337.       # ターン 条件確認
  3338.       n = $game_temp.battle_turn
  3339.       a = action.condition_turn_a
  3340.       b = action.condition_turn_b
  3341.       if (b == 0 and n != a) or
  3342.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3343.         next
  3344.       end
  3345.       # HP 条件確認
  3346.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3347.         next
  3348.       end
  3349.       # レベル 条件確認
  3350.       if $game_party.max_level < action.condition_level
  3351.         next
  3352.       end
  3353.       # スイッチ 条件確認
  3354.       switch_id = action.condition_switch_id
  3355.       if switch_id > 0 and $game_switches[switch_id] == false
  3356.         next
  3357.       end
  3358.       # スキル使用可能 条件確認
  3359.       if action.kind == 1
  3360.         unless self.skill_can_use?(action.skill_id)
  3361.           next
  3362.         end
  3363.       end
  3364.       # 条件に該当 : このアクションを追加
  3365.       available_actions.push(action)
  3366.       if action.rating > rating_max
  3367.         rating_max = action.rating
  3368.       end
  3369.     end
  3370.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3371.     ratings_total = 0
  3372.     for action in available_actions
  3373.       if action.rating > rating_max - 3
  3374.         ratings_total += action.rating - (rating_max - 3)
  3375.       end
  3376.     end
  3377.     # レーティングの合計が 0 ではない場合
  3378.     if ratings_total > 0
  3379.       # 乱数を作成
  3380.       value = rand(ratings_total)
  3381.       # 作成した乱数に対応するものをカレントアクションに設定
  3382.       for action in available_actions
  3383.         if action.rating > rating_max - 3
  3384.           if value < action.rating - (rating_max - 3)
  3385.             self.current_action.kind = action.kind
  3386.             self.current_action.basic = action.basic
  3387.             self.current_action.skill_id = action.skill_id
  3388.             self.current_action.decide_random_target_for_enemy
  3389.             return
  3390.           else
  3391.             value -= action.rating - (rating_max - 3)
  3392.           end
  3393.         end
  3394.       end
  3395.     end
  3396.   end
  3397. end

  3398. #==============================================================================
  3399. # ■ Game_Party
  3400. #------------------------------------------------------------------------------
  3401. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3402. # ラスのインスタンスは $game_party で参照されます。
  3403. #==============================================================================

  3404. class Game_Party
  3405.   #--------------------------------------------------------------------------
  3406.   # ● 全滅判定
  3407.   #--------------------------------------------------------------------------
  3408.   def all_dead?
  3409.     # パーティ人数が 0 人の場合
  3410.     if $game_party.actors.size == 0
  3411.       return false
  3412.     end
  3413.     # HP 0 以上のアクターがパーティにいる場合
  3414.     for actor in @actors
  3415.       if actor.rest_hp > 0
  3416.         return false
  3417.       end
  3418.     end
  3419.     # 全滅
  3420.     return true
  3421.   end
  3422.   #--------------------------------------------------------------------------
  3423.   # ● 対象アクターのランダムな決定
  3424.   #     hp0 : HP 0 のアクターに限る
  3425.   #--------------------------------------------------------------------------
  3426.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3427.   alias :random_target_actor_rtab :random_target_actor
  3428.   def random_target_actor(hp0 = false)
  3429.     # ルーレットを初期化
  3430.     roulette = []
  3431.     # ループ
  3432.     for actor in @actors
  3433.       # 条件に該当する場合
  3434.       if (not hp0 and actor.exist? and actor.rest_hp > 0) or
  3435.           (hp0 and actor.hp0?)
  3436.         # アクターのクラスの [位置] を取得
  3437.         position = $data_classes[actor.class_id].position
  3438.         # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  3439.         n = 4 - position
  3440.         # ルーレットにアクターを n 回追加
  3441.         n.times do
  3442.           roulette.push(actor)
  3443.         end
  3444.       end
  3445.     end
  3446.     # ルーレットのサイズが 0 の場合
  3447.     if roulette.size == 0
  3448.       return random_target_actor_rtab(hp0)
  3449.     end
  3450.     # ルーレットを回し、アクターを決定
  3451.     return roulette[rand(roulette.size)]
  3452.   end
  3453.   #--------------------------------------------------------------------------
  3454.   # ● 対象アクターのスムーズな決定
  3455.   #     actor_index : アクターインデックス
  3456.   #--------------------------------------------------------------------------
  3457.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3458.   alias :smooth_target_actor_rtab :smooth_target_actor
  3459.   def smooth_target_actor(actor_index)
  3460.     # アクターを取得
  3461.     actor = @actors[actor_index]
  3462.     # アクターが存在する場合
  3463.     if actor != nil and actor.exist? and actor.rest_hp > 0
  3464.       return actor
  3465.     end
  3466.     # ループ
  3467.     for actor in @actors
  3468.       # アクターが存在する場合
  3469.       if actor.exist? and actor.rest_hp > 0
  3470.         return actor
  3471.       end
  3472.     end
  3473.     # 味方が全滅している場合、オリジナルのターゲット決定ルーチンを実行する
  3474.     return smooth_target_actor_rtab(actor_index)
  3475.   end
  3476. end

  3477. #==============================================================================
  3478. # ■ Game_Troop
  3479. #------------------------------------------------------------------------------
  3480. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3481. # れます。
  3482. #==============================================================================

  3483. class Game_Troop
  3484.   #--------------------------------------------------------------------------
  3485.   # ● 対象エネミーのランダムな決定
  3486.   #     hp0 : HP 0 のエネミーに限る
  3487.   #--------------------------------------------------------------------------
  3488.   # オリジナルのターゲット決定ルーチンを random_target_enemy_rtab と名前変更
  3489.   alias :random_target_enemy_rtab :random_target_enemy
  3490.   def random_target_enemy(hp0 = false)
  3491.     # ルーレットを初期化
  3492.     roulette = []
  3493.     # ループ
  3494.     for enemy in @enemies
  3495.       # 条件に該当する場合
  3496.       if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
  3497.           (hp0 and enemy.hp0?)
  3498.         # ルーレットにエネミーを追加
  3499.         roulette.push(enemy)
  3500.       end
  3501.     end
  3502.     # ルーレットのサイズが 0 の場合
  3503.     if roulette.size == 0
  3504.       return random_target_enemy_rtab(hp0)
  3505.     end
  3506.     # ルーレットを回し、エネミーを決定
  3507.     return roulette[rand(roulette.size)]
  3508.   end
  3509.   #--------------------------------------------------------------------------
  3510.   # ● 対象エネミーのスムーズな決定
  3511.   #     enemy_index : エネミーインデックス
  3512.   #--------------------------------------------------------------------------
  3513.   # オリジナルのターゲット決定ルーチンを smooth_target_enemy_rtab と名前変更
  3514.   alias :smooth_target_enemy_rtab :smooth_target_enemy
  3515.   def smooth_target_enemy(enemy_index)
  3516.     # エネミーを取得
  3517.     enemy = @enemies[enemy_index]
  3518.     # エネミーが存在する場合
  3519.     if enemy != nil and enemy.exist? and enemy.rest_hp > 0
  3520.       return enemy
  3521.     end
  3522.     # ループ
  3523.     for enemy in @enemies
  3524.       # エネミーが存在する場合
  3525.       if enemy.exist? and enemy.rest_hp > 0
  3526.         return enemy
  3527.       end
  3528.     end
  3529.     # 敵が全滅している場合、再度敵の検索を行う
  3530.     return smooth_target_enemy_rtab(enemy_index)
  3531.   end
  3532. end

  3533. #==============================================================================
  3534. # ■ Sprite_Battler
  3535. #------------------------------------------------------------------------------
  3536. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3537. # スプライトの状態を自動的に変化させます。
  3538. #==============================================================================

  3539. class Sprite_Battler < RPG::Sprite
  3540.   #--------------------------------------------------------------------------
  3541.   # ● フレーム更新
  3542.   #--------------------------------------------------------------------------
  3543.   def update
  3544.     super
  3545.     # バトラーが nil の場合
  3546.     if @battler == nil
  3547.       self.bitmap = nil
  3548.       loop_animation(nil)
  3549.       return
  3550.     end
  3551.     # ファイル名か色相が現在のものと異なる場合
  3552.     if @battler.battler_name != @battler_name or
  3553.        @battler.battler_hue != @battler_hue
  3554.       # ビットマップを取得、設定
  3555.       @battler_name = @battler.battler_name
  3556.       @battler_hue = @battler.battler_hue
  3557.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3558.       @width = bitmap.width
  3559.       @height = bitmap.height
  3560.       self.ox = @width / 2
  3561.       self.oy = @height
  3562.       if @battler.is_a?(Game_Enemy)
  3563.         @battler.height = @height
  3564.       end
  3565.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3566.       if @battler.dead? or @battler.hidden
  3567.         self.opacity = 0
  3568.       end
  3569.     end
  3570.     # アニメーション ID が現在のものと異なる場合
  3571.     if @battler.state_animation_id != @state_animation_id
  3572.       @state_animation_id = @battler.state_animation_id
  3573.       loop_animation($data_animations[@state_animation_id])
  3574.     end
  3575.     # 表示されるべきアクターの場合
  3576.     if @battler.is_a?(Game_Actor) and @battler_visible
  3577.       # メインフェーズでないときは不透明度をやや下げる
  3578.       if $game_temp.battle_main_phase
  3579.         self.opacity += 3 if self.opacity < 255
  3580.       else
  3581.         self.opacity -= 3 if self.opacity > 207
  3582.       end
  3583.     end
  3584.     # 明滅
  3585.     if @battler.blink
  3586.       blink_on
  3587.     else
  3588.       blink_off
  3589.     end
  3590.     # 不可視の場合
  3591.     unless @battler_visible
  3592.       # 出現
  3593.       if not @battler.hidden and not @battler.dead? and
  3594.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3595.         appear
  3596.         @battler_visible = true
  3597.       end
  3598.     end
  3599.     # ダメージ
  3600.     for battler in @battler.damage_pop
  3601.       if battler[0].class == Array
  3602.         if battler[0][1] >= 0
  3603.           $scene.skill_se
  3604.         else
  3605.           $scene.levelup_se
  3606.         end
  3607.         damage(@battler.damage[battler[0]], false, 2)
  3608.       else
  3609.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3610.       end
  3611.       if @battler.damage_sp.include?(battler[0])
  3612.         damage(@battler.damage_sp[battler[0]],
  3613.                 @battler.critical[battler[0]], 1)
  3614.         @battler.damage_sp.delete(battler[0])
  3615.       end
  3616.       @battler.damage_pop.delete(battler[0])
  3617.       @battler.damage.delete(battler[0])
  3618.       @battler.critical.delete(battler[0])
  3619.     end
  3620.     # 可視の場合
  3621.     if @battler_visible
  3622.       # 逃走
  3623.       if @battler.hidden
  3624.         $game_system.se_play($data_system.escape_se)
  3625.         escape
  3626.         @battler_visible = false
  3627.       end
  3628.       # 白フラッシュ
  3629.       if @battler.white_flash
  3630.         whiten
  3631.         @battler.white_flash = false
  3632.       end
  3633.       # アニメーション
  3634.       unless @battler.animation.empty?
  3635.         for animation in @battler.animation.reverse
  3636.           animation($data_animations[animation[0]], animation[1])
  3637.           @battler.animation.delete(animation)
  3638.         end
  3639.       end
  3640.       # コラプス
  3641.       if @battler.damage.empty? and @battler.dead?
  3642.         if $scene.dead_ok?(@battler)
  3643.           if @battler.is_a?(Game_Enemy)
  3644.             $game_system.se_play($data_system.enemy_collapse_se)
  3645.           else
  3646.             $game_system.se_play($data_system.actor_collapse_se)
  3647.           end
  3648.           collapse
  3649.           @battler_visible = false
  3650.         end
  3651.       end
  3652.     end
  3653.     # スプライトの座標を設定
  3654.     self.x = @battler.screen_x
  3655.     self.y = @battler.screen_y
  3656.     self.z = @battler.screen_z
  3657.     if @battler.is_a?(Game_Enemy)
  3658.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3659.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3660.     end
  3661.   end
  3662. end

  3663. #==============================================================================
  3664. # ■ Window_Base
  3665. #------------------------------------------------------------------------------
  3666. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3667. #==============================================================================

  3668. class Window_Base < Window
  3669.   #--------------------------------------------------------------------------
  3670.   # ● ゲージの描画
  3671.   #--------------------------------------------------------------------------
  3672.   def gauge_rect_at(width, height, align3,
  3673.                     color1, color2, color3, color4, color5, color6, color7,
  3674.                     color8, color9, color10, color11, color12, grade1, grade2)
  3675.     # 枠描画
  3676.     @at_gauge = Bitmap.new(width, height * 5)
  3677.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3678.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3679.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3680.       color = color3
  3681.       color3 = color4
  3682.       color4 = color
  3683.     end
  3684.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3685.       color = color5
  3686.       color5 = color6
  3687.       color6 = color
  3688.       color = color7
  3689.       color7 = color8
  3690.       color8 = color
  3691.       color = color9
  3692.       color9 = color10
  3693.       color10 = color
  3694.       color = color11
  3695.       color11 = color12
  3696.       color12 = color
  3697.     end
  3698.     if align3 == 0
  3699.       if grade1 == 2
  3700.         grade1 = 3
  3701.       end
  3702.       if grade2 == 2
  3703.         grade2 = 3
  3704.       end
  3705.     end
  3706.     # 空ゲージの描画 縦にグラデーション表示
  3707.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3708.                                   color3, color4, grade1)
  3709.     # 実ゲージの描画
  3710.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3711.                                   color5, color6, grade2)
  3712.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3713.                                   color7, color8, grade2)
  3714.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3715.                                   color9, color10, grade2)
  3716.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3717.                                   color11, color12, grade2)
  3718.   end
  3719. end

  3720. #==============================================================================
  3721. # ■ Window_Help
  3722. #------------------------------------------------------------------------------
  3723. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3724. #==============================================================================

  3725. class Window_Help < Window_Base
  3726.   #--------------------------------------------------------------------------
  3727.   # ● エネミー設定
  3728.   #     enemy : 名前とステートを表示するエネミー
  3729.   #--------------------------------------------------------------------------
  3730.   def set_enemy(enemy)
  3731.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3732.     state_text = make_battler_state_text(enemy, 112, false)
  3733.     if state_text != ""
  3734.       text += "  " + state_text
  3735.     end
  3736.     set_text(text, 1)
  3737.   end
  3738. end

  3739. #==============================================================================
  3740. # ■ Window_BattleStatus
  3741. #------------------------------------------------------------------------------
  3742. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3743. #==============================================================================

  3744. class Window_BattleStatus < Window_Base
  3745.   #--------------------------------------------------------------------------
  3746.   # ● オブジェクト初期化
  3747.   #--------------------------------------------------------------------------
  3748.   def initialize
  3749.     x = (4 - $game_party.actors.size) * 80
  3750.     width = $game_party.actors.size * 160
  3751.     super(x, 320, width, 160)
  3752.     self.back_opacity = 160
  3753.     @actor_window = []
  3754.     for i in 0...$game_party.actors.size
  3755.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3756.     end
  3757.     @level_up_flags = [false, false, false, false]
  3758.     refresh
  3759.   end
  3760.   #--------------------------------------------------------------------------
  3761.   # ● 解放
  3762.   #--------------------------------------------------------------------------
  3763.   def dispose
  3764.     for window in @actor_window
  3765.       window.dispose
  3766.     end
  3767.     super
  3768.   end
  3769.   #--------------------------------------------------------------------------
  3770.   # ● リフレッシュ
  3771.   #--------------------------------------------------------------------------
  3772.   def refresh(number = 0)
  3773.     if number == 0
  3774.       cnt = 0
  3775.       for window in @actor_window
  3776.         window.refresh(@level_up_flags[cnt])
  3777.         cnt += 1
  3778.       end
  3779.     else
  3780.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3781.     end
  3782.   end
  3783.   #--------------------------------------------------------------------------
  3784.   # ● ATゲージリフレッシュ
  3785.   #--------------------------------------------------------------------------
  3786.   def at_refresh(number = 0)
  3787.     if number == 0
  3788.       for window in @actor_window
  3789.         window.at_refresh
  3790.       end
  3791.     else
  3792.       @actor_window[number - 1].at_refresh
  3793.     end
  3794.   end
  3795.   #--------------------------------------------------------------------------
  3796.   # ● フレーム更新
  3797.   #--------------------------------------------------------------------------
  3798.   def update
  3799.     super
  3800.     if self.x != (4 - $game_party.actors.size) * 80
  3801.       self.x = (4 - $game_party.actors.size) * 80
  3802.       self.width = $game_party.actors.size * 160
  3803.       for window in @actor_window
  3804.         window.dispose
  3805.       end
  3806.       @actor_window = []
  3807.       for i in 0...$game_party.actors.size
  3808.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3809.       end
  3810.       refresh
  3811.     end
  3812.     for window in @actor_window
  3813.       window.update
  3814.     end
  3815.   end
  3816. end

  3817. #==============================================================================
  3818. # ■ Window_ActorStatus
  3819. #------------------------------------------------------------------------------
  3820. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3821. #==============================================================================

  3822. class Window_ActorStatus < Window_Base
  3823.   #--------------------------------------------------------------------------
  3824.   # ● オブジェクト初期化
  3825.   #--------------------------------------------------------------------------
  3826.   def initialize(id, x)
  3827.     @actor_num = id
  3828.     super(x, 320, 160, 160)
  3829.     self.contents = Bitmap.new(width - 32, height - 32)
  3830.     self.opacity = 0
  3831.     self.back_opacity = 0
  3832.     actor = $game_party.actors[@actor_num]
  3833.     @actor_nm = actor.name
  3834.     @actor_mhp = actor.maxhp
  3835.     @actor_msp = actor.maxsp
  3836.     @actor_hp = actor.hp
  3837.     @actor_sp = actor.sp
  3838.     @actor_st = make_battler_state_text(actor, 120, true)
  3839.     @status_window = []
  3840.     for i in 0...5
  3841.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3842.     end
  3843.     refresh(false)
  3844.   end
  3845.   #--------------------------------------------------------------------------
  3846.   # ● 解放
  3847.   #--------------------------------------------------------------------------
  3848.   def dispose
  3849.     for i in 0...5
  3850.       @status_window[i].dispose
  3851.     end
  3852.     super
  3853.   end
  3854.   #--------------------------------------------------------------------------
  3855.   # ● リフレッシュ
  3856.   #--------------------------------------------------------------------------
  3857.   def refresh(level_up_flags)
  3858.     self.contents.clear
  3859.     actor = $game_party.actors[@actor_num]
  3860.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3861.     @status_window[1].refresh(actor) if
  3862.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3863.     @status_window[2].refresh(actor) if
  3864.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3865.     @status_window[3].refresh(actor, level_up_flags) if
  3866.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3867.     @actor_nm = actor.name
  3868.     @actor_mhp = actor.maxhp
  3869.     @actor_msp = actor.maxsp
  3870.     @actor_hp = actor.hp
  3871.     @actor_sp = actor.sp
  3872.     @actor_st = make_battler_state_text(actor, 120, true)
  3873.   end
  3874.   #--------------------------------------------------------------------------
  3875.   # ● ATゲージリフレッシュ
  3876.   #--------------------------------------------------------------------------
  3877.   def at_refresh
  3878.     @status_window[4].refresh($game_party.actors[@actor_num])
  3879.   end
  3880.   #--------------------------------------------------------------------------
  3881.   # ● フレーム更新
  3882.   #--------------------------------------------------------------------------
  3883.   def update
  3884.     for window in @status_window
  3885.       window.update
  3886.     end
  3887.   end
  3888. end

  3889. #==============================================================================
  3890. # ■ Window_DetailsStatus
  3891. #------------------------------------------------------------------------------
  3892. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3893. #==============================================================================

  3894. class Window_DetailsStatus < Window_Base
  3895.   #--------------------------------------------------------------------------
  3896.   # ● オブジェクト初期化
  3897.   #--------------------------------------------------------------------------
  3898.   def initialize(actor, id, x)
  3899.     @status_id = id
  3900.     super(x, 320 + id * 26, 160, 64)
  3901.     self.contents = Bitmap.new(width - 32, height - 32)
  3902.     self.opacity = 0
  3903.     self.back_opacity = 0
  3904.     refresh(actor, false)
  3905.   end
  3906.   #--------------------------------------------------------------------------
  3907.   # ● 解放
  3908.   #--------------------------------------------------------------------------
  3909.   def dispose
  3910.     super
  3911.   end
  3912.   #--------------------------------------------------------------------------
  3913.   # ● リフレッシュ
  3914.   #--------------------------------------------------------------------------
  3915.   def refresh(actor, level_up_flags = false)
  3916.     self.contents.clear
  3917.     case @status_id
  3918.     when 0
  3919.       draw_actor_name(actor, 4, 0)
  3920.     when 1
  3921.       draw_actor_hp(actor, 4, 0, 120)
  3922.     when 2
  3923.       draw_actor_sp(actor, 4, 0, 120)
  3924.     when 3
  3925.       if level_up_flags
  3926.         self.contents.font.color = normal_color
  3927.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3928.       else
  3929.         draw_actor_state(actor, 4, 0)
  3930.       end
  3931.     when 4
  3932.       draw_actor_atg(actor, 4, 0, 120)
  3933.     end
  3934.   end
  3935.   #--------------------------------------------------------------------------
  3936.   # ● フレーム更新
  3937.   #--------------------------------------------------------------------------
  3938.   def update
  3939.     # メインフェーズのときは不透明度をやや下げる
  3940.     if $game_temp.battle_main_phase
  3941.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3942.     else
  3943.       self.contents_opacity += 4 if self.contents_opacity < 255
  3944.     end
  3945.   end
  3946. end

  3947. #==============================================================================
  3948. # ■ Arrow_Base
  3949. #------------------------------------------------------------------------------
  3950. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3951. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3952. #==============================================================================

  3953. class Arrow_Base < Sprite
  3954.   #--------------------------------------------------------------------------
  3955.   # ● オブジェクト初期化
  3956.   #     viewport : ビューポート
  3957.   #--------------------------------------------------------------------------
  3958.   def initialize(viewport)
  3959.     super(viewport)
  3960.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3961.     self.ox = 16
  3962.     self.oy = 32
  3963.     self.z = 2500
  3964.     @blink_count = 0
  3965.     @index = 0
  3966.     @help_window = nil
  3967.     update
  3968.   end
  3969. end

  3970. #==============================================================================
  3971. # ■ Arrow_Enemy
  3972. #------------------------------------------------------------------------------
  3973. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  3974. # スを継承します。
  3975. #==============================================================================

  3976. class Arrow_Enemy < Arrow_Base
  3977.   #--------------------------------------------------------------------------
  3978.   # ● フレーム更新
  3979.   #--------------------------------------------------------------------------
  3980.   def update
  3981.     super
  3982.     # 存在しないエネミーを指していたら飛ばす
  3983.     $game_troop.enemies.size.times do
  3984.       break if self.enemy.exist?
  3985.       @index += 1
  3986.       @index %= $game_troop.enemies.size
  3987.     end
  3988.     # カーソル右
  3989.     if Input.repeat?(Input::RIGHT)
  3990.       $game_system.se_play($data_system.cursor_se)
  3991.       $game_troop.enemies.size.times do
  3992.         @index += 1
  3993.         @index %= $game_troop.enemies.size
  3994.         break if self.enemy.exist?
  3995.       end
  3996.       $scene.camera = "select"
  3997.       zoom = 1 / self.enemy.zoom
  3998.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  3999.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4000.     end
  4001.     # カーソル左
  4002.     if Input.repeat?(Input::LEFT)
  4003.       $game_system.se_play($data_system.cursor_se)
  4004.       $game_troop.enemies.size.times do
  4005.         @index += $game_troop.enemies.size - 1
  4006.         @index %= $game_troop.enemies.size
  4007.         break if self.enemy.exist?
  4008.       end
  4009.       $scene.camera = "select"
  4010.       zoom = 1 / self.enemy.zoom
  4011.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4012.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4013.     end
  4014.     # スプライトの座標を設定
  4015.     if self.enemy != nil
  4016.       self.x = self.enemy.screen_x
  4017.       self.y = self.enemy.screen_y
  4018.     end
  4019.   end
  4020. end

  4021. #==============================================================================
  4022. # ■ Interpreter
  4023. #------------------------------------------------------------------------------
  4024. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4025. # スや Game_Event クラスの内部で使用されます。
  4026. #==============================================================================

  4027. class Interpreter
  4028.   #--------------------------------------------------------------------------
  4029.   # ● アクターの入れ替え
  4030.   #--------------------------------------------------------------------------
  4031.   def command_129
  4032.     # アクターを取得
  4033.     actor = $game_actors[@parameters[0]]
  4034.     # アクターが有効の場合
  4035.     if actor != nil
  4036.       # 操作で分岐
  4037.       if @parameters[1] == 0
  4038.         if @parameters[2] == 1
  4039.           $game_actors[@parameters[0]].setup(@parameters[0])
  4040.         end
  4041.         $game_party.add_actor(@parameters[0])
  4042.         if $game_temp.in_battle
  4043.           $game_actors[@parameters[0]].at = 0
  4044.           $game_actors[@parameters[0]].atp = 0
  4045.           $scene.spell_reset($game_actors[@parameters[0]])
  4046.           $game_actors[@parameters[0]].damage_pop = {}
  4047.           $game_actors[@parameters[0]].damage = {}
  4048.           $game_actors[@parameters[0]].damage_sp = {}
  4049.           $game_actors[@parameters[0]].critical = {}
  4050.           $game_actors[@parameters[0]].recover_hp = {}
  4051.           $game_actors[@parameters[0]].recover_sp = {}
  4052.           $game_actors[@parameters[0]].state_p = {}
  4053.           $game_actors[@parameters[0]].state_m = {}
  4054.           $game_actors[@parameters[0]].animation = []
  4055.         end
  4056.       else
  4057.         $game_party.remove_actor(@parameters[0])
  4058.       end
  4059.     end
  4060.     if $game_temp.in_battle
  4061.       $scene.status_window.update
  4062.     end
  4063.     # 継続
  4064.     return true
  4065.   end
  4066.   #--------------------------------------------------------------------------
  4067.   # ● HP の増減
  4068.   #--------------------------------------------------------------------------
  4069.   alias :command_311_rtab :command_311
  4070.   def command_311
  4071.     command_311_rtab
  4072.     if $game_temp.in_battle
  4073.       $scene.status_window.refresh
  4074.     end
  4075.   end
  4076.   #--------------------------------------------------------------------------
  4077.   # ● SP の増減
  4078.   #--------------------------------------------------------------------------
  4079.   alias :command_312_rtab :command_312
  4080.   def command_312
  4081.     command_312_rtab
  4082.     if $game_temp.in_battle
  4083.       $scene.status_window.refresh
  4084.     end
  4085.   end
  4086.   #--------------------------------------------------------------------------
  4087.   # ● ステートの変更
  4088.   #--------------------------------------------------------------------------
  4089.   alias :command_313_rtab :command_313
  4090.   def command_313
  4091.     command_313_rtab
  4092.     if $game_temp.in_battle
  4093.       $scene.status_window.refresh
  4094.     end
  4095.   end
  4096.   #--------------------------------------------------------------------------
  4097.   # ● 全回復
  4098.   #--------------------------------------------------------------------------
  4099.   alias :command_314_rtab :command_314
  4100.   def command_314
  4101.     command_314_rtab
  4102.     if $game_temp.in_battle
  4103.       $scene.status_window.refresh
  4104.     end
  4105.   end
  4106.   #--------------------------------------------------------------------------
  4107.   # ● EXP の増減
  4108.   #--------------------------------------------------------------------------
  4109.   alias :command_315_rtab :command_315
  4110.   def command_315
  4111.     command_315_rtab
  4112.     if $game_temp.in_battle
  4113.       $scene.status_window.refresh
  4114.     end
  4115.   end
  4116.   #--------------------------------------------------------------------------
  4117.   # ● レベルの増減
  4118.   #--------------------------------------------------------------------------
  4119.   alias :command_316_rtab :command_316
  4120.   def command_316
  4121.     command_316_rtab
  4122.     if $game_temp.in_battle
  4123.       $scene.status_window.refresh
  4124.     end
  4125.   end
  4126.   #--------------------------------------------------------------------------
  4127.   # ● パラメータの増減
  4128.   #--------------------------------------------------------------------------
  4129.   alias :command_317_rtab :command_317
  4130.   def command_317
  4131.     command_317_rtab
  4132.     if $game_temp.in_battle
  4133.       $scene.status_window.refresh
  4134.     end
  4135.   end
  4136.   #--------------------------------------------------------------------------
  4137.   # ● 装備の変更
  4138.   #--------------------------------------------------------------------------
  4139.   alias :command_319_rtab :command_319
  4140.   def command_319
  4141.     command_319_rtab
  4142.     if $game_temp.in_battle
  4143.       $scene.status_window.refresh
  4144.     end
  4145.   end
  4146.   #--------------------------------------------------------------------------
  4147.   # ● アクターの名前変更
  4148.   #--------------------------------------------------------------------------
  4149.   alias :command_320_rtab :command_320
  4150.   def command_320
  4151.     command_320_rtab
  4152.     if $game_temp.in_battle
  4153.       $scene.status_window.refresh
  4154.     end
  4155.   end
  4156.   #--------------------------------------------------------------------------
  4157.   # ● アクターのクラス変更
  4158.   #--------------------------------------------------------------------------
  4159.   alias :command_321_rtab :command_321
  4160.   def command_321
  4161.     command_321_rtab
  4162.     if $game_temp.in_battle
  4163.       $scene.status_window.refresh
  4164.     end
  4165.   end
  4166.   #--------------------------------------------------------------------------
  4167.   # ● アニメーションの表示
  4168.   #--------------------------------------------------------------------------
  4169.   def command_337
  4170.     # イテレータで処理
  4171.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4172.       # バトラーが存在する場合
  4173.       if battler.exist?
  4174.         # アニメーション ID を設定
  4175.         battler.animation.push([@parameters[2], true])
  4176.       end
  4177.     end
  4178.     # 継続
  4179.     return true
  4180.   end
  4181.   #--------------------------------------------------------------------------
  4182.   # ● ダメージの処理
  4183.   #--------------------------------------------------------------------------
  4184.   def command_338
  4185.     # 操作する値を取得
  4186.     value = operate_value(0, @parameters[2], @parameters[3])
  4187.     # イテレータで処理
  4188.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4189.       # バトラーが存在する場合
  4190.       if battler.exist?
  4191.         # HP を変更
  4192.         battler.hp -= value
  4193.         # 戦闘中なら
  4194.         if $game_temp.in_battle
  4195.           # ダメージを設定
  4196.           battler.damage["event"] = value
  4197.           battler.damage_pop["event"] = true
  4198.         end
  4199.       end
  4200.     end
  4201.     if $game_temp.in_battle
  4202.       $scene.status_window.refresh
  4203.     end
  4204.     # 継続
  4205.     return true
  4206.   end
  4207.   #--------------------------------------------------------------------------
  4208.   # ● アクションの強制
  4209.   #--------------------------------------------------------------------------
  4210.   def command_339
  4211.     # 戦闘中でなければ無視
  4212.     unless $game_temp.in_battle
  4213.       return true
  4214.     end
  4215.     # ターン数が 0 なら無視
  4216.     if $game_temp.battle_turn == 0
  4217.       return true
  4218.     end
  4219.     # イテレータで処理 (便宜的なもので、複数になることはない)
  4220.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4221.       # バトラーが存在する場合
  4222.       if battler.exist?
  4223.         # アクションを設定
  4224.         battler.current_action.force_kind = @parameters[2]
  4225.         if battler.current_action.force_kind == 0
  4226.           battler.current_action.force_basic = @parameters[3]
  4227.         else
  4228.           battler.current_action.force_skill_id = @parameters[3]
  4229.         end
  4230.         # 行動対象を設定
  4231.         if @parameters[4] == -2
  4232.           if battler.is_a?(Game_Enemy)
  4233.             battler.current_action.decide_last_target_for_enemy
  4234.           else
  4235.             battler.current_action.decide_last_target_for_actor
  4236.           end
  4237.         elsif @parameters[4] == -1
  4238.           if battler.is_a?(Game_Enemy)
  4239.             battler.current_action.decide_random_target_for_enemy
  4240.           else
  4241.             battler.current_action.decide_random_target_for_actor
  4242.           end
  4243.         elsif @parameters[4] >= 0
  4244.           battler.current_action.target_index = @parameters[4]
  4245.         end
  4246.         # アクションが有効かつ [すぐに実行] の場合
  4247.         if battler.current_action.valid? and @parameters[5] == 1
  4248.           # 強制対象のバトラーを設定
  4249.           $game_temp.forcing_battler = battler
  4250.           # インデックスを進める
  4251.           @index += 1
  4252.           # 終了
  4253.           return false
  4254.         elsif battler.current_action.valid? and @parameters[5] == 0
  4255.           battler.current_action.forcing = true
  4256.         end
  4257.       end
  4258.     end
  4259.     # 継続
  4260.     return true
  4261.   end
  4262. end

  4263. #==============================================================================
  4264. # ■ Spriteモジュール
  4265. #------------------------------------------------------------------------------
  4266. #  アニメーションの管理を行うモジュールです。
  4267. #==============================================================================

  4268. module RPG
  4269.   class Sprite < ::Sprite
  4270.     def initialize(viewport = nil)
  4271.       super(viewport)
  4272.       @_whiten_duration = 0
  4273.       @_appear_duration = 0
  4274.       @_escape_duration = 0
  4275.       @_collapse_duration = 0
  4276.       @_damage = []
  4277.       @_animation = []
  4278.       @_animation_duration = 0
  4279.       @_blink = false
  4280.     end
  4281.     def damage(value, critical, type = 0)
  4282.       if value.is_a?(Numeric)
  4283.         damage_string = value.abs.to_s
  4284.       else
  4285.         damage_string = value.to_s
  4286.       end
  4287.       bitmap = Bitmap.new(160, 48)
  4288.       bitmap.font.name = "Arial Black"
  4289.       bitmap.font.size = 32
  4290.       bitmap.font.color.set(0, 0, 0)
  4291.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  4292.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  4293.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  4294.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  4295.       if value.is_a?(Numeric) and value < 0
  4296.         if type == 0
  4297.           bitmap.font.color.set(176, 255, 144)
  4298.         else
  4299.           bitmap.font.color.set(176, 144, 255)
  4300.         end
  4301.       else
  4302.         if type == 0
  4303.           bitmap.font.color.set(255, 255, 255)
  4304.         else
  4305.           bitmap.font.color.set(255, 176, 144)
  4306.         end
  4307.       end
  4308.       if type == 2
  4309.         bitmap.font.color.set(255, 224, 128)
  4310.       end
  4311.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4312.       if critical
  4313.         string = "CRITICAL"
  4314.         bitmap.font.size = 20
  4315.         bitmap.font.color.set(0, 0, 0)
  4316.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4317.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4318.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4319.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4320.         bitmap.font.color.set(255, 255, 255)
  4321.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4322.       end
  4323.       num = @_damage.size
  4324.       if type != 2
  4325.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4326.       else
  4327.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4328.       end
  4329.       @_damage[num][0].bitmap = bitmap
  4330.       @_damage[num][0].ox = 80 + self.viewport.ox
  4331.       @_damage[num][0].oy = 20 + self.viewport.oy
  4332.       if self.battler.is_a?(Game_Actor)
  4333.         @_damage[num][0].x = self.x
  4334.         @_damage[num][0].y = self.y - self.oy / 2
  4335.       else
  4336.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4337.                             self.ox + self.src_rect.width / 2
  4338.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4339.                             self.viewport.rect.y
  4340.         @_damage[num][0].zoom_x = self.zoom_x
  4341.         @_damage[num][0].zoom_y = self.zoom_y
  4342.         @_damage[num][0].z = 3000
  4343.       end
  4344.     end
  4345.     def animation(animation, hit)
  4346.       return if animation == nil
  4347.       num = @_animation.size
  4348.       @_animation.push([animation, hit, animation.frame_max, []])
  4349.       bitmap = RPG::Cache.animation(animation.animation_name,
  4350.                                     animation.animation_hue)
  4351.       if @@_reference_count.include?(bitmap)
  4352.         @@_reference_count[bitmap] += 1
  4353.       else
  4354.         @@_reference_count[bitmap] = 1
  4355.       end
  4356.       if @_animation[num][0].position != 3 or
  4357.           not @@_animations.include?(animation)
  4358.         for i in 0..15
  4359.           sprite = ::Sprite.new
  4360.           sprite.bitmap = bitmap
  4361.           sprite.visible = false
  4362.           @_animation[num][3].push(sprite)
  4363.         end
  4364.         unless @@_animations.include?(animation)
  4365.           @@_animations.push(animation)
  4366.         end
  4367.       end
  4368.       update_animation(@_animation[num])
  4369.     end
  4370.     def loop_animation(animation)
  4371.       return if animation == @_loop_animation
  4372.       dispose_loop_animation
  4373.       @_loop_animation = animation
  4374.       return if @_loop_animation == nil
  4375.       @_loop_animation_index = 0
  4376.       animation_name = @_loop_animation.animation_name
  4377.       animation_hue = @_loop_animation.animation_hue
  4378.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4379.       if @@_reference_count.include?(bitmap)
  4380.         @@_reference_count[bitmap] += 1
  4381.       else
  4382.         @@_reference_count[bitmap] = 1
  4383.       end
  4384.       @_loop_animation_sprites = []
  4385.       for i in 0..15
  4386.         sprite = ::Sprite.new
  4387.         sprite.bitmap = bitmap
  4388.         sprite.visible = false
  4389.         @_loop_animation_sprites.push(sprite)
  4390.       end
  4391.       # update_loop_animation
  4392.     end
  4393.     def dispose_damage
  4394.       for damage in @_damage.reverse
  4395.         damage[0].bitmap.dispose
  4396.         damage[0].dispose
  4397.         @_damage.delete(damage)
  4398.       end
  4399.     end
  4400.     def dispose_animation
  4401.       for anime in @_animation.reverse
  4402.         sprite = anime[3][0]
  4403.         if sprite != nil
  4404.           @@_reference_count[sprite.bitmap] -= 1
  4405.           if @@_reference_count[sprite.bitmap] == 0
  4406.             sprite.bitmap.dispose
  4407.           end
  4408.         end
  4409.         for sprite in anime[3]
  4410.           sprite.dispose
  4411.         end
  4412.         @_animation.delete(anime)
  4413.       end
  4414.     end
  4415.     def effect?
  4416.       @_whiten_duration > 0 or
  4417.       @_appear_duration > 0 or
  4418.       @_escape_duration > 0 or
  4419.       @_collapse_duration > 0 or
  4420.       @_damage.size == 0 or
  4421.       @_animation.size == 0
  4422.     end
  4423.     def update
  4424.       super
  4425.       if @_whiten_duration > 0
  4426.         @_whiten_duration -= 1
  4427.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4428.       end
  4429.       if @_appear_duration > 0
  4430.         @_appear_duration -= 1
  4431.         self.opacity = (16 - @_appear_duration) * 16
  4432.       end
  4433.       if @_escape_duration > 0
  4434.         @_escape_duration -= 1
  4435.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4436.       end
  4437.       if @_collapse_duration > 0
  4438.         @_collapse_duration -= 1
  4439.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4440.       end
  4441.       for damage in @_damage
  4442.         if damage[1] > 0
  4443.           damage[1] -= 1
  4444.           damage[4] -= 3
  4445.           damage[2] -= damage[4]
  4446.           if self.battler.is_a?(Game_Actor)
  4447.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4448.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4449.           else
  4450.             damage[0].x = self.x + self.viewport.rect.x -
  4451.                           self.ox + self.src_rect.width / 2 +
  4452.                           (40 - damage[1]) * damage[3] / 10
  4453.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4454.                           self.viewport.rect.y + damage[2] / 10
  4455.             damage[0].zoom_x = self.zoom_x
  4456.             damage[0].zoom_y = self.zoom_y
  4457.           end
  4458.           damage[0].z = 2960 + damage[1]
  4459.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4460.           if damage[1] == 0
  4461.             damage[0].bitmap.dispose
  4462.             damage[0].dispose
  4463.             @_damage.delete(damage)
  4464.           end
  4465.         end
  4466.       end
  4467.       for anime in @_animation
  4468.         if (Graphics.frame_count % 2 == 0)
  4469.           anime[2] -= 1
  4470.           update_animation(anime)
  4471.         end
  4472.       end
  4473.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4474.         update_loop_animation
  4475.         @_loop_animation_index += 1
  4476.         @_loop_animation_index %= @_loop_animation.frame_max
  4477.       end
  4478.       if @_blink
  4479.         @_blink_count = (@_blink_count + 1) % 32
  4480.         if @_blink_count < 16
  4481.           alpha = (16 - @_blink_count) * 6
  4482.         else
  4483.           alpha = (@_blink_count - 16) * 6
  4484.         end
  4485.         self.color.set(255, 255, 255, alpha)
  4486.       end
  4487.       @@_animations.clear
  4488.     end
  4489.     def update_animation(anime)
  4490.       if anime[2] > 0
  4491.         frame_index = anime[0].frame_max - anime[2]
  4492.         cell_data = anime[0].frames[frame_index].cell_data
  4493.         position = anime[0].position
  4494.         animation_set_sprites(anime[3], cell_data, position)
  4495.         for timing in anime[0].timings
  4496.           if timing.frame == frame_index
  4497.             animation_process_timing(timing, anime[1])
  4498.           end
  4499.         end
  4500.       else
  4501.         @@_reference_count[anime[3][0].bitmap] -= 1
  4502.         if @@_reference_count[anime[3][0].bitmap] == 0
  4503.             anime[3][0].bitmap.dispose
  4504.         end
  4505.         for sprite in anime[3]
  4506.           sprite.dispose
  4507.         end
  4508.         @_animation.delete(anime)
  4509.       end
  4510.     end
  4511.     def animation_set_sprites(sprites, cell_data, position)
  4512.       for i in 0..15
  4513.         sprite = sprites[i]
  4514.         pattern = cell_data[i, 0]
  4515.         if sprite == nil or pattern == nil or pattern == -1
  4516.           sprite.visible = false if sprite != nil
  4517.           next
  4518.         end
  4519.         sprite.visible = true
  4520.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4521.         if position == 3
  4522.           if self.viewport != nil
  4523.             sprite.x = self.viewport.rect.width / 2
  4524.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4525.               sprite.y = self.viewport.rect.height - 320
  4526.             else
  4527.               sprite.y = self.viewport.rect.height - 160
  4528.             end
  4529.           else
  4530.             sprite.x = 320
  4531.             sprite.y = 240
  4532.           end
  4533.         else
  4534.           sprite.x = self.x + self.viewport.rect.x -
  4535.                       self.ox + self.src_rect.width / 2
  4536.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4537.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4538.                         self.viewport.rect.y
  4539.             if position == 0
  4540.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4541.             elsif position == 2
  4542.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4543.             end
  4544.           else
  4545.             sprite.y = self.y + self.viewport.rect.y -
  4546.                         self.oy + self.src_rect.height / 2
  4547.             sprite.y -= self.src_rect.height / 4 if position == 0
  4548.             sprite.y += self.src_rect.height / 4 if position == 2
  4549.           end
  4550.         end
  4551.         sprite.x += cell_data[i, 1]
  4552.         sprite.y += cell_data[i, 2]
  4553.         sprite.z = 2000
  4554.         sprite.ox = 96
  4555.         sprite.oy = 96
  4556.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4557.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4558.         if position != 3
  4559.           sprite.zoom_x *= self.zoom_x
  4560.           sprite.zoom_y *= self.zoom_y
  4561.         end
  4562.         sprite.angle = cell_data[i, 4]
  4563.         sprite.mirror = (cell_data[i, 5] == 1)
  4564.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4565.         sprite.blend_type = cell_data[i, 7]
  4566.       end
  4567.     end
  4568.     def x=(x)
  4569.       sx = x - self.x
  4570.       if sx != 0
  4571.         for anime in @_animation
  4572.           if anime[3] != nil
  4573.             for i in 0..15
  4574.               anime[3][i].x += sx
  4575.             end
  4576.           end
  4577.         end
  4578.         if @_loop_animation_sprites != nil
  4579.           for i in 0..15
  4580.             @_loop_animation_sprites[i].x += sx
  4581.           end
  4582.         end
  4583.       end
  4584.       super
  4585.     end
  4586.     def y=(y)
  4587.       sy = y - self.y
  4588.       if sy != 0
  4589.         for anime in @_animation
  4590.           if anime[3] != nil
  4591.             for i in 0..15
  4592.               anime[3][i].y += sy
  4593.             end
  4594.           end
  4595.         end
  4596.         if @_loop_animation_sprites != nil
  4597.           for i in 0..15
  4598.             @_loop_animation_sprites[i].y += sy
  4599.           end
  4600.         end
  4601.       end
  4602.       super
  4603.     end
  4604.   end
  4605. end

  4606. #------------------------------------------------------------------------------
  4607. #  Bitmapクラスに新たな機能を追加します。
  4608. #==============================================================================

  4609. class Bitmap
  4610.   #--------------------------------------------------------------------------
  4611.   # ● 矩形をグラデーション表示
  4612.   #     color1 : スタートカラー
  4613.   #     color2 : エンドカラー
  4614.   #     align  :  0:横にグラデーション
  4615.   #               1:縦にグラデーション
  4616.   #               2:斜めにグラデーション(激重につき注意)
  4617.   #--------------------------------------------------------------------------
  4618.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4619.     if align == 0
  4620.       for i in x...x + width
  4621.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4622.         green = color1.green +
  4623.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4624.         blue  = color1.blue +
  4625.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4626.         alpha = color1.alpha +
  4627.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4628.         color = Color.new(red, green, blue, alpha)
  4629.         fill_rect(i, y, 1, height, color)
  4630.       end
  4631.     elsif align == 1
  4632.       for i in y...y + height
  4633.         red   = color1.red +
  4634.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4635.         green = color1.green +
  4636.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4637.         blue  = color1.blue +
  4638.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4639.         alpha = color1.alpha +
  4640.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4641.         color = Color.new(red, green, blue, alpha)
  4642.         fill_rect(x, i, width, 1, color)
  4643.       end
  4644.     elsif align == 2
  4645.       for i in x...x + width
  4646.         for j in y...y + height
  4647.           red   = color1.red + (color2.red - color1.red) *
  4648.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4649.           green = color1.green + (color2.green - color1.green) *
  4650.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4651.           blue  = color1.blue + (color2.blue - color1.blue) *
  4652.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4653.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4654.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4655.           color = Color.new(red, green, blue, alpha)
  4656.           set_pixel(i, j, color)
  4657.         end
  4658.       end
  4659.     elsif align == 3
  4660.       for i in x...x + width
  4661.         for j in y...y + height
  4662.           red   = color1.red + (color2.red - color1.red) *
  4663.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4664.           green = color1.green + (color2.green - color1.green) *
  4665.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4666.           blue  = color1.blue + (color2.blue - color1.blue) *
  4667.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4668.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4669.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4670.           color = Color.new(red, green, blue, alpha)
  4671.           set_pixel(i, j, color)
  4672.         end
  4673.       end
  4674.     end
  4675.     end
  4676.       end
复制代码



RTAB连击数-显示部分
  1. #==============================================================================
  2. #RTAB观光游第六站,连击效果+连击数显示 (显示部分)
  3. #==============================================================================
  4. # ▼▲▼ XRXS_BP19. コンボ表示+ヒットボーナス ver.3β ▼▲▼ built 201409
  5. # by 桜雅 在土

  6. #==============================================================================
  7. # □ カスタマイズポイント
  8. #==============================================================================
  9. class XRXS_BP19
  10.   #
  11.   # コンボ持続時間[単位:F](40F が 一秒)
  12.   #
  13.   COMBOHIT_DURATION = 90
  14.   #
  15.   # スキン ファイル名
  16.   #
  17.   SKIN_NUMBER = "SixRice_Number.png"
  18.   SKIN_HIT    = "SixRice_HITS.png"
  19. end
  20. class Game_Battler
  21.   #
  22.   # コンボヒットによるダメージ補正力/ヒット数[単位:%]
  23.   #
  24.   DAMAGE_INCREASE_PER_HIT = 1
  25. end
  26. #==============================================================================
  27. # --- XRXS.ナンバースプライト スキン対応!  ---
  28. #==============================================================================
  29. class NumberSprite
  30.   #--------------------------------------------------------------------------
  31.   # ○ オブジェクト初期化
  32.   #--------------------------------------------------------------------------
  33.   def initialize(skin)
  34.     @skin = skin
  35.     @sprites = []
  36.     @width  = skin.width/10
  37.     @height = skin.height
  38.     set_digit(4) # 基本設定値
  39.     set(0)
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ○ 桁の設定
  43.   #--------------------------------------------------------------------------
  44.   def set_digit(digit)
  45.     @sprites.each{|sprite| sprite.dispose}
  46.     @sprites.clear
  47.     digit.times do
  48.       sprite = Sprite.new
  49.       sprite.bitmap = @skin
  50.       sprite.z = 999
  51.       sprite.src_rect.set(0, 0, @width, @height)
  52.       @sprites.push(sprite)
  53.     end
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ○ 値の設定
  57.   #--------------------------------------------------------------------------
  58.   def set(number)
  59.     # 例外補正 0.17b更新
  60.     digit = (number ==0) ? 0 : Math.log10(number)
  61.     if digit > @sprites.size
  62.       set_digit(digit)
  63.     end
  64.     # 各桁の適用
  65.     for sprite in @sprites
  66.       sprite.src_rect.x = number%10 * @width
  67.       number /= 10
  68.     end
  69.     # ゼロ表示 上から判定し、一度でも 0 でなければそこから表示
  70.     zero_display = false
  71.     for sprite in @sprites.reverse
  72.       zero_display |= (sprite.src_rect.x != 0)
  73.       sprite.visible = zero_display
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ○ 座標などの設定の経由
  78.   #--------------------------------------------------------------------------
  79.   def x=(n)
  80.     @sprites.each{|sprite|
  81.       sprite.x = n
  82.       n -= @width
  83.     }
  84.   end
  85.   def y=(n)
  86.     @sprites.each{|sprite| sprite.y = n }
  87.   end
  88.   def opacity=(n)
  89.     @sprites.each{|sprite| sprite.opacity = n }
  90.   end
  91.   def dispose
  92.     @sprites.each{|sprite| sprite.dispose }
  93.   end
  94. end

  95. #==============================================================================
  96. # □ Window_ComboHit
  97. #------------------------------------------------------------------------------
  98. #     戦闘中にコンボ数を表示する透明なウィンドウです。
  99. #==============================================================================
  100. class Window_ComboHit < Window_Base
  101.   #--------------------------------------------------------------------------
  102.   # ○ オブジェクト初期化
  103.   #--------------------------------------------------------------------------
  104.   def initialize
  105.     @number = NumberSprite.new(RPG::Cache.windowskin(XRXS_BP19::SKIN_NUMBER))
  106.      super(200, 80, 200, 80)
  107.     self.opacity = 0
  108.     self.z = 999
  109.     self.visible = false
  110.     self.contents = RPG::Cache.windowskin(XRXS_BP19::SKIN_HIT).dup
  111.     @active = false
  112.     @show_duration = 0
  113.     @sliding_duration = 0
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ○ クリア ほか
  117.   #--------------------------------------------------------------------------
  118.   def clear
  119.     self.visible = false
  120.   end
  121.   def x=(n)
  122.     super
  123.     @number.x = n if @number != nil
  124.   end
  125.   def y=(n)
  126.     super
  127.     @number.y = n if @number != nil
  128.   end
  129.   def contents_opacity=(n)
  130.     super
  131.     @number.opacity = n if @number != nil
  132.   end
  133.   def dispose
  134.     @number.dispose
  135.     super
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ○ リフレッシュ
  139.   #--------------------------------------------------------------------------
  140.   def refresh(hit_combo, duration)
  141.     # 可視化
  142.     self.contents_opacity = 255
  143.     self.visible = true
  144.     # 設定
  145.     @show_duration    = duration
  146.     @sliding_duration = 0
  147.     # 描写
  148.     @number.set(hit_combo)
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ○ フレーム更新
  152.   #--------------------------------------------------------------------------
  153.   def update
  154.     if @sliding_duration > 0
  155.       @sliding_duration -= 1
  156.       self.contents_opacity -= 32
  157.       self.x += 1
  158.       if @sliding_duration == 0
  159.         self.visible = false
  160.       end
  161.     elsif @show_duration > 0
  162.       @show_duration -= 1
  163.       if @show_duration == 0
  164.         @sliding_duration = 8
  165.       end
  166.     end
  167.   end
  168. end
复制代码


RTAB连击数-计算部分
  1. #==============================================================================
  2. #RTAB观光游第六站,连击效果+连击数显示 (计算部分)
  3. #==============================================================================
  4. # 連撃 Ver 1.03
  5. # 配布元・サポートURL
  6. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

  7. #==============================================================================
  8. # ■ Scene_Battle (分割定義 4)
  9. #------------------------------------------------------------------------------
  10. #  バトル画面の処理を行うクラスです。
  11. #==============================================================================
  12. # アニメに強さ0のフラッシュが存在した場合、
  13. # 赤:倍率 緑:+スキル・アイテムID でダメージ計算を行う。
  14. #
  15. # 连击数,每次伤害比率如何设置,参考动画“千裂斩”

  16. class Scene_Battle
  17. attr_reader :skill#到此一游
  18. #--------------------------------------------------------------------------
  19. # ● ATB基礎セットアップ
  20. #--------------------------------------------------------------------------
  21.   alias :atb_setup_straight :atb_setup
  22.   def atb_setup
  23.     atb_setup_straight
  24.     for battler in $game_party.actors + $game_troop.enemies
  25.       battler.total_damage = {}
  26.     end
  27.   end
  28. #--------------------------------------------------------------------------
  29. # ● アクション更新 (メインフェーズ)
  30. #--------------------------------------------------------------------------
  31.   def action_phase(battler)
  32.     while true
  33.       # action が 1 の場合、バトラーが行動中かどうか確認
  34.       if @action == 1 and battler.phase < 3
  35.         for target in battler.target
  36.           speller = synthe?(target)
  37.           if speller == nil
  38.             # ターゲットが通常行動中の場合
  39.             if @action_battlers.include?(target)
  40.               if target.phase > 2
  41.                 return
  42.               end
  43.             end
  44.           else
  45.             # ターゲットが連携スキル発動中の場合
  46.             for spell in speller
  47.               if @action_battlers.include?(spell)
  48.                 if spell.phase > 2
  49.                   return
  50.                 end
  51.               end
  52.             end
  53.           end
  54.         end
  55.       end
  56.       case battler.phase
  57.       when 1
  58.         update_phase4_step1(battler)
  59.       when 2
  60.         update_phase4_step2(battler)
  61.       when 3
  62.         update_phase4_step3(battler)
  63.       when 4
  64.         update_phase4_step4(battler)
  65.       when 5
  66.         update_phase4_step5(battler)
  67.       when 6
  68.         update_phase4_step6(battler)
  69.       end
  70.       # ウェイトが入った場合
  71.       if battler.wait > 0
  72.         # ウェイトカウントを減らして終了
  73.         battler.wait -= 1
  74.         break
  75.       end
  76.       # 行動終了した場合ループを抜ける
  77.       unless @action_battlers.include?(battler)
  78.         break
  79.       end
  80.     end
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  84.   #--------------------------------------------------------------------------
  85.   def update_phase4_step1(battler)
  86.     # すでに戦闘から外されている場合
  87.     if battler.index == nil
  88.       @action_battlers.delete(battler)
  89.       anime_wait_return
  90.       battler.wait = 1
  91.       return
  92.     end
  93.     speller = synthe?(battler)
  94.     if speller == nil
  95.       # ダメージ食らい中の場合
  96.       unless battler.damage.empty? or @action > 2
  97.         battler.wait = 1
  98.         return
  99.       end
  100.       # 行動可能かどうか判定
  101.       unless battler.movable?
  102.         battler.phase = 6
  103.         return
  104.       end
  105.     else
  106.       # ダメージ食らい中の場合
  107.       for spell in speller
  108.         unless spell.damage.empty? or @action > 2
  109.           battler.wait = 1
  110.           return
  111.         end
  112.         # 行動可能かどうか判定
  113.         unless spell.movable?
  114.           battler.phase = 6
  115.           return
  116.         end
  117.       end
  118.     end
  119.     # スキル使用時、詠唱時間設定
  120.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  121.     if battler.current_action.kind == 1 and
  122.       (not battler.current_action.forcing or @force != 2)
  123.       if battler.rtp == 0
  124.         # スキル詠唱中ならば、解除
  125.         skill_reset(battler)
  126.         # スキル詠唱時間設定
  127.         recite_time(battler)
  128.         # 連携技設定
  129.         synthe_spell(battler)
  130.         # スキルを詠唱する場合
  131.         if battler.rtp > 0
  132.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  133.           speller = synthe?(battler)
  134.           if battler.current_action.forcing and @force > 0 and speller != nil
  135.             for spell in speller
  136.               spell.rt = spell.rtp
  137.             end
  138.           else
  139.             battler.blink = true
  140.             if battler.current_action.forcing
  141.               $game_temp.forcing_battler = nil
  142.               battler.current_action.forcing = false
  143.             end
  144.             @action_battlers.delete(battler)
  145.             return
  146.           end
  147.         end
  148.       end
  149.     end
  150.     # アクターの明滅エフェクト OFF
  151.     if battler != nil
  152.       battler.blink = false
  153.     end
  154.     speller = synthe?(battler)
  155.     if speller == nil
  156.       @spell_p.delete(battler)
  157.       @spell_e.delete(battler)
  158.     else
  159.       for spell in speller
  160.         spell.blink = false
  161.         @spell_p.delete(spell)
  162.         @spell_e.delete(spell)
  163.       end
  164.     end
  165.     # ステップ 2 に移行
  166.     battler.phase = 2
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  170.   #--------------------------------------------------------------------------
  171.   def update_phase4_step2(battler)
  172.     # 強制アクションでなければ
  173.     unless battler.current_action.forcing
  174.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  175.       if battler.restriction == 2 or battler.restriction == 3
  176.         # アクションに攻撃を設定
  177.         battler.current_action.kind = 0
  178.         battler.current_action.basic = 0
  179.       end
  180.     end
  181.     # アクションの種別より攻撃アニメーションを取得する
  182.     case battler.current_action.kind
  183.     when 0 # 基本
  184.       if battler.is_a?(Game_Actor)
  185.         base_id = battler.weapon_id
  186.       end
  187.       anime_id = battler.animation2_id
  188.       # 防御など特殊行動の場合は次のステップへ
  189.       unless make_basic_action_preparation(battler)
  190.         return
  191.       end
  192.       # 戦闘が終了した場合は行動をキャンセル
  193.       if fin?
  194.         battler.phase = 6
  195.         return
  196.       end
  197.     when 1 # スキル
  198.       base_id = battler.current_action.skill_id
  199.       anime_id = $data_skills[battler.current_action.skill_id].animation2_id
  200.       # スキルが使用できない場合は行動をキャンセル
  201.       unless make_skill_action_preparation(battler)
  202.         return
  203.       end
  204.       # 戦闘が終了した場合は行動をキャンセル
  205.       if fin? and $data_skills[anime_id].scope == 1..2
  206.         battler.phase = 6
  207.         return
  208.       end
  209.     when 2 # アイテム
  210.       base_id = battler.current_action.item_id
  211.       anime_id = $data_items[battler.current_action.item_id].animation2_id
  212.       # アイテムが使用できない場合は行動をキャンセル
  213.       unless make_item_action_preparation(battler)
  214.         return
  215.       end
  216.       # 戦闘が終了した場合は行動をキャンセル
  217.       if fin? and $data_items[anime_id].scope == 1..2
  218.         battler.phase = 6
  219.         return
  220.       end
  221.     end
  222.     # アニメーションを検索し、連撃性を変数serialに代入する
  223.     serial = []
  224.     frame = 0
  225.     if $data_animations[anime_id] != nil
  226.       for animation in $data_animations[anime_id].timings
  227.         color = animation.flash_color
  228.         # アニメーション・フラッシュの強さが0の場合
  229.         if color.alpha == 0
  230.           serial.push([color.red.to_i, color.green, animation.frame - frame])
  231.           frame = animation.frame
  232.         end
  233.       end
  234.       # 連撃性がない場合単発攻撃
  235.       if serial.empty?
  236.         serial = [[20, 100, $data_animations[anime_id].frame_max - 5]]
  237.       end
  238.     else
  239.       # アニメーションが存在しない場合
  240.       serial = [[20, 100, 0]]
  241.     end
  242.     # ハッシュ total_damage の作成
  243.     total_damage = {}
  244.     for target in battler.target
  245.       total_damage[target] = []
  246.     end
  247.     # 連撃回数分ダメージ計算を行う
  248.     for attack in serial
  249.       # アクションの種別で分岐
  250.       case battler.current_action.kind
  251.       when 0  # 基本
  252.         if battler.is_a?(Game_Actor)
  253.           # バトラーがアクターの場合、攻撃時に武器を変更する
  254.           battler.change_weapon(base_id + attack[1] - 100)
  255.         end
  256.         make_basic_action_result(battler)
  257.       when 1  # スキル
  258.         # 連携スキルのことを考え、スキルIDの変更は内部処理で行う
  259.         make_skill_action_result(battler, attack[1] - 100)
  260.       when 2  # アイテム
  261.         # アイテムIDを設定分変化させる
  262.         battler.current_action.item_id = base_id + attack[1] - 100
  263.         make_item_action_result(battler)
  264.       end
  265.       # total_damage へダメージを代入
  266.       for target in battler.target
  267.         # ダメージがある場合、ダメージをX/20倍する。
  268.         if target.damage[battler].is_a?(Numeric)
  269.           damage = target.damage[battler] * attack[0] / 20
  270.         else
  271.           damage = target.damage[battler]
  272.         end
  273.         # 回復HP量がある場合、回復HP量をX/20倍する。
  274.         if target.recover_hp[battler].is_a?(Numeric)
  275.           recover_hp = target.recover_hp[battler] * attack[0] / 20
  276.         end
  277.         # 回復SP量がある場合、回復SP量をX/20倍する。
  278.         if target.recover_sp[battler].is_a?(Numeric)
  279.           recover_sp = target.recover_sp[battler] * attack[0] / 20
  280.         end
  281.         critical = target.critical[battler]
  282.         # total_damage = [ダメージ, クリティカルフラグ, 回復HP量, 回復SP量,
  283.         #                 ステート変化, ステート回復, 待ちフレーム時間]
  284.         total_damage[target].push([damage, critical, recover_hp, recover_sp,
  285.           target.state_p[battler], target.state_m[battler], attack[2]])
  286.       end
  287.     end
  288.     # トータルダメージを、バトラーのインスタンスに代入
  289.     for target in battler.target
  290.       target.total_damage[battler] = total_damage[target]
  291.     end
  292.     # 武器・スキル・アイテムIDを通常に戻す
  293.     case battler.current_action.kind
  294.     when 0  # 基本
  295.       if battler.is_a?(Game_Actor)
  296.         battler.change_weapon(base_id)
  297.       end
  298.     when 1  # スキル
  299.       battler.current_action.skill_id = base_id
  300.     when 2  # アイテム
  301.       battler.current_action.item_id = base_id
  302.     end
  303.     if battler.phase == 2
  304.       # ステップ 3 に移行
  305.       battler.phase = 3
  306.     end
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 基本アクション 準備
  310.   #--------------------------------------------------------------------------
  311.   def make_basic_action_preparation(battler)
  312.     # 攻撃の場合
  313.     if battler.current_action.basic == 0
  314.       # アニメーション ID を設定
  315.       battler.anime1 = battler.animation1_id
  316.       battler.anime2 = battler.animation2_id
  317.       # 行動側バトラーがエネミーの場合
  318.       if battler.is_a?(Game_Enemy)
  319.         if battler.restriction == 3
  320.           target = $game_troop.random_target_enemy
  321.         elsif battler.restriction == 2
  322.           target = $game_party.random_target_actor
  323.         else
  324.           index = battler.current_action.target_index
  325.           target = $game_party.smooth_target_actor(index)
  326.         end
  327.       end
  328.       # 行動側バトラーがアクターの場合
  329.       if battler.is_a?(Game_Actor)
  330.         if battler.restriction == 3
  331.           target = $game_party.random_target_actor
  332.         elsif battler.restriction == 2
  333.           target = $game_troop.random_target_enemy
  334.         else
  335.           index = battler.current_action.target_index
  336.           target = $game_troop.smooth_target_enemy(index)
  337.         end
  338.       end
  339.       # 対象側バトラーの配列を設定
  340.       battler.target = [target]
  341.       return true
  342.     end
  343.     # 防御の場合
  344.     if battler.current_action.basic == 1
  345.       # ステップ 3 に移行
  346.       battler.phase = 3
  347.       return false
  348.     end
  349. #===============0.15b(RTAB官方更新)===========================================   
  350.     # 逃げるの場合
  351.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  352.       # ステップ 3 に移行
  353.       battler.phase = 3
  354.       return false
  355.     end
  356. #=============================================================================
  357.     # 何もしないの場合
  358.     if battler.current_action.basic == 3
  359.       # ステップ 6 に移行
  360.       battler.phase = 6
  361.       return false
  362.     end
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ● スキルアクション 準備
  366.   #--------------------------------------------------------------------------
  367.   def make_skill_action_preparation(battler)
  368.     # スキルを取得
  369.     @skill = $data_skills[battler.current_action.skill_id]
  370.     # 連携スキルであるかどうか確認
  371.     speller = synthe?(battler)
  372.     # 強制アクションでなければ
  373.     unless battler.current_action.forcing
  374.       # SP 切れなどで使用できなくなった場合
  375.       if speller == nil
  376.         unless battler.skill_can_use?(@skill.id)
  377.           # ステップ 6 に移行
  378.           battler.phase = 6
  379.          return false
  380.         end
  381.       end
  382.     end
  383.     # SP 消費
  384.     temp = false
  385.     if speller != nil
  386.       for spell in speller
  387.         if spell.current_action.spell_id == 0
  388.           spell.sp -= @skill.sp_cost
  389.         else
  390.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  391.         end
  392.         # ステータスウィンドウをリフレッシュ
  393.         status_refresh(spell)
  394.       end
  395.     else
  396.       battler.sp -= @skill.sp_cost
  397.       # ステータスウィンドウをリフレッシュ
  398.       status_refresh(battler)
  399.     end
  400.     # アニメーション ID を設定
  401.     battler.anime1 = @skill.animation1_id
  402.     battler.anime2 = @skill.animation2_id
  403.     # コモンイベント ID を設定
  404.     battler.event = @skill.common_event_id
  405.     # 対象側バトラーを設定
  406.     set_target_battlers(@skill.scope, battler)
  407.     return true
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● アイテムアクション 準備
  411.   #--------------------------------------------------------------------------
  412.   def make_item_action_preparation(battler)
  413.     # アイテムを取得
  414.     @item = $data_items[battler.current_action.item_id]
  415.     # アイテム切れなどで使用できなくなった場合
  416.     unless $game_party.item_can_use?(@item.id)
  417.       # ステップ 6 に移行
  418.       battler.phase = 6
  419.       return false
  420.     end
  421.     # 消耗品の場合
  422.     if @item.consumable
  423.       # 使用したアイテムを 1 減らす
  424.       $game_party.lose_item(@item.id, 1)
  425.     end
  426.     # アニメーション ID を設定
  427.     battler.anime1 = @item.animation1_id
  428.     battler.anime2 = @item.animation2_id
  429.     # コモンイベント ID を設定
  430.     battler.event = @item.common_event_id
  431.     # 対象を決定
  432.     index = battler.current_action.target_index
  433.     target = $game_party.smooth_target_actor(index)
  434.     # 対象側バトラーを設定
  435.     set_target_battlers(@item.scope, battler)
  436.     return true
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 基本アクション 結果作成
  440.   #--------------------------------------------------------------------------
  441.   def make_basic_action_result(battler)
  442.     # 通常攻撃の効果を適用
  443.     for target in battler.target
  444.       target.attack_effect(battler)
  445.     end
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ● スキルアクション 結果作成
  449.   #--------------------------------------------------------------------------
  450.   def make_skill_action_result(battler, plus_id)
  451.     # スキルを取得
  452.     @skill = $data_skills[battler.current_action.skill_id + plus_id]
  453.     # 連携スキルであるかどうか確認
  454.     speller = synthe?(battler)
  455.     # スキルの効果を適用
  456.     for target in battler.target
  457.       if speller != nil
  458.         damage = 0
  459.         effective = false
  460.         state_p = []
  461.         state_m = []
  462.         d_result = false
  463.         for spell in speller
  464.           if spell.current_action.spell_id != 0
  465.             @skill = $data_skills[spell.current_action.spell_id + plus_id]
  466.           end
  467.           effective |= target.skill_effect(spell, @skill)
  468.           if target.damage[spell].class != String
  469.             d_result = true
  470.             damage += target.damage[spell]
  471.           elsif effective
  472.             effect = target.damage[spell]
  473.           end
  474.           state_p += target.state_p[spell]
  475.           state_m += target.state_m[spell]
  476.           target.damage.delete(spell)
  477.           target.state_p.delete(spell)
  478.           target.state_m.delete(spell)
  479.         end
  480.         if d_result
  481.           target.damage[battler] = damage
  482.         elsif effective
  483.           target.damage[battler] = effect
  484.         end
  485.         target.state_p[battler] = state_p
  486.         target.state_m[battler] = state_m
  487.       else
  488.         target.skill_effect(battler, @skill)
  489.       end
  490.     end
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # ● アイテムアクション 結果作成
  494.   #--------------------------------------------------------------------------
  495.   def make_item_action_result(battler)
  496.     # アイテムを取得
  497.     @item = $data_items[battler.current_action.item_id]
  498.     # アイテムの効果を適用
  499.     for target in battler.target
  500.       target.item_effect(@item, battler)
  501.     end
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  505.   #--------------------------------------------------------------------------
  506.   def update_phase4_step4(battler)
  507.     # カメラ設定
  508.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  509.       camera_set(battler)
  510.     end
  511.     # 対象側アニメーション
  512.     for target in battler.target
  513.       target.animation.push([battler.anime2,
  514.                                           (target.damage[battler] != "Miss")])
  515.       unless battler.anime2 == 0
  516.         battler.wait = 2 * target.total_damage[battler][0][6] - 1 +
  517.           Graphics.frame_count % 2
  518.       end
  519.     end
  520.     # ステップ 5 に移行
  521.     battler.phase = 5
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  525.   #--------------------------------------------------------------------------
  526.   def update_phase4_step5(battler)
  527.     next_step = true
  528.     # ダメージ表示
  529.     for target in battler.target
  530.       # total_damage より全ダメージを算出
  531.       total_damage = target.total_damage[battler].shift
  532.       target.damage[battler] = total_damage[0]
  533.       target.critical[battler] = total_damage[1]
  534.       target.recover_hp[battler] = total_damage[2]
  535.       target.recover_sp[battler] = total_damage[3]
  536.       target.state_p[battler] = total_damage[4]
  537.       target.state_m[battler] = total_damage[5]
  538.       # ダメージ表示フラグをON
  539.       target.damage_pop[battler] = true
  540.       # 恭喜你发现了连击计算的关键一行!
  541.       target.combohit_count if target.damage[battler].to_i > 0 and target.damage[battler] != "Miss"
  542.       # 実際にダメージを与える
  543. #      target.damage_effect(battler, battler.current_action.kind)
  544.       target.damage_effect(battler, battler.current_action.kind,skill)#到此一游
  545.       # 余計なハッシュを削除
  546.       target.recover_hp.delete(battler)
  547.       target.recover_sp.delete(battler)
  548.       target.state_p.delete(battler)
  549.       target.state_m.delete(battler)
  550.       # ダメージを全て与えきった場合
  551.       if target.total_damage[battler].empty?
  552.         # ターゲットへの全ダメージを削除
  553.         target.total_damage.delete(battler)
  554.         # 指定時間ウェイトする
  555.         battler.wait = @damage_wait
  556.       else
  557.         # 指定時間ウェイトする
  558.         next_step = false
  559.         battler.wait = 2 * target.total_damage[battler][0][6]
  560.       end
  561.       # ステータスウィンドウをリフレッシュ
  562.       status_refresh(target)
  563.     end
  564.     if next_step
  565.       # ステップ 6 に移行
  566.       battler.phase = 6
  567.     end
  568.   end
  569.   #--------------------------------------------------------------------------
  570.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  571.   #--------------------------------------------------------------------------
  572.   def update_phase4_step6(battler)
  573.     # カメラを戻す
  574.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  575.       @spriteset.screen_target(0, 0, 1)
  576.     end
  577.     # スキルラーニング
  578.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  579.       for target in battler.target        
  580.         if target.is_a?(Game_Actor)#(0.16)
  581.         skill_learning(target, target.class_id,
  582.                         battler.current_action.skill_id)
  583.         end #(0.16)               
  584.       end
  585.     end
  586.     # アクション強制対象のバトラーをクリア
  587.     if battler.current_action.forcing == true and
  588.         battler.current_action.force_kind == 0 and
  589.         battler.current_action.force_basic == 0 and
  590.         battler.current_action.force_skill_id == 0
  591.       $game_temp.forcing_battler = nil
  592.       battler.current_action.forcing = false
  593.     end
  594.     refresh_phase(battler)
  595.     speller = synthe?(battler)
  596.     if speller != nil
  597.       for spell in speller
  598.         if spell != battler
  599.           refresh_phase(spell)
  600.         end
  601.       end
  602.       synthe_delete(speller)
  603.     end
  604.     # コモンイベント ID が有効の場合
  605.     if battler.event > 0
  606.       # イベントをセットアップ
  607.       common_event = $data_common_events[battler.event]
  608.       $game_system.battle_interpreter.setup(common_event.list, 0)
  609.     end
  610.     act = 0
  611.     for actor in $game_party.actors + $game_troop.enemies
  612.       if actor.movable?
  613.         act += 1
  614.       end
  615.     end
  616.     if @turn_cnt >= act and act > 0
  617.       @turn_cnt %= act
  618.       $game_temp.battle_turn += 1
  619.       # バトルイベントの全ページを検索
  620.       for index in 0...$data_troops[@troop_id].pages.size
  621.         # イベントページを取得
  622.         page = $data_troops[@troop_id].pages[index]
  623.         # このページのスパンが [ターン] の場合
  624.         if page.span == 1
  625.           # 実行済みフラグをクリア
  626.           $game_temp.battle_event_flags[index] = false
  627.         end
  628.       end
  629.     end
  630.     battler.phase = 1
  631.     @action_battlers.delete(battler)
  632.   end
  633. #//////////////////////////////////////////////////////////////////////////////
  634. #连击数计算的基础部分Part1  by 桜雅 在土
  635. #------------------------------------------------------------------------------
  636. # ● メイン処理
  637. #------------------------------------------------------------------------------
  638.   alias xrxs_bp19_main main
  639.   def main
  640.     # コンボヒットウィンドウを作成
  641.     @combohit_window = Window_ComboHit.new
  642.     # 呼び戻す
  643.     xrxs_bp19_main
  644.     # ウィンドウを解放
  645.     @combohit_window.dispose
  646.     # コンボクリア
  647.     $game_party.actors.each {|actor| actor.combohit_clear}
  648.   end
  649. #------------------------------------------------------------------------------
  650. # ● フレーム更新
  651. #------------------------------------------------------------------------------
  652.   alias xrxs_bp19_update update
  653.   def update
  654.     # フレーム更新
  655.     @combohit_window.update
  656.     $game_party.actors.each {|actor| actor.combohit_update}
  657.     $game_troop.enemies.each{|enemy| enemy.combohit_update}
  658.     # 呼び戻す
  659.     xrxs_bp19_update
  660.   end
  661. #------------------------------------------------------------------------------
  662. # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  663. #------------------------------------------------------------------------------
  664.   alias xrxs_bp19_update_phase4_step5 update_phase4_step5
  665.   def update_phase4_step5(battler)
  666.     # 呼び戻す
  667.     xrxs_bp19_update_phase4_step5(battler)
  668.     # コンボ数の最も高いターゲットを探す
  669.     max = 0
  670.     hit_target = nil
  671.     for target in battler.target
  672.       if target.combohit > max
  673.         max = target.combohit
  674.         hit_target = target
  675.       end
  676.     end
  677.     if max >= 2 and !hit_target.nil?
  678.       @combohit_window.x = hit_target.is_a?(Game_Enemy) ? 512 : 512
  679.       @combohit_window.refresh(max, hit_target.combohit_duration)
  680.     end
  681.   end  
  682. end
  683. #//////////////////////////////////////////////////////////////////////////////
  684. #==============================================================================
  685. # ■ Game_Battler (分割定義 1)
  686. #------------------------------------------------------------------------------
  687. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  688. # スのスーパークラスとして使用されます。
  689. #==============================================================================

  690. class Game_Battler
  691.   #--------------------------------------------------------------------------
  692.   # ● 公開インスタンス変数追加
  693.   #--------------------------------------------------------------------------
  694.   attr_accessor :total_damage              # 総ダメージ
  695.   #--------------------------------------------------------------------------
  696.   # ● オブジェクト初期化
  697.   #--------------------------------------------------------------------------
  698.   alias :initialize_straight :initialize
  699.   def initialize
  700.     initialize_straight
  701.     @total_damage = {}
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # ● 存在判定
  705.   #--------------------------------------------------------------------------
  706.   def exist?
  707.     return (not @hidden and (@hp > 0 or @immortal or not @total_damage.empty?))
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● 残HP予測
  711.   #--------------------------------------------------------------------------
  712.   def rest_hp
  713.     # rest_hp に現HPを代入
  714.     rest_hp = @hp
  715.     # バトラーが受ける全ダメージをrest_hpに反映させる
  716.     for total in @total_damage
  717.       for pre_damage in total[1]
  718.         if pre_damage[0].is_a?(Numeric)
  719.           rest_hp -= pre_damage[0]
  720.         end
  721.         if pre_damage[2].is_a?(Numeric)
  722.           rest_hp += pre_damage[2]
  723.         end
  724.       end
  725.     end
  726.     return rest_hp
  727.   end
  728. end
  729. #//////////////////////////////////////////////////////////////////////////////
  730. #连击数计算的基础部分Part2  by 桜雅 在土
  731. #------------------------------------------------------------------------------
  732. # ● 公開インスタンス変数
  733. #------------------------------------------------------------------------------
  734.   def combohit
  735.     @combohit = 0 if @combohit.nil?
  736.     return @combohit
  737.   end
  738.   def combohit_duration
  739.     @combohit_duration = 0 if @combohit_duration.nil?
  740.     return @combohit_duration
  741.   end
  742. #------------------------------------------------------------------------------
  743. # ○ コンボヒットを更新
  744. #------------------------------------------------------------------------------  
  745.   def combohit_update
  746.     # 例外補正
  747.     @combohit_duration = 0 if @combohit_duration.nil?
  748.     # カウント
  749.     if @combohit_duration > 0
  750.       @combohit_duration -= 1
  751.       # のけぞり時間終了時、コンボ数をリセット
  752.       @combohit = 0 if @combohit_duration == 0
  753.     end
  754.   end
  755. #------------------------------------------------------------------------------
  756. # ○ コンボヒットをカウント
  757. #------------------------------------------------------------------------------
  758.   def combohit_count
  759.     # 例外補正
  760.     @combohit = 0 if @combohit.nil?  
  761.     # カウント
  762.     @combohit += 1
  763.     @combohit_duration = XRXS_BP19::COMBOHIT_DURATION
  764.   end
  765. #------------------------------------------------------------------------------
  766. # ○ コンボヒットをクリア
  767. #------------------------------------------------------------------------------  
  768.   def combohit_clear
  769.     @combohit = nil
  770.     @combohit_duration = nil
  771.   end

  772. #//////////////////////////////////////////////////////////////////////////////
  773. #==============================================================================
  774. # ■ Game_Actor
  775. #------------------------------------------------------------------------------
  776. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  777. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  778. #==============================================================================

  779. class Game_Actor < Game_Battler
  780.   #--------------------------------------------------------------------------
  781.   # ● 公開インスタンス変数
  782.   #--------------------------------------------------------------------------
  783.   def change_weapon(id)
  784.     @weapon_id = id
  785.   end
  786. end

  787. #==============================================================================
  788. # ■ Sprite_Battler
  789. #------------------------------------------------------------------------------
  790. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  791. # スプライトの状態を自動的に変化させます。
  792. #==============================================================================

  793. class Sprite_Battler < RPG::Sprite
  794.   #--------------------------------------------------------------------------
  795.   # ● フレーム更新
  796.   #--------------------------------------------------------------------------
  797.   def update
  798.     super
  799.     # バトラーが nil の場合
  800.     if @battler == nil
  801.       self.bitmap = nil
  802.       loop_animation(nil)
  803.       return
  804.     end
  805.     # ファイル名か色相が現在のものと異なる場合
  806.     if @battler.battler_name != @battler_name or
  807.        @battler.battler_hue != @battler_hue
  808.       # ビットマップを取得、設定
  809.       @battler_name = @battler.battler_name
  810.       @battler_hue = @battler.battler_hue
  811.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  812.       @width = bitmap.width
  813.       @height = bitmap.height
  814.       self.ox = @width / 2
  815.       self.oy = @height
  816.       if @battler.is_a?(Game_Enemy)
  817.         @battler.height = @height
  818.       end
  819.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  820.       if @battler.dead? or @battler.hidden
  821.         self.opacity = 0
  822.       end
  823.     end
  824.     # アニメーション ID が現在のものと異なる場合
  825.     if @battler.state_animation_id != @state_animation_id
  826.       @state_animation_id = @battler.state_animation_id
  827.       loop_animation($data_animations[@state_animation_id])
  828.     end
  829.     # 表示されるべきアクターの場合
  830.     if @battler.is_a?(Game_Actor) and @battler_visible
  831.       # メインフェーズでないときは不透明度をやや下げる
  832.       if $game_temp.battle_main_phase
  833.         self.opacity += 3 if self.opacity < 255
  834.       else
  835.         self.opacity -= 3 if self.opacity > 207
  836.       end
  837.     end
  838.     # 明滅
  839.     if @battler.blink
  840.       blink_on
  841.     else
  842.       blink_off
  843.     end
  844.     # 不可視の場合
  845.     unless @battler_visible
  846.       # 出現
  847.       if not @battler.hidden and not @battler.dead? and
  848.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  849.         appear
  850.         @battler_visible = true
  851.       end
  852.     end
  853.     # ダメージ
  854.     for battler in @battler.damage_pop
  855.       if battler[0].class == Array
  856.         if battler[0][1] >= 0
  857.           $scene.skill_se
  858.         else
  859.           $scene.levelup_se
  860.         end
  861.         damage(@battler.damage[battler[0]], false, 2)
  862.       else
  863.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  864.       end
  865.       if @battler.damage_sp.include?(battler[0])
  866.         damage(@battler.damage_sp[battler[0]],
  867.                 @battler.critical[battler[0]], 1)
  868.         @battler.damage_sp.delete(battler[0])
  869.       end
  870.       @battler.damage_pop.delete(battler[0])
  871.       @battler.damage.delete(battler[0])
  872.       @battler.critical.delete(battler[0])
  873.     end
  874.     # 可視の場合
  875.     if @battler_visible
  876.       # 逃走
  877.       if @battler.hidden
  878.         $game_system.se_play($data_system.escape_se)
  879.         escape
  880.         @battler_visible = false
  881.       end
  882.       # 白フラッシュ
  883.       if @battler.white_flash
  884.         whiten
  885.         @battler.white_flash = false
  886.       end
  887.       # アニメーション
  888.       unless @battler.animation.empty?
  889.         for animation in @battler.animation.reverse
  890.           animation($data_animations[animation[0]], animation[1])
  891.           @battler.animation.delete(animation)
  892.         end
  893.       end
  894.       # コラプス
  895.       if @battler.total_damage.empty? and @battler.dead?
  896.         if $scene.dead_ok?(@battler)
  897.           if @battler.is_a?(Game_Enemy)
  898.             $game_system.se_play($data_system.enemy_collapse_se)
  899.           else
  900.             $game_system.se_play($data_system.actor_collapse_se)
  901.           end
  902.           collapse
  903.           @battler_visible = false
  904.         end
  905.       end
  906.     end
  907.     # スプライトの座標を設定
  908.     self.x = @battler.screen_x
  909.     self.y = @battler.screen_y
  910.     self.z = @battler.screen_z
  911.     if @battler.is_a?(Game_Enemy)
  912.       self.zoom_x = @battler.real_zoom * @battler.zoom
  913.       self.zoom_y = @battler.real_zoom * @battler.zoom
  914.     end
  915.   end
  916. end
复制代码



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



RTAB特技连携 Ver 1.02
  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. class Scene_Battle
  10. #------------------------------------------------------------------------------
  11. # 合成特技判定
  12. #
  13. # 考虑到可能会存在同名特技,将默认的根据name判断改成id判断则不会重复了(0.16b)
  14. #------------------------------------------------------------------------------
  15.   def synthe_spell(battler)
  16.     if battler.is_a?(Game_Actor)
  17.       @spell_p[battler] = $data_skills[battler.current_action.skill_id].id
  18.     end
  19.     if battler.is_a?(Game_Enemy)
  20.       @spell_e[battler] = $data_skills[battler.current_action.skill_id].id
  21.     end
  22. #------------------------------------------------------------------------------   
  23.   synthe_s = []#合成特技判定数组
  24. #------------------------------------------------------------------------------
  25. # 官方说明:
  26. # 设定为『synthe_s.push([["特技idA","特技idB"],"特技idC"]』的情况下,
  27. # 特技A和特技B同时使用时会发动特技C,称为“合成特技”。
  28. #------------------------------------------------------------------------------
  29. # 以下是官方设置范例(这里一样给出翻译,当作创作参考也不错,不用则删):
  30. #------------------------------------------------------------------------------   

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



RTAB特技学习 Ver 1.00
  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. class Scene_Battle
  10. #------------------------------------------------------------------------------
  11. # ● 特技学习(战斗中被特定招式攻击,可习得该招式)
  12. #------------------------------------------------------------------------------
  13.   def skill_learning(actor, class_id, skill_id)
  14.     effect = false
  15. case actor.class_id
  16. #考虑到可能会存在同名职业,将默认的根据name判断改成id判断则不会重复了(0.16b)      
  17.     when 8 #8号职业
  18.       case $data_skills[skill_id].id
  19.       when 10 #10号特技
  20.         effect = learn_skill(actor, skill_id)
  21.       when 13 #13号特技
  22.         effect = learn_skill(actor, skill_id)
  23.       #以上为举例说明,有需要请自行设定,职业,可习得特技  
  24.       end
  25.    
  26.    
  27.     when 1 #1号职业
  28.       case $data_skills[skill_id].id
  29.       when 60 #60号特技
  30.         #这里举个例子,可以设置一定几率      
  31.         effect = learn_skill(actor, skill_id) if rand(100) < 20
  32.       end
  33.       
  34. end   
  35.     if effect
  36.       actor.damage[[actor, skill_id]] = "Learning!"
  37.       actor.damage_pop[[actor, skill_id]] = true
  38.     end
  39.   end
  40.   def learn_skill(actor, skill_id)
  41.     unless actor.skill_learn?(skill_id)
  42.       actor.learn_skill(skill_id)
  43.       return true
  44.     end
  45.     return false
  46.   end
  47. end
复制代码



RTAB伤害美化 Ver 1.02
  1. # ダメージ表示改造(RTAB用) ver 1.02
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

  4. class Scene_Battle
  5.   alias :atb_setup_original :atb_setup
  6.   def atb_setup
  7.     for path in ["num", "critical", "miss", "levelup", "newskill", "learning"]
  8.       RPG::Cache.numeric(path)
  9.     end
  10.     atb_setup_original
  11.   end
  12. end

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



XRXS.付加属性名称判定
  1. # ▽△▽ XRXS.付加属性名称判定 ▽△▽  built 091221
  2. # by 桜雅 在土

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



XRXS.装备属性取得机构
  1. # ▽△▽ XRXS. 装備属性取得機構 ▽△▽ built 221114
  2. # by 桜雅 在土

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



XRXS.属性修正计数限制
  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
  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.     self.damage[battler] = self.damage[battler].to_i

  422.    
  423.     # 特殊效果:追加分散度
  424.   if battler.current_action.add_variance > 0 and self.damage[battler].abs > 0
  425.   amp = [self.damage[battler].abs * battler.current_action.add_variance / 100, 1].max
  426.   self.damage[battler]  += rand(amp+1) + rand(amp+1) - amp
  427. end
  428.     # 特殊效果:现HP威力
  429.     if battler.current_action.hp_rate
  430. self.damage[battler] = self.damage[battler] * battler.hp / battler.maxhp
  431. end
  432.     # 特殊效果:现SP威力
  433.     if battler.current_action.sp_rate
  434. self.damage[battler] = self.damage[battler] * battler.sp / battler.maxsp
  435. end

  436.     # 特殊效果:会心一击
  437.     if battler.current_action.critical_hit > 0
  438.   if self.critical[battler]
  439. self.critical[battler] = false      
  440. self.damage[battler] /= 2           
  441. end
  442.     # critical重新判定
  443.     if rand(100) < battler.current_action.critical_hit
  444. self.critical[battler] = true
  445. self.damage[battler] *= 2
  446. end
  447. end
  448.     # 特殊效果:固定伤害
  449.     if battler.current_action.fix_damage != 0
  450. self.damage[battler] = battler.current_action.fix_damage.to_i
  451. self.critical[battler] = false
  452. end
  453. #------------------------------------------------------------------------------
  454. # 特殊效果:追加伤害效果类计算
  455. #------------------------------------------------------------------------------
  456. case battler.current_action.special_damage_kind
  457.     when 1# 「目标方当前HP比例」
  458.       if skill != nil
  459.       self.damage[battler] += self.hp * skill.power / 100
  460.     else
  461.       self.damage[battler] += self.hp * battler.atk / 10000
  462.     end
  463. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWHPTA))/100
  464. when 2# 「目标方最大HP比例」
  465.       if skill != nil
  466.       self.damage[battler] += self.maxhp * skill.power / 100
  467.     else
  468.       self.damage[battler] += self.maxhp * battler.atk / 10000
  469.     end   
  470. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXHPTA))/100
  471.     when 3# 「目标方HP差值比例」
  472.       if skill != nil
  473.       self.damage[battler] += (self.maxhp - self.hp) * skill.power / 100
  474.     else
  475.       self.damage[battler] += (self.maxhp - self.hp) * battler.atk / 10000
  476.     end      
  477. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFHPTA))/100
  478.     when 4# 「使用者当前HP比例」
  479.       if skill != nil
  480.       self.damage[battler] += battler.hp * skill.power / 100
  481.     else
  482.       self.damage[battler] += battler.hp * battler.atk / 10000
  483.     end
  484. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWHPUS))/100   
  485.     when 5# 「使用者最大HP比例」
  486.       if skill != nil
  487.       self.damage[battler] += battler.maxhp * skill.power / 100
  488.     else
  489.       self.damage[battler] += battler.maxhp * battler.atk / 10000
  490.     end
  491. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXHPUS))/100
  492.     when 6# 「使用者HP差值比例」
  493.       if skill != nil
  494.       self.damage[battler] += (battler.maxhp - battler.hp) * skill.power / 100
  495.     else
  496.       self.damage[battler] += (battler.maxhp - battler.hp) * battler.atk / 10000
  497.     end      
  498. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFHPUS))/100   
  499.     when 7# 「目标方当前SP比例」
  500.       if skill != nil
  501.       self.damage[battler] += self.sp * skill.power / 100
  502.     else
  503.       self.damage[battler] += self.sp * battler.atk / 10000
  504.     end
  505. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWSPTA))/100
  506.     when 8# 「目标方最大SP比例」   
  507.       if skill != nil
  508.       self.damage[battler] += self.maxsp * skill.power / 100
  509.     else
  510.       self.damage[battler] += self.maxsp * battler.atk / 10000
  511.     end   
  512. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXSPTA))/100
  513.     when 9# 「目标方SP差值比例」      
  514.       if skill != nil
  515.       self.damage[battler] += (self.maxsp - self.sp) * skill.power / 100
  516.     else
  517.       self.damage[battler] += (self.maxsp - self.sp) * battler.atk / 10000
  518.     end   
  519. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFSPTA))/100
  520.     when 10# 「使用者当前SP比例」  
  521.       if skill != nil
  522.       self.damage[battler] += battler.sp * skill.power / 100
  523.     else
  524.       self.damage[battler] += battler.sp * battler.atk / 10000
  525.     end
  526. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_NOWSPUS))/100
  527.     when 11# 「使用者最大SP比例」     
  528.       if skill != nil
  529.       self.damage[battler] += battler.maxsp * skill.power / 100
  530.     else
  531.       self.damage[battler] += battler.maxsp * battler.atk / 10000
  532.     end
  533. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_MAXSPUS))/100
  534.     when 12# 「使用者SP差值比例」   
  535.       if skill != nil
  536.       self.damage[battler] += (battler.maxsp - battler.sp) * skill.power / 100
  537.     else
  538.       self.damage[battler] += (battler.maxsp - battler.sp) * battler.atk / 10000
  539.     end  
  540. self.damage[battler] *=self.element_rate(($data_system.elements).index(XRXS19::FIXDAMAGE_DIFSPUS))/100
  541. end
  542. #------------------------------------------------------------------------------
  543. # 特殊效果:AT伤害值(1.03)
  544.   if battler.current_action.at_damage != 0
  545.   self.at -= battler.current_action.at_damage * self.maxat / 100
  546.   self.at  = 0 if self.at < 0
  547.   self.atp = 100 * self.at / self.maxat
  548. end
  549. # 特殊效果:HP伤害率
  550.   if battler.current_action.hp_damage != 0 and battler.current_action.sp_damage == 0
  551. self.damage[battler] = self.damage[battler] * battler.current_action.hp_damage / 100
  552. end
  553. # 特殊效果:SP伤害率
  554.   if battler.current_action.sp_damage != 0
  555. self.damage_sp[battler] = self.damage[battler] * battler.current_action.sp_damage / 100
  556. self.damage_sp[battler] = self.sp if self.damage_sp[battler] > self.sp
  557. self.damage_sp[battler] = "" if self.sp == 0
  558. self.sp      -= self.damage_sp[battler] if self.damage_sp[battler] != ""
  559.   if battler.current_action.hp_damage != 0 # 特殊效果:HP伤害率
  560. self.damage[battler] = self.damage[battler] * battler.current_action.hp_damage / 100
  561. else
  562. self.damage[battler] = ""
  563. end
  564. end
  565. #------------------------------------------------------------------------------
  566. # 特殊效果:收招修正(1.03)
  567. battler.hp = battler.current_action.hp_correct.to_i if battler.current_action.hp_correct != 0
  568. battler.sp = battler.current_action.sp_correct.to_i if battler.current_action.sp_correct != 0
  569. #------------------------------------------------------------------------------   
  570. # 特殊效果:HP吸收
  571. if battler.current_action.hp_drain != 0
  572.    battler.damage[battler] = 0 if battler.damage[battler] == nil
  573.    drain_point = -1 * self.damage[battler].to_i * battler.current_action.hp_drain / 100
  574.    battler.damage[battler] += drain_point
  575.    battler.hp -= drain_point
  576. if battler.damage[battler] == 0
  577.    battler.damage[battler] = nil
  578.   end
  579. end
  580. # 特殊效果:SP吸收
  581. if battler.current_action.sp_drain != 0
  582.    battler.damage_sp[battler] = 0 if battler.damage_sp[battler] == nil
  583.    drain_point = -1 * self.damage_sp[battler].to_i * battler.current_action.sp_drain / 100
  584.    battler.damage_sp[battler] += drain_point
  585.    battler.sp -= drain_point
  586.    battler.damage_sp[battler] = drain_point
  587. if battler.damage_sp[battler] == 0
  588.    battler.damage_sp[battler] = nil
  589.   end
  590. end
  591.     # recall
  592.     xrxs19co_x1_damage_effect(battler, item)
  593.   end
  594. end

  595. #==============================================================================
  596. # ■ Scene_Battle
  597. #==============================================================================
  598. class Scene_Battle
  599. #------------------------------------------------------------------------------
  600. # ○ ATB_SETUP (ATB = AT Bar,意思不要和RTAB搞错)(1.03)
  601. #------------------------------------------------------------------------------
  602.   alias xrxs19_atb_setup atb_setup
  603.   def atb_setup
  604.     # recall
  605.     xrxs19_atb_setup
  606.     # 保存最大AT
  607.     for battler in $game_party.actors + $game_troop.enemies
  608.       battler.maxat = @max
  609.     end
  610.   end  
  611. #--------------------------------------------------------------------------
  612. # ● 主处理
  613. #--------------------------------------------------------------------------
  614.   alias xrxs19_main main
  615.   def main
  616.     # 清空角色的伤害值
  617.     for actor in $game_party.actors
  618.       actor.damage = nil
  619.     end
  620.     # recall
  621.     xrxs19_main
  622.     # 清空角色的特殊效果设置
  623.     for actor in $game_party.actors
  624.       actor.current_action.clear_xrxs19_special_effect
  625.       actor.current_action.nillize_xrxs19_special_effect
  626.     end
  627.   end
  628. #--------------------------------------------------------------------------
  629. # ● 刷新画面 (主回合步骤 1 : 准备行动)
  630. #--------------------------------------------------------------------------
  631.   alias xrxs19co_x1_update_phase4_step1 update_phase4_step1
  632.   def update_phase4_step1(battler)
  633.     # 清空行动者的伤害值
  634.     battler.damage.clear
  635.     # recall
  636.     xrxs19co_x1_update_phase4_step1(battler)
  637.   end
  638.   
  639. #--------------------------------------------------------------------------
  640. # ● 刷新画面 (主回合步骤 2 : 开始行动)
  641. #--------------------------------------------------------------------------
  642.   alias xrxs19_update_phase4_step2 update_phase4_step2
  643.   def update_phase4_step2(battler)
  644.     # 清空行动者的伤害值
  645.     battler.damage.clear
  646.     # recall
  647.     xrxs19_update_phase4_step2(battler)   
  648.   end
  649. #--------------------------------------------------------------------------
  650. # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  651. #(武器范围定义必须)
  652. #--------------------------------------------------------------------------
  653.   def update_phase3_enemy_select
  654.     # コマンド選択中に行動不能になった場合
  655.     unless @active_actor.inputable?
  656.       # カメラを元に戻す
  657.       if @camera == "select"
  658.         @spriteset.screen_target(0, 0, 1)
  659.       end
  660.       @active_actor.current_action.clear
  661.       command_delete
  662.       # 次のアクターのコマンド入力へ
  663.       phase3_next_actor
  664.       return
  665.     end
  666.     @active_actor.set_xrxs19_special_scope(@active_actor.equip_element_set) if @skill_window == nil
  667.     @active_actor.set_xrxs19_special_scope(@active_actor.skill_element_set(@skill)) if @skill_window != nil
  668.   case @active_actor.current_action.scope_force
  669.   when 2,4,6,7,8,9,10,11
  670.         # アクションを設定
  671.         @active_actor.current_action.kind = 0
  672.         @active_actor.current_action.basic = 0
  673.         # スキルの選択を終了
  674.         end_enemy_select
  675.         # 次のアクターのコマンド入力へ
  676.         phase3_next_actor
  677.   when 3
  678.         # アクターアローを更新
  679.     @actor_arrow.update
  680.     # B ボタンが押された場合
  681.     if Input.trigger?(Input::B)
  682.       # キャンセル SE を演奏
  683.       $game_system.se_play($data_system.cancel_se)
  684.       # アクターの選択を終了
  685.       end_enemy_select
  686.       return
  687.     end
  688.     # C ボタンが押された場合
  689.     if Input.trigger?(Input::C)
  690.     # 決定 SE を演奏
  691.       $game_system.se_play($data_system.decision_se)
  692.       # アクションを設定
  693.       @active_actor.current_action.kind = 0
  694.       @active_actor.current_action.basic = 0
  695.       @active_actor.current_action.target_index = @actor_arrow.index
  696.       # アクターの選択を終了
  697.       end_enemy_select
  698.       # 次のアクターのコマンド入力へ
  699.         phase3_next_actor
  700.      end
  701.      else
  702.     # エネミーアローを更新
  703.     @enemy_arrow.update
  704.     # B ボタンが押された場合
  705.     if Input.trigger?(Input::B)
  706.       # キャンセル SE を演奏
  707.       $game_system.se_play($data_system.cancel_se)
  708.       # カメラを元に戻す
  709.       if @camera == "select"
  710.         # カメラの設定
  711.         @camera = "command"
  712.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  713.         y = [(plus.abs - 1.5) * 10 , 0].min
  714.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  715.       end
  716.       # エネミーの選択を終了
  717.       end_enemy_select
  718.       return
  719.     end
  720.     # C ボタンが押された場合
  721.     if Input.trigger?(Input::C)
  722.       # 決定 SE を演奏
  723.       $game_system.se_play($data_system.decision_se)
  724.       # アクションを設定
  725.       @active_actor.current_action.kind = 0
  726.       @active_actor.current_action.basic = 0
  727.       @active_actor.current_action.target_index = @enemy_arrow.index
  728.       # スキルウィンドウ表示中の場合
  729.       if @skill_window != nil
  730.         # アクションを再設定
  731.         @active_actor.current_action.kind = 1
  732.         # スキルの選択を終了
  733.         end_skill_select
  734.       end
  735.       # アイテムウィンドウ表示中の場合
  736.       if @item_window != nil
  737.         # アクションを再設定
  738.         @active_actor.current_action.kind = 2
  739.         # アイテムの選択を終了
  740.         end_item_select
  741.       end
  742.       # エネミーの選択を終了
  743.       end_enemy_select
  744.       # 次のアクターのコマンド入力へ
  745.       phase3_next_actor
  746.       end
  747.     end
  748.   end
  749. #--------------------------------------------------------------------------
  750. # ● 开始选择敌人#(武器范围定义必须)(1.03修正显示BUG)
  751. #--------------------------------------------------------------------------
  752.   def start_enemy_select   
  753.     @active_actor.set_xrxs19_special_scope(@active_actor.equip_element_set) if @skill_window == nil
  754.     @active_actor.set_xrxs19_special_scope(@active_actor.skill_element_set(@skill)) if @skill_window != nil
  755. if @active_actor.current_action.scope_force == 3
  756.    # 生成敌人箭头
  757.    @actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
  758.    # 关联帮助窗口
  759.     @actor_arrow.help_window = @help_window
  760.   else
  761.     # 生成敌人箭头
  762.      @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
  763.      # 关联帮助窗口
  764.     @enemy_arrow.help_window = @help_window
  765.     end
  766.     # 无效化角色指令窗口
  767.     @actor_command_window.active = false
  768.     @actor_command_window.visible = false
  769.   end
  770. #--------------------------------------------------------------------------
  771. # ● 结束选择敌人#武器范围定义必须)
  772. #--------------------------------------------------------------------------
  773.   def end_enemy_select
  774.     # 释放敌人箭头
  775.     @enemy_arrow.dispose if @enemy_arrow != nil
  776.     @actor_arrow.dispose if @actor_arrow != nil
  777.     @enemy_arrow = nil
  778.     @actor_arrow = nil
  779.     # 指令为 [战斗] 的情况下
  780.     if @actor_command_window.index == 0
  781.       # 有效化角色指令窗口
  782.       @actor_command_window.active = true
  783.       @actor_command_window.visible = true
  784.       # 隐藏帮助窗口
  785.       @help_window.visible = false
  786.     end
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # ● 基本アクション 準備#(武器范围定义必须)
  790.   #--------------------------------------------------------------------------
  791.   def make_basic_action_preparation(battler)
  792.     # 攻撃の場合
  793.     if battler.current_action.basic == 0
  794.       # アニメーション ID を設定
  795.       battler.anime1 = battler.animation1_id
  796.       battler.anime2 = battler.animation2_id
  797.       # 行動側バトラーがエネミーの場合
  798.       if battler.is_a?(Game_Enemy)
  799.         if battler.restriction == 3
  800.           target = $game_troop.random_target_enemy
  801.         elsif battler.restriction == 2
  802.           target = $game_party.random_target_actor
  803.         else
  804.           index = battler.current_action.target_index
  805.           target = $game_party.smooth_target_actor(index)
  806.         end
  807.       end
  808.       # 行動側バトラーがアクターの場合
  809. battler.set_xrxs19_special_scope(battler.equip_element_set)   
  810.       if battler.is_a?(Game_Actor)
  811.         if battler.restriction == 3
  812.           target = $game_party.random_target_actor
  813.         elsif battler.restriction == 2
  814.           target = $game_troop.random_target_enemy
  815.         elsif battler.current_action.scope_force == 3 # 己方单体
  816.           index = battler.current_action.target_index
  817.           target = $game_party.smooth_target_actor(index)
  818.         else
  819.            
  820.           index = battler.current_action.target_index
  821.           target = $game_troop.smooth_target_enemy(index)
  822.         end
  823.       end
  824.    
  825.       # 対象側バトラーの配列を設定
  826.     case  battler.current_action.scope_force
  827.     when 2 # 敌方全体
  828.         for enemy in $game_troop.enemies
  829.           if enemy.exist?
  830.             battler.target.push(enemy)
  831.           end
  832.         end
  833.     battler.target.push(battler) if battler.current_action.self_inclusion     
  834.     when 4 # 己方全体
  835.         for actor in $game_party.actors
  836.           if actor.exist?
  837.             battler.target.push(actor)
  838.           end
  839.         end
  840.     battler.target -=[battler] if battler.current_action.self_exclusion   
  841.     when 7  # 使用者
  842.       battler.target.push(battler)
  843.          when 8  # 全域化
  844.         for enemy in $game_troop.enemies
  845.           if enemy.exist?
  846.             battler.target.push(enemy)
  847.           end
  848.         end
  849.       for actor in $game_party.actors
  850.           if actor.exist?
  851.             battler.target.push(actor)
  852.           end
  853.         end
  854. battler.target -=[battler] if battler.current_action.self_exclusion
  855.      when 9  # 敌方随机        
  856.         for enemy in $game_troop.enemies
  857.           if enemy.exist?
  858.             battler.target = [$game_troop.random_target_enemy]
  859.           end
  860.         end
  861. battler.target.push(battler) if battler.current_action.self_inclusion
  862.       when 10  # 己方随机
  863.       for actor in $game_party.actors
  864.           if actor.exist?
  865.             battler.target.push(actor)
  866.           end
  867.         end      
  868. battler.target -=[battler] if battler.current_action.self_exclusion
  869. battler.target = [battler.target[rand(battler.target.size)]]
  870.         when 11 #对象随机
  871.       battler.target = []
  872.         for enemy in $game_troop.enemies
  873.           if enemy.exist?
  874.             battler.target.push(enemy)
  875.           end
  876.         end
  877.       for actor in $game_party.actors
  878.           if actor.exist?
  879.             battler.target.push(actor)
  880.           end
  881.         end
  882. battler.target -=[battler] if battler.current_action.self_exclusion
  883. battler.target = [battler.target[rand(battler.target.size)]]
  884. else
  885.       battler.target = [target]
  886. battler.target.push(battler) if battler.current_action.self_inclusion and
  887. battler.current_action.scope_force != 3 and
  888. battler.restriction != 2 and
  889. battler.restriction != 3
  890.       end
  891.       return true
  892.     end
  893.     # 防御の場合
  894.     if battler.current_action.basic == 1
  895.       # ステップ 3 に移行
  896.       battler.phase = 3
  897.       return false
  898.     end
  899. #===============0.15b(RTAB官方更新)===========================================   
  900.     # 逃げるの場合
  901.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  902.       # ステップ 3 に移行
  903.       battler.phase = 3
  904.       return false
  905.     end
  906. #=============================================================================
  907.     # 何もしないの場合
  908.     if battler.current_action.basic == 3
  909.       # ステップ 6 に移行
  910.       battler.phase = 6
  911.       return false
  912.     end
  913.   end  
  914. #--------------------------------------------------------------------------
  915. # ● 生成基本行动结果
  916. #--------------------------------------------------------------------------
  917.   alias xrxs19_make_basic_action_result make_basic_action_result
  918.    def make_basic_action_result(battler)
  919.     # 攻击的情况
  920.     if battler.current_action.basic == 0
  921.       # 获取行动者武器附加的战斗特效
  922.       if battler.is_a?(Game_Actor)
  923.         battler.set_xrxs19_special_effect(battler.equip_element_set)
  924.       # 行动时附加自身状态
  925.         if battler.current_action.p_state > 0
  926.         battler.pp_state(battler,battler.current_action.p_state)
  927.       end
  928.       # 行动时解除自身状态
  929.       if battler.current_action.m_state > 0
  930.         battler.remove_state(battler.current_action.m_state)
  931.       end
  932.       end
  933. end
  934.     # recall
  935.     xrxs19_make_basic_action_result(battler)
  936.   end
  937.   #--------------------------------------------------------------------------
  938.   # ● スキルまたはアイテムの対象側バトラー設定
  939.   #     scope : スキルまたはアイテムの効果範囲
  940.   # (武器范围定义必须)特技/道具的范围定义
  941.   #--------------------------------------------------------------------------
  942.   def set_target_battlers(scope, battler)
  943.     #行动方战斗者是敌方的情况
  944.     if battler.is_a?(Game_Enemy)
  945.      # 效果范围的分歧
  946.       case scope
  947.       when 1  # 敌单体
  948. battler.target.push(battler) if battler.current_action.self_inclusion           
  949.         index =battler.current_action.target_index
  950.         battler.target.push($game_party.smooth_target_actor(index))
  951.         
  952.       when 2  # 敌全体
  953. battler.target.push(battler) if battler.current_action.self_inclusion   
  954.         for actor in $game_party.actors
  955.           if actor.exist?
  956.             battler.target.push(actor)
  957.           end
  958.         end
  959.      
  960.       when 3  # 己方单体
  961.         
  962.         index = battler.current_action.target_index
  963.         battler.target.push($game_troop.smooth_target_enemy(index))
  964.       
  965.       when 4  # 己方全体
  966.         for enemy in $game_troop.enemies
  967.           if enemy.exist?
  968.             battler.target.push(enemy)
  969.           end
  970.         end
  971. battler.target -=[battler] if battler.current_action.self_exclusion        
  972.       when 5  # 己方单体 (HP 0)   
  973.         
  974.         index = battler.current_action.target_index
  975.         enemy = $game_troop.enemies[index]
  976.         if enemy != nil# and enemy.hp0?# 复活类特技/道具对生存者有效
  977.           battler.target.push(enemy)
  978.         end
  979.         
  980.       when 6  # 己方全体 (HP 0)
  981.         for enemy in $game_troop.enemies
  982.           if enemy != nil# and enemy.hp0?# 复活类特技/道具对生存者有效
  983.             battler.target.push(enemy)
  984.           end
  985.         end
  986. battler.target -=[battler] if battler.current_action.self_exclusion        
  987.       when 7  # 使用者
  988.         battler.target.push(battler)
  989.       when 8  # 全域化
  990.         for enemy in $game_troop.enemies
  991.           if enemy.exist?
  992.             battler.target.push(enemy)
  993.           end
  994.         end
  995.       for actor in $game_party.actors
  996.           if actor.exist?
  997.             battler.target.push(actor)
  998.           end
  999.         end
  1000. battler.target -=[battler] if battler.current_action.self_exclusion        
  1001.      when 9  # 敌方随机
  1002. battler.target.push(battler) if battler.current_action.self_inclusion        
  1003.              for actor in $game_party.actors
  1004.           if actor.exist?
  1005.             battler.target = [$game_party.random_target_actor]
  1006.           end
  1007.         end
  1008.          
  1009.           when 10  # 己方随机
  1010.         for enemy in $game_troop.enemies
  1011.           if enemy.exist?
  1012.             battler.target.push(enemy)
  1013.           end
  1014.         end
  1015. battler.target -=[battler] if battler.current_action.self_exclusion
  1016. battler.target = [battler.target[rand(battler.target.size)]]
  1017.         when 11 #对象随机
  1018.       battler.target = []
  1019.         for enemy in $game_troop.enemies
  1020.           if enemy.exist?
  1021.             battler.target.push(enemy)
  1022.           end
  1023.         end
  1024.       for actor in $game_party.actors
  1025.           if actor.exist?
  1026.             battler.target.push(actor)
  1027.           end
  1028.         end
  1029. battler.target -=[battler] if battler.current_action.self_exclusion        
  1030. battler.target = [battler.target[rand(battler.target.size)]]         
  1031.       end
  1032.     end
  1033.    
  1034.    
  1035.     #行动方战斗者是己方的情况
  1036.     if battler.is_a?(Game_Actor)
  1037.       # 效果范围的分歧
  1038.       case scope
  1039.       when 1  # 敌单体
  1040.         
  1041.         index = battler.current_action.target_index
  1042.         battler.target.push($game_troop.smooth_target_enemy(index))
  1043. battler.target.push(battler) if battler.current_action.self_inclusion         
  1044.       when 2  # 敌全体
  1045.          
  1046.         for enemy in $game_troop.enemies
  1047.           if enemy.exist?
  1048.             battler.target.push(enemy)
  1049.           end
  1050.         end
  1051. battler.target.push(battler) if battler.current_action.self_inclusion        
  1052.       when 3  # 己方单体
  1053.         
  1054.         index = battler.current_action.target_index
  1055.         battler.target.push($game_party.smooth_target_actor(index))
  1056.         
  1057.       when 4  # 己方全体
  1058.         for actor in $game_party.actors
  1059.           if actor.exist?
  1060.             battler.target.push(actor)
  1061.           end
  1062.         end
  1063. battler.target -=[battler] if battler.current_action.self_exclusion        
  1064.       when 5  # 己方单体 (HP 0)
  1065.         
  1066.         index = battler.current_action.target_index
  1067.         actor = $game_party.actors[index]
  1068.         if actor != nil# and actor.hp0?# 复活类特技/道具对生存者有效
  1069.           battler.target.push(actor)
  1070.         end
  1071.         
  1072.       when 6  # 己方全体 (HP 0)
  1073.         for actor in $game_party.actors
  1074.           if actor != nil# and actor.hp0?# 复活类特技/道具对生存者有效
  1075.             battler.target.push(actor)
  1076.           end
  1077.         end
  1078. battler.target -=[battler] if battler.current_action.self_exclusion        
  1079.       when 7  # 使用者
  1080.         battler.target.push(battler)
  1081.       when 8  # 全域化
  1082.         for enemy in $game_troop.enemies
  1083.           if enemy.exist?
  1084.             battler.target.push(enemy)
  1085.           end
  1086.         end
  1087.       for actor in $game_party.actors
  1088.           if actor.exist?
  1089.             battler.target.push(actor)
  1090.           end
  1091.         end            
  1092. battler.target -=[battler] if battler.current_action.self_exclusion
  1093.      when 9  # 敌方随机
  1094.       
  1095.         for enemy in $game_troop.enemies
  1096.           if enemy.exist?
  1097.             battler.target = [$game_troop.random_target_enemy]
  1098.           end
  1099.         end
  1100. battler.target.push(battler) if battler.current_action.self_inclusion         
  1101.       when 10  # 己方随机
  1102.       for actor in $game_party.actors
  1103.           if actor.exist?
  1104.             battler.target.push(actor)
  1105.           end
  1106.         end      
  1107. battler.target -=[battler] if battler.current_action.self_exclusion
  1108. battler.target = [battler.target[rand(battler.target.size)]]
  1109.         when 11 #对象随机
  1110.       battler.target = []
  1111.         for enemy in $game_troop.enemies
  1112.           if enemy.exist?
  1113.             battler.target.push(enemy)
  1114.           end
  1115.         end
  1116.       for actor in $game_party.actors
  1117.           if actor.exist?
  1118.             battler.target.push(actor)
  1119.           end
  1120.         end
  1121. battler.target -=[battler] if battler.current_action.self_exclusion
  1122. battler.target = [battler.target[rand(battler.target.size)]]
  1123. end
  1124. end
  1125. end   
  1126. #--------------------------------------------------------------------------
  1127. # ● 生成特技行动结果
  1128. #--------------------------------------------------------------------------
  1129.   alias xrxs19_make_skill_action_result make_skill_action_result
  1130.     def make_skill_action_result(battler, plus_id)
  1131.     # 获取特技
  1132.     @skill = $data_skills[battler.current_action.skill_id + plus_id]
  1133.     # 获取行动者特技附加的战斗特效
  1134.     battler.set_xrxs19_special_effect(battler.skill_element_set(@skill))
  1135.     # 行动时附加自身状态
  1136.           if battler.current_action.p_state > 0
  1137.         battler.pp_state(battler,battler.current_action.p_state)
  1138.       end
  1139.     # 行动时解除自身状态  
  1140.       if battler.current_action.m_state > 0
  1141.         battler.remove_state(battler.current_action.m_state)
  1142.       end
  1143.     # recall
  1144.     xrxs19_make_skill_action_result(battler, plus_id)
  1145.   end
  1146. #--------------------------------------------------------------------------
  1147. # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  1148. #--------------------------------------------------------------------------
  1149.   alias xrxs19_update_phase4_step5 update_phase4_step5
  1150.   def update_phase4_step5(battler)
  1151.     # recall
  1152.     xrxs19_update_phase4_step5(battler)
  1153.     # 行动者伤害表示(HP/SP吸收的表示用)
  1154.     if battler.damage[battler] != nil or
  1155.        battler.damage_sp[battler] != nil
  1156.        battler.damage_pop[battler] = true
  1157.     # 行动者状态栏刷新
  1158.       status_refresh(battler)
  1159.     end
  1160.   end
  1161. end
  1162. #==============================================================================
  1163. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1164. #==============================================================================
复制代码



RTAB特殊状态[魔法反射]
  1. # ▼▲▼ XRXS27. 特殊効果 SuperEX「魔法反射」 ver.1.03 ▼▲▼
  2. # by 桜雅 在土, clum-sea

  3. #==============================================================================
  4. # □ カスタマイズポイント
  5. #==============================================================================
  6. class Scene_Battle
  7.   MAGIC_REFREX_STATE_NAME         = "魔法反射"   # 「魔法反射」状态名
  8.   MAGIC_REFREX_ANIMATION_ID       =  64          #  魔法反射的动画ID
  9.   REFREX_PENETRATION_ELEMENT_NAME = "魔法贯通"   # 「反射貫通」属性名
  10. end
  11. class Scene_Battle
  12.   #--------------------------------------------------------------------------
  13.   # ○ スキルが魔法であるかどうか
  14.   #--------------------------------------------------------------------------
  15.   def skill_is_a_magic?(skill)
  16.     return false unless skill.is_a?(RPG::Skill)
  17.     return (skill.int_f > skill.str_f)
  18.   end
  19. end

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



容错
  1. #==============================================================================
  2. # ■ 容错脚本第3版                                              BY 轮回者
  3. #------------------------------------------------------------------------------
  4. #  本脚本基于星大叔的容错脚本第2版,区别只是“下手”的地方不同而已。
  5. #  说明请参看星大叔的容错脚本第2版。
  6. #==============================================================================

  7. $need_file_bitmap = []
  8. if FileTest.exist?("log_bitmap.txt")
  9. f = File.open("./log_bitmap.txt","r")
  10. $need_file_bitmap = f.read.split(/\n/)
  11. f.close
  12. end

  13. module Graphics
  14. @transition = method("transition")
  15. def self.transition(*arg)
  16.    begin
  17.      @transition.call(*arg)
  18.    rescue Errno::ENOENT
  19.      ary=[*arg]
  20.      filename=ary[1]
  21.      unless $need_file_bitmap.include?(filename)
  22.        $need_file_bitmap.push(filename)
  23.        f = File.open("./log_bitmap.txt","a")
  24.        f.write(filename + "\n")
  25.        f.close
  26.      end
  27.      @transition.call(ary[0])
  28.    end
  29. end
  30. end

  31. class Bitmap < Object
  32. alias ini initialize
  33. def initialize(*arg)
  34.    begin
  35.      ini(*arg)
  36.    rescue Errno::ENOENT
  37.      filename=[*arg][0]
  38.      unless $need_file_bitmap.include?(filename)
  39.        $need_file_bitmap.push(filename)
  40.        f = File.open("./log_bitmap.txt","a")
  41.        f.write(filename + "\n")
  42.        f.close
  43.      end
  44.      ini(32,32)
  45.    end
  46. end
  47. end

  48. $need_file_audio = []
  49. if FileTest.exist?("log_audio.txt")
  50. f = File.open("./log_audio.txt","r")
  51. $need_file_audio = f.read.split(/\n/)
  52. f.close
  53. end

  54. module Audio
  55. @me_play = method("me_play")
  56. def self.me_play(*arg)
  57.    begin
  58.      @me_play.call(*arg)
  59.    rescue Errno::ENOENT
  60.      filename=[*arg][0]
  61.      unless $need_file_audio.include?(filename)
  62.        $need_file_audio.push(filename)
  63.        f = File.open("./log_audio.txt","a")
  64.        f.write(filename + "\n")
  65.        f.close
  66.      end
  67.      me_stop
  68.    end
  69. end
  70. @bgm_play = method("bgm_play")
  71. def self.bgm_play(*arg)
  72.    begin
  73.      @bgm_play.call(*arg)
  74.    rescue Errno::ENOENT
  75.      filename=[*arg][0]
  76.      unless $need_file_audio.include?(filename)
  77.        $need_file_audio.push(filename)
  78.        f = File.open("./log_audio.txt","a")
  79.        f.write(filename + "\n")
  80.        f.close
  81.      end
  82.      bgm_stop
  83.    end
  84. end
  85. @se_play = method("se_play")
  86. def self.se_play(*arg)
  87.    begin
  88.      @se_play.call(*arg)
  89.    rescue Errno::ENOENT
  90.      filename=[*arg][0]
  91.      unless $need_file_audio.include?(filename)
  92.        $need_file_audio.push(filename)
  93.        f = File.open("./log_audio.txt","a")
  94.        f.write(filename + "\n")
  95.        f.close
  96.      end
  97.      se_stop
  98.    end
  99. end
  100. @bgs_play = method("bgs_play")
  101. def self.bgs_play(*arg)
  102.    begin
  103.      @bgs_play.call(*arg)
  104.    rescue Errno::ENOENT
  105.      filename=[*arg][0]
  106.      unless $need_file_audio.include?(filename)
  107.        $need_file_audio.push(filename)
  108.        f = File.open("./log_audio.txt","a")
  109.        f.write(filename + "\n")
  110.        f.close
  111.      end
  112.      bgs_stop
  113.    end
  114. end
  115. end
复制代码





回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部