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

Project1

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

[已经过期] 新人,求教学习特技系统脚本的用法

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
26 小时
注册时间
2013-6-19
帖子
16
跳转到指定楼层
1
发表于 2013-6-22 20:41:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 亿万星辰 于 2013-6-22 21:04 编辑
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Learn Skill Engine v1.00
  4. # -- Last Updated: 2012.01.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  444. class Window_LearnSkillCommand < Window_Command
  445.   
  446.   #--------------------------------------------------------------------------
  447.   # public instance variables
  448.   #--------------------------------------------------------------------------
  449.   attr_reader   :skill_window
  450.   
  451.   #--------------------------------------------------------------------------
  452.   # initialize
  453.   #--------------------------------------------------------------------------
  454.   def initialize(dx, dy)
  455.     super(dx, dy)
  456.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  457.   end
  458.   
  459.   #--------------------------------------------------------------------------
  460.   # window_width
  461.   #--------------------------------------------------------------------------
  462.   def window_width; return 160; end
  463.   
  464.   #--------------------------------------------------------------------------
  465.   # visible_line_number
  466.   #--------------------------------------------------------------------------
  467.   def visible_line_number; return 4; end
  468.   
  469.   #--------------------------------------------------------------------------
  470.   # actor=
  471.   #--------------------------------------------------------------------------
  472.   def actor=(actor)
  473.     return if @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 [email protected]_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. #==============================================================================
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
26 小时
注册时间
2013-6-19
帖子
16
2
 楼主| 发表于 2013-6-22 20:42:08 | 只看该作者
是VA超级整合里的找的脚本
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
99
在线时间
60 小时
注册时间
2013-1-29
帖子
45
3
发表于 2013-6-23 07:14:13 | 只看该作者
连注释都没有 = =
回复 支持 反对

使用道具 举报

Lv3.寻梦者

○赛

梦石
0
星屑
1249
在线时间
1276 小时
注册时间
2013-1-22
帖子
2246

贵宾

4
发表于 2013-6-24 14:51:53 | 只看该作者
像特技学习这种完全不需要脚本的,可以用物品制作也可以用事件制作,完全每必要用脚本吧。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-28 08:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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