VX 스크립트

출처는 알피지 레볼루션입니다.

JP 잡포인트를 이용해서 기본클래스에서 서브 클래스로 변경이 가능하게 해주는

스크립트 인것같습니다..-_-;

쓰실분은 적당히 아이콘이라던가 직업등을 수정해 주셔야 될듯...

스크립트는 아래 부분....

#===============================================================================
#
# Yanfly Engine RD - Subclass Selection System
# Last Date Updated: 2009.06.28
# Level: Hard
# 
# There's been a lot of scripts where class changing is possible, but I've yet
# to see anything about a subclass system. Although this script allows changing
# primary classes, its main focus is the subclass system. There are many rules
# you may set for your subclass system. You can enable or disable equipment
# sharing amongst classes. You can choose how subclasses affect your base stats
# or not at all. You can determine how skills can be learned via subclass, etc.
#
# CLASS SYSTEM
# Classes are now split between primary and secondary classes. You can set many
# different rules for each class here inside the script. Secondary classes will
# expand the skill pool and equipment pool an actor has. With the class system,
# actors can also get a change in their base stats depending on which class they
# have equipped at the time. They can also get different amounts of boosts for
# their stats upon leveling up. The possibilities are vast.
#
# JP SYSTEM
# There is a new stat for each actor called JP. This new stat can be earned
# through various ways. It can be earned in battle, from items, attacking, using
# skills and items, and guarding. All of that can be modified. What JP does is
# allow your actors to learn new skills through a JP purchase system. These
# skills are unlocked when JP is spent on them and an actor will permanently
# have the skill at their disposal.
#
# UNLOCK SYSTEM
# Classes are unlocked via directly class changing, items, or learning specific
# skills. Scripted events can also directly unlock classes for actors if that's
# what floats your boat. There is no direct tier system implemented with this
# script since there is too many different ways people would love to have their
# classes unlock and whatnot.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.06.28 - Added ALLOW_WEAPON and ALLOW_ARMOUR.
# o 2009.05.26 - Compatibility with Scene Status ReDux
# o 2009.05.17 - Small bugfix to the change actor graphics commands.
# o 2009.05.16 - Upgrade Pack 2:
#                Primary-Only Classes and Subclass-Only Classes implemented.
#                Search for PRIMARY_ONLY_CLASSES and SUBCLASS_ONLY_CLASSES
#                Classes can now have special traits. 
#                Actors can now change graphics when changing primary classes.
#                Can now event call the menus using the following:
#                $scene = Scene_Class_Change.new
#                $scene = Scene_Learn_Skill.new
#                Anti-crash methods updated.
# o 2009.05.10 - Upgrade Pack 1:
#                Even more lag reduction.
#                Added level requirements and skill requirements.
#                Added Actor-Specific Common Skills Options
#                Added Primary-Class Only Skills Options
#                Added Subclass Only Skills Options
#                Added percentile growth rates dependent on primary and subclass
#                Added Actor-Restricted Classes Options
#                Added Primary/Subclass Stat Rate Percentage Options
#                Added two states that affect JP gain rate.
#                Added mechanic: Learning certain skills can unlock classes.
#                Fixed a few bugs regarding HP/MP during class changing.
# o 2009.05.08 - Compatibility update with YERD Equip Skill Slots.
# o 2009.05.07 - Lag Reduction. Ironed out crashes if people didn't input their
#                class data in correctly.
# o 2009.05.05 - Finished demo. Fix up remaining bugs.
# o 2009.04.30 - Finished script. Started creating demo.
# o 2009.04.29 - Started script.
#===============================================================================
# How to Use: Hard Mode
#===============================================================================
#
# I'm going to label all of this script as hard mode and above for multiple
# reasons. This script is not meant to be taken lightly nor does it provide the
# comfort of regular plug and playing that scripts with normal mode offer. I
# made as much of the script to be plug and play as possible but it will still
# require you to modify your classes properly before this skill will work the
# way you would want it to. After all, this is your game.
#
# ----------------------------------------------------------------------------
#
# Here are some tags you can put into your skills' noteboxes to give them JP
# related effects. Note that if you're not using the JP system at all, you can
# just flat out ignore most of these.
#
# <unlock class x>
# If a skill is learned with this tag, it will unlock class x for the character.
# Input multiple of these tags to unlock multiple classes. The lock class tag
# is not included due to potential save corruption and crashes.
#
# <require level x>
# The actor must be at least x level before they can buy the skill with JP.
#
# <require skill x>
# The actor must know skill x before they can buy the skill with JP. Insert
# multiple of these tags to increase the amount of skills required.
#
# <jp cost x>
# The skill will cost x jp for the actor to learn it.
#
# <jp boost set x>
# If an actor uses this skill, that actor will gain x set amount of JP.
#
# <jp boost ran x>
# If an actor uses this skill, that actor will gain x random amount of JP.
#
# ----------------------------------------------------------------------------
# 
# Here are some tags you can put into your items' noteboxes to give them new
# effects. These include JP effects but not all of them. Use accordingly.
#
# <gain jp x>
# The item will give the target ally JP of x amount. JP is given to whatever
# the ally's current class is.
#
# <unlock class x>
# The item will unlock class x for the target ally. Use multiple of these tags
# if you want an item to unlock more than one class.
#
# <lock class x>
# The item will lock class x for the target ally. Use multiple of these tags if
# you want an item to lock more than one class. Unlike the skill counterpart,
# this will not corrupt the save file nor crash the game.
#
# <set primary x> <set subclass x>
# This item will cause the target character to change primary or subclass to
# whatever class x is. If subclass is set to 0, it'll remove the subclass.
#
# ----------------------------------------------------------------------------
#
# There's not much for enemy tags but here it is.
#
# <enemy jp x>
# This determines the amount of JP given by that enemy. If nothing is determined
# by this set value and you allow your enemies to give JP, then the JP delivered
# will equal to the ENEMIES_DEFAULT amount.
#
# ----------------------------------------------------------------------------
#
# There's also not much for state tags but here they are.
#
# <bonus jp per x>
# JP gain rate is x%. If x is 200, then the JP gain rate is 200%.
#
# <bonus jp set x>
# x is added to JP gain. This means if JP gain is 20 and x is 10, total is 30.
#
#===============================================================================
#
# Compatibility
# - Works With: KGC HelpExtension, EquipExtension, CustomMenuCommand
# - Works With: Yanfly Display Skill Query, Equip Skill Slots
# - Alias: Game_Battler: attack_effect, skill_effect, item_effect, item_test
# - Alias: Game_Actor: setup, class_id=, equippable?, level_up, skills, base_*
# - Alias: Game_Actor: a lot of special traits
# - Alias: Scene_Battle: process_battle_start, execute_action_guard
# - Alias: Scene_Battle: display_exp_and_gold
# - Alias: Scene_Menu: create_command_window, update_command_selection,
# - Alias: Scene_Menu: update_actor_selection
# - Alias: Scene_Title: create_game_objects
# - Overwrites: Window_Base: draw_actor_class
#
#===============================================================================
# Credits:
# KGC for Window_Command imports.
#===============================================================================

$imported = {} if $imported == nil
$imported["SubclassSelectionSystem"] = true

