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

Project1

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

[原创发布] 仿仙三法术延迟发动的法术CP战斗系统

[复制链接]

Lv1.梦旅人

梦石
0
星屑
177
在线时间
15 小时
注册时间
2023-12-18
帖子
3
跳转到指定楼层
1
发表于 2023-12-20 01:45:25 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 斗螃蟹 于 2024-1-1 17:10 编辑

【概述】
基于“桜雅 在土”的CP制御系统,为战斗的法施法增加难度,使用法术次数越多,施法越快,增加刷怪使用法术的意义。
1、增加了法术延迟发动系统。
2、新定义了每个角色的法术熟练度,以对应不同法术CP增加速度,并在法术名称后附上[1级][2级][3级]加以提示。
3、增加了选择敌人/队友时行动条上图标闪烁,以提示选择的人物。
法术延迟启动系统的基础构思源自“斯塔萨菲雅”14年的帖子,帖子指路:https://rpg.blue/thread-366978-1-1.html

【整体思想】
cp值增到50000时开始行动,判断行动种类,如果是法术则根据人物使用该法术的次数多少附上【施法准备状态】,状态分为三个等级:1法术等级、2法术等级、3法术等级。
进入【施法准备状态】后1、2等级需要待CP增加至65536才能施法,且2等级速度比1等级速度快,3等级不需要准备,直接施法。
在人物进入【施法准备状态】后若受到攻击,则有极大概率破除施法状态,CP值回到25000且需要待CP值增到50000才能进行下一轮行动。
特殊:敌人的施法等级默认是2。

【使用注意事项及可定制部分】
除了复制脚本,还需要在数据库->状态里增加三个状态


在脚本页面可以:
1、定义施法等级的法术使用次数。
2、敌人的施法等级。
3、受击后破除施法状态的可能性。
4、其他例如法术1、2等级的施法速度可以在脚本里更改速度定义的函数。

如果想在事件里修改某个角色某个法术的使用次数
在事件里使用脚本:$game_actors[角色ID].skill_use_num[法术ID] = 想要修改的次数
例如:$game_actors[1].skill_use_num[2] = 10
意思是第一个角色的第二个技能使用次数修改为10次。另外注意对应角色第一次入队后才能使用这个代码,未初始化就用这个代码会报错。另外,角色入队了即使离队也可以使用此脚本。


【效果展示】
以下画面源自RPG maker XP原生游戏模板附上脚本(结尾有案例文件下载)

【法术1等级】施法准备速度较慢


【法术2等级】施法准备速度更快


【法术3等级】直接施法


【受击后CP值倒退】



以下画面源自我正在制作的游戏《拾壹》,配上了其他战斗脚本例如45度战斗,窗口美化,人物呼吸等。



【脚本代码】
技能熟练度
RUBY 代码复制
  1. #==============================================================================
  2. # 斗螃蟹制作-技能熟练度,配合技能跑CP条改版
  3. #------------------------------------------------------------------------------
  4. # 更新记录:
  5. #     2023.11.22  第一版
  6. #     2023.12.14  第二版-增加读档检测是否有使用法术次数数组,避免存档不兼容
  7. #==============================================================================
  8.  
  9. #==============================================================================
  10. # 使用说明
  11. #==============================================================================
  12.  
  13. #每个角色有skill_use_number数组储存技能使用次数
  14. #每次使用了技能后在skill_use_number对应位置加1
  15. #选择技能时判断使用次数大于几,在技能后面增加[1级][2级][3级]指标以提示玩家
  16. #使用技能时判断使用次数大于几,根据不同的等级给角色加上不同的状态
  17. #来实现不同行动速度
  18.  
  19.  
  20. #如果想要更改某个对应ID角色的技能使用次数
  21. #在事件里可以用下一行脚本(注意不要带第一个#,这里用#是注释用)
  22. #$game_actors[角色ID].skill_use_num[法术ID] = 想要修改的次数
  23. #例如
  24. #$game_actors[1].skill_use_num[2] = 10
  25. #意思是第一个角色的第二个技能使用次数修改为10次
  26. #另外注意对应角色第一次入队后才能使用这个代码,未初始化就用这个代码会报错
  27. #只要入队后即使离队也可以使用
  28.  
  29.  
  30. #==============================================================================
  31. # 自定义部分
  32. #==============================================================================
  33.  
  34. module DPX
  35. end
  36. module DPX::Skill_Proficiency
  37.  
  38.   Skill_number = 81 #技能总数量,根据数据库来写,注意是数据库技能数量+1(数组索引从0开始)
  39.   Upgrade_to_2 = 5  #升到2级需要使用多少次,也就使用Upgrade_to_2次后,立马升级为等级2
  40.   Upgrade_to_3 = 10 #升到3级需要使用多少次
  41.  
  42.   #三个等级对应的状态ID
  43.   State_Proficiency1 = 17
  44.   State_Proficiency2 = 18
  45.   State_Proficiency3 = 19
  46.   #敌人没有技能熟练度升级要求
  47.   State_Proficiency_Enemy = 18 #这里给的是等级二,默认敌人是等级二速度
  48.  
  49. end
  50.  
  51. #==============================================================================
  52. # 主代码
  53. #==============================================================================
  54.  
  55. #--------------------------------------------------------------------------
  56.  
  57. # ● 技能使用次数变量定义
  58.  
  59. #--------------------------------------------------------------------------
  60.  
  61. #下面的代码是兼容旧的,未定义skill_use_num存档的
  62. class Game_Actors
  63.   attr_accessor   :data
  64. end
  65.  
  66. class Scene_Load
  67. include DPX::Skill_Proficiency
  68. alias DPX_read_save_data read_save_data
  69. def read_save_data(file)
  70.   DPX_read_save_data(file)
  71.   for i in $game_actors.data
  72.     if i != nil
  73.       if i.skill_use_num==nil
  74.         i.skill_use_num = Array.new(Skill_number, 0)
  75.       end
  76.     end
  77.   end
  78. end
  79. end
  80.  
  81. #接下来是创建角色时定义skill_use_num
  82. class Game_Actor < Game_Battler
  83.   include DPX::Skill_Proficiency
  84.   #--------------------------------------------------------------------------
  85.   # ● 定义实例变量
  86.   #--------------------------------------------------------------------------
  87.   attr_accessor   :skill_use_num                # 技能使用次数
  88.   #一个1*n的数组,存储的是角色使用技能的次数,序号对应的是技能ID
  89.   #每个角色都跟着一个这个
  90.   #--------------------------------------------------------------------------
  91.   # ● 觉悟特技
  92.   #     skill_id : 特技 ID
  93.   #--------------------------------------------------------------------------
  94.  
  95.   alias old_initialize initialize
  96.   def initialize(actor_id)
  97.     old_initialize(actor_id)
  98.     @skill_use_num = Array.new(Skill_number, 0)#建立全是0元素的数组,好比较大小
  99.   end
  100.  
  101. end
  102.  
  103. #--------------------------------------------------------------------------
  104.  
  105. # ● 技能次数叠加和附加状态
  106.  
  107. #--------------------------------------------------------------------------
  108.  
  109. class Scene_Battle
  110.   include DPX::Skill_Proficiency
  111.   def DPX_skill_use_num_up(actor,skill)
  112.     if actor.is_a?(Game_Actor)
  113.       actor.skill_use_num[skill.id] += 1
  114.     end
  115.   end
  116.   def DPX_skill_state(actor,skill_id)
  117.     if actor.skill_use_num[skill_id] < Upgrade_to_2
  118.       actor.add_state(State_Proficiency1)
  119.     elsif actor.skill_use_num[skill_id].between?(Upgrade_to_2 ,Upgrade_to_3-1)
  120.       actor.add_state(State_Proficiency2)
  121.     elsif actor.skill_use_num[skill_id] >= Upgrade_to_3
  122.       actor.add_state(State_Proficiency3)
  123.     end
  124.   end
  125.  
  126. end
  127.  
  128. #--------------------------------------------------------------------------
  129.  
  130. # ● 技能等级展示
  131.  
  132. #--------------------------------------------------------------------------
  133.  
  134. class Window_Skill < Window_Selectable
  135.   include DPX::Skill_Proficiency
  136.  
  137.   def DPX_skill_level_show(actor,skill)
  138.     if actor.skill_use_num[skill.id] < Upgrade_to_2
  139.       return "[1级]"
  140.     elsif actor.skill_use_num[skill.id].between?(Upgrade_to_2 ,Upgrade_to_3-1)
  141.       return "[2级]"
  142.     elsif actor.skill_use_num[skill.id] >= Upgrade_to_3
  143.       return "[3级]"
  144.     end
  145.   end
  146.  
  147.   alias DPX_draw_item draw_item
  148.   def draw_item(index)
  149.  
  150.     skill = @data[index]
  151.     if @actor.skill_can_use?(skill.id)
  152.       self.contents.font.color = normal_color
  153.     else
  154.       self.contents.font.color = disabled_color
  155.     end
  156.     x = 4 + index % 2 * (288 + 32)
  157.     y = index / 2 * 32
  158.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  159.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  160.     bitmap = RPG::Cache.icon(skill.icon_name)
  161.     opacity = self.contents.font.color == normal_color ? 255 : 128
  162.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  163.  
  164.     skill_level = DPX_skill_level_show(@actor,skill)
  165.  
  166.     self.contents.draw_text(x + 28, y, 204, 32, skill.name+skill_level, 0)
  167.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  168.   end
  169.  
  170. end
  171. #----------


