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

Project1

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

[已经过期] 关于超级脚本整合中的职业脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
74 小时
注册时间
2011-2-5
帖子
46
跳转到指定楼层
1
发表于 2014-4-15 22:19:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Class System v1.08
  4. # -- Last Updated: 2012.01.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.08 - Compatibility Update: Learn Skill Engine
  15. # 2012.01.05 - Bug Fixed: Equipment no longer gets duplicated.
  16. # 2012.01.04 - Update: Autobattle will no longer use skills not available to
  17. #              that class for specific actors.
  18. # 2012.01.02 - Efficiency Update.
  19. # 2011.12.26 - Added custom command functionality.
  20. # 2011.12.23 - Compatibility Update: Class Specifics.
  21. # 2011.12.22 - Compatibility Update: Ace Menu Engine.
  22. # 2011.12.20 - Compatibility Update: Class Unlock Level.
  23. # 2011.12.19 - Started Script and Finished.
  24. #
  25. #==============================================================================
  26. # ▼ Introduction
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # This script adds the ability for your player to freely change the classes of
  29. # actors outside of battle from a menu. When changing classes, this script
  30. # gives the option for the developer to choose whether or not classes have
  31. # their own levels (causing the actor's level to reset back to the class's
  32. # level) or to maintain the current level. In addition to providing the ability
  33. # to change classes, equipping a subclass is also doable, and the mechanics of
  34. # having a subclass can also be defined within this script.
  35. #
  36. #==============================================================================
  37. # ▼ Instructions
  38. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  39. # To install this script, open up your script editor and copy/paste this script
  40. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  41. #
  42. # -----------------------------------------------------------------------------
  43. # Actor Notetags - These notetags go in the actors notebox in the database.
  44. # -----------------------------------------------------------------------------
  45. # <unlocked classes: x>
  46. # <unlocked classes: x, x>
  47. # This will set the default classes as unlocked for the actor. This does not
  48. # override the default classes unlocked in the module, but instead, adds on
  49. # to the number of unlocked classes.
  50. #
  51. # -----------------------------------------------------------------------------
  52. # Class Notetags - These notetags go in the class notebox in the database.
  53. # -----------------------------------------------------------------------------
  54. # <icon: x>
  55. # Sets the icon representing the class to x.
  56. #
  57. # <help description>
  58. #  string
  59. #  string
  60. # </help description>
  61. # Sets the text used for the help window in the class scene. Multiple lines in
  62. # the notebox will be strung together. Use | for a line break.
  63. #
  64. # -----------------------------------------------------------------------------
  65. # Script Calls - These commands are used with script calls.
  66. # -----------------------------------------------------------------------------
  67. # $game_actors[x].unlock_class(y)
  68. # This allows actor x to unlock class y, making it available for switching in
  69. # and out in the Class scene.
  70. #
  71. # $game_actors[x].remove_class(y)
  72. # This causes actor x to remove class y from being able to switch to and from.
  73. # If the actor is currently class y, the class will not be removed. If the
  74. # actor's current subclass is y, the subclass will be unequipped.
  75. #
  76. #==============================================================================
  77. # ▼ Compatibility
  78. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  79. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  80. # it will run with RPG Maker VX without adjusting.
  81. #
  82. #==============================================================================

  83. module YEA
  84.   module CLASS_SYSTEM
  85.    
  86.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  87.     # - General Class Settings -
  88.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  89.     # These are the general settings regarding the whole script. They control
  90.     # various rules and regulations that this script undergoes. These settings
  91.     # will also determine what a subclass can do for a player.
  92.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  93.     CLASS_MENU_TEXT = "职业"  # Text that appears in the Main Menu.
  94.     MAINTAIN_LEVELS = false    # Maintain through all classes. Default: false.
  95.     DEFAULT_UNLOCKS = [ ]   # Classes unlocked by default.
  96.    
  97.     # The display between a primary class and a subclass when written in a
  98.     # window will appear as such.
  99.     SUBCLASS_TEXT = "%s/%s"
  100.    
  101.     # This adjusts the stat rate inheritance for an actor if an actor has a
  102.     # subclass equipped. If you want to disable this, set the rate to 0.0.
  103.     SUBCLASS_STAT_RATE = 0.20
  104.    
  105.     # This adds subclass skill types to the available skill types usable.
  106.     SUBCLASS_SKILL_TYPES = true
  107.    
  108.     # This adds subclass weapons to equippable weapon types.
  109.     SUBCLASS_WEAPON_TYPES = true
  110.    
  111.     # This adds subclass weapons to equippable armour types.
  112.     SUBCLASS_ARMOUR_TYPES = true
  113.    
  114.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  115.     # - Class Scene Commands -
  116.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  117.     # These settings adjust how the class scene appears. Here, you can adjust
  118.     # the command list and the order at which items appear. These are mostly
  119.     # visual settings. Adjust them as you see fit.
  120.     #
  121.     # -------------------------------------------------------------------------
  122.     # :command         Description
  123.     # -------------------------------------------------------------------------
  124.     # :primary         Allows the player to change the primary class.
  125.     # :subclass        Allows the player to change the subclass.
  126.     #
  127.     # :learn_skill     Requires YEA - Learn Skill Engine
  128.     #
  129.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  130.     COMMANDS =[ # The order at which the menu items are shown.
  131.     # [ :command,   "Display"],
  132.       [ :primary,   "选择职业"],
  133.       [:learn_skill, "学习技能"],
  134.     # [ :custom1,   "Custom1"],
  135.     # [ :custom2,   "Custom2"],
  136.     ] # Do not remove this.
  137.    
  138.     #--------------------------------------------------------------------------
  139.     # - Status Class Commands -
  140.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  141.     # For those who use scripts to that may produce unique effects for the
  142.     # class menu, use this hash to manage the custom commands for the Class
  143.     # Command Window. You can disable certain commands or prevent them from
  144.     # appearing by using switches. If you don't wish to bind them to a switch,
  145.     # set the proper switch to 0 for it to have no impact.
  146.     #--------------------------------------------------------------------------
  147.     CUSTOM_CLASS_COMMANDS ={
  148.     # :command => [EnableSwitch, ShowSwitch, Handler Method,
  149.       :custom1 => [           0,          0, :command_name1],
  150.       :custom2 => [           0,          0, :command_name2],
  151.     } # Do not remove this.
  152.    
  153.     # These settings adjust the colour displays for classes.
  154.     CURRENT_CLASS_COLOUR = 17     # "Window" colour used for current class.
  155.     SUBCLASS_COLOUR      = 4      # "Window" colour used for subclass.
  156.    
  157.     # This adjusts the display for class levels if MAINTAIN_LEVELS is false.
  158.     CLASS_LEVEL     = "LV%s"      # Text display for level.
  159.     LEVEL_FONT_SIZE = 16          # Font size used for level.
  160.    
  161.     # This array sets the order of how classes are ordered in the class listing
  162.     # window. Any class ID's unlisted will not be shown.
  163.     CLASS_ORDER = [41..999, 1..40]
  164.    
  165.     # This adjusts the font size for the Parameters window.
  166.     PARAM_FONT_SIZE = 20
  167.    
  168.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  169.     # - Switch Settings -
  170.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  171.     # These are the switches that govern whether or not certain menu items will
  172.     # appear and/or will be enabled. By binding them to a Switch, you can just
  173.     # set the Switch ON/OFF to show/hide or enable/disable a menu command. If
  174.     # you do not wish to use this feature, set these commands to 0.
  175.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  176.     SWITCH_SHOW_CLASS      = 0    # Switch that shows Class in Main Menu.
  177.     SWITCH_ENABLE_CLASS    = 0    # Switch that enables Class in Main Menu.
  178.     SWITCH_SHOW_PRIMARY    = 0    # Switch that shows Subclass in Class Menu.
  179.     SWITCH_ENABLE_PRIMARY  = 0    # Switch that enables Subclass in Class Menu.
  180.     SWITCH_SHOW_SUBCLASS   = 0    # Switch that shows Subclass in Class Menu.
  181.     SWITCH_ENABLE_SUBCLASS = 0    # Switch that enables Subclass in Class Menu.
  182.    
  183.   end # CLASS_SYSTEM
  184. end # YEA

  185. #==============================================================================
  186. # ▼ Editting anything past this point may potentially result in causing
  187. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  188. # halitosis so edit at your own risk.
  189. #==============================================================================

  190. module YEA
  191.   module CLASS_SYSTEM
  192.     module_function
  193.     #--------------------------------------------------------------------------
  194.     # convert_integer_array
  195.     #--------------------------------------------------------------------------
  196.     def convert_integer_array(array)
  197.       result = []
  198.       array.each { |i|
  199.         case i
  200.         when Range; result |= i.to_a
  201.         when Integer; result |= [i]
  202.         end }
  203.       return result
  204.     end
  205.     #--------------------------------------------------------------------------
  206.     # converted_contants
  207.     #--------------------------------------------------------------------------
  208.     DEFAULT_UNLOCKS = convert_integer_array(DEFAULT_UNLOCKS)
  209.     CLASS_ORDER = convert_integer_array(CLASS_ORDER)
  210.   end # CLASS_SYSTEM
  211.   module REGEXP
  212.   module ACTOR
  213.    
  214.     UNLOCKED_CLASSES =
  215.       /<(?:UNLOCKED_CLASSES|unlocked classes):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  216.    
  217.   end # ACTOR
  218.   module CLASS
  219.    
  220.     ICON_INDEX = /<(?:ICON_INDEX|icon index|icon):[ ](\d+)>/i
  221.     HELP_DESCRIPTION_ON  = /<(?:HELP_DESCRIPTION|help description)>/i
  222.     HELP_DESCRIPTION_OFF = /<\/(?:HELP_DESCRIPTION|help description)>/i
  223.    
  224.   end # CLASS
  225.   end # REGEXP
  226. end # YEA

  227. #==============================================================================
  228. # ■ Switch
  229. #==============================================================================

  230. module Switch
  231.   
  232.   #--------------------------------------------------------------------------
  233.   # self.class_show
  234.   #--------------------------------------------------------------------------
  235.   def self.class_show
  236.     return true if YEA::CLASS_SYSTEM::SWITCH_SHOW_CLASS <= 0
  237.     return $game_switches[YEA::CLASS_SYSTEM::SWITCH_SHOW_CLASS]
  238.   end
  239.   
  240.   #--------------------------------------------------------------------------
  241.   # self.class_enable
  242.   #--------------------------------------------------------------------------
  243.   def self.class_enable
  244.     return true if YEA::CLASS_SYSTEM::SWITCH_ENABLE_CLASS <= 0
  245.     return $game_switches[YEA::CLASS_SYSTEM::SWITCH_ENABLE_CLASS]
  246.   end
  247.   
  248.   #--------------------------------------------------------------------------
  249.   # self.primary_show
  250.   #--------------------------------------------------------------------------
  251.   def self.primary_show
  252.     return true if YEA::CLASS_SYSTEM::SWITCH_SHOW_PRIMARY <= 0
  253.     return $game_switches[YEA::CLASS_SYSTEM::SWITCH_SHOW_PRIMARY]
  254.   end
  255.   
  256.   #--------------------------------------------------------------------------
  257.   # self.primary_enable
  258.   #--------------------------------------------------------------------------
  259.   def self.primary_enable
  260.     return true if YEA::CLASS_SYSTEM::SWITCH_ENABLE_PRIMARY <= 0
  261.     return $game_switches[YEA::CLASS_SYSTEM::SWITCH_ENABLE_PRIMARY]
  262.   end
  263.   
  264.   #--------------------------------------------------------------------------
  265.   # self.subclass_show
  266.   #--------------------------------------------------------------------------
  267.   def self.subclass_show
  268.     return true if YEA::CLASS_SYSTEM::SWITCH_SHOW_SUBCLASS <= 0
  269.     return $game_switches[YEA::CLASS_SYSTEM::SWITCH_SHOW_SUBCLASS]
  270.   end
  271.   
  272.   #--------------------------------------------------------------------------
  273.   # self.subclass_enable
  274.   #--------------------------------------------------------------------------
  275.   def self.subclass_enable
  276.     return true if YEA::CLASS_SYSTEM::SWITCH_ENABLE_SUBCLASS <= 0
  277.     return $game_switches[YEA::CLASS_SYSTEM::SWITCH_ENABLE_SUBCLASS]
  278.   end
  279.    
  280. end # Switch

  281. #==============================================================================
  282. # ■ Numeric
  283. #==============================================================================

  284. class Numeric
  285.   
  286.   #--------------------------------------------------------------------------
  287.   # new method: group_digits
  288.   #--------------------------------------------------------------------------
  289.   unless $imported["YEA-CoreEngine"]
  290.   def group; return self.to_s; end
  291.   end # $imported["YEA-CoreEngine"]
  292.    
  293. end # Numeric

  294. #==============================================================================
  295. # ■ DataManager
  296. #==============================================================================

  297. module DataManager
  298.   
  299.   #--------------------------------------------------------------------------
  300.   # alias method: load_database
  301.   #--------------------------------------------------------------------------
  302.   class <<self; alias load_database_cs load_database; end
  303.   def self.load_database
  304.     load_database_cs
  305.     load_notetags_cs
  306.   end
  307.   
  308.   #--------------------------------------------------------------------------
  309.   # new method: load_notetags_cs
  310.   #--------------------------------------------------------------------------
  311.   def self.load_notetags_cs
  312.     groups = [$data_actors, $data_classes]
  313.     for group in groups
  314.       for obj in group
  315.         next if obj.nil?
  316.         obj.load_notetags_cs
  317.       end
  318.     end
  319.   end
  320.   
  321. end # DataManager

  322. #==============================================================================
  323. # ■ RPG::Actor
  324. #==============================================================================

  325. class RPG::Actor < RPG::BaseItem
  326.   
  327.   #--------------------------------------------------------------------------
  328.   # public instance variables
  329.   #--------------------------------------------------------------------------
  330.   attr_accessor :unlocked_classes
  331.   
  332.   #--------------------------------------------------------------------------
  333.   # common cache: load_notetags_cs
  334.   #--------------------------------------------------------------------------
  335.   def load_notetags_cs
  336.     @unlocked_classes = []
  337.     #---
  338.     self.note.split(/[\r\n]+/).each { |line|
  339.       case line
  340.       #---
  341.       when YEA::REGEXP::ACTOR::UNLOCKED_CLASSES
  342.         $1.scan(/\d+/).each { |num|
  343.         @unlocked_classes.push(num.to_i) if num.to_i > 0 }
  344.       #---
  345.       end
  346.     } # self.note.split
  347.     #---
  348.   end
  349.   
  350. end # RPG::Actor

  351. #==============================================================================
  352. # ■ RPG::Class
  353. #==============================================================================

  354. class RPG::Class < RPG::BaseItem
  355.   
  356.   #--------------------------------------------------------------------------
  357.   # public instance variables
  358.   #--------------------------------------------------------------------------
  359.   attr_accessor :icon_index
  360.   
  361.   #--------------------------------------------------------------------------
  362.   # common cache: load_notetags_cs
  363.   #--------------------------------------------------------------------------
  364.   def load_notetags_cs
  365.     @icon_index = 0
  366.     @help_description_on = false
  367.     #---
  368.     self.note.split(/[\r\n]+/).each { |line|
  369.       case line
  370.       #---
  371.       when YEA::REGEXP::CLASS::ICON_INDEX
  372.         @icon_index = $1.to_i
  373.       #---
  374.       when YEA::REGEXP::CLASS::HELP_DESCRIPTION_ON
  375.         @help_description_on = true
  376.       when YEA::REGEXP::CLASS::HELP_DESCRIPTION_OFF
  377.         @help_description_on = false
  378.       #---
  379.       else
  380.         @description += line.to_s if @help_description_on
  381.       end
  382.     } # self.note.split
  383.     #---
  384.     @description.gsub!(/[|]/i) { "\n" }
  385.   end
  386.   
  387. end # RPG::Class

  388. #==============================================================================
  389. # ■ Game_Temp
  390. #==============================================================================

  391. class Game_Temp
  392.   
  393.   #--------------------------------------------------------------------------
  394.   # public instance variables
  395.   #--------------------------------------------------------------------------
  396.   attr_accessor :scene_class_index
  397.   attr_accessor :scene_class_oy
  398.   
  399. end # Game_Temp

  400. #==============================================================================
  401. # ■ Game_Action
  402. #==============================================================================

  403. class Game_Action
  404.   
  405.   #--------------------------------------------------------------------------
  406.   # alias method: valid?
  407.   #--------------------------------------------------------------------------
  408.   alias game_action_valid_cs valid?
  409.   def valid?
  410.     return false if check_auto_battle_class
  411.     return game_action_valid_cs
  412.   end
  413.   
  414.   #--------------------------------------------------------------------------
  415.   # new method: check_auto_battle_class
  416.   #--------------------------------------------------------------------------
  417.   def check_auto_battle_class
  418.     return false unless subject.actor?
  419.     return false unless subject.auto_battle?
  420.     return false if item.nil?
  421.     return false if subject.added_skill_types.include?(item.stype_id)
  422.     return false if item.id == subject.attack_skill_id
  423.     return true
  424.   end
  425.   
  426. end # Game_Action

  427. #==============================================================================
  428. # ■ Game_BattlerBase
  429. #==============================================================================

  430. class Game_BattlerBase
  431.   
  432.   #--------------------------------------------------------------------------
  433.   # public instance variables
  434.   #--------------------------------------------------------------------------
  435.   attr_accessor :temp_flag
  436.   
  437.   #--------------------------------------------------------------------------
  438.   # alias method: added_skill_types
  439.   #--------------------------------------------------------------------------
  440.   alias game_battlerbase_added_skill_types_cs added_skill_types
  441.   def added_skill_types
  442.     result = game_battlerbase_added_skill_types_cs
  443.     result |= subclass_skill_types
  444.     return result
  445.   end
  446.   
  447.   #--------------------------------------------------------------------------
  448.   # new method: subclass_skill_types
  449.   #--------------------------------------------------------------------------
  450.   def subclass_skill_types; return []; end
  451.   
  452.   #--------------------------------------------------------------------------
  453.   # alias method: equip_wtype_ok?
  454.   #--------------------------------------------------------------------------
  455.   alias game_battlerbase_equip_wtype_ok_cs equip_wtype_ok?
  456.   def equip_wtype_ok?(wtype_id)
  457.     return true if subclass_equip_wtype?(wtype_id)
  458.     return game_battlerbase_equip_wtype_ok_cs(wtype_id)
  459.   end
  460.   
  461.   #--------------------------------------------------------------------------
  462.   # new method: subclass_equip_wtype?
  463.   #--------------------------------------------------------------------------
  464.   def subclass_equip_wtype?(wtype_id); return false; end
  465.   
  466.   #--------------------------------------------------------------------------
  467.   # alias method: equip_atype_ok?
  468.   #--------------------------------------------------------------------------
  469.   alias game_battlerbase_equip_atype_ok_cs equip_atype_ok?
  470.   def equip_atype_ok?(atype_id)
  471.     return true if subclass_equip_atype?(atype_id)
  472.     return game_battlerbase_equip_atype_ok_cs(atype_id)
  473.   end
  474.   
  475.   #--------------------------------------------------------------------------
  476.   # new method: subclass_equip_atype?
  477.   #--------------------------------------------------------------------------
  478.   def subclass_equip_atype?(atype_id); return false; end
  479.   
  480. end # Game_BattlerBase

  481. #==============================================================================
  482. # ■ Game_Actor
  483. #==============================================================================

  484. class Game_Actor < Game_Battler
  485.   
  486.   #--------------------------------------------------------------------------
  487.   # alias method: setup
  488.   #--------------------------------------------------------------------------
  489.   alias game_actor_setup_cs setup
  490.   def setup(actor_id)
  491.     game_actor_setup_cs(actor_id)
  492.     init_unlocked_classes
  493.     init_subclass
  494.   end
  495.   
  496.   #--------------------------------------------------------------------------
  497.   # new method: init_unlocked_classes
  498.   #--------------------------------------------------------------------------
  499.   def init_unlocked_classes
  500.     @unlocked_classes = actor.unlocked_classes.clone
  501.     @unlocked_classes.push(@class_id) if !@unlocked_classes.include?(@class_id)
  502.     @unlocked_classes.sort!
  503.   end
  504.   
  505.   #--------------------------------------------------------------------------
  506.   # new method: init_subclass
  507.   #--------------------------------------------------------------------------
  508.   def init_subclass
  509.     @subclass_id = 0
  510.   end
  511.   
  512.   #--------------------------------------------------------------------------
  513.   # new method: unlocked_classes
  514.   #--------------------------------------------------------------------------
  515.   def unlocked_classes
  516.     init_unlocked_classes if @unlocked_classes.nil?
  517.     return @unlocked_classes
  518.   end
  519.   
  520.   #--------------------------------------------------------------------------
  521.   # new method: unlock_class
  522.   #--------------------------------------------------------------------------
  523.   def unlock_class(class_id)
  524.     init_unlocked_classes if @unlocked_classes.nil?
  525.     return if @unlocked_classes.include?(class_id)
  526.     @unlocked_classes.push(class_id)
  527.     learn_class_skills(class_id)
  528.   end
  529.   
  530.   #--------------------------------------------------------------------------
  531.   # new method: remove_class
  532.   #--------------------------------------------------------------------------
  533.   def remove_class(class_id)
  534.     init_unlocked_classes if @unlocked_classes.nil?
  535.     return if class_id == @class_id
  536.     @unlocked_classes.delete(class_id)
  537.     @subclass_id = 0 if class_id == @subclass_id
  538.     refresh
  539.   end
  540.   
  541.   #--------------------------------------------------------------------------
  542.   # new method: subclass
  543.   #--------------------------------------------------------------------------
  544.   def subclass
  545.     init_subclass if @subclass_id.nil?
  546.     return $data_classes[@subclass_id]
  547.   end
  548.   
  549.   #--------------------------------------------------------------------------
  550.   # alias method: change_class
  551.   #--------------------------------------------------------------------------
  552.   alias game_actor_change_class_cs change_class
  553.   def change_class(class_id, keep_exp = false)
  554.     @subclass_id = 0 if @subclass_id == class_id
  555.     game_actor_change_class_cs(class_id, keep_exp)
  556.     learn_class_skills(class_id)
  557.     unlock_class(class_id)
  558.   end
  559.   
  560.   #--------------------------------------------------------------------------
  561.   # new method: learn_class_skills
  562.   #--------------------------------------------------------------------------
  563.   def learn_class_skills(class_id)
  564.     return if class_id <= 0
  565.     return if $data_classes[class_id].nil?
  566.     $data_classes[class_id].learnings.each do |learning|
  567.       learn_skill(learning.skill_id) if learning.level == class_level(class_id)
  568.     end
  569.   end
  570.   
  571.   #--------------------------------------------------------------------------
  572.   # new method: change_subclass
  573.   #--------------------------------------------------------------------------
  574.   def change_subclass(class_id)
  575.     return if class_id == @class_id
  576.     unlock_class(class_id)
  577.     @subclass_id = @subclass_id == class_id ? 0 : class_id
  578.     learn_class_skills(@subclass_id)
  579.     refresh
  580.   end
  581.   
  582.   #--------------------------------------------------------------------------
  583.   # new method: class_level
  584.   #--------------------------------------------------------------------------
  585.   def class_level(class_id)
  586.     return [url=home.php?mod=space&uid=22147]@level[/url] if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  587.     temp_class = $data_classes[class_id]
  588.     @exp[class_id] = 0 if @exp[class_id].nil?
  589.     n = 1
  590.     loop do
  591.       break if temp_class.exp_for_level(n+1) > @exp[class_id]
  592.       n += 1
  593.     end
  594.     return n
  595.   end
  596.   
  597.   #--------------------------------------------------------------------------
  598.   # new method: subclass_level
  599.   #--------------------------------------------------------------------------
  600.   def subclass_level
  601.     return 0 if @subclass_id == 0
  602.     return @level if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  603.     return class_level(@subclass_id)
  604.   end
  605.   
  606.   #--------------------------------------------------------------------------
  607.   # alias method: param_base
  608.   #--------------------------------------------------------------------------
  609.   alias game_actor_param_base_cs param_base
  610.   def param_base(param_id)
  611.     result = game_actor_param_base_cs(param_id)
  612.     unless subclass.nil?
  613.       subclass_rate = YEA::CLASS_SYSTEM::SUBCLASS_STAT_RATE
  614.       slevel = subclass_level
  615.       result += subclass.params[param_id, slevel] * subclass_rate
  616.     end
  617.     return result.to_i
  618.   end
  619.   
  620.   #--------------------------------------------------------------------------
  621.   # new method: subclass_skill_types
  622.   #--------------------------------------------------------------------------
  623.   def subclass_skill_types
  624.     return [] unless YEA::CLASS_SYSTEM::SUBCLASS_SKILL_TYPES
  625.     return [] if subclass.nil?
  626.     array = []
  627.     for feature in subclass.features
  628.       next unless feature.code == FEATURE_STYPE_ADD
  629.       next if features_set(FEATURE_STYPE_ADD).include?(feature.data_id)
  630.       array.push(feature.data_id)
  631.     end
  632.     return array
  633.   end
  634.   
  635.   #--------------------------------------------------------------------------
  636.   # new method: subclass_equip_wtype?
  637.   #--------------------------------------------------------------------------
  638.   def subclass_equip_wtype?(wtype_id)
  639.     return false unless YEA::CLASS_SYSTEM::SUBCLASS_WEAPON_TYPES
  640.     return false if subclass.nil?
  641.     for feature in subclass.features
  642.       next unless feature.code == FEATURE_EQUIP_WTYPE
  643.       return true if wtype_id == feature.data_id
  644.     end
  645.     return super
  646.   end
  647.   
  648.   #--------------------------------------------------------------------------
  649.   # new method: subclass_equip_atype?
  650.   #--------------------------------------------------------------------------
  651.   def subclass_equip_atype?(atype_id)
  652.     return false unless YEA::CLASS_SYSTEM::SUBCLASS_ARMOUR_TYPES
  653.     return false if subclass.nil?
  654.     for feature in subclass.features
  655.       next unless feature.code == FEATURE_EQUIP_ATYPE
  656.       return true if atype_id == feature.data_id
  657.     end
  658.     return super
  659.   end
  660.   
  661.   #--------------------------------------------------------------------------
  662.   # alias method: release_unequippable_items
  663.   #--------------------------------------------------------------------------
  664.   alias game_actor_release_unequippable_items_cs release_unequippable_items
  665.   def release_unequippable_items(item_gain = true)
  666.     item_gain = false if @temp_flag
  667.     game_actor_release_unequippable_items_cs(item_gain)
  668.   end
  669.   
  670. end # Game_Actor

  671. #==============================================================================
  672. # ■ Game_Interpreter
  673. #==============================================================================

  674. class Game_Interpreter
  675.   
  676.   #--------------------------------------------------------------------------
  677.   # overwrite method: command_321
  678.   #--------------------------------------------------------------------------
  679.   def command_321
  680.     actor = $game_actors[@params[0]]
  681.     if actor && $data_classes[@params[1]]
  682.       maintain = YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  683.       actor.change_class(@params[1], maintain)
  684.     end
  685.   end
  686.   
  687. end # Game_Interpreter

  688. #==============================================================================
  689. # ■ Window_Base
  690. #==============================================================================

  691. class Window_Base < Window
  692.   
  693.   #--------------------------------------------------------------------------
  694.   # overwrite method: draw_actor_class
  695.   #--------------------------------------------------------------------------
  696.   def draw_actor_class(actor, x, y, width = 112)
  697.     change_color(normal_color)
  698.     if actor.subclass.nil?
  699.       text = actor.class.name
  700.     else
  701.       fmt = YEA::CLASS_SYSTEM::SUBCLASS_TEXT
  702.       text = sprintf(fmt, actor.class.name, actor.subclass.name)
  703.     end
  704.     draw_text(x, y, width, line_height, text)
  705.   end
  706.   
  707. end # Window_Base

  708. #==============================================================================
  709. # ■ Window_MenuCommand
  710. #==============================================================================

  711. class Window_MenuCommand < Window_Command
  712.   
  713.   #--------------------------------------------------------------------------
  714.   # alias method: add_formation_command
  715.   #--------------------------------------------------------------------------
  716.   alias window_menucommand_add_formation_command_cs add_formation_command
  717.   def add_formation_command
  718.     add_class_command unless $imported["YEA-AceMenuEngine"]
  719.     window_menucommand_add_formation_command_cs
  720.   end
  721.   
  722.   #--------------------------------------------------------------------------
  723.   # new method: add_class_command
  724.   #--------------------------------------------------------------------------
  725.   def add_class_command
  726.     return unless Switch.class_show
  727.     text = YEA::CLASS_SYSTEM::CLASS_MENU_TEXT
  728.     add_command(text, :class, Switch.class_enable)
  729.   end
  730.   
  731. end # Window_MenuCommand

  732. #==============================================================================
  733. # ■ Window_ClassCommand
  734. #==============================================================================

  735. class Window_ClassCommand < Window_Command
  736.   
  737.   #--------------------------------------------------------------------------
  738.   # initialize
  739.   #--------------------------------------------------------------------------
  740.   def initialize(x, y)
  741.     super(x, y)
  742.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  743.   end
  744.   
  745.   #--------------------------------------------------------------------------
  746.   # ● ウィンドウ幅の取得
  747.   #--------------------------------------------------------------------------
  748.   def window_width; return 160; end
  749.   
  750.   #--------------------------------------------------------------------------
  751.   # actor=
  752.   #--------------------------------------------------------------------------
  753.   def actor=(actor)
  754.     return if @actor == actor
  755.     @actor = actor
  756.     refresh
  757.   end
  758.   
  759.   #--------------------------------------------------------------------------
  760.   # item_window=
  761.   #--------------------------------------------------------------------------
  762.   def item_window=(window)
  763.     @item_window = window
  764.   end
  765.   
  766.   #--------------------------------------------------------------------------
  767.   # visible_line_number
  768.   #--------------------------------------------------------------------------
  769.   def visible_line_number; return 4; end
  770.   
  771.   #--------------------------------------------------------------------------
  772.   # make_command_list
  773.   #--------------------------------------------------------------------------
  774.   def make_command_list
  775.     return if @actor.nil?
  776.     for command in YEA::CLASS_SYSTEM::COMMANDS
  777.       case command[0]
  778.       when :primary
  779.         next unless Switch.primary_show
  780.         add_command(command[1], command[0], Switch.primary_enable)
  781.       when :subclass
  782.         next unless Switch.subclass_show
  783.         add_command(command[1], command[0], Switch.subclass_enable)
  784.       when :learn_skill
  785.         next unless $imported["YEA-LearnSkillEngine"]
  786.         add_learn_skill_command
  787.       else
  788.         process_custom_command(command)
  789.       end
  790.     end
  791.     if !$game_temp.scene_class_index.nil?
  792.       select($game_temp.scene_class_index)
  793.       self.oy = $game_temp.scene_class_oy
  794.     end
  795.     $game_temp.scene_class_index = nil
  796.     $game_temp.scene_class_oy = nil
  797.   end
  798.   
  799.   #--------------------------------------------------------------------------
  800.   # process_ok
  801.   #--------------------------------------------------------------------------
  802.   def process_ok
  803.     $game_temp.scene_class_index = index
  804.     $game_temp.scene_class_oy = self.oy
  805.     super
  806.   end
  807.   
  808.   #--------------------------------------------------------------------------
  809.   # process_custom_command
  810.   #--------------------------------------------------------------------------
  811.   def process_custom_command(command)
  812.     return unless YEA::CLASS_SYSTEM::CUSTOM_CLASS_COMMANDS.include?(command[0])
  813.     show = YEA::CLASS_SYSTEM::CUSTOM_CLASS_COMMANDS[command[0]][1]
  814.     continue = show <= 0 ? true : $game_switches[show]
  815.     return unless continue
  816.     text = command[1]
  817.     switch = YEA::CLASS_SYSTEM::CUSTOM_CLASS_COMMANDS[command[0]][0]
  818.     enabled = switch <= 0 ? true : $game_switches[switch]
  819.     add_command(text, command[0], enabled)
  820.   end
  821.   
  822.   #--------------------------------------------------------------------------
  823.   # update
  824.   #--------------------------------------------------------------------------
  825.   def update
  826.     super
  827.     update_visible_windows
  828.   end
  829.   
  830.   #--------------------------------------------------------------------------
  831.   # update_visible_windows
  832.   #--------------------------------------------------------------------------
  833.   def update_visible_windows
  834.     return if @current_index == current_symbol
  835.     @current_index = current_symbol
  836.     @item_window.refresh unless @item_window.nil?
  837.   end
  838.   
  839.   #--------------------------------------------------------------------------
  840.   # add_learn_skill_command
  841.   #--------------------------------------------------------------------------
  842.   def add_learn_skill_command
  843.     return unless Switch.show_learn_skill
  844.     name = YEA::LEARN_SKILL::COMMAND_NAME
  845.     add_command(name, :learn_skill, true)
  846.   end
  847.   
  848. end # Window_ClassCommand

  849. #==============================================================================
  850. # ■ Window_ClassStatus
  851. #==============================================================================

  852. class Window_ClassStatus < Window_Base
  853.   
  854.   #--------------------------------------------------------------------------
  855.   # initialize
  856.   #--------------------------------------------------------------------------
  857.   def initialize(dx, dy)
  858.     super(dx, dy, window_width, fitting_height(4))
  859.     @actor = nil
  860.   end
  861.   
  862.   #--------------------------------------------------------------------------
  863.   # window_width
  864.   #--------------------------------------------------------------------------
  865.   def window_width; Graphics.width - 160; end
  866.   
  867.   #--------------------------------------------------------------------------
  868.   # actor=
  869.   #--------------------------------------------------------------------------
  870.   def actor=(actor)
  871.     return if @actor == actor
  872.     @actor = actor
  873.     refresh
  874.   end
  875.   
  876.   #--------------------------------------------------------------------------
  877.   # refresh
  878.   #--------------------------------------------------------------------------
  879.   def refresh
  880.     contents.clear
  881.     return if @actor.nil?
  882.     draw_actor_face(@actor, 0, 0)
  883.     draw_actor_simple_status(@actor, 108, line_height / 2)
  884.   end
  885.   
  886. end # Window_ClassStatus

  887. #==============================================================================
  888. # ■ Window_ClassParam
  889. #==============================================================================

  890. class Window_ClassParam < Window_Base
  891.   
  892.   #--------------------------------------------------------------------------
  893.   # initialize
  894.   #--------------------------------------------------------------------------
  895.   def initialize(dx, dy)
  896.     super(dx, dy, window_width, Graphics.height - dy)
  897.     @actor = nil
  898.     @temp_actor = nil
  899.     refresh
  900.   end
  901.   
  902.   #--------------------------------------------------------------------------
  903.   # window_width
  904.   #--------------------------------------------------------------------------
  905.   def window_width; return Graphics.width * 2 / 5; end
  906.   
  907.   #--------------------------------------------------------------------------
  908.   # actor=
  909.   #--------------------------------------------------------------------------
  910.   def actor=(actor)
  911.     return if @actor == actor
  912.     @actor = actor
  913.     refresh
  914.   end
  915.   
  916.   #--------------------------------------------------------------------------
  917.   # refresh
  918.   #--------------------------------------------------------------------------
  919.   def refresh
  920.     contents.clear
  921.     8.times {|i| draw_item(0, line_height * i, i) }
  922.   end
  923.   
  924.   #--------------------------------------------------------------------------
  925.   # set_temp_actor
  926.   #--------------------------------------------------------------------------
  927.   def set_temp_actor(temp_actor)
  928.     return if @temp_actor == temp_actor
  929.     @temp_actor = temp_actor
  930.     refresh
  931.   end
  932.   
  933.   #--------------------------------------------------------------------------
  934.   # draw_item
  935.   #--------------------------------------------------------------------------
  936.   def draw_item(dx, dy, param_id)
  937.     draw_background_colour(dx, dy)
  938.     draw_param_name(dx + 4, dy, param_id)
  939.     draw_current_param(dx + 4, dy, param_id) if @actor
  940.     drx = (contents.width + 22) / 2
  941.     draw_right_arrow(drx, dy)
  942.     draw_new_param(drx + 22, dy, param_id) if @temp_actor
  943.     reset_font_settings
  944.   end
  945.   
  946.   #--------------------------------------------------------------------------
  947.   # draw_background_colour
  948.   #--------------------------------------------------------------------------
  949.   def draw_background_colour(dx, dy)
  950.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  951.     rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
  952.     contents.fill_rect(rect, colour)
  953.   end
  954.   
  955.   #--------------------------------------------------------------------------
  956.   # overwrite method: draw_param_name
  957.   #--------------------------------------------------------------------------
  958.   def draw_param_name(dx, dy, param_id)
  959.     contents.font.size = YEA::CLASS_SYSTEM::PARAM_FONT_SIZE
  960.     change_color(system_color)
  961.     draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
  962.   end
  963.   
  964.   #--------------------------------------------------------------------------
  965.   # overwrite method: draw_current_param
  966.   #--------------------------------------------------------------------------
  967.   def draw_current_param(dx, dy, param_id)
  968.     change_color(normal_color)
  969.     dw = (contents.width + 22) / 2
  970.     draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
  971.     reset_font_settings
  972.   end
  973.   
  974.   #--------------------------------------------------------------------------
  975.   # draw_right_arrow
  976.   #--------------------------------------------------------------------------
  977.   def draw_right_arrow(x, y)
  978.     change_color(system_color)
  979.     draw_text(x, y, 22, line_height, "→", 1)
  980.   end
  981.   
  982.   #--------------------------------------------------------------------------
  983.   # draw_new_param
  984.   #--------------------------------------------------------------------------
  985.   def draw_new_param(dx, dy, param_id)
  986.     contents.font.size = YEA::CLASS_SYSTEM::PARAM_FONT_SIZE
  987.     new_value = @temp_actor.param(param_id)
  988.     change_color(param_change_color(new_value - @actor.param(param_id)))
  989.     draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
  990.     reset_font_settings
  991.   end
  992.   
  993. end # Window_ClassParam

  994. #==============================================================================
  995. # ■ Window_ClassList
  996. #==============================================================================

  997. class Window_ClassList < Window_Selectable
  998.   
  999.   #--------------------------------------------------------------------------
  1000.   # initialize
  1001.   #--------------------------------------------------------------------------
  1002.   def initialize(dx, dy)
  1003.     dw = Graphics.width - (Graphics.width * 2 / 5)
  1004.     dh = Graphics.height - dy
  1005.     super(dx, dy, dw, dh)
  1006.     @actor = nil
  1007.     @command_window = nil
  1008.     @status_window
  1009.     @data = []
  1010.   end
  1011.   
  1012.   #--------------------------------------------------------------------------
  1013.   # actor=
  1014.   #--------------------------------------------------------------------------
  1015.   def actor=(actor)
  1016.     return if @actor == actor
  1017.     @actor = actor
  1018.     @last_item = nil
  1019.     refresh
  1020.     self.oy = 0
  1021.   end
  1022.   
  1023.   #--------------------------------------------------------------------------
  1024.   # command_window=
  1025.   #--------------------------------------------------------------------------
  1026.   def command_window=(command_window)
  1027.     @command_window = command_window
  1028.   end
  1029.   
  1030.   #--------------------------------------------------------------------------
  1031.   # status_window=
  1032.   #--------------------------------------------------------------------------
  1033.   def status_window=(status_window)
  1034.     @status_window = status_window
  1035.   end
  1036.   
  1037.   #--------------------------------------------------------------------------
  1038.   # item_max
  1039.   #--------------------------------------------------------------------------
  1040.   def item_max; return @data ? @data.size : 1; end
  1041.   
  1042.   #--------------------------------------------------------------------------
  1043.   # item
  1044.   #--------------------------------------------------------------------------
  1045.   def item; return @data && index >= 0 ? @data[index] : nil; end
  1046.   
  1047.   #--------------------------------------------------------------------------
  1048.   # current_item_enabled?
  1049.   #--------------------------------------------------------------------------
  1050.   def current_item_enabled?; return enable?(@data[index]); end
  1051.   
  1052.   #--------------------------------------------------------------------------
  1053.   # include?
  1054.   #--------------------------------------------------------------------------
  1055.   def include?(item)
  1056.     return true if YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS.include?(item.id)
  1057.     return @actor.unlocked_classes.include?(item.id)
  1058.   end
  1059.   
  1060.   #--------------------------------------------------------------------------
  1061.   # enable?
  1062.   #--------------------------------------------------------------------------
  1063.   def enable?(item)
  1064.     return false if item == @actor.class
  1065.     return true
  1066.   end
  1067.   
  1068.   #--------------------------------------------------------------------------
  1069.   # make_item_list
  1070.   #--------------------------------------------------------------------------
  1071.   def make_item_list
  1072.     @data = []
  1073.     for class_id in YEA::CLASS_SYSTEM::CLASS_ORDER
  1074.       next if $data_classes[class_id].nil?
  1075.       item = $data_classes[class_id]
  1076.       @data.push(item) if include?(item)
  1077.     end
  1078.   end
  1079.   
  1080.   #--------------------------------------------------------------------------
  1081.   # select_last
  1082.   #--------------------------------------------------------------------------
  1083.   def select_last
  1084.     case @command_window.current_symbol
  1085.     when :primary
  1086.       select(@data.index(@actor.class))
  1087.     when :subclass
  1088.       select(0) if @actor.subclass.nil?
  1089.       select(@data.index(@actor.subclass)) unless @actor.subclass.nil?
  1090.     else
  1091.       select(0)
  1092.     end
  1093.   end
  1094.   
  1095.   #--------------------------------------------------------------------------
  1096.   # draw_item
  1097.   #--------------------------------------------------------------------------
  1098.   def draw_item(index)
  1099.     item = @data[index]
  1100.     return if item.nil?
  1101.     rect = item_rect(index)
  1102.     rect.width -= 4
  1103.     reset_font_settings
  1104.     set_item_colour(item)
  1105.     draw_class_icon(item, rect)
  1106.     draw_class_name(item, rect)
  1107.     draw_class_level(item, rect)
  1108.   end
  1109.   
  1110.   #--------------------------------------------------------------------------
  1111.   # set_item_colour
  1112.   #--------------------------------------------------------------------------
  1113.   def set_item_colour(item)
  1114.     if item == @actor.class
  1115.       change_color(text_color(YEA::CLASS_SYSTEM::CURRENT_CLASS_COLOUR))
  1116.     elsif item == @actor.subclass
  1117.       change_color(text_color(YEA::CLASS_SYSTEM::SUBCLASS_COLOUR))
  1118.     else
  1119.       change_color(normal_color, enable?(item))
  1120.     end
  1121.   end
  1122.   
  1123.   #--------------------------------------------------------------------------
  1124.   # draw_class_icon
  1125.   #--------------------------------------------------------------------------
  1126.   def draw_class_icon(item, rect)
  1127.     icon = item.icon_index
  1128.     draw_icon(icon, rect.x, rect.y)
  1129.   end
  1130.   
  1131.   #--------------------------------------------------------------------------
  1132.   # draw_class_name
  1133.   #--------------------------------------------------------------------------
  1134.   def draw_class_name(item, rect)
  1135.     text = item.name
  1136.     draw_text(24, rect.y, rect.width-24, line_height, text)
  1137.   end
  1138.   
  1139.   #--------------------------------------------------------------------------
  1140.   # draw_class_level
  1141.   #--------------------------------------------------------------------------
  1142.   def draw_class_level(item, rect)
  1143.     return if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  1144.     return if @actor.nil?
  1145.     level = @actor.class_level(item.id)
  1146.     contents.font.size = YEA::CLASS_SYSTEM::LEVEL_FONT_SIZE
  1147.     text = sprintf(YEA::CLASS_SYSTEM::CLASS_LEVEL, level.group)
  1148.     draw_text(rect, text, 2)
  1149.   end
  1150.   
  1151.   #--------------------------------------------------------------------------
  1152.   # update_help
  1153.   #--------------------------------------------------------------------------
  1154.   def update_help
  1155.     @help_window.set_item(item)
  1156.     return if @actor.nil?
  1157.     return if @status_window.nil?
  1158.     update_param_window
  1159.   end
  1160.   
  1161.   #--------------------------------------------------------------------------
  1162.   # update_param_window
  1163.   #--------------------------------------------------------------------------
  1164.   def update_param_window
  1165.     return if @last_item == item
  1166.     @last_item = item
  1167.     class_id = item.nil? ? @actor.class_id : item.id
  1168.     temp_actor = Marshal.load(Marshal.dump(@actor))
  1169.     temp_actor.temp_flag = true
  1170.     case @command_window.current_symbol
  1171.     when :primary
  1172.       temp_actor.change_class(class_id, YEA::CLASS_SYSTEM::MAINTAIN_LEVELS)
  1173.     when :subclass
  1174.       temp_actor.change_subclass(class_id)
  1175.     end
  1176.     @status_window.set_temp_actor(temp_actor)
  1177.   end
  1178.   
  1179.   #--------------------------------------------------------------------------
  1180.   # update_class
  1181.   #--------------------------------------------------------------------------
  1182.   def update_class
  1183.     @last_item = nil
  1184.     update_help
  1185.     refresh
  1186.     activate
  1187.   end
  1188.   
  1189.   #--------------------------------------------------------------------------
  1190.   # refresh
  1191.   #--------------------------------------------------------------------------
  1192.   def refresh
  1193.     make_item_list
  1194.     create_contents
  1195.     draw_all_items
  1196.   end
  1197.   
  1198. end # Window_ClassList

  1199. #==============================================================================
  1200. # ■ Scene_Menu
  1201. #==============================================================================

  1202. class Scene_Menu < Scene_MenuBase
  1203.   
  1204.   #--------------------------------------------------------------------------
  1205.   # alias method: create_command_window
  1206.   #--------------------------------------------------------------------------
  1207.   alias scene_menu_create_command_window_cs create_command_window
  1208.   def create_command_window
  1209.     scene_menu_create_command_window_cs
  1210.     @command_window.set_handler(:class, method(:command_personal))
  1211.   end
  1212.   
  1213.   #--------------------------------------------------------------------------
  1214.   # alias method: on_personal_ok
  1215.   #--------------------------------------------------------------------------
  1216.   alias scene_menu_on_personal_ok_cs on_personal_ok
  1217.   def on_personal_ok
  1218.     case @command_window.current_symbol
  1219.     when :class
  1220.       SceneManager.call(Scene_Class)
  1221.     else
  1222.       scene_menu_on_personal_ok_cs
  1223.     end
  1224.   end
  1225.   
  1226. end # Scene_Menu

  1227. #==============================================================================
  1228. # ■ Scene_Class
  1229. #==============================================================================

  1230. class Scene_Class < Scene_MenuBase
  1231.   
  1232.   #--------------------------------------------------------------------------
  1233.   # start
  1234.   #--------------------------------------------------------------------------
  1235.   def start
  1236.     super
  1237.     create_help_window
  1238.     create_command_window
  1239.     create_status_window
  1240.     create_param_window
  1241.     create_item_window
  1242.     relocate_windows
  1243.   end
  1244.   
  1245.   #--------------------------------------------------------------------------
  1246.   # create_command_window
  1247.   #--------------------------------------------------------------------------
  1248.   def create_command_window
  1249.     wy = @help_window.height
  1250.     @command_window = Window_ClassCommand.new(0, wy)
  1251.     @command_window.viewport = @viewport
  1252.     @command_window.help_window = @help_window
  1253.     @command_window.actor = @actor
  1254.     @command_window.set_handler(:cancel,   method(:return_scene))
  1255.     @command_window.set_handler(:primary,  method(:command_class_change))
  1256.     @command_window.set_handler(:subclass, method(:command_class_change))
  1257.     process_custom_class_commands
  1258.     return if $game_party.in_battle
  1259.     @command_window.set_handler(:pagedown, method(:next_actor))
  1260.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1261.     @command_window.set_handler(:learn_skill, method(:command_learn_skill))
  1262.   end
  1263.   
  1264.   #--------------------------------------------------------------------------
  1265.   # process_custom_class_commands
  1266.   #--------------------------------------------------------------------------
  1267.   def process_custom_class_commands
  1268.     for command in YEA::CLASS_SYSTEM::COMMANDS
  1269.       next unless YEA::CLASS_SYSTEM::CUSTOM_CLASS_COMMANDS.include?(command[0])
  1270.       called_method = YEA::CLASS_SYSTEM::CUSTOM_CLASS_COMMANDS[command[0]][2]
  1271.       @command_window.set_handler(command[0], method(called_method))
  1272.     end
  1273.   end
  1274.   
  1275.   #--------------------------------------------------------------------------
  1276.   # create_status_window
  1277.   #--------------------------------------------------------------------------
  1278.   def create_status_window
  1279.     wy = @help_window.height
  1280.     @status_window = Window_ClassStatus.new(@command_window.width, wy)
  1281.     @status_window.viewport = @viewport
  1282.     @status_window.actor = @actor
  1283.   end
  1284.   
  1285.   #--------------------------------------------------------------------------
  1286.   # create_param_window
  1287.   #--------------------------------------------------------------------------
  1288.   def create_param_window
  1289.     dx = Graphics.width - (Graphics.width * 2 / 5)
  1290.     dy = @status_window.y + @status_window.height
  1291.     @param_window = Window_ClassParam.new(dx, dy)
  1292.     @param_window.viewport = @viewport
  1293.     @param_window.actor = @actor
  1294.   end
  1295.   
  1296.   #--------------------------------------------------------------------------
  1297.   # create_item_window
  1298.   #--------------------------------------------------------------------------
  1299.   def create_item_window
  1300.     dy = @status_window.y + @status_window.height
  1301.     @item_window = Window_ClassList.new(0, dy)
  1302.     @item_window.help_window = @help_window
  1303.     @item_window.command_window = @command_window
  1304.     @item_window.status_window = @param_window
  1305.     @item_window.viewport = @viewport
  1306.     @item_window.actor = @actor
  1307.     @command_window.item_window = @item_window
  1308.     @item_window.set_handler(:ok,     method(:on_class_ok))
  1309.     @item_window.set_handler(:cancel, method(:on_class_cancel))
  1310.   end
  1311.   
  1312.   #--------------------------------------------------------------------------
  1313.   # relocate_windows
  1314.   #--------------------------------------------------------------------------
  1315.   def relocate_windows
  1316.     return unless $imported["YEA-AceMenuEngine"]
  1317.     case Menu.help_window_location
  1318.     when 0 # Top
  1319.       @help_window.y = 0
  1320.       @command_window.y = @help_window.height
  1321.       @param_window.y = @command_window.y + @command_window.height
  1322.     when 1 # Middle
  1323.       @command_window.y = 0
  1324.       @help_window.y = @command_window.height
  1325.       @param_window.y = @help_window.y + @help_window.height
  1326.     else # Bottom
  1327.       @command_window.y = 0
  1328.       @param_window.y = @command_window.height
  1329.       @help_window.y = @param_window.y + @param_window.height
  1330.     end
  1331.     @status_window.y = @command_window.y
  1332.     @item_window.y = @param_window.y
  1333.   end
  1334.   
  1335.   #--------------------------------------------------------------------------
  1336.   # on_actor_change
  1337.   #--------------------------------------------------------------------------
  1338.   def on_actor_change
  1339.     @command_window.actor = @actor
  1340.     @status_window.actor = @actor
  1341.     @param_window.actor = @actor
  1342.     @item_window.actor = @actor
  1343.     @command_window.activate
  1344.   end
  1345.   
  1346.   #--------------------------------------------------------------------------
  1347.   # command_class_change
  1348.   #--------------------------------------------------------------------------
  1349.   def command_class_change
  1350.     @item_window.activate
  1351.     @item_window.select_last
  1352.   end
  1353.   
  1354.   #--------------------------------------------------------------------------
  1355.   # on_class_cancel
  1356.   #--------------------------------------------------------------------------
  1357.   def on_class_cancel
  1358.     @item_window.unselect
  1359.     @command_window.activate
  1360.     @param_window.set_temp_actor(nil)
  1361.   end
  1362.   
  1363.   #--------------------------------------------------------------------------
  1364.   # on_class_ok
  1365.   #--------------------------------------------------------------------------
  1366.   def on_class_ok
  1367.     Sound.play_equip
  1368.     class_id = @item_window.item.id
  1369.     maintain = YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  1370.     hp = @actor.hp * 1.0 / @actor.mhp
  1371.     mp = @actor.mp * 1.0 / [@actor.mmp, 1].max
  1372.     case @command_window.current_symbol
  1373.     when :primary
  1374.       @actor.change_class(class_id, maintain)
  1375.     when :subclass
  1376.       @actor.change_subclass(class_id)
  1377.     else
  1378.       @item_window.activate
  1379.       return
  1380.     end
  1381.     @actor.hp = (@actor.mhp * hp).to_i
  1382.     @actor.mp = (@actor.mmp * mp).to_i
  1383.     @status_window.refresh
  1384.     @item_window.update_class
  1385.   end
  1386.   
  1387.   #--------------------------------------------------------------------------
  1388.   # new method: command_learn_skill
  1389.   #--------------------------------------------------------------------------
  1390.   def command_learn_skill
  1391.     return unless $imported["YEA-LearnSkillEngine"]
  1392.     SceneManager.call(Scene_LearnSkill)
  1393.   end
  1394.   
  1395.   #--------------------------------------------------------------------------
  1396.   # command_name1
  1397.   #--------------------------------------------------------------------------
  1398.   def command_name1
  1399.     # Do nothing.
  1400.   end
  1401.   
  1402.   #--------------------------------------------------------------------------
  1403.   # command_name2
  1404.   #--------------------------------------------------------------------------
  1405.   def command_name2
  1406.     # Do nothing.
  1407.   end
  1408.   
  1409. end # Scene_Class

  1410. #==============================================================================
  1411. #
  1412. # ▼ End of File
  1413. #
  1414. #==============================================================================
复制代码
恩,脚本如上,我希望能够添加一个改变职业就可以自动改变该人物行走图和头像的系统,但是实在苦手,也不知道从哪里插入代码好
希望大家能够提提意见,非常感谢……
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-12-31 04:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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