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

Project1

 找回密码
 注册会员
搜索
查看: 2387|回复: 5

[已经过期] 关于CP制和豪华版冷却系统脚本的冲突问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
459
在线时间
69 小时
注册时间
2018-11-23
帖子
6
发表于 2020-2-1 20:44:18 | 显示全部楼层 |阅读模式

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

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

x
如题,使用了绿发的Eclair的豪华版技能冷却系统加上CP制....结果因为CP制的人物行动问题,回合乱了...请问,有什么能让这两个脚本兼容的办法么。
RUBY 代码复制
  1. # ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # □ カスタマイズポイント
  6. #==============================================================================
  7. module XRXS65
  8.         #
  9.         # 「バトルスピード」(数値が高いほど早い)  战斗速度,数值越高越快
  10.         #
  11.         SPEED = 1.0
  12.         #
  13.         # 戦闘開始時 CP。 固定値と占有率
  14.         #
  15.         CP_PRESET_FIXNUM = 0
  16.         CP_PRESET_RATIO  = 2.0
  17.         #
  18.         # ターンコントローラ (nil  : カウント/ターンを有効。
  19.         #                     数値 : そのインデックスをもつエネミーが支配)
  20.         #
  21.         TC = 0
  22.         #
  23.         # カウント/ターン (TCが有効な場合は無視)
  24.         #
  25.         CPT = 40
  26.         #
  27.         # CP スキン
  28.         #
  29.         SKIN        = "123"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  30.         LINE_HEIGHT =  6        # スキンの"一行"の縦幅[単位:ピクセル]
  31.         #
  32.         # 表示位置セッティング
  33.         #
  34.         X_OFFSET = 144    # 横位置
  35.         Y_OFFSET = 464    # 縦位置
  36.         ALIGN    =   1    #「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  37.         MAX      =   4    # 確保するサイズ[単位:~人分]
  38.         #
  39.         # アクターコマンドがポップしたときの効果音
  40.         #
  41.         COMMAND_UP_SE = "Audio/SE/Decision2"
  42.   CPADD_SKILLLIST = {194=>5660,190=>12767 } #新增#用于设定技能的cp跳条值 格式:技能id => cp跳条值
  43. end
  44. #==============================================================================
  45. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  46. #==============================================================================
  47. module XRXS_CP
  48.         #--------------------------------------------------------------------------
  49.         # ○ スキンライン (スキンの何行目を使うか)
  50.         #--------------------------------------------------------------------------
  51.         def cp_linetype
  52.                 # CP フルの場合はスキンの 2 行目を使う
  53.                 return 2 if self.cp_full?
  54.                 # 通常はスキンの 1 行目を使う
  55.                 return 1
  56.         end
  57.         #--------------------------------------------------------------------------
  58.         # ○ メーター量[単位:%]
  59.         #--------------------------------------------------------------------------
  60.         def cp_lineamount
  61.                 # 戦闘不能の場合は 0 %として表示させる
  62.                 return 0 if self.dead?
  63.                 # CP値を%値に変換して返却する
  64.                 return 100 * self.cp / self.max_cp
  65.         end
  66. end
  67. #
  68. # カスタマイズポイントここまで。
  69. #------------------------------------------------------------------------------
  70.  
  71.  
  72.  
  73. #==============================================================================
  74. # --- XRXS. CP機構 ---
  75. #==============================================================================
  76. module XRXS_CP_SYSTEM
  77.         #----------------------------------------------------------------------------
  78.         # ○ 合計 AGI の取得
  79.         #----------------------------------------------------------------------------
  80.         def self.total_agi
  81.                 total = 0
  82.                 for battler in $game_party.actors + $game_troop.enemies
  83.                         total += battler.agi
  84.                 end
  85.                 return total
  86.         end
  87. end
  88. #==============================================================================
  89. # --- バトラーにCP機能を追加 モジュール ---
  90. #==============================================================================
  91. module XRXS_CP
  92.         #--------------------------------------------------------------------------
  93.         # ○ 最大 CP の取得
  94.         #--------------------------------------------------------------------------
  95.         def max_cp
  96.                 return 65535
  97.         end
  98.         #--------------------------------------------------------------------------
  99.         # ○ CP の取得と設定
  100.         #--------------------------------------------------------------------------
  101.         def cp
  102.                 return @cp == nil ? @cp = 0 : @cp
  103.         end
  104.         def cp=(n)
  105.                 @cp = [[n.to_i, 0].max, self.max_cp].min
  106.         end
  107.         #--------------------------------------------------------------------------
  108.         # ○ CP 初期設定
  109.         #--------------------------------------------------------------------------
  110.         def cp_preset
  111.                 percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  112.                 self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  113.         end
  114.         #--------------------------------------------------------------------------
  115.         # ○ CP カウントアップ
  116.         #--------------------------------------------------------------------------
  117.         def cp_update
  118.                 self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  119.         end
  120.         #--------------------------------------------------------------------------
  121.         # ○ CP 満タン?CP满值
  122.         #--------------------------------------------------------------------------
  123.         def cp_full?
  124.                 return @cp == self.max_cp
  125.         end
  126. end
  127. class Game_Battler
  128.         include XRXS_CP
  129. end
  130. #==============================================================================
  131. # --- ガード機能 ---
  132. #==============================================================================
  133. class Game_Battler
  134.         #--------------------------------------------------------------------------
  135.         # ○ ガードフラグ
  136.         #--------------------------------------------------------------------------
  137.         def guarding=(n)
  138.                 @guarding = n
  139.         end
  140.         #--------------------------------------------------------------------------
  141.         # ● 防御中判定 [再定義]
  142.         #--------------------------------------------------------------------------
  143.         def guarding?
  144.                 return @guarding
  145.         end
  146. end
  147. #==============================================================================
  148. # --- アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  149. #==============================================================================
  150. module XRXS_CP_INPUTABLE
  151.         def inputable?
  152.                 return (self.cp_full? and super)
  153.         end
  154.  
  155.   def inputable_zcl_fix?
  156.     return (self.cp_full? and exist?)
  157.   end
  158. end
  159. class Game_Actor < Game_Battler
  160.         include XRXS_CP_INPUTABLE
  161. end
  162. #==============================================================================
  163. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  164. #==============================================================================
  165. module XRXS_CP_MOVABLE
  166.         def movable?
  167.                 return (self.cp_full? and super)
  168.         end
  169. end
  170. class Game_Enemy < Game_Battler
  171.         include XRXS_CP_MOVABLE
  172. end
  173. #==============================================================================
  174. # --- 戦闘時 CPカウント ---
  175. #==============================================================================
  176. module XRXS_CP_Battle
  177.         #--------------------------------------------------------------------------
  178.         # ○ パーティ全員の CP を初期設定
  179.         #--------------------------------------------------------------------------
  180.         def cp_preset_party
  181.                 #p $game_party.actors.size
  182.                 i = 0
  183.                 for actor in $game_party.actors
  184.                         actor.cp_preset
  185.                         if actor.cp_full?
  186.                                 if i == 0
  187.                                         i += 1
  188.                                 else         
  189.                                         actor.cp -= 1         
  190.                                 end
  191.                         end
  192.                 end
  193.         end
  194.         #--------------------------------------------------------------------------
  195.         # ○ トループ全員の CP を初期設定
  196.         #--------------------------------------------------------------------------
  197.         def cp_preset_troop
  198.                 for enemy in $game_troop.enemies
  199.                         enemy.cp_preset
  200.                 end
  201.         end
  202.         #--------------------------------------------------------------------------
  203.         # ○ バトラー全員の CP をカウントアップ
  204.         #--------------------------------------------------------------------------
  205.         def cp_update
  206.                 #p $game_party.actors.size
  207.                 #for battler in $game_party.actors + $game_troop.enemies
  208.                 #  battler.cp_update
  209.                 #end
  210.                 i = 0
  211.                 for battler in $game_party.actors + $game_troop.enemies
  212.                         battler.cp_update
  213.                         if battler.cp_full?
  214.                                 if i == 0
  215.                                         i += 1
  216.                                 else
  217.                                         battler.cp -= 1
  218.                                 end
  219.                         end
  220.                 end
  221.                 @fuck_helper.cp_update if @fuck_helper != nil
  222.         end
  223. end
  224. class Scene_Battle
  225.         include XRXS_CP_Battle
  226. end
  227. #==============================================================================
  228. # ■ Scene_Battle
  229. #==============================================================================
  230. class Scene_Battle
  231.         #--------------------------------------------------------------------------
  232.         # ● メイン処理
  233.         #--------------------------------------------------------------------------
  234.         alias xrxs65_main main
  235.         def main
  236.                 # エクストラスプライトの初期化
  237.                 @extra_sprites = [] if @extra_sprites == nil
  238.                 # CP の初期化
  239.                 cp_preset_party
  240.                 # CP メーターの作成
  241.                 @cp_meters = CP_Meters.new
  242.                 # CP メーターをエクストラスプライトへ登録
  243.                 @extra_sprites.push(@cp_meters)
  244.                 # 呼び戻す
  245.                 #    p $game_party.actors.size
  246.                 xrxs65_main
  247.                 # メーターの解放
  248.                 @cp_meters.dispose
  249.         end
  250.         #--------------------------------------------------------------------------
  251.         # ● プレバトルフェーズ開始
  252.         #--------------------------------------------------------------------------
  253.         alias xrxs65_start_phase1 start_phase1
  254.         def start_phase1
  255.                 # 呼び戻す
  256.                 xrxs65_start_phase1
  257.                 # CP の初期化
  258.                 cp_preset_troop
  259.                 # CP メーターの更新
  260.                 @cp_meters.refresh
  261.                 # インデックスを計算
  262.                 @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  263.                 # アクターコマンドウィンドウに追加
  264.                 #@actor_command_window.add_command("逃跑")
  265.                 #    if !$game_temp.battle_can_escape
  266.                 #      @actor_command_window.disable_item(@cp_escape_actor_command_index)
  267.                 #    end
  268.         end
  269.         #--------------------------------------------------------------------------
  270.         # ● パーティコマンドフェーズ開始
  271.         #--------------------------------------------------------------------------
  272.         alias xrxs65_start_phase2 start_phase2
  273.         def start_phase2
  274.                 # 呼び戻す
  275.                 xrxs65_start_phase2
  276.                 # パーティコマンドウィンドウを無効化
  277.                 @party_command_window.active  = false
  278.                 @party_command_window.visible = false
  279.                 # 強制的にフェイズ 2 を保持
  280.  
  281.                 @phase = 2
  282.                 # ただし、既に行動可能者が存在する場合は 3 へ
  283.                 start_phase3 if anybody_movable?
  284.         end
  285.         #--------------------------------------------------------------------------
  286.         # ○ CP制での ターンのカウント
  287.         #--------------------------------------------------------------------------
  288.         def cp_turn_count
  289.                 $game_temp.battle_turn += 1
  290.                 # バトルイベントの全ページを検索
  291.                 for index in 0...$data_troops[@troop_id].pages.size
  292.                         # このページのスパンが [ターン] の場合
  293.                         if $data_troops[@troop_id].pages[index].span == 1
  294.                                 # 実行済みフラグをクリア
  295.                                 $game_temp.battle_event_flags[index] = false
  296.                         end
  297.                 end
  298.         end
  299.         #--------------------------------------------------------------------------
  300.         # ● フレーム更新 (パーティコマンドフェーズ)
  301.         #--------------------------------------------------------------------------
  302.         alias xrxs65_update_phase2 update_phase2
  303.         def update_phase2
  304.                 # パーティコマンドウィンドウのインデックスを無効化
  305.                 @party_command_window.index = -1
  306.                 # 呼び戻す
  307.                 xrxs65_update_phase2
  308.                 # 例外補正
  309.                 @turn_count_time = 1 if @turn_count_time == nil
  310.                 # ターンのカウント
  311.                 if @turn_count_time > 0
  312.                         @turn_count_time -= 1
  313.                         if @turn_count_time == 0
  314.                                 cp_turn_count
  315.                                 @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  316.                         end
  317.                 end
  318.                 # CP のフレーム更新
  319.                 cp_update
  320.                 @cp_meters.refresh
  321.                 # フル CP のバトラーが存在する場合、ターン開始
  322.                 start_phase3 if anybody_movable?
  323.         end
  324.         #--------------------------------------------------------------------------
  325.         # ○ フル CP バトラーが存在するか?
  326.         #--------------------------------------------------------------------------
  327.         def anybody_movable?
  328.                 for battler in $game_party.actors + $game_troop.enemies
  329.                         return true if battler.cp_full?
  330.                 end
  331.                 #p "Full" if @fuck_helper.cp_full?
  332.                 if @fuck_helper != nil
  333.                         return true if @fuck_helper.cp_full?
  334.                 end
  335.                 return false
  336.         end
  337.         #--------------------------------------------------------------------------
  338.         # ● アクターコマンドウィンドウのセットアップ
  339.         #--------------------------------------------------------------------------
  340.         alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  341.         def phase3_setup_command_window
  342.                 # 効果音の再生
  343.                 Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  344.                 # 呼び戻す
  345.                 xrxs65_phase3_setup_command_window
  346.         end
  347.         #--------------------------------------------------------------------------
  348.         # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  349.         #--------------------------------------------------------------------------
  350.         alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  351.         def update_phase3_basic_command
  352.     if Input.trigger?(Input::B) then return end
  353.                 # C ボタンが押された場合
  354.                 if Input.trigger?(Input::C)
  355.                         # アクターコマンドウィンドウのカーソル位置で分岐
  356.                         case @actor_command_window.index
  357.                         when @cp_escape_actor_command_index # 逃げる
  358.                                 if $game_temp.battle_can_escape
  359.                                         # 決定 SE を演奏
  360.                                         $game_system.se_play($data_system.decision_se)
  361.                                         # アクションを設定
  362.                                         @active_battler.current_action.kind = 0
  363.                                         @active_battler.current_action.basic = 4
  364.                                         # 次のアクターのコマンド入力へ
  365.                                         phase3_next_actor
  366.                                 else
  367.                                         # ブザー SE を演奏
  368.                                         $game_system.se_play($data_system.buzzer_se)
  369.                                 end
  370.                                 return
  371.                         end
  372.                 end
  373.                 # 呼び戻す
  374.                 xrxs_bsp1_update_phase3_basic_command
  375.         end
  376.         #--------------------------------------------------------------------------
  377.         # ● メインフェーズ開始
  378.         #--------------------------------------------------------------------------
  379.         alias xrxs65_start_phase4 start_phase4
  380.         def start_phase4
  381.                 # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  382.                 $game_temp.battle_turn -= 1
  383.                 # フラグを退避
  384.                 save_flags = $game_temp.battle_event_flags.dup
  385.                 # 呼び戻す
  386.                 xrxs65_start_phase4
  387.                 # フラグを復旧
  388.                 $game_temp.battle_event_flags = save_flags
  389.         end
  390.         #--------------------------------------------------------------------------
  391.         # ● 行動順序作成
  392.         #--------------------------------------------------------------------------
  393.         alias xrxs65_make_action_orders make_action_orders
  394.         def make_action_orders
  395.                 # 呼び戻す
  396.                 xrxs65_make_action_orders
  397.                 # CPが不足している場合は @action_battlers から除外する
  398.                 for battler in @action_battlers.dup
  399.                         @action_battlers.delete(battler) unless battler.cp_full?# || battler.id == @fuck_helper.id
  400.                 end
  401.         end
  402.         #--------------------------------------------------------------------------
  403.         # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  404.         #--------------------------------------------------------------------------
  405.         alias xrxs65_update_phase4_step2 update_phase4_step2
  406.         def update_phase4_step2
  407.                 # ガードの解除
  408.                 @active_battler.guarding = false
  409.                 # CPの消費
  410.                 @active_battler.cp = 0
  411.                 #p @active_battler.name,@active_battler.cp
  412.                 # CP メーターの更新
  413.                 @cp_meters.refresh
  414.                 # 呼び戻す
  415.                 xrxs65_update_phase4_step2
  416.                 # 例外補正
  417.                 return if @active_battler == nil
  418.                 # ターンコントローラ
  419.                 if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  420.                         cp_turn_count
  421.                 end
  422.         end
  423.         #--------------------------------------------------------------------------
  424.         # ● 基本アクション 結果作成
  425.         #--------------------------------------------------------------------------
  426.         alias xrxs65_make_basic_action_result make_basic_action_result
  427.         def make_basic_action_result
  428.                 # 呼び戻す
  429.                 xrxs65_make_basic_action_result
  430.                 # 防御の場合
  431.                 if @active_battler.current_action.basic == 1
  432.                         @active_battler.guarding = true
  433.                         return
  434.                 end
  435.                 # パーティの逃亡の場合
  436.                 if @active_battler.current_action.basic == 4
  437.                         # 逃走可能ではない場合
  438.                         if $game_temp.battle_can_escape == false
  439.                                 # ブザー SE を演奏
  440.                                 $game_system.se_play($data_system.buzzer_se)
  441.                                 return
  442.                         end
  443.                         # パーティ全員の CP をクリア
  444.                         for actor in $game_party.actors
  445.                                 actor.cp = 0
  446.                         end
  447.                         # CP メーターの更新
  448.                         @cp_meters.refresh
  449.                         # 逃走処理
  450.                         update_phase2_escape
  451.                         return
  452.                 end
  453.         end
  454.         #--------------------------------------------------------------------------
  455.         # ● 特技アクション 結果作成
  456.         #--------------------------------------------------------------------------
  457.         alias xrxs65_make_skill_action_result make_skill_action_result
  458.         def make_skill_action_result
  459.                 # 呼び戻す的
  460.                 xrxs65_make_skill_action_result
  461.                 if XRXS65::CPADD_SKILLLIST.keys.include?(@skill.id)
  462.                         cp_add = XRXS65::CPADD_SKILLLIST[@skill.id]
  463.       list = []
  464.       if @active_battler.is_a?(Game_Actor)
  465.         for battler in $game_party.actors
  466.           num = (XRXS65::CPADD_SKILLLIST[@skill.id] / (XRXS65::SPEED * 4096 * battler.agi / XRXS_CP_SYSTEM.total_agi)).ceil
  467.           #p num
  468.           for i in 0...num
  469.             for battler2 in $game_party.actors
  470.             if battler2.cp >= battler2.max_cp
  471.               battler2.cp = battler2.max_cp - i-1
  472.               break
  473.             end
  474.             battler2.cp_update
  475.             @cp_meters.refresh
  476.             Graphics.update
  477.             end
  478.           end
  479.         end
  480.       end
  481.       if @active_battler.is_a?(Game_Enemy)
  482.         for battler in $game_party.enemies
  483.           num = (XRXS65::CPADD_SKILLLIST[@skill.id] / (XRXS65::SPEED * 4096 * battler.agi / XRXS_CP_SYSTEM.total_agi)).ceil
  484.           for i in 0...num
  485.             if battler.cp >= battler.max_cp
  486.               battler.cp = battler.max_cp
  487.               break
  488.             end
  489.             battler.cp_update
  490.             Graphics.update
  491.           end
  492.         end
  493.       end
  494.     end
  495.         end
  496.         #--------------------------------------------------------------------------
  497.         # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  498.         #--------------------------------------------------------------------------
  499.         alias xrxs65_update_phase4_step5 update_phase4_step5
  500.         def update_phase4_step5
  501.                 # 呼び戻す
  502.                 xrxs65_update_phase4_step5
  503.                 # CP メーターの更新
  504.                 @cp_meters.refresh
  505.         end
  506. end
  507. #==============================================================================
  508. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  509. #==============================================================================
  510. class CP_Meters
  511.         #--------------------------------------------------------------------------
  512.         # ○ オブジェクト初期化
  513.         #--------------------------------------------------------------------------
  514.         def initialize
  515.                 # メーター群の生成
  516.                 @meters = []
  517.                 for i in 0...$game_party.actors.size
  518.                         make_meter(i)
  519.                 end
  520.                 refresh
  521.         end
  522.         #--------------------------------------------------------------------------
  523.         # ○ リフレッシュ
  524.         #--------------------------------------------------------------------------
  525.         def refresh
  526.                 # 戦闘メンバー数の変更を判別
  527.                 for i in @meters.size...$game_party.actors.size
  528.                         make_meter(i)
  529.                 end
  530.                 for i in $game_party.actors.size...@meters.size
  531.                         @meters[i].dispose
  532.                         @meters[i] = nil
  533.                 end
  534.                 @meters.compact!
  535.                 # 表示更新
  536.                 for i in 0...$game_party.actors.size
  537.                         actor = $game_party.actors[i]
  538.                         @meters[i].line   = actor.cp_linetype
  539.                         @meters[i].amount = actor.cp_lineamount
  540.                 end
  541.         end
  542.         #--------------------------------------------------------------------------
  543.         # ○ メーターひとつの生成
  544.         #--------------------------------------------------------------------------
  545.         def make_meter(i)
  546.                 # スキンの取得
  547.                 skin = RPG::Cache.windowskin(XRXS65::SKIN)
  548.                 #
  549.                 space = 640 / XRXS65::MAX
  550.                 case XRXS65::ALIGN
  551.                 when 0
  552.                         actor_x = i * space + 4
  553.                 when 1
  554.                         actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  555.                 when 2
  556.                         actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  557.                 end
  558.                 meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  559.                 meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  560.                 meter.y = XRXS65::Y_OFFSET
  561.                 @meters[i] = meter
  562.         end
  563.         #--------------------------------------------------------------------------
  564.         # ○ 可視状態
  565.         #--------------------------------------------------------------------------
  566.         def visible=(b)
  567.                 @meters.each{|sprite| sprite.visible = b }
  568.         end
  569.         #--------------------------------------------------------------------------
  570.         # ○ 解放
  571.         #--------------------------------------------------------------------------
  572.         def dispose
  573.                 @meters.each{|sprite| sprite.dispose }
  574.         end
  575. end
  576. #==============================================================================
  577. # --- XRXS. レクタンギュラーメーター表示・極 ---
  578. #==============================================================================
  579. class MeterSprite < Sprite
  580.         #--------------------------------------------------------------------------
  581.         # ○ オブジェクト初期化
  582.         #--------------------------------------------------------------------------
  583.         def initialize(skin, line_height)
  584.                 @skin   = skin
  585.                 @width  = @skin.width
  586.                 @height = line_height
  587.                 @line   = 1
  588.                 @amount = 0
  589.                 @base_sprite = Sprite.new
  590.                 @base_sprite.bitmap = @skin
  591.                 @base_sprite.src_rect.set(0, 0, @width, @height)
  592.                 @base_sprite.z = 601
  593.                 super()
  594.                 self.z = @base_sprite.z + 1
  595.                 self.bitmap = @skin
  596.                 self.line = 1
  597.         end
  598.         #--------------------------------------------------------------------------
  599.         # ○ 値の設定
  600.         #--------------------------------------------------------------------------
  601.         def line=(n)
  602.                 @line = n
  603.                 refresh
  604.         end
  605.         def amount=(n)
  606.                 @amount = n
  607.                 refresh
  608.         end
  609.         def refresh
  610.                 self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  611.         end
  612.         #--------------------------------------------------------------------------
  613.         # ○ 座標の設定
  614.         #--------------------------------------------------------------------------
  615.         def x=(n)
  616.                 super
  617.                 @base_sprite.x = n
  618.         end
  619.         def y=(n)
  620.                 super
  621.                 @base_sprite.y = n
  622.         end
  623.         #--------------------------------------------------------------------------
  624.         # ○ 解放
  625.         #--------------------------------------------------------------------------
  626.         def dispose
  627.                 @base_sprite.dispose
  628.                 super
  629.         end
  630. end

