def random_target_actor(hp0 = false)
# 初始化轮流
roulette = []
# 循环
for actor in @actors
# 符合条件的场合
if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
# 获取角色职业的位置 [位置]
position = $data_classes[actor.class_id].position
# 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
# n = 4 - position
case position
when 0
n = 7
when 1
n = 2
when 2
n = 1
else
n = 0
end
# 添加角色的轮流 n 回
n.times do
roulette.push(actor)
end
end
end
# 轮流大小为 0 的情况
if roulette.size == 0
return nil
end
# 转轮盘赌,决定角色
return roulette[rand(roulette.size)]
end