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

Project1

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

[已经解决] 关于学习技能脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
23 小时
注册时间
2012-7-25
帖子
13
跳转到指定楼层
1
发表于 2012-8-19 11:56:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 Fracture 于 2012-8-19 11:56 编辑

脚本如下
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Learn Skill Engine v1.00
  4. # -- Last Updated: 2012.01.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-LearnSkillEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.08 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # For those who want an alternative for actors to learn skills outside of
  22. # leveling, this script allows actors to learn skills through a learn skill
  23. # menu. The actor can use acquired JP, EXP, or Gold to learn skills. Skills can
  24. # also be hidden until certain requirements are met.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Class Notetags - These notetags go in the class notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <learn skills: x>
  36. # <learn skills: x, x>
  37. # Sets the class to be able to learn skills x through the Learn Skills menu.
  38. # Insert multiple of these tags to increase the number of skills learned.
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Skill Notetags - These notetags go in the skill notebox in the database.
  42. # -----------------------------------------------------------------------------
  43. # <learn cost: x jp>
  44. # <learn cost: x exp>
  45. # <learn cost: x gold>
  46. # Sets the learn for cost the skill to require x amounts of JP, x amounts of
  47. # exp, or x amounts of gold. Only one type of cost can be used at a time. For
  48. # JP costs, the Yanfly Engine Ace - JP Manager script must be installed.
  49. #
  50. # <learn require level: x>
  51. # Sets the skill to require the actor's current level to be x before the skill
  52. # will show up in the skill learning window.
  53. #
  54. # <learn require skill: x>
  55. # <learn require skill: x, x>
  56. # Sets the skill to require learning skill x (through any means) before the
  57. # skill becomes visible in the skill learning window. Insert multiples of these
  58. # tags to require more skills to be learned in order for the skill to show.
  59. #
  60. # <learn require switch: x>
  61. # <learn require switch: x, x>
  62. # Sets the skill to require switch x to be ON in order for it to show in the
  63. # skill learning window. Insert multiple switches to to increase the number of
  64. # switches needed to be ON before the skill is shown.
  65. #
  66. # <learn require eval>
  67. #  string
  68. #  string
  69. # </learn require eval>
  70. # For the more advanced users, replace string with lines of code to check for
  71. # whether or not the skill will be shown in skill learning window. If multiple
  72. # lines are used, they are all considered part of the same line.
  73. #
  74. #==============================================================================
  75. # ▼ Compatibility
  76. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  77. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  78. # it will run with RPG Maker VX without adjusting.
  79. #
  80. # This script is compatible with Yanfly Engine Ace - JP Manager v1.00+. The
  81. # placement of this script relative to the JP Manager script doesn't matter.
  82. #
  83. #==============================================================================
  84.  
  85. module YEA
  86.   module LEARN_SKILL
  87.  
  88.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  89.     # - General Settings -
  90.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  91.     # Adjust the general settings here for your game. These adjust how the
  92.     # command name appears, a switch to show the Learn Command
  93.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  94.     COMMAND_NAME = "学习技能"    # Name used for Learn Skill command.
  95.  
  96.     # This switch will hide the "Learn" command from view if the switch is OFF.
  97.     # The "Learn" command will be shown if the switch is ON. Set this switch to
  98.     # 0 to not use this effect and to always have the Learn command be shown.
  99.     SHOW_SWITCH   = 0
  100.  
  101.     # This adjusts the order the Skill Types appear in for the command window.
  102.     # Any Skill Types unlisted will not be shown.
  103.     STYPE_ORDER = [41..999, 1..40]
  104.  
  105.     # For those who installed Yanfly Engine - Skill Restrictions, you can
  106.     # choose to display warmups or cooldowns inside of the menu here.
  107.     DRAW_WARMUP   = true        # Draw warmups for skills?
  108.     DRAW_COOLDOWN = true        # Draw cooldowns for skills?
  109.  
  110.     #-------------------------------------------------------------------------
  111.     # - Default Cost -
  112.     #-------------------------------------------------------------------------
  113.     # This sets the default costs for all skills. If the JP script isn't
  114.     # installed, the type will become :exp instead.
  115.     #
  116.     # Cost Type       Description
  117.     #  :jp            - Requires YEA - JP Manager.
  118.     #  :exp           - Makes skill cost EXP.
  119.     #  :gold          - Makes skill cost gold.
  120.     #-------------------------------------------------------------------------
  121.     DEFAULT_COST = 100          # Sets the default cost of a skill.
  122.     DEFAULT_TYPE = :jp          # Sets the default cost type.
  123.  
  124.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  125.     # - Learn Window Settings -
  126.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  127.     # These settings adjust the Learn Window's visual appearance. Adjust the
  128.     # way empty text appears, EXP cost suffixes appear, Learned text appears,
  129.     # font sizes, and cost colours here.
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     EMPTY_TEXT     = "-"        # Text if no restricts used for the skill.
  132.     EXP_TEXT       = "EXP"      # Text used for EXP costs.
  133.     LEARNED_TEXT   = "领悟"  # Text to indicate skill has been learned.
  134.     LEARNED_SIZE   = 20         # Font size used for learned skill text.
  135.     COLOUR_JP      = 24         # Text colour used for JP Cost.
  136.     COLOUR_EXP     =  5         # Text colour used for EXP Cost.
  137.     COLOUR_GOLD    = 21         # Text colour used for Gold Cost.
  138.     COST_SIZE      = 20         # Font size used for skill costs.
  139.  
  140.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  141.     # - Cost Window Settings -
  142.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  143.     # When a skill is selected to be learned, the cost window appears. Adjust
  144.     # the settings here to choose how your game's cost window looks. Change the
  145.     # maximum number of rows, the gold icon used for gold costs, the gold text,
  146.     # the learn skill text, the cancel text, and the cancel icon here.
  147.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  148.     MAXIMUM_ROWS      = 8               # Maximum number of rows displayed.
  149.     GOLD_ICON         = 361             # Icon used for gold costs.
  150.     GOLD_TEXT         = "金币"     # Text used for gold costs.
  151.     LEARN_SKILL_TEXT  = "学习 %s?"     # Text used to learn skill.
  152.     LEARN_CANCEL_TEXT = "放弃"        # Text used for do not learn.
  153.     CANCEL_ICON       = 187             # Icon used for cancel.
  154.  
  155.   end # LEARN_SKILL
  156. end # YEA
  157.  
  158. #==============================================================================
  159. # ▼ Editting anything past this point may potentially result in causing
  160. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  161. # halitosis so edit at your own risk.
  162. #==============================================================================
  163.  
  164. module YEA
  165.   module LEARN_SKILL
  166.     module_function
  167.     #--------------------------------------------------------------------------
  168.     # convert_integer_array
  169.     #--------------------------------------------------------------------------
  170.     def convert_integer_array(array)
  171.       result = []
  172.       array.each { |i|
  173.         case i
  174.         when Range; result |= i.to_a
  175.         when Integer; result |= [i]
  176.         end }
  177.       return result
  178.     end
  179.     #--------------------------------------------------------------------------
  180.     # converted_contants
  181.     #--------------------------------------------------------------------------
  182.     STYPE_ORDER = convert_integer_array(STYPE_ORDER)
  183.   end # LEARN_SKILL
  184.   module REGEXP
  185.   module CLASS
  186.  
  187.     LEARN_SKILLS = /<(?:LEARN_SKILLS|learn skills):[ ](\d+(?:\s*,\s*\d+)*)>/i
  188.  
  189.   end # CLASS
  190.   module SKILL
  191.  
  192.     LEARN_COST = /<(?:LEARN_COST|learn cost):[ ](.*)>/i
  193.     LEARN_REQUIRE_LEVEL =
  194.       /<(?:LEARN_REQUIRE_LEVEL|learn require level):[ ](\d+)>/i
  195.     LEARN_REQUIRE_SKILL =
  196.       /<(?:LEARN_REQUIRE_SKILL|learn require skill):[ ](\d+(?:\s*,\s*\d+)*)>/i
  197.     LEARN_REQUIRE_SWITCH =
  198.       /<(?:LEARN_REQUIRE_SWITCH|learn require switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  199.     LEARN_REQUIRE_EVAL_ON  = /<(?:LEARN_REQUIRE_EVAL|learn require eval)>/i
  200.     LEARN_REQUIRE_EVAL_OFF = /<\/(?:LEARN_REQUIRE_EVAL|learn require eval)>/i
  201.  
  202.   end # SKILL
  203.   end # REGEXP
  204. end # YEA
  205.  
  206. #==============================================================================
  207. # ■ Numeric
  208. #==============================================================================
  209.  
  210. class Numeric
  211.  
  212.   #--------------------------------------------------------------------------
  213.   # new method: group_digits
  214.   #--------------------------------------------------------------------------
  215.   unless $imported["YEA-CoreEngine"]
  216.   def group; return self.to_s; end
  217.   end # $imported["YEA-CoreEngine"]
  218.  
  219. end # Numeric
  220.  
  221. #==============================================================================
  222. # ■ Icon
  223. #==============================================================================
  224.  
  225. module Icon
  226.  
  227.   #--------------------------------------------------------------------------
  228.   # self.cancel
  229.   #--------------------------------------------------------------------------
  230.   def self.cancel
  231.     return YEA::LEARN_SKILL::CANCEL_ICON
  232.   end
  233.  
  234.   #--------------------------------------------------------------------------
  235.   # self.learn_skill_gold
  236.   #--------------------------------------------------------------------------
  237.   def self.learn_skill_gold
  238.     return YEA::LEARN_SKILL::GOLD_ICON
  239.   end
  240.  
  241. end # Icon
  242.  
  243. #==============================================================================
  244. # ■ Switch
  245. #==============================================================================
  246.  
  247. module Switch
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # self.show_learn_skill
  251.   #--------------------------------------------------------------------------
  252.   def self.show_learn_skill
  253.     return true if YEA::LEARN_SKILL::SHOW_SWITCH <= 0
  254.     return $game_switches[YEA::LEARN_SKILL::SHOW_SWITCH]
  255.   end
  256.  
  257. end # Switch
  258.  
  259. #==============================================================================
  260. # ■ DataManager
  261. #==============================================================================
  262.  
  263. module DataManager
  264.  
  265.   #--------------------------------------------------------------------------
  266.   # alias method: load_database
  267.   #--------------------------------------------------------------------------
  268.   class <<self; alias load_database_lse load_database; end
  269.   def self.load_database
  270.     load_database_lse
  271.     load_notetags_lse
  272.   end
  273.  
  274.   #--------------------------------------------------------------------------
  275.   # new method: load_notetags_lse
  276.   #--------------------------------------------------------------------------
  277.   def self.load_notetags_lse
  278.     groups = [$data_classes, $data_skills]
  279.     for group in groups
  280.       for obj in group
  281.         next if obj.nil?
  282.         obj.load_notetags_lse
  283.       end
  284.     end
  285.   end
  286.  
  287. end # DataManager
  288.  
  289. #==============================================================================
  290. # ■ RPG::Class
  291. #==============================================================================
  292.  
  293. class RPG::Class < RPG::BaseItem
  294.  
  295.   #--------------------------------------------------------------------------
  296.   # public instance variables
  297.   #--------------------------------------------------------------------------
  298.   attr_accessor :learn_skills
  299.  
  300.   #--------------------------------------------------------------------------
  301.   # common cache: load_notetags_lse
  302.   #--------------------------------------------------------------------------
  303.   def load_notetags_lse
  304.     @learn_skills = []
  305.     #---
  306.     self.note.split(/[\r\n]+/).each { |line|
  307.       case line
  308.       #---
  309.       when YEA::REGEXP::CLASS::LEARN_SKILLS
  310.         $1.scan(/\d+/).each { |num|
  311.         @learn_skills.push(num.to_i) if num.to_i > 0 }
  312.       end
  313.     } # self.note.split
  314.     #---
  315.   end
  316.  
  317. end # RPG::Class
  318.  
  319. #==============================================================================
  320. # ■ RPG::Skill
  321. #==============================================================================
  322.  
  323. class RPG::Skill < RPG::UsableItem
  324.  
  325.   #--------------------------------------------------------------------------
  326.   # public instance variables
  327.   #--------------------------------------------------------------------------
  328.   attr_accessor :learn_cost
  329.   attr_accessor :learn_require_level
  330.   attr_accessor :learn_require_skill
  331.   attr_accessor :learn_require_switch
  332.   attr_accessor :learn_require_eval
  333.  
  334.   #--------------------------------------------------------------------------
  335.   # common cache: load_notetags_lse
  336.   #--------------------------------------------------------------------------
  337.   def load_notetags_lse
  338.     @learn_cost = [YEA::LEARN_SKILL::DEFAULT_COST]
  339.     @learn_cost.push(YEA::LEARN_SKILL::DEFAULT_TYPE)
  340.     @learn_require_level = 0
  341.     @learn_require_skill = []
  342.     @learn_require_switch = []
  343.     @learn_require_eval_on = false
  344.     #---
  345.     self.note.split(/[\r\n]+/).each { |line|
  346.       case line
  347.       #---
  348.       when YEA::REGEXP::SKILL::LEARN_COST
  349.         case $1.upcase
  350.         when /(\d+)[ ]JP/i
  351.           next unless $imported["YEA-JPManager"]
  352.           @learn_cost = [$1.to_i, :jp]
  353.         when /(\d+)[ ]EXP/i
  354.           @learn_cost = [$1.to_i, :exp]
  355.         when /(\d+)[ ]GOLD/i
  356.           @learn_cost = [$1.to_i, :gold]
  357.         end
  358.       #---
  359.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_LEVEL
  360.         @learn_require_level = $1.to_i
  361.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_SKILL
  362.         $1.scan(/\d+/).each { |num|
  363.         @learn_require_skill.push(num.to_i) if num.to_i > 0 }
  364.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_SWITCH
  365.         $1.scan(/\d+/).each { |num|
  366.         @learn_require_switch.push(num.to_i) if num.to_i > 0 }
  367.       #---
  368.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_EVAL_ON
  369.         @learn_require_eval_on = true
  370.       when YEA::REGEXP::SKILL::LEARN_REQUIRE_EVAL_OFF
  371.         @learn_require_eval_on = false
  372.       else
  373.         next unless @learn_require_eval_on
  374.         @learn_require_eval = "" if @learn_require_eval.nil?
  375.         @learn_require_eval += line.to_s
  376.       #---
  377.       end
  378.     } # self.note.split
  379.     #---
  380.     if !$imported["YEA-JPManager"] && @learn_cost[1] == :jp
  381.       @learn_cost[1] = :exp
  382.     end
  383.   end
  384.  
  385. end # RPG::Skill
  386.  
  387. #==============================================================================
  388. # ■ Game_Actor
  389. #==============================================================================
  390.  
  391. class Game_Actor < Game_Battler
  392.  
  393.   #--------------------------------------------------------------------------
  394.   # alias method: skills
  395.   #--------------------------------------------------------------------------
  396.   alias game_actor_skills_lse skills
  397.   def skills
  398.     btest_add_learn_skills
  399.     game_actor_skills_lse
  400.   end
  401.  
  402.   #--------------------------------------------------------------------------
  403.   # new method: btest_add_learn_skills
  404.   #--------------------------------------------------------------------------
  405.   def btest_add_learn_skills
  406.     return unless $BTEST
  407.     for skill_id in self.class.learn_skills; learn_skill(skill_id); end
  408.   end
  409.  
  410.   #--------------------------------------------------------------------------
  411.   # new method: exp_class
  412.   #--------------------------------------------------------------------------
  413.   def exp_class(class_id)
  414.     @exp[class_id] = 0 if @exp[class_id].nil?
  415.     return @exp[class_id]
  416.   end
  417.  
  418.   #--------------------------------------------------------------------------
  419.   # lose_exp_class
  420.   #--------------------------------------------------------------------------
  421.   def lose_exp_class(value, class_id)
  422.     exp = exp_class(class_id) - value
  423.     change_exp_class(exp, class_id)
  424.   end
  425.  
  426.   #--------------------------------------------------------------------------
  427.   # change_exp_class
  428.   #--------------------------------------------------------------------------
  429.   def change_exp_class(exp, class_id)
  430.     return change_exp(exp, false) if class_id == @class_id
  431.     @exp[class_id] = [exp, 0].max
  432.   end
  433.  
  434. end # Game_Actor
  435.  
  436. #==============================================================================
  437. # ■ Window_SkillCommand
  438. #==============================================================================
  439.  
  440. class Window_SkillCommand < Window_Command
  441.  
  442.   #--------------------------------------------------------------------------
  443.   # alias method: make_command_list
  444.   #--------------------------------------------------------------------------
  445.   alias window_skillcommand_make_command_list_lse make_command_list
  446.   def make_command_list
  447.     window_skillcommand_make_command_list_lse
  448.     return if @actor.nil?
  449.     add_learn_skill_command unless $imported["YEA-SkillMenu"]
  450.   end
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # new method: add_learn_skill_command
  454.   #--------------------------------------------------------------------------
  455.   def add_learn_skill_command
  456.     return unless Switch.show_learn_skill
  457.     name = YEA::LEARN_SKILL::COMMAND_NAME
  458.     add_command(name, :learn_skill, true, @actor.added_skill_types[0])
  459.   end
  460.  
  461. end # Window_SkillCommand
  462.  
  463. #==============================================================================
  464. # ■ Window_LearnSkillCommand
  465. #==============================================================================
  466.  
  467. class Window_LearnSkillCommand < Window_Command
  468.  
  469.   #--------------------------------------------------------------------------
  470.   # public instance variables
  471.   #--------------------------------------------------------------------------
  472.   attr_reader   :skill_window
  473.  
  474.   #--------------------------------------------------------------------------
  475.   # initialize
  476.   #--------------------------------------------------------------------------
  477.   def initialize(dx, dy)
  478.     super(dx, dy)
  479.     @actor = nil
  480.   end
  481.  
  482.   #--------------------------------------------------------------------------
  483.   # window_width
  484.   #--------------------------------------------------------------------------
  485.   def window_width; return 160; end
  486.  
  487.   #--------------------------------------------------------------------------
  488.   # visible_line_number
  489.   #--------------------------------------------------------------------------
  490.   def visible_line_number; return 4; end
  491.  
  492.   #--------------------------------------------------------------------------
  493.   # actor=
  494.   #--------------------------------------------------------------------------
  495.   def actor=(actor)
  496.     return if @actor == actor
  497.     @actor = actor
  498.     refresh
  499.     select(item_max - 1) if index >= item_max
  500.   end
  501.  
  502.   #--------------------------------------------------------------------------
  503.   # make_command_list
  504.   #--------------------------------------------------------------------------
  505.   def make_command_list
  506.     return if @actor.nil?
  507.     make_unlocked_class_skill_types
  508.     correct_unlocked_class_learned_skills
  509.     for stype_id in YEA::LEARN_SKILL::STYPE_ORDER
  510.       next unless include?(stype_id)
  511.       name = $data_system.skill_types[stype_id]
  512.       add_command(name, :skill, true, stype_id)
  513.     end
  514.   end
  515.  
  516.   #--------------------------------------------------------------------------
  517.   # make_unlocked_class_skill_types
  518.   #--------------------------------------------------------------------------
  519.   def make_unlocked_class_skill_types
  520.     return unless $imported["YEA-ClassSystem"]
  521.     @unlocked_types = []
  522.     unlocked_classes = @actor.unlocked_classes.clone
  523.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  524.     for class_id in unlocked_classes
  525.       next if $data_classes[class_id].nil?
  526.       for feature in $data_classes[class_id].features
  527.         next unless feature.code == 41
  528.         @unlocked_types.push(feature.data_id)
  529.       end
  530.     end
  531.   end
  532.  
  533.   #--------------------------------------------------------------------------
  534.   # correct_unlocked_class_learned_skills
  535.   #--------------------------------------------------------------------------
  536.   def correct_unlocked_class_learned_skills
  537.     return unless $imported["YEA-ClassSystem"]
  538.     unlocked_classes = @actor.unlocked_classes.clone
  539.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  540.     for class_id in unlocked_classes
  541.       @actor.learn_class_skills(class_id)
  542.     end
  543.   end
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # include?
  547.   #--------------------------------------------------------------------------
  548.   def include?(stype_id)
  549.     return true if @actor.added_skill_types.include?(stype_id)
  550.     if $imported["YEA-ClassSystem"]
  551.       return true if @unlocked_types.include?(stype_id)
  552.     end
  553.     return false
  554.   end
  555.  
  556.   #--------------------------------------------------------------------------
  557.   # update
  558.   #--------------------------------------------------------------------------
  559.   def update
  560.     super
  561.     @skill_window.stype_id = current_ext if @skill_window
  562.   end
  563.  
  564.   #--------------------------------------------------------------------------
  565.   # skill_window=
  566.   #--------------------------------------------------------------------------
  567.   def skill_window=(skill_window)
  568.     @skill_window = skill_window
  569.     update
  570.   end
  571.  
  572. end # Window_LearnSkillCommand
  573.  
  574. #==============================================================================
  575. # ■ Window_LearnSkillList
  576. #==============================================================================
  577.  
  578. class Window_LearnSkillList < Window_SkillList
  579.  
  580.   #--------------------------------------------------------------------------
  581.   # col_max
  582.   #--------------------------------------------------------------------------
  583.   def col_max; return 1; end
  584.  
  585.   #--------------------------------------------------------------------------
  586.   # select_last
  587.   #--------------------------------------------------------------------------
  588.   def select_last; select(0); end
  589.  
  590.   #--------------------------------------------------------------------------
  591.   # actor=
  592.   #--------------------------------------------------------------------------
  593.   def actor=(actor)
  594.     return if @actor == actor
  595.     super(actor)
  596.     make_learn_skills_list
  597.   end
  598.  
  599.   #--------------------------------------------------------------------------
  600.   # make_learn_skills_list
  601.   #--------------------------------------------------------------------------
  602.   def make_learn_skills_list
  603.     @learn_skills = []
  604.     @skill_classes = {}
  605.     return if @actor.nil?
  606.     for skill_id in @actor.class.learn_skills
  607.       next if $data_skills[skill_id].nil?
  608.       next if @learn_skills.include?($data_skills[skill_id])
  609.       skill = $data_skills[skill_id]
  610.       @learn_skills.push(skill)
  611.       @skill_classes[skill] = [] if @skill_classes[skill].nil?
  612.       @skill_classes[skill].push(@actor.class.id)
  613.     end
  614.     make_unlocked_class_skills
  615.   end
  616.  
  617.   #--------------------------------------------------------------------------
  618.   # make_unlocked_class_skills
  619.   #--------------------------------------------------------------------------
  620.   def make_unlocked_class_skills
  621.     return unless $imported["YEA-ClassSystem"]
  622.     @unlocked_types = []
  623.     unlocked_classes = @actor.unlocked_classes.clone
  624.     unlocked_classes |= YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS
  625.     for class_id in unlocked_classes
  626.       next if $data_classes[class_id].nil?
  627.       for skill_id in $data_classes[class_id].learn_skills
  628.         next if $data_skills[skill_id].nil?
  629.         skill = $data_skills[skill_id]
  630.         @learn_skills.push(skill) unless @learn_skills.include?(skill)
  631.         @skill_classes[skill] = [] if @skill_classes[skill].nil?
  632.         @skill_classes[skill] |= [class_id]
  633.       end
  634.     end
  635.   end
  636.  
  637.   #--------------------------------------------------------------------------
  638.   # skill_classes
  639.   #--------------------------------------------------------------------------
  640.   def skill_classes(skill)
  641.     return @skill_classes[skill]
  642.   end
  643.  
  644.   #--------------------------------------------------------------------------
  645.   # make_item_list
  646.   #--------------------------------------------------------------------------
  647.   def make_item_list
  648.     return if @learn_skills.nil?
  649.     @data = @learn_skills.select {|skill| include?(skill) }
  650.   end
  651.  
  652.   #--------------------------------------------------------------------------
  653.   # include?
  654.   #--------------------------------------------------------------------------
  655.   def include?(item)
  656.     return false if item.nil?
  657.     return false unless meet_requirements?(item)
  658.     return item.stype_id == @stype_id
  659.   end
  660.  
  661.   #--------------------------------------------------------------------------
  662.   # meet_requirements?
  663.   #--------------------------------------------------------------------------
  664.   def meet_requirements?(item)
  665.     return false if @actor.nil?
  666.     return false unless meet_level_requirements?(item)
  667.     return false unless meet_skill_requirements?(item)
  668.     return false unless meet_switch_requirements?(item)
  669.     return false unless meet_eval_requirements?(item)
  670.     return true
  671.   end
  672.  
  673.   #--------------------------------------------------------------------------
  674.   # meet_level_requirements?
  675.   #--------------------------------------------------------------------------
  676.   def meet_level_requirements?(item)
  677.     return @actor.level >= item.learn_require_level
  678.   end
  679.  
  680.   #--------------------------------------------------------------------------
  681.   # meet_skill_requirements?
  682.   #--------------------------------------------------------------------------
  683.   def meet_skill_requirements?(item)
  684.     for skill_id in item.learn_require_skill
  685.       next if $data_skills[skill_id].nil?
  686.       return false unless @actor.skill_learn?($data_skills[skill_id])
  687.     end
  688.     return true
  689.   end
  690.  
  691.   #--------------------------------------------------------------------------
  692.   # meet_switch_requirements?
  693.   #--------------------------------------------------------------------------
  694.   def meet_switch_requirements?(item)
  695.     for switch_id in item.learn_require_switch
  696.       return false unless $game_switches[switch_id]
  697.     end
  698.     return true
  699.   end
  700.  
  701.   #--------------------------------------------------------------------------
  702.   # meet_eval_requirements?
  703.   #--------------------------------------------------------------------------
  704.   def meet_eval_requirements?(item)
  705.     return true if item.learn_require_eval.nil?
  706.     return eval(item.learn_require_eval)
  707.   end
  708.  
  709.   #--------------------------------------------------------------------------
  710.   # enable?
  711.   #--------------------------------------------------------------------------
  712.   def enable?(skill)
  713.     return false if skill.nil?
  714.     return false unless enabled_jp?(skill)
  715.     return false unless enabled_exp?(skill)
  716.     return false unless enabled_gold?(skill)
  717.     return !@actor.skill_learn?(skill)
  718.   end
  719.  
  720.   #--------------------------------------------------------------------------
  721.   # enabled_jp?
  722.   #--------------------------------------------------------------------------
  723.   def enabled_jp?(skill)
  724.     return true if skill.learn_cost[1] != :jp
  725.     cost = skill.learn_cost[0]
  726.     for class_id in @skill_classes[skill]
  727.       return true if @actor.jp(class_id) >= cost
  728.     end
  729.     return false
  730.   end
  731.  
  732.   #--------------------------------------------------------------------------
  733.   # enabled_exp?
  734.   #--------------------------------------------------------------------------
  735.   def enabled_exp?(skill)
  736.     return true if skill.learn_cost[1] != :exp
  737.     cost = skill.learn_cost[0]
  738.     for class_id in @skill_classes[skill]
  739.       return true if @actor.exp_class(class_id) >= cost
  740.     end
  741.     return false
  742.   end
  743.  
  744.   #--------------------------------------------------------------------------
  745.   # enabled_gold?
  746.   #--------------------------------------------------------------------------
  747.   def enabled_gold?(skill)
  748.     return true if skill.learn_cost[1] != :gold
  749.     cost = skill.learn_cost[0]
  750.     return $game_party.gold >= cost
  751.   end
  752.  
  753.   #--------------------------------------------------------------------------
  754.   # draw_item
  755.   #--------------------------------------------------------------------------
  756.   def draw_item(index)
  757.     skill = @data[index]
  758.     return if skill.nil?
  759.     rect = item_rect(index)
  760.     rect.width = (contents.width - spacing) / 2 - 4
  761.     draw_item_name(skill, rect.x, rect.y, enable?(skill), rect.width - 24)
  762.     draw_skill_cost(rect, skill)
  763.     draw_restriction_info(skill, index)
  764.     draw_learn_cost(skill, index)
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # skill_restriction?
  769.   #--------------------------------------------------------------------------
  770.   def skill_restriction?(index)
  771.     return false
  772.   end
  773.  
  774.   #--------------------------------------------------------------------------
  775.   # draw_restriction_info
  776.   #--------------------------------------------------------------------------
  777.   def draw_restriction_info(skill, index)
  778.     return unless $imported["YEA-SkillRestrictions"]
  779.     rect = item_rect(index)
  780.     rect.x = contents.width / 2
  781.     rect.width /= 2
  782.     rect.width /= 3
  783.     rect.width -= 8
  784.     draw_skill_warmup(skill, rect)
  785.     rect.x += rect.width + 4
  786.     draw_skill_cooldown(skill, rect)
  787.   end
  788.  
  789.   #--------------------------------------------------------------------------
  790.   # draw_skill_warmup
  791.   #--------------------------------------------------------------------------
  792.   def draw_skill_warmup(skill, rect)
  793.     return unless YEA::LEARN_SKILL::DRAW_WARMUP
  794.     enabled = enable?(skill)
  795.     enabled = false if skill.warmup <= 0
  796.     change_color(warmup_colour, enabled)
  797.     icon = Icon.warmup
  798.     if icon > 0
  799.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  800.       rect.width -= 24
  801.     end
  802.     contents.font.size = YEA::SKILL_RESTRICT::WARMUP_SIZE
  803.     value = skill.warmup > 0 ? skill.warmup.group : empty_text
  804.     text = sprintf(YEA::SKILL_RESTRICT::WARMUP_SUFFIX, value)
  805.     draw_text(rect, text, 2)
  806.     reset_font_settings
  807.   end
  808.  
  809.   #--------------------------------------------------------------------------
  810.   # draw_skill_cooldown
  811.   #--------------------------------------------------------------------------
  812.   def draw_skill_cooldown(skill, rect)
  813.     return unless YEA::LEARN_SKILL::DRAW_COOLDOWN
  814.     enabled = enable?(skill)
  815.     enabled = false if skill.cooldown <= 0
  816.     change_color(cooldown_colour, enabled)
  817.     icon = Icon.cooldown
  818.     if icon > 0
  819.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  820.       rect.width -= 24
  821.     end
  822.     contents.font.size = YEA::SKILL_RESTRICT::COOLDOWN_SIZE
  823.     value = skill.cooldown > 0 ? skill.cooldown.group : empty_text
  824.     text = sprintf(YEA::SKILL_RESTRICT::COOLDOWN_SUFFIX, value)
  825.     draw_text(rect, text, 2)
  826.     reset_font_settings
  827.   end
  828.  
  829.   #--------------------------------------------------------------------------
  830.   # empty_text
  831.   #--------------------------------------------------------------------------
  832.   def empty_text
  833.     return YEA::LEARN_SKILL::EMPTY_TEXT
  834.   end
  835.  
  836.   #--------------------------------------------------------------------------
  837.   # draw_learn_cost
  838.   #--------------------------------------------------------------------------
  839.   def draw_learn_cost(skill, index)
  840.     rect = item_rect(index)
  841.     rect.width -= 4
  842.     if @actor.skill_learn?(skill)
  843.       draw_learned_skill(rect)
  844.     else
  845.       draw_learn_skill_cost(skill, rect)
  846.     end
  847.     reset_font_settings
  848.   end
  849.  
  850.   #--------------------------------------------------------------------------
  851.   # draw_learned_skill
  852.   #--------------------------------------------------------------------------
  853.   def draw_learned_skill(rect)
  854.     contents.font.size = YEA::LEARN_SKILL::LEARNED_SIZE
  855.     change_color(normal_color)
  856.     draw_text(rect, YEA::LEARN_SKILL::LEARNED_TEXT, 2)
  857.   end
  858.  
  859.   #--------------------------------------------------------------------------
  860.   # draw_learn_skill_cost
  861.   #--------------------------------------------------------------------------
  862.   def draw_learn_skill_cost(skill, rect)
  863.     case skill.learn_cost[1]
  864.     when :jp
  865.       return unless $imported["YEA-JPManager"]
  866.       draw_jp_cost(skill, rect)
  867.     when :exp
  868.       draw_exp_cost(skill, rect)
  869.     when :gold
  870.       draw_gold_cost(skill, rect)
  871.     else; return
  872.     end
  873.   end
  874.  
  875.   #--------------------------------------------------------------------------
  876.   # draw_jp_cost
  877.   #--------------------------------------------------------------------------
  878.   def draw_jp_cost(skill, rect)
  879.     enabled = enabled_jp?(skill)
  880.     if Icon.jp > 0
  881.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  882.       rect.width -= 24
  883.     end
  884.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  885.     change_color(system_color, enabled)
  886.     draw_text(rect, Vocab::jp, 2)
  887.     rect.width -= text_size(Vocab::jp).width
  888.     cost = skill.learn_cost[0]
  889.     text = cost.group
  890.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  891.     draw_text(rect, text, 2)
  892.   end
  893.  
  894.   #--------------------------------------------------------------------------
  895.   # draw_exp_cost
  896.   #--------------------------------------------------------------------------
  897.   def draw_exp_cost(skill, rect)
  898.     enabled = enabled_exp?(skill)
  899.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  900.     change_color(system_color, enabled)
  901.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  902.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  903.     cost = skill.learn_cost[0]
  904.     text = cost.group
  905.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  906.     draw_text(rect, text, 2)
  907.   end
  908.  
  909.   #--------------------------------------------------------------------------
  910.   # draw_gold_cost
  911.   #--------------------------------------------------------------------------
  912.   def draw_gold_cost(skill, rect)
  913.     enabled = enabled_jp?(skill)
  914.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  915.     change_color(system_color, enabled)
  916.     draw_text(rect, Vocab::currency_unit, 2)
  917.     rect.width -= text_size(Vocab::currency_unit).width
  918.     cost = skill.learn_cost[0]
  919.     text = cost.group
  920.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  921.     draw_text(rect, text, 2)
  922.   end
  923.  
  924. end # Window_LearnSkillList
  925.  
  926. #==============================================================================
  927. # ■ Window_LearnSkillCostBack
  928. #==============================================================================
  929.  
  930. class Window_LearnSkillCostBack < Window_Base
  931.  
  932.   #--------------------------------------------------------------------------
  933.   # initialize
  934.   #--------------------------------------------------------------------------
  935.   def initialize(item_window)
  936.     dw = Graphics.width * 3 / 4
  937.     dx = (Graphics.width - dw) / 2
  938.     super(dx, 0, dw, fitting_height(2))
  939.     self.openness = 0
  940.     self.back_opacity = 255
  941.     @front_window = nil
  942.     @item_window = item_window
  943.     @skill = nil
  944.   end
  945.  
  946.   #--------------------------------------------------------------------------
  947.   # reveal
  948.   #--------------------------------------------------------------------------
  949.   def reveal(skill, skill_classes)
  950.     @skill = skill
  951.     return if @skill.nil?
  952.     case @skill.learn_cost[1]
  953.     when :gold
  954.       self.height = fitting_height(3)
  955.     else
  956.       maximum = [skill_classes.size, YEA::LEARN_SKILL::MAXIMUM_ROWS].min
  957.       self.height = fitting_height(maximum + 2)
  958.     end
  959.     create_contents
  960.     self.y = (Graphics.height - self.height) / 2
  961.     refresh
  962.     open
  963.   end
  964.  
  965.   #--------------------------------------------------------------------------
  966.   # refresh
  967.   #--------------------------------------------------------------------------
  968.   def refresh
  969.     contents.clear
  970.     reset_font_settings
  971.     draw_learn_skill_text
  972.     rect = Rect.new(0, 0, contents.width - 4, line_height)
  973.     draw_learn_skill_cost(@skill, rect)
  974.   end
  975.  
  976.   #--------------------------------------------------------------------------
  977.   # draw_learn_skill_text
  978.   #--------------------------------------------------------------------------
  979.   def draw_learn_skill_text
  980.     name = sprintf("\eI[%d]%s", @skill.icon_index, @skill.name)
  981.     fmt = YEA::LEARN_SKILL::LEARN_SKILL_TEXT
  982.     text = sprintf(fmt, name)
  983.     draw_text_ex(4, 0, text)
  984.   end
  985.  
  986.   #--------------------------------------------------------------------------
  987.   # draw_learn_skill_cost
  988.   #--------------------------------------------------------------------------
  989.   def draw_learn_skill_cost(skill, rect)
  990.     case skill.learn_cost[1]
  991.     when :jp
  992.       return unless $imported["YEA-JPManager"]
  993.       draw_jp_cost(skill, rect)
  994.     when :exp
  995.       draw_exp_cost(skill, rect)
  996.     when :gold
  997.       draw_gold_cost(skill, rect)
  998.     else; return
  999.     end
  1000.   end
  1001.  
  1002.   #--------------------------------------------------------------------------
  1003.   # draw_jp_cost
  1004.   #--------------------------------------------------------------------------
  1005.   def draw_jp_cost(skill, rect)
  1006.     enabled = true
  1007.     if Icon.jp > 0
  1008.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  1009.       rect.width -= 24
  1010.     end
  1011.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1012.     change_color(system_color, enabled)
  1013.     draw_text(rect, Vocab::jp, 2)
  1014.     rect.width -= text_size(Vocab::jp).width
  1015.     cost = skill.learn_cost[0]
  1016.     text = cost.group
  1017.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  1018.     draw_text(rect, text, 2)
  1019.   end
  1020.  
  1021.   #--------------------------------------------------------------------------
  1022.   # draw_exp_cost
  1023.   #--------------------------------------------------------------------------
  1024.   def draw_exp_cost(skill, rect)
  1025.     enabled = true
  1026.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1027.     change_color(system_color, enabled)
  1028.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  1029.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  1030.     cost = skill.learn_cost[0]
  1031.     text = cost.group
  1032.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  1033.     draw_text(rect, text, 2)
  1034.   end
  1035.  
  1036.   #--------------------------------------------------------------------------
  1037.   # draw_gold_cost
  1038.   #--------------------------------------------------------------------------
  1039.   def draw_gold_cost(skill, rect)
  1040.     enabled = true
  1041.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1042.     change_color(system_color, enabled)
  1043.     draw_text(rect, Vocab::currency_unit, 2)
  1044.     rect.width -= text_size(Vocab::currency_unit).width
  1045.     cost = skill.learn_cost[0]
  1046.     text = cost.group
  1047.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  1048.     draw_text(rect, text, 2)
  1049.   end
  1050.  
  1051. end # Window_LearnSkillCostBack
  1052.  
  1053. #==============================================================================
  1054. # ■ Window_LearnSkillCostFront
  1055. #==============================================================================
  1056.  
  1057. class Window_LearnSkillCostFront < Window_Command
  1058.  
  1059.   #--------------------------------------------------------------------------
  1060.   # initialize
  1061.   #--------------------------------------------------------------------------
  1062.   def initialize(item_window, cost_window)
  1063.     super((Graphics.width - window_width) / 2, 0)
  1064.     self.openness = 0
  1065.     self.opacity = 0
  1066.     @item_window = item_window
  1067.     @cost_window = cost_window
  1068.     @skill = nil
  1069.     @actor = nil
  1070.     deactivate
  1071.   end
  1072.  
  1073.   #--------------------------------------------------------------------------
  1074.   # window_width
  1075.   #--------------------------------------------------------------------------
  1076.   def window_width; return Graphics.width * 3 / 4; end
  1077.  
  1078.   #--------------------------------------------------------------------------
  1079.   # skill_class
  1080.   #--------------------------------------------------------------------------
  1081.   def skill_class
  1082.     return @skill_classes.nil? ? nil : @skill_classes[index]
  1083.   end
  1084.  
  1085.   #--------------------------------------------------------------------------
  1086.   # reveal
  1087.   #--------------------------------------------------------------------------
  1088.   def reveal(skill, skill_classes, actor)
  1089.     @skill = skill
  1090.     @skill_classes = skill_classes.clone
  1091.     @actor = actor
  1092.     return if @skill.nil?
  1093.     case @skill.learn_cost[1]
  1094.     when :gold
  1095.       self.height = fitting_height(2)
  1096.     else
  1097.       maximum = [skill_classes.size, YEA::LEARN_SKILL::MAXIMUM_ROWS].min
  1098.       self.height = fitting_height(maximum + 1)
  1099.     end
  1100.     create_contents
  1101.     self.y = @cost_window.y + line_height
  1102.     refresh
  1103.     select(0)
  1104.     open
  1105.     activate
  1106.   end
  1107.  
  1108.   #--------------------------------------------------------------------------
  1109.   # make_command_list
  1110.   #--------------------------------------------------------------------------
  1111.   def make_command_list
  1112.     return if @skill_classes.nil?
  1113.     if @skill.learn_cost[1] == :gold
  1114.       add_command("GOLD", :gold, true)
  1115.       add_command(YEA::LEARN_SKILL::LEARN_CANCEL_TEXT, :cancel, true)
  1116.       return
  1117.     end
  1118.     for class_id in @skill_classes
  1119.       name = $data_classes[class_id].name
  1120.       add_command(name, :class, enabled?(class_id), class_id)
  1121.     end
  1122.     add_command(YEA::LEARN_SKILL::LEARN_CANCEL_TEXT, :cancel, true)
  1123.   end
  1124.  
  1125.   #--------------------------------------------------------------------------
  1126.   # enabled?
  1127.   #--------------------------------------------------------------------------
  1128.   def enabled?(class_id)
  1129.     cost = @skill.learn_cost[0]
  1130.     case @skill.learn_cost[1]
  1131.     when :jp
  1132.       return @actor.jp(class_id) >= cost
  1133.     when :exp
  1134.       return @actor.exp_class(class_id) >= cost
  1135.     end
  1136.     return true
  1137.   end
  1138.  
  1139.   #--------------------------------------------------------------------------
  1140.   # draw_item
  1141.   #--------------------------------------------------------------------------
  1142.   def draw_item(index)
  1143.     reset_font_settings
  1144.     rect = item_rect(index)
  1145.     rect.x += 24
  1146.     rect.width -= 28
  1147.     return draw_cancel_text(index, rect) if @list[index][:symbol] == :cancel
  1148.     draw_class_name(index, rect) if @skill.learn_cost[1] != :gold
  1149.     draw_party_gold(rect) if @skill.learn_cost[1] == :gold
  1150.     draw_learn_skill_cost(@skill, rect, index)
  1151.   end
  1152.  
  1153.   #--------------------------------------------------------------------------
  1154.   # draw_cancel_text
  1155.   #--------------------------------------------------------------------------
  1156.   def draw_cancel_text(index, rect)
  1157.     draw_icon(Icon.cancel, rect.x, rect.y)
  1158.     text = command_name(index)
  1159.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  1160.   end
  1161.  
  1162.   #--------------------------------------------------------------------------
  1163.   # draw_class_name
  1164.   #--------------------------------------------------------------------------
  1165.   def draw_class_name(index, rect)
  1166.     class_id = @list[index][:ext]
  1167.     return if $data_classes[class_id].nil?
  1168.     enabled = enabled?(class_id)
  1169.     if $imported["YEA-ClassSystem"]
  1170.       draw_icon($data_classes[class_id].icon_index, rect.x, rect.y, enabled)
  1171.     end
  1172.     rect.x += 24
  1173.     rect.width -= 24
  1174.     change_color(normal_color, enabled)
  1175.     draw_text(rect, $data_classes[class_id].name)
  1176.   end
  1177.  
  1178.   #--------------------------------------------------------------------------
  1179.   # draw_class_name
  1180.   #--------------------------------------------------------------------------
  1181.   def draw_party_gold(rect)
  1182.     enabled = true
  1183.     draw_icon(Icon.learn_skill_gold, rect.x, rect.y)
  1184.     rect.x += 24
  1185.     rect.width -= 24
  1186.     change_color(normal_color, enabled)
  1187.     draw_text(rect, YEA::LEARN_SKILL::GOLD_TEXT)
  1188.   end
  1189.  
  1190.   #--------------------------------------------------------------------------
  1191.   # draw_learn_skill_cost
  1192.   #--------------------------------------------------------------------------
  1193.   def draw_learn_skill_cost(skill, rect, index)
  1194.     case skill.learn_cost[1]
  1195.     when :jp
  1196.       return unless $imported["YEA-JPManager"]
  1197.       draw_jp_cost(skill, rect, index)
  1198.     when :exp
  1199.       draw_exp_cost(skill, rect, index)
  1200.     when :gold
  1201.       draw_gold_cost(skill, rect)
  1202.     else; return
  1203.     end
  1204.   end
  1205.  
  1206.   #--------------------------------------------------------------------------
  1207.   # draw_jp_cost
  1208.   #--------------------------------------------------------------------------
  1209.   def draw_jp_cost(skill, rect, index)
  1210.     enabled = enabled?(@list[index][:ext])
  1211.     if Icon.jp > 0
  1212.       draw_icon(Icon.jp, rect.x + rect.width - 24, rect.y, enabled)
  1213.       rect.width -= 24
  1214.     end
  1215.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1216.     change_color(system_color, enabled)
  1217.     draw_text(rect, Vocab::jp, 2)
  1218.     rect.width -= text_size(Vocab::jp).width
  1219.     cost = @actor.jp(@list[index][:ext])
  1220.     text = cost.group
  1221.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_JP), enabled)
  1222.     draw_text(rect, text, 2)
  1223.   end
  1224.  
  1225.   #--------------------------------------------------------------------------
  1226.   # draw_exp_cost
  1227.   #--------------------------------------------------------------------------
  1228.   def draw_exp_cost(skill, rect, index)
  1229.     enabled = enabled?(@list[index][:ext])
  1230.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1231.     change_color(system_color, enabled)
  1232.     draw_text(rect, YEA::LEARN_SKILL::EXP_TEXT, 2)
  1233.     rect.width -= text_size(YEA::LEARN_SKILL::EXP_TEXT).width
  1234.     cost = @actor.exp_class(@list[index][:ext])
  1235.     text = cost.group
  1236.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_EXP), enabled)
  1237.     draw_text(rect, text, 2)
  1238.   end
  1239.  
  1240.   #--------------------------------------------------------------------------
  1241.   # draw_gold_cost
  1242.   #--------------------------------------------------------------------------
  1243.   def draw_gold_cost(skill, rect)
  1244.     enabled = $game_party.gold >= skill.learn_cost[0]
  1245.     contents.font.size = YEA::LEARN_SKILL::COST_SIZE
  1246.     change_color(system_color, enabled)
  1247.     draw_text(rect, Vocab::currency_unit, 2)
  1248.     rect.width -= text_size(Vocab::currency_unit).width
  1249.     cost = $game_party.gold
  1250.     text = cost.group
  1251.     change_color(text_color(YEA::LEARN_SKILL::COLOUR_GOLD), enabled)
  1252.     draw_text(rect, text, 2)
  1253.   end
  1254.  
  1255. end # Window_LearnSkillCostFront
  1256.  
  1257. #==============================================================================
  1258. # ■ Scene_Skill
  1259. #==============================================================================
  1260.  
  1261. class Scene_Skill < Scene_ItemBase
  1262.  
  1263.   #--------------------------------------------------------------------------
  1264.   # alias method: create_command_window
  1265.   #--------------------------------------------------------------------------
  1266.   alias scene_skill_create_command_window_lse create_command_window
  1267.   def create_command_window
  1268.     scene_skill_create_command_window_lse
  1269.     @command_window.set_handler(:learn_skill, method(:command_learn_skill))
  1270.   end
  1271.  
  1272.   #--------------------------------------------------------------------------
  1273.   # new method: command_learn_skill
  1274.   #--------------------------------------------------------------------------
  1275.   def command_learn_skill
  1276.     SceneManager.call(Scene_LearnSkill)
  1277.   end
  1278.  
  1279. end # Scene_Skill
  1280.  
  1281. #==============================================================================
  1282. # ■ Scene_LearnSkill
  1283. #==============================================================================
  1284.  
  1285. class Scene_LearnSkill < Scene_Skill
  1286.  
  1287.   #--------------------------------------------------------------------------
  1288.   # start
  1289.   #--------------------------------------------------------------------------
  1290.   def start
  1291.     super
  1292.     create_cost_windows
  1293.   end
  1294.  
  1295.   #--------------------------------------------------------------------------
  1296.   # create_command_window
  1297.   #--------------------------------------------------------------------------
  1298.   def create_command_window
  1299.     wy = @help_window.height
  1300.     @command_window = Window_LearnSkillCommand.new(0, wy)
  1301.     @command_window.viewport = @viewport
  1302.     @command_window.help_window = @help_window
  1303.     @command_window.actor = @actor
  1304.     @command_window.set_handler(:skill,    method(:command_skill))
  1305.     @command_window.set_handler(:cancel,   method(:return_scene))
  1306.     @command_window.set_handler(:pagedown, method(:next_actor))
  1307.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1308.   end
  1309.  
  1310.   #--------------------------------------------------------------------------
  1311.   # create_item_window
  1312.   #--------------------------------------------------------------------------
  1313.   def create_item_window
  1314.     wx = 0
  1315.     wy = @status_window.y + @status_window.height
  1316.     ww = Graphics.width
  1317.     wh = Graphics.height - wy
  1318.     @item_window = Window_LearnSkillList.new(wx, wy, ww, wh)
  1319.     @item_window.actor = @actor
  1320.     @item_window.viewport = @viewport
  1321.     @item_window.help_window = @help_window
  1322.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1323.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1324.     @command_window.skill_window = @item_window
  1325.   end
  1326.  
  1327.   #--------------------------------------------------------------------------
  1328.   # create_cost_windows
  1329.   #--------------------------------------------------------------------------
  1330.   def create_cost_windows
  1331.     @cost_window = Window_LearnSkillCostBack.new(@item_window)
  1332.     @cost_front = Window_LearnSkillCostFront.new(@item_window, @cost_window)
  1333.     @cost_window.viewport = @viewport
  1334.     @cost_front.viewport = @viewport
  1335.     @cost_front.set_handler(:ok, method(:on_cost_ok))
  1336.     @cost_front.set_handler(:cancel, method(:on_cost_cancel))
  1337.   end
  1338.  
  1339.   #--------------------------------------------------------------------------
  1340.   # on_item_ok
  1341.   #--------------------------------------------------------------------------
  1342.   def on_item_ok
  1343.     skill = @item_window.item
  1344.     @cost_window.reveal(skill, @item_window.skill_classes(skill))
  1345.     @cost_front.reveal(skill, @item_window.skill_classes(skill), @actor)
  1346.   end
  1347.  
  1348.   #--------------------------------------------------------------------------
  1349.   # on_cost_ok
  1350.   #--------------------------------------------------------------------------
  1351.   def on_cost_ok
  1352.     Sound.play_use_skill
  1353.     skill = @item_window.item
  1354.     @actor.learn_skill(skill.id)
  1355.     cost = skill.learn_cost[0]
  1356.     case skill.learn_cost[1]
  1357.     when :jp
  1358.       @actor.lose_jp(cost, @cost_front.skill_class)
  1359.     when :exp
  1360.       @actor.lose_exp_class(cost, @cost_front.skill_class)
  1361.     when :gold
  1362.       $game_party.lose_gold(cost)
  1363.     end
  1364.     on_cost_cancel
  1365.     refresh_windows
  1366.   end
  1367.  
  1368.   #--------------------------------------------------------------------------
  1369.   # on_cost_cancel
  1370.   #--------------------------------------------------------------------------
  1371.   def on_cost_cancel
  1372.     @cost_front.close
  1373.     @cost_window.close
  1374.     @item_window.activate
  1375.   end
  1376.  
  1377.   #--------------------------------------------------------------------------
  1378.   # refresh_windows
  1379.   #--------------------------------------------------------------------------
  1380.   def refresh_windows
  1381.     @item_window.refresh
  1382.     @status_window.refresh
  1383.   end
  1384.  
  1385. end # Scene_LearnSkill
  1386.  
  1387. #==============================================================================
  1388. #
  1389. # ▼ End of File
  1390. #
  1391. #==============================================================================


如何把技能设成刻学习的 , 是在备注里打什么吗?

Lv1.梦旅人

梦石
0
星屑
94
在线时间
191 小时
注册时间
2011-10-12
帖子
320
2
发表于 2012-8-23 19:11:13 | 只看该作者
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
116 小时
注册时间
2012-8-12
帖子
61
3
发表于 2012-8-23 21:05:59 | 只看该作者
职业中备注写<learn skills: x, x> 表示该职业可以学习的技能,     技能备注中<learn cost: x jp>  <learn cost: x exp>  <learn cost: x gold> 表示学习技能的成本,写<learn require level: x>表示学习该技能的等级要求,写<learn require skill: x, x>表示学习该技能需要的前置技能为(x,x),写<learn require switch: x>表示学习该技能需要的开关!

其实你google翻译一下就会明白的!

评分

参与人数 1梦石 +2 收起 理由
迷糊的安安 + 2 认可答案 附赠66RPG提供的精美好人卡一张^^.

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 05:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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