CP制御+法术CP
RUBY 代码复制
  1. # ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # □ カスタマイズポイント
  6. #==============================================================================
  7. class Game_System
  8.   def new_DPX_temp
  9.     @DPX_skill_temp  = [] #防止旧存档不兼容
  10.     @DPX_target_temp = []
  11.     @DPX_Battler_temp  = []
  12.   end
  13.  
  14.   def add_DPX_temp(active_battler,skill,target_battlers)
  15.     @DPX_Battler_temp.push(active_battler)
  16.     @DPX_skill_temp.push(skill)
  17.     @DPX_target_temp.push(target_battlers)
  18.   end
  19.  
  20.   def get_DPX_temp(active_battler)
  21.     for j in @DPX_Battler_temp
  22.       if j == active_battler
  23.         a_index = @DPX_Battler_temp.index(j)
  24.         skill = @DPX_skill_temp[a_index]
  25.         target_battlers = @DPX_target_temp[a_index]
  26.         return [skill,target_battlers]
  27.       end
  28.     end
  29.   end
  30.  
  31.   def remove_DPX_temp(active_battler)
  32.     for i in @DPX_Battler_temp
  33.       if i == active_battler
  34.         a_index = @DPX_Battler_temp.index(i)
  35.         @DPX_Battler_temp.delete_at(a_index)
  36.         @DPX_skill_temp.delete_at(a_index)
  37.         @DPX_target_temp.delete_at(a_index)
  38.       end
  39.     end
  40.   end     
  41.  
  42. end
  43.  
  44. module XRXS65
  45.   #
  46.   # 「バトルスピード」(数値が高いほど早い)
  47.   #
  48.   SPEED = 0.4
  49.   #
  50.   # 戦闘開始時 CP。 固定値と占有率
  51.   #
  52.   CP_PRESET_FIXNUM = 0
  53.   CP_PRESET_RATIO  = 1.0
  54.   #
  55.   # 转向控制器(nil:有效计数/转向。  ターンコントローラ (nil  : カウント/ターンを有効。
  56.   # 数值:拥有该索引的敌人支配)      数値 : そのインデックスをもつエネミーが支配)
  57.   #
  58.   TC = 0
  59.   #
  60.   # 计数/回合(TC有效时忽略) カウント/ターン (TCが有効な場合は無視)
  61.   #
  62.   CPT = 40
  63.   #
  64.   # CP 条皮肤スキン
  65.   #
  66.   SKIN        = "123"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  67.   LINE_HEIGHT =  6        # スキンの"一行"の縦幅[単位:ピクセル]
  68.   #
  69.   # 表示位置セッティング
  70.   #
  71.   X_OFFSET = 160    # 横位置
  72.   Y_OFFSET = 464    # 縦位置
  73.   ALIGN    =   2    #(CP仪表的位置。0:靠左1:中间2:靠右)「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  74.   MAX      =   4    # 確保するサイズ[単位:~人分]
  75.   #
  76.   # アクターコマンドがポップしたときの効果音
  77.   #
  78.   COMMAND_UP_SE = "Audio/SE/decision.wav"
  79. end
  80. #==============================================================================
  81. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  82. #==============================================================================
  83. module XRXS_CP
  84.   #--------------------------------------------------------------------------
  85.   # ○ スキンライン (スキンの何行目を使うか)
  86.   #--------------------------------------------------------------------------
  87.   def cp_linetype
  88.     # CP フルの場合はスキンの 2 行目を使う
  89.     return 2 if self.cp_full?
  90.     # 通常はスキンの 1 行目を使う
  91.     return 1
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ○ メーター量[単位:%]
  95.   #--------------------------------------------------------------------------
  96.   def cp_lineamount
  97.     # 戦闘不能の場合は 0 %として表示させる
  98.     return 0 if self.dead?
  99.     # CP値を%値に変換して返却する
  100.     return 100 * self.cp / self.max_cp
  101.   end
  102. end
  103. #
  104. # カスタマイズポイントここまで。
  105. #------------------------------------------------------------------------------
  106.  
  107.  
  108.  
  109. #==============================================================================
  110. # --- XRXS. CP機構 ---
  111. #==============================================================================
  112. module XRXS_CP_SYSTEM
  113.   #----------------------------------------------------------------------------
  114.   # ○ 合計 AGI の取得
  115.   #----------------------------------------------------------------------------
  116.   def self.total_agi
  117.     total = 0
  118.     for battler in $game_party.actors + $game_troop.enemies
  119.       total += battler.agi
  120.     end
  121.     return total
  122.   end
  123. end
  124. #==============================================================================
  125. # --- バトラーにCP機能を追加 モジュール ---
  126. #==============================================================================
  127. module XRXS_CP
  128.   include DPX::Skill_Proficiency
  129.   #--------------------------------------------------------------------------
  130.   # ○ 最大 CP の取得
  131.   #--------------------------------------------------------------------------
  132.   def max_cp
  133.     return 65535
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ○ CP の取得と設定
  137.   #--------------------------------------------------------------------------
  138.   def cp
  139.     return @cp == nil ? @cp = 0 : @cp
  140.   end
  141.   def cp=(n)
  142.     #@cp = [[n.to_i, 0].max, self.max_cp].min
  143.     if self.states.include?(State_Proficiency1)#判断玩家,敌人的状态是熟练度1、2施法状态
  144.       @cp = [[n.to_i, 0].max, max_cp].min
  145.     elsif self.states.include?(State_Proficiency2)
  146.       @cp = [[n.to_i, 0].max, max_cp].min
  147.     else
  148.       @cp = [[n.to_i, 0].max, 50000].min
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ○ CP 初期設定
  153.   #--------------------------------------------------------------------------
  154.   def cp_preset
  155. #percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  156.     percent = 50000 * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  157.     self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ○ CP值增长速度  CP カウントアップ
  161.   #--------------------------------------------------------------------------
  162.   def cp_update
  163.     if self.states.include?(State_Proficiency1)
  164.       self.cp += XRXS65::SPEED * 4096 /10
  165.     elsif self.states.include?(State_Proficiency2)
  166.       self.cp += XRXS65::SPEED * 4096 /3
  167.     else
  168.       #self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  169.       self.cp += XRXS65::SPEED * 4096 * self.agi / 200
  170.     end
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ 判断CP是否满了 CP 満タン?
  174.   #--------------------------------------------------------------------------
  175.   def cp_full?
  176.     if self.states.include?(State_Proficiency1)
  177.       return @cp == 65535
  178.     elsif self.states.include?(State_Proficiency2)
  179.       return @cp == 65535
  180.     else
  181.     #    return @cp == self.max_cp
  182.       return @cp == 50000
  183.     end
  184.   end
  185.  
  186. end
  187. class Game_Battler
  188.   include XRXS_CP
  189.  
  190.  
  191.   alias DPX_remove_states_shock remove_states_shock
  192.   def remove_states_shock
  193.     if self.damage > 0  #必须伤害大于0才行,否则治疗也会打断
  194.       for i in @states.clone
  195.         if rand(100) < $data_states[i].shock_release_prob
  196.           if self.states.include?(State_Proficiency1) || self.states.include?(State_Proficiency2)
  197.             $game_system.remove_DPX_temp(self)
  198.             #p "检测到状态,受到攻击,返还一部分CP"
  199.             self.cp = 25000
  200.           end
  201.           remove_state(i)
  202.         end
  203.       end
  204.     end
  205.   end
  206.  
  207.   #更改状态解除判断准则,只要受到伤害都会解除状态
  208.   alias DPX_skill_effect skill_effect
  209.   def skill_effect(user, skill)
  210.     # 清除会心一击标志
  211.     self.critical = false
  212.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  213.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  214.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  215.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  216.       # 过程结束
  217.       return false
  218.     end
  219.     # 清除有效标志
  220.     effective = false
  221.     # 公共事件 ID 是有效的情况下,设置为有效标志
  222.     effective |= skill.common_event_id > 0
  223.     # 第一命中判定
  224.     hit = skill.hit
  225.     if skill.atk_f > 0
  226.       hit *= user.hit / 100
  227.     end
  228.     hit_result = (rand(100) < hit)
  229.     # 不确定的特技的情况下设置为有效标志
  230.     effective |= hit < 100
  231.     # 命中的情况下
  232.     if hit_result == true
  233.       # 计算威力
  234.       power = skill.power + user.atk * skill.atk_f / 100
  235.       if power > 0
  236.         power -= self.pdef * skill.pdef_f / 200
  237.         power -= self.mdef * skill.mdef_f / 200
  238.         power = [power, 0].max
  239.       end
  240.       # 计算倍率
  241.       rate = 20
  242.       rate += (user.str * skill.str_f / 100)
  243.       rate += (user.dex * skill.dex_f / 100)
  244.       rate += (user.agi * skill.agi_f / 100)
  245.       rate += (user.int * skill.int_f / 100)
  246.       # 计算基本伤害
  247.       self.damage = power * rate / 20
  248.       # 属性修正
  249.       self.damage *= elements_correct(skill.element_set)
  250.       self.damage /= 100
  251.       # 伤害符号正确的情况下
  252.       if self.damage > 0
  253.         # 防御修正
  254.         if self.guarding?
  255.           self.damage /= 2
  256.         end
  257.       end
  258.       # 分散
  259.       if skill.variance > 0 and self.damage.abs > 0
  260.         amp = [self.damage.abs * skill.variance / 100, 1].max
  261.         self.damage += rand(amp+1) + rand(amp+1) - amp
  262.       end
  263.       # 第二命中判定
  264.       eva = 8 * self.agi / user.dex + self.eva
  265.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  266.       hit = self.cant_evade? ? 100 : hit
  267.       hit_result = (rand(100) < hit)
  268.       # 不确定的特技的情况下设置为有效标志
  269.       effective |= hit < 100
  270.     end
  271.     # 命中的情况下
  272.     if hit_result == true
  273.       #▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
  274.       # 威力 0 以外的物理攻击的情况下
  275.       #if skill.power != 0 and skill.atk_f > 0
  276.       if skill.power != 0 #我不想要只有物理攻击才会消除
  277.         # 状态冲击解除
  278.         remove_states_shock
  279.         # 设置有效标志
  280.         effective = true
  281.       end
  282.       # HP 的伤害减法运算
  283.       last_hp = self.hp
  284.       self.hp -= self.damage
  285.       effective |= self.hp != last_hp
  286.       # 状态变化
  287.       @state_changed = false
  288.       effective |= states_plus(skill.plus_state_set)
  289.       effective |= states_minus(skill.minus_state_set)
  290.       # 威力为 0 的场合
  291.       if skill.power == 0
  292.         # 伤害设置为空的字串
  293.         self.damage = ""
  294.         # 状态没有变化的情况下
  295.         unless @state_changed
  296.           # 伤害设置为 "Miss"
  297.           self.damage = "Miss"
  298.         end
  299.       end
  300.     # Miss 的情况下
  301.     else
  302.       # 伤害设置为 "Miss"
  303.       self.damage = "Miss"
  304.     end
  305.     # 不在战斗中的情况下
  306.     unless $game_temp.in_battle
  307.       # 伤害设置为 nil
  308.       self.damage = nil
  309.     end
  310.     # 过程结束
  311.     return effective
  312.   end
  313. end
  314. #==============================================================================
  315. # --- ガード機能 ---
  316. #==============================================================================
  317. class Game_Battler
  318.   #--------------------------------------------------------------------------
  319.   # ○ ガードフラグ
  320.   #--------------------------------------------------------------------------
  321.   def guarding=(n)
  322.     @guarding = n
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● 防御中判定 [再定義]
  326.   #--------------------------------------------------------------------------
  327.   def guarding?
  328.     return @guarding
  329.   end
  330. end
  331. #==============================================================================
  332. # ---演员“判断可输入命令”没有CP就不能命令---(没到达终点不能行动)
  333. # ---アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  334. #==============================================================================
  335. module XRXS_CP_INPUTABLE
  336.   include DPX::Skill_Proficiency
  337.   def inputable?
  338.     #防止技能条到终点后又输入指令
  339.     if self.states.include?(State_Proficiency1) || self.states.include?(State_Proficiency2)
  340.       return false
  341.     else
  342.       return (self.cp_full? and super)
  343.     end
  344.   end
  345. end
  346. class Game_Actor < Game_Battler
  347.   include XRXS_CP_INPUTABLE
  348. end
  349. #==============================================================================
  350. # --- 敌人“判断可输入命令”没有CP就不能命令---(没到达终点不能行动)
  351. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  352. #==============================================================================
  353. module XRXS_CP_MOVABLE
  354.   def movable?
  355.     return (self.cp_full? and super)
  356.   end
  357. end
  358. class Game_Enemy < Game_Battler
  359.   include XRXS_CP_MOVABLE
  360. end
  361. #==============================================================================
  362. # --- 战斗时CP计数 ---
  363. # --- 戦闘時 CPカウント ---
  364. #==============================================================================
  365. module XRXS_CP_Battle
  366.   #--------------------------------------------------------------------------
  367.   # ○ パーティ全員の CP を初期設定
  368.   #--------------------------------------------------------------------------
  369.   def cp_preset_party
  370.     for actor in $game_party.actors
  371.       actor.cp_preset
  372.     end
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ○ トループ全員の CP を初期設定
  376.   #--------------------------------------------------------------------------
  377.   def cp_preset_troop
  378.     for enemy in $game_troop.enemies
  379.       enemy.cp_preset
  380.     end
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # ○ バトラー全員の CP をカウントアップ
  384.   #--------------------------------------------------------------------------
  385.   def cp_update
  386.     for battler in $game_party.actors + $game_troop.enemies
  387.       battler.cp_update
  388.     end
  389.   end
  390. end
  391. class Scene_Battle
  392.  
  393.   include XRXS_CP_Battle
  394.  
  395.   alias DPX_main main
  396.   def main
  397.     $game_system.new_DPX_temp
  398.     DPX_main()
  399.   end
  400.  
  401. end
  402.  
  403.  
  404. #==============================================================================
  405.  
  406. # ■ Scene_Battle
  407.  
  408. #==============================================================================
  409. class Scene_Battle
  410.   alias DPX_battle_end battle_end
  411.   def battle_end(result)
  412.     $game_system.new_DPX_temp
  413.     #战斗结束后需要把暂存信息清空
  414.     DPX_battle_end(result)
  415.   end
  416.  
  417.   #--------------------------------------------------------------------------
  418.   # ● メイン処理
  419.   #--------------------------------------------------------------------------
  420.   alias xrxs65_main main
  421.   def main
  422.     # エクストラスプライトの初期化
  423.     @extra_sprites = [] if @extra_sprites == nil
  424.     # CP の初期化
  425.     cp_preset_party
  426.     # CP メーターの作成  CP仪表的制作
  427.     @cp_meters = CP_Meters.new
  428.     # CP メーターをエクストラスプライトへ登録
  429.     @extra_sprites.push(@cp_meters)
  430.     # 呼び戻す
  431.     xrxs65_main
  432.     # メーターの解放
  433.     @cp_meters.dispose
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ● 战斗阶段开始 プレバトルフェーズ開始
  437.   #--------------------------------------------------------------------------
  438.   alias xrxs65_start_phase1 start_phase1
  439.   def start_phase1
  440.     # 呼び戻す
  441.     xrxs65_start_phase1
  442.     # CP の初期化
  443.     cp_preset_troop
  444.     # CP メーターの更新
  445.     @cp_meters.refresh
  446.     # インデックスを計算
  447.     #@cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  448.     # アクターコマンドウィンドウに追加
  449.     #@actor_command_window.add_command("逃げる")
  450.     #if !$game_temp.battle_can_escape
  451.     #  @actor_command_window.disable_item(@cp_escape_actor_command_index)
  452.     #end
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   # ● 派对命令阶段开始 パーティコマンドフェーズ開始
  456.   #--------------------------------------------------------------------------
  457.   alias xrxs65_start_phase2 start_phase2
  458.   def start_phase2
  459.     # 呼び戻す
  460.     xrxs65_start_phase2
  461.     # パーティコマンドウィンドウを無効化
  462.     @party_command_window.active  = false
  463.     @party_command_window.visible = false
  464.     # 強制的にフェイズ 2 を保持
  465.     @phase = 2
  466.     # ただし、既に行動可能者が存在する場合は 3 へ
  467.     start_phase3 if anybody_movable?
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # ○ CP制での ターンのカウント
  471.   #--------------------------------------------------------------------------
  472.   def cp_turn_count
  473.     $game_temp.battle_turn += 1
  474.     # バトルイベントの全ページを検索
  475.     for index in 0...$data_troops[@troop_id].pages.size
  476.       # このページのスパンが [ターン] の場合
  477.       if $data_troops[@troop_id].pages[index].span == 1
  478.         # 実行済みフラグをクリア
  479.         $game_temp.battle_event_flags[index] = false
  480.       end
  481.     end
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ●帧更新(派对命令阶段)  フレーム更新 (パーティコマンドフェーズ)
  485.   #--------------------------------------------------------------------------
  486.   alias xrxs65_update_phase2 update_phase2
  487.   def update_phase2
  488.     # パーティコマンドウィンドウのインデックスを無効化
  489.     @party_command_window.index = -1
  490.     # 呼び戻す
  491.     xrxs65_update_phase2
  492.     # 例外補正
  493.     @turn_count_time = 1 if @turn_count_time == nil
  494.     # ターンのカウント
  495.     if @turn_count_time > 0
  496.       @turn_count_time -= 1
  497.       if @turn_count_time == 0
  498.         cp_turn_count
  499.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  500.       end
  501.     end
  502.     # CP のフレーム更新
  503.     cp_update
  504.     @cp_meters.refresh
  505.     # フル CP のバトラーが存在する場合、ターン開始
  506.     start_phase3 if anybody_movable?
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # ○ フル CP バトラーが存在するか?
  510.   #--------------------------------------------------------------------------
  511.   def anybody_movable?
  512.     for battler in $game_party.actors + $game_troop.enemies
  513.       return true if battler.cp_full?
  514.     end
  515.     return false
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● アクターコマンドウィンドウのセットアップ
  519.   #--------------------------------------------------------------------------
  520.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  521.   def phase3_setup_command_window
  522.     # 効果音の再生
  523.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  524.     # 呼び戻す
  525.     xrxs65_phase3_setup_command_window
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  529.   #--------------------------------------------------------------------------
  530.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  531.   def update_phase3_basic_command
  532.     # C ボタンが押された場合
  533.     if Input.trigger?(Input::C)
  534.       # アクターコマンドウィンドウのカーソル位置で分岐
  535.       case @actor_command_window.index
  536.       when @cp_escape_actor_command_index # 逃げる
  537.         if $game_temp.battle_can_escape
  538.           # 決定 SE を演奏
  539.           $game_system.se_play($data_system.decision_se)
  540.           # アクションを設定
  541.           @active_battler.current_action.kind = 0
  542.           @active_battler.current_action.basic = 4
  543.           # 次のアクターのコマンド入力へ
  544.           phase3_next_actor
  545.         else
  546.           # ブザー SE を演奏
  547.           $game_system.se_play($data_system.buzzer_se)
  548.         end
  549.         return
  550.       end
  551.     end
  552.     # 呼び戻す
  553.     xrxs_bsp1_update_phase3_basic_command
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● メインフェーズ開始
  557.   #--------------------------------------------------------------------------
  558.   alias xrxs65_start_phase4 start_phase4
  559.   def start_phase4
  560.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  561.     $game_temp.battle_turn -= 1
  562.     # フラグを退避
  563.     save_flags = $game_temp.battle_event_flags.dup
  564.     # 呼び戻す
  565.     xrxs65_start_phase4
  566.     # フラグを復旧
  567.     $game_temp.battle_event_flags = save_flags
  568.   end
  569.   #--------------------------------------------------------------------------
  570.   # ● 行動順序作成
  571.   #--------------------------------------------------------------------------
  572.   alias xrxs65_make_action_orders make_action_orders
  573.   def make_action_orders
  574.     # 呼び戻す
  575.     xrxs65_make_action_orders
  576.     # CPが不足している場合は @action_battlers から除外する
  577.     for battler in @action_battlers.dup
  578.       @action_battlers.delete(battler) unless battler.cp_full?
  579.     end
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ● 帧更新(主阶段步骤2:动作开始) フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  583.   #这是到达终点了,使用动作,需要判断是否用了技能
  584.   #--------------------------------------------------------------------------
  585. alias xrxs65_update_phase4_step2 update_phase4_step2
  586.   def update_phase4_step2
  587.     # ガードの解除
  588.  
  589.     #▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
  590.     #dpx-使用技能的CP达到65536则施展技能
  591.  
  592.     # 如果不是强制行动
  593.     unless @active_battler.current_action.forcing
  594.       # 限制为 [s熟练度1、2] 的情况下
  595.       if @active_battler.states.include?(State_Proficiency1) || @active_battler.states.include?(State_Proficiency2)
  596.         #p "开始使用技能"
  597.         #make_skill_action_result的定制版本,从全局的Temp里面选取
  598.         temp_list = $game_system.get_DPX_temp(@active_battler)
  599.         @skill = temp_list[0]
  600.         #DPX-增加技能使用次数
  601.         DPX_skill_use_num_up(@active_battler,@skill)              
  602.         # 如果不是强制行动
  603.         unless @active_battler.current_action.forcing
  604.           # 因为 SP 耗尽而无法使用的情况下
  605.           unless @active_battler.skill_can_use?(@skill.id)
  606.             # 清除强制行动对像的战斗者
  607.             $game_temp.forcing_battler = nil
  608.             # 移至步骤 1
  609.             @phase4_step = 1
  610.             return
  611.           end
  612.         end
  613.  
  614.         # 消耗 SP
  615.         @active_battler.sp -= @skill.sp_cost
  616.         # 刷新状态窗口
  617.         @status_window.refresh
  618.         # 在帮助窗口显示特技名
  619.         @help_window.set_text(@skill.name, 1)
  620.         # 设置动画 ID
  621.         @animation1_id = @skill.animation1_id
  622.         @animation2_id = @skill.animation2_id
  623.         # 设置公共事件 ID
  624.         @common_event_id = @skill.common_event_id
  625.         # 设置对像侧战斗者
  626.         #set_target_battlers(@skill.scope)
  627.         # 应用特技效果
  628.         @target_battlers=[]
  629.         @target_battlers = temp_list[1]
  630.         for target in @target_battlers
  631.           target.skill_effect(@active_battler, @skill)
  632.         end
  633.  
  634.         @active_battler.cp = 0 #CP条清零
  635.         #@cp_meters.refresh
  636.         #移除施法状态
  637.         @active_battler.remove_state(State_Proficiency1)
  638.         @active_battler.remove_state(State_Proficiency2)
  639.         #清除暂时存储的施法者,技能,受法者ID
  640.         $game_system.remove_DPX_temp(@active_battler)
  641.         #$game_temp.forcing_battler = nil
  642.  
  643.         # 例外補正
  644.         return if @active_battler == nil
  645.         #回合计数
  646.         if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  647.           cp_turn_count
  648.         end
  649.  
  650.         @phase4_step = 3 #不需要选择,直接挪到步骤三
  651.         return
  652.       end
  653.     end
  654.  
  655.  
  656.  
  657.     @active_battler.guarding = false
  658.  
  659.     #DPX-跑技能条
  660.     case @active_battler.current_action.kind
  661.     when 0  # 基本
  662.       # CPの消費
  663.       @active_battler.cp = 0
  664.     when 1  # 特技
  665.       @skill = $data_skills[@active_battler.current_action.skill_id]
  666.       #不需要修改cp值,附加状态
  667.       @cp_meters.refresh
  668.       if @active_battler.is_a?(Game_Actor)#如果行动发出者是玩家
  669.         DPX_skill_state(@active_battler,@skill.id) #根据熟练度增加法术状态
  670.       else
  671.         if @active_battler.skill_can_use?(@skill.id)
  672.           @active_battler.add_state(State_Proficiency_Enemy)#敌人默认是2级熟练度,增加2级法术状态
  673.         elsif @skill.id==90#会心一击特殊技能,不需要消耗sp,剧情用
  674.           @active_battler.add_state(State_Proficiency3)
  675.         else
  676.           @active_battler.current_action.kind = 0
  677.           update_phase4_step2
  678.         end
  679.       end
  680.  
  681.       #如果是熟练度3,直接施法
  682.       if @active_battler.states.include?(State_Proficiency3)
  683.         @active_battler.remove_state(State_Proficiency3)
  684.         @active_battler.cp = 0
  685.         # 清除对像战斗者
  686.         @target_battlers = []
  687.         #make_skill_action_result
  688.  
  689.         # 消耗 SP
  690.         @active_battler.sp -= @skill.sp_cost
  691.         # 刷新状态窗口
  692.         @status_window.refresh
  693.         # 在帮助窗口显示特技名
  694.         @help_window.set_text(@skill.name, 1)
  695.         # 设置动画 ID
  696.         @animation1_id = @skill.animation1_id
  697.         @animation2_id = @skill.animation2_id
  698.         # 设置公共事件 ID
  699.         @common_event_id = @skill.common_event_id
  700.         # 设置对像侧战斗者
  701.         set_target_battlers(@skill.scope)
  702.  
  703.         # 应用特技效果
  704.         for target in @target_battlers
  705.           target.skill_effect(@active_battler, @skill)
  706.         end
  707.  
  708.         # 移至步骤 3
  709.         if @phase4_step == 2
  710.           @phase4_step = 3
  711.         end
  712.         return
  713.       elsif @active_battler.states.include?(State_Proficiency1) || @active_battler.states.include?(State_Proficiency2)
  714.         #需要将行动人物ID,skill和target暂时存储起来,在CP=65535施法时使用
  715.         @target_battlers=[]
  716.         set_target_battlers(@skill.scope)
  717.         $game_system.add_DPX_temp(@active_battler,@skill,@target_battlers)
  718.         # 清除行动强制对像的战斗者
  719.         $game_temp.forcing_battler = nil
  720.         # 移至步骤 1
  721.         @phase4_step = 1
  722.         return
  723.       end
  724.     when 2  # 物品
  725.       @active_battler.cp = 0
  726.     end   
  727.     #▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲   
  728.     # CP メーターの更新
  729.     @cp_meters.refresh
  730.     # 呼び戻す
  731.     xrxs65_update_phase4_step2 #继续原生update_phase4_step2脚本
  732.     # 例外補正
  733.     return if @active_battler == nil
  734.     # ターンコントローラ
  735.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  736.       cp_turn_count
  737.     end
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ● 基本行动制作结果 基本アクション 結果作成
  741.   #这是防御、逃跑的CP更新
  742.   #--------------------------------------------------------------------------
  743.   alias xrxs65_make_basic_action_result make_basic_action_result
  744.   def make_basic_action_result
  745.     # 呼び戻す
  746.     xrxs65_make_basic_action_result
  747.     # 防御の場合
  748.     if @active_battler.current_action.basic == 1
  749.       @active_battler.guarding = true
  750.       return
  751.     end
  752.     # パーティの逃亡の場合
  753.     if @active_battler.current_action.basic == 4
  754.       # 逃走可能ではない場合
  755.       if $game_temp.battle_can_escape == false
  756.         # ブザー SE を演奏
  757.         $game_system.se_play($data_system.buzzer_se)
  758.         return
  759.       end
  760.       # パーティ全員の CP をクリア 派对全员的CP通关成功
  761.       for actor in $game_party.actors
  762.         actor.cp = 0
  763.       end
  764.       # CP メーターの更新
  765.       @cp_meters.refresh
  766.       # 逃走処理
  767.       update_phase2_escape
  768.       return
  769.     end
  770.   end
  771.   #--------------------------------------------------------------------------
  772.   # ● 帧更新(主阶段步骤5:伤害表示) フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  773.   #--------------------------------------------------------------------------
  774.   alias xrxs65_update_phase4_step5 update_phase4_step5
  775.   def update_phase4_step5
  776.     # 召回 呼び戻す
  777.     xrxs65_update_phase4_step5
  778.     # CP メーターの更新
  779.     @cp_meters.refresh
  780.   end
  781. end
  782. #==============================================================================
  783. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  784. #==============================================================================
  785. class CP_Meters
  786.   #--------------------------------------------------------------------------
  787.   # ○ オブジェクト初期化
  788.   #--------------------------------------------------------------------------
  789.   def initialize
  790.     # メーター群の生成
  791.     @meters = []
  792.     for i in 0...$game_party.actors.size
  793.       make_meter(i)
  794.     end
  795.     refresh
  796.   end
  797.   #--------------------------------------------------------------------------
  798.   # ○ リフレッシュ
  799.   #--------------------------------------------------------------------------
  800.   def refresh
  801.     # 戦闘メンバー数の変更を判別
  802.     for i in @meters.size...$game_party.actors.size
  803.       make_meter(i)
  804.     end
  805.     for i in $game_party.actors.size...@meters.size
  806.       @meters[i].dispose
  807.       @meters[i] = nil
  808.     end
  809.     @meters.compact!
  810.     # 表示更新
  811.     for i in 0...$game_party.actors.size
  812.       actor = $game_party.actors[i]
  813.       @meters[i].line   = actor.cp_linetype
  814.       @meters[i].amount = actor.cp_lineamount
  815.     end
  816.   end
  817.   #--------------------------------------------------------------------------
  818.   # ○ メーターひとつの生成
  819.   #--------------------------------------------------------------------------
  820.   def make_meter(i)
  821.     # スキンの取得
  822.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  823.     #
  824.     space = 640 / XRXS65::MAX
  825.     case XRXS65::ALIGN
  826.     when 0
  827.       actor_x = i * space + 4
  828.     when 1
  829.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  830.     when 2
  831.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  832.     end
  833.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  834.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  835.     meter.y = XRXS65::Y_OFFSET
  836.     @meters[i] = meter
  837.   end
  838.   #--------------------------------------------------------------------------
  839.   # ○ 可視状態
  840.   #--------------------------------------------------------------------------
  841.   def visible=(b)
  842.     @meters.each{|sprite| sprite.visible = b }
  843.   end
  844.   #--------------------------------------------------------------------------
  845.   # ○ 解放
  846.   #--------------------------------------------------------------------------
  847.   def dispose
  848.     @meters.each{|sprite| sprite.dispose }
  849.   end
  850. end
  851. #==============================================================================
  852. # --- XRXS. レクタンギュラーメーター表示・極 ---
  853. #==============================================================================
  854. class MeterSprite < Sprite
  855.   #--------------------------------------------------------------------------
  856.   # ○ オブジェクト初期化
  857.   #--------------------------------------------------------------------------
  858.   def initialize(skin, line_height)
  859.     @skin   = skin
  860.     @width  = @skin.width
  861.     @height = line_height
  862.     @line   = 1
  863.     @amount = 0
  864.     @base_sprite = Sprite.new
  865.     @base_sprite.bitmap = @skin
  866.     @base_sprite.src_rect.set(0, 0, @width, @height)
  867.     @base_sprite.z = 601
  868.     super()
  869.     self.z = @base_sprite.z + 1
  870.     self.bitmap = @skin
  871.     self.line = 1
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ○ 値の設定
  875.   #--------------------------------------------------------------------------
  876.   def line=(n)
  877.     @line = n
  878.     refresh
  879.   end
  880.   def amount=(n)
  881.     @amount = n
  882.     refresh
  883.   end
  884.   def refresh
  885.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ○ 座標の設定
  889.   #--------------------------------------------------------------------------
  890.   def x=(n)
  891.     super
  892.     @base_sprite.x = n
  893.   end
  894.   def y=(n)
  895.     super
  896.     @base_sprite.y = n
  897.   end
  898.   #--------------------------------------------------------------------------
  899.   # ○ 解放
  900.   #--------------------------------------------------------------------------
  901.   def dispose
  902.     @base_sprite.dispose
  903.     super
  904.   end
  905. end