(上面是我用的CP制)
RUBY 代码复制
  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.   #--------------------------------------------------------------------------
  27.   # ● 可以使用特技的判定
  28.   #     skill_id : 特技 ID
  29.   #--------------------------------------------------------------------------
  30.    attr_accessor :cold
  31.    alias initialize_cold :initialize
  32.    def initialize
  33.      @cold = {}
  34.      initialize_cold
  35.    end
  36.    def set_cold(key,val)
  37.      return if @cold[key] == nil
  38.      @cold[key] += val
  39.      @cold.delete(key) if @cold[key] <= 0
  40.    end
  41.    alias skill_can_use_addcold :skill_can_use?
  42.   def skill_can_use?(skill_id)
  43.     return false if @cold[skill_id] != nil
  44.     skill_can_use_addcold(skill_id)
  45.   end
  46. end
  47. #==============================================================================
  48. # ■ Scene_Battle
  49. #------------------------------------------------------------------------------
  50. #  处理战斗画面的类。
  51. #==============================================================================
  52.  
  53. class Scene_Battle
  54.    alias make_skill_action_result_addcold :make_skill_action_result
  55.    def make_skill_action_result
  56.      make_skill_action_result_addcold
  57.      if @skill.cold.to_i != 0
  58.      @active_battler.cold[@skill.id] = @skill.cold.to_i
  59.      end
  60.    end
  61.    alias start_phase4_addcold :start_phase4
  62.    def start_phase4
  63.      start_phase4_addcold
  64.    end   
  65. end
  66. #==============================================================================
  67. # ■ Window_Skill
  68. #------------------------------------------------------------------------------
  69. #  特技画面、战斗画面、显示可以使用的特技浏览的窗口。
  70. #==============================================================================
  71. class Window_Skill < Window_Selectable
  72.      def draw_item(index)
  73.      skill = @data[index]
  74.      if @actor.skill_can_use?(skill.id)
  75.        self.contents.font.color = normal_color
  76. else
  77.        self.contents.font.color = disabled_color
  78.      end
  79.      x = 4 + index % 2 * (288 + 32)
  80.      y = index / 2 * 32
  81.      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  82.      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  83.      bitmap = RPG::Cache.icon(skill.icon_name)
  84.      opacity = self.contents.font.color == normal_color ? 255 : 128
  85.      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  86.      if $scene.is_a?(Scene_Battle)
  87.      self.contents.draw_text(x + 28, y, 204, 32, skill.name(@actor), 0)
  88.      else
  89.      self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  90.      end
  91.      self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)if skill.occasion !=3
  92.      self.contents.draw_text(x + 232, y, 48, 32, "被动", 2) if skill.occasion == 3
  93.    end
  94. end
  95. #==============================================================================
  96. # ■ Game_Enemy
  97. #------------------------------------------------------------------------------
  98. #  处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
  99. # 内部使用。
  100. #==============================================================================
  101.  
  102. class Game_Enemy < Game_Battler
  103.      def make_action
  104.      # 清除当前行动
  105.      self.current_action.clear
  106.      # 无法行动的情况
  107.      unless self.movable?
  108.        # 过程结束
  109.        return
  110.      end
  111.      # 抽取现在有效的行动
  112.      available_actions = []
  113.      rating_max = 0
  114.      for action in self.actions
  115.        # 确认回合条件
  116.        n = $game_temp.battle_turn
  117.        a = action.condition_turn_a
  118.        b = action.condition_turn_b
  119.        if (b == 0 and n != a) or
  120.           (b > 0 and (n < 1 or n < a or n % b != a % b))
  121.          next
  122.        end
  123.        # 确认 HP 条件
  124.        if self.hp * 100.0 / self.maxhp > action.condition_hp
  125.          next
  126.        end
  127.        if self.cold[action.skill_id] != nil
  128.          next
  129.        end
  130.        # 确认等级条件
  131.        if $game_party.max_level < action.condition_level
  132.          next
  133.        end
  134.        # 确认开关条件
  135.        switch_id = action.condition_switch_id
  136.        if switch_id > 0 and $game_switches[switch_id] == false
  137.   next
  138.        end
  139.        # 符合条件 : 添加本行动
  140.        available_actions.push(action)
  141.        if action.rating > rating_max
  142.          rating_max = action.rating
  143.        end
  144.      end
  145.      # 最大概率值作为 3 合计计算(0 除外)
  146.      ratings_total = 0
  147.      for action in available_actions
  148.        if action.rating > rating_max - 3
  149.          ratings_total += action.rating - (rating_max - 3)
  150.        end
  151.      end
  152.      # 概率合计不为 0 的情况下
  153.      if ratings_total > 0
  154.        # 生成随机数
  155.        value = rand(ratings_total)
  156.        # 设置对应生成随机数的当前行动
  157.        for action in available_actions
  158.          if action.rating > rating_max - 3
  159.            if value < action.rating - (rating_max - 3)
  160.              self.current_action.kind = action.kind
  161.              self.current_action.basic = action.basic
  162.              self.current_action.skill_id = action.skill_id
  163.              self.current_action.decide_random_target_for_enemy
  164.              return
  165.            else
  166.              value -= action.rating - (rating_max - 3)
  167.            end
  168.          end
  169.        end
  170.      end
  171.    end
  172. end
  173. #=======================================================================
  174. #豪华版技能冷却系统
  175. #=======================================================================

