查看: 2178|回复: 0

战斗指令优化

[复制链接]

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2015-1-10 11:35:21 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 taroxd 于 2015-1-10 11:37 编辑

[pre lang="ruby" line="1"]

#--------------------------------------------------------------------------
# ● require Taroxd基础设置
#    战斗指令优化
#--------------------------------------------------------------------------
#    效果:
#      攻击指令无需选择目标时,跳过目标选择。
#      防御指令需要选择目标时,添加目标选择。
#      攻击、防御的指令名变为对应的技能名。(“用语”中的设置将会无效)
#--------------------------------------------------------------------------

Taroxd::BattleCommandExt = true

class Scene_Battle < Scene_Base

  # 普通攻击无需选择目标的情况
  def_chain :command_attack do |old|
    skill = $data_skills[BattleManager.actor.attack_skill_id]
    if !skill.need_selection?
      BattleManager.actor.input.set_attack
      next_command
    elsif skill.for_opponent?
      old.call
    else
      BattleManager.actor.input.set_attack
      select_actor_selection
    end
  end

  # 防御需要选择目标的情况
  def_chain :command_guard do |old|
    skill = $data_skills[BattleManager.actor.guard_skill_id]
    if skill.need_selection?
      BattleManager.actor.input.set_guard
      skill.for_opponent? ? select_enemy_selection : select_actor_selection
    else
      old.call
    end
  end
end

class Window_ActorCommand < Window_Command

  # 更改攻击指令名称
  def add_attack_command
    name = $data_skills[@actor.attack_skill_id].name
    add_command(name, :attack, @actor.attack_usable?)
  end

  # 更改防御指令名称
  def add_guard_command
    name = $data_skills[@actor.guard_skill_id].name
    add_command(name, :guard, @actor.guard_usable?)
  end
end
[/pre]

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本发帖返回顶部