#作者 crow2006 66RPG
#-------------------------------------------------------------------------------
#使用说明
=begin
本脚本可以自动释放已设定好的技能,优先释放第一个技能,
如果第一个技能无法释放,则会释放第二个技能,以此类推。
非战斗状态点击一下技能即选定,再点击一下即取消,
选定的技能会根据优先顺序显示在技能窗口中。
脚本只支持设定攻击技能,其他技能请自行设定。
未设定技能时,默认为普通攻击。
=end
#-------------------------------------------------------------------------------
module ZD
#第一步:设定存储角色选定技能的变量
JN = 10 #假设有5个角色,那么变量11-变量15不要作其他用途。
#class Window_Skill < Window_Selectable中的@column_max请根据窗口自行设定,我这里是3.
#第二步:设定开启/关闭全员自动战斗的开关
KG = 10 #范例中开关号是10。
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
class Game_Actor < Game_Battler
def auto_battle
return $game_switches[ZD::KG] #全员自动战斗开关
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
class Window_Skill < Window_Selectable
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 3 #请根据窗口自行设定。
self.index = 0
refresh
end
end
#==============================================================================
# ■ Window_SkillStatus
#------------------------------------------------------------------------------
class Window_SkillStatus < Window_Base
def initialize(x, y, actor)
super(x, y, 544, WLH + 32 + 40)
@actor = actor
refresh
end
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 140, 0)
draw_actor_hp(@actor, 240, 0)
draw_actor_mp(@actor, 392, 0)
if $game_variables[ZD::JN + @actor.id][0] != nil
draw_item_name($data_skills[$game_variables[ZD::JN + @actor.id][0]], 0, 35, true)
end
if $game_variables[ZD::JN + @actor.id][1] != nil
draw_item_name($data_skills[$game_variables[ZD::JN + @actor.id][1]], 180, 35, true)
end
if $game_variables[ZD::JN + @actor.id][2] != nil
draw_item_name($data_skills[$game_variables[ZD::JN + @actor.id][2]], 360, 35, true)
end
end
end
#==============================================================================
# ■ Scene_Skill
#------------------------------------------------------------------------------
class Scene_Skill < Scene_Base
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
$game_variables[ZD::JN + @actor.id] = [] if $game_variables[ZD::JN + @actor.id] == 0
@viewport = Viewport.new(0, 0, 544, 416)
@name_window = Window_Base.new(0, 0, 544, 56)
@name_window.contents.draw_text(4, 0, 544, 24, Vocab::skill, 0)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@status_window = Window_SkillStatus.new(0, 56, @actor)
@status_window.viewport = @viewport
@skill_window = Window_Skill.new(0, 112+40, 544, 304-40, @actor)
@skill_window.viewport = @viewport
@skill_window.help_window = @help_window
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
end
#--------------------------------------------------------------------------
# ● 更新技能选择
#--------------------------------------------------------------------------
def update_skill_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill != nil
@actor.last_skill_id = @skill.id
if not $game_variables[ZD::JN + @actor.id].include?(@skill.id) and @skill.for_opponent? and $game_variables[ZD::JN + @actor.id].size <= 3
$game_variables[ZD::JN + @actor.id] += [@skill.id]
@status_window.refresh
elsif $game_variables[ZD::JN + @actor.id].include?(@skill.id)
$game_variables[ZD::JN + @actor.id] -= [@skill.id]
@status_window.refresh
end
end
if @actor.skill_can_use?(@skill)
Sound.play_decision
determine_skill
else
Sound.play_buzzer
end
end
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
class Scene_Battle < Scene_Base
def next_actor
loop do
if @actor_index == $game_party.members.size-1
start_main
return
end
@status_window.index = @actor_index += 1
@active_battler = $game_party.members[@actor_index]
if @active_battler.auto_battle
@active_battler.action.set_attack
@skill = $data_skills[$game_variables[ZD::JN + @active_battler.id][2]] if $game_variables[ZD::JN + @active_battler.id][2] != nil
@active_battler.action.set_skill($game_variables[ZD::JN + @active_battler.id][2]) if $game_variables[ZD::JN + @active_battler.id][2] != nil and @active_battler.skill_can_use?(@skill)
@skill = $data_skills[$game_variables[ZD::JN + @active_battler.id][1]] if $game_variables[ZD::JN + @active_battler.id][1] != nil
@active_battler.action.set_skill($game_variables[ZD::JN + @active_battler.id][1]) if $game_variables[ZD::JN + @active_battler.id][1] != nil and @active_battler.skill_can_use?(@skill)
@skill = $data_skills[$game_variables[ZD::JN + @active_battler.id][0]] if $game_variables[ZD::JN + @active_battler.id][0] != nil
@active_battler.action.set_skill($game_variables[ZD::JN + @active_battler.id][0]) if $game_variables[ZD::JN + @active_battler.id][0] != nil and @active_battler.skill_can_use?(@skill)
start_target_enemy_selection
@active_battler.action.target_index = @target_enemy_window.enemy.index #如果使用敌人状态脚本,此处可能有冲突。请注意。
end_target_enemy_selection
next
end
break if @active_battler.inputable?
end
start_actor_command_selection
end
end