#==============================================================================
# 【 武器攻击发动特技 】
#==============================================================================
# by -> 芯☆淡茹水
#==============================================================================
# ** 使用方法 **
# 复制该脚本,插入到 main 前。
#==============================================================================
### 设置 ##
#------------------------------------------------------------------------------
# 攻击时有几率发动特技的武器 ID
WEAPON_ID = [3,4,5]
# 发动的特技 ID,与上面武器 ID 相对应。上面的第一个,对应下面的第一个,,,,
SKILL_ID = [2, 3, 4]
# 攻击时发动特技的几率百分比 % 。
PERCENT = 70
#==============================================================================
class Scene_Battle
def update_phase4_step2
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
if @active_battler.restriction == 2 or @active_battler.restriction == 3
# 设置行动为攻击
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
# 限制为 [不能行动] 的情况下
if @active_battler.restriction == 4
# 清除行动强制对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
# 清除对像战斗者
@target_battlers = []
# 行动种类分支
case @active_battler.current_action.kind
when 0 # 基本
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# 如果战斗者是角色
if @active_battler.is_a?(Game_Actor)
# 如果 WEAPON_ID 数组有战斗者当前的武器ID
if WEAPON_ID.include?(@active_battler.weapon_id)
# 随机 100 小于 百分比 的情况下
if rand(100) < PERCENT
# 将 i 代入 0 到 WEAPON_ID 的最大个数
for i in 0...WEAPON_ID.size
# 如果战斗者的武器 ID 等于 WEAPON_ID[i]
if @active_battler.weapon_id == WEAPON_ID[i]
# 获取与 WEAPON_ID 相对应的特技ID SKILL_ID
skill = $data_skills[SKILL_ID[i]]
# 帮助窗口显示特技名
@help_window.set_text("发动武器特效" , 1)
# 获取特技动画
@animation1_id = skill.animation1_id
@animation2_id = skill.animation2_id
# 获取公共事件
@common_event_id = skill.common_event_id
# 特技有效范围
set_target_battlers(skill.scope)
# 应用特技效果
for target in @target_battlers
target.skill_effect(@active_battler, skill)
end
end
end
# 其他情况,全部为基本行动类
else
make_basic_action_result
end
else
make_basic_action_result
end
else
make_basic_action_result
end
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
when 1 # 特技
make_skill_action_result
when 2 # 物品
make_item_action_result
end
# 移至步骤 3
if @phase4_step == 2
@phase4_step = 3
end
end
end
#==============================================================================