查看: 1436|回复: 6

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

[复制链接]
梦石
0
星屑
50
在线时间
58 小时
注册时间
2013-11-9
回帖
20
发表于 2013-11-25 13:37:17 | 显示全部楼层 |阅读模式

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

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

×
如题。(就是给你所有技能,你来选一项学习。)
梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2013-11-25 14:03:59 | 显示全部楼层
事件就能实现,事件里的选择,选择哪项,就学会XXX技能即可。
回复

使用道具 举报

梦石
0
星屑
240
在线时间
341 小时
注册时间
2010-9-5
回帖
66
发表于 2013-11-25 14:04:31 | 显示全部楼层
本帖最后由 76213585 于 2013-11-29 18:28 编辑

这三个脚本分别加入到main之前 然后按照说明使用
  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. $imported = {} if $imported.nil?
  10. $imported["YEA-SkillMenu"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.08 - Compatibility Update: Learn Skill Engine
  15. # 2012.01.02 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # This is a menu reordering script for the Skill Menu for RPG Maker VX Ace. The
  21. # script lets you add, remove, and rearrange skill menu additions added by
  22. # other scripts. This script will update periodically to provide better updated
  23. # compatibility with those other scripts.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  30. #
  31. # Adjust the module's settings to adjust the skill command window.
  32. #
  33. #==============================================================================
  34. # ▼ Compatibility
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  37. # it will run with RPG Maker VX without adjusting.
  38. #
  39. #==============================================================================

  40. module YEA
  41.   module SKILL_MENU
  42.    
  43.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  44.     # - Command Window Settings -
  45.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46.     # Adjust the command window that appears in the skill command window. Add,
  47.     # remove, or rearrange the commands as you see fit. If you would like to
  48.     # add in custom commands, please refer to the custom hash. Here's a list of
  49.     # what does what:
  50.     #
  51.     # -------------------------------------------------------------------------
  52.     # :command         Description
  53.     # -------------------------------------------------------------------------
  54.     # :stype_list      Displays all of the actor's usable skill types.
  55.     #
  56.     # :tp_mode         Requires YEA - TP Manager
  57.     # :learn_skill     Requires YEA - Learn Skill Engine
  58.     #
  59.     # :grathnode       Requires Kread-EX - Grathnode Install
  60.     # :sslots          Requires YSA - Slots Battle
  61.     #
  62.     # And that's all of the currently available commands. This list will be
  63.     # updated as more scripts become available.
  64.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65.     COMMANDS =[
  66.       :stype_list,   # Displays all of the actor's usable skill types.
  67.       :learn_skill,  # Requires YEA - Learn Skill Engine
  68.       :tp_mode,      # Requires YEA - TP Manager
  69.       :grathnode,    # Requires Kread-EX - Grathnode Install
  70.       :sslots,       # Requires YSA - Slots Battle.
  71.     # :custom1,      # Custom Skill Command 1
  72.     # :custom2,      # Custom Skill Command 2
  73.     ] # Do not remove this.
  74.    
  75.     #--------------------------------------------------------------------------
  76.     # - Skill Custom Commands -
  77.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  78.     # For those who use scripts to that may produce unique effects for
  79.     # equipping, use this hash to manage the custom commands for the Skill
  80.     # Command Window. You can disable certain commands or prevent them from
  81.     # appearing by using switches. If you don't wish to bind them to a switch,
  82.     # set the proper switch to 0 for it to have no impact.
  83.     #--------------------------------------------------------------------------
  84.     CUSTOM_SKILL_COMMANDS ={
  85.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  86.       :grathnode => ["Grathnodes",            0,          0, :command_grath],
  87.       :sslots  => [  "Pick Slots",            0,          0, :command_sslot],
  88.       :custom1 => [ "Custom Name",            0,          0, :command_name1],
  89.       :custom2 => [ "Custom Text",           13,          0, :command_name2],
  90.     } # Do not remove this.
  91.    
  92.   end # SKILL_MENU
  93. end # YEA

  94. #==============================================================================
  95. # ▼ Editting anything past this point may potentially result in causing
  96. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  97. # halitosis so edit at your own risk.
  98. #==============================================================================

  99. #==============================================================================
  100. # ■ Game_Temp
  101. #==============================================================================

  102. class Game_Temp
  103.   
  104.   #--------------------------------------------------------------------------
  105.   # public instance variables
  106.   #--------------------------------------------------------------------------
  107.   attr_accessor :scene_skill_index
  108.   attr_accessor :scene_skill_oy
  109.   
  110. end # Game_Temp

  111. #==============================================================================
  112. # ■ Window_SkillCommand
  113. #==============================================================================

  114. class Window_SkillCommand < Window_Command
  115.   
  116.   #--------------------------------------------------------------------------
  117.   # alias method: make_command_list
  118.   #--------------------------------------------------------------------------
  119.   alias window_skillcommand_make_command_list_asm make_command_list
  120.   def make_command_list
  121.     unless SceneManager.scene_is?(Scene_Skill)
  122.       window_skillcommand_make_command_list_asm
  123.       return
  124.     end
  125.     return unless @actor
  126.     for command in YEA::SKILL_MENU::COMMANDS
  127.       case command
  128.       #--- Imported YEA ---
  129.       when :stype_list
  130.         add_skill_types
  131.       #--- Imported YEA ---
  132.       when :tp_mode
  133.         next unless $imported["YEA-TPManager"]
  134.         add_tp_modes
  135.       when :learn_skill
  136.         next unless $imported["YEA-LearnSkillEngine"]
  137.         add_learn_skill_command
  138.       #--- Imported Other ---
  139.       when :grathnode
  140.         next unless $imported["KRX-GrathnodeInstall"]
  141.         process_custom_command(command)
  142.       when :sslots
  143.         next unless $imported["YSA-SlotBattle"]
  144.         process_custom_command(command)
  145.       #--- Custom Commands ---
  146.       else
  147.         process_custom_command(command)
  148.       end
  149.     end
  150.   end
  151.   
  152.   #--------------------------------------------------------------------------
  153.   # new method: add_skill_types
  154.   #--------------------------------------------------------------------------
  155.   def add_skill_types
  156.     @actor.added_skill_types.each do |stype_id|
  157.       name = $data_system.skill_types[stype_id]
  158.       add_command(name, :skill, true, stype_id)
  159.     end
  160.   end
  161.   
  162.   #--------------------------------------------------------------------------
  163.   # new method: process_custom_command
  164.   #--------------------------------------------------------------------------
  165.   def process_custom_command(command)
  166.     return unless YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS.include?(command)
  167.     show = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][2]
  168.     continue = show <= 0 ? true : $game_switches[show]
  169.     return unless continue
  170.     text = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][0]
  171.     switch = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][1]
  172.     enabled = switch <= 0 ? true : $game_switches[switch]
  173.     add_command(text, command, enabled, @actor.added_skill_types[0])
  174.   end
  175.   
  176.   #--------------------------------------------------------------------------
  177.   # new method: process_ok
  178.   #--------------------------------------------------------------------------
  179.   def process_ok
  180.     if SceneManager.scene_is?(Scene_Skill)
  181.       $game_temp.scene_skill_index = index
  182.       $game_temp.scene_skill_oy = self.oy
  183.     end
  184.     super
  185.   end
  186.   
  187. end # Window_SkillCommand

  188. #==============================================================================
  189. # ■ Scene_Skill
  190. #==============================================================================

  191. class Scene_Skill < Scene_ItemBase
  192.   
  193.   #--------------------------------------------------------------------------
  194.   # alias method: create_command_window
  195.   #--------------------------------------------------------------------------
  196.   alias scene_skill_create_command_window_asm create_command_window
  197.   def create_command_window
  198.     scene_skill_create_command_window_asm
  199.     if !$game_temp.scene_skill_index.nil? && SceneManager.scene_is?(Scene_Skill)
  200.       @command_window.select($game_temp.scene_skill_index)
  201.       @command_window.oy = $game_temp.scene_skill_oy
  202.     end
  203.     $game_temp.scene_skill_index = nil
  204.     $game_temp.scene_skill_oy = nil
  205.     process_custom_skill_commands
  206.   end
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # new method: process_custom_skill_commands
  210.   #--------------------------------------------------------------------------
  211.   def process_custom_skill_commands
  212.     for command in YEA::SKILL_MENU::COMMANDS
  213.       next unless YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS.include?(command)
  214.       called_method = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][3]
  215.       @command_window.set_handler(command, method(called_method))
  216.     end
  217.   end
  218.   
  219.   #--------------------------------------------------------------------------
  220.   # new method: command_grath
  221.   #--------------------------------------------------------------------------
  222.   def command_grath
  223.     SceneManager.call(Scene_Grathnode)
  224.   end
  225.   
  226.   #--------------------------------------------------------------------------
  227.   # new method: command_sslot
  228.   #--------------------------------------------------------------------------
  229.   def command_sslot
  230.     SceneManager.call(Scene_PickSlots)
  231.   end
  232.   
  233.   #--------------------------------------------------------------------------
  234.   # new method: command_name1
  235.   #--------------------------------------------------------------------------
  236.   def command_name1
  237.     # Do nothing.
  238.   end
  239.   
  240.   #--------------------------------------------------------------------------
  241.   # new method: command_name2
  242.   #--------------------------------------------------------------------------
  243.   def command_name2
  244.     # Do nothing.
  245.   end
  246.   
  247. end # Scene_Skill

  248. #==============================================================================
  249. #
  250. # ▼ End of File
  251. #
  252. #==============================================================================
