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

Project1

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

[已经解决] 怎么选择技能来学习

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2013-11-9
帖子
28
跳转到指定楼层
1
发表于 2013-11-25 13:37:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如题。(就是给你所有技能,你来选一项学习。)

Lv3.寻梦者

梦石
0
星屑
3298
在线时间
1120 小时
注册时间
2009-4-15
帖子
815
2
发表于 2013-11-25 14:03:59 | 只看该作者
事件就能实现,事件里的选择,选择哪项,就学会XXX技能即可。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
243
在线时间
341 小时
注册时间
2010-9-5
帖子
70
3
发表于 2013-11-25 14:04:31 | 只看该作者
本帖最后由 76213585 于 2013-11-29 18:28 编辑

这三个脚本分别加入到main之前 然后按照说明使用
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Skill Menu v1.01
  4. # -- Last Updated: 2012.01.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SkillMenu"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.08 - Compatibility Update: Learn Skill Engine
  17. # 2012.01.02 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This is a menu reordering script for the Skill Menu for RPG Maker VX Ace. The
  23. # script lets you add, remove, and rearrange skill menu additions added by
  24. # other scripts. This script will update periodically to provide better updated
  25. # compatibility with those other scripts.
  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. # Adjust the module's settings to adjust the skill command window.
  34. #
  35. #==============================================================================
  36. # ▼ Compatibility
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  39. # it will run with RPG Maker VX without adjusting.
  40. #
  41. #==============================================================================
  42.  
  43. module YEA
  44.   module SKILL_MENU
  45.  
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     # - Command Window Settings -
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.     # Adjust the command window that appears in the skill command window. Add,
  50.     # remove, or rearrange the commands as you see fit. If you would like to
  51.     # add in custom commands, please refer to the custom hash. Here's a list of
  52.     # what does what:
  53.     #
  54.     # -------------------------------------------------------------------------
  55.     # :command         Description
  56.     # -------------------------------------------------------------------------
  57.     # :stype_list      Displays all of the actor's usable skill types.
  58.     #
  59.     # :tp_mode         Requires YEA - TP Manager
  60.     # :learn_skill     Requires YEA - Learn Skill Engine
  61.     #
  62.     # :grathnode       Requires Kread-EX - Grathnode Install
  63.     # :sslots          Requires YSA - Slots Battle
  64.     #
  65.     # And that's all of the currently available commands. This list will be
  66.     # updated as more scripts become available.
  67.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  68.     COMMANDS =[
  69.       :stype_list,   # Displays all of the actor's usable skill types.
  70.       :learn_skill,  # Requires YEA - Learn Skill Engine
  71.       :tp_mode,      # Requires YEA - TP Manager
  72.       :grathnode,    # Requires Kread-EX - Grathnode Install
  73.       :sslots,       # Requires YSA - Slots Battle.
  74.     # :custom1,      # Custom Skill Command 1
  75.     # :custom2,      # Custom Skill Command 2
  76.     ] # Do not remove this.
  77.  
  78.     #--------------------------------------------------------------------------
  79.     # - Skill Custom Commands -
  80.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  81.     # For those who use scripts to that may produce unique effects for
  82.     # equipping, use this hash to manage the custom commands for the Skill
  83.     # Command Window. You can disable certain commands or prevent them from
  84.     # appearing by using switches. If you don't wish to bind them to a switch,
  85.     # set the proper switch to 0 for it to have no impact.
  86.     #--------------------------------------------------------------------------
  87.     CUSTOM_SKILL_COMMANDS ={
  88.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  89.       :grathnode => ["Grathnodes",            0,          0, :command_grath],
  90.       :sslots  => [  "Pick Slots",            0,          0, :command_sslot],
  91.       :custom1 => [ "Custom Name",            0,          0, :command_name1],
  92.       :custom2 => [ "Custom Text",           13,          0, :command_name2],
  93.     } # Do not remove this.
  94.  
  95.   end # SKILL_MENU
  96. end # YEA
  97.  
  98. #==============================================================================
  99. # ▼ Editting anything past this point may potentially result in causing
  100. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  101. # halitosis so edit at your own risk.
  102. #==============================================================================
  103.  
  104. #==============================================================================
  105. # ■ Game_Temp
  106. #==============================================================================
  107.  
  108. class Game_Temp
  109.  
  110.   #--------------------------------------------------------------------------
  111.   # public instance variables
  112.   #--------------------------------------------------------------------------
  113.   attr_accessor :scene_skill_index
  114.   attr_accessor :scene_skill_oy
  115.  
  116. end # Game_Temp
  117.  
  118. #==============================================================================
  119. # ■ Window_SkillCommand
  120. #==============================================================================
  121.  
  122. class Window_SkillCommand < Window_Command
  123.  
  124.   #--------------------------------------------------------------------------
  125.   # alias method: make_command_list
  126.   #--------------------------------------------------------------------------
  127.   alias window_skillcommand_make_command_list_asm make_command_list
  128.   def make_command_list
  129.     unless SceneManager.scene_is?(Scene_Skill)
  130.       window_skillcommand_make_command_list_asm
  131.       return
  132.     end
  133.     return unless @actor
  134.     for command in YEA::SKILL_MENU::COMMANDS
  135.       case command
  136.       #--- Imported YEA ---
  137.       when :stype_list
  138.         add_skill_types
  139.       #--- Imported YEA ---
  140.       when :tp_mode
  141.         next unless $imported["YEA-TPManager"]
  142.         add_tp_modes
  143.       when :learn_skill
  144.         next unless $imported["YEA-LearnSkillEngine"]
  145.         add_learn_skill_command
  146.       #--- Imported Other ---
  147.       when :grathnode
  148.         next unless $imported["KRX-GrathnodeInstall"]
  149.         process_custom_command(command)
  150.       when :sslots
  151.         next unless $imported["YSA-SlotBattle"]
  152.         process_custom_command(command)
  153.       #--- Custom Commands ---
  154.       else
  155.         process_custom_command(command)
  156.       end
  157.     end
  158.   end
  159.  
  160.   #--------------------------------------------------------------------------
  161.   # new method: add_skill_types
  162.   #--------------------------------------------------------------------------
  163.   def add_skill_types
  164.     @actor.added_skill_types.each do |stype_id|
  165.       name = $data_system.skill_types[stype_id]
  166.       add_command(name, :skill, true, stype_id)
  167.     end
  168.   end
  169.  
  170.   #--------------------------------------------------------------------------
  171.   # new method: process_custom_command
  172.   #--------------------------------------------------------------------------
  173.   def process_custom_command(command)
  174.     return unless YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS.include?(command)
  175.     show = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][2]
  176.     continue = show <= 0 ? true : $game_switches[show]
  177.     return unless continue
  178.     text = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][0]
  179.     switch = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][1]
  180.     enabled = switch <= 0 ? true : $game_switches[switch]
  181.     add_command(text, command, enabled, @actor.added_skill_types[0])
  182.   end
  183.  
  184.   #--------------------------------------------------------------------------
  185.   # new method: process_ok
  186.   #--------------------------------------------------------------------------
  187.   def process_ok
  188.     if SceneManager.scene_is?(Scene_Skill)
  189.       $game_temp.scene_skill_index = index
  190.       $game_temp.scene_skill_oy = self.oy
  191.     end
  192.     super
  193.   end
  194.  
  195. end # Window_SkillCommand
  196.  
  197. #==============================================================================
  198. # ■ Scene_Skill
  199. #==============================================================================
  200.  
  201. class Scene_Skill < Scene_ItemBase
  202.  
  203.   #--------------------------------------------------------------------------
  204.   # alias method: create_command_window
  205.   #--------------------------------------------------------------------------
  206.   alias scene_skill_create_command_window_asm create_command_window
  207.   def create_command_window
  208.     scene_skill_create_command_window_asm
  209.     if !$game_temp.scene_skill_index.nil? && SceneManager.scene_is?(Scene_Skill)
  210.       @command_window.select($game_temp.scene_skill_index)
  211.       @command_window.oy = $game_temp.scene_skill_oy
  212.     end
  213.     $game_temp.scene_skill_index = nil
  214.     $game_temp.scene_skill_oy = nil
  215.     process_custom_skill_commands
  216.   end
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # new method: process_custom_skill_commands
  220.   #--------------------------------------------------------------------------
  221.   def process_custom_skill_commands
  222.     for command in YEA::SKILL_MENU::COMMANDS
  223.       next unless YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS.include?(command)
  224.       called_method = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][3]
  225.       @command_window.set_handler(command, method(called_method))
  226.     end
  227.   end
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # new method: command_grath
  231.   #--------------------------------------------------------------------------
  232.   def command_grath
  233.     SceneManager.call(Scene_Grathnode)
  234.   end
  235.  
  236.   #--------------------------------------------------------------------------
  237.   # new method: command_sslot
  238.   #--------------------------------------------------------------------------
  239.   def command_sslot
  240.     SceneManager.call(Scene_PickSlots)
  241.   end
  242.  
  243.   #--------------------------------------------------------------------------
  244.   # new method: command_name1
  245.   #--------------------------------------------------------------------------
  246.   def command_name1
  247.     # Do nothing.
  248.   end
  249.  
  250.   #--------------------------------------------------------------------------
  251.   # new method: command_name2
  252.   #--------------------------------------------------------------------------
  253.   def command_name2
  254.     # Do nothing.
  255.   end
  256.  
  257. end # Scene_Skill
  258.  
  259. #==============================================================================
  260. #
  261. # ▼ End of File
  262. #
  263. #==============================================================================
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Learn Skill Engine v1.00
  4. # -- Last Updated: 2012.01.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-LearnSkillEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.08 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # For those who want an alternative for actors to learn skills outside of
  22. # leveling, this script allows actors to learn skills through a learn skill
  23. # menu. The actor can use acquired JP, EXP, or Gold to learn skills. Skills can
  24. # also be hidden until certain requirements are met.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Class Notetags - These notetags go in the class notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <learn skills: x>
  36. # <learn skills: x, x>
  37. # Sets the class to be able to learn skills x through the Learn Skills menu.
  38. # Insert multiple of these tags to increase the number of skills learned.
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Skill Notetags - These notetags go in the skill notebox in the database.
  42. # -----------------------------------------------------------------------------
  43. # <learn cost: x jp>
  44. # <learn cost: x exp>
  45. # <learn cost: x gold>
  46. # Sets the learn for cost the skill to require x amounts of JP, x amounts of
  47. # exp, or x amounts of gold. Only one type of cost can be used at a time. For
  48. # JP costs, the Yanfly Engine Ace - JP Manager script must be installed.
  49. #
  50. # <learn require level: x>
  51. # Sets the skill to require the actor's current level to be x before the skill
  52. # will show up in the skill learning window.
  53. #
  54. # <learn require skill: x>
  55. # <learn require skill: x, x>
  56. # Sets the skill to require learning skill x (through any means) before the
  57. # skill becomes visible in the skill learning window. Insert multiples of these
  58. # tags to require more skills to be learned in order for the skill to show.
  59. #
  60. # <learn require switch: x>
  61. # <learn require switch: x, x>
  62. # Sets the skill to require switch x to be ON in order for it to show in the
  63. # skill learning window. Insert multiple switches to to increase the number of
  64. # switches needed to be ON before the skill is shown.
  65. #
  66. # <learn require eval>
  67. #  string
  68. #  string
  69. # </learn require eval>
  70. # For the more advanced users, replace string with lines of code to check for
  71. # whether or not the skill will be shown in skill learning window. If multiple
  72. # lines are used, they are all considered part of the same line.
  73. #
  74. #==============================================================================
  75. # ▼ Compatibility
  76. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  77. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  78. # it will run with RPG Maker VX without adjusting.
  79. #
  80. # This script is compatible with Yanfly Engine Ace - JP Manager v1.00+. The
  81. # placement of this script relative to the JP Manager script doesn't matter.
  82. #
  83. #==============================================================================
  84.  
  85. module YEA
  86.   module LEARN_SKILL
  87.  
  88.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  89.     # - General Settings -
  90.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  91.     # Adjust the general settings here for your game. These adjust how the
  92.     # command name appears, a switch to show the Learn Command
  93.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  94.     COMMAND_NAME = "学习技能"    # Name used for Learn Skill command.
  95.  
  96.     # This switch will hide the "Learn" command from view if the switch is OFF.
  97.     # The "Learn" command will be shown if the switch is ON. Set this switch to
  98.     # 0 to not use this effect and to always have the Learn command be shown.
  99.     SHOW_SWITCH   = 0
  100.  
  101.     # This adjusts the order the Skill Types appear in for the command window.
  102.     # Any Skill Types unlisted will not be shown.
  103.     STYPE_ORDER = [41..999, 1..40]
  104.  
  105.     # For those who installed Yanfly Engine - Skill Restrictions, you can
  106.     # choose to display warmups or cooldowns inside of the menu here.
  107.     DRAW_WARMUP   = true        # Draw warmups for skills?
  108.     DRAW_COOLDOWN = true        # Draw cooldowns for skills?
  109.  
  110.     #-------------------------------------------------------------------------
  111.     # - Default Cost -
  112.     #-------------------------------------------------------------------------
  113.     # This sets the default costs for all skills. If the JP script isn't
  114.     # installed, the type will become :exp instead.
  115.     #
  116.     # Cost Type       Description
  117.     #  :jp            - Requires YEA - JP Manager.
  118.     #  :exp           - Makes skill cost EXP.
  119.     #  :gold          - Makes skill cost gold.
  120.     #-------------------------------------------------------------------------
  121.     DEFAULT_COST = 100          # Sets the default cost of a skill.
  122.     DEFAULT_TYPE = :jp          # Sets the default cost type.
  123.  
  124.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  125.     # - Learn Window Settings -
  126.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  127.     # These settings adjust the Learn Window's visual appearance. Adjust the
  128.     # way empty text appears, EXP cost suffixes appear, Learned text appears,
  129.     # font sizes, and cost colours here.
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     EMPTY_TEXT     = "-"        # Text if no restricts used for the skill.
  132.     EXP_TEXT       = "EXP"      # Text used for EXP costs.
  133.     LEARNED_TEXT   = "领悟"  # Text to indicate skill has been learned.
  134.     LEARNED_SIZE   = 20         # Font size used for learned skill text.
  135.     COLOUR_JP      = 24         # Text colour used for JP Cost.
  136.     COLOUR_EXP     =  5         # Text colour used for EXP Cost.
  137.     COLOUR_GOLD    = 21         # Text colour used for Gold Cost.
  138.     COST_SIZE      = 20         # Font size used for skill costs.
  139.  
  140.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  141.     # - Cost Window Settings -
  142.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  143.     # When a skill is selected to be learned, the cost window appears. Adjust
  144.     # the settings here to choose how your game's cost window looks. Change the
  145.     # maximum number of rows, the gold icon used for gold costs, the gold text,
  146.     # the learn skill text, the cancel text, and the cancel icon here.
  147.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  148.     MAXIMUM_ROWS      = 8               # Maximum number of rows displayed.
  149.     GOLD_ICON         = 361             # Icon used for gold costs.
  150.     GOLD_TEXT         = "金币"     # Text used for gold costs.
  151.     LEARN_SKILL_TEXT  = "学习 %s?"     # Text used to learn skill.
  152.     LEARN_CANCEL_TEXT = "放弃"        # Text used for do not learn.
  153.     CANCEL_ICON       = 187             # Icon used for cancel.
  154.  
  155.   end # LEARN_SKILL
  156. end # YEA
  157.  
  158. #==============================================================================
  159. # ▼ Editting anything past this point may potentially result in causing
  160. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  161. # halitosis so edit at your own risk.
  162. #==============================================================================
  163.  
  164. module YEA
  165.   module LEARN_SKILL
  166.     module_function
  167.     #--------------------------------------------------------------------------
  168.     # convert_integer_array
  169.     #--------------------------------------------------------------------------
  170.     def convert_integer_array(array)
  171.       result = []
  172.       array.each { |i|
  173.         case i
  174.         when Range; result |= i.to_a
  175.         when Integer; result |= [i]
  176.         end }
  177.       return result
  178.     end
  179.     #--------------------------------------------------------------------------
  180.     # converted_contants
  181.     #--------------------------------------------------------------------------
  182.     STYPE_ORDER = convert_integer_array(STYPE_ORDER)
  183.   end # LEARN_SKILL
  184.   module REGEXP
  185.   module CLASS
  186.  
  187.     LEARN_SKILLS = /<(?:LEARN_SKILLS|learn skills):[ ](\d+(?:\s*,\s*\d+)*)>/i
  188.  
  189.   end # CLASS
  190.   module SKILL
  191.  
  192.     LEARN_COST = /<(?:LEARN_COST|learn cost):[ ](.*)>/i
  193.     LEARN_REQUIRE_LEVEL =
  194.       /<(?:LEARN_REQUIRE_LEVEL|learn require level):[ ](\d+)>/i
  195.     LEARN_REQUIRE_SKILL =
  196.       /<(?:LEARN_REQUIRE_SKILL|learn require skill):[ ](\d+(?:\s*,\s*\d+)*)>/i
  197.     LEARN_REQUIRE_SWITCH =
  198.       /<(?:LEARN_REQUIRE_SWITCH|learn require switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  199.     LEARN_REQUIRE_EVAL_ON  = /<(?:LEARN_REQUIRE_EVAL|learn require eval)>/i
  200.     LEARN_REQUIRE_EVAL_OFF = /<\/(?:LEARN_REQUIRE_EVAL|learn require eval)>/i
  201.  
  202.   end # SKILL
  203.   end # REGEXP
  204. end # YEA
  205.  
  206. #==============================================================================
  207. # ■ Numeric
  208. #==============================================================================
  209.  
  210. class Numeric
  211.  
  212.   #--------------------------------------------------------------------------
  213.   # new method: group_digits
  214.   #--------------------------------------------------------------------------
  215.   unless $imported["YEA-CoreEngine"]
  216.   def group; return self.to_s; end
  217.   end # $imported["YEA-CoreEngine"]
  218.  
  219. end # Numeric
  220.  
  221. #==============================================================================
  222. # ■ Icon
  223. #==============================================================================
  224.  
  225. module Icon
  226.  
  227.   #--------------------------------------------------------------------------
  228.   # self.cancel
  229.   #--------------------------------------------------------------------------
  230.   def self.cancel
  231.     return YEA::LEARN_SKILL::CANCEL_ICON
  232.   end
  233.  
  234.   #--------------------------------------------------------------------------
  235.   # self.learn_skill_gold
  236.   #--------------------------------------------------------------------------
  237.   def self.learn_skill_gold
  238.     return YEA::LEARN_SKILL::GOLD_ICON
  239.   end
  240.  
  241. end # Icon
  242.  
  243. #==============================================================================
  244. # ■ Switch
  245. #==============================================================================
  246.  
  247. module Switch
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # self.show_learn_skill
  251.   #--------------------------------------------------------------------------
  252.   def self.show_learn_skill
  253.     return true if YEA::LEARN_SKILL::SHOW_SWITCH <= 0
  254.     return $game_switches[YEA::LEARN_SKILL::SHOW_SWITCH]
  255.   end
  256.  
  257. end # Switch
  258.  
  259. #==============================================================================
  260. # ■ DataManager
  261. #==============================================================================
  262.  
  263. module DataManager
  264.  
  265.   #--------------------------------------------------------------------------
  266.   # alias method: load_database
  267.   #--------------------------------------------------------------------------
  268.   class <<self; alias load_database_lse load_database; end
  269.   def self.load_database
  270.     load_database_lse
  271.     load_notetags_lse
  272.   end
  273.  
  274.   #--------------------------------------------------------------------------
  275.   # new method: load_notetags_lse
  276.   #--------------------------------------------------------------------------
  277.   def self.load_notetags_lse
  278.     groups = [$data_classes, $data_skills]
  279.     for group in groups
  280.       for obj in group
  281.         next if obj.nil?
  282.         obj.load_notetags_lse
  283.       end
  284.     end
  285.   end
  286.  
  287. end # DataManager
  288.  
  289. #==============================================================================
  290. # ■ RPG::Class
  291. #==============================================================================
  292.  
  293. class RPG::Class < RPG::BaseItem
  294.  
  295.   #--------------------------------------------------------------------------
  296.   # public instance variables
  297.   #--------------------------------------------------------------------------
  298.   attr_accessor :learn_skills
  299.  
  300.   #--------------------------------------------------------------------------
  301.   # common cache: load_notetags_lse
  302.   #--------------------------------------------------------------------------
  303.   def load_notetags_lse
  304.     @learn_skills = []
  305.     #---
  306.     self.note.split(/[\r\n]+/).each { |line|
  307.       case line
  308.       #---
  309.       when YEA::REGEXP::CLASS::LEARN_SKILLS
  310.         $1.scan(/\d+/).each { |num|
  311.         @learn_skills.push(num.to_i) if num.to_i > 0 }
  312.       end
  313.     } # self.note.split
  314.     #---
  315.   end
  316.  
  317. end # RPG::Class
  318.  
  319. #==============================================================================
  320. # ■ RPG::Skill
  321. #==============================================================================
  322.  
  323. class RPG::Skill < RPG::UsableItem
  324.  
  325.   #--------------------------------------------------------------------------
  326.   # public instance variables
  327.   #--------------------------------------------------------------------------
  328.   attr_accessor :learn_cost
  329.   attr_accessor :learn_require_level
  330.   attr_accessor :learn_require_skill
  331.   attr_accessor :learn_require_switch
  332.   attr_accessor :learn_require_eval
  333.  
  334.   #--------------------------------------------------------------------------
  335.   # common cache: load_notetags_lse
  336.   #--------------------------------------------------------------------------
  337.   def load_notetags_lse
  338.     @learn_cost = [YEA::LEARN_SKILL::DEFAULT_COST]
  339.     @learn_cost.push(YEA::LEARN_SKILL::DEFAULT_TYPE)
  340.     @learn_require_level = 0
  341.     @learn_require_skill = []
  342.     @learn_require_switch = []
  343.     @learn_require_eval_on = false
  344.     #---
  345.     self.note.split(/[\r\n]+/).each { |line|
  346.       case line
  347.       #---
  348.       when YEA::REGEXP::SKILL::LEARN_COST
  349.         case $1.upcase
  350.         when /(\d+)[ ]JP/i
  351.           next unless $imported["YEA-JPManager"]
  352.           @learn_cost = [$1.to_i, :jp]
  353.         when /(\d+)[ ]EXP/i
  354.           @learn_cost = [$1.to_i, :exp]
  355.         when /(\d+)[ ]GOLD/i
  356.           @learn_cost = [$1.to_i, :gold]
  357.         end
  358.       #---
  359.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_LEVEL
  360.         @learn_require_level = $1.to_i
  361.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_SKILL
  362.         $1.scan(/\d+/).each { |num|
  363.         @learn_require_skill.push(num.to_i) if num.to_i > 0 }
  364.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_SWITCH
  365.         $1.scan(/\d+/).each { |num|
  366.         @learn_require_switch.push(num.to_i) if num.to_i > 0 }
  367.       #---
  368.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_EVAL_ON
  369.         @learn_require_eval_on = true
  370.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_EVAL_OFF
  371.         @learn_require_eval_on = false
  372.       else
  373.         next unless @learn_require_eval_on
  374.         @learn_require_eval = "" if @learn_require_eval.nil?
  375.         @learn_require_eval += line.to_s
  376.       #---
  377.       end
  378.     } # self.note.split
  379.     #---
  380.     if !$imported["YEA-JPManager"] && @learn_cost[1] == :jp
  381.       @learn_cost[1] = :exp
  382.     end
  383.   end
  384.  
  385. end # RPG::Skill
  386.  
  387. #==============================================================================
  388. # ■ Game_Actor
  389. #==============================================================================
  390.  
  391. class Game_Actor < Game_Battler
  392.  
  393.   #--------------------------------------------------------------------------
  394.   # alias method: skills
  395.   #--------------------------------------------------------------------------
  396.   alias game_actor_skills_lse skills
  397.   def skills
  398.     btest_add_learn_skills
  399.     game_actor_skills_lse
  400.   end
  401.  
  402.   #--------------------------------------------------------------------------
  403.   # new method: btest_add_learn_skills
  404.   #--------------------------------------------------------------------------
  405.   def btest_add_learn_skills
  406.     return unless $BTEST
  407.     for skill_id in self.class.learn_skills; learn_skill(skill_id); end
  408.   end
  409.  
  410.   #--------------------------------------------------------------------------
  411.   # new method: exp_class
  412.   #--------------------------------------------------------------------------
  413.   def exp_class(class_id)
  414.     @exp[class_id] = 0 if @exp[class_id].nil?
  415.     return @exp[class_id]
  416.   end
  417.  
  418.   #--------------------------------------------------------------------------
  419.   # lose_exp_class
  420.   #--------------------------------------------------------------------------
  421.   def lose_exp_class(value, class_id)
  422.     exp = exp_class(class_id) - value
  423.     change_exp_class(exp, class_id)
  424.   end
  425.  
  426.   #--------------------------------------------------------------------------
  427.   # change_exp_class
  428.   #--------------------------------------------------------------------------
  429.   def change_exp_class(exp, class_id)
  430.     return change_exp(exp, false) if class_id == @class_id
  431.     @exp[class_id] = [exp, 0].max
  432.   end
  433.  
  434. end # Game_Actor
  435.  
  436. #==============================================================================
  437. # ■ Window_SkillCommand
  438. #==============================================================================
  439.  
  440. class Window_SkillCommand < Window_Command
  441.  
  442.   #--------------------------------------------------------------------------
  443.   # alias method: make_command_list
  444.   #--------------------------------------------------------------------------
  445.   alias window_skillcommand_make_command_list_lse make_command_list
  446.   def make_command_list
  447.     window_skillcommand_make_command_list_lse
  448.     return if @actor.nil?
  449.     add_learn_skill_command unless $imported["YEA-SkillMenu"]
  450.   end
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # new method: add_learn_skill_command
  454.   #--------------------------------------------------------------------------
  455.   def add_learn_skill_command
  456.     return unless Switch.show_learn_skill
  457.     name = YEA::LEARN_SKILL::COMMAND_NAME
  458.     add_command(name, :learn_skill, true, @actor.added_skill_types[0])
  459.   end
  460.  
  461. end # Window_SkillCommand
  462.  
  463. #==============================================================================
  464. # ■ Window_LearnSkillCommand
  465. #==============================================================================
  466.  
  467. class Window_LearnSkillCommand < Window_Command
  468.  
  469.   #--------------------------------------------------------------------------
  470.   # public instance variables
  471.   #--------------------------------------------------------------------------
  472.   attr_reader   :skill_window
  473.  
  474.   #--------------------------------------------------------------------------
  475.   # initialize
  476.   #--------------------------------------------------------------------------
  477.   def initialize(dx, dy)
  478.     super(dx, dy)
  479.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  480.   end
  481.  
  482.   #--------------------------------------------------------------------------
  483.   # window_width
  484.   #--------------------------------------------------------------------------
  485.   def window_width; return 160; end
  486.  
  487.   #--------------------------------------------------------------------------
  488.   # visible_line_number
  489.   #--------------------------------------------------------------------------
  490.   def visible_line_number; return 4; end
  491.  
  492.   #--------------------------------------------------------------------------
  493.   # actor=
  494.   #--------------------------------------------------------------------------
  495.   def actor=(actor)
  496.     return if [url=home.php?mod=space&uid=95897]@actor[/url] == actor
  497.     @actor = actor
  498.     refresh
  499.     select(item_max - 1) if index >= item_max
  500.   end
  501.  
  502.   #--------------------------------------------------------------------------
  503.   # make_command_list
  504.   #--------------------------------------------------------------------------
  505.   def make_command_list
  506.     return if @actor.nil?
  507.     make_unlocked_class_skill_types
  508.     correct_unlocked_class_learned_skills
  509.     for stype_id in YEA::LEARN_SKILL::STYPE_ORDER
  510.       next unless include?(stype_id)
  511.       name = $data_system.skill_types[stype_id]
  512.       add_command(name, :skill, true, stype_id)
  513.     end
  514.   end
  515.  
  516.   #--------------------------------------------------------------------------
  517.   # make_unlocked_class_skill_types
  518.   #--------------------------------------------------------------------------
  519.   def make_unlocked_class_skill_types
  520.     return unless $imported["YEA-ClassSystem"]
  521.     @unlocked_types = []
  522.     unlocked_classes = @actor.unlocked_classes.clone
  523.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  524.     for class_id in unlocked_classes
  525.       next if $data_classes[class_id].nil?
  526.       for feature in $data_classes[class_id].features
  527.         next unless feature.code == 41
  528.         @unlocked_types.push(feature.data_id)
  529.       end
  530.     end
  531.   end
  532.  
  533.   #--------------------------------------------------------------------------
  534.   # correct_unlocked_class_learned_skills
  535.   #--------------------------------------------------------------------------
  536.   def correct_unlocked_class_learned_skills
  537.     return unless $imported["YEA-ClassSystem"]
  538.     unlocked_classes = @actor.unlocked_classes.clone
  539.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  540.     for class_id in unlocked_classes
  541.       @actor.learn_class_skills(class_id)
  542.     end
  543.   end
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # include?
  547.   #--------------------------------------------------------------------------
  548.   def include?(stype_id)
  549.     return true if @actor.added_skill_types.include?(stype_id)
  550.     if $imported["YEA-ClassSystem"]
  551.       return true if @unlocked_types.include?(stype_id)
  552.     end
  553.     return false
  554.   end
  555.  
  556.   #--------------------------------------------------------------------------
  557.   # update
  558.   #--------------------------------------------------------------------------
  559.   def update
  560.     super
  561.     @skill_window.stype_id = current_ext if @skill_window
  562.   end
  563.  
  564.   #--------------------------------------------------------------------------
  565.   # skill_window=
  566.   #--------------------------------------------------------------------------
  567.   def skill_window=(skill_window)
  568.     @skill_window = skill_window
  569.     update
  570.   end
  571.  
  572. end # Window_LearnSkillCommand
  573.  
  574. #==============================================================================
  575. # ■ Window_LearnSkillList
  576. #==============================================================================
  577.  
  578. class Window_LearnSkillList < Window_SkillList
  579.  
  580.   #--------------------------------------------------------------------------
  581.   # col_max
  582.   #--------------------------------------------------------------------------
  583.   def col_max; return 1; end
  584.  
  585.   #--------------------------------------------------------------------------
  586.   # select_last
  587.   #--------------------------------------------------------------------------
  588.   def select_last; select(0); end
  589.  
  590.   #--------------------------------------------------------------------------
  591.   # actor=
  592.   #--------------------------------------------------------------------------
  593.   def actor=(actor)
  594.     return if @actor == actor
  595.     super(actor)
  596.     make_learn_skills_list
  597.   end
  598.  
  599.   #--------------------------------------------------------------------------
  600.   # make_learn_skills_list
  601.   #--------------------------------------------------------------------------
  602.   def make_learn_skills_list
  603.     @learn_skills = []
  604.     @skill_classes = {}
  605.     return if @actor.nil?
  606.     for skill_id in @actor.class.learn_skills
  607.       next if $data_skills[skill_id].nil?
  608.       next if @learn_skills.include?($data_skills[skill_id])
  609.       skill = $data_skills[skill_id]
  610.       @learn_skills.push(skill)
  611.       @skill_classes[skill] = [] if @skill_classes[skill].nil?
  612.       @skill_classes[skill].push(@actor.class.id)
  613.     end
  614.     make_unlocked_class_skills
  615.   end
  616.  
  617.   #--------------------------------------------------------------------------
  618.   # make_unlocked_class_skills
  619.   #--------------------------------------------------------------------------
  620.   def make_unlocked_class_skills
  621.     return unless $imported["YEA-ClassSystem"]
  622.     @unlocked_types = []
  623.     unlocked_classes = @actor.unlocked_classes.clone
  624.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  625.     for class_id in unlocked_classes
  626.       next if $data_classes[class_id].nil?
  627.       for skill_id in $data_classes[class_id].learn_skills
  628.         next if $data_skills[skill_id].nil?
  629.         skill = $data_skills[skill_id]
  630.         @learn_skills.push(skill) unless @learn_skills.include?(skill)
  631.         @skill_classes[skill] = [] if @skill_classes[skill].nil?
  632.         @skill_classes[skill] |= [class_id]
  633.       end
  634.     end
  635.   end
  636.  
  637.   #--------------------------------------------------------------------------
  638.   # skill_classes
  639.   #--------------------------------------------------------------------------
  640.   def skill_classes(skill)
  641.     return @skill_classes[skill]
  642.   end
  643.  
  644.   #--------------------------------------------------------------------------
  645.   # make_item_list
  646.   #--------------------------------------------------------------------------
  647.   def make_item_list
  648.     return if @learn_skills.nil?
  649.     @data = @learn_skills.select {|skill| include?(skill) }
  650.   end
  651.  
  652.   #--------------------------------------------------------------------------
  653.   # include?
  654.   #--------------------------------------------------------------------------
  655.   def include?(item)
  656.     return false if item.nil?
  657.     return false unless meet_requirements?(item)
  658.     return item.stype_id == @stype_id
  659.   end
  660.  
  661.   #--------------------------------------------------------------------------
  662.   # meet_requirements?
  663.   #--------------------------------------------------------------------------
  664.   def meet_requirements?(item)
  665.     return false if @actor.nil?
  666.     return false unless meet_level_requirements?(item)
  667.     return false unless meet_skill_requirements?(item)
  668.     return false unless meet_switch_requirements?(item)
  669.     return false unless meet_eval_requirements?(item)
  670.     return true
  671.   end
  672.  
  673.   #--------------------------------------------------------------------------
  674.   # meet_level_requirements?
  675.   #--------------------------------------------------------------------------
  676.   def meet_level_requirements?(item)
  677.     return @actor.level >= item.learn_require_level
  678.   end
  679.  
  680.   #--------------------------------------------------------------------------
  681.   # meet_skill_requirements?
  682.   #--------------------------------------------------------------------------
  683.   def meet_skill_requirements?(item)
  684.     for skill_id in item.learn_require_skill
  685.       next if $data_skills[skill_id].nil?
  686.       return false unless @actor.skill_learn?($data_skills[skill_id])
  687.     end
  688.     return true
  689.   end
  690.  
  691.   #--------------------------------------------------------------------------
  692.   # meet_switch_requirements?
  693.   #--------------------------------------------------------------------------
  694.   def meet_switch_requirements?(item)
  695.     for switch_id in item.learn_require_switch
  696.       return false unless $game_switches[switch_id]
  697.     end
  698.     return true
  699.   end
  700.  
  701.   #--------------------------------------------------------------------------
  702.   # meet_eval_requirements?
  703.   #--------------------------------------------------------------------------
  704.   def meet_eval_requirements?(item)
  705.     return true if item.learn_require_eval.nil?
  706.     return eval(item.learn_require_eval)
  707.   end
  708.  
  709.   #--------------------------------------------------------------------------
  710.   # enable?
  711.   #--------------------------------------------------------------------------
  712.   def enable?(skill)
  713.     return false if skill.nil?
  714.     return false unless enabled_jp?(skill)
  715.     return false unless enabled_exp?(skill)
  716.     return false unless enabled_gold?(skill)
  717.     return !@actor.skill_learn?(skill)
  718.   end
  719.  
  720.   #--------------------------------------------------------------------------
  721.   # enabled_jp?
  722.   #--------------------------------------------------------------------------
  723.   def enabled_jp?(skill)
  724.     return true if skill.learn_cost[1] != :jp
  725.     cost = skill.learn_cost[0]
  726.     for class_id in @skill_classes[skill]
  727.       return true if @actor.jp(class_id) >= cost
  728.     end
  729.     return false
  730.   end
  731.  
  732.   #--------------------------------------------------------------------------
  733.   # enabled_exp?
  734.   #--------------------------------------------------------------------------
  735.   def enabled_exp?(skill)
  736.     return true if skill.learn_cost[1] != :exp
  737.     cost = skill.learn_cost[0]
  738.     for class_id in @skill_classes[skill]
  739.       return true if @actor.exp_class(class_id) >= cost
  740.     end
  741.     return false
  742.   end
  743.  
  744.   #--------------------------------------------------------------------------
  745.   # enabled_gold?
  746.   #--------------------------------------------------------------------------
  747.   def enabled_gold?(skill)
  748.     return true if skill.learn_cost[1] != :gold
  749.     cost = skill.learn_cost[0]
  750.     return $game_party.gold >= cost
  751.   end
  752.  
  753.   #--------------------------------------------------------------------------
  754.   # draw_item
  755.   #--------------------------------------------------------------------------
  756.   def draw_item(index)
  757.     skill = @data[index]
  758.     return if skill.nil?
  759.     rect = item_rect(index)
  760.     rect.width = (contents.width - spacing) / 2 - 4
  761.     draw_item_name(skill, rect.x, rect.y, enable?(skill), rect.width - 24)
  762.     draw_skill_cost(rect, skill)
  763.     draw_restriction_info(skill, index)
  764.     draw_learn_cost(skill, index)
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # skill_restriction?
  769.   #--------------------------------------------------------------------------
  770.   def skill_restriction?(index)
  771.     return false
  772.   end
  773.  
  774.   #--------------------------------------------------------------------------
  775.   # draw_restriction_info
  776.   #--------------------------------------------------------------------------
  777.   def draw_restriction_info(skill, index)
  778.     return unless $imported["YEA-SkillRestrictions"]
  779.     rect = item_rect(index)
  780.     rect.x = contents.width / 2
  781.     rect.width /= 2
  782.     rect.width /= 3
  783.     rect.width -= 8
  784.     draw_skill_warmup(skill, rect)
  785.     rect.x += rect.width + 4
  786.     draw_skill_cooldown(skill, rect)
  787.   end
  788.  
  789.   #--------------------------------------------------------------------------
  790.   # draw_skill_warmup
  791.   #--------------------------------------------------------------------------
  792.   def draw_skill_warmup(skill, rect)
  793.     return unless YEA::LEARN_SKILL::DRAW_WARMUP
  794.     enabled = enable?(skill)
  795.     enabled = false if skill.warmup <= 0
  796.     change_color(warmup_colour, enabled)
  797.     icon = Icon.warmup
  798.     if icon > 0
  799.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  800.       rect.width -= 24
  801.     end
  802.     contents.font.size = YEA::SKILL_RESTRICT::WARMUP_SIZE
  803.     value = skill.warmup > 0 ? skill.warmup.group : empty_text
  804.     text = sprintf(YEA::SKILL_RESTRICT::WARMUP_SUFFIX, value)
  805.     draw_text(rect, text, 2)
  806.     reset_font_settings
  807.   end
  808.  
  809.   #--------------------------------------------------------------------------
  810.   # draw_skill_cooldown
  811.   #--------------------------------------------------------------------------
  812.   def draw_skill_cooldown(skill, rect)
  813.     return unless YEA::LEARN_SKILL::DRAW_COOLDOWN
  814.     enabled = enable?(skill)
  815.     enabled = false if skill.cooldown <= 0
  816.     change_color(cooldown_colour, enabled)
  817.     icon = Icon.cooldown
  818.     if icon > 0
  819.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  820.       rect.width -= 24
  821.     end
  822.     contents.font.size = YEA::SKILL_RESTRICT::COOLDOWN_SIZE
  823.     value = skill.cooldown > 0 ? skill.cooldown.group : empty_text
  824.     text = sprintf(YEA::SKILL_RESTRICT::COOLDOWN_SUFFIX, value)
  825.     draw_text(rect, text, 2)
  826.     reset_font_settings
  827.   end
  828.  
  829.   #--------------------------------------------------------------------------
  830.   # empty_text
  831.   #--------------------------------------------------------------------------
  832.   def empty_text
  833.     return YEA::LEARN_SKILL::EMPTY_TEXT
  834.   end
  835.  
  836.   #--------------------------------------------------------------------------
  837.   # draw_learn_cost
  838.   #--------------------------------------------------------------------------
  839.   def draw_learn_cost(skill, index)
  840.     rect = item_rect(index)
  841.     rect.width -= 4
  842.     if @actor.skill_learn?(skill)
  843.       draw_learned_skill(rect)
  844.     else
  845.       draw_learn_skill_cost(skill, rect)
  846.     end
  847.     reset_font_settings
  848.   end
  849.  
  850.   #--------------------------------------------------------------------------
  851.   # draw_learned_skill
  852.   #--------------------------------------------------------------------------
  853.   def draw_learned_skill(rect)
  854.     contents.font.size = YEA::LEARN_SKILL::LEARNED_SIZE
  855.     change_color(normal_color)
  856.     draw_text(rect, YEA::LEARN_SKILL::LEARNED_TEXT, 2)
  857.   end
  858.  
  859.   #--------------------------------------------------------------------------
  860.   # draw_learn_skill_cost
  861.   #--------------------------------------------------------------------------
  862.   def draw_learn_skill_cost(skill, rect)
  863.     case skill.learn_cost[1]
  864.     when :jp
  865.       return unless $imported["YEA-JPManager"]
  866.       draw_jp_cost(skill, rect)
  867.     when :exp
  868.       draw_exp_cost(skill, rect)
  869.     when :gold
  870.       draw_gold_cost(skill, rect)
  871.     else; return
  872.     end
  873.   end
  874.  
  875.   #--------------------------------------------------------------------------
  876.   # draw_jp_cost
  877.   #--------------------------------------------------------------------------
  878.   def draw_jp_cost(skill, rect)
  879.     enabled = enabled_jp?(skill)
  880.     if Icon.jp > 0
  881.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  882.       rect.width -= 24
  883.     end
  884.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  885.     change_color(system_color, enabled)
  886.     draw_text(rect, Vocab::jp, 2)
  887.     rect.width -= text_size(Vocab::jp).width
  888.     cost = skill.learn_cost[0]
  889.     text = cost.group
  890.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  891.     draw_text(rect, text, 2)
  892.   end
  893.  
  894.   #--------------------------------------------------------------------------
  895.   # draw_exp_cost
  896.   #--------------------------------------------------------------------------
  897.   def draw_exp_cost(skill, rect)
  898.     enabled = enabled_exp?(skill)
  899.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  900.     change_color(system_color, enabled)
  901.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  902.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  903.     cost = skill.learn_cost[0]
  904.     text = cost.group
  905.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  906.     draw_text(rect, text, 2)
  907.   end
  908.  
  909.   #--------------------------------------------------------------------------
  910.   # draw_gold_cost
  911.   #--------------------------------------------------------------------------
  912.   def draw_gold_cost(skill, rect)
  913.     enabled = enabled_jp?(skill)
  914.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  915.     change_color(system_color, enabled)
  916.     draw_text(rect, Vocab::currency_unit, 2)
  917.     rect.width -= text_size(Vocab::currency_unit).width
  918.     cost = skill.learn_cost[0]
  919.     text = cost.group
  920.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  921.     draw_text(rect, text, 2)
  922.   end
  923.  
  924. end # Window_LearnSkillList
  925.  
  926. #==============================================================================
  927. # ■ Window_LearnSkillCostBack
  928. #==============================================================================
  929.  
  930. class Window_LearnSkillCostBack < Window_Base
  931.  
  932.   #--------------------------------------------------------------------------
  933.   # initialize
  934.   #--------------------------------------------------------------------------
  935.   def initialize(item_window)
  936.     dw = Graphics.width * 3 / 4
  937.     dx = (Graphics.width - dw) / 2
  938.     super(dx, 0, dw, fitting_height(2))
  939.     self.openness = 0
  940.     self.back_opacity = 255
  941.     @front_window = nil
  942.     @item_window = item_window
  943.     [url=home.php?mod=space&uid=260100]@skill[/url] = nil
  944.   end
  945.  
  946.   #--------------------------------------------------------------------------
  947.   # reveal
  948.   #--------------------------------------------------------------------------
  949.   def reveal(skill, skill_classes)
  950.     [url=home.php?mod=space&uid=260100]@skill[/url] = skill
  951.     return if @skill.nil?
  952.     case @skill.learn_cost[1]
  953.     when :gold
  954.       self.height = fitting_height(3)
  955.     else
  956.       maximum = [skill_classes.size, YEA::LEARN_SKILL::MAXIMUM_ROWS].min
  957.       self.height = fitting_height(maximum + 2)
  958.     end
  959.     create_contents
  960.     self.y = (Graphics.height - self.height) / 2
  961.     refresh
  962.     open
  963.   end
  964.  
  965.   #--------------------------------------------------------------------------
  966.   # refresh
  967.   #--------------------------------------------------------------------------
  968.   def refresh
  969.     contents.clear
  970.     reset_font_settings
  971.     draw_learn_skill_text
  972.     rect = Rect.new(0, 0, contents.width - 4, line_height)
  973.     draw_learn_skill_cost(@skill, rect)
  974.   end
  975.  
  976.   #--------------------------------------------------------------------------
  977.   # draw_learn_skill_text
  978.   #--------------------------------------------------------------------------
  979.   def draw_learn_skill_text
  980.     name = sprintf("\eI[%d]%s", @skill.icon_index, @skill.name)
  981.     fmt = YEA::LEARN_SKILL::LEARN_SKILL_TEXT
  982.     text = sprintf(fmt, name)
  983.     draw_text_ex(4, 0, text)
  984.   end
  985.  
  986.   #--------------------------------------------------------------------------
  987.   # draw_learn_skill_cost
  988.   #--------------------------------------------------------------------------
  989.   def draw_learn_skill_cost(skill, rect)
  990.     case skill.learn_cost[1]
  991.     when :jp
  992.       return unless $imported["YEA-JPManager"]
  993.       draw_jp_cost(skill, rect)
  994.     when :exp
  995.       draw_exp_cost(skill, rect)
  996.     when :gold
  997.       draw_gold_cost(skill, rect)
  998.     else; return
  999.     end
  1000.   end
  1001.  
  1002.   #--------------------------------------------------------------------------
  1003.   # draw_jp_cost
  1004.   #--------------------------------------------------------------------------
  1005.   def draw_jp_cost(skill, rect)
  1006.     enabled = true
  1007.     if Icon.jp > 0
  1008.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  1009.       rect.width -= 24
  1010.     end
  1011.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1012.     change_color(system_color, enabled)
  1013.     draw_text(rect, Vocab::jp, 2)
  1014.     rect.width -= text_size(Vocab::jp).width
  1015.     cost = skill.learn_cost[0]
  1016.     text = cost.group
  1017.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  1018.     draw_text(rect, text, 2)
  1019.   end
  1020.  
  1021.   #--------------------------------------------------------------------------
  1022.   # draw_exp_cost
  1023.   #--------------------------------------------------------------------------
  1024.   def draw_exp_cost(skill, rect)
  1025.     enabled = true
  1026.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1027.     change_color(system_color, enabled)
  1028.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  1029.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  1030.     cost = skill.learn_cost[0]
  1031.     text = cost.group
  1032.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  1033.     draw_text(rect, text, 2)
  1034.   end
  1035.  
  1036.   #--------------------------------------------------------------------------
  1037.   # draw_gold_cost
  1038.   #--------------------------------------------------------------------------
  1039.   def draw_gold_cost(skill, rect)
  1040.     enabled = true
  1041.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1042.     change_color(system_color, enabled)
  1043.     draw_text(rect, Vocab::currency_unit, 2)
  1044.     rect.width -= text_size(Vocab::currency_unit).width
  1045.     cost = skill.learn_cost[0]
  1046.     text = cost.group
  1047.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  1048.     draw_text(rect, text, 2)
  1049.   end
  1050.  
  1051. end # Window_LearnSkillCostBack
  1052.  
  1053. #==============================================================================
  1054. # ■ Window_LearnSkillCostFront
  1055. #==============================================================================
  1056.  
  1057. class Window_LearnSkillCostFront < Window_Command
  1058.  
  1059.   #--------------------------------------------------------------------------
  1060.   # initialize
  1061.   #--------------------------------------------------------------------------
  1062.   def initialize(item_window, cost_window)
  1063.     super((Graphics.width - window_width) / 2, 0)
  1064.     self.openness = 0
  1065.     self.opacity = 0
  1066.     @item_window = item_window
  1067.     @cost_window = cost_window
  1068.     @skill = nil
  1069.     @actor = nil
  1070.     deactivate
  1071.   end
  1072.  
  1073.   #--------------------------------------------------------------------------
  1074.   # window_width
  1075.   #--------------------------------------------------------------------------
  1076.   def window_width; return Graphics.width * 3 / 4; end
  1077.  
  1078.   #--------------------------------------------------------------------------
  1079.   # skill_class
  1080.   #--------------------------------------------------------------------------
  1081.   def skill_class
  1082.     return @skill_classes.nil? ? nil : @skill_classes[index]
  1083.   end
  1084.  
  1085.   #--------------------------------------------------------------------------
  1086.   # reveal
  1087.   #--------------------------------------------------------------------------
  1088.   def reveal(skill, skill_classes, actor)
  1089.     @skill = skill
  1090.     @skill_classes = skill_classes.clone
  1091.     @actor = actor
  1092.     return if @skill.nil?
  1093.     case @skill.learn_cost[1]
  1094.     when :gold
  1095.       self.height = fitting_height(2)
  1096.     else
  1097.       maximum = [skill_classes.size, YEA::LEARN_SKILL::MAXIMUM_ROWS].min
  1098.       self.height = fitting_height(maximum + 1)
  1099.     end
  1100.     create_contents
  1101.     self.y = @cost_window.y + line_height
  1102.     refresh
  1103.     select(0)
  1104.     open
  1105.     activate
  1106.   end
  1107.  
  1108.   #--------------------------------------------------------------------------
  1109.   # make_command_list
  1110.   #--------------------------------------------------------------------------
  1111.   def make_command_list
  1112.     return if @skill_classes.nil?
  1113.     if @skill.learn_cost[1] == :gold
  1114.       add_command("GOLD", :gold, true)
  1115.       add_command(YEA::LEARN_SKILL::LEARN_CANCEL_TEXT, :cancel, true)
  1116.       return
  1117.     end
  1118.     for class_id in @skill_classes
  1119.       name = $data_classes[class_id].name
  1120.       add_command(name, :class, enabled?(class_id), class_id)
  1121.     end
  1122.     add_command(YEA::LEARN_SKILL::LEARN_CANCEL_TEXT, :cancel, true)
  1123.   end
  1124.  
  1125.   #--------------------------------------------------------------------------
  1126.   # enabled?
  1127.   #--------------------------------------------------------------------------
  1128.   def enabled?(class_id)
  1129.     cost = @skill.learn_cost[0]
  1130.     case @skill.learn_cost[1]
  1131.     when :jp
  1132.       return @actor.jp(class_id) >= cost
  1133.     when :exp
  1134.       return @actor.exp_class(class_id) >= cost
  1135.     end
  1136.     return true
  1137.   end
  1138.  
  1139.   #--------------------------------------------------------------------------
  1140.   # draw_item
  1141.   #--------------------------------------------------------------------------
  1142.   def draw_item(index)
  1143.     reset_font_settings
  1144.     rect = item_rect(index)
  1145.     rect.x += 24
  1146.     rect.width -= 28
  1147.     return draw_cancel_text(index, rect) if @list[index][:symbol] == :cancel
  1148.     draw_class_name(index, rect) if @skill.learn_cost[1] != :gold
  1149.     draw_party_gold(rect) if @skill.learn_cost[1] == :gold
  1150.     draw_learn_skill_cost(@skill, rect, index)
  1151.   end
  1152.  
  1153.   #--------------------------------------------------------------------------
  1154.   # draw_cancel_text
  1155.   #--------------------------------------------------------------------------
  1156.   def draw_cancel_text(index, rect)
  1157.     draw_icon(Icon.cancel, rect.x, rect.y)
  1158.     text = command_name(index)
  1159.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  1160.   end
  1161.  
  1162.   #--------------------------------------------------------------------------
  1163.   # draw_class_name
  1164.   #--------------------------------------------------------------------------
  1165.   def draw_class_name(index, rect)
  1166.     class_id = @list[index][:ext]
  1167.     return if $data_classes[class_id].nil?
  1168.     enabled = enabled?(class_id)
  1169.     if $imported["YEA-ClassSystem"]
  1170.       draw_icon($data_classes[class_id].icon_index, rect.x, rect.y, enabled)
  1171.     end
  1172.     rect.x += 24
  1173.     rect.width -= 24
  1174.     change_color(normal_color, enabled)
  1175.     draw_text(rect, $data_classes[class_id].name)
  1176.   end
  1177.  
  1178.   #--------------------------------------------------------------------------
  1179.   # draw_class_name
  1180.   #--------------------------------------------------------------------------
  1181.   def draw_party_gold(rect)
  1182.     enabled = true
  1183.     draw_icon(Icon.learn_skill_gold, rect.x, rect.y)
  1184.     rect.x += 24
  1185.     rect.width -= 24
  1186.     change_color(normal_color, enabled)
  1187.     draw_text(rect, YEA::LEARN_SKILL::GOLD_TEXT)
  1188.   end
  1189.  
  1190.   #--------------------------------------------------------------------------
  1191.   # draw_learn_skill_cost
  1192.   #--------------------------------------------------------------------------
  1193.   def draw_learn_skill_cost(skill, rect, index)
  1194.     case skill.learn_cost[1]
  1195.     when :jp
  1196.       return unless $imported["YEA-JPManager"]
  1197.       draw_jp_cost(skill, rect, index)
  1198.     when :exp
  1199.       draw_exp_cost(skill, rect, index)
  1200.     when :gold
  1201.       draw_gold_cost(skill, rect)
  1202.     else; return
  1203.     end
  1204.   end
  1205.  
  1206.   #--------------------------------------------------------------------------
  1207.   # draw_jp_cost
  1208.   #--------------------------------------------------------------------------
  1209.   def draw_jp_cost(skill, rect, index)
  1210.     enabled = enabled?(@list[index][:ext])
  1211.     if Icon.jp > 0
  1212.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  1213.       rect.width -= 24
  1214.     end
  1215.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1216.     change_color(system_color, enabled)
  1217.     draw_text(rect, Vocab::jp, 2)
  1218.     rect.width -= text_size(Vocab::jp).width
  1219.     cost = @actor.jp(@list[index][:ext])
  1220.     text = cost.group
  1221.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  1222.     draw_text(rect, text, 2)
  1223.   end
  1224.  
  1225.   #--------------------------------------------------------------------------
  1226.   # draw_exp_cost
  1227.   #--------------------------------------------------------------------------
  1228.   def draw_exp_cost(skill, rect, index)
  1229.     enabled = enabled?(@list[index][:ext])
  1230.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1231.     change_color(system_color, enabled)
  1232.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  1233.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  1234.     cost = @actor.exp_class(@list[index][:ext])
  1235.     text = cost.group
  1236.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  1237.     draw_text(rect, text, 2)
  1238.   end
  1239.  
  1240.   #--------------------------------------------------------------------------
  1241.   # draw_gold_cost
  1242.   #--------------------------------------------------------------------------
  1243.   def draw_gold_cost(skill, rect)
  1244.     enabled = $game_party.gold >= skill.learn_cost[0]
  1245.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1246.     change_color(system_color, enabled)
  1247.     draw_text(rect, Vocab::currency_unit, 2)
  1248.     rect.width -= text_size(Vocab::currency_unit).width
  1249.     cost = $game_party.gold
  1250.     text = cost.group
  1251.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  1252.     draw_text(rect, text, 2)
  1253.   end
  1254.  
  1255. end # Window_LearnSkillCostFront
  1256.  
  1257. #==============================================================================
  1258. # ■ Scene_Skill
  1259. #==============================================================================
  1260.  
  1261. class Scene_Skill < Scene_ItemBase
  1262.  
  1263.   #--------------------------------------------------------------------------
  1264.   # alias method: create_command_window
  1265.   #--------------------------------------------------------------------------
  1266.   alias scene_skill_create_command_window_lse create_command_window
  1267.   def create_command_window
  1268.     scene_skill_create_command_window_lse
  1269.     @command_window.set_handler(:learn_skill, method(:command_learn_skill))
  1270.   end
  1271.  
  1272.   #--------------------------------------------------------------------------
  1273.   # new method: command_learn_skill
  1274.   #--------------------------------------------------------------------------
  1275.   def command_learn_skill
  1276.     SceneManager.call(Scene_LearnSkill)
  1277.   end
  1278.  
  1279. end # Scene_Skill
  1280.  
  1281. #==============================================================================
  1282. # ■ Scene_LearnSkill
  1283. #==============================================================================
  1284.  
  1285. class Scene_LearnSkill < Scene_Skill
  1286.  
  1287.   #--------------------------------------------------------------------------
  1288.   # start
  1289.   #--------------------------------------------------------------------------
  1290.   def start
  1291.     super
  1292.     create_cost_windows
  1293.   end
  1294.  
  1295.   #--------------------------------------------------------------------------
  1296.   # create_command_window
  1297.   #--------------------------------------------------------------------------
  1298.   def create_command_window
  1299.     wy = @help_window.height
  1300.     @command_window = Window_LearnSkillCommand.new(0, wy)
  1301.     @command_window.viewport = @viewport
  1302.     @command_window.help_window = @help_window
  1303.     @command_window.actor = @actor
  1304.     @command_window.set_handler(:skill,    method(:command_skill))
  1305.     @command_window.set_handler(:cancel,   method(:return_scene))
  1306.     @command_window.set_handler(:pagedown, method(:next_actor))
  1307.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1308.   end
  1309.  
  1310.   #--------------------------------------------------------------------------
  1311.   # create_item_window
  1312.   #--------------------------------------------------------------------------
  1313.   def create_item_window
  1314.     wx = 0
  1315.     wy = @status_window.y + @status_window.height
  1316.     ww = Graphics.width
  1317.     wh = Graphics.height - wy
  1318.     @item_window = Window_LearnSkillList.new(wx, wy, ww, wh)
  1319.     @item_window.actor = @actor
  1320.     @item_window.viewport = @viewport
  1321.     @item_window.help_window = @help_window
  1322.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1323.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1324.     @command_window.skill_window = @item_window
  1325.   end
  1326.  
  1327.   #--------------------------------------------------------------------------
  1328.   # create_cost_windows
  1329.   #--------------------------------------------------------------------------
  1330.   def create_cost_windows
  1331.     @cost_window = Window_LearnSkillCostBack.new(@item_window)
  1332.     @cost_front = Window_LearnSkillCostFront.new(@item_window, @cost_window)
  1333.     @cost_window.viewport = @viewport
  1334.     @cost_front.viewport = @viewport
  1335.     @cost_front.set_handler(:ok, method(:on_cost_ok))
  1336.     @cost_front.set_handler(:cancel, method(:on_cost_cancel))
  1337.   end
  1338.  
  1339.   #--------------------------------------------------------------------------
  1340.   # on_item_ok
  1341.   #--------------------------------------------------------------------------
  1342.   def on_item_ok
  1343.     skill = @item_window.item
  1344.     @cost_window.reveal(skill, @item_window.skill_classes(skill))
  1345.     @cost_front.reveal(skill, @item_window.skill_classes(skill), @actor)
  1346.   end
  1347.  
  1348.   #--------------------------------------------------------------------------
  1349.   # on_cost_ok
  1350.   #--------------------------------------------------------------------------
  1351.   def on_cost_ok
  1352.     Sound.play_use_skill
  1353.     skill = @item_window.item
  1354.     @actor.learn_skill(skill.id)
  1355.     cost = skill.learn_cost[0]
  1356.     case skill.learn_cost[1]
  1357.     when :jp
  1358.       @actor.lose_jp(cost, @cost_front.skill_class)
  1359.     when :exp
  1360.       @actor.lose_exp_class(cost, @cost_front.skill_class)
  1361.     when :gold
  1362.       $game_party.lose_gold(cost)
  1363.     end
  1364.     on_cost_cancel
  1365.     refresh_windows
  1366.   end
  1367.  
  1368.   #--------------------------------------------------------------------------
  1369.   # on_cost_cancel
  1370.   #--------------------------------------------------------------------------
  1371.   def on_cost_cancel
  1372.     @cost_front.close
  1373.     @cost_window.close
  1374.     @item_window.activate
  1375.   end
  1376.  
  1377.   #--------------------------------------------------------------------------
  1378.   # refresh_windows
  1379.   #--------------------------------------------------------------------------
  1380.   def refresh_windows
  1381.     @item_window.refresh
  1382.     @status_window.refresh
  1383.   end
  1384.  
  1385. end # Scene_LearnSkill
  1386.  
  1387. #==============================================================================
  1388. #
  1389. # ▼ End of File
  1390. #
  1391. #==============================================================================[/code][code]#==============================================================================
  1392. #
  1393. # ▼ Yanfly Engine Ace - Skill Cost Manager v1.02
  1394. # -- Last Updated: 2012.01.23
  1395. # -- Level: Normal, Hard, Lunatic
  1396. # -- Requires: n/a
  1397. #
  1398. #==============================================================================
  1399.  
  1400. $imported = {} if $imported.nil?
  1401. $imported["YEA-SkillCostManager"] = true
  1402.  
  1403. #==============================================================================
  1404. # ▼ Updates
  1405. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1406. # 2012.01.23 - Compatibility Update: Doppelganger
  1407. # 2011.12.11 - Started Script and Finished.
  1408. #            - Added max and min notetags.
  1409. #
  1410. #==============================================================================
  1411. # ▼ Introduction
  1412. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1413. # This script adds more functionality towards skill costs. Skills can now cost
  1414. # HP, more MP, more TP, gold, and even have custom costs. The way the skill
  1415. # costs are drawn in the display windows are changed to deliver more effective
  1416. # and reliable information to the player. And if four skill costs aren't enough
  1417. # to satisfy you, you can even make your own custom skill costs.
  1418. #
  1419. #==============================================================================
  1420. # ▼ Instructions
  1421. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1422. # To install this script, open up your script editor and copy/paste this script
  1423. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  1424. #
  1425. # -----------------------------------------------------------------------------
  1426. # Actor Notetags - These notetags go in the actors notebox in the database.
  1427. # -----------------------------------------------------------------------------
  1428. # <hp cost rate: x%>
  1429. # Allows the actor to drop the HP cost of skills to x%.
  1430. #
  1431. # <tp cost rate: x%>
  1432. # Allows the actor to drop the TP cost of skills to x%.
  1433. #
  1434. # <gold cost rate: x%>
  1435. # Allows the actor to drop the Gold cost of skills to x%.
  1436. #
  1437. # -----------------------------------------------------------------------------
  1438. # Class Notetags - These notetags go in the class notebox in the database.
  1439. # -----------------------------------------------------------------------------
  1440. # <hp cost rate: x%>
  1441. # Allows the class to drop the HP cost of skills to x%.
  1442. #
  1443. # <tp cost rate: x%>
  1444. # Allows the class to drop the TP cost of skills to x%.
  1445. #
  1446. # <gold cost rate: x%>
  1447. # Allows the class to drop the Gold cost of skills to x%.
  1448. #
  1449. # -----------------------------------------------------------------------------
  1450. # Skill Notetags - These notetags go in the skills notebox in the database.
  1451. # -----------------------------------------------------------------------------
  1452. # <hp cost: x>
  1453. # Sets the skill's HP cost to x. This function did not exist by default in
  1454. # RPG Maker VX Ace.
  1455. #
  1456. # <hp cost: x%>
  1457. # Sets the HP cost to a percentage of the actor's MaxHP. If a normal HP cost is
  1458. # present on the skill, too, then this value is added to the HP cost.
  1459. #
  1460. # <hp cost max: x>
  1461. # <hp cost min: x>
  1462. # Sets the maximum and minimum range of the HP Cost of the skill. If you do not
  1463. # use this tag, there will be no maximum and/or minimum range.
  1464. #
  1465. # <mp cost: x>
  1466. # Sets the skill's MP cost to x. Allows MP cost to exceed 9999, which is RPG
  1467. # Maker VX Ace's database editor's maximum limit.
  1468. #
  1469. # <mp cost: x%>
  1470. # Sets the MP cost to a percentage of the actor's MaxMP. If a normal MP cost is
  1471. # present on the skill, too, then this value is added to the MP cost.
  1472. #
  1473. # <mp cost max: x>
  1474. # <mp cost min: x>
  1475. # Sets the maximum and minimum range of the MP Cost of the skill. If you do not
  1476. # use this tag, there will be no maximum and/or minimum range.
  1477. #
  1478. # <tp cost: x>
  1479. # Sets the skill's TP cost to x. Allows TP cost to exceed 100, which is RPG
  1480. # Maker VX Ace's database editor's maximum limit.
  1481. #
  1482. # <tp cost: x%>
  1483. # Sets the TP cost to a percentage of the actor's MaxTP. If a normal TP cost is
  1484. # present on the skill, too, then this value is added to the TP cost.
  1485. #
  1486. # <tp cost max: x>
  1487. # <tp cost min: x>
  1488. # Sets the maximum and minimum range of the TP Cost of the skill. If you do not
  1489. # use this tag, there will be no maximum and/or minimum range.
  1490. #
  1491. # <gold cost: x>
  1492. # Sets the skill's gold cost to x. Enemies with skills that cost gold do not
  1493. # use gold. If the player does not have enough gold, the skill can't be used.
  1494. #
  1495. # <gold cost: x%>
  1496. # Sets the skill's gold cost equal to a percentage of the party's total gold.
  1497. # If both a regular gold cost and a percentile gold cost is used, the total of
  1498. # both values will be the skill's gold cost.
  1499. #
  1500. # <gold cost max: x>
  1501. # <gold cost min: x>
  1502. # Sets the maximum and minimum range of the Gold Cost of the skill. If you do
  1503. # not use this tag, there will be no maximum and/or minimum range.
  1504. #
  1505. # --- Making Your Own Custom Costs ---
  1506. #
  1507. # <custom cost: string>
  1508. # If you decide to have a custom cost for your game, insert this notetag to
  1509. # change what displays in the skill menu visually.
  1510. #
  1511. # <custom cost colour: x>
  1512. # This is the "Window" skin text colour used for the custom cost. By default,
  1513. # it is text colour 0, which is the white colour.
  1514. #
  1515. # <custom cost size: x>
  1516. # This is the text font size used for the custom cost in the display windows.
  1517. # By default, it is font size 20.
  1518. #
  1519. # <custom cost icon: x>
  1520. # If you wish to use an icon for your custom cost, replace x with the icon ID
  1521. # you wish to show in display windows. By default, it is 0 (and not shown).
  1522. #
  1523. # <custom cost requirement>
  1524. #  string
  1525. #  string
  1526. # </custom cost requirement>
  1527. # Sets the custom cost requirement of the skill with an eval function using the
  1528. # strings in between. The strings are a part of one line even if in the notebox
  1529. # they are on separate lines.
  1530. #
  1531. # <custom cost perform>
  1532. #  string
  1533. #  string
  1534. # </custom cost perform>
  1535. # Sets how the custom cost payment is done with an eval function using the
  1536. # strings in between. The strings are a part of one line even if in the notebox
  1537. # they are on separate lines.
  1538. #
  1539. # -----------------------------------------------------------------------------
  1540. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  1541. # -----------------------------------------------------------------------------
  1542. # <hp cost rate: x%>
  1543. # Allows the weapon to drop the HP cost of skills to x% when worn.
  1544. #
  1545. # <tp cost rate: x%>
  1546. # Allows the weapon to drop the TP cost of skills to x% when worn.
  1547. #
  1548. # <gold cost rate: x%>
  1549. # Allows the weapon to drop the Gold cost of skills to x% when worn.
  1550. #
  1551. # -----------------------------------------------------------------------------
  1552. # Armour Notetags - These notetags go in the armours notebox in the database.
  1553. # -----------------------------------------------------------------------------
  1554. # <hp cost rate: x%>
  1555. # Allows the armour to drop the HP cost of skills to x% when worn.
  1556. #
  1557. # <tp cost rate: x%>
  1558. # Allows the armour to drop the TP cost of skills to x% when worn.
  1559. #
  1560. # <gold cost rate: x%>
  1561. # Allows the armour to drop the TP cost of skills to x% when worn.
  1562. #
  1563. # -----------------------------------------------------------------------------
  1564. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  1565. # -----------------------------------------------------------------------------
  1566. # <hp cost rate: x%>
  1567. # Allows the enemy to drop the HP cost of skills to x%.
  1568. #
  1569. # <tp cost rate: x%>
  1570. # Allows the enemy to drop the TP cost of skills to x%.
  1571. #
  1572. # -----------------------------------------------------------------------------
  1573. # State Notetags - These notetags go in the states notebox in the database.
  1574. # -----------------------------------------------------------------------------
  1575. # <hp cost rate: x%>
  1576. # Allows the state to drop the HP cost of skills to x% when afflicted.
  1577. #
  1578. # <tp cost rate: x%>
  1579. # Allows the state to drop the TP cost of skills to x% when afflicted.
  1580. #
  1581. # <gold cost rate: x%>
  1582. # Allows the state to drop the Gold cost of skills to x% when afflicted.
  1583. #
  1584. #==============================================================================
  1585. # ▼ Compatibility
  1586. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1587. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  1588. # it will run with RPG Maker VX without adjusting.
  1589. #
  1590. #==============================================================================
  1591.  
  1592. module YEA
  1593.   module SKILL_COST
  1594.  
  1595.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1596.     # - HP Cost Settings -
  1597.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1598.     # New to this script are HP costs. HP costs require the battler to have
  1599.     # sufficient HP before being able to use the skill. The text colour that's
  1600.     # used, the suffix, or whether or not to use an icon. If you do not wish
  1601.     # to use an icon, set the icon to 0.
  1602.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1603.     HP_COST_COLOUR = 21         # Colour used from "Window" skin.
  1604.     HP_COST_SIZE   = 20         # Font size used for HP costs.
  1605.     HP_COST_SUFFIX = "%sHP"     # Suffix used for HP costs.
  1606.     HP_COST_ICON   = 0          # Icon used for HP costs. Set 0 to disable.
  1607.  
  1608.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1609.     # - MP Cost Settings -
  1610.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1611.     # Here, you can change the settings for MP costs: the text colour that's
  1612.     # used, the suffix, or whether or not to use an icon. If you do not wish
  1613.     # to use an icon, set the icon to 0.
  1614.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1615.     MP_COST_COLOUR = 23         # Colour used from "Window" skin. Default: 23
  1616.     MP_COST_SIZE   = 20         # Font size used for MP costs. Default: 24
  1617.     MP_COST_SUFFIX = "%sMP"     # Suffix used for MP costs. No suffix default.
  1618.     MP_COST_ICON   = 0          # Icon used for MP costs. Set 0 to disable.
  1619.  
  1620.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1621.     # - TP Cost Settings -
  1622.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1623.     # Here, you can change the settings for TP costs: the text colour that's
  1624.     # used, the suffix, or whether or not to use an icon. If you do not wish
  1625.     # to use an icon, set the icon to 0.
  1626.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1627.     TP_COST_COLOUR = 2          # Colour used from "Window" skin. Default: 29
  1628.     TP_COST_SIZE   = 20         # Font size used for TP costs. Default: 24
  1629.     TP_COST_SUFFIX = "%sTP"     # Suffix used for TP costs. No suffix default.
  1630.     TP_COST_ICON   = 0          # Icon used for TP costs. Set 0 to disable.
  1631.  
  1632.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1633.     # - Gold Cost Settings -
  1634.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1635.     # New to this script are Gold costs. Gold costs require the party to have
  1636.     # enough gold before being able to use the skill. The text colour that's
  1637.     # used, the suffix, or whether or not to use an icon. If you do not wish
  1638.     # to use an icon, set the icon to 0.
  1639.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1640.     GOLD_COST_COLOUR = 6          # Colour used from "Window" skin.
  1641.     GOLD_COST_SIZE   = 20         # Font size used for Gold costs.
  1642.     GOLD_COST_SUFFIX = "%sGold"   # Suffix used for Gold costs.
  1643.     GOLD_COST_ICON   = 0          # Icon used for Gold costs. Set 0 to disable.
  1644.  
  1645.   end # SKILL_COST
  1646. end # YEA
  1647.  
  1648. #==============================================================================
  1649. # ▼ Editting anything past this point may potentially result in causing
  1650. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  1651. # halitosis so edit at your own risk.
  1652. #==============================================================================
  1653.  
  1654. module YEA
  1655.   module REGEXP
  1656.   module BASEITEM
  1657.  
  1658.     HP_COST_RATE = /<(?:HP_COST_RATE|hp cost rate):[ ](\d+)([%%])>/i
  1659.     TP_COST_RATE = /<(?:TP_COST_RATE|tp cost rate):[ ](\d+)([%%])>/i
  1660.     GOLD_COST_RATE = /<(?:GOLD_COST_RATE|gold cost rate):[ ](\d+)([%%])>/i
  1661.  
  1662.   end # BASEITEM
  1663.   module SKILL
  1664.  
  1665.     HP_COST_SET = /<(?:HP_COST|hp cost):[ ](\d+)>/i
  1666.     HP_COST_PER = /<(?:HP_COST|hp cost):[ ](\d+)([%%])>/i
  1667.     MP_COST_SET = /<(?:MP_COST|mp cost):[ ](\d+)>/i
  1668.     MP_COST_PER = /<(?:MP_COST|mp cost):[ ](\d+)([%%])>/i
  1669.     TP_COST_SET = /<(?:TP_COST|tp cost):[ ](\d+)>/i
  1670.     TP_COST_PER = /<(?:TP_COST|tp cost):[ ](\d+)([%%])>/i
  1671.     GOLD_COST_SET = /<(?:GOLD_COST|gold cost):[ ](\d+)>/i
  1672.     GOLD_COST_PER = /<(?:GOLD_COST|gold cost):[ ](\d+)([%%])>/i
  1673.  
  1674.     CUSTOM_COST_TEXT = /<(?:CUSTOM_COST|custom cost):[ ](.*)>/i
  1675.     CUSTOM_COST_COLOUR =
  1676.       /<(?:CUSTOM_COST_COLOUR|custom cost colour|custom cost color):[ ](\d+)>/i
  1677.     CUSTOM_COST_SIZE = /<(?:CUSTOM_COST_SIZE|custom cost size):[ ](\d+)>/i
  1678.     CUSTOM_COST_ICON = /<(?:CUSTOM_COST_ICON|custom cost icon):[ ](\d+)>/i
  1679.     CUSTOM_COST_REQUIREMENT_ON =
  1680.       /<(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  1681.     CUSTOM_COST_REQUIREMENT_OFF =
  1682.       /<\/(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  1683.     CUSTOM_COST_PERFORM_ON =
  1684.       /<(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  1685.     CUSTOM_COST_PERFORM_OFF =
  1686.       /<\/(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  1687.  
  1688.     HP_COST_MIN = /<(?:HP_COST_MIN|hp cost min):[ ](\d+)>/i
  1689.     HP_COST_MAX = /<(?:HP_COST_MIN|hp cost max):[ ](\d+)>/i
  1690.     MP_COST_MIN = /<(?:MP_COST_MIN|mp cost min):[ ](\d+)>/i
  1691.     MP_COST_MAX = /<(?:MP_COST_MIN|mp cost max):[ ](\d+)>/i
  1692.     TP_COST_MIN = /<(?:TP_COST_MIN|tp cost min):[ ](\d+)>/i
  1693.     TP_COST_MAX = /<(?:TP_COST_MIN|tp cost max):[ ](\d+)>/i
  1694.     GOLD_COST_MIN = /<(?:GOLD_COST_MIN|gold cost min):[ ](\d+)>/i
  1695.     GOLD_COST_MAX = /<(?:GOLD_COST_MIN|gold cost max):[ ](\d+)>/i
  1696.  
  1697.   end # SKILL
  1698.   end # REGEXP
  1699. end # YEA
  1700.  
  1701. #==============================================================================
  1702. # ■ Icon
  1703. #==============================================================================
  1704.  
  1705. module Icon
  1706.  
  1707.   #--------------------------------------------------------------------------
  1708.   # self.mp_cost
  1709.   #--------------------------------------------------------------------------
  1710.   def self.mp_cost; return YEA::SKILL_COST::MP_COST_ICON; end
  1711.  
  1712.   #--------------------------------------------------------------------------
  1713.   # self.tp_cost
  1714.   #--------------------------------------------------------------------------
  1715.   def self.tp_cost; return YEA::SKILL_COST::TP_COST_ICON; end
  1716.  
  1717.   #--------------------------------------------------------------------------
  1718.   # self.hp_cost
  1719.   #--------------------------------------------------------------------------
  1720.   def self.hp_cost; return YEA::SKILL_COST::HP_COST_ICON; end
  1721.  
  1722.   #--------------------------------------------------------------------------
  1723.   # self.gold_cost
  1724.   #--------------------------------------------------------------------------
  1725.   def self.gold_cost; return YEA::SKILL_COST::GOLD_COST_ICON; end
  1726.  
  1727. end # Icon
  1728.  
  1729. #==============================================================================
  1730. # ■ Numeric
  1731. #==============================================================================
  1732.  
  1733. class Numeric
  1734.  
  1735.   #--------------------------------------------------------------------------
  1736.   # new method: group_digits
  1737.   #--------------------------------------------------------------------------
  1738.   unless $imported["YEA-CoreEngine"]
  1739.   def group; return self.to_s; end
  1740.   end # $imported["YEA-CoreEngine"]
  1741.  
  1742. end # Numeric
  1743.  
  1744. #==============================================================================
  1745. # ■ DataManager
  1746. #==============================================================================
  1747.  
  1748. module DataManager
  1749.  
  1750.   #--------------------------------------------------------------------------
  1751.   # alias method: load_database
  1752.   #--------------------------------------------------------------------------
  1753.   class <<self; alias load_database_scm load_database; end
  1754.   def self.load_database
  1755.     load_database_scm
  1756.     load_notetags_scm
  1757.   end
  1758.  
  1759.   #--------------------------------------------------------------------------
  1760.   # new method: load_notetags_scm
  1761.   #--------------------------------------------------------------------------
  1762.   def self.load_notetags_scm
  1763.     groups = [$data_actors, $data_classes, $data_skills, $data_weapons,
  1764.       $data_armors, $data_enemies, $data_states]
  1765.     for group in groups
  1766.       for obj in group
  1767.         next if obj.nil?
  1768.         obj.load_notetags_scm
  1769.       end
  1770.     end
  1771.   end
  1772.  
  1773. end # DataManager
  1774.  
  1775. #==============================================================================
  1776. # ■ RPG::BaseItem
  1777. #==============================================================================
  1778.  
  1779. class RPG::BaseItem
  1780.  
  1781.   #--------------------------------------------------------------------------
  1782.   # public instance variables
  1783.   #--------------------------------------------------------------------------
  1784.   attr_accessor :tp_cost_rate
  1785.   attr_accessor :hp_cost_rate
  1786.   attr_accessor :gold_cost_rate
  1787.  
  1788.   #--------------------------------------------------------------------------
  1789.   # common cache: load_notetags_scm
  1790.   #--------------------------------------------------------------------------
  1791.   def load_notetags_scm
  1792.     @tp_cost_rate = 1.0
  1793.     @hp_cost_rate = 1.0
  1794.     @gold_cost_rate = 1.0
  1795.     #---
  1796.     self.note.split(/[\r\n]+/).each { |line|
  1797.       case line
  1798.       #---
  1799.       when YEA::REGEXP::BASEITEM::TP_COST_RATE
  1800.         @tp_cost_rate = $1.to_i * 0.01
  1801.       when YEA::REGEXP::BASEITEM::HP_COST_RATE
  1802.         @hp_cost_rate = $1.to_i * 0.01
  1803.       when YEA::REGEXP::BASEITEM::GOLD_COST_RATE
  1804.         @gold_cost_rate = $1.to_i * 0.01
  1805.       #---
  1806.       end
  1807.     } # self.note.split
  1808.     #---
  1809.   end
  1810.  
  1811. end # RPG::BaseItem
  1812.  
  1813. #==============================================================================
  1814. # ■ RPG::Skill
  1815. #==============================================================================
  1816.  
  1817. class RPG::Skill < RPG::UsableItem
  1818.  
  1819.   #--------------------------------------------------------------------------
  1820.   # public instance variables
  1821.   #--------------------------------------------------------------------------
  1822.   attr_accessor :hp_cost
  1823.   attr_accessor :hp_cost_percent
  1824.   attr_accessor :mp_cost_percent
  1825.   attr_accessor :tp_cost_percent
  1826.   attr_accessor :gold_cost
  1827.   attr_accessor :gold_cost_percent
  1828.  
  1829.   attr_accessor :hp_cost_min
  1830.   attr_accessor :hp_cost_max
  1831.   attr_accessor :mp_cost_min
  1832.   attr_accessor :mp_cost_max
  1833.   attr_accessor :tp_cost_min
  1834.   attr_accessor :tp_cost_max
  1835.   attr_accessor :gold_cost_min
  1836.   attr_accessor :gold_cost_max
  1837.  
  1838.   attr_accessor :use_custom_cost
  1839.   attr_accessor :custom_cost_text
  1840.   attr_accessor :custom_cost_colour
  1841.   attr_accessor :custom_cost_size
  1842.   attr_accessor :custom_cost_icon
  1843.   attr_accessor :custom_cost_requirement
  1844.   attr_accessor :custom_cost_perform
  1845.  
  1846.   #--------------------------------------------------------------------------
  1847.   # common cache: load_notetags_scm
  1848.   #--------------------------------------------------------------------------
  1849.   def load_notetags_scm
  1850.     @hp_cost = 0
  1851.     @gold_cost = 0
  1852.     @hp_cost_percent = 0.0
  1853.     @mp_cost_percent = 0.0
  1854.     @tp_cost_percent = 0.0
  1855.     @gold_cost_percent = 0.0
  1856.  
  1857.     @custom_cost_text = "0"
  1858.     @custom_cost_colour = 0
  1859.     @custom_cost_size = 20
  1860.     @custom_cost_icon = 0
  1861.     @custom_cost_requirement = ""
  1862.     @custom_cost_perform = ""
  1863.  
  1864.     @use_custom_cost = false
  1865.     @custom_cost_req_on = false
  1866.     @custom_cost_per_on = false
  1867.     #---
  1868.     self.note.split(/[\r\n]+/).each { |line|
  1869.       case line
  1870.       #---
  1871.       when YEA::REGEXP::SKILL::MP_COST_SET
  1872.         @mp_cost = $1.to_i
  1873.       when YEA::REGEXP::SKILL::MP_COST_PER
  1874.         @mp_cost_percent = $1.to_i * 0.01
  1875.       when YEA::REGEXP::SKILL::TP_COST_SET
  1876.         @tp_cost = $1.to_i
  1877.       when YEA::REGEXP::SKILL::TP_COST_PER
  1878.         @tp_cost_percent = $1.to_i * 0.01
  1879.       when YEA::REGEXP::SKILL::HP_COST_SET
  1880.         @hp_cost = $1.to_i
  1881.       when YEA::REGEXP::SKILL::HP_COST_PER
  1882.         @hp_cost_percent = $1.to_i * 0.01
  1883.       when YEA::REGEXP::SKILL::GOLD_COST_SET
  1884.         @gold_cost = $1.to_i
  1885.       when YEA::REGEXP::SKILL::GOLD_COST_PER
  1886.         @gold_cost_percent = $1.to_i * 0.01
  1887.       #---
  1888.       when YEA::REGEXP::SKILL::HP_COST_MIN
  1889.         @hp_cost_min = $1.to_i
  1890.       when YEA::REGEXP::SKILL::HP_COST_MAX
  1891.         @hp_cost_max = $1.to_i
  1892.       when YEA::REGEXP::SKILL::MP_COST_MIN
  1893.         @mp_cost_min = $1.to_i
  1894.       when YEA::REGEXP::SKILL::MP_COST_MAX
  1895.         @mp_cost_max = $1.to_i
  1896.       when YEA::REGEXP::SKILL::TP_COST_MIN
  1897.         @tp_cost_min = $1.to_i
  1898.       when YEA::REGEXP::SKILL::TP_COST_MAX
  1899.         @tp_cost_max = $1.to_i
  1900.       when YEA::REGEXP::SKILL::GOLD_COST_MIN
  1901.         @gold_cost_min = $1.to_i
  1902.       when YEA::REGEXP::SKILL::GOLD_COST_MAX
  1903.         @gold_cost_max = $1.to_i
  1904.       #---
  1905.       when YEA::REGEXP::SKILL::CUSTOM_COST_TEXT
  1906.         @custom_cost_text = $1.to_s
  1907.       when YEA::REGEXP::SKILL::CUSTOM_COST_COLOUR
  1908.         @custom_cost_colour = $1.to_i
  1909.       when YEA::REGEXP::SKILL::CUSTOM_COST_SIZE
  1910.         @custom_cost_size = $1.to_i
  1911.       when YEA::REGEXP::SKILL::CUSTOM_COST_ICON
  1912.         @custom_cost_icon = $1.to_i
  1913.       when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_ON
  1914.         @custom_cost_req_on = true
  1915.         @use_custom_cost = true
  1916.       when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_OFF
  1917.         @custom_cost_req_on = false
  1918.         @use_custom_cost = true
  1919.       when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_ON
  1920.         @custom_cost_per_on = true
  1921.         @use_custom_cost = true
  1922.       when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_OFF
  1923.         @custom_cost_per_on = false
  1924.         @use_custom_cost = true
  1925.       else
  1926.         @custom_cost_requirement += line.to_s if @custom_cost_req_on
  1927.         @custom_cost_perform += line.to_s if @custom_cost_per_on
  1928.       #---
  1929.       end
  1930.     } # self.note.split
  1931.     #---
  1932.   end
  1933.  
  1934. end # RPG::Skill
  1935.  
  1936. #==============================================================================
  1937. # ■ Game_BattlerBase
  1938. #==============================================================================
  1939.  
  1940. class Game_BattlerBase
  1941.  
  1942.   #--------------------------------------------------------------------------
  1943.   # alias method: skill_cost_payable?
  1944.   #--------------------------------------------------------------------------
  1945.   alias game_battlerbase_skill_cost_payable_scm skill_cost_payable?
  1946.   def skill_cost_payable?(skill)
  1947.     return false if hp <= skill_hp_cost(skill)
  1948.     return false unless gold_cost_met?(skill)
  1949.     return false unless custom_cost_met?(skill)
  1950.     return game_battlerbase_skill_cost_payable_scm(skill)
  1951.   end
  1952.  
  1953.   #--------------------------------------------------------------------------
  1954.   # new method: gold_cost_met?
  1955.   #--------------------------------------------------------------------------
  1956.   def gold_cost_met?(skill)
  1957.     return true unless actor?
  1958.     return $game_party.gold >= skill_gold_cost(skill)
  1959.   end
  1960.  
  1961.   #--------------------------------------------------------------------------
  1962.   # new method: custom_cost_met?
  1963.   #--------------------------------------------------------------------------
  1964.   def custom_cost_met?(skill)
  1965.     return true unless skill.use_custom_cost
  1966.     return eval(skill.custom_cost_requirement)
  1967.   end
  1968.  
  1969.   #--------------------------------------------------------------------------
  1970.   # alias method: pay_skill_cost
  1971.   #--------------------------------------------------------------------------
  1972.   alias game_battlerbase_pay_skill_cost_scm pay_skill_cost
  1973.   def pay_skill_cost(skill)
  1974.     game_battlerbase_pay_skill_cost_scm(skill)
  1975.     self.hp -= skill_hp_cost(skill)
  1976.     $game_party.lose_gold(skill_gold_cost(skill)) if actor?
  1977.     pay_custom_cost(skill)
  1978.   end
  1979.  
  1980.   #--------------------------------------------------------------------------
  1981.   # new method: pay_custom_cost
  1982.   #--------------------------------------------------------------------------
  1983.   def pay_custom_cost(skill)
  1984.     return unless skill.use_custom_cost
  1985.     eval(skill.custom_cost_perform)
  1986.   end
  1987.  
  1988.   #--------------------------------------------------------------------------
  1989.   # alias method: skill_mp_cost
  1990.   #--------------------------------------------------------------------------
  1991.   alias game_battlerbase_skill_mp_cost_scm skill_mp_cost
  1992.   def skill_mp_cost(skill)
  1993.     n = game_battlerbase_skill_mp_cost_scm(skill)
  1994.     n += skill.mp_cost_percent * mmp * mcr
  1995.     n = [n.to_i, skill.mp_cost_max].min unless skill.mp_cost_max.nil?
  1996.     n = [n.to_i, skill.mp_cost_min].max unless skill.mp_cost_min.nil?
  1997.     return n.to_i
  1998.   end
  1999.  
  2000.   #--------------------------------------------------------------------------
  2001.   # alias method: skill_tp_cost
  2002.   #--------------------------------------------------------------------------
  2003.   alias game_battlerbase_skill_tp_cost_scm skill_tp_cost
  2004.   def skill_tp_cost(skill)
  2005.     n = game_battlerbase_skill_tp_cost_scm(skill) * tcr
  2006.     n += skill.tp_cost_percent * max_tp * tcr
  2007.     n = [n.to_i, skill.tp_cost_max].min unless skill.tp_cost_max.nil?
  2008.     n = [n.to_i, skill.tp_cost_min].max unless skill.tp_cost_min.nil?
  2009.     return n.to_i
  2010.   end
  2011.  
  2012.   #--------------------------------------------------------------------------
  2013.   # new method: tcr
  2014.   #--------------------------------------------------------------------------
  2015.   def tcr
  2016.     n = 1.0
  2017.     if actor?
  2018.       n *= self.actor.tp_cost_rate
  2019.       n *= self.class.tp_cost_rate
  2020.       for equip in equips
  2021.         next if equip.nil?
  2022.         n *= equip.tp_cost_rate
  2023.       end
  2024.     else
  2025.       n *= self.enemy.tp_cost_rate
  2026.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  2027.         n *= self.class.tp_cost_rate
  2028.       end
  2029.     end
  2030.     for state in states
  2031.       next if state.nil?
  2032.       n *= state.tp_cost_rate
  2033.     end
  2034.     return n
  2035.   end
  2036.  
  2037.   #--------------------------------------------------------------------------
  2038.   # new method: skill_hp_cost
  2039.   #--------------------------------------------------------------------------
  2040.   def skill_hp_cost(skill)
  2041.     n = skill.hp_cost * hcr
  2042.     n += skill.hp_cost_percent * mhp * hcr
  2043.     n = [n.to_i, skill.hp_cost_max].min unless skill.hp_cost_max.nil?
  2044.     n = [n.to_i, skill.hp_cost_min].max unless skill.hp_cost_min.nil?
  2045.     return n.to_i
  2046.   end
  2047.  
  2048.   #--------------------------------------------------------------------------
  2049.   # new method: hcr
  2050.   #--------------------------------------------------------------------------
  2051.   def hcr
  2052.     n = 1.0
  2053.     if actor?
  2054.       n *= self.actor.hp_cost_rate
  2055.       n *= self.class.hp_cost_rate
  2056.       for equip in equips
  2057.         next if equip.nil?
  2058.         n *= equip.hp_cost_rate
  2059.       end
  2060.     else
  2061.       n *= self.enemy.hp_cost_rate
  2062.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  2063.         n *= self.class.hp_cost_rate
  2064.       end
  2065.     end
  2066.     for state in states
  2067.       next if state.nil?
  2068.       n *= state.hp_cost_rate
  2069.     end
  2070.     return n
  2071.   end
  2072.  
  2073.   #--------------------------------------------------------------------------
  2074.   # new method: skill_gold_cost
  2075.   #--------------------------------------------------------------------------
  2076.   def skill_gold_cost(skill)
  2077.     n = skill.gold_cost * gcr
  2078.     n += skill.gold_cost_percent * $game_party.gold * gcr
  2079.     n = [n.to_i, skill.gold_cost_max].min unless skill.gold_cost_max.nil?
  2080.     n = [n.to_i, skill.gold_cost_min].max unless skill.gold_cost_min.nil?
  2081.     return n.to_i
  2082.   end
  2083.  
  2084.   #--------------------------------------------------------------------------
  2085.   # new method: gcr
  2086.   #--------------------------------------------------------------------------
  2087.   def gcr
  2088.     n = 1.0
  2089.     n *= self.actor.gold_cost_rate
  2090.     n *= self.class.gold_cost_rate
  2091.     for equip in equips
  2092.       next if equip.nil?
  2093.       n *= equip.gold_cost_rate
  2094.     end
  2095.     for state in states
  2096.       next if state.nil?
  2097.       n *= state.gold_cost_rate
  2098.     end
  2099.     return n
  2100.   end
  2101.  
  2102. end # Game_BattlerBase
  2103.  
  2104. #==============================================================================
  2105. # ■ Window_Base
  2106. #==============================================================================
  2107.  
  2108. class Window_Base < Window
  2109.  
  2110.   #--------------------------------------------------------------------------
  2111.   # overwrite methods: cost_colours
  2112.   #--------------------------------------------------------------------------
  2113.   def mp_cost_color; text_color(YEA::SKILL_COST::MP_COST_COLOUR); end;
  2114.   def tp_cost_color; text_color(YEA::SKILL_COST::TP_COST_COLOUR); end;
  2115.   def hp_cost_color; text_color(YEA::SKILL_COST::HP_COST_COLOUR); end;
  2116.   def gold_cost_color; text_color(YEA::SKILL_COST::GOLD_COST_COLOUR); end;
  2117.  
  2118. end # Window_Base
  2119.  
  2120. #==============================================================================
  2121. # ■ Window_SkillList
  2122. #==============================================================================
  2123.  
  2124. class Window_SkillList < Window_Selectable
  2125.  
  2126.   #--------------------------------------------------------------------------
  2127.   # overwrite method: draw_skill_cost
  2128.   #--------------------------------------------------------------------------
  2129.   def draw_skill_cost(rect, skill)
  2130.     draw_tp_skill_cost(rect, skill) unless $imported["YEA-BattleEngine"]
  2131.     draw_mp_skill_cost(rect, skill)
  2132.     draw_tp_skill_cost(rect, skill) if $imported["YEA-BattleEngine"]
  2133.     draw_hp_skill_cost(rect, skill)
  2134.     draw_gold_skill_cost(rect, skill)
  2135.     draw_custom_skill_cost(rect, skill)
  2136.   end
  2137.  
  2138.   #--------------------------------------------------------------------------
  2139.   # new method: draw_mp_skill_cost
  2140.   #--------------------------------------------------------------------------
  2141.   def draw_mp_skill_cost(rect, skill)
  2142.     return unless @actor.skill_mp_cost(skill) > 0
  2143.     change_color(mp_cost_color, enable?(skill))
  2144.     #---
  2145.     icon = Icon.mp_cost
  2146.     if icon > 0
  2147.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2148.       rect.width -= 24
  2149.     end
  2150.     #---
  2151.     contents.font.size = YEA::SKILL_COST::MP_COST_SIZE
  2152.     cost = @actor.skill_mp_cost(skill)
  2153.     text = sprintf(YEA::SKILL_COST::MP_COST_SUFFIX, cost.group)
  2154.     draw_text(rect, text, 2)
  2155.     cx = text_size(text).width + 4
  2156.     rect.width -= cx
  2157.     reset_font_settings
  2158.   end
  2159.  
  2160.   #--------------------------------------------------------------------------
  2161.   # new method: draw_tp_skill_cost
  2162.   #--------------------------------------------------------------------------
  2163.   def draw_tp_skill_cost(rect, skill)
  2164.     return unless @actor.skill_tp_cost(skill) > 0
  2165.     change_color(tp_cost_color, enable?(skill))
  2166.     #---
  2167.     icon = Icon.tp_cost
  2168.     if icon > 0
  2169.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2170.       rect.width -= 24
  2171.     end
  2172.     #---
  2173.     contents.font.size = YEA::SKILL_COST::TP_COST_SIZE
  2174.     cost = @actor.skill_tp_cost(skill)
  2175.     text = sprintf(YEA::SKILL_COST::TP_COST_SUFFIX, cost.group)
  2176.     draw_text(rect, text, 2)
  2177.     cx = text_size(text).width + 4
  2178.     rect.width -= cx
  2179.     reset_font_settings
  2180.   end
  2181.  
  2182.   #--------------------------------------------------------------------------
  2183.   # new method: draw_hp_skill_cost
  2184.   #--------------------------------------------------------------------------
  2185.   def draw_hp_skill_cost(rect, skill)
  2186.     return unless @actor.skill_hp_cost(skill) > 0
  2187.     change_color(hp_cost_color, enable?(skill))
  2188.     #---
  2189.     icon = Icon.hp_cost
  2190.     if icon > 0
  2191.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2192.       rect.width -= 24
  2193.     end
  2194.     #---
  2195.     contents.font.size = YEA::SKILL_COST::HP_COST_SIZE
  2196.     cost = @actor.skill_hp_cost(skill)
  2197.     text = sprintf(YEA::SKILL_COST::HP_COST_SUFFIX, cost.group)
  2198.     draw_text(rect, text, 2)
  2199.     cx = text_size(text).width + 4
  2200.     rect.width -= cx
  2201.     reset_font_settings
  2202.   end
  2203.  
  2204.   #--------------------------------------------------------------------------
  2205.   # new method: draw_gold_skill_cost
  2206.   #--------------------------------------------------------------------------
  2207.   def draw_gold_skill_cost(rect, skill)
  2208.     return unless @actor.skill_gold_cost(skill) > 0
  2209.     change_color(gold_cost_color, enable?(skill))
  2210.     #---
  2211.     icon = Icon.gold_cost
  2212.     if icon > 0
  2213.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2214.       rect.width -= 24
  2215.     end
  2216.     #---
  2217.     contents.font.size = YEA::SKILL_COST::GOLD_COST_SIZE
  2218.     cost = @actor.skill_gold_cost(skill)
  2219.     text = sprintf(YEA::SKILL_COST::GOLD_COST_SUFFIX, cost.group)
  2220.     draw_text(rect, text, 2)
  2221.     cx = text_size(text).width + 4
  2222.     rect.width -= cx
  2223.     reset_font_settings
  2224.   end
  2225.  
  2226.   #--------------------------------------------------------------------------
  2227.   # new method: draw_custom_skill_cost
  2228.   #--------------------------------------------------------------------------
  2229.   def draw_custom_skill_cost(rect, skill)
  2230.     return unless skill.use_custom_cost
  2231.     change_color(text_color(skill.custom_cost_colour), enable?(skill))
  2232.     icon = skill.custom_cost_icon
  2233.     if icon > 0
  2234.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2235.       rect.width -= 24
  2236.     end
  2237.     contents.font.size = skill.custom_cost_size
  2238.     text = skill.custom_cost_text
  2239.     draw_text(rect, text, 2)
  2240.     cx = text_size(text).width + 4
  2241.     rect.width -= cx
  2242.     reset_font_settings
  2243.   end
  2244.  
  2245. end # Window_SkillList
  2246.  
  2247. #==============================================================================
  2248. #
  2249. # ▼ End of File
  2250. #
  2251. #==============================================================================
  

点评

在职业备注栏中填写例如<learn skills: 021>就可以指定该职业可以学习21号技能了 在技能备注栏中填写例如<learn cost: 1 exp>就可以指定学习此技能消耗的经验   发表于 2013-11-25 14:08
点击即可领养:
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2013-11-9
帖子
28
4
 楼主| 发表于 2013-11-26 12:52:09 | 只看该作者
令狐林 发表于 2013-11-25 14:04
这三个脚本分别加入到main之前 然后按照说明使用

我是说,在事件输入脚本,弹出一个技能表,你从中选一项。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
243
在线时间
341 小时
注册时间
2010-9-5
帖子
70
5
发表于 2013-11-26 13:45:57 | 只看该作者
562613736 发表于 2013-11-26 12:52
我是说,在事件输入脚本,弹出一个技能表,你从中选一项。

有个技能商店脚本  你可以看一下

评分

参与人数 1星屑 +132 收起 理由
熊喵酱 + 132 认可答案

查看全部评分

点击即可领养:
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
416 小时
注册时间
2012-11-30
帖子
162
6
发表于 2013-11-26 18:49:42 | 只看该作者
可以把技能商店链接发一次吗?

<object width="630" height="500" align="middle" id="reader" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-44455354000
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2013-11-9
帖子
28
7
 楼主| 发表于 2013-11-27 11:20:25 | 只看该作者
令狐林 发表于 2013-11-26 13:45
有个技能商店脚本  你可以看一下

好的,谢谢。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 05:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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