Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Yanfly Engine Zealous - Job System: Classes
- # Last Date Updated: 2010.01.28
- # Level: Normal, Hard
- #
- # There's been many class switching scripts but rarely any scripts that added
- # subclasses. This script offers both features along with many adjustable rules
- # regarding the whole class switching process and easy to adapt scenes. For
- # those who are familiar with YERD's Subclass Selection System, this script will
- # function very similarly but will withhold its own unique set of rules and
- # customization properties as well. Furthermore, this script is also independent
- # of the Job System: Base script and can function without it (though I highly
- # recommend the two to be used in conjunction with each other to achieve the
- # most optimal effect).
- #
- #===============================================================================
- # Updates
- # -----------------------------------------------------------------------------
- # o 2010.01.28 - Efficiency update.
- # o 2010.01.22 - Equipment Overhaul Compatibility.
- # - Compatibility access to Weapon Mastery Skills.
- # - Compatibility access to BEZ Formation Macros
- # o 2010.01.10 - Job System: Passives Compatibility.
- # o 2010.01.04 - Started Script and Finished.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # -----------------------------------------------------------------------------
- # Debug Shortcuts - Only during $TEST and $BTEST mode
- # -----------------------------------------------------------------------------
- # During testplay mode, pressing F7 or F8 at the learning class menus will
- # lower or raise the classes' JP totals by 1000 + rand(1000).
- #
- #===============================================================================
- # Compatibility
- # -----------------------------------------------------------------------------
- # - Works With: YEZ Job System Scripts, YEZ Main Menu Zealous
- # - Requires: YEZ Skill Command Selection
- # -----------------------------------------------------------------------------
- # Note: This script may not work with former Yanfly Engine ReDux scripts.
- # Use Yanfly Engine Zealous scripts to work with this if available.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["JobSystemClasses"] = true
- module YEZ
- module JOB
- #===========================================================================
- # Basic Settings
- # --------------------------------------------------------------------------
- # The following below will adjust the basic settings and vocabulary that
- # will display throughout the script. Change them as you see fit.
- #===========================================================================
- # This adjusts the Class scene Info.
- CLASS_TITLE = "Class"
- CLASS_ICON = 131
- # These two switches adjust whether or not primary classes and subclasses
- # are accessible from the menu. If either switch is on, the "Class" menu
- # command will be enabled and shows up.
- ENABLE_1STCLASS_SWITCH = 46
- ENABLE_SUBCLASS_SWITCH = 47
- # This array determines the items shown and displayed in the class menu.
- # Rearrange them accordingly. The following options are available:
- # :primary Allows player to switch actor's primary class.
- # :subclass Allows player to switch actor's subclass.
- # :passives Requires Job System: Passives
- # :skill Allows player to enter the skill menu scene.
- # :equip Allows player to enter the equip menu scene.
- CLASS_COMMANDS =[
- :primary, # Allows player to switch actor's primary class.
- :subclass, # Allows player to switch actor's subclass.
- :formations, # Requires BEZ Formation Macros.
- :mastery, # Requires Weapon Mastery Skills
- # :passives, # Requires Job System: Passives
- # :skill, # Allows player to enter the skill menu scene.
- # :equip, # Allows player to enter the equip menu scene.
- ] # Do not remove this.
- # The following hash adjusts the text displayed for this script. Adjust
- # them accordingly to how you want them to show up.
- CLASS_VOCAB ={
- :primary => "Primary",
- :subclass => "Subclass",
- :formations => "Tactics",
- :mastery => "Weaponry",
- :passives => "Passives",
- :skill => "Skills",
- :equip => "Equipment",
- :arrow => "→",
- :list => "Acquired Skills",
- } # Do not remove this.
- # This will create a centered command window for the scene.
- CLASS_CENTERED_COMMAND = true
- # The following hash adjusts which classes are unlocked for the actor by
- # default. Note that actor ID 0 is unlocked for the party, which means all
- # actors have access to it.
- UNLOCKED_1STCLASS ={
- # ActorID => [Unlocked Classes]
- 0 => [1..8],
- 1 => [8],
- 2 => [7],
- 3 => [5],
- 4 => [6],
- } # Do not remove this,
- # The following hash adjusts which subclasses are unlocked for the actor by
- # default. Note that actor ID 0 is unlocked for the party, which means all
- # actors have access to it.
- UNLOCKED_SUBCLASS ={
- # ActorID => [Unlocked Classes]
- 0 => [1..8]
- } # Do not remove this.
- #===========================================================================
- # Class Stat Settings
- # --------------------------------------------------------------------------
- # Since not all classes will have the same stat distributions, this script
- # will allow for some classes to have higher MaxHP than others, or lower
- # ATK than others, etc. Adjust the following settings accordingly.
- #===========================================================================
- # This hash adjusts the stats calculated for each stat. Some stats that
- # appear here are not available in the database by default and require YEZ
- # scripts to function. If the respective scripts do not exist, this script
- # will still function.
- CLASS_STATS ={ # Do not remove class 0.
- # ID => [ HP, MP, ATK, DEF, SPI, RES, DEX, AGI]
- 0 => [ 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00], # Common
- 1 => [ 1.50, 1.00, 1.25, 1.25, 1.00, 1.00, 1.00, 1.50], # Knight
- 2 => [ 1.75, 1.00, 1.50, 1.50, 0.50, 0.50, 2.00, 1.00], # Warrior
- 3 => [ 0.85, 1.50, 0.50, 0.75, 1.25, 2.00, 1.25, 1.25], # Priest
- 4 => [ 0.75, 2.00, 0.50, 0.75, 2.00, 1.25, 1.25, 1.25], # Magician
- 5 => [ 1.25, 1.25, 1.50, 1.25, 0.75, 1.50, 1.25, 0.75], # Paladin
- 6 => [ 1.25, 1.25, 1.50, 1.25, 1.50, 0.75, 0.75, 1.25], # Dark Knight
- 7 => [ 2.00, 0.75, 2.00, 0.75, 0.50, 0.50, 2.00, 1.25], # Grappler
- 8 => [ 0.65, 1.50, 1.00, 0.75, 0.75, 0.75, 1.75, 2.00], # Thief
- } # Do not remove this.
- # This adjusts the multiplier rate each class has an effect on for the
- # base stats calculated.
- PRIMARY_MULTIPLIER = 1.00
- SUBCLASS_MULTIPLIER = 0.50
- # When characters level up, they can receive stat bonuses depending on
- # what their primary class and subclass are. Adjust the hash below to
- # change the way stat growths work for each class.
- CLASS_BONUSES ={ # Do not remove class 0.
- # ID => [ HP, MP, ATK, DEF, SPI, RES, DEX, AGI]
- 0 => [ 0, 0, 0, 0, 0, 0, 0, 0], # Common
- 1 => [ 10, 0, 3, 6, 0, 0, 0, 6], # Knight
- 2 => [ 20, 0, 6, 3, 0, 0, 6, 0], # Warrior
- 3 => [ 0, 10, 0, 3, 3, 6, 0, 0], # Priest
- 4 => [ 0, 10, 0, 0, 6, 3, 3, 0], # Magician
- 5 => [ 5, 0, 3, 3, 0, 6, 3, 0], # Paladin
- 6 => [ 5, 0, 3, 3, 6, 0, 3, 0], # Dark Knight
- 7 => [ 30, 0, 6, 0, 0, 0, 6, 3], # Grappler
- 8 => [ 0, 0, 3, 0, 0, 0, 6, 6], # Thief
- } # Do not remove this.
- # This adjusts the rate of growth for both the primary class and the
- # subclass equipped at the time of the level up. If the rate is 0.00, then
- # there will be no bonus growth rate at all.
- PRIMARY_BONUS_RATE = 1.00
- SUBCLASS_BONUS_RATE = 0.00
- # To add more variability for your characters, each class can have a random
- # stat growth amount. Note that values 0 and 1 won't do anything. Only from
- # a value of 2 and onward will actually have an effect.
- CLASS_RANDOM ={ # Do not remove class 0.
- # ID => [ HP, MP, ATK, DEF, SPI, RES, DEX, AGI]
- 0 => [ 0, 0, 0, 0, 0, 0, 0, 0], # Common
- 1 => [ 5, 0, 2, 4, 0, 0, 0, 4], # Knight
- 2 => [ 10, 0, 4, 2, 0, 0, 4, 0], # Warrior
- 3 => [ 0, 0, 0, 2, 2, 4, 0, 0], # Priest
- 4 => [ 0, 0, 0, 0, 4, 2, 2, 0], # Magician
- 5 => [ 3, 0, 2, 2, 0, 4, 2, 0], # Paladin
- 6 => [ 3, 0, 2, 2, 2, 0, 2, 0], # Dark Knight
- 7 => [ 15, 0, 4, 0, 0, 0, 4, 2], # Grappler
- 8 => [ 0, 0, 2, 0, 0, 0, 4, 4], # Thief
- } # Do not remove this.
- # This adjusts the rate of the random stat growth for both the primary and
- # subclass equipped at the time of the level up. If the rate is 0.00, then
- # there will be no random growth rate at all.
- PRIMARY_RANDOM_RATE = 1.00
- SUBCLASS_RANDOM_RATE = 0.00
- # If Job System: Base is installed, this adjusts how much JP the subclass
- # earns whenever JP is gained.
- SUBCLASS_JP_MULTIPLIER = 0.5
- # This adjusts whether or not subclasses can share weapons or armour
- # equips with the main class.
- SUBCLASS_WEAPONS = true
- SUBCLASS_ARMOURS = false
- #===========================================================================
- # Skill Settings
- # --------------------------------------------------------------------------
- # Here, you can set which skills will be considered primary-only skills and
- # which skills will be considered subclass-only. This means that certain
- # skills will only appear usable if the primary class is equipped or if the
- # subclass is equipped. If skills exist in either case, they're usable by
- # all standards. If you have Job System: Base installed, the skills within
- # the CLASS_SKILLS hash will be usable regardless of primary/subclass-only.
- #===========================================================================
- # Common skills are usable by all classes but cannot be learned through JP
- # unless it exists within the CLASS_SKILLS hash inside of the Job System:
- # Base script. Insert here what you wish to be common skills.
- COMMON_SKILLS = []
- # This hash adjusts the primary only skills. If a class doesn't exist here,
- # then that class doesn't have any primary-only skills.
- PRIMARY_ONLY_SKILLS ={
- #ID => [Skills]
- 1 => [164..166, 168],
- 2 => [163..166, 168, 169],
- 3 => [170, 172],
- 4 => [170, 172],
- 5 => [164, 172],
- 6 => [164, 169],
- 7 => [163, 167],
- 8 => [167, 171],
- } # Do not remove this.
- # This hash adjusts the subclass only skills.
- SUBCLASS_ONLY_SKILLS ={
- #ID => [Skills]
- 1 => [],
- 2 => [],
- 3 => [],
- 4 => [],
- } # Do not remove this.
- #===========================================================================
- # Display Settings
- # --------------------------------------------------------------------------
- # This part adjusts the way classes are displayed in the various menus.
- # Here, you can allow class name combinations, give special cases for those
- # said combinations, and more. Class icons are also defined here.
- #===========================================================================
- # This adjusts the colour of the primary class and subclass inside of the
- # clas changing windows.
- PRIMARY_COLOUR = 6
- SUBCLASS_COLOUR = 6
- # This adjusts the way class orders are displayed within the class list
- # windows whenever they appear.
- CLASS_ORDER = [1..4, 5, 6, 7, 8]
- # This determines which stats will be drawn inside of the class change data
- # window in the lower right corner of the class scene.
- # :maxhp, :maxmp, :atk, :def, :spi, :res; :dex; :agi
- SHOWN_CLASS_STATS = [:maxhp, :maxmp, :atk, :def, :spi, :res, :dex, :agi]
- # 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 adjusts the class display name type. Here are the various settings
- # in regards to the class name settings.
- # 0 - Primary only
- # 1 - Primary unless there is a combination name.
- # 2 - Primary/Secondary unless there is a combination name.
- # 3 - Primary/Secondary only
- CLASS_NAME_DISPLAY = 1
- # The following here adjusts class combination names. If a combination
- # here matches, it will use that name instead.
- COMBINATION_NAMES ={
- # 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.
- # The following adjusts the descriptions used for the classes during the
- # class changing scene.
- CLASS_HELP_DESCRIPTIONS ={
- # ClassID => Description
- 1 => "Physical fighter capable of using rage skills.",
- 2 => "Physical fighter capable of using many weapons.",
- 3 => "Magical user who heals wounded allies in combat.",
- 4 => "Magical user who casts offensive magic in combat.",
- 5 => "Magical fighter capable of using healing skills.",
- 6 => "Magical fighter capable of using darkness skills.",
- 7 => "Physical fighter who specializes in close combat.",
- 8 => "Physical fighter who specializes in quick combat.",
- } # Do not remove this.
- end # JOB
- end # YEZ
- #===============================================================================
- # 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 YEZ::JOB
- module_function
- #--------------------------------------------------------------------------
- # convert_integer_array
- #--------------------------------------------------------------------------
- def convert_integer_array(array)
- result = []
- array.each { |i|
- case i
- when Range; result |= i.to_a
- when Integer; result |= [i]
- end }
- return result
- end
- #--------------------------------------------------------------------------
- # full_convert_hash
- #--------------------------------------------------------------------------
- def full_convert_hash(hash)
- result = {}
- hash.each { |key|
- result[key[0]] = convert_integer_array(key[1]) }
- return result
- end
- #--------------------------------------------------------------------------
- # class_lists
- #--------------------------------------------------------------------------
- UNLOCKED_1STCLASS_LIST = full_convert_hash(UNLOCKED_1STCLASS)
- UNLOCKED_SUBCLASS_LIST = full_convert_hash(UNLOCKED_SUBCLASS)
- CLASS_ORDER_LIST = convert_integer_array(CLASS_ORDER)
- COMMON_SKILLS_LIST = convert_integer_array(COMMON_SKILLS)
- PRIMARY_ONLY_SKILLS_LIST = full_convert_hash(PRIMARY_ONLY_SKILLS)
- SUBCLASS_ONLY_SKILLS_LIST = full_convert_hash(SUBCLASS_ONLY_SKILLS)
- end # YEZ::JOB
- #===============================================================================
- # Game_Temp
- #===============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :jpc_oy
- end # Game_Temp
- #===============================================================================
- # Game_Actor
- #===============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # alias method: setup
- #--------------------------------------------------------------------------
- alias setup_jpclasses setup unless $@
- def setup(actor_id)
- setup_jpclasses(actor_id)
- @subclass_id = 0
- @base_maxhp_plus = 0
- @base_maxmp_plus = 0
- @base_atk_plus = 0
- @base_def_plus = 0
- @base_spi_plus = 0
- @base_res_plus = 0
- @base_dex_plus = 0
- @base_agi_plus = 0
- end
- #--------------------------------------------------------------------------
- # alias method: level_up
- #--------------------------------------------------------------------------
- alias level_up_jpclasses level_up unless $@
- def level_up
- level_up_jpclasses
- bonus_stats_increases
- random_stat_increases
- end
- #--------------------------------------------------------------------------
- # new method: anticrash_bonus_stats
- #--------------------------------------------------------------------------
- def anticrash_bonus_stats
- @base_maxhp_plus = 0 if @base_maxhp_plus == nil
- @base_maxmp_plus = 0 if @base_maxmp_plus == nil
- @base_atk_plus = 0 if @base_atk_plus == nil
- @base_def_plus = 0 if @base_def_plus == nil
- @base_spi_plus = 0 if @base_spi_plus == nil
- @base_res_plus = 0 if @base_res_plus == nil
- @base_dex_plus = 0 if @base_dex_plus == nil
- @base_agi_plus = 0 if @base_agi_plus == nil
- end
- #--------------------------------------------------------------------------
- # new method: bonus_stats_increases
- #--------------------------------------------------------------------------
- def bonus_stats_increases
- bonus_hash = YEZ::JOB::CLASS_BONUSES
- multiplier1 = YEZ::JOB::PRIMARY_BONUS_RATE
- multiplier2 = YEZ::JOB::SUBCLASS_BONUS_RATE
- if bonus_hash.include?(@class_id)
- values1 = bonus_hash[@class_id]
- else
- values1 = bonus_hash[0]
- end
- if subclass_id == 0 or subclass_id == nil
- values2 = nil
- elsif bonus_hash.include?(subclass_id)
- values2 = bonus_hash[subclass_id]
- else
- values2 = bonus_hash[0]
- end
- if @base_maxhp_plus == nil
- anticrash_bonus_stats
- end
- for i in 0..7
- bonus = [Integer(multiplier1 * values1[i]), 0].max
- if values2 != nil
- bonus += [Integer(multiplier2 * values2[i]), 0].max
- end
- case i
- when 0; @base_maxhp_plus += bonus
- when 1; @base_maxmp_plus += bonus
- when 2; @base_atk_plus += bonus
- when 3; @base_def_plus += bonus
- when 4; @base_spi_plus += bonus
- when 5; @base_res_plus += bonus if $imported["BattlerStatRES"]
- when 6; @base_dex_plus += bonus if $imported["BattlerStatDEX"]
- when 7; @base_agi_plus += bonus
- end
- end
- end
- #--------------------------------------------------------------------------
- # new method: random_stat_increases
- #--------------------------------------------------------------------------
- def random_stat_increases
- random_hash = YEZ::JOB::CLASS_RANDOM
- multiplier1 = YEZ::JOB::PRIMARY_RANDOM_RATE
- multiplier2 = YEZ::JOB::SUBCLASS_RANDOM_RATE
- if random_hash.include?(@class_id)
- values1 = random_hash[@class_id]
- else
- values1 = random_hash[0]
- end
- if subclass_id == 0 or subclass_id == nil
- values2 = nil
- elsif random_hash.include?(subclass_id)
- values2 = random_hash[subclass_id]
- else
- values2 = random_hash[0]
- end
- for i in 0..7
- random = rand([Integer(multiplier1 * values1[i]), 0].max)
- if values2 != nil
- random += rand([Integer(multiplier2 * values2[i]), 0].max)
- end
- case i
- when 0; @base_maxhp_plus += random
- when 1; @base_maxmp_plus += random
- when 2; @base_atk_plus += random
- when 3; @base_def_plus += random
- when 4; @base_spi_plus += random
- when 5; @base_res_plus += random if $imported["BattlerStatRES"]
- when 6; @base_dex_plus += random if $imported["BattlerStatDEX"]
- when 7; @base_agi_plus += random
- end
- end
- end
- #--------------------------------------------------------------------------
- # overwrite method: skills
- #--------------------------------------------------------------------------
- def skills
- result = []
- result += class_skills
- result += primary_skills
- result += subclass_skills
- if $imported["WeaponMasterySkills"] and include_weapon_skills?
- result += weapon_skills
- end
- result.sort! { |a,b| a.id <=> b.id }
- return result.uniq
- end
- #--------------------------------------------------------------------------
- # new method: class_skills
- #--------------------------------------------------------------------------
- def class_skills
- result = []
- for i in @skills
- next unless YEZ::JOB::COMMON_SKILLS_LIST.include?(i)
- result.push($data_skills[i])
- end
- return result unless $imported["JobSystemBase"]
- for i in @skills
- next unless YEZ::JOB::CLASS_SKILLS_LIST[@class_id].include?(i) or
- YEZ::JOB::CLASS_SKILLS_LIST[subclass_id].include?(i) or
- YEZ::JOB::CLASS_SKILLS_LIST[0].include?(i)
- result.push($data_skills[i])
- end
- return result
- end
- #--------------------------------------------------------------------------
- # new method: primary_skills
- #--------------------------------------------------------------------------
- def primary_skills
- result = []
- return result unless YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST.include?(@class_id)
- for i in @skills
- next unless YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST[@class_id].include?(i)
- result.push($data_skills[i])
- end
- return result
- end
- #--------------------------------------------------------------------------
- # new method: subclass_skills
- #--------------------------------------------------------------------------
- def subclass_skills
- result = []
- return result unless YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST.include?(subclass_id)
- for i in @skills
- next unless YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST[subclass_id].include?(i)
- result.push($data_skills[i])
- end
- return result
- end
- unless $imported["EquipmentOverhaul"]
- #--------------------------------------------------------------------------
- # alias method: base_maxhp
- #--------------------------------------------------------------------------
- alias base_maxhp_jpclasses base_maxhp unless $@
- def base_maxhp
- anticrash_bonus_stats
- n = base_maxhp_jpclasses + @base_maxhp_plus
- n *= base_class_stat(:maxhp)
- return Integer(n)
- end
- #--------------------------------------------------------------------------
- # alias method: base_maxmp
- #--------------------------------------------------------------------------
- alias base_maxmp_jpclasses base_maxmp unless $@
- def base_maxmp
- anticrash_bonus_stats
- n = base_maxmp_jpclasses + @base_maxmp_plus
- n *= base_class_stat(:maxmp)
- return Integer(n)
- end
- #--------------------------------------------------------------------------
- # alias method: base_atk
- #--------------------------------------------------------------------------
- alias base_atk_jpclasses base_atk unless $@
- def base_atk
- anticrash_bonus_stats
- n = base_atk_jpclasses + @base_atk_plus
- n *= base_class_stat(:atk)
- return Integer(n)
- end
- #--------------------------------------------------------------------------
- # alias method: base_def
- #--------------------------------------------------------------------------
- alias base_def_jpclasses base_def unless $@
- def base_def
- anticrash_bonus_stats
- n = base_def_jpclasses + @base_def_plus
- n *= base_class_stat(:def)
- return Integer(n)
- end
- #--------------------------------------------------------------------------
- # alias method: base_spi
- #--------------------------------------------------------------------------
- alias base_spi_jpclasses base_spi unless $@
- def base_spi
- anticrash_bonus_stats
- n = base_spi_jpclasses + @base_spi_plus
- n *= base_class_stat(:spi)
- return Integer(n)
- end
- #--------------------------------------------------------------------------
- # alias method: base_agi
- #--------------------------------------------------------------------------
- alias base_agi_jpclasses base_agi unless $@
- def base_agi
- anticrash_bonus_stats
- n = base_agi_jpclasses + @base_agi_plus
- n *= base_class_stat(:agi)
- return Integer(n)
- end
- end # $imported["EquipmentOverhaul"]
- #--------------------------------------------------------------------------
- # enable_clone_flag
- #--------------------------------------------------------------------------
- def enable_clone_flag; @self_clone = true; end
- #--------------------------------------------------------------------------
- # new method: subclass
- #--------------------------------------------------------------------------
- def subclass
- return $data_classes[subclass_id]
- end
- #--------------------------------------------------------------------------
- # new method: subclass_id
- #--------------------------------------------------------------------------
- def subclass_id
- @subclass_id = 0 if @subclass_id == nil
- return @subclass_id
- end
- #--------------------------------------------------------------------------
- # overwrite method: class_id=
- #--------------------------------------------------------------------------
- def class_id=(class_id)
- unlock_class(class_id, true, false)
- @class_id = class_id
- @subclass_id = 0 if @subclass_id == @class_id
- for i in 0..4
- change_equip(i, nil, @self_clone) unless equippable?(equips[i])
- end
- purge_unequippable_passives if $imported["JobSystemPassives"]
- for i in self.class.learnings
- learn_skill(i.skill_id) if i.level <= @level
- end
- if $imported["EquipExtension"] or $imported["EquipmentOverhaul"]
- return if extra_armor_number == 0
- for i in 5..armor_number
- change_equip(i, nil, @self_clone) unless equippable?(equips[i])
- end
- end
- end
- #--------------------------------------------------------------------------
- # new method: subclass_id=
- #--------------------------------------------------------------------------
- def subclass_id=(id)
- unlock_class(class_id, false, true)
- id = 0 if id == @subclass_id
- @subclass_id = id
- purge_unequippable_passives if $imported["JobSystemPassives"]
- for i in 0..4
- change_equip(i, nil, @self_clone) unless equippable?(equips[i])
- end
- if $imported["EquipExtension"] or $imported["EquipmentOverhaul"]
- return if extra_armor_number == 0
- for i in 5..armor_number
- change_equip(i, nil, @self_clone) unless equippable?(equips[i])
- end
- end
- return if @subclass_id == nil or @subclass_id == 0
- for i in self.subclass.learnings
- learn_skill(i.skill_id) if i.level <= @level
- end
- end
- #--------------------------------------------------------------------------
- # new method: base_class_stat
- #--------------------------------------------------------------------------
- def base_class_stat(stat)
- case stat
- when :maxhp; i = 0
- when :maxmp; i = 1
- when :atk; i = 2
- when :def; i = 3
- when :spi; i = 4
- when :res; i = 5
- when :dex; i = 6
- when :agi; i = 7
- end
- if YEZ::JOB::CLASS_STATS.include?(@class_id)
- n = YEZ::JOB::CLASS_STATS[@class_id][i] * YEZ::JOB::PRIMARY_MULTIPLIER
- else
- n = YEZ::JOB::CLASS_STATS[0][i] * YEZ::JOB::PRIMARY_MULTIPLIER
- end
- if YEZ::JOB::CLASS_STATS.include?(subclass_id) and subclass_id != 0
- n += YEZ::JOB::CLASS_STATS[subclass_id][i] * YEZ::JOB::SUBCLASS_MULTIPLIER
- elsif subclass_id != 0
- n += YEZ::JOB::CLASS_STATS[0][i] * YEZ::JOB::SUBCLASS_MULTIPLIER
- end
- return n
- end
- #--------------------------------------------------------------------------
- # alias method: equippable?
- #--------------------------------------------------------------------------
- alias equippable_jpclasses equippable?
- def equippable?(item)
- return true if equippable_jpclasses(item)
- return false if subclass == nil
- if item.is_a?(RPG::Weapon)
- return false unless YEZ::JOB::SUBCLASS_WEAPONS
- return self.subclass.weapon_set.include?(item.id)
- elsif item.is_a?(RPG::Armor)
- return false unless YEZ::JOB::SUBCLASS_ARMOURS
- return false if two_swords_style and item.kind == 0
- return self.subclass.armor_set.include?(item.id)
- end
- return false
- end
- #--------------------------------------------------------------------------
- # new method: all_unlocked_classes
- #--------------------------------------------------------------------------
- def all_unlocked_classes
- result = unlocked_1stclasses
- result += unlocked_subclasses
- result.sort!
- return result.uniq
- end
- #--------------------------------------------------------------------------
- # new method: unlocked_1stclasses
- #--------------------------------------------------------------------------
- def unlocked_1stclasses
- if @unlocked_1stclasses == nil
- @unlocked_1stclasses = YEZ::JOB::UNLOCKED_1STCLASS_LIST[0]
- @unlocked_1stclasses += YEZ::JOB::UNLOCKED_1STCLASS_LIST[id] if
- YEZ::JOB::UNLOCKED_1STCLASS_LIST.include?(id)
- unlock_class(@class_id)
- end
- result = @unlocked_1stclasses + $game_party.unlocked_1stclasses
- return result
- end
- #--------------------------------------------------------------------------
- # new method: unlocked_subclasses
- #--------------------------------------------------------------------------
- def unlocked_subclasses
- if @unlocked_subclasses == nil
- @unlocked_subclasses = YEZ::JOB::UNLOCKED_1STCLASS_LIST[0]
- @unlocked_subclasses += YEZ::JOB::UNLOCKED_1STCLASS_LIST[id] if
- YEZ::JOB::UNLOCKED_1STCLASS_LIST.include?(id)
- end
- result = @unlocked_subclasses + $game_party.unlocked_subclasses
- return result
- end
- #--------------------------------------------------------------------------
- # new method: unlock_class
- #--------------------------------------------------------------------------
- def unlock_class(class_id, primary = true, subclass = true)
- unlocked_1stclasses if @unlocked_1stclasses == nil
- unlocked_subclasses if @unlocked_subclasses == nil
- @unlocked_1stclasses += [class_id] if primary
- @unlocked_subclasses += [class_id] if subclass
- end
- #--------------------------------------------------------------------------
- # new method: lock_class
- #--------------------------------------------------------------------------
- def lock_class(class_id, primary = true, subclass = true)
- unlocked_1stclasses if @unlocked_1stclasses == nil
- unlocked_subclasses if @unlocked_subclasses == nil
- @unlocked_1stclasses -= [class_id] if primary
- @unlocked_subclasses -= [class_id] if subclass
- end
- end # Game_Actor
- #===============================================================================
- # Game_Party
- #===============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # new method: unlocked_1stclasses
- #--------------------------------------------------------------------------
- def unlocked_1stclasses
- @unlocked_1stclasses = YEZ::JOB::UNLOCKED_1STCLASS_LIST[0] if
- @unlocked_1stclasses == nil
- return @unlocked_1stclasses
- end
- #--------------------------------------------------------------------------
- # new method: unlocked_subclasses
- #--------------------------------------------------------------------------
- def unlocked_subclasses
- @unlocked_subclasses = YEZ::JOB::UNLOCKED_SUBCLASS_LIST[0] if
- @unlocked_subclasses == nil
- return @unlocked_subclasses
- end
- #--------------------------------------------------------------------------
- # new method: unlock_class
- #--------------------------------------------------------------------------
- def unlock_class(class_id, primary = true, subclass = true)
- unlocked_1stclasses if @unlocked_1stclasses == nil
- unlocked_subclasses if @unlocked_subclasses == nil
- @unlocked_1stclasses += [class_id] if primary
- @unlocked_subclasses += [class_id] if subclass
- end
- #--------------------------------------------------------------------------
- # new method: lock_class
- #--------------------------------------------------------------------------
- def lock_class(class_id, primary = true, subclass = true)
- unlocked_1stclasses if @unlocked_1stclasses == nil
- unlocked_subclasses if @unlocked_subclasses == nil
- @unlocked_1stclasses -= [class_id] if primary
- @unlocked_subclasses -= [class_id] if subclass
- end
- #--------------------------------------------------------------------------
- # alias method: setup_starting_members
- #--------------------------------------------------------------------------
- alias setup_starting_members_jpclasses setup_starting_members unless $@
- def setup_starting_members
- setup_starting_members_jpclasses
- $game_switches[YEZ::JOB::ENABLE_1STCLASS_SWITCH] = true
- $game_switches[YEZ::JOB::ENABLE_SUBCLASS_SWITCH] = true
- end
- end # Game_Party
- #===============================================================================
- # Scene_Menu
- #===============================================================================
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # alias method: create_command_window
- #--------------------------------------------------------------------------
- alias create_command_window_jpclasses create_command_window unless $@
- def create_command_window
- create_command_window_jpclasses
- return if $imported["CustomMenuCommand"] or $imported["StatusCommandMenu"]
- if $game_switches[YEZ::JOB::ENABLE_1STCLASS_SWITCH] or
- $game_switches[YEZ::JOB::ENABLE_SUBCLASS_SWITCH]
- title = YEZ::JOB::CLASS_TITLE
- @command_class = @command_window.add_command(title)
- if @command_window.oy > 0
- @command_window.oy -= Window_Base::WLH
- end
- end
- @command_window.index = @menu_index
- end
- #--------------------------------------------------------------------------
- # alias method: update_command_selection
- #--------------------------------------------------------------------------
- alias update_command_selection_jpclasses update_command_selection unless $@
- def update_command_selection
- if Input.trigger?(Input::C)
- case @command_window.index
- when @command_class
- if $game_party.members.size == 0
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- start_actor_selection
- return
- end
- end
- update_command_selection_jpclasses
- end
- #--------------------------------------------------------------------------
- # alias method: update_actor_selection
- #--------------------------------------------------------------------------
- alias update_actor_selection_jpclasses 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
- $scene = Scene_Class.new(@status_window.index, @command_class)
- return
- end
- end
- update_actor_selection_jpclasses
- end
- end # Scene Menu
- #===============================================================================
- # Scene_Class
- #===============================================================================
- class Scene_Class < Scene_Base
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :data
- attr_accessor :actor
- attr_accessor :last_index
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, menu_index = 0, last_index = 0)
- @actor_index = actor_index
- @menu_index = menu_index
- @last_index = last_index
- end
- #--------------------------------------------------------------------------
- # start
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @actor = $game_party.members[@actor_index]
- $game_party.last_actor_index = @actor_index
- @status_window = Window_Class_Actor.new(@actor)
- @help_window = Window_Help.new
- @help_window.y = 128
- create_command_window
- @class_window = Window_Class_List.new(@actor, 0, @help_window.y +
- @help_window.height)
- @class_window.help_window = @help_window
- @class_window.update_help
- @data_window = Window_Class_Data.new(@class_window.width,
- @class_window.y, @actor)
- refresh_class_window
- end
- #--------------------------------------------------------------------------
- # terminate
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @status_window.dispose if @status_window != nil
- @command_window.dispose if @command_window != nil
- @help_window.dispose if @help_window != nil
- @class_window.dispose if @class_window != nil
- @data_window.dispose if @data_window != nil
- @mastery_window.dispose if @mastery_window != nil
- @formation_window.dispose if @formation_window != nil
- end
- #--------------------------------------------------------------------------
- # return_scene
- #--------------------------------------------------------------------------
- def return_scene
- $game_temp.jpc_oy = nil
- if $imported["StatusCommandMenu"] and $game_temp.status_index != nil
- $scene = Scene_Status.new(@actor_index)
- elsif $imported["CustomMenuCommand"] and
- $game_temp.menu_command_index.has_key?(:class)
- $scene = Scene_Menu.new($game_temp.menu_command_index[:class])
- else
- $scene = Scene_Menu.new(@menu_index)
- end
- end
- #--------------------------------------------------------------------------
- # next_actor
- #--------------------------------------------------------------------------
- def next_actor
- $game_temp.jpc_oy = @command_window.oy
- @actor_index += 1
- @actor_index %= $game_party.members.size
- $scene = Scene_Class.new(@actor_index, @menu_index, @last_index)
- end
- #--------------------------------------------------------------------------
- # prev_actor
- #--------------------------------------------------------------------------
- def prev_actor
- $game_temp.jpc_oy = @command_window.oy
- @actor_index += $game_party.members.size - 1
- @actor_index %= $game_party.members.size
- $scene = Scene_Class.new(@actor_index, @menu_index, @last_index)
- end
- #--------------------------------------------------------------------------
- # create_command_window
- #--------------------------------------------------------------------------
- def create_command_window
- commands = []; @data = []
- for command in YEZ::JOB::CLASS_COMMANDS
- case command
- when :primary
- next unless $game_switches[YEZ::JOB::ENABLE_1STCLASS_SWITCH]
- commands.push(YEZ::JOB::CLASS_VOCAB[command])
- when :subclass
- next unless $game_switches[YEZ::JOB::ENABLE_SUBCLASS_SWITCH]
- commands.push(YEZ::JOB::CLASS_VOCAB[command])
- when :passives
- next unless $imported["JobSystemPassives"]
- next unless $game_switches[YEZ::JOB::ENABLE_PASSIVE_SWITCH]
- commands.push(YEZ::JOB::CLASS_VOCAB[command])
- when :formations
- next unless $imported["FormationMacros"]
- next unless $game_switches[YEZ::MACRO::ENABLE_SWITCH]
- commands.push(YEZ::JOB::CLASS_VOCAB[command])
- @formation_window = Window_Formation.new(@actor)
- when :mastery
- next unless $imported["WeaponMasterySkills"]
- commands.push(YEZ::JOB::CLASS_VOCAB[command])
- @mastery_window = Window_Mastery.new(0, 128, @actor, true)
- when :skill; commands.push(YEZ::JOB::CLASS_VOCAB[command])
- when :equip; commands.push(YEZ::JOB::CLASS_VOCAB[command])
- else; next
- end
- @data.push(command)
- end
- if YEZ::JOB::CLASS_CENTERED_COMMAND
- @command_window = Window_Command_Centered.new(160, commands)
- else
- @command_window = Window_Command.new(160, commands)
- end
- @command_window.height = 128
- @command_window.oy = $game_temp.jpc_oy if $game_temp.jpc_oy != nil
- @command_window.index = [@last_index, 0].max
- @command_window.active = true
- end
- #--------------------------------------------------------------------------
- # update
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- if @command_window.active
- update_command_selection
- elsif @class_window.active
- update_class_selection
- end
- end
- #--------------------------------------------------------------------------
- # refresh_class_window
- #--------------------------------------------------------------------------
- def refresh_class_window
- @last_index = @command_window.index
- @help_window.y = @status_window.height
- @class_window.y = @help_window.y + @help_window.height
- @data_window.y = @class_window.y
- @mastery_window.y = 416*3 if @mastery_window != nil
- @formation_window.y = 416*3 if @formation_window != nil
- case @data[@command_window.index]
- when :primary
- @class_window.refresh(1)
- when :subclass
- @class_window.refresh(2)
- when :formations
- @formation_window.y = @help_window.y
- @help_window.y = 416*3
- @class_window.y = 416*3
- @data_window.y = 416*3
- when :mastery
- @mastery_window.y = @help_window.y
- @mastery_window.refresh(true)
- @help_window.y = 416*3
- @class_window.y = 416*3
- @data_window.y = 416*3
- else
- @class_window.refresh(0)
- end
- end
- #--------------------------------------------------------------------------
- # update_command_selection
- #--------------------------------------------------------------------------
- def update_command_selection
- @command_window.update
- refresh_class_window if @last_index != @command_window.index
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.repeat?(Input::F8) and $TEST # Debug increase JP
- return unless $imported["JobSystemBase"]
- Sound.play_equip
- value = YEZ::JOB::JP_COST * 10
- value *= 10 if Input.press?(Input::SHIFT)
- for class_id in @actor.all_unlocked_classes
- @actor.gain_jp(value + rand(value), class_id)
- end
- @status_window.refresh
- refresh_class_window
- elsif Input.repeat?(Input::F7) and $TEST # Debug increase JP
- return unless $imported["JobSystemBase"]
- Sound.play_equip
- value = YEZ::JOB::JP_COST * 10
- value *= 10 if Input.press?(Input::SHIFT)
- for class_id in @actor.all_unlocked_classes
- @actor.lose_jp(value + rand(value), class_id)
- end
- @status_window.refresh
- refresh_class_window
- elsif Input.repeat?(Input::RIGHT)
- Sound.play_cursor
- next_actor
- elsif Input.repeat?(Input::LEFT)
- Sound.play_cursor
- prev_actor
- elsif Input.trigger?(Input::X)
- return unless (@actor.subclass_id != 0 and @actor.subclass_id != nil)
- Sound.play_equip
- @actor.subclass_id = 0
- @status_window.refresh
- @class_window.refresh(@class_window.mode)
- @data_window.refresh
- elsif Input.trigger?(Input::C)
- case @data[@command_window.index]
- when :primary
- Sound.play_decision
- @command_window.active = false
- @class_window.active = true
- when :subclass
- Sound.play_decision
- @command_window.active = false
- @class_window.active = true
- when :formations
- Sound.play_decision
- $game_temp.jpc_oy = @command_window.oy
- $scene = Scene_Formation.new(@actor_index, @command_window.index)
- when :mastery
- Sound.play_decision
- $game_temp.jpc_oy = @command_window.oy
- $scene = Scene_Mastery.new(@actor_index, @command_window.index)
- when :passives
- Sound.play_decision
- $scene = Scene_Passives.new(@actor.index, @last_index,
- Scene_Passives::HOST_CLASS)
- when :skill
- Sound.play_decision
- $scene = Scene_Skill.new(@actor.index)
- when :equip
- Sound.play_decision
- $scene = Scene_Equip.new(@actor.index)
- end
- end
- end
- #--------------------------------------------------------------------------
- # update_class_selection
- #--------------------------------------------------------------------------
- def update_class_selection
- @class_window.update
- if @last_class_index != @class_window.index
- @last_class_index = @class_window.index
- clone = @actor.clone
- clone.enable_clone_flag
- class_id = @class_window.class
- case @data[@command_window.index]
- when :primary
- clone.class_id = class_id if @class_window.enabled_class?(class_id)
- when :subclass
- clone.subclass_id = class_id if @class_window.enabled_class?(class_id)
- end
- clone = nil unless @class_window.enabled_class?(class_id)
- @data_window.refresh(clone)
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @class_window.active = false
- @data_window.refresh
- elsif Input.repeat?(Input::F8) and $TEST # Debug increase JP
- return unless $imported["JobSystemBase"]
- Sound.play_equip
- value = YEZ::JOB::JP_COST * 10
- value *= 10 if Input.press?(Input::SHIFT)
- @actor.gain_jp(value + rand(value), @class_window.class)
- @status_window.refresh
- refresh_class_window
- elsif Input.repeat?(Input::F7) and $TEST # Debug increase JP
- return unless $imported["JobSystemBase"]
- Sound.play_equip
- value = YEZ::JOB::JP_COST * 10
- value *= 10 if Input.press?(Input::SHIFT)
- @actor.lose_jp(value + rand(value), @class_window.class)
- @status_window.refresh
- refresh_class_window
- elsif Input.trigger?(Input::X)
- return unless (@actor.subclass_id != 0 and @actor.subclass_id != nil)
- Sound.play_equip
- @actor.subclass_id = 0
- @status_window.refresh
- @class_window.refresh(@class_window.mode)
- @last_class_index += 1
- elsif Input.trigger?(Input::C)
- class_id = @class_window.class
- if !@class_window.enabled_class?(class_id)
- Sound.play_buzzer
- return
- end
- last_hp = @actor.maxhp
- last_mp = @actor.maxmp
- case @data[@command_window.index]
- when :primary
- Sound.play_equip
- @actor.class_id = class_id
- when :subclass
- Sound.play_equip
- @actor.subclass_id = class_id
- end
- @actor.hp = [@actor.hp + @actor.maxhp - last_hp, @actor.hp - 1].max
- @actor.mp += @actor.maxmp - last_mp
- @status_window.refresh
- @class_window.refresh(@class_window.mode)
- @last_class_index += 1
- end
- end
- end # Scene_Class
- #==============================================================================
- # Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # overwrite method: draw_actor_class
- #--------------------------------------------------------------------------
- def draw_actor_class(actor, x, y)
- self.contents.font.color = normal_color
- case_set = YEZ::JOB::CLASS_NAME_DISPLAY
- case_set = 0 if actor.subclass == nil
- case case_set
- when 0 # Primary only
- text = actor.class.name
- when 1 # Primary unless there is a combination name.
- text = sprintf("%s/%s", actor.class.name, actor.subclass.name)
- if YEZ::JOB::COMBINATION_NAMES.include?(text)
- text = YEZ::JOB::COMBINATION_NAMES[text]
- else
- text = actor.class.name
- end
- when 2 # Primary/Secondary unless there is a combination name.
- text = sprintf("%s/%s", actor.class.name, actor.subclass.name)
- if YEZ::JOB::COMBINATION_NAMES.include?(text)
- text = YEZ::JOB::COMBINATION_NAMES[text]
- end
- when 3 # Primary/Secondary only
- text = sprintf("%s/%s", actor.class.name, actor.subclass.name)
- end
- self.contents.draw_text(x, y, 120, WLH, text)
- end
- #--------------------------------------------------------------------------
- # new method: draw_actor_1stclass
- #--------------------------------------------------------------------------
- def draw_actor_1stclass(actor, x, y)
- self.contents.font.color = normal_color
- if YEZ::JOB::CLASS_ICONS.include?(actor.class_id)
- icon = YEZ::JOB::CLASS_ICONS[actor.class_id]
- else
- icon = YEZ::JOB::CLASS_ICONS[0]
- end
- draw_icon(icon, x, y)
- self.contents.draw_text(x+24, y, 120, WLH, actor.class.name)
- end
- #--------------------------------------------------------------------------
- # new method: draw_actor_subclass
- #--------------------------------------------------------------------------
- def draw_actor_subclass(actor, x, y)
- return if actor.subclass == nil
- self.contents.font.color = normal_color
- if YEZ::JOB::CLASS_ICONS.include?(actor.subclass_id)
- icon = YEZ::JOB::CLASS_ICONS[actor.subclass_id]
- else
- icon = YEZ::JOB::CLASS_ICONS[0]
- end
- draw_icon(icon, x, y)
- self.contents.draw_text(x+24, y, 120, WLH, actor.subclass.name)
- end
- end # Window_Base
- #===============================================================================
- # 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
- #===============================================================================
- # Window_Command_Centered
- #===============================================================================
- class Window_Command_Centered < Window_Command
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(rect, @commands[index], 1)
- end
- end # Window_Command_Centered
- #===============================================================================
- # Window_Help
- #===============================================================================
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # alias method: current_actor
- #--------------------------------------------------------------------------
- if method_defined?(:current_actor)
- alias current_actor_jpclasses current_actor unless $@
- def current_actor
- if $scene.is_a?(Scene_Class)
- return $scene.actor.name
- else
- return current_actor_jpclasses
- end
- end
- end
- end # Window_Help
- #===============================================================================
- # Window_Class_Actor
- #===============================================================================
- class Window_Class_Actor < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(160, 0, 384, 128)
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_face(@actor, 0, 0, size = 96)
- x = 104
- y = 0
- draw_actor_name(@actor, x, y)
- if @actor.subclass == nil or @actor.subclass == 0
- draw_actor_1stclass(@actor, x, y+WLH*1)
- draw_actor_jp(@actor, @actor.class_id, x+120, y+WLH*1)
- else
- draw_actor_class(@actor, x, y+WLH*1)
- draw_actor_1stclass(@actor, x, y+WLH*2)
- draw_actor_jp(@actor, @actor.class_id, x+120, y+WLH*2)
- draw_actor_subclass(@actor, x, y+WLH*3)
- draw_actor_jp(@actor, @actor.subclass_id, x+120, y+WLH*3)
- end
- end
- #--------------------------------------------------------------------------
- # draw_actor_jp
- #--------------------------------------------------------------------------
- def draw_actor_jp(actor, class_id, dx, dy, dw = 120)
- return unless $imported["JobSystemBase"]
- icon = $imported["Icons"] ? YEZ::ICONS[:txtjp] : YEZ::JOB::JP_ICON
- draw_icon(icon, dx + dw - 24, dy)
- text = @actor.class_jp[class_id]
- self.contents.draw_text(dx, dy, dw - 24, WLH, text, 2)
- end
- end # Window_JP_Actor
- #===============================================================================
- # Window_Class_List
- #===============================================================================
- class Window_Class_List < Window_Selectable
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(actor, dx, dy)
- super(dx, dy, 304, Graphics.height - dy)
- self.active = false
- @actor = actor
- if $scene.is_a?(Scene_Class)
- case $scene.data[$scene.last_index]
- when :primary; value = 1
- when :subclass; value = 2
- else; value = 0
- end
- else
- value = 0
- end
- refresh(value)
- end
- #--------------------------------------------------------------------------
- # class
- #--------------------------------------------------------------------------
- def class; return @data[self.index]; end
- #--------------------------------------------------------------------------
- # mode
- #--------------------------------------------------------------------------
- def mode; return @mode; end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh(mode = 0)
- @mode = mode; @data = [];
- @classes = @actor.all_unlocked_classes
- for class_id in YEZ::JOB::CLASS_ORDER_LIST
- next unless include?(class_id)
- self.index = @data.size if @actor.class_id == class_id and
- self.index == -1
- @data.push(class_id)
- end
- @item_max = @data.size
- create_contents
- for i in 0..(@item_max-1)
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.size = Font.default_size
- class_id = @data[index]
- return if $data_classes[class_id] == nil
- enabled = enabled_class?(class_id)
- if YEZ::JOB::CLASS_ICONS.include?(class_id)
- icon = YEZ::JOB::CLASS_ICONS[class_id]
- else
- icon = YEZ::JOB::CLASS_ICONS[0]
- end
- draw_icon(icon, rect.x, rect.y, enabled)
- name = $data_classes[class_id].name
- if @actor.class_id == class_id
- self.contents.font.color = text_color(YEZ::JOB::PRIMARY_COLOUR)
- elsif @actor.subclass_id == class_id
- self.contents.font.color = text_color(YEZ::JOB::SUBCLASS_COLOUR)
- else
- self.contents.font.color = normal_color
- end
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(rect.x+24, rect.y, 172, WLH, name, 0)
- draw_class_jp(class_id, rect.x, rect.y, enabled)
- end
- #--------------------------------------------------------------------------
- # include?
- #--------------------------------------------------------------------------
- def include?(class_id)
- return false if $data_classes[class_id] == nil
- return false if @data.include?(class_id)
- return false if !@classes.include?(class_id)
- return true
- end
- #--------------------------------------------------------------------------
- # enabled_class?
- #--------------------------------------------------------------------------
- def enabled_class?(class_id)
- if @mode == 1
- return false if @actor.class_id == class_id
- return false unless @actor.unlocked_1stclasses.include?(class_id)
- elsif @mode == 2
- return false if @actor.class_id == class_id
- return false unless @actor.unlocked_subclasses.include?(class_id)
- end
- return true
- end
- #--------------------------------------------------------------------------
- # draw_class_jp
- #--------------------------------------------------------------------------
- def draw_class_jp(class_id, dx, dy, enabled)
- return unless $imported["JobSystemBase"]
- icon = $imported["Icons"] ? YEZ::ICONS[:txtjp] : YEZ::JOB::JP_ICON
- dw = self.width - 32 - dx - 24
- draw_icon(icon, self.width - 56, dy, enabled)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.font.size = YEZ::JOB::JP_SIZE
- text = @actor.class_jp[class_id]
- self.contents.draw_text(dx, dy, dw, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # update_help
- #--------------------------------------------------------------------------
- def update_help
- if YEZ::JOB::CLASS_HELP_DESCRIPTIONS.include?(self.class)
- @help_window.set_text(YEZ::JOB::CLASS_HELP_DESCRIPTIONS[self.class])
- else
- @help_window.set_text("")
- end
- end
- end # Window_Class_List
- #===============================================================================
- # Window_Class_Data
- #===============================================================================
- class Window_Class_Data < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(x, y, actor)
- super(x, y, Graphics.width - x, Graphics.height - y)
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh(clone = nil)
- self.contents.clear
- @clone = clone
- dx = (self.width - 32)/2 - 97; dy = 0
- draw_actor_stats(dx, dy)
- return if @clone == nil
- draw_clone_stats(dx, dy)
- end
- #--------------------------------------------------------------------------
- # draw_actor_stats
- #--------------------------------------------------------------------------
- def draw_actor_stats(dx, dy)
- arrow = YEZ::JOB::CLASS_VOCAB[:arrow]
- for stat in YEZ::JOB::SHOWN_CLASS_STATS
- icon = 0
- case stat
- when :maxhp
- icon = $imported["Icons"] ? YEZ::ICONS[:hp] : 0
- text = Vocab.hp
- value = @actor.maxhp
- when :maxmp
- icon = $imported["Icons"] ? YEZ::ICONS[:mp] : 0
- text = Vocab.mp
- value = @actor.maxmp
- when :atk
- icon = $imported["Icons"] ? YEZ::ICONS[:atk] : 0
- text = Vocab.atk
- value = @actor.atk
- when :def
- icon = $imported["Icons"] ? YEZ::ICONS[:def] : 0
- text = Vocab.def
- value = @actor.def
- when :spi
- icon = $imported["Icons"] ? YEZ::ICONS[:spi] : 0
- text = Vocab.spi
- value = @actor.spi
- when :agi
- icon = $imported["Icons"] ? YEZ::ICONS[:agi] : 0
- text = Vocab.agi
- value = @actor.agi
- when :dex
- next unless $imported["BattlerStatDEX"]
- icon = $imported["Icons"] ? YEZ::ICONS[:dex] : 0
- text = Vocab.dex
- value = @actor.dex
- when :res
- next unless $imported["BattlerStatRES"]
- icon = $imported["Icons"] ? YEZ::ICONS[:res] : 0
- text = Vocab.res
- value = @actor.res
- else; next
- end
- draw_icon(icon, dx, dy)
- self.contents.font.color = system_color
- self.contents.draw_text(dx+24, dy, 60, WLH, text, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(dx+84, dy, 40, WLH, value, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(dx+124, dy, 30, WLH, arrow, 1)
- dy += WLH
- end
- end
- #--------------------------------------------------------------------------
- # draw_clone_stats
- #--------------------------------------------------------------------------
- def draw_clone_stats(dx, dy)
- for stat in YEZ::JOB::SHOWN_CLASS_STATS
- case stat
- when :maxhp
- value1 = @clone.maxhp
- value2 = @actor.maxhp
- when :maxmp
- value1 = @clone.maxmp
- value2 = @actor.maxmp
- when :atk
- value1 = @clone.atk
- value2 = @actor.atk
- when :def
- value1 = @clone.def
- value2 = @actor.def
- when :spi
- value1 = @clone.spi
- value2 = @actor.spi
- when :agi
- value1 = @clone.agi
- value2 = @actor.agi
- when :dex
- next unless $imported["BattlerStatDEX"]
- value1 = @clone.dex
- value2 = @actor.dex
- when :res
- next unless $imported["BattlerStatRES"]
- value1 = @clone.res
- value2 = @actor.res
- else; next
- end
- if value1 > value2
- self.contents.font.color = power_up_color
- elsif value1 < value2
- self.contents.font.color = power_down_color
- else
- self.contents.font.color = normal_color
- end
- self.contents.draw_text(dx+154, dy, 40, WLH, value1, 2)
- dy += WLH
- end
- end
- end # Window_Class_Data
- #===============================================================================
- # Window_Class_Info
- #===============================================================================
- class Window_Class_Info < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(x, y, actor)
- super(x, y, Graphics.width - x, Graphics.height - y)
- @actor = actor
- refresh(@actor.class_id)
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh(class_id = nil)
- self.contents.clear
- @class_id = class_id if class_id != nil
- @data = []
- for skill_id in learnable_skills
- skill = $data_skills[skill_id]
- next if skill == nil
- @data.push(skill)
- end
- @data.sort! { |a,b| a.id <=> b.id }
- self.contents.font.color = normal_color
- text = YEZ::JOB::CLASS_VOCAB[:list]
- self.contents.draw_text(0,0,self.width-32,WLH, text, 1)
- draw_skill_list
- end
- #--------------------------------------------------------------------------
- # learnable_skills
- #--------------------------------------------------------------------------
- def learnable_skills
- result = []
- if $imported["JobSystemBase"]
- result += YEZ::JOB::CLASS_SKILLS_LIST[0]
- if YEZ::JOB::CLASS_SKILLS_LIST.include?(@class_id)
- result += YEZ::JOB::CLASS_SKILLS_LIST[@class_id]
- end
- end
- if YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST.include?(@class_id)
- result += YEZ::JOB::PRIMARY_ONLY_SKILLS_LIST[@class_id]
- end
- if YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST.include?(@class_id)
- result += YEZ::JOB::SUBCLASS_ONLY_SKILLS_LIST[@class_id]
- end
- return result
- end
- #--------------------------------------------------------------------------
- # draw_skill_list
- #--------------------------------------------------------------------------
- def draw_skill_list(icons_per_row = 4)
- icons_per_row = [[icons_per_row, 1].max, 8].min
- px = ((self.width-32)-(icons_per_row*24))/icons_per_row + 24
- dw = icons_per_row * px
- dx = original_x = (self.width-32)/2 - dw/2 + px/icons_per_row
- dy = original_y = WLH*1
- counter = 0
- for skill in @data.uniq
- if enabled_skill?(skill)
- icon = skill.icon_index
- enabled = true
- else
- icon = show_icon?(skill) ? skill.icon_index : YEZ::JOB::CLASS_ICONS[0]
- enabled = false
- end
- draw_icon(icon, dx, dy, enabled)
- draw_skill_level(dx, dy, skill, @actor, enabled) if
- $imported["JobSystemSkillLevels"]
- dx += px
- counter += 1
- if counter % icons_per_row == 0
- counter = 0
- dx = original_x
- dy += WLH
- return if dy + WLH > self.height-32
- end
- end
- end
- #--------------------------------------------------------------------------
- # enabled_skill?
- #--------------------------------------------------------------------------
- def enabled_skill?(skill)
- return true if @actor.skill_learn?(skill)
- return false
- end
- #--------------------------------------------------------------------------
- # show_icon?
- #--------------------------------------------------------------------------
- def show_icon?(skill)
- if $imported["JobSystemBase"]
- return false if skill.jp_cost <= 0
- for switch_id in skill.jp_switches
- return false unless $game_switches[switch_id]
- end
- if $imported["JobSystemSkillLevels"]
- for key in skill.level_at
- return false if key[1] > @actor.skill_level(key[0])
- end
- end
- end
- return true
- end
- end # Window_Class_Info
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
RAW Paste Data