查看: 1122|回复: 0

[已经过期] 求助,能帮忙把战斗特效和连击两脚本分开来吗

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2014-10-25 13:28:28 | 显示全部楼层 |阅读模式

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

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

×
以下6个脚本被连在了一起,可是连击部分脚本和其他脚本有冲突,只想要战斗特效脚本,可是这个战斗特效脚本不把连击加进去会出错。

连击显示部分
  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.     [url=home.php?mod=space&uid=81523]@skin[/url] = skin
  35.     @sprites = []
  36.     @width  = skin.width/10
  37.     [url=home.php?mod=space&uid=291977]@height[/url] = 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.     # 強制アクションかつ [url=home.php?mod=space&uid=316545]@force[/url] が 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.     [url=home.php?mod=space&uid=260100]@skill[/url] = $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 [url=home.php?mod=space&uid=292300]@Hidden[/url] 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 [url=home.php?mod=space&uid=133701]@battler[/url] == 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
复制代码


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战斗系统 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 = 150
  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.     # アニメーション ID を設定
  2030.     battler.anime1 = @item.animation1_id
  2031.     battler.anime2 = @item.animation2_id
  2032.     # コモンイベント ID を設定
  2033.     battler.event = @item.common_event_id
  2034.     # 対象を決定
  2035.     index = battler.current_action.target_index
  2036.     target = $game_party.smooth_target_actor(index)
  2037.     # 対象側バトラーを設定
  2038.     set_target_battlers(@item.scope, battler)
  2039.     # アイテムの効果を適用
  2040.     for target in battler.target
  2041.       target.item_effect(@item, battler)
  2042.     end
  2043.   end
  2044.   #--------------------------------------------------------------------------
  2045.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2046.   #--------------------------------------------------------------------------
  2047.   def update_phase4_step3(battler)
  2048.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2049.     case battler.current_action.kind
  2050.     when 0  # 基本
  2051.       if battler.current_action.basic == 1
  2052.         @help_window.set_text($data_system.words.guard, 1)
  2053.         @help_wait = @help_time
  2054.       end
  2055. #========RTAB 1.16==================================      
  2056.       if battler.current_action.basic == 2
  2057.         # 逃げる
  2058.         @help_window.set_text("逃げる", 1)
  2059.         @help_wait = @help_time
  2060.         battler.escape
  2061.         battler.phase = 4
  2062.         return
  2063.       end
  2064. #===================================================        
  2065.     when 1  # スキル
  2066.       skill =  $data_skills[battler.current_action.skill_id]
  2067.       @help_window.set_text(skill.name, 1)
  2068.       @help_wait = @help_time
  2069.     when 2  # アイテム
  2070.       item = $data_items[battler.current_action.item_id]
  2071.       @help_window.set_text(item.name, 1)
  2072.       @help_wait = @help_time
  2073.     end
  2074.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2075.     if battler.anime1 == 0
  2076.       battler.white_flash = true
  2077.       battler.wait = 5
  2078.       # カメラ設定
  2079.       if battler.target[0].is_a?(Game_Enemy)
  2080.         camera_set(battler)
  2081.       end
  2082.     else
  2083.       battler.animation.push([battler.anime1, true])
  2084.       speller = synthe?(battler)
  2085.       if speller != nil
  2086.         for spell in speller
  2087.           if spell != battler
  2088.             if spell.current_action.spell_id == 0
  2089.               spell.animation.push([battler.anime1, true])
  2090.             else
  2091.               skill = spell.current_action.spell_id
  2092.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2093.               spell.current_action.spell_id = 0
  2094.             end
  2095.           end
  2096.         end
  2097.       end
  2098.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2099.     end
  2100.     # ステップ 4 に移行
  2101.     battler.phase = 4
  2102.   end
  2103.   #--------------------------------------------------------------------------
  2104.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2105.   #--------------------------------------------------------------------------
  2106.   def update_phase4_step4(battler)
  2107.     # カメラ設定
  2108.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  2109.        camera_set(battler)
  2110.     end
  2111.     # 対象側アニメーション
  2112.     for target in battler.target
  2113.       target.animation.push([battler.anime2,
  2114.                                           (target.damage[battler] != "Miss")])
  2115.       unless battler.anime2 == 0
  2116.         battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
  2117.       end
  2118.     end
  2119.     # ステップ 5 に移行
  2120.     battler.phase = 5
  2121.   end
  2122.   #--------------------------------------------------------------------------
  2123.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  2124.   #--------------------------------------------------------------------------
  2125.   def update_phase4_step5(battler)
  2126.     # ダメージ表示
  2127.     for target in battler.target
  2128.       if target.damage[battler] != nil
  2129.         target.damage_pop[battler] = true
  2130.         target.damage_effect(battler, battler.current_action.kind)
  2131.         battler.wait = @damage_wait
  2132.         # ステータスウィンドウをリフレッシュ
  2133.         status_refresh(target)
  2134.       end
  2135.     end
  2136.     # ステップ 6 に移行
  2137.     battler.phase = 6
  2138.   end
  2139.   #--------------------------------------------------------------------------
  2140.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  2141.   #--------------------------------------------------------------------------
  2142.   def update_phase4_step6(battler)
  2143.     # カメラを戻す
  2144.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  2145.       @spriteset.screen_target(0, 0, 1)
  2146.     end
  2147.     # スキルラーニング
  2148.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  2149.       for target in battler.target
  2150.         skill_learning(target, target.class_id,
  2151.                         battler.current_action.skill_id)
  2152.       end
  2153.     end
  2154.     # アクション強制対象のバトラーをクリア
  2155.     if battler.current_action.forcing == true and
  2156.         battler.current_action.force_kind == 0 and
  2157.         battler.current_action.force_basic == 0 and
  2158.         battler.current_action.force_skill_id == 0
  2159.       $game_temp.forcing_battler = nil
  2160.       battler.current_action.forcing = false
  2161.     end
  2162.     refresh_phase(battler)
  2163.     speller = synthe?(battler)
  2164.     if speller != nil
  2165.       for spell in speller
  2166.         if spell != battler
  2167.           refresh_phase(spell)
  2168.         end
  2169.       end
  2170.       synthe_delete(speller)
  2171.     end
  2172.     # コモンイベント ID が有効の場合
  2173.     if battler.event > 0
  2174.       # イベントをセットアップ
  2175.       common_event = $data_common_events[battler.event]
  2176.       $game_system.battle_interpreter.setup(common_event.list, 0)
  2177.     end
  2178.     act = 0
  2179.     for actor in $game_party.actors + $game_troop.enemies
  2180.       if actor.movable?
  2181.         act += 1
  2182.       end
  2183.     end
  2184.     if @turn_cnt >= act and act > 0
  2185.       @turn_cnt %= act
  2186.       $game_temp.battle_turn += 1
  2187.       # バトルイベントの全ページを検索
  2188.       for index in 0...$data_troops[@troop_id].pages.size
  2189.         # イベントページを取得
  2190.         page = $data_troops[@troop_id].pages[index]
  2191.         # このページのスパンが [ターン] の場合
  2192.         if page.span == 1
  2193.           # 実行済みフラグをクリア
  2194.           $game_temp.battle_event_flags[index] = false
  2195.         end
  2196.       end
  2197.     end
  2198.     battler.phase = 1
  2199.     @action_battlers.delete(battler)
  2200.   end
  2201.   #--------------------------------------------------------------------------
  2202.   # ● リフレッシュ
  2203.   #--------------------------------------------------------------------------
  2204.   def refresh_phase(battler)
  2205.     battler.at -= @max
  2206.     if battler.movable?
  2207.       battler.atp = 100 * battler.at / @max
  2208.     end
  2209.     spell_reset(battler)
  2210.     # スリップダメージ
  2211.     if battler.hp > 0 and battler.slip_damage?
  2212.       battler.slip_damage_effect
  2213.       battler.damage_pop["slip"] = true
  2214.     end
  2215.     # ステート自然解除
  2216.     battler.remove_states_auto
  2217.     # ステータスウィンドウをリフレッシュ
  2218.     status_refresh(battler, true)
  2219.     unless battler.movable?
  2220.       return
  2221.     end
  2222.     # ターン数カウント
  2223.     @turn_cnt += 1
  2224.   end
  2225.   #--------------------------------------------------------------------------
  2226.   # ● バトラーアクションスタート
  2227.   #--------------------------------------------------------------------------
  2228.   def action_start(battler)
  2229.     battler.phase = 1
  2230.     battler.anime1 = 0
  2231.     battler.anime2 = 0
  2232.     battler.target = []
  2233.     battler.event = 0
  2234.     @action_battlers.unshift(battler)
  2235.   end
  2236.   #--------------------------------------------------------------------------
  2237.   # ● ステータスウィンドウをリフレッシュ
  2238.   #--------------------------------------------------------------------------
  2239.   def status_refresh(battler, at = false)
  2240.     if battler.is_a?(Game_Actor)
  2241.       for i in 0...$game_party.actors.size
  2242.         if battler == $game_party.actors[i]
  2243.           number = i + 1
  2244.         end
  2245.       end
  2246.       @status_window.refresh(number)
  2247.       if at == true
  2248.         @status_window.at_refresh(number)
  2249.       end
  2250.     end
  2251.   end
  2252.   #--------------------------------------------------------------------------
  2253.   # ● アニメウェイト判断処理
  2254.   #--------------------------------------------------------------------------
  2255.   def anime_wait_return
  2256.     if (@action_battlers.empty? or @anime_wait == false) and
  2257.         not $game_system.battle_interpreter.running?
  2258.       # エネミーアローが有効の場合
  2259.       if @enemy_arrow != nil
  2260.         return [@active - 2, 0].min == 0
  2261.       # アクターアローが有効の場合
  2262.       elsif @actor_arrow != nil
  2263.         return [@active - 2, 0].min == 0
  2264.       # スキルウィンドウが有効の場合
  2265.       elsif @skill_window != nil
  2266.         return [@active - 3, 0].min == 0
  2267.       # アイテムウィンドウが有効の場合
  2268.       elsif @item_window != nil
  2269.         return [@active - 3, 0].min == 0
  2270.       # アクターコマンドウィンドウが有効の場合
  2271.       elsif @actor_command_window.active
  2272.         return [@active - 1, 0].min == 0
  2273.       else
  2274.         return true
  2275.       end
  2276.     else
  2277.       return false
  2278.     end
  2279.   end
  2280.   #--------------------------------------------------------------------------
  2281.   # ● アクターコマンド消去判断
  2282.   #--------------------------------------------------------------------------
  2283.   def command_delete
  2284.     # エネミーアローが有効の場合
  2285.     if @enemy_arrow != nil
  2286.       end_enemy_select
  2287.     # アクターアローが有効の場合
  2288.     elsif @actor_arrow != nil
  2289.       end_actor_select
  2290.     end
  2291.     # スキルウィンドウが有効の場合
  2292.     if @skill_window != nil
  2293.       end_skill_select
  2294.     # アイテムウィンドウが有効の場合
  2295.     elsif @item_window != nil
  2296.       end_item_select
  2297.     end
  2298.     # アクターコマンドウィンドウが有効の場合
  2299.     if @actor_command_window.active
  2300.       @command.shift
  2301.       @command_a = false
  2302.       # メインフェーズフラグをセット
  2303.       $game_temp.battle_main_phase = true
  2304.       # アクターコマンドウィンドウを無効化
  2305.       @actor_command_window.active = false
  2306.       @actor_command_window.visible = false
  2307.       # アクターの明滅エフェクト OFF
  2308.       if @active_actor != nil
  2309.         @active_actor.blink = false
  2310.       end
  2311.     end
  2312.   end
  2313.   #--------------------------------------------------------------------------
  2314.   # ● 強制アクション設定
  2315.   #--------------------------------------------------------------------------
  2316.   def force_action(battler)
  2317.     battler.current_action.kind = battler.current_action.force_kind
  2318.     battler.current_action.basic = battler.current_action.force_basic
  2319.     battler.current_action.skill_id = battler.current_action.force_skill_id
  2320.     battler.current_action.force_kind = 0
  2321.     battler.current_action.force_basic = 0
  2322.     battler.current_action.force_skill_id = 0
  2323.   end
  2324.   #--------------------------------------------------------------------------
  2325.   # ● カメラセット
  2326.   #--------------------------------------------------------------------------
  2327.   def camera_set(battler)
  2328.     @camera = battler
  2329.     if battler.target.size == 1
  2330.       if battler.current_action.kind == 0
  2331.         zoom = 1.2 / battler.target[0].zoom
  2332.       elsif synthe?(battler) == nil
  2333.         zoom = 1.5 / battler.target[0].zoom
  2334.       else
  2335.         zoom = 2.0 / battler.target[0].zoom
  2336.       end
  2337.       @spriteset.screen_target(battler.target[0].attack_x(zoom),
  2338.                                 battler.target[0].attack_y(zoom), zoom)
  2339.     else
  2340.       @spriteset.screen_target(0, 0, 0.75)
  2341.     end
  2342.   end
  2343.   #--------------------------------------------------------------------------
  2344.   # ● スキル詠唱タイム作成
  2345.   #--------------------------------------------------------------------------
  2346.   def recite_time(battler)
  2347.   end
  2348.   #--------------------------------------------------------------------------
  2349.   # ● 連携スキル判別
  2350.   #--------------------------------------------------------------------------
  2351.   def synthe_spell(battler)
  2352.   end
  2353.   #--------------------------------------------------------------------------
  2354.   # ● スキルラーニングシステム
  2355.   #--------------------------------------------------------------------------
  2356.   def skill_learning(actor, class_id, skill_id)
  2357.   end
  2358.   #--------------------------------------------------------------------------
  2359.   # ● 行動可能判定
  2360.   #--------------------------------------------------------------------------
  2361.   def active?(battler)
  2362.     speller = synthe?(battler)
  2363.     if speller != nil
  2364.       if synthe_delete?(speller)
  2365.         return false
  2366.       end
  2367.     else
  2368.       unless battler.inputable?
  2369.         spell_reset(battler)
  2370.         unless battler.movable?
  2371.           battler.atp = 0
  2372.           return false
  2373.         end
  2374.       end
  2375.       if battler.current_action.forcing
  2376.         spell_reset(battler)
  2377.       end
  2378.     end
  2379.     return true
  2380.   end
  2381.   #--------------------------------------------------------------------------
  2382.   # ● 合成スキル詠唱中か?
  2383.   #--------------------------------------------------------------------------
  2384.   def synthe?(battler)
  2385.     for speller in @synthe
  2386.       if speller.include?(battler)
  2387.         return speller
  2388.       end
  2389.     end
  2390.     return nil
  2391.   end
  2392.   #--------------------------------------------------------------------------
  2393.   # ● 合成スキル消去判断
  2394.   #--------------------------------------------------------------------------
  2395.   def synthe_delete?(speller)
  2396.     for battler in speller
  2397.       if not battler.inputable? and dead_ok?(battler)
  2398.         synthe_delete(speller)
  2399.         return true
  2400.       end
  2401.     end
  2402.     return false
  2403.   end
  2404.   #--------------------------------------------------------------------------
  2405.   # ● 合成スキル消去
  2406.   #--------------------------------------------------------------------------
  2407.   def synthe_delete(speller)
  2408.     for battler in speller
  2409.       spell_reset(battler)
  2410.       if dead_ok?(battler)
  2411.         @action_battlers.delete(battler)
  2412.       end
  2413.     end
  2414.     @synthe.delete(speller)
  2415.   end
  2416.   #--------------------------------------------------------------------------
  2417.   # ● 連携含むスキル詠唱解除
  2418.   #--------------------------------------------------------------------------
  2419.   def skill_reset(battler)
  2420.     speller = synthe?(battler)
  2421.     if speller != nil
  2422.       synthe_delete(speller)
  2423.     else
  2424.       spell_reset(battler)
  2425.     end
  2426.   end
  2427.   #--------------------------------------------------------------------------
  2428.   # ● スキル詠唱解除
  2429.   #--------------------------------------------------------------------------
  2430.   def spell_reset(battler)
  2431.     battler.rt = 0
  2432.     battler.rtp = 0
  2433.     battler.blink = false
  2434.     battler.spell = false
  2435.     battler.current_action.spell_id = 0
  2436.     @spell_p.delete(battler)
  2437.     @spell_e.delete(battler)
  2438.   end
  2439.   #--------------------------------------------------------------------------
  2440.   # ● 戦闘終了判定
  2441.   #--------------------------------------------------------------------------
  2442.   def fin?
  2443.    return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  2444.   end
  2445.   #--------------------------------------------------------------------------
  2446.   # ● 敵全滅判定
  2447.   #--------------------------------------------------------------------------
  2448.   def victory?
  2449.     for battler in $game_troop.enemies
  2450.       if not battler.hidden and (battler.rest_hp > 0 or
  2451.           battler.immortal or battler.damage_pop.size > 0)
  2452.         return false
  2453.       end
  2454.     end
  2455.     return true
  2456.   end
  2457.   #--------------------------------------------------------------------------
  2458.   # ● 死亡許可判定
  2459.   #--------------------------------------------------------------------------
  2460.   def dead_ok?(battler)
  2461.     speller = synthe?(battler)
  2462.     if speller == nil
  2463.       if @action_battlers.include?(battler)
  2464.         if battler.phase > 2
  2465.           return false
  2466.         end
  2467.       end
  2468.     else
  2469.       for battler in speller
  2470.         if @action_battlers.include?(battler)
  2471.           if battler.phase > 2
  2472.             return false
  2473.           end
  2474.         end
  2475.       end
  2476.     end
  2477.     return true
  2478.   end
  2479. end

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

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

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

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

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

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

  3202. #==============================================================================
  3203. # ■ Game_BattleAction
  3204. #------------------------------------------------------------------------------
  3205. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3206. # スの内部で使用されます。
  3207. #==============================================================================

  3208. class Game_BattleAction
  3209.   #--------------------------------------------------------------------------
  3210.   # ● 公開インスタンス変数
  3211.   #--------------------------------------------------------------------------
  3212.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3213.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3214.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3215.   attr_accessor :force_skill_id           # スキル ID
  3216.   #--------------------------------------------------------------------------
  3217.   # ● 有効判定
  3218.   #--------------------------------------------------------------------------
  3219.   def valid?
  3220.     return (not (@force_kind == 0 and @force_basic == 3))
  3221.   end
  3222. end

  3223. #==============================================================================
  3224. # ■ Game_Actor
  3225. #------------------------------------------------------------------------------
  3226. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3227. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3228. #==============================================================================

  3229. class Game_Actor < Game_Battler
  3230.   def skill_can_use?(skill_id)
  3231.     return super
  3232.   end
  3233. end

  3234. #==============================================================================
  3235. # ■ Game_Enemy
  3236. #------------------------------------------------------------------------------
  3237. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3238. # 内部で使用されます。
  3239. #==============================================================================

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

  3387. #==============================================================================
  3388. # ■ Game_Party
  3389. #------------------------------------------------------------------------------
  3390. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3391. # ラスのインスタンスは $game_party で参照されます。
  3392. #==============================================================================

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

  3466. #==============================================================================
  3467. # ■ Game_Troop
  3468. #------------------------------------------------------------------------------
  3469. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3470. # れます。
  3471. #==============================================================================

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

  3522. #==============================================================================
  3523. # ■ Sprite_Battler
  3524. #------------------------------------------------------------------------------
  3525. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3526. # スプライトの状態を自動的に変化させます。
  3527. #==============================================================================

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

  3652. #==============================================================================
  3653. # ■ Window_Base
  3654. #------------------------------------------------------------------------------
  3655. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3656. #==============================================================================

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

  3709. #==============================================================================
  3710. # ■ Window_Help
  3711. #------------------------------------------------------------------------------
  3712. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3713. #==============================================================================

  3714. class Window_Help < Window_Base
  3715.   #--------------------------------------------------------------------------
  3716.   # ● エネミー設定
  3717.   #     enemy : 名前とステートを表示するエネミー
  3718.   #--------------------------------------------------------------------------
  3719.   def set_enemy(enemy)
  3720.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3721.     state_text = make_battler_state_text(enemy, 112, false)
  3722.     if state_text != ""
  3723.       text += "  " + state_text
  3724.     end
  3725.     set_text(text, 1)
  3726.   end
  3727. end

  3728. #==============================================================================
  3729. # ■ Window_BattleStatus
  3730. #------------------------------------------------------------------------------
  3731. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3732. #==============================================================================

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

  3806. #==============================================================================
  3807. # ■ Window_ActorStatus
  3808. #------------------------------------------------------------------------------
  3809. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3810. #==============================================================================

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

  3878. #==============================================================================
  3879. # ■ Window_DetailsStatus
  3880. #------------------------------------------------------------------------------
  3881. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3882. #==============================================================================

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

  3936. #==============================================================================
  3937. # ■ Arrow_Base
  3938. #------------------------------------------------------------------------------
  3939. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3940. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3941. #==============================================================================

  3942. class Arrow_Base < Sprite
  3943.   #--------------------------------------------------------------------------
  3944.   # ● オブジェクト初期化
  3945.   #     viewport : ビューポート
  3946.   #--------------------------------------------------------------------------
  3947.   def initialize(viewport)
  3948.     super(viewport)
  3949.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3950.     self.ox = 16
  3951.     self.oy = 32
  3952.     self.z = 2500
  3953.     @blink_count = 0
  3954.     @index = 0
  3955.     @help_window = nil
  3956.     update
  3957.   end
  3958. end

  3959. #==============================================================================
  3960. # ■ Arrow_Enemy
  3961. #------------------------------------------------------------------------------
  3962. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  3963. # スを継承します。
  3964. #==============================================================================

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

  4010. #==============================================================================
  4011. # ■ Interpreter
  4012. #------------------------------------------------------------------------------
  4013. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4014. # スや Game_Event クラスの内部で使用されます。
  4015. #==============================================================================

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

  4252. #==============================================================================
  4253. # ■ Spriteモジュール
  4254. #------------------------------------------------------------------------------
  4255. #  アニメーションの管理を行うモジュールです。
  4256. #==============================================================================

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

  4595. #------------------------------------------------------------------------------
  4596. #  Bitmapクラスに新たな機能を追加します。
  4597. #==============================================================================

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