module YE
  module SUBCLASS
    
    #---------------------------------------------------------------------------
    # CLASS SYSTEM
    #---------------------------------------------------------------------------
    
    # This part sets a bunch of rules regarding subclasses. Each one will allow
    # you to designate how you would like the subclass system rules to flow.
    # Read each part carefully since this will affect how the subclass system
    # will work for YOUR game.
    
    #---This allows actors to be able to wear equipment that is otherwise only
      # available for their equipped subclass. Set ALLOW_WEAPON to determine
      # whether or not characters can equip their subclass weapons. Set
      # ALLOW_ARMOUR to determine whether characters can equip subclass armours.
      ALLOW_EQUIP = true
      ALLOW_WEAPON = true
      ALLOW_ARMOUR = false
    
    #---These are two important switches for your game. If they are enabled,
      # their respective options will allow actors to switch their primary class
      # or their subclass. If not, the option to change them will not appear.
      ALLOW_CHANGE_PRIMARY_SWITCH = 65
      ALLOW_CHANGE_SUBCLASS_SWITCH = 66
      
    #---These are two important switches for your game. If they are enabled,
      # their respective options will appear in the menu. If not, they'll be
      # skipped.
      ENABLE_CLASS_CHANGE_SWITCH = 67
      ENABLE_LEARN_SKILLS_SWITCH = 68
      
    # This part affects all of the text you see inside the Class Change Menu.
    # Changing OPTION will enable/disable it inside your menu. Everything else
    # will adjust the text that appears.
    MENU_CLASS_CHANGE_OPTION = true
    MENU_CLASS_CHANGE_TITLE = "Class Change"
    MENU_CLASS_CHANGE_PRIM  = "Primary"
    MENU_CLASS_CHANGE_SUB   = "Subclass"
    MENU_CLASS_CHANGE_LEARN = "Learn"
    MENU_CLASS_CHANGE_DONE  = "Finish"
    MENU_CLASS_CHANGE_PARAM = ["MaxHP", "MaxMP", "ATK", "DEF", "SPI", "AGI"]
    MENU_CLASS_CHANGE_ICONS = [     99,     100,     2,    52,    21,    48]
    
    # This adjusts how the stats and arrows will appear.
    MENU_CLASS_CHANGE_USE_ICON = false
    MENU_CLASS_CHANGE_ARROW    = ">"
    MENU_CLASS_CHANGE_ICON     = 142
    
    # This affects the display type for new stats.
    # Type 1 - Shows the new stat itself.
    # Type 2 - Shows the increase/decrease in the stat.
    MENU_CLASS_CHANGE_SDISPLAY = 1
    
    # This allows you to designate icons for your classes. These will show up
    # whenever the class name is drawn.
    CLASS_ICONS ={
    # Class.ID => Icon ID
            0  =>  176,  # Nil Class
            1  =>  32,   # Paladin(Knight)
            2  =>  6,    # Warrior
            3  =>  128,  # Priest
            4  =>  119,  # Magician
            5  =>  3,    # Knight(Paladin)
            6  =>  136,  # Dark Knight
            7  =>  132,  # Grappler
            8  =>  39,   # Thief
    } # Do not remove this.
    
    #---This determines how the class and subclass is displayed inside menus.
      DISPLAY_FORMAT = "%s/%s"
    
    # This allows you to set how the class abbreviations will be displayed
    # in windows that will display the class abbreviations over the full name.
    CLASS_ABBREVIATIONS ={
    # Class.ID => Icon ID
            0  =>  "",    # Nil Class
            1  =>  "Kn",  # Paladin(Knight)
            2  =>  "Wa",  # Warrior
            3  =>  "Pr",  # Priest
            4  =>  "Ma",  # Magician
            5  =>  "Pa",  # Knight(Paladin)
            6  =>  "DK",  # Dark Knight
            7  =>  "Gr",  # Grappler
            8  =>  "Th",  # Thief
    } # Do not remove this.
    
    #---This allows you to set complex class names if your classes managed to
      # meet a specific combination. Take into consideration the slashes if
      # those are used in your display format.
      USE_COMPLEX_CLASS_NAMES = true
      
    # This is the string transformation data for full complex class naming.
    # Make sure you match it with the display format in order for it to change.
    COMPLEX_CLASS_NAMES_FULL ={
      # Combination Required => New Class Name
            "Knight/Warrior" => "Gladiator",
           "Knight/Magician" => "Magic Knight",
            "Knight/Paladin" => "White Knight",
        "Knight/Dark Knight" => "Black Knight",
            "Warrior/Knight" => "Combatant",
          "Warrior/Grappler" => "Fighter",
             "Warrior/Thief" => "Mercenary",
           "Priest/Magician" => "Shaman",
            "Priest/Paladin" => "Enchanter",
           "Magician/Knight" => "Spell Sword",
           "Magician/Priest" => "Archmage",
      "Magician/Dark Knight" => "Necromancer",
            "Paladin/Knight" => "Holy Knight",
            "Paladin/Priest" => "Soul Knight",
       "Paladin/Dark Knight" => "Arc Knight",
        "Dark Knight/Knight" => "Hell Knight",
      "Dark Knight/Magician" => "Death Knight",
       "Dark Knight/Paladin" => "Night Blade",
          "Grappler/Warrior" => "Brawler",
            "Grappler/Thief" => "Wrestler",
             "Thief/Warrior" => "Rogue Edge",
            "Thief/Grappler" => "Assassin",
    } # Do not remove this.
    
    # This is the string transformation data for abbreviated complex classes.
    # Make sure you match it with the display format in order for it to change.
    COMPLEX_CLASS_NAMES_ABBR ={
      # Combination Required => New Class Name
                     "Kn/Wa" => "Gl",
                     "Kn/Ma" => "MK",
                     "Kn/Pa" => "WK",
                     "Kn/DK" => "BK",
                     "Wa/Kn" => "Ct",
                     "Wa/Gr" => "Fi",
                     "Wa/Th" => "Mc",
                     "Pr/Ma" => "Sh",
                     "Pr/Pa" => "En",
                     "Ma/Kn" => "SS",
                     "Ma/Pr" => "AM",
                     "Ma/DK" => "Nm",
                     "Pa/Kn" => "HyK",
                     "Pa/Pr" => "SK",
                     "Pa/DK" => "AK",
                     "DK/Kn" => "HlK",
                     "DK/Ma" => "DtK",
                     "DK/Pa" => "NB",
                     "Gr/Wa" => "Br",
                     "Gr/Th" => "Wr",
                     "Th/Wa" => "RE",
                     "Th/Gr" => "As",
    } # Do not remove this.
    
    #---These two options can set some classes to be equippable only as primary
      # or subclass. A primary-only class cannot be equipped as a subclass and
      # vice versa. If a class is in both, it can't be equipped at all unless
      # through force scripted or evented means.
    PRIMARY_ONLY_CLASSES  = []
    SUBCLASS_ONLY_CLASSES = []
    
    #---This part determines whether or not some actors are restricted to only
      # a certain set of classes. If they're not on this list, those actors will
      # have access to all classes. There is no example shown in the demo.
    ACTOR_RESTRICTED_CLASSES ={
    # ActorID => [Class ID's]
            5 => [1, 2, 5, 6, 8],
            6 => [3, 4, 5, 6, 7],
    } # Do not remove this.
    
    #---This allows actors to instantly learn their subclasses skills if they
      # meet the level requirements upon leveling up or simply changing classes.
      ALLOW_RETRO_LEARN = true
    
    # This allows you to set which classes allow the actor to use which skills.
    # Even if the actors have learned skills outside of their class/subclass,
    # they won't be able to use them unless the actors equipped those classes.
    # Class 0 designates common skills allowed for all classes.
    CLASS_SKILL_ALLOW ={
    # ClassID => [Skill ID's]
            0 => [81, 82, 85, 86],
            1 => [33, 34, 41, 52, 67, 68],
            2 => [ 1,  2,  4,  5,  6,  7],
            3 => [33, 34, 36, 39, 41, 75],
            4 => [44, 47, 59, 60, 63, 64],
            5 => [33, 39, 49, 50, 51, 52],
            6 => [43, 44, 53, 54, 55, 56],
            7 => [ 1,  2,  7, 27, 28, 38],
            8 => [57, 58, 71, 73],
    } # Do not remove this.
    
    #---This part determines actor-based common skills. In other words, these
      # skills will always be available for specific actors no matter what
      # primary class or subclass they have equipped
    ACTOR_COMMON_SKILLS ={
    # ActorID => [Skill ID's]
            1 => [81],
            2 => [85],
            3 => [82],
            4 => [86],
    } # Do not remove this.
    
    #---This part determines primary-class only skills. These skills will only
      # be available if the actor has the specific class equipped as primary.
    PRIMARY_ONLY_SKILLS ={
    # ClassID => [Skill ID's]
            1 => [35, 42, 69, 70],
            2 => [ 8, 38],
            3 => [35, 37, 40, 42, 51, 76],
            4 => [45, 46, 61, 62, 65, 66],
            5 => [36, 40, 77, 78],
            6 => [46, 48, 79, 80],
            7 => [ 3, 29],
            8 => [31, 32, 72, 74],
    } # Do not remove this.
    
    #---This part determines subclass only skills. These skills will only
      # be available if the actor has the specific class equipped as a subclass.
      # There is no example of this shown in the demo.
    SUBCLASS_ONLY_SKILLS ={
    # ClassID => [Skill ID's]
            1 => [],
    } # Do not remove this.
    
    #---This determines whether or not actor stats are affected by their what
      # class they have equipped. You can also change whether or not subclasses
      # will affect the character's base stats at all.
      AFFECT_STATS_PRIMARY  = true
      AFFECT_STATS_SUBCLASS = true
    
    # This adjusts how classes affect the actor's stats.
    CLASS_STAT_RATE ={
    # Class.ID => [MaxHP, MaxMP,   ATK,   DEF,   SPI,   AGI]
             0 => [  100,   100,   100,   100,   100,   100],
             1 => [  100,   100,   100,   100,   100,   100],
             2 => [  120,    70,   120,   140,    70,   100],
             3 => [   90,   110,    80,    80,   110,    80],
             4 => [   85,   120,    70,    75,   120,    85],
             5 => [  115,   110,   100,   100,   110,    90],
             6 => [  120,    90,   115,    75,   115,   100],
             7 => [  125,    70,   125,    80,    70,    80],
             8 => [   80,    80,    85,    70,    80,   150],
    } # Do not remove this.
    
    # This determines what percentage primary and subclasses affect the class
    # stat rates. Normally, you should leave primary at 100% to avoid problems.
    PRIMARY_STAT_RATE  = 100
    SUBCLASS_STAT_RATE = 50
    
    #---This determines whether or not actors will gain extra stat bonuses for
      # leveling with a specific class. You can decide if their primary class
      # will get the stat bonuses, the subclass getting the bonuses, or both.
      LEVEL_UP_BONUS_PRIMARY  = true
      LEVEL_UP_BONUS_SUBCLASS = true
      
    # This determines the extra boost in stats actors will get when they level
    # up with that class as their primary or secondary (depending on which is
    # set to true). If a class's ID isn't included here, that class will not
    # get any bonus stats upon level up. Not even class 0.
    CLASS_STAT_BONUS_SET ={
    # Class.ID => [MaxHP, MaxMP,   ATK,   DEF,   SPI,   AGI]
             1 => [   10,     5,     1,     1,     1,     1],
             2 => [   20,     0,     2,     3,     0,     1],
             3 => [    0,    10,     0,     1,     2,     0],
             4 => [    0,    20,     0,     0,     5,     0],
             5 => [    5,     5,     1,     1,     1,     0],
             6 => [    5,     0,     2,     0,     2,     1],
             7 => [   30,     0,     3,     0,     0,     0],
             8 => [    0,     0,     0,     0,     0,     5],
    } # Do not remove this.
    
    # This also determines the extra boost in stats when actors level up. This
    # is different than the other table in the way that these stats are random
    # increases. This means they can range anywhere from 0 to the numbered
    # amount. You have to enable this growth first.
    BONUS_RANDOM_PRIMARY  = true
    BONUS_RANDOM_SUBCLASS = true
    CLASS_STAT_BONUS_RAN ={
    # Class.ID => [MaxHP, MaxMP,   ATK,   DEF,   SPI,   AGI]
             1 => [    5,     5,     2,     2,     2,     2],
             2 => [    5,     0,     2,     2,     0,     2],
             3 => [    0,     5,     0,     2,     2,     0],
             4 => [    0,     5,     0,     0,     2,     0],
             5 => [    5,     5,     2,     2,     2,     0],
             6 => [    5,     0,     2,     0,     2,     2],
             7 => [    5,     0,     2,     0,     0,     0],
             8 => [    1,     1,     1,     1,     1,     5],
    } # Do not remove this.
    
    # This determines the percentage growth rate applied depending if it's the
    # primary class or subclass. This affects both set and random increases.
    PRIMARY_GROWTH_RATE  = 100
    SUBCLASS_GROWTH_RATE = 50
    
    #---------------------------------------------------------------------------
    # CLASS TRAITS
    #---------------------------------------------------------------------------
    
    # This section governs traits unique to certain classes. These traits are
    # effects you can normally see under the character tab, weapon tag, and
    # armour tag. Traits can be set for primary or subclass. If you want a trait
    # to exist for both, just put it in both hashes.
    #
    # Here is a list of all the traits you can add:
    # "auto battle"   - Actor will automatically attack.
    # "super guard"   - Actor will take even less damage when guarding.
    # "pharmacology"  - Items will have double effect when used by actor.
    # "fast attack"   - Actor will strike quicker when using normals.
    # "dual attack"   - Actor will strike twice when using normals.
    # "prevent crit"  - Critical hits don't work against actor.
    # "half mp cost"  - Actor spends 50% less MP.
    # "double exp"    - Actor gains double the exp.
    # "double jp"     - Actor gains double the jp.
    #    
    # "barehanded"    - Actor gains a boost to attack if no weapons equipped.
    # "maxhp up"      - Actor gains a boost to maxhp outside of class rates.
    # "maxmp up"      - Actor gains a boost to maxmp outside of class rates.
    # "atk up"        - Actor gains a boost to atk outside of class rates.
    # "def up"        - Actor gains a boost to def outside of class rates.
    # "spi up"        - Actor gains a boost to spi outside of class rates.
    # "agi up"        - Actor gains a boost to agi outside of class rates.
    #
    # "no weapon"     - Actor cannot use weapon slot.
    # "no shield"     - Actor cannot use shield slot.
    # "no helmet"     - Actor cannot use helmet slot.
    # "no armour"     - Actor cannot use armour slot.
    # "no accessory"  - Actor cannot use accessory slot.
    # "no equips"     - Actor cannot use any equip slot.
    # "all weapon"    - Actor can use all weapons.
    # "all shield"    - Actor can wear all shields.
    # "all helmet"    - Actor can wear all helmets.
    # "all armour"    - Actor can wear all armours.
    # "all accessory" - Actor can wear all accessories.
    # "all equip"     - Actor can wear everything.
    #
    # To give a class more than one trait, separate them by commas.
    
    # This governs the traits available for classes when equipped as a primary
    # class. If you don't want a class to have a unique primary trait, either
    # remove the entry or keep the array blank.
    PRIMARY_TRAITS_HASH ={
    # Class.ID => [Traits]
             1 => ["prevent crit", "super guard", "agi up"],
             2 => ["fast attack", "all weapon", "atk up"],
             3 => ["pharmacology", "no shield"],
             4 => ["no shield", "spi up"],
             5 => ["prevent crit", "def up"],
             6 => ["super guard", "def up"],
             7 => ["dual attack", "barehanded", "no weapon", "no shield"],
             8 => ["double exp", "double jp", "no shield", "agi up"],
    } # Do not remove this.
    
    # This governs the traits available for classes when equipped as a subclass.
    # If you don't want a class to have a unique subclass trait, either remove
    # the entry or keep the array blank.
    SUBCLASS_TRAITS_HASH ={
    # Class.ID => [Traits]
             4 => ["spi up"],
             7 => ["barehanded"],
             8 => ["double jp"],
    } # Do not remove this.
    
    #---------------------------------------------------------------------------
    # CLASS CHANGE GRAPHIC
    #---------------------------------------------------------------------------
    
    # This array lists which actors will change their graphic upon changing
    # classes. Note that this will only take effect if the primary class is
    # changed and not the subclass. If an actor's ID isn't listed here, that
    # actor's graphic is locked from being able to be changed.
    CHANGE_ACTOR_GRAPHICS = [1]
    
    # This hash determines which graphics each individual actor will switch to
    # when changing classes. Note that if you don't list an actor ID, the hash
    # will automatically pool the actor together with Actor ID 0. For that
    # reason, do NOT remove actor 0's hash information. If a class ID doesn't
    # appear, the actor will retain its current graphic settings.
    GRAPHIC_HASH ={
    # Actor.ID => Do not remove Actor 0. It's a common pool for unlisted actors.
             0 => [#ClassID, CharName, Ind, FaceName, Ind],
                   [      1, "Actor1",   0, "Actor1",   0],
                   [      2, "Actor1",   2, "Actor1",   2],
                   [      3, "Actor2",   2, "Actor2",   2],
                   [      4, "Actor2",   4, "Actor2",   4],
                   [      5, "Actor1",   4, "Actor1",   4],
                   [      6,   "Evil",   4,   "Evil",   4],
                   [      7, "Actor3",   0, "Actor3",   0],
                   [      8, "Actor3",   2, "Actor3",   2],
                  ],#Next Instance
             1 => [#ClassID, CharName, Ind, FaceName, Ind],
                   [      1, "Actor1",   0, "Actor1",   0],
                   [      2, "Actor1",   2, "Actor1",   2],
                   [      3, "Actor2",   2, "Actor2",   2],
                   [      4, "Actor2",   4, "Actor2",   4],
                   [      5, "Actor1",   4, "Actor1",   4],
                   [      6,   "Evil",   4,   "Evil",   4],
                   [      7, "Actor3",   0, "Actor3",   0],
                   [      8, "Actor3",   2, "Actor3",   2],
                  ],#Next Instance
             2 => [#ClassID, CharName, Ind, FaceName, Ind],
                   [      1, "Actor1",   1, "Actor1",   1],
                   [      2, "Actor1",   3, "Actor1",   3],
                   [      3, "Actor2",   3, "Actor2",   3],
                   [      4, "Actor2",   5, "Actor2",   5],
                   [      5, "Actor1",   5, "Actor1",   5],
                   [      6,"People2",   5,"People2",   5],
                   [      7, "Actor3",   1, "Actor3",   1],
                   [      8, "Actor3",   3, "Actor3",   3],
                  ],#Next Instance
             3 => [#ClassID, CharName, Ind, FaceName, Ind],
                   [      1, "Actor1",   0, "Actor1",   0],
                   [      2, "Actor1",   2, "Actor1",   2],
                   [      3, "Actor2",   2, "Actor2",   2],
                   [      4, "Actor2",   4, "Actor2",   4],
                   [      5, "Actor1",   4, "Actor1",   4],
                   [      6,   "Evil",   4,   "Evil",   4],
                   [      7, "Actor3",   0, "Actor3",   0],
                   [      8, "Actor3",   2, "Actor3",   2],
                  ],#Next Instance
             4 => [#ClassID, CharName, Ind, FaceName, Ind],
                   [      1, "Actor1",   1, "Actor1",   1],
                   [      2, "Actor1",   3, "Actor1",   3],
                   [      3, "Actor2",   3, "Actor2",   3],
                   [      4, "Actor2",   5, "Actor2",   5],
                   [      5, "Actor1",   5, "Actor1",   5],
                   [      6,"People2",   5,"People2",   5],
                   [      7, "Actor3",   1, "Actor3",   1],
                   [      8, "Actor3",   3, "Actor3",   3],
                  ],#Next Instance
    } # Do not remove this.
    
    # These govern the multipliers given to the various traits.
    BAREHAND_MULTIPLIER = 250      # Uses Yanfly Barehand modifier if have.
    MAXHP_MULTIPLIER    = 125      # Additional multiplier regardless of rates.
    MAXMP_MULTIPLIER    = 125      # Additional multiplier regardless of rates.
    ATK_MULTIPLIER      = 150      # Additional multiplier regardless of rates.
    DEF_MULTIPLIER      = 150      # Additional multiplier regardless of rates.
    SPI_MULTIPLIER      = 150      # Additional multiplier regardless of rates.
    AGI_MULTIPLIER      = 150      # Additional multiplier regardless of rates.
    
    #---------------------------------------------------------------------------
    # JP SYSTEM
    #---------------------------------------------------------------------------
    
    # The JP system is a system adapted from Final Fantasy Tactics. Your classes
    # will earn JP over battles and can use them to purchase new skills inside a
    # particular menu. This section will allow you to change JP system rules for
    # your game should you desire to use it.
    USE_JP_SYSTEM = true
    MAX_JP_EARNED = 9999
    JP_DEFINITION = "%d JP"
    JP_ICON       = 145
    
    # This determines whether or not enemies will give JP if killed and the
    # default amount if not set with <enemy jp x>.
    ENEMIES_GIVE_JP   = true
    ENEMIES_SHOW_MSG  = false
    ENEMIES_DEFAULT   = 10
    ENEMIES_MESSAGE   = "%s has earned %s JP from battle."
    
    # This sets whether or not you'd like your actors to display the JP they've
    # earned in battle (since every action adds JP).
    DISPLAY_ACTOR_JP  = true
    DISPLAY_ACTOR_MSG = "%s gained %d JP this battle."
    
    # This will determine whether or not the Learn Skill scene can be accessed
    # from the main menu. This also adjusts the text for the scene's options.
    LEARN_SKILL_OPTION = true
    LEARN_SKILL_TITLE  = "Learn Skills"
    LEARN_SKILL_SELECT = "Learn"
    LEARN_SKILL_CHANGE = "Change"
    LEARN_SKILL_DONE   = "Finish"
    
    # This affects the string data for the status window shown on the side.
    # This also affects what sound effect is played when buying skills.
    LEARN_SKILL_STATUS_HELP = "Select class you would like to learn skills for."
    LEARN_SKILL_STATUS_LEARNED = "%d%% Mastery"
    LEARN_SKILL_STATUS_ALL     = "Mastered!"
    LEARN_SKILL_SHOP_LEARNED   = "Learned"
    LEARN_SKILL_SHOP_STRING    = "%s JP"
    LEARN_SKILL_SHOP_SOUND     = RPG::SE.new("Equip", 80, 100)
    
    # This is the string data used for required skills and levels before the
    # skill can be purchased with JP.
    REQUIRE_SKILL = "Requires"
    REQUIRE_LEVEL = "Level %d"
    
    # These icons will replace the JP icon if the class is a primary only skill
    # or a subclass only skill.
    PRIMARY_ONLY_ICON  = 208
    SUBCLASS_ONLY_ICON = 209
    
    # JP is earned throughout battle from different effects. You can determine
    # what will earn JP here and by how much. Set amounts are the increases that
    # will always occur so long as the action is enabled. Random amounts will
    # increase the JP earned from 0 to that amount.
    
    EARN_JP_VIA_ATTACK_ENABLE = true         # Normal attacks will earn JP.
    EARN_JP_VIA_ATTACK_AMOUNT = 10           # Earns at least this amount of JP.
    EARN_JP_VIA_ATTACK_RANDOM = 5            # Earns up to this random amount.
    
    EARN_JP_VIA_SKILL_ENABLE = true          # Skills will earn JP.
    EARN_JP_VIA_SKILL_AMOUNT = 20            # Earns at least this amount of JP.
    EARN_JP_VIA_SKILL_RANDOM = 10            # Earns up to this random amount.
    
    EARN_JP_VIA_GUARD_ENABLE = true          # Guarding will earn JP.
    EARN_JP_VIA_GUARD_AMOUNT = 4             # Earns at least this amount of JP.
    EARN_JP_VIA_GUARD_RANDOM = 2             # Earns up to this random amount.
    
    EARN_JP_VIA_ITEMS_ENABLE = true          # Using items will earn JP.
    EARN_JP_VIA_ITEMS_AMOUNT = 8             # Earns at least this amount of JP.
    EARN_JP_VIA_ITEMS_RANDOM = 4             # Earns up to this random amount.
    
    # This will determine the multipliers for earning JP split between primary
    # and subclasses. This effect is determined every time "gain_jp" definition
    # occurs within the script.
    
    EARN_JP_MULTIPLIER_PRIMARY  = 100  # Percentage for primary JP earning.
    EARN_JP_MULTIPLIER_SUBCLASS = 50   # Percentage for subclass JP earning.
    
    #---------------------------------------------------------------------------
    # COMPATIBILITY ADD-ONS
    #---------------------------------------------------------------------------
    
    # This following section is to determine compatibility showing for Display
    # Skill Query if you wish for that to be enabled.
    ENABLE_SKILL_QUERY  = true
    SHOW_QUERY_BUTTON   = Input::A
    SHOW_QUERY_HELP_WIN = true
    QUERY_HELP_WIN_TEXT = "Press Shift to view skill info."
    
  end # SUBCLASS
