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

Project1

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

[已经解决] 想製作一個消耗%數MP的技能

[复制链接]

Lv2.观梦者

梦石
0
星屑
312
在线时间
67 小时
注册时间
2014-4-17
帖子
20
跳转到指定楼层
1
发表于 2016-8-21 13:38:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
想製作一個技能,消耗MP是當前魔力的%數,

例如:

現在魔力最大值是1000,技能消耗30%MP,即300MP,

當魔力值低於300則無法使用。

但是在系統介面只能填入固定數字,並沒有辦法填入%...

想請問該如何解決呢?

Lv4.逐梦者 (版主)

漾夕☽星化残月☾

梦石
0
星屑
8596
在线时间
3857 小时
注册时间
2015-5-12
帖子
2077

剧作品鉴家

2
发表于 2016-8-21 16:05:17 | 只看该作者
  1. #==============================================================================
  2. # ■ BMSP HP消費スキル[CONSUMEHPSKILL] Ver1.00 2013/03/25
  3. #------------------------------------------------------------------------------
  4. #  HPを消費して使用するスキルを作成します.
  5. #==============================================================================
  6. #------------------------------------------------------------------------------
  7. # ■内容
  8. # HPを消費して使用するスキルを作成します.また,MP,TPを割合で消費するスキル
  9. # も作成可能になります。
  10. # さらに消費量を変数で指定することもできます.
  11. #
  12. # 位置:他のスクリプトより上
  13. #
  14. # ■必須
  15. # 「BMSP ウインドウ内容自動切り替えver1.00以上」が必須です.
  16. #
  17. # ■使用方法
  18. # スクリプトに丸ごと貼り付けていただければ使用できます.
  19. #
  20. # 各種消費スキルを作るにはスキルのメモ欄に以下を記述します.
  21. # ○HP消費スキル
  22. #   ==HP消費xxx==:HPをxxx消費
  23. #   ==HP消費xxx%==:現在のHPのxxx%を消費
  24. #   ==MAXHP消費xxx%==:最大HPのxxx%を消費
  25. # ○MP消費スキル
  26. #   ==MP消費xxx==:MPをxxx消費
  27. #   ==MP消費xxx%==:現在のMPのxxx%を消費
  28. #   ==MAXMP消費xxx%==:最大MPのxxx%を消費
  29. # ○TP消費スキル
  30. #   ==TP消費xxx==:TPをxxx消費
  31. #   ==TP消費xxx%==:現在のTPのxxx%を消費
  32. #   ==MAXTP消費xxx%==:最大TPのxxx%を消費
  33. #
  34. # また,xxxには数字もしくは頭にVを付けた数字を記述します.
  35. # 頭にVを付けると変数を参照します.
  36. # 例・HPを変数001の値だけ消費するスキル
  37. #  ==HP消費V1==
  38. #
  39. # さらにそれぞれいくつでも組み合わせることが可能です.
  40. # 例・HPを10%,MPを20消費するスキル
  41. #   ==HP消費10%==
  42. #   ==MP消費20==
  43. #
  44. # 詳細設定の欄では以下の項目を設定できます.
  45. # ○KNOCKOUT:trueでHP消費スキルの時,スキル使用によってHPが0
  46. #             になって戦闘不能になるのを許可します.
  47. # ○OVERHP:trueで現在HPより消費の大きいHPスキルの使用を許可します.
  48. #           その時戦闘不能になるかHPが1残るかはKNOCKOUTの設定によります.
  49. # ○HPCOLOR:HPコストを描画するときの文字色です.
  50. # ○ACTOR_KNOCKOUT_MESSAGE:アクターがHP消費スキルを使用して
  51. #                           戦闘不能になった時に表示されるメッセージです.
  52. # ○ENEMY_KNOCKOUT_MESSAGE:エネミーがHP消費スキルを使用して
  53. #                           戦闘不能になった時に表示されるメッセージです.
  54. # 消費パラメータが2つ以上の場合,「BMSP ウインドウ内容自動切り替え」を用いて
  55. # 消費コストが自動で切り替わって表示されるようになります.
  56. # 詳細は「BMSP ウインドウ内容自動切り替え」をご覧下さい.
  57. # ○WAIT:切り替えまでのウェイトです
  58. # ○UPDATE_TYPE:切り替え方法です
  59. # ○UPDATE_TIME:フェード切り替え時のフェード時間です
  60. # ○UPDATE_SPEED:スライド切り替え時のスライドスピードです
  61. #
  62. # □補足
  63. # 互換性のため,データベースのスキル欄で直接設定できる消費MP,消費TP欄の値も
  64. # スキルのコストとして合算されます.
  65. #
  66. # ■注意
  67. # このスクリプトでは
  68. # 「RPG::Skill」「Game_BattlerBase」「Window_Base」「Window_SkillList」
  69. # 「Scene_Battle」「Window_BattleLog」
  70. # のメソッドを改変しています.
  71. # ■情報
  72. # このスクリプトはgentlawkによって作られたものです.
  73. # 利用規約はhttp://blueredzone.comをご覧ください.
  74. #------------------------------------------------------------------------------
  75. module BMSP
  76.   @@includes ||= {}
  77.   @@includes[:ConsumeHPSkill] = 1.00
  78.   module ConsumeHPSkill
  79.     #▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
  80.     #詳細設定
  81.     KNOCKOUT = true # 戦闘不能を許可するか
  82.     OVERHP = true   # 現在HPを超える消費HPのスキルを許可するか
  83.     HPCOLOR = 21    # HPを消費するスキルのコスト描画色です.
  84.     # 消費パラメータが2つ以上の時の切り替えアニメーションの挙動です
  85.     WAIT = 60 # 切り替えまでのウェイトです
  86.     UPDATE_TYPE = :fade # 切り替え方法です
  87.     UPDATE_TIME = 20 # フェードの時間です
  88.     UPDATE_SPEED = 2 # スライドのスピードです
  89.     # HP消費で戦闘不能になったときの表示メッセージ
  90.     ACTOR_KNOCKOUT_MESSAGE = "%s倒下了!" # アクター
  91.     ENEMY_KNOCKOUT_MESSAGE = "%s倒下了!" # エネミー
  92.     #▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
  93.     REGEXP_VAL = /(V|[-+]?)(\d+)/o
  94.     REGEXP_BODY = /==(MAX)?(HP|MP|TP)?消費#{REGEXP_VAL}(%)?==/o
  95.     #--------------------------------------------------------------------------
  96.     # ● 正規表現とのマッチ
  97.     #--------------------------------------------------------------------------
  98.     def self.match(str)
  99.       set = {:HP=>{:abs=>[],:per=>[],:maxper=>[]},
  100.              :MP=>{:abs=>[],:per=>[],:maxper=>[]},
  101.              :TP=>{:abs=>[],:per=>[],:maxper=>[]}}
  102.       str.scan(REGEXP_BODY) do |max,param,var,val,per|
  103.         max = !max.nil?
  104.         param = param.to_sym
  105.         per = !per.nil?
  106.         costseed = var == "V" ? [val.to_i, true] : [(var.to_s + val).to_i, false]
  107.         case [max, per]
  108.         when [true, true] # 最大割合消費
  109.           set[param][:maxper].push costseed
  110.         when [false, true] # 割合消費
  111.           set[param][:per].push costseed
  112.         when [false, false] # 固定値消費
  113.           set[param][:abs].push costseed
  114.         else
  115.           next
  116.         end
  117.       end
  118.       set
  119.     end
  120.     #--------------------------------------------------------------------------
  121.     # ● コストインジェクター
  122.     #--------------------------------------------------------------------------
  123.     def self.cost_injector(costset)
  124.       injected_set = {}
  125.       costset.each do |type, costseeds|
  126.         injected_set[type] = costseeds.map{|val, var|
  127.           var ? $game_variables[val] : val
  128.         }.inject(0,:+)
  129.       end
  130.       injected_set
  131.     end
  132.     #--------------------------------------------------------------------------
  133.     # ● バグの例外クラス
  134.     #--------------------------------------------------------------------------
  135.     class BUG < StandardError
  136.     end
  137.     #--------------------------------------------------------------------------
  138.     # ● 導入スクリプトの例外クラス
  139.     #--------------------------------------------------------------------------
  140.     class REQUIRE < StandardError
  141.     end
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 必須スクリプトのチェック
  145.   #--------------------------------------------------------------------------
  146.   class << self
  147.     if method_defined?(:check_require)
  148.       alias consumehpskill_check_require check_require
  149.     end
  150.   end
  151.   def self.check_require(require, version)
  152.     if methods.include?(:consumehpskill_check_require)
  153.       consumehpskill_check_require(require, version)
  154.     end
  155.     if !@@includes[require]
  156.       message =
  157.         sprintf("BMSPスクリプト%sが導入されていません.\n%s Ver%1.2f以上を導入してください.",
  158.           require,require,version)
  159.       raise ConsumeHPSkill::REQUIRE, message
  160.     elsif @@includes[require] < version
  161.       message =
  162.         sprintf("BMSPスクリプト%s Ver%1.2fは古いバージョンです.\n%s Ver%1.2f以上を導入してください.",
  163.           require,@@includes[require],require,version)
  164.       raise ConsumeHPSkill::REQUIRE, message
  165.     end
  166.     return true
  167.   end
  168. end
  169. #==============================================================================
  170. # ■ RPG::Skill
  171. #==============================================================================
  172. class RPG::Skill < RPG::UsableItem
  173.   #--------------------------------------------------------------------------
  174.   # ● コストの初期化
  175.   #--------------------------------------------------------------------------
  176.   def init_cost
  177.     @bmsp_consumehpskill_costset = BMSP::ConsumeHPSkill.match(self.note)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● [デバッグ]スキルコストプリンター
  181.   #--------------------------------------------------------------------------
  182.   def format_costseed(param, type, costseed)
  183.     max = type == :maxper ? "MAX" : ""
  184.     var = costseed[1] ? "V" : ""
  185.     per = type != :abs ? "%" : ""
  186.     "#{max}#{param}消費#{var}#{costseed[0]}#{per}"
  187.   end
  188.   def print_cost
  189.     init_cost if @bmsp_consumehpskill_costset.nil?
  190.     @bmsp_consumehpskill_costset.each do |param, costtypes|
  191.       costtypes.each do |type, costseeds|
  192.         costseeds.each do |costseed|
  193.           p format_costseed(param, type, costseed)
  194.         end
  195.       end
  196.     end
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● HPコストセットの取得
  200.   #--------------------------------------------------------------------------
  201.   def bmsp_consumehpskill_hp_costset
  202.     init_cost if @bmsp_consumehpskill_costset.nil?
  203.     BMSP::ConsumeHPSkill.cost_injector(@bmsp_consumehpskill_costset[:HP])
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● MPコストセットの取得
  207.   #--------------------------------------------------------------------------
  208.   def bmsp_consumehpskill_mp_costset
  209.     init_cost if @bmsp_consumehpskill_costset.nil?
  210.     costset = @bmsp_consumehpskill_costset[:MP].dup
  211.     costset[:abs] = costset[:abs].dup
  212.     costset[:abs].push [mp_cost, false]
  213.     BMSP::ConsumeHPSkill.cost_injector(costset)
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● TPコストセットの取得
  217.   #--------------------------------------------------------------------------
  218.   def bmsp_consumehpskill_tp_costset
  219.     init_cost if @bmsp_consumehpskill_costset.nil?
  220.     costset = @bmsp_consumehpskill_costset[:TP].dup
  221.     costset[:abs] = costset[:abs].dup
  222.     costset[:abs].push [tp_cost, false]
  223.     BMSP::ConsumeHPSkill.cost_injector(costset)
  224.   end
  225. end
  226. #==============================================================================
  227. # ■ Game_BattlerBase
  228. #==============================================================================
  229. class Game_BattlerBase
  230.   #--------------------------------------------------------------------------
  231.   # ● スキルの消費 HP 計算
  232.   #--------------------------------------------------------------------------
  233.   def skill_hp_cost(skill)
  234.     costset = skill.bmsp_consumehpskill_hp_costset
  235.     abscost = costset[:abs]
  236.     percost = costset[:per] * self.hp / 100
  237.     maxpercost = costset[:maxper] * self.mhp / 100
  238.     abscost + percost + maxpercost
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● スキルの消費 MP 計算(再定義)
  242.   #--------------------------------------------------------------------------
  243.   def skill_mp_cost(skill)
  244.     costset = skill.bmsp_consumehpskill_mp_costset
  245.     abscost = costset[:abs]
  246.     percost = costset[:per] * self.mp / 100
  247.     maxpercost = costset[:maxper] * self.mmp / 100
  248.     ((abscost + percost + maxpercost) * mcr).to_i
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● スキルの消費 TP 計算(再定義)
  252.   #--------------------------------------------------------------------------
  253.   def skill_tp_cost(skill)
  254.     costset = skill.bmsp_consumehpskill_tp_costset
  255.     abscost = costset[:abs]
  256.     percost = costset[:per] * self.tp / 100
  257.     maxtp = self.methods.include?("mtp") ? self.mtp : 100
  258.     maxpercost = costset[:maxper] * maxtp / 100
  259.     abscost + percost + maxpercost
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● スキル使用コストの支払い可能判定
  263.   #--------------------------------------------------------------------------
  264.   alias bmsp_consuemhpskill_skill_const_payable? skill_cost_payable?
  265.   def skill_cost_payable?(skill)
  266.     bmsp_consuemhpskill_skill_const_payable?(skill) &&
  267.     (BMSP::ConsumeHPSkill::OVERHP || self.hp >= skill_hp_cost(skill))
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● スキル使用コストの支払い
  271.   #--------------------------------------------------------------------------
  272.   alias bmsp_consumehpskill_pay_skill_cost pay_skill_cost
  273.   def pay_skill_cost(skill)
  274.     bmsp_consumehpskill_pay_skill_cost(skill)
  275.     hpcost= skill_hp_cost(skill)
  276.     unless BMSP::ConsumeHPSkill::KNOCKOUT
  277.       hpcost = self.hp - 1 if hpcost >= self.hp
  278.     end
  279.     self.hp -= hpcost
  280.   end
  281. end
  282. #==============================================================================
  283. # ■ Window_Base
  284. #==============================================================================
  285. class Window_Base < Window
  286.   #--------------------------------------------------------------------------
  287.   # ● 各種文字色の取得
  288.   #--------------------------------------------------------------------------
  289.   def hp_cost_color;     text_color(21);  end;    # 消費 HP
  290. end
  291. #==============================================================================
  292. # ■ Window_SkillList
  293. #==============================================================================
  294. class Window_SkillList < Window_Selectable
  295.   #--------------------------------------------------------------------------
  296.   # ● リフレッシュ
  297.   #--------------------------------------------------------------------------
  298.   alias bmsp_consumehpskill_refresh refresh
  299.   def refresh
  300.     BMSP.check_require(:ContentsAutoUpdate, 1.00)
  301.     @auto_updator.unregister_all
  302.     bmsp_consumehpskill_refresh
  303.     @auto_updator.update
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● スキルの使用コストを描画(再定義)
  307.   #--------------------------------------------------------------------------
  308.   def draw_skill_cost(rect, skill)
  309.     rect.x += rect.width - 12 * 4
  310.     rect.width = 12 * 4
  311.     area = @auto_updator.register(rect.x, rect.y, rect.width, rect.height)
  312.     area.wait = BMSP::ConsumeHPSkill::WAIT
  313.     area.update_type = BMSP::ConsumeHPSkill::UPDATE_TYPE
  314.     area.update_time = BMSP::ConsumeHPSkill::UPDATE_TIME
  315.     area.update_speed = BMSP::ConsumeHPSkill::UPDATE_SPEED
  316.     if @actor.skill_tp_cost(skill) > 0
  317.       bitmap = area.add(:tpcost)
  318.       bitmap.font.color.set(tp_cost_color)
  319.       bitmap.font.color.alpha = translucent_alpha unless enable?(skill)
  320.       bitmap.draw_text(bitmap.rect, @actor.skill_tp_cost(skill), 2)
  321.     end
  322.     if @actor.skill_mp_cost(skill) > 0
  323.       bitmap = area.add(:mpcost)
  324.       bitmap.font.color.set(mp_cost_color)
  325.       bitmap.font.color.alpha = translucent_alpha unless enable?(skill)
  326.       bitmap.draw_text(bitmap.rect, @actor.skill_mp_cost(skill), 2)
  327.     end
  328.     if @actor.skill_hp_cost(skill) > 0
  329.       bitmap = area.add(:hpcost)
  330.       bitmap.font.color.set(hp_cost_color)
  331.       bitmap.font.color.alpha = translucent_alpha unless enable?(skill)
  332.       bitmap.draw_text(bitmap.rect, @actor.skill_hp_cost(skill), 2)
  333.     end
  334.   end
  335. end
  336. #==============================================================================
  337. # ■ Scene_Battle
  338. #==============================================================================
  339. class Scene_Battle < Scene_Base
  340.   #--------------------------------------------------------------------------
  341.   # ● スキル/アイテムの使用(再定義)
  342.   #--------------------------------------------------------------------------
  343.   def use_item
  344.     item = @subject.current_action.item
  345.     @log_window.display_use_item(@subject, item)
  346.     targets = @subject.current_action.make_targets.compact
  347.     @subject.use_item(item)
  348.     refresh_status
  349.     show_animation(targets, item.animation_id)
  350.     @log_window.bmsp_consumehpskill_display_hpskill_knockout(@subject, item)
  351.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  352.   end
  353. end
  354. #==============================================================================
  355. # ■ Window_BattleLog
  356. #==============================================================================
  357. class Window_BattleLog < Window_Selectable
  358.   #--------------------------------------------------------------------------
  359.   # ● HP消費スキルによる戦闘不能の表示
  360.   #--------------------------------------------------------------------------
  361.   def bmsp_consumehpskill_display_hpskill_knockout(subject, item)
  362.     if subject.result.added_states.include?(subject.death_state_id)
  363.       subject.perform_collapse_effect
  364.       msg = subject.actor? ? BMSP::ConsumeHPSkill::ACTOR_KNOCKOUT_MESSAGE :
  365.             BMSP::ConsumeHPSkill::ENEMY_KNOCKOUT_MESSAGE
  366.       add_text(sprintf(msg,subject.name))
  367.       wait
  368.     end
  369.   end
  370. end
  371.                        
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
3
发表于 2016-8-21 16:24:43 | 只看该作者
大大我看不懂怎么用,还是用我的吧,还附带了解释
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Skill Cost Manager v1.02
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal, Hard, Lunatic
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-SkillCostManager"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.23 - Compatibility Update: Doppelganger
  15. # 2011.12.11 - Started Script and Finished.
  16. #            - Added max and min notetags.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script adds more functionality towards skill costs. Skills can now cost
  22. # HP, more MP, more TP, gold, and even have custom costs. The way the skill
  23. # costs are drawn in the display windows are changed to deliver more effective
  24. # and reliable information to the player. And if four skill costs aren't enough
  25. # to satisfy you, you can even make your own custom skill costs.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32. #
  33. # -----------------------------------------------------------------------------
  34. # Actor Notetags - These notetags go in the actors notebox in the database.
  35. # -----------------------------------------------------------------------------
  36. # <hp cost rate: x%>
  37. # Allows the actor to drop the HP cost of skills to x%.
  38. #
  39. # <tp cost rate: x%>
  40. # Allows the actor to drop the TP cost of skills to x%.
  41. #
  42. # <gold cost rate: x%>
  43. # Allows the actor to drop the Gold cost of skills to x%.
  44. #
  45. # -----------------------------------------------------------------------------
  46. # Class Notetags - These notetags go in the class notebox in the database.
  47. # -----------------------------------------------------------------------------
  48. # <hp cost rate: x%>
  49. # Allows the class to drop the HP cost of skills to x%.
  50. #
  51. # <tp cost rate: x%>
  52. # Allows the class to drop the TP cost of skills to x%.
  53. #
  54. # <gold cost rate: x%>
  55. # Allows the class to drop the Gold cost of skills to x%.
  56. #
  57. # -----------------------------------------------------------------------------
  58. # Skill Notetags - These notetags go in the skills notebox in the database.
  59. # -----------------------------------------------------------------------------
  60. # <hp cost: x>
  61. # Sets the skill's HP cost to x. This function did not exist by default in
  62. # RPG Maker VX Ace.
  63. #
  64. # <hp cost: x%>
  65. # Sets the HP cost to a percentage of the actor's MaxHP. If a normal HP cost is
  66. # present on the skill, too, then this value is added to the HP cost.
  67. #
  68. # <hp cost max: x>
  69. # <hp cost min: x>
  70. # Sets the maximum and minimum range of the HP Cost of the skill. If you do not
  71. # use this tag, there will be no maximum and/or minimum range.
  72. #
  73. # <mp cost: x>
  74. # Sets the skill's MP cost to x. Allows MP cost to exceed 9999, which is RPG
  75. # Maker VX Ace's database editor's maximum limit.
  76. #
  77. # <mp cost: x%>
  78. # Sets the MP cost to a percentage of the actor's MaxMP. If a normal MP cost is
  79. # present on the skill, too, then this value is added to the MP cost.
  80. #
  81. # <mp cost max: x>
  82. # <mp cost min: x>
  83. # Sets the maximum and minimum range of the MP Cost of the skill. If you do not
  84. # use this tag, there will be no maximum and/or minimum range.
  85. #
  86. # <tp cost: x>
  87. # Sets the skill's TP cost to x. Allows TP cost to exceed 100, which is RPG
  88. # Maker VX Ace's database editor's maximum limit.
  89. #
  90. # <tp cost: x%>
  91. # Sets the TP cost to a percentage of the actor's MaxTP. If a normal TP cost is
  92. # present on the skill, too, then this value is added to the TP cost.
  93. #
  94. # <tp cost max: x>
  95. # <tp cost min: x>
  96. # Sets the maximum and minimum range of the TP Cost of the skill. If you do not
  97. # use this tag, there will be no maximum and/or minimum range.
  98. #
  99. # <gold cost: x>
  100. # Sets the skill's gold cost to x. Enemies with skills that cost gold do not
  101. # use gold. If the player does not have enough gold, the skill can't be used.
  102. #
  103. # <gold cost: x%>
  104. # Sets the skill's gold cost equal to a percentage of the party's total gold.
  105. # If both a regular gold cost and a percentile gold cost is used, the total of
  106. # both values will be the skill's gold cost.
  107. #
  108. # <gold cost max: x>
  109. # <gold cost min: x>
  110. # Sets the maximum and minimum range of the Gold Cost of the skill. If you do
  111. # not use this tag, there will be no maximum and/or minimum range.
  112. #
  113. # --- Making Your Own Custom Costs ---
  114. #
  115. # <custom cost: string>
  116. # If you decide to have a custom cost for your game, insert this notetag to
  117. # change what displays in the skill menu visually.
  118. #
  119. # <custom cost colour: x>
  120. # This is the "Window" skin text colour used for the custom cost. By default,
  121. # it is text colour 0, which is the white colour.
  122. #
  123. # <custom cost size: x>
  124. # This is the text font size used for the custom cost in the display windows.
  125. # By default, it is font size 20.
  126. #
  127. # <custom cost icon: x>
  128. # If you wish to use an icon for your custom cost, replace x with the icon ID
  129. # you wish to show in display windows. By default, it is 0 (and not shown).
  130. #
  131. # <custom cost requirement>
  132. #  string
  133. #  string
  134. # </custom cost requirement>
  135. # Sets the custom cost requirement of the skill with an eval function using the
  136. # strings in between. The strings are a part of one line even if in the notebox
  137. # they are on separate lines.
  138. #
  139. # <custom cost perform>
  140. #  string
  141. #  string
  142. # </custom cost perform>
  143. # Sets how the custom cost payment is done with an eval function using the
  144. # strings in between. The strings are a part of one line even if in the notebox
  145. # they are on separate lines.
  146. #
  147. # -----------------------------------------------------------------------------
  148. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  149. # -----------------------------------------------------------------------------
  150. # <hp cost rate: x%>
  151. # Allows the weapon to drop the HP cost of skills to x% when worn.
  152. #
  153. # <tp cost rate: x%>
  154. # Allows the weapon to drop the TP cost of skills to x% when worn.
  155. #
  156. # <gold cost rate: x%>
  157. # Allows the weapon to drop the Gold cost of skills to x% when worn.
  158. #
  159. # -----------------------------------------------------------------------------
  160. # Armour Notetags - These notetags go in the armours notebox in the database.
  161. # -----------------------------------------------------------------------------
  162. # <hp cost rate: x%>
  163. # Allows the armour to drop the HP cost of skills to x% when worn.
  164. #
  165. # <tp cost rate: x%>
  166. # Allows the armour to drop the TP cost of skills to x% when worn.
  167. #
  168. # <gold cost rate: x%>
  169. # Allows the armour to drop the TP cost of skills to x% when worn.
  170. #
  171. # -----------------------------------------------------------------------------
  172. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  173. # -----------------------------------------------------------------------------
  174. # <hp cost rate: x%>
  175. # Allows the enemy to drop the HP cost of skills to x%.
  176. #
  177. # <tp cost rate: x%>
  178. # Allows the enemy to drop the TP cost of skills to x%.
  179. #
  180. # -----------------------------------------------------------------------------
  181. # State Notetags - These notetags go in the states notebox in the database.
  182. # -----------------------------------------------------------------------------
  183. # <hp cost rate: x%>
  184. # Allows the state to drop the HP cost of skills to x% when afflicted.
  185. #
  186. # <tp cost rate: x%>
  187. # Allows the state to drop the TP cost of skills to x% when afflicted.
  188. #
  189. # <gold cost rate: x%>
  190. # Allows the state to drop the Gold cost of skills to x% when afflicted.
  191. #
  192. #==============================================================================
  193. # ▼ Compatibility
  194. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  195. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  196. # it will run with RPG Maker VX without adjusting.
  197. #
  198. #==============================================================================

  199. module YEA
  200.   module SKILL_COST
  201.    
  202.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  203.     # - HP Cost Settings -
  204.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  205.     # New to this script are HP costs. HP costs require the battler to have
  206.     # sufficient HP before being able to use the skill. The text colour that's
  207.     # used, the suffix, or whether or not to use an icon. If you do not wish
  208.     # to use an icon, set the icon to 0.
  209.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  210.     HP_COST_COLOUR = 21         # Colour used from "Window" skin.
  211.     HP_COST_SIZE   = 20         # Font size used for HP costs.
  212.     HP_COST_SUFFIX = "%sHP"     # Suffix used for HP costs.
  213.     HP_COST_ICON   = 0          # Icon used for HP costs. Set 0 to disable.
  214.    
  215.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  216.     # - MP Cost Settings -
  217.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  218.     # Here, you can change the settings for MP costs: the text colour that's
  219.     # used, the suffix, or whether or not to use an icon. If you do not wish
  220.     # to use an icon, set the icon to 0.
  221.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  222.     MP_COST_COLOUR = 23         # Colour used from "Window" skin. Default: 23
  223.     MP_COST_SIZE   = 20         # Font size used for MP costs. Default: 24
  224.     MP_COST_SUFFIX = "%sMP"     # Suffix used for MP costs. No suffix default.
  225.     MP_COST_ICON   = 0          # Icon used for MP costs. Set 0 to disable.
  226.    
  227.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  228.     # - TP Cost Settings -
  229.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  230.     # Here, you can change the settings for TP costs: the text colour that's
  231.     # used, the suffix, or whether or not to use an icon. If you do not wish
  232.     # to use an icon, set the icon to 0.
  233.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  234.     TP_COST_COLOUR = 2          # Colour used from "Window" skin. Default: 29
  235.     TP_COST_SIZE   = 20         # Font size used for TP costs. Default: 24
  236.     TP_COST_SUFFIX = "%sTP"     # Suffix used for TP costs. No suffix default.
  237.     TP_COST_ICON   = 0          # Icon used for TP costs. Set 0 to disable.
  238.    
  239.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  240.     # - Gold Cost Settings -
  241.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  242.     # New to this script are Gold costs. Gold costs require the party to have
  243.     # enough gold before being able to use the skill. The text colour that's
  244.     # used, the suffix, or whether or not to use an icon. If you do not wish
  245.     # to use an icon, set the icon to 0.
  246.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  247.     GOLD_COST_COLOUR = 6          # Colour used from "Window" skin.
  248.     GOLD_COST_SIZE   = 20         # Font size used for Gold costs.
  249.     GOLD_COST_SUFFIX = "%sGold"   # Suffix used for Gold costs.
  250.     GOLD_COST_ICON   = 0          # Icon used for Gold costs. Set 0 to disable.
  251.    
  252.   end # SKILL_COST
  253. end # YEA

  254. #==============================================================================
  255. # ▼ Editting anything past this point may potentially result in causing
  256. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  257. # halitosis so edit at your own risk.
  258. #==============================================================================

  259. module YEA
  260.   module REGEXP
  261.   module BASEITEM
  262.    
  263.     HP_COST_RATE = /<(?:HP_COST_RATE|hp cost rate):[ ](\d+)([%%])>/i
  264.     TP_COST_RATE = /<(?:TP_COST_RATE|tp cost rate):[ ](\d+)([%%])>/i
  265.     GOLD_COST_RATE = /<(?:GOLD_COST_RATE|gold cost rate):[ ](\d+)([%%])>/i
  266.    
  267.   end # BASEITEM
  268.   module SKILL
  269.    
  270.     HP_COST_SET = /<(?:HP_COST|hp cost):[ ](\d+)>/i
  271.     HP_COST_PER = /<(?:HP_COST|hp cost):[ ](\d+)([%%])>/i
  272.     MP_COST_SET = /<(?:MP_COST|mp cost):[ ](\d+)>/i
  273.     MP_COST_PER = /<(?:MP_COST|mp cost):[ ](\d+)([%%])>/i
  274.     TP_COST_SET = /<(?:TP_COST|tp cost):[ ](\d+)>/i
  275.     TP_COST_PER = /<(?:TP_COST|tp cost):[ ](\d+)([%%])>/i
  276.     GOLD_COST_SET = /<(?:GOLD_COST|gold cost):[ ](\d+)>/i
  277.     GOLD_COST_PER = /<(?:GOLD_COST|gold cost):[ ](\d+)([%%])>/i
  278.    
  279.     CUSTOM_COST_TEXT = /<(?:CUSTOM_COST|custom cost):[ ](.*)>/i
  280.     CUSTOM_COST_COLOUR =
  281.       /<(?:CUSTOM_COST_COLOUR|custom cost colour|custom cost color):[ ](\d+)>/i
  282.     CUSTOM_COST_SIZE = /<(?:CUSTOM_COST_SIZE|custom cost size):[ ](\d+)>/i
  283.     CUSTOM_COST_ICON = /<(?:CUSTOM_COST_ICON|custom cost icon):[ ](\d+)>/i
  284.     CUSTOM_COST_REQUIREMENT_ON =
  285.       /<(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  286.     CUSTOM_COST_REQUIREMENT_OFF =
  287.       /<\/(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  288.     CUSTOM_COST_PERFORM_ON =
  289.       /<(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  290.     CUSTOM_COST_PERFORM_OFF =
  291.       /<\/(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  292.    
  293.     HP_COST_MIN = /<(?:HP_COST_MIN|hp cost min):[ ](\d+)>/i
  294.     HP_COST_MAX = /<(?:HP_COST_MIN|hp cost max):[ ](\d+)>/i
  295.     MP_COST_MIN = /<(?:MP_COST_MIN|mp cost min):[ ](\d+)>/i
  296.     MP_COST_MAX = /<(?:MP_COST_MIN|mp cost max):[ ](\d+)>/i
  297.     TP_COST_MIN = /<(?:TP_COST_MIN|tp cost min):[ ](\d+)>/i
  298.     TP_COST_MAX = /<(?:TP_COST_MIN|tp cost max):[ ](\d+)>/i
  299.     GOLD_COST_MIN = /<(?:GOLD_COST_MIN|gold cost min):[ ](\d+)>/i
  300.     GOLD_COST_MAX = /<(?:GOLD_COST_MIN|gold cost max):[ ](\d+)>/i
  301.    
  302.   end # SKILL
  303.   end # REGEXP
  304. end # YEA

  305. #==============================================================================
  306. # ■ Icon
  307. #==============================================================================

  308. module Icon
  309.   
  310.   #--------------------------------------------------------------------------
  311.   # self.mp_cost
  312.   #--------------------------------------------------------------------------
  313.   def self.mp_cost; return YEA::SKILL_COST::MP_COST_ICON; end
  314.   
  315.   #--------------------------------------------------------------------------
  316.   # self.tp_cost
  317.   #--------------------------------------------------------------------------
  318.   def self.tp_cost; return YEA::SKILL_COST::TP_COST_ICON; end
  319.   
  320.   #--------------------------------------------------------------------------
  321.   # self.hp_cost
  322.   #--------------------------------------------------------------------------
  323.   def self.hp_cost; return YEA::SKILL_COST::HP_COST_ICON; end
  324.   
  325.   #--------------------------------------------------------------------------
  326.   # self.gold_cost
  327.   #--------------------------------------------------------------------------
  328.   def self.gold_cost; return YEA::SKILL_COST::GOLD_COST_ICON; end
  329.    
  330. end # Icon

  331. #==============================================================================
  332. # ■ Numeric
  333. #==============================================================================

  334. class Numeric
  335.   
  336.   #--------------------------------------------------------------------------
  337.   # new method: group_digits
  338.   #--------------------------------------------------------------------------
  339.   unless $imported["YEA-CoreEngine"]
  340.   def group; return self.to_s; end
  341.   end # $imported["YEA-CoreEngine"]
  342.    
  343. end # Numeric

  344. #==============================================================================
  345. # ■ DataManager
  346. #==============================================================================

  347. module DataManager
  348.   
  349.   #--------------------------------------------------------------------------
  350.   # alias method: load_database
  351.   #--------------------------------------------------------------------------
  352.   class <<self; alias load_database_scm load_database; end
  353.   def self.load_database
  354.     load_database_scm
  355.     load_notetags_scm
  356.   end
  357.   
  358.   #--------------------------------------------------------------------------
  359.   # new method: load_notetags_scm
  360.   #--------------------------------------------------------------------------
  361.   def self.load_notetags_scm
  362.     groups = [$data_actors, $data_classes, $data_skills, $data_weapons,
  363.       $data_armors, $data_enemies, $data_states]
  364.     for group in groups
  365.       for obj in group
  366.         next if obj.nil?
  367.         obj.load_notetags_scm
  368.       end
  369.     end
  370.   end
  371.   
  372. end # DataManager

  373. #==============================================================================
  374. # ■ RPG::BaseItem
  375. #==============================================================================

  376. class RPG::BaseItem
  377.   
  378.   #--------------------------------------------------------------------------
  379.   # public instance variables
  380.   #--------------------------------------------------------------------------
  381.   attr_accessor :tp_cost_rate
  382.   attr_accessor :hp_cost_rate
  383.   attr_accessor :gold_cost_rate
  384.   
  385.   #--------------------------------------------------------------------------
  386.   # common cache: load_notetags_scm
  387.   #--------------------------------------------------------------------------
  388.   def load_notetags_scm
  389.     @tp_cost_rate = 1.0
  390.     @hp_cost_rate = 1.0
  391.     @gold_cost_rate = 1.0
  392.     #---
  393.     self.note.split(/[\r\n]+/).each { |line|
  394.       case line
  395.       #---
  396.       when YEA::REGEXP::BASEITEM::TP_COST_RATE
  397.         @tp_cost_rate = $1.to_i * 0.01
  398.       when YEA::REGEXP::BASEITEM::HP_COST_RATE
  399.         @hp_cost_rate = $1.to_i * 0.01
  400.       when YEA::REGEXP::BASEITEM::GOLD_COST_RATE
  401.         @gold_cost_rate = $1.to_i * 0.01
  402.       #---
  403.       end
  404.     } # self.note.split
  405.     #---
  406.   end
  407.   
  408. end # RPG::BaseItem

  409. #==============================================================================
  410. # ■ RPG::Skill
  411. #==============================================================================

  412. class RPG::Skill < RPG::UsableItem
  413.   
  414.   #--------------------------------------------------------------------------
  415.   # public instance variables
  416.   #--------------------------------------------------------------------------
  417.   attr_accessor :hp_cost
  418.   attr_accessor :hp_cost_percent
  419.   attr_accessor :mp_cost_percent
  420.   attr_accessor :tp_cost_percent
  421.   attr_accessor :gold_cost
  422.   attr_accessor :gold_cost_percent
  423.   
  424.   attr_accessor :hp_cost_min
  425.   attr_accessor :hp_cost_max
  426.   attr_accessor :mp_cost_min
  427.   attr_accessor :mp_cost_max
  428.   attr_accessor :tp_cost_min
  429.   attr_accessor :tp_cost_max
  430.   attr_accessor :gold_cost_min
  431.   attr_accessor :gold_cost_max
  432.   
  433.   attr_accessor :use_custom_cost
  434.   attr_accessor :custom_cost_text
  435.   attr_accessor :custom_cost_colour
  436.   attr_accessor :custom_cost_size
  437.   attr_accessor :custom_cost_icon
  438.   attr_accessor :custom_cost_requirement
  439.   attr_accessor :custom_cost_perform
  440.   
  441.   #--------------------------------------------------------------------------
  442.   # common cache: load_notetags_scm
  443.   #--------------------------------------------------------------------------
  444.   def load_notetags_scm
  445.     @hp_cost = 0
  446.     @gold_cost = 0
  447.     @hp_cost_percent = 0.0
  448.     @mp_cost_percent = 0.0
  449.     @tp_cost_percent = 0.0
  450.     @gold_cost_percent = 0.0
  451.    
  452.     @custom_cost_text = "0"
  453.     @custom_cost_colour = 0
  454.     @custom_cost_size = 20
  455.     @custom_cost_icon = 0
  456.     @custom_cost_requirement = ""
  457.     @custom_cost_perform = ""
  458.    
  459.     @use_custom_cost = false
  460.     @custom_cost_req_on = false
  461.     @custom_cost_per_on = false
  462.     #---
  463.     self.note.split(/[\r\n]+/).each { |line|
  464.       case line
  465.       #---
  466.       when YEA::REGEXP::SKILL::MP_COST_SET
  467.         @mp_cost = $1.to_i
  468.       when YEA::REGEXP::SKILL::MP_COST_PER
  469.         @mp_cost_percent = $1.to_i * 0.01
  470.       when YEA::REGEXP::SKILL::TP_COST_SET
  471.         @tp_cost = $1.to_i
  472.       when YEA::REGEXP::SKILL::TP_COST_PER
  473.         @tp_cost_percent = $1.to_i * 0.01
  474.       when YEA::REGEXP::SKILL::HP_COST_SET
  475.         @hp_cost = $1.to_i
  476.       when YEA::REGEXP::SKILL::HP_COST_PER
  477.         @hp_cost_percent = $1.to_i * 0.01
  478.       when YEA::REGEXP::SKILL::GOLD_COST_SET
  479.         @gold_cost = $1.to_i
  480.       when YEA::REGEXP::SKILL::GOLD_COST_PER
  481.         @gold_cost_percent = $1.to_i * 0.01
  482.       #---
  483.       when YEA::REGEXP::SKILL::HP_COST_MIN
  484.         @hp_cost_min = $1.to_i
  485.       when YEA::REGEXP::SKILL::HP_COST_MAX
  486.         @hp_cost_max = $1.to_i
  487.       when YEA::REGEXP::SKILL::MP_COST_MIN
  488.         @mp_cost_min = $1.to_i
  489.       when YEA::REGEXP::SKILL::MP_COST_MAX
  490.         @mp_cost_max = $1.to_i
  491.       when YEA::REGEXP::SKILL::TP_COST_MIN
  492.         @tp_cost_min = $1.to_i
  493.       when YEA::REGEXP::SKILL::TP_COST_MAX
  494.         @tp_cost_max = $1.to_i
  495.       when YEA::REGEXP::SKILL::GOLD_COST_MIN
  496.         @gold_cost_min = $1.to_i
  497.       when YEA::REGEXP::SKILL::GOLD_COST_MAX
  498.         @gold_cost_max = $1.to_i
  499.       #---
  500.       when YEA::REGEXP::SKILL::CUSTOM_COST_TEXT
  501.         @custom_cost_text = $1.to_s
  502.       when YEA::REGEXP::SKILL::CUSTOM_COST_COLOUR
  503.         @custom_cost_colour = $1.to_i
  504.       when YEA::REGEXP::SKILL::CUSTOM_COST_SIZE
  505.         @custom_cost_size = $1.to_i
  506.       when YEA::REGEXP::SKILL::CUSTOM_COST_ICON
  507.         @custom_cost_icon = $1.to_i
  508.       when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_ON
  509.         @custom_cost_req_on = true
  510.         @use_custom_cost = true
  511.       when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_OFF
  512.         @custom_cost_req_on = false
  513.         @use_custom_cost = true
  514.       when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_ON
  515.         @custom_cost_per_on = true
  516.         @use_custom_cost = true
  517.       when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_OFF
  518.         @custom_cost_per_on = false
  519.         @use_custom_cost = true
  520.       else
  521.         @custom_cost_requirement += line.to_s if @custom_cost_req_on
  522.         @custom_cost_perform += line.to_s if @custom_cost_per_on
  523.       #---
  524.       end
  525.     } # self.note.split
  526.     #---
  527.   end
  528.   
  529. end # RPG::Skill

  530. #==============================================================================
  531. # ■ Game_BattlerBase
  532. #==============================================================================

  533. class Game_BattlerBase
  534.   
  535.   #--------------------------------------------------------------------------
  536.   # alias method: skill_cost_payable?
  537.   #--------------------------------------------------------------------------
  538.   alias game_battlerbase_skill_cost_payable_scm skill_cost_payable?
  539.   def skill_cost_payable?(skill)
  540.     return false if hp <= skill_hp_cost(skill)
  541.     return false unless gold_cost_met?(skill)
  542.     return false unless custom_cost_met?(skill)
  543.     return game_battlerbase_skill_cost_payable_scm(skill)
  544.   end
  545.   
  546.   #--------------------------------------------------------------------------
  547.   # new method: gold_cost_met?
  548.   #--------------------------------------------------------------------------
  549.   def gold_cost_met?(skill)
  550.     return true unless actor?
  551.     return $game_party.gold >= skill_gold_cost(skill)
  552.   end
  553.   
  554.   #--------------------------------------------------------------------------
  555.   # new method: custom_cost_met?
  556.   #--------------------------------------------------------------------------
  557.   def custom_cost_met?(skill)
  558.     return true unless skill.use_custom_cost
  559.     return eval(skill.custom_cost_requirement)
  560.   end
  561.   
  562.   #--------------------------------------------------------------------------
  563.   # alias method: pay_skill_cost
  564.   #--------------------------------------------------------------------------
  565.   alias game_battlerbase_pay_skill_cost_scm pay_skill_cost
  566.   def pay_skill_cost(skill)
  567.     game_battlerbase_pay_skill_cost_scm(skill)
  568.     self.hp -= skill_hp_cost(skill)
  569.     $game_party.lose_gold(skill_gold_cost(skill)) if actor?
  570.     pay_custom_cost(skill)
  571.   end
  572.   
  573.   #--------------------------------------------------------------------------
  574.   # new method: pay_custom_cost
  575.   #--------------------------------------------------------------------------
  576.   def pay_custom_cost(skill)
  577.     return unless skill.use_custom_cost
  578.     eval(skill.custom_cost_perform)
  579.   end
  580.   
  581.   #--------------------------------------------------------------------------
  582.   # alias method: skill_mp_cost
  583.   #--------------------------------------------------------------------------
  584.   alias game_battlerbase_skill_mp_cost_scm skill_mp_cost
  585.   def skill_mp_cost(skill)
  586.     n = game_battlerbase_skill_mp_cost_scm(skill)
  587.     n += skill.mp_cost_percent * mmp * mcr
  588.     n = [n.to_i, skill.mp_cost_max].min unless skill.mp_cost_max.nil?
  589.     n = [n.to_i, skill.mp_cost_min].max unless skill.mp_cost_min.nil?
  590.     return n.to_i
  591.   end
  592.   
  593.   #--------------------------------------------------------------------------
  594.   # alias method: skill_tp_cost
  595.   #--------------------------------------------------------------------------
  596.   alias game_battlerbase_skill_tp_cost_scm skill_tp_cost
  597.   def skill_tp_cost(skill)
  598.     n = game_battlerbase_skill_tp_cost_scm(skill) * tcr
  599.     n += skill.tp_cost_percent * max_tp * tcr
  600.     n = [n.to_i, skill.tp_cost_max].min unless skill.tp_cost_max.nil?
  601.     n = [n.to_i, skill.tp_cost_min].max unless skill.tp_cost_min.nil?
  602.     return n.to_i
  603.   end
  604.   
  605.   #--------------------------------------------------------------------------
  606.   # new method: tcr
  607.   #--------------------------------------------------------------------------
  608.   def tcr
  609.     n = 1.0
  610.     if actor?
  611.       n *= self.actor.tp_cost_rate
  612.       n *= self.class.tp_cost_rate
  613.       for equip in equips
  614.         next if equip.nil?
  615.         n *= equip.tp_cost_rate
  616.       end
  617.     else
  618.       n *= self.enemy.tp_cost_rate
  619.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  620.         n *= self.class.tp_cost_rate
  621.       end
  622.     end
  623.     for state in states
  624.       next if state.nil?
  625.       n *= state.tp_cost_rate
  626.     end
  627.     return n
  628.   end
  629.   
  630.   #--------------------------------------------------------------------------
  631.   # new method: skill_hp_cost
  632.   #--------------------------------------------------------------------------
  633.   def skill_hp_cost(skill)
  634.     n = skill.hp_cost * hcr
  635.     n += skill.hp_cost_percent * mhp * hcr
  636.     n = [n.to_i, skill.hp_cost_max].min unless skill.hp_cost_max.nil?
  637.     n = [n.to_i, skill.hp_cost_min].max unless skill.hp_cost_min.nil?
  638.     return n.to_i
  639.   end
  640.   
  641.   #--------------------------------------------------------------------------
  642.   # new method: hcr
  643.   #--------------------------------------------------------------------------
  644.   def hcr
  645.     n = 1.0
  646.     if actor?
  647.       n *= self.actor.hp_cost_rate
  648.       n *= self.class.hp_cost_rate
  649.       for equip in equips
  650.         next if equip.nil?
  651.         n *= equip.hp_cost_rate
  652.       end
  653.     else
  654.       n *= self.enemy.hp_cost_rate
  655.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  656.         n *= self.class.hp_cost_rate
  657.       end
  658.     end
  659.     for state in states
  660.       next if state.nil?
  661.       n *= state.hp_cost_rate
  662.     end
  663.     return n
  664.   end
  665.   
  666.   #--------------------------------------------------------------------------
  667.   # new method: skill_gold_cost
  668.   #--------------------------------------------------------------------------
  669.   def skill_gold_cost(skill)
  670.     n = skill.gold_cost * gcr
  671.     n += skill.gold_cost_percent * $game_party.gold * gcr
  672.     n = [n.to_i, skill.gold_cost_max].min unless skill.gold_cost_max.nil?
  673.     n = [n.to_i, skill.gold_cost_min].max unless skill.gold_cost_min.nil?
  674.     return n.to_i
  675.   end
  676.   
  677.   #--------------------------------------------------------------------------
  678.   # new method: gcr
  679.   #--------------------------------------------------------------------------
  680.   def gcr
  681.     n = 1.0
  682.     n *= self.actor.gold_cost_rate
  683.     n *= self.class.gold_cost_rate
  684.     for equip in equips
  685.       next if equip.nil?
  686.       n *= equip.gold_cost_rate
  687.     end
  688.     for state in states
  689.       next if state.nil?
  690.       n *= state.gold_cost_rate
  691.     end
  692.     return n
  693.   end
  694.   
  695. end # Game_BattlerBase
  696.   
  697. #==============================================================================
  698. # ■ Window_Base
  699. #==============================================================================

  700. class Window_Base < Window
  701.   
  702.   #--------------------------------------------------------------------------
  703.   # overwrite methods: cost_colours
  704.   #--------------------------------------------------------------------------
  705.   def mp_cost_color; text_color(YEA::SKILL_COST::MP_COST_COLOUR); end;
  706.   def tp_cost_color; text_color(YEA::SKILL_COST::TP_COST_COLOUR); end;
  707.   def hp_cost_color; text_color(YEA::SKILL_COST::HP_COST_COLOUR); end;
  708.   def gold_cost_color; text_color(YEA::SKILL_COST::GOLD_COST_COLOUR); end;
  709.   
  710. end # Window_Base

  711. #==============================================================================
  712. # ■ Window_SkillList
  713. #==============================================================================

  714. class Window_SkillList < Window_Selectable
  715.   
  716.   #--------------------------------------------------------------------------
  717.   # overwrite method: draw_skill_cost
  718.   #--------------------------------------------------------------------------
  719.   def draw_skill_cost(rect, skill)
  720.     draw_tp_skill_cost(rect, skill) unless $imported["YEA-BattleEngine"]
  721.     draw_mp_skill_cost(rect, skill)
  722.     draw_tp_skill_cost(rect, skill) if $imported["YEA-BattleEngine"]
  723.     draw_hp_skill_cost(rect, skill)
  724.     draw_gold_skill_cost(rect, skill)
  725.     draw_custom_skill_cost(rect, skill)
  726.   end
  727.   
  728.   #--------------------------------------------------------------------------
  729.   # new method: draw_mp_skill_cost
  730.   #--------------------------------------------------------------------------
  731.   def draw_mp_skill_cost(rect, skill)
  732.     return unless @actor.skill_mp_cost(skill) > 0
  733.     change_color(mp_cost_color, enable?(skill))
  734.     #---
  735.     icon = Icon.mp_cost
  736.     if icon > 0
  737.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  738.       rect.width -= 24
  739.     end
  740.     #---
  741.     contents.font.size = YEA::SKILL_COST::MP_COST_SIZE
  742.     cost = @actor.skill_mp_cost(skill)
  743.     text = sprintf(YEA::SKILL_COST::MP_COST_SUFFIX, cost.group)
  744.     draw_text(rect, text, 2)
  745.     cx = text_size(text).width + 4
  746.     rect.width -= cx
  747.     reset_font_settings
  748.   end
  749.   
  750.   #--------------------------------------------------------------------------
  751.   # new method: draw_tp_skill_cost
  752.   #--------------------------------------------------------------------------
  753.   def draw_tp_skill_cost(rect, skill)
  754.     return unless @actor.skill_tp_cost(skill) > 0
  755.     change_color(tp_cost_color, enable?(skill))
  756.     #---
  757.     icon = Icon.tp_cost
  758.     if icon > 0
  759.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  760.       rect.width -= 24
  761.     end
  762.     #---
  763.     contents.font.size = YEA::SKILL_COST::TP_COST_SIZE
  764.     cost = @actor.skill_tp_cost(skill)
  765.     text = sprintf(YEA::SKILL_COST::TP_COST_SUFFIX, cost.group)
  766.     draw_text(rect, text, 2)
  767.     cx = text_size(text).width + 4
  768.     rect.width -= cx
  769.     reset_font_settings
  770.   end
  771.   
  772.   #--------------------------------------------------------------------------
  773.   # new method: draw_hp_skill_cost
  774.   #--------------------------------------------------------------------------
  775.   def draw_hp_skill_cost(rect, skill)
  776.     return unless @actor.skill_hp_cost(skill) > 0
  777.     change_color(hp_cost_color, enable?(skill))
  778.     #---
  779.     icon = Icon.hp_cost
  780.     if icon > 0
  781.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  782.       rect.width -= 24
  783.     end
  784.     #---
  785.     contents.font.size = YEA::SKILL_COST::HP_COST_SIZE
  786.     cost = @actor.skill_hp_cost(skill)
  787.     text = sprintf(YEA::SKILL_COST::HP_COST_SUFFIX, cost.group)
  788.     draw_text(rect, text, 2)
  789.     cx = text_size(text).width + 4
  790.     rect.width -= cx
  791.     reset_font_settings
  792.   end
  793.   
  794.   #--------------------------------------------------------------------------
  795.   # new method: draw_gold_skill_cost
  796.   #--------------------------------------------------------------------------
  797.   def draw_gold_skill_cost(rect, skill)
  798.     return unless @actor.skill_gold_cost(skill) > 0
  799.     change_color(gold_cost_color, enable?(skill))
  800.     #---
  801.     icon = Icon.gold_cost
  802.     if icon > 0
  803.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  804.       rect.width -= 24
  805.     end
  806.     #---
  807.     contents.font.size = YEA::SKILL_COST::GOLD_COST_SIZE
  808.     cost = @actor.skill_gold_cost(skill)
  809.     text = sprintf(YEA::SKILL_COST::GOLD_COST_SUFFIX, cost.group)
  810.     draw_text(rect, text, 2)
  811.     cx = text_size(text).width + 4
  812.     rect.width -= cx
  813.     reset_font_settings
  814.   end
  815.   
  816.   #--------------------------------------------------------------------------
  817.   # new method: draw_custom_skill_cost
  818.   #--------------------------------------------------------------------------
  819.   def draw_custom_skill_cost(rect, skill)
  820.     return unless skill.use_custom_cost
  821.     change_color(text_color(skill.custom_cost_colour), enable?(skill))
  822.     icon = skill.custom_cost_icon
  823.     if icon > 0
  824.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  825.       rect.width -= 24
  826.     end
  827.     contents.font.size = skill.custom_cost_size
  828.     text = skill.custom_cost_text
  829.     draw_text(rect, text, 2)
  830.     cx = text_size(text).width + 4
  831.     rect.width -= cx
  832.     reset_font_settings
  833.   end
  834.   
  835. end # Window_SkillList

  836. #==============================================================================
  837. #
  838. # ▼ End of File
  839. #
  840. #==============================================================================
复制代码
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
4
发表于 2016-8-21 16:28:53 | 只看该作者
<hp cost: x>是固定扣X血,X后面加个%就是百分比  <mp cost: x>就是固定耗费X蓝,X后面加了%就是百分比扣除 TP不解释了你替换即可,记得使用啊,我不需要感谢,你完全自己可以找到,我只是推荐这个好,而且兼容性强。以后有什么需要留言给我,我尽力帮你,或者    1286124843加我Q,直接在线帮你解决

评分

参与人数 1星屑 +250 梦石 +1 收起 理由
RaidenInfinity + 250 + 1 楼主认可的解答

查看全部评分

P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
312
在线时间
67 小时
注册时间
2014-4-17
帖子
20
5
 楼主| 发表于 2016-8-22 14:36:49 | 只看该作者
300英雄 发表于 2016-8-21 16:28
是固定扣X血,X后面加个%就是百分比  就是固定耗费X蓝,X后面加了%就是百分比扣除 TP不解释了你替换即可, ...

真的很感謝你QQ
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
6
发表于 2016-8-22 17:40:26 | 只看该作者
楼主需要帮忙就加我QQ,脚本方面尽全力帮你解决掉
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 02:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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