#用于角色特定职业普通攻击可攻击2个对象(1个选定,另一个随机)by 冰水金刚
#复制脚本,插入到 main 前。
#脚本第38行填写职业id
class Scene_Battle
#--------------------------------------------------------------------------
# ● 生成基本行动结果
#--------------------------------------------------------------------------
def make_basic_action_result
# 攻击的情况下
if @active_battler.current_action.basic == 0
# 设置攻击 ID
@animation1_id = @active_battler.animation1_id
@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)
target2 = $game_troop.random_target_enemy2(index)
end
end
# 职业判定
if @active_battler.class_id == 1 #(这行输入职业id)
# 设置对像方的战斗者序列
@target_battlers = [target,target2]
# 应用通常攻击效果
a = 1
for target in @target_battlers
if a == 2
break
end
a += 1
if target2 == nil
if target != nil
target.attack_effect(@active_battler)
end
else
if target != nil
target.attack_effect(@active_battler)
end
target2.attack_effect(@active_battler)
end
end
return
else
# 设置对像方的战斗者序列
@target_battlers = [target]
# 应用通常攻击效果
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
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
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 4 : 对像方动画)
#--------------------------------------------------------------------------
def update_phase4_step4
# 对像方动画
for target in @target_battlers
if target != nil
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
end
# 限制动画长度、最低 8 帧
@wait_count = 8
# 移至步骤 5
@phase4_step = 5
end
def update_phase4_step5
# 隐藏帮助窗口
@help_window.visible = false
# 刷新状态窗口
@status_window.refresh
# 显示伤害
for target in @target_battlers
if target != nil
if target.damage != nil
target.damage_pop = true
end
end
end
# 移至步骤 6
@phase4_step = 6
end
end
class Game_Troop
#--------------------------------------------------------------------------
# ● 对像敌人的除本次随机确定
# hp0 : 限制 HP 0 的敌人
#--------------------------------------------------------------------------
def random_target_enemy2(index2,hp0 = false)
# 初始化轮流
roulette = []
# 循环
for enemy in @enemies
# 条件符合的情况下
if (not hp0 and enemy.exist?) or (hp0 and enemy.hp0?)
if enemy != @enemies[index2]
# 添加敌人到轮流
roulette.push(enemy)
end
end
end
# 轮流尺寸为 0 的情况下
if roulette.size == 0
return nil
end
# 转轮盘赌,决定敌人
return roulette[rand(roulette.size)]
end
end
# 敌人职业无效化
class Game_Enemy < Game_Battler
attr_accessor :class_id
end