查看: 2995|回复: 6

[已经解决] Ace怎样在人物升级时获得技能点学习技能

[复制链接]
梦石
0
星屑
100
在线时间
84 小时
注册时间
2010-10-16
回帖
110
发表于 2014-6-8 20:59:29 | 显示全部楼层 |阅读模式

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

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

×
最近遇到这个麻烦了,希望大神解决
具体问题:想在人物升级后获得若干技能点,这个技能点不能提升人物能力只能学习技能。也就是说想做出战斗后如果人物升级获得若干技能点,打开一个窗口分配技能点学习各种技能的效果。
类似勇者斗恶龙9升级加点系统。谢谢了!
[img]http://rpg.blue/static/image/smiley/default/victory.
回归中........

…あたしは天

梦石
0
星屑
2311
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-6-8 21:00:59 | 显示全部楼层
论坛搜索“技能树”,也许可以找到你想要的
回复

使用道具 举报

梦石
0
星屑
100
在线时间
84 小时
注册时间
2010-10-16
回帖
110
 楼主| 发表于 2014-6-8 21:03:12 | 显示全部楼层
taroxd 发表于 2014-6-8 21:00
论坛搜索“技能树”,也许可以找到你想要的

首先先谢谢版主!但是目前ace有技能树系统吗?貌似没看到哎。。本人脚本盲。。
[img]http://rpg.blue/static/image/smiley/default/victory.
回归中........
回复

使用道具 举报

运否天赋

梦石
10
星屑
5246
在线时间
3568 小时
注册时间
2014-5-15
回帖
1441

开拓者

发表于 2014-6-8 21:27:34 | 显示全部楼层
脚本版:传送门 这个需要再设个变量判断升级后所加的技能点
事件版:传送门  虽然是XP版的,但是可以参照这个用事件做
土猫三国开发完成
回复

使用道具 举报

梦石
0
星屑
100
在线时间
84 小时
注册时间
2010-10-16
回帖
110
 楼主| 发表于 2014-6-8 22:32:17 | 显示全部楼层
喵kano 发表于 2014-6-8 21:27
脚本版:传送门 这个需要再设个变量判断升级后所加的技能点
事件版:传送门  虽然是XP版的,但是可以参照这 ...

这个是比较接近了。可是技能升级是将原有的技能升级成新的吧?从无到有怎么搞呢?

点评

或者最低级技能不可使用  发表于 2014-6-9 07:41
建议参考下第二个用事件做的  发表于 2014-6-8 22:33
[img]http://rpg.blue/static/image/smiley/default/victory.
回归中........
回复

使用道具 举报

梦石
0
星屑
240
在线时间
341 小时
注册时间
2010-9-5
回帖
66
发表于 2014-6-9 09:46:38 | 显示全部楼层
绝命崖 发表于 2014-6-8 22:32
这个是比较接近了。可是技能升级是将原有的技能升级成新的吧?从无到有怎么搞呢? ...

从无到有可以利用这个技能学习系统,一共三个脚本,给你
  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.     @actor = 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 @actor == 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.     @skill = 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. #==============================================================================
复制代码
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Skill Cost Manager v1.02
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal, Hard, Lunatic
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

另外,升级加技能点的话,用这个:
在Game_Actor的420行左右是判断升级的,这段代码可以改为:
  1.   def level_up
  2.     @level += 1
  3.     if @actor_id == 1
  4.           $game_variables[0032]=$game_variables[0032]+2
  5.           end
  6.     self.class.learnings.each do |learning|
  7.       learn_skill(learning.skill_id) if learning.level == @level
  8.     end
  9.   end
复制代码

这段效果就是主角升一级,32号变量增加两点,而其他人升级是不增加的,可用作技能点

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

点击即可领养:
回复

使用道具 举报

梦石
0
星屑
100
在线时间
84 小时
注册时间
2010-10-16
回帖
110
 楼主| 发表于 2014-6-10 18:45:24 | 显示全部楼层
令狐林 发表于 2014-6-9 09:46
从无到有可以利用这个技能学习系统,一共三个脚本,给你
#============================================ ...

谢谢了!
[img]http://rpg.blue/static/image/smiley/default/victory.
回归中........
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部