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

Project1

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

[已经解决] 还是技能消耗HP的问题...

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
37 小时
注册时间
2014-2-14
帖子
23
跳转到指定楼层
1
发表于 2014-4-16 09:57:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
问了很多次了,确实感谢大家的耐心回答,我辜负了版主的回复辜负了大家的期望,但是这脚本实在是看不懂啊...只是想做个特定职业的技能只消耗HP的(个别技能同时消耗MP)不管是否命中是否范围伤害都只扣除指定的HP,实在是找不到一个两全其美的办法,做游戏就卡在这了,再次求大神们伸出援救之手....

奴才小三子 拜上

Lv3.寻梦者 (版主)

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

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

开拓者贵宾

2
发表于 2014-4-16 12:38:56 | 只看该作者
本帖最后由 taroxd 于 2014-4-16 17:22 编辑

重定义Game_Battler类的pay_skill_cost和skill_cost_payable?
我没有环境,所以方法名字不是很确定。思路大概就是这样~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
37 小时
注册时间
2014-2-14
帖子
23
3
 楼主| 发表于 2014-4-16 12:56:16 | 只看该作者
我发现脚本盲活的好自卑啊...确实研究Game_Battler和Game_Battlerbase有好几天了,经我的大黑手改过之处无不出错无不掉链子,毫无头绪啊

点评

自学ruby  发表于 2014-4-16 15:46
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3278
在线时间
1120 小时
注册时间
2009-4-15
帖子
815
4
发表于 2014-4-16 19:20:17 | 只看该作者
我有几个问题要问:
1.消耗HP来发动技能是针对职业,还是针对技能?比如同一个技能,A职业使用就是消耗HP,B职业就是消耗TP?
2.如果HP不足怎么半?
3.本来HP是足够的,但是你后出手,出手前被怪物打了一下,被打以后HP已经不足以发动技能了,怎么办?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
37 小时
注册时间
2014-2-14
帖子
23
5
 楼主| 发表于 2014-4-16 21:55:02 | 只看该作者
tan12345 发表于 2014-4-16 19:20
我有几个问题要问:
1.消耗HP来发动技能是针对职业,还是针对技能?比如同一个技能,A职业使用就是消耗HP, ...

好吧告诉你,其实是想做一个机械类职业,机器的所有技能都消费HP,而MP作为能源靠饰品(电池)来撑上限
1,是针对一系列机械类职业的技能,这些技能其它职业不能用
2,HP不足不能发动,而HP刚好为N,释放消耗N HP的技能会直接死掉
3,HP不足时发动失败
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3278
在线时间
1120 小时
注册时间
2009-4-15
帖子
815
6
发表于 2014-4-16 22:53:30 | 只看该作者
  1. class Game_BattlerBase
  2.   #--------------------------------------------------------------------------
  3.   # ● 判定是否足够扣除技能的使用消耗
  4.   #--------------------------------------------------------------------------
  5.   def skill_cost_payable?(skill)
  6.     if @class_id == 1#1号职业
  7.       hp >= skill_tp_cost(skill) && mp >= skill_mp_cost(skill)
  8.     else
  9.       tp >= skill_tp_cost(skill) && mp >= skill_mp_cost(skill)
  10.     end
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● 扣除技能的使用消耗
  14.   #--------------------------------------------------------------------------
  15.   def pay_skill_cost(skill)
  16.     self.mp -= skill_mp_cost(skill)
  17.     if @class_id == 1#1号职业
  18.       self.hp -= skill_tp_cost(skill)
  19.     else
  20.       self.tp -= skill_tp_cost(skill)
  21.     end
  22.   end
  23. end
复制代码
没有环境,无法测试,不敢保证会报错。
这样设定后,1号职业的所有消耗TP的技能都变成消耗HP,技能设定里,TP消耗那里填写后,就代表消耗HP。

点评

好厉害啊,膜拜大神,虽然TP上限还有些限制,不过本质上解决我的问题了  发表于 2014-4-17 11:12
原来这方法是BattlerBase的……看来我又记错了……  发表于 2014-4-17 06:38

评分

参与人数 1星屑 +5 收起 理由
taroxd + 5 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
92 小时
注册时间
2013-2-23
帖子
130
7
发表于 2014-4-19 06:36:02 | 只看该作者
好像见过LZ发过同样的问题?
用YF大神的脚本:http://yanflychannel.wordpress.c ... skill-cost-manager/

只需要在备注里加入<hp cost: x>或<hp cost: x%>就可以了。

点评

唉...这个网址一直打不开,我用的IE浏览器是不是有问题啊?  发表于 2014-4-19 11:33
梦想是成为触手的新手DE☆SU(<ゝω·)绮罗星 ~☆
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

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

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

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

  306. #==============================================================================
  307. # ■ Icon
  308. #==============================================================================

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

  332. #==============================================================================
  333. # ■ Numeric
  334. #==============================================================================

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

  345. #==============================================================================
  346. # ■ DataManager
  347. #==============================================================================

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

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

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

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

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

  531. #==============================================================================
  532. # ■ Game_BattlerBase
  533. #==============================================================================

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

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

  712. #==============================================================================
  713. # ■ Window_SkillList
  714. #==============================================================================

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

  837. #==============================================================================
  838. #
  839. # ▼ End of File
  840. #
  841. #==============================================================================
复制代码

点评

找了一个月也没见到这个,膜拜啊!爱死你了啊!也膜拜YF爷啊!话说我这个新账号不能给你好人卡积分什么的吗?  发表于 2014-4-19 20:04

评分

参与人数 1梦石 +1 收起 理由
迷糊的安安 + 1 膜拜啊!爱死你了啊!

查看全部评分

梦想是成为触手的新手DE☆SU(<ゝω·)绮罗星 ~☆
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-25 07:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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