扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 132|回复: 0

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

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    5 小时前
  • 签到天数: 114 天

    连续签到: 4 天

    [LV.6]常住居民II

    2338

    主题

    403

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10612
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13381

    灌水之王

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


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


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


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


                 本帖来自P1论坛作者斗螃蟹,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=495096  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-3-14 23:41 , Processed in 0.147598 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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