Guest User

Multiple Icon Display Yanfly Skill Cost

a guest
Aug 15th, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.19 KB | None | 0 0
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SkillCostManager"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.08.06 - Restore SP-Paramater: TCR
  17. # 2012.01.23 - Compatibility Update: Doppelganger
  18. # 2011.12.11 - Started Script and Finished.
  19. # - Added max and min notetags.
  20. #
  21. #==============================================================================
  22. # ▼ Introduction
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # This script adds more functionality towards skill costs. Skills can now cost
  25. # HP, more MP, more TP, gold, and even have custom costs. The way the skill
  26. # costs are drawn in the display windows are changed to deliver more effective
  27. # and reliable information to the player. And if four skill costs aren't enough
  28. # to satisfy you, you can even make your own custom skill costs.
  29. #
  30. #==============================================================================
  31. # ▼ Instructions
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # To install this script, open up your script editor and copy/paste this script
  34. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  35. #
  36. # -----------------------------------------------------------------------------
  37. # Actor Notetags - These notetags go in the actors notebox in the database.
  38. # -----------------------------------------------------------------------------
  39. # <hp cost rate: x%>
  40. # Allows the actor to drop the HP cost of skills to x%.
  41. #
  42. # <tp cost rate: x%>
  43. # Allows the actor to drop the TP cost of skills to x%.
  44. #
  45. # <gold cost rate: x%>
  46. # Allows the actor to drop the Gold cost of skills to x%.
  47. #
  48. # -----------------------------------------------------------------------------
  49. # Class Notetags - These notetags go in the class notebox in the database.
  50. # -----------------------------------------------------------------------------
  51. # <hp cost rate: x%>
  52. # Allows the class to drop the HP cost of skills to x%.
  53. #
  54. # <tp cost rate: x%>
  55. # Allows the class to drop the TP cost of skills to x%.
  56. #
  57. # <gold cost rate: x%>
  58. # Allows the class to drop the Gold cost of skills to x%.
  59. #
  60. # -----------------------------------------------------------------------------
  61. # Skill Notetags - These notetags go in the skills notebox in the database.
  62. # -----------------------------------------------------------------------------
  63. # <hp cost: x>
  64. # Sets the skill's HP cost to x. This function did not exist by default in
  65. # RPG Maker VX Ace.
  66. #
  67. # <hp cost: x%>
  68. # Sets the HP cost to a percentage of the actor's MaxHP. If a normal HP cost is
  69. # present on the skill, too, then this value is added to the HP cost.
  70. #
  71. # <hp cost max: x>
  72. # <hp cost min: x>
  73. # Sets the maximum and minimum range of the HP Cost of the skill. If you do not
  74. # use this tag, there will be no maximum and/or minimum range.
  75. #
  76. # <mp cost: x>
  77. # Sets the skill's MP cost to x. Allows MP cost to exceed 9999, which is RPG
  78. # Maker VX Ace's database editor's maximum limit.
  79. #
  80. # <mp cost: x%>
  81. # Sets the MP cost to a percentage of the actor's MaxMP. If a normal MP cost is
  82. # present on the skill, too, then this value is added to the MP cost.
  83. #
  84. # <mp cost max: x>
  85. # <mp cost min: x>
  86. # Sets the maximum and minimum range of the MP Cost of the skill. If you do not
  87. # use this tag, there will be no maximum and/or minimum range.
  88. #
  89. # <tp cost: x>
  90. # Sets the skill's TP cost to x. Allows TP cost to exceed 100, which is RPG
  91. # Maker VX Ace's database editor's maximum limit.
  92. #
  93. # <tp cost: x%>
  94. # Sets the TP cost to a percentage of the actor's MaxTP. If a normal TP cost is
  95. # present on the skill, too, then this value is added to the TP cost.
  96. #
  97. # <tp cost max: x>
  98. # <tp cost min: x>
  99. # Sets the maximum and minimum range of the TP Cost of the skill. If you do not
  100. # use this tag, there will be no maximum and/or minimum range.
  101. #
  102. # <gold cost: x>
  103. # Sets the skill's gold cost to x. Enemies with skills that cost gold do not
  104. # use gold. If the player does not have enough gold, the skill can't be used.
  105. #
  106. # <gold cost: x%>
  107. # Sets the skill's gold cost equal to a percentage of the party's total gold.
  108. # If both a regular gold cost and a percentile gold cost is used, the total of
  109. # both values will be the skill's gold cost.
  110. #
  111. # <gold cost max: x>
  112. # <gold cost min: x>
  113. # Sets the maximum and minimum range of the Gold Cost of the skill. If you do
  114. # not use this tag, there will be no maximum and/or minimum range.
  115. #
  116. # --- Making Your Own Custom Costs ---
  117. #
  118. # <custom cost: string>
  119. # If you decide to have a custom cost for your game, insert this notetag to
  120. # change what displays in the skill menu visually.
  121. #
  122. # <custom cost colour: x>
  123. # This is the "Window" skin text colour used for the custom cost. By default,
  124. # it is text colour 0, which is the white colour.
  125. #
  126. # <custom cost size: x>
  127. # This is the text font size used for the custom cost in the display windows.
  128. # By default, it is font size 20.
  129. #
  130. # <custom cost icon: x>
  131. # If you wish to use an icon for your custom cost, replace x with the icon ID
  132. # you wish to show in display windows. By default, it is 0 (and not shown).
  133. #
  134. # <custom cost requirement>
  135. # string
  136. # string
  137. # </custom cost requirement>
  138. # Sets the custom cost requirement of the skill with an eval function using the
  139. # strings in between. The strings are a part of one line even if in the notebox
  140. # they are on separate lines.
  141. #
  142. # <custom cost perform>
  143. # string
  144. # string
  145. # </custom cost perform>
  146. # Sets how the custom cost payment is done with an eval function using the
  147. # strings in between. The strings are a part of one line even if in the notebox
  148. # they are on separate lines.
  149. #
  150. # -----------------------------------------------------------------------------
  151. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  152. # -----------------------------------------------------------------------------
  153. # <hp cost rate: x%>
  154. # Allows the weapon to drop the HP cost of skills to x% when worn.
  155. #
  156. # <tp cost rate: x%>
  157. # Allows the weapon to drop the TP cost of skills to x% when worn.
  158. #
  159. # <gold cost rate: x%>
  160. # Allows the weapon to drop the Gold cost of skills to x% when worn.
  161. #
  162. # -----------------------------------------------------------------------------
  163. # Armour Notetags - These notetags go in the armours notebox in the database.
  164. # -----------------------------------------------------------------------------
  165. # <hp cost rate: x%>
  166. # Allows the armour to drop the HP cost of skills to x% when worn.
  167. #
  168. # <tp cost rate: x%>
  169. # Allows the armour to drop the TP cost of skills to x% when worn.
  170. #
  171. # <gold cost rate: x%>
  172. # Allows the armour to drop the TP cost of skills to x% when worn.
  173. #
  174. # -----------------------------------------------------------------------------
  175. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  176. # -----------------------------------------------------------------------------
  177. # <hp cost rate: x%>
  178. # Allows the enemy to drop the HP cost of skills to x%.
  179. #
  180. # <tp cost rate: x%>
  181. # Allows the enemy to drop the TP cost of skills to x%.
  182. #
  183. # -----------------------------------------------------------------------------
  184. # State Notetags - These notetags go in the states notebox in the database.
  185. # -----------------------------------------------------------------------------
  186. # <hp cost rate: x%>
  187. # Allows the state to drop the HP cost of skills to x% when afflicted.
  188. #
  189. # <tp cost rate: x%>
  190. # Allows the state to drop the TP cost of skills to x% when afflicted.
  191. #
  192. # <gold cost rate: x%>
  193. # Allows the state to drop the Gold cost of skills to x% when afflicted.
  194. #
  195. #==============================================================================
  196. # ▼ Compatibility
  197. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  198. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  199. # it will run with RPG Maker VX without adjusting.
  200. #
  201. #==============================================================================
  202.  
  203. module YEA
  204. module SKILL_COST
  205.  
  206. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  207. # - HP Cost Settings -
  208. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  209. # New to this script are HP costs. HP costs require the battler to have
  210. # sufficient HP before being able to use the skill. The text colour that's
  211. # used, the suffix, or whether or not to use an icon. If you do not wish
  212. # to use an icon, set the icon to 0.
  213. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  214. HP_COST_COLOUR = 18 # Colour used from "Window" skin.
  215. HP_COST_SIZE = 20 # Font size used for HP costs.
  216. HP_COST_SUFFIX = "%sHP" # Suffix used for HP costs.
  217. HP_COST_ICON = 0 # Icon used for HP costs. Set 0 to disable.
  218.  
  219. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  220. # - MP Cost Settings -
  221. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  222. # Here, you can change the settings for MP costs: the text colour that's
  223. # used, the suffix, or whether or not to use an icon. If you do not wish
  224. # to use an icon, set the icon to 0.
  225. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  226. MP_COST_COLOUR = 1 # Colour used from "Window" skin. Default: 23
  227. MP_COST_SIZE = 20 # Font size used for MP costs. Default: 24
  228. MP_COST_SUFFIX = "%sMP" # Suffix used for MP costs. No suffix default.
  229. MP_COST_ICON = 0 # Icon used for MP costs. Set 0 to disable.
  230.  
  231. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  232. # - TP Cost Settings -
  233. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  234. # Here, you can change the settings for TP costs: the text colour that's
  235. # used, the suffix, or whether or not to use an icon. If you do not wish
  236. # to use an icon, set the icon to 0.
  237. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  238. TP_COST_COLOUR = 11 # Colour used from "Window" skin. Default: 29
  239. TP_COST_SIZE = 20 # Font size used for TP costs. Default: 24
  240. TP_COST_SUFFIX = "%sLust" # Suffix used for TP costs. No suffix default.
  241. TP_COST_ICON = 0 # Icon used for TP costs. Set 0 to disable.
  242.  
  243. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  244. # - Gold Cost Settings -
  245. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  246. # New to this script are Gold costs. Gold costs require the party to have
  247. # enough gold before being able to use the skill. The text colour that's
  248. # used, the suffix, or whether or not to use an icon. If you do not wish
  249. # to use an icon, set the icon to 0.
  250. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  251. GOLD_COST_COLOUR = 6 # Colour used from "Window" skin.
  252. GOLD_COST_SIZE = 20 # Font size used for Gold costs.
  253. GOLD_COST_SUFFIX = "%sGold" # Suffix used for Gold costs.
  254. GOLD_COST_ICON = 0 # Icon used for Gold costs. Set 0 to disable.
  255.  
  256. end # SKILL_COST
  257. end # YEA
  258.  
  259. #==============================================================================
  260. # ▼ Editting anything past this point may potentially result in causing
  261. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  262. # halitosis so edit at your own risk.
  263. #==============================================================================
  264.  
  265. module YEA
  266. module REGEXP
  267. module BASEITEM
  268.  
  269. HP_COST_RATE = /<(?:HP_COST_RATE|hp cost rate):[ ](\d+)([%%])>/i
  270. TP_COST_RATE = /<(?:TP_COST_RATE|tp cost rate):[ ](\d+)([%%])>/i
  271. GOLD_COST_RATE = /<(?:GOLD_COST_RATE|gold cost rate):[ ](\d+)([%%])>/i
  272.  
  273. end # BASEITEM
  274. module SKILL
  275.  
  276. HP_COST_SET = /<(?:HP_COST|hp cost):[ ](\d+)>/i
  277. HP_COST_PER = /<(?:HP_COST|hp cost):[ ](\d+)([%%])>/i
  278. MP_COST_SET = /<(?:MP_COST|mp cost):[ ](\d+)>/i
  279. MP_COST_PER = /<(?:MP_COST|mp cost):[ ](\d+)([%%])>/i
  280. TP_COST_SET = /<(?:TP_COST|tp cost):[ ](\d+)>/i
  281. TP_COST_PER = /<(?:TP_COST|tp cost):[ ](\d+)([%%])>/i
  282. GOLD_COST_SET = /<(?:GOLD_COST|gold cost):[ ](\d+)>/i
  283. GOLD_COST_PER = /<(?:GOLD_COST|gold cost):[ ](\d+)([%%])>/i
  284.  
  285. CUSTOM_COST_TEXT = /<(?:CUSTOM_COST|custom cost):[ ](.*)>/i
  286. CUSTOM_COST_TEXT_EX = /<(?:CUSTOM_COST_EX|custom cost ex):[ ](.*)>/i
  287. CUSTOM_COST_COLOUR =
  288. /<(?:CUSTOM_COST_COLOUR|custom cost colour|custom cost color):[ ](\d+)>/i
  289. CUSTOM_COST_SIZE = /<(?:CUSTOM_COST_SIZE|custom cost size):[ ](\d+)>/i
  290. CUSTOM_COST_ICON = /<(?:CUSTOM_COST_ICON|custom cost icon):[ ](\d+)>/i
  291. CUSTOM_COST_ICON_EX = /<(?:CUSTOM_COST_ICON_EX|custom cost icon ex):[ ](\d+)>/i
  292. CUSTOM_COST_REQUIREMENT_ON =
  293. /<(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  294. CUSTOM_COST_REQUIREMENT_OFF =
  295. /<\/(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  296. CUSTOM_COST_PERFORM_ON =
  297. /<(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  298. CUSTOM_COST_PERFORM_OFF =
  299. /<\/(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  300.  
  301. HP_COST_MIN = /<(?:HP_COST_MIN|hp cost min):[ ](\d+)>/i
  302. HP_COST_MAX = /<(?:HP_COST_MIN|hp cost max):[ ](\d+)>/i
  303. MP_COST_MIN = /<(?:MP_COST_MIN|mp cost min):[ ](\d+)>/i
  304. MP_COST_MAX = /<(?:MP_COST_MIN|mp cost max):[ ](\d+)>/i
  305. TP_COST_MIN = /<(?:TP_COST_MIN|tp cost min):[ ](\d+)>/i
  306. TP_COST_MAX = /<(?:TP_COST_MIN|tp cost max):[ ](\d+)>/i
  307. GOLD_COST_MIN = /<(?:GOLD_COST_MIN|gold cost min):[ ](\d+)>/i
  308. GOLD_COST_MAX = /<(?:GOLD_COST_MIN|gold cost max):[ ](\d+)>/i
  309.  
  310. end # SKILL
  311. end # REGEXP
  312. end # YEA
  313.  
  314. #==============================================================================
  315. # ■ Icon
  316. #==============================================================================
  317.  
  318. module Icon
  319.  
  320. #--------------------------------------------------------------------------
  321. # self.mp_cost
  322. #--------------------------------------------------------------------------
  323. def self.mp_cost; return YEA::SKILL_COST::MP_COST_ICON; end
  324.  
  325. #--------------------------------------------------------------------------
  326. # self.tp_cost
  327. #--------------------------------------------------------------------------
  328. def self.tp_cost; return YEA::SKILL_COST::TP_COST_ICON; end
  329.  
  330. #--------------------------------------------------------------------------
  331. # self.hp_cost
  332. #--------------------------------------------------------------------------
  333. def self.hp_cost; return YEA::SKILL_COST::HP_COST_ICON; end
  334.  
  335. #--------------------------------------------------------------------------
  336. # self.gold_cost
  337. #--------------------------------------------------------------------------
  338. def self.gold_cost; return YEA::SKILL_COST::GOLD_COST_ICON; end
  339.  
  340. end # Icon
  341.  
  342. #==============================================================================
  343. # ■ Numeric
  344. #==============================================================================
  345.  
  346. class Numeric
  347.  
  348. #--------------------------------------------------------------------------
  349. # new method: group_digits
  350. #--------------------------------------------------------------------------
  351. unless $imported["YEA-CoreEngine"]
  352. def group; return self.to_s; end
  353. end # $imported["YEA-CoreEngine"]
  354.  
  355. end # Numeric
  356.  
  357. #==============================================================================
  358. # ■ DataManager
  359. #==============================================================================
  360.  
  361. module DataManager
  362.  
  363. #--------------------------------------------------------------------------
  364. # alias method: load_database
  365. #--------------------------------------------------------------------------
  366. class <<self; alias load_database_scm load_database; end
  367. def self.load_database
  368. load_database_scm
  369. load_notetags_scm
  370. end
  371.  
  372. #--------------------------------------------------------------------------
  373. # new method: load_notetags_scm
  374. #--------------------------------------------------------------------------
  375. def self.load_notetags_scm
  376. groups = [$data_actors, $data_classes, $data_skills, $data_weapons,
  377. $data_armors, $data_enemies, $data_states]
  378. for group in groups
  379. for obj in group
  380. next if obj.nil?
  381. obj.load_notetags_scm
  382. end
  383. end
  384. end
  385.  
  386. end # DataManager
  387.  
  388. #==============================================================================
  389. # ■ RPG::BaseItem
  390. #==============================================================================
  391.  
  392. class RPG::BaseItem
  393.  
  394. #--------------------------------------------------------------------------
  395. # public instance variables
  396. #--------------------------------------------------------------------------
  397. attr_accessor :tp_cost_rate
  398. attr_accessor :hp_cost_rate
  399. attr_accessor :gold_cost_rate
  400.  
  401. #--------------------------------------------------------------------------
  402. # common cache: load_notetags_scm
  403. #--------------------------------------------------------------------------
  404. def load_notetags_scm
  405. @tp_cost_rate = 1.0
  406. @hp_cost_rate = 1.0
  407. @gold_cost_rate = 1.0
  408. #---
  409. self.note.split(/[\r\n]+/).each { |line|
  410. case line
  411. #---
  412. when YEA::REGEXP::BASEITEM::TP_COST_RATE
  413. @tp_cost_rate = $1.to_i * 0.01
  414. when YEA::REGEXP::BASEITEM::HP_COST_RATE
  415. @hp_cost_rate = $1.to_i * 0.01
  416. when YEA::REGEXP::BASEITEM::GOLD_COST_RATE
  417. @gold_cost_rate = $1.to_i * 0.01
  418. #---
  419. end
  420. } # self.note.split
  421. #---
  422. end
  423.  
  424. end # RPG::BaseItem
  425.  
  426. #==============================================================================
  427. # ■ RPG::Skill
  428. #==============================================================================
  429.  
  430. class RPG::Skill < RPG::UsableItem
  431.  
  432. #--------------------------------------------------------------------------
  433. # public instance variables
  434. #--------------------------------------------------------------------------
  435. attr_accessor :hp_cost
  436. attr_accessor :hp_cost_percent
  437. attr_accessor :mp_cost_percent
  438. attr_accessor :tp_cost_percent
  439. attr_accessor :gold_cost
  440. attr_accessor :gold_cost_percent
  441.  
  442. attr_accessor :hp_cost_min
  443. attr_accessor :hp_cost_max
  444. attr_accessor :mp_cost_min
  445. attr_accessor :mp_cost_max
  446. attr_accessor :tp_cost_min
  447. attr_accessor :tp_cost_max
  448. attr_accessor :gold_cost_min
  449. attr_accessor :gold_cost_max
  450.  
  451. attr_accessor :use_custom_cost
  452. attr_accessor :custom_cost_text
  453. attr_accessor :custom_cost_text_ex
  454. attr_accessor :custom_cost_colour
  455. attr_accessor :custom_cost_size
  456. attr_accessor :custom_cost_icon
  457. attr_accessor :custom_cost_icon_ex
  458. attr_accessor :custom_cost_requirement
  459. attr_accessor :custom_cost_perform
  460.  
  461. #--------------------------------------------------------------------------
  462. # common cache: load_notetags_scm
  463. #--------------------------------------------------------------------------
  464. def load_notetags_scm
  465. @hp_cost = 0
  466. @gold_cost = 0
  467. @hp_cost_percent = 0.0
  468. @mp_cost_percent = 0.0
  469. @tp_cost_percent = 0.0
  470. @gold_cost_percent = 0.0
  471.  
  472. @custom_cost_text = "0"
  473. @custom_cost_text_ex = "0"
  474. @custom_cost_colour = 0
  475. @custom_cost_size = 20
  476. @custom_cost_icon = 0
  477. @custom_cost_icon_ex = 0
  478. @custom_cost_requirement = ""
  479. @custom_cost_perform = ""
  480.  
  481. @use_custom_cost = false
  482. @custom_cost_req_on = false
  483. @custom_cost_per_on = false
  484. #---
  485. self.note.split(/[\r\n]+/).each { |line|
  486. case line
  487. #---
  488. when YEA::REGEXP::SKILL::MP_COST_SET
  489. @mp_cost = $1.to_i
  490. when YEA::REGEXP::SKILL::MP_COST_PER
  491. @mp_cost_percent = $1.to_i * 0.01
  492. when YEA::REGEXP::SKILL::TP_COST_SET
  493. @tp_cost = $1.to_i
  494. when YEA::REGEXP::SKILL::TP_COST_PER
  495. @tp_cost_percent = $1.to_i * 0.01
  496. when YEA::REGEXP::SKILL::HP_COST_SET
  497. @hp_cost = $1.to_i
  498. when YEA::REGEXP::SKILL::HP_COST_PER
  499. @hp_cost_percent = $1.to_i * 0.01
  500. when YEA::REGEXP::SKILL::GOLD_COST_SET
  501. @gold_cost = $1.to_i
  502. when YEA::REGEXP::SKILL::GOLD_COST_PER
  503. @gold_cost_percent = $1.to_i * 0.01
  504. #---
  505. when YEA::REGEXP::SKILL::HP_COST_MIN
  506. @hp_cost_min = $1.to_i
  507. when YEA::REGEXP::SKILL::HP_COST_MAX
  508. @hp_cost_max = $1.to_i
  509. when YEA::REGEXP::SKILL::MP_COST_MIN
  510. @mp_cost_min = $1.to_i
  511. when YEA::REGEXP::SKILL::MP_COST_MAX
  512. @mp_cost_max = $1.to_i
  513. when YEA::REGEXP::SKILL::TP_COST_MIN
  514. @tp_cost_min = $1.to_i
  515. when YEA::REGEXP::SKILL::TP_COST_MAX
  516. @tp_cost_max = $1.to_i
  517. when YEA::REGEXP::SKILL::GOLD_COST_MIN
  518. @gold_cost_min = $1.to_i
  519. when YEA::REGEXP::SKILL::GOLD_COST_MAX
  520. @gold_cost_max = $1.to_i
  521. #---
  522. when YEA::REGEXP::SKILL::CUSTOM_COST_TEXT
  523. @custom_cost_text = $1.to_s
  524. when YEA::REGEXP::SKILL::CUSTOM_COST_TEXT_EX
  525. @custom_cost_text_ex = $1.to_s
  526. when YEA::REGEXP::SKILL::CUSTOM_COST_COLOUR
  527. @custom_cost_colour = $1.to_i
  528. when YEA::REGEXP::SKILL::CUSTOM_COST_SIZE
  529. @custom_cost_size = $1.to_i
  530. when YEA::REGEXP::SKILL::CUSTOM_COST_ICON
  531. @custom_cost_icon = $1.to_i
  532. when YEA::REGEXP::SKILL::CUSTOM_COST_ICON_EX
  533. @custom_cost_icon_ex = $1.to_i
  534. when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_ON
  535. @custom_cost_req_on = true
  536. @use_custom_cost = true
  537. when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_OFF
  538. @custom_cost_req_on = false
  539. @use_custom_cost = true
  540. when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_ON
  541. @custom_cost_per_on = true
  542. @use_custom_cost = true
  543. when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_OFF
  544. @custom_cost_per_on = false
  545. @use_custom_cost = true
  546. else
  547. @custom_cost_requirement += line.to_s if @custom_cost_req_on
  548. @custom_cost_perform += line.to_s if @custom_cost_per_on
  549. #---
  550. end
  551. } # self.note.split
  552. #---
  553. end
  554.  
  555. end # RPG::Skill
  556.  
  557. #==============================================================================
  558. # ■ Game_BattlerBase
  559. #==============================================================================
  560.  
  561. class Game_BattlerBase
  562.  
  563. #--------------------------------------------------------------------------
  564. # alias method: skill_cost_payable?
  565. #--------------------------------------------------------------------------
  566. alias game_battlerbase_skill_cost_payable_scm skill_cost_payable?
  567. def skill_cost_payable?(skill)
  568. return false if hp <= skill_hp_cost(skill)
  569. return false unless gold_cost_met?(skill)
  570. return false unless custom_cost_met?(skill)
  571. return game_battlerbase_skill_cost_payable_scm(skill)
  572. end
  573.  
  574. #--------------------------------------------------------------------------
  575. # new method: gold_cost_met?
  576. #--------------------------------------------------------------------------
  577. def gold_cost_met?(skill)
  578. return true unless actor?
  579. return $game_party.gold >= skill_gold_cost(skill)
  580. end
  581.  
  582. #--------------------------------------------------------------------------
  583. # new method: custom_cost_met?
  584. #--------------------------------------------------------------------------
  585. def custom_cost_met?(skill)
  586. return true unless skill.use_custom_cost
  587. return eval(skill.custom_cost_requirement)
  588. end
  589.  
  590. #--------------------------------------------------------------------------
  591. # alias method: pay_skill_cost
  592. #--------------------------------------------------------------------------
  593. alias game_battlerbase_pay_skill_cost_scm pay_skill_cost
  594. def pay_skill_cost(skill)
  595. game_battlerbase_pay_skill_cost_scm(skill)
  596. self.hp -= skill_hp_cost(skill)
  597. $game_party.lose_gold(skill_gold_cost(skill)) if actor?
  598. pay_custom_cost(skill)
  599. end
  600.  
  601. #--------------------------------------------------------------------------
  602. # new method: pay_custom_cost
  603. #--------------------------------------------------------------------------
  604. def pay_custom_cost(skill)
  605. return unless skill.use_custom_cost
  606. eval(skill.custom_cost_perform)
  607. end
  608.  
  609. #--------------------------------------------------------------------------
  610. # alias method: skill_mp_cost
  611. #--------------------------------------------------------------------------
  612. alias game_battlerbase_skill_mp_cost_scm skill_mp_cost
  613. def skill_mp_cost(skill)
  614. n = game_battlerbase_skill_mp_cost_scm(skill)
  615. n += skill.mp_cost_percent * mmp * mcr
  616. n = [n.to_i, skill.mp_cost_max].min unless skill.mp_cost_max.nil?
  617. n = [n.to_i, skill.mp_cost_min].max unless skill.mp_cost_min.nil?
  618. return n.to_i
  619. end
  620.  
  621. #--------------------------------------------------------------------------
  622. # alias method: skill_tp_cost
  623. #--------------------------------------------------------------------------
  624. alias game_battlerbase_skill_tp_cost_scm skill_tp_cost
  625. def skill_tp_cost(skill)
  626. n = game_battlerbase_skill_tp_cost_scm(skill) * tcr_y
  627. n += skill.tp_cost_percent * max_tp * tcr_y
  628. n = [n.to_i, skill.tp_cost_max].min unless skill.tp_cost_max.nil?
  629. n = [n.to_i, skill.tp_cost_min].max unless skill.tp_cost_min.nil?
  630. return n.to_i
  631. end
  632.  
  633. #--------------------------------------------------------------------------
  634. # new method: tcr_y
  635. #--------------------------------------------------------------------------
  636. def tcr_y
  637. n = 1.0
  638. if actor?
  639. n *= self.actor.tp_cost_rate
  640. n *= self.class.tp_cost_rate
  641. for equip in equips
  642. next if equip.nil?
  643. n *= equip.tp_cost_rate
  644. end
  645. else
  646. n *= self.enemy.tp_cost_rate
  647. if $imported["YEA-Doppelganger"] && !self.class.nil?
  648. n *= self.class.tp_cost_rate
  649. end
  650. end
  651. for state in states
  652. next if state.nil?
  653. n *= state.tp_cost_rate
  654. end
  655. return n
  656. end
  657.  
  658. #--------------------------------------------------------------------------
  659. # new method: skill_hp_cost
  660. #--------------------------------------------------------------------------
  661. def skill_hp_cost(skill)
  662. n = skill.hp_cost * hcr
  663. n += skill.hp_cost_percent * mhp * hcr
  664. n = [n.to_i, skill.hp_cost_max].min unless skill.hp_cost_max.nil?
  665. n = [n.to_i, skill.hp_cost_min].max unless skill.hp_cost_min.nil?
  666. return n.to_i
  667. end
  668.  
  669. #--------------------------------------------------------------------------
  670. # new method: hcr
  671. #--------------------------------------------------------------------------
  672. def hcr
  673. n = 1.0
  674. if actor?
  675. n *= self.actor.hp_cost_rate
  676. n *= self.class.hp_cost_rate
  677. for equip in equips
  678. next if equip.nil?
  679. n *= equip.hp_cost_rate
  680. end
  681. else
  682. n *= self.enemy.hp_cost_rate
  683. if $imported["YEA-Doppelganger"] && !self.class.nil?
  684. n *= self.class.hp_cost_rate
  685. end
  686. end
  687. for state in states
  688. next if state.nil?
  689. n *= state.hp_cost_rate
  690. end
  691. return n
  692. end
  693.  
  694. #--------------------------------------------------------------------------
  695. # new method: skill_gold_cost
  696. #--------------------------------------------------------------------------
  697. def skill_gold_cost(skill)
  698. n = skill.gold_cost * gcr
  699. n += skill.gold_cost_percent * $game_party.gold * gcr
  700. n = [n.to_i, skill.gold_cost_max].min unless skill.gold_cost_max.nil?
  701. n = [n.to_i, skill.gold_cost_min].max unless skill.gold_cost_min.nil?
  702. return n.to_i
  703. end
  704.  
  705. #--------------------------------------------------------------------------
  706. # new method: gcr
  707. #--------------------------------------------------------------------------
  708. def gcr
  709. n = 1.0
  710. n *= self.actor.gold_cost_rate
  711. n *= self.class.gold_cost_rate
  712. for equip in equips
  713. next if equip.nil?
  714. n *= equip.gold_cost_rate
  715. end
  716. for state in states
  717. next if state.nil?
  718. n *= state.gold_cost_rate
  719. end
  720. return n
  721. end
  722.  
  723. end # Game_BattlerBase
  724.  
  725. #==============================================================================
  726. # ■ Window_Base
  727. #==============================================================================
  728.  
  729. class Window_Base < Window
  730.  
  731. #--------------------------------------------------------------------------
  732. # overwrite methods: cost_colours
  733. #--------------------------------------------------------------------------
  734. def mp_cost_color; text_color(YEA::SKILL_COST::MP_COST_COLOUR); end;
  735. def tp_cost_color; text_color(YEA::SKILL_COST::TP_COST_COLOUR); end;
  736. def hp_cost_color; text_color(YEA::SKILL_COST::HP_COST_COLOUR); end;
  737. def gold_cost_color; text_color(YEA::SKILL_COST::GOLD_COST_COLOUR); end;
  738.  
  739. end # Window_Base
  740.  
  741. #==============================================================================
  742. # ■ Window_SkillList
  743. #==============================================================================
  744.  
  745. class Window_SkillList < Window_Selectable
  746.  
  747. #--------------------------------------------------------------------------
  748. # overwrite method: draw_skill_cost
  749. #--------------------------------------------------------------------------
  750. def draw_skill_cost(rect, skill)
  751. draw_tp_skill_cost(rect, skill) unless $imported["YEA-BattleEngine"]
  752. draw_mp_skill_cost(rect, skill)
  753. draw_tp_skill_cost(rect, skill) if $imported["YEA-BattleEngine"]
  754. draw_hp_skill_cost(rect, skill)
  755. draw_gold_skill_cost(rect, skill)
  756. draw_custom_skill_cost(rect, skill)
  757. end
  758.  
  759. #--------------------------------------------------------------------------
  760. # new method: draw_mp_skill_cost
  761. #--------------------------------------------------------------------------
  762. def draw_mp_skill_cost(rect, skill)
  763. return unless @actor.skill_mp_cost(skill) > 0
  764. change_color(mp_cost_color, enable?(skill))
  765. #---
  766. icon = Icon.mp_cost
  767. if icon > 0
  768. draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  769. rect.width -= 24
  770. end
  771. #---
  772. contents.font.size = YEA::SKILL_COST::MP_COST_SIZE
  773. cost = @actor.skill_mp_cost(skill)
  774. text = sprintf(YEA::SKILL_COST::MP_COST_SUFFIX, cost.group)
  775. draw_text(rect, text, 2)
  776. cx = text_size(text).width + 4
  777. rect.width -= cx
  778. reset_font_settings
  779. end
  780.  
  781. #--------------------------------------------------------------------------
  782. # new method: draw_tp_skill_cost
  783. #--------------------------------------------------------------------------
  784. def draw_tp_skill_cost(rect, skill)
  785. return unless @actor.skill_tp_cost(skill) > 0
  786. change_color(tp_cost_color, enable?(skill))
  787. #---
  788. icon = Icon.tp_cost
  789. if icon > 0
  790. draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  791. rect.width -= 24
  792. end
  793. #---
  794. contents.font.size = YEA::SKILL_COST::TP_COST_SIZE
  795. cost = @actor.skill_tp_cost(skill)
  796. text = sprintf(YEA::SKILL_COST::TP_COST_SUFFIX, cost.group)
  797. draw_text(rect, text, 2)
  798. cx = text_size(text).width + 4
  799. rect.width -= cx
  800. reset_font_settings
  801. end
  802.  
  803. #--------------------------------------------------------------------------
  804. # new method: draw_hp_skill_cost
  805. #--------------------------------------------------------------------------
  806. def draw_hp_skill_cost(rect, skill)
  807. return unless @actor.skill_hp_cost(skill) > 0
  808. change_color(hp_cost_color, enable?(skill))
  809. #---
  810. icon = Icon.hp_cost
  811. if icon > 0
  812. draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  813. rect.width -= 24
  814. end
  815. #---
  816. contents.font.size = YEA::SKILL_COST::HP_COST_SIZE
  817. cost = @actor.skill_hp_cost(skill)
  818. text = sprintf(YEA::SKILL_COST::HP_COST_SUFFIX, cost.group)
  819. draw_text(rect, text, 2)
  820. cx = text_size(text).width + 4
  821. rect.width -= cx
  822. reset_font_settings
  823. end
  824.  
  825. #--------------------------------------------------------------------------
  826. # new method: draw_gold_skill_cost
  827. #--------------------------------------------------------------------------
  828. def draw_gold_skill_cost(rect, skill)
  829. return unless @actor.skill_gold_cost(skill) > 0
  830. change_color(gold_cost_color, enable?(skill))
  831. #---
  832. icon = Icon.gold_cost
  833. if icon > 0
  834. draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  835. rect.width -= 24
  836. end
  837. #---
  838. contents.font.size = YEA::SKILL_COST::GOLD_COST_SIZE
  839. cost = @actor.skill_gold_cost(skill)
  840. text = sprintf(YEA::SKILL_COST::GOLD_COST_SUFFIX, cost.group)
  841. draw_text(rect, text, 2)
  842. cx = text_size(text).width + 4
  843. rect.width -= cx
  844. reset_font_settings
  845. end
  846.  
  847. #--------------------------------------------------------------------------
  848. # new method: draw_custom_skill_cost
  849. #--------------------------------------------------------------------------
  850. def draw_custom_skill_cost(rect, skill)
  851. return unless skill.use_custom_cost
  852. change_color(text_color(skill.custom_cost_colour), enable?(skill))
  853. icon = skill.custom_cost_icon
  854. if icon > 0
  855. draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  856. rect.width -= 24
  857. end
  858. contents.font.size = skill.custom_cost_size
  859. text = skill.custom_cost_text
  860. draw_text(rect, text, 2)
  861. cx = text_size(text).width + 4
  862. rect.width -= cx
  863. icon_ex = skill.custom_cost_icon_ex
  864. if icon_ex > 0
  865. draw_icon(icon_ex, rect.x + rect.width-24, rect.y, enable?(skill))
  866. rect.width -= 24
  867. end
  868. text_ex = skill.custom_cost_text_ex
  869. draw_text(rect, text_ex, 2)
  870. cx = text_size(text_ex).width + 4
  871. rect.width -= cx
  872. reset_font_settings
  873. end
  874.  
  875. end # Window_SkillList
  876.  
  877. #==============================================================================
  878. #
  879. # ▼ End of File
  880. #
  881. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment