Project1

标题: 技能冷卻解除 [打印本页]

作者: w3860000    时间: 2012-6-26 22:16
标题: 技能冷卻解除
本帖最后由 w3860000 于 2012-6-26 22:19 编辑

这是小弟在某个网站找到的技能冷却脚本...
  1. module Sword
  2.   ON = true ; OFF = false ; Sword15_Cooling = Array.new
  3. #● 使用者自定設置
  4. Sword15_XPVX = 1 # 此腳本用於XP時設為0;此腳本用在VX時設為1
  5. Sword15_Battle = 1  # 戰鬥結束時的冷卻狀態,0為不需冷卻;1為記憶;2為需冷卻
  6. Sword15_Menu1 = true # 選單中的技能畫面,是否要顯示剩餘的冷卻時間
  7. Sword15_Menu2 = 0 # 選單中的使用標準,0為一律可用;1為沒冷卻中時可用;
  8.                                   # 2為沒冷卻中時可用(使用後變更為冷卻中);3為一律不可用
  9. Sword15_Enemy = OFF # 敵人使用冷卻技能時,是否需要冷卻
  10. Sword15_Text = ' 剩\V回合才能使用' # 技能冷卻的顯示內容,\V表示剩餘冷卻回合數
  11. #--------------------------------------------------------------
  12. #○ 技能冷卻回合(Sword15_Cooling[技能編號] = 冷卻回合數)
  13. Sword15_Cooling[124] = 6
  14. Sword15_Cooling[123] = 4
  15. Sword15_Cooling[122] = 2
  16. Sword15_Cooling[93] = 3
  17. Sword15_Cooling[91] = 5
  18. Sword15_Cooling[83] = 5
  19. Sword15_Cooling[37] = 2
  20. Sword15_Cooling[62] = 2
  21. Sword15_Cooling[66] = 2
  22. Sword15_Cooling[70] = 2
  23. Sword15_Cooling[72] = 2
  24. Sword15_Cooling[74] = 2
  25. Sword15_Cooling[76] = 2
  26. Sword15_Cooling[78] = 2
  27. Sword15_Cooling[80] = 2
  28. Sword15_Cooling[82] = 2
  29. Sword15_Cooling[118] = 2
  30. Sword15_Cooling[116] = 4
  31. Sword15_Cooling[137] = 3
  32. Sword15_Cooling[136] = 2
  33. Sword15_Cooling[135] = 2
  34. Sword15_Cooling[133] = 4
  35. Sword15_Cooling[132] = 2
  36. Sword15_Cooling[131] = 3
  37. Sword15_Cooling[130] = 2
  38. Sword15_Cooling[129] = 2
  39. Sword15_Cooling[128] = 2
  40. Sword15_Cooling[127] = 2
  41. Sword15_Cooling[126] = 2
  42. Sword15_Cooling[103] = 2
  43. Sword15_Cooling[139] = 5
  44. Sword15_Cooling[142] = 6
  45. Sword15_Cooling[141] = 4
  46. Sword15_Cooling[144] = 4
  47. Sword15_Cooling[1] = 1
  48. Sword15_Cooling[2] = 1
  49. Sword15_Cooling[3] = 1
  50. Sword15_Cooling[117] = 1
  51. Sword15_Cooling[151] = 4
  52. Sword15_Cooling[150] = 4
  53. Sword15_Cooling[149] = 4
  54. Sword15_Cooling[148] = 4
  55. Sword15_Cooling[147] = 4
  56. Sword15_Cooling[146] = 4
  57. Sword15_Cooling[153] = 2
  58. Sword15_Cooling[154] = 4
  59. Sword15_Cooling[155] = 4
  60. Sword15_Cooling[159] = 4
  61. Sword15_Cooling[160] = 4
  62. Sword15_Cooling[161] = 2
  63. Sword15_Cooling[163] = 4
  64. Sword15_Cooling[164] = 4
  65. =begin
  66. ========================================
  67. =end
  68.   $Sword ? $Sword[15] = 101 : $Sword = {15=>101} # 腳本使用標誌
  69. end

  70. #=======================================
  71. #■ 處理臨時資料的類別
  72. class Game_Temp
  73.   attr_accessor :skill_id # 技能編號(選單用)
  74.   alias sword15_initialize initialize
  75.   def initialize
  76.     @skill_id = 0 ; sword15_initialize
  77.   end
  78. end
  79. #=======================================
  80. #■ 處理戰鬥者的類別
  81. class Game_Battler
  82.   include Sword # 連接自定設置
  83.   attr_accessor :cooling  # 冷卻技能表
  84.   #-------------------------------------------------------------
  85.   #● 初始化物件
  86.   alias sword15_initialize initialize
  87.   def initialize
  88.     sword15_initialize
  89.     @cooling = {}
  90.     Sword15_Cooling.each_index do |index|
  91.       next if Sword15_Cooling[index] == nil # 沒設置冷卻時間的技能跳過
  92.       if Sword15_Battle == 2 ; @cooling[index] = Sword15_Cooling[index]
  93.       else ; @cooling[index] = 0 ; end
  94.     end
  95.   end
  96.   #-------------------------------------------------------------
  97.   #● 可以使用技能的判定
  98.   alias sword15_skill_can_use? skill_can_use?
  99.   def skill_can_use?(skill_id)
  100.     if Sword15_Enemy or self.is_a?(Game_Actor)
  101.       skill_id = skill_id.id if Sword15_XPVX == 1 # 將數據轉成編號(VX)
  102.       if (not $game_temp.in_battle) # 不是戰鬥中時
  103.         return sword15_skill_can_use?(skill_id) if Sword15_Menu2 == 0 # 一律可用
  104.         return false if Sword15_Cooling.has_key?(skill_id) if Sword15_Menu2 == 3
  105.       end
  106.       return false if self.cooling[skill_id] > 0 if self.cooling[skill_id] # 冷卻技能不可使用
  107.       skill_id = $data_skills[skill_id] if Sword15_XPVX == 1 # 將編號轉成數據(VX)
  108.     end
  109.     sword15_skill_can_use?(skill_id)
  110.   end
  111. end
  112. #=======================================
  113. #■ 處理角色的類別
  114. class Game_Actor < Game_Battler
  115.   include Sword # 連接自定設置
  116.   attr_reader   :actor_id # 角色編號
  117.   attr_accessor :cooling  # 冷卻技能表
  118.   #-------------------------------------------------------------
  119.   #● 初始化物件
  120.   alias sword15_setup setup
  121.   def setup(actor_id)
  122.     sword15_setup(actor_id)
  123.     @cooling = {}
  124.     Sword15_Cooling.each_index do |index|
  125.       next if Sword15_Cooling[index] == nil # 沒設置冷卻時間的技能跳過
  126.       if Sword15_Battle == 2 ; @cooling[index] = Sword15_Cooling[index]
  127.       else ; @cooling[index] = 0 ; end
  128.     end
  129.   end
  130.   #-------------------------------------------------------------
  131.   #● 變更 SP(XP)
  132.   if Sword15_Menu2 == 2 and Sword15_Battle != 0
  133.     if Sword15_XPVX == 0 ; alias sword15_sp= sp=
  134.     else ; alias sword15_mp= mp= ; end
  135.     def sp=(a)
  136.       @cooling[$game_temp.skill_id] = Sword15_Cooling[$game_temp.skill_id] if
  137.       Sword15_Cooling[$game_temp.skill_id] != nil # 自定設置有設定就設置冷卻回合
  138.       self.sword15_sp = a
  139.     end
  140.     #-----------------------------------------------------------
  141.     #●  變更 MP(VX)
  142.     def mp=(a)
  143.       @cooling[$game_temp.skill_id] = Sword15_Cooling[$game_temp.skill_id] if
  144.       Sword15_Cooling[$game_temp.skill_id] != nil # 自定設置有設定就設置冷卻回合
  145.       self.sword15_mp = a
  146.     end
  147.   end
  148. end
  149. #=======================================
  150. #■ 技能畫面、戰鬥畫面、顯示可以使用的技能的瀏覽視窗
  151. class Window_Skill < Window_Selectable
  152.   include Sword # 連接自定設置
  153.   #-------------------------------------------------------------
  154.   #● 描繪項目
  155.   alias sword15_draw_item draw_item
  156.   def draw_item(index)
  157.     if Sword15_Menu1 or $game_temp.in_battle # 允許顯示或戰鬥時的場合
  158.       text = '' # 負責存入冷卻內容的變量
  159.       if @actor.cooling[@data[index].id] ; if @actor.cooling[@data[index].id] > 0
  160.         text = Sword15_Text ; text = text.gsub(/\\[Vv]/) { @actor.cooling[@data[index].id] }
  161.         @data[index].name += text
  162.       end ; end
  163.     end
  164.     sword15_draw_item(index)
  165.     @data[index].name = @data[index].name.gsub(/#{text}/) { '' }
  166.   end
  167. end
  168. #=======================================
  169. #■ 處理戰鬥畫面的類別
  170. class Scene_Battle
  171.   include Sword # 連接自定設置
  172.   #-------------------------------------------------------------
  173.   #● 戰鬥結束
  174.   alias sword15_battle_end battle_end
  175.   def battle_end(result)
  176.     sword15_battle_end(result)
  177.     actor = Sword15_XPVX == 0 ? $game_party.actors : $game_party.members
  178.     xpvx = Sword15_XPVX == 0 ? 1 : 0
  179.     if Sword15_Battle == 0 # 當指定為「不需冷卻」的場合
  180.       (0...actor.size).each {|i| $game_actors[actor[i].id].cooling = Hash.new}
  181.     elsif Sword15_Battle == 2 # 當指定為「需冷卻」的場合
  182.       (0...actor.size).each do |i| ; (1..Sword15_Cooling.size).each do |ii|
  183.         $game_actors[actor[i].id].cooling[ii] = Sword15_Cooling[ii] + xpvx if
  184.         Sword15_Cooling[ii] != nil # 當有設置冷卻時代入冷卻回合
  185.       end ; end
  186.     end
  187.   end
  188.   #-------------------------------------------------------------
  189.   #● 產生技能行動結果(XP)
  190.   if Sword15_XPVX == 0 ; alias sword15_make_skill_action_result make_skill_action_result
  191.   else ; alias sword15_make_skill_action_result execute_action_skill ; end
  192.   def make_skill_action_result
  193.     #○ 確認敵人是否可使用該技能
  194.     skill_id = Sword15_XPVX == 0 ? @active_battler.current_action.skill_id :
  195.     @active_battler.action.skill_id # 縮短腳本長度
  196.     skill = Sword15_XPVX == 0 ?
  197.     $data_skills[@active_battler.current_action.skill_id] :
  198.     $data_skills[@active_battler.action.skill_id]
  199.     no = false
  200.     a = Sword15_XPVX == 0 ?
  201.     @active_battler.current_action.forcing : @active_battler.action.forcing
  202.     b = Sword15_XPVX == 0 ? skill.id : skill
  203.     unless a ; unless @active_battler.skill_can_use?(b)
  204.       @phase4_step = 1 if no # 跳轉到階段1
  205.       no = true
  206.     end ; end
  207.     sword15_make_skill_action_result unless no
  208.     #○ 設置冷卻回合
  209.     return if @active_battler.cooling[skill_id] > 0 if @active_battler.cooling[skill_id] != nil
  210.     xpvx = Sword15_XPVX == 0 ? 1 : 0 # XP和VX的回合數值修正
  211.     @active_battler.cooling[skill_id] = Sword15_Cooling[skill_id] + xpvx if
  212.     Sword15_Cooling[skill_id] != nil # 如果自定設置有設定就設置冷卻回合
  213.     $game_temp.forcing_battler = nil if no # 清除強制行動對象
  214.   end
  215.   #-------------------------------------------------------------
  216.   #● 執行戰鬥行動:使用技能(VX)
  217.   def execute_action_skill
  218.     make_skill_action_result
  219.   end
  220.   #-------------------------------------------------------------
  221.   #● 更新畫面 (主回合步驟 6 : 更新)(XP)
  222.   if Sword15_XPVX == 0 ; alias sword15_update_phase4_step6 update_phase4_step6
  223.   else ; alias sword15_update_phase4_step6 set_next_active_battler ; end
  224.   def update_phase4_step6
  225.     sword15_update_phase4_step6
  226.     return if @active_battler == nil # 如果行動方是空的就中斷
  227.     @active_battler.cooling.each_key do |i|
  228.       @active_battler.cooling[i] -= 1 if @active_battler.cooling[i] > 0
  229.     end
  230.   end
  231.   #-------------------------------------------------------------
  232.   #● 設置下一戰鬥者行動(VX)
  233.   def set_next_active_battler
  234.     update_phase4_step6
  235.   end
  236. end
  237. #=======================================
  238. #■ 處理技能畫面的類別
  239. class Scene_Skill
  240.   include Sword # 連接自定設置
  241.   #-------------------------------------------------------------
  242.   #● 更新畫面 (技能視窗被活化的情況下) (XP)
  243.   if Sword15_XPVX == 0 ; alias sword15_update_skill update_skill
  244.   else ; alias sword15_update_skill update_skill_selection ; end
  245.   def update_skill
  246.     $game_temp.skill_id = @skill_window.skill.id
  247.     sword15_update_skill
  248.     $game_temp.skill_id = nil if $scene.is_a?(Scene_Skill)
  249.   end
  250.   #-------------------------------------------------------------
  251.   #● 更新技能選擇(VX)
  252.   def update_skill_selection
  253.     update_skill
  254.   end
  255. end
复制代码
可是问题来了......想要解除这个技能冷却的话他没有设开关
而且版主给的方法非常的...

$game_actors[角色編號].cooling[技能編號] = 冷卻回合

我有作转换人物介面的公共事件加总足足有七十个左右的冷却技能
如果真的全部复制贴上的话大概也有70乘上12个人物
我的手指会酸死!!
有没有比较简单的方法啊!dsu_plus_rewardpost_czw
作者: zdc223658    时间: 2012-6-27 09:36
冷却的话用这个可以实现吧

<recharge x> 该标签表示技能在施放后 x 回合内不能再次使用.
  1. #===============================================================================
  2. # Yanfly Engine RD - Custom Skill Effects ReDONE
  3. # 《自定义技能效果重制版》  简体中文化 by 小爽
  4. #
  5. # 最后更新: 2009.06.01
  6. # 适用人群: 普通玩家、专家和疯子
  7. #
  8. # 本脚本整合了两个不同效果的脚本,导致非常的巨大...
  9. # 但是一定值得你使用。看看下面的功能吧:
  10. #
  11. # - 为每个参战者增加一个怒气值. 每一回合或者每当参战者受到伤害时可以获得怒气,
  12. #   以使用需要怒气值才能发动的技能。同时也可以使用其它消费形式使用技能(不
  13. #   局限于消耗MP才能发动技能,比如HP、金钱、怒气等).
  14. # - 技能延迟:技能可以设置为延迟一定回合后才施放,怪物的技能亦可实现此效果.
  15. # - 技能冷却:技能可以设置成在施放后的一定回合内无法再次施放.
  16. # - 物品合成系统:允许你使用合成的物品,这些物品可以继承原料自带的特殊效果.
  17. # - 子技能菜单:节省技能列表菜单(例如不同级别的法术归类到该法术下的子菜单中).
  18. # - 允许技能立刻施放而不再等待到下个回合.
  19. # - 现在技能可以按指定的顺序依次施放了.
  20. # - 现在技能可以在指定的情况下在战斗中习得了.
  21. #
  22. # - 为脚本狂人量身订制的自定义技能效果. 在施放法术时、蓄力时、吟唱过程中
  23. #   或法术施放后均可自定义技能造成的效果.
  24. # - 为脚本狂人量身订制的自定义技能动画. 可以依据不同的条件为技能设置完全不同的.
  25. #   法术动画.
  26. #===============================================================================
  27. # 更新:
  28. # ----------------------------------------------------------------------------
  29. # o 2009.05.31 - 合成技能和连锁技能现在可以正确地重置消耗了.
  30. # o 2009.05.30 - Scene Battle 恢复兼容性.
  31. # o 2009.05.28 - 更改 <require learn> 为 <not require learn>
  32. #                为 子技能 及 技能链 添加 <require level> 标签.
  33. # o 2009.05.25 - Upgrade Pack 2
  34. #                添加合成物品能力
  35. #                添加瞬发技能
  36. #                添加子技能扩展
  37. #                添加技能链功能
  38. #                添加受到攻击后领悟技能
  39. # o 2009.05.18 - 修正装备技能插槽
  40. # o 2009.05.15 - 修正参战者属性:士气
  41. # o 2009.05.12 - 更高效的技能窗口.
  42. #                添加 <require element x> 标签
  43. #                修复一个惊天大bug:现在怪物们不会因技能消耗我们的金钱了-,-.
  44. # o 2009.04.22 - 现在怪物们也将受到如下效果的影响:重载、预备及次数限制
  45. #                反射现在能正确反弹伤害给对立的队伍了,反弹给怪物或者被反弹回来.
  46. # o 2009.04.19 - Upgrade Pack 1
  47. #                添加怒气值增速修改选项.
  48. #                添加无法被反弹的技能属性.
  49. #                添加技能消费值修改选项.
  50. #                为狂人们添加了技能链功能.
  51. # o 2009.04.15 - 添加 Scene_Skill 功能. 我居然会忘记这个.
  52. #                修正参战者在MP不符合时依然可以使用技能.
  53. #                Added another return for cost_custom.
  54. #                为重载添加特性.
  55. # o 2009.04.14 - 更新兼容 KGC 装备后习得技能脚本.
  56. #                添加一个爆击后等待时间的选项.
  57. #                Added common before, common during, and common after effects.
  58. #                Added calc_common_cost.
  59. # o 2009.04.12 - 本次更新整合了自定义技能脚本.
  60. #                添加一个施法时间参数用于装载技能.
  61. #                爆击信息不再占用一整行的信息窗口了.
  62. # o 2009.04.09 - 注意:这些最初是为自定义技能功能使用的.
  63. #                添加诸如“当前MP、最大MP百分比、当前HP、最大HP百分比、金钱、
  64. #                最大金钱百分比、自定义消费类型和脚本模板”用于技能的消耗.
  65. #                添加怒气系统.
  66. # 0 2009.02.18 - 完成第一版脚本.
  67. #===============================================================================
  68. # 使用方法: 正常模式
  69. #===============================================================================
  70. #
  71. # 将下列需要的标签插入到数据库——技能——备注栏里. 一次可以填入多个标签
  72. # 并由上至下执行.
  73. # 但是你不能填入两个功能相反的标签.
  74. #
  75. #   <cost curmp x> 该标签表示技能消费的MP值 x ,最大为9999.
  76. #   <cost maxmp x> 该标签表示技能消费占最大MP值的百分比 x %.
  77. #   <cost curhp x> 该标签表示技能消费的HP值 x ,会造成使用者 x 点的伤害.
  78. #   <cost maxhp x> 该标签表示技能消费占最大HP值的百分比 x %,并造成使用者 x %
  79. #                  最大血量的伤害.
  80. #    <cost gold x> 该标签表示技能消费的金币值 x.
  81. # <cost maxgold x> 该标签表示技能消费占最大(当前)金币值的 x %.
  82. #    <cost rage x> 该标签表示技能消费的怒气值 x.
  83. #   <rage boost x> 该标签表示使用技能获得的怒气值 x.
  84. #
  85. #===============================================================================
  86. # 使用方法: 专家模式
  87. #===============================================================================
  88. #
  89. # 将下列需要的标签插入到数据库——技能——备注栏里. 它们不会被优先执行,
  90. # 但是无论本回合技能是否被施放都将产生标签代表的效果.
  91. #
  92. #    <prepare x> 该标签表示技能会在战斗开始后 x 回合后施放(准备时间).
  93. #  <cast time x> 该标签表示技能施法时间为 x 回合.
  94. #    <fatigue x> 该标签表示人物在施放技能后会存在 x 回合的虚弱时间(无法操作).
  95. #   <recharge x> 该标签表示技能在施放后 x 回合内不能再次使用.
  96. # <limit uses x> 该标签表示技能在本次战斗中只能使用 x 次.
  97. #
  98. # ----------------------------------------------------------------------------
  99. # 以下为技能的特殊效果
  100. # ----------------------------------------------------------------------------
  101. #
  102. # <require all elements x> 及 <require all elements x,x>
  103. # 带有该标签的技能必须在玩家的武器属性中拥有 x 元素属性才能发动(需同时满足).
  104. # 比如技能 火球术 必须装备了火属性的武器后发动. 你需要首先为武器设置好属性.
  105. # 可以同时使用多个这样的标签.
  106. #
  107. # <require any elements x> 及 <require any elements x,x>
  108. # 带有该标签的技能必须在玩家的武器属性中拥有 x 元素属性才能发动(任意一个).
  109. # 比如技能 冰火球术 可以在装备有冰属性武器或火属性武器的情况下发动.
  110. #
  111. # <require all states x> 及 <require all states x,x>
  112. # 带有该标签的技能必须在玩家获得所有状态 x 后才能使用.
  113. #
  114. # <not require learn>
  115. # 这个标签修改自 <require learn> ,子技能和技能链专用标签.
  116. # 默认情况下,技能必须在技能窗口中可习得的状态下学习到. 使用这个标签后
  117. # 子技能和技能链属性的技能就无需学习了.
  118. #
  119. # <require level x>
  120. # 带有该标签的技能只有在玩家等级到达 x 时才会显示在子技能或技能链的窗口中.
  121. # 这不会改变学习此技能所需要的等级.
  122. #
  123. # <unreflectable>
  124. # 带有该标签的技能将无视施放对象所拥有的反弹法术状态.
  125. #
  126. # <mix items all>
  127. # 允许玩家合成物品并获得新的物品特效,此标签表示所有队伍角色拥有的物品都可以
  128. # 参与合成,但是那些被标注为 <do not mix> 的除外.
  129. #
  130. # <mix type x> or <mix type x,x>
  131. # 允许玩家合成类型为 x 的物品,持有同类标签的物品可以参与合成,你可以插入更多
  132. # 不同的类型标签来获得更多的合成方式,或者使用 <mix type x,x> .
  133. #
  134. # <do not mix>
  135. # 带有该标签的物品显然不会参与任何合成,可以使用在任务物品或者其它关键物品上.
  136. #
  137. # <instant cast>
  138. # 带有该标签的法术会在选择后立刻使用而不再按顺序施放.
  139. #
  140. # <subskills x> or <subskills x,x>
  141. # 带有该标签的技能在从技能窗口被点击时将弹出子技能菜单,里面存储着id为x的技能.
  142. # 这些技能也许是玩家已经学会的子技能,也可以是尚未学会或压根不可能学到的技能.
  143. #
  144. # <subskill only>
  145. # 带有该标签的技能只会显示在子技能窗口中(可以理解为需要前置技能).
  146. #
  147. # <open chain x>
  148. # 自由技能链,允许你一次选择 x 个技能连续施放,这些技能师你已经学会的,包括但
  149. # 不限于暂时无法使用的技能。
  150. #
  151. # <closed chain x:y> or <closed chain x:y,y>
  152. # 闭合技能链,与自由技能链的区别是,你需要指定处于技能链中的技能类型 y,只有该
  153. # 类型的技能才会显示在技能链选择菜单中.类型的指定使用下列标签.
  154. #
  155. # <closed type x> or <closed type x,x>
  156. # 带有该标签的技能可以被闭合技能链调用组成连续技,x 可以是数字或其它容易辨识的
  157. # 字符,被标识相同类型的技能可以被闭合技能链调用,如<closed type 1,2> 可以被
  158. # <closed chain 5:1> 或者<closed chain 4:1,2>调用.
  159. #
  160. # <forced chain x:y,y>
  161. # 强制技能链,与闭合技能链的区别是,除了要符合闭合技能链的要求外,可以忽略
  162. # 使用者是否学会了技能链中的技能而强行使用它们,但是标注为 <require learn>
  163. # 的技能除外 .
  164. #
  165. # <reselect chain>
  166. # 允许处于技能链反射已选定的技能.
  167. #
  168. # <unchainable>
  169. # 带有该标签的技能无法组建技能链.
  170. #
  171. # <hit learn actor x> 及 <hit learn actor x,x>
  172. # <hit learn class x> 及 <hit learn class x,x>
  173. # 带有此标签的技能击中后将导致玩家 x 习得该技能,可以指定多个玩家,但是只有被.
  174. # 击中的玩家才能习得.class代表拥有本组法术类别的玩家可以习得,比如法师可以习得
  175. # 怪物的3级火球术之类.
  176. #
  177. # ----------------------------------------------------------------------------
  178. # 以下为状态的特殊效果
  179. # ----------------------------------------------------------------------------
  180. # 下面的某些效果必须设置正确,才能配合上述的一些技能产生特效
  181. #
  182. # <reflect>
  183. # 将法术反射给施法者,但是法术免疫反弹例外(免疫反射标签).
  184. #
  185. # <rage boost per x>, <rage boost add x>, <rage boost sub x>
  186. # 增加或减少参数 x 的怒气,第一个按百分比增加 x% 怒气,第二个直接增加x点怒气,
  187. # 第三个减去 x 点怒气,下同.
  188. #      <cost hp per x>      <cost hp add x>      <cost hp sub x>
  189. #      <cost mp per x>      <cost mp add x>      <cost mp sub x>
  190. #    <cost gold per x>    <cost gold add x>    <cost gold sub x>
  191. # <cost maxgold per x> <cost maxgold add x> <cost maxgold sub x>
  192. #    <cost rage per x>    <cost rage add x>    <cost rage sub x>
  193. #
  194. #
  195. #===============================================================================
  196. #
  197. # 兼容性:
  198. # - 兼容于: KGC_OnScreenStatus, KGC_Steal
  199. # - 兼容于: Yanfly's Battler Stat: Morale
  200. # - Alias: Game_Actor, setup
  201. # - Alias: Game_Battler, inputable?, attack_effect, skill_effect
  202. # - Alias: Game_BattleAction, valid?
  203. # - Alias: Game_Enemy, initialize
  204. # - Alias: Scene_Battle, process_battle_start, display_hp_damage, execute_action
  205. # - Alias: Scene_Skill, use_skill_nontarget
  206. # - Overwrites: Game_Battler, calc_mp_cost, skill_can_use?
  207. # - Overwrites: Scene_Battle, execute_action_skill, display_action_effects
  208. # - Overwrites: Scene_Skill, apply_skill_cost
  209. #
  210. #===============================================================================

  211. $imported = {} if $imported == nil
  212. $imported["CustomSkillEffects"] = true

  213. module YE
  214.   module BATTLE
  215.    
  216.     #-------------------------------------------------------------------------
  217.     # 基本性能
  218.     #-------------------------------------------------------------------------
  219.    
  220.     # 这里设置默认信息及爆击信息的等待时间.
  221.     MSGWAIT  = 60
  222.     CRITWAIT = 30
  223.    
  224.     # 这里设置技能消费的种类所使用的图标,比如代表这个技能使用的是怒气的图标
  225.     USE_ICONS = true # 图标开关
  226.     MP_ICON   = 100 # 消耗法力值技能的图标.
  227.     HP_ICON   = 99  # 消耗体力值技能的图标.
  228.     GOLD_ICON = 205 # 消耗金币值技能的图标.
  229.     WINCOLUMN = 2   # 技能窗口分栏数量.
  230.    
  231.     # 如果你不准备使用图标, 那么必须将下列信息填写完整以便区分技能消费类型.
  232.     MP_COST    = "%d MP"     # 消耗 %d 法力值,只修改“MP”的名称即可,下同.
  233.     HP_COST    = "%d HP"     # 消耗 %d 体力值.
  234.     GOLD_COST  = "%d Gold"   # 消耗 %d 金币.
  235.     MGOLD_COST = "%d%% Gold" # 消耗百分之 %d 的金币值.
  236.    
  237.     # 这个开关可以控制在使用消费HP技能时是否无视玩家的生命值过少?
  238.     ALLOW_DEATH_HP_COST = false
  239.    
  240.     # 这里设置怒气系统,包括怒气的获取方式.
  241.     INC_RAGE_ATTACK   = true  # 每次攻击获得.
  242.     NUM_RAGE_ATTACK   = 2     # 每次攻击获得量.
  243.     INC_RAGE_DAMAGED  = true  # 受到攻击获取.
  244.     NUM_RAGE_DAMAGED  = 1     # 受到攻击获得量.
  245.     INC_RAGE_SKILL    = true  # 使用技能时获得.
  246.     NUM_RAGE_SKILL    = 1     # 每次使用技能获得量.
  247.     RAGE_ICON = 132           # 代表消费怒气值的技能的类别图标.
  248.     RAGE_COST = "%d Rage"     # 技能消费 %d 怒气值.
  249.     MAX_RAGE  = 12            # 怒气的最大值.
  250.     RAGE_RESET_BATTLE = true  # 每场战斗怒气归零.
  251.    
  252.     # 这里设置那些需要吟唱时间的技能在信息框显示的信息及播放的音效.
  253.     CHARGE_MSG = "%s 开始吟唱 %s!"    # 开始吟唱
  254.     CHARGE_CON = "%s 持续吟唱 %s!"    # 正在吟唱
  255.     CHARGE_SND = RPG::SE.new("Up", 80, 100)  # 音效名称
  256.    
  257.     # 这里设置使用蓄力法术时是否替换消费图标,需要显示的信息和图标.
  258.     REPLACE_ICON_RECHARGE = true  # 图标开关
  259.     RECHARGE_ICON = 142           # 图标id
  260.     RECHARGE_MSG  = "%d Turns"    # 蓄力回合数
  261.     RECHARGE_MSG1 = "%d Turn"     # 蓄力回合数
  262.    
  263.     # 这里设置虚弱,施法后获得虚弱属性,无法再次行动直到状态消失.
  264.     FATIGUE_MSG = "%s 变得虚弱了."         # 虚弱信息
  265.     FATIGUE_SND = RPG::SE.new("Down", 80, 100)   # 音效
  266.    
  267.     # 这里设置使用次数限制的技能,每场战斗可使用的次数,并且在消耗完所有次数后
  268.     # 使用新图标代替同时显示警告信息.
  269.     REPLACE_ICON_USAGE = true # 图标开关
  270.     USAGE_ICON = 143          # 图标id
  271.     USAGE_MSG  = "Can't Use"  # 显示信息
  272.    
  273.     # 这里设置技能被反射时显示效果.
  274.     REFLECT_MSG = "%s 反射了 %s."                # 反射提示
  275.     REFLECT_SND = RPG::SE.new("Flash2", 80, 100)   # 音效
  276.    
  277.     #-------------------------------------------------------------------------
  278.     # 物品合成
  279.     #-------------------------------------------------------------------------
  280.    
  281.     # 下列规则约束了物品的合成,规则的合理性直接决定了合成系统的成败,GoodLucy.
  282.    
  283.     # 物品合成成功的音效.
  284.     SUCCESSFUL_ITEM_MIX = RPG::SE.new("Decision2", 80, 150)
  285.    
  286.     # 缺少原料的提示信息.
  287.     NOT_ENOUGH_ITEMS = "缺少足够的原料."
  288.    
  289.     ITEM_COLOUR1 = 14    # 第一件物品被选择时的颜色.
  290.     ITEM_COLOUR2 = 14    # 第二件物品被选择时的颜色.
  291.     ITEM_COLOUR3 = 18    # 一件物品被重复选取时的颜色.
  292.    
  293.     # 以下规定了如果合成物品不存在于哈希表中,那么系统将自动从下列两种类型中
  294.     # 随机选取一种技能,请不要删除 type 0 及其中至少保留一个技能 id,如果
  295.     # 如果随机类型不存在,那么默认使用 type 0.
  296.     RANDOM_ITEM_MIX_TYPES ={
  297.     # 类型 => [技能 id]
  298.          0 => [15, 17, 19, 21, 23, 25],
  299.          2 => [ 9, 10, 11, 12, 13, 14],
  300.     } # 请勿删除本规则.
  301.    
  302.     # 此哈希表规定了各物品合成后获得何种技能的效果,物品合成表是双向的,
  303.     # 也就是说你不必为了一个相反的合成规则订立新的规则.
  304.     # 在合成结果中填入一个或多个技能 id,表示合成物会拥有其中之一的技能效果.
  305.     ITEM_MIX_COMBO_HASH ={
  306.     # [Item, Item] => [Skill.ID Result]
  307.       [  15,   15] => [60],     # 例:火球术卷轴 + 火球术卷轴 = 2级火球术
  308.       [  15,   16] => [60, 62], # 火球术卷轴 + 火焰卷轴 = 2级火球术或2级火焰术
  309.       [  16,   16] => [62],     # 下同,略
  310.       [  17,   17] => [64],     #
  311.       [  17,   18] => [64, 66], #
  312.       [  18,   18] => [66],     #
  313.       [  19,   19] => [68],     #
  314.       [  19,   20] => [68, 70], #
  315.       [  20,   20] => [70],     #
  316.     } # 请勿删除本规则.
  317.    
  318.     #-------------------------------------------------------------------------
  319.     # 攻击后习得技能
  320.     #-------------------------------------------------------------------------
  321.    
  322.     # 以下规定了攻击技能发动后习得其他技能的规则.只有玩家有此功能.
  323.     HIT_LEARN_MESSAGE  = "%s 领悟了 %s!" # 习得新技能信息
  324.     SUBCLASS_HIT_LEARN = true    # 如果你开启了子技能系统这里也保持开启.
  325.    
  326.     #-------------------------------------------------------------------------
  327.     # 技能链
  328.     #-------------------------------------------------------------------------
  329.    
  330.     # 以下设定为如何在技能链窗口中显示已选择的技能链中的所有技能.
  331.     CHAIN_MAX_TEXT = "%d/%d"
  332.    
  333.   end
  334. end

  335. #===============================================================================
  336. # 使用方法:脚本狂人!本节未翻译,有能力写脚本的无需我画蛇添足吧.原文意思更明确
  337. #===============================================================================
  338. #
  339. # 你可以使用  YE::BATTLE::MSGWAIT 自由定义信息等待时间. 如果你确定你需要文字信息
  340. # 延迟一些时间显示,请使用下面的代码.
  341. #      msgwait
  342. #
  343. # <effect before x>
  344. # Adding that tag into the notebox of a skill would give it the extra effect
  345. # before the damage is dealt. Find "def effect_before" to begin adding in your
  346. # own before skill effects. "def common_before" will occur for each skill
  347. # regardless of BSE tags. Input those common before effects there.
  348. #
  349. # <effect charge x>
  350. # This can only occur when the skill is one that requires charging. This is here
  351. # mainly because chargable skills don't activate any before, during, or after
  352. # effects and that sometimes, scripters would like to produce effects simply
  353. # from charing a skill. "def common_charge" will occur for each charge skill.
  354. #
  355. # <effect during x>
  356. # Adding that tag into the notebox of a skill would give it the extra effect
  357. # during the damage being dealt. Note that the damage still takes place, but
  358. # the extra effect will occur in between each enemy taking damage. To use this,
  359. # find "def effect_during" to begin adding in your own during skill effects.
  360. # "def common_during" will occur for each skill regardless of DSE tags. Input
  361. # those common during effects there.
  362. #
  363. # <effect after x>
  364. # Adding that tag into the notebox of a skill would give it the extra effect
  365. # after the damage is dealt. Find "def effect_after" to begin adding in your own
  366. # after skill effects. "def common_after" will occur for each skill regardless
  367. # of ASE tags. Input those common during effects there.
  368. #
  369. # <custom ani x>
  370. # Adding that tag into the notebox of a skill would allow it to have conditional
  371. # skill animations played. You can choose what animations would be played and
  372. # under what conditions. Find "def custom_ani" to begin adding in your own
  373. # conditional skill animations.
  374. #
  375. # <cost custom x>
  376. # Adding that tag into the notebox of a skill would allow it to have different
  377. # (and conditional) costs. Follow the template and you should be okay regarding
  378. # how it's composed. Find "cost_custom" to change the visual aspects of the
  379. # costs and "apply_custom_cost" for the mechanical aspects. The new definition
  380. # "def calc_cost_common" will alter costs regardless of their type.
  381. #
  382. #===============================================================================

  383. class Scene_Battle < Scene_Base
  384.   
  385.   def effect_before(skill, beforeskill)
  386.     line_number = @message_window.line_number
  387.     case beforeskill
  388.     #---------------------------------------------------------------------------
  389.     # //////////////////////////////////////////////////////////////////////////
  390.     # This is where you begin adding in your own before skill effects.
  391.     #---------------------------------------------------------------------------
  392.     when 1
  393.       @active_battler.maxmp = 10000
  394.       @active_battler.mp = 10000
  395.       sound = RPG::SE.new("Item2", 80, 100)
  396.       sound.play
  397.       refresh_onscreenstatus # if KGC_OnScreenStatus is imported
  398.       text = sprintf("%s 感到全身充满了能量.", @active_battler.name)
  399.       @message_window.add_instant_text(text)
  400.       msgwait
  401.       @message_window.back_to(line_number)
  402.     when 2
  403.       
  404.     when 3
  405.       
  406.     #---------------------------------------------------------------------------
  407.     # This is the part you guys shouldn't touch afterwards.
  408.     # //////////////////////////////////////////////////////////////////////////
  409.     #---------------------------------------------------------------------------
  410.     end
  411.   end
  412.   
  413.   #-----------------------------------------------------------------------------
  414.   #-----This is the common before effect. It'll occur regardless of BSE tagging.
  415.   def common_before(skill)
  416.    
  417.   end
  418.   #-----------------------------------------------------------------------------
  419.   
  420.   def effect_charge(skill, chargeskill)
  421.     line_number = @message_window.line_number
  422.     case chargeskill
  423.     #---------------------------------------------------------------------------
  424.     # //////////////////////////////////////////////////////////////////////////
  425.     # This is where you begin adding in your own charge skill effects.
  426.     #---------------------------------------------------------------------------
  427.     when 1
  428.       #
  429.     when 2
  430.       
  431.     when 3
  432.       
  433.     #---------------------------------------------------------------------------
  434.     # This is the part you guys shouldn't touch afterwards.
  435.     # //////////////////////////////////////////////////////////////////////////
  436.     #---------------------------------------------------------------------------
  437.     end
  438.   end
  439.   
  440.   #-----------------------------------------------------------------------------
  441.   #-----This is the common charge effect. It'll occur regardless of CSE tagging.
  442.   def common_charge(skill)
  443.    
  444.   end
  445.   #-----------------------------------------------------------------------------
  446.   
  447.   def effect_during(target, skill, duringskill)
  448.     line_number = @message_window.line_number
  449.     case duringskill
  450.     #---------------------------------------------------------------------------
  451.     # //////////////////////////////////////////////////////////////////////////
  452.     # This is where you begin adding in your own during skill effects.
  453.     #---------------------------------------------------------------------------
  454.     when 1
  455.       target.maxmp = 0
  456.       target.mp = 0
  457.       sound = RPG::SE.new("Bow2", 80, 100)
  458.       sound.play
  459.       text = sprintf("%s 失去了能量!", target.name)
  460.       @message_window.add_instant_text(text)
  461.       msgwait
  462.     when 2
  463.       target.hp = 1
  464.       sound = RPG::SE.new("Down", 80, 100)
  465.       sound.play
  466.       text = sprintf("%s 快要死了!", target.name)
  467.       @message_window.replace_instant_text(text)
  468.     when 3  
  469.       #@active_battler.remove_state(17)
  470.          
  471.     #---------------------------------------------------------------------------
  472.     # This is the part you guys shouldn't touch afterwards.
  473.     # //////////////////////////////////////////////////////////////////////////
  474.     #---------------------------------------------------------------------------
  475.     end
  476.   end
  477.   
  478.   #-----------------------------------------------------------------------------
  479.   #-----This is the common during effect. It'll occur regardless of DSE tagging.
  480.   def common_during(target, skill)
  481.     #---
  482.     if skill == nil
  483.       # Regular Attack
  484.     else
  485.       # Skill Effect
  486.     end
  487.     #---
  488.   end
  489.   #-----------------------------------------------------------------------------
  490.   
  491.   def effect_after(skill, afterskill)
  492.     line_number = @message_window.line_number
  493.     case afterskill
  494.     #---------------------------------------------------------------------------
  495.     # //////////////////////////////////////////////////////////////////////////
  496.     # This is where you begin adding in your own after skill effects.
  497.     #---------------------------------------------------------------------------
  498.     when 1
  499.       @active_battler.maxhp = 10000
  500.       @active_battler.hp = 10000
  501.       sound = RPG::SE.new("Item1", 80, 100)
  502.       sound.play
  503.       refresh_onscreenstatus # if KGC_OnScreenStatus is imported
  504.       text = sprintf ("%s 此刻已经无敌!", @active_battler.name)
  505.       @message_window.add_instant_text(text)
  506.       msgwait
  507.       @message_window.back_to(line_number)
  508.     when 2
  509.       
  510.     when 3
  511.       
  512.     #---------------------------------------------------------------------------
  513.     # This is the part you guys shouldn't touch afterwards.
  514.     # //////////////////////////////////////////////////////////////////////////
  515.     #---------------------------------------------------------------------------
  516.     end
  517.   end
  518.   
  519.   #-----------------------------------------------------------------------------
  520.   #-----This is the common after effect. It'll occur regardless of ASE tagging.
  521.   def common_after(skill)
  522.    
  523.   end
  524.   #-----------------------------------------------------------------------------
  525.   
  526.   def custom_ani(targets, customani)
  527.     case customani
  528.     #---------------------------------------------------------------------------
  529.     # //////////////////////////////////////////////////////////////////////////
  530.     # This is where you begin adding in your own custom skill animations.
  531.     #---------------------------------------------------------------------------
  532.     when 1
  533.       # Plays a fire sword animation if user's current HP is above 50%.
  534.       if @active_battler.hp > (@active_battler.maxhp / 2)
  535.         display_normal_animation(targets, 8)
  536.       else
  537.         display_normal_animation(targets, 7)
  538.       end
  539.     when 2
  540.       
  541.     when 3
  542.       
  543.     #---------------------------------------------------------------------------
  544.     # This is the part you guys shouldn't touch afterwards.
  545.     # //////////////////////////////////////////////////////////////////////////
  546.     #---------------------------------------------------------------------------
  547.     end
  548.     wait(20)
  549.     wait_for_animation
  550.   end
  551.   
  552. end # Scene_Battle

  553. class Game_Battler
  554.   
  555.   def cost_custom(skill, return_value)
  556.     cost_icon = 0
  557.     cost_name = ""
  558.     cost_name2 = ""
  559.     cost_value = 0
  560.     can_use = true
  561.     skill_case = skill.cost_custom
  562.     case skill_case
  563.     #---------------------------------------------------------------------------
  564.     # //////////////////////////////////////////////////////////////////////////
  565.     # This is where you begin editting your own custom costs.
  566.     #---------------------------------------------------------------------------
  567.     when 1
  568.       cost_icon = 1
  569.       cost_name = "Mastery"
  570.       cost_name2 = "Mastery Requirement"
  571.       cost_value = 10
  572.       if cost_value > $game_variables[1]
  573.         can_use = false
  574.       end
  575.       
  576.     when 2
  577.       cost_icon = 64
  578.       cost_name = "Pots"
  579.       cost_name2 = "Requires"
  580.       cost_value = 3
  581.       if cost_value > $game_party.item_number($data_items[1])
  582.         can_use = false
  583.       end
  584.       
  585.     when 3
  586.       cost_icon = 65
  587.       cost_name = "Ether"
  588.       cost_name2 = "Requires"
  589.       cost_value = 0
  590.       if cost_value > $game_party.item_number($data_items[1])
  591.         can_use = false
  592.       end
  593.    
  594.     #---------------------------------------------------------------------------
  595.     # This is the part you guys shouldn't touch afterwards.
  596.     # //////////////////////////////////////////////////////////////////////////
  597.     #---------------------------------------------------------------------------
  598.     end
  599.     return cost_icon  if return_value == 1
  600.     return cost_name  if return_value == 2
  601.     return cost_value if return_value == 3
  602.     return can_use    if return_value == 4
  603.     return cost_name2 if return_value == 5
  604.   end
  605.   
  606.   #-----------------------------------------------------------------------------
  607.   #-----This is where all undergo one final cost calculation before returning.
  608.   def calc_cost_common(cost, skill)
  609.     return cost
  610.   end
  611.   #-----------------------------------------------------------------------------
  612.   
  613. end # Game_Battler

  614. class Scene_Battle < Scene_Base
  615.   
  616.   def apply_custom_cost(battler, skill)
  617.     skill_case = skill.cost_custom
  618.     case skill_case
  619.     #---------------------------------------------------------------------------
  620.     # //////////////////////////////////////////////////////////////////////////
  621.     # This is where you perform the custom costs.
  622.     #---------------------------------------------------------------------------
  623.     when 1
  624.       $game_variables[1] -= 10
  625.       
  626.     when 2
  627.       $game_party.gain_item($data_items[1], -3)
  628.       
  629.     when 3
  630.       $game_party.gain_item($data_items[1], -1)
  631.       
  632.     #---------------------------------------------------------------------------
  633.     # This is the part you guys shouldn't touch afterwards.
  634.     # //////////////////////////////////////////////////////////////////////////
  635.     #---------------------------------------------------------------------------
  636.     end
  637.   end
  638.   
  639. end # Scene_Battle

  640. #===============================================================================
  641. # Editting anything past this point may potentially result in causing computer
  642. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  643. # Therefore, edit at your own risk.大意就是:下有电缆,高压危险 :)
  644. #===============================================================================

  645. module YE
  646. module REGEXP
  647. module BASEITEM
  648.       
  649.   # 技能消费.
  650.   COST_CURMP  = /<(?:COST_CURMP|cost curmp|cost cur mp)[ ]*(\d+)>/i
  651.   COST_MAXMP  = /<(?:COST_MAXMP|cost maxmp|cost max mp)[ ]*(\d+)>/i
  652.   COST_CURHP  = /<(?:COST_CURMP|cost curhp|cost cur hp)[ ]*(\d+)>/i
  653.   COST_MAXHP  = /<(?:COST_MAXMP|cost maxhp|cost max hp)[ ]*(\d+)>/i
  654.   COST_GOLD   = /<(?:COST_GOLD|cost gold)[ ]*(\d+)>/i
  655.   COST_MGOLD  = /<(?:COST_MAXGOLD|cost maxgold|cost max gold)[ ]*(\d+)>/i
  656.   COST_RAGE   = /<(?:COST_RAGE|cost rage)[ ]*(\d+)>/i
  657.   RAGE_BOOST  = /<(?:RAGE_BOOST|rage boost)[ ]*(\d+)>/i
  658.   COST_CUSTOM = /<(?:COST_CUSTOM|cost custom)[ ]*(\d+)>/i
  659.   
  660.   # 其他技能特性.
  661.   UNREFLECT = /<(?:UNREFLECT|unreflectable)>/i
  662.   
  663.   REQUIRE_LEVEL = /<(?:REQUIRE_LEVEL|require level)[ ]*(\d+)>/i
  664.   REQUIRE_LEARN = /<(?:NOT_REQUIRE_LEARN|not require learn)>/i
  665.   REQUIRE_ELE_ALL =
  666.   /<(?:REQUIRE_ALL_ELEMENTS|require all elements)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  667.   REQUIRE_ELE_ANY =
  668.   /<(?:REQUIRE_ANY_ELEMENTS|require any elements)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  669.   REQUIRE_STATE_ALL =
  670.   /<(?:REQUIRE_ALL_STATES|require all states)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  671.   REQUIRE_STATE_ANY =
  672.   /<(?:REQUIRE_ANY_STATES|require any states)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  673.   
  674.   MIX_ITEMS_ALL  = /<(?:MIX_ITEMS_ALL|MIX_TYPE_ALL|mix items all|mix type all)>/i
  675.   MIX_ITEMS      = /<(?:MIX_TYPE|mix type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  676.   DONT_MIX       = /<(?:DONT_MIX|DO_NOT_MIX|dont mix|do not mix)>/i
  677.   INSTANT_CAST   = /<(?:INSTANT_CAST|instant cast)>/i
  678.   SUBSKILLS      = /<(?:SUBSKILLS|sub skills)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  679.   SUBSKILL_ONLY  = /<(?:SUBSKILL_ONLY|subskill only)>/i
  680.   
  681.   # 攻击习得技能特性
  682.   HIT_LEARN_ACTOR = /<(?:HIT_LEARN_ACTOR|hit learn actor)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  683.   HIT_LEARN_CLASS = /<(?:HIT_LEARN_CLASS|hit learn class)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  684.   
  685.   # 技能链特性
  686.   UNCHAINABLE = /<(?:UNCHAINABLE|nonchainable)>/i
  687.   RESELECT_CHAIN = /<(?:RESELECTABLE|reselect chain)>/i
  688.   OPEN_CHAIN = /<(?:OPEN_CHAIN|open chain)[ ]*(\d+)>/i
  689.   CLOSED_CHAIN = /<(?:CLOSED_CHAIN|closed chain)[ ]*(\d+):(\d+(?:\s*,\s*\d+)*)>/i
  690.   CLOSED_TYPE = /<(?:CLOSED_TYPE|closed type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  691.   FORCED_CHAIN = /<(?:FORCED_CHAIN|forced chain)[ ]*(\d+):(\d+(?:\s*,\s*\d+)*)>/i
  692.   
  693.   # 其它技能.
  694.   CAST_TIME  = /<(?:CAST_TIME|cast time)[ ]*(\d+)>/i
  695.   RECHARGE   = /<(?:RECHARGE|cooldown)[ ]*(\d+)>/i
  696.   LIMITUSES  = /<(?:LIMIT_USES|limit uses)[ ]*(\d+)>/i
  697.   FATIGUEVAL = /<(?:FATIGUE|tired)[ ]*(\d+)>/i
  698.   PREPARE    = /<(?:PREPARE|warmup)[ ]*(\d+)>/i
  699.       
  700.   # 自定义技能特效.
  701.   EFFECT_BEFORE = /<(?:EFFECT_BEFORE|effect before|before effect|bse)[ ]*(\d+)>/i
  702.   EFFECT_CHARGE = /<(?:EFFECT_CHARGE|effect charge|charge effect|cse)[ ]*(\d+)>/i
  703.   EFFECT_DURING = /<(?:EFFECT_DURING|effect during|during effect|dse)[ ]*(\d+)>/i
  704.   EFFECT_AFTER = /<(?:EFFECT_AFTER|effect after|after effect|ase)[ ]*(\d+)>/i
  705.       
  706.   # 技能动画条件.
  707.   CUSTOM_ANI = /<(?:CUSTOM_ANI|custom ani|custom animation|csa)[ ]*(\d+)>/i
  708.       
  709. end #module BASEITEM
  710. module STATE
  711.       
  712.   # 技能参数.
  713.   REFLECT        = /<(?:REFLECT|reflectable)>/i
  714.   RAGE_BOOST_PER = /<(?:RAGE_BOOST_PER|rage boost per)[ ]*(\d+)>/i
  715.   RAGE_BOOST_ADD = /<(?:RAGE_BOOST_ADD|rage boost add)[ ]*(\d+)>/i
  716.   RAGE_BOOST_SUB = /<(?:RAGE_BOOST_SUB|rage boost sub)[ ]*(\d+)>/i
  717.       
  718.   # 技能消耗修正.
  719.   COST_HP_PER   = /<(?:COST_HP_PER|cost hp per)[ ]*(\d+)>/i
  720.   COST_HP_ADD   = /<(?:COST_HP_ADD|cost hp add)[ ]*(\d+)>/i
  721.   COST_HP_SUB   = /<(?:COST_HP_SUB|cost hp sub)[ ]*(\d+)>/i
  722.   COST_MP_PER   = /<(?:COST_MP_PER|cost mp per)[ ]*(\d+)>/i
  723.   COST_MP_ADD   = /<(?:COST_MP_ADD|cost mp add)[ ]*(\d+)>/i
  724.   COST_MP_SUB   = /<(?:COST_MP_SUB|cost mp sub)[ ]*(\d+)>/i
  725.   COST_GOLD_PER = /<(?:COST_GOLD_PER|cost gold per)[ ]*(\d+)>/i
  726.   COST_GOLD_ADD = /<(?:COST_GOLD_ADD|cost gold add)[ ]*(\d+)>/i
  727.   COST_GOLD_SUB = /<(?:COST_GOLD_SUB|cost gold sub)[ ]*(\d+)>/i
  728.   COST_MAXG_PER = /<(?:COST_MAXGOLD_PER|cost maxgold per)[ ]*(\d+)>/i
  729.   COST_MAXG_ADD = /<(?:COST_MAXGOLD_ADD|cost maxgold add)[ ]*(\d+)>/i
  730.   COST_MAXG_SUB = /<(?:COST_MAXGOLD_SUB|cost maxgold sub)[ ]*(\d+)>/i
  731.   COST_RAGE_PER = /<(?:COST_RAGE_PER|cost rage per)[ ]*(\d+)>/i
  732.   COST_RAGE_ADD = /<(?:COST_RAGE_ADD|cost rage add)[ ]*(\d+)>/i
  733.   COST_RAGE_SUB = /<(?:COST_RAGE_SUB|cost rage sub)[ ]*(\d+)>/i
  734.       
  735. end # STATE
  736. end # REGEXP
  737. end # YE

  738. #===============================================================================
  739. # RPG::State
  740. #===============================================================================

  741. class RPG::State
  742.   
  743.   #--------------------------------------------------------------------------
  744.   # Yanfly_Cache_CSE
  745.   #--------------------------------------------------------------------------
  746.   def yanfly_cache_state_cse
  747.     @reflect = false; @rage_boost_per = 100; @rage_boost_set = 0
  748.     @cost_hp_per = 100; @cost_hp_set = 0; @cost_mp_per = 100; @cost_mp_set = 0
  749.     @cost_gold_per = 100; @cost_gold_set = 0; @cost_maxgold_per = 100;
  750.     @cost_maxgold_set = 0; @cost_rage_per = 100; @cost_rage_set = 0
  751.    
  752.     self.note.split(/[\r\n]+/).each { |line|
  753.       case line
  754.       when YE::REGEXP::STATE::REFLECT
  755.         @reflect = true
  756.          
  757.       when YE::REGEXP::STATE::RAGE_BOOST_PER
  758.         @rage_boost_per = $1.to_i
  759.       when YE::REGEXP::STATE::RAGE_BOOST_ADD
  760.         @rage_boost_set = $1.to_i
  761.       when YE::REGEXP::STATE::RAGE_BOOST_SUB
  762.         @rage_boost_set = $1.to_i * -1
  763.          
  764.       when YE::REGEXP::STATE::COST_HP_PER
  765.         @cost_hp_per = $1.to_i
  766.       when YE::REGEXP::STATE::COST_HP_ADD
  767.         @cost_hp_set = $1.to_i
  768.       when YE::REGEXP::STATE::COST_HP_SUB
  769.         @cost_hp_set = $1.to_i *-1
  770.       when YE::REGEXP::STATE::COST_MP_PER
  771.         @cost_mp_per = $1.to_i
  772.       when YE::REGEXP::STATE::COST_MP_ADD
  773.         @cost_mp_set = $1.to_i
  774.       when YE::REGEXP::STATE::COST_MP_SUB
  775.         @cost_mp_set = $1.to_i * -1
  776.       when YE::REGEXP::STATE::COST_GOLD_PER
  777.         @cost_gold_per = $1.to_i
  778.       when YE::REGEXP::STATE::COST_GOLD_ADD
  779.         @cost_gold_set = $1.to_i
  780.       when YE::REGEXP::STATE::COST_GOLD_SUB
  781.         @cost_gold_set = $1.to_i * -1
  782.       when YE::REGEXP::STATE::COST_MAXG_PER
  783.         @cost_maxgold_per = $1.to_i
  784.       when YE::REGEXP::STATE::COST_MAXG_ADD
  785.         @cost_maxgold_set = $1.to_i
  786.       when YE::REGEXP::STATE::COST_MAXG_SUB
  787.         @cost_maxgold_set = $1.to_i * -1
  788.       when YE::REGEXP::STATE::COST_RAGE_PER
  789.         @cost_rage_per = $1.to_i
  790.       when YE::REGEXP::STATE::COST_RAGE_ADD
  791.         @cost_rage_set = $1.to_i
  792.       when YE::REGEXP::STATE::COST_RAGE_SUB
  793.         @cost_rage_set = $1.to_i * -1
  794.       
  795.       end
  796.     }
  797.   end # end yanfly_cache_state_cse
  798.   
  799.   #--------------------------------------------------------------------------
  800.   # 反射
  801.   #--------------------------------------------------------------------------
  802.   def reflect
  803.     yanfly_cache_state_cse if @reflect == nil
  804.     return @reflect
  805.   end
  806.   
  807.   #--------------------------------------------------------------------------
  808.   # 怒气获得情况
  809.   #--------------------------------------------------------------------------
  810.   def rage_boost_per
  811.     yanfly_cache_state_cse if @rage_boost_per == nil
  812.     return @rage_boost_per
  813.   end
  814.   
  815.   def rage_boost_set
  816.     yanfly_cache_state_cse if @rage_boost_set == nil
  817.     return @rage_boost_set
  818.   end
  819.   
  820.   #--------------------------------------------------------------------------
  821.   # 消费体力情况
  822.   #--------------------------------------------------------------------------
  823.   def cost_hp_per
  824.     yanfly_cache_state_cse if @cost_hp_per == nil
  825.     return @cost_hp_per
  826.   end
  827.   
  828.   def cost_hp_set
  829.     yanfly_cache_state_cse if @cost_hp_set == nil
  830.     return @cost_hp_set
  831.   end
  832.   
  833.   #--------------------------------------------------------------------------
  834.   # 消费法力情况
  835.   #--------------------------------------------------------------------------
  836.   def cost_mp_per
  837.     yanfly_cache_state_cse if @cost_mp_per == nil
  838.     return @cost_mp_per
  839.   end
  840.   
  841.   def cost_mp_set
  842.     yanfly_cache_state_cse if @cost_mp_set == nil
  843.     return @cost_mp_set
  844.   end
  845.   
  846.   #--------------------------------------------------------------------------
  847.   # 消费金币的技能
  848.   #--------------------------------------------------------------------------
  849.   def cost_gold_per
  850.     yanfly_cache_state_cse if @cost_gold_per == nil
  851.     return @cost_gold_per
  852.   end
  853.   
  854.   def cost_gold_set
  855.     yanfly_cache_state_cse if @cost_gold_set == nil
  856.     return @cost_gold_set
  857.   end
  858.   
  859.   #--------------------------------------------------------------------------
  860.   # 消费最大金币
  861.   #--------------------------------------------------------------------------
  862.   def cost_maxgold_per
  863.     yanfly_cache_state_cse if @cost_maxgold_per == nil
  864.     return @cost_maxgold_per
  865.   end
  866.   
  867.   def cost_maxgold_set
  868.     yanfly_cache_state_cse if @cost_maxgold_set == nil
  869.     return @cost_maxgold_set
  870.   end
  871.   
  872.   #--------------------------------------------------------------------------
  873.   # 消费怒气情况
  874.   #--------------------------------------------------------------------------
  875.   def cost_rage_per
  876.     yanfly_cache_state_cse if @cost_rage_per == nil
  877.     return @cost_rage_per
  878.   end
  879.   
  880.   def cost_rage_set
  881.     yanfly_cache_state_cse if @cost_rage_set == nil
  882.     return @cost_rage_set
  883.   end
  884.   
  885. end # end RPG::State

  886. #===============================================================================
  887. # RPG::BaseItem
  888. #===============================================================================
  889. class RPG::BaseItem
  890.   
  891.   #--------------------------------------------------------------------------
  892.   # Yanfly_Cache_CSE
  893.   #--------------------------------------------------------------------------
  894.   def yanfly_cache_baseitem_cse
  895.     @unreflectable = false; @bse = 0; @cse = 0; @dse = 0; @ase = 0; @csa = 0
  896.     @cur_mp_cost = 0; @max_mp_cost = 0; @cur_hp_cost = 0; @max_hp_cost = 0
  897.     @gold_cost = 0; @maxgold_cost = 0; @rage_cost = 0; @cost_custom = 0
  898.     @cast_time = 0; @recharge = 0; @prepare = 0; @usage = 0; @rage_boost = 0
  899.     @fatigue = 0; @mix_items = false; @mix_types = []; @mix_items_all = false;
  900.     @dont_mix = false; @subskills = []; @instant_cast = false
  901.     @hit_learn_actor = []; @hit_learn_class = []; @hit_learnable = false
  902.     @subskill_only = false; @require_learn = true
  903.    
  904.     @required_all_elements = []; @required_any_elements = []; @require_level = 0
  905.     @required_all_states = []; @required_any_states = []
  906.    
  907.     @unchainable = false; @reselect_chain = false; @closed_type = []
  908.     @chain_type = 0 # 0:none 1:open 2:limit 3:forced
  909.     @chain_times = 0; @chain_array = []
  910.    
  911.     self.note.split(/[\r\n]+/).each { |line|
  912.       case line
  913.       when YE::REGEXP::BASEITEM::UNREFLECT
  914.         @unreflectable = true
  915.       when YE::REGEXP::BASEITEM::REQUIRE_LEVEL
  916.         @require_level = $1.to_i
  917.       when YE::REGEXP::BASEITEM::REQUIRE_LEARN
  918.         @require_learn = false
  919.       when YE::REGEXP::BASEITEM::REQUIRE_ELE_ALL
  920.         $1.scan(/\d+/).each { |num|
  921.         if num.to_i > 0
  922.           @required_all_elements.push(num.to_i)
  923.         end }
  924.       when YE::REGEXP::BASEITEM::REQUIRE_ELE_ANY
  925.         $1.scan(/\d+/).each { |num|
  926.         if num.to_i > 0
  927.           @required_any_elements.push(num.to_i)
  928.         end }
  929.       when YE::REGEXP::BASEITEM::REQUIRE_STATE_ALL
  930.         $1.scan(/\d+/).each { |num|
  931.         if num.to_i > 0
  932.           @required_all_states.push(num.to_i)
  933.         end }
  934.       when YE::REGEXP::BASEITEM::REQUIRE_STATE_ANY
  935.         $1.scan(/\d+/).each { |num|
  936.         if num.to_i > 0
  937.           @required_any_states.push(num.to_i)
  938.         end }
  939.         
  940.       when YE::REGEXP::BASEITEM::MIX_ITEMS
  941.         @instant_cast = false
  942.         @mix_items = true
  943.         $1.scan(/\d+/).each { |num|
  944.         if num.to_i > 0
  945.           @mix_types.push(num.to_i)
  946.         end }
  947.       when YE::REGEXP::BASEITEM::MIX_ITEMS_ALL
  948.         @instant_cast = false
  949.         @mix_items = true
  950.         @mix_items_all = true
  951.       when YE::REGEXP::BASEITEM::DONT_MIX
  952.         @dont_mix = true
  953.       when YE::REGEXP::BASEITEM::INSTANT_CAST
  954.         @instant_cast = true
  955.         
  956.       when YE::REGEXP::BASEITEM::SUBSKILLS
  957.         $1.scan(/\d+/).each { |num|
  958.         if num.to_i > 0
  959.           @subskills.push(num.to_i)
  960.         end }
  961.       
  962.       when YE::REGEXP::BASEITEM::SUBSKILL_ONLY
  963.         @subskill_only = true
  964.         
  965.       when YE::REGEXP::BASEITEM::HIT_LEARN_ACTOR
  966.         @hit_learnable = true
  967.         $1.scan(/\d+/).each { |num|
  968.         if num.to_i > 0
  969.           @hit_learn_actor.push(num.to_i)
  970.         end }
  971.       when YE::REGEXP::BASEITEM::HIT_LEARN_CLASS
  972.         @hit_learnable = true
  973.         $1.scan(/\d+/).each { |num|
  974.         if num.to_i > 0
  975.           @hit_learn_class.push(num.to_i)
  976.         end }
  977.         
  978.       when YE::REGEXP::BASEITEM::UNCHAINABLE
  979.         @unchainable = true
  980.       when YE::REGEXP::BASEITEM::RESELECT_CHAIN
  981.         @reselect_chain = true
  982.       when YE::REGEXP::BASEITEM::OPEN_CHAIN
  983.         @instant_cast = false
  984.         @chain_type = 1
  985.         @chain_times = $1.to_i
  986.       when YE::REGEXP::BASEITEM::CLOSED_CHAIN
  987.         @instant_cast = false
  988.         @chain_type = 2
  989.         @chain_times = $1.to_i
  990.         $2.scan(/\d+/).each { |num|
  991.         if num.to_i > 0
  992.           @chain_array.push(num.to_i)
  993.         end }
  994.       when YE::REGEXP::BASEITEM::CLOSED_TYPE
  995.         $1.scan(/\d+/).each { |num|
  996.         if num.to_i > 0
  997.           @closed_type.push(num.to_i)
  998.         end }
  999.       when YE::REGEXP::BASEITEM::FORCED_CHAIN
  1000.         @instant_cast = false
  1001.         @chain_type = 3
  1002.         @chain_times = $1.to_i
  1003.         $2.scan(/\d+/).each { |num|
  1004.         if num.to_i > 0
  1005.           @chain_array.push(num.to_i)
  1006.         end }
  1007.         
  1008.       when YE::REGEXP::BASEITEM::EFFECT_BEFORE
  1009.         @bse = $1.to_i
  1010.       when YE::REGEXP::BASEITEM::EFFECT_CHARGE
  1011.         @cse = $1.to_i
  1012.       when YE::REGEXP::BASEITEM::EFFECT_DURING
  1013.         @dse = $1.to_i
  1014.       when YE::REGEXP::BASEITEM::EFFECT_AFTER
  1015.         @ase = $1.to_i
  1016.       when YE::REGEXP::BASEITEM::CUSTOM_ANI
  1017.         @csa = $1.to_i
  1018.          
  1019.       when YE::REGEXP::BASEITEM::COST_CURMP
  1020.         @cur_mp_cost = $1.to_i
  1021.       when YE::REGEXP::BASEITEM::COST_MAXMP
  1022.         @max_mp_cost = $1.to_i
  1023.       when YE::REGEXP::BASEITEM::COST_CURHP
  1024.         @cur_hp_cost = $1.to_i
  1025.       when YE::REGEXP::BASEITEM::COST_MAXHP
  1026.         @max_hp_cost = $1.to_i
  1027.       when YE::REGEXP::BASEITEM::COST_GOLD
  1028.         @gold_cost = $1.to_i
  1029.       when YE::REGEXP::BASEITEM::COST_MGOLD
  1030.         @maxgold_cost = $1.to_i
  1031.       when YE::REGEXP::BASEITEM::COST_RAGE
  1032.         @rage_cost = $1.to_i
  1033.       when YE::REGEXP::BASEITEM::COST_CUSTOM
  1034.         @cost_custom = $1.to_i
  1035.          
  1036.       when YE::REGEXP::BASEITEM::CAST_TIME
  1037.         @cast_time = $1.to_i
  1038.       when YE::REGEXP::BASEITEM::RECHARGE
  1039.         @recharge = $1.to_i
  1040.       when YE::REGEXP::BASEITEM::PREPARE
  1041.         @prepare = $1.to_i
  1042.       when YE::REGEXP::BASEITEM::LIMITUSES
  1043.         @usage = $1.to_i
  1044.       when YE::REGEXP::BASEITEM::RAGE_BOOST
  1045.         @rage_boost = $1.to_i
  1046.       when YE::REGEXP::BASEITEM::FATIGUEVAL
  1047.         @fatigue = $1.to_i
  1048.         
  1049.       end
  1050.     }
  1051.   end # end yanfly_cache_cse
  1052.   
  1053.   #--------------------------------------------------------------------------
  1054.   # 杂项
  1055.   #--------------------------------------------------------------------------
  1056.   def unreflectable
  1057.     yanfly_cache_baseitem_cse if @unreflectable == nil
  1058.     return @unreflectable
  1059.   end
  1060.   
  1061.   #--------------------------------------------------------------------------
  1062.   # 前提
  1063.   #--------------------------------------------------------------------------
  1064.   def require_level
  1065.     yanfly_cache_baseitem_cse if @require_level == nil
  1066.     return @require_level
  1067.   end
  1068.   def require_learn
  1069.     yanfly_cache_baseitem_cse if @require_learn == nil
  1070.     return @require_learn
  1071.   end
  1072.   def required_all_elements
  1073.     yanfly_cache_baseitem_cse if @required_all_elements == nil
  1074.     return @required_all_elements
  1075.   end
  1076.   def required_any_elements
  1077.     yanfly_cache_baseitem_cse if @required_any_elements == nil
  1078.     return @required_any_elements
  1079.   end
  1080.   def required_all_states
  1081.     yanfly_cache_baseitem_cse if @required_all_states == nil
  1082.     return @required_all_states
  1083.   end
  1084.   def required_any_states
  1085.     yanfly_cache_baseitem_cse if @required_any_states == nil
  1086.     return @required_any_states
  1087.   end
  1088.   
  1089.   #--------------------------------------------------------------------------
  1090.   # 合成物品
  1091.   #--------------------------------------------------------------------------
  1092.   def mix_items
  1093.     yanfly_cache_baseitem_cse if @mix_items == nil
  1094.     return @mix_items
  1095.   end
  1096.   def mix_items_all
  1097.     yanfly_cache_baseitem_cse if @mix_items_all == nil
  1098.     return @mix_items_all
  1099.   end
  1100.   def mix_types
  1101.     yanfly_cache_baseitem_cse if @mix_types == nil
  1102.     return @mix_types
  1103.   end
  1104.   def dont_mix
  1105.     yanfly_cache_baseitem_cse if @dont_mix == nil
  1106.     return @dont_mix
  1107.   end
  1108.   
  1109.   #--------------------------------------------------------------------------
  1110.   # 瞬发
  1111.   #--------------------------------------------------------------------------
  1112.   def instant_cast
  1113.     yanfly_cache_baseitem_cse if @instant_cast == nil
  1114.     return @instant_cast
  1115.   end
  1116.   
  1117.   #--------------------------------------------------------------------------
  1118.   # 子技能
  1119.   #--------------------------------------------------------------------------
  1120.   def subskills
  1121.     yanfly_cache_baseitem_cse if @subskills == nil
  1122.     return @subskills
  1123.   end
  1124.   
  1125.   def subskill_only
  1126.     yanfly_cache_baseitem_cse if @subskill_only == nil
  1127.     return @subskill_only
  1128.   end
  1129.   
  1130.   #--------------------------------------------------------------------------
  1131.   # 攻击习得
  1132.   #--------------------------------------------------------------------------
  1133.   def hit_learnable?
  1134.     yanfly_cache_baseitem_cse if @hit_learnable == nil
  1135.     return @hit_learnable
  1136.   end
  1137.   def hit_learn_actor
  1138.     yanfly_cache_baseitem_cse if @hit_learn_actor == nil
  1139.     return @hit_learn_actor
  1140.   end
  1141.   def hit_learn_class
  1142.     yanfly_cache_baseitem_cse if @hit_learn_class == nil
  1143.     return @hit_learn_class
  1144.   end
  1145.   
  1146.   #--------------------------------------------------------------------------
  1147.   # 技能链
  1148.   #--------------------------------------------------------------------------
  1149.   def unchainable
  1150.     yanfly_cache_baseitem_cse if @unchainable == nil
  1151.     return @unchainable
  1152.   end
  1153.   def reselect_chain
  1154.     yanfly_cache_baseitem_cse if @reselect_chain == nil
  1155.     return @reselect_chain
  1156.   end
  1157.   def chain_type
  1158.     yanfly_cache_baseitem_cse if @chain_type == nil
  1159.     return @chain_type
  1160.   end
  1161.   def closed_type
  1162.     yanfly_cache_baseitem_cse if @closed_type == nil
  1163.     return @closed_type
  1164.   end
  1165.   def chain_times
  1166.     yanfly_cache_baseitem_cse if @chain_times == nil
  1167.     return @chain_times
  1168.   end
  1169.   def chain_array
  1170.     yanfly_cache_baseitem_cse if @chain_array == nil
  1171.     return @chain_array
  1172.   end
  1173.   
  1174.   #--------------------------------------------------------------------------
  1175.   # 技能时态侦测. 动画侦测.
  1176.   #--------------------------------------------------------------------------
  1177.   def bse
  1178.     yanfly_cache_baseitem_cse if @bse == nil
  1179.     return @bse
  1180.   end
  1181.   
  1182.   def cse
  1183.     yanfly_cache_baseitem_cse if @cse == nil
  1184.     return @cse
  1185.   end
  1186.   
  1187.   def dse
  1188.     yanfly_cache_baseitem_cse if @dse == nil
  1189.     return @dse
  1190.   end
  1191.   
  1192.   def ase
  1193.     yanfly_cache_baseitem_cse if @ase == nil
  1194.     return @ase
  1195.   end
  1196.   
  1197.   def csa
  1198.     yanfly_cache_baseitem_cse if @csa == nil
  1199.     return @csa
  1200.   end
  1201.   
  1202.   #--------------------------------------------------------------------------
  1203.   # 消费侦测
  1204.   #--------------------------------------------------------------------------
  1205.   def cur_mp_cost
  1206.     yanfly_cache_baseitem_cse if @cur_mp_cost == nil
  1207.     return @cur_mp_cost
  1208.   end
  1209.   
  1210.   def max_mp_cost
  1211.     yanfly_cache_baseitem_cse if @max_mp_cost == nil
  1212.     return @max_mp_cost
  1213.   end
  1214.   
  1215.   def cur_hp_cost
  1216.     yanfly_cache_baseitem_cse if @cur_hp_cost == nil
  1217.     return @cur_hp_cost
  1218.   end
  1219.   
  1220.   def max_hp_cost
  1221.     yanfly_cache_baseitem_cse if @max_hp_cost == nil
  1222.     return @max_hp_cost
  1223.   end
  1224.   
  1225.   def gold_cost
  1226.     yanfly_cache_baseitem_cse if @gold_cost == nil
  1227.     return @gold_cost
  1228.   end
  1229.   
  1230.   def maxgold_cost
  1231.     yanfly_cache_baseitem_cse if @maxgold_cost == nil
  1232.     return @maxgold_cost
  1233.   end
  1234.   
  1235.   def rage_cost
  1236.     yanfly_cache_baseitem_cse if @rage_cost == nil
  1237.     return @rage_cost
  1238.   end
  1239.   
  1240.   def cost_custom
  1241.     yanfly_cache_baseitem_cse if @cost_custom == nil
  1242.     return @cost_custom
  1243.   end
  1244.   
  1245.   #--------------------------------------------------------------------------
  1246.   # 蓄力/蓄力时间/预备/用法/怒气获取/虚弱
  1247.   #--------------------------------------------------------------------------
  1248.   def cast_time
  1249.     yanfly_cache_baseitem_cse if @cast_time == nil
  1250.     return @cast_time
  1251.   end
  1252.   
  1253.   def recharge
  1254.     yanfly_cache_baseitem_cse if @recharge == nil
  1255.     return @recharge
  1256.   end
  1257.   
  1258.   def prepare
  1259.     yanfly_cache_baseitem_cse if @prepare == nil
  1260.     return @prepare
  1261.   end
  1262.   
  1263.   def usage
  1264.     yanfly_cache_baseitem_cse if @usage == nil
  1265.     return @usage
  1266.   end
  1267.   
  1268.   def rage_boost
  1269.     yanfly_cache_baseitem_cse if @rage_boost == nil
  1270.     return @rage_boost
  1271.   end
  1272.   
  1273.   def fatigue
  1274.     yanfly_cache_baseitem_cse if @fatigue == nil
  1275.     return @fatigue
  1276.   end
  1277.   
  1278. end # RPG::BaseItem

  1279. #===============================================================================
  1280. # Game_Actor
  1281. #===============================================================================

  1282. class Game_Actor < Game_Battler
  1283.   
  1284.   #--------------------------------------------------------------------------
  1285.   # alias setup
  1286.   #--------------------------------------------------------------------------
  1287.   alias setup_cse setup unless $@
  1288.   def setup(actor_id)
  1289.     setup_cse(actor_id)
  1290.     @mix_flag = false
  1291.     @scd = {}
  1292.     reset_recharge
  1293.     @slu = {}
  1294.     reset_usage
  1295.   end
  1296.   
  1297.   #--------------------------------------------------------------------------
  1298.   # set_chain
  1299.   #--------------------------------------------------------------------------
  1300.   def set_chain(array1 = nil, array2 = nil)
  1301.     @chain_skills = array1
  1302.     @chain_targets = array2
  1303.   end
  1304.   
  1305.   #--------------------------------------------------------------------------
  1306.   # reset mix items
  1307.   #--------------------------------------------------------------------------
  1308.   def reset_mix_items
  1309.     @mix_item_1 = nil
  1310.     @mix_item_2 = nil
  1311.     @mix_item_skill = nil
  1312.   end
  1313.   
  1314.   #--------------------------------------------------------------------------
  1315.   # recharge definitions
  1316.   #--------------------------------------------------------------------------
  1317.   def reset_recharge
  1318.     @scd = {} if @scd == nil
  1319.     for skill in skills
  1320.       @scd[skill.id] = 0
  1321.     end
  1322.   end
  1323.   
  1324.   #--------------------------------------------------------------------------
  1325.   # limited uses definitions
  1326.   #--------------------------------------------------------------------------
  1327.   def reset_usage
  1328.     @slu = {} if @slu == nil
  1329.     for skill in skills
  1330.       @slu[skill.id] = 0
  1331.     end
  1332.   end
  1333.   
  1334.   #--------------------------------------------------------------------------
  1335.   # alias skills
  1336.   #--------------------------------------------------------------------------
  1337.   alias skills_cse skills unless $@
  1338.   def skills
  1339.     result = skills_cse
  1340.     for skill in result
  1341.       result -= [skill] if skill.subskill_only
  1342.     end
  1343.     return result
  1344.   end
  1345.   
  1346.   #--------------------------------------------------------------------------
  1347.   # alias skill_can_use?
  1348.   #--------------------------------------------------------------------------
  1349.   alias skill_can_use_actor_cse skill_can_use? unless $@
  1350.   def skill_can_use?(skill)
  1351.     if skill == nil
  1352.       return false
  1353.     elsif @subskill_flag == true
  1354.       return super
  1355.     elsif skill.subskills != [] and @subskill_flag != true
  1356.       return true
  1357.     else
  1358.       return skill_can_use_actor_cse(skill)
  1359.     end
  1360.   end
  1361.   
  1362. end # Game_Actor

  1363. #===============================================================================
  1364. # Game_Enemy
  1365. #===============================================================================

  1366. class Game_Enemy < Game_Battler
  1367.   
  1368.   #--------------------------------------------------------------------------
  1369.   # alias initialize
  1370.   #--------------------------------------------------------------------------
  1371.   alias initialize_enemy_cse initialize unless $@
  1372.   def initialize(index, enemy_id)
  1373.     initialize_enemy_cse(index, enemy_id)
  1374.     @scd = {}
  1375.     reset_recharge
  1376.     @slu = {}
  1377.     reset_usage
  1378.   end
  1379.   
  1380.   #--------------------------------------------------------------------------
  1381.   # recharge definitions
  1382.   #--------------------------------------------------------------------------
  1383.   def reset_recharge
  1384.     @scd = {} if @scd == nil
  1385.     for action in enemy.actions
  1386.       next if action.kind != 1
  1387.       skill = $data_skills[action.skill_id]
  1388.       @scd[skill.id] = 0
  1389.     end
  1390.   end
  1391.   
  1392.   #--------------------------------------------------------------------------
  1393.   # limited uses definitions
  1394.   #--------------------------------------------------------------------------
  1395.   def reset_usage
  1396.     @slu = {} if @slu == nil
  1397.     for action in enemy.actions
  1398.       next if action.kind != 1
  1399.       skill = $data_skills[action.skill_id]
  1400.       @slu[skill.id] = 0
  1401.     end
  1402.   end
  1403.   
  1404. end # Game_Enemy

  1405. #===============================================================================
  1406. # Game_Battler
  1407. #===============================================================================

  1408. class Game_Battler
  1409.   
  1410.   #--------------------------------------------------------------------------
  1411.   # Public Instance Variables
  1412.   #--------------------------------------------------------------------------
  1413.   attr_accessor :mix_item_1
  1414.   attr_accessor :mix_item_2
  1415.   attr_accessor :mix_item_skill
  1416.   attr_accessor :chain_skills
  1417.   attr_accessor :chain_targets
  1418.   attr_accessor :subskill_flag
  1419.   
  1420.   #--------------------------------------------------------------------------
  1421.   # alias initialize
  1422.   #--------------------------------------------------------------------------
  1423.   alias initialize_cse initialize unless $@
  1424.   def initialize
  1425.     @rage = 0
  1426.     @charge_turns = 0
  1427.     @charge_skill = nil
  1428.     @fatigue = 0
  1429.     initialize_cse
  1430.   end
  1431.   
  1432.   #--------------------------------------------------------------------------
  1433.   # recharge definitions
  1434.   #--------------------------------------------------------------------------
  1435.   def recharge(skill_id)
  1436.     @scd = {} if @scd == nil
  1437.     return 0 if skill_id == nil
  1438.     @scd[skill_id] = 0 if @scd[skill_id] == nil
  1439.     x = @scd[skill_id]
  1440.     return x
  1441.   end
  1442.   
  1443.   def make_recharge(skill, amount)
  1444.     amount = 0 if amount < 0
  1445.     @scd = {} if @scd == nil
  1446.     @scd[skill.id] = amount
  1447.   end
  1448.   
  1449.   def update_recharge
  1450.     @scd = {} if @scd == nil
  1451.     @scd.each_key {|key|
  1452.       @scd[key] = 0 if @scd[key] == nil
  1453.       @scd[key] -= 1
  1454.       @scd[key] = 0 if @scd[key] < 0
  1455.     }
  1456.   end
  1457.   
  1458.   #--------------------------------------------------------------------------
  1459.   # limited uses definitions
  1460.   #--------------------------------------------------------------------------
  1461.   def usage(skill_id)
  1462.     @slu = {} if @slu == nil
  1463.     return 0 if skill_id == nil
  1464.     @slu[skill_id] = 0 if @slu[skill_id] == nil
  1465.     x = @slu[skill_id]
  1466.     return x
  1467.   end
  1468.   
  1469.   def update_usage(skill_id)
  1470.     @slu = {} if @slu == nil
  1471.     @slu[skill_id] = 0 if @slu[skill_id] == nil
  1472.     @slu[skill_id] = @slu[skill_id] + 1
  1473.   end
  1474.   
  1475.   #--------------------------------------------------------------------------
  1476.   # alias inputable?
  1477.   #--------------------------------------------------------------------------
  1478.   alias inputable_cse inputable? unless $@
  1479.   def inputable?
  1480.     return false if @fatigue >= 1
  1481.     return false if (@charge_skill != nil) and (@charge_turns > 0)
  1482.     inputable_cse
  1483.   end
  1484.   
  1485.   #--------------------------------------------------------------------------
  1486.   # reflect
  1487.   #--------------------------------------------------------------------------
  1488.   def reflect
  1489.     for state in states
  1490.       return true if state.reflect
  1491.     end
  1492.     return false
  1493.   end
  1494.   
  1495.   #--------------------------------------------------------------------------
  1496.   # Cost Mods
  1497.   #--------------------------------------------------------------------------
  1498.   def cost_hp_mod(value)
  1499.     states.each { |state|
  1500.       value = value * state.cost_hp_per / 100
  1501.       value += state.cost_hp_set
  1502.     }
  1503.     return value
  1504.   end
  1505.   
  1506.   def cost_mp_mod(value)
  1507.     states.each { |state|
  1508.       value = value * state.cost_mp_per / 100
  1509.       value += state.cost_mp_set
  1510.     }
  1511.     return value
  1512.   end
  1513.   
  1514.   def cost_gold_mod(value)
  1515.     states.each { |state|
  1516.       value = value * state.cost_gold_per / 100
  1517.       value += state.cost_gold_set
  1518.     }
  1519.     return value
  1520.   end
  1521.   
  1522.   def cost_maxgold_mod(value)
  1523.     states.each { |state|
  1524.       value = value * state.cost_maxgold_per / 100
  1525.       value += state.cost_maxgold_set
  1526.     }
  1527.     return value
  1528.   end
  1529.   
  1530.   def cost_rage_mod(value)
  1531.     states.each { |state|
  1532.       value = value * state.cost_rage_per / 100
  1533.       value += state.cost_rage_set
  1534.     }
  1535.     return value
  1536.   end
  1537.   
  1538.   #--------------------------------------------------------------------------
  1539.   # rage definitions
  1540.   #--------------------------------------------------------------------------
  1541.   def rage
  1542.     @rage = 0 if @rage == nil or @rage < 0
  1543.     @rage = YE::BATTLE::MAX_RAGE if @rage > YE::BATTLE::MAX_RAGE
  1544.     return @rage
  1545.   end
  1546.   
  1547.   def rage=(new_rage)
  1548.     @rage = new_rage
  1549.     @rage = 0 if @rage < 0
  1550.     @rage = YE::BATTLE::MAX_RAGE if @rage > YE::BATTLE::MAX_RAGE
  1551.   end
  1552.   
  1553.   def rage_boost_mod(value)
  1554.     states.each { |state|
  1555.       value = value * state.rage_boost_per / 100
  1556.       value += state.rage_boost_set
  1557.     }
  1558.     value = 0 if value < 0
  1559.     return value
  1560.   end
  1561.   
  1562.   #--------------------------------------------------------------------------
  1563.   # cast time definitions
  1564.   #--------------------------------------------------------------------------
  1565.   def charge_turns
  1566.     return @charge_turns
  1567.   end
  1568.   
  1569.   def charge_turns=(new_charge_turn)
  1570.     @charge_turns = (new_charge_turn)
  1571.   end
  1572.   
  1573.   def charge_skill
  1574.     return @charge_skill
  1575.   end
  1576.   
  1577.   def charge_skill=(new_skill)
  1578.     @charge_skill = new_skill
  1579.   end
  1580.   
  1581.   def make_charge(skill)
  1582.     @charge_turns = skill.cast_time
  1583.     @charge_skill = skill
  1584.   end
  1585.   
  1586.   def reset_charging
  1587.     if @charge_skill != nil
  1588.       make_recharge(@charge_skill, @charge_skill.recharge)
  1589.     end
  1590.     @charge_turns = 0
  1591.     @charge_skill = nil
  1592.   end
  1593.   
  1594.   def update_charging
  1595.     if @charge_skill != nil
  1596.       @charge_turns -= 1
  1597.       csekeep = true
  1598.       csekeep = false if dead?
  1599.       csekeep = false if !exist?
  1600.       csekeep = false if !movable?
  1601.       csekeep = false if berserker?
  1602.       csekeep = false if confusion?
  1603.       if !csekeep
  1604.         reset_charging
  1605.       end
  1606.     end
  1607.   end
  1608.   
  1609.   #--------------------------------------------------------------------------
  1610.   # fatigue definitions
  1611.   #--------------------------------------------------------------------------
  1612.   def fatigue
  1613.     return @fatigue
  1614.   end
  1615.   
  1616.   def fatigue=(new_fatigue)
  1617.     @fatigue = new_fatigue
  1618.     @fatigue = 0 if fatigue < 0
  1619.   end
  1620.   
  1621.   def make_fatigue(skill)
  1622.     @fatigue = skill.fatigue
  1623.   end
  1624.   
  1625.   def update_fatigue
  1626.     @fatigue -= 1
  1627.   end
  1628.   
  1629.   #--------------------------------------------------------------------------
  1630.   # Create Cost Icon
  1631.   #--------------------------------------------------------------------------
  1632.   def create_cost_icon(skill)
  1633.     if skill.cost_custom > 0
  1634.       icon = cost_custom(skill, 1)
  1635.     elsif skill.cur_mp_cost > 0
  1636.       icon = YE::BATTLE::MP_ICON
  1637.     elsif skill.max_mp_cost > 0
  1638.       icon = YE::BATTLE::MP_ICON
  1639.     elsif skill.cur_hp_cost > 0
  1640.       icon = YE::BATTLE::HP_ICON
  1641.     elsif skill.max_hp_cost > 0
  1642.       icon = YE::BATTLE::HP_ICON
  1643.     elsif skill.gold_cost > 0
  1644.       icon = YE::BATTLE::GOLD_ICON
  1645.     elsif skill.maxgold_cost > 0
  1646.       icon = YE::BATTLE::GOLD_ICON
  1647.     elsif skill.rage_cost > 0
  1648.       icon = YE::BATTLE::RAGE_ICON
  1649.     else
  1650.       icon = YE::BATTLE::MP_ICON
  1651.     end
  1652.     if skill.subskills != [] and self.subskill_flag != true
  1653.       icon = 0
  1654.     end
  1655.     return icon
  1656.   end
  1657.   
  1658.   #--------------------------------------------------------------------------
  1659.   # Calculation of MP Consumed for Skills
  1660.   #--------------------------------------------------------------------------
  1661.   def calc_mp_cost(skill)
  1662.     recharge = self.recharge(skill.id)
  1663.     if recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
  1664.       cost = recharge
  1665.     elsif skill.cost_custom > 0
  1666.       cost = cost_custom(skill, 3)
  1667.     elsif skill.cur_mp_cost > 0
  1668.       cost = skill.cur_mp_cost
  1669.       cost /= 2 if half_mp_cost
  1670.       cost = cost_mp_mod(cost)
  1671.     elsif skill.max_mp_cost > 0
  1672.       cost = skill.max_mp_cost * maxmp
  1673.       cost /= 100
  1674.       cost /= 2 if half_mp_cost
  1675.       cost = cost_mp_mod(cost)
  1676.     elsif skill.cur_hp_cost > 0
  1677.       cost = skill.cur_hp_cost
  1678.       cost = cost_hp_mod(cost)
  1679.     elsif skill.max_hp_cost > 0
  1680.       cost = skill.max_hp_cost * maxhp
  1681.       cost /= 100
  1682.       cost = cost_hp_mod(cost)
  1683.     elsif skill.gold_cost > 0
  1684.       cost = skill.gold_cost
  1685.       cost = cost_gold_mod(cost)
  1686.       cost = 0 unless self.actor?
  1687.     elsif skill.maxgold_cost > 0
  1688.       cost = skill.maxgold_cost
  1689.       cost = cost_maxgold_mod(cost)
  1690.       cost = 0 unless self.actor?
  1691.     elsif skill.rage_cost > 0
  1692.       cost = skill.rage_cost
  1693.       cost = cost_rage_mod(cost)
  1694.     else
  1695.       cost = skill.mp_cost
  1696.       cost /= 2 if half_mp_cost
  1697.       cost = cost_mp_mod(cost)
  1698.     end
  1699.     cost = 0 if cost <= 0
  1700.     return calc_cost_common(cost, skill)
  1701.   end
  1702.   
  1703.   #--------------------------------------------------------------------------
  1704.   # overwrite skill_can_use?
  1705.   #--------------------------------------------------------------------------
  1706.   def skill_can_use?(skill)
  1707.     return false unless skill.is_a?(RPG::Skill)
  1708.     return false unless movable?
  1709.     return false if silent? and skill.spi_f > 0
  1710.     #---
  1711.     if $imported["BattlerStatMorale"] and skill.requires_morale
  1712.       if skill.required_morale >= 0
  1713.         return false if skill.required_morale > self.morale
  1714.       elsif skill.required_morale < 0
  1715.         return false if skill.required_morale < self.morale
  1716.       end
  1717.     end
  1718.     if $imported["EquipSkillSlots"]
  1719.       return false unless can_use_limit_type?(skill)
  1720.     end
  1721.     #---
  1722.     return false unless custom_skill_requirements(skill)
  1723.     #---
  1724.     recharge = self.recharge(skill.id)
  1725.     recharge = 0 unless $scene.is_a?(Scene_Battle)
  1726.     usage = self.usage(skill.id)
  1727.     usage = 0 unless $scene.is_a?(Scene_Battle)
  1728.     cost = calc_mp_cost(skill)
  1729.     if recharge > 0
  1730.       return false
  1731.     elsif skill.cost_custom > 0
  1732.       can_use = cost_custom(skill, 4)
  1733.       return false if can_use == false
  1734.     elsif skill.usage > 0
  1735.       return false if usage >= skill.usage
  1736.     elsif skill.cur_mp_cost > 0
  1737.       return false if cost > mp
  1738.     elsif skill.max_mp_cost > 0
  1739.       return false if cost > mp
  1740.     elsif skill.cur_hp_cost > 0
  1741.       if !YE::BATTLE::ALLOW_DEATH_HP_COST
  1742.         return false if cost > self.hp
  1743.       end
  1744.     elsif skill.max_hp_cost > 0
  1745.       if !YE::BATTLE::ALLOW_DEATH_HP_COST
  1746.         return false if cost > self.hp
  1747.       end
  1748.     elsif skill.gold_cost > 0
  1749.       return false if cost > $game_party.gold
  1750.     elsif skill.maxgold_cost > 0
  1751.       cost *= $game_party.gold
  1752.       cost /= 100
  1753.       return false if $game_party.gold < cost
  1754.       return false if cost == 0
  1755.     elsif skill.rage_cost > 0
  1756.       return false if cost > self.rage
  1757.     else
  1758.       return false if cost > mp
  1759.     end
  1760.     #---
  1761.     if $game_temp.in_battle
  1762.       return skill.battle_ok?
  1763.     else
  1764.       return skill.menu_ok?
  1765.     end
  1766.   end
  1767.   
  1768.   #--------------------------------------------------------------------------
  1769.   # custom_skill_requirements
  1770.   #--------------------------------------------------------------------------
  1771.   def custom_skill_requirements(skill)
  1772.     return true if !self.actor?
  1773.     #---
  1774.     if skill.required_all_elements != []
  1775.       for ele_id in skill.required_all_elements
  1776.         next if self.element_set.include?(ele_id)
  1777.         return false
  1778.       end
  1779.     end
  1780.     if skill.required_any_elements != []
  1781.       possess_element = false
  1782.       for ele_id in skill.required_any_elements
  1783.         possess_element = true if self.element_set.include?(ele_id)
  1784.       end
  1785.       return false unless possess_element
  1786.     end
  1787.     #---
  1788.     if skill.required_all_states != []
  1789.       for state_id in skill.required_all_states
  1790.         return false unless self.states.include?($data_states[state_id])
  1791.       end
  1792.     end
  1793.     if skill.required_any_states != []
  1794.       for state_id in skill.required_any_states
  1795.         possess_state = true if self.states.include?($data_states[state_id])
  1796.       end
  1797.       return false unless possess_state
  1798.     end
  1799.     #---
  1800.     return true
  1801.   end
  1802.   
  1803.   #--------------------------------------------------------------------------
  1804.   # alias attack_effect
  1805.   #--------------------------------------------------------------------------
  1806.   alias attack_effect_cse attack_effect unless $@
  1807.   def attack_effect(attacker)
  1808.     attack_effect_cse(attacker)
  1809.     if YE::BATTLE::INC_RAGE_ATTACK
  1810.       attacker.rage += YE::BATTLE::NUM_RAGE_ATTACK
  1811.     end
  1812.   end
  1813.   
  1814.   #--------------------------------------------------------------------------
  1815.   # alias skill_effect
  1816.   #--------------------------------------------------------------------------
  1817.   alias skill_effect_cse skill_effect unless $@
  1818.   def skill_effect(user, skill)
  1819.     skill_effect_cse(user, skill)
  1820.     if $scene.is_a?(Scene_Battle)
  1821.       user.rage += YE::BATTLE::NUM_RAGE_SKILL if YE::BATTLE::INC_RAGE_SKILL
  1822.       rb = user.rage_boost_mod(skill.rage_boost)
  1823.       user.rage += rb
  1824.     end
  1825.     if $scene.is_a?(Scene_Battle)
  1826.       user.make_recharge(skill, skill.recharge)
  1827.       user.update_usage(skill.id) unless $scene.usage_flag
  1828.       $scene.set_usage
  1829.     end
  1830.   end
  1831.   
  1832.   #--------------------------------------------------------------------------
  1833.   # hit_learn?
  1834.   #--------------------------------------------------------------------------
  1835.   def hit_learn?(skill)
  1836.     return false unless self.actor?
  1837.     return false unless skill.hit_learnable?
  1838.     return false if self.skill_learn?(skill)
  1839.     return false if self.dead?
  1840.     return true if skill.hit_learn_actor.include?(self.id)
  1841.     return true if skill.hit_learn_class.include?(self.class.id)
  1842.     if $imported["SubclassSelectionSystem"] and self.subclass != nil and
  1843.     YE::BATTLE::SUBCLASS_HIT_LEARN
  1844.       return true if skill.hit_learn_class.include?(self.subclass.id)
  1845.     end
  1846.     return false
  1847.   end
  1848.   
  1849. end #class Game_Battler

  1850. #===============================================================================
  1851. # Game_BattleAction
  1852. #===============================================================================

  1853. class Game_BattleAction
  1854.   
  1855.   #--------------------------------------------------------------------------
  1856.   # alias valid
  1857.   #--------------------------------------------------------------------------
  1858.   alias valid_cse valid? unless $@
  1859.   def valid?
  1860.     battler.update_recharge
  1861.     if battler.fatigue >= 1
  1862.       battler.update_fatigue
  1863.       return false
  1864.     end
  1865.     return true if battler.charge_turns >= 1 and
  1866.     battler.charge_skill != nil and !battler.dead?
  1867.     valid_cse
  1868.   end
  1869.   
  1870.   #--------------------------------------------------------------------------
  1871.   # perform_charge_skill
  1872.   #--------------------------------------------------------------------------
  1873.   def perform_charge_skill
  1874.     @forcing = true
  1875.     decide_last_target
  1876.     set_skill(battler.charge_skill.id)
  1877.     $game_troop.forcing_battler = @active_battler
  1878.   end
  1879.   
  1880. end

  1881. #===============================================================================
  1882. # Scene Battle
  1883. #===============================================================================

  1884. class Scene_Battle < Scene_Base

  1885.   #--------------------------------------------------------------------------
  1886.   # Refresh OnScreenStatus
  1887.   #--------------------------------------------------------------------------
  1888.   def refresh_onscreenstatus
  1889.     @onscreen_status_window.refresh if $imported["OnScreenStatus"]
  1890.   end
  1891.   
  1892.   #--------------------------------------------------------------------------
  1893.   # Message Wait
  1894.   #--------------------------------------------------------------------------
  1895.   def msgwait
  1896.     wait(YE::BATTLE::MSGWAIT)
  1897.   end
  1898.   
  1899.   #--------------------------------------------------------------------------
  1900.   # alias process_battle_start
  1901.   #--------------------------------------------------------------------------
  1902.   alias process_battle_start_cps process_battle_start unless $@
  1903.   def process_battle_start
  1904.     for actor in $game_party.members
  1905.       actor_reset(actor)
  1906.       create_prep_charge_actor(actor)
  1907.     end
  1908.     for battler in $game_troop.members
  1909.       create_prep_charge_enemy(battler)
  1910.     end
  1911.     process_battle_start_cps
  1912.   end
  1913.   
  1914.   #--------------------------------------------------------------------------
  1915.   # alias battle_end
  1916.   #--------------------------------------------------------------------------
  1917.   alias battle_end_cse battle_end unless $@
  1918.   def battle_end(result)
  1919.     for actor in $game_party.members
  1920.       actor_reset(actor)
  1921.     end
  1922.     battle_end_cse(result)
  1923.   end
  1924.   
  1925.   #--------------------------------------------------------------------------
  1926.   # actor reset
  1927.   #--------------------------------------------------------------------------
  1928.   def actor_reset(actor)
  1929.     actor.rage = 0 if YE::BATTLE::RAGE_RESET_BATTLE
  1930.     actor.charge_turns = 0
  1931.     actor.charge_skill = nil
  1932.     actor.fatigue = 0
  1933.     actor.reset_recharge
  1934.     actor.subskill_flag = nil
  1935.     actor.set_chain
  1936.   end
  1937.   
  1938.   #--------------------------------------------------------------------------
  1939.   # create preparation charging
  1940.   #--------------------------------------------------------------------------
  1941.   def create_prep_charge_actor(actor)
  1942.     for skill in actor.skills
  1943.       next if skill == nil
  1944.       actor.make_recharge(skill, skill.prepare)
  1945.     end
  1946.   end
  1947.   
  1948.   #--------------------------------------------------------------------------
  1949.   # create preparation charging
  1950.   #--------------------------------------------------------------------------
  1951.   def create_prep_charge_enemy(battler)
  1952.     for action in battler.enemy.actions
  1953.       if action.kind == 1
  1954.         skill = $data_skills[action.skill_id]
  1955.         battler.make_recharge(skill, skill.prepare)
  1956.       end
  1957.     end
  1958.   end
  1959.   
  1960.   #--------------------------------------------------------------------------
  1961.   # alias update_actor_command_selection
  1962.   #--------------------------------------------------------------------------
  1963.   alias update_actor_command_selection_cse update_actor_command_selection unless $@
  1964.   def update_actor_command_selection
  1965.     if Input.trigger?(Input::B)
  1966.       @active_battler.reset_mix_items
  1967.       @active_battler.subskill_flag = nil
  1968.       @active_battler.set_chain
  1969.     elsif Input.trigger?(Input::C) and !$imported["CustomBattleActions"]
  1970.       @active_battler.reset_mix_items
  1971.       @active_battler.subskill_flag = nil
  1972.       @active_battler.set_chain
  1973.     end
  1974.     update_actor_command_selection_cse
  1975.   end
  1976.   
  1977.   #--------------------------------------------------------------------------
  1978.   # alias update_target_enemy_selection
  1979.   #--------------------------------------------------------------------------
  1980.   alias update_target_enemy_selection_cse update_target_enemy_selection unless $@
  1981.   def update_target_enemy_selection
  1982.     if Input.trigger?(Input::B)
  1983.       if @mix_item_window != nil
  1984.         @mix_item_window.active = true
  1985.         @active_battler.mix_item_2 = nil
  1986.         @mix_item_window.refresh
  1987.       elsif @subskill_window != nil
  1988.         @subskill_window.active = true
  1989.       elsif @chain_window != nil
  1990.         @chain_window.active = true
  1991.         @chain_array.delete_at (@chain_array.size - 1)
  1992.         @chain_targets.delete_at (@chain_targets.size - 1)
  1993.         @chain_info.refresh(@chain_array)
  1994.         @chain_window.refresh(@chain_array)
  1995.       else
  1996.         @active_battler.reset_mix_items
  1997.       end
  1998.     end
  1999.     if Input.trigger?(Input::C) and @chain_window != nil
  2000.       add_chain_targets
  2001.     else
  2002.       update_target_enemy_selection_cse
  2003.     end
  2004.   end
  2005.   
  2006.   #--------------------------------------------------------------------------
  2007.   # alias update_target_actor_selection
  2008.   #--------------------------------------------------------------------------
  2009.   alias update_target_actor_selection_cse update_target_actor_selection unless $@
  2010.   def update_target_actor_selection
  2011.     if Input.trigger?(Input::B)
  2012.       if @mix_item_window != nil
  2013.         @mix_item_window.active = true
  2014.         @active_battler.mix_item_2 = nil
  2015.         @mix_item_window.refresh
  2016.       elsif @subskill_window != nil
  2017.         @subskill_window.active = true
  2018.       elsif @chain_window != nil
  2019.         @chain_window.active = true
  2020.         @chain_array.delete_at (@chain_array.size - 1)
  2021.         @chain_targets.delete_at (@chain_targets.size - 1)
  2022.         @chain_info.refresh(@chain_array)
  2023.         @chain_window.refresh(@chain_array)
  2024.       else
  2025.         @active_battler.reset_mix_items
  2026.       end
  2027.     end
  2028.     if Input.trigger?(Input::C) and @chain_window != nil
  2029.       add_chain_targets
  2030.     else
  2031.       update_target_actor_selection_cse
  2032.     end
  2033.   end
  2034.   
  2035.   #--------------------------------------------------------------------------
  2036.   # alias next_actor
  2037.   #--------------------------------------------------------------------------
  2038.   alias next_actor_cse next_actor unless $@
  2039.   def next_actor
  2040.     if instant_cast_skill?
  2041.       perform_instant_cast
  2042.       if @active_battler.inputable?
  2043.         start_actor_command_selection
  2044.       else
  2045.         next_actor_cse
  2046.       end
  2047.     else
  2048.       next_actor_cse
  2049.     end
  2050.   end
  2051.   
  2052.   #--------------------------------------------------------------------------
  2053.   # instant_cast_skill?
  2054.   #--------------------------------------------------------------------------
  2055.   def instant_cast_skill?
  2056.     return false if @active_battler == nil
  2057.     return false unless @active_battler.action.skill?
  2058.     return false unless @active_battler.action.skill.instant_cast
  2059.     return true
  2060.   end
  2061.   
  2062.   #--------------------------------------------------------------------------
  2063.   # perform instant cast
  2064.   #--------------------------------------------------------------------------
  2065.   def perform_instant_cast
  2066.     @message_window.clear
  2067.     @message_window.visible = true
  2068.     unless $imported["SceneBattleReDux"] and @redux_msg
  2069.       @info_viewport.visible = false
  2070.     end
  2071.     cast_the_skill(@active_battler.action.skill)
  2072.     unless $imported["SceneBattleReDux"] and @redux_msg
  2073.       @info_viewport.visible = true
  2074.     end
  2075.     @message_window.visible = false
  2076.     @status_window.refresh
  2077.   end
  2078.   
  2079.   #--------------------------------------------------------------------------
  2080.   # alias determine skill
  2081.   #--------------------------------------------------------------------------
  2082.   alias determine_skill_cse determine_skill unless $@
  2083.   def determine_skill
  2084.     if @skill.mix_items
  2085.       create_mix_item_windows
  2086.     elsif @skill.subskills != []
  2087.       create_subskill_windows
  2088.     elsif @skill.chain_type > 0
  2089.       create_chain_windows
  2090.     else
  2091.       determine_skill_cse
  2092.     end
  2093.   end
  2094.   
  2095.   #--------------------------------------------------------------------------
  2096.   # create_mix_item_windows
  2097.   #--------------------------------------------------------------------------
  2098.   def create_mix_item_windows
  2099.     sk = @skill
  2100.     @active_battler.action.set_skill(@skill.id)
  2101.     @mix_item_window = Window_Mix_Item.new(0, 56, 544, 232, @active_battler, sk)
  2102.     @mix_item_window.help_window = @help_window
  2103.     if $imported["HelpExtension"]
  2104.       @mix_item_window.y = @help_window.height
  2105.       @mix_item_window.height = Graphics.height -
  2106.         (@help_window.height + @status_window.height)
  2107.       @mix_item_window.refresh
  2108.     end
  2109.     @mix_item_window.active = true
  2110.     @skill_window.active = false
  2111.     @skill_window.visible = false
  2112.   end
  2113.   
  2114.   #--------------------------------------------------------------------------
  2115.   # end_mix_item
  2116.   #--------------------------------------------------------------------------
  2117.   def end_mix_item
  2118.     if $imported["CustomBattleActions"]
  2119.       if @active_battler.custom_action_flag == true
  2120.         end_skill_selection
  2121.       end
  2122.     end
  2123.     if @skill_window != nil
  2124.       @skill_window.active = true
  2125.       @skill_window.visible = true
  2126.     end
  2127.     if @mix_item_window != nil
  2128.       @mix_item_window.dispose
  2129.       @mix_item_window = nil
  2130.     end
  2131.     @active_battler.reset_mix_items
  2132.   end
  2133.   
  2134.   #--------------------------------------------------------------------------
  2135.   # alias end_skill_selection
  2136.   #--------------------------------------------------------------------------
  2137.   alias end_skill_selection_cse end_skill_selection unless $@
  2138.   def end_skill_selection
  2139.     if @mix_item_window != nil
  2140.       @mix_item_window.dispose
  2141.       @mix_item_window = nil
  2142.     end
  2143.     if @subskill_window != nil
  2144.       @subskill_window.dispose
  2145.       @subskill_window = nil
  2146.     end
  2147.     if @chain_window != nil
  2148.       @chain_window.dispose
  2149.       @chain_window = nil
  2150.     end
  2151.     if @chain_info != nil
  2152.       @chain_info.dispose
  2153.       @chain_info = nil
  2154.     end
  2155.     end_skill_selection_cse
  2156.   end
  2157.   
  2158.   #--------------------------------------------------------------------------
  2159.   # alias update_skill_selection
  2160.   #--------------------------------------------------------------------------
  2161.   alias update_skill_selection_cse update_skill_selection unless $@
  2162.   def update_skill_selection
  2163.     if @mix_item_window != nil and @mix_item_window.active
  2164.       update_mix_item
  2165.     elsif @subskill_window != nil and @subskill_window.active
  2166.       update_subskill
  2167.     elsif @chain_window != nil and @chain_window.active
  2168.       update_chain_skill
  2169.     else
  2170.       update_skill_selection_cse
  2171.     end
  2172.   end
  2173.   
  2174.   #--------------------------------------------------------------------------
  2175.   # update_mix_item
  2176.   #--------------------------------------------------------------------------
  2177.   def update_mix_item
  2178.     @mix_item_window.update
  2179.     @help_window.update
  2180.     if Input.trigger?(Input::B)
  2181.       if @active_battler.mix_item_1 == nil and @active_battler.mix_item_2 == nil
  2182.         Sound.play_cancel
  2183.         end_mix_item
  2184.       elsif @active_battler.mix_item_2 != nil
  2185.         Sound.play_cancel
  2186.         @active_battler.mix_item_2 = nil
  2187.         @mix_item_window.refresh
  2188.       elsif @active_battler.mix_item_1 != nil
  2189.         Sound.play_cancel
  2190.         @active_battler.mix_item_1 = nil
  2191.         @mix_item_window.refresh
  2192.       end
  2193.     elsif Input.trigger?(Input::C)
  2194.       item = @mix_item_window.item
  2195.       if item == nil
  2196.         Sound.play_buzzer
  2197.       elsif @active_battler.mix_item_1 == nil
  2198.         Sound.play_decision
  2199.         @active_battler.mix_item_1 = item.id
  2200.       elsif @active_battler.mix_item_2 == nil
  2201.         if item.id == @active_battler.mix_item_1 and
  2202.         $game_party.item_number(item) < 2
  2203.           Sound.play_buzzer
  2204.         else
  2205.           @active_battler.mix_item_2 = item.id
  2206.           determine_mix_item
  2207.         end
  2208.       end
  2209.       @mix_item_window.refresh if @mix_item_window != nil
  2210.     end
  2211.   end
  2212.   
  2213.   #--------------------------------------------------------------------------
  2214.   # determine_mix_item
  2215.   #--------------------------------------------------------------------------
  2216.   def determine_mix_item
  2217.     item1 = @active_battler.mix_item_1
  2218.     item2 = @active_battler.mix_item_2
  2219.     combo_hash = YE::BATTLE::ITEM_MIX_COMBO_HASH
  2220.     if combo_hash.include?([item1, item2])
  2221.       if YE::BATTLE::SUCCESSFUL_ITEM_MIX != nil
  2222.         YE::BATTLE::SUCCESSFUL_ITEM_MIX.play
  2223.       else
  2224.         Sound.play_decision
  2225.       end
  2226.       combo_array = combo_hash[[item1, item2]]
  2227.       @active_battler.mix_item_skill = combo_array[rand(combo_array.size)]
  2228.     elsif combo_hash.include?([item2, item1])
  2229.       if YE::BATTLE::SUCCESSFUL_ITEM_MIX != nil
  2230.         YE::BATTLE::SUCCESSFUL_ITEM_MIX.play
  2231.       else
  2232.         Sound.play_decision
  2233.       end
  2234.       combo_array = combo_hash[[item2, item1]]
  2235.       @active_battler.mix_item_skill = combo_array[rand(combo_array.size)]
  2236.     else
  2237.       Sound.play_decision
  2238.       select_random_mix_item_skill(item1, item2)
  2239.     end
  2240.     item_skill = $data_skills[@active_battler.mix_item_skill]
  2241.     if item_skill.need_selection?
  2242.       if item_skill.for_opponent?
  2243.         start_target_enemy_selection
  2244.       else
  2245.         start_target_actor_selection
  2246.       end
  2247.     else
  2248.       end_skill_selection
  2249.       next_actor
  2250.     end
  2251.   end
  2252.   
  2253.   #--------------------------------------------------------------------------
  2254.   # select_random_mix_item_skill
  2255.   #--------------------------------------------------------------------------
  2256.   def select_random_mix_item_skill(item1, item2)
  2257.     random_hash = YE::BATTLE::RANDOM_ITEM_MIX_TYPES
  2258.     random_array = []
  2259.     for type in $data_items[item1].mix_types
  2260.       random_array += random_hash[type] if random_hash.include?(type)
  2261.     end
  2262.     for type in $data_items[item2].mix_types
  2263.       random_array += random_hash[type] if random_hash.include?(type)
  2264.     end
  2265.     random_array = random_hash[0] if random_array == []
  2266.     @active_battler.mix_item_skill = random_array[rand(random_array.size)]
  2267.   end
  2268.   
  2269.   #--------------------------------------------------------------------------
  2270.   # create_subskill_windows
  2271.   #--------------------------------------------------------------------------
  2272.   def create_subskill_windows
  2273.     sk = @skill
  2274.     @active_battler.subskill_flag = true
  2275.     @active_battler.action.set_skill(@skill.id)
  2276.     @subskill_window = Window_Subskills.new(0,56,544,232,@active_battler, sk)
  2277.     @subskill_window.help_window = @help_window
  2278.     if $imported["HelpExtension"]
  2279.       @subskill_window.y = @help_window.height
  2280.       @subskill_window.height = Graphics.height -
  2281.         (@help_window.height + @status_window.height)
  2282.       @subskill_window.refresh
  2283.     end
  2284.     @subskill_window.active = true
  2285.     @skill_window.active = false
  2286.     @skill_window.visible = false
  2287.   end
  2288.   
  2289.   #--------------------------------------------------------------------------
  2290.   # update subskill
  2291.   #--------------------------------------------------------------------------
  2292.   def update_subskill
  2293.     @subskill_window.update
  2294.     @help_window.update
  2295.     if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::BATTLE_HELP_SHOW
  2296.       if @skill_data_window.active
  2297.         @help_info_window.visible = false
  2298.       elsif @subskill_window.active
  2299.         @help_info_window.visible = true
  2300.       else
  2301.         @help_info_window.visible = false
  2302.       end
  2303.     else
  2304.       @help_info_window.visible = false if $imported["DisplaySkillQuery"]
  2305.     end
  2306.     if Input.trigger?(Input::B)
  2307.       Sound.play_cancel
  2308.       @subskill_window.dispose
  2309.       @subskill_window = nil
  2310.       @skill_window.active = true
  2311.       @skill_window.visible = true
  2312.       @active_battler.subskill_flag = nil
  2313.       if $imported["CustomBattleActions"]
  2314.         if @active_battler.custom_action_flag == true
  2315.           @help_info_window.visible = false if $imported["DisplaySkillQuery"]
  2316.           end_skill_selection
  2317.         end
  2318.       end
  2319.     elsif Input.trigger?(Input::C)
  2320.       @skill = @subskill_window.skill
  2321.       if @active_battler.skill_can_use?(@skill)
  2322.         Sound.play_decision
  2323.         @help_info_window.visible = false if $imported["DisplaySkillQuery"]
  2324.         determine_subskill
  2325.       else
  2326.         Sound.play_buzzer
  2327.       end
  2328.     elsif $imported["DisplaySkillQuery"] and
  2329.     Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_BATTLE_BUTTON)
  2330.       skill = @subskill_window.skill
  2331.       if skill != nil
  2332.         Sound.play_decision
  2333.         @skill_data_window.appear(skill, @subskill_window, @active_battler)
  2334.         @subskill_window.active = false
  2335.       else
  2336.         Sound.play_buzzer
  2337.       end
  2338.     end
  2339.   end
  2340.   
  2341.   #--------------------------------------------------------------------------
  2342.   # determine_subskill
  2343.   #--------------------------------------------------------------------------
  2344.   def determine_subskill
  2345.     @active_battler.action.set_skill(@skill.id)
  2346.     @subskill_window.active = false
  2347.     if @skill.need_selection?
  2348.       if @skill.for_opponent?
  2349.         start_target_enemy_selection
  2350.       else
  2351.         start_target_actor_selection
  2352.       end
  2353.     else
  2354.       end_skill_selection
  2355.       next_actor
  2356.     end
  2357.   end
  2358.   
  2359.   #--------------------------------------------------------------------------
  2360.   # create chain windows
  2361.   #--------------------------------------------------------------------------
  2362.   def create_chain_windows
  2363.     sk = @skill
  2364.     @chain_array = []
  2365.     @chain_targets = []
  2366.     @active_battler.subskill_flag = true
  2367.     @active_battler.action.set_skill(@skill.id)
  2368.     @chain_window = Window_Chain_Skill.new(0,56,272,232,@active_battler, sk)
  2369.     @chain_window.help_window = @help_window
  2370.     @chain_info = Window_Chain_Info.new(272,56,272,232,@active_battler, sk)
  2371.     if $imported["HelpExtension"]
  2372.       @chain_window.y = @help_window.height
  2373.       @chain_info.y = @help_window.height
  2374.       @chain_window.height = Graphics.height -
  2375.         (@help_window.height + @status_window.height)
  2376.       @chain_info.height = Graphics.height -
  2377.         (@help_window.height + @status_window.height)
  2378.       @chain_window.refresh
  2379.       @chain_window.refresh(@chain_array)
  2380.       @chain_info.refresh(@chain_array)
  2381.     end
  2382.     @chain_window.active = true
  2383.     @skill_window.active = false
  2384.     @skill_window.visible = false
  2385.   end
  2386.   
  2387.   #--------------------------------------------------------------------------
  2388.   # update chain skill
  2389.   #--------------------------------------------------------------------------
  2390.   def update_chain_skill
  2391.     @chain_window.update
  2392.     @help_window.update
  2393.     if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::BATTLE_HELP_SHOW
  2394.       if @skill_data_window.active
  2395.         @help_info_window.visible = false
  2396.       elsif @chain_window.active
  2397.         @help_info_window.visible = true
  2398.       else
  2399.         @help_info_window.visible = false
  2400.       end
  2401.     else
  2402.       @help_info_window.visible = false if $imported["DisplaySkillQuery"]
  2403.     end
  2404.     if Input.trigger?(Input::B)
  2405.       Sound.play_cancel
  2406.       if @chain_array == []
  2407.         @active_battler.set_chain
  2408.         @chain_window.dispose
  2409.         @chain_window = nil
  2410.         @chain_info.dispose
  2411.         @chain_info = nil
  2412.         @skill_window.active = true
  2413.         @skill_window.visible = true
  2414.         if $imported["CustomBattleActions"]
  2415.           if @active_battler.custom_action_flag == true
  2416.             @help_info_window.visible = false if $imported["DisplaySkillQuery"]
  2417.             end_skill_selection
  2418.           end
  2419.         end
  2420.       else
  2421.         @chain_array.delete_at (@chain_array.size - 1)
  2422.         @chain_targets.delete_at (@chain_targets.size - 1)
  2423.         @chain_info.refresh(@chain_array)
  2424.         @chain_window.refresh(@chain_array)
  2425.       end
  2426.     elsif Input.trigger?(Input::C)
  2427.       skill = @chain_window.skill
  2428.       if select_chain_valid?(skill)
  2429.         @help_info_window.visible = false if $imported["DisplaySkillQuery"]
  2430.         determine_chain(skill)
  2431.       else
  2432.         Sound.play_buzzer
  2433.       end
  2434.     elsif $imported["DisplaySkillQuery"] and
  2435.     Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_BATTLE_BUTTON)
  2436.       skill = @chain_window.skill
  2437.       if skill != nil
  2438.         Sound.play_decision
  2439.         @skill_data_window.appear(skill, @chain_window, @active_battler, 2)
  2440.         @chain_window.active = false
  2441.       else
  2442.         Sound.play_buzzer
  2443.       end
  2444.     end
  2445.   end
  2446.   
  2447.   #--------------------------------------------------------------------------
  2448.   # select chain valid
  2449.   #--------------------------------------------------------------------------
  2450.   def select_chain_valid?(skill)
  2451.     return false if [email protected]_chain and @chain_array.include?(skill.id)
  2452.     return false if @chain_array.size >= @skill.chain_times
  2453.     return true
  2454.   end
  2455.   
  2456.   #--------------------------------------------------------------------------
  2457.   # determine chain
  2458.   #--------------------------------------------------------------------------
  2459.   def determine_chain(skill)
  2460.     Sound.play_decision
  2461.     skill = @chain_window.skill
  2462.     @chain_array.push(skill.id)
  2463.     @chain_window.refresh(@chain_array)
  2464.     @chain_info.refresh(@chain_array)
  2465.     if skill.need_selection?
  2466.       @chain_window.active = false
  2467.       if skill.for_opponent?
  2468.         start_target_enemy_selection
  2469.       else
  2470.         start_target_actor_selection
  2471.       end
  2472.     else
  2473.       add_chain_targets
  2474.     end
  2475.   end
  2476.   
  2477.   #--------------------------------------------------------------------------
  2478.   # add chain targets
  2479.   #--------------------------------------------------------------------------
  2480.   def add_chain_targets
  2481.     if @target_actor_window != nil and @target_actor_window.visible
  2482.       Sound.play_decision
  2483.       @chain_targets.push(@target_actor_window.index)
  2484.       end_target_actor_selection
  2485.     elsif @target_enemy_window != nil and @target_enemy_window.visible
  2486.       Sound.play_decision
  2487.       @chain_targets.push(@target_enemy_window.index)
  2488.       end_target_enemy_selection
  2489.     else
  2490.       @chain_targets.push(0)
  2491.     end
  2492.     @active_battler.set_chain(@chain_array, @chain_targets)
  2493.     if @chain_array.size >= @skill.chain_times
  2494.       end_skill_selection
  2495.       end_item_selection
  2496.       next_actor
  2497.     else
  2498.       @chain_window.active = true
  2499.     end
  2500.   end

  2501.   #--------------------------------------------------------------------------
  2502.   # alias display_hp_damage
  2503.   #--------------------------------------------------------------------------
  2504.   alias display_hp_damage_cse display_hp_damage unless $@
  2505.   def display_hp_damage(target, obj = nil)
  2506.     if target.hp_damage > 0 and YE::BATTLE::INC_RAGE_DAMAGED
  2507.       target.rage += YE::BATTLE::NUM_RAGE_DAMAGED
  2508.     end
  2509.     display_hp_damage_cse(target, obj)
  2510.   end
  2511.   
  2512.   #--------------------------------------------------------------------------
  2513.   # alias execute_action
  2514.   #--------------------------------------------------------------------------
  2515.   alias execute_action_cse execute_action unless $@
  2516.   def execute_action
  2517.     if @active_battler.charge_skill != nil
  2518.       @active_battler.update_charging
  2519.       if @active_battler.charge_turns <= 0
  2520.         @active_battler.action.perform_charge_skill
  2521.       else
  2522.         name = @active_battler.name
  2523.         skill = @active_battler.charge_skill.name
  2524.         text = sprintf(YE::BATTLE::CHARGE_CON, name, skill)
  2525.         @message_window.add_instant_text(text)
  2526.         wait(60)
  2527.       end
  2528.     end
  2529.     execute_action_cse
  2530.   end
  2531.   
  2532.   #--------------------------------------------------------------------------
  2533.   # usage flag
  2534.   #--------------------------------------------------------------------------
  2535.   def usage_flag
  2536.     @usage_flag = false if @usage_flag == nil
  2537.     return @usage_flag
  2538.   end
  2539.   
  2540.   def set_usage
  2541.     @usage_flag = true
  2542.   end

  2543.   #--------------------------------------------------------------------------
  2544.   # Execute Battle Action: Skill
  2545.   #--------------------------------------------------------------------------
  2546.   def execute_action_skill
  2547.     skill = @active_battler.action.skill
  2548.     charged = @active_battler.action.forcing
  2549.     @mix_item_flag = nil
  2550.     if skill.cast_time >= 1 and @active_battler.charge_skill == nil and !charged
  2551.       charge_the_skill(skill)
  2552.     elsif !@active_battler.actor? and @active_battler.charge_turns >= 1
  2553.       #do nothing since monsters don't have an inputable? check
  2554.     elsif @active_battler.actor? and skill.mix_items and
  2555.     @active_battler.mix_item_skill != nil
  2556.       set_mix_skill(skill)
  2557.     elsif @active_battler.actor? and skill.chain_type > 0
  2558.       chain_cast_skill(skill)
  2559.     else
  2560.       cast_the_skill(skill)
  2561.     end
  2562.   end # end execute_action_skill

  2563.   #--------------------------------------------------------------------------
  2564.   # charge_the_skill
  2565.   #--------------------------------------------------------------------------
  2566.   def charge_the_skill(skill)
  2567.     sound = YE::BATTLE::CHARGE_SND
  2568.     sound.play
  2569.     unless $imported["SceneBattleReDux"] and
  2570.     !YE::REDUX::BATTLE::MSG_CURRENT_ACTION
  2571.       text = sprintf(YE::BATTLE::CHARGE_MSG, @active_battler.name, skill.name)
  2572.       @message_window.add_instant_text(text)
  2573.     end
  2574.     apply_skill_cost(@active_battler, skill)
  2575.     @active_battler.make_charge(skill)
  2576.     refresh_onscreenstatus
  2577.     effect_charge(skill, skill.cse) if skill.cse > 0
  2578.     common_charge(skill)
  2579.     msgwait
  2580.   end

  2581.   #--------------------------------------------------------------------------
  2582.   # set_mix_skill
  2583.   #--------------------------------------------------------------------------
  2584.   def set_mix_skill(skill)
  2585.     unless $imported["SceneBattleReDux"] and
  2586.     !YE::REDUX::BATTLE::MSG_CURRENT_ACTION
  2587.       unless skill.message1.empty?
  2588.         text = @active_battler.name + skill.message1
  2589.         @message_window.add_instant_text(text)
  2590.       end
  2591.       unless skill.message2.empty?
  2592.         wait(10)
  2593.         @message_window.add_instant_text(skill.message2)
  2594.       end
  2595.       msgwait
  2596.     end
  2597.     effect_before(skill, skill.bse) if skill.bse > 0
  2598.     common_before(skill)
  2599.     apply_skill_cost(@active_battler, skill)
  2600.     refresh_onscreenstatus
  2601.     @message_window.clear
  2602.     @mix_item_flag = true
  2603.     item1 = $data_items[@active_battler.mix_item_1]
  2604.     item2 = $data_items[@active_battler.mix_item_2]
  2605.     #---
  2606.     if @active_battler.mix_item_1 == @active_battler.mix_item_1
  2607.       @mix_item_flag = false if $game_party.item_number(item1) < 2
  2608.     else
  2609.       @mix_item_flag = false if $game_party.item_number(item1) < 1
  2610.       @mix_item_flag = false if $game_party.item_number(item2) < 1
  2611.     end
  2612.     #---
  2613.     if @mix_item_flag
  2614.       $game_party.gain_item(item1, -1)
  2615.       $game_party.gain_item(item2, -1)
  2616.       skill = $data_skills[@active_battler.mix_item_skill]
  2617.       @active_battler.action.set_skill(skill.id)
  2618.       cast_the_skill(skill)
  2619.     else
  2620.       text = YE::BATTLE::NOT_ENOUGH_ITEMS
  2621.       @message_window.add_instant_text(text)
  2622.     end
  2623.     @message_window.clear
  2624.     effect_after(skill, skill.ase) if skill.ase > 0
  2625.     common_after(skill)
  2626.     @active_battler.reset_mix_items
  2627.     @active_battler.reset_charging
  2628.   end

  2629.   #--------------------------------------------------------------------------
  2630.   # chain_cast_skill
  2631.   #--------------------------------------------------------------------------
  2632.   def chain_cast_skill(skill)
  2633.     unless $imported["SceneBattleReDux"] and
  2634.     !YE::REDUX::BATTLE::MSG_CURRENT_ACTION
  2635.       unless skill.message1.empty?
  2636.         text = @active_battler.name + skill.message1
  2637.         @message_window.add_instant_text(text)
  2638.       end
  2639.       unless skill.message2.empty?
  2640.         wait(10)
  2641.         @message_window.add_instant_text(skill.message2)
  2642.       end
  2643.       msgwait
  2644.     end
  2645.     effect_before(skill, skill.bse) if skill.bse > 0
  2646.     common_before(skill)
  2647.     #---
  2648.     for i in 0..(@active_battler.chain_skills.size - 1)
  2649.       chainskill = $data_skills[@active_battler.chain_skills[i]]
  2650.       next if chainskill == nil
  2651.       @active_battler.action.set_skill(chainskill.id)
  2652.       @active_battler.action.target_index = @active_battler.chain_targets[i]
  2653.       next unless @active_battler.action.valid?
  2654.       @message_window.clear
  2655.       cast_the_skill(@active_battler.action.skill)
  2656.     end
  2657.     #---
  2658.     @message_window.clear
  2659.     apply_skill_cost(@active_battler, skill)
  2660.     refresh_onscreenstatus
  2661.     effect_after(skill, skill.ase) if skill.ase > 0
  2662.     common_after(skill)
  2663.     @active_battler.set_chain
  2664.     @active_battler.reset_charging
  2665.   end

  2666.   #--------------------------------------------------------------------------
  2667.   # cast_the_skill
  2668.   #--------------------------------------------------------------------------
  2669.   def cast_the_skill(skill)
  2670.     @mix_item_flag = false if @mix_item_flag == nil
  2671.     unless $imported["SceneBattleReDux"] and
  2672.     !YE::REDUX::BATTLE::MSG_CURRENT_ACTION
  2673.       unless skill.message1.empty?
  2674.         text = @active_battler.name + skill.message1
  2675.         @message_window.add_instant_text(text)
  2676.       end
  2677.       unless skill.message2.empty?
  2678.         wait(10)
  2679.         @message_window.add_instant_text(skill.message2)
  2680.       end
  2681.     end
  2682.     targets = @active_battler.action.make_targets
  2683.     if skill.csa > 0
  2684.       custom_ani(targets, skill.csa)
  2685.     else
  2686.       display_animation(targets, skill.animation_id)
  2687.     end
  2688.     apply_skill_cost(@active_battler, skill) unless @mix_item_flag
  2689.     refresh_onscreenstatus
  2690.     effect_before(skill, skill.bse) if skill.bse > 0
  2691.     common_before(skill)
  2692.     @usage_flag = false
  2693.     for target in targets
  2694.       target = reflect_check(target, skill)
  2695.       target.skill_effect(@active_battler, skill)
  2696.       display_action_effects(target, skill)
  2697.     end
  2698.     for target in targets
  2699.       target.perform_collapse unless target.collapse
  2700.       if $imported["SceneBattleReDux"] and @redux_msg and target.actor?
  2701.         @status_window.draw_item(target.index) if target.collapse
  2702.       end
  2703.     end
  2704.     effect_after(skill, skill.ase) if skill.ase > 0
  2705.     common_after(skill)
  2706.     @active_battler.make_fatigue(skill)
  2707.     if @active_battler.fatigue > 0
  2708.       sound = YE::BATTLE::FATIGUE_SND
  2709.       sound.play
  2710.       text = sprintf(YE::BATTLE::FATIGUE_MSG, @active_battler.name)
  2711.       @message_window.add_instant_text(text)
  2712.       wait(60)
  2713.     end
  2714.     @active_battler.reset_charging
  2715.     if $imported["EquipSkillSlots"] and skill.skill_copy?
  2716.       create_skill_copy_window(skill, targets) if @active_battler.actor?
  2717.     else
  2718.       $game_temp.common_event_id = skill.common_event_id
  2719.     end
  2720.     @mix_item_flag = nil
  2721.   end

  2722.   #--------------------------------------------------------------------------
  2723.   # Reflect Check
  2724.   #--------------------------------------------------------------------------
  2725.   def reflect_check(target, skill)
  2726.     @reflected = false
  2727.     @origtarget = target
  2728.     unless skill.unreflectable
  2729.       if target.reflect
  2730.         @reflected = true
  2731.         if target.actor? and @active_battler.actor?
  2732.           target = $game_troop.random_target
  2733.         elsif !target.actor? and !@active_battler.actor?
  2734.           target = $game_party.random_target
  2735.         else
  2736.           target = @active_battler
  2737.         end
  2738.       end
  2739.     end
  2740.     return target
  2741.   end

  2742.   #--------------------------------------------------------------------------
  2743.   # Show Action Results
  2744.   #--------------------------------------------------------------------------
  2745.   def display_action_effects(target, obj = nil)
  2746.     unless target.skipped
  2747.       line_number = @message_window.line_number
  2748.       anti_no_effect = false
  2749.       wait(5)
  2750.       if @reflected
  2751.         sound = YE::BATTLE::REFLECT_SND
  2752.         sound.play
  2753.         text = sprintf(YE::BATTLE::REFLECT_MSG, @origtarget.name, obj.name)
  2754.         unless $imported["SceneBattleReDux"] and !@misc_msg
  2755.           @reflected = false
  2756.           @message_window.add_instant_text(text)
  2757.           msgwait
  2758.           @message_window.back_to(line_number)
  2759.         end
  2760.       end
  2761.       if target.critical
  2762.         display_critical(target, obj)
  2763.         wait(YE::BATTLE::CRITWAIT)
  2764.         @message_window.back_to(line_number)
  2765.       end
  2766.       display_damage(target, obj)
  2767.       if $imported["Steal"] and obj.is_a?(RPG::Skill)
  2768.         if obj.steal?
  2769.           display_stole_object(target, obj)
  2770.         end
  2771.       end
  2772.       if obj.is_a?(RPG::Skill)
  2773.         if obj.dse > 0 and !target.missed and !target.evaded
  2774.           effect_during(target, obj, obj.dse)
  2775.           anti_no_effect = true
  2776.         end
  2777.       end
  2778.       if $imported["EquipSkillSlots"] and obj.is_a?(RPG::Skill)
  2779.         anti_no_effect = true if obj.skill_copy?
  2780.       end
  2781.       common_during(target, obj)
  2782.       if obj.is_a?(RPG::Skill)
  2783.         if target.hit_learn?(obj)
  2784.           target.learn_skill(obj.id)
  2785.           text = sprintf(YE::BATTLE::HIT_LEARN_MESSAGE, target.name, obj.name)
  2786.           @message_window.add_instant_text(text)
  2787.           msgwait
  2788.         end
  2789.       end
  2790.       display_state_changes(target, obj)
  2791.       anti_no_effect = true if target.states_active?
  2792.       if line_number == @message_window.line_number
  2793.         display_failure(target, obj) unless anti_no_effect
  2794.       end
  2795.       if line_number != @message_window.line_number
  2796.         wait(YE::BATTLE::MSGWAIT)
  2797.       end
  2798.       @message_window.back_to(line_number)
  2799.     end
  2800.   end

  2801.   #--------------------------------------------------------------------------
  2802.   # Apply Skill Cost
  2803.   #--------------------------------------------------------------------------
  2804.   def apply_skill_cost(battler, skill)
  2805.     if battler.charge_skill == nil
  2806.       cost = battler.calc_mp_cost(skill)
  2807.       if skill.cost_custom > 0
  2808.         apply_custom_cost(battler, skill)
  2809.       elsif skill.cur_mp_cost > 0
  2810.         battler.mp -= cost
  2811.       elsif skill.max_mp_cost > 0
  2812.         battler.mp -= cost
  2813.       elsif skill.cur_hp_cost > 0
  2814.         battler.hp -= cost
  2815.       elsif skill.max_hp_cost > 0
  2816.         battler.hp -= cost
  2817.       elsif skill.gold_cost > 0
  2818.         return unless battler.actor?
  2819.         cost *= -1
  2820.         $game_party.gain_gold(cost)
  2821.       elsif skill.maxgold_cost > 0
  2822.         return unless battler.actor?
  2823.         cost *= $game_party.gold
  2824.         cost /= 100
  2825.         cost *= -1
  2826.         $game_party.gain_gold(cost)
  2827.       elsif skill.rage_cost > 0
  2828.         battler.rage -= cost
  2829.       else
  2830.         battler.mp -= cost
  2831.       end
  2832.     end
  2833.     if $imported["SceneBattleReDux"] and battler.actor?
  2834.       @status_window.draw_item(battler.index)
  2835.     end
  2836.   end
  2837.   
  2838. end # Scene_Battle

  2839. #===============================================================================
  2840. # Scene_Skill
  2841. #===============================================================================

  2842. class Scene_Skill < Scene_Base
  2843.   
  2844.   #--------------------------------------------------------------------------
  2845.   # use_skill_nontarget
  2846.   #--------------------------------------------------------------------------
  2847.   def use_skill_nontarget
  2848.     Sound.play_use_skill
  2849.     apply_skill_cost(@actor, @skill)
  2850.     @status_window.refresh
  2851.     @skill_window.refresh
  2852.     @target_window.refresh
  2853.     if $game_party.all_dead?
  2854.       $scene = Scene_Gameover.new
  2855.     elsif @skill.common_event_id > 0
  2856.       $game_temp.common_event_id = @skill.common_event_id
  2857.       $scene = Scene_Map.new
  2858.     end
  2859.   end
  2860.   
  2861.   #--------------------------------------------------------------------------
  2862.   # Apply Skill Cost
  2863.   #--------------------------------------------------------------------------
  2864.   def apply_skill_cost(actor, skill)
  2865.     if actor.charge_skill == nil
  2866.       cost = actor.calc_mp_cost(skill)
  2867.       if skill.cost_custom > 0
  2868.         apply_custom_cost(actor, skill)
  2869.       elsif skill.cur_mp_cost > 0
  2870.         actor.mp -= cost
  2871.       elsif skill.max_mp_cost > 0
  2872.         actor.mp -= cost
  2873.       elsif skill.cur_hp_cost > 0
  2874.         actor.hp -= cost
  2875.       elsif skill.max_hp_cost > 0
  2876.         actor.hp -= cost
  2877.       elsif skill.gold_cost > 0
  2878.         cost *= -1
  2879.         $game_party.gain_gold(cost)
  2880.       elsif skill.maxgold_cost > 0
  2881.         cost *= $game_party.gold
  2882.         cost /= 100
  2883.         cost *= -1
  2884.         $game_party.gain_gold(cost)
  2885.       elsif skill.rage_cost > 0
  2886.         actor.rage -= cost
  2887.       else
  2888.         actor.mp -= cost
  2889.       end
  2890.     end
  2891.   end
  2892.   
  2893.   #--------------------------------------------------------------------------
  2894.   # use_skill_nontarget
  2895.   #--------------------------------------------------------------------------
  2896.   def use_skill_nontarget
  2897.     if @skill.subskills != [] and @actor.subskill_flag == nil
  2898.       Sound.play_decision
  2899.       create_subskill_window
  2900.       return
  2901.     end
  2902.     Sound.play_use_skill
  2903.     apply_skill_cost(@actor, @skill)
  2904.     @status_window.refresh
  2905.     @skill_window.refresh
  2906.     @target_window.refresh
  2907.     if $game_party.all_dead?
  2908.       $scene = Scene_Gameover.new
  2909.     elsif @skill.common_event_id > 0
  2910.       $game_temp.common_event_id = @skill.common_event_id
  2911.       $scene = Scene_Map.new
  2912.     end
  2913.   end
  2914.   
  2915.   #--------------------------------------------------------------------------
  2916.   # create subskill window
  2917.   #--------------------------------------------------------------------------
  2918.   def create_subskill_window
  2919.     y = @help_window.height + @status_window.height
  2920.     height = Graphics.height - @help_window.height - @status_window.height
  2921.     if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::MENU_HELP_SHOW
  2922.       height -= 56
  2923.     end
  2924.     skill = @skill
  2925.     @actor.subskill_flag = true
  2926.     @subskill_window = Window_Subskills.new(0, y, 544, height, @actor, skill)
  2927.     @subskill_window.active = true
  2928.     @subskill_window.z = 1
  2929.     @subskill_window.help_window = @help_window
  2930.     @subskill_window.viewport = @viewport
  2931.     @skill_window.active = false
  2932.     @skill_window.visible = false
  2933.   end
  2934.   
  2935.   #--------------------------------------------------------------------------
  2936.   # alias update
  2937.   #--------------------------------------------------------------------------
  2938.   alias update_skill_submenu_cse update unless $@
  2939.   def update
  2940.     if @subskill_window != nil and @subskill_window.active
  2941.       update_subskill_window
  2942.     else
  2943.       update_skill_submenu_cse
  2944.     end
  2945.   end
  2946.   
  2947.   #--------------------------------------------------------------------------
  2948.   # update_subskill_window
  2949.   #--------------------------------------------------------------------------
  2950.   def update_subskill_window
  2951.     @subskill_window.update
  2952.     @help_window.update
  2953.     if Input.trigger?(Input::B)
  2954.       Sound.play_cancel
  2955.       @actor.subskill_flag = nil
  2956.       @skill_window.active = true
  2957.       @skill_window.visible = true
  2958.       @subskill_window.dispose
  2959.       @subskill_window = nil
  2960.     elsif Input.trigger?(Input::R)
  2961.       Sound.play_cursor
  2962.       next_actor
  2963.     elsif Input.trigger?(Input::L)
  2964.       Sound.play_cursor
  2965.       prev_actor
  2966.     elsif Input.trigger?(Input::C)
  2967.       @skill = @subskill_window.skill
  2968.       if @actor.skill_can_use?(@skill)
  2969.         Sound.play_decision
  2970.         @subskill_window.active = false
  2971.         determine_skill
  2972.         @actor.subskill_flag = nil
  2973.       else
  2974.         Sound.play_buzzer
  2975.       end
  2976.     elsif $imported["DisplaySkillQuery"] and
  2977.     Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_MENU_BUTTON)
  2978.       skill = @subskill_window.skill
  2979.       if skill != nil
  2980.         Sound.play_decision
  2981.         @skill_data_window.appear(skill, @subskill_window, @actor)
  2982.         @subskill_window.active = false
  2983.       else
  2984.         Sound.play_buzzer
  2985.       end
  2986.     end
  2987.   end
  2988.   
  2989.   #--------------------------------------------------------------------------
  2990.   # alias hide_target_window
  2991.   #--------------------------------------------------------------------------
  2992.   alias hide_target_window_cse hide_target_window unless $@
  2993.   def hide_target_window
  2994.     hide_target_window_cse
  2995.     if @subskill_window != nil
  2996.       @subskill_window.active = true
  2997.     end
  2998.   end
  2999.   
  3000. end

  3001. #===============================================================================
  3002. # Window_Base
  3003. #===============================================================================

  3004. class Window_Selectable < Window_Base
  3005.   
  3006.   #--------------------------------------------------------------------------
  3007.   # Draw Skill
  3008.   #--------------------------------------------------------------------------
  3009.   def draw_skill(index)
  3010.     rect = item_rect(index)
  3011.     self.contents.clear_rect(rect)
  3012.     skill = @data[index]
  3013.     if skill != nil
  3014.       skill_id = @data[index].id
  3015.       actor_id = @actor.id
  3016.       recharge = $game_actors[actor_id].recharge(skill_id)
  3017.       #---
  3018.       usage = $game_actors[actor_id].usage(skill_id)
  3019.       if skill.usage > 0 and YE::BATTLE::REPLACE_ICON_USAGE
  3020.         if usage >= skill.usage
  3021.           usagecheck = true
  3022.         else
  3023.           usagecheck = false
  3024.         end
  3025.       end
  3026.       #---
  3027.       rect.width -= 4
  3028.       x = rect.x
  3029.       y = rect.y
  3030.       enabled = @actor.skill_can_use?(skill)
  3031.       #---
  3032.       draw_icon(skill.icon_index, x, y, enabled)
  3033.       self.contents.font.color = normal_color
  3034.       self.contents.font.color.alpha = enabled ? 255 : 128
  3035.       self.contents.draw_text(x + 24, y, rect.width-84, WLH, skill.name, 0)
  3036.       #---
  3037.       cost = @actor.calc_mp_cost(skill)
  3038.       if YE::BATTLE::USE_ICONS
  3039.         #--- Use icons
  3040.         rect.width -= 24
  3041.         x = rect.x + rect.width
  3042.         y = rect.y
  3043.         #---
  3044.         if usagecheck
  3045.           self.contents.draw_text(rect, "", 2)
  3046.         elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
  3047.           self.contents.draw_text(x-30, y, 30, WLH, recharge, 2)
  3048.         elsif cost == 0
  3049.           self.contents.draw_text(rect, "", 2)
  3050.         elsif skill.maxgold_cost > 0
  3051.           self.contents.draw_text(x-30, y, 30, WLH, sprintf("%d%%",cost), 2)
  3052.         else
  3053.           self.contents.draw_text(x-30, y, 30, WLH, cost, 2)
  3054.         end
  3055.         #---
  3056.         if usagecheck
  3057.           icon = YE::BATTLE::USAGE_ICON
  3058.         elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
  3059.           icon = YE::BATTLE::RECHARGE_ICON
  3060.         elsif skill.cost_custom > 0
  3061.           icon = @actor.create_cost_icon(skill)
  3062.         elsif cost == 0
  3063.           icon = 0
  3064.         else
  3065.           icon = @actor.create_cost_icon(skill)
  3066.         end
  3067.         draw_icon(icon, x, y, enabled)
  3068.         #---
  3069.       else
  3070.         #--- Don't use icons
  3071.         if usagecheck
  3072.         text = sprintf(YE::BATTLE::USAGE_MSG, recharge)
  3073.         elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
  3074.           if recharge == 1
  3075.             text = sprintf(YE::BATTLE::RECHARGE_MSG1, recharge)
  3076.           else
  3077.             text = sprintf(YE::BATTLE::RECHARGE_MSG, recharge)
  3078.           end
  3079.         elsif skill.cost_custom > 0
  3080.           text = @actor.cost_custom(skill, 1)
  3081.         elsif cost == 0
  3082.           text = ""
  3083.         elsif skill.cur_mp_cost > 0
  3084.           text = sprintf(YE::BATTLE::MP_COST, cost)
  3085.         elsif skill.max_mp_cost > 0
  3086.           text = sprintf(YE::BATTLE::MP_COST, cost)
  3087.         elsif skill.cur_hp_cost > 0
  3088.           text = sprintf(YE::BATTLE::HP_COST, cost)
  3089.         elsif skill.max_hp_cost > 0
  3090.           text = sprintf(YE::BATTLE::HP_COST, cost)
  3091.         elsif skill.gold_cost > 0
  3092.           text = sprintf(YE::BATTLE::GOLD_COST, cost)
  3093.         elsif skill.maxgold_cost > 0
  3094.           text = sprintf(YE::BATTLE::MGOLD_COST, cost)
  3095.         elsif skill.rage_cost > 0
  3096.           text = sprintf(YE::BATTLE::RAGE_COST, cost)
  3097.         else
  3098.           text = sprintf(YE::BATTLE::MP_COST, cost)
  3099.         end
  3100.         x = rect.x + rect.width - 54
  3101.         self.contents.draw_text(x, y, 54, WLH, text, 2)
  3102.         #---
  3103.       end
  3104.       
  3105.     end
  3106.   end
  3107.   
  3108. end

  3109. #===============================================================================
  3110. # Window_Skill
  3111. #===============================================================================

  3112. class Window_Skill < Window_Selectable

  3113.   #--------------------------------------------------------------------------
  3114.   # Draw Item
  3115.   #--------------------------------------------------------------------------
  3116.   def draw_item(index)
  3117.     draw_skill(index)
  3118.   end
  3119.   
  3120. end # class Window_Skill < Window_Selectable

  3121. #==============================================================================
  3122. # Window_Mix_Item
  3123. #==============================================================================

  3124. class Window_Mix_Item < Window_Selectable
  3125.   #--------------------------------------------------------------------------
  3126.   # initialize
  3127.   #--------------------------------------------------------------------------
  3128.   def initialize(x, y, width, height, actor, skill)
  3129.     super(x, y, width, height)
  3130.     @column_max = 2
  3131.     @actor = actor
  3132.     @skill = skill
  3133.     self.index = 0
  3134.     refresh
  3135.   end
  3136.   
  3137.   #--------------------------------------------------------------------------
  3138.   # item
  3139.   #--------------------------------------------------------------------------
  3140.   def item
  3141.     return @data[self.index]
  3142.   end
  3143.   
  3144.   #--------------------------------------------------------------------------
  3145.   # refresh
  3146.   #--------------------------------------------------------------------------
  3147.   def refresh
  3148.     @data = []
  3149.     for item in $game_party.items
  3150.       @data.push(item) if include?(item)
  3151.     end
  3152.     @item_max = @data.size
  3153.     create_contents
  3154.     for i in 0...@item_max
  3155.       draw_item(i)
  3156.     end
  3157.   end
  3158.   
  3159.   #--------------------------------------------------------------------------
  3160.   # include?
  3161.   #--------------------------------------------------------------------------
  3162.   def include?(item)
  3163.     return false unless item.is_a?(RPG::Item)
  3164.     return false if item.dont_mix
  3165.     return true if @skill.mix_items_all
  3166.     for type in @skill.mix_types
  3167.       return true if item.mix_types.include?(type)
  3168.     end
  3169.     return false
  3170.   end
  3171.   
  3172.   #--------------------------------------------------------------------------
  3173.   # draw_item
  3174.   #--------------------------------------------------------------------------
  3175.   def draw_item(index)
  3176.     self.contents.font.color = normal_color
  3177.     rect = item_rect(index)
  3178.     self.contents.clear_rect(rect)
  3179.     item = @data[index]
  3180.     if item != nil
  3181.       number = $game_party.item_number(item)
  3182.       rect.width -= 4
  3183.       draw_item_name(item, rect.x, rect.y, true)
  3184.       self.contents.draw_text(rect, sprintf("亊%2d", number), 2)
  3185.     end
  3186.   end
  3187.   
  3188.   #--------------------------------------------------------------------------
  3189.   # draw item name
  3190.   #--------------------------------------------------------------------------
  3191.   def draw_item_name(item, x, y, enabled = true)
  3192.     if item != nil
  3193.       draw_icon(item.icon_index, x, y, enabled)
  3194.       if item.id == @actor.mix_item_1 and item.id == @actor.mix_item_2
  3195.         self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR3)
  3196.       elsif item.id == @actor.mix_item_1
  3197.         self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR1)
  3198.       elsif item.id == @actor.mix_item_2
  3199.         self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR2)
  3200.       else
  3201.         self.contents.font.color = normal_color
  3202.       end
  3203.       self.contents.font.color.alpha = enabled ? 255 : 128
  3204.       self.contents.draw_text(x + 24, y, 172, WLH, item.name)
  3205.     end
  3206.   end
  3207.   
  3208.   #--------------------------------------------------------------------------
  3209.   # update help
  3210.   #--------------------------------------------------------------------------
  3211.   def update_help
  3212.     @help_window.set_text(item == nil ? "" : item.description)
  3213.   end
  3214.   
  3215. end

  3216. #===============================================================================
  3217. # Window Subskills
  3218. #===============================================================================

  3219. class Window_Subskills < Window_Selectable
  3220.   
  3221.   #--------------------------------------------------------------------------
  3222.   # initialize
  3223.   #--------------------------------------------------------------------------
  3224.   def initialize(x, y, width, height, actor, sk)
  3225.     super(x, y, width, height)
  3226.     @superskill = sk
  3227.     @actor = actor
  3228.     @column_max = 2
  3229.     self.index = 0
  3230.     refresh
  3231.   end
  3232.   
  3233.   #--------------------------------------------------------------------------
  3234.   # refresh
  3235.   #--------------------------------------------------------------------------
  3236.   def refresh
  3237.     @data = []
  3238.     for skill_id in @superskill.subskills
  3239.       sk = $data_skills[skill_id]
  3240.       next if sk == nil
  3241.       @data.push(sk) if include?(sk)
  3242.     end
  3243.     @item_max = @data.size
  3244.     create_contents
  3245.     for i in 0...@item_max
  3246.       draw_skill(i)
  3247.     end
  3248.   end
  3249.   
  3250.   #--------------------------------------------------------------------------
  3251.   # skill
  3252.   #--------------------------------------------------------------------------
  3253.   def skill
  3254.     return @data[self.index]
  3255.   end
  3256.   
  3257.   #--------------------------------------------------------------------------
  3258.   # include?
  3259.   #--------------------------------------------------------------------------
  3260.   def include?(sk)
  3261.     return false if sk == nil
  3262.     return false if sk.require_level > @actor.level
  3263.     return false if sk.require_learn and [email protected]_learn?(sk)
  3264.     return false if sk.mix_items
  3265.     return false if sk.subskills != []
  3266.     return false if sk.chain_type > 0
  3267.     return true
  3268.   end
  3269.   
  3270.   #--------------------------------------------------------------------------
  3271.   # update_help
  3272.   #--------------------------------------------------------------------------
  3273.   def update_help
  3274.     @help_window.set_text(skill == nil ? "" : skill.description)
  3275.   end
  3276.   
  3277. end # Window_Subskills

  3278. #===============================================================================
  3279. # Window Chain Skill
  3280. #===============================================================================

  3281. class Window_Chain_Skill < Window_Selectable
  3282.   
  3283.   #--------------------------------------------------------------------------
  3284.   # initialize
  3285.   #--------------------------------------------------------------------------
  3286.   def initialize(x, y, width, height, actor, sk)
  3287.     super(x, y, width, height)
  3288.     @skill = sk
  3289.     @actor = actor
  3290.     @column_max = 1
  3291.     self.index = 0
  3292.     refresh
  3293.   end
  3294.   
  3295.   #--------------------------------------------------------------------------
  3296.   # refresh
  3297.   #--------------------------------------------------------------------------
  3298.   def refresh(chain_array = [])
  3299.     @data = []
  3300.     @chain_array = chain_array
  3301.     array = []
  3302.     #----------------------------
  3303.     if @skill.chain_type == 1
  3304.       for skill in @actor.skills
  3305.         array.push(skill.id)
  3306.       end
  3307.     end
  3308.     #----------------------------
  3309.     if @skill.chain_type == 2
  3310.       allowed_types = @skill.chain_array
  3311.       for sk in @actor.skills
  3312.         for type in sk.closed_type
  3313.           array.push(sk.id) if allowed_types.include?(type)
  3314.         end
  3315.       end
  3316.     end
  3317.     #----------------------------
  3318.     if @skill.chain_type == 3
  3319.       for skill_id in @skill.chain_array
  3320.         array.push(skill_id)
  3321.       end
  3322.     end
  3323.     #----------------------------
  3324.     for skill_id in array
  3325.       sk = $data_skills[skill_id]
  3326.       next if sk == nil
  3327.       @data.push(sk) if include?(sk)
  3328.     end
  3329.     @item_max = @data.size
  3330.     create_contents
  3331.     for i in 0...@item_max
  3332.       draw_skill(i)
  3333.     end
  3334.   end
  3335.   
  3336.   #--------------------------------------------------------------------------
  3337.   # skill
  3338.   #--------------------------------------------------------------------------
  3339.   def skill
  3340.     return @data[self.index]
  3341.   end
  3342.   
  3343.   #--------------------------------------------------------------------------
  3344.   # include?
  3345.   #--------------------------------------------------------------------------
  3346.   def include?(sk)
  3347.     return false if sk == nil
  3348.     return false if sk.mix_items
  3349.     return false if sk.require_level > @actor.level
  3350.     return false if sk.require_learn and [email protected]_learn?(sk)
  3351.     return false if sk.subskills != []
  3352.     return false if sk.chain_type > 0
  3353.     return true
  3354.   end
  3355.   
  3356.   #--------------------------------------------------------------------------
  3357.   # Draw Skill
  3358.   #--------------------------------------------------------------------------
  3359.   def draw_skill(index)
  3360.     rect = item_rect(index)
  3361.     self.contents.clear_rect(rect)
  3362.     skill = @data[index]
  3363.     if skill != nil
  3364.       skill_id = @data[index].id
  3365.       actor_id = @actor.id
  3366.       recharge = $game_actors[actor_id].recharge(skill_id)
  3367.       #---
  3368.       usage = $game_actors[actor_id].usage(skill_id)
  3369.       if skill.usage > 0 and YE::BATTLE::REPLACE_ICON_USAGE
  3370.         if usage >= skill.usage
  3371.           usagecheck = true
  3372.         else
  3373.           usagecheck = false
  3374.         end
  3375.       end
  3376.       #---
  3377.       rect.width -= 4
  3378.       x = rect.x
  3379.       y = rect.y
  3380.       enabled = skill_can_use?(skill)
  3381.       #---
  3382.       draw_icon(skill.icon_index, x, y, enabled)
  3383.       self.contents.font.color = normal_color
  3384.       self.contents.font.color.alpha = enabled ? 255 : 128
  3385.       self.contents.draw_text(x + 24, y, rect.width-84, WLH, skill.name, 0)
  3386.       #---
  3387.       cost = @actor.calc_mp_cost(skill)
  3388.       rect.width -= 24
  3389.       x = rect.x + rect.width
  3390.       y = rect.y
  3391.       #---
  3392.       if usagecheck
  3393.         self.contents.draw_text(rect, "", 2)
  3394.       elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
  3395.         self.contents.draw_text(x-30, y, 30, WLH, recharge, 2)
  3396.       elsif cost == 0
  3397.         self.contents.draw_text(rect, "", 2)
  3398.       elsif skill.maxgold_cost > 0
  3399.         self.contents.draw_text(x-30, y, 30, WLH, sprintf("%d%%",cost), 2)
  3400.       else
  3401.         self.contents.draw_text(x-30, y, 30, WLH, cost, 2)
  3402.       end
  3403.       #---
  3404.       if usagecheck
  3405.         icon = YE::BATTLE::USAGE_ICON
  3406.       elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
  3407.         icon = YE::BATTLE::RECHARGE_ICON
  3408.       elsif skill.cost_custom > 0
  3409.         icon = @actor.create_cost_icon(skill)
  3410.       elsif cost == 0
  3411.         icon = 0
  3412.       else
  3413.         icon = @actor.create_cost_icon(skill)
  3414.       end
  3415.       draw_icon(icon, x, y, enabled)
  3416.     end
  3417.   end
  3418.   
  3419.   #--------------------------------------------------------------------------
  3420.   # skill_can_use?
  3421.   #--------------------------------------------------------------------------
  3422.   def skill_can_use?(sk)
  3423.     return false if @chain_array.include?(sk.id) and [email protected]_chain
  3424.     return true
  3425.   end
  3426.   
  3427.   #--------------------------------------------------------------------------
  3428.   # update_help
  3429.   #--------------------------------------------------------------------------
  3430.   def update_help
  3431.     @help_window.set_text(skill == nil ? "" : skill.description)
  3432.   end
  3433.   
  3434. end # Window_Chain_Skill

  3435. #==============================================================================
  3436. # Window_Chain_Info
  3437. #==============================================================================

  3438. class Window_Chain_Info < Window_Base
  3439.   
  3440.   #--------------------------------------------------------------------------
  3441.   # initialize
  3442.   #--------------------------------------------------------------------------
  3443.   def initialize(x, y, width, height, actor, sk)
  3444.     super(x, y, width, height)
  3445.     @actor = actor
  3446.     @skill = sk
  3447.     refresh
  3448.   end
  3449.   
  3450.   #--------------------------------------------------------------------------
  3451.   # refresh
  3452.   #--------------------------------------------------------------------------
  3453.   def refresh(array = [])
  3454.     self.contents.clear
  3455.     self.contents.font.color = normal_color
  3456.     @array = array
  3457.     draw_icon(@skill.icon_index, 0, 0)
  3458.     self.contents.draw_text(24, 0, 166, WLH, @skill.name, 0)
  3459.     text = sprintf(YE::BATTLE::CHAIN_MAX_TEXT, @array.size, @skill.chain_times)
  3460.     self.contents.draw_text(190, 0, 50, WLH, text, 2)
  3461.     draw_costs
  3462.     dx = 0
  3463.     dy = WLH * 2
  3464.     for skill_id in @array
  3465.       skill = $data_skills[skill_id]
  3466.       draw_item_name(skill, dx, dy)
  3467.       cost = @actor.calc_mp_cost(skill)
  3468.       icon = @actor.create_cost_icon(skill)
  3469.       draw_icon(icon, 216, dy)
  3470.       self.contents.draw_text(186, dy, 30, WLH, cost, 2)
  3471.       dy += WLH
  3472.       break if dy + WLH > self.height - 32
  3473.     end
  3474.   end
  3475.   
  3476.   #--------------------------------------------------------------------------
  3477.   # draw costs
  3478.   #--------------------------------------------------------------------------
  3479.   def draw_costs
  3480.     icon = YE::BATTLE::MP_ICON
  3481.     draw_icon(icon, 44, 24)
  3482.     icon = YE::BATTLE::HP_ICON
  3483.     draw_icon(icon, 124, 24)
  3484.     icon = YE::BATTLE::RAGE_ICON
  3485.     draw_icon(icon, 204, 24)
  3486.     mpcost = 0; hpcost = 0; ragecost = 0
  3487.     for skill_id in @array
  3488.       sk = $data_skills[skill_id]
  3489.       next if sk == nil
  3490.       if sk.cur_mp_cost > 0
  3491.         mpcost += @actor.calc_mp_cost(sk)
  3492.       elsif sk.max_mp_cost > 0
  3493.         mpcost += @actor.calc_mp_cost(sk)
  3494.       elsif sk.cur_hp_cost > 0
  3495.         hpcost += @actor.calc_mp_cost(sk)
  3496.       elsif sk.max_hp_cost > 0
  3497.         hpcost += @actor.calc_mp_cost(sk)
  3498.       elsif sk.rage_cost > 0
  3499.         hpcost += @actor.calc_mp_cost(sk)
  3500.       else
  3501.         mpcost += @actor.calc_mp_cost(sk)
  3502.       end
  3503.     end
  3504.     self.contents.draw_text(12, 24, 32, WLH, mpcost, 2)
  3505.     self.contents.draw_text(92, 24, 32, WLH, hpcost, 2)
  3506.     self.contents.draw_text(172, 24, 32, WLH, ragecost, 2)
  3507.   end
  3508.   
  3509. end # Window_Chain_Info

  3510. #===============================================================================
  3511. #
  3512. # 脚本结束
  3513. #
  3514. #===============================================================================
复制代码

作者: 54酱    时间: 2012-6-27 19:37
http://rpg.blue/forum.php?mod=viewthread&tid=187384
纯连接不解释=,=
作者: w3860000    时间: 2012-6-27 23:22
本帖最后由 w3860000 于 2012-6-27 23:23 编辑
54酱 发表于 2012-6-27 19:37
http://rpg.blue/forum.php?mod=viewthread&tid=187384
纯连接不解释=,=


不解释实在是会把自己变成伸手党,我用这语法
$game_actors[編號].cooling = Hash.new

如果这是你所想要给的给的答案的话我会很高兴,如果是完全不一样的,我想我会哭哭...
因为不知道什么时候会爆炸

作者: 这算小号吗    时间: 2012-7-23 13:46
这脚本好!横版能用就好!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1