Project1
标题:
自动战斗(??),战斗行动指令自动输入
[打印本页]
作者:
恐惧剑刃
时间:
2014-10-11 20:39
标题:
自动战斗(??),战斗行动指令自动输入
可以用来制作一次性召唤兽等等
详见工程
自动战斗.zip
(230.57 KB, 下载次数: 144)
2014-10-11 20:38 上传
点击文件名下载附件
晾晒脚本(才100多行我自豪我骄傲 233333333)
class Game_Temp
attr_accessor :input_command, :input_skill
alias initialize_input_command initialize
def initialize
initialize_input_command
@input_command = []
@input_skill = []
@input_command[1] = "防御" # 1号角色会自动防御
@input_command[2] = "特技" # 2号角色会自动防御
@input_command[7] = "特技" # 3号角色会自动施放(默认)特技
@input_command[8] = "攻击" # 4号角色会自动攻击
@input_skill[1] = 57 #1号角色的默认技能十字斩
@input_skill[2] = 61 #2号角色的默认技能扫荡
@input_skill[7] = [*1..6] #7号角色的默认技能1到6号特技
@input_skill[8] = 7 #8号角色的默认技能火炎
end
end
class Scene_Battle
def input_command # 输入指令
for actor_index in 0...$game_party.actors.size
case $game_temp.input_command[$game_party.actors[actor_index].id]
when "防御"
# 设置行动
$game_party.actors[actor_index].current_action.kind = 0
$game_party.actors[actor_index].current_action.basic = 1
when "攻击"
# 设置行动
$game_party.actors[actor_index].current_action.kind = 0
$game_party.actors[actor_index].current_action.basic = 0
# 随机选择敌人
$game_party.actors[actor_index].current_action.target_index =
$game_troop.enemies.index($game_troop.random_target_enemy)
when "特技"
if $game_temp.input_skill[$game_party.actors[actor_index].id].is_a?(Numeric)
skill = $data_skills[$game_temp.input_skill[$game_party.actors[actor_index].id]]
# 魔法不足或者无效特技
if (skill.sp_cost > $game_party.actors[actor_index].sp) or ([2, 3].include?(skill.occasion) or skill.scope == 0)
# 气血较多自动攻击,较少自动防御
if 1.0 * $game_party.actors[actor_index].hp / $game_party.actors[actor_index].maxhp >= 0.3
# 设置行动
$game_party.actors[actor_index].current_action.kind = 0
$game_party.actors[actor_index].current_action.basic = 0
# 随机选择敌人
$game_party.actors[actor_index].current_action.target_index =
$game_troop.enemies.index($game_troop.random_target_enemy)
else
# 设置行动
$game_party.actors[actor_index].current_action.kind = 0
$game_party.actors[actor_index].current_action.basic = 1
end
next
end
elsif $game_temp.input_skill[$game_party.actors[actor_index].id].is_a?(Array)
skill_id = $game_temp.input_skill[$game_party.actors[actor_index].id]
# 随机特技
input_id = []
for id in skill_id
skill = $data_skills[id]
if (skill.sp_cost <= $game_party.actors[actor_index].sp) and ([0, 1].include?(skill.occasion) and skill.scope != 0)
input_id << id
end
end
# 指令
if input_id.size != 0
skill = $data_skills[input_id[rand(input_id.size)]]
else
# 气血较多自动攻击,较少自动防御
if 1.0 * $game_party.actors[actor_index].hp / $game_party.actors[actor_index].maxhp >= 0.3
# 设置行动
$game_party.actors[actor_index].current_action.kind = 0
$game_party.actors[actor_index].current_action.basic = 0
# 随机选择敌人
$game_party.actors[actor_index].current_action.target_index =
$game_troop.enemies.index($game_troop.random_target_enemy)
else
# 设置行动
$game_party.actors[actor_index].current_action.kind = 0
$game_party.actors[actor_index].current_action.basic = 1
end
next
end
end
# 设置行动
$game_party.actors[actor_index].current_action.kind = 1
$game_party.actors[actor_index].current_action.skill_id = skill.id
# 随机选择
case skill.scope
when 1
$game_party.actors[actor_index].current_action.target_index =
$game_troop.enemies.index($game_troop.random_target_enemy)
when 3
$game_party.actors[actor_index].current_action.target_index =
$game_party.actors.index($game_party.random_target_actor)
when 5
if $game_party.random_target_actor_hp0.nil?
next
end
$game_party.actors[actor_index].current_action.target_index =
$game_party.actors.index($game_party.random_target_actor_hp0)
end
end
end
end
#--------------------------------------------------------------------------
# ● 转到输入下一个角色的命令
#--------------------------------------------------------------------------
def phase3_next_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最后的角色的情况
if @actor_index == $game_party.actors.size-1
# 开始主回合
input_command
start_phase4
return
end
# 推进角色索引
@actor_index += 1
# =======================================================
while $game_temp.input_command[$game_party.actors[@actor_index].id] != nil
@actor_index += 1
if @actor_index == $game_party.actors.size - 1
# 开始主回合
input_command
start_phase4
return
end
end
# =======================================================
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 转向前一个角色的命令输入
#--------------------------------------------------------------------------
def phase3_prior_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初的角色的情况下
if @actor_index == 0
# 开始同伴指令回合
start_phase2
return
end
# 返回角色索引
@actor_index -= 1
# =======================================================
while $game_temp.input_command[$game_party.actors[@actor_index].id] != nil
@actor_index -= 1
if @actor_index <= 0
# 开始同伴指令回合
start_phase2
return
end
end
# =======================================================
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
end
复制代码
作者:
chd114
时间:
2014-10-11 21:32
一次性召唤兽
?是召唤生物死了离队的那种吗···
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1