●AX追加+CP条图标闪烁
RUBY 代码复制
  1. # ▼▲▼ XRXS65A. CP制御ターンシステム「シンセ・ゲージ」 ▼▲▼ built201202
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # □ カスタマイズポイント
  6. #==============================================================================
  7. class XRXS65A
  8.   #--------------------------------------------------------------------------
  9.   # 「アイコン設定」
  10.   #--------------------------------------------------------------------------
  11.   DEFAULT = "怪物行动条.png" # 默认图标(未设定均为此)
  12.   # 人物图标  记述方式: ID名ー程序图标
  13.   ICONS = {
  14.     1=>"行动条-主角1.png",
  15.     4=>"行动条-主角4.png",
  16.     7=>"行动条-主角7.png",
  17.       }
  18.   # 怪物图标  记述方式: ID名ー程序图标
  19.   ICONE = {
  20.     1=>"行动条-幽灵.png",
  21.     2=>"行动条-蜥蜴.png",
  22.     21=>"行动条-食人魔.png",
  23.   }
  24.   #--------------------------------------------------------------------------
  25.   # 「シンセ・ゲージ」
  26.   #--------------------------------------------------------------------------
  27.   SKIN = "CPLine"  # スキン
  28.   X    =  400         # X 座標
  29.   Y    =  36         # Y 座標
  30.  
  31.   # 闪烁时光芒的颜色
  32.   Flash_color = Color.new(255, 255, 255, 128)
  33.   # 闪烁时间
  34.   Flash_duration = 5
  35.   # 闪烁间隔
  36.   Flash_interval = 10
  37.  
  38. end
  39. #==============================================================================
  40. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ --- [再定義]
  41. #==============================================================================
  42.  
  43. #以下代码是实现CP条图标闪烁
  44. class Game_System
  45.   def new_DPX_ICON_temp
  46.     @ICON_Sprite_temp=[]
  47.   end
  48.  
  49.   def push_DPX_ICON_temp(set)
  50.     @ICON_Sprite_temp.push(set)
  51.   end
  52.  
  53.   def get_DPX_ICON_temp
  54.     return @ICON_Sprite_temp
  55.   end
  56.  
  57.   alias dpx_icon_initialize initialize
  58.   def initialize
  59.     @iCON_target = []
  60.     dpx_icon_initialize
  61.   end
  62.  
  63.   def get_DPX_self_temp(self_v)
  64.     @iCON_target = []
  65.     @iCON_target = self_v
  66.   end
  67.  
  68.   def get_icon_target
  69.     return @iCON_target
  70.   end
  71.  
  72.   def reset_icon_target
  73.     set = $game_system.get_DPX_ICON_temp
  74.     for i in set
  75.       if @iCON_target.is_a?(Arrow_Actor)
  76.         if @iCON_target.actor == i[1]
  77.           i[0].update
  78.         end
  79.  
  80.       elsif @iCON_target.is_a?(Arrow_Enemy)
  81.         if @iCON_target.enemy == i[1]
  82.           i[0].update
  83.         end
  84.       end
  85.     end
  86.  
  87.     @iCON_target = []
  88.   end
  89.  
  90. end
  91.  
  92.  
  93. class Arrow_Enemy < Arrow_Base
  94.  
  95.   alias DPX_update update
  96.   def update
  97.     DPX_update()
  98.     $game_system.get_DPX_self_temp(self)
  99.    end
  100.  
  101. end
  102.  
  103. class Arrow_Actor < Arrow_Base
  104.  
  105.   alias DPX_update2 update
  106.   def update
  107.     DPX_update2()
  108.     $game_system.get_DPX_self_temp(self)
  109.    end
  110.  
  111. end
  112.  
  113.  
  114.  
  115. class Scene_Battle
  116.  
  117.   alias dPX_Arrow_update update
  118.   def update
  119.     dPX_Arrow_update()
  120.     cpicon_update
  121.   end
  122.  
  123.  
  124.   alias old_main main
  125.   def main
  126.     @count = 0
  127.     old_main
  128.   end
  129.  
  130.   def cpicon_update
  131.     set = $game_system.get_DPX_ICON_temp
  132.     for i in set
  133.       iCON_target = $game_system.get_icon_target
  134.       if iCON_target != [] && iCON_target != nil
  135.         i[0].update
  136.         if iCON_target.is_a?(Arrow_Actor)
  137.           if iCON_target.actor == i[1]
  138.             @count += 1
  139.             CPicon_flash(@count,i)
  140.             @count = 0 if @count == 20
  141.           else
  142.             cpicon_reset
  143.           end
  144.         else         
  145.           if iCON_target.enemy == i[1]
  146.             @count += 1
  147.             CPicon_flash(@count,i)
  148.             @count = 0 if @count == 20
  149.           else
  150.             cpicon_reset
  151.           end
  152.         end
  153.  
  154.       end
  155.     end
  156.   end
  157.  
  158.   alias dpx_update_phase4 update_phase4
  159.   def update_phase4
  160.     $game_system.reset_icon_target
  161.     dpx_update_phase4
  162.   end
  163.  
  164.   alias dpx_update_phase3 update_phase3
  165.   def update_phase3
  166.     $game_system.reset_icon_target
  167.     dpx_update_phase3
  168.   end
  169.  
  170.  
  171.   def CPicon_flash(count,set)
  172.     if count % XRXS65A::Flash_interval == 0
  173.       set[0].flash(XRXS65A::Flash_color, XRXS65A::Flash_duration)
  174.     else
  175.     end
  176.   end
  177.  
  178.   def cpicon_reset
  179.  
  180.   end
  181.  
  182.  
  183. end
  184.  
  185.  
  186. class CP_Meters
  187.   #--------------------------------------------------------------------------
  188.   # ○ オブジェクト初期化
  189.   #--------------------------------------------------------------------------
  190.   def initialize
  191.     # シンセゲージの生成
  192.     @base = Sprite.new
  193.     @base.bitmap = RPG::Cache.windowskin(XRXS65A::SKIN).dup
  194.     @base.x = XRXS65A::X
  195.     @base.y = XRXS65A::Y
  196.     @base.z = XRXS65A::X
  197.     @width  = @base.bitmap.width - 12
  198.     @height = @base.bitmap.height
  199.     @icon_set = []
  200.     $game_system.new_DPX_ICON_temp
  201.     refresh
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ○ リフレッシュ
  205.   #--------------------------------------------------------------------------
  206.   def refresh
  207.     # 生成すべきバトラーの取得
  208.     need_initializes = []
  209.     for battler in $game_party.actors + $game_troop.enemies
  210.       exist = false
  211.       for set in @icon_set
  212.         exist |= (set[1] == battler)
  213.       end
  214.       need_initializes.push(battler) unless exist
  215.     end
  216.     for battler in need_initializes
  217.       iconname = nil
  218.       if battler.is_a?(Game_Actor)
  219.         iconname = XRXS65A::ICONS[battler.id]
  220.       else
  221.         iconname = XRXS65A::ICONE[battler.id]
  222.       end
  223.       if iconname == nil
  224.         iconname = XRXS65A::DEFAULT
  225.       end
  226.       sprite = Sprite.new
  227.       sprite.bitmap = RPG::Cache.icon(iconname).dup
  228.       sprite.y = XRXS65A::Y + @height / 2 - 12
  229.       @icon_set.push([sprite, battler])
  230.       #DPX修改
  231.       $game_system.push_DPX_ICON_temp([sprite, battler])
  232.  
  233.     end
  234.     # 更新
  235.     for set in @icon_set
  236.       set[0].x = XRXS65A::X + @width * set[1].cp / set[1].max_cp - 12
  237.       set[0].z = set[0].x
  238.       set[0].visible = false if set[1].dead? or !set[1].exist?
  239.       if set[1].dead? or !set[1].exist?
  240.         $game_system.remove_DPX_temp(set[1])
  241.       end
  242.       #解决复活后图标消失
  243.       set[0].visible = true if !set[1].dead? or set[1].exist?
  244.       set[0].update
  245.     end
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ○ 可視状態
  249.   #--------------------------------------------------------------------------
  250.   def visible=(b)
  251.     @base.visible = b
  252.     @icon_set.each{|set| set[0].visible = b }
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ○ 解放
  256.   #--------------------------------------------------------------------------
  257.   def dispose
  258.     @base.dispose
  259.     @icon_set.each{|set| set[0].dispose }
  260.     $game_system.new_DPX_ICON_temp
  261.   end
  262. end