(然后这里是我用的技能冷却系统)
你再猜?

Lv3.寻梦者

梦石
0
星屑
1433
在线时间
50 小时
注册时间
2020-2-16
帖子
103
发表于 2020-2-17 17:24:56 | 显示全部楼层
请问windowskin 123 是个什么文件
流飘零半生,未逢明主。公若是不弃,流愿拜为义父
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1433
在线时间
50 小时
注册时间
2020-2-16
帖子
103
发表于 2020-2-17 17:31:06 | 显示全部楼层
123是个cp条的素材,然后经过一轮测试并没有报错
QQ截图20200217172326.png
QQ截图20200217172658.png
QQ截图20200217172705.png
QQ截图20200217172901.png
流飘零半生,未逢明主。公若是不弃,流愿拜为义父
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
459
在线时间
69 小时
注册时间
2018-11-23
帖子
6
 楼主| 发表于 2020-2-19 00:13:46 | 显示全部楼层
轩辕合流 发表于 2020-2-17 17:31
123是个cp条的素材,然后经过一轮测试并没有报错

是的,123是cp条的素材.....
你再猜?
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
946
在线时间
61 小时
注册时间
2019-12-10
帖子
97
发表于 2021-2-10 19:32:47 | 显示全部楼层
轩辕合流 发表于 2020-2-17 17:31
123是个cp条的素材,然后经过一轮测试并没有报错

我用他的冷却,在选技能后出现,43行错误
想玩我做的游戏加我qq947128749
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6116
在线时间
1089 小时
注册时间
2015-8-15
帖子
652
发表于 2022-11-9 15:51:22 | 显示全部楼层
林晨曦2233 发表于 2020-2-19 00:13
是的,123是cp条的素材.....

CP说的是攻击速度值越高越快执行, 而技能冷却说的是冷却值越低越快执行,南辕北辙。要把SPEED改一下
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 01:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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