设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3038|回复: 15
打印 上一主题 下一主题

[已经解决] 关于战斗的一些问题(只剩第八问了)

[复制链接]

Lv6.析梦学徒

老鹰

梦石
40
星屑
33422
在线时间
6553 小时
注册时间
2012-5-26
帖子
3178

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

1
发表于 2018-3-19 18:41:14 | 显示全部楼层
本帖最后由 百里_飞柳 于 2018-3-19 18:43 编辑

6
自用的一个脚本,再给你写了个小整合

数据库-角色/敌人的备注栏填写 <Attack Skill: id> 即可指定id号技能替换之前的攻击位置,而 <Guard Skill: id> 指定替换防御位置
  1. #==============================================================================
  2. # ■ 自定义攻击防御技能id by 老鹰(http://oneeyedeagle.lofter.com/)
  3. #==============================================================================
  4. # - 在角色/敌人的备注栏中填写相应正则,即可自定义其默认的攻击/防御技能
  5. #==============================================================================
  6. # - 2018.3.6.11
  7. #==============================================================================
  8. module EAGLE
  9.   # 用于读取设置的攻击技能的正则
  10.   ATTACK_SKILL_REGEXP = /<Attack Skill: ?(\d+)>/i
  11.   # 用于读取设置的防御技能的正则
  12.   GUARD_SKILL_REGEXP = /<Guard Skill: ?(\d+)>/i
  13. end

  14. class Game_Battler < Game_BattlerBase
  15.   #--------------------------------------------------------------------------
  16.   # ● 获取普通攻击的技能 ID
  17.   #--------------------------------------------------------------------------
  18.   def attack_skill_id
  19.     @attack_skill_id
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 获取防御的技能 ID
  23.   #--------------------------------------------------------------------------
  24.   def guard_skill_id
  25.     @guard_skill_id
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 读取备注栏中的攻击技能设置
  29.   #--------------------------------------------------------------------------
  30.   def set_attack_skill_id
  31.     note =~ EAGLE::ATTACK_SKILL_REGEXP
  32.     @attack_skill_id = $1.to_i
  33.     @attack_skill_id = 1 unless @attack_skill_id > 0
  34.     note =~ EAGLE::GUARD_SKILL_REGEXP
  35.     @guard_skill_id = $1.to_i
  36.     @guard_skill_id = 2 unless @guard_skill_id > 0
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 获取备注栏
  40.   #--------------------------------------------------------------------------
  41.   def note
  42.     ""
  43.   end  
  44. end

  45. class Game_Actor < Game_Battler
  46.   #--------------------------------------------------------------------------
  47.   # ● 设置
  48.   #--------------------------------------------------------------------------
  49.   alias eagle_attack_skill_setup setup
  50.   def setup(actor_id)
  51.     eagle_attack_skill_setup(actor_id)
  52.     set_attack_skill_id
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 获取备注栏
  56.   #--------------------------------------------------------------------------
  57.   def note
  58.     actor.note
  59.   end  
  60. end

  61. class Game_Enemy < Game_Battler
  62.   #--------------------------------------------------------------------------
  63.   # ● 初始化对象
  64.   #--------------------------------------------------------------------------
  65.   alias eagle_attack_skill_init initialize
  66.   def initialize(index, enemy_id)
  67.     eagle_attack_skill_init(index, enemy_id)
  68.     set_attack_skill_id
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 变身
  72.   #--------------------------------------------------------------------------
  73.   alias eagle_attack_skill_transform transform
  74.   def transform(enemy_id)
  75.     eagle_attack_skill_transform(enemy_id)
  76.     set_attack_skill_id
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ○ 获取攻击动画
  80.   #--------------------------------------------------------------------------
  81.   if method_defined?(:atk_animation_id1)
  82.     alias eagle_attack_skill_atk_animation_id1 atk_animation_id1
  83.   end
  84.   def atk_animation_id1
  85.     id = $data_skills[attack_skill_id].animation_id
  86.     return id if id > 0
  87.     if respond_to?(:eagle_attack_skill_atk_animation_id1)
  88.       return eagle_attack_skill_atk_animation_id1
  89.     end
  90.     return 0
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 获取备注栏
  94.   #--------------------------------------------------------------------------
  95.   def note
  96.     enemy.note
  97.   end
  98. end
复制代码
  1. #==============================================================================
  2. # ■ Add-On 自定义攻击防御技能 / 整合默认战斗系统的指令选择
  3. #==============================================================================
  4. class Window_ActorCommand < Window_Command
  5.   #--------------------------------------------------------------------------
  6.   # ● 添加攻击指令
  7.   #--------------------------------------------------------------------------
  8.   def add_attack_command
  9.     add_command($data_skills[@actor.attack_skill_id].name, :attack,
  10.       @actor.attack_usable?)
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● 添加防御指令
  14.   #--------------------------------------------------------------------------
  15.   def add_guard_command
  16.     add_command($data_skills[@actor.guard_skill_id].name, :guard,
  17.       @actor.guard_usable?)
  18.   end
  19. end
  20. class Scene_Battle < Scene_Base
  21.   #--------------------------------------------------------------------------
  22.   # ● 指令“攻击”
  23.   #--------------------------------------------------------------------------
  24.   def command_attack
  25.     @skill = $data_skills[BattleManager.actor.attack_skill_id]
  26.     BattleManager.actor.input.set_skill(@skill.id)
  27.     BattleManager.actor.last_skill.object = @skill
  28.     if [email protected]_selection?
  29.       next_command
  30.     elsif @skill.for_opponent?
  31.       select_enemy_selection
  32.     else
  33.       select_actor_selection
  34.     end
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 指令“防御”
  38.   #--------------------------------------------------------------------------
  39.   def command_guard
  40.     @skill = $data_skills[BattleManager.actor.guard_skill_id]
  41.     BattleManager.actor.input.set_skill(@skill.id)
  42.     BattleManager.actor.last_skill.object = @skill
  43.     if [email protected]_selection?
  44.       next_command
  45.     elsif @skill.for_opponent?
  46.       select_enemy_selection
  47.     else
  48.       select_actor_selection
  49.     end
  50.   end
  51. end
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-4 20:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表