复制代码
  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. $imported = {} if $imported.nil?
  10. $imported["YEA-LearnSkillEngine"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.08 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # For those who want an alternative for actors to learn skills outside of
  20. # leveling, this script allows actors to learn skills through a learn skill
  21. # menu. The actor can use acquired JP, EXP, or Gold to learn skills. Skills can
  22. # also be hidden until certain requirements are met.
  23. #
  24. #==============================================================================
  25. # ▼ Instructions
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # To install this script, open up your script editor and copy/paste this script
  28. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  29. #
  30. # -----------------------------------------------------------------------------
  31. # Class Notetags - These notetags go in the class notebox in the database.
  32. # -----------------------------------------------------------------------------
  33. # <learn skills: x>
  34. # <learn skills: x, x>
  35. # Sets the class to be able to learn skills x through the Learn Skills menu.
  36. # Insert multiple of these tags to increase the number of skills learned.
  37. #
  38. # -----------------------------------------------------------------------------
  39. # Skill Notetags - These notetags go in the skill notebox in the database.
  40. # -----------------------------------------------------------------------------
  41. # <learn cost: x jp>
  42. # <learn cost: x exp>
  43. # <learn cost: x gold>
  44. # Sets the learn for cost the skill to require x amounts of JP, x amounts of
  45. # exp, or x amounts of gold. Only one type of cost can be used at a time. For
  46. # JP costs, the Yanfly Engine Ace - JP Manager script must be installed.
  47. #
  48. # <learn require level: x>
  49. # Sets the skill to require the actor's current level to be x before the skill
  50. # will show up in the skill learning window.
  51. #
  52. # <learn require skill: x>
  53. # <learn require skill: x, x>
  54. # Sets the skill to require learning skill x (through any means) before the
  55. # skill becomes visible in the skill learning window. Insert multiples of these
  56. # tags to require more skills to be learned in order for the skill to show.
  57. #
  58. # <learn require switch: x>
  59. # <learn require switch: x, x>
  60. # Sets the skill to require switch x to be ON in order for it to show in the
  61. # skill learning window. Insert multiple switches to to increase the number of
  62. # switches needed to be ON before the skill is shown.
  63. #
  64. # <learn require eval>
  65. #  string
  66. #  string
  67. # </learn require eval>
  68. # For the more advanced users, replace string with lines of code to check for
  69. # whether or not the skill will be shown in skill learning window. If multiple
  70. # lines are used, they are all considered part of the same line.
  71. #
  72. #==============================================================================
  73. # ▼ Compatibility
  74. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  75. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  76. # it will run with RPG Maker VX without adjusting.
  77. #
  78. # This script is compatible with Yanfly Engine Ace - JP Manager v1.00+. The
  79. # placement of this script relative to the JP Manager script doesn't matter.
  80. #
  81. #==============================================================================

  82. module YEA
  83.   module LEARN_SKILL
  84.    
  85.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  86.     # - General Settings -
  87.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  88.     # Adjust the general settings here for your game. These adjust how the
  89.     # command name appears, a switch to show the Learn Command
  90.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  91.     COMMAND_NAME = "学习技能"    # Name used for Learn Skill command.
  92.    
  93.     # This switch will hide the "Learn" command from view if the switch is OFF.
  94.     # The "Learn" command will be shown if the switch is ON. Set this switch to
  95.     # 0 to not use this effect and to always have the Learn command be shown.
  96.     SHOW_SWITCH   = 0
  97.    
  98.     # This adjusts the order the Skill Types appear in for the command window.
  99.     # Any Skill Types unlisted will not be shown.
  100.     STYPE_ORDER = [41..999, 1..40]
  101.    
  102.     # For those who installed Yanfly Engine - Skill Restrictions, you can
  103.     # choose to display warmups or cooldowns inside of the menu here.
  104.     DRAW_WARMUP   = true        # Draw warmups for skills?
  105.     DRAW_COOLDOWN = true        # Draw cooldowns for skills?
  106.    
  107.     #-------------------------------------------------------------------------
  108.     # - Default Cost -
  109.     #-------------------------------------------------------------------------
  110.     # This sets the default costs for all skills. If the JP script isn't
  111.     # installed, the type will become :exp instead.
  112.     #
  113.     # Cost Type       Description
  114.     #  :jp            - Requires YEA - JP Manager.
  115.     #  :exp           - Makes skill cost EXP.
  116.     #  :gold          - Makes skill cost gold.
  117.     #-------------------------------------------------------------------------
  118.     DEFAULT_COST = 100          # Sets the default cost of a skill.
  119.     DEFAULT_TYPE = :jp          # Sets the default cost type.
  120.    
  121.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  122.     # - Learn Window Settings -
  123.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  124.     # These settings adjust the Learn Window's visual appearance. Adjust the
  125.     # way empty text appears, EXP cost suffixes appear, Learned text appears,
  126.     # font sizes, and cost colours here.
  127.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  128.     EMPTY_TEXT     = "-"        # Text if no restricts used for the skill.
  129.     EXP_TEXT       = "EXP"      # Text used for EXP costs.
  130.     LEARNED_TEXT   = "领悟"  # Text to indicate skill has been learned.
  131.     LEARNED_SIZE   = 20         # Font size used for learned skill text.
  132.     COLOUR_JP      = 24         # Text colour used for JP Cost.
  133.     COLOUR_EXP     =  5         # Text colour used for EXP Cost.
  134.     COLOUR_GOLD    = 21         # Text colour used for Gold Cost.
  135.     COST_SIZE      = 20         # Font size used for skill costs.
  136.    
  137.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  138.     # - Cost Window Settings -
  139.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  140.     # When a skill is selected to be learned, the cost window appears. Adjust
  141.     # the settings here to choose how your game's cost window looks. Change the
  142.     # maximum number of rows, the gold icon used for gold costs, the gold text,
  143.     # the learn skill text, the cancel text, and the cancel icon here.
  144.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  145.     MAXIMUM_ROWS      = 8               # Maximum number of rows displayed.
  146.     GOLD_ICON         = 361             # Icon used for gold costs.
  147.     GOLD_TEXT         = "金币"     # Text used for gold costs.
  148.     LEARN_SKILL_TEXT  = "学习 %s?"     # Text used to learn skill.
  149.     LEARN_CANCEL_TEXT = "放弃"        # Text used for do not learn.
  150.     CANCEL_ICON       = 187             # Icon used for cancel.
  151.    
  152.   end # LEARN_SKILL
  153. end # YEA

  154. #==============================================================================
  155. # ▼ Editting anything past this point may potentially result in causing
  156. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  157. # halitosis so edit at your own risk.
  158. #==============================================================================

  159. module YEA
  160.   module LEARN_SKILL
  161.     module_function
  162.     #--------------------------------------------------------------------------
  163.     # convert_integer_array
  164.     #--------------------------------------------------------------------------
  165.     def convert_integer_array(array)
  166.       result = []
  167.       array.each { |i|
  168.         case i
  169.         when Range; result |= i.to_a
  170.         when Integer; result |= [i]
  171.         end }
  172.       return result
  173.     end
  174.     #--------------------------------------------------------------------------
  175.     # converted_contants
  176.     #--------------------------------------------------------------------------
  177.     STYPE_ORDER = convert_integer_array(STYPE_ORDER)
  178.   end # LEARN_SKILL
  179.   module REGEXP
  180.   module CLASS
  181.    
  182.     LEARN_SKILLS = /<(?:LEARN_SKILLS|learn skills):[ ](\d+(?:\s*,\s*\d+)*)>/i
  183.    
  184.   end # CLASS
  185.   module SKILL
  186.    
  187.     LEARN_COST = /<(?:LEARN_COST|learn cost):[ ](.*)>/i
  188.     LEARN_REQUIRE_LEVEL =
  189.       /<(?:LEARN_REQUIRE_LEVEL|learn require level):[ ](\d+)>/i
  190.     LEARN_REQUIRE_SKILL =
  191.       /<(?:LEARN_REQUIRE_SKILL|learn require skill):[ ](\d+(?:\s*,\s*\d+)*)>/i
  192.     LEARN_REQUIRE_SWITCH =
  193.       /<(?:LEARN_REQUIRE_SWITCH|learn require switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  194.     LEARN_REQUIRE_EVAL_ON  = /<(?:LEARN_REQUIRE_EVAL|learn require eval)>/i
  195.     LEARN_REQUIRE_EVAL_OFF = /<\/(?:LEARN_REQUIRE_EVAL|learn require eval)>/i
  196.    
  197.   end # SKILL
  198.   end # REGEXP
  199. end # YEA

  200. #==============================================================================
  201. # ■ Numeric
  202. #==============================================================================

  203. class Numeric
  204.   
  205.   #--------------------------------------------------------------------------
  206.   # new method: group_digits
  207.   #--------------------------------------------------------------------------
  208.   unless $imported["YEA-CoreEngine"]
  209.   def group; return self.to_s; end
  210.   end # $imported["YEA-CoreEngine"]
  211.    
  212. end # Numeric

  213. #==============================================================================
  214. # ■ Icon
  215. #==============================================================================

  216. module Icon
  217.   
  218.   #--------------------------------------------------------------------------
  219.   # self.cancel
  220.   #--------------------------------------------------------------------------
  221.   def self.cancel
  222.     return YEA::LEARN_SKILL::CANCEL_ICON
  223.   end
  224.   
  225.   #--------------------------------------------------------------------------
  226.   # self.learn_skill_gold
  227.   #--------------------------------------------------------------------------
  228.   def self.learn_skill_gold
  229.     return YEA::LEARN_SKILL::GOLD_ICON
  230.   end
  231.   
  232. end # Icon

  233. #==============================================================================
  234. # ■ Switch
  235. #==============================================================================

  236. module Switch
  237.   
  238.   #--------------------------------------------------------------------------
  239.   # self.show_learn_skill
  240.   #--------------------------------------------------------------------------
  241.   def self.show_learn_skill
  242.     return true if YEA::LEARN_SKILL::SHOW_SWITCH <= 0
  243.     return $game_switches[YEA::LEARN_SKILL::SHOW_SWITCH]
  244.   end
  245.   
  246. end # Switch

  247. #==============================================================================
  248. # ■ DataManager
  249. #==============================================================================

  250. module DataManager
  251.   
  252.   #--------------------------------------------------------------------------
  253.   # alias method: load_database
  254.   #--------------------------------------------------------------------------
  255.   class <<self; alias load_database_lse load_database; end
  256.   def self.load_database
  257.     load_database_lse
  258.     load_notetags_lse
  259.   end
  260.   
  261.   #--------------------------------------------------------------------------
  262.   # new method: load_notetags_lse
  263.   #--------------------------------------------------------------------------
  264.   def self.load_notetags_lse
  265.     groups = [$data_classes, $data_skills]
  266.     for group in groups
  267.       for obj in group
  268.         next if obj.nil?
  269.         obj.load_notetags_lse
  270.       end
  271.     end
  272.   end
  273.   
  274. end # DataManager

  275. #==============================================================================
  276. # ■ RPG::Class
  277. #==============================================================================

  278. class RPG::Class < RPG::BaseItem
  279.   
  280.   #--------------------------------------------------------------------------
  281.   # public instance variables
  282.   #--------------------------------------------------------------------------
  283.   attr_accessor :learn_skills
  284.   
  285.   #--------------------------------------------------------------------------
  286.   # common cache: load_notetags_lse
  287.   #--------------------------------------------------------------------------
  288.   def load_notetags_lse
  289.     @learn_skills = []
  290.     #---
  291.     self.note.split(/[\r\n]+/).each { |line|
  292.       case line
  293.       #---
  294.       when YEA::REGEXP::CLASS::LEARN_SKILLS
  295.         $1.scan(/\d+/).each { |num|
  296.         @learn_skills.push(num.to_i) if num.to_i > 0 }
  297.       end
  298.     } # self.note.split
  299.     #---
  300.   end
  301.   
  302. end # RPG::Class

  303. #==============================================================================
  304. # ■ RPG::Skill
  305. #==============================================================================

  306. class RPG::Skill < RPG::UsableItem
  307.   
  308.   #--------------------------------------------------------------------------
  309.   # public instance variables
  310.   #--------------------------------------------------------------------------
  311.   attr_accessor :learn_cost
  312.   attr_accessor :learn_require_level
  313.   attr_accessor :learn_require_skill
  314.   attr_accessor :learn_require_switch
  315.   attr_accessor :learn_require_eval
  316.   
  317.   #--------------------------------------------------------------------------
  318.   # common cache: load_notetags_lse
  319.   #--------------------------------------------------------------------------
  320.   def load_notetags_lse
  321.     @learn_cost = [YEA::LEARN_SKILL::DEFAULT_COST]
  322.     @learn_cost.push(YEA::LEARN_SKILL::DEFAULT_TYPE)
  323.     @learn_require_level = 0
  324.     @learn_require_skill = []
  325.     @learn_require_switch = []
  326.     @learn_require_eval_on = false
  327.     #---
  328.     self.note.split(/[\r\n]+/).each { |line|
  329.       case line
  330.       #---
  331.       when YEA::REGEXP::SKILL::LEARN_COST
  332.         case $1.upcase
  333.         when /(\d+)[ ]JP/i
  334.           next unless $imported["YEA-JPManager"]
  335.           @learn_cost = [$1.to_i, :jp]
  336.         when /(\d+)[ ]EXP/i
  337.           @learn_cost = [$1.to_i, :exp]
  338.         when /(\d+)[ ]GOLD/i
  339.           @learn_cost = [$1.to_i, :gold]
  340.         end
  341.       #---
  342.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_LEVEL
  343.         @learn_require_level = $1.to_i
  344.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_SKILL
  345.         $1.scan(/\d+/).each { |num|
  346.         @learn_require_skill.push(num.to_i) if num.to_i > 0 }
  347.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_SWITCH
  348.         $1.scan(/\d+/).each { |num|
  349.         @learn_require_switch.push(num.to_i) if num.to_i > 0 }
  350.       #---
  351.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_EVAL_ON
  352.         @learn_require_eval_on = true
  353.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_EVAL_OFF
  354.         @learn_require_eval_on = false
  355.       else
  356.         next unless @learn_require_eval_on
  357.         @learn_require_eval = "" if @learn_require_eval.nil?
  358.         @learn_require_eval += line.to_s
  359.       #---
  360.       end
  361.     } # self.note.split
  362.     #---
  363.     if !$imported["YEA-JPManager"] && @learn_cost[1] == :jp
  364.       @learn_cost[1] = :exp
  365.     end
  366.   end
  367.   
  368. end # RPG::Skill

  369. #==============================================================================
  370. # ■ Game_Actor
  371. #==============================================================================

  372. class Game_Actor < Game_Battler
  373.   
  374.   #--------------------------------------------------------------------------
  375.   # alias method: skills
  376.   #--------------------------------------------------------------------------
  377.   alias game_actor_skills_lse skills
  378.   def skills
  379.     btest_add_learn_skills
  380.     game_actor_skills_lse
  381.   end
  382.   
  383.   #--------------------------------------------------------------------------
  384.   # new method: btest_add_learn_skills
  385.   #--------------------------------------------------------------------------
  386.   def btest_add_learn_skills
  387.     return unless $BTEST
  388.     for skill_id in self.class.learn_skills; learn_skill(skill_id); end
  389.   end
  390.   
  391.   #--------------------------------------------------------------------------
  392.   # new method: exp_class
  393.   #--------------------------------------------------------------------------
  394.   def exp_class(class_id)
  395.     @exp[class_id] = 0 if @exp[class_id].nil?
  396.     return @exp[class_id]
  397.   end
  398.   
  399.   #--------------------------------------------------------------------------
  400.   # lose_exp_class
  401.   #--------------------------------------------------------------------------
  402.   def lose_exp_class(value, class_id)
  403.     exp = exp_class(class_id) - value
  404.     change_exp_class(exp, class_id)
  405.   end
  406.   
  407.   #--------------------------------------------------------------------------
  408.   # change_exp_class
  409.   #--------------------------------------------------------------------------
  410.   def change_exp_class(exp, class_id)
  411.     return change_exp(exp, false) if class_id == @class_id
  412.     @exp[class_id] = [exp, 0].max
  413.   end
  414.   
  415. end # Game_Actor

  416. #==============================================================================
  417. # ■ Window_SkillCommand
  418. #==============================================================================

  419. class Window_SkillCommand < Window_Command
  420.   
  421.   #--------------------------------------------------------------------------
  422.   # alias method: make_command_list
  423.   #--------------------------------------------------------------------------
  424.   alias window_skillcommand_make_command_list_lse make_command_list
  425.   def make_command_list
  426.     window_skillcommand_make_command_list_lse
  427.     return if @actor.nil?
  428.     add_learn_skill_command unless $imported["YEA-SkillMenu"]
  429.   end
  430.   
  431.   #--------------------------------------------------------------------------
  432.   # new method: add_learn_skill_command
  433.   #--------------------------------------------------------------------------
  434.   def add_learn_skill_command
  435.     return unless Switch.show_learn_skill
  436.     name = YEA::LEARN_SKILL::COMMAND_NAME
  437.     add_command(name, :learn_skill, true, @actor.added_skill_types[0])
  438.   end
  439.   
  440. end # Window_SkillCommand

  441. #==============================================================================
  442. # ■ Window_LearnSkillCommand
  443. #==============================================================================

  444. class Window_LearnSkillCommand < Window_Command
  445.   
  446.   #--------------------------------------------------------------------------
  447.   # public instance variables
  448.   #--------------------------------------------------------------------------
  449.   attr_reader   :skill_window
  450.   
  451.   #--------------------------------------------------------------------------
  452.   # initialize
  453.   #--------------------------------------------------------------------------
  454.   def initialize(dx, dy)
  455.     super(dx, dy)
  456.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  457.   end
  458.   
  459.   #--------------------------------------------------------------------------
  460.   # window_width
  461.   #--------------------------------------------------------------------------
  462.   def window_width; return 160; end
  463.   
  464.   #--------------------------------------------------------------------------
  465.   # visible_line_number
  466.   #--------------------------------------------------------------------------
  467.   def visible_line_number; return 4; end
  468.   
  469.   #--------------------------------------------------------------------------
  470.   # actor=
  471.   #--------------------------------------------------------------------------
  472.   def actor=(actor)
  473.     return if [url=home.php?mod=space&uid=95897]@actor[/url] == actor
  474.     @actor = actor
  475.     refresh
  476.     select(item_max - 1) if index >= item_max
  477.   end
  478.   
  479.   #--------------------------------------------------------------------------
  480.   # make_command_list
  481.   #--------------------------------------------------------------------------
  482.   def make_command_list
  483.     return if @actor.nil?
  484.     make_unlocked_class_skill_types
  485.     correct_unlocked_class_learned_skills
  486.     for stype_id in YEA::LEARN_SKILL::STYPE_ORDER
  487.       next unless include?(stype_id)
  488.       name = $data_system.skill_types[stype_id]
  489.       add_command(name, :skill, true, stype_id)
  490.     end
  491.   end
  492.   
  493.   #--------------------------------------------------------------------------
  494.   # make_unlocked_class_skill_types
  495.   #--------------------------------------------------------------------------
  496.   def make_unlocked_class_skill_types
  497.     return unless $imported["YEA-ClassSystem"]
  498.     @unlocked_types = []
  499.     unlocked_classes = @actor.unlocked_classes.clone
  500.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  501.     for class_id in unlocked_classes
  502.       next if $data_classes[class_id].nil?
  503.       for feature in $data_classes[class_id].features
  504.         next unless feature.code == 41
  505.         @unlocked_types.push(feature.data_id)
  506.       end
  507.     end
  508.   end
  509.   
  510.   #--------------------------------------------------------------------------
  511.   # correct_unlocked_class_learned_skills
  512.   #--------------------------------------------------------------------------
  513.   def correct_unlocked_class_learned_skills
  514.     return unless $imported["YEA-ClassSystem"]
  515.     unlocked_classes = @actor.unlocked_classes.clone
  516.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  517.     for class_id in unlocked_classes
  518.       @actor.learn_class_skills(class_id)
  519.     end
  520.   end
  521.   
  522.   #--------------------------------------------------------------------------
  523.   # include?
  524.   #--------------------------------------------------------------------------
  525.   def include?(stype_id)
  526.     return true if @actor.added_skill_types.include?(stype_id)
  527.     if $imported["YEA-ClassSystem"]
  528.       return true if @unlocked_types.include?(stype_id)
  529.     end
  530.     return false
  531.   end
  532.   
  533.   #--------------------------------------------------------------------------
  534.   # update
  535.   #--------------------------------------------------------------------------
  536.   def update
  537.     super
  538.     @skill_window.stype_id = current_ext if @skill_window
  539.   end
  540.   
  541.   #--------------------------------------------------------------------------
  542.   # skill_window=
  543.   #--------------------------------------------------------------------------
  544.   def skill_window=(skill_window)
  545.     @skill_window = skill_window
  546.     update
  547.   end
  548.   
  549. end # Window_LearnSkillCommand

  550. #==============================================================================
  551. # ■ Window_LearnSkillList
  552. #==============================================================================

  553. class Window_LearnSkillList < Window_SkillList
  554.   
  555.   #--------------------------------------------------------------------------
  556.   # col_max
  557.   #--------------------------------------------------------------------------
  558.   def col_max; return 1; end
  559.   
  560.   #--------------------------------------------------------------------------
  561.   # select_last
  562.   #--------------------------------------------------------------------------
  563.   def select_last; select(0); end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # actor=
  567.   #--------------------------------------------------------------------------
  568.   def actor=(actor)
  569.     return if @actor == actor
  570.     super(actor)
  571.     make_learn_skills_list
  572.   end
  573.   
  574.   #--------------------------------------------------------------------------
  575.   # make_learn_skills_list
  576.   #--------------------------------------------------------------------------
  577.   def make_learn_skills_list
  578.     @learn_skills = []
  579.     @skill_classes = {}
  580.     return if @actor.nil?
  581.     for skill_id in @actor.class.learn_skills
  582.       next if $data_skills[skill_id].nil?
  583.       next if @learn_skills.include?($data_skills[skill_id])
  584.       skill = $data_skills[skill_id]
  585.       @learn_skills.push(skill)
  586.       @skill_classes[skill] = [] if @skill_classes[skill].nil?
  587.       @skill_classes[skill].push(@actor.class.id)
  588.     end
  589.     make_unlocked_class_skills
  590.   end
  591.   
  592.   #--------------------------------------------------------------------------
  593.   # make_unlocked_class_skills
  594.   #--------------------------------------------------------------------------
  595.   def make_unlocked_class_skills
  596.     return unless $imported["YEA-ClassSystem"]
  597.     @unlocked_types = []
  598.     unlocked_classes = @actor.unlocked_classes.clone
  599.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  600.     for class_id in unlocked_classes
  601.       next if $data_classes[class_id].nil?
  602.       for skill_id in $data_classes[class_id].learn_skills
  603.         next if $data_skills[skill_id].nil?
  604.         skill = $data_skills[skill_id]
  605.         @learn_skills.push(skill) unless @learn_skills.include?(skill)
  606.         @skill_classes[skill] = [] if @skill_classes[skill].nil?
  607.         @skill_classes[skill] |= [class_id]
  608.       end
  609.     end
  610.   end
  611.   
  612.   #--------------------------------------------------------------------------
  613.   # skill_classes
  614.   #--------------------------------------------------------------------------
  615.   def skill_classes(skill)
  616.     return @skill_classes[skill]
  617.   end
  618.   
  619.   #--------------------------------------------------------------------------
  620.   # make_item_list
  621.   #--------------------------------------------------------------------------
  622.   def make_item_list
  623.     return if @learn_skills.nil?
  624.     @data = @learn_skills.select {|skill| include?(skill) }
  625.   end
  626.   
  627.   #--------------------------------------------------------------------------
  628.   # include?
  629.   #--------------------------------------------------------------------------
  630.   def include?(item)
  631.     return false if item.nil?
  632.     return false unless meet_requirements?(item)
  633.     return item.stype_id == @stype_id
  634.   end
  635.   
  636.   #--------------------------------------------------------------------------
  637.   # meet_requirements?
  638.   #--------------------------------------------------------------------------
  639.   def meet_requirements?(item)
  640.     return false if @actor.nil?
  641.     return false unless meet_level_requirements?(item)
  642.     return false unless meet_skill_requirements?(item)
  643.     return false unless meet_switch_requirements?(item)
  644.     return false unless meet_eval_requirements?(item)
  645.     return true
  646.   end
  647.   
  648.   #--------------------------------------------------------------------------
  649.   # meet_level_requirements?
  650.   #--------------------------------------------------------------------------
  651.   def meet_level_requirements?(item)
  652.     return @actor.level >= item.learn_require_level
  653.   end
  654.   
  655.   #--------------------------------------------------------------------------
  656.   # meet_skill_requirements?
  657.   #--------------------------------------------------------------------------
  658.   def meet_skill_requirements?(item)
  659.     for skill_id in item.learn_require_skill
  660.       next if $data_skills[skill_id].nil?
  661.       return false unless @actor.skill_learn?($data_skills[skill_id])
  662.     end
  663.     return true
  664.   end
  665.   
  666.   #--------------------------------------------------------------------------
  667.   # meet_switch_requirements?
  668.   #--------------------------------------------------------------------------
  669.   def meet_switch_requirements?(item)
  670.     for switch_id in item.learn_require_switch
  671.       return false unless $game_switches[switch_id]
  672.     end
  673.     return true
  674.   end
  675.   
  676.   #--------------------------------------------------------------------------
  677.   # meet_eval_requirements?
  678.   #--------------------------------------------------------------------------
  679.   def meet_eval_requirements?(item)
  680.     return true if item.learn_require_eval.nil?
  681.     return eval(item.learn_require_eval)
  682.   end
  683.   
  684.   #--------------------------------------------------------------------------
  685.   # enable?
  686.   #--------------------------------------------------------------------------
  687.   def enable?(skill)
  688.     return false if skill.nil?
  689.     return false unless enabled_jp?(skill)
  690.     return false unless enabled_exp?(skill)
  691.     return false unless enabled_gold?(skill)
  692.     return !@actor.skill_learn?(skill)
  693.   end
  694.   
  695.   #--------------------------------------------------------------------------
  696.   # enabled_jp?
  697.   #--------------------------------------------------------------------------
  698.   def enabled_jp?(skill)
  699.     return true if skill.learn_cost[1] != :jp
  700.     cost = skill.learn_cost[0]
  701.     for class_id in @skill_classes[skill]
  702.       return true if @actor.jp(class_id) >= cost
  703.     end
  704.     return false
  705.   end
  706.   
  707.   #--------------------------------------------------------------------------
  708.   # enabled_exp?
  709.   #--------------------------------------------------------------------------
  710.   def enabled_exp?(skill)
  711.     return true if skill.learn_cost[1] != :exp
  712.     cost = skill.learn_cost[0]
  713.     for class_id in @skill_classes[skill]
  714.       return true if @actor.exp_class(class_id) >= cost
  715.     end
  716.     return false
  717.   end
  718.   
  719.   #--------------------------------------------------------------------------
  720.   # enabled_gold?
  721.   #--------------------------------------------------------------------------
  722.   def enabled_gold?(skill)
  723.     return true if skill.learn_cost[1] != :gold
  724.     cost = skill.learn_cost[0]
  725.     return $game_party.gold >= cost
  726.   end
  727.   
  728.   #--------------------------------------------------------------------------
  729.   # draw_item
  730.   #--------------------------------------------------------------------------
  731.   def draw_item(index)
  732.     skill = @data[index]
  733.     return if skill.nil?
  734.     rect = item_rect(index)
  735.     rect.width = (contents.width - spacing) / 2 - 4
  736.     draw_item_name(skill, rect.x, rect.y, enable?(skill), rect.width - 24)
  737.     draw_skill_cost(rect, skill)
  738.     draw_restriction_info(skill, index)
  739.     draw_learn_cost(skill, index)
  740.   end
  741.   
  742.   #--------------------------------------------------------------------------
  743.   # skill_restriction?
  744.   #--------------------------------------------------------------------------
  745.   def skill_restriction?(index)
  746.     return false
  747.   end
  748.   
  749.   #--------------------------------------------------------------------------
  750.   # draw_restriction_info
  751.   #--------------------------------------------------------------------------
  752.   def draw_restriction_info(skill, index)
  753.     return unless $imported["YEA-SkillRestrictions"]
  754.     rect = item_rect(index)
  755.     rect.x = contents.width / 2
  756.     rect.width /= 2
  757.     rect.width /= 3
  758.     rect.width -= 8
  759.     draw_skill_warmup(skill, rect)
  760.     rect.x += rect.width + 4
  761.     draw_skill_cooldown(skill, rect)
  762.   end
  763.   
  764.   #--------------------------------------------------------------------------
  765.   # draw_skill_warmup
  766.   #--------------------------------------------------------------------------
  767.   def draw_skill_warmup(skill, rect)
  768.     return unless YEA::LEARN_SKILL::DRAW_WARMUP
  769.     enabled = enable?(skill)
  770.     enabled = false if skill.warmup <= 0
  771.     change_color(warmup_colour, enabled)
  772.     icon = Icon.warmup
  773.     if icon > 0
  774.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  775.       rect.width -= 24
  776.     end
  777.     contents.font.size = YEA::SKILL_RESTRICT::WARMUP_SIZE
  778.     value = skill.warmup > 0 ? skill.warmup.group : empty_text
  779.     text = sprintf(YEA::SKILL_RESTRICT::WARMUP_SUFFIX, value)
  780.     draw_text(rect, text, 2)
  781.     reset_font_settings
  782.   end
  783.   
  784.   #--------------------------------------------------------------------------
  785.   # draw_skill_cooldown
  786.   #--------------------------------------------------------------------------
  787.   def draw_skill_cooldown(skill, rect)
  788.     return unless YEA::LEARN_SKILL::DRAW_COOLDOWN
  789.     enabled = enable?(skill)
  790.     enabled = false if skill.cooldown <= 0
  791.     change_color(cooldown_colour, enabled)
  792.     icon = Icon.cooldown
  793.     if icon > 0
  794.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  795.       rect.width -= 24
  796.     end
  797.     contents.font.size = YEA::SKILL_RESTRICT::COOLDOWN_SIZE
  798.     value = skill.cooldown > 0 ? skill.cooldown.group : empty_text
  799.     text = sprintf(YEA::SKILL_RESTRICT::COOLDOWN_SUFFIX, value)
  800.     draw_text(rect, text, 2)
  801.     reset_font_settings
  802.   end
  803.   
  804.   #--------------------------------------------------------------------------
  805.   # empty_text
  806.   #--------------------------------------------------------------------------
  807.   def empty_text
  808.     return YEA::LEARN_SKILL::EMPTY_TEXT
  809.   end
  810.   
  811.   #--------------------------------------------------------------------------
  812.   # draw_learn_cost
  813.   #--------------------------------------------------------------------------
  814.   def draw_learn_cost(skill, index)
  815.     rect = item_rect(index)
  816.     rect.width -= 4
  817.     if @actor.skill_learn?(skill)
  818.       draw_learned_skill(rect)
  819.     else
  820.       draw_learn_skill_cost(skill, rect)
  821.     end
  822.     reset_font_settings
  823.   end
  824.   
  825.   #--------------------------------------------------------------------------
  826.   # draw_learned_skill
  827.   #--------------------------------------------------------------------------
  828.   def draw_learned_skill(rect)
  829.     contents.font.size = YEA::LEARN_SKILL::LEARNED_SIZE
  830.     change_color(normal_color)
  831.     draw_text(rect, YEA::LEARN_SKILL::LEARNED_TEXT, 2)
  832.   end
  833.   
  834.   #--------------------------------------------------------------------------
  835.   # draw_learn_skill_cost
  836.   #--------------------------------------------------------------------------
  837.   def draw_learn_skill_cost(skill, rect)
  838.     case skill.learn_cost[1]
  839.     when :jp
  840.       return unless $imported["YEA-JPManager"]
  841.       draw_jp_cost(skill, rect)
  842.     when :exp
  843.       draw_exp_cost(skill, rect)
  844.     when :gold
  845.       draw_gold_cost(skill, rect)
  846.     else; return
  847.     end
  848.   end
  849.   
  850.   #--------------------------------------------------------------------------
  851.   # draw_jp_cost
  852.   #--------------------------------------------------------------------------
  853.   def draw_jp_cost(skill, rect)
  854.     enabled = enabled_jp?(skill)
  855.     if Icon.jp > 0
  856.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  857.       rect.width -= 24
  858.     end
  859.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  860.     change_color(system_color, enabled)
  861.     draw_text(rect, Vocab::jp, 2)
  862.     rect.width -= text_size(Vocab::jp).width
  863.     cost = skill.learn_cost[0]
  864.     text = cost.group
  865.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  866.     draw_text(rect, text, 2)
  867.   end
  868.   
  869.   #--------------------------------------------------------------------------
  870.   # draw_exp_cost
  871.   #--------------------------------------------------------------------------
  872.   def draw_exp_cost(skill, rect)
  873.     enabled = enabled_exp?(skill)
  874.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  875.     change_color(system_color, enabled)
  876.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  877.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  878.     cost = skill.learn_cost[0]
  879.     text = cost.group
  880.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  881.     draw_text(rect, text, 2)
  882.   end
  883.   
  884.   #--------------------------------------------------------------------------
  885.   # draw_gold_cost
  886.   #--------------------------------------------------------------------------
  887.   def draw_gold_cost(skill, rect)
  888.     enabled = enabled_jp?(skill)
  889.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  890.     change_color(system_color, enabled)
  891.     draw_text(rect, Vocab::currency_unit, 2)
  892.     rect.width -= text_size(Vocab::currency_unit).width
  893.     cost = skill.learn_cost[0]
  894.     text = cost.group
  895.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  896.     draw_text(rect, text, 2)
  897.   end
  898.   
  899. end # Window_LearnSkillList

  900. #==============================================================================
  901. # ■ Window_LearnSkillCostBack
  902. #==============================================================================

  903. class Window_LearnSkillCostBack < Window_Base
  904.   
  905.   #--------------------------------------------------------------------------
  906.   # initialize
  907.   #--------------------------------------------------------------------------
  908.   def initialize(item_window)
  909.     dw = Graphics.width * 3 / 4
  910.     dx = (Graphics.width - dw) / 2
  911.     super(dx, 0, dw, fitting_height(2))
  912.     self.openness = 0
  913.     self.back_opacity = 255
  914.     @front_window = nil
  915.     @item_window = item_window
  916.     [url=home.php?mod=space&uid=260100]@skill[/url] = nil
  917.   end
  918.   
  919.   #--------------------------------------------------------------------------
  920.   # reveal
  921.   #--------------------------------------------------------------------------
  922.   def reveal(skill, skill_classes)
  923.     [url=home.php?mod=space&uid=260100]@skill[/url] = skill
  924.     return if @skill.nil?
  925.     case @skill.learn_cost[1]
  926.     when :gold
  927.       self.height = fitting_height(3)
  928.     else
  929.       maximum = [skill_classes.size, YEA::LEARN_SKILL::MAXIMUM_ROWS].min
  930.       self.height = fitting_height(maximum + 2)
  931.     end
  932.     create_contents
  933.     self.y = (Graphics.height - self.height) / 2
  934.     refresh
  935.     open
  936.   end
  937.   
  938.   #--------------------------------------------------------------------------
  939.   # refresh
  940.   #--------------------------------------------------------------------------
  941.   def refresh
  942.     contents.clear
  943.     reset_font_settings
  944.     draw_learn_skill_text
  945.     rect = Rect.new(0, 0, contents.width - 4, line_height)
  946.     draw_learn_skill_cost(@skill, rect)
  947.   end
  948.   
  949.   #--------------------------------------------------------------------------
  950.   # draw_learn_skill_text
  951.   #--------------------------------------------------------------------------
  952.   def draw_learn_skill_text
  953.     name = sprintf("\eI[%d]%s", @skill.icon_index, @skill.name)
  954.     fmt = YEA::LEARN_SKILL::LEARN_SKILL_TEXT
  955.     text = sprintf(fmt, name)
  956.     draw_text_ex(4, 0, text)
  957.   end
  958.   
  959.   #--------------------------------------------------------------------------
  960.   # draw_learn_skill_cost
  961.   #--------------------------------------------------------------------------
  962.   def draw_learn_skill_cost(skill, rect)
  963.     case skill.learn_cost[1]
  964.     when :jp
  965.       return unless $imported["YEA-JPManager"]
  966.       draw_jp_cost(skill, rect)
  967.     when :exp
  968.       draw_exp_cost(skill, rect)
  969.     when :gold
  970.       draw_gold_cost(skill, rect)
  971.     else; return
  972.     end
  973.   end
  974.   
  975.   #--------------------------------------------------------------------------
  976.   # draw_jp_cost
  977.   #--------------------------------------------------------------------------
  978.   def draw_jp_cost(skill, rect)
  979.     enabled = true
  980.     if Icon.jp > 0
  981.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  982.       rect.width -= 24
  983.     end
  984.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  985.     change_color(system_color, enabled)
  986.     draw_text(rect, Vocab::jp, 2)
  987.     rect.width -= text_size(Vocab::jp).width
  988.     cost = skill.learn_cost[0]
  989.     text = cost.group
  990.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  991.     draw_text(rect, text, 2)
  992.   end
  993.   
  994.   #--------------------------------------------------------------------------
  995.   # draw_exp_cost
  996.   #--------------------------------------------------------------------------
  997.   def draw_exp_cost(skill, rect)
  998.     enabled = true
  999.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1000.     change_color(system_color, enabled)
  1001.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  1002.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  1003.     cost = skill.learn_cost[0]
  1004.     text = cost.group
  1005.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  1006.     draw_text(rect, text, 2)
  1007.   end
  1008.   
  1009.   #--------------------------------------------------------------------------
  1010.   # draw_gold_cost
  1011.   #--------------------------------------------------------------------------
  1012.   def draw_gold_cost(skill, rect)
  1013.     enabled = true
  1014.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1015.     change_color(system_color, enabled)
  1016.     draw_text(rect, Vocab::currency_unit, 2)
  1017.     rect.width -= text_size(Vocab::currency_unit).width
  1018.     cost = skill.learn_cost[0]
  1019.     text = cost.group
  1020.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  1021.     draw_text(rect, text, 2)
  1022.   end
  1023.   
  1024. end # Window_LearnSkillCostBack

  1025. #==============================================================================
  1026. # ■ Window_LearnSkillCostFront
  1027. #==============================================================================

  1028. class Window_LearnSkillCostFront < Window_Command
  1029.   
  1030.   #--------------------------------------------------------------------------
  1031.   # initialize
  1032.   #--------------------------------------------------------------------------
  1033.   def initialize(item_window, cost_window)
  1034.     super((Graphics.width - window_width) / 2, 0)
  1035.     self.openness = 0
  1036.     self.opacity = 0
  1037.     @item_window = item_window
  1038.     @cost_window = cost_window
  1039.     @skill = nil
  1040.     @actor = nil
  1041.     deactivate
  1042.   end
  1043.   
  1044.   #--------------------------------------------------------------------------
  1045.   # window_width
  1046.   #--------------------------------------------------------------------------
  1047.   def window_width; return Graphics.width * 3 / 4; end
  1048.   
  1049.   #--------------------------------------------------------------------------
  1050.   # skill_class
  1051.   #--------------------------------------------------------------------------
  1052.   def skill_class
  1053.     return @skill_classes.nil? ? nil : @skill_classes[index]
  1054.   end
  1055.   
  1056.   #--------------------------------------------------------------------------
  1057.   # reveal
  1058.   #--------------------------------------------------------------------------
  1059.   def reveal(skill, skill_classes, actor)
  1060.     @skill = skill
  1061.     @skill_classes = skill_classes.clone
  1062.     @actor = actor
  1063.     return if @skill.nil?
  1064.     case @skill.learn_cost[1]
  1065.     when :gold
  1066.       self.height = fitting_height(2)
  1067.     else
  1068.       maximum = [skill_classes.size, YEA::LEARN_SKILL::MAXIMUM_ROWS].min
  1069.       self.height = fitting_height(maximum + 1)
  1070.     end
  1071.     create_contents
  1072.     self.y = @cost_window.y + line_height
  1073.     refresh
  1074.     select(0)
  1075.     open
  1076.     activate
  1077.   end
  1078.   
  1079.   #--------------------------------------------------------------------------
  1080.   # make_command_list
  1081.   #--------------------------------------------------------------------------
  1082.   def make_command_list
  1083.     return if @skill_classes.nil?
  1084.     if @skill.learn_cost[1] == :gold
  1085.       add_command("GOLD", :gold, true)
  1086.       add_command(YEA::LEARN_SKILL::LEARN_CANCEL_TEXT, :cancel, true)
  1087.       return
  1088.     end
  1089.     for class_id in @skill_classes
  1090.       name = $data_classes[class_id].name
  1091.       add_command(name, :class, enabled?(class_id), class_id)
  1092.     end
  1093.     add_command(YEA::LEARN_SKILL::LEARN_CANCEL_TEXT, :cancel, true)
  1094.   end
  1095.   
  1096.   #--------------------------------------------------------------------------
  1097.   # enabled?
  1098.   #--------------------------------------------------------------------------
  1099.   def enabled?(class_id)
  1100.     cost = @skill.learn_cost[0]
  1101.     case @skill.learn_cost[1]
  1102.     when :jp
  1103.       return @actor.jp(class_id) >= cost
  1104.     when :exp
  1105.       return @actor.exp_class(class_id) >= cost
  1106.     end
  1107.     return true
  1108.   end
  1109.   
  1110.   #--------------------------------------------------------------------------
  1111.   # draw_item
  1112.   #--------------------------------------------------------------------------
  1113.   def draw_item(index)
  1114.     reset_font_settings
  1115.     rect = item_rect(index)
  1116.     rect.x += 24
  1117.     rect.width -= 28
  1118.     return draw_cancel_text(index, rect) if @list[index][:symbol] == :cancel
  1119.     draw_class_name(index, rect) if @skill.learn_cost[1] != :gold
  1120.     draw_party_gold(rect) if @skill.learn_cost[1] == :gold
  1121.     draw_learn_skill_cost(@skill, rect, index)
  1122.   end
  1123.   
  1124.   #--------------------------------------------------------------------------
  1125.   # draw_cancel_text
  1126.   #--------------------------------------------------------------------------
  1127.   def draw_cancel_text(index, rect)
  1128.     draw_icon(Icon.cancel, rect.x, rect.y)
  1129.     text = command_name(index)
  1130.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  1131.   end
  1132.   
  1133.   #--------------------------------------------------------------------------
  1134.   # draw_class_name
  1135.   #--------------------------------------------------------------------------
  1136.   def draw_class_name(index, rect)
  1137.     class_id = @list[index][:ext]
  1138.     return if $data_classes[class_id].nil?
  1139.     enabled = enabled?(class_id)
  1140.     if $imported["YEA-ClassSystem"]
  1141.       draw_icon($data_classes[class_id].icon_index, rect.x, rect.y, enabled)
  1142.     end
  1143.     rect.x += 24
  1144.     rect.width -= 24
  1145.     change_color(normal_color, enabled)
  1146.     draw_text(rect, $data_classes[class_id].name)
  1147.   end
  1148.   
  1149.   #--------------------------------------------------------------------------
  1150.   # draw_class_name
  1151.   #--------------------------------------------------------------------------
  1152.   def draw_party_gold(rect)
  1153.     enabled = true
  1154.     draw_icon(Icon.learn_skill_gold, rect.x, rect.y)
  1155.     rect.x += 24
  1156.     rect.width -= 24
  1157.     change_color(normal_color, enabled)
  1158.     draw_text(rect, YEA::LEARN_SKILL::GOLD_TEXT)
  1159.   end
  1160.   
  1161.   #--------------------------------------------------------------------------
  1162.   # draw_learn_skill_cost
  1163.   #--------------------------------------------------------------------------
  1164.   def draw_learn_skill_cost(skill, rect, index)
  1165.     case skill.learn_cost[1]
  1166.     when :jp
  1167.       return unless $imported["YEA-JPManager"]
  1168.       draw_jp_cost(skill, rect, index)
  1169.     when :exp
  1170.       draw_exp_cost(skill, rect, index)
  1171.     when :gold
  1172.       draw_gold_cost(skill, rect)
  1173.     else; return
  1174.     end
  1175.   end
  1176.   
  1177.   #--------------------------------------------------------------------------
  1178.   # draw_jp_cost
  1179.   #--------------------------------------------------------------------------
  1180.   def draw_jp_cost(skill, rect, index)
  1181.     enabled = enabled?(@list[index][:ext])
  1182.     if Icon.jp > 0
  1183.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  1184.       rect.width -= 24
  1185.     end
  1186.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1187.     change_color(system_color, enabled)
  1188.     draw_text(rect, Vocab::jp, 2)
  1189.     rect.width -= text_size(Vocab::jp).width
  1190.     cost = @actor.jp(@list[index][:ext])
  1191.     text = cost.group
  1192.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  1193.     draw_text(rect, text, 2)
  1194.   end
  1195.   
  1196.   #--------------------------------------------------------------------------
  1197.   # draw_exp_cost
  1198.   #--------------------------------------------------------------------------
  1199.   def draw_exp_cost(skill, rect, index)
  1200.     enabled = enabled?(@list[index][:ext])
  1201.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1202.     change_color(system_color, enabled)
  1203.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  1204.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  1205.     cost = @actor.exp_class(@list[index][:ext])
  1206.     text = cost.group
  1207.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  1208.     draw_text(rect, text, 2)
  1209.   end
  1210.   
  1211.   #--------------------------------------------------------------------------
  1212.   # draw_gold_cost
  1213.   #--------------------------------------------------------------------------
  1214.   def draw_gold_cost(skill, rect)
  1215.     enabled = $game_party.gold >= skill.learn_cost[0]
  1216.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1217.     change_color(system_color, enabled)
  1218.     draw_text(rect, Vocab::currency_unit, 2)
  1219.     rect.width -= text_size(Vocab::currency_unit).width
  1220.     cost = $game_party.gold
  1221.     text = cost.group
  1222.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  1223.     draw_text(rect, text, 2)
  1224.   end
  1225.   
  1226. end # Window_LearnSkillCostFront

  1227. #==============================================================================
  1228. # ■ Scene_Skill
  1229. #==============================================================================

  1230. class Scene_Skill < Scene_ItemBase
  1231.   
  1232.   #--------------------------------------------------------------------------
  1233.   # alias method: create_command_window
  1234.   #--------------------------------------------------------------------------
  1235.   alias scene_skill_create_command_window_lse create_command_window
  1236.   def create_command_window
  1237.     scene_skill_create_command_window_lse
  1238.     @command_window.set_handler(:learn_skill, method(:command_learn_skill))
  1239.   end
  1240.   
  1241.   #--------------------------------------------------------------------------
  1242.   # new method: command_learn_skill
  1243.   #--------------------------------------------------------------------------
  1244.   def command_learn_skill
  1245.     SceneManager.call(Scene_LearnSkill)
  1246.   end
  1247.   
  1248. end # Scene_Skill

  1249. #==============================================================================
  1250. # ■ Scene_LearnSkill
  1251. #==============================================================================

  1252. class Scene_LearnSkill < Scene_Skill
  1253.   
  1254.   #--------------------------------------------------------------------------
  1255.   # start
  1256.   #--------------------------------------------------------------------------
  1257.   def start
  1258.     super
  1259.     create_cost_windows
  1260.   end
  1261.   
  1262.   #--------------------------------------------------------------------------
  1263.   # create_command_window
  1264.   #--------------------------------------------------------------------------
  1265.   def create_command_window
  1266.     wy = @help_window.height
  1267.     @command_window = Window_LearnSkillCommand.new(0, wy)
  1268.     @command_window.viewport = @viewport
  1269.     @command_window.help_window = @help_window
  1270.     @command_window.actor = @actor
  1271.     @command_window.set_handler(:skill,    method(:command_skill))
  1272.     @command_window.set_handler(:cancel,   method(:return_scene))
  1273.     @command_window.set_handler(:pagedown, method(:next_actor))
  1274.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1275.   end
  1276.   
  1277.   #--------------------------------------------------------------------------
  1278.   # create_item_window
  1279.   #--------------------------------------------------------------------------
  1280.   def create_item_window
  1281.     wx = 0
  1282.     wy = @status_window.y + @status_window.height
  1283.     ww = Graphics.width
  1284.     wh = Graphics.height - wy
  1285.     @item_window = Window_LearnSkillList.new(wx, wy, ww, wh)
  1286.     @item_window.actor = @actor
  1287.     @item_window.viewport = @viewport
  1288.     @item_window.help_window = @help_window
  1289.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1290.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1291.     @command_window.skill_window = @item_window
  1292.   end
  1293.   
  1294.   #--------------------------------------------------------------------------
  1295.   # create_cost_windows
  1296.   #--------------------------------------------------------------------------
  1297.   def create_cost_windows
  1298.     @cost_window = Window_LearnSkillCostBack.new(@item_window)
  1299.     @cost_front = Window_LearnSkillCostFront.new(@item_window, @cost_window)
  1300.     @cost_window.viewport = @viewport
  1301.     @cost_front.viewport = @viewport
  1302.     @cost_front.set_handler(:ok, method(:on_cost_ok))
  1303.     @cost_front.set_handler(:cancel, method(:on_cost_cancel))
  1304.   end
  1305.   
  1306.   #--------------------------------------------------------------------------
  1307.   # on_item_ok
  1308.   #--------------------------------------------------------------------------
  1309.   def on_item_ok
  1310.     skill = @item_window.item
  1311.     @cost_window.reveal(skill, @item_window.skill_classes(skill))
  1312.     @cost_front.reveal(skill, @item_window.skill_classes(skill), @actor)
  1313.   end
  1314.   
  1315.   #--------------------------------------------------------------------------
  1316.   # on_cost_ok
  1317.   #--------------------------------------------------------------------------
  1318.   def on_cost_ok
  1319.     Sound.play_use_skill
  1320.     skill = @item_window.item
  1321.     @actor.learn_skill(skill.id)
  1322.     cost = skill.learn_cost[0]
  1323.     case skill.learn_cost[1]
  1324.     when :jp
  1325.       @actor.lose_jp(cost, @cost_front.skill_class)
  1326.     when :exp
  1327.       @actor.lose_exp_class(cost, @cost_front.skill_class)
  1328.     when :gold
  1329.       $game_party.lose_gold(cost)
  1330.     end
  1331.     on_cost_cancel
  1332.     refresh_windows
  1333.   end
  1334.   
  1335.   #--------------------------------------------------------------------------
  1336.   # on_cost_cancel
  1337.   #--------------------------------------------------------------------------
  1338.   def on_cost_cancel
  1339.     @cost_front.close
  1340.     @cost_window.close
  1341.     @item_window.activate
  1342.   end
  1343.   
  1344.   #--------------------------------------------------------------------------
  1345.   # refresh_windows
  1346.   #--------------------------------------------------------------------------
  1347.   def refresh_windows
  1348.     @item_window.refresh
  1349.     @status_window.refresh
  1350.   end
  1351.   
  1352. end # Scene_LearnSkill

  1353. #==============================================================================
  1354. #
  1355. # ▼ End of File
  1356. #
  1357. #==============================================================================[/code][code]#==============================================================================
  1358. #
  1359. # ▼ Yanfly Engine Ace - Skill Cost Manager v1.02
  1360. # -- Last Updated: 2012.01.23
  1361. # -- Level: Normal, Hard, Lunatic
  1362. # -- Requires: n/a
  1363. #
  1364. #==============================================================================

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

  1367. #==============================================================================
  1368. # ▼ Updates
  1369. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1370. # 2012.01.23 - Compatibility Update: Doppelganger
  1371. # 2011.12.11 - Started Script and Finished.
  1372. #            - Added max and min notetags.
  1373. #
  1374. #==============================================================================
  1375. # ▼ Introduction
  1376. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1377. # This script adds more functionality towards skill costs. Skills can now cost
  1378. # HP, more MP, more TP, gold, and even have custom costs. The way the skill
  1379. # costs are drawn in the display windows are changed to deliver more effective
  1380. # and reliable information to the player. And if four skill costs aren't enough
  1381. # to satisfy you, you can even make your own custom skill costs.
  1382. #
  1383. #==============================================================================
  1384. # ▼ Instructions
  1385. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1386. # To install this script, open up your script editor and copy/paste this script
  1387. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  1388. #
  1389. # -----------------------------------------------------------------------------
  1390. # Actor Notetags - These notetags go in the actors notebox in the database.
  1391. # -----------------------------------------------------------------------------
  1392. # <hp cost rate: x%>
  1393. # Allows the actor to drop the HP cost of skills to x%.
  1394. #
  1395. # <tp cost rate: x%>
  1396. # Allows the actor to drop the TP cost of skills to x%.
  1397. #
  1398. # <gold cost rate: x%>
  1399. # Allows the actor to drop the Gold cost of skills to x%.
  1400. #
  1401. # -----------------------------------------------------------------------------
  1402. # Class Notetags - These notetags go in the class notebox in the database.
  1403. # -----------------------------------------------------------------------------
  1404. # <hp cost rate: x%>
  1405. # Allows the class to drop the HP cost of skills to x%.
  1406. #
  1407. # <tp cost rate: x%>
  1408. # Allows the class to drop the TP cost of skills to x%.
  1409. #
  1410. # <gold cost rate: x%>
  1411. # Allows the class to drop the Gold cost of skills to x%.
  1412. #
  1413. # -----------------------------------------------------------------------------
  1414. # Skill Notetags - These notetags go in the skills notebox in the database.
  1415. # -----------------------------------------------------------------------------
  1416. # <hp cost: x>
  1417. # Sets the skill's HP cost to x. This function did not exist by default in
  1418. # RPG Maker VX Ace.
  1419. #
  1420. # <hp cost: x%>
  1421. # Sets the HP cost to a percentage of the actor's MaxHP. If a normal HP cost is
  1422. # present on the skill, too, then this value is added to the HP cost.
  1423. #
  1424. # <hp cost max: x>
  1425. # <hp cost min: x>
  1426. # Sets the maximum and minimum range of the HP Cost of the skill. If you do not
  1427. # use this tag, there will be no maximum and/or minimum range.
  1428. #
  1429. # <mp cost: x>
  1430. # Sets the skill's MP cost to x. Allows MP cost to exceed 9999, which is RPG
  1431. # Maker VX Ace's database editor's maximum limit.
  1432. #
  1433. # <mp cost: x%>
  1434. # Sets the MP cost to a percentage of the actor's MaxMP. If a normal MP cost is
  1435. # present on the skill, too, then this value is added to the MP cost.
  1436. #
  1437. # <mp cost max: x>
  1438. # <mp cost min: x>
  1439. # Sets the maximum and minimum range of the MP Cost of the skill. If you do not
  1440. # use this tag, there will be no maximum and/or minimum range.
  1441. #
  1442. # <tp cost: x>
  1443. # Sets the skill's TP cost to x. Allows TP cost to exceed 100, which is RPG
  1444. # Maker VX Ace's database editor's maximum limit.
  1445. #
  1446. # <tp cost: x%>
  1447. # Sets the TP cost to a percentage of the actor's MaxTP. If a normal TP cost is
  1448. # present on the skill, too, then this value is added to the TP cost.
  1449. #
  1450. # <tp cost max: x>
  1451. # <tp cost min: x>
  1452. # Sets the maximum and minimum range of the TP Cost of the skill. If you do not
  1453. # use this tag, there will be no maximum and/or minimum range.
  1454. #
  1455. # <gold cost: x>
  1456. # Sets the skill's gold cost to x. Enemies with skills that cost gold do not
  1457. # use gold. If the player does not have enough gold, the skill can't be used.
  1458. #
  1459. # <gold cost: x%>
  1460. # Sets the skill's gold cost equal to a percentage of the party's total gold.
  1461. # If both a regular gold cost and a percentile gold cost is used, the total of
  1462. # both values will be the skill's gold cost.
  1463. #
  1464. # <gold cost max: x>
  1465. # <gold cost min: x>
  1466. # Sets the maximum and minimum range of the Gold Cost of the skill. If you do
  1467. # not use this tag, there will be no maximum and/or minimum range.
  1468. #
  1469. # --- Making Your Own Custom Costs ---
  1470. #
  1471. # <custom cost: string>
  1472. # If you decide to have a custom cost for your game, insert this notetag to
  1473. # change what displays in the skill menu visually.
  1474. #
  1475. # <custom cost colour: x>
  1476. # This is the "Window" skin text colour used for the custom cost. By default,
  1477. # it is text colour 0, which is the white colour.
  1478. #
  1479. # <custom cost size: x>
  1480. # This is the text font size used for the custom cost in the display windows.
  1481. # By default, it is font size 20.
  1482. #
  1483. # <custom cost icon: x>
  1484. # If you wish to use an icon for your custom cost, replace x with the icon ID
  1485. # you wish to show in display windows. By default, it is 0 (and not shown).
  1486. #
  1487. # <custom cost requirement>
  1488. #  string
  1489. #  string
  1490. # </custom cost requirement>
  1491. # Sets the custom cost requirement of the skill with an eval function using the
  1492. # strings in between. The strings are a part of one line even if in the notebox
  1493. # they are on separate lines.
  1494. #
  1495. # <custom cost perform>
  1496. #  string
  1497. #  string
  1498. # </custom cost perform>
  1499. # Sets how the custom cost payment is done with an eval function using the
  1500. # strings in between. The strings are a part of one line even if in the notebox
  1501. # they are on separate lines.
  1502. #
  1503. # -----------------------------------------------------------------------------
  1504. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  1505. # -----------------------------------------------------------------------------
  1506. # <hp cost rate: x%>
  1507. # Allows the weapon to drop the HP cost of skills to x% when worn.
  1508. #
  1509. # <tp cost rate: x%>
  1510. # Allows the weapon to drop the TP cost of skills to x% when worn.
  1511. #
  1512. # <gold cost rate: x%>
  1513. # Allows the weapon to drop the Gold cost of skills to x% when worn.
  1514. #
  1515. # -----------------------------------------------------------------------------
  1516. # Armour Notetags - These notetags go in the armours notebox in the database.
  1517. # -----------------------------------------------------------------------------
  1518. # <hp cost rate: x%>
  1519. # Allows the armour to drop the HP cost of skills to x% when worn.
  1520. #
  1521. # <tp cost rate: x%>
  1522. # Allows the armour to drop the TP cost of skills to x% when worn.
  1523. #
  1524. # <gold cost rate: x%>
  1525. # Allows the armour to drop the TP cost of skills to x% when worn.
  1526. #
  1527. # -----------------------------------------------------------------------------
  1528. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  1529. # -----------------------------------------------------------------------------
  1530. # <hp cost rate: x%>
  1531. # Allows the enemy to drop the HP cost of skills to x%.
  1532. #
  1533. # <tp cost rate: x%>
  1534. # Allows the enemy to drop the TP cost of skills to x%.
  1535. #
  1536. # -----------------------------------------------------------------------------
  1537. # State Notetags - These notetags go in the states notebox in the database.
  1538. # -----------------------------------------------------------------------------
  1539. # <hp cost rate: x%>
  1540. # Allows the state to drop the HP cost of skills to x% when afflicted.
  1541. #
  1542. # <tp cost rate: x%>
  1543. # Allows the state to drop the TP cost of skills to x% when afflicted.
  1544. #
  1545. # <gold cost rate: x%>
  1546. # Allows the state to drop the Gold cost of skills to x% when afflicted.
  1547. #
  1548. #==============================================================================
  1549. # ▼ Compatibility
  1550. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1551. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  1552. # it will run with RPG Maker VX without adjusting.
  1553. #
  1554. #==============================================================================

  1555. module YEA
  1556.   module SKILL_COST
  1557.    
  1558.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1559.     # - HP Cost Settings -
  1560.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1561.     # New to this script are HP costs. HP costs require the battler to have
  1562.     # sufficient HP before being able to use the skill. The text colour that's
  1563.     # used, the suffix, or whether or not to use an icon. If you do not wish
  1564.     # to use an icon, set the icon to 0.
  1565.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1566.     HP_COST_COLOUR = 21         # Colour used from "Window" skin.
  1567.     HP_COST_SIZE   = 20         # Font size used for HP costs.
  1568.     HP_COST_SUFFIX = "%sHP"     # Suffix used for HP costs.
  1569.     HP_COST_ICON   = 0          # Icon used for HP costs. Set 0 to disable.
  1570.    
  1571.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1572.     # - MP Cost Settings -
  1573.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1574.     # Here, you can change the settings for MP costs: the text colour that's
  1575.     # used, the suffix, or whether or not to use an icon. If you do not wish
  1576.     # to use an icon, set the icon to 0.
  1577.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1578.     MP_COST_COLOUR = 23         # Colour used from "Window" skin. Default: 23
  1579.     MP_COST_SIZE   = 20         # Font size used for MP costs. Default: 24
  1580.     MP_COST_SUFFIX = "%sMP"     # Suffix used for MP costs. No suffix default.
  1581.     MP_COST_ICON   = 0          # Icon used for MP costs. Set 0 to disable.
  1582.    
  1583.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1584.     # - TP Cost Settings -
  1585.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1586.     # Here, you can change the settings for TP costs: the text colour that's
  1587.     # used, the suffix, or whether or not to use an icon. If you do not wish
  1588.     # to use an icon, set the icon to 0.
  1589.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1590.     TP_COST_COLOUR = 2          # Colour used from "Window" skin. Default: 29
  1591.     TP_COST_SIZE   = 20         # Font size used for TP costs. Default: 24
  1592.     TP_COST_SUFFIX = "%sTP"     # Suffix used for TP costs. No suffix default.
  1593.     TP_COST_ICON   = 0          # Icon used for TP costs. Set 0 to disable.
  1594.    
  1595.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1596.     # - Gold Cost Settings -
  1597.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1598.     # New to this script are Gold costs. Gold costs require the party to have
  1599.     # enough gold 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.     GOLD_COST_COLOUR = 6          # Colour used from "Window" skin.
  1604.     GOLD_COST_SIZE   = 20         # Font size used for Gold costs.
  1605.     GOLD_COST_SUFFIX = "%sGold"   # Suffix used for Gold costs.
  1606.     GOLD_COST_ICON   = 0          # Icon used for Gold costs. Set 0 to disable.
  1607.    
  1608.   end # SKILL_COST
  1609. end # YEA

  1610. #==============================================================================
  1611. # ▼ Editting anything past this point may potentially result in causing
  1612. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  1613. # halitosis so edit at your own risk.
  1614. #==============================================================================

  1615. module YEA
  1616.   module REGEXP
  1617.   module BASEITEM
  1618.    
  1619.     HP_COST_RATE = /<(?:HP_COST_RATE|hp cost rate):[ ](\d+)([%%])>/i
  1620.     TP_COST_RATE = /<(?:TP_COST_RATE|tp cost rate):[ ](\d+)([%%])>/i
  1621.     GOLD_COST_RATE = /<(?:GOLD_COST_RATE|gold cost rate):[ ](\d+)([%%])>/i
  1622.    
  1623.   end # BASEITEM
  1624.   module SKILL
  1625.    
  1626.     HP_COST_SET = /<(?:HP_COST|hp cost):[ ](\d+)>/i
  1627.     HP_COST_PER = /<(?:HP_COST|hp cost):[ ](\d+)([%%])>/i
  1628.     MP_COST_SET = /<(?:MP_COST|mp cost):[ ](\d+)>/i
  1629.     MP_COST_PER = /<(?:MP_COST|mp cost):[ ](\d+)([%%])>/i
  1630.     TP_COST_SET = /<(?:TP_COST|tp cost):[ ](\d+)>/i
  1631.     TP_COST_PER = /<(?:TP_COST|tp cost):[ ](\d+)([%%])>/i
  1632.     GOLD_COST_SET = /<(?:GOLD_COST|gold cost):[ ](\d+)>/i
  1633.     GOLD_COST_PER = /<(?:GOLD_COST|gold cost):[ ](\d+)([%%])>/i
  1634.    
  1635.     CUSTOM_COST_TEXT = /<(?:CUSTOM_COST|custom cost):[ ](.*)>/i
  1636.     CUSTOM_COST_COLOUR =
  1637.       /<(?:CUSTOM_COST_COLOUR|custom cost colour|custom cost color):[ ](\d+)>/i
  1638.     CUSTOM_COST_SIZE = /<(?:CUSTOM_COST_SIZE|custom cost size):[ ](\d+)>/i
  1639.     CUSTOM_COST_ICON = /<(?:CUSTOM_COST_ICON|custom cost icon):[ ](\d+)>/i
  1640.     CUSTOM_COST_REQUIREMENT_ON =
  1641.       /<(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  1642.     CUSTOM_COST_REQUIREMENT_OFF =
  1643.       /<\/(?:CUSTOM_COST_REQUIREMENT|custom cost requirement)>/i
  1644.     CUSTOM_COST_PERFORM_ON =
  1645.       /<(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  1646.     CUSTOM_COST_PERFORM_OFF =
  1647.       /<\/(?:CUSTOM_COST_PERFORM|custom cost perform)>/i
  1648.    
  1649.     HP_COST_MIN = /<(?:HP_COST_MIN|hp cost min):[ ](\d+)>/i
  1650.     HP_COST_MAX = /<(?:HP_COST_MIN|hp cost max):[ ](\d+)>/i
  1651.     MP_COST_MIN = /<(?:MP_COST_MIN|mp cost min):[ ](\d+)>/i
  1652.     MP_COST_MAX = /<(?:MP_COST_MIN|mp cost max):[ ](\d+)>/i
  1653.     TP_COST_MIN = /<(?:TP_COST_MIN|tp cost min):[ ](\d+)>/i
  1654.     TP_COST_MAX = /<(?:TP_COST_MIN|tp cost max):[ ](\d+)>/i
  1655.     GOLD_COST_MIN = /<(?:GOLD_COST_MIN|gold cost min):[ ](\d+)>/i
  1656.     GOLD_COST_MAX = /<(?:GOLD_COST_MIN|gold cost max):[ ](\d+)>/i
  1657.    
  1658.   end # SKILL
  1659.   end # REGEXP
  1660. end # YEA

  1661. #==============================================================================
  1662. # ■ Icon
  1663. #==============================================================================

  1664. module Icon
  1665.   
  1666.   #--------------------------------------------------------------------------
  1667.   # self.mp_cost
  1668.   #--------------------------------------------------------------------------
  1669.   def self.mp_cost; return YEA::SKILL_COST::MP_COST_ICON; end
  1670.   
  1671.   #--------------------------------------------------------------------------
  1672.   # self.tp_cost
  1673.   #--------------------------------------------------------------------------
  1674.   def self.tp_cost; return YEA::SKILL_COST::TP_COST_ICON; end
  1675.   
  1676.   #--------------------------------------------------------------------------
  1677.   # self.hp_cost
  1678.   #--------------------------------------------------------------------------
  1679.   def self.hp_cost; return YEA::SKILL_COST::HP_COST_ICON; end
  1680.   
  1681.   #--------------------------------------------------------------------------
  1682.   # self.gold_cost
  1683.   #--------------------------------------------------------------------------
  1684.   def self.gold_cost; return YEA::SKILL_COST::GOLD_COST_ICON; end
  1685.    
  1686. end # Icon

  1687. #==============================================================================
  1688. # ■ Numeric
  1689. #==============================================================================

  1690. class Numeric
  1691.   
  1692.   #--------------------------------------------------------------------------
  1693.   # new method: group_digits
  1694.   #--------------------------------------------------------------------------
  1695.   unless $imported["YEA-CoreEngine"]
  1696.   def group; return self.to_s; end
  1697.   end # $imported["YEA-CoreEngine"]
  1698.    
  1699. end # Numeric

  1700. #==============================================================================
  1701. # ■ DataManager
  1702. #==============================================================================

  1703. module DataManager
  1704.   
  1705.   #--------------------------------------------------------------------------
  1706.   # alias method: load_database
  1707.   #--------------------------------------------------------------------------
  1708.   class <<self; alias load_database_scm load_database; end
  1709.   def self.load_database
  1710.     load_database_scm
  1711.     load_notetags_scm
  1712.   end
  1713.   
  1714.   #--------------------------------------------------------------------------
  1715.   # new method: load_notetags_scm
  1716.   #--------------------------------------------------------------------------
  1717.   def self.load_notetags_scm
  1718.     groups = [$data_actors, $data_classes, $data_skills, $data_weapons,
  1719.       $data_armors, $data_enemies, $data_states]
  1720.     for group in groups
  1721.       for obj in group
  1722.         next if obj.nil?
  1723.         obj.load_notetags_scm
  1724.       end
  1725.     end
  1726.   end
  1727.   
  1728. end # DataManager

  1729. #==============================================================================
  1730. # ■ RPG::BaseItem
  1731. #==============================================================================

  1732. class RPG::BaseItem
  1733.   
  1734.   #--------------------------------------------------------------------------
  1735.   # public instance variables
  1736.   #--------------------------------------------------------------------------
  1737.   attr_accessor :tp_cost_rate
  1738.   attr_accessor :hp_cost_rate
  1739.   attr_accessor :gold_cost_rate
  1740.   
  1741.   #--------------------------------------------------------------------------
  1742.   # common cache: load_notetags_scm
  1743.   #--------------------------------------------------------------------------
  1744.   def load_notetags_scm
  1745.     @tp_cost_rate = 1.0
  1746.     @hp_cost_rate = 1.0
  1747.     @gold_cost_rate = 1.0
  1748.     #---
  1749.     self.note.split(/[\r\n]+/).each { |line|
  1750.       case line
  1751.       #---
  1752.       when YEA::REGEXP::BASEITEM::TP_COST_RATE
  1753.         @tp_cost_rate = $1.to_i * 0.01
  1754.       when YEA::REGEXP::BASEITEM::HP_COST_RATE
  1755.         @hp_cost_rate = $1.to_i * 0.01
  1756.       when YEA::REGEXP::BASEITEM::GOLD_COST_RATE
  1757.         @gold_cost_rate = $1.to_i * 0.01
  1758.       #---
  1759.       end
  1760.     } # self.note.split
  1761.     #---
  1762.   end
  1763.   
  1764. end # RPG::BaseItem

  1765. #==============================================================================
  1766. # ■ RPG::Skill
  1767. #==============================================================================

  1768. class RPG::Skill < RPG::UsableItem
  1769.   
  1770.   #--------------------------------------------------------------------------
  1771.   # public instance variables
  1772.   #--------------------------------------------------------------------------
  1773.   attr_accessor :hp_cost
  1774.   attr_accessor :hp_cost_percent
  1775.   attr_accessor :mp_cost_percent
  1776.   attr_accessor :tp_cost_percent
  1777.   attr_accessor :gold_cost
  1778.   attr_accessor :gold_cost_percent
  1779.   
  1780.   attr_accessor :hp_cost_min
  1781.   attr_accessor :hp_cost_max
  1782.   attr_accessor :mp_cost_min
  1783.   attr_accessor :mp_cost_max
  1784.   attr_accessor :tp_cost_min
  1785.   attr_accessor :tp_cost_max
  1786.   attr_accessor :gold_cost_min
  1787.   attr_accessor :gold_cost_max
  1788.   
  1789.   attr_accessor :use_custom_cost
  1790.   attr_accessor :custom_cost_text
  1791.   attr_accessor :custom_cost_colour
  1792.   attr_accessor :custom_cost_size
  1793.   attr_accessor :custom_cost_icon
  1794.   attr_accessor :custom_cost_requirement
  1795.   attr_accessor :custom_cost_perform
  1796.   
  1797.   #--------------------------------------------------------------------------
  1798.   # common cache: load_notetags_scm
  1799.   #--------------------------------------------------------------------------
  1800.   def load_notetags_scm
  1801.     @hp_cost = 0
  1802.     @gold_cost = 0
  1803.     @hp_cost_percent = 0.0
  1804.     @mp_cost_percent = 0.0
  1805.     @tp_cost_percent = 0.0
  1806.     @gold_cost_percent = 0.0
  1807.    
  1808.     @custom_cost_text = "0"
  1809.     @custom_cost_colour = 0
  1810.     @custom_cost_size = 20
  1811.     @custom_cost_icon = 0
  1812.     @custom_cost_requirement = ""
  1813.     @custom_cost_perform = ""
  1814.    
  1815.     @use_custom_cost = false
  1816.     @custom_cost_req_on = false
  1817.     @custom_cost_per_on = false
  1818.     #---
  1819.     self.note.split(/[\r\n]+/).each { |line|
  1820.       case line
  1821.       #---
  1822.       when YEA::REGEXP::SKILL::MP_COST_SET
  1823.         @mp_cost = $1.to_i
  1824.       when YEA::REGEXP::SKILL::MP_COST_PER
  1825.         @mp_cost_percent = $1.to_i * 0.01
  1826.       when YEA::REGEXP::SKILL::TP_COST_SET
  1827.         @tp_cost = $1.to_i
  1828.       when YEA::REGEXP::SKILL::TP_COST_PER
  1829.         @tp_cost_percent = $1.to_i * 0.01
  1830.       when YEA::REGEXP::SKILL::HP_COST_SET
  1831.         @hp_cost = $1.to_i
  1832.       when YEA::REGEXP::SKILL::HP_COST_PER
  1833.         @hp_cost_percent = $1.to_i * 0.01
  1834.       when YEA::REGEXP::SKILL::GOLD_COST_SET
  1835.         @gold_cost = $1.to_i
  1836.       when YEA::REGEXP::SKILL::GOLD_COST_PER
  1837.         @gold_cost_percent = $1.to_i * 0.01
  1838.       #---
  1839.       when YEA::REGEXP::SKILL::HP_COST_MIN
  1840.         @hp_cost_min = $1.to_i
  1841.       when YEA::REGEXP::SKILL::HP_COST_MAX
  1842.         @hp_cost_max = $1.to_i
  1843.       when YEA::REGEXP::SKILL::MP_COST_MIN
  1844.         @mp_cost_min = $1.to_i
  1845.       when YEA::REGEXP::SKILL::MP_COST_MAX
  1846.         @mp_cost_max = $1.to_i
  1847.       when YEA::REGEXP::SKILL::TP_COST_MIN
  1848.         @tp_cost_min = $1.to_i
  1849.       when YEA::REGEXP::SKILL::TP_COST_MAX
  1850.         @tp_cost_max = $1.to_i
  1851.       when YEA::REGEXP::SKILL::GOLD_COST_MIN
  1852.         @gold_cost_min = $1.to_i
  1853.       when YEA::REGEXP::SKILL::GOLD_COST_MAX
  1854.         @gold_cost_max = $1.to_i
  1855.       #---
  1856.       when YEA::REGEXP::SKILL::CUSTOM_COST_TEXT
  1857.         @custom_cost_text = $1.to_s
  1858.       when YEA::REGEXP::SKILL::CUSTOM_COST_COLOUR
  1859.         @custom_cost_colour = $1.to_i
  1860.       when YEA::REGEXP::SKILL::CUSTOM_COST_SIZE
  1861.         @custom_cost_size = $1.to_i
  1862.       when YEA::REGEXP::SKILL::CUSTOM_COST_ICON
  1863.         @custom_cost_icon = $1.to_i
  1864.       when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_ON
  1865.         @custom_cost_req_on = true
  1866.         @use_custom_cost = true
  1867.       when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_OFF
  1868.         @custom_cost_req_on = false
  1869.         @use_custom_cost = true
  1870.       when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_ON
  1871.         @custom_cost_per_on = true
  1872.         @use_custom_cost = true
  1873.       when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_OFF
  1874.         @custom_cost_per_on = false
  1875.         @use_custom_cost = true
  1876.       else
  1877.         @custom_cost_requirement += line.to_s if @custom_cost_req_on
  1878.         @custom_cost_perform += line.to_s if @custom_cost_per_on
  1879.       #---
  1880.       end
  1881.     } # self.note.split
  1882.     #---
  1883.   end
  1884.   
  1885. end # RPG::Skill

  1886. #==============================================================================
  1887. # ■ Game_BattlerBase
  1888. #==============================================================================

  1889. class Game_BattlerBase
  1890.   
  1891.   #--------------------------------------------------------------------------
  1892.   # alias method: skill_cost_payable?
  1893.   #--------------------------------------------------------------------------
  1894.   alias game_battlerbase_skill_cost_payable_scm skill_cost_payable?
  1895.   def skill_cost_payable?(skill)
  1896.     return false if hp <= skill_hp_cost(skill)
  1897.     return false unless gold_cost_met?(skill)
  1898.     return false unless custom_cost_met?(skill)
  1899.     return game_battlerbase_skill_cost_payable_scm(skill)
  1900.   end
  1901.   
  1902.   #--------------------------------------------------------------------------
  1903.   # new method: gold_cost_met?
  1904.   #--------------------------------------------------------------------------
  1905.   def gold_cost_met?(skill)
  1906.     return true unless actor?
  1907.     return $game_party.gold >= skill_gold_cost(skill)
  1908.   end
  1909.   
  1910.   #--------------------------------------------------------------------------
  1911.   # new method: custom_cost_met?
  1912.   #--------------------------------------------------------------------------
  1913.   def custom_cost_met?(skill)
  1914.     return true unless skill.use_custom_cost
  1915.     return eval(skill.custom_cost_requirement)
  1916.   end
  1917.   
  1918.   #--------------------------------------------------------------------------
  1919.   # alias method: pay_skill_cost
  1920.   #--------------------------------------------------------------------------
  1921.   alias game_battlerbase_pay_skill_cost_scm pay_skill_cost
  1922.   def pay_skill_cost(skill)
  1923.     game_battlerbase_pay_skill_cost_scm(skill)
  1924.     self.hp -= skill_hp_cost(skill)
  1925.     $game_party.lose_gold(skill_gold_cost(skill)) if actor?
  1926.     pay_custom_cost(skill)
  1927.   end
  1928.   
  1929.   #--------------------------------------------------------------------------
  1930.   # new method: pay_custom_cost
  1931.   #--------------------------------------------------------------------------
  1932.   def pay_custom_cost(skill)
  1933.     return unless skill.use_custom_cost
  1934.     eval(skill.custom_cost_perform)
  1935.   end
  1936.   
  1937.   #--------------------------------------------------------------------------
  1938.   # alias method: skill_mp_cost
  1939.   #--------------------------------------------------------------------------
  1940.   alias game_battlerbase_skill_mp_cost_scm skill_mp_cost
  1941.   def skill_mp_cost(skill)
  1942.     n = game_battlerbase_skill_mp_cost_scm(skill)
  1943.     n += skill.mp_cost_percent * mmp * mcr
  1944.     n = [n.to_i, skill.mp_cost_max].min unless skill.mp_cost_max.nil?
  1945.     n = [n.to_i, skill.mp_cost_min].max unless skill.mp_cost_min.nil?
  1946.     return n.to_i
  1947.   end
  1948.   
  1949.   #--------------------------------------------------------------------------
  1950.   # alias method: skill_tp_cost
  1951.   #--------------------------------------------------------------------------
  1952.   alias game_battlerbase_skill_tp_cost_scm skill_tp_cost
  1953.   def skill_tp_cost(skill)
  1954.     n = game_battlerbase_skill_tp_cost_scm(skill) * tcr
  1955.     n += skill.tp_cost_percent * max_tp * tcr
  1956.     n = [n.to_i, skill.tp_cost_max].min unless skill.tp_cost_max.nil?
  1957.     n = [n.to_i, skill.tp_cost_min].max unless skill.tp_cost_min.nil?
  1958.     return n.to_i
  1959.   end
  1960.   
  1961.   #--------------------------------------------------------------------------
  1962.   # new method: tcr
  1963.   #--------------------------------------------------------------------------
  1964.   def tcr
  1965.     n = 1.0
  1966.     if actor?
  1967.       n *= self.actor.tp_cost_rate
  1968.       n *= self.class.tp_cost_rate
  1969.       for equip in equips
  1970.         next if equip.nil?
  1971.         n *= equip.tp_cost_rate
  1972.       end
  1973.     else
  1974.       n *= self.enemy.tp_cost_rate
  1975.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  1976.         n *= self.class.tp_cost_rate
  1977.       end
  1978.     end
  1979.     for state in states
  1980.       next if state.nil?
  1981.       n *= state.tp_cost_rate
  1982.     end
  1983.     return n
  1984.   end
  1985.   
  1986.   #--------------------------------------------------------------------------
  1987.   # new method: skill_hp_cost
  1988.   #--------------------------------------------------------------------------
  1989.   def skill_hp_cost(skill)
  1990.     n = skill.hp_cost * hcr
  1991.     n += skill.hp_cost_percent * mhp * hcr
  1992.     n = [n.to_i, skill.hp_cost_max].min unless skill.hp_cost_max.nil?
  1993.     n = [n.to_i, skill.hp_cost_min].max unless skill.hp_cost_min.nil?
  1994.     return n.to_i
  1995.   end
  1996.   
  1997.   #--------------------------------------------------------------------------
  1998.   # new method: hcr
  1999.   #--------------------------------------------------------------------------
  2000.   def hcr
  2001.     n = 1.0
  2002.     if actor?
  2003.       n *= self.actor.hp_cost_rate
  2004.       n *= self.class.hp_cost_rate
  2005.       for equip in equips
  2006.         next if equip.nil?
  2007.         n *= equip.hp_cost_rate
  2008.       end
  2009.     else
  2010.       n *= self.enemy.hp_cost_rate
  2011.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  2012.         n *= self.class.hp_cost_rate
  2013.       end
  2014.     end
  2015.     for state in states
  2016.       next if state.nil?
  2017.       n *= state.hp_cost_rate
  2018.     end
  2019.     return n
  2020.   end
  2021.   
  2022.   #--------------------------------------------------------------------------
  2023.   # new method: skill_gold_cost
  2024.   #--------------------------------------------------------------------------
  2025.   def skill_gold_cost(skill)
  2026.     n = skill.gold_cost * gcr
  2027.     n += skill.gold_cost_percent * $game_party.gold * gcr
  2028.     n = [n.to_i, skill.gold_cost_max].min unless skill.gold_cost_max.nil?
  2029.     n = [n.to_i, skill.gold_cost_min].max unless skill.gold_cost_min.nil?
  2030.     return n.to_i
  2031.   end
  2032.   
  2033.   #--------------------------------------------------------------------------
  2034.   # new method: gcr
  2035.   #--------------------------------------------------------------------------
  2036.   def gcr
  2037.     n = 1.0
  2038.     n *= self.actor.gold_cost_rate
  2039.     n *= self.class.gold_cost_rate
  2040.     for equip in equips
  2041.       next if equip.nil?
  2042.       n *= equip.gold_cost_rate
  2043.     end
  2044.     for state in states
  2045.       next if state.nil?
  2046.       n *= state.gold_cost_rate
  2047.     end
  2048.     return n
  2049.   end
  2050.   
  2051. end # Game_BattlerBase
  2052.   
  2053. #==============================================================================
  2054. # ■ Window_Base
  2055. #==============================================================================

  2056. class Window_Base < Window
  2057.   
  2058.   #--------------------------------------------------------------------------
  2059.   # overwrite methods: cost_colours
  2060.   #--------------------------------------------------------------------------
  2061.   def mp_cost_color; text_color(YEA::SKILL_COST::MP_COST_COLOUR); end;
  2062.   def tp_cost_color; text_color(YEA::SKILL_COST::TP_COST_COLOUR); end;
  2063.   def hp_cost_color; text_color(YEA::SKILL_COST::HP_COST_COLOUR); end;
  2064.   def gold_cost_color; text_color(YEA::SKILL_COST::GOLD_COST_COLOUR); end;
  2065.   
  2066. end # Window_Base

  2067. #==============================================================================
  2068. # ■ Window_SkillList
  2069. #==============================================================================

  2070. class Window_SkillList < Window_Selectable
  2071.   
  2072.   #--------------------------------------------------------------------------
  2073.   # overwrite method: draw_skill_cost
  2074.   #--------------------------------------------------------------------------
  2075.   def draw_skill_cost(rect, skill)
  2076.     draw_tp_skill_cost(rect, skill) unless $imported["YEA-BattleEngine"]
  2077.     draw_mp_skill_cost(rect, skill)
  2078.     draw_tp_skill_cost(rect, skill) if $imported["YEA-BattleEngine"]
  2079.     draw_hp_skill_cost(rect, skill)
  2080.     draw_gold_skill_cost(rect, skill)
  2081.     draw_custom_skill_cost(rect, skill)
  2082.   end
  2083.   
  2084.   #--------------------------------------------------------------------------
  2085.   # new method: draw_mp_skill_cost
  2086.   #--------------------------------------------------------------------------
  2087.   def draw_mp_skill_cost(rect, skill)
  2088.     return unless @actor.skill_mp_cost(skill) > 0
  2089.     change_color(mp_cost_color, enable?(skill))
  2090.     #---
  2091.     icon = Icon.mp_cost
  2092.     if icon > 0
  2093.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2094.       rect.width -= 24
  2095.     end
  2096.     #---
  2097.     contents.font.size = YEA::SKILL_COST::MP_COST_SIZE
  2098.     cost = @actor.skill_mp_cost(skill)
  2099.     text = sprintf(YEA::SKILL_COST::MP_COST_SUFFIX, cost.group)
  2100.     draw_text(rect, text, 2)
  2101.     cx = text_size(text).width + 4
  2102.     rect.width -= cx
  2103.     reset_font_settings
  2104.   end
  2105.   
  2106.   #--------------------------------------------------------------------------
  2107.   # new method: draw_tp_skill_cost
  2108.   #--------------------------------------------------------------------------
  2109.   def draw_tp_skill_cost(rect, skill)
  2110.     return unless @actor.skill_tp_cost(skill) > 0
  2111.     change_color(tp_cost_color, enable?(skill))
  2112.     #---
  2113.     icon = Icon.tp_cost
  2114.     if icon > 0
  2115.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2116.       rect.width -= 24
  2117.     end
  2118.     #---
  2119.     contents.font.size = YEA::SKILL_COST::TP_COST_SIZE
  2120.     cost = @actor.skill_tp_cost(skill)
  2121.     text = sprintf(YEA::SKILL_COST::TP_COST_SUFFIX, cost.group)
  2122.     draw_text(rect, text, 2)
  2123.     cx = text_size(text).width + 4
  2124.     rect.width -= cx
  2125.     reset_font_settings
  2126.   end
  2127.   
  2128.   #--------------------------------------------------------------------------
  2129.   # new method: draw_hp_skill_cost
  2130.   #--------------------------------------------------------------------------
  2131.   def draw_hp_skill_cost(rect, skill)
  2132.     return unless @actor.skill_hp_cost(skill) > 0
  2133.     change_color(hp_cost_color, enable?(skill))
  2134.     #---
  2135.     icon = Icon.hp_cost
  2136.     if icon > 0
  2137.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2138.       rect.width -= 24
  2139.     end
  2140.     #---
  2141.     contents.font.size = YEA::SKILL_COST::HP_COST_SIZE
  2142.     cost = @actor.skill_hp_cost(skill)
  2143.     text = sprintf(YEA::SKILL_COST::HP_COST_SUFFIX, cost.group)
  2144.     draw_text(rect, text, 2)
  2145.     cx = text_size(text).width + 4
  2146.     rect.width -= cx
  2147.     reset_font_settings
  2148.   end
  2149.   
  2150.   #--------------------------------------------------------------------------
  2151.   # new method: draw_gold_skill_cost
  2152.   #--------------------------------------------------------------------------
  2153.   def draw_gold_skill_cost(rect, skill)
  2154.     return unless @actor.skill_gold_cost(skill) > 0
  2155.     change_color(gold_cost_color, enable?(skill))
  2156.     #---
  2157.     icon = Icon.gold_cost
  2158.     if icon > 0
  2159.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2160.       rect.width -= 24
  2161.     end
  2162.     #---
  2163.     contents.font.size = YEA::SKILL_COST::GOLD_COST_SIZE
  2164.     cost = @actor.skill_gold_cost(skill)
  2165.     text = sprintf(YEA::SKILL_COST::GOLD_COST_SUFFIX, cost.group)
  2166.     draw_text(rect, text, 2)
  2167.     cx = text_size(text).width + 4
  2168.     rect.width -= cx
  2169.     reset_font_settings
  2170.   end
  2171.   
  2172.   #--------------------------------------------------------------------------
  2173.   # new method: draw_custom_skill_cost
  2174.   #--------------------------------------------------------------------------
  2175.   def draw_custom_skill_cost(rect, skill)
  2176.     return unless skill.use_custom_cost
  2177.     change_color(text_color(skill.custom_cost_colour), enable?(skill))
  2178.     icon = skill.custom_cost_icon
  2179.     if icon > 0
  2180.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  2181.       rect.width -= 24
  2182.     end
  2183.     contents.font.size = skill.custom_cost_size
  2184.     text = skill.custom_cost_text
  2185.     draw_text(rect, text, 2)
  2186.     cx = text_size(text).width + 4
  2187.     rect.width -= cx
  2188.     reset_font_settings
  2189.   end
  2190.   
  2191. end # Window_SkillList

  2192. #==============================================================================
  2193. #
  2194. # ▼ End of File
  2195. #
  2196. #==============================================================================
复制代码

点评

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

使用道具 举报

梦石
0
星屑
50
在线时间
58 小时
注册时间
2013-11-9
回帖
20
 楼主| 发表于 2013-11-26 12:52:09 | 显示全部楼层
令狐林 发表于 2013-11-25 14:04
这三个脚本分别加入到main之前 然后按照说明使用

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

使用道具 举报

梦石
0
星屑
240
在线时间
341 小时
注册时间
2010-9-5
回帖
66
发表于 2013-11-26 13:45:57 | 显示全部楼层
562613736 发表于 2013-11-26 12:52
我是说,在事件输入脚本,弹出一个技能表,你从中选一项。

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

评分

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

查看全部评分

点击即可领养:
回复

使用道具 举报

梦石
0
星屑
55
在线时间
416 小时
注册时间
2012-11-30
回帖
146
发表于 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
回复

使用道具 举报

梦石
0
星屑
50
在线时间
58 小时
注册时间
2013-11-9
回帖
20
 楼主| 发表于 2013-11-27 11:20:25 | 显示全部楼层
令狐林 发表于 2013-11-26 13:45
有个技能商店脚本  你可以看一下

好的,谢谢。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部