于是可以写成这样 以技能类来说明
[pre lang="ruby"]
if user.is_a?(Game_Actor) && user.id==1
user.cp+=65535 if rand(100)<30
end
#角色是一号角色 30%的几率CP+满=连击
[/pre]
第二方法:用脚本 技能连击脚本 你搜索一下 我暂时贴出我用到的
[pre lang="ruby"]
# ===================================================================
# 连击效果(完美版) v1.2 by SailCat
# ===================================================================
# 数据库设定(特技):
# 名称:技能名称,连击次数(要用半角逗号)
# 例如:超究舞神霸斩,11
# 狮子心,16
# 陨石,9
# 注意这是连击次数,实际攻击的回数是这个回数+1回。
# 省略逗号连同后面的参数的话,连击次数默认为零。
# 连击次数是负数的话,将取绝对值处理。
# 视觉效果是发动动画只放1回,击中动画放N回,伤害值显示N次,
# 所以,如使用了齐时战斗的话,要修改倒数第四行,该行内容为:
# @phase4_step = 4
# 改为@phase4_step = 3
# 其他:RTAB不适用
# ===================================================================
module RPG
class Skill
def name
name = @name.split(/,/)[0]
return name != nil ? name : ""
end
def hit_count
name = @name.split(/,/)[1]
return name != nil ? name.to_i.abs : 0
end
end
class Sprite < ::Sprite
def effect?
@_whiten_duration > 0 or
@_appear_duration > 0 or
@_escape_duration > 0 or
@_animation_duration > 0
end
def damage_effect?
@_damage_duration > 0 or
@_collapse_duration > 0
end
end
end
class Spriteset_Battle
def damage_effect?
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.damage_effect?
end
return false
end
end
class Scene_Battle
alias sailcat_update_phase4_step1 update_phase4_step1
alias sailcat_make_skill_action_result make_skill_action_result
alias sailcat_update_phase4_step5 update_phase4_step5
def update_phase4_step1
@hit_count = 0
$game_variables[51] = 0
#$game_variables[86] = 0
sailcat_update_phase4_step1
end
def make_skill_action_result
sailcat_make_skill_action_result
@hit_count = @skill.hit_count
end
def update_phase4_step5
sailcat_update_phase4_step5
if @hit_count > 0
$game_variables[51] += 1
for target in @target_battlers.clone
if @active_battler.dead?
return
end
if target.dead?
if @target_battlers.size > 1
@target_battlers.delete(target)
else
@target_battlers.delete(target)
if target.is_a?(Game_Enemy)
target = $game_troop.smooth_target_enemy(target.index)
else
target = $game_party.smooth_target_actor(target.index)
end
if target.is_a?(Game_Battler)
@target_battlers.push(target)
end
end
end
end
if @target_battlers.size == 0
return
end
for target in @target_battlers
if target.damage != nil
@phase4_step = 5
return
end
target.skill_effect(@active_battler, @skill)
end
# 如果你应用了23种战斗特效的公共事件版脚本请去掉下面几行的注释
if @common_event_id > 0
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
@hit_count -= 1
$game_temp.enemy_hpsp_refresh = false
@phase4_step = 4
end
end
end
[/pre]
[pre lang="ruby"]
def make_action_orders
# 初始化序列 @action_battlers
@action_battlers = []
# 添加敌人到 @action_battlers 序列
for enemy in $game_troop.enemies
#--------------------------------------------------------------------------
#当敌人行为为特技并且使用了带有40号属性的特技 #敌人几率二连击
if enemy.current_action.kind == 1 and $data_skills[enemy.current_action.skill_id].element_set.include?(40)
if rand(100) <= 50
@action_battlers.push(enemy)
end
end
#--------------------------------------------------------------------------
@action_battlers.push(enemy)
end
# 添加角色到 @action_battlers 序列
for actor in $game_party.actors
#--------------------------------------------------------------------------
#当角色行为为特技并且使用了带有18号属性的特技#剑几率三连击
# if actor.current_action.kind == 1 and $data_skills[actor.current_action.skill_id].element_set.include?(18)
# if rand(100) <= 20
# @action_battlers.push(actor)
# @action_battlers.push(actor)
# end
# end
#--------------------------------------------------------------------------
@action_battlers.push(actor)
end
# 确定全体的行动速度
for battler in @action_battlers
battler.make_action_speed
end
# 按照行动速度从大到小排列
@action_battlers.sort! {|a,b|
b.current_action.speed - a.current_action.speed }
end
[/pre]