end # YE

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

module YE
  module REGEXP
    module BASEITEM
      
      # These are skill related.
      JP_COST       = /<(?:JP_COST|jp cost)[ ]*(d+)>/i
      JP_BOOST_SET  = /<(?:JP_BOOST_SET|jp boost set)[ ]*(d+)>/i
      JP_BOOST_RAN  = /<(?:JP_BOOST_RAN|jp boost ran)[ ]*(d+)>/i
      REQUIRE_SKILL =  /<(?:REQUIRE_SKILL|require skill)[ ]*(d+)>/i
      REQUIRE_LEVEL =  /<(?:REQUIRE_LEVEL|require level)[ ]*(d+)>/i
      
      # These are item related.
      GAIN_JP      = /<(?:GAIN_JP|gain jp)[ ]*(d+)>/i
      UNLOCK_CLASS = /<(?:UNLOCK_CLASS|unlock class)[ ]*(d+)>/i
      LOCK_CLASS   = /<(?:LOCK_CLASS|lock class)[ ]*(d+)>/i
      SET_PRIMARY  = /<(?:SET_PRIMARY|set primary)[ ]*(d+)>/i
      SET_SUBCLASS = /<(?:SET_SUBCLASS|set subclass)[ ]*(d+)>/i
      
    end # BASEITEM
    module ENEMY
      
      # These are enemy related
      ENEMY_JP     = /<(?:ENEMY_JP|enemy jp)[ ]*(d+)>/i
      
    end # ENEMY
    module STATE
      
      # This affects states.
      BONUS_JP_PER = /<(?:BONUS_JP_PER|bonus jp per)[ ]*(d+)>/i
      BONUS_JP_SET = /<(?:BONUS_JP_SET|bonus jp set)[ ]*(d+)>/i
      
    end # STATE
  end # REGEXP
end # YE

#===============================================================================
# RPG::State
#===============================================================================

class RPG::State
  
  #--------------------------------------------------------------------------
  # Yanfly_Cache_SSS
  #--------------------------------------------------------------------------
  def yanfly_cache_state_sss
    @bonus_jp_per = 100; @bonus_jp_set = 0
    
    self.note.split(/[rn]+/).each { |line|
      case line
      when YE::REGEXP::STATE::BONUS_JP_PER
        @bonus_jp_per = $1.to_i
      when YE::REGEXP::STATE::BONUS_JP_SET
        @bonus_jp_set = $1.to_i
      end
    }
  end # cache
  
  #--------------------------------------------------------------------------
  # definitions
  #--------------------------------------------------------------------------
  def bonus_jp_per
    yanfly_cache_state_sss if @bonus_jp_per == nil
    return @bonus_jp_per
  end
  def bonus_jp_set
    yanfly_cache_state_sss if @bonus_jp_set == nil
    return @bonus_jp_set
  end
  
end

#===============================================================================
# RPG::Enemy
#===============================================================================

class RPG::Enemy
  
  #--------------------------------------------------------------------------
  # Yanfly_Cache_SSS
  #--------------------------------------------------------------------------
  def yanfly_cache_enemy_sss
    @enemy_jp = YE::SUBCLASS::ENEMIES_DEFAULT
    
    self.note.split(/[rn]+/).each { |line|
      case line
      when YE::REGEXP::ENEMY::ENEMY_JP
        @enemy_jp = $1.to_i
      end
    }
  end # cache
  
  #--------------------------------------------------------------------------
  # definitions
  #--------------------------------------------------------------------------
  def enemy_jp
    yanfly_cache_enemy_sss if @enemy_jp == nil
    return @enemy_jp
  end
  
end

#===============================================================================
# RPG::BaseItem
#===============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # Yanfly_Cache_SSS
  #--------------------------------------------------------------------------
  def yanfly_cache_baseitem_sss
    @jp_cost = 0; @jp_learn = false; @jp_boost_set = 0; @jp_boost_ran = 0
    @gain_jp = 0; @unlock_class = []; @lock_class = []
    @set_primary = 0; @set_subclass = -1
    @require_skill = []; @require_level = 0
    
    self.note.split(/[rn]+/).each { |line|
      case line
      when YE::REGEXP::BASEITEM::JP_COST
        @jp_cost = $1.to_i
        @jp_learn = true
      when YE::REGEXP::BASEITEM::JP_BOOST_SET
        @jp_boost_set = $1.to_i
      when YE::REGEXP::BASEITEM::JP_BOOST_RAN
        @jp_boost_ran = $1.to_i
      when YE::REGEXP::BASEITEM::GAIN_JP
        @gain_jp = $1.to_i
      when YE::REGEXP::BASEITEM::REQUIRE_SKILL
        @require_skill.push($1.to_i)
      when YE::REGEXP::BASEITEM::REQUIRE_LEVEL
        @require_level = $1.to_i
        
      when YE::REGEXP::BASEITEM::UNLOCK_CLASS
        @unlock_class.push($1.to_i)
      when YE::REGEXP::BASEITEM::LOCK_CLASS
        @lock_class.push($1.to_i)
      when YE::REGEXP::BASEITEM::SET_PRIMARY
        @set_primary = $1.to_i
      when YE::REGEXP::BASEITEM::SET_SUBCLASS
        @set_subclass = $1.to_i
      end
    }
  end # cache
  
  #--------------------------------------------------------------------------
  # JP definitions
  #--------------------------------------------------------------------------
  def jp_cost
    yanfly_cache_baseitem_sss if @jp_cost == nil
    return @jp_cost
  end
  
  def jp_learn?
    yanfly_cache_baseitem_sss if @jp_learn == nil
    return @jp_learn
  end
  
  def jp_boost_set
    yanfly_cache_baseitem_sss if @jp_boost_set == nil
    return @jp_boost_set
  end
  
  def jp_boost_ran
    yanfly_cache_baseitem_sss if @jp_boost_ran == nil
    return @jp_boost_ran
  end
  
  def gain_jp
    yanfly_cache_baseitem_sss if @gain_jp == nil
    return @gain_jp
  end
  
  def require_skill
    yanfly_cache_baseitem_sss if @require_skill == nil
    return @require_skill
  end
  
  def require_level
    yanfly_cache_baseitem_sss if @require_level == nil
    return @require_level
  end
  
  #--------------------------------------------------------------------------
  # class definitions
  #--------------------------------------------------------------------------
  def unlock_class
    yanfly_cache_baseitem_sss if @unlock_class == nil
    return @unlock_class
  end
  
  def lock_class
    yanfly_cache_baseitem_sss if @lock_class == nil
    return @lock_class
  end
  
  def set_primary
    yanfly_cache_baseitem_sss if @set_primary == nil
    return @set_primary
  end
  
  def set_subclass
    yanfly_cache_baseitem_sss if @set_subclass == nil
    return @set_subclass
  end
  
