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

Project1

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

技能冷却与CP条战斗的小问题

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
57 小时
注册时间
2007-9-4
帖子
72
跳转到指定楼层
1
发表于 2008-7-24 17:24:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我同时使用了豪版的技能冷却与CP战斗的脚本后发现,技能冷却显示出错。
假如设定冷却时间是6回合,它依次这样显示:6-> 4-> 2-> 可使用。造成
回合数减二,而不是减一的错误。这是计算回合数的部分:
module RPG
  class Skill
  def cold
    return @name.split(/,/)[1]
  end
  def name(actor = nil)
    if $冷却时间显示 and actor != nil and actor.cold[@id] != nil
      a = (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
      return a + "(" + actor.cold[@id].to_s + "回合冷却)"
    else
      return (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
    end
  end
  end
end


这是CP制御的脚本
  1. #==============================================================================
  2. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  3. #==============================================================================
  4. module XRXS_CP
  5.   #--------------------------------------------------------------------------
  6.   # ○ スキンライン (スキンの何行目を使うか)
  7.   #--------------------------------------------------------------------------
  8.   def cp_linetype
  9.     # CP フルの場合はスキンの 2 行目を使う
  10.     return 2 if self.cp_full?
  11.     # 通常はスキンの 1 行目を使う
  12.     return 1
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ○ メーター量[単位:%]
  16.   #--------------------------------------------------------------------------
  17.   def cp_lineamount
  18.     # 戦闘不能の場合は 0 %として表示させる
  19.     return 0 if self.dead?
  20.     # CP値を%値に変換して返却する
  21.     return 100 * self.cp / self.max_cp
  22.   end
  23. end
  24. #
  25. # カスタマイズポイントここまで。
  26. #------------------------------------------------------------------------------



  27. #==============================================================================
  28. # --- XRXS. CP機構 ---
  29. #==============================================================================
  30. module XRXS_CP_SYSTEM
  31.   #----------------------------------------------------------------------------
  32.   # ○ 合計 AGI の取得
  33.   #----------------------------------------------------------------------------
  34.   def self.total_agi
  35.     total = 0
  36.     for battler in $game_party.actors + $game_troop.enemies
  37.       total += battler.agi
  38.     end
  39.     return total
  40.   end
  41. end
  42. #==============================================================================
  43. # --- バトラーにCP機能を追加 モジュール ---
  44. #==============================================================================
  45. module XRXS_CP
  46.   #--------------------------------------------------------------------------
  47.   # ○ 最大 CP の取得
  48.   #--------------------------------------------------------------------------
  49.   def max_cp
  50.     return 65535
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ○ CP の取得と設定
  54.   #--------------------------------------------------------------------------
  55.   def cp
  56.     return @cp == nil ? @cp = 0 : @cp
  57.   end
  58.   def cp=(n)
  59.     @cp = [[n.to_i, 0].max, self.max_cp].min
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ○ CP 初期設定
  63.   #--------------------------------------------------------------------------
  64.   def cp_preset
  65.     percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  66.     self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ○ CP カウントアップ
  70.   #--------------------------------------------------------------------------
  71.   def cp_update
  72.     self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ○ CP 満タン?
  76.   #--------------------------------------------------------------------------
  77.   def cp_full?
  78.     return @cp == self.max_cp
  79.   end
  80. end
  81. class Game_Battler
  82.   include XRXS_CP
  83. end
  84. #==============================================================================
  85. # --- ガード機能 ---
  86. #==============================================================================
  87. class Game_Battler
  88.   #--------------------------------------------------------------------------
  89.   # ○ ガードフラグ
  90.   #--------------------------------------------------------------------------
  91.   def guarding=(n)
  92.     @guarding = n
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 防御中判定 [再定義]
  96.   #--------------------------------------------------------------------------
  97.   def guarding?
  98.     return @guarding
  99.   end
  100. end
  101. #==============================================================================
  102. # --- アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  103. #==============================================================================
  104. module XRXS_CP_INPUTABLE
  105.   def inputable?
  106.     return (self.cp_full? and super)
  107.   end
  108. end
  109. class Game_Actor < Game_Battler
  110.   include XRXS_CP_INPUTABLE
  111. end
  112. #==============================================================================
  113. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  114. #==============================================================================
  115. module XRXS_CP_MOVABLE
  116.   def movable?
  117.     return (self.cp_full? and super)
  118.   end
  119. end
  120. class Game_Enemy < Game_Battler
  121.   include XRXS_CP_MOVABLE
  122. end
  123. #==============================================================================
  124. # --- 戦闘時 CPカウント ---
  125. #==============================================================================
  126. module XRXS_CP_Battle
  127.   #--------------------------------------------------------------------------
  128.   # ○ パーティ全員の CP を初期設定
  129.   #--------------------------------------------------------------------------
  130.   def cp_preset_party
  131.     for actor in $game_party.actors
  132.       actor.cp_preset
  133.     end
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ○ トループ全員の CP を初期設定
  137.   #--------------------------------------------------------------------------
  138.   def cp_preset_troop
  139.     for enemy in $game_troop.enemies
  140.       enemy.cp_preset
  141.     end
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ○ バトラー全員の CP をカウントアップ
  145.   #--------------------------------------------------------------------------
  146.   def cp_update
  147.     for battler in $game_party.actors + $game_troop.enemies
  148.       battler.cp_update
  149.     end
  150.   end
  151. end
  152. class Scene_Battle
  153.   include XRXS_CP_Battle
  154. end
  155. #==============================================================================
  156. # ■ Scene_Battle
  157. #==============================================================================
  158. class Scene_Battle
  159.   #--------------------------------------------------------------------------
  160.   # ● メイン処理
  161.   #--------------------------------------------------------------------------
  162.   alias xrxs65_main main
  163.   def main
  164.     # エクストラスプライトの初期化
  165.     @extra_sprites = [] if @extra_sprites == nil
  166.     # CP の初期化
  167.     cp_preset_party
  168.     # CP メーターの作成
  169.     @cp_meters = CP_Meters.new
  170.     # CP メーターをエクストラスプライトへ登録
  171.     @extra_sprites.push(@cp_meters)
  172.     # 呼び戻す
  173.     xrxs65_main
  174.     # メーターの解放
  175.     @cp_meters.dispose
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● プレバトルフェーズ開始
  179.   #--------------------------------------------------------------------------
  180.   alias xrxs65_start_phase1 start_phase1
  181.   def start_phase1
  182.     # 呼び戻す
  183.     xrxs65_start_phase1
  184.     # CP の初期化
  185.     cp_preset_troop
  186.     # CP メーターの更新
  187.     @cp_meters.refresh
  188.     # インデックスを計算
  189.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  190.     # アクターコマンドウィンドウに追加
  191.     @actor_command_window.add_command("逃跑")
  192.     if !$game_temp.battle_can_escape
  193.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  194.     end
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● パーティコマンドフェーズ開始
  198.   #--------------------------------------------------------------------------
  199.   alias xrxs65_start_phase2 start_phase2
  200.   def start_phase2
  201.     # 呼び戻す
  202.     xrxs65_start_phase2
  203.     # パーティコマンドウィンドウを無効化
  204.     @party_command_window.active  = false
  205.     @party_command_window.visible = false
  206.     # 強制的にフェイズ 2 を保持
  207.     @phase = 2
  208.     # ただし、既に行動可能者が存在する場合は 3 へ
  209.     start_phase3 if anybody_movable?
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ○ CP制での ターンのカウント
  213.   #--------------------------------------------------------------------------
  214.   def cp_turn_count
  215.     $game_temp.battle_turn += 1
  216.     # バトルイベントの全ページを検索
  217.     for index in 0...$data_troops[@troop_id].pages.size
  218.       # このページのスパンが [ターン] の場合
  219.       if $data_troops[@troop_id].pages[index].span == 1
  220.         # 実行済みフラグをクリア
  221.         $game_temp.battle_event_flags[index] = false
  222.       end
  223.     end
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● フレーム更新 (パーティコマンドフェーズ)
  227.   #--------------------------------------------------------------------------
  228.   alias xrxs65_update_phase2 update_phase2
  229.   def update_phase2
  230.     # パーティコマンドウィンドウのインデックスを無効化
  231. #去掉    @party_command_window.index = -1
  232.     # 呼び戻す
  233.     xrxs65_update_phase2
  234.     # 例外補正
  235.     @turn_count_time = 1 if @turn_count_time == nil
  236.     # ターンのカウント
  237.     if @turn_count_time > 0
  238.       @turn_count_time -= 1
  239.       if @turn_count_time == 0
  240.         cp_turn_count
  241.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  242.       end
  243.     end
  244.     # CP のフレーム更新
  245.     cp_update
  246.     @cp_meters.refresh
  247.     # フル CP のバトラーが存在する場合、ターン開始
  248.     start_phase3 if anybody_movable?
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ○ フル CP バトラーが存在するか?
  252.   #--------------------------------------------------------------------------
  253.   def anybody_movable?
  254.     for battler in $game_party.actors + $game_troop.enemies
  255.       return true if battler.cp_full?
  256.     end
  257.     return false
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● アクターコマンドウィンドウのセットアップ
  261.   #--------------------------------------------------------------------------
  262.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  263.   def phase3_setup_command_window
  264.     # 効果音の再生
  265.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  266.     # 呼び戻す
  267.     xrxs65_phase3_setup_command_window
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  271.   #--------------------------------------------------------------------------
  272.     alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  273.   def update_phase3_basic_command
  274.     # C ボタンが押された場合
  275.     if Input.trigger?(Input::C)
  276.       # アクターコマンドウィンドウのカーソル位置で分岐
  277.       case @actor_command_window.index
  278.       when @cp_escape_actor_command_index # 逃げる
  279.         if $game_temp.battle_can_escape
  280.           # 決定 SE を演奏
  281.           $game_system.se_play($data_system.decision_se)
  282.           # アクションを設定
  283.           @active_battler.current_action.kind = 0
  284.           @active_battler.current_action.basic = 4
  285.           # 次のアクターのコマンド入力へ
  286.           phase3_next_actor
  287.         else
  288.           # ブザー SE を演奏
  289.           $game_system.se_play($data_system.buzzer_se)
  290.         end
  291.         return
  292.       end
  293.     end
  294.     # 呼び戻す
  295.     xrxs_bsp1_update_phase3_basic_command
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● メインフェーズ開始
  299.   #--------------------------------------------------------------------------
  300.   alias xrxs65_start_phase4 start_phase4
  301.   def start_phase4
  302.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  303.     $game_temp.battle_turn -= 1
  304.     # フラグを退避
  305.     save_flags = $game_temp.battle_event_flags.dup
  306.     # 呼び戻す
  307.     xrxs65_start_phase4
  308.     # フラグを復旧
  309.     $game_temp.battle_event_flags = save_flags
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● 行動順序作成
  313.   #--------------------------------------------------------------------------
  314.   alias xrxs65_make_action_orders make_action_orders
  315.   def make_action_orders
  316.     # 呼び戻す
  317.     xrxs65_make_action_orders
  318.     # CPが不足している場合は @action_battlers から除外する
  319.     for battler in @action_battlers.dup
  320.       @action_battlers.delete(battler) unless battler.cp_full?
  321.     end
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  325.   #--------------------------------------------------------------------------
  326.   alias xrxs65_update_phase4_step2 update_phase4_step2
  327.   def update_phase4_step2
  328.     # ガードの解除
  329.     @active_battler.guarding = false
  330.     # CPの消費
  331.     @active_battler.cp = 0
  332.     # CP メーターの更新
  333.     @cp_meters.refresh
  334.     # 呼び戻す
  335.     xrxs65_update_phase4_step2
  336.     # 例外補正
  337.     return if @active_battler == nil
  338.     # ターンコントローラ
  339.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  340.       cp_turn_count
  341.     end
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● 基本アクション 結果作成
  345.   #--------------------------------------------------------------------------
  346.   alias xrxs65_make_basic_action_result make_basic_action_result
  347.   def make_basic_action_result
  348.     # 呼び戻す
  349.     xrxs65_make_basic_action_result
  350.     # 防御の場合
  351.     if @active_battler.current_action.basic == 1
  352.       @active_battler.guarding = true
  353.       return
  354.     end
  355.     # パーティの逃亡の場合
  356.     if @active_battler.current_action.basic == 4
  357.       # 逃走可能ではない場合
  358.       if $game_temp.battle_can_escape == false
  359.         # ブザー SE を演奏
  360.         $game_system.se_play($data_system.buzzer_se)
  361.         return
  362.       end

  363.       # パーティ全員の CP をクリア
  364.       for actor in $game_party.actors
  365.         actor.cp = 0
  366.       end
  367.       # CP メーターの更新
  368.       @cp_meters.refresh
  369.       # 逃走処理
  370.       update_phase2_escape
  371.       return
  372.     end
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  376.   #--------------------------------------------------------------------------
  377.   alias xrxs65_update_phase4_step5 update_phase4_step5
  378.   def update_phase4_step5
  379.     # 呼び戻す
  380.     xrxs65_update_phase4_step5
  381.     # CP メーターの更新
  382.     @cp_meters.refresh
  383.   end
  384. end
  385. #==============================================================================
  386. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  387. #==============================================================================
  388. class CP_Meters
  389.   #--------------------------------------------------------------------------
  390.   # ○ オブジェクト初期化
  391.   #--------------------------------------------------------------------------
  392.   def initialize
  393.     # メーター群の生成
  394.     @meters = []
  395.     for i in 0...$game_party.actors.size
  396.       make_meter(i)
  397.     end
  398.     refresh
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ○ リフレッシュ
  402.   #--------------------------------------------------------------------------
  403.   def refresh
  404.     # 戦闘メンバー数の変更を判別
  405.     for i in @meters.size...$game_party.actors.size
  406.       make_meter(i)
  407.     end
  408.     for i in [email protected]
  409.       @meters[i].dispose
  410.       @meters[i] = nil
  411.     end
  412.     @meters.compact!
  413.     # 表示更新
  414.     for i in 0...$game_party.actors.size
  415.       actor = $game_party.actors[i]
  416.       @meters[i].line   = actor.cp_linetype
  417.       @meters[i].amount = actor.cp_lineamount
  418.     end
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ○ メーターひとつの生成
  422.   #--------------------------------------------------------------------------
  423.   def make_meter(i)
  424.     # スキンの取得
  425.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  426.     #
  427.     space = 640 / XRXS65::MAX
  428.     case XRXS65::ALIGN
  429.     when 0
  430.       actor_x = i * space + 4
  431.     when 1
  432.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  433.     when 2
  434.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  435.     end
  436.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  437.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  438.     meter.y = XRXS65::Y_OFFSET
  439.     @meters[i] = meter
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ○ 可視状態
  443.   #--------------------------------------------------------------------------
  444.   def visible=(b)
  445.     @meters.each{|sprite| sprite.visible = b }
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ○ 解放
  449.   #--------------------------------------------------------------------------
  450.   def dispose
  451.     @meters.each{|sprite| sprite.dispose }
  452.   end
  453. end
  454. #==============================================================================
  455. # --- XRXS. レクタンギュラーメーター表示・極 ---
  456. #==============================================================================
  457. class MeterSprite < Sprite
  458.   #--------------------------------------------------------------------------
  459.   # ○ オブジェクト初期化
  460.   #--------------------------------------------------------------------------
  461.   def initialize(skin, line_height)
  462.     @skin   = skin
  463.     @width  = @skin.width
  464.     @height = line_height
  465.     @line   = 1
  466.     @amount = 0
  467.     @base_sprite = Sprite.new
  468.     @base_sprite.bitmap = @skin
  469.     @base_sprite.src_rect.set(0, 0, @width, @height)
  470.     @base_sprite.z = 601
  471.     super()
  472.     self.z = @base_sprite.z + 1
  473.     self.bitmap = @skin
  474.     self.line = 1
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ○ 値の設定
  478.   #--------------------------------------------------------------------------
  479.   def line=(n)
  480.     @line = n
  481.     refresh
  482.   end
  483.   def amount=(n)
  484.     @amount = n
  485.     refresh
  486.   end
  487.   def refresh
  488.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ○ 座標の設定
  492.   #--------------------------------------------------------------------------
  493.   def x=(n)
  494.     super
  495.     @base_sprite.x = n
  496.   end
  497.   def y=(n)
  498.     super
  499.     @base_sprite.y = n
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ○ 解放
  503.   #--------------------------------------------------------------------------
  504.   def dispose
  505.     @base_sprite.dispose
  506.     super
  507.   end
  508. end
复制代码


请会脚本的朋友帮帮忙,看看是不是被CP脚本的哪段给冲突掉了,如若不是
,可不可以在第一部分直接修改呢?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
57 小时
注册时间
2007-9-4
帖子
72
2
 楼主| 发表于 2008-7-24 18:59:27 | 只看该作者
晕,都静候一个上午了,还是米人帮忙,给一些提示也好啊!

暴走!把全部的相关脚本都放上来了:

按钮追加

  1. # ▽△▽ XRXS. コマンドウィンドウ追加機構 ▽△▽
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # --- XRXS.コマンドウィンドウ追加機構 ---
  5. #==============================================================================
  6. module XRXS_Window_Command
  7.   #--------------------------------------------------------------------------
  8.   # ○ コマンドを追加
  9.   #--------------------------------------------------------------------------
  10.   def add_command(command)
  11.     #
  12.     # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  13.     #
  14.     @disabled = [] if @disabled.nil?
  15.     if @commands.size != @disabled.size
  16.       for i in [email protected]
  17.         @disabled[i] = false
  18.       end
  19.     end
  20.     #
  21.     # 追加
  22.     #
  23.     @commands.push(command)
  24.     @disabled.push(false)
  25.     @item_max = @commands.size
  26.     self.y -= 32
  27.     self.height += 32
  28.     self.contents.dispose
  29.     self.contents = nil
  30.     self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  31.     refresh
  32.     for i in [email protected]
  33.       if @disabled[i]
  34.         disable_item(i)
  35.       end
  36.     end
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ○ 項目の無効化
  40.   #     index : 項目番号
  41.   #--------------------------------------------------------------------------
  42.   def disable_item(index)
  43.     @disabled = [] if @disabled.nil?
  44.     @disabled[index] = true
  45.     draw_item(index, disabled_color)
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ○ 項目の有効化
  49.   #     index : 項目番号
  50.   #--------------------------------------------------------------------------
  51.   def enable_item(index)
  52.     @disabled = [] if @disabled.nil?
  53.     @disabled[index] = false
  54.     draw_item(index, normal_color)
  55.   end
  56. end
  57. class Window_Command < Window_Selectable
  58.   #--------------------------------------------------------------------------
  59.   # ○ インクルード
  60.   #--------------------------------------------------------------------------
  61.   include XRXS_Window_Command
  62.   #--------------------------------------------------------------------------
  63.   # ● 項目の無効化
  64.   #--------------------------------------------------------------------------
  65.   def disable_item(index)
  66.     super
  67.   end
  68. end
复制代码


CP制御

  1. #脚本可以达成《格兰蒂亚》的那种统一即时战斗条的效果,我见过不少人想用这个效果,这里说下用法。
  2. #使用方法:
  3. #一:由“按钮追加”“CP制御”“AX追加”三部分脚本构成。
  4. #   一定要注意插入顺序:自上而下“按钮追加”“CP制御”“AX追加”
  5. #二:AX追加中约27~29行这段:
  6. #SKIN = "123"        # 这里填写CP槽的图片,要放在Graphics/Windowskins下,大小无要求,
  7. # X   =  16          # CP槽的X坐标
  8. # Y   =  32          # CP槽的Y坐标
  9. #  CP制御约29行
  10. #SKIN        = "123"  # 加入AX追加后这部分实际上用不上,不过最好也填上。
  11. #三:AX追加约11~~23行部分
  12. # DEFAULT = "046-Skill03" # 这里是默认图标
  13. # # 这里是角色ID对应的图标,例如下面分别为1、2、7、8角色对应后面的图标名,可以按照格式自己添加,如果没有角色对应图标会采用默认,例如这里的3号角色。
  14. # ICONS = {
  15. #   1=>"001-Weapon01",
  16. #   2=>"002-Weapon02",
  17. #   7=>"007-Weapon07",
  18. #   8=>"008-Weapon08"
  19. # }
  20. # # 这里是敌人ID对应的图标,其他同上。
  21. # ICONE = {
  22. #   1=>"046-Skill03",
  23. #   2=>"047-Skill04",
  24. # }
  25. #四:CP制御约41行
  26. #COMMAND_UP_SE = "Audio/SE/046-Book01.ogg"  #这是CP槽满的效果音。#
  27. #
  28. #五:冲突,不必说,与战斗类必然稀里哗啦,不过只改战斗界面应该问题不大,对战斗要求不太高并且喜欢纵版的人来说,这个效果非常之好,自己考虑是否用吧。
  29. #
  30. # ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
  31. # by 桜雅 在土

  32. #==============================================================================
  33. # □ カスタマイズポイント
  34. #==============================================================================
  35. module XRXS65
  36.   #
  37.   # 「バトルスピード」(数値が高いほど早い)
  38.   #
  39.   SPEED = 0.7
  40.   #
  41.   # 戦闘開始時 CP。 固定値と占有率
  42.   #
  43.   CP_PRESET_FIXNUM = 0
  44.   CP_PRESET_RATIO  = 2.0
  45.   #
  46.   # ターンコントローラ (nil  : カウント/ターンを有効。
  47.   #                     数値 : そのインデックスをもつエネミーが支配)
  48.   #
  49.   TC = 0
  50.   #
  51.   # カウント/ターン (TCが有効な場合は無視)
  52.   #
  53.   CPT = 40
  54.   #
  55.   # CP スキン
  56.   #
  57.   SKIN        = "Line"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  58.   LINE_HEIGHT = 6        # スキンの"一行"の縦幅[単位:ピクセル]
  59.   #
  60.   # 表示位置セッティング
  61.   #
  62.   X_OFFSET = 164    # 横位置
  63.   Y_OFFSET = 464   # 縦位置
  64.   ALIGN    =   2    #「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  65.   MAX      =   4    # 確保するサイズ[単位:~人分]
  66.   #
  67.   # アクターコマンドがポップしたときの効果音
  68.   #
  69.   COMMAND_UP_SE = "Audio/SE/满条响"
  70. end
  71. #==============================================================================
  72. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  73. #==============================================================================
  74. module XRXS_CP
  75.   #--------------------------------------------------------------------------
  76.   # ○ スキンライン (スキンの何行目を使うか)
  77.   #--------------------------------------------------------------------------
  78.   def cp_linetype
  79.     # CP フルの場合はスキンの 2 行目を使う
  80.     return 2 if self.cp_full?
  81.     # 通常はスキンの 1 行目を使う
  82.     return 1
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ○ メーター量[単位:%]
  86.   #--------------------------------------------------------------------------
  87.   def cp_lineamount
  88.     # 戦闘不能の場合は 0 %として表示させる
  89.     return 0 if self.dead?
  90.     # CP値を%値に変換して返却する
  91.     return 100 * self.cp / self.max_cp
  92.   end
  93. end
  94. #
  95. # カスタマイズポイントここまで。
  96. #------------------------------------------------------------------------------



  97. #==============================================================================
  98. # --- XRXS. CP機構 ---
  99. #==============================================================================
  100. module XRXS_CP_SYSTEM
  101.   #----------------------------------------------------------------------------
  102.   # ○ 合計 AGI の取得
  103.   #----------------------------------------------------------------------------
  104.   def self.total_agi
  105.     total = 0
  106.     for battler in $game_party.actors + $game_troop.enemies
  107.       total += battler.agi
  108.     end
  109.     return total
  110.   end
  111. end
  112. #==============================================================================
  113. # --- バトラーにCP機能を追加 モジュール ---
  114. #==============================================================================
  115. module XRXS_CP
  116.   #--------------------------------------------------------------------------
  117.   # ○ 最大 CP の取得
  118.   #--------------------------------------------------------------------------
  119.   def max_cp
  120.     return 65535
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ○ CP の取得と設定
  124.   #--------------------------------------------------------------------------
  125.   def cp
  126.     return @cp == nil ? @cp = 0 : @cp
  127.   end
  128.   def cp=(n)
  129.     @cp = [[n.to_i, 0].max, self.max_cp].min
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ○ CP 初期設定
  133.   #--------------------------------------------------------------------------
  134.   def cp_preset
  135.     percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  136.     self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ○ CP カウントアップ
  140.   #--------------------------------------------------------------------------
  141.   def cp_update
  142.     self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ○ CP 満タン?
  146.   #--------------------------------------------------------------------------
  147.   def cp_full?
  148.     return @cp == self.max_cp
  149.   end
  150. end
  151. class Game_Battler
  152.   include XRXS_CP
  153. end
  154. #==============================================================================
  155. # --- ガード機能 ---
  156. #==============================================================================
  157. class Game_Battler
  158.   #--------------------------------------------------------------------------
  159.   # ○ ガードフラグ
  160.   #--------------------------------------------------------------------------
  161.   def guarding=(n)
  162.     @guarding = n
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 防御中判定 [再定義]
  166.   #--------------------------------------------------------------------------
  167.   def guarding?
  168.     return @guarding
  169.   end
  170. end
  171. #==============================================================================
  172. # --- アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  173. #==============================================================================
  174. module XRXS_CP_INPUTABLE
  175.   def inputable?
  176.     return (self.cp_full? and super)
  177.   end
  178. end
  179. class Game_Actor < Game_Battler
  180.   include XRXS_CP_INPUTABLE
  181. end
  182. #==============================================================================
  183. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  184. #==============================================================================
  185. module XRXS_CP_MOVABLE
  186.   def movable?
  187.     return (self.cp_full? and super)
  188.   end
  189. end
  190. class Game_Enemy < Game_Battler
  191.   include XRXS_CP_MOVABLE
  192. end
  193. #==============================================================================
  194. # --- 戦闘時 CPカウント ---
  195. #==============================================================================
  196. module XRXS_CP_Battle
  197.   #--------------------------------------------------------------------------
  198.   # ○ パーティ全員の CP を初期設定
  199.   #--------------------------------------------------------------------------
  200.   def cp_preset_party
  201.     for actor in $game_party.actors
  202.       actor.cp_preset
  203.     end
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ○ トループ全員の CP を初期設定
  207.   #--------------------------------------------------------------------------
  208.   def cp_preset_troop
  209.     for enemy in $game_troop.enemies
  210.       enemy.cp_preset
  211.     end
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ○ バトラー全員の CP をカウントアップ
  215.   #--------------------------------------------------------------------------
  216.   def cp_update
  217.     for battler in $game_party.actors + $game_troop.enemies
  218.       battler.cp_update
  219.     end
  220.   end
  221. end
  222. class Scene_Battle
  223.   include XRXS_CP_Battle
  224. end
  225. #==============================================================================
  226. # ■ Scene_Battle
  227. #==============================================================================
  228. class Scene_Battle
  229.   #--------------------------------------------------------------------------
  230.   # ● メイン処理
  231.   #--------------------------------------------------------------------------
  232.   alias xrxs65_main main
  233.   def main
  234.     # エクストラスプライトの初期化
  235.     @extra_sprites = [] if @extra_sprites == nil
  236.     # CP の初期化
  237.     cp_preset_party
  238.     # CP メーターの作成
  239.     @cp_meters = CP_Meters.new
  240.     # CP メーターをエクストラスプライトへ登録
  241.     @extra_sprites.push(@cp_meters)
  242.     # 呼び戻す
  243.     xrxs65_main
  244.     # メーターの解放
  245.     @cp_meters.dispose
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● プレバトルフェーズ開始
  249.   #--------------------------------------------------------------------------
  250.   alias xrxs65_start_phase1 start_phase1
  251.   def start_phase1
  252.     # 呼び戻す
  253.     xrxs65_start_phase1
  254.     # CP の初期化
  255.     cp_preset_troop
  256.     # CP メーターの更新
  257.     @cp_meters.refresh
  258.     # インデックスを計算
  259.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  260.     # アクターコマンドウィンドウに追加
  261.     @actor_command_window.add_command("逃跑")
  262.     if !$game_temp.battle_can_escape
  263.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  264.     end
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● パーティコマンドフェーズ開始
  268.   #--------------------------------------------------------------------------
  269.   alias xrxs65_start_phase2 start_phase2
  270.   def start_phase2
  271.     # 呼び戻す
  272.     xrxs65_start_phase2
  273.     # パーティコマンドウィンドウを無効化
  274.     @party_command_window.active  = false
  275.     @party_command_window.visible = false
  276.     # 強制的にフェイズ 2 を保持
  277.     @phase = 2
  278.     # ただし、既に行動可能者が存在する場合は 3 へ
  279.     start_phase3 if anybody_movable?
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # ○ CP制での ターンのカウント
  283.   #--------------------------------------------------------------------------
  284.   def cp_turn_count
  285.     $game_temp.battle_turn += 1
  286.     # バトルイベントの全ページを検索
  287.     for index in 0...$data_troops[@troop_id].pages.size
  288.       # このページのスパンが [ターン] の場合
  289.       if $data_troops[@troop_id].pages[index].span == 1
  290.         # 実行済みフラグをクリア
  291.         $game_temp.battle_event_flags[index] = false
  292.       end
  293.     end
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● フレーム更新 (パーティコマンドフェーズ)
  297.   #--------------------------------------------------------------------------
  298.   alias xrxs65_update_phase2 update_phase2
  299.   def update_phase2
  300.     # パーティコマンドウィンドウのインデックスを無効化
  301. #去掉    @party_command_window.index = -1
  302.     # 呼び戻す
  303.     xrxs65_update_phase2
  304.     # 例外補正
  305.     @turn_count_time = 1 if @turn_count_time == nil
  306.     # ターンのカウント
  307.     if @turn_count_time > 0
  308.       @turn_count_time -= 1
  309.       if @turn_count_time == 0
  310.         cp_turn_count
  311.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  312.       end
  313.     end
  314.     # CP のフレーム更新
  315.     cp_update
  316.     @cp_meters.refresh
  317.     # フル CP のバトラーが存在する場合、ターン開始
  318.     start_phase3 if anybody_movable?
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ○ フル CP バトラーが存在するか?
  322.   #--------------------------------------------------------------------------
  323.   def anybody_movable?
  324.     for battler in $game_party.actors + $game_troop.enemies
  325.       return true if battler.cp_full?
  326.     end
  327.     return false
  328.   end
  329.   #--------------------------------------------------------------------------
  330.   # ● アクターコマンドウィンドウのセットアップ
  331.   #--------------------------------------------------------------------------
  332.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  333.   def phase3_setup_command_window
  334.     # 効果音の再生
  335.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  336.     # 呼び戻す
  337.     xrxs65_phase3_setup_command_window
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  341.   #--------------------------------------------------------------------------
  342.     alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  343.   def update_phase3_basic_command
  344.     # C ボタンが押された場合
  345.     if Input.trigger?(Input::C)
  346.       # アクターコマンドウィンドウのカーソル位置で分岐
  347.       case @actor_command_window.index
  348.       when @cp_escape_actor_command_index # 逃げる
  349.         if $game_temp.battle_can_escape
  350.           # 決定 SE を演奏
  351.           $game_system.se_play($data_system.decision_se)
  352.           # アクションを設定
  353.           @active_battler.current_action.kind = 0
  354.           @active_battler.current_action.basic = 4
  355.           # 次のアクターのコマンド入力へ
  356.           phase3_next_actor
  357.         else
  358.           # ブザー SE を演奏
  359.           $game_system.se_play($data_system.buzzer_se)
  360.         end
  361.         return
  362.       end
  363.     end
  364.     # 呼び戻す
  365.     xrxs_bsp1_update_phase3_basic_command
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● メインフェーズ開始
  369.   #--------------------------------------------------------------------------
  370.   alias xrxs65_start_phase4 start_phase4
  371.   def start_phase4
  372.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  373.     $game_temp.battle_turn -= 1
  374.     # フラグを退避
  375.     save_flags = $game_temp.battle_event_flags.dup
  376.     # 呼び戻す
  377.     xrxs65_start_phase4
  378.     # フラグを復旧
  379.     $game_temp.battle_event_flags = save_flags
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # ● 行動順序作成
  383.   #--------------------------------------------------------------------------
  384.   alias xrxs65_make_action_orders make_action_orders
  385.   def make_action_orders
  386.     # 呼び戻す
  387.     xrxs65_make_action_orders
  388.     # CPが不足している場合は @action_battlers から除外する
  389.     for battler in @action_battlers.dup
  390.       @action_battlers.delete(battler) unless battler.cp_full?
  391.     end
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  395.   #--------------------------------------------------------------------------
  396.   alias xrxs65_update_phase4_step2 update_phase4_step2
  397.   def update_phase4_step2
  398.     # ガードの解除
  399.     @active_battler.guarding = false
  400.     # CPの消費
  401.     @active_battler.cp = 0
  402.     # CP メーターの更新
  403.     @cp_meters.refresh
  404.     # 呼び戻す
  405.     xrxs65_update_phase4_step2
  406.     # 例外補正
  407.     return if @active_battler == nil
  408.     # ターンコントローラ
  409.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  410.       cp_turn_count
  411.     end
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 基本アクション 結果作成
  415.   #--------------------------------------------------------------------------
  416.   alias xrxs65_make_basic_action_result make_basic_action_result
  417.   def make_basic_action_result
  418.     # 呼び戻す
  419.     xrxs65_make_basic_action_result
  420.     # 防御の場合
  421.     if @active_battler.current_action.basic == 1
  422.       @active_battler.guarding = true
  423.       return
  424.     end
  425.     # パーティの逃亡の場合
  426.     if @active_battler.current_action.basic == 4
  427.       # 逃走可能ではない場合
  428.       if $game_temp.battle_can_escape == false
  429.         # ブザー SE を演奏
  430.         $game_system.se_play($data_system.buzzer_se)
  431.         return
  432.       end

  433.       # パーティ全員の CP をクリア
  434.       for actor in $game_party.actors
  435.         actor.cp = 0
  436.       end
  437.       # CP メーターの更新
  438.       @cp_meters.refresh
  439.       # 逃走処理
  440.       update_phase2_escape
  441.       return
  442.     end
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  446.   #--------------------------------------------------------------------------
  447.   alias xrxs65_update_phase4_step5 update_phase4_step5
  448.   def update_phase4_step5
  449.     # 呼び戻す
  450.     xrxs65_update_phase4_step5
  451.     # CP メーターの更新
  452.     @cp_meters.refresh
  453.   end
  454. end
  455. #==============================================================================
  456. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  457. #==============================================================================
  458. class CP_Meters
  459.   #--------------------------------------------------------------------------
  460.   # ○ オブジェクト初期化
  461.   #--------------------------------------------------------------------------
  462.   def initialize
  463.     # メーター群の生成
  464.     @meters = []
  465.     for i in 0...$game_party.actors.size
  466.       make_meter(i)
  467.     end
  468.     refresh
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # ○ リフレッシュ
  472.   #--------------------------------------------------------------------------
  473.   def refresh
  474.     # 戦闘メンバー数の変更を判別
  475.     for i in @meters.size...$game_party.actors.size
  476.       make_meter(i)
  477.     end
  478.     for i in [email protected]
  479.       @meters[i].dispose
  480.       @meters[i] = nil
  481.     end
  482.     @meters.compact!
  483.     # 表示更新
  484.     for i in 0...$game_party.actors.size
  485.       actor = $game_party.actors[i]
  486.       @meters[i].line   = actor.cp_linetype
  487.       @meters[i].amount = actor.cp_lineamount
  488.     end
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ○ メーターひとつの生成
  492.   #--------------------------------------------------------------------------
  493.   def make_meter(i)
  494.     # スキンの取得
  495.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  496.     #
  497.     space = 640 / XRXS65::MAX
  498.     case XRXS65::ALIGN
  499.     when 0
  500.       actor_x = i * space + 4
  501.     when 1
  502.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  503.     when 2
  504.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  505.     end
  506.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  507.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  508.     meter.y = XRXS65::Y_OFFSET
  509.     @meters[i] = meter
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ○ 可視状態
  513.   #--------------------------------------------------------------------------
  514.   def visible=(b)
  515.     @meters.each{|sprite| sprite.visible = b }
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ○ 解放
  519.   #--------------------------------------------------------------------------
  520.   def dispose
  521.     @meters.each{|sprite| sprite.dispose }
  522.   end
  523. end
  524. #==============================================================================
  525. # --- XRXS. レクタンギュラーメーター表示・極 ---
  526. #==============================================================================
  527. class MeterSprite < Sprite
  528.   #--------------------------------------------------------------------------
  529.   # ○ オブジェクト初期化
  530.   #--------------------------------------------------------------------------
  531.   def initialize(skin, line_height)
  532.     @skin   = skin
  533.     @width  = @skin.width
  534.     @height = line_height
  535.     @line   = 1
  536.     @amount = 0
  537.     @base_sprite = Sprite.new
  538.     @base_sprite.bitmap = @skin
  539.     @base_sprite.src_rect.set(0, 0, @width, @height)
  540.     @base_sprite.z = 601
  541.     super()
  542.     self.z = @base_sprite.z + 1
  543.     self.bitmap = @skin
  544.     self.line = 1
  545.   end
  546.   #--------------------------------------------------------------------------
  547.   # ○ 値の設定
  548.   #--------------------------------------------------------------------------
  549.   def line=(n)
  550.     @line = n
  551.     refresh
  552.   end
  553.   def amount=(n)
  554.     @amount = n
  555.     refresh
  556.   end
  557.   def refresh
  558.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # ○ 座標の設定
  562.   #--------------------------------------------------------------------------
  563.   def x=(n)
  564.     super
  565.     @base_sprite.x = n
  566.   end
  567.   def y=(n)
  568.     super
  569.     @base_sprite.y = n
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ○ 解放
  573.   #--------------------------------------------------------------------------
  574.   def dispose
  575.     @base_sprite.dispose
  576.     super
  577.   end
  578. end
复制代码


AX追加

  1. # ▼▲▼ XRXS65A. CP制御ターンシステム「シンセ・ゲージ」 ▼▲▼ built201202
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # □ カスタマイズポイント
  5. #==============================================================================
  6. class XRXS65A
  7.   #--------------------------------------------------------------------------
  8.   # 「アイコン設定」
  9.   #--------------------------------------------------------------------------
  10.   DEFAULT = "Feather" # ディフォルトアイコン
  11.   # アイコンハッシュ  記述方式 : アクターID=>アイコン名
  12.   ICONS = {
  13.     1=>"z1",
  14.     2=>"z2",
  15.     3=>"z3",
  16.     4=>"z4",
  17.     5=>"z5",
  18.     6=>"z6",
  19.     7=>"z7",
  20.     8=>"z8",
  21.     9=>"z9",
  22.     10=>"z10",
  23.     11=>"z11",
  24.     12=>"z12",
  25.     13=>"z13",
  26.     14=>"z14",
  27.     15=>"z15",
  28.     16=>"z16",
  29.     17=>"z17",
  30.     18=>"z18",
  31.    
  32.   }
  33.   # アイコンハッシュE  記述方式 : エネミーID=>アイコン名
  34.   ICONE = {
  35.     1=>"Feather",
  36.   }
  37.   #--------------------------------------------------------------------------
  38.   # 「シンセ・ゲージ」
  39.   #--------------------------------------------------------------------------
  40.   SKIN = "Line"  # スキン
  41.   X    =  16         # X 座標
  42.   Y    =  18 # Y 座標
  43. end
  44. #==============================================================================
  45. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ --- [再定義]
  46. #==============================================================================
  47. class CP_Meters
  48.   #--------------------------------------------------------------------------
  49.   # ○ オブジェクト初期化
  50.   #--------------------------------------------------------------------------
  51.   def initialize
  52.     # シンセゲージの生成
  53.     @base = Sprite.new
  54.     @base.bitmap = RPG::Cache.windowskin(XRXS65A::SKIN).dup
  55.     @base.x = XRXS65A::X
  56.     @base.y = XRXS65A::Y
  57.     @base.z = XRXS65A::X
  58.     @width  = @base.bitmap.width
  59.     @height = @base.bitmap.height
  60.     @icon_set = []
  61.     refresh
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ○ リフレッシュ
  65.   #--------------------------------------------------------------------------
  66.   def refresh
  67.     # 生成すべきバトラーの取得
  68.     need_initializes = []
  69.     for battler in $game_party.actors + $game_troop.enemies
  70.       exist = false
  71.       for set in @icon_set
  72.       set[0].visible = true if set[0].visible ==false
  73.         exist |= (set[1] == battler)
  74.       end
  75.       need_initializes.push(battler) unless exist
  76.     end
  77.     for battler in need_initializes
  78.       iconname = nil
  79.       if battler.is_a?(Game_Actor)
  80.         iconname = XRXS65A::ICONS[battler.id]
  81.       else
  82.         iconname = XRXS65A::ICONE[battler.id]
  83.       end
  84.       if iconname == nil
  85.         iconname = XRXS65A::DEFAULT
  86.       end
  87.       sprite = Sprite.new
  88.       sprite.bitmap = RPG::Cache.icon(iconname).dup
  89.       sprite.y = XRXS65A::Y + @height / 2 - 12
  90.       @icon_set.push([sprite, battler])
  91.     end
  92.     # 更新
  93.     for set in @icon_set
  94.       set[0].x = XRXS65A::X + @width * set[1].cp / set[1].max_cp - 12
  95.       set[0].z = set[0].x
  96.       set[0].visible = false if set[1].dead? or !set[1].exist?
  97.     end
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ○ 可視状態
  101.   #--------------------------------------------------------------------------
  102.   def visible=(b)
  103.     @base.visible = b
  104.     @icon_set.each{|set| set[0].visible = b }
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ○ 解放
  108.   #--------------------------------------------------------------------------
  109.   def dispose
  110.     @base.dispose
  111.     @icon_set.each{|set| set[0].dispose }
  112.   end
  113. end
复制代码


豪华版技能冷却系统

  1. #=======================================================================
  2. #  豪华版技能冷却系统 By 绿发的Eclair
  3. #  使用方法:在特技名称后面用半角逗号分割,写上冷却回合数。
  4. #  比如 十字斩,10 就是特技 十字斩 冷却10个回合了。
  5. #  注意这个冷却是敌我通用的,不只是我方,敌人也不会使用冷却中的技能哦。
  6. #  不想让特技窗口中显示冷却回合数, $冷却时间显示 = false 就行了。
  7. #  冲突性:存在,但是除了RTAB外似乎整合难度不大。
  8. #=======================================================================
  9. $冷却时间显示 = true
  10. module RPG
  11.   class Skill
  12.   def cold
  13.     return @name.split(/,/)[1]
  14.   end
  15.   def name(actor = nil)
  16.     if $冷却时间显示 and actor != nil and actor.cold[@id] != nil
  17.       a = (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  18.       return a + "(" + actor.cold[@id].to_s + "回合冷却)"
  19.     else
  20.       return (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  21.     end
  22.   end
  23.   end
  24. end
  25. class Game_Battler
  26.   attr_accessor :cold
  27.   alias initialize_cold :initialize
  28.   def initialize
  29.     @cold = {}
  30.     initialize_cold
  31.   end
  32.   def set_cold(key,val)
  33.     return if @cold[key] == nil
  34.     @cold[key] += val
  35.     @cold.delete(key) if @cold[key] <= 0
  36.   end
  37.   alias skill_can_use_addcold :skill_can_use?
  38.   def skill_can_use?(skill_id)
  39.     return false if @cold[skill_id] != nil
  40.     skill_can_use_addcold(skill_id)
  41.   end
  42. end
  43. class Scene_Battle
  44.   alias make_skill_action_result_addcold :make_skill_action_result
  45.   def make_skill_action_result
  46.     make_skill_action_result_addcold
  47.     if @skill.cold.to_i != 0
  48.     @active_battler.cold[@skill.id] = @skill.cold.to_i
  49.     end
  50.   end
  51.   alias start_phase4_addcold :start_phase4
  52.   def start_phase4
  53.     for i in $game_party.actors + $game_troop.enemies
  54.       for j in i.cold.keys
  55.       i.set_cold(j,-1)
  56.       end  
  57.     end  
  58.     start_phase4_addcold
  59.   end   
  60. end  
  61. class Window_Skill < Window_Selectable
  62.     def draw_item(index)
  63.     skill = @data[index]
  64.     if @actor.skill_can_use?(skill.id)
  65.       self.contents.font.color = normal_color
  66.     else
  67.       self.contents.font.color = disabled_color
  68.     end
  69.     x = 4 + index % 2 * (288 + 32)
  70.     y = index / 2 * 32
  71.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  72.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  73.     bitmap = RPG::Cache.icon(skill.icon_name)
  74.     opacity = self.contents.font.color == normal_color ? 255 : 128
  75.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  76.     if $scene.is_a?(Scene_Battle)
  77.     self.contents.draw_text(x + 28, y, 204, 32, skill.name(@actor), 0)
  78.     else
  79.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  80.     end
  81.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  82.   end
  83. end

  84. class Game_Enemy < Game_Battler
  85.     def make_action
  86.     # 清除当前行动
  87.     self.current_action.clear
  88.     # 无法行动的情况
  89.     unless self.movable?
  90.       # 过程结束
  91.       return
  92.     end
  93.     # 抽取现在有效的行动
  94.     available_actions = []
  95.     rating_max = 0
  96.     for action in self.actions
  97.       # 确认回合条件
  98.       n = $game_temp.battle_turn
  99.       a = action.condition_turn_a
  100.       b = action.condition_turn_b
  101.       if (b == 0 and n != a) or
  102.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  103.         next
  104.       end
  105.       # 确认 HP 条件
  106.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  107.         next
  108.       end
  109.       if self.cold[action.skill_id] != nil
  110.         next
  111.       end
  112.       # 确认等级条件
  113.       if $game_party.max_level < action.condition_level
  114.         next
  115.       end
  116.       # 确认开关条件
  117.       switch_id = action.condition_switch_id
  118.       if switch_id > 0 and $game_switches[switch_id] == false
  119.         next
  120.       end
  121.       # 符合条件 : 添加本行动
  122.       available_actions.push(action)
  123.       if action.rating > rating_max
  124.         rating_max = action.rating
  125.       end
  126.     end
  127.     # 最大概率值作为 3 合计计算(0 除外)
  128.     ratings_total = 0
  129.     for action in available_actions
  130.       if action.rating > rating_max - 3
  131.         ratings_total += action.rating - (rating_max - 3)
  132.       end
  133.     end
  134.     # 概率合计不为 0 的情况下
  135.     if ratings_total > 0
  136.       # 生成随机数
  137.       value = rand(ratings_total)
  138.       # 设置对应生成随机数的当前行动
  139.       for action in available_actions
  140.         if action.rating > rating_max - 3
  141.           if value < action.rating - (rating_max - 3)
  142.             self.current_action.kind = action.kind
  143.             self.current_action.basic = action.basic
  144.             self.current_action.skill_id = action.skill_id
  145.             self.current_action.decide_random_target_for_enemy
  146.             return
  147.           else
  148.             value -= action.rating - (rating_max - 3)
  149.           end
  150.         end
  151.       end
  152.     end
  153.   end
  154. end
  155. #=======================================================================
  156. #豪华版技能冷却系统
  157. #======================================================================
复制代码


恳请有心人测试一下,不需要多久的。HELP ME!!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-8-9 15:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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