Project1
标题:
传统连击小脚本
[打印本页]
作者:
恐惧剑刃
时间:
2014-2-11 14:11
标题:
传统连击小脚本
本帖最后由 恐惧剑刃 于 2014-7-25 12:00 编辑
更新下。。。
@atk_chain_states 是 攻击状态id 的数组
举个例子,比如有一个id为20的状态——狂怒
而附加这个状态的角色或者敌人都会进行三连击
那么
这样设置:
@atk_chain_states.push(20)
设置多次攻击的次数
@atk_chain_num[20] = 2#多攻击2下即攻击三次
特技连击 直接在 @skill_chain_num 处设置
比如 @skill_chain_num[57] = 1 # 就是说 57号特技会多攻击一次即攻击两次,57号特技默认十字斩
class Game_Temp
attr_accessor :atk_chain_num, :skill_chain_num,
:atk_chain_states,
:battler_ok
alias initialize_old_dl initialize
def initialize
initialize_old_dl
@battler_ok = []
@atk_chain_num = {}
@skill_chain_num = {}
#=============== 连击 ===============#
@atk_chain_states = [20, 21, 22]
@atk_chain_num[20] = 1
@atk_chain_num[21] = 2
@atk_chain_num[22] = 3
@skill_chain_num[57] = 1
end
end
class Scene_Battle
alias update_chain_atk_skill_old update
def update
if $game_temp.battle_turn != @old_battle_turn_dl
@old_battle_turn_dl = $game_temp.battle_turn
$game_temp.battler_ok = [] if $game_temp.battler_ok != []
end
update_chain_atk_skill_old
end
#--------------------------------------------------------------------------
# ● 生成行动循序
#--------------------------------------------------------------------------
def make_action_orders
# 初始化序列 @action_battlers
@action_battlers = []
# 添加敌人到 @action_battlers 序列
for enemy in $game_troop.enemies
@action_battlers.push(enemy)
#=============== 连击 ===============#
if enemy.current_action.basic == 0
atk_states = []
for i in $game_temp.atk_chain_states
atk_states << i if enemy.state? i
end
chain_num = 0
for i in atk_states
chain_num += $game_temp.atk_chain_num[i]
end
for i in 1..chain_num
@action_battlers.push(enemy)
end
end
if enemy.current_action.kind == 1
skill_id = enemy.current_action.skill_id
return if $game_temp.skill_chain_num[skill_id].nil?
for i in 1..$game_temp.skill_chain_num[skill_id]
@action_battlers.push(enemy)
end
end
end
# 添加角色到 @action_battlers 序列
for actor in $game_party.actors
@action_battlers.push(actor)
#=============== 连击 ===============#
if actor.current_action.basic == 0
atk_states = []
for i in $game_temp.atk_chain_states
atk_states << i if actor.state? i
end
chain_num = 0
for i in atk_states
chain_num += $game_temp.atk_chain_num[i]
end
for i in 1..chain_num
@action_battlers.push(actor)
end
end
if actor.current_action.kind == 1
skill_id = actor.current_action.skill_id
return if $game_temp.skill_chain_num[skill_id].nil?
for i in 1..$game_temp.skill_chain_num[skill_id]
@action_battlers.push(actor)
end
end
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
#--------------------------------------------------------------------------
# ● 生成基本行动结果
#--------------------------------------------------------------------------
def make_basic_action_result
# 攻击的情况下
if @active_battler.current_action.basic == 0
if !$game_temp.battler_ok.include? @active_battler
# 设置攻击 ID
@animation1_id = @active_battler.animation1_id
end
@animation2_id = @active_battler.animation2_id
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
# 设置对像方的战斗者序列
@target_battlers = [target]
# 应用通常攻击效果
for target in @target_battlers
target.attack_effect(@active_battler)
end
$game_temp.battler_ok << @active_battler
return
end
# 防御的情况下
if @active_battler.current_action.basic == 1
# 帮助窗口显示"防御"
@help_window.set_text($data_system.words.guard, 1)
return
end
# 逃跑的情况下
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# 帮助窗口显示"逃跑"
@help_window.set_text("逃跑", 1)
# 逃跑
@active_battler.escape
return
end
# 什么也不做的情况下
if @active_battler.current_action.basic == 3
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
# ● 生成特技行动结果
#--------------------------------------------------------------------------
def make_skill_action_result
# 获取特技
@skill_dl = $data_skills[@active_battler.current_action.skill_id]
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 因为 SP 耗尽而无法使用的情况下
unless @active_battler.skill_can_use?(@skill_dl.id)
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
# 消耗 SP
@active_battler.sp -= @skill_dl.sp_cost
# 刷新状态窗口
@status_window.refresh
# 在帮助窗口显示特技名
@help_window.set_text(@skill_dl.name, 1)
if !$game_temp.battler_ok.include? @active_battler
# 设置动画 ID
@animation1_id = @skill_dl.animation1_id
end
@animation2_id = @skill_dl.animation2_id
# 设置公共事件 ID
@common_event_id = @skill_dl.common_event_id
# 设置对像侧战斗者
set_target_battlers(@skill_dl.scope)
# 应用特技效果
for target in @target_battlers
target.skill_effect(@active_battler, @skill_dl)
end
$game_temp.battler_ok << @active_battler
end
end
复制代码
作者:
szzyc0
时间:
2014-2-11 22:40
现在正在用p叔的二连击脚本。看来可以换一个更高级的了
作者:
chd114
时间:
2014-2-15 01:23
如果用agi/100来决定呢···我修改的那个连击敌人如果放魔法就会出问题···
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1