end

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
  
  #--------------------------------------------------------------------------
  # perform gain_jp
  #--------------------------------------------------------------------------
  def gain_jp(amount)
    return unless self.actor?
    class1 = self.class_id
    class2 = self.subclass_id unless self.subclass == nil
    for state in states
      amount *= state.bonus_jp_per
      amount /= 100
    end
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      if pri_hash.include?("double jp") or pri_hash.include?("double jp gain")
        amount *= 2
      end
    end
    if YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.class.id) and
    self.subclass != nil
      sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH[self.class.id]
      if sub_hash.include?("double jp") or sub_hash.include?("double jp gain")
        amount *= 2
      end
    end
    for state in states
      amount += state.bonus_jp_set
    end
    jp1  = amount * YE::SUBCLASS::EARN_JP_MULTIPLIER_PRIMARY
    jp1 /= 100
    jp2  = amount * YE::SUBCLASS::EARN_JP_MULTIPLIER_SUBCLASS
    jp2 /= 100
    self.jp_counter += [jp1, jp2].max if $scene.is_a?(Scene_Battle)
    change_jp(class1, jp1)
    change_jp(class2, jp2) unless self.subclass == nil
  end
  
  #--------------------------------------------------------------------------
  # jp counter
  #--------------------------------------------------------------------------
  def jp_counter
    @jp_counter = 0 if @jp_counter == nil
    return @jp_counter
  end
  
  def jp_counter=(newvalue)
    @jp_counter = 0 if @jp_counter == nil
    @jp_counter = newvalue
  end
  
  #--------------------------------------------------------------------------
  # alias attack effect
  #--------------------------------------------------------------------------
  alias attack_effect_sss attack_effect unless $@
  def attack_effect(attacker)
    attack_effect_sss(attacker)
    return unless attacker.actor?
    return unless YE::SUBCLASS::EARN_JP_VIA_ATTACK_ENABLE
    amount  = YE::SUBCLASS::EARN_JP_VIA_ATTACK_AMOUNT
    unless YE::SUBCLASS::EARN_JP_VIA_ATTACK_RANDOM == 0
      amount += rand(YE::SUBCLASS::EARN_JP_VIA_ATTACK_RANDOM)
    end
    attacker.gain_jp(amount)
  end
  
  #--------------------------------------------------------------------------
  # alias skill effect
  #--------------------------------------------------------------------------
  alias skill_effect_sss skill_effect unless $@
  def skill_effect(user, skill)
    skill_effect_sss(user, skill)
    return unless user.actor?
    return unless YE::SUBCLASS::EARN_JP_VIA_SKILL_ENABLE
    return unless $scene.is_a?(Scene_Battle)
    amount  = YE::SUBCLASS::EARN_JP_VIA_SKILL_AMOUNT
    unless YE::SUBCLASS::EARN_JP_VIA_SKILL_RANDOM == 0
      amount += rand(YE::SUBCLASS::EARN_JP_VIA_SKILL_RANDOM)
    end
    amount += skill.jp_boost_set unless skill.jp_boost_set <= 0
    amount += rand(skill.jp_boost_ran) unless skill.jp_boost_ran <= 0
    user.gain_jp(amount)
  end
  
  #--------------------------------------------------------------------------
  # alias item effect
  #--------------------------------------------------------------------------
  alias item_effect_sss item_effect unless $@
  def item_effect(user, item)
    item_effect_sss(user, item)
    return unless user.actor?
    user.gain_jp(item.gain_jp)
    #----------------------------------
    if item.unlock_class != []
      for class_id in item.unlock_class
        user.unlock_class(class_id)
      end
    end
    if item.lock_class != []
      for class_id in item.lock_class
        user.lock_class(class_id)
      end
    end
    if item.set_primary > 0
      user.class_id = item.set_primary
    end
    if item.set_subclass > -1
      user.subclass_id = item.set_subclass
    end
    #----------------------------------
    return unless YE::SUBCLASS::EARN_JP_VIA_ITEMS_ENABLE
    return unless $scene.is_a?(Scene_Battle)
    amount  = YE::SUBCLASS::EARN_JP_VIA_ITEMS_AMOUNT
    unless YE::SUBCLASS::EARN_JP_VIA_ITEMS_RANDOM == 0
      amount += rand(YE::SUBCLASS::EARN_JP_VIA_ITEMS_RANDOM)
    end
    user.gain_jp(amount)
  end
  
  #--------------------------------------------------------------------------
  # alias item test
  #--------------------------------------------------------------------------
  alias item_test_sss item_test unless $@
  def item_test(user, item)
    if self.actor?
      return true if item.unlock_class != []
      return true if item.lock_class != []
      return true if item.gain_jp > 0
      return true if item.set_primary > 0
      return true if item.set_subclass > -1
    end
    return item_test_sss(user, item)
  end
  
end

