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

Project1

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

技能的延迟发动(定时炸弹)

[复制链接]

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

跳转到指定楼层
1
发表于 2014-5-21 16:10:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 taroxd 于 2014-9-7 15:55 编辑

RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2. # ● require Taroxd基础设置
  3. #    使用方法:技能备注<delay n>,n 为延迟的回合数,n <= 0 为当前回合结束时发动
  4. #             技能备注<delay message s>,s为技能施放时提示的信息。
  5. #             其中使用者名称用\N代替。
  6. #--------------------------------------------------------------------------
  7.  
  8. class RPG::UsableItem
  9.   note_i :delay, false
  10.   note_s :delay_message
  11. end
  12.  
  13. class Window_BattleLog < Window_Selectable
  14.   #--------------------------------------------------------------------------
  15.   # ● 显示延迟使用技能/物品
  16.   #--------------------------------------------------------------------------
  17.   def display_delay_use_item(subject, item)
  18.     add_text(item.delay_message.gsub(/\\N/, subject.name))
  19.   end
  20. end
  21.  
  22. class Scene_Battle < Scene_Base
  23.   #--------------------------------------------------------------------------
  24.   # ● 初始化延迟列表
  25.   #--------------------------------------------------------------------------
  26.   def_after(:start) { @delay_list = [] }
  27.   #--------------------------------------------------------------------------
  28.   # ● 使用技能/物品
  29.   #--------------------------------------------------------------------------
  30.   def_chain :use_item do |old|
  31.     item = @subject.current_action.item
  32.     return old.call unless item.delay
  33.     @log_window.display_delay_use_item(@subject, item)
  34.     subject = @subject
  35.     action = @subject.current_action
  36.     @delay_list.push Fiber.new {
  37.       item.delay.times { Fiber.yield }
  38.       subject.actions.unshift(action)
  39.       @subject, subject = subject, @subject
  40.       old.call
  41.       @subject.remove_current_action
  42.       @subject = subject
  43.     }
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 回合结束
  47.   #--------------------------------------------------------------------------
  48.   def_before(:turn_end) { @delay_list.delete_if(&:resume) }
  49. end
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-5-5 15:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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