Guest User

Yanfly Zealous Job System Classes

a guest
Mar 22nd, 2014
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. #
  3. # Yanfly Engine Zealous - Job System: Classes
  4. # Last Date Updated: 2010.01.28
  5. # Level: Normal, Hard
  6. #
  7. # There's been many class switching scripts but rarely any scripts that added
  8. # subclasses. This script offers both features along with many adjustable rules
  9. # regarding the whole class switching process and easy to adapt scenes. For
  10. # those who are familiar with YERD's Subclass Selection System, this script will
  11. # function very similarly but will withhold its own unique set of rules and
  12. # customization properties as well. Furthermore, this script is also independent
  13. # of the Job System: Base script and can function without it (though I highly
  14. # recommend the two to be used in conjunction with each other to achieve the
  15. # most optimal effect).
  16. #
  17. #===============================================================================
  18. # Updates
  19. # -----------------------------------------------------------------------------
  20. # o 2010.01.28 - Efficiency update.
  21. # o 2010.01.22 - Equipment Overhaul Compatibility.
  22. #              - Compatibility access to Weapon Mastery Skills.
  23. #              - Compatibility access to BEZ Formation Macros
  24. # o 2010.01.10 - Job System: Passives Compatibility.
  25. # o 2010.01.04 - Started Script and Finished.
  26. #===============================================================================
  27. # Instructions
  28. # -----------------------------------------------------------------------------
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Debug Shortcuts - Only during $TEST and $BTEST mode
  34. # -----------------------------------------------------------------------------
  35. # During testplay mode, pressing F7 or F8 at the learning class menus will
  36. # lower or raise the classes' JP totals by 1000 + rand(1000).
  37. #
  38. #===============================================================================
  39. # Compatibility
  40. # -----------------------------------------------------------------------------
  41. # - Works With: YEZ Job System Scripts, YEZ Main Menu Zealous
  42. # - Requires: YEZ Skill Command Selection
  43. # -----------------------------------------------------------------------------
  44. # Note: This script may not work with former Yanfly Engine ReDux scripts.
  45. #       Use Yanfly Engine Zealous scripts to work with this if available.
  46. #===============================================================================
  47.  
  48. $imported = {} if $imported == nil
  49. $imported["JobSystemClasses"] = true
  50.  
  51. module YEZ
  52.   module JOB
  53.    
  54.     #===========================================================================
  55.     # Basic Settings
  56.     # --------------------------------------------------------------------------
  57.     # The following below will adjust the basic settings and vocabulary that
  58.     # will display throughout the script. Change them as you see fit.
  59.     #===========================================================================
  60.    
  61.     # This adjusts the Class scene Info.
  62.     CLASS_TITLE = "Class"
  63.     CLASS_ICON = 131
  64.    
  65.     # These two switches adjust whether or not primary classes and subclasses
  66.     # are accessible from the menu. If either switch is on, the "Class" menu
  67.     # command will be enabled and shows up.
  68.     ENABLE_1STCLASS_SWITCH = 46
  69.     ENABLE_SUBCLASS_SWITCH = 47
  70.    
  71.     # This array determines the items shown and displayed in the class menu.
  72.     # Rearrange them accordingly. The following options are available:
  73.     #  :primary    Allows player to switch actor's primary class.
  74.     #  :subclass   Allows player to switch actor's subclass.
  75.     #  :passives   Requires Job System: Passives
  76.     #  :skill      Allows player to enter the skill menu scene.
  77.     #  :equip      Allows player to enter the equip menu scene.
  78.     CLASS_COMMANDS =[
  79.       :primary,    # Allows player to switch actor's primary class.
  80.       :subclass,   # Allows player to switch actor's subclass.
  81.       :formations, # Requires BEZ Formation Macros.
  82.       :mastery,    # Requires Weapon Mastery Skills
  83.     # :passives,   # Requires Job System: Passives
  84.     # :skill,      # Allows player to enter the skill menu scene.
  85.     # :equip,      # Allows player to enter the equip menu scene.
  86.     ] # Do not remove this.
  87.    
  88.     # The following hash adjusts the text displayed for this script. Adjust
  89.     # them accordingly to how you want them to show up.
  90.     CLASS_VOCAB ={
  91.       :primary    => "Primary",
  92.       :subclass   => "Subclass",
  93.       :formations => "Tactics",
  94.       :mastery    => "Weaponry",
  95.       :passives   => "Passives",
  96.       :skill      => "Skills",
  97.       :equip      => "Equipment",
  98.       :arrow      => "→",
  99.       :list       => "Acquired Skills",
  100.     } # Do not remove this.
  101.    
  102.     # This will create a centered command window for the scene.
  103.     CLASS_CENTERED_COMMAND = true
  104.    
  105.     # The following hash adjusts which classes are unlocked for the actor by
  106.     # default. Note that actor ID 0 is unlocked for the party, which means all
  107.     # actors have access to it.
  108.     UNLOCKED_1STCLASS ={
  109.     # ActorID => [Unlocked Classes]
  110.             0 => [1..8],
  111.             1 => [8],
  112.             2 => [7],
  113.             3 => [5],
  114.             4 => [6],
  115.     } # Do not remove this,
  116.    
  117.     # The following hash adjusts which subclasses are unlocked for the actor by
  118.     # default. Note that actor ID 0 is unlocked for the party, which means all
  119.     # actors have access to it.
  120.     UNLOCKED_SUBCLASS ={
  121.     # ActorID => [Unlocked Classes]
  122.             0 => [1..8]
  123.     } # Do not remove this.
  124.    
  125.     #===========================================================================
  126.     # Class Stat Settings
  127.     # --------------------------------------------------------------------------
  128.     # Since not all classes will have the same stat distributions, this script
  129.     # will allow for some classes to have higher MaxHP than others, or lower
  130.     # ATK than others, etc. Adjust the following settings accordingly.
  131.     #===========================================================================
  132.    
  133.     # This hash adjusts the stats calculated for each stat. Some stats that
  134.     # appear here are not available in the database by default and require YEZ
  135.     # scripts to function. If the respective scripts do not exist, this script
  136.     # will still function.
  137.     CLASS_STATS ={ # Do not remove class 0.
  138.     # ID => [   HP,   MP,  ATK,  DEF,  SPI,  RES,  DEX,  AGI]
  139.        0 => [ 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00], # Common
  140.        1 => [ 1.50, 1.00, 1.25, 1.25, 1.00, 1.00, 1.00, 1.50], # Knight
  141.        2 => [ 1.75, 1.00, 1.50, 1.50, 0.50, 0.50, 2.00, 1.00], # Warrior
  142.        3 => [ 0.85, 1.50, 0.50, 0.75, 1.25, 2.00, 1.25, 1.25], # Priest
  143.        4 => [ 0.75, 2.00, 0.50, 0.75, 2.00, 1.25, 1.25, 1.25], # Magician
  144.        5 => [ 1.25, 1.25, 1.50, 1.25, 0.75, 1.50, 1.25, 0.75], # Paladin
  145.        6 => [ 1.25, 1.25, 1.50, 1.25, 1.50, 0.75, 0.75, 1.25], # Dark Knight
  146.        7 => [ 2.00, 0.75, 2.00, 0.75, 0.50, 0.50, 2.00, 1.25], # Grappler
  147.        8 => [ 0.65, 1.50, 1.00, 0.75, 0.75, 0.75, 1.75, 2.00], # Thief
  148.     } # Do not remove this.
  149.    
  150.     # This adjusts the multiplier rate each class has an effect on for the
  151.     # base stats calculated.
  152.     PRIMARY_MULTIPLIER  = 1.00
  153.     SUBCLASS_MULTIPLIER = 0.50
  154.    
  155.     # When characters level up, they can receive stat bonuses depending on
  156.     # what their primary class and subclass are. Adjust the hash below to
  157.     # change the way stat growths work for each class.
  158.     CLASS_BONUSES ={ # Do not remove class 0.
  159.     # ID => [   HP,   MP,  ATK,  DEF,  SPI,  RES,  DEX,  AGI]
  160.        0 => [    0,    0,    0,    0,    0,    0,    0,    0], # Common
  161.        1 => [   10,    0,    3,    6,    0,    0,    0,    6], # Knight
  162.        2 => [   20,    0,    6,    3,    0,    0,    6,    0], # Warrior
  163.        3 => [    0,   10,    0,    3,    3,    6,    0,    0], # Priest
  164.        4 => [    0,   10,    0,    0,    6,    3,    3,    0], # Magician
  165.        5 => [    5,    0,    3,    3,    0,    6,    3,    0], # Paladin
  166.        6 => [    5,    0,    3,    3,    6,    0,    3,    0], # Dark Knight
  167.        7 => [   30,    0,    6,    0,    0,    0,    6,    3], # Grappler
  168.        8 => [    0,    0,    3,    0,    0,    0,    6,    6], # Thief
  169.     } # Do not remove this.
  170.    
  171.     # This adjusts the rate of growth for both the primary class and the
  172.     # subclass equipped at the time of the level up. If the rate is 0.00, then
  173.     # there will be no bonus growth rate at all.
  174.     PRIMARY_BONUS_RATE  = 1.00
  175.     SUBCLASS_BONUS_RATE = 0.00
  176.    
  177.     # To add more variability for your characters, each class can have a random
  178.     # stat growth amount. Note that values 0 and 1 won't do anything. Only from
  179.     # a value of 2 and onward will actually have an effect.
  180.     CLASS_RANDOM ={ # Do not remove class 0.
  181.     # ID => [   HP,   MP,  ATK,  DEF,  SPI,  RES,  DEX,  AGI]
  182.        0 => [    0,    0,    0,    0,    0,    0,    0,    0], # Common
  183.        1 => [    5,    0,    2,    4,    0,    0,    0,    4], # Knight
  184.        2 => [   10,    0,    4,    2,    0,    0,    4,    0], # Warrior
  185.        3 => [    0,    0,    0,    2,    2,    4,    0,    0], # Priest
  186.        4 => [    0,    0,    0,    0,    4,    2,    2,    0], # Magician
  187.        5 => [    3,    0,    2,    2,    0,    4,    2,    0], # Paladin
  188.        6 => [    3,    0,    2,    2,    2,    0,    2,    0], # Dark Knight
  189.        7 => [   15,    0,    4,    0,    0,    0,    4,    2], # Grappler
  190.        8 => [    0,    0,    2,    0,    0,    0,    4,    4], # Thief
  191.     } # Do not remove this.
  192.    
  193.     # This adjusts the rate of the random stat growth for both the primary and
  194.     # subclass equipped at the time of the level up. If the rate is 0.00, then
  195.     # there will be no random growth rate at all.
  196.     PRIMARY_RANDOM_RATE  = 1.00
  197.     SUBCLASS_RANDOM_RATE = 0.00
  198.    
  199.     # If Job System: Base is installed, this adjusts how much JP the subclass
  200.     # earns whenever JP is gained.
  201.     SUBCLASS_JP_MULTIPLIER = 0.5
  202.    
  203.     # This adjusts whether or not subclasses can share weapons or armour
  204.     # equips with the main class.
  205.     SUBCLASS_WEAPONS = true
  206.     SUBCLASS_ARMOURS = false
  207.    
  208.     #===========================================================================
  209.     # Skill Settings
  210.     # --------------------------------------------------------------------------
  211.     # Here, you can set which skills will be considered primary-only skills and
  212.     # which skills will be considered subclass-only. This means that certain
  213.     # skills will only appear usable if the primary class is equipped or if the
  214.     # subclass is equipped. If skills exist in either case, they're usable by
  215.     # all standards. If you have Job System: Base installed, the skills within
  216.     # the CLASS_SKILLS hash will be usable regardless of primary/subclass-only.
  217.     #===========================================================================
  218.    
  219.     # Common skills are usable by all classes but cannot be learned through JP
  220.     # unless it exists within the CLASS_SKILLS hash inside of the Job System:
  221.     # Base script. Insert here what you wish to be common skills.
  222.     COMMON_SKILLS = []
  223.    
  224.     # This hash adjusts the primary only skills. If a class doesn't exist here,
  225.     # then that class doesn't have any primary-only skills.
  226.     PRIMARY_ONLY_SKILLS ={
  227.     #ID => [Skills]
  228.       1 => [164..166, 168],
  229.       2 => [163..166, 168, 169],
  230.       3 => [170, 172],
  231.       4 => [170, 172],
  232.       5 => [164, 172],
  233.       6 => [164, 169],
  234.       7 => [163, 167],
  235.       8 => [167, 171],
  236.     } # Do not remove this.
  237.     # This hash adjusts the subclass only skills.
  238.     SUBCLASS_ONLY_SKILLS ={
  239.     #ID => [Skills]
  240.       1 => [],
  241.       2 => [],
  242.       3 => [],
  243.       4 => [],
  244.     } # Do not remove this.
  245.    
  246.     #===========================================================================
  247.     # Display Settings
  248.     # --------------------------------------------------------------------------
  249.     # This part adjusts the way classes are displayed in the various menus.
  250.     # Here, you can allow class name combinations, give special cases for those
  251.     # said combinations, and more. Class icons are also defined here.
  252.     #===========================================================================
  253.    
  254.     # This adjusts the colour of the primary class and subclass inside of the
  255.     # clas changing windows.
  256.     PRIMARY_COLOUR  = 6
  257.     SUBCLASS_COLOUR = 6
  258.    
  259.     # This adjusts the way class orders are displayed within the class list
  260.     # windows whenever they appear.
  261.     CLASS_ORDER = [1..4, 5, 6, 7, 8]
  262.    
  263.     # This determines which stats will be drawn inside of the class change data
  264.     # window in the lower right corner of the class scene.
  265.     #   :maxhp, :maxmp, :atk, :def, :spi, :res; :dex; :agi
  266.     SHOWN_CLASS_STATS = [:maxhp, :maxmp, :atk, :def, :spi, :res, :dex, :agi]
  267.    
  268.     # This allows you to designate icons for your classes. These will show up
  269.     # whenever the class name is drawn.
  270.     CLASS_ICONS ={
  271.     # Class.ID => Icon ID
  272.             0  =>  176,  # Nil Class
  273.             1  =>  32,   # Paladin(Knight)
  274.             2  =>  6,    # Warrior
  275.             3  =>  128,  # Priest
  276.             4  =>  119,  # Magician
  277.             5  =>  3,    # Knight(Paladin)
  278.             6  =>  136,  # Dark Knight
  279.             7  =>  132,  # Grappler
  280.             8  =>  39,   # Thief
  281.     } # Do not remove this.
  282.    
  283.     # This adjusts the class display name type. Here are the various settings
  284.     # in regards to the class name settings.
  285.     #   0 - Primary only
  286.     #   1 - Primary unless there is a combination name.
  287.     #   2 - Primary/Secondary unless there is a combination name.
  288.     #   3 - Primary/Secondary only
  289.     CLASS_NAME_DISPLAY = 1
  290.    
  291.     # The following here adjusts class combination names. If a combination
  292.     # here matches, it will use that name instead.
  293.     COMBINATION_NAMES ={
  294.       # Combination Required => New Class Name
  295.             "Knight/Warrior" => "Gladiator",
  296.            "Knight/Magician" => "Magic Knight",
  297.             "Knight/Paladin" => "White Knight",
  298.         "Knight/Dark Knight" => "Black Knight",
  299.             "Warrior/Knight" => "Combatant",
  300.           "Warrior/Grappler" => "Fighter",
  301.              "Warrior/Thief" => "Mercenary",
  302.            "Priest/Magician" => "Shaman",
  303.             "Priest/Paladin" => "Enchanter",
  304.            "Magician/Knight" => "Spell Sword",
  305.            "Magician/Priest" => "Archmage",
  306.       "Magician/Dark Knight" => "Necromancer",
  307.             "Paladin/Knight" => "Holy Knight",
  308.             "Paladin/Priest" => "Soul Knight",
  309.        "Paladin/Dark Knight" => "Arc Knight",
  310.         "Dark Knight/Knight" => "Hell Knight",
  311.       "Dark Knight/Magician" => "Death Knight",
  312.        "Dark Knight/Paladin" => "Night Blade",
  313.           "Grappler/Warrior" => "Brawler",
  314.             "Grappler/Thief" => "Wrestler",
  315.              "Thief/Warrior" => "Rogue Edge",
  316.             "Thief/Grappler" => "Assassin",
  317.     } # Do not remove this.
  318.    
  319.     # The following adjusts the descriptions used for the classes during the
  320.     # class changing scene.
  321.     CLASS_HELP_DESCRIPTIONS ={
  322.     # ClassID => Description
  323.             1 => "Physical fighter capable of using rage skills.",
  324.             2 => "Physical fighter capable of using many weapons.",
  325.             3 => "Magical user who heals wounded allies in combat.",
  326.             4 => "Magical user who casts offensive magic in combat.",
  327.             5 => "Magical fighter capable of using healing skills.",
  328.             6 => "Magical fighter capable of using darkness skills.",
  329.             7 => "Physical fighter who specializes in close combat.",
  330.             8 => "Physical fighter who specializes in quick combat.",
  331.     } # Do not remove this.
  332.    
  333.   end # JOB  
  334. end # YEZ
  335.  
  336. #===============================================================================
  337. # Editting anything past this point may potentially result in causing computer
  338. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  339. # Therefore, edit at your own risk.
  340. #===============================================================================
  341.  
  342. module YEZ::JOB
  343.   module_function
  344.   #--------------------------------------------------------------------------
  345.   # convert_integer_array
  346.   #--------------------------------------------------------------------------
  347.   def convert_integer_array(array)
  348.     result = []
  349.     array.each { |i|
  350.       case i
  351.       when Range; result |= i.to_a
  352.       when Integer; result |= [i]
  353.       end }
  354.     return result
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # full_convert_hash
  358.   #--------------------------------------------------------------------------
  359.   def full_convert_hash(hash)
  360.     result = {}
  361.     hash.each { |key|
  362.       result[key[0]] = convert_integer_array(key[1]) }
  363.     return result
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # class_lists
  367.   #--------------------------------------------------------------------------
  368.   UNLOCKED_1STCLASS_LIST = full_convert_hash(UNLOCKED_1STCLASS)
  369.   UNLOCKED_SUBCLASS_LIST = full_convert_hash(UNLOCKED_SUBCLASS)
  370.   CLASS_ORDER_LIST = convert_integer_array(CLASS_ORDER)
  371.   COMMON_SKILLS_LIST = convert_integer_array(COMMON_SKILLS)
  372.   PRIMARY_ONLY_SKILLS_LIST = full_convert_hash(PRIMARY_ONLY_SKILLS)
  373.   SUBCLASS_ONLY_SKILLS_LIST = full_convert_hash(SUBCLASS_ONLY_SKILLS)
  374.  
  375. end # YEZ::JOB
  376.  
  377. #===============================================================================
  378. # Game_Temp
  379. #===============================================================================
  380.  
  381. class Game_Temp
  382.  
  383.   #--------------------------------------------------------------------------
  384.   # public instance variables
  385.   #--------------------------------------------------------------------------
  386.   attr_accessor :jpc_oy
  387.  
  388. end # Game_Temp
  389.  
  390. #===============================================================================
  391. # Game_Actor
  392. #===============================================================================
  393.  
  394. class Game_Actor < Game_Battler
  395.  
  396.   #--------------------------------------------------------------------------
  397.   # alias method: setup
  398.   #--------------------------------------------------------------------------
  399.   alias setup_jpclasses setup unless $@
  400.   def setup(actor_id)
  401.     setup_jpclasses(actor_id)
  402.     @subclass_id = 0
  403.     @base_maxhp_plus = 0
  404.     @base_maxmp_plus = 0
  405.     @base_atk_plus = 0
  406.     @base_def_plus = 0
  407.     @base_spi_plus = 0
  408.     @base_res_plus = 0
  409.     @base_dex_plus = 0
  410.     @base_agi_plus = 0
  411.   end
  412.  
  413.   #--------------------------------------------------------------------------
  414.   # alias method: level_up
  415.   #--------------------------------------------------------------------------
  416.   alias level_up_jpclasses level_up unless $@
  417.   def level_up
  418.     level_up_jpclasses
  419.     bonus_stats_increases
  420.     random_stat_increases
  421.   end
  422.  
  423.   #--------------------------------------------------------------------------
  424.   # new method: anticrash_bonus_stats
  425.   #--------------------------------------------------------------------------
  426.   def anticrash_bonus_stats
  427.     @base_maxhp_plus = 0 if @base_maxhp_plus == nil
  428.     @base_maxmp_plus = 0 if @base_maxmp_plus == nil
  429.     @base_atk_plus = 0 if @base_atk_plus == nil
  430.     @base_def_plus = 0 if @base_def_plus == nil
  431.     @base_spi_plus = 0 if @base_spi_plus == nil
  432.     @base_res_plus = 0 if @base_res_plus == nil
  433.     @base_dex_plus = 0 if @base_dex_plus == nil
  434.     @base_agi_plus = 0 if @base_agi_plus == nil
  435.   end
  436.  
  437.   #--------------------------------------------------------------------------
  438.   # new method: bonus_stats_increases
  439.   #--------------------------------------------------------------------------
  440.   def bonus_stats_increases
  441.     bonus_hash = YEZ::JOB::CLASS_BONUSES
  442.     multiplier1 = YEZ::JOB::PRIMARY_BONUS_RATE
  443.     multiplier2 = YEZ::JOB::SUBCLASS_BONUS_RATE
  444.     if bonus_hash.include?(@class_id)
  445.       values1 = bonus_hash[@class_id]
  446.     else
  447.       values1 = bonus_hash[0]
  448.     end
  449.     if subclass_id == 0 or subclass_id == nil
  450.       values2 = nil
  451.     elsif bonus_hash.include?(subclass_id)
  452.       values2 = bonus_hash[subclass_id]
  453.     else
  454.       values2 = bonus_hash[0]
  455.     end
  456.     if @base_maxhp_plus == nil
  457.     anticrash_bonus_stats
  458.     end
  459.     for i in 0..7
  460.       bonus = [Integer(multiplier1 * values1[i]), 0].max
  461.       if values2 != nil
  462.         bonus += [Integer(multiplier2 * values2[i]), 0].max
  463.       end
  464.       case i
  465.       when 0; @base_maxhp_plus += bonus
  466.       when 1; @base_maxmp_plus += bonus
  467.       when 2; @base_atk_plus += bonus
  468.       when 3; @base_def_plus += bonus
  469.       when 4; @base_spi_plus += bonus
  470.       when 5; @base_res_plus += bonus if $imported["BattlerStatRES"]
  471.       when 6; @base_dex_plus += bonus if $imported["BattlerStatDEX"]
  472.       when 7; @base_agi_plus += bonus
  473.       end
  474.     end
  475.   end
  476.  
  477.   #--------------------------------------------------------------------------
  478.   # new method: random_stat_increases
  479.   #--------------------------------------------------------------------------
  480.   def random_stat_increases
  481.     random_hash = YEZ::JOB::CLASS_RANDOM
  482.     multiplier1 = YEZ::JOB::PRIMARY_RANDOM_RATE
  483.     multiplier2 = YEZ::JOB::SUBCLASS_RANDOM_RATE
  484.     if random_hash.include?(@class_id)
  485.       values1 = random_hash[@class_id]
  486.     else
  487.       values1 = random_hash[0]
  488.     end
  489.     if subclass_id == 0 or subclass_id == nil
  490.       values2 = nil
  491.     elsif random_hash.include?(subclass_id)
  492.       values2 = random_hash[subclass_id]
  493.     else
  494.       values2 = random_hash[0]
  495.     end
  496.     for i in 0..7
  497.       random = rand([Integer(multiplier1 * values1[i]), 0].max)
  498.       if values2 != nil
  499.         random += rand([Integer(multiplier2 * values2[i]), 0].max)
  500.       end
  501.       case i
  502.       when 0; @base_maxhp_plus += random
  503.       when 1; @base_maxmp_plus += random
  504.       when 2; @base_atk_plus += random
  505.       when 3; @base_def_plus += random
  506.       when 4; @base_spi_plus += random
  507.       when 5; @base_res_plus += random if $imported["BattlerStatRES"]
  508.       when 6; @base_dex_plus += random if $imported["BattlerStatDEX"]
  509.       when 7; @base_agi_plus += random
  510.       end
  511.     end
  512.   end
  513.  
  514.   #--------------------------------------------------------------------------
  515.   # overwrite method: skills
  516.   #--------------------------------------------------------------------------
  517.   def skills
  518.     result = []
  519.     result += class_skills
  520.     result += primary_skills
  521.     result += subclass_skills
  522.     if $imported["WeaponMasterySkills"] and include_weapon_skills?
  523.       result += weapon_skills
  524.     end
  525.     result.sort! { |a,b| a.id <=> b.id }
  526.     return result.uniq
  527.   end
  528.  
  529.   #--------------------------------------------------------------------------
  530.   # new method: class_skills
  531.   #--------------------------------------------------------------------------
  532.   def class_skills
  533.     result = []
  534.     for i in @skills
  535.       next unless YEZ::JOB::COMMON_SKILLS_LIST.include?(i)
  536.       result.push($data_skills[i])
  537.     end
  538.     return result unless $imported["JobSystemBase"]
  539.     for i in @skills
  540.       next unless YEZ::JOB::CLASS_SKILLS_LIST[@class_id].include?(i) or
  541.         YEZ::JOB::CLASS_SKILLS_LIST[subclass_id].include?(i) or
  542.         YEZ::JOB::CLASS_SKILLS_LIST[0].include?(i)
  543.       result.push($data_skills[i])
  544.     end
  545.     return result
  546.   end
  547.  
  548.   #--------------------------------------------------------------------------
  549.   # new method: primary_skills
  550.   #--------------------------------------------------------------------------
  551.   def primary_skills
  552.     result = []
  553.     return result unless YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST.include?(@class_id)
  554.     for i in @skills
  555.       next unless YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST[@class_id].include?(i)
  556.       result.push($data_skills[i])
  557.     end
  558.     return result
  559.   end
  560.  
  561.   #--------------------------------------------------------------------------
  562.   # new method: subclass_skills
  563.   #--------------------------------------------------------------------------
  564.   def subclass_skills
  565.     result = []
  566.     return result unless YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST.include?(subclass_id)
  567.     for i in @skills
  568.       next unless YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST[subclass_id].include?(i)
  569.       result.push($data_skills[i])
  570.     end
  571.     return result
  572.   end
  573.  
  574.   unless $imported["EquipmentOverhaul"]
  575.   #--------------------------------------------------------------------------
  576.   # alias method: base_maxhp
  577.   #--------------------------------------------------------------------------
  578.   alias base_maxhp_jpclasses base_maxhp unless $@
  579.   def base_maxhp
  580.     anticrash_bonus_stats
  581.     n = base_maxhp_jpclasses + @base_maxhp_plus
  582.     n *= base_class_stat(:maxhp)
  583.     return Integer(n)
  584.   end
  585.  
  586.   #--------------------------------------------------------------------------
  587.   # alias method: base_maxmp
  588.   #--------------------------------------------------------------------------
  589.   alias base_maxmp_jpclasses base_maxmp unless $@
  590.   def base_maxmp
  591.     anticrash_bonus_stats
  592.     n = base_maxmp_jpclasses + @base_maxmp_plus
  593.     n *= base_class_stat(:maxmp)
  594.     return Integer(n)
  595.   end
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # alias method: base_atk
  599.   #--------------------------------------------------------------------------
  600.   alias base_atk_jpclasses base_atk unless $@
  601.   def base_atk
  602.     anticrash_bonus_stats
  603.     n = base_atk_jpclasses + @base_atk_plus
  604.     n *= base_class_stat(:atk)
  605.     return Integer(n)
  606.   end
  607.  
  608.   #--------------------------------------------------------------------------
  609.   # alias method: base_def
  610.   #--------------------------------------------------------------------------
  611.   alias base_def_jpclasses base_def unless $@
  612.   def base_def
  613.     anticrash_bonus_stats
  614.     n = base_def_jpclasses + @base_def_plus
  615.     n *= base_class_stat(:def)
  616.     return Integer(n)
  617.   end
  618.  
  619.   #--------------------------------------------------------------------------
  620.   # alias method: base_spi
  621.   #--------------------------------------------------------------------------
  622.   alias base_spi_jpclasses base_spi unless $@
  623.   def base_spi
  624.     anticrash_bonus_stats
  625.     n = base_spi_jpclasses + @base_spi_plus
  626.     n *= base_class_stat(:spi)
  627.     return Integer(n)
  628.   end
  629.  
  630.   #--------------------------------------------------------------------------
  631.   # alias method: base_agi
  632.   #--------------------------------------------------------------------------
  633.   alias base_agi_jpclasses base_agi unless $@
  634.   def base_agi
  635.     anticrash_bonus_stats
  636.     n = base_agi_jpclasses + @base_agi_plus
  637.     n *= base_class_stat(:agi)
  638.     return Integer(n)
  639.   end
  640.   end # $imported["EquipmentOverhaul"]
  641.  
  642.   #--------------------------------------------------------------------------
  643.   # enable_clone_flag
  644.   #--------------------------------------------------------------------------
  645.   def enable_clone_flag; @self_clone = true; end
  646.  
  647.   #--------------------------------------------------------------------------
  648.   # new method: subclass
  649.   #--------------------------------------------------------------------------
  650.   def subclass
  651.     return $data_classes[subclass_id]
  652.   end
  653.  
  654.   #--------------------------------------------------------------------------
  655.   # new method: subclass_id
  656.   #--------------------------------------------------------------------------
  657.   def subclass_id
  658.     @subclass_id = 0 if @subclass_id == nil
  659.     return @subclass_id
  660.   end
  661.  
  662.   #--------------------------------------------------------------------------
  663.   # overwrite method: class_id=
  664.   #--------------------------------------------------------------------------
  665.   def class_id=(class_id)
  666.     unlock_class(class_id, true, false)
  667.     @class_id = class_id
  668.     @subclass_id = 0 if @subclass_id == @class_id
  669.     for i in 0..4
  670.       change_equip(i, nil, @self_clone) unless equippable?(equips[i])
  671.     end
  672.     purge_unequippable_passives if $imported["JobSystemPassives"]
  673.     for i in self.class.learnings
  674.       learn_skill(i.skill_id) if i.level <= @level
  675.     end
  676.     if $imported["EquipExtension"] or $imported["EquipmentOverhaul"]
  677.       return if extra_armor_number == 0
  678.       for i in 5..armor_number
  679.         change_equip(i, nil, @self_clone) unless equippable?(equips[i])
  680.       end
  681.     end
  682.   end
  683.  
  684.   #--------------------------------------------------------------------------
  685.   # new method: subclass_id=
  686.   #--------------------------------------------------------------------------
  687.   def subclass_id=(id)
  688.     unlock_class(class_id, false, true)
  689.     id = 0 if id == @subclass_id
  690.     @subclass_id = id
  691.     purge_unequippable_passives if $imported["JobSystemPassives"]
  692.     for i in 0..4
  693.       change_equip(i, nil, @self_clone) unless equippable?(equips[i])
  694.     end
  695.     if $imported["EquipExtension"] or $imported["EquipmentOverhaul"]
  696.       return if extra_armor_number == 0
  697.       for i in 5..armor_number
  698.         change_equip(i, nil, @self_clone) unless equippable?(equips[i])
  699.       end
  700.     end
  701.     return if @subclass_id == nil or @subclass_id == 0
  702.     for i in self.subclass.learnings
  703.       learn_skill(i.skill_id) if i.level <= @level
  704.     end
  705.   end
  706.  
  707.   #--------------------------------------------------------------------------
  708.   # new method: base_class_stat
  709.   #--------------------------------------------------------------------------
  710.   def base_class_stat(stat)
  711.     case stat
  712.     when :maxhp; i = 0
  713.     when :maxmp; i = 1
  714.     when :atk;   i = 2
  715.     when :def;   i = 3
  716.     when :spi;   i = 4
  717.     when :res;   i = 5
  718.     when :dex;   i = 6
  719.     when :agi;   i = 7
  720.     end
  721.     if YEZ::JOB::CLASS_STATS.include?(@class_id)
  722.       n = YEZ::JOB::CLASS_STATS[@class_id][i] * YEZ::JOB::PRIMARY_MULTIPLIER
  723.     else
  724.       n = YEZ::JOB::CLASS_STATS[0][i] * YEZ::JOB::PRIMARY_MULTIPLIER
  725.     end
  726.     if YEZ::JOB::CLASS_STATS.include?(subclass_id) and subclass_id != 0
  727.       n += YEZ::JOB::CLASS_STATS[subclass_id][i] * YEZ::JOB::SUBCLASS_MULTIPLIER
  728.     elsif subclass_id != 0
  729.       n += YEZ::JOB::CLASS_STATS[0][i] * YEZ::JOB::SUBCLASS_MULTIPLIER
  730.     end
  731.     return n
  732.   end
  733.  
  734.   #--------------------------------------------------------------------------
  735.   # alias method: equippable?
  736.   #--------------------------------------------------------------------------
  737.   alias equippable_jpclasses equippable?
  738.   def equippable?(item)
  739.     return true if equippable_jpclasses(item)
  740.     return false if subclass == nil
  741.     if item.is_a?(RPG::Weapon)
  742.       return false unless YEZ::JOB::SUBCLASS_WEAPONS
  743.       return self.subclass.weapon_set.include?(item.id)
  744.     elsif item.is_a?(RPG::Armor)
  745.       return false unless YEZ::JOB::SUBCLASS_ARMOURS
  746.       return false if two_swords_style and item.kind == 0
  747.       return self.subclass.armor_set.include?(item.id)
  748.     end
  749.     return false
  750.   end
  751.  
  752.   #--------------------------------------------------------------------------
  753.   # new method: all_unlocked_classes
  754.   #--------------------------------------------------------------------------
  755.   def all_unlocked_classes
  756.     result = unlocked_1stclasses
  757.     result += unlocked_subclasses
  758.     result.sort!
  759.     return result.uniq
  760.   end
  761.  
  762.   #--------------------------------------------------------------------------
  763.   # new method: unlocked_1stclasses
  764.   #--------------------------------------------------------------------------
  765.   def unlocked_1stclasses
  766.     if @unlocked_1stclasses == nil
  767.       @unlocked_1stclasses = YEZ::JOB::UNLOCKED_1STCLASS_LIST[0]
  768.       @unlocked_1stclasses += YEZ::JOB::UNLOCKED_1STCLASS_LIST[id] if
  769.         YEZ::JOB::UNLOCKED_1STCLASS_LIST.include?(id)
  770.       unlock_class(@class_id)
  771.     end
  772.     result = @unlocked_1stclasses + $game_party.unlocked_1stclasses
  773.     return result
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # new method: unlocked_subclasses
  778.   #--------------------------------------------------------------------------
  779.   def unlocked_subclasses
  780.     if @unlocked_subclasses == nil
  781.       @unlocked_subclasses = YEZ::JOB::UNLOCKED_1STCLASS_LIST[0]
  782.       @unlocked_subclasses += YEZ::JOB::UNLOCKED_1STCLASS_LIST[id] if
  783.         YEZ::JOB::UNLOCKED_1STCLASS_LIST.include?(id)
  784.     end
  785.     result = @unlocked_subclasses + $game_party.unlocked_subclasses
  786.     return result
  787.   end
  788.  
  789.   #--------------------------------------------------------------------------
  790.   # new method: unlock_class
  791.   #--------------------------------------------------------------------------
  792.   def unlock_class(class_id, primary = true, subclass = true)
  793.     unlocked_1stclasses if @unlocked_1stclasses == nil
  794.     unlocked_subclasses if @unlocked_subclasses == nil
  795.     @unlocked_1stclasses += [class_id] if primary
  796.     @unlocked_subclasses += [class_id] if subclass
  797.   end
  798.  
  799.   #--------------------------------------------------------------------------
  800.   # new method: lock_class
  801.   #--------------------------------------------------------------------------
  802.   def lock_class(class_id, primary = true, subclass = true)
  803.     unlocked_1stclasses if @unlocked_1stclasses == nil
  804.     unlocked_subclasses if @unlocked_subclasses == nil
  805.     @unlocked_1stclasses -= [class_id] if primary
  806.     @unlocked_subclasses -= [class_id] if subclass
  807.   end
  808.  
  809. end # Game_Actor
  810.  
  811. #===============================================================================
  812. # Game_Party
  813. #===============================================================================
  814.  
  815. class Game_Party < Game_Unit
  816.  
  817.   #--------------------------------------------------------------------------
  818.   # new method: unlocked_1stclasses
  819.   #--------------------------------------------------------------------------
  820.   def unlocked_1stclasses
  821.     @unlocked_1stclasses = YEZ::JOB::UNLOCKED_1STCLASS_LIST[0] if
  822.       @unlocked_1stclasses == nil
  823.     return @unlocked_1stclasses
  824.   end
  825.  
  826.   #--------------------------------------------------------------------------
  827.   # new method: unlocked_subclasses
  828.   #--------------------------------------------------------------------------
  829.   def unlocked_subclasses
  830.     @unlocked_subclasses = YEZ::JOB::UNLOCKED_SUBCLASS_LIST[0] if
  831.       @unlocked_subclasses == nil
  832.     return @unlocked_subclasses
  833.   end
  834.  
  835.   #--------------------------------------------------------------------------
  836.   # new method: unlock_class
  837.   #--------------------------------------------------------------------------
  838.   def unlock_class(class_id, primary = true, subclass = true)
  839.     unlocked_1stclasses if @unlocked_1stclasses == nil
  840.     unlocked_subclasses if @unlocked_subclasses == nil
  841.     @unlocked_1stclasses += [class_id] if primary
  842.     @unlocked_subclasses += [class_id] if subclass
  843.   end
  844.  
  845.   #--------------------------------------------------------------------------
  846.   # new method: lock_class
  847.   #--------------------------------------------------------------------------
  848.   def lock_class(class_id, primary = true, subclass = true)
  849.     unlocked_1stclasses if @unlocked_1stclasses == nil
  850.     unlocked_subclasses if @unlocked_subclasses == nil
  851.     @unlocked_1stclasses -= [class_id] if primary
  852.     @unlocked_subclasses -= [class_id] if subclass
  853.   end
  854.  
  855.   #--------------------------------------------------------------------------
  856.   # alias method: setup_starting_members
  857.   #--------------------------------------------------------------------------
  858.   alias setup_starting_members_jpclasses setup_starting_members unless $@
  859.   def setup_starting_members
  860.     setup_starting_members_jpclasses
  861.     $game_switches[YEZ::JOB::ENABLE_1STCLASS_SWITCH] = true
  862.     $game_switches[YEZ::JOB::ENABLE_SUBCLASS_SWITCH] = true
  863.   end
  864.  
  865. end # Game_Party
  866.  
  867. #===============================================================================
  868. # Scene_Menu
  869. #===============================================================================
  870.  
  871. class Scene_Menu < Scene_Base
  872.  
  873.   #--------------------------------------------------------------------------
  874.   # alias method: create_command_window
  875.   #--------------------------------------------------------------------------
  876.   alias create_command_window_jpclasses create_command_window unless $@
  877.   def create_command_window
  878.     create_command_window_jpclasses
  879.     return if $imported["CustomMenuCommand"] or $imported["StatusCommandMenu"]
  880.     if $game_switches[YEZ::JOB::ENABLE_1STCLASS_SWITCH] or
  881.     $game_switches[YEZ::JOB::ENABLE_SUBCLASS_SWITCH]
  882.       title = YEZ::JOB::CLASS_TITLE
  883.       @command_class = @command_window.add_command(title)
  884.       if @command_window.oy > 0
  885.         @command_window.oy -= Window_Base::WLH
  886.       end
  887.     end
  888.     @command_window.index = @menu_index
  889.   end
  890.  
  891.   #--------------------------------------------------------------------------
  892.   # alias method: update_command_selection
  893.   #--------------------------------------------------------------------------
  894.   alias update_command_selection_jpclasses update_command_selection unless $@
  895.   def update_command_selection
  896.     if Input.trigger?(Input::C)
  897.       case @command_window.index
  898.       when @command_class
  899.         if $game_party.members.size == 0
  900.           Sound.play_buzzer
  901.           return
  902.         end
  903.         Sound.play_decision
  904.         start_actor_selection
  905.         return
  906.       end
  907.     end
  908.     update_command_selection_jpclasses
  909.   end
  910.  
  911.   #--------------------------------------------------------------------------
  912.   # alias method: update_actor_selection
  913.   #--------------------------------------------------------------------------
  914.   alias update_actor_selection_jpclasses update_actor_selection unless $@
  915.   def update_actor_selection
  916.     if Input.trigger?(Input::C)
  917.       $game_party.last_actor_index = @status_window.index
  918.       Sound.play_decision
  919.       case @command_window.index
  920.       when @command_class
  921.         $scene = Scene_Class.new(@status_window.index, @command_class)
  922.         return
  923.       end
  924.     end
  925.     update_actor_selection_jpclasses
  926.   end
  927.  
  928. end # Scene Menu
  929.  
  930. #===============================================================================
  931. # Scene_Class
  932. #===============================================================================
  933.  
  934. class Scene_Class < Scene_Base
  935.  
  936.   #--------------------------------------------------------------------------
  937.   # public instance variables
  938.   #--------------------------------------------------------------------------
  939.   attr_accessor :data
  940.   attr_accessor :actor
  941.   attr_accessor :last_index
  942.  
  943.   #--------------------------------------------------------------------------
  944.   # initialize
  945.   #--------------------------------------------------------------------------
  946.   def initialize(actor_index = 0, menu_index = 0, last_index = 0)
  947.     @actor_index = actor_index
  948.     @menu_index = menu_index
  949.     @last_index = last_index
  950.   end
  951.  
  952.   #--------------------------------------------------------------------------
  953.   # start
  954.   #--------------------------------------------------------------------------
  955.   def start
  956.     super
  957.     create_menu_background
  958.     @actor = $game_party.members[@actor_index]
  959.     $game_party.last_actor_index = @actor_index
  960.     @status_window = Window_Class_Actor.new(@actor)
  961.     @help_window = Window_Help.new
  962.     @help_window.y = 128
  963.     create_command_window
  964.     @class_window = Window_Class_List.new(@actor, 0, @help_window.y +
  965.       @help_window.height)
  966.     @class_window.help_window = @help_window
  967.     @class_window.update_help
  968.     @data_window = Window_Class_Data.new(@class_window.width,
  969.       @class_window.y, @actor)
  970.     refresh_class_window
  971.   end
  972.  
  973.   #--------------------------------------------------------------------------
  974.   # terminate
  975.   #--------------------------------------------------------------------------
  976.   def terminate
  977.     super
  978.     dispose_menu_background
  979.     @status_window.dispose if @status_window != nil
  980.     @command_window.dispose if @command_window != nil
  981.     @help_window.dispose if @help_window != nil
  982.     @class_window.dispose if @class_window != nil
  983.     @data_window.dispose if @data_window != nil
  984.     @mastery_window.dispose if @mastery_window != nil
  985.     @formation_window.dispose if @formation_window != nil
  986.   end
  987.  
  988.   #--------------------------------------------------------------------------
  989.   # return_scene
  990.   #--------------------------------------------------------------------------
  991.   def return_scene
  992.     $game_temp.jpc_oy = nil
  993.     if $imported["StatusCommandMenu"] and $game_temp.status_index != nil
  994.       $scene = Scene_Status.new(@actor_index)
  995.     elsif $imported["CustomMenuCommand"] and
  996.     $game_temp.menu_command_index.has_key?(:class)
  997.       $scene = Scene_Menu.new($game_temp.menu_command_index[:class])
  998.     else
  999.       $scene = Scene_Menu.new(@menu_index)
  1000.     end
  1001.   end
  1002.  
  1003.   #--------------------------------------------------------------------------
  1004.   # next_actor
  1005.   #--------------------------------------------------------------------------
  1006.   def next_actor
  1007.     $game_temp.jpc_oy = @command_window.oy
  1008.     @actor_index += 1
  1009.     @actor_index %= $game_party.members.size
  1010.     $scene = Scene_Class.new(@actor_index, @menu_index, @last_index)
  1011.   end
  1012.  
  1013.   #--------------------------------------------------------------------------
  1014.   # prev_actor
  1015.   #--------------------------------------------------------------------------
  1016.   def prev_actor
  1017.     $game_temp.jpc_oy = @command_window.oy
  1018.     @actor_index += $game_party.members.size - 1
  1019.     @actor_index %= $game_party.members.size
  1020.     $scene = Scene_Class.new(@actor_index, @menu_index, @last_index)
  1021.   end
  1022.  
  1023.   #--------------------------------------------------------------------------
  1024.   # create_command_window
  1025.   #--------------------------------------------------------------------------
  1026.   def create_command_window
  1027.     commands = []; @data = []
  1028.     for command in YEZ::JOB::CLASS_COMMANDS
  1029.       case command
  1030.       when :primary
  1031.         next unless $game_switches[YEZ::JOB::ENABLE_1STCLASS_SWITCH]
  1032.         commands.push(YEZ::JOB::CLASS_VOCAB[command])
  1033.       when :subclass
  1034.         next unless $game_switches[YEZ::JOB::ENABLE_SUBCLASS_SWITCH]
  1035.         commands.push(YEZ::JOB::CLASS_VOCAB[command])
  1036.       when :passives
  1037.         next unless $imported["JobSystemPassives"]
  1038.         next unless $game_switches[YEZ::JOB::ENABLE_PASSIVE_SWITCH]
  1039.         commands.push(YEZ::JOB::CLASS_VOCAB[command])
  1040.       when :formations
  1041.         next unless $imported["FormationMacros"]
  1042.         next unless $game_switches[YEZ::MACRO::ENABLE_SWITCH]
  1043.         commands.push(YEZ::JOB::CLASS_VOCAB[command])
  1044.         @formation_window = Window_Formation.new(@actor)
  1045.       when :mastery
  1046.         next unless $imported["WeaponMasterySkills"]
  1047.         commands.push(YEZ::JOB::CLASS_VOCAB[command])
  1048.         @mastery_window = Window_Mastery.new(0, 128, @actor, true)
  1049.       when :skill; commands.push(YEZ::JOB::CLASS_VOCAB[command])
  1050.       when :equip; commands.push(YEZ::JOB::CLASS_VOCAB[command])
  1051.       else; next
  1052.       end
  1053.       @data.push(command)
  1054.     end
  1055.     if YEZ::JOB::CLASS_CENTERED_COMMAND
  1056.       @command_window = Window_Command_Centered.new(160, commands)
  1057.     else
  1058.       @command_window = Window_Command.new(160, commands)
  1059.     end
  1060.     @command_window.height = 128
  1061.     @command_window.oy = $game_temp.jpc_oy if $game_temp.jpc_oy != nil
  1062.     @command_window.index = [@last_index, 0].max
  1063.     @command_window.active = true
  1064.   end
  1065.  
  1066.   #--------------------------------------------------------------------------
  1067.   # update
  1068.   #--------------------------------------------------------------------------
  1069.   def update
  1070.     super
  1071.     update_menu_background
  1072.     if @command_window.active
  1073.       update_command_selection
  1074.     elsif @class_window.active
  1075.       update_class_selection
  1076.     end
  1077.   end
  1078.  
  1079.   #--------------------------------------------------------------------------
  1080.   # refresh_class_window
  1081.   #--------------------------------------------------------------------------
  1082.   def refresh_class_window
  1083.     @last_index = @command_window.index
  1084.     @help_window.y = @status_window.height
  1085.     @class_window.y = @help_window.y + @help_window.height
  1086.     @data_window.y = @class_window.y
  1087.     @mastery_window.y = 416*3 if @mastery_window != nil
  1088.     @formation_window.y = 416*3 if @formation_window != nil
  1089.     case @data[@command_window.index]
  1090.     when :primary
  1091.       @class_window.refresh(1)
  1092.     when :subclass
  1093.       @class_window.refresh(2)
  1094.     when :formations
  1095.       @formation_window.y = @help_window.y
  1096.       @help_window.y = 416*3
  1097.       @class_window.y = 416*3
  1098.       @data_window.y = 416*3
  1099.     when :mastery
  1100.       @mastery_window.y = @help_window.y
  1101.       @mastery_window.refresh(true)
  1102.       @help_window.y = 416*3
  1103.       @class_window.y = 416*3
  1104.       @data_window.y = 416*3
  1105.     else
  1106.       @class_window.refresh(0)
  1107.     end
  1108.   end
  1109.  
  1110.   #--------------------------------------------------------------------------
  1111.   # update_command_selection
  1112.   #--------------------------------------------------------------------------
  1113.   def update_command_selection
  1114.     @command_window.update
  1115.     refresh_class_window if @last_index != @command_window.index
  1116.     if Input.trigger?(Input::B)
  1117.       Sound.play_cancel
  1118.       return_scene
  1119.     elsif Input.repeat?(Input::F8) and $TEST # Debug increase JP
  1120.       return unless $imported["JobSystemBase"]
  1121.       Sound.play_equip
  1122.       value = YEZ::JOB::JP_COST * 10
  1123.       value *= 10 if Input.press?(Input::SHIFT)
  1124.       for class_id in @actor.all_unlocked_classes
  1125.         @actor.gain_jp(value + rand(value), class_id)
  1126.       end
  1127.       @status_window.refresh
  1128.       refresh_class_window
  1129.     elsif Input.repeat?(Input::F7) and $TEST # Debug increase JP
  1130.       return unless $imported["JobSystemBase"]
  1131.       Sound.play_equip
  1132.       value = YEZ::JOB::JP_COST * 10
  1133.       value *= 10 if Input.press?(Input::SHIFT)
  1134.       for class_id in @actor.all_unlocked_classes
  1135.         @actor.lose_jp(value + rand(value), class_id)
  1136.       end
  1137.       @status_window.refresh
  1138.       refresh_class_window
  1139.     elsif Input.repeat?(Input::RIGHT)
  1140.       Sound.play_cursor
  1141.       next_actor
  1142.     elsif Input.repeat?(Input::LEFT)
  1143.       Sound.play_cursor
  1144.       prev_actor
  1145.     elsif Input.trigger?(Input::X)
  1146.       return unless (@actor.subclass_id != 0 and @actor.subclass_id != nil)
  1147.       Sound.play_equip
  1148.       @actor.subclass_id = 0
  1149.       @status_window.refresh
  1150.       @class_window.refresh(@class_window.mode)
  1151.       @data_window.refresh
  1152.     elsif Input.trigger?(Input::C)
  1153.       case @data[@command_window.index]
  1154.       when :primary
  1155.         Sound.play_decision
  1156.         @command_window.active = false
  1157.         @class_window.active = true
  1158.       when :subclass
  1159.         Sound.play_decision
  1160.         @command_window.active = false
  1161.         @class_window.active = true
  1162.       when :formations
  1163.         Sound.play_decision
  1164.         $game_temp.jpc_oy = @command_window.oy
  1165.         $scene = Scene_Formation.new(@actor_index, @command_window.index)
  1166.       when :mastery
  1167.         Sound.play_decision
  1168.         $game_temp.jpc_oy = @command_window.oy
  1169.         $scene = Scene_Mastery.new(@actor_index, @command_window.index)
  1170.       when :passives
  1171.         Sound.play_decision
  1172.         $scene = Scene_Passives.new(@actor.index, @last_index,
  1173.           Scene_Passives::HOST_CLASS)
  1174.       when :skill
  1175.         Sound.play_decision
  1176.         $scene = Scene_Skill.new(@actor.index)
  1177.       when :equip
  1178.         Sound.play_decision
  1179.         $scene = Scene_Equip.new(@actor.index)
  1180.       end
  1181.     end
  1182.   end
  1183.  
  1184.   #--------------------------------------------------------------------------
  1185.   # update_class_selection
  1186.   #--------------------------------------------------------------------------
  1187.   def update_class_selection
  1188.     @class_window.update
  1189.     if @last_class_index != @class_window.index
  1190.       @last_class_index = @class_window.index
  1191.       clone = @actor.clone
  1192.       clone.enable_clone_flag
  1193.       class_id = @class_window.class
  1194.       case @data[@command_window.index]
  1195.       when :primary
  1196.         clone.class_id = class_id if @class_window.enabled_class?(class_id)
  1197.       when :subclass
  1198.         clone.subclass_id = class_id if @class_window.enabled_class?(class_id)
  1199.       end
  1200.       clone = nil unless @class_window.enabled_class?(class_id)
  1201.       @data_window.refresh(clone)
  1202.     end
  1203.     if Input.trigger?(Input::B)
  1204.       Sound.play_cancel
  1205.       @command_window.active = true
  1206.       @class_window.active = false
  1207.       @data_window.refresh
  1208.     elsif Input.repeat?(Input::F8) and $TEST # Debug increase JP
  1209.       return unless $imported["JobSystemBase"]
  1210.       Sound.play_equip
  1211.       value = YEZ::JOB::JP_COST * 10
  1212.       value *= 10 if Input.press?(Input::SHIFT)
  1213.       @actor.gain_jp(value + rand(value), @class_window.class)
  1214.       @status_window.refresh
  1215.       refresh_class_window
  1216.     elsif Input.repeat?(Input::F7) and $TEST # Debug increase JP
  1217.       return unless $imported["JobSystemBase"]
  1218.       Sound.play_equip
  1219.       value = YEZ::JOB::JP_COST * 10
  1220.       value *= 10 if Input.press?(Input::SHIFT)
  1221.       @actor.lose_jp(value + rand(value), @class_window.class)
  1222.       @status_window.refresh
  1223.       refresh_class_window
  1224.     elsif Input.trigger?(Input::X)
  1225.       return unless (@actor.subclass_id != 0 and @actor.subclass_id != nil)
  1226.       Sound.play_equip
  1227.       @actor.subclass_id = 0
  1228.       @status_window.refresh
  1229.       @class_window.refresh(@class_window.mode)
  1230.       @last_class_index += 1
  1231.     elsif Input.trigger?(Input::C)
  1232.       class_id = @class_window.class
  1233.       if !@class_window.enabled_class?(class_id)
  1234.         Sound.play_buzzer
  1235.         return
  1236.       end
  1237.       last_hp = @actor.maxhp
  1238.       last_mp = @actor.maxmp
  1239.       case @data[@command_window.index]
  1240.       when :primary
  1241.         Sound.play_equip
  1242.         @actor.class_id = class_id
  1243.       when :subclass
  1244.         Sound.play_equip
  1245.         @actor.subclass_id = class_id
  1246.       end
  1247.       @actor.hp = [@actor.hp + @actor.maxhp - last_hp, @actor.hp - 1].max
  1248.       @actor.mp += @actor.maxmp - last_mp
  1249.       @status_window.refresh
  1250.       @class_window.refresh(@class_window.mode)
  1251.       @last_class_index += 1
  1252.     end
  1253.   end
  1254.  
  1255. end # Scene_Class
  1256.  
  1257. #==============================================================================
  1258. # Window_Base
  1259. #==============================================================================
  1260.  
  1261. class Window_Base < Window
  1262.  
  1263.   #--------------------------------------------------------------------------
  1264.   # overwrite method: draw_actor_class
  1265.   #--------------------------------------------------------------------------
  1266.   def draw_actor_class(actor, x, y)
  1267.     self.contents.font.color = normal_color
  1268.     case_set = YEZ::JOB::CLASS_NAME_DISPLAY
  1269.     case_set = 0 if actor.subclass == nil
  1270.     case case_set
  1271.     when 0 # Primary only
  1272.       text = actor.class.name
  1273.     when 1 # Primary unless there is a combination name.
  1274.       text = sprintf("%s/%s", actor.class.name, actor.subclass.name)
  1275.       if YEZ::JOB::COMBINATION_NAMES.include?(text)
  1276.         text = YEZ::JOB::COMBINATION_NAMES[text]
  1277.       else
  1278.         text = actor.class.name
  1279.       end
  1280.     when 2 # Primary/Secondary unless there is a combination name.
  1281.       text = sprintf("%s/%s", actor.class.name, actor.subclass.name)
  1282.       if YEZ::JOB::COMBINATION_NAMES.include?(text)
  1283.         text = YEZ::JOB::COMBINATION_NAMES[text]
  1284.       end
  1285.     when 3 # Primary/Secondary only
  1286.       text = sprintf("%s/%s", actor.class.name, actor.subclass.name)
  1287.     end
  1288.     self.contents.draw_text(x, y, 120, WLH, text)
  1289.   end
  1290.  
  1291.   #--------------------------------------------------------------------------
  1292.   # new method: draw_actor_1stclass
  1293.   #--------------------------------------------------------------------------
  1294.   def draw_actor_1stclass(actor, x, y)
  1295.     self.contents.font.color = normal_color
  1296.     if YEZ::JOB::CLASS_ICONS.include?(actor.class_id)
  1297.       icon = YEZ::JOB::CLASS_ICONS[actor.class_id]
  1298.     else
  1299.       icon = YEZ::JOB::CLASS_ICONS[0]
  1300.     end
  1301.     draw_icon(icon, x, y)
  1302.     self.contents.draw_text(x+24, y, 120, WLH, actor.class.name)
  1303.   end
  1304.  
  1305.   #--------------------------------------------------------------------------
  1306.   # new method: draw_actor_subclass
  1307.   #--------------------------------------------------------------------------
  1308.   def draw_actor_subclass(actor, x, y)
  1309.     return if actor.subclass == nil
  1310.     self.contents.font.color = normal_color
  1311.     if YEZ::JOB::CLASS_ICONS.include?(actor.subclass_id)
  1312.       icon = YEZ::JOB::CLASS_ICONS[actor.subclass_id]
  1313.     else
  1314.       icon = YEZ::JOB::CLASS_ICONS[0]
  1315.     end
  1316.     draw_icon(icon, x, y)
  1317.     self.contents.draw_text(x+24, y, 120, WLH, actor.subclass.name)
  1318.   end
  1319.  
  1320. end # Window_Base
  1321.  
  1322. #===============================================================================
  1323. # Window_Command (imported from KGC)
  1324. #===============================================================================
  1325.  
  1326. class Window_Command < Window_Selectable
  1327. unless method_defined?(:add_command)
  1328.   #--------------------------------------------------------------------------
  1329.   # add command
  1330.   #--------------------------------------------------------------------------
  1331.   def add_command(command)
  1332.     @commands << command
  1333.     @item_max = @commands.size
  1334.     item_index = @item_max - 1
  1335.     refresh_command
  1336.     draw_item(item_index)
  1337.     return item_index
  1338.   end
  1339.   #--------------------------------------------------------------------------
  1340.   # refresh command
  1341.   #--------------------------------------------------------------------------
  1342.   def refresh_command
  1343.     buf = self.contents.clone
  1344.     self.height = [self.height, row_max * WLH + 32].max
  1345.     create_contents
  1346.     self.contents.blt(0, 0, buf, buf.rect)
  1347.     buf.dispose
  1348.   end
  1349.   #--------------------------------------------------------------------------
  1350.   # insert command
  1351.   #--------------------------------------------------------------------------
  1352.   def insert_command(index, command)
  1353.     @commands.insert(index, command)
  1354.     @item_max = @commands.size
  1355.     refresh_command
  1356.     refresh
  1357.   end
  1358.   #--------------------------------------------------------------------------
  1359.   # remove command
  1360.   #--------------------------------------------------------------------------
  1361.   def remove_command(command)
  1362.     @commands.delete(command)
  1363.     @item_max = @commands.size
  1364.     refresh
  1365.   end
  1366. end
  1367. end
  1368.  
  1369. #===============================================================================
  1370. # Window_Command_Centered
  1371. #===============================================================================
  1372.  
  1373. class Window_Command_Centered < Window_Command
  1374.  
  1375.   #--------------------------------------------------------------------------
  1376.   # draw_item
  1377.   #--------------------------------------------------------------------------
  1378.   def draw_item(index, enabled = true)
  1379.     rect = item_rect(index)
  1380.     rect.x += 4
  1381.     rect.width -= 8
  1382.     self.contents.clear_rect(rect)
  1383.     self.contents.font.color = normal_color
  1384.     self.contents.font.color.alpha = enabled ? 255 : 128
  1385.     self.contents.draw_text(rect, @commands[index], 1)
  1386.   end
  1387.  
  1388. end # Window_Command_Centered
  1389.  
  1390. #===============================================================================
  1391. # Window_Help
  1392. #===============================================================================
  1393.  
  1394. class Window_Help < Window_Base
  1395.  
  1396.   #--------------------------------------------------------------------------
  1397.   # alias method: current_actor
  1398.   #--------------------------------------------------------------------------
  1399.   if method_defined?(:current_actor)
  1400.   alias current_actor_jpclasses current_actor unless $@
  1401.   def current_actor
  1402.     if $scene.is_a?(Scene_Class)
  1403.       return $scene.actor.name
  1404.     else
  1405.       return current_actor_jpclasses
  1406.     end
  1407.   end
  1408.   end
  1409.  
  1410. end # Window_Help
  1411.  
  1412. #===============================================================================
  1413. # Window_Class_Actor
  1414. #===============================================================================
  1415.  
  1416. class Window_Class_Actor < Window_Base
  1417.  
  1418.   #--------------------------------------------------------------------------
  1419.   # initialize
  1420.   #--------------------------------------------------------------------------
  1421.   def initialize(actor)
  1422.     super(160, 0, 384, 128)
  1423.     @actor = actor
  1424.     refresh
  1425.   end
  1426.  
  1427.   #--------------------------------------------------------------------------
  1428.   # refresh
  1429.   #--------------------------------------------------------------------------
  1430.   def refresh
  1431.     self.contents.clear
  1432.     draw_actor_face(@actor, 0, 0, size = 96)
  1433.     x = 104
  1434.     y = 0
  1435.     draw_actor_name(@actor, x, y)
  1436.     if @actor.subclass == nil or @actor.subclass == 0
  1437.       draw_actor_1stclass(@actor, x, y+WLH*1)
  1438.       draw_actor_jp(@actor, @actor.class_id, x+120, y+WLH*1)
  1439.     else
  1440.       draw_actor_class(@actor, x, y+WLH*1)
  1441.       draw_actor_1stclass(@actor, x, y+WLH*2)
  1442.       draw_actor_jp(@actor, @actor.class_id, x+120, y+WLH*2)
  1443.       draw_actor_subclass(@actor, x, y+WLH*3)
  1444.       draw_actor_jp(@actor, @actor.subclass_id, x+120, y+WLH*3)
  1445.     end
  1446.   end
  1447.  
  1448.   #--------------------------------------------------------------------------
  1449.   # draw_actor_jp
  1450.   #--------------------------------------------------------------------------
  1451.   def draw_actor_jp(actor, class_id, dx, dy, dw = 120)
  1452.     return unless $imported["JobSystemBase"]
  1453.     icon = $imported["Icons"] ? YEZ::ICONS[:txtjp] : YEZ::JOB::JP_ICON
  1454.     draw_icon(icon, dx + dw - 24, dy)
  1455.     text = @actor.class_jp[class_id]
  1456.     self.contents.draw_text(dx, dy, dw - 24, WLH, text, 2)
  1457.   end
  1458.  
  1459. end # Window_JP_Actor
  1460.  
  1461. #===============================================================================
  1462. # Window_Class_List
  1463. #===============================================================================
  1464.  
  1465. class Window_Class_List < Window_Selectable
  1466.  
  1467.   #--------------------------------------------------------------------------
  1468.   # initialize
  1469.   #--------------------------------------------------------------------------
  1470.   def initialize(actor, dx, dy)
  1471.     super(dx, dy, 304, Graphics.height - dy)
  1472.     self.active = false
  1473.     @actor = actor
  1474.     if $scene.is_a?(Scene_Class)
  1475.       case $scene.data[$scene.last_index]
  1476.       when :primary; value = 1
  1477.       when :subclass; value = 2
  1478.       else; value = 0
  1479.       end
  1480.     else
  1481.       value = 0
  1482.     end
  1483.     refresh(value)
  1484.   end
  1485.  
  1486.   #--------------------------------------------------------------------------
  1487.   # class
  1488.   #--------------------------------------------------------------------------
  1489.   def class; return @data[self.index]; end
  1490.  
  1491.   #--------------------------------------------------------------------------
  1492.   # mode
  1493.   #--------------------------------------------------------------------------
  1494.   def mode; return @mode; end
  1495.  
  1496.   #--------------------------------------------------------------------------
  1497.   # refresh
  1498.   #--------------------------------------------------------------------------
  1499.   def refresh(mode = 0)
  1500.     @mode = mode; @data = [];
  1501.     @classes = @actor.all_unlocked_classes
  1502.     for class_id in YEZ::JOB::CLASS_ORDER_LIST
  1503.       next unless include?(class_id)
  1504.       self.index = @data.size if @actor.class_id == class_id and
  1505.         self.index == -1
  1506.       @data.push(class_id)
  1507.     end
  1508.     @item_max = @data.size
  1509.     create_contents
  1510.     for i in 0..(@item_max-1)
  1511.       draw_item(i)
  1512.     end
  1513.   end
  1514.  
  1515.   #--------------------------------------------------------------------------
  1516.   # draw_item
  1517.   #--------------------------------------------------------------------------
  1518.   def draw_item(index)
  1519.     rect = item_rect(index)
  1520.     self.contents.clear_rect(rect)
  1521.     self.contents.font.color = normal_color
  1522.     self.contents.font.size = Font.default_size
  1523.     class_id = @data[index]
  1524.     return if $data_classes[class_id] == nil
  1525.     enabled = enabled_class?(class_id)
  1526.     if YEZ::JOB::CLASS_ICONS.include?(class_id)
  1527.       icon = YEZ::JOB::CLASS_ICONS[class_id]
  1528.     else
  1529.       icon = YEZ::JOB::CLASS_ICONS[0]
  1530.     end
  1531.     draw_icon(icon, rect.x, rect.y, enabled)
  1532.     name = $data_classes[class_id].name
  1533.     if @actor.class_id == class_id
  1534.       self.contents.font.color = text_color(YEZ::JOB::PRIMARY_COLOUR)
  1535.     elsif @actor.subclass_id == class_id
  1536.       self.contents.font.color = text_color(YEZ::JOB::SUBCLASS_COLOUR)
  1537.     else
  1538.       self.contents.font.color = normal_color
  1539.     end
  1540.     self.contents.font.color.alpha = enabled ? 255 : 128
  1541.     self.contents.draw_text(rect.x+24, rect.y, 172, WLH, name, 0)
  1542.     draw_class_jp(class_id, rect.x, rect.y, enabled)
  1543.   end
  1544.  
  1545.   #--------------------------------------------------------------------------
  1546.   # include?
  1547.   #--------------------------------------------------------------------------
  1548.   def include?(class_id)
  1549.     return false if $data_classes[class_id] == nil
  1550.     return false if @data.include?(class_id)
  1551.     return false if !@classes.include?(class_id)
  1552.     return true
  1553.   end
  1554.  
  1555.   #--------------------------------------------------------------------------
  1556.   # enabled_class?
  1557.   #--------------------------------------------------------------------------
  1558.   def enabled_class?(class_id)
  1559.     if @mode == 1
  1560.       return false if @actor.class_id == class_id
  1561.       return false unless @actor.unlocked_1stclasses.include?(class_id)
  1562.     elsif @mode == 2
  1563.       return false if @actor.class_id == class_id
  1564.       return false unless @actor.unlocked_subclasses.include?(class_id)
  1565.     end
  1566.     return true
  1567.   end
  1568.  
  1569.   #--------------------------------------------------------------------------
  1570.   # draw_class_jp
  1571.   #--------------------------------------------------------------------------
  1572.   def draw_class_jp(class_id, dx, dy, enabled)
  1573.     return unless $imported["JobSystemBase"]
  1574.     icon = $imported["Icons"] ? YEZ::ICONS[:txtjp] : YEZ::JOB::JP_ICON
  1575.     dw = self.width - 32 - dx - 24
  1576.     draw_icon(icon, self.width - 56, dy, enabled)
  1577.     self.contents.font.color = normal_color
  1578.     self.contents.font.color.alpha = enabled ? 255 : 128
  1579.     self.contents.font.size = YEZ::JOB::JP_SIZE
  1580.     text = @actor.class_jp[class_id]
  1581.     self.contents.draw_text(dx, dy, dw, WLH, text, 2)
  1582.   end
  1583.  
  1584.   #--------------------------------------------------------------------------
  1585.   # update_help
  1586.   #--------------------------------------------------------------------------
  1587.   def update_help
  1588.     if YEZ::JOB::CLASS_HELP_DESCRIPTIONS.include?(self.class)
  1589.       @help_window.set_text(YEZ::JOB::CLASS_HELP_DESCRIPTIONS[self.class])
  1590.     else
  1591.       @help_window.set_text("")
  1592.     end
  1593.   end
  1594.  
  1595. end # Window_Class_List
  1596.  
  1597. #===============================================================================
  1598. # Window_Class_Data
  1599. #===============================================================================
  1600.  
  1601. class Window_Class_Data < Window_Base
  1602.  
  1603.   #--------------------------------------------------------------------------
  1604.   # initialize
  1605.   #--------------------------------------------------------------------------
  1606.   def initialize(x, y, actor)
  1607.     super(x, y, Graphics.width - x, Graphics.height - y)
  1608.     @actor = actor
  1609.     refresh
  1610.   end
  1611.  
  1612.   #--------------------------------------------------------------------------
  1613.   # refresh
  1614.   #--------------------------------------------------------------------------
  1615.   def refresh(clone = nil)
  1616.     self.contents.clear
  1617.     @clone = clone
  1618.     dx = (self.width - 32)/2 - 97; dy = 0
  1619.     draw_actor_stats(dx, dy)
  1620.     return if @clone == nil
  1621.     draw_clone_stats(dx, dy)
  1622.   end
  1623.  
  1624.   #--------------------------------------------------------------------------
  1625.   # draw_actor_stats
  1626.   #--------------------------------------------------------------------------
  1627.   def draw_actor_stats(dx, dy)
  1628.     arrow = YEZ::JOB::CLASS_VOCAB[:arrow]
  1629.     for stat in YEZ::JOB::SHOWN_CLASS_STATS
  1630.       icon = 0
  1631.       case stat
  1632.       when :maxhp
  1633.         icon = $imported["Icons"] ? YEZ::ICONS[:hp] : 0
  1634.         text = Vocab.hp
  1635.         value = @actor.maxhp
  1636.       when :maxmp
  1637.         icon = $imported["Icons"] ? YEZ::ICONS[:mp] : 0
  1638.         text = Vocab.mp
  1639.         value = @actor.maxmp
  1640.       when :atk
  1641.         icon = $imported["Icons"] ? YEZ::ICONS[:atk] : 0
  1642.         text = Vocab.atk
  1643.         value = @actor.atk
  1644.       when :def
  1645.         icon = $imported["Icons"] ? YEZ::ICONS[:def] : 0
  1646.         text = Vocab.def
  1647.         value = @actor.def
  1648.       when :spi
  1649.         icon = $imported["Icons"] ? YEZ::ICONS[:spi] : 0
  1650.         text = Vocab.spi
  1651.         value = @actor.spi
  1652.       when :agi
  1653.         icon = $imported["Icons"] ? YEZ::ICONS[:agi] : 0
  1654.         text = Vocab.agi
  1655.         value = @actor.agi
  1656.       when :dex
  1657.         next unless $imported["BattlerStatDEX"]
  1658.         icon = $imported["Icons"] ? YEZ::ICONS[:dex] : 0
  1659.         text = Vocab.dex
  1660.         value = @actor.dex
  1661.       when :res
  1662.         next unless $imported["BattlerStatRES"]
  1663.         icon = $imported["Icons"] ? YEZ::ICONS[:res] : 0
  1664.         text = Vocab.res
  1665.         value = @actor.res
  1666.       else; next
  1667.       end
  1668.       draw_icon(icon, dx, dy)
  1669.       self.contents.font.color = system_color
  1670.       self.contents.draw_text(dx+24, dy, 60, WLH, text, 0)
  1671.       self.contents.font.color = normal_color
  1672.       self.contents.draw_text(dx+84, dy, 40, WLH, value, 2)
  1673.       self.contents.font.color = system_color
  1674.       self.contents.draw_text(dx+124, dy, 30, WLH, arrow, 1)
  1675.       dy += WLH
  1676.     end
  1677.   end
  1678.  
  1679.   #--------------------------------------------------------------------------
  1680.   # draw_clone_stats
  1681.   #--------------------------------------------------------------------------
  1682.   def draw_clone_stats(dx, dy)
  1683.     for stat in YEZ::JOB::SHOWN_CLASS_STATS
  1684.       case stat
  1685.       when :maxhp
  1686.         value1 = @clone.maxhp
  1687.         value2 = @actor.maxhp
  1688.       when :maxmp
  1689.         value1 = @clone.maxmp
  1690.         value2 = @actor.maxmp
  1691.       when :atk
  1692.         value1 = @clone.atk
  1693.         value2 = @actor.atk
  1694.       when :def
  1695.         value1 = @clone.def
  1696.         value2 = @actor.def
  1697.       when :spi
  1698.         value1 = @clone.spi
  1699.         value2 = @actor.spi
  1700.       when :agi
  1701.         value1 = @clone.agi
  1702.         value2 = @actor.agi
  1703.       when :dex
  1704.         next unless $imported["BattlerStatDEX"]
  1705.         value1 = @clone.dex
  1706.         value2 = @actor.dex
  1707.       when :res
  1708.         next unless $imported["BattlerStatRES"]
  1709.         value1 = @clone.res
  1710.         value2 = @actor.res
  1711.       else; next
  1712.       end
  1713.       if value1 > value2
  1714.         self.contents.font.color = power_up_color
  1715.       elsif value1 < value2
  1716.         self.contents.font.color = power_down_color
  1717.       else
  1718.         self.contents.font.color = normal_color
  1719.       end
  1720.       self.contents.draw_text(dx+154, dy, 40, WLH, value1, 2)
  1721.       dy += WLH
  1722.     end
  1723.   end
  1724.  
  1725. end # Window_Class_Data
  1726.  
  1727. #===============================================================================
  1728. # Window_Class_Info
  1729. #===============================================================================
  1730.  
  1731. class Window_Class_Info < Window_Base
  1732.  
  1733.   #--------------------------------------------------------------------------
  1734.   # initialize
  1735.   #--------------------------------------------------------------------------
  1736.   def initialize(x, y, actor)
  1737.     super(x, y, Graphics.width - x, Graphics.height - y)
  1738.     @actor = actor
  1739.     refresh(@actor.class_id)
  1740.   end
  1741.  
  1742.   #--------------------------------------------------------------------------
  1743.   # refresh
  1744.   #--------------------------------------------------------------------------
  1745.   def refresh(class_id = nil)
  1746.     self.contents.clear
  1747.     @class_id = class_id if class_id != nil
  1748.     @data = []
  1749.     for skill_id in learnable_skills
  1750.       skill = $data_skills[skill_id]
  1751.       next if skill == nil
  1752.       @data.push(skill)
  1753.     end
  1754.     @data.sort! { |a,b| a.id <=> b.id }
  1755.     self.contents.font.color = normal_color
  1756.     text = YEZ::JOB::CLASS_VOCAB[:list]
  1757.     self.contents.draw_text(0,0,self.width-32,WLH, text, 1)
  1758.     draw_skill_list
  1759.   end
  1760.  
  1761.   #--------------------------------------------------------------------------
  1762.   # learnable_skills
  1763.   #--------------------------------------------------------------------------
  1764.   def learnable_skills
  1765.     result = []
  1766.     if $imported["JobSystemBase"]
  1767.       result += YEZ::JOB::CLASS_SKILLS_LIST[0]
  1768.       if YEZ::JOB::CLASS_SKILLS_LIST.include?(@class_id)
  1769.         result += YEZ::JOB::CLASS_SKILLS_LIST[@class_id]
  1770.       end
  1771.     end
  1772.     if YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST.include?(@class_id)
  1773.       result += YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST[@class_id]
  1774.     end
  1775.     if YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST.include?(@class_id)
  1776.       result += YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST[@class_id]
  1777.     end
  1778.     return result
  1779.   end
  1780.  
  1781.   #--------------------------------------------------------------------------
  1782.   # draw_skill_list
  1783.   #--------------------------------------------------------------------------
  1784.   def draw_skill_list(icons_per_row = 4)
  1785.     icons_per_row = [[icons_per_row, 1].max, 8].min
  1786.     px = ((self.width-32)-(icons_per_row*24))/icons_per_row + 24
  1787.     dw = icons_per_row * px
  1788.     dx = original_x = (self.width-32)/2 - dw/2 + px/icons_per_row
  1789.     dy = original_y = WLH*1
  1790.     counter = 0
  1791.     for skill in @data.uniq
  1792.       if enabled_skill?(skill)
  1793.         icon = skill.icon_index
  1794.         enabled = true
  1795.       else
  1796.         icon = show_icon?(skill) ? skill.icon_index : YEZ::JOB::CLASS_ICONS[0]
  1797.         enabled = false
  1798.       end
  1799.       draw_icon(icon, dx, dy, enabled)
  1800.       draw_skill_level(dx, dy, skill, @actor, enabled) if
  1801.         $imported["JobSystemSkillLevels"]
  1802.       dx += px
  1803.       counter += 1
  1804.       if counter % icons_per_row == 0
  1805.         counter = 0
  1806.         dx = original_x
  1807.         dy += WLH
  1808.         return if dy + WLH > self.height-32
  1809.       end
  1810.     end
  1811.   end
  1812.  
  1813.   #--------------------------------------------------------------------------
  1814.   # enabled_skill?
  1815.   #--------------------------------------------------------------------------
  1816.   def enabled_skill?(skill)
  1817.     return true if @actor.skill_learn?(skill)
  1818.     return false
  1819.   end
  1820.  
  1821.   #--------------------------------------------------------------------------
  1822.   # show_icon?
  1823.   #--------------------------------------------------------------------------
  1824.   def show_icon?(skill)
  1825.     if $imported["JobSystemBase"]
  1826.       return false if skill.jp_cost <= 0
  1827.       for switch_id in skill.jp_switches
  1828.         return false unless $game_switches[switch_id]
  1829.       end
  1830.       if $imported["JobSystemSkillLevels"]
  1831.         for key in skill.level_at
  1832.           return false if key[1] > @actor.skill_level(key[0])
  1833.         end
  1834.       end
  1835.     end
  1836.     return true
  1837.   end
  1838.  
  1839. end # Window_Class_Info
  1840.  
  1841. #===============================================================================
  1842. #
  1843. # END OF FILE
  1844. #
  1845. #===============================================================================
RAW Paste Data