【总结】
14年接触RPG Maker XP到现在,一直希望能在自己的游戏里实现仙三的半回合制,也是最近开发游戏时搜索脚本发现了论坛里的CP条系统,于是下定决心在论坛里学了Ruby代码,接着在原有代码的基础上做了改进。
属于是脚本小白第一次写脚本,可能很多地方还不是很完善,代码也可能有冗余的地方,各位若觉得有可以改进的地方欢迎指出。例如现在就有一个没有解决的问题就是行动条始终出现在画面最上方可能会挡住法术信息。
最终实现效果其实也没有完全复刻仙三的半回合战斗制,现阶段人物行动时CP条不会继续增加,如果要完全复刻仙三的战斗,还需要给人物增加动画,并设置伤害起效帧,这样才能实现攻击时不在原位的闪避,不过看似工作量很大因此就没有继续弄了。所以1、2级能施法成功也不是很容易,因为只要敌人可以行动并攻击了,就可以打断施法,所以为了降低难度,给受击解除施法增加了概率值(刚好状态也自带这个功能)。

仿仙三法术CP条战斗测试.rar

377.92 KB, 阅读权限: 10, 下载次数: 15

附件中包含了人物行动条图标的psd文件

评分

参与人数 1+1 收起 理由
言物之石 + 1 塞糖

