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

Project1

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

[已经解决] 集气条战斗脚本+豪华版技能冷却脚本 的合并问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
456
在线时间
76 小时
注册时间
2020-2-23
帖子
24
跳转到指定楼层
1
发表于 2021-3-18 23:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
从网上找到了这两个脚本,但豪华版技能冷却脚本只能使用于普通的齐时战斗,对于CP集气式战斗就有了问题,同时使用的话会导致技能冷却脚本无效。
我就想着将他们两个合并一下,实现技能冷却回合数按照技能使用者之后本身的行动次数来算的这一功能。但是现在碰到了一个问题,主要集中在一个冷却方法的调用(*号标出的),删了该方法的话,技能使用一次后就一直不能用了,不删该方法的话技能无冷却CD,就想请教各位大触,这两个脚本该怎么合并,下面是两个源脚本以及我自己更改的合并脚本,合并脚本里增加的地方都用长的双重#号线段标出来了。

Lv2.观梦者

梦石
0
星屑
456
在线时间
76 小时
注册时间
2020-2-23
帖子
24
2
 楼主| 发表于 2021-3-18 23:02:16 | 只看该作者
  1. #合并版#========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #========================================================================
  4. #========================================================================
  5. # ▼▲▼ XRXS_BP 1. CP制導入 ver..23 ▼▲▼
  6. # by 桜雅 在土, 和希
  7. #------------------------------------------------------------------------
  8. # □ カスタマイズポイント
  9. #========================================================================
  10. module XRXS_BP1
  11.   #
  12.   # 对齐方式。0:左 1:中央 2:右
  13.   #
  14.   ALIGN = 0
  15.   #
  16.   # 人数
  17.   #
  18.   MAX = 4
  19. end
  20. class Scene_Battle_CP
  21.   #
  22.   # 战斗速度
  23.   #
  24.   BATTLE_SPEED = 0.5
  25.   #
  26.   # 战斗开始的时候气槽百分比
  27.   #
  28.   START_CP_PERCENT = 0
  29. end
  30. class Scene_Battle
  31.   # 效果音效,可以自己添加
  32.   DATA_SYSTEM_COMMAND_UP_SE = ""
  33.   # 各项数值功能消耗的CP值
  34.   CP_COST_BASIC_ACTIONS = 0 # 基础共同
  35.   CP_COST_SKILL_ACTION = 65535 # 技能
  36.   CP_COST_ITEM_ACTION = 65535 # 物品
  37.   CP_COST_BASIC_ATTACK = 65535 # 攻撃
  38.   CP_COST_BASIC_GUARD = 65535 # 防御
  39.   CP_COST_BASIC_NOTHING = 65535 # 不做任何事情
  40.   CP_COST_BASIC_ESCAPE = 65535 # 逃跑
  41. end
  42. #========================================================================
  43. # --- XRXS.コマンドウィンドウ?コマンド追加機構 ---
  44. #------------------------------------------------------------------------
  45. # Window_Commandクラスに add_command メソッドを追加します。
  46. #========================================================================
  47. module XRXS_Window_Command_Add_Command
  48.   #----------------------------------------------------------------------
  49.   # ○ コマンドを追加
  50.   #----------------------------------------------------------------------
  51.   def add_command(command)
  52.     # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  53.     #
  54.     if @disabled == nil
  55.       @disabled = []
  56.     end
  57.     if @commands.size != @disabled.size
  58.       for i in [email protected]
  59.         @disabled[i] = false
  60.       end
  61.     end
  62.     #
  63.     # 追加
  64.     #
  65.     @commands.push(command)
  66.     @disabled.push(false)
  67.     @item_max = @commands.size
  68.     self.y -= 32
  69.     self.height += 32
  70.     self.contents.dispose
  71.     self.contents = nil
  72.     self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  73.     refresh
  74.     for i in [email protected]
  75.       if @disabled[i]
  76.         disable_item(i)
  77.       end
  78.     end
  79.   end
  80.   #----------------------------------------------------------------------
  81.   # ○ 項目の無効化
  82.   # index : 項目番号
  83.   #----------------------------------------------------------------------
  84.   def disable_item(index)
  85.     if @disabled == nil
  86.       @disabled = []
  87.     end
  88.     @disabled[index] = true
  89.     draw_item(index, disabled_color)
  90.   end
  91. end

  92. ###############################################################
  93. ###############################################################
  94. $冷却时间显示 = true
  95. module RPG
  96.   class Skill
  97.    
  98.     def cold
  99.       return @name.split(/,/)[1]
  100.     end
  101.    
  102.     def name(actor = nil)
  103.       if $冷却时间显示 and actor != nil and actor.cold[@id] != nil
  104.         a = (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  105.         return a + "(" + actor.cold[@id].to_s + ")"
  106.       else
  107.         return (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  108.       end
  109.     end
  110.    
  111.   end
  112. end
  113. ###############################################################
  114. ###############################################################

  115. class Window_Command < Window_Selectable
  116.   #----------------------------------------------------------------------
  117.   # ○ インクルード
  118.   #----------------------------------------------------------------------
  119.   include XRXS_Window_Command_Add_Command
  120.   #----------------------------------------------------------------------
  121.   # ● 項目の無効化
  122.   # index : 項目番号
  123.   #----------------------------------------------------------------------
  124.   def disable_item(index)
  125.     super
  126.   end
  127. end



  128. #========================================================================
  129. # □ Scene_Battle_CP
  130. #========================================================================
  131. class Scene_Battle_CP
  132.   #----------------------------------------------------------------------
  133.   # ○ 公開インスタンス変数
  134.   #----------------------------------------------------------------------
  135.   attr_accessor :stop # CP加算ストップ
  136.   #----------------------------------------------------------------------
  137.   # ○ オブジェクトの初期化
  138.   #----------------------------------------------------------------------
  139.   def initialize
  140.     @battlers = []
  141.     @cancel = false
  142.     @stop = false
  143.     @agi_total = 0
  144.     # 配列 count_battlers を初期化
  145.     count_battlers = []
  146.     # エネミーを配列 count_battlers に追加
  147.     for enemy in $game_troop.enemies
  148.       count_battlers.push(enemy)
  149.     end
  150.     # アクターを配列 count_battlers に追加
  151.     for actor in $game_party.actors
  152.       count_battlers.push(actor)
  153.     end
  154.     for battler in count_battlers
  155.       @agi_total += battler.agi
  156.     end
  157.     for battler in count_battlers
  158.       battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
  159.     end
  160.   end
  161.   #----------------------------------------------------------------------
  162.   # ○ CP计数
  163.   #----------------------------------------------------------------------
  164.   def update
  165.     # 如果停止则返回
  166.     return if @stop
  167.     #
  168.     for battler in $game_party.actors + $game_troop.enemies
  169.       # 如果你不采取行动,忽略
  170.       if battler.dead? == true
  171.         battler.cp = 0
  172.         next
  173.       end
  174.       battler.cp = [[battler.cp + BATTLE_SPEED * 4096 * battler.agi / @agi_total, 0].max, 65535].min
  175.     end
  176.   end
  177.   #----------------------------------------------------------------------
  178.   # ○ 开始CP计数
  179.   #----------------------------------------------------------------------
  180.   def stop
  181.     @cancel = true
  182.     if @cp_thread != nil then
  183.       @cp_thread.join
  184.       @cp_thread = nil
  185.     end
  186.   end
  187. end



  188. #========================================================================
  189. # ■ Game_Battler*************************************
  190. #========================================================================
  191. class Game_Battler
  192.   attr_accessor :now_guarding # 現在防御中フラグ
  193.   attr_accessor :cp # 現在CP
  194.   attr_accessor :slip_state_update_ban # 禁止自动打滑状态处理
  195.   #----------------------------------------------------------------------
  196.   # ○ CP の変更
  197.   #-----------------------------------------------------------------------
  198.   
  199.   ###############################################################
  200.   ###############################################################
  201.   attr_accessor :cold
  202.   
  203.   alias initialize_cold :initialize
  204.   def initialize
  205.     @cold = {}
  206.     initialize_cold
  207.   end
  208.   
  209.   def set_cold(i,key) # i是角色编号,key为角色i的技能编号
  210.     return if i.cold[key] == nil#无冷却回合数,则返回,无需冷却-1
  211.     i.cold[key] = i.cold[key] - 1  #冷却回合数-1
  212.    
  213.     #该技能冷却回合数到0,则需该角色冷却技能序列表中,删除该编号技能
  214.     i.cold.delete(key) if i.cold[key] <= 0
  215.   end
  216.   
  217.   alias skill_can_use_addcold :skill_can_use?
  218.   def skill_can_use?(skill_id)
  219.     return false if self.cold[skill_id] != nil#角色冷却序列表中某技能为空,则可用
  220.     skill_can_use_addcold(skill_id)
  221.   end
  222.   ###############################################################
  223.   ###############################################################
  224.   
  225.   
  226.   
  227.   def cp=(p)
  228.     @cp = [[p, 0].max, 65535].min
  229.   end
  230.   #----------------------------------------------------------------------
  231.   # ● 防御中判定 [ 再定義 ]
  232.   #----------------------------------------------------------------------
  233.   def guarding?
  234.     return @now_guarding
  235.   end
  236.   #----------------------------------------------------------------------
  237.   # ● 判断是否可以输入命令
  238.   #----------------------------------------------------------------------
  239.   alias xrxs_bp1_inputable? inputable?
  240.   def inputable?
  241.     bool = xrxs_bp1_inputable?
  242.     return (bool and (@cp >= 65535))
  243.   end
  244.   #----------------------------------------------------------------------
  245.   # ● 状态[滑倒伤害]判断
  246.   #----------------------------------------------------------------------
  247.   alias xrxs_bp1_slip_damage? slip_damage?
  248.   def slip_damage?
  249.     return false if @slip_state_update_ban
  250.     return xrxs_bp1_slip_damage?
  251.   end
  252.   #----------------------------------------------------------------------
  253.   # ● 自然释放状态(每转一次)
  254.   #----------------------------------------------------------------------
  255.   alias xrxs_bp1_remove_states_auto remove_states_auto
  256.   def remove_states_auto
  257.     return if @slip_state_update_ban
  258.     xrxs_bp1_remove_states_auto
  259.   end
  260. end

  261. #========================================================================
  262. # ■ Game_Actor
  263. #========================================================================
  264. class Game_Actor < Game_Battler
  265.   #----------------------------------------------------------------------
  266.   # ● 设置
  267.   #----------------------------------------------------------------------
  268.   alias xrxs_bp1_setup setup
  269.   def setup(actor_id)
  270.     xrxs_bp1_setup(actor_id)
  271.     @cp = 0
  272.     @now_guarding = false
  273.     @slip_state_update_ban = false
  274.   end
  275. end

  276. #========================================================================
  277. # ■ Game_Enemy
  278. #========================================================================
  279. class Game_Enemy < Game_Battler
  280.   #----------------------------------------------------------------------
  281.   # ● 对象初始化
  282.   #----------------------------------------------------------------------
  283.   alias xrxs_bp1_initialize initialize
  284.   def initialize(troop_id, member_index)
  285.     xrxs_bp1_initialize(troop_id, member_index)
  286.     @cp = 0
  287.     @now_guarding = false
  288.     @slip_state_update_ban = false
  289.   end
  290. end
  291. class Window_All < Window_Base
  292.   def initialize
  293.     super(0,0,640,480)
  294.     self.opacity = 0
  295.     self.contents = Bitmap.new(width - 32, height - 32)
  296.     refresh
  297.   end
  298.   def refresh
  299.     self.contents.clear
  300.     for actor in $game_troop.enemies
  301.       next if !actor.exist?
  302.       draw_actor_cp_meter(actor, actor.screen_x-50, actor.screen_y-50, 60, 0)
  303.     end
  304.   end
  305.   #----------------------------------------------------------------------
  306.   # ○ CPメーター の描画
  307.   #----------------------------------------------------------------------
  308.   def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
  309.     self.contents.font.color = system_color
  310.     self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  311.     if actor.cp == nil
  312.       actor.cp = 0
  313.     end
  314.     w = width * [actor.cp,65535].min / 65535
  315.     self.contents.fill_rect(x, y+28, w,1, Color.new(255, 255, 128, 255))
  316.     self.contents.fill_rect(x, y+29, w,1, Color.new(255, 255, 0, 255))
  317.     self.contents.fill_rect(x, y+30, w,1, Color.new(192, 192, 0, 255))
  318.     self.contents.fill_rect(x, y+31, w,1, Color.new(128, 128, 0, 255))
  319.   end  
  320. end

  321. #========================================================================
  322. # ■ Window_BattleStatus
  323. #========================================================================
  324. class Window_BattleStatus < Window_Base
  325.   #-----------------------------------------------------------------------
  326.   # ○ 公共实例变量
  327.   #----------------------------------------------------------------------
  328.   attr_accessor :update_cp_only # 仅CP表更新
  329.   #----------------------------------------------------------------------
  330.   # ● 对象初始化
  331.   #----------------------------------------------------------------------
  332.   alias xrxs_bp1_initialize initialize
  333.   def initialize
  334.     @update_cp_only = false
  335.     @wall = Window_All.new
  336.     xrxs_bp1_initialize
  337.   end
  338.   def dispose
  339.     super
  340.     @wall.dispose
  341.   end
  342.   #----------------------------------------------------------------------
  343.   # ● 刷新
  344.   #----------------------------------------------------------------------
  345.   alias xrxs_bp1_refresh refresh
  346.   def refresh
  347.     unless @update_cp_only
  348.       xrxs_bp1_refresh
  349.     end
  350.     refresh_cp
  351.     @wall.refresh
  352.   end
  353.   #----------------------------------------------------------------------
  354.   # 刷新(仅CP)
  355.   #----------------------------------------------------------------------
  356.   def refresh_cp
  357.     for i in 0...$game_party.actors.size
  358.       actor = $game_party.actors[i]
  359.       width = [self.width*3/4 / XRXS_BP1::MAX, 80].max
  360.       space = self.width / XRXS_BP1::MAX
  361.       case XRXS_BP1::ALIGN
  362.       when 0
  363.         actor_x = i * space + 4
  364.       when 1
  365.         actor_x = (space * ((XRXS_BP1::MAX - $game_party.actors.size)/2.0 + i)).floor
  366.       when 2
  367.         actor_x = (i + XRXS_BP1::MAX - $game_party.actors.size) * space + 4
  368.       end
  369.       actor_x += self.x
  370.       draw_actor_cp_meter(actor, actor_x, 96, width, 0)
  371.     end
  372.   end
  373.   #----------------------------------------------------------------------
  374.   # ○ CPメーター の描画
  375.   #----------------------------------------------------------------------
  376.   def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
  377.     self.contents.font.color = system_color
  378.     self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  379.     if actor.cp == nil
  380.       actor.cp = 0
  381.     end
  382.     w = width * [actor.cp,65535].min / 65535
  383.     self.contents.fill_rect(x, y+28, w,1, Color.new(255, 255, 128, 255))
  384.     self.contents.fill_rect(x, y+29, w,1, Color.new(255, 255, 0, 255))
  385.     self.contents.fill_rect(x, y+30, w,1, Color.new(192, 192, 0, 255))
  386.     self.contents.fill_rect(x, y+31, w,1, Color.new(128, 128, 0, 255))
  387.   end
  388. end

  389. #========================================================================
  390. # ■ Scene_Battle
  391. #========================================================================
  392. class Scene_Battle
  393.   #----------------------------------------------------------------------
  394.   # ● 框架更新
  395.   #----------------------------------------------------------------------
  396.   
  397.   
  398. ################################################################
  399. ###############################################################
  400.     alias make_skill_action_result_addcold :make_skill_action_result
  401.     def make_skill_action_result
  402.       make_skill_action_result_addcold
  403.       if @skill.cold.to_i != 0 #若该技能的设定冷却回合非0
  404.         @active_battler.cold[@skill.id] = @skill.cold.to_i
  405.       end
  406.     end
  407. ################################################################
  408. ###############################################################
  409.   
  410.   

  411.   
  412.   alias xrxs_bp1_update update
  413.   def update
  414.     xrxs_bp1_update
  415.     # CP更新
  416.     @cp_thread.update
  417.   end
  418.   #----------------------------------------------------------------------
  419.   # ● 战斗结束
  420.   # result : 結果 (0:勝利 1:敗北 2:逃走)
  421.   #----------------------------------------------------------------------
  422.   alias xrxs_bp1_battle_end battle_end
  423.   def battle_end(result)
  424.     # 停止CP计数
  425.     @cp_thread.stop
  426.     # 呼び戻す
  427.     xrxs_bp1_battle_end(result)
  428.   end
  429.   #----------------------------------------------------------------------
  430.   # ● 战斗前阶段开始
  431.   #----------------------------------------------------------------------
  432.   alias xrxs_bp1_start_phase1 start_phase1
  433.   def start_phase1
  434.     @agi_total = 0
  435.     # CP加算を開始する
  436.     @cp_thread = Scene_Battle_CP.new
  437.     # インデックスを計算
  438.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  439.     # アクターコマンドウィンドウに追加
  440.     @actor_command_window.add_command("逃跑")
  441.     if !$game_temp.battle_can_escape
  442.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  443.     end
  444.     # 呼び戻す
  445.     xrxs_bp1_start_phase1
  446.    
  447.    
  448.    
  449.    
  450.   end
  451.   #----------------------------------------------------------------------
  452.   # ● 派对命令阶段开始
  453.   #----------------------------------------------------------------------
  454.   alias xrxs_bp1_start_phase2 start_phase2
  455.   def start_phase2
  456.     xrxs_bp1_start_phase2
  457.     @party_command_window.active = false
  458.     @party_command_window.visible = false
  459.     # 恢复CP添加
  460.     @cp_thread.stop = false
  461.     # 下一个
  462.     start_phase3
  463.   end
  464.   #----------------------------------------------------------------------
  465.   # ● Actor命令窗口设置
  466.   #----------------------------------------------------------------------
  467.   alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
  468.   def phase3_setup_command_window
  469.     # 暂停CP线程
  470.     @cp_thread.stop = true
  471.     # ウィンドウのCP更新
  472.     @status_window.refresh_cp
  473.     # @active_battlerの防御を解除
  474.     @active_battler.now_guarding = false
  475.     # 効果音の再生
  476.     Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE != ""
  477.     # 呼び戻す
  478.     xrxs_bp1_phase3_setup_command_window
  479.   end
  480.   #----------------------------------------------------------------------
  481.   # ● 帧更新(演员命令阶段:基本命令)
  482.   #----------------------------------------------------------------------
  483.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  484.   def update_phase3_basic_command
  485.     # C ボタンが押された場合
  486.     if Input.trigger?(Input::C)
  487.       # アクターコマンドウィンドウのカーソル位置で分岐
  488.       case @actor_command_window.index
  489.       when @cp_escape_actor_command_index # 逃げる
  490.         if $game_temp.battle_can_escape
  491.           # 決定 SE を演奏
  492.           $game_system.se_play($data_system.decision_se)
  493.           # アクションを設定
  494.           @active_battler.current_action.kind = 0
  495.           @active_battler.current_action.basic = 4
  496.           # 次のアクターのコマンド入力へ
  497.           phase3_next_actor
  498.         else
  499.           # ブザー SE を演奏
  500.           $game_system.se_play($data_system.buzzer_se)
  501.         end
  502.         return
  503.       end
  504.     end
  505.     xrxs_bsp1_update_phase3_basic_command
  506.   end
  507.   #----------------------------------------------------------------------
  508.   # ● 主阶段开始
  509.   #----------------------------------------------------------------------
  510.   alias xrxs_bp1_start_phase4 start_phase4
  511.   def start_phase4
  512.     # 呼び戻す
  513.    
  514.    
  515.     ###############################################################
  516.     ###############################################################
  517.      for i in $game_party.actors + $game_troop.enemies
  518.            #如何只冷却当前行动角色的技能CD?
  519.            for j in i.cold.keys # if self.is_a?(Game_Actor)
  520.       #***********************************************************
  521.              i.set_cold(i,j)#删去此处,则冷却回合无法递减,不删则无技能冷却
  522.            end  
  523.      end  
  524.     ###############################################################  
  525.     ###############################################################
  526.       
  527.       
  528.     xrxs_bp1_start_phase4
  529.     # 暂停CP线程
  530.     unless @action_battlers.empty?
  531.       @cp_thread.stop = true
  532.     end
  533.   end
  534.   #----------------------------------------------------------------------
  535.   # ● 行动顺序创建
  536.   #----------------------------------------------------------------------
  537.   alias xrxs_bp1_make_action_orders make_action_orders
  538.   def make_action_orders
  539.     xrxs_bp1_make_action_orders
  540.     # 检查每个人的CP
  541.     exclude_battler = []
  542.     for battler in @action_battlers
  543.       # 如果缺少CP,则从@action_battlers中排除
  544.       if battler.cp < 65535
  545.         exclude_battler.push(battler)
  546.       end
  547.     end
  548.     @action_battlers -= exclude_battler
  549.   end
  550.   #----------------------------------------------------------------------
  551.   # ● 框架更新(主要阶段步骤1:动作准备)
  552.   #----------------------------------------------------------------------
  553.   alias xrxs_bp1_update_phase4_step1 update_phase4_step1
  554.   def update_phase4_step1
  555.     # 初期化
  556.     @phase4_act_continuation = 0
  557.     # 勝敗判定
  558.     if judge
  559.       @cp_thread.stop
  560.       # 如果胜利或失败:方法结束
  561.       return
  562.     end
  563.     # 从不活动的管家数组的开头获取
  564.     @active_battler = @action_battlers[0]
  565.     # 状态更新仅限于CP。
  566.     @status_window.update_cp_only = true
  567.    
  568.     # 禁止状态更新
  569.     @active_battler.slip_state_update_ban = true if @active_battler != nil
  570.     # 返回
  571.     xrxs_bp1_update_phase4_step1
  572.     # @status_window 如果未刷新则手动刷新(仅CP)
  573.     if @phase4_step != 2
  574.       # 刷新
  575.       @status_window.refresh
  576.       # 减轻重量:只有Σ(?W?
  577.       Graphics.frame_reset
  578.     end
  579.     # 解除禁令
  580.     @status_window.update_cp_only = false
  581.     @active_battler.slip_state_update_ban = false if @active_battler != nil
  582.   end
  583.   #----------------------------------------------------------------------
  584.   # ● 框架更新(主要阶段步骤2:动作开始)
  585.   #----------------------------------------------------------------------
  586.   alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  587.   def update_phase4_step2
  588.     # 除非是强制性行动
  589.     unless @active_battler.current_action.forcing
  590.       # 如果限制条件是[通常攻击敌人]或[通常攻击盟友]
  591.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  592.         # アクションに攻撃を設定
  593.         @active_battler.current_action.kind = 0
  594.         @active_battler.current_action.basic = 0
  595.       end
  596.       # 如果约束条件无法执行
  597.       if @active_battler.restriction == 4
  598.         # 清除要采取行动的管家
  599.         $game_temp.forcing_battler = nil
  600.         if @phase4_act_continuation == 0 and @active_battler.cp >= 65535
  601.           # 自然释放状态
  602.           @active_battler.remove_states_auto
  603.           # CP消費
  604.           @active_battler.cp -= 65535
  605.           # 刷新状态窗口
  606.           @status_window.refresh
  607.         end
  608.         # 转到步骤1
  609.         @phase4_step = 1
  610.         return
  611.       end
  612.     end
  613.     # 按动作类型分支
  614.     case @active_battler.current_action.kind
  615.     when 0
  616.       # 攻击/防御/逃脱?无所事事的共同消费CP
  617.       @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
  618.     when 1
  619.       # 使用技能时消耗的CP
  620.       @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
  621.     when 2
  622.       # 使用物品时消耗的CP
  623.       @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
  624.     end
  625.     # 自然释放状态
  626.     @active_battler.remove_states_auto
  627.     # 召回
  628.     xrxs_bp1_update_phase4_step2
  629.   end
  630.   #----------------------------------------------------------------------
  631.   # ● 基本动作结果创建
  632.   #----------------------------------------------------------------------
  633.   alias xrxs_bp1_make_basic_action_result make_basic_action_result
  634.   def make_basic_action_result
  635.     # 攻撃の場合
  636.     if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
  637.       @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
  638.     end
  639.     # 防御の場合
  640.     if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
  641.       @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
  642.       # @active_battlerの防御をON
  643.       @active_battler.now_guarding = true
  644.     end
  645.     # 当敌人逃跑时
  646.     if @active_battler.is_a?(Game_Enemy) and
  647.         @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
  648.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  649.     end
  650.     # 如果你什么都不做
  651.     if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
  652.       @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
  653.     end
  654.     # 如果你逃跑
  655.     if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
  656.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  657.       # 如果它没有逃脱
  658.       if $game_temp.battle_can_escape == false
  659.         # 播放SE を演奏
  660.         $game_system.se_play($data_system.buzzer_se)
  661.         return
  662.       end
  663.       # 逃走処理
  664.       update_phase2_escape
  665.       return
  666.     end
  667.     # 召回
  668.     xrxs_bp1_make_basic_action_result
  669.   end
  670.   #----------------------------------------------------------------------
  671.   # ● 框架更新(主要阶段步骤6:刷新)
  672.   #----------------------------------------------------------------------
  673.   alias xrxs_bp1_update_phase4_step6 update_phase4_step6
  674.   def update_phase4_step6
  675.     # 滑倒损坏
  676.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  677.       @active_battler.slip_damage_effect
  678.       @active_battler.damage_pop = true
  679.       # 刷新状态窗口
  680.       @status_window.refresh
  681.     end
  682.     #召回
  683.     xrxs_bp1_update_phase4_step6
  684.   end
  685. end
  686. #======================================================================
  687. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  688. #======================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
456
在线时间
76 小时
注册时间
2020-2-23
帖子
24
3
 楼主| 发表于 2021-3-18 23:02:58 | 只看该作者
  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.   
  28.   alias initialize_cold :initialize
  29.   def initialize
  30.     @cold = {}
  31.     initialize_cold
  32.   end
  33.   
  34.   def set_cold(key,val) # key为某角色的技能编号,val为冷却回合减一
  35.     return if @cold[key] == nil
  36.     @cold[key] += val
  37.     @cold.delete(key) if @cold[key] <= 0
  38.   end
  39.   
  40.   alias skill_can_use_addcold :skill_can_use?
  41.   def skill_can_use?(skill_id)
  42.     return false if @cold[skill_id] != nil
  43.     skill_can_use_addcold(skill_id)
  44.   end
  45. end

  46. class Scene_Battle
  47.   
  48.   alias make_skill_action_result_addcold :make_skill_action_result
  49.   def make_skill_action_result
  50.     make_skill_action_result_addcold
  51.     if @skill.cold.to_i != 0
  52.     @active_battler.cold[@skill.id] = @skill.cold.to_i
  53.     end
  54.   end
  55.   
  56.   alias start_phase4_addcold :start_phase4
  57.   
  58.   def start_phase4
  59.        for i in $game_party.actors + $game_troop.enemies
  60.          for j in i.cold.keys
  61.            i.set_cold(j,-1)
  62.          end  
  63.        end  
  64.     start_phase4_addcold
  65.   end   
  66.   
  67. end  
复制代码
回复 支持 反对

使用道具 举报

Lv2.观梦者

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

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6483
在线时间
119 小时
注册时间
2020-1-8
帖子
234
5
发表于 2021-3-19 14:16:37 | 只看该作者
本帖最后由 RPGzh500223 于 2021-3-19 14:18 编辑

bug多得   我就不改了
首先 集气并没有修改回合数 $game_temp.battle_turn
RMXP默认的战斗模式
Game_Battler#remove_states_auto 是按回合调用
  #--------------------------------------------------------------------------
  # ● 状态自然解除 (回合改变时调用)
  #--------------------------------------------------------------------------
  def remove_states_auto

而 集气脚本是角色行动一次调用一次,所以感觉“回合乱了”

以下不算是代码,表达大概的意思   
#………… 表示  RMXP默认的代码  或  插件修改后的代码
RUBY 代码复制
  1. class Game_Battler
  2.   def initialize
  3.     #………………
  4.     @cd = {}
  5.   end
  6.  
  7.   def the_skill_cd(skill_id)
  8.     return @cd[skill_id] || 0
  9.   end
  10.  
  11.   def cold_the_skill(skill_id)
  12.     @cd[skill_id] = $data_skills[skill_id].cd if $game_temp.in_battle
  13.   end
  14.  
  15.   def reduce_skill_cd
  16.     return if @cd.empty?
  17.     @cd.keys.each {|i| @cd[i] -= 1 if @cd[i] > 0}
  18.   end
  19.  
  20.   def skill_cd_clear
  21.     @cd.clear
  22.   end
  23.  
  24.   def skill_can_use?(skill_id)   
  25.     return false if self.the_skill_cd(skill_id) > 0
  26.     #…………
  27.   end
  28.  
  29.   def skill_effect(user, skill)
  30.     user.cold_the_skill(skill.id)
  31.     #…………
  32.   end
  33.  
  34.   def remove_states_battle
  35.     #…………
  36.     self.skill_cd_clear
  37.   end
  38.  
  39.   def remove_states_auto
  40.     #…………
  41.     self.reduce_skill_cd
  42.   end
  43. end



回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
456
在线时间
76 小时
注册时间
2020-2-23
帖子
24
6
 楼主| 发表于 2021-3-19 19:13:33 | 只看该作者
RPGzh500223 发表于 2021-3-19 14:16
bug多得   我就不改了
首先 集气并没有修改回合数 $game_temp.battle_turn
RMXP默认的战斗模式

大哥,真的谢谢你。照着你的思路,然后我就在那瞎猜乱搞,然后搞出终于了一个能运行的脚本,确实能够达到我要的冷却效果。只是不知道为什么现在有一个小问题,我设定的冷却回合数和实际的冷却回合数有些细微差别,比如说设定某技能冷却1或2回合,实际只是一回合,设定3,4回合实际为2回合,以此类推。大哥,这是什么原因导致的啊

  1. #豪华版冷却#=======================================================================
  2. #  豪华版技能冷却系统 By 绿发的Eclair
  3. #  使用方法:在特技名称后面用半角逗号分割,写上冷却回合数。
  4. #  比如 十字斩,10 就是特技 十字斩 冷却10个回合了。
  5. #  注意这个冷却是敌我通用的,不只是我方,敌人也不会使用冷却中的技能哦。
  6. #  不想让特技窗口中显示冷却回合数, $冷却时间显示 = false 就行了。
  7. #  冲突性:存在,但是除了RTAB外似乎整合难度不大。
  8. #=======================================================================

  9. module RPG
  10.   class Skill
  11.   def cold
  12.     return @name.split(/,/)[1]
  13.   end
  14.   def name(actor = nil)
  15.     if $冷却时间显示 and actor != nil and actor.cold[@id] != nil
  16.       a = (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  17.       return a + "(" + actor.cold[@id].to_s + ")"
  18.     else
  19.       return (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  20.     end
  21.   end
  22.   end
  23. end

  24. class Game_Battler
  25.   #attr_accessor :cold
  26.   alias initialize_cold :initialize
  27.   def initialize
  28.     @cold = {}
  29.     initialize_cold
  30.   end
  31.   
  32.   alias skill_can_use_addcold :skill_can_use?
  33.   def skill_can_use?(skill_id)   
  34.     return false if self.the_skill_cold(skill_id)  > 0
  35.     skill_can_use_addcold(skill_id)
  36.     #…………
  37.   end
  38.   
  39.   def the_skill_cold(skill_id)
  40.     return @cold[skill_id] || 0
  41.   end

  42.   def cold_the_skill(skill_id)
  43.     @cold[skill_id] = $data_skills[skill_id].cold.to_i if $game_temp.in_battle
  44.   end

  45.   def reduce_skill_cold
  46.     return if @cold.empty?
  47.     @cold.keys.each {|i| @cold[i] -= 1 if @cold[i] > 0}
  48.   end

  49.   def skill_cold_clear
  50.     @cold.clear
  51.   end

  52.   alias skill_effect_addcold :skill_effect
  53.   def skill_effect(user, skill)
  54.     user.cold_the_skill(skill.id)
  55.     skill_effect_addcold(user, skill)
  56.     #…………
  57.   end

  58.   alias remove_states_battle_addcold :remove_states_battle
  59.   def remove_states_battle
  60.     #…………
  61.     remove_states_battle_addcold
  62.     self.skill_cold_clear
  63.   end

  64.   alias remove_states_auto_addcold :remove_states_auto
  65.   def remove_states_auto
  66.     #…………
  67.     remove_states_auto_addcold
  68.     self.reduce_skill_cold
  69.   end
  70.   
  71. end
复制代码
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6483
在线时间
119 小时
注册时间
2020-1-8
帖子
234
7
发表于 2021-3-20 11:32:17 | 只看该作者
本帖最后由 RPGzh500223 于 2021-3-20 16:09 编辑
3103924369 发表于 2021-3-19 19:13
大哥,真的谢谢你。照着你的思路,然后我就在那瞎猜乱搞,然后搞出终于了一个能运行的脚本,确 ...


我测试的正常啊
(一些方法名,改为你自己的)
RUBY 代码复制
  1. module RPG
  2.   Show_Skill_CD = true
  3.   class Skill
  4.     def cd
  5.       return (@name.split(/,/)[1]).to_i
  6.     end
  7.  
  8.     def name
  9.       return @name.split(/,/)[0] || ""
  10.     end
  11.   end
  12. end
  13.  
  14. class Window_Skill < Window_Selectable
  15.   def draw_item(index)
  16.     skill = @data[index]
  17.     if @actor.skill_can_use?(skill.id)
  18.       self.contents.font.color = normal_color
  19.     else
  20.       self.contents.font.color = disabled_color
  21.     end
  22.     x = 4 + index % 2 * (288 + 32)
  23.     y = index / 2 * 32
  24.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  25.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  26.     bitmap = RPG::Cache.icon(skill.icon_name)
  27.     opacity = self.contents.font.color == normal_color ? 255 : 128
  28.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  29.  
  30.     text = skill.name
  31.     if RPG::Show_Skill_CD && $game_temp.in_battle
  32.       if (cd = @actor.the_skill_cd(skill.id)) != 0
  33.         text += "【#{cd}】"
  34.       end  
  35.     end
  36.  
  37.     self.contents.draw_text(x + 28, y, 204, 32, text, 0)
  38.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  39.   end
  40. end
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
456
在线时间
76 小时
注册时间
2020-2-23
帖子
24
8
 楼主| 发表于 2021-3-21 15:30:10 | 只看该作者
RPGzh500223 发表于 2021-3-20 11:32
我测试的正常啊
(一些方法名,改为你自己的)
module RPG

啊这,晕了,大哥你写的貌似和我的思路很不一样啊,能发一下测试的样例工程文件么
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6483
在线时间
119 小时
注册时间
2020-1-8
帖子
234
9
发表于 2021-3-21 16:02:39 | 只看该作者
编辑器内容自行修改

Scripts.rxdata

124.33 KB, 下载次数: 51

评分

参与人数 1星屑 +200 +1 收起 理由
RyanBern + 200 + 1 认可答案

查看全部评分

回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
456
在线时间
76 小时
注册时间
2020-2-23
帖子
24
10
 楼主| 发表于 2021-3-22 13:22:49 | 只看该作者
RPGzh500223 发表于 2021-3-21 16:02
编辑器内容自行修改

顶礼膜拜,完全做到乐我预想的效果,真的太强了,大哥。真的谢谢你
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-17 02:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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