加了 菜鸟横版modified
  1. =begin
  2.   #--------------------------------------------------------------------------
  3.  # ● 人物行走图做战斗图像(附加动画) ver1.02
  4.   #--------------------------------------------------------------------------
  5.   制作者 らい
  6.   翻译:忧郁的涟漪
  7.   
  8.    
  9.   图像文件的规格
  10.   
  11.   ● 巴特勒图像(似乎指的是战斗图像)
  12.   
  13.   使用步行图片。
  14.    
  15.   ● 武器的图像
  16.   
  17.   就是武器图标的图像(ICO图)  
  18.       

  19. ###############################################################################
  20. 行走图横版战斗:
  21. ------------------------------------------------------------------------------
  22. 经过了两次的修改,终于完全实现了远距离攻击的效果(弓箭、铳类)
  23. 另外,也实现了简单的回旋攻击(类似回力镖的攻击)和攻击道具(类似石头或炸弹)

  24. 这个脚本的更动分为2部分:
  25. 1)战斗动作 - 新加了数个动作,如:“弓箭攻击”、“远距离发动”等等
  26. 2)战斗动画 - 基本上是脚本原带的。只是这个功能被隐藏起来了。现在已恢复。

  27. 用法:
  28. 在相应的脚本行加入武器/技能/道具的数据库id(id之间要用“,”来分开)
  29. 如果不要某些功能的话就随便填一个外太空id就行了(没有用到的id)
  30. 1)战斗动作(角色/行走图的动作)
  31. 脚本355行:  远程武器的id  (普通攻击时使用远程射击)
  32. 脚本357行:  回旋武器的id  (普通攻击时会飞回手上的武器,如:回力镖)
  33. 脚本370行:  远程技能的id  (使用技能时是远程射击)
  34. 脚本372行:  回旋技能的id  (使用技能时,飞出的武器会飞回手上)

  35. 2)战斗动画(显示‘对象方的动画’之前先显示‘飞行武器射去敌人身上’的动画)
  36. 脚本453行:  回旋武器的id  (攻击时会显示一段类似回力镖的动画)
  37. 脚本455行:  弓箭武器的id  (攻击时会显示箭射去敌人身上的动画)
  38. 脚本457行:  铳类武器的id  (攻击时会显示子弹射去敌人身上的动画)
  39. 脚本470行:  回旋技能的id  (技能使用时会显示一段类似回力镖的动画)
  40. 脚本472行:  弓箭技能的id  (技能使用时会显示箭射去敌人身上的动画)
  41. 脚本474行:  铳类技能的id  (技能使用时会显示子弹射去敌人身上的动画)
  42. 脚本486行:  抛击道具的id  (使用该道具时,道具被丢到敌人身上)

  43. 〉注意:
  44. 〉‘飞行武器射去敌人身上’的动画是在设定id之后的那句脚本里面设置
  45. 〉例子:(脚本第455和456行)
  46. 〉       when 17,18,19,20    #远程武器1(弓箭类)的id
  47. 〉       return [101,32,false,false]
  48. 〉这样,武器17~20(都是弓箭)在显示‘对象方的动画’之前会先显示第101号动画
  49. 〉而动画的轨道是从使用者身上直到敌人身上(实现子弹射出的效果)
  50.   
  51. 还有:
  52. 战斗队伍的画面位置已经被修改过,
  53. 让角色的位置与默认的战斗背景图不会有视觉上的冲突。
  54. 如果要更改请去脚本第113-116行改改就行了。

  55. 脚本‘Arrow_Enemy’和‘Arrow_Actor’被稍微修改过(可以无视)

  56. 这个范例附带了
  57. 一张经过修改的战斗背景图(027-castle03),其他的战斗背景图可以使用默认的。
  58. 一套横版的默认敌人的战斗图(从行走图改过来的)

  59. =end                                                        #modify by darkten
  60. ###############################################################################
  61.   
  62. module Side_view
  63.   #--------------------------------------------------------------------------
  64.   # ● 是否与RATB并用 ☆自动识别(这到是不错~省了~)
  65.   #    在Scene_Battle计算方法是否是方法synthe?
  66.   #    在自动不想认识的时候,请重写。
  67.   #--------------------------------------------------------------------------
  68.   if Scene_Battle.method_defined?("synthe?")
  69.     RTAB = true
  70.   else
  71.     RTAB = false
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 改正RATB中的位置误差 ☆自动识别
  75.   #    在自动不想认识的时候,请重写。
  76.   #--------------------------------------------------------------------------
  77.   def camera_correctness
  78.     return false if !RTAB
  79.     begin
  80.       return $scene.drive
  81.     rescue
  82.       return false
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 队伍中的最大人数
  87.   #--------------------------------------------------------------------------
  88.   Party_max = 4
  89.   #--------------------------------------------------------------------------
  90.   # ● 战斗图的扩大率(1.0的时候是保持原有大小)
  91.   #--------------------------------------------------------------------------
  92.   CHAR_ZOOM = 1.0
  93.   #--------------------------------------------------------------------------
  94.   # ● 光标的位置修正(基本不需要改~)
  95.   #--------------------------------------------------------------------------
  96.   ARROW_OX = 0
  97.   ARROW_OY = 64
  98.   #--------------------------------------------------------------------------
  99.   # ● 名状态作为飞行管理的排列(不知道什么意思....)
  100.   #--------------------------------------------------------------------------
  101.   FLY_STATES = ["飛行"]
  102.   #--------------------------------------------------------------------------
  103.   # ● 战斗画面的位置
  104.   #--------------------------------------------------------------------------
  105.   PARTY_X = 455     # 队伍 X 位置
  106.   PARTY_Y = 200     # 队伍 Y 位置
  107.   FORMATION_X = 15  # 各个角色之间的间隔 X
  108.   FORMATION_Y = 35  # 各个角色之间的间隔 Y
  109.   #--------------------------------------------------------------------------
  110.   # ● 自定义常数
  111.   #--------------------------------------------------------------------------
  112.   NORMAL   = "NORMAL"
  113.   WALK_R   = "WALK_R"
  114.   WALK_L   = "WALK_L"
  115.   ATTACK   = "ATTACK"
  116.   ATTACK_R = "ATTACK_R"
  117.   ATTACK_L = "ATTACK_L"
  118.   MAGIC    = "MAGIC"
  119.   ITEM     = "ITEM"
  120.   # 动画的设定
  121.   ANIME = {
  122.     # [画像ID,是否循环,アニメスピード,动画速度,不能指向动画,武器放在右手or左手]
  123.     NORMAL            => [1,true , 0,false, true ,""    ], # 通常待击
  124.     WALK_R            => [2,true , 2,false, false,""    ], # 右移动
  125.     WALK_L            => [1,true , 2,false, false,""    ], # 左移动
  126.     ATTACK_R          => [1,false, 2,true , false,"右手"], # 右手攻击
  127.     ATTACK_L          => [1,false, 2,true , false,"左手"], # 左手攻击
  128.     MAGIC             => [1,false, 2,false, false,""    ], # 右手攻击
  129.     ITEM              => [1,false, 2,false, false,""    ], # 左手攻击
  130.     }
  131.    
  132.   # 债务不履行声明价值的设定(一个字一个字翻译的,不知道啥意思)  
  133.   ANIME.default = [1,false,12,false,"",""]
  134.   
  135.   # 在行动设定的时候 右手攻击 or 左手攻击 辨别を(这个不知道什么意思)的ANIME
  136.   # "角色动画变更#ATTACK"在玩了と(还是不知道啥意思..)的时候,辨别ATTACK_R或者ATTACK_L
  137.   DUAL_WEAPONS_ANIME = [ATTACK]
  138.   
  139.   #--------------------------------------------------------------------------
  140.   # ● 摇晃的设定
  141.   #--------------------------------------------------------------------------
  142.   SHAKE_FILE = "摇晃"  # 文件名
  143.   SHAKE_POWER = 5          # 强度
  144.   SHAKE_SPEED = 5          # 速度
  145.   SHAKE_DURATION = 5      # 时间
  146.   #--------------------------------------------------------------------------
  147.   # ● 上下反转地的设定
  148.   #--------------------------------------------------------------------------
  149.   UPSIDE_DOWN_FILE = "上下反转" # 文件名
  150.   #--------------------------------------------------------------------------
  151.   # ● 左右反转地的设定
  152.   #--------------------------------------------------------------------------
  153.   REVERSE_FILE = "左右反转" # 文件名
  154.   #--------------------------------------------------------------------------
  155.   # ● 回转地的设定
  156.   #--------------------------------------------------------------------------
  157.   TURNING_FILE = "回转" # 文件名
  158.   TURNING_DIRECTION = 1 # 方向(1.逆时针,-1.顺时针)(|||-_-汗..怎么还有用-1做带入值的...)
  159.   TURNING_SPEED = 40    # 速度
  160.   TURNING_DURATION = 1  # 回转数
  161.   #--------------------------------------------------------------------------
  162.   # ● 移动的设定
  163.   #--------------------------------------------------------------------------
  164.   MOVE_FILE = "移动"             # 文件名
  165.   MOVE_RETURN = 1                # 回到原来的位置吗?(光写了个1,也不知道不回到该怎么写?0?)
  166.   MOVE_SPEED = 32                # 速度
  167.   MOVE_COORDINATES = [0,-640]    # 原来位置的相对坐标
  168.   #--------------------------------------------------------------------------
  169.   # ● 动画追加的设定
  170.   #--------------------------------------------------------------------------
  171.   ADD_ANIME_FILE = "动画追加"  # 文件名
  172.   ADD_ANIME_ID = 0               # 动画的ID
  173.   #--------------------------------------------------------------------------
  174.   # ● 债务不履行声明和RTAB的数据转换
  175.   #--------------------------------------------------------------------------
  176.   def convert_battler
  177.     return RTAB ? @active_actor : @active_battler
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 债务不履行声明和RTAB的数据转换2
  181.   #--------------------------------------------------------------------------
  182.   def convert_battler2(*arg)
  183.     return RTAB ? arg[0] : @active_battler
  184.   end
  185. end

  186. #--------------------------------------------------------------------------
  187. # ● 行动設定
  188. #--------------------------------------------------------------------------
  189. module BattleActions
  190.   
  191.   # 下のものはあくまでも一例なので
  192.   # 独自に作ってください。

  193.   Actions = {

  194.   "通常攻撃" => [
  195.   
  196.   "閃きアニメ",
  197.   "アクターアニメ変更#WALK_L",
  198.   "移動#target,32,0,64,0",
  199.   "行動アニメ",
  200.   "アクターアニメ変更#ATTACK",
  201.   "遠距離アニメ",
  202.   "対象アニメ",
  203.   "アクターアニメ変更#WALK_L",
  204.   "SEの演奏#016-Jump02,80,100",
  205.   "移動#self,0,0,48,32",
  206.   "終了"
  207.   ],

  208.   "エネミー攻撃" => [
  209.   
  210.   "閃きアニメ",
  211.   "アクターアニメ変更#WALK_L",
  212.   "移動#self,-36,0,12,0",
  213.   "行動アニメ",
  214.   "アクターアニメ変更#ATTACK",
  215.   "遠距離アニメ",
  216.   "対象アニメ",
  217.   "アクターアニメ変更#WALK_L",
  218.   "移動#self,0,0,12,0",
  219.   "終了"
  220.   ],
  221.   
  222.   "術発動" => [
  223.   
  224.   "閃きアニメ",
  225.   "アクターアニメ変更#WALK_L",
  226.   "移動#self,-32,0,4,0",
  227.   "アクターアニメ変更#MAGIC",
  228.   "行動アニメ",
  229.   "ウエイト#15",
  230.   "遠距離アニメ",
  231.   "対象アニメ",
  232.   "アクターアニメ変更#WALK_L",
  233.   "移動#self,0,0,4,2",
  234.   "終了"
  235.   ],

  236.   "アイテム使用" => [
  237.   
  238.   "閃きアニメ",
  239.   "アクターアニメ変更#WALK_L",
  240.   "移動#self,-32,0,4,0",
  241.   "行動アニメ",
  242.   "アクターアニメ変更#ITEM",
  243.   "ウエイト#15",
  244.   "遠距離アニメ",
  245.   "対象アニメ",
  246.   "アクターアニメ変更#WALK_L",
  247.   "移動#self,0,0,4,2",
  248.   "終了"
  249.   ],
  250.   
  251.   "払い抜け" => [
  252.   
  253.   "閃きアニメ",
  254.   "アクターアニメ変更#WALK_L",
  255.   "移動#target_near,50,0,48,30",  
  256.   "左右反転",
  257.   "アクターアニメ固定#ATTACK#3",
  258.   "行動アニメ",
  259.   "SEの演奏#135-Light01,100,100",
  260.   "アニメーションの表示#self,42",
  261.   "ウエイト#15",
  262.   "左右反転",
  263.   "残像表示",
  264.   "移動#target_far,-50,0,48,0",
  265.   "対象アニメ",
  266.   "残像消去",
  267.   "アニメ固定解除",
  268.   "アクターアニメ変更#WALK_L",
  269.   "移動#self,0,0,48,1,0",
  270.   "終了"
  271.   ],

  272.   "弓箭攻撃" => [
  273.   
  274.   "閃きアニメ",
  275.   "アクターアニメ変更#WALK_L",
  276.   "移動#self,-32,0,4,0",
  277.   "行動アニメ",
  278.   "アクターアニメ変更#ATTACK",
  279.   "遠距離アニメ",
  280.   "対象アニメ",
  281.   "アクターアニメ変更#WALK_L",
  282.   "移動#self,0,0,4,2",
  283.   "終了"
  284.   ],

  285.   "回旋攻撃" => [
  286.   
  287.   "閃きアニメ",
  288.   "アクターアニメ変更#WALK_L",
  289.   "移動#self,-32,0,4,0",
  290.   "行動アニメ",
  291.   "アクターアニメ変更#STAND_L",  
  292.   "遠距離アニメ",
  293.   "対象アニメ",
  294.   "アクターアニメ変更#WALK_L",
  295.   "移動#self,0,0,4,2",
  296.   "終了"
  297.   ],
  298.   
  299.   "远距离発動" => [
  300.   
  301.   "閃きアニメ",
  302.   "アクターアニメ変更#WALK_L",
  303.   "移動#self,-32,0,4,0",
  304.   "アクターアニメ変更#MAGIC",
  305.   "行動アニメ",
  306.   "アクターアニメ変更#ATTACK",
  307.   "遠距離アニメ",
  308.   "対象アニメ",
  309.   "アクターアニメ変更#WALK_L",
  310.   "移動#self,0,0,4,2",
  311.   "終了"
  312.   ],
  313.   
  314.   "回旋発動" => [
  315.   
  316.   "閃きアニメ",
  317.   "アクターアニメ変更#WALK_L",
  318.   "移動#self,-32,0,4,0",
  319.   "アクターアニメ変更#MAGIC",
  320.   "行動アニメ",
  321.   "アクターアニメ変更#STAND_L",  
  322.   "遠距離アニメ",
  323.   "対象アニメ",
  324.   "アクターアニメ変更#WALK_L",
  325.   "移動#self,0,0,4,2",
  326.   "終了"
  327.   ],

  328.   } # ここで終わり 消さないでください

  329. end
  330.   
  331. module RPG
  332.   class Weapon
  333.     #--------------------------------------------------------------------------
  334.     # ● アクション設定
  335.     #--------------------------------------------------------------------------
  336.     def battle_actions
  337.       case @id
  338.       when 17,18,19,20,21,22,23,24  # 远程武器的id回旋攻撃
  339.         return BattleActions::Actions["弓箭攻撃"]
  340.       when 34                       # 回旋武器的id
  341.         return BattleActions::Actions["回旋攻撃"]
  342.       end
  343.       else
  344.       return BattleActions::Actions["通常攻撃"]
  345.     end
  346.   end
  347.   class Skill
  348.     #--------------------------------------------------------------------------
  349.     # ● アクション設定
  350.     #--------------------------------------------------------------------------
  351.     def battle_actions
  352.       case @id
  353.       when 73,74,75,76,77,78,79,80  # 远程技能的id
  354.         return BattleActions::Actions["远距离発動"]
  355.       when 82                       # 回旋技能的id
  356.         return BattleActions::Actions["回旋発動"]
  357.       end
  358.       else
  359.       if self.magic?
  360.         return BattleActions::Actions["術発動"]
  361.       else
  362.         return BattleActions::Actions["払い抜け"]
  363.       end
  364.     end
  365.   end
  366.   class Item
  367.     #--------------------------------------------------------------------------
  368.     # ● アクション設定
  369.     #--------------------------------------------------------------------------
  370.     def battle_actions
  371.       return BattleActions::Actions["アイテム使用"]
  372.     end
  373.   end
  374. end
  375. class Game_Enemy < Game_Battler
  376.   #--------------------------------------------------------------------------
  377.   # ● アクション設定
  378.   #--------------------------------------------------------------------------
  379.   def battle_actions
  380.     return BattleActions::Actions["エネミー攻撃"]
  381.   end
  382. end
  383. =begin
  384. #--------------------------------------------------------------------------
  385. # ● 遠距離アニメーション
  386. #--------------------------------------------------------------------------
  387.  ☆ 説明
  388.   
  389.    行動者から対象者にアニメを飛ばします。
  390.    飛ばすアニメを データベース‐アニメーション で作ります。
  391.     [アニメーションID, スピード, 往復するか?,直線(false)or曲線(true)] で指定します。


  392.   ● カスタマイズ方法
  393.    
  394.     case @id
  395.     when 17,18,19,20
  396.       return [101,32,false,false]
  397.     when 21,22,23,24
  398.       return [102,32,false,false]
  399.     end
  400.     return 0
  401.    
  402.     のように描くとID別に指定可能です。
  403.    
  404.    
  405.   ● アニメーションID
  406.   
  407.   飛ばすアニメーションIDです。短い場合は繰り返しで表示されます。
  408.   
  409.    
  410.   ● スピード
  411.   
  412.   大きいほうが早い(0だとアニメは移動しません)
  413.   
  414.   1 = 1フレームで1ドット進むと考えてください。
  415.   
  416.   ● 往復するか?
  417.   
  418.   true とした場合、ブーメランのようにアニメが戻ります。
  419.   
  420.   ● 直線(false)or曲線(true)
  421.   
  422.   true  = 対象に向かって曲線で、アニメが飛びます。(修正の余地ありですが・・・)
  423.   false = 対象に向かって直線で、アニメが飛びます。
  424.    
  425. =end
  426. module RPG
  427.   class Weapon
  428.     #--------------------------------------------------------------------------
  429.     # ● 遠距離アニメーション
  430.     #--------------------------------------------------------------------------
  431.     def flying_anime
  432.       # ID 指定 の例(武器的id,分类是根据飞行武器的动画id)
  433.       case @id
  434.       when 34             #回旋武器(类似回力镖)的id
  435.         return [103,32,true,true]
  436.       when 17,18,19,20    #远程武器1(弓箭类)的id
  437.         return [101,32,false,false]
  438.       when 21,22,23,24    #远程武器2(铳类)的id
  439.         return [102,32,false,false]
  440.       end
  441.       return [0,0,false,false]
  442.     end
  443.   end
  444.   class Skill
  445.     #--------------------------------------------------------------------------
  446.     # ● 遠距離アニメーション
  447.     #--------------------------------------------------------------------------
  448.     def flying_anime
  449.       # ID 指定 の例(技能的id,分类是根据飞行武器的动画id)
  450.       case @id
  451.       when 82             #回旋技能(类似回力镖)的id
  452.         return [103,32,true,true]
  453.       when 73,74,75,76    #远程技能1(弓箭类)的id
  454.         return [101,32,false,false]
  455.       when 77,78,79,80    #远程技能2(铳类)的id
  456.         return [102,32,false,false]
  457.       end
  458.       return [0,0,false,false]
  459.     end
  460.   end
  461.   class Item
  462.     #--------------------------------------------------------------------------
  463.     # ● 遠距離アニメーション
  464.     #--------------------------------------------------------------------------
  465.     def flying_anime
  466.       case @id
  467.       when 34    #抛击类道具(如炸弹一类)的id
  468.         return [104,32,false,true]
  469.       end
  470.       return [0,0,false,false]
  471.     end
  472.   end
  473. end

  474. class Game_Enemy < Game_Battler
  475.   #--------------------------------------------------------------------------
  476.   # ● 遠距離アニメーション
  477.   #--------------------------------------------------------------------------
  478.   def flying_anime
  479.     return [0,0,false,false]
  480.   end
  481. end
  482. #==============================================================================
  483. # ■ Game_Battler
  484. #==============================================================================
  485. class Game_Battler
  486.   include Side_view
  487.   #--------------------------------------------------------------------------
  488.   # ● 追加・公開インスタンス変数
  489.   #--------------------------------------------------------------------------
  490.   attr_accessor :height                  # 画像の高さ
  491.   attr_accessor :real_x                  # X座標補正
  492.   attr_accessor :real_y                  # Y座標補正
  493.   attr_accessor :real_zoom               # 拡大率
  494.   attr_accessor :wait_count              # アニメーション 待ち時間
  495.   attr_accessor :wait_count2             # アニメーション 待ち時間2
  496.   attr_accessor :pattern                 # アニメーション カウント(キャラ)
  497.   attr_accessor :shake                   # シェイク開始フラッグ
  498.   attr_accessor :reverse                 # 左右反転フラッグ
  499.   attr_accessor :shadow                  # 残像フラッグ
  500.   attr_accessor :flash_flag              # 閃きフラッグ
  501.   attr_reader   :ox                      # X座標補正
  502.   attr_reader   :oy                      # Y座標補正
  503.   attr_reader   :flying_x                # 遠距離アニメX座標
  504.   attr_reader   :flying_y                # 遠距離アニメY座標
  505.   attr_reader   :flying_anime            # 遠距離アニメ
  506.   attr_reader   :animation1_on           # 行動アニメ開始フラッグ
  507.   attr_reader   :animation2_on           # 対象アニメ開始フラッグ
  508.   #--------------------------------------------------------------------------
  509.   # ● デフォルトのアニメーション待ち時間を取得
  510.   #--------------------------------------------------------------------------
  511.   def animation_duration=(animation_duration)
  512.     @_animation_duration = animation_duration
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # ● バトル開始時のセットアップ
  516.   #--------------------------------------------------------------------------
  517.   def start_battle
  518.     @height = 0
  519.     @real_x = 0
  520.     @real_y = 0
  521.     @real_zoom = 1.0
  522.     @battler_condition = ""
  523.     @action = nil
  524.     @battle_actions = []
  525.     @battler_action = false
  526.     @step = 0
  527.     @anime_on = false
  528.     @wait_count = 0
  529.     @wait_count2 = 0
  530.     @ox = 0
  531.     @oy = 0
  532.     @pattern = 0
  533.     @pattern_log = true
  534.     @pattern_freeze = false
  535.     @condition_freeze = false
  536.     @active = false
  537.     @move_distance = nil
  538.     @move_wait = 0
  539.     @move_coordinates = [0,0,0,0]
  540.     @flying_distance = nil
  541.     @flying_wait = 0
  542.     @flying_x = 0
  543.     @flying_y = 0
  544.     @flash_flag = {}
  545.     self.flying_clear
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● 移動中判定
  549.   #--------------------------------------------------------------------------
  550.   def moving?
  551.     # X座標補正または、Y座標補正が0でなければ、移動中
  552.     return (@ox != 0 or @oy != 0)
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 移動終了判定
  556.   #--------------------------------------------------------------------------
  557.   def move_end?
  558.     return (@ox == @move_coordinates[0] and @oy == @move_coordinates[1])
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # ● アクション開始設定
  562.   #--------------------------------------------------------------------------
  563.   def action(flag = true)
  564.     @battler_action = flag
  565.     @animation1_on = false
  566.     @animation2_on = false
  567.     @step = "setup"
  568.   end   
  569.   #--------------------------------------------------------------------------
  570.   # ● アクション中判定
  571.   #--------------------------------------------------------------------------
  572.   def action?
  573.     return @battler_action
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● 閃き判定
  577.   #--------------------------------------------------------------------------
  578.   def flash?
  579.     return @flash_flg
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ● 戦闘不能判定
  583.   #--------------------------------------------------------------------------
  584.   def anime_dead?
  585.     if $game_temp.in_battle and !RTAB
  586.       if [2,3,4,5].include?($scene.phase4_step)
  587.         return @last_dead
  588.       end
  589.     end
  590.     return @last_dead = self.dead?
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ● ピンチ状態判定
  594.   #--------------------------------------------------------------------------
  595.   def crisis?
  596.     if $game_temp.in_battle and !RTAB
  597.       if [2,3,4,5].include?($scene.phase4_step)
  598.         return @last_crisis
  599.       end
  600.     end
  601.     return @last_crisis = (self.hp <= self.maxhp / 4 or badstate?)
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● バッドステート判定
  605.   #--------------------------------------------------------------------------
  606.   def badstate?
  607.     for i in @states
  608.       unless $data_states[i].nonresistance
  609.         return true
  610.       end
  611.     end
  612.     return false
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ● 飛行
  616.   #--------------------------------------------------------------------------
  617.   def fly
  618.     if @fly != nil
  619.       return @fly
  620.     end
  621.     for id in @states
  622.       if FLY_STATES.include?($data_states[id].name)
  623.         return 60
  624.       end
  625.     end
  626.     return 0
  627.   end
  628.   #--------------------------------------------------------------------------
  629.   # ● 遠距離アニメ目標座標の計算
  630.   #--------------------------------------------------------------------------
  631.   def flying_setup
  632.     # 二度目は実行しない
  633.     return if @flying_distance != nil && !camera_correctness
  634.     if RTAB
  635.       targets = @target
  636.     else
  637.       targets = $scene.target_battlers
  638.     end
  639.     # 目的座標を計算
  640.     @f_target_x = 0
  641.     @f_target_y = 0
  642.     for t in targets
  643.       @f_target_x += t.screen_x
  644.       @f_target_y += t.screen_y
  645.     end
  646.     if targets != []
  647.       @f_target_x /= targets.size
  648.       @f_target_y /= targets.size
  649.     else
  650.       @flying_distance = 0
  651.       return
  652.     end
  653.     # 距離の計算
  654.     @flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 遠距離アニメ
  658.   #--------------------------------------------------------------------------
  659.   def flying_animation
  660.     # 戻る
  661.     if @step != "flying" or @flying_distance.nil?
  662.       return [false,true]
  663.     end
  664.     # あらかじめ計算
  665.     self_x = self.screen_x
  666.     self_y = self.screen_y
  667.     @flying_distance = @flying_distance == 0 ? 1 : @flying_distance
  668.     n1 = @flying_wait / @flying_distance.to_f
  669.     if @flying_distance - @flying_wait > @flying_distance / 2
  670.       n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
  671.     else
  672.       n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
  673.     end
  674.     if !@flying_anime[4]
  675.       # 直線移動
  676.       x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  677.       y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
  678.     else
  679.       # 曲線移動
  680.       if !@flying_proceed_end
  681.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  682.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
  683.       else
  684.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  685.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
  686.       end
  687.     end
  688.     # 座標代入
  689.     @flying_x = x
  690.     @flying_y = y
  691.     # ウエイト
  692.     if !@flying_proceed_end
  693.       # 開始
  694.       @flying_proceed_start = @flying_wait == 0
  695.       @flying_wait += @flying_anime[1]
  696.       @flying_wait = [@flying_wait,@flying_distance].min
  697.       @flying_proceed_end = @flying_wait == @flying_distance
  698.     else
  699.       # 開始
  700.       @flying_return_start = @flying_wait == @flying_distance
  701.       @flying_wait -= @flying_anime[1]
  702.       @flying_wait = [@flying_wait,0].max
  703.       @flying_return_end = @flying_wait == 0
  704.     end
  705.     if @flying_anime[1] == 0
  706.       @flying_end = true
  707.     elsif !@flying_anime[2]
  708.       @flying_end = @flying_proceed_end
  709.     else
  710.       @flying_end = @flying_return_end
  711.     end
  712.     # 値を返す(アニメ開始,アニメ終了)
  713.     return [@flying_proceed_start,@flying_end]
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # ● 遠距離アニメ初期化
  717.   #--------------------------------------------------------------------------
  718.   def flying_clear
  719.     @flying_proceed_start = false
  720.     @flying_proceed_end = false
  721.     @flying_return_start = false
  722.     @flying_return_end = false
  723.     @flying_end = false
  724.     @flying_anime = [0,0,false]
  725.   end
  726.   #--------------------------------------------------------------------------
  727.   # ● 移動
  728.   #--------------------------------------------------------------------------
  729.   def move
  730.     # 距離の計算
  731.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  732.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  733.     if @move_distance > 0
  734.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  735.       array = @move_coordinates
  736.       # ジャンプ補正値の計算
  737.       if @move_distance - @move_wait > @move_distance / 2
  738.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  739.       else
  740.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  741.       end
  742.       jump = @move_action[4] > 0 ? -jump : jump
  743.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  744.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  745.       # ウエイト
  746.       @move_wait -= @move_action[3]
  747.       @move_wait = [@move_wait,0].max
  748.     end
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # ● 移動アクションの取得
  752.   #--------------------------------------------------------------------------
  753.   def get_move_action
  754.     string = @action.split(/#/)[1]
  755.     string = string.split(/,/)
  756.     @move_action = [string[0],string[1].to_i,string[2].to_i,string[3].to_i,string[4].to_i,string[5].to_i]
  757.   end
  758.   #--------------------------------------------------------------------------
  759.   # ● アクションの取得
  760.   #--------------------------------------------------------------------------
  761.   def get_step
  762.     if @action.nil?
  763.       @step = "finish"
  764.       return
  765.     end
  766.     string = @action.split(/#/)[0]
  767.     if string =~ "移動"
  768.       @step = "moving_setup"
  769.     elsif string =~ "アクターアニメ実行"
  770.       @step = "action"
  771.     elsif string =~ "遠距離アニメ"
  772.       @step = "flying"
  773.     elsif string =~ "アクターアニメ変更"
  774.       @step = "change"
  775.     elsif string =~ "行動アニメ"
  776.       @step = "animation1"
  777.     elsif string =~ "対象アニメ"
  778.       @step = "animation2"
  779.     elsif string =~ "ウエイト"
  780.       @step = "wait"
  781.     elsif string =~ "左右反転"
  782.       @step = "reverse"
  783.     elsif string =~ "閃きアニメ"
  784.       @step = "flash"
  785.     elsif string =~ "残像表示"
  786.       @step = "shadow_on"
  787.     elsif string =~ "残像消去"
  788.       @step = "shadow_off"
  789.     elsif string =~ "アクターアニメ固定"
  790.       @step = "freeze"
  791.     elsif string =~ "アニメ固定解除"
  792.       @step = "freeze_lifting"
  793.     elsif string =~ "アニメーションの表示"
  794.       @step = "animation_start"
  795.     elsif string =~ "SEの演奏"
  796.       @step = "play_se"
  797.     else
  798.       @step = "finish"
  799.     end
  800.   end
  801.   #--------------------------------------------------------------------------
  802.   # ● フレーム更新 (次のアクションへ)
  803.   #--------------------------------------------------------------------------
  804.   def update_next
  805.     @action = @battle_actions.shift
  806.     @step = get_step
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ● フレーム更新 (動作取得)
  810.   #--------------------------------------------------------------------------
  811.   def update_setup
  812.     # アクションの取得
  813.     self.get_actions
  814.     @action = @battle_actions.shift
  815.     @step = get_step
  816.   end
  817.   #--------------------------------------------------------------------------
  818.   # ● フレーム更新 (移動取得)
  819.   #--------------------------------------------------------------------------
  820.   def update_moving_setup
  821.     # 移動アクションの取得
  822.     self.get_move_action
  823.     # 移動目標の設定
  824.     self.move_setup
  825.     @step = "moving"
  826.   end
  827.   #--------------------------------------------------------------------------
  828.   # ● フレーム更新 (移動)
  829.   #--------------------------------------------------------------------------
  830.   def update_moving
  831.     # 移動
  832.     self.move
  833.     self.condition = @battler_condition
  834.     # 移動完了したら次のステップへ
  835.     if move_end?
  836.       @wait_count = 2
  837.       @action = @battle_actions.shift
  838.       @step = get_step
  839.     end
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # ● フレーム更新 (アニメ実行)
  843.   #--------------------------------------------------------------------------
  844.   def update_action
  845.     con = @action.split(/#/)[1]
  846.     # 右手・左手を分ける
  847.     if DUAL_WEAPONS_ANIME.include?(con)
  848.       if !@first_weapon and @second_weapon
  849.         con = con + "_L"
  850.       else
  851.         con = con + "_R"
  852.       end
  853.     end
  854.     # アニメ変更
  855.     self.condition = con
  856.     # ループか否か
  857.     if !ANIME[@battler_condition][1]
  858.       self.anime_on
  859.     end
  860.     @action = @battle_actions.shift
  861.     @step = get_step
  862.   end
  863.   #--------------------------------------------------------------------------
  864.   # ● フレーム更新 (遠距離アニメ)
  865.   #--------------------------------------------------------------------------
  866.   def update_flying
  867.     # 目標の設定
  868.     self.flying_setup
  869.     # 遠距離アニメ終了
  870.     if @flying_end
  871.       self.flying_clear
  872.       @action = @battle_actions.shift
  873.       @step = get_step
  874.     end
  875.   end
  876.   #--------------------------------------------------------------------------
  877.   # ● フレーム更新 (アニメ変更)
  878.   #--------------------------------------------------------------------------
  879.   def update_change
  880.     con = @action.split(/#/)[1]
  881.     # 右手・左手を分ける
  882.     if DUAL_WEAPONS_ANIME.include?(con)
  883.       if !@first_weapon and @second_weapon
  884.         con = con + "_L"
  885.       else
  886.         con = con + "_R"
  887.       end
  888.     end
  889.     # アニメ変更
  890.     self.condition = con
  891.     # ループか否か
  892.     if !ANIME[@battler_condition][1]
  893.       self.anime_on
  894.     end
  895.     @action = @battle_actions.shift
  896.     @step = get_step
  897.   end
  898.   #--------------------------------------------------------------------------
  899.   # ● フレーム更新 (行動アニメ)
  900.   #--------------------------------------------------------------------------
  901.   def update_animation1
  902.     @animation1_on = true
  903.     # 行動アニメの後に行動を開始する
  904.     if $scene.phase4_step == 3
  905.       id = RTAB ? @anime1 : $scene.animation1_id
  906.       animation = $data_animations[id]
  907.       frame_max = animation != nil ? animation.frame_max : 0
  908.       @wait_count2 = frame_max * 2
  909.       return
  910.     end
  911.     @action = @battle_actions.shift
  912.     @step = get_step
  913.   end
  914.   #--------------------------------------------------------------------------
  915.   # ● フレーム更新 (対象アニメ)
  916.   #--------------------------------------------------------------------------
  917.   def update_animation2
  918.     @animation2_on = true
  919.     # 行動アニメの後に行動を開始する
  920.     if $scene.phase4_step == 4
  921.       id = RTAB ? @anime2 : $scene.animation2_id
  922.       animation = $data_animations[id]
  923.       frame_max = animation != nil ? animation.frame_max : 0
  924.       @wait_count2 = frame_max * 2
  925.       return
  926.     end
  927.     @action = @battle_actions.shift
  928.     @step = get_step
  929.   end
  930.   #--------------------------------------------------------------------------
  931.   # ● フレーム更新 (ウエイト)
  932.   #--------------------------------------------------------------------------
  933.   def update_wait
  934.     @wait_count2 = @action.split(/#/)[1].to_i
  935.     @action = @battle_actions.shift
  936.     @step = get_step
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ● フレーム更新 (残像表示)
  940.   #--------------------------------------------------------------------------
  941.   def update_shadow_on
  942.     @shadow = true
  943.     @action = @battle_actions.shift
  944.     @step = get_step
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # ● フレーム更新 (残像消去)
  948.   #--------------------------------------------------------------------------
  949.   def update_shadow_off
  950.     @shadow = false
  951.     @action = @battle_actions.shift
  952.     @step = get_step
  953.   end
  954.   #--------------------------------------------------------------------------
  955.   # ● フレーム更新 (左右反転)
  956.   #--------------------------------------------------------------------------
  957.   def update_reverse
  958.     @reverse = @reverse ? false : true
  959.     @action = @battle_actions.shift
  960.     @step = get_step
  961.   end
  962.   #--------------------------------------------------------------------------
  963.   # ● フレーム更新 (閃きアニメ)
  964.   #--------------------------------------------------------------------------
  965.   def update_flash
  966.     # 閃きアニメの後に行動を開始する
  967.     if @flash_flag["normal"]
  968.       @wait_count = $scene.flash_duration
  969.       @flash_flag["normal"] = false
  970.       return
  971.     end
  972.     @action = @battle_actions.shift
  973.     @step = get_step
  974.   end
  975.   #--------------------------------------------------------------------------
  976.   # ● フレーム更新 (SEの演奏)
  977.   #--------------------------------------------------------------------------
  978.   def update_play_se
  979.     data = @action.split(/#/)[1]
  980.     data = data.split(/,/)
  981.     # SE を演奏
  982.     Audio.se_play("Audio/SE/" + data[0], data[1].to_i, data[2].to_i)
  983.     @action = @battle_actions.shift
  984.     @step = get_step
  985.   end
  986.   #--------------------------------------------------------------------------
  987.   # ● フレーム更新 (アクターアニメ固定)
  988.   #--------------------------------------------------------------------------
  989.   def update_freeze
  990.     con = @action.split(/#/)[1]
  991.     # 右手・左手を分ける
  992.     if DUAL_WEAPONS_ANIME.include?(con)
  993.       if !@first_weapon and @second_weapon
  994.         con = con + "_L"
  995.       else
  996.         con = con + "_R"
  997.       end
  998.     end
  999.     # アニメ変更
  1000.     self.condition = con
  1001.     @pattern = @action.split(/#/)[2].to_i
  1002.     @pattern_freeze = true
  1003.     @condition_freeze = true
  1004.     @action = @battle_actions.shift
  1005.     @step = get_step
  1006.   end
  1007.   #--------------------------------------------------------------------------
  1008.   # ● フレーム更新 (アクターアニメ固定解除)
  1009.   #--------------------------------------------------------------------------
  1010.   def update_freeze_lifting
  1011.     @pattern_freeze = false
  1012.     @condition_freeze = false
  1013.     @action = @battle_actions.shift
  1014.     @step = get_step
  1015.   end
  1016.   #--------------------------------------------------------------------------
  1017.   # ● フレーム更新 (アニメーションの表示)
  1018.   #--------------------------------------------------------------------------
  1019.   def update_animation_start
  1020.     data = @action.split(/#/)[1]
  1021.     data = data.split(/,/)
  1022.     target = data[0]
  1023.     animation_id = data[1].to_i
  1024.     if RTAB
  1025.       case target
  1026.       when "self"
  1027.         @animation.push([animation_id,true])
  1028.       when "target"
  1029.         for tar in @target
  1030.           tar.animation.push([animation_id, true])
  1031.         end
  1032.       end
  1033.     else
  1034.       case target
  1035.       when "self"
  1036.         @animation_id = animation_id
  1037.         @animation_hit = true
  1038.       when "target"
  1039.         for tar in $scene.target_battlers
  1040.           tar.animation_id = animation_id
  1041.           tar.animation_hit = true
  1042.         end
  1043.       end
  1044.     end
  1045.     @action = @battle_actions.shift
  1046.     @step = get_step
  1047.   end
  1048.   #--------------------------------------------------------------------------
  1049.   # ● フレーム更新 (動作終了)
  1050.   #--------------------------------------------------------------------------
  1051.   def update_finish
  1052.     # 動作終了
  1053.     @battler_action = false
  1054.     @step = "setup"
  1055.   end
  1056.   #--------------------------------------------------------------------------
  1057.   # ● バトラーの状態 変更(バトラーグラフィックのタイプ)
  1058.   #--------------------------------------------------------------------------
  1059.   def condition=(condition)
  1060.     return if @condition_freeze
  1061.     @battler_condition = condition
  1062.     @wait_count = ANIME[condition][2]
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # ● バトラーの状態(バトラーグラフィックのタイプ)
  1066.   #--------------------------------------------------------------------------
  1067.   def condition
  1068.     return @battler_condition
  1069.   end
  1070.   #--------------------------------------------------------------------------
  1071.   # ● フレーム更新
  1072.   #--------------------------------------------------------------------------
  1073.   def update
  1074.     # ウェイト中の場合
  1075.     if @wait_count > 0
  1076.       return
  1077.     end
  1078.     # パターン更新
  1079.     self.char_animation
  1080.     # ウェイト中の場合
  1081.     if @wait_count2 > 0
  1082.       return
  1083.     end
  1084.    
  1085.     # 行動アニメーション
  1086.     if @battler_action
  1087.       method("update_" + @step).call
  1088.       return
  1089.     end
  1090.    
  1091.     # データ初期化
  1092.     @animation1_on = false
  1093.     @animation2_on = false
  1094.     @action = nil
  1095.     @battle_actions = []
  1096.     @move_wait = 0
  1097.     @move_distance = nil
  1098.     @flying_wait = 0
  1099.     @flying_distance = nil
  1100.     @flash = false

  1101.     # RTAB対応
  1102.     # 通常・待機
  1103.     return self.condition = NORMAL
  1104.   end
  1105.   #--------------------------------------------------------------------------
  1106.   # ● アクションの取得
  1107.   #--------------------------------------------------------------------------
  1108.   def get_actions
  1109.     skill = $data_skills[self.current_action.skill_id]
  1110.     item = $data_items[self.current_action.item_id]
  1111.     kind = self.current_action.kind
  1112.     # 動作取得
  1113.     @battle_actions = []
  1114.     # スキル
  1115.     if skill != nil && kind == 1
  1116.       @battle_actions = skill.battle_actions.dup
  1117.       @flying_anime = skill.flying_anime
  1118.     # アイテム
  1119.     elsif item != nil && kind == 2
  1120.       @battle_actions = item.battle_actions.dup
  1121.       @flying_anime = item.flying_anime
  1122.     # 左手攻撃
  1123.     elsif !@first_weapon and @second_weapon and self.is_a?(Game_Actor)
  1124.       @battle_actions = self.battle_actions2.dup
  1125.       @flying_anime = self.flying_anime2
  1126.     # 右手攻撃
  1127.     elsif self.current_action.basic == 0 and
  1128.       self.is_a?(Game_Actor) and self.current_action.kind == 0
  1129.       @battle_actions = self.battle_actions1.dup
  1130.       @flying_anime = self.flying_anime1
  1131.     # 通常攻撃
  1132.     elsif self.current_action.basic == 0 and self.current_action.kind == 0
  1133.       @battle_actions = self.battle_actions.dup
  1134.       @flying_anime = self.flying_anime
  1135.     else
  1136.       @battle_actions = ["終了"]
  1137.       @flying_anime = [0,0,false,false]
  1138.     end
  1139.   end
  1140.   #--------------------------------------------------------------------------
  1141.   # ● ループしないアニメのセット
  1142.   #--------------------------------------------------------------------------
  1143.   def anime_on
  1144.     @pattern = 0
  1145.     @pattern_log = true
  1146.     return
  1147.   end
  1148.   #--------------------------------------------------------------------------
  1149.   # ● パターン更新
  1150.   #--------------------------------------------------------------------------
  1151.   def char_animation
  1152.     # パタン固定の場合もどる
  1153.     return if @pattern_freeze
  1154.     # ループしないアニメの場合 1234 で止まる
  1155.     if !ANIME[@battler_condition][1] && @pattern == 3
  1156.       return
  1157.     end
  1158.     # アニメさせない場合 1 で止まる
  1159.     if ANIME[@battler_condition][4]
  1160.       @pattern = 0
  1161.       return
  1162.     end
  1163.     @pattern = (@pattern + 1) % 4
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # ● アニメタイプ
  1167.   #--------------------------------------------------------------------------
  1168.   def anime_type
  1169.     return ANIME[self.condition] != nil ? ANIME[self.condition][0] : 0
  1170.   end
  1171. end
  1172. #==============================================================================
  1173. # ■ Game_Actor
  1174. #==============================================================================
  1175. class Game_Actor < Game_Battler
  1176.   include Side_view
  1177.   #--------------------------------------------------------------------------
  1178.   # ● セットアップ
  1179.   #--------------------------------------------------------------------------
  1180.   alias side_view_setup setup
  1181.   def setup(actor_id)
  1182.     side_view_setup(actor_id)
  1183.     start_battle
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # ● 二刀武器のID取得 ※エラー回避用
  1187.   #--------------------------------------------------------------------------
  1188.   def weapon2_id
  1189.     return @weapon2_id != nil ? @weapon2_id : 0
  1190.   end
  1191.   #--------------------------------------------------------------------------
  1192.   # ● X方向 ポジション 取得 (陣形スクリプト拡張用)
  1193.   #--------------------------------------------------------------------------
  1194.   def position
  1195.     return $data_classes[@class_id].position
  1196.   end
  1197.   #--------------------------------------------------------------------------
  1198.   # ● Y方向 ポジション 取得 (陣形スクリプト拡張用)
  1199.   #--------------------------------------------------------------------------
  1200.   def position2
  1201.     return self.index
  1202.   end
  1203.   #--------------------------------------------------------------------------
  1204.   # ● 武器アニメタイプ
  1205.   #--------------------------------------------------------------------------
  1206.   def weapon_anime_type(type)
  1207.     file_name  = weapon_anime_type0(type)
  1208.     visible   = weapon_anime_type1(type)
  1209.     z         = weapon_anime_type2(type)
  1210.     return [file_name,visible,z]
  1211.   end
  1212.   # 武器アイコン取得
  1213.   def weapon_anime_type0(type)
  1214.     type = ANIME[type][5]
  1215.     return weapon_anime1 if type == "右手"
  1216.     return weapon_anime2 if type == "左手"
  1217.     return nil
  1218.   end
  1219.   # 表示・非表示の取得
  1220.   def weapon_anime_type1(type)
  1221.     return ANIME[type][3]
  1222.   end
  1223.   # バトラーより上に表示するかどうか
  1224.   def weapon_anime_type2(type)
  1225.     type = ANIME[type][5]
  1226.     return true if type == "左手"
  1227.     return false
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1231.   #--------------------------------------------------------------------------
  1232.   def true_x
  1233.     return PARTY_X + position * FORMATION_X + @ox
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1237.   #--------------------------------------------------------------------------
  1238.   def true_y
  1239.     # パーティ内の並び順から Y 座標を計算して返す
  1240.     if self.index != nil
  1241.       y = position2 * FORMATION_Y + PARTY_Y + @oy - @height / 2
  1242.       return y
  1243.     else
  1244.       return 0
  1245.     end
  1246.   end
  1247.   #--------------------------------------------------------------------------
  1248.   # ● バトル画面 X 座標の取得
  1249.   #--------------------------------------------------------------------------
  1250.   def screen_x(true_x = self.true_x)
  1251.     return 320 + (true_x - 320) * @real_zoom + @real_x
  1252.   end
  1253.   #--------------------------------------------------------------------------
  1254.   # ● バトル画面 Y 座標の取得
  1255.   #--------------------------------------------------------------------------
  1256.   def screen_y(true_y = self.true_y)
  1257.     return true_y * @real_zoom + @real_y
  1258.   end
  1259.   #--------------------------------------------------------------------------
  1260.   # ● バトル画面 Z 座標の取得
  1261.   #--------------------------------------------------------------------------
  1262.   def screen_z
  1263.     return screen_y + 1000
  1264.   end
  1265.   #--------------------------------------------------------------------------
  1266.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1267.   #--------------------------------------------------------------------------
  1268.   def base_x
  1269.     return 320 + (true_x - @ox - 320) * @real_zoom + @real_x
  1270.   end
  1271.   #--------------------------------------------------------------------------
  1272.   # ● バトル画面 Y 座標の取得
  1273.   #--------------------------------------------------------------------------
  1274.   def base_y
  1275.     return (true_y - @oy) * @real_zoom + @real_y
  1276.   end
  1277.   #--------------------------------------------------------------------------
  1278.   # ● バトル画面 拡大率の取得
  1279.   #--------------------------------------------------------------------------
  1280.   def zoom
  1281.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  1282.                           (true_x + @fly) / 480 + $scene.zoom_rate[0]
  1283.   end
  1284.   #--------------------------------------------------------------------------
  1285.   # ● 攻撃用、バトル画面 X 座標の取得
  1286.   #--------------------------------------------------------------------------
  1287.   def attack_x(z)
  1288.     return (320 - true_x) * z * 0.75
  1289.   end
  1290.   #--------------------------------------------------------------------------
  1291.   # ● 攻撃用、バトル画面 Y 座標の取得
  1292.   #--------------------------------------------------------------------------
  1293.   def attack_y(z)
  1294.     return (160 - (true_y + fly / 4) * z + @height * zoom * z / 2) * 0.75
  1295.   end
  1296.   #--------------------------------------------------------------------------
  1297.   # ● 閃き待ち時間
  1298.   #--------------------------------------------------------------------------
  1299.   def flash_duration
  1300.     return $scene.flash_duration
  1301.   end
  1302.   #--------------------------------------------------------------------------
  1303.   # ● アニメーション取得
  1304.   #--------------------------------------------------------------------------
  1305.   def battle_actions1
  1306.     weapon = $data_weapons[@weapon_id]
  1307.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1308.   end
  1309.   #--------------------------------------------------------------------------
  1310.   # ● アニメーション取得
  1311.   #--------------------------------------------------------------------------
  1312.   def battle_actions2
  1313.     weapon = $data_weapons[@weapon2_id]
  1314.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1315.   end
  1316.   #--------------------------------------------------------------------------
  1317.   # ● 武器アニメーション取得
  1318.   #--------------------------------------------------------------------------
  1319.   def weapon_anime1
  1320.     weapon = $data_weapons[@weapon_id]
  1321.     return weapon != nil ? weapon.icon_name : ""
  1322.   end
  1323.   #--------------------------------------------------------------------------
  1324.   # ● 武器アニメーション取得
  1325.   #--------------------------------------------------------------------------
  1326.   def weapon_anime2
  1327.     weapon = $data_weapons[@weapon2_id]
  1328.     return weapon != nil ? weapon.icon_name : ""
  1329.   end
  1330.   #--------------------------------------------------------------------------
  1331.   # ● 遠距離アニメーション取得
  1332.   #--------------------------------------------------------------------------
  1333.   def flying_anime1
  1334.     weapon = $data_weapons[@weapon_id]
  1335.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1336.   end
  1337.   #--------------------------------------------------------------------------
  1338.   # ● 遠距離アニメーション取得
  1339.   #--------------------------------------------------------------------------
  1340.   def flying_anime2
  1341.     weapon = $data_weapons[@weapon2_id]
  1342.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1343.   end
  1344.   #--------------------------------------------------------------------------
  1345.   # ● 移動目標座標の計算
  1346.   #--------------------------------------------------------------------------
  1347.   def move_setup
  1348.     if RTAB
  1349.       targets = @target
  1350.     else
  1351.       targets = $scene.target_battlers
  1352.     end
  1353.     case @move_action[0]
  1354.     when "self" # 自分
  1355.       @target_x = self.base_x
  1356.       @target_y = self.base_y
  1357.     when "target_near" # 一番近くのターゲット
  1358.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1359.       targets.reverse!
  1360.       if targets != []
  1361.         @target_x = targets[0].screen_x
  1362.         @target_y = targets[0].screen_y
  1363.       else
  1364.         @target_x = self.base_x
  1365.         @target_y = self.base_y
  1366.       end
  1367.     when "target_far" # 一番遠くのターゲット
  1368.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1369.       if targets != []
  1370.         @target_x = targets[0].screen_x
  1371.         @target_y = targets[0].screen_y
  1372.       else
  1373.         @target_x = self.base_x
  1374.         @target_y = self.base_y
  1375.       end
  1376.     when "target" # ターゲット中央
  1377.       @target_x = 0
  1378.       @target_y = 0
  1379.       for t in targets
  1380.         @target_x += t.screen_x
  1381.         @target_y += t.screen_y
  1382.       end
  1383.       if targets != []
  1384.         @target_x /= targets.size
  1385.         @target_y /= targets.size
  1386.       end
  1387.     when "troop" # "トループ中央"
  1388.       @target_x = 0
  1389.       @target_y = 0
  1390.       for t in $game_troop.enemies
  1391.         @target_x += t.screen_x
  1392.         @target_y += t.screen_y
  1393.       end
  1394.       if $game_troop.enemies != []
  1395.         @target_x /= $game_troop.enemies.size
  1396.         @target_y /= $game_troop.enemies.size
  1397.       end
  1398.     when "party" # "パーティ中央"
  1399.       @target_x = 0
  1400.       @target_y = 0
  1401.       for t in $game_party.actors
  1402.         @target_x += t.screen_x
  1403.         @target_y += t.screen_y
  1404.       end
  1405.       if $game_party.actors != []
  1406.         @target_x /= $game_party.actors.size
  1407.         @target_y /= $game_party.actors.size
  1408.       end
  1409.     when "screen" # "画面"
  1410.       @target_x = self.base_x
  1411.       @target_y = self.base_y
  1412.     end
  1413.     # 補正
  1414.     @target_x += @move_action[1] - self.base_x
  1415.     @target_y += @move_action[2] - self.base_y
  1416.     # 移動目標の座標をセット
  1417.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1418.     # 距離の計算(ウエイトの設定)
  1419.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1420.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1421.   end
  1422. end
  1423. #==============================================================================
  1424. # ■ Game_Enemy
  1425. #==============================================================================
  1426. class Game_Enemy < Game_Battler
  1427.   #--------------------------------------------------------------------------
  1428.   # ● セットアップ
  1429.   #--------------------------------------------------------------------------
  1430.   alias side_view_initialize initialize
  1431.   def initialize(troop_id, member_index)
  1432.     side_view_initialize(troop_id, member_index)
  1433.     start_battle
  1434.   end
  1435.   #--------------------------------------------------------------------------
  1436.   # ● 移動
  1437.   #--------------------------------------------------------------------------
  1438.   def move
  1439.     # 距離の計算
  1440.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1441.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1442.     if @move_distance > 0
  1443.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  1444.       array = @move_coordinates
  1445.       # ジャンプ補正値の計算
  1446.       if @move_distance - @move_wait > @move_distance / 2
  1447.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  1448.       else
  1449.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  1450.       end
  1451.       jump = @move_action[4] > 0 ? -jump : jump
  1452.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  1453.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  1454.       # ウエイト
  1455.       @move_wait -= @move_action[3]
  1456.       @move_wait = [@move_wait,0].max
  1457.     end
  1458.   end
  1459.   #--------------------------------------------------------------------------
  1460.   # ● 移動目標座標の計算
  1461.   #--------------------------------------------------------------------------
  1462.   def move_setup
  1463.     if RTAB
  1464.       targets = @target
  1465.     else
  1466.       targets = $scene.target_battlers
  1467.     end
  1468.     case @move_action[0]
  1469.     when "self" # 自分
  1470.       @target_x = self.base_x
  1471.       @target_y = self.base_y
  1472.     when "target_near" # 一番近くのターゲット
  1473.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1474.       if targets != []
  1475.         @target_x = targets[0].screen_x
  1476.         @target_y = targets[0].screen_y
  1477.       else
  1478.         @target_x = self.base_x
  1479.         @target_y = self.base_y
  1480.       end
  1481.     when "target_far" # 一番遠くのターゲット
  1482.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1483.       targets.reverse!
  1484.       if targets != []
  1485.         @target_x = targets[0].screen_x
  1486.         @target_y = targets[0].screen_y
  1487.       else
  1488.         @target_x = self.base_x
  1489.         @target_y = self.base_y
  1490.       end
  1491.     when "target" # ターゲット中央
  1492.       @target_x = 0
  1493.       @target_y = 0
  1494.       for t in targets
  1495.         @target_x += t.screen_x
  1496.         @target_y += t.screen_y
  1497.       end
  1498.       if targets != []
  1499.         @target_x /= targets.size
  1500.         @target_y /= targets.size
  1501.       end
  1502.     when  "party" # "トループ中央"
  1503.       @target_x = 0
  1504.       @target_y = 0
  1505.       for t in $game_troop.enemies
  1506.         @target_x += t.screen_x
  1507.         @target_y += t.screen_y
  1508.       end
  1509.       if $game_troop.enemies != []
  1510.         @target_x /= $game_troop.enemies.size
  1511.         @target_y /= $game_troop.enemies.size
  1512.       end
  1513.     when "troop" # "パーティ中央"
  1514.       @target_x = 0
  1515.       @target_y = 0
  1516.       for t in $game_party.actors
  1517.         @target_x += t.screen_x
  1518.         @target_y += t.screen_y
  1519.       end
  1520.       if $game_party.actors != []
  1521.         @target_x /= $game_party.actors.size
  1522.         @target_y /= $game_party.actors.size
  1523.       end
  1524.     when "screen" # "画面"
  1525.       @target_x = self.base_x
  1526.       @target_y = self.base_y
  1527.     end
  1528.     # 補正
  1529.     @target_x -= @move_action[1] + self.base_x
  1530.     @target_y -= @move_action[2] + self.base_y
  1531.     # 移動目標の座標をセット
  1532.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1533.     # 距離の計算(ウエイトの設定)
  1534.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1535.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1536.   end
  1537.   if RTAB
  1538.   alias original_x true_x
  1539.   alias original_y true_y
  1540.   else
  1541.   alias original_x screen_x
  1542.   alias original_y screen_y
  1543.   end
  1544.   #--------------------------------------------------------------------------
  1545.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1546.   #--------------------------------------------------------------------------
  1547.   def true_x
  1548.     return original_x + @ox
  1549.   end
  1550.   #--------------------------------------------------------------------------
  1551.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1552.   #--------------------------------------------------------------------------
  1553.   def true_y
  1554.     return original_y - @height / 2 + @oy
  1555.   end
  1556.   #--------------------------------------------------------------------------
  1557.   # ● バトル画面 X 座標の取得
  1558.   #--------------------------------------------------------------------------
  1559.   def screen_x(true_x = self.true_x)
  1560.     return true_x * @real_zoom + @real_x
  1561.   end
  1562.   #--------------------------------------------------------------------------
  1563.   # ● バトル画面 Y 座標の取得
  1564.   #--------------------------------------------------------------------------
  1565.   def screen_y(true_y = self.true_y)
  1566.     return true_y * @real_zoom + @real_y
  1567.   end
  1568.   #--------------------------------------------------------------------------
  1569.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1570.   #--------------------------------------------------------------------------
  1571.   def base_x(true_x = self.true_x)
  1572.     return (true_x - @ox) * @real_zoom + @real_x
  1573.   end
  1574.   #--------------------------------------------------------------------------
  1575.   # ● バトル画面 Y 座標の取得(移動などしていない場合)
  1576.   #--------------------------------------------------------------------------
  1577.   def base_y(true_y = self.true_y)
  1578.     return (true_y - @oy) * @real_zoom + @real_y
  1579.   end
  1580. end
  1581. #==============================================================================
  1582. # ■ Game_Party
  1583. #==============================================================================
  1584. class Game_Party
  1585.   #--------------------------------------------------------------------------
  1586.   # ● アクターを加える
  1587.   #     actor_id : アクター ID
  1588.   #--------------------------------------------------------------------------
  1589.   alias side_view_add_actor add_actor
  1590.   def add_actor(actor_id)
  1591.     # アクターを取得
  1592.     actor = $game_actors[actor_id]
  1593.     # サイドビューデータの初期化
  1594.     actor.start_battle
  1595.     # 戻す
  1596.     side_view_add_actor(actor_id)
  1597.   end
  1598. end
  1599. #==============================================================================
  1600. # ■ Scene_Battle
  1601. #==============================================================================
  1602. class Scene_Battle
  1603.   include Side_view
  1604.   #--------------------------------------------------------------------------
  1605.   # ● 公開インスタンス変数
  1606.   #--------------------------------------------------------------------------
  1607.   attr_reader   :phase            # フェーズ
  1608.   attr_reader   :phase4_step      # フェーズ4ステップ
  1609.   attr_reader   :active_battler   # 対象の配列
  1610.   attr_reader   :target_battlers  # 対象の配列
  1611.   attr_reader   :animation1_id    # 行動アニメID
  1612.   attr_reader   :animation2_id    # 対象アニメID
  1613.   #--------------------------------------------------------------------------
  1614.   # ● メイン処理
  1615.   #--------------------------------------------------------------------------
  1616.   alias side_view_main main
  1617.   def main
  1618.     # バトラー初期化
  1619.     for battler in $game_party.actors + $game_troop.enemies
  1620.       battler.start_battle
  1621.     end
  1622.     # 戻す
  1623.     side_view_main
  1624.   end
  1625.   #--------------------------------------------------------------------------
  1626.   # ● 閃き判定
  1627.   #--------------------------------------------------------------------------
  1628.   def flash?
  1629.     return @flash_flag ? true : false
  1630.   end  
  1631.   #--------------------------------------------------------------------------
  1632.   # ● 閃きアニメ待ち時間取得
  1633.   #--------------------------------------------------------------------------
  1634.   def flash_duration
  1635.     animation = nil
  1636.     if FLASH_ANIME
  1637.       animation = $data_animations[FLASH_ANIMATION_ID]
  1638.     end
  1639.     return animation != nil ? animation.frame_max * 2 + 2 : 0
  1640.   end
  1641.   #--------------------------------------------------------------------------
  1642.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1643.   #--------------------------------------------------------------------------
  1644.   alias side_view_update_phase4_step2 update_phase4_step2
  1645.   def update_phase4_step2(*arg)
  1646.     battler = convert_battler2(*arg)
  1647.     battler.action
  1648.     side_view_update_phase4_step2(*arg)
  1649.   end
  1650.   #--------------------------------------------------------------------------
  1651.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  1652.   #--------------------------------------------------------------------------
  1653.   alias side_view_update_phase4_step3 update_phase4_step3
  1654.   def update_phase4_step3(*arg)
  1655.     battler = convert_battler2(*arg)
  1656.     return if !battler.animation1_on and battler.action? and !battler.flash?
  1657.     if battler.flash? and FLASH_ANIME
  1658.       battler.flash_flag["normal"] = true
  1659.     end
  1660.     side_view_update_phase4_step3(*arg)
  1661.   end
  1662.   #--------------------------------------------------------------------------
  1663.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  1664.   #--------------------------------------------------------------------------
  1665.   alias side_view_update_phase4_step4 update_phase4_step4
  1666.   def update_phase4_step4(*arg)
  1667.     battler = convert_battler2(*arg)
  1668.     targets = RTAB ? battler.target : @target_battlers
  1669.     return if !battler.animation2_on and battler.action?
  1670.     side_view_update_phase4_step4(*arg)
  1671.     for target in targets
  1672.       if RTAB
  1673.         value = nil
  1674.         if target.damage_sp.include?(battler)
  1675.           value = target.damage_sp[battler]
  1676.         end
  1677.         if target.damage.include?(battler)
  1678.           if value == nil or value == "Miss"
  1679.             value = target.damage[battler]
  1680.           elsif value.is_a?(Numeric) && value > 0
  1681.             value = target.damage[battler] == "Miss" ? value : target.damage[battler]
  1682.           end
  1683.         end
  1684.       else
  1685.         value = target.damage
  1686.       end
  1687.       if target.is_a?(Game_Actor)
  1688.         # ダメージの場合
  1689.         if value.is_a?(Numeric) && value > 0
  1690.           # シェイクを開始
  1691.           target.shake = true
  1692.         end
  1693.       elsif target.is_a?(Game_Enemy)
  1694.         # ダメージの場合
  1695.         if value.is_a?(Numeric) && value > 0
  1696.           # シェイクを開始
  1697.           target.shake = true
  1698.         end
  1699.       end
  1700.     end
  1701.   end
  1702.   #--------------------------------------------------------------------------
  1703.   # ● プレバトルフェーズ開始
  1704.   #--------------------------------------------------------------------------
  1705.   alias start_phase1_correct start_phase1
  1706.   def start_phase1
  1707.     # カメラの設定
  1708.     # 元々フロントビュー向けの数値になっているため
  1709.     @zoom_rate = [1.0, 1.0]
  1710.     start_phase1_correct
  1711.   end
  1712.   #--------------------------------------------------------------------------
  1713.   # ● アクターコマンドフェーズ開始
  1714.   #--------------------------------------------------------------------------
  1715.   alias start_phase3_correct start_phase3
  1716.   def start_phase3
  1717.     battler = convert_battler
  1718.     start_phase3_correct
  1719.     if RTAB
  1720.       # カメラの設定
  1721.       # 元々フロントビュー向けの数値になっているため
  1722.       @camera = "command"
  1723.       @spriteset.screen_target(0, 0, 1.0)
  1724.     end
  1725.   end
  1726. end

  1727. class Spriteset_Battle
  1728.   include Side_view
  1729.   #--------------------------------------------------------------------------
  1730.   # ● オブジェクト初期化
  1731.   #--------------------------------------------------------------------------
  1732.   alias side_veiw_initialize initialize
  1733.   def initialize
  1734.     side_veiw_initialize
  1735.     # アクタースプライトを解放
  1736.     for sprite in @actor_sprites
  1737.       sprite.dispose
  1738.     end
  1739.     # アクタースプライトを作成
  1740.     @actor_sprites = []
  1741.     for i in 1..Party_max
  1742.       @actor_sprites.push(Sprite_Battler.new(@viewport1))
  1743.     end
  1744.     update
  1745.   end
  1746.   #--------------------------------------------------------------------------
  1747.   # ● 画面のスクロール
  1748.   #--------------------------------------------------------------------------
  1749.   if method_defined?("screen_scroll")
  1750.   alias side_view_screen_scroll screen_scroll
  1751.   def screen_scroll
  1752.     side_view_screen_scroll
  1753.     # アクターの位置補正
  1754.     for actor in $game_party.actors
  1755.       actor.real_x = @real_x
  1756.       actor.real_y = @real_y
  1757.       actor.real_zoom = @real_zoom
  1758.     end
  1759.   end
  1760.   end
  1761. end

  1762. class Sprite_Battler < RPG::Sprite
  1763.   include Side_view
  1764.   #--------------------------------------------------------------------------
  1765.   # ● オブジェクト初期化
  1766.   #     viewport : ビューポート
  1767.   #     battler  : バトラー (Game_Battler)
  1768.   #--------------------------------------------------------------------------
  1769.   def initialize(viewport, battler = nil)
  1770.     super(viewport)
  1771.     @battler = battler
  1772.     @battler_visible = false
  1773.     @weapon = Sprite_Weapon.new(viewport, battler)
  1774.     @flying = Sprite_Flying.new(viewport, battler)
  1775.     @shadow = []
  1776.     @fly = 0
  1777.     @fly_direction = 1
  1778.     @rand = rand(10)
  1779.     self.effect_clear
  1780.   end
  1781.   #--------------------------------------------------------------------------
  1782.   # ● 解放
  1783.   #--------------------------------------------------------------------------
  1784.   alias side_view_dispose dispose
  1785.   def dispose
  1786.     side_view_dispose
  1787.     @weapon.dispose
  1788.     @flying.dispose
  1789.     if @_target_sprite != nil
  1790.       @_target_sprite.bitmap.dispose
  1791.       @_target_sprite.dispose
  1792.       @_target_sprite = nil
  1793.     end
  1794.   end
  1795.   #--------------------------------------------------------------------------
  1796.   # ● フレーム更新
  1797.   #--------------------------------------------------------------------------
  1798.   def update
  1799.     super
  1800.     # バトラーが nil の場合
  1801.     if @battler == nil
  1802.       self.bitmap = nil
  1803.       @weapon.bitmap = nil
  1804.       loop_animation(nil)
  1805.       return
  1806.     end
  1807.     # バトラー更新
  1808.     @battler.update
  1809.     # バトラーアニメのデータ取得
  1810.     @anime_type = @battler.anime_type
  1811.     # ファイル名か色相が現在のものと異なる場合
  1812.     if @battler.is_a?(Game_Actor)
  1813.       change = (@battler.character_name != @battler_name or @battler.character_hue != @battler_hue)
  1814.     elsif @battler.is_a?(Game_Enemy)
  1815.       change = (@battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue)
  1816.     else
  1817.       return
  1818.     end
  1819.     if change
  1820.       # ビットマップを取得、設定
  1821.       if @battler.is_a?(Game_Actor)
  1822.         @battler_name = @battler.character_name
  1823.         @battler_hue = @battler.character_hue
  1824.         self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
  1825.         @width = bitmap.width / 4
  1826.         @height = bitmap.height / 4
  1827.       else
  1828.         @battler_name = @battler.battler_name
  1829.         @battler_hue = @battler.battler_hue
  1830.         self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1831.         @width = bitmap.width
  1832.         @height = bitmap.height
  1833.       end
  1834.       self.ox = @width / 2
  1835.       self.oy = @height / 2
  1836.       @battler.height = @height
  1837.       @flag = true
  1838.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  1839.       if @battler.dead? or @battler.hidden
  1840.         self.opacity = 0
  1841.       end
  1842.     end
  1843.     if @battler.is_a?(Game_Actor) and
  1844.       (@battler.anime_type != @anime_type or @battler.pattern != @pattern or @flag)
  1845.       # ビットマップを取得、設定
  1846.       @pattern = @battler.pattern
  1847.       self.ox = @width / 2
  1848.       self.oy = @height / 2
  1849.       @sx = @pattern * @width
  1850.       @sy = @anime_type % 4 * @height
  1851.       self.src_rect.set(@sx, @sy, @width, @height)
  1852.       self.zoom_x = CHAR_ZOOM
  1853.       self.zoom_y = CHAR_ZOOM
  1854.       @battler.height = @height
  1855.       @flag = false
  1856.     end
  1857.     # 飛行
  1858.     update_fly
  1859.     # シェイク
  1860.     update_shake
  1861.     # 回転
  1862.     update_turning
  1863.     # 反転
  1864.     update_reverse   
  1865.     # 移動
  1866.     update_moving
  1867.     # 追加アニメ
  1868.     update_add_anime
  1869.     # エフェクト効果の適用
  1870.     update_effect
  1871.     # アニメーション ID が現在のものと異なる場合
  1872.     flag = RTAB ? true : @battler.damage == nil
  1873.     if flag and @battler.state_animation_id != @state_animation_id
  1874.       @state_animation_id = @battler.state_animation_id
  1875.       loop_animation($data_animations[@state_animation_id])
  1876.     end
  1877.     # シェイク
  1878.     if @battler.shake
  1879.       self.start_shake(5, 5, 5)
  1880.       @battler.shake = false
  1881.     end
  1882.     # 明滅
  1883.     if @battler.blink
  1884.       blink_on
  1885.     else
  1886.       blink_off
  1887.     end
  1888.     # 不可視の場合
  1889.     unless @battler_visible
  1890.       flag = RTAB ? (@battler.damage.size < 2 or @battler.damage_pop.size < 2) :
  1891.                     (@battler.damage == nil or @battler.damage_pop)
  1892.       # 出現
  1893.       if not @battler.hidden and not @battler.dead? and flag
  1894.         appear
  1895.         @battler_visible = true
  1896.       end
  1897.     end
  1898.     if RTAB
  1899.     # ダメージ
  1900.     for battler in @battler.damage_pop
  1901.       if battler[0].class == Array
  1902.         if battler[0][1] >= 0
  1903.           $scene.skill_se
  1904.         else
  1905.           $scene.levelup_se
  1906.         end
  1907.         damage(@battler.damage[battler[0]], false, 2)
  1908.       else
  1909.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  1910.       end
  1911.       if @battler.damage_sp.include?(battler[0])
  1912.         damage(@battler.damage_sp[battler[0]],
  1913.                 @battler.critical[battler[0]], 1)
  1914.         @battler.damage_sp.delete(battler[0])
  1915.       end
  1916.       @battler.damage_pop.delete(battler[0])
  1917.       @battler.damage.delete(battler[0])
  1918.       @battler.critical.delete(battler[0])
  1919.     end
  1920.     end
  1921.     # 可視の場合
  1922.     if @battler_visible
  1923.       # 武器アニメ
  1924.       @weapon.battler = @battler
  1925.       @weapon.update
  1926.       # 遠距離アニメ
  1927.       @flying.battler = @battler
  1928.       @flying.update
  1929.       # 逃走
  1930.       if @battler.hidden
  1931.         $game_system.se_play($data_system.escape_se)
  1932.         escape
  1933.         @battler_visible = false
  1934.       end
  1935.       # 白フラッシュ
  1936.       if @battler.white_flash
  1937.         whiten
  1938.         @battler.white_flash = false
  1939.       end
  1940.       if RTAB
  1941.       # アニメーション
  1942.       if !@battler.animation.empty?
  1943.         for animation in @battler.animation.reverse
  1944.           if animation[2]
  1945.             animation($data_animations[animation[0]], animation[1], true)
  1946.           else
  1947.             animation($data_animations[animation[0]], animation[1])
  1948.           end
  1949.           @battler.animation.delete(animation)
  1950.         end
  1951.       end
  1952.       else
  1953.       # アニメーション
  1954.       if @battler.animation_id != 0
  1955.         animation = $data_animations[@battler.animation_id]
  1956.         animation(animation, @battler.animation_hit)
  1957.         @battler.animation_id = 0
  1958.       end
  1959.       end
  1960.       # ダメージ
  1961.       if !RTAB and @battler.damage_pop
  1962.         damage(@battler.damage, @battler.critical)
  1963.         @battler.damage = nil
  1964.         @battler.critical = false
  1965.         @battler.damage_pop = false
  1966.       end
  1967.       flag = RTAB ? (@battler.damage.empty? and $scene.dead_ok?(@battler)) :
  1968.                      @battler.damage == nil
  1969.       # コラプス
  1970.       if flag and @battler.dead?
  1971.         if @battler.is_a?(Game_Actor)
  1972.           $game_system.se_play($data_system.actor_collapse_se)
  1973.         elsif @battler.is_a?(Game_Enemy)
  1974.           $game_system.se_play($data_system.enemy_collapse_se)
  1975.         end
  1976.         collapse
  1977.         @battler_visible = false
  1978.       end
  1979.     end
  1980.     # スプライトの座標を設定
  1981.     self.x = @battler.screen_x + @effect_ox
  1982.     self.y = @battler.screen_y + @effect_oy
  1983.     self.z = @battler.screen_z
  1984.     self.zoom_x = @battler.real_zoom
  1985.     self.zoom_y = @battler.real_zoom
  1986.     # ウェイトカウントを減らす
  1987.     @battler.wait_count -= 1
  1988.     @battler.wait_count2 -= 1
  1989.     # アニメーション待ち時間取得
  1990.     @battler.animation_duration = @_animation_duration
  1991.     if @battler.is_a?(Game_Actor)
  1992.       self.zoom_x *= CHAR_ZOOM
  1993.       self.zoom_y *= CHAR_ZOOM
  1994.       @weapon.x = self.x + 2
  1995.       @weapon.y = self.y + 6
  1996.       @weapon.angle = 75 - (4 - @battler.pattern) * 45
  1997.       if self.mirror
  1998.         @weapon.angle += @weapon.angle - 180
  1999.       end
  2000.     end
  2001.     # 残像
  2002.     if @battler.shadow
  2003.       if Graphics.frame_count % 2 == 0
  2004.         shadow = ::Sprite.new(self.viewport)
  2005.         shadow.bitmap = self.bitmap.dup
  2006.         shadow.x = self.x
  2007.         shadow.y = self.y
  2008.         shadow.ox = self.ox
  2009.         shadow.oy = self.oy
  2010.         shadow.mirror = self.mirror
  2011.         shadow.angle = self.angle
  2012.         shadow.opacity = 160
  2013.         shadow.zoom_x = self.zoom_x
  2014.         shadow.zoom_y = self.zoom_y
  2015.         if @battler.is_a?(Game_Actor)
  2016.           shadow.src_rect.set(@sx, @sy, @width, @height)
  2017.         else
  2018.           shadow.src_rect.set(0, 0, @width, @height)
  2019.         end
  2020.         @shadow.push([shadow,duration = 10,@battler.true_x + @effect_ox,@battler.true_y + @effect_oy])
  2021.       end
  2022.     end
  2023.     for s in @shadow
  2024.       if !s[0].disposed?
  2025.         s[0].update
  2026.         s[1] -= 1
  2027.         if s[1] < 1
  2028.           if s[0].bitmap != nil
  2029.             s[0].bitmap.dispose
  2030.           end
  2031.           s[0].dispose
  2032.         else
  2033.           s[0].x = @battler.screen_x(s[2])
  2034.           s[0].y = @battler.screen_y(s[3])
  2035.         end
  2036.       else
  2037.         s = nil
  2038.       end
  2039.     end
  2040.     @shadow.compact!
  2041.   end
  2042.   #--------------------------------------------------------------------------
  2043.   # ● エフェクトによる座標系の更新
  2044.   #--------------------------------------------------------------------------
  2045.   def update_effect
  2046.     # 角度の修正
  2047.     if @_upside_down
  2048.       self.angle = (@_turning + 180) % 360
  2049.     else
  2050.       self.angle = @_turning
  2051.     end
  2052.     # X 座標の修正値
  2053.     @effect_ox = @_shake + @_moving[0]
  2054.     # Y 座標の修正値
  2055.     @effect_oy = -@fly + @_moving[1]
  2056.     if  @_animation == nil or (RTAB and @_animation.empty?)
  2057.       self.effect_clear
  2058.     end
  2059.   end
  2060.   #--------------------------------------------------------------------------
  2061.   # ● シェイク更新
  2062.   #--------------------------------------------------------------------------
  2063.   def update_shake
  2064.     if @_shake_duration >= 1 or @_shake != 0
  2065.       delta = (@_shake_power * @_shake_speed * @_shake_direction) / 10.0
  2066.       if @_shake_duration <= 1 and @_shake * (@_shake + delta) < 0
  2067.         @_shake = 0
  2068.       else
  2069.         @_shake += delta
  2070.       end
  2071.       if @_shake > @_shake_power * 2
  2072.         @_shake_direction = -1
  2073.       end
  2074.       if @_shake < - @_shake_power * 2
  2075.         @_shake_direction = 1
  2076.       end
  2077.       if @_shake_duration >= 1
  2078.         @_shake_duration -= 1
  2079.       end
  2080.     end
  2081.   end
  2082.   #--------------------------------------------------------------------------
  2083.   # ● 飛行更新
  2084.   #--------------------------------------------------------------------------
  2085.   def update_fly
  2086.     if @rand > 0
  2087.       @rand -= 1
  2088.       return
  2089.     end
  2090.     if @battler.fly != 0
  2091.       if @fly < @battler.fly / 4
  2092.         @fly_direction = 1
  2093.       elsif @fly > @battler.fly / 2
  2094.         @fly_direction = -1
  2095.       end
  2096.       @fly += 0.5 * @fly_direction
  2097.     end
  2098.   end
  2099.   #--------------------------------------------------------------------------
  2100.   # ● 回転更新
  2101.   #--------------------------------------------------------------------------
  2102.   def update_turning
  2103.     if @_turning_duration > 0 or @_turning != 0
  2104.       @_turning += @_turning_direction * @_turning_speed / 2.0
  2105.       # 残り回転数を減らす
  2106.       if @_turning_direction == -1
  2107.         if @_turning_duration > 0 and @_turning < 0
  2108.           @_turning_duration -= 1
  2109.         end
  2110.       elsif @_turning_direction == 1
  2111.         if @_turning_duration > 0 and @_turning >= 360
  2112.           @_turning_duration -= 1
  2113.         end
  2114.       end
  2115.       # 以下補正
  2116.       while @_turning < 0
  2117.         @_turning += 360
  2118.       end
  2119.       if @_turning_duration <= 0
  2120.         @_turning = 0
  2121.       end
  2122.       @_turning %= 360
  2123.     end
  2124.   end
  2125.   #--------------------------------------------------------------------------
  2126.   # ● 左右反転更新
  2127.   #--------------------------------------------------------------------------
  2128.   def update_reverse
  2129.     if @last_reverse != (@_reverse or @battler.reverse)
  2130.       self.mirror = (@_reverse or @battler.reverse)
  2131.       @last_reverse = (@_reverse or @battler.reverse)
  2132.     end
  2133.   end
  2134.   #--------------------------------------------------------------------------
  2135.   # ● 移動更新
  2136.   #--------------------------------------------------------------------------
  2137.   def update_moving
  2138.     @move_distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  2139.                      (@_move_coordinates[3] - @_move_coordinates[1]).abs
  2140.     if @move_distance > 0
  2141.       return if @_moving[0] == @_move_coordinates[0] and @_moving[1] == @_move_coordinates[1]
  2142.       array = @_move_coordinates
  2143.       x = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  2144.       y = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  2145.       @_moving = [x, y]
  2146.       if @_move_quick_return and @_move_duration == 0
  2147.         @_move_coordinates = [0,0,array[0],array[1]]
  2148.         @_move_duration = @move_distance
  2149.       end
  2150.       @_move_duration -= @_move_speed
  2151.       @_move_duration = [@_move_duration, 0].max
  2152.     end
  2153.   end
  2154.   #--------------------------------------------------------------------------
  2155.   # ● 追加アニメ更新 (RTAB限定機能)
  2156.   #--------------------------------------------------------------------------
  2157.   def update_add_anime
  2158.     if RTAB
  2159.     # アニメーション
  2160.     if @_add_anime_id != 0
  2161.       animation = $data_animations[@_add_anime_id]
  2162.       animation(animation, true)
  2163.       @_add_anime_id = 0
  2164.     end
  2165.     end
  2166.   end
  2167.   #--------------------------------------------------------------------------
  2168.   # ● エフェクト初期化
  2169.   #--------------------------------------------------------------------------
  2170.   def effect_clear
  2171.     @_effect_ox = 0
  2172.     @_effect_oy = 0
  2173.     @_shake_power = 0
  2174.     @_shake_speed = 0
  2175.     @_shake_duration = 0
  2176.     @_shake_direction = 1
  2177.     @_shake = 0
  2178.     @_upside_down = false
  2179.     @_reverse = false
  2180.     @_turning_direction = 1
  2181.     @_turning_speed = 0
  2182.     @_turning_duration = 0
  2183.     @_turning = 0
  2184.     @_move_quick_return = true
  2185.     @_move_speed = 0
  2186.     @_move_coordinates = [0,0,0,0]
  2187.     @_move_jump = false
  2188.     @_move_duration = 0
  2189.     @_moving = [0,0]
  2190.     @_add_anime_id = 0
  2191.   end
  2192.   #--------------------------------------------------------------------------
  2193.   # ● シェイクの開始
  2194.   #     power    : 強さ
  2195.   #     speed    : 速さ
  2196.   #     duration : 時間
  2197.   #--------------------------------------------------------------------------
  2198.   def start_shake(power, speed, duration)
  2199.     @_shake_power = power
  2200.     @_shake_speed = speed
  2201.     @_shake_duration = duration
  2202.   end
  2203.   #--------------------------------------------------------------------------
  2204.   # ● 上下反転を開始
  2205.   #--------------------------------------------------------------------------
  2206.   def start_upside_down
  2207.     @_upside_down = @_upside_down ? false : true
  2208.   end
  2209.   #--------------------------------------------------------------------------
  2210.   # ● 左右反転を開始
  2211.   #--------------------------------------------------------------------------
  2212.   def start_reverse
  2213.     @_reverse = @_reverse ? false : true
  2214.   end
  2215.   #--------------------------------------------------------------------------
  2216.   # ● 回転を開始
  2217.   #     direction: 方向
  2218.   #     speed    : 速さ
  2219.   #     duration : 時間
  2220.   #--------------------------------------------------------------------------
  2221.   def start_turning(direction, speed, duration)
  2222.     @_turning_direction = direction
  2223.     @_turning_speed = speed
  2224.     @_turning_duration = duration
  2225.     @_turning = @_turning_direction == 1 ? 0 : 360
  2226.   end
  2227.   #--------------------------------------------------------------------------
  2228.   # ● 移動を開始
  2229.   #     quick_return : 戻るかどうか
  2230.   #     speed        : 速さ
  2231.   #     x            : X 座標
  2232.   #     y            : Y 座標
  2233.   #--------------------------------------------------------------------------
  2234.   def start_moving(quick_return, speed, x, y)
  2235.     @_move_quick_return = quick_return == 0 ? false : true
  2236.     @_move_speed = speed
  2237.     @_move_coordinates = [x,y,@_move_coordinates[0],@_move_coordinates[1]]
  2238.     distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  2239.                (@_move_coordinates[3] - @_move_coordinates[1]).abs
  2240.     @_move_duration = distance
  2241.   end
  2242.   #--------------------------------------------------------------------------
  2243.   # ● アニメ追加を開始
  2244.   #     id           : ID
  2245.   #     hit          : 命中フラッグ
  2246.   #--------------------------------------------------------------------------
  2247.   def start_add_anime(id)
  2248.     @_add_anime_id = id
  2249.   end
  2250.   #--------------------------------------------------------------------------
  2251.   # ● 各種エフェクトの開始判定
  2252.   #--------------------------------------------------------------------------
  2253.   if !method_defined?("side_view_animation_process_timing")
  2254.     alias side_view_animation_process_timing animation_process_timing
  2255.   end
  2256.   def animation_process_timing(timing, hit)
  2257.     side_view_animation_process_timing(timing, hit)
  2258.     if (timing.condition == 0) or
  2259.        (timing.condition == 1 and hit == true) or
  2260.        (timing.condition == 2 and hit == false)
  2261.       if timing.se.name =~ SHAKE_FILE
  2262.         names = timing.se.name.split(/#/)
  2263.         power    = names[1].nil? ? SHAKE_POWER    : names[1].to_i
  2264.         speed    = names[2].nil? ? SHAKE_SPEED    : names[2].to_i
  2265.         duration = names[3].nil? ? SHAKE_DURATION : names[3].to_i
  2266.         # シェイクを開始
  2267.         self.start_shake(power, speed, duration)
  2268.       end
  2269.       if timing.se.name == UPSIDE_DOWN_FILE
  2270.         # 上下反転を開始
  2271.         self.start_upside_down
  2272.       end
  2273.       if timing.se.name == REVERSE_FILE
  2274.         # 左右反転を開始
  2275.         self.start_reverse
  2276.       end
  2277.       if timing.se.name =~ TURNING_FILE
  2278.         names = timing.se.name.split(/#/)
  2279.         direction = names[1].nil? ? TURNING_DIRECTION : names[1].to_i
  2280.         speed     = names[2].nil? ? TURNING_SPEED     : names[2].to_i
  2281.         duration  = names[3].nil? ? TURNING_DURATION  : names[3].to_i
  2282.         # 回転を開始
  2283.         self.start_turning(direction, speed, duration)
  2284.       end
  2285.       if timing.se.name =~ MOVE_FILE
  2286.         names = timing.se.name.split(/#/)
  2287.         quick_return= names[1].nil? ? MOVE_RETURN      : names[1].to_i
  2288.         speed       = names[2].nil? ? MOVE_SPEED       : names[2].to_i
  2289.         x           = names[3].nil? ? MOVE_COORDINATES[0] : names[3].to_i
  2290.         y           = names[3].nil? ? MOVE_COORDINATES[1] : names[4].to_i
  2291.         # 移動を開始
  2292.         self.start_moving(quick_return, speed, x, y)
  2293.       end
  2294.       if timing.se.name =~ ADD_ANIME_FILE
  2295.         names = timing.se.name.split(/#/)
  2296.         id = names[1].nil? ? ADD_ANIME_ID      : names[1].to_i
  2297.         # アニメ追加を開始
  2298.         self.start_add_anime(id)
  2299.       end
  2300.     end
  2301.   end
  2302. end
  2303. #==============================================================================
  2304. # ■ Sprite_Weapon
  2305. #------------------------------------------------------------------------------
  2306. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2307. # スプライトの状態を自動的に変化させます。
  2308. #==============================================================================

  2309. class Sprite_Weapon < RPG::Sprite
  2310.   include Side_view
  2311.   #--------------------------------------------------------------------------
  2312.   # ● 公開インスタンス変数
  2313.   #--------------------------------------------------------------------------
  2314.   attr_accessor :battler                  # バトラー
  2315.   attr_reader   :cw                       # グラフィックの幅
  2316.   attr_reader   :ch                       # グラフィックの高さ
  2317.   #--------------------------------------------------------------------------
  2318.   # ● オブジェクト初期化
  2319.   #     viewport : ビューポート
  2320.   #     battler  : バトラー (Game_Battler)
  2321.   #--------------------------------------------------------------------------
  2322.   def initialize(viewport, battler = nil)
  2323.     super(viewport)
  2324.     @battler = battler
  2325.     @battler_visible = false
  2326.   end
  2327.   #--------------------------------------------------------------------------
  2328.   # ● 解放
  2329.   #--------------------------------------------------------------------------
  2330.   def dispose
  2331.     if self.bitmap != nil
  2332.       self.bitmap.dispose
  2333.     end
  2334.     super
  2335.   end
  2336.   #--------------------------------------------------------------------------
  2337.   # ● フレーム更新
  2338.   #--------------------------------------------------------------------------
  2339.   def update
  2340.     super
  2341.     # バトラーが nil の場合
  2342.     if @battler == nil or !@battler.is_a?(Game_Actor)
  2343.       self.bitmap = nil
  2344.       return
  2345.     end
  2346.     # ウエポンアニメのデータ取得
  2347.     @weapon_anime_type = @battler.weapon_anime_type(@battler.condition)
  2348.     # 設定が「非表示」の場合
  2349.     if !@weapon_anime_type[1] or @weapon_anime_type[0].nil?
  2350.       self.visible = false
  2351.       return
  2352.     else
  2353.       self.visible = true
  2354.     end
  2355.     # ファイル名が現在のものと異なる場合
  2356.     if @weapon_anime_type[0] != @weapon_name
  2357.       @weapon_name = @weapon_anime_type[0]
  2358.       # ビットマップを取得、設定
  2359.       self.bitmap = RPG::Cache.icon(@weapon_name)
  2360.       @width = bitmap.width
  2361.       @height = bitmap.height
  2362.       @flag = true
  2363.     end
  2364.     # 現在アニメパターンが現在のものと異なる場合
  2365.     if @pattern != @battler.pattern or @flag or @condition != @battler.condition
  2366.       @pattern = @battler.pattern
  2367.       @condition = @battler.condition
  2368.       self.ox = @width
  2369.       self.oy = @height
  2370.       self.z = battler.screen_z
  2371.       self.zoom_x = @battler.real_zoom * CHAR_ZOOM
  2372.       self.zoom_y = @battler.real_zoom * CHAR_ZOOM
  2373.       self.src_rect.set(0, 0, @width, @height)
  2374.       self.opacity = 255
  2375.       # バトラーより手前に表示
  2376.       if @weapon_anime_type[2]
  2377.         self.z += 10
  2378.       # バトラーより奥に表示
  2379.       else
  2380.         self.z -= 10
  2381.       end
  2382.       @flag = false
  2383.     end
  2384.   end
  2385. end

  2386. #==============================================================================
  2387. # ■ Sprite_Flying
  2388. #------------------------------------------------------------------------------
  2389. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2390. # スプライトの状態を自動的に変化させます。
  2391. #==============================================================================

  2392. class Sprite_Flying < RPG::Sprite
  2393.   include Side_view
  2394.   #--------------------------------------------------------------------------
  2395.   # ● 公開インスタンス変数
  2396.   #--------------------------------------------------------------------------
  2397.   attr_accessor :battler                  # バトラー
  2398.   #--------------------------------------------------------------------------
  2399.   # ● オブジェクト初期化
  2400.   #     viewport : ビューポート
  2401.   #     battler  : バトラー (Game_Battler)
  2402.   #--------------------------------------------------------------------------
  2403.   def initialize(viewport, battler = nil)
  2404.     super(viewport)
  2405.     @battler = battler
  2406.     @battler_visible = false
  2407.   end
  2408.   #--------------------------------------------------------------------------
  2409.   # ● 解放
  2410.   #--------------------------------------------------------------------------
  2411.   def dispose
  2412.     if self.bitmap != nil
  2413.       self.bitmap.dispose
  2414.     end
  2415.     super
  2416.   end
  2417.   #--------------------------------------------------------------------------
  2418.   # ● フレーム更新
  2419.   #--------------------------------------------------------------------------
  2420.   def update
  2421.     super
  2422.     # バトラーが nil の場合
  2423.     if @battler == nil
  2424.       self.bitmap = nil
  2425.       loop_animation(nil)
  2426.       return
  2427.     end
  2428.     # 遠距離アニメ
  2429.     flying_animation = @battler.flying_animation
  2430.     flying_start = flying_animation[0]
  2431.     flying_end   = flying_animation[1]
  2432.     # アニメーション ID が現在のものと異なる場合
  2433.     if @anime_id != @battler.flying_anime[0]
  2434.       @anime_id = @battler.flying_anime[0]
  2435.       @animation = $data_animations[@anime_id]
  2436.     end
  2437.     # アニメーション 開始
  2438.     if flying_start
  2439.       loop_animation(@animation)
  2440.     elsif flying_end
  2441.       loop_animation(nil)
  2442.     end
  2443.     self.x = @battler.flying_x
  2444.     self.y = @battler.flying_y
  2445.     self.z = @battler.screen_z + 1000
  2446.   end
  2447. end

  2448. module RPG
  2449.   class Skill
  2450.     #--------------------------------------------------------------------------
  2451.     # ● 魔法かどうかの判断
  2452.     #--------------------------------------------------------------------------
  2453.     def magic?
  2454.       if @atk_f == 0
  2455.         return true
  2456.       else
  2457.         return false
  2458.       end
  2459.     end
  2460.   end
  2461. end

  2462. # アローカーソルの位置修正

  2463. class Arrow_Actor < Arrow_Base
  2464.   include Side_view
  2465.   #--------------------------------------------------------------------------
  2466.   # ● フレーム更新
  2467.   #--------------------------------------------------------------------------
  2468.   alias side_view_update update
  2469.   def update
  2470.     side_view_update
  2471.     # スプライトの座標を設定
  2472.     if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
  2473.       self.x = self.actor.screen_x + ARROW_OX
  2474.       self.y = self.actor.screen_y + ARROW_OY
  2475.     end
  2476.   end
  2477. end
  2478. class Arrow_Enemy < Arrow_Base
  2479.   include Side_view
  2480.   #--------------------------------------------------------------------------
  2481.   # ● フレーム更新
  2482.   #--------------------------------------------------------------------------
  2483.   alias side_view_update update
  2484.   def update
  2485.     side_view_update
  2486.     # スプライトの座標を設定
  2487.     if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
  2488.       self.x = self.enemy.screen_x
  2489.       self.y = self.enemy.screen_y + self.enemy.height/2
  2490.     end
  2491.   end
  2492. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部