查看全部评分

Lv4.逐梦者

梦石
0
星屑
8075
在线时间
1001 小时
注册时间
2017-10-6
帖子
41
2
发表于 2023-12-20 18:34:05 | 只看该作者
牛!居然还能看到xp的新脚本 必是老人了
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33183
在线时间
10490 小时
注册时间
2009-3-15
帖子
4756
3
发表于 2023-12-20 20:19:19 | 只看该作者
好东西...支持
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33183
在线时间
10490 小时
注册时间
2009-3-15
帖子
4756
4
发表于 2023-12-26 09:54:39 | 只看该作者
本帖最后由 soulsaga 于 2023-12-26 20:42 编辑

也可以弄合体技....
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
177
在线时间
15 小时
注册时间
2023-12-18
帖子
3
5
 楼主| 发表于 2023-12-27 11:38:37 | 只看该作者
soulsaga 发表于 2023-12-26 09:54
也可以弄合体技....

嗯...满足某几个条件,比如队友在某种状态,使出某个技能就可以触发合体技。在实施行动的update_phase4_step2函数里增加判据,判断成功强制实施合体技。
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33183
在线时间
10490 小时
注册时间
2009-3-15
帖子
4756
6
发表于 2023-12-29 12:48:40 | 只看该作者
本帖最后由 soulsaga 于 2023-12-29 12:52 编辑

也可以写个降低施法被中断概率的状态
甚至霸体
还有附加了特定状态的攻击才能打断等等
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
177
在线时间
15 小时
注册时间
2023-12-18
帖子
3
7
 楼主| 发表于 2023-12-30 22:37:05 | 只看该作者
soulsaga 发表于 2023-12-29 12:48
也可以写个降低施法被中断概率的状态
甚至霸体
还有附加了特定状态的攻击才能打断等等 ...

哈哈好主意,可以新增一个受击被打断概率为0的霸体状态,在定量里不设为0,战斗时就可见了。然后在受击被打断的remove_states_shock函数中增加判据,检测到霸体状态直接return.
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 23:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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