#===============================================================================
# Game_Actor
#===============================================================================

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :subclass_id
  
  #--------------------------------------------------------------------------
  # alias setup
  #--------------------------------------------------------------------------
  alias setup_sss setup unless $@
  def setup(actor_id)
    setup_sss(actor_id)
    @subclass_id = 0         # This determines the subclass ID.
    @unlocked_classes = [self.class.id]   # What classes are unlocked.
    @class_jp = {}
  end
  
  #--------------------------------------------------------------------------
  # alias learn skill
  #--------------------------------------------------------------------------
  alias learn_skill_sss learn_skill unless $@
  def learn_skill(skill_id)
    learn_skill_sss(skill_id)
    skill = $data_skills[skill_id]
    if skill.unlock_class != []
      for class_id in skill.unlock_class
        self.unlock_class(class_id)
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # class actor graphic
  #--------------------------------------------------------------------------
  def class_actor_graphic
    return unless YE::SUBCLASS::CHANGE_ACTOR_GRAPHICS.include?(self.id)
    if YE::SUBCLASS::GRAPHIC_HASH.include?(self.id)
      narray = YE::SUBCLASS::GRAPHIC_HASH[self.id]
    else
      narray = YE::SUBCLASS::GRAPHIC_HASH[0]
    end
    parray = [0, self.character_name, self.character_index, 
    self.face_name, self.face_index]
    for tarray in narray
      if @class_id == tarray[0]
        parray = tarray
        break
      end
    end
    val1 = parray[1]; val2 = parray[2]; val3 = parray[3]; val4 = parray[4]
    self.set_graphic(val1, val2, val3, val4)
    return unless $game_party.members[0].id == self.id
    $game_player.set_graphic(val1, val2)
  end
  
  #--------------------------------------------------------------------------
  # alias class_id=
  #--------------------------------------------------------------------------
  alias class_id_equal_sss class_id=  unless $@
  def class_id=(class_id)
    return if YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(class_id)
    if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES.include?(self.id)
      unless YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES[self.id].include?(class_id)
        return
      end
    end
    return if class_id == self.class.id
    hp_per = (self.maxhp == 0) ? 0 : self.hp * 100 / self.maxhp
    mp_per = (self.maxmp == 0) ? 0 : self.mp * 100 / self.maxmp
    class_id_equal_sss(class_id)
    class_actor_graphic
    if self.subclass_id == self.class_id
      self.subclass_id = 0
    end
    self.hp = Integer(hp_per * self.maxhp / 100)
    self.mp = Integer(mp_per * self.maxmp / 100)
    if YE::SUBCLASS::ALLOW_RETRO_LEARN
      for i in self.class.learnings
        learn_skill(i.skill_id) if i.level <= @level
      end
    end
    unless @unlocked_classes.include?(@class_id)
      @unlocked_classes.push(@class_id)
    end
    #---
    for i in 0..4
      change_equip(i, nil) unless equippable?(equips[i])
    end
    if $imported["EquipExtension"]
      return if extra_armor_number == 0
      for i in 5..armor_number
        change_equip(i, nil) unless equippable?(equips[i])
      end
    end
    purge_unequippable_skills if $imported["EquipSkillSlots"]
    @unlocked_classes.sort!
  end
  
  #--------------------------------------------------------------------------
  # return Subclass
  #--------------------------------------------------------------------------
  def subclass
    @subclass_id = 0 if @subclass_id == nil
    return $data_classes[@subclass_id]
  end
  
  #--------------------------------------------------------------------------
  # change Subclass ID
  #--------------------------------------------------------------------------
  def subclass_id=(newvalue)
    return if YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(newvalue)
    if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES.include?(self.id)
      unless YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES[self.id].include?(newvalue)
        return
      end
    end
    hp_per = (self.maxhp == 0) ? 0 : self.hp * 100 / self.maxhp
    mp_per = (self.maxmp == 0) ? 0 : self.mp * 100 / self.maxmp
    @subclass_id = newvalue
    @subclass_id = 0 if @subclass_id == @class_id
    self.hp = Integer(hp_per * self.maxhp / 100)
    self.mp = Integer(mp_per * self.maxmp / 100)
    return if @subclass_id == 0
    if YE::SUBCLASS::ALLOW_RETRO_LEARN and self.subclass != nil
      for i in self.subclass.learnings
        learn_skill(i.skill_id) if i.level <= @level
      end
    end
    unless @unlocked_classes.include?(@subclass_id)
      @unlocked_classes.push(@subclass_id)
    end
    #---
    for i in 0..4
      change_equip(i, nil) unless equippable?(equips[i])
    end
    if $imported["EquipExtension"]
      return if extra_armor_number == 0
      for i in 5..armor_number
        change_equip(i, nil) unless equippable?(equips[i])
      end
    end
    purge_unequippable_skills if $imported["EquipSkillSlots"]
    @unlocked_classes.sort!
  end
  
  #--------------------------------------------------------------------------
  # clone class/subclass change
  #--------------------------------------------------------------------------
  def class_clone=(newvalue)
    return if YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(newvalue)
    @class_id = newvalue
    for i in 0..4
      change_equip(i, nil, true) unless equippable?(equips[i])
    end
    if $imported["EquipExtension"]
      return if extra_armor_number == 0
      for i in 5..armor_number
        change_equip(i, nil, true) unless equippable?(equips[i])
      end
    end
  end
  
  def subclass_clone=(newvalue)
    return if YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(newvalue)
    return if newvalue == @class_id
    @subclass_id = newvalue
    @subclass_id = 0 if @subclass_id == @class_id
    for i in 0..4
      change_equip(i, nil, true) unless equippable?(equips[i])
    end
    if $imported["EquipExtension"]
      return if extra_armor_number == 0
      for i in 5..armor_number
        change_equip(i, nil, true) unless equippable?(equips[i])
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # return unlocked classes
  #--------------------------------------------------------------------------
  def unlocked_classes
    results = []
    @unlocked_classes = [self.class.id] if @unlocked_classes == nil
    @unlocked_classes.sort!
    if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES.include?(self.id)
      for class_id in @unlocked_classes
        if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES[self.id].include?(class_id)
          results.push(class_id)
        end
      end
    else
      results = @unlocked_classes
    end
    results.push(self.class.id) unless results.include?(self.class.id)
    return results
  end
  
  #--------------------------------------------------------------------------
  # perform unlock class
  #--------------------------------------------------------------------------
  def unlock_class(newclass_id)
    @unlocked_classes = [self.class.id] if @unlocked_classes == nil
    unless @unlocked_classes.include?(newclass_id)
      @unlocked_classes.push(newclass_id)
    end
    @unlocked_classes.sort!
    if YE::SUBCLASS::ALLOW_RETRO_LEARN
      newsubclass = $data_classes[newclass_id]
      for i in newsubclass.learnings
        learn_skill(i.skill_id) if i.level <= @level
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # perform lock class
  #--------------------------------------------------------------------------
  def lock_class(newclass_id)
    return if newclass_id == self.class.id
    @unlocked_classes = [self.class.id] if @unlocked_classes == nil
    @unlocked_classes.delete(newclass_id)
    @unlocked_classes.sort!
  end
  
  #--------------------------------------------------------------------------
  # perform unlock all classes
  #--------------------------------------------------------------------------
  def unlock_all_classes
    for i in 0..$data_classes.size
      unlock = $data_classes[i + 1]
      self.unlock_class(unlock.id)
    end
    @unlocked_classes.sort!
  end
  
  #--------------------------------------------------------------------------
  # perform lock all classes
  #--------------------------------------------------------------------------
  def lock_all_classes
    for i in 0..$data_classes.size
      unlock = $data_classes[i + 1]
      self.lock_class(unlock.id)
    end
    @unlocked_classes.sort!
  end
  
  #--------------------------------------------------------------------------
  # alias equippable?
  #--------------------------------------------------------------------------
  alias equippable_sss equippable? unless $@
  def equippable?(item)
    result = false
    result = equippable_sss(item)
    #---
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      return false unless no_equip_hash(check_hash, item)
      return true if all_equip_hash(check_hash, item)
    end
    #---
    if YE::SUBCLASS::ALLOW_EQUIP and !result and self.subclass != nil
      result = subclass_equippable?(item)
    end
    if YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.class.id) and
    self.subclass != nil
      check_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH[self.class.id]
      return false unless no_equip_hash(check_hash, item)
      return true if all_equip_hash(check_hash, item)
    end
    return result
  end
  
  #--------------------------------------------------------------------------
  # no equip hash
  #--------------------------------------------------------------------------
  def no_equip_hash(check_hash, item)
    if item.is_a?(RPG::Weapon)
      return false if check_hash.include?("no equip")
      return false if check_hash.include?("no equips")
      return false if check_hash.include?("no equipment")
      return false if check_hash.include?("no weapon")
      return false if check_hash.include?("no weapons")
    elsif item.is_a?(RPG::Armor)
      case item.kind
      when 0
        return false if check_hash.include?("no shield")
        return false if check_hash.include?("no shields")
      when 1
        return false if check_hash.include?("no helmet")
        return false if check_hash.include?("no helmets")
      when 2
        return false if check_hash.include?("no armour")
        return false if check_hash.include?("no armours")
        return false if check_hash.include?("no armor")
        return false if check_hash.include?("no armors")
      when 3
        return false if check_hash.include?("no accessory")
        return false if check_hash.include?("no accessories")
      end
    end
    return true
  end
  
  #--------------------------------------------------------------------------
  # all equip hash
  #--------------------------------------------------------------------------
  def all_equip_hash(check_hash, item)
    return true if check_hash.include?("all equip")
    return true if check_hash.include?("all equips")
    return true if check_hash.include?("all equipment")
    if item.is_a?(RPG::Weapon)
      return true if check_hash.include?("all weapon")
      return true if check_hash.include?("all weapons")
    elsif item.is_a?(RPG::Armor)
      case item.kind
      when 0
        return true if check_hash.include?("all shield")
        return true if check_hash.include?("all shields")
      when 1
        return true if check_hash.include?("all helmet")
        return true if check_hash.include?("all helmets")
      when 2
        return true if check_hash.include?("all armour")
        return true if check_hash.include?("all armours")
        return true if check_hash.include?("all armor")
        return true if check_hash.include?("all armors")
      when 3
        return true if check_hash.include?("all accessory")
        return true if check_hash.include?("all accessories")
      end
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # subclass equippable?
  #--------------------------------------------------------------------------
  def subclass_equippable?(item)
    return false if item == nil
    if item.is_a?(RPG::Weapon) and YE::SUBCLASS::ALLOW_WEAPON
      return self.subclass.weapon_set.include?(item.id)
    elsif item.is_a?(RPG::Armor) and YE::SUBCLASS::ALLOW_ARMOUR
      return false if two_swords_style and item.kind == 0
      return self.subclass.armor_set.include?(item.id)
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # alias level_up
  #--------------------------------------------------------------------------
  alias level_up_sss level_up unless $@
  def level_up
    #-----
    prm_rate = YE::SUBCLASS::PRIMARY_GROWTH_RATE
    sub_rate = YE::SUBCLASS::SUBCLASS_GROWTH_RATE
    if YE::SUBCLASS::LEVEL_UP_BONUS_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_BONUS_SET.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_BONUS_SET[self.class.id]
        self.maxhp += (narray[0] * prm_rate) / 100
        self.maxmp += (narray[1] * prm_rate) / 100
        self.atk += (narray[2] * prm_rate) / 100
        self.def += (narray[3] * prm_rate) / 100
        self.spi += (narray[4] * prm_rate) / 100
        self.agi += (narray[5] * prm_rate) / 100
      end
    end
    #-----
    if YE::SUBCLASS::BONUS_RANDOM_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_BONUS_RAN.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_BONUS_RAN[self.class.id]
        self.maxhp += (rand(narray[0]) * prm_rate) / 100 unless narray[0] == 0
        self.maxmp += (rand(narray[1]) * prm_rate) / 100 unless narray[1] == 0
        self.atk += (rand(narray[2]) * prm_rate) / 100 unless narray[2] == 0
        self.def += (rand(narray[3]) * prm_rate) / 100 unless narray[3] == 0
        self.spi += (rand(narray[4]) * prm_rate) / 100 unless narray[4] == 0
        self.agi += (rand(narray[5]) * prm_rate) / 100 unless narray[5] == 0
      end
    end
    #-----
    if YE::SUBCLASS::LEVEL_UP_BONUS_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_BONUS_SET.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_BONUS_SET[self.class.id]
        self.maxhp += (narray[0] * sub_rate) / 100
        self.maxmp += (narray[1] * sub_rate) / 100
        self.atk += (narray[2] * sub_rate) / 100
        self.def += (narray[3] * sub_rate) / 100
        self.spi += (narray[4] * sub_rate) / 100
        self.agi += (narray[5] * sub_rate) / 100
      end
    end
    #-----
    if YE::SUBCLASS::BONUS_RANDOM_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_BONUS_RAN.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_BONUS_RAN[self.class.id]
        self.maxhp += (rand(narray[0]) * sub_rate) / 100 unless narray[0] == 0
        self.maxmp += (rand(narray[1]) * sub_rate) / 100 unless narray[1] == 0
        self.atk += (rand(narray[2]) * sub_rate) / 100 unless narray[2] == 0
        self.def += (rand(narray[3]) * sub_rate) / 100 unless narray[3] == 0
        self.spi += (rand(narray[4]) * sub_rate) / 100 unless narray[4] == 0
        self.agi += (rand(narray[5]) * sub_rate) / 100 unless narray[5] == 0
      end
    end
    #-----
    if YE::SUBCLASS::ALLOW_RETRO_LEARN and self.subclass != nil
      for i in self.subclass.learnings
        learn_skill(i.skill_id) if i.level <= @level
      end
    end
    #-----
    level_up_sss
  end
  
  #--------------------------------------------------------------------------
  # alias skills
  #--------------------------------------------------------------------------
  alias skills_sss skills unless $@
  def skills
    original_skills = skills_sss
    allowed_skills = YE::SUBCLASS::CLASS_SKILL_ALLOW[0]
    if YE::SUBCLASS::ACTOR_COMMON_SKILLS.include?(self.id)
      allowed_skills += YE::SUBCLASS::ACTOR_COMMON_SKILLS[self.id]
    end
    if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(self.class.id)
      allowed_skills += YE::SUBCLASS::CLASS_SKILL_ALLOW[self.class.id]
      if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(self.class.id)
        allowed_skills += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[self.class.id]
      end
    end
    unless self.subclass == nil
      allowed_skills += YE::SUBCLASS::CLASS_SKILL_ALLOW[self.subclass.id]
      if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(self.subclass.id)
        allowed_skills += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[self.subclass.id]
      end
    end
    result = []
    for skill in original_skills
      skill_id = skill.id
      result.push(skill) if allowed_skills.include?(skill_id)
    end
    return result
  end
  
  #--------------------------------------------------------------------------
  # skills_learned
  #--------------------------------------------------------------------------
  def skills_learned(class_id)
    result = []
    if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(class_id)
      class_skills = YE::SUBCLASS::CLASS_SKILL_ALLOW[class_id]
      if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(class_id)
        class_skills += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[class_id]
      end
      if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(class_id)
        class_skills += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[class_id]
      end
      for i in class_skills
        result.push($data_skills[i]) if @skills.include?(i)
      end
    end
    return result
  end
  
  #--------------------------------------------------------------------------
  # alias base stats
  #--------------------------------------------------------------------------
  alias base_maxhp_sss base_maxhp unless $@
  def base_maxhp
    n = base_maxhp_sss
    if YE::SUBCLASS::AFFECT_STATS_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[0]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
      n /= 100.0
    end
    if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[0]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
      n /= 100.0
    end
    boost = false
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      boost = true if check_hash.include?("maxhp up")
    end
    if self.subclass != nil and 
    YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
      boost = true if check_hash.include?("maxhp up")
    end
    if boost
      n *= YE::SUBCLASS::MAXHP_MULTIPLIER
      n /= 100
    end
    return Integer(n)
  end
  
  alias base_maxmp_sss base_maxmp unless $@
  def base_maxmp
    n = base_maxmp_sss
    if YE::SUBCLASS::AFFECT_STATS_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[1]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
      n /= 100.0
    end
    if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[1]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
      n /= 100.0
    end
    boost = false
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      boost = true if check_hash.include?("maxmp up")
    end
    if self.subclass != nil and 
    YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
      boost = true if check_hash.include?("maxmp up")
    end
    if boost
      n *= YE::SUBCLASS::MAXHP_MULTIPLIER
      n /= 100
    end
    return Integer(n)
  end
  
  alias base_atk_sss base_atk unless $@
  def base_atk
    n = base_atk_sss
    if YE::SUBCLASS::AFFECT_STATS_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[2]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
      n /= 100.0
    end
    if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[2]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
      n /= 100.0
    end
    boost = false
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      boost = true if check_hash.include?("atk up")
    end
    if self.subclass != nil and 
    YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
      boost = true if check_hash.include?("atk up")
    end
    if boost
      n *= YE::SUBCLASS::MAXHP_MULTIPLIER
      n /= 100
    end
    unless $imported["BattlerStatBarehand"]
      barehand_trait = false
      if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id) and
      self.weapons[0] == nil and self.weapons[1] == nil
        check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
        barehand_trait = true if check_hash.include?("barehanded")
        barehand_trait = true if check_hash.include?("barehands")
      end
      if self.subclass != nil and !barehand_trait
        if YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id) and
        self.weapons[0] == nil and self.weapons[1] == nil
        check_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH[self.subclass.id]
          barehand_trait = true if check_hash.include?("barehanded")
          barehand_trait = true if check_hash.include?("barehands")
        end
      end
      n = barehanded_multiplier(n) if barehand_trait
    end
    return Integer(n)
  end
  
  unless method_defined?(:barehanded_multiplier)
  def barehanded_multiplier(value)
    value *= YE::SUBCLASS::BAREHAND_MULTIPLIER
    value /= 100
    return value
  end
  end
  
  alias base_def_sss base_def unless $@
  def base_def
    n = base_def_sss
    if YE::SUBCLASS::AFFECT_STATS_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[3]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
      n /= 100.0
    end
    if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[3]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
      n /= 100.0
    end
    boost = false
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      boost = true if check_hash.include?("def up")
    end
    if self.subclass != nil and 
    YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
      boost = true if check_hash.include?("def up")
    end
    if boost
      n *= YE::SUBCLASS::MAXHP_MULTIPLIER
      n /= 100
    end
    return Integer(n)
  end
  
  alias base_spi_sss base_spi unless $@
  def base_spi
    n = base_spi_sss
    if YE::SUBCLASS::AFFECT_STATS_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[4]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
      n /= 100.0
    end
    if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[4]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
      n /= 100.0
    end
    boost = false
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      boost = true if check_hash.include?("spi up")
    end
    if self.subclass != nil and 
    YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
      boost = true if check_hash.include?("spi up")
    end
    if boost
      n *= YE::SUBCLASS::MAXHP_MULTIPLIER
      n /= 100
    end
    return Integer(n)
  end
  
  alias base_agi_sss base_agi unless $@
  def base_agi
    n = base_agi_sss
    if YE::SUBCLASS::AFFECT_STATS_PRIMARY
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[5]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
      n /= 100.0
    end
    if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
      if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
        narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
      else
        narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
      end
      n *= 100 + ((narray[5]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
      n /= 100.0
    end
    boost = false
    if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
      boost = true if check_hash.include?("agi up")
    end
    if self.subclass != nil and 
    YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
      check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
      boost = true if check_hash.include?("agi up")
    end
    if boost
      n *= YE::SUBCLASS::MAXHP_MULTIPLIER
      n /= 100
    end
    return Integer(n)
  end
  
  #--------------------------------------------------------------------------
  # return class_jp
  #--------------------------------------------------------------------------
  def class_jp(id_value)
    @class_jp = {} if @class_jp == nil
    @class_jp[id_value] = 0 if @class_jp[id_value] == nil
    limit = YE::SUBCLASS::MAX_JP_EARNED
    @class_jp[id_value] = [@class_jp[id_value], limit].min
    return @class_jp[id_value]
  end
  
  #--------------------------------------------------------------------------
  # action change jp
  #--------------------------------------------------------------------------
  def change_jp(id_value, jp_earned = 1)
    @class_jp = {} if @class_jp == nil
    @class_jp[id_value] = 0 if @class_jp[id_value] == nil
    @class_jp[id_value] += jp_earned
    limit = YE::SUBCLASS::MAX_JP_EARNED
    @class_jp[id_value] = [[@class_jp[id_value], limit].min, 0].max
  end
  
  #--------------------------------------------------------------------------
  # forget all skills
  #--------------------------------------------------------------------------
  def forget_all_skills
    @skills = []
  end
  
  #--------------------------------------------------------------------------
  # alias auto battle
  #--------------------------------------------------------------------------
  alias auto_battle_sss auto_battle unless $@
  def auto_battle
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("auto battle")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("auto battle")
    end
    auto_battle_sss
  end
  
  #--------------------------------------------------------------------------
  # alias super guard
  #--------------------------------------------------------------------------
  alias super_guard_sss super_guard unless $@
  def super_guard
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("super guard")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("super guard")
    end
    super_guard_sss
  end
  
  #--------------------------------------------------------------------------
  # alias pharmacology
  #--------------------------------------------------------------------------
  alias pharmacology_sss pharmacology unless $@
  def pharmacology
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("pharmacology")
      return true if pri_hash[self.class.id].include?("item boost")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("pharmacology")
      return true if sub_hash[self.subclass.id].include?("item boost")
    end
    pharmacology_sss
  end
  
  #--------------------------------------------------------------------------
  # alias fast attack
  #--------------------------------------------------------------------------
  alias fast_attack_sss fast_attack unless $@
  def fast_attack
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("fast attack")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("fast attack")
    end
    fast_attack_sss
  end
  
  #--------------------------------------------------------------------------
  # alias dual_attack
  #--------------------------------------------------------------------------
  alias dual_attack_sss dual_attack unless $@
  def dual_attack
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("dual attack")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("dual attack")
    end
    dual_attack_sss
  end
  
  #--------------------------------------------------------------------------
  # alias prevent_critical
  #--------------------------------------------------------------------------
  alias prevent_critical_sss prevent_critical unless $@
  def prevent_critical
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("prevent critical")
      return true if pri_hash[self.class.id].include?("prevent crit")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("prevent critical")
      return true if sub_hash[self.subclass.id].include?("prevent crit")
    end
    prevent_critical_sss
  end
  
  #--------------------------------------------------------------------------
  # alias half_mp_cost
  #--------------------------------------------------------------------------
  alias half_mp_cost_sss half_mp_cost unless $@
  def half_mp_cost
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("half mp cost")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("half mp cost")
    end
    half_mp_cost_sss
  end
  
  #--------------------------------------------------------------------------
  # alias double_exp_gain
  #--------------------------------------------------------------------------
  alias double_exp_gain_sss double_exp_gain unless $@
  def double_exp_gain
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("double exp gain")
      return true if pri_hash[self.class.id].include?("double exp")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("double exp gain")
      return true if sub_hash[self.subclass.id].include?("double exp")
    end
    double_exp_gain_sss
  end
  
  #--------------------------------------------------------------------------
  # alias auto_hp_recover
  #--------------------------------------------------------------------------
  alias auto_hp_recover_sss auto_hp_recover unless $@
  def auto_hp_recover
    pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
    sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
    if pri_hash.include?(self.class.id)
      return true if pri_hash[self.class.id].include?("auto hp recover")
      return true if pri_hash[self.class.id].include?("auto hp regen")
    end
    if self.subclass != nil and sub_hash.include?(self.subclass.id)
      return true if sub_hash[self.subclass.id].include?("auto hp recover")
      return true if sub_hash[self.subclass.id].include?("auto hp regen")
    end
    auto_hp_recover_sss
  end
  
end # end Game Actor

#==============================================================================
# Game_Troop
#==============================================================================

class Game_Troop < Game_Unit
  
  #--------------------------------------------------------------------------
  # JP Total
  #--------------------------------------------------------------------------
  def jp_total
    jp = 0
    for enemy in dead_members
      jp += enemy.enemy.enemy_jp unless enemy.hidden
    end
    return jp
  end
  
end # Game_Troop

#==============================================================================
# Window_Command (imported from KGC)
#==============================================================================

class Window_Command < Window_Selectable
unless method_defined?(:add_command)
  #--------------------------------------------------------------------------
  # add command
  #--------------------------------------------------------------------------
  def add_command(command)
    @commands << command
    @item_max = @commands.size
    item_index = @item_max - 1
    refresh_command
    draw_item(item_index)
    return item_index
  end
  #--------------------------------------------------------------------------
  # refresh command
  #--------------------------------------------------------------------------
  def refresh_command
    buf = self.contents.clone
    self.height = [self.height, row_max * WLH + 32].max
    create_contents
    self.contents.blt(0, 0, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # insert command
  #--------------------------------------------------------------------------
  def insert_command(index, command)
    @commands.insert(index, command)
    @item_max = @commands.size
    refresh_command
    refresh
  end
  #--------------------------------------------------------------------------
  # remove command
  #--------------------------------------------------------------------------
  def remove_command(command)
    @commands.delete(command)
    @item_max = @commands.size
    refresh
  end
end
end

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # alias process_battle_start
  #--------------------------------------------------------------------------
  alias process_battle_start_sss process_battle_start unless $@
  def process_battle_start
    for actor in $game_party.members
      actor.jp_counter = 0
    end
    process_battle_start_sss
  end
  
  #--------------------------------------------------------------------------
  # alias execute_action_guard
  #--------------------------------------------------------------------------
  alias execute_action_guard_sss execute_action_guard unless $@
  def execute_action_guard
    execute_action_guard_sss
    return unless @active_battler.actor?
    return unless YE::SUBCLASS::EARN_JP_VIA_GUARD_ENABLE
    amount  = YE::SUBCLASS::EARN_JP_VIA_GUARD_AMOUNT
    unless YE::SUBCLASS::EARN_JP_VIA_GUARD_RANDOM == 0
      amount += rand(YE::SUBCLASS::EARN_JP_VIA_GUARD_RANDOM)
    end
    @active_battler.gain_jp(amount)
  end
  
  #--------------------------------------------------------------------------
  # alias display_exp_and_gold
  #--------------------------------------------------------------------------
  alias display_exp_and_gold_sss display_exp_and_gold unless $@
  def display_exp_and_gold
    display_exp_and_gold_sss
    return unless YE::SUBCLASS::USE_JP_SYSTEM
    return unless YE::SUBCLASS::ENEMIES_GIVE_JP
    jp = $game_troop.jp_total
    if jp > 0
      text = sprintf(YE::SUBCLASS::ENEMIES_MESSAGE, $game_party.name, jp)
      $game_message.texts.push(text) if YE::SUBCLASS::ENEMIES_SHOW_MSG
    end
    if YE::SUBCLASS::DISPLAY_ACTOR_JP
      $game_message.new_page
    end
    for actor in $game_party.members
      actor.gain_jp(jp)
      next unless YE::SUBCLASS::DISPLAY_ACTOR_JP
      text = sprintf(YE::SUBCLASS::DISPLAY_ACTOR_MSG, actor.name, actor.jp_counter)
      $game_message.texts.push('>' + text)
    end
    wait_for_message if YE::SUBCLASS::DISPLAY_ACTOR_JP
  end
  
end

#===============================================================================
# Scene Menu
#===============================================================================

class Scene_Menu < Scene_Base
  
  #--------------------------------------------------------------------------
  # alias create command window
  #--------------------------------------------------------------------------
  alias create_command_window_sss create_command_window unless $@
  def create_command_window
    create_command_window_sss
    return if $imported["CustomMenuCommand"]
    if YE::SUBCLASS::MENU_CLASS_CHANGE_OPTION and
    $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH]
      scc_text = YE::SUBCLASS::MENU_CLASS_CHANGE_TITLE
      @command_class_change = @command_window.add_command(scc_text)
      if @command_window.oy > 0
        @command_window.oy -= Window_Base::WLH
      end
    end
    if YE::SUBCLASS::USE_JP_SYSTEM and YE::SUBCLASS::LEARN_SKILL_OPTION and
    $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH]
      scc_text = YE::SUBCLASS::LEARN_SKILL_TITLE
      @command_learn_skill = @command_window.add_command(scc_text)
      if @command_window.oy > 0
        @command_window.oy -= Window_Base::WLH
      end
    end
    @command_window.index = @menu_index
  end
  
  #--------------------------------------------------------------------------
  # alias update command selection
  #--------------------------------------------------------------------------
  alias update_command_selection_sss update_command_selection unless $@
  def update_command_selection
    call_yerd_command = 0
    if Input.trigger?(Input::C)
      case @command_window.index
      when @command_class_change
        call_yerd_command = 1
      when @command_learn_skill
        call_yerd_command = 1
      end
    end
    if call_yerd_command == 1
      if $game_party.members.size == 0
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      start_actor_selection
      return
    end
    update_command_selection_sss
  end
  
  #--------------------------------------------------------------------------
  # alias update actor selection
  #--------------------------------------------------------------------------
  alias update_actor_selection_sss update_actor_selection unless $@
  def update_actor_selection
    if Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when @command_class_change
        $scene = Scene_Class_Change.new(@status_window.index,
        @command_class_change)
        return
      when @command_learn_skill
        $scene = Scene_Learn_Skill.new(@status_window.index,
        @command_learn_skill)
        return
      end
    end
    update_actor_selection_sss
  end
  
end # Scene Menu

#===============================================================================
# Scene Class Change
#===============================================================================

class Scene_Class_Change < Scene_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, menu_index = nil)
    @actor_index = actor_index
    @menu_index = menu_index
  end
  
  #--------------------------------------------------------------------------
  # start process
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @actor_window = Window_Class_Change_Actor.new(@actor)
    @status_window = Window_Class_Change_Status.new(@actor)
    @class_window = Window_Class_Change_Jobs.new(@actor)
    create_command_window
    @class_window.refresh
  end
  
  #--------------------------------------------------------------------------
  # terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @actor_window.dispose
    @status_window.dispose
    @class_window.dispose
    @command_window.dispose
  end
  
  #--------------------------------------------------------------------------
  # return scene
  #--------------------------------------------------------------------------
  def return_scene
    if $imported["SceneStatusReDux"] and $game_temp.status_menu_flag
      $scene = Scene_Status.new(@actor_index, $game_temp.status_menu_index)
    elsif @menu_index == nil
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(@menu_index)
    end
  end
  
  #--------------------------------------------------------------------------
  # * Switch to Next Actor Screen
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Class_Change.new(@actor_index, @menu_index)
  end
  #--------------------------------------------------------------------------
  # * Switch to Previous Actor Screen
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Class_Change.new(@actor_index, @menu_index)
  end
  
  #--------------------------------------------------------------------------
  # frame update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    if @command_window.active
      update_command_window
    elsif @class_window.active
      update_class_window
    end
  end
  
  #--------------------------------------------------------------------------
  # create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    actions = []
    if $game_switches[YE::SUBCLASS::ALLOW_CHANGE_PRIMARY_SWITCH]
      actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_PRIM)
      @command_primary = actions.size - 1
    end
    if $game_switches[YE::SUBCLASS::ALLOW_CHANGE_SUBCLASS_SWITCH]
      actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_SUB)
      @command_sub = actions.size - 1
    end
    if YE::SUBCLASS::USE_JP_SYSTEM and
    $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH]
      actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_LEARN)
      @command_learn = actions.size - 1
    end
    actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_DONE)
    @command_done = actions.size - 1
    @command_window = Window_Command.new(160, actions, 1, actions.size)
    @command_window.x = 384
    @command_window.y = 0
    @command_window.height = 128
    @command_window.active = true
    @command_window.refresh
  end
  
  #--------------------------------------------------------------------------
  # update_command_window
  #--------------------------------------------------------------------------
  def update_command_window
    @command_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::UP)
      @class_window.refresh
    elsif Input.trigger?(Input::DOWN)
      @class_window.refresh
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      case @command_window.index
      when @command_done
        return_scene
      when @command_primary
        @last_index = @class_window.item_max + 1
        @command_window.active = false
        @class_window.active = true
        @class_window.refresh
      when @command_sub
        @last_index = @class_window.item_max + 1
        @command_window.active = false
        @class_window.active = true
        @class_window.refresh
      when @command_learn
        $scene = Scene_Learn_Skill.new(@actor_index, @menu_index)
      end
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  
  #--------------------------------------------------------------------------
  # update_class_window
  #--------------------------------------------------------------------------
  def update_class_window
    @class_window.update
    if @last_index != @class_window.index
      @temp_actor = @actor.clone
      if @command_window.index == @command_primary
        class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
        if @temp_actor.subclass_id == class_to_be.id
          unless YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(class_to_be.id)
            @temp_actor.subclass_clone = 0
          end
        end
        @temp_actor.class_clone = class_to_be.id
      elsif @command_window.index == @command_sub
        class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
        if @temp_actor.subclass_id == class_to_be.id
          @temp_actor.subclass_clone = 0
        else
          @temp_actor.subclass_clone = class_to_be.id
        end
      end
      @last_index = @class_window.index
      @status_window.refresh(@temp_actor)
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @class_window.active = false
      @status_window.refresh
      @temp_actor = nil
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when @command_primary
        determine_primary
      when @command_sub
        determine_subclass
      end
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  
  #--------------------------------------------------------------------------
  # determine primary
  #--------------------------------------------------------------------------
  def determine_primary
    class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
    if class_to_be == @actor.class
      Sound.play_buzzer
    elsif YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(class_to_be.id)
      Sound.play_buzzer
    elsif class_to_be == @actor.subclass
      Sound.play_equip
      @actor.class_id = class_to_be.id
      @actor.subclass_id = 0
      scene_refresh(@temp_actor)
    else
      Sound.play_equip
      @actor.class_id = class_to_be.id
      scene_refresh(@temp_actor)
    end
  end
  
  #--------------------------------------------------------------------------
  # determine subclass
  #--------------------------------------------------------------------------
  def determine_subclass
    class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
    if class_to_be == @actor.class
      Sound.play_buzzer
    elsif YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(class_to_be.id)
      Sound.play_buzzer
    else
      Sound.play_equip
      if @actor.subclass_id == class_to_be.id
        @actor.subclass_id = 0
      else
        @actor.subclass_id = class_to_be.id
      end
      scene_refresh(@temp_actor)
    end
  end
  
  #--------------------------------------------------------------------------
  # scene_refresh
  #--------------------------------------------------------------------------
  def scene_refresh(fake = nil)
    @actor_window.refresh
    @class_window.refresh
    @status_window.refresh(fake)
  end
  
  #--------------------------------------------------------------------------
  # index_primary
  #--------------------------------------------------------------------------
  def index_primary
    if @command_window != nil
      return true if @command_window.index == @command_primary
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # index_subclass
  #--------------------------------------------------------------------------
  def index_subclass
    if @command_window != nil
      return true if @command_window.index == @command_sub
    end
    return false
  end
  
end # Scene Class Change

#===============================================================================
# Scene Learn Skill
#===============================================================================

class Scene_Learn_Skill < Scene_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, menu_index = nil)
    @actor_index = actor_index
    @menu_index = menu_index
    @last_index = -100
  end
  
  #--------------------------------------------------------------------------
  # start process
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @help_window = Window_Help.new
    if $imported["HelpExtension"]
      @help_window.row_max = KGC::HelpExtension::ROW_MAX
    end
    dy = @help_window.height
    @status_window = Window_Learn_Skill_Status.new(384, dy, @actor)
    dy += 56
    dh = 416 - @help_window.height - 56
    @class_window = Window_Learn_Skill_Classes.new(0, dy, 384, dh, @actor)
    create_command_window
    create_skill_query
  end
  
  #--------------------------------------------------------------------------
  # terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @status_window.dispose
    @class_window.dispose
    @command_window.dispose
    @skill_data_window.dispose if @skill_data_window != nil
    @help_info_window.dispose if @help_info_window != nil
  end
  
  #--------------------------------------------------------------------------
  # return scene
  #--------------------------------------------------------------------------
  def return_scene
    if $imported["SceneStatusReDux"] and $game_temp.status_menu_flag
      $scene = Scene_Status.new(@actor_index, $game_temp.status_menu_index)
    elsif @menu_index == nil
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(@menu_index)
    end
  end
  
  #--------------------------------------------------------------------------
  # create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    actions = []
    actions.push(YE::SUBCLASS::LEARN_SKILL_SELECT)
    @command_select = actions.size - 1
    if YE::SUBCLASS::MENU_CLASS_CHANGE_OPTION and 
    $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH]
      actions.push(YE::SUBCLASS::LEARN_SKILL_CHANGE)
      @command_change = actions.size - 1
    end
    actions.push(YE::SUBCLASS::LEARN_SKILL_DONE)
    @command_done = actions.size - 1
    @command_window = Window_Command.new(384, actions, actions.size)
    @command_window.x = 0
    @command_window.y = @help_window.height
    @command_window.active = true
    @command_window.refresh
  end
  
  #--------------------------------------------------------------------------
  # create skill query
  #--------------------------------------------------------------------------
  def create_skill_query
    return unless $imported["DisplaySkillQuery"]
    return unless YE::SUBCLASS::ENABLE_SKILL_QUERY
    sdy = @help_window.height
    sdh = 416 - sdy
    @skill_data_window = Window_Skill_Data.new(0, sdy, 272, sdh)
    @skill_data_window.active = false
    @help_info_window = Window_Base.new(0, sdy, 384, 56)
    text = YE::SUBCLASS::QUERY_HELP_WIN_TEXT
    @help_info_window.contents.draw_text(2, 0, 344, 24, text, 1)
    @help_info_window.visible = false
  end
  
  #--------------------------------------------------------------------------
  # * Switch to Next Actor Screen
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Learn_Skill.new(@actor_index, @menu_index)
  end
  #--------------------------------------------------------------------------
  # * Switch to Previous Actor Screen
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Learn_Skill.new(@actor_index, @menu_index)
  end
  
  #--------------------------------------------------------------------------
  # frame update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    if $imported["DisplaySkillQuery"] and @skill_data_window.active
      update_skill_query_window
    elsif @command_window.active
      update_command_window
    elsif @class_window.active
      update_class_window
    elsif @skill_list_window != nil
      update_skill_list_window
    end
  end
  
  #--------------------------------------------------------------------------
  # update_skill_query_window
  #--------------------------------------------------------------------------
  def update_skill_query_window
    @skill_data_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @skill_data_window.disappear
      @skill_list_window.active = true
    elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
      @skill_data_window.previous_page
    elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
      @skill_data_window.next_page
    elsif Input.trigger?(Input::L)
      @skill_data_window.top_page
    elsif Input.trigger?(Input::R)
      @skill_data_window.bottom_page
    end
  end
  
  #--------------------------------------------------------------------------
  # update_command_window
  #--------------------------------------------------------------------------
  def update_command_window
    @command_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      case @command_window.index
      when @command_done
        return_scene
      when @command_select
        Sound.play_decision
        @class_window.active = true
        @command_window.active = false
        class_id = $data_classes[@actor.unlocked_classes[@class_window.index]].id
        @status_window.refresh(class_id)
        text = YE::SUBCLASS::LEARN_SKILL_STATUS_HELP
        @help_window.set_text(text)
      when @command_change
        $scene = Scene_Class_Change.new(@actor_index, @menu_index)
      end
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  
  #--------------------------------------------------------------------------
  # update_class_window
  #--------------------------------------------------------------------------
  def update_class_window
    @class_window.update
    if @last_index != @class_window.index
      class_id = $data_classes[@actor.unlocked_classes[@class_window.index]].id
      @status_window.refresh(class_id)
      @last_index = @class_window.index
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @class_window.active = false
      @command_window.active = true
      @status_window.refresh
      @help_window.set_text("")
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      class_id = $data_classes[@actor.unlocked_classes[@class_window.index]].id
      @skill_list_window = Window_Learn_Skill_List.new(@class_window, @actor, class_id)
      @skill_list_window.help_window = @help_window
      @class_window.active = false
      @class_window.visible = false
      show_query_info
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  
  #--------------------------------------------------------------------------
  # update_skill_list_window
  #--------------------------------------------------------------------------
  def update_skill_list_window
    @skill_list_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @class_window.active = true
      @class_window.visible = true
      @skill_list_window.dispose
      text = YE::SUBCLASS::LEARN_SKILL_STATUS_HELP
      @help_window.set_text(text)
      hide_query_info
    elsif Input.trigger?(Input::C)
      unless @skill_list_window.skill_id == nil
        skill = $data_skills[@skill_list_window.skill_id]
        if @actor.skill_learn?(skill)
          Sound.play_buzzer
        elsif skill.require_level >= @actor.level
          Sound.play_buzzer
        elsif !met_skill_requirements(skill)
          Sound.play_buzzer
        elsif skill.jp_cost > @actor.class_jp(@skill_list_window.class_id)
          Sound.play_buzzer
        else
          YE::SUBCLASS::LEARN_SKILL_SHOP_SOUND.play
          @actor.learn_skill(skill.id)
          @actor.change_jp(@skill_list_window.class_id, -skill.jp_cost)
          @skill_list_window.refresh
          @status_window.refresh(@skill_list_window.class_id)
          @class_window.refresh
        end
      end
    elsif $imported["DisplaySkillQuery"] and 
    Input.trigger?(YE::SUBCLASS::SHOW_QUERY_BUTTON)
      if @skill_list_window.skill_id == nil
        skill = nil
      else
        skill = $data_skills[@skill_list_window.skill_id]
      end
      if skill != nil
        Sound.play_decision
        @skill_data_window.appear(skill, @skill_list_window, @actor, 2)
        @skill_list_window.active = false
      else
        Sound.play_buzzer
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # met skill requirements
  #--------------------------------------------------------------------------
  def met_skill_requirements(skill)
    return true if skill.require_skill == []
    total_met = 0
    for skill_id in skill.require_skill
      if @actor.skill_learn?($data_skills[skill_id])
        total_met += 1
      end
    end
    if total_met == skill.require_skill.size
      return true
    else
      return false
    end
  end
  
  #--------------------------------------------------------------------------
  # show/hide query info
  #--------------------------------------------------------------------------
  def show_query_info
    return unless $imported["DisplaySkillQuery"]
    return unless YE::SUBCLASS::SHOW_QUERY_HELP_WIN
    @help_info_window.visible = true
    @command_window.visible = false
  end
  
  def hide_query_info
    return unless $imported["DisplaySkillQuery"]
    return unless YE::SUBCLASS::SHOW_QUERY_HELP_WIN
    @help_info_window.visible = false
    @command_window.visible = true
  end
  
end # Scene_Learn_Skill

#===============================================================================
# Scene Title
#===============================================================================

class Scene_Title < Scene_Base
  
  #--------------------------------------------------------------------------
  # alias create game objects
  #--------------------------------------------------------------------------
  alias create_game_objects_sss create_game_objects unless $@
  def create_game_objects
    create_game_objects_sss
    $game_switches[YE::SUBCLASS::ALLOW_CHANGE_PRIMARY_SWITCH] = true
    $game_switches[YE::SUBCLASS::ALLOW_CHANGE_SUBCLASS_SWITCH] = true
    $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH] = true
    $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH] = true
  end
  
end # Scene_Title

#===============================================================================
# Window_Base
#===============================================================================

class Window_Base < Window
  
  #--------------------------------------------------------------------------
  # Draw Actor Class
  #--------------------------------------------------------------------------
  def draw_actor_class(actor, x, y, wd = 120, align = 0)
    if actor.subclass == nil
      text = actor.class.name
    else
      text = sprintf(YE::SUBCLASS::DISPLAY_FORMAT, actor.class.name,
      actor.subclass.name)
    end
    if YE::SUBCLASS::USE_COMPLEX_CLASS_NAMES
      if YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL.include?(text)
        text = YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL[text]
      end
    end
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, wd, WLH, text, align)
  end
  
  #--------------------------------------------------------------------------
  # Draw Actor Class Abbreviated
  #--------------------------------------------------------------------------
  def draw_actor_class_abbr(actor, x, y, wd = 120, align = 0)
    if actor.subclass == nil
      text = YE::SUBCLASS::CLASS_ABBREVIATIONS[actor.class.id]
    else
      class1 = YE::SUBCLASS::CLASS_ABBREVIATIONS[actor.class.id]
      class2 = YE::SUBCLASS::CLASS_ABBREVIATIONS[actor.subclass.id]
      text = sprintf(YE::SUBCLASS::DISPLAY_FORMAT, class1, class2)
    end
    if YE::SUBCLASS::USE_COMPLEX_CLASS_NAMES
      if YE::SUBCLASS::COMPLEX_CLASS_NAMES_ABBR.include?(text)
        text = YE::SUBCLASS::COMPLEX_CLASS_NAMES_ABBR[text]
      end
    end
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, wd, WLH, text, align)
  end
  
end

#===============================================================================
# Window Class Change Actor
#===============================================================================

class Window_Class_Change_Actor < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 384, 128)
    @actor = actor
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_face(@actor, 0, 0)
    y = 0
    draw_actor_name(@actor, 116, y)
    if YE::SUBCLASS::CLASS_ICONS.include?(@actor.class.id)
      icon = YE::SUBCLASS::CLASS_ICONS[@actor.class.id]
    else
      icon = YE::SUBCLASS::CLASS_ICONS[0]
    end
    if @actor.subclass != nil
      y += WLH
      draw_actor_class(@actor, 116, y, 200, 0)
    end
    y += WLH
    sety = y
    draw_icon(icon, 116, y)
    self.contents.draw_text(140, y, 112, WLH, @actor.class.name, 0)
    if @actor.subclass != nil
      if YE::SUBCLASS::CLASS_ICONS.include?(@actor.subclass.id)
        icon = YE::SUBCLASS::CLASS_ICONS[@actor.subclass.id]
      else
        icon = YE::SUBCLASS::CLASS_ICONS[0]
      end
      y += WLH
      draw_icon(icon, 116, y)
      self.contents.draw_text(140, y, 112, WLH, @actor.subclass.name, 0)
    end
    if YE::SUBCLASS::USE_JP_SYSTEM
      y = sety
      icon = YE::SUBCLASS::JP_ICON
      draw_icon(icon, 256, y)
      class_id = @actor.class.id
      text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(class_id))
      self.contents.draw_text(268, y, 80, WLH, text, 2)
      y += WLH
      if @actor.subclass != nil
        draw_icon(icon, 256, y)
        class_id = @actor.subclass.id
        text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(class_id))
        self.contents.draw_text(268, y, 80, WLH, text, 2)
      end
    end
  end # end refresh
  
end # End Window Class Change Actor

#==============================================================================
# Window_Class_Change_Jobs
#==============================================================================

class Window_Class_Change_Jobs < Window_Selectable
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(272, 128, 272, 288)
    @actor = actor
    @column_max = 1
    self.index = 0
    self.active = false
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for class_id in @actor.unlocked_classes
      @data.push(class_id)
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  
  #--------------------------------------------------------------------------
  # draw item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    iclass = $data_classes[@actor.unlocked_classes[index]]
    if iclass.id != 0
      rect.width -= 4
      enabled = true
      enabled = false if iclass == @actor.class
      enabled = false if iclass == @actor.subclass
      if $scene.index_primary
        if YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(iclass.id)
          enabled = false
        end
      elsif $scene.index_subclass
        if YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(iclass.id)
          enabled = false
        end
      end
      if YE::SUBCLASS::CLASS_ICONS.include?(iclass.id)
        icon = YE::SUBCLASS::CLASS_ICONS[iclass.id]
      else
        icon = YE::SUBCLASS::CLASS_ICONS[0]
      end
      draw_icon(icon, rect.x, rect.y, enabled)
      dx = rect.x
      dy = rect.y
      dw = rect.width
      dh = rect.height
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(dx+24, dy, dw-48, dh, iclass.name, 0)
      if YE::SUBCLASS::USE_JP_SYSTEM
        icon = YE::SUBCLASS::JP_ICON
        draw_icon(icon, rect.width-24, rect.y, enabled)
        jp = @actor.class_jp(iclass.id)
        self.contents.draw_text(dw-104, dy, 80, dh, jp, 2)
      end
    end
  end
  
end # Window_Class_Change_Jobs

#===============================================================================
# Window Class Change Status
#===============================================================================

class Window_Class_Change_Status < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 272, 288)
    @real = actor
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh(fake = nil)
    self.contents.clear
    self.contents.font.color = normal_color
    if YE::SUBCLASS::CLASS_ICONS.include?(@real.class.id)
      icon1 = YE::SUBCLASS::CLASS_ICONS[@real.class.id]
    else
      icon1 = YE::SUBCLASS::CLASS_ICONS[0]
    end
    if @real.subclass != nil
      if YE::SUBCLASS::CLASS_ICONS.include?(@real.subclass.id)
        icon2 = YE::SUBCLASS::CLASS_ICONS[@real.subclass.id]
      else
        icon2 = YE::SUBCLASS::CLASS_ICONS[0]
      end
      draw_icon(icon2, 50, 0)
    end
    draw_icon(icon1, 26, 0)
    self.contents.font.color = system_color
    draw_actor_class_abbr(@real, 80, 0, 60, 2)
    dx = 0
    dy = WLH
    self.contents.font.color = system_color
    for i in 0..5
      text = YE::SUBCLASS::MENU_CLASS_CHANGE_PARAM[i]
      icon = YE::SUBCLASS::MENU_CLASS_CHANGE_ICONS[i]
      draw_icon(icon, dx, dy)
      self.contents.draw_text(dx+24, dy, 60, WLH, text, 0)
      dy += WLH
    end
    dx += 80
    dy = WLH
    self.contents.font.color = normal_color
    for i in 0..5
      case i
      when 0
        text = @real.maxhp
      when 1
        text = @real.maxmp
      when 2
        text = @real.atk
      when 3
        text = @real.def
      when 4
        text = @real.spi
      when 5
        text = @real.agi
      end
      self.contents.draw_text(dx, dy, 60, WLH, text, 2)
      dy += WLH
    end
    dx += 60
    dy = 0
    self.contents.font.color = system_color
    if YE::SUBCLASS::MENU_CLASS_CHANGE_USE_ICON
      icon = YE::SUBCLASS::MENU_CLASS_CHANGE_ICON
      for i in 0..6
        draw_icon(icon, dx+3, dy)
        dy += WLH
      end
    else
      text = YE::SUBCLASS::MENU_CLASS_CHANGE_ARROW
      for i in 0..6
        self.contents.draw_text(dx, dy, 30, WLH, text, 1)
        dy += WLH
      end
    end
    return if fake == nil
    dx += 30
    dy = WLH
    draw_actor_class_abbr(fake, dx, 0, 60, 0)
    for i in 0..5
      case i
      when 0
        old = @real.maxhp
        new = fake.maxhp
      when 1
        old = @real.maxmp
        new = fake.maxmp
      when 2
        old = @real.atk
        new = fake.atk
      when 3
        old = @real.def
        new = fake.def
      when 4
        old = @real.spi
        new = fake.spi
      when 5
        old = @real.agi
        new = fake.agi
      end
      self.contents.font.color = new_parameter_color(old, new)
      if YE::SUBCLASS::MENU_CLASS_CHANGE_SDISPLAY == 1
        text = new
      else
        text = sprintf("%+d", new - old)
      end
      self.contents.draw_text(dx, dy, 60, WLH, text, 0)
      dy += WLH
    end
  end
  
  #--------------------------------------------------------------------------
  # New Parameter Colour
  #--------------------------------------------------------------------------
  def new_parameter_color(old_value, new_value)
    if new_value > old_value
      return power_up_color
    elsif new_value == old_value
      return normal_color
    else
      return power_down_color
    end
  end
  
end # End Window Class Change Status

#===============================================================================
# Window Learn Skill Status
#===============================================================================

class Window_Learn_Skill_Status < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    dh = 416 - y
    super(x, y, 160, dh)
    @actor = actor
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh(class_id = nil)
    self.contents.clear
    sw = self.width - 32
    dx = (sw / 2) - 48
    dy = 0
    self.contents.draw_text(0, dy, sw, WLH, @actor.name, 1)
    dy += WLH
    draw_actor_face(@actor, dx, dy)
    return if class_id == nil
    
    dy += WLH * 4
    if YE::SUBCLASS::CLASS_ICONS.include?(class_id) and class_id != nil
      icon = YE::SUBCLASS::CLASS_ICONS[class_id]
    else
      icon = YE::SUBCLASS::CLASS_ICONS[0]
    end
    draw_icon(icon, 0, dy)
    text = $data_classes[class_id].name
    self.contents.draw_text(24, dy, sw-24, WLH, text, 0)
    
    dy += WLH
    skills_learned = @actor.skills_learned(class_id).size
    if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(class_id)
      skill_size = YE::SUBCLASS::CLASS_SKILL_ALLOW[class_id].size
      if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(class_id)
        skill_size += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[class_id].size
      end
      if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(class_id)
        skill_size += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[class_id].size
      end
      if skills_learned == skill_size
        text = YE::SUBCLASS::LEARN_SKILL_STATUS_ALL
      else
        mastery = skills_learned * 100
        mastery /= skill_size
        text = sprintf(YE::SUBCLASS::LEARN_SKILL_STATUS_LEARNED, mastery)
      end
      self.contents.draw_text(0, dy, sw, WLH, text, 1)
    end
    dy += WLH
    icon = YE::SUBCLASS::JP_ICON
    draw_icon(icon, 0, dy)
    text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(class_id))
    self.contents.draw_text(24, dy, sw-24, WLH, text, 2)
  end
  
end # end class Window_Learn_Skill_Status

#==============================================================================
# Window_Learn_Skill_Classes
#==============================================================================

class Window_Learn_Skill_Classes < Window_Selectable
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(wx, wy, ww, wh, actor)
    super(wx, wy, ww, wh)
    @actor = actor
    @column_max = 1
    self.index = 0
    self.active = false
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for class_id in @actor.unlocked_classes
      @data.push(class_id)
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  
  #--------------------------------------------------------------------------
  # draw item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    iclass = $data_classes[@actor.unlocked_classes[index]]
    if iclass.id != 0
      rect.width -= 4
      if YE::SUBCLASS::CLASS_ICONS.include?(iclass.id)
        icon = YE::SUBCLASS::CLASS_ICONS[iclass.id]
      else
        icon = YE::SUBCLASS::CLASS_ICONS[0]
      end
      draw_icon(icon, rect.x, rect.y)
      dx = rect.x
      dy = rect.y
      dw = rect.width
      dh = rect.height
      self.contents.draw_text(dx+24, dy, 172, dh, iclass.name, 0)
      icon = YE::SUBCLASS::JP_ICON
      draw_icon(icon, rect.width-24, rect.y)
      text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(iclass.id))
      self.contents.draw_text(dw-104, dy, 80, dh, text, 2)
    end
  end
  
end # Window_Learn_Skill_Classes

#==============================================================================
# Window_Learn_Skill_List
#==============================================================================

class Window_Learn_Skill_List < Window_Selectable
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(window, actor, class_id)
    wx = window.x
    wy = window.y
    ww = window.width
    wh = window.height
    super(wx, wy, ww, wh)
    @actor = actor
    @class_id = class_id
    @column_max = 1
    self.index = 0
    self.active = true
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(@class_id)
      class_skills = YE::SUBCLASS::CLASS_SKILL_ALLOW[@class_id]
      if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(@class_id)
        class_skills += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[@class_id]
      end
      if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(@class_id)
        class_skills += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[@class_id]
      end
      for skill_id in class_skills
        @data.push(skill_id) if $data_skills[skill_id].jp_learn?
      end
    end
    for skill in @actor.skills_learned(@class_id)
      @data.push(skill.id)# unless @data.include?(skill.id)
    end
    @data = @data.uniq
    @data.sort!
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  
  #--------------------------------------------------------------------------
  # draw item
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = $data_skills[@data[index]]
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    rect.width -= 4
    enabled = true
    enabled = false if @actor.skill_learn?(skill)
    enabled = false if skill.require_level >= @actor.level
    enabled = false if skill.jp_cost > @actor.class_jp(@class_id)
    if skill.require_skill == []
      met_skill_requirements = true
    else
      met_skill_requirements = false
      total_met = 0
      reqicon = 0
      for skill_id in skill.require_skill
        if @actor.skill_learn?($data_skills[skill_id])
          total_met += 1
        else
          reqicon = $data_skills[skill_id].icon_index if reqicon == 0
        end
      end
      met_skill_requirements = true if total_met == skill.require_skill.size
    end
    enabled = false unless met_skill_requirements
    dx = rect.x
    dy = rect.y
    dw = rect.width
    dh = rect.height
    sw = self.width - 32
    draw_icon(skill.icon_index, dx, dy, enabled)
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(dx+24, dy, 172, dh, skill.name, 0)
    
    icon = YE::SUBCLASS::JP_ICON
    if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(@class_id) and
    YE::SUBCLASS::PRIMARY_ONLY_SKILLS[@class_id].include?(skill.id)
      icon = YE::SUBCLASS::PRIMARY_ONLY_ICON
    elsif YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(@class_id) and
    YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[@class_id].include?(skill.id)
      icon = YE::SUBCLASS::SUBCLASS_ONLY_ICON
    end
    
    if @actor.skill_learn?(skill)
      text = YE::SUBCLASS::LEARN_SKILL_SHOP_LEARNED
    elsif skill.require_level >= @actor.level
      text = sprintf(YE::SUBCLASS::REQUIRE_LEVEL, skill.require_level)
    elsif !met_skill_requirements
      text = YE::SUBCLASS::REQUIRE_SKILL
      icon = reqicon
    else
      text = sprintf(YE::SUBCLASS::LEARN_SKILL_SHOP_STRING, skill.jp_cost)
    end
    
    self.contents.draw_text(dw-104, dy, 80, dh, text, 2)
    draw_icon(icon, dw-24, dy, enabled)
  end
  
  #--------------------------------------------------------------------------
  # Skill
  #--------------------------------------------------------------------------
  def skill_id
    return @data[self.index]
  end
  
  #--------------------------------------------------------------------------
  # class_id
  #--------------------------------------------------------------------------
  def class_id
    return @class_id
  end
  
  #--------------------------------------------------------------------------
  # update help
  #--------------------------------------------------------------------------
  def update_help
    if self.skill_id != nil
      skill = $data_skills[self.skill_id]
    else
      skill = nil
    end
    @help_window.set_text(skill==nil ? "" : skill.description)
  end
  
end # Window_Learn_Skill_List

#===============================================================================
#
# END OF FILE
#
#===============================================================================
 
 
Untitled-1 copy.jpg 
Untitled-2 copy.jpg 
Untitled-3 copy.jpg 
 
 
 
 
   

Who's 카르와푸딩의아틀리에

profile

엘카르디아 제작자 (현재 MV로 리메이크중)

유튜브

https://www.youtube.com/channel/UCMwirNTR-pOEzJNB0jL3y_g

트위터

https://twitter.com/karsis98

블로그

https://blog.naver.com/karsis98

Comment '7'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5453
337 이동 및 탈것 대쉬금지의 변경 1 rukan 2009.07.02 1456
336 기타 배틀신에서 곡 넘기기 2 rukan 2009.07.02 1759
335 HUD HUD HP / MP 게이지바 스크립트 29 file 아방스 2009.07.02 5681
334 온라인 VX Phoenix 온라인 스크립트 Ver 1.5 36 아방스 2009.07.02 5512
333 기타 페이드 시간 변경 2 rukan 2009.07.01 1362
332 오디오 사운드 자동 변환 설정 rukan 2009.07.01 1463
331 이동 및 탈것 탈것탑승후 내부로 이동하는 스크립트 16 file 카르와푸딩의아틀리에 2009.07.01 3273
330 기타 밤낮의 변화에 따른 전투배경의 변화 스크립트 10 file 카르와푸딩의아틀리에 2009.07.01 2950
329 기타 높이(층)를 설정하는 스크립트 11 file 카르와푸딩의아틀리에 2009.07.01 3345
328 전투 RPGTankentai SBS3.3b 버전 (사이드뷰) 21 file 카르와푸딩의아틀리에 2009.07.01 8458
327 전투 WGB배틀 시스템. 59 file 카르와푸딩의아틀리에 2009.06.30 8780
326 기타 회피,명중,크리 스테이트를 작성하는 스크립트 9 카르와푸딩의아틀리에 2009.06.30 2396
325 메뉴 전투 결과 팝업 스크립트 12 file 카르와푸딩의아틀리에 2009.06.30 3384
324 메뉴 몬스터도감 심플버전! 52 file 카르와푸딩의아틀리에 2009.06.30 6911
323 이동 및 탈것 달리면 스태미너가 감소하는 스크립트 18 file 카르와푸딩의아틀리에 2009.06.30 2874
322 기타 미니게임 로또??일까? 14 file 카르와푸딩의아틀리에 2009.06.30 2578
321 메시지 어드밴스 텍스트 시스템 13 file 카르와푸딩의아틀리에 2009.06.30 4920
320 기타 시야범위 스크립트 22 file 카르와푸딩의아틀리에 2009.06.30 4027
319 기타 미니게임테트리스 스크립트 ㅋㅋㅋ 27 file 카르와푸딩의아틀리에 2009.06.30 3692
» 직업 서브클래스 선택 시스템 Subclass Selection System 7 file 카르와푸딩의아틀리에 2009.06.30 3952
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ... 32 Next
/ 32