$imported = {} if $imported.nil?$imported["EBON-SubManager"] = true#==============================================================================# ▼ YEA CLASS SYSTEM ADD-ON (EBONFLAME): SUBCLASS MANAGER v1.3.4#==============================================================================# ▼ Author: Ebonflame# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#——————————————————————————# ▼ Updates#——————————————————————————## 2013.02.07: Initial relase, inspired by Estriole's Sub EXP Gain Script.# 2013.02.09-2013.02.22: Bug fixes and compatibility updates; Additional# functions (single classes gain bonus EXP/JP, init subclass skills).# 2013.03.06: Additional functions (gain pbg/features from subclass and# customizeable level caps for subclasses).# 2013.03.14: Final items on the to-do list added (subclass JP in main menu,# subclass exp/exp for level on status screen), plus the option to forget# subclass skills when unequipping a subclass (until you equip it again).# 2013.04.10: Additional function added (maintain_sub_levels) & compatibility# update (YEA::CLASS_SYSTEM::MAINTAIN_LEVELS). Note you need "EBON-ULMaintain"# if you have MAINTAIN_LEVELS/MAINTAIN_SUB_LEVELS set to true and you want# Unlock Level to work. You can find it on the main page for this script:# (www)rpgmakervxace.net/topic/12492-yanfly-class-system-add-ons-subclass-management/# 2013.04.17: Added a less time-consuming method to retrieve exp values.# Re-wrote regexp (it still works the same way, it's just better code). Erased# unnecessary code. Additional functions added (change_sub_level,# DISALLOW_NO_SUBCLASS).# 2013.05.22: Updated the help section. Eliminated the last nilClass error due# to @exp[class_id] not having a value. Re-worked setup_initial_subclass a# little to prevent a conflict if MAINTAIN_SUB_LEVELS is set to true. And since# I now actually know a little about windows, I set it so it plays the correct# sound when the player attempts to equip an unequippable subclass, and hid# the classes when neither primary nor subclass was selected within the class# window.# 2013.05.29: Finished modifying subclass feature addition section. Modified# learn_other_skills and forget_other_skills for more flexibility. Added a# feature to allow the main class not to transfer skills on class change -# remember to set this to false if you have YEA::CLASS_SYSTEM::MAINTAIN_LEVELS# set to true. (Also, sorry about not finishing the subclass feature section# last time.)##——————————————————————————# ▼ Description#——————————————————————————## This is my first finished script: the Subclass Manager, inspired by the# amazing Estriole. With this script, you can:## - Let your actor's subclass gain EXP!# - Let your actor's subclass gain JP!# - Let your actors gain bonus EXP/JP if they're single-classed!# - Give your actors an initial subclass - and subclass level!# - Cap your subclass levels individually or as a whole!# - Make your actors forget skills from a subclass when they switch from that# subclass (until they switch back)!*# - View your class' and subclass' JP on the main menu screen!# - Implement your subclass' features!# - Add PBG to your actors when their subclass levels if you have Yanfly's# Parameter Bonus Growth script installed!# - Have only your main class maintain levels... or only your subclasses maintain# levels... or both!**# - Be totally rad!## (Err... was there anything I forgot? There's quite a lot of features packed# into this thing...)## * It may be weird to have your actor forget their subclass' skills if# EBON::MAINTAIN_SUB_LEVELS is set to true.# ** Coming Soon to a webpage near you: ULMaintain! Required if you want to use# YEA - ClassUnlockLevel in conjunction with this script and either# MAINTAIN_LEVEL or MAINTAIN_SUB_LEVELS is set to true. Shipping and handling# fees may apply. Additionally, it's strongly recommended that you have your# classes set to primary only or subclass only if you have a MAINTAIN set to true.## # --- # Important note: This script may conflict with other scripts that alias# # --- # 'change_class' aside from Yanfly's Class System script. Read #1 in the# # --- # 'Aliases & Redefinitions' section for more information.## You can find updated versions of this script, as well as related scripts, at:# (www)rpgmakervxace.net/topic/12492-yanfly-class-system-add-ons-subclass-management/## You can find the original script that inspired this one at:# (www)rpgmakervxace.net/topic/6661-yea-class-script-addon-subclass-gain-exp/##——————————————————————————# ▼ Notetags#——————————————————————————## To initialize an actor's subclass, put the following notetag in their notes:## <initial subclass: x># <initial subclass: x at lvl y>## X and y are both numerical values. X is the subclass ID you want them to start# with, and y is the level you want them to start at. If y is not given, level 1# will be assumed. If y is higher than 99, 99 will be assumed.##——————————————————————————# ▼ Script Calls#——————————————————————————## This script enables the following script calls:##——————————————————————————## $game_actors[x].earn_jp_alt(y)# $game_actors[x].earn_jp_alt(y, z)## This will cause actor x to earn y amount of JP. JP earned will be# modified first by any JP Rate traits provided through notetags, then by the# subclass JP gain rate. If z is not given, the primary class will be assumed.##——————————————————————————## $game_actors[x].gain_exp(y)# $game_actors[x].gain_exp(y, z)## This will cause actor x to earn y amount of EXP. Z is the value of the class# you wish to add/subtract EXP to/from, with 1 being the main class and 2 being# the subclass.## z = nil (no class specified): Both the main class and subclass will gain the# EXP value specified. The subclass' exp gain WILL be auto-corrected to correlate# with the rate set in EBON::SUB_EXP_RATE. EXP gain for the main class will also# be auto-adjusted to compensate for those with single classes if necessary.# z = 1 (main class): only the main class will gain the EXP value specified,# and it will NOT gain additional EXP even if EBON::SINGLE_CLASS_EXP_BONUS is# set to true and the actor only has a main class.# z = 2 (subclass): only the subclass will gain the EXP value specified, and it# will NOT be auto-corrected to correlate with the rate set in EBON::SUB_EXP_RATE.##——————————————————————————## $game_actors[x].sub_id# $game_actors[x].sub_level## Can be used for compatibility with Yanfly's Learn Skills Engine. An example of# how to utilize these script calls in a notetag:## <learn require eval># @actor.sub_level > 5 & [1, 2, 3].include?(@actor.sub_id)# </learn require eval>## This would make the skill show up in YEA's learn skills page if the actor's# subclass is 1, 2, or 3 (1, 2, and 3 are the ID's of the class) and the actor's# subclass level is greater than five. sub_id will return zero if the actor's# subclass_id is set to nil or zero, and sub_level will return one if the actor# does not have a subclass; otherwise it will return the actor's subclass level.##——————————————————————————## $game_actors[x].change_sub_level(y)## This will cause actor x's subclass to become level y, performing any leveling# operations required, such as parameter bonus growth if you have YEA - Parameter# Bonus Growth installed, or mastery aquisitions if you have EBON - Level# Masteries and/or EBON - Learn Masteries imported.##——————————————————————————## $game_actors[x].change_subclass(y)## Changes the actor's subclass to <y>, where <y> is the database ID for the class# you want to change it to. You will not be able to switch to that subclass if# you have already exceeded the level cap for that subclass.## $game_actors[x].change_subclass(0) will completely remove the actor's subclass# (if present), including features that were added on subclass change. This will# not work if MAINTAIN_SUB_LEVELS is set to true, since the unequipping of a# subclass is disallowed in that case.## ~~~~~~~~~~~~~~~~~~~~~~~~———*———~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# ===> IMPORTANT: This needs to be called if you want to change the <===# ===> actor's subclass_id; DO NOT just set @subclass_id to something <===# ===> else. THIS WILL MESS UP YOUR MAIN CLASS' FEATURES, and may <===# ===> prevent the subclass from leveling correctly. <===# ~~~~~~~~~~~~~~~~~~~———*———~~~~~~~~~~~~~~~~~~~##——————————————————————————# ▼ Requirements#——————————————————————————## 1) Requires Yanfly's Class System scrpt.# 2) Must be placed below YEA - Class System, YEA - Class Specifics,# YEA - Class Unlock LV, and YEA - JP Manager (if the last three are imported).##——————————————————————————# ▼ Compatibility#——————————————————————————## 1) YEA - JP Manager (must be below it; allows your subclass to gain JP)# 2) YEA - Victory Aftermath (doesn't show level-up messages if you have VA# imported; placement doesn't matter as long as you have EBON - Subclass# Aftermath imported as well; shows subclass stats, gains, and level changes)# 3) YEA - Parameter Bonus Growth (placement doesn't matter; lets your subclass# contribute to Parameter Bonus Growth earned)##——————————————————————————# ▼ Aliases & Redefinitions#——————————————————————————## 1) Redefine: change_class (if keep_exp is false and the class the actor is# changing to is higher than your current level; to prevent PBG from# giving additional param_bonus_growth)# 2) Redefine: gain_exp (to allow the subclass to gain exp)# 3) Redefine: draw_block1, draw_exp_info, draw_actor_info (optional; to display# the actor's subclass information)# 4) Alias: param_base (temporarily lowers exp in the actor's subclass if one # is equipped and it's above lv 99; to prevent errors)##——————————————————————————# ▼ Instructions#——————————————————————————## To install the script, open your script editor and paste this script into# a new section below ▼ Materials but above ▼ Main.##——————————————————————————module EBON # --- # Class/Subclass Display options HIDE_UNEQUIPPABLE_CLASSES = true # If this is set to true, classes that cannot be equipped will be hidden from # the class selection screen. If set to false, the default greyed-out value # will be displayed. # --- # /Class/Subclass Display options # --- # Subclass Info Display options DISPLAY_SUB_INFO = true # Displays the actor's subclass information. This overwrites the following # core definitions: draw_block1, draw_exp_info # Set to false to prevent it from overwriting these definitions. Your # subclass' experience information will not be displayed. SUB_EXP_DISPLAY = "%s / %s" # <main class experience> / <subclass experience> # <main class exp-to-level> / <subclass exp-to-level> MAX_LV = "MAX LEVEL!" # When actor is at max level/max subclass level, this will be displayed # instead of experience points. CHANGE_LEVEL_FORMAT = true # Displays the actor's subclass level along with the main class level. This # overwrites the following definition: draw_actor_info # Set to false to prevent it from overwriting this definition. Your subclass' # level will not be displayed. SUB_LVL_FORMAT = "%s (%s)" # <main class level> (<subclass level>) DISPLAY_JP = true # Displays your actors' main class and subclass JP in the main menu. # Set to false if you don't want your actor's class and subclass JP shown. JP_FORMAT = "%s / %s" # The way jp is displayed. Default: <class jp>/<subclass jp> # --- # /Subclass Info Display options # --- # JP options SUB_JP_RATE = 1.0 # JP rate. 0.50 means half JP rate for subclass. VICTORY_MESSAGE = "%s earned %s %s in their class." # "<actor name> earned <amount> <YEA::JP::VOCAB> in their subclass." # Displayed only if Victory Aftermath/subclass Aftermath is not imported. SUB_LEVEL_JP = 0 # JP subclass gains from leveling up. SINGLE_CLASS_JP_BONUS = false # Allows those with single classes to be 'rewarded' with additional JP, as # specified by the JP subclass rate. Set to false to disable. # --- # /JP options # --- # EXP options SUB_EXP_RATE = 1.0 # EXP rate. 0.50 means half EXP rate for subclass. SINGLE_CLASS_EXP_BONUS = false # Allows those with single classes to be 'rewarded' with additional EXP, as # specified by the subclass EXP rate. Set to false to disable. VOCAB_ADDITIONAL_EXP = "%s class exp received!" # "<amount of subclass/single-class bonus exp received> secondary exp received!" # Displayed only if Victory Aftermath/Subclass Aftermath is not imported. VOCAB_SUB_LV_UP = "%s reached %s %s in their class (%s)." # "<actor name> reached <Vocab::level> <level number> in their subclass # <subclass name>." # Displayed only if Victory Aftermath/Subclass Aftermath is not imported. # --- # /EXP options # --- # Subclass Level/Unequipping options DISALLOW_NO_SUBCLASS = true # Disallows the unequipping of subclasses. Automatically set to true if # MAINTAIN_SUB_LEVELS is true. MAINTAIN_SUB_LEVELS = false # Maintain the actor's @sub_level through all subclasses. This will # automatically set DISALLOW_NO_SUBCLASS to true and set the max level all # subclasses can have to the lowest entry in DEFAULT_MAX_SUB_LEVEL and # MAX_SUB_LEVELS combined. It is strongly recommended that you set your # classes to "primary only" or "subclass only" if you use either this or # Yanfly's MAINTAIN_LEVELS, since weird things can happen otherwise. # # If all of your classes are equippable as either primary or subclass: # You can set the SUB_EXP_RATE to 1.0, so that there is no conflict between # the potential exp values available. However, if you do not have EBON - CS # Additional Functions imported and CONTINUOUS_MAINTAIN set to true, and only # one of the MAINTAIN_LEVELS are set to true, the old level will still appear # in the class selection screen of whichever MAINTAIN is not set to true. DEFAULT_MAX_SUB_LEVEL = 20 # The level cap you'd like your subclasses to stop at unless otherwise # specified. If YEA - Adjust Limits is not imported, the maximum cap is 99. # The subclass will stop leveling at the level specified here or in # MAX_SUB_LEVELS. The subclass does not stop leveling if your actor reaches # his or her level cap for their main class and the subclass cap is higher # than your actors' level cap. # If your actors' main class level cap is set to a higher level than the # subclass cap, and your actor equips the subclass as a main class, they # will not be able to re-equip that subclass if they level the subclass past # the level cap. # Note that the way this function works is by preventing your subclass from # leveling by not letting your subclass gain any more EXP. For example, if it # takes 50 EXP to get from level one to level two, and your actor's subclass # gains 50 or more EXP, the EXP gain will be reset to 49 and they will not # gain any more EXP from subsequent battles until they change subclasses (if # the level cap for that subclass is set to one). MAX_SUB_LEVELS = [ # Specify any class-specific subclass level caps here. # If YEA - Adjust Limits is not imported, the maximum level cap is 99. #-------------------------------# # Class ID | Max Subclass Level # #-------------------------------# #[248, 1],# Level 1 is the lowest cap possible. #[249, 99],# Max if YEA - Adjust Limits isn't imported. #[250, 999],# Holy crap, that's a high level cap. #[Class ID, Max Subclass Level],# Don't forget the brackets and commas! #[ , ], ]#Don't remove this. # --- # /Subclass Level/Unequipping options # --- # Learned Skills options REMEMBER_SUBCLASS_SKILLS = false # Set to true if you want your actor to remember the skills learned in their # subclass even if they don't have that subclass equipped. Setting this to # false will make your actors forget subclass skills when they don't have that # subclass equipped (as long as those skills aren't in the main class' skill # list). REMEMBER_CLASS_SKILLS = false # The same as REMEMBER_SUBCLASS_SKILLS, except it works on classes instead of # subclasses. # --- # /Learned Skills options # --- # Feature options # This section adds features from your subclass to your main class. Note that # it does so by actually putting those features into the features list of # the main class on the database level. It does not rewrite all of the # functions (definitions) that utilize those features. The script holds the # original class features and restores them on class or subclass change. ADDED_FEATURES = [ # The features you want to add from the actor's equipped subclass. # |-----------------------------------------------------------------| # | Comment a number out if you don't want to include it. Search | # | 'Setting Features' in the help file if you're unsure what any | # | of these features mean/do. | # |-----------------------------------------------------------------| # | [14, 42, 44]: these are features that could potentially | # | conflict with features 13, 41, and 43 (respectively) in the | # | actor's main class. If they're just included here, they will be | # | added only if there is no conflict (for example, if the main | # | class has not specifically allowed the skill type "magic," but | # | the subclass does disallow use of the skill type "magic"). | # | ==> If you want them to be forcefully added even if there <== | # | ==> is a conflict, uncomment them in FORCED_FEATURES. <== | # |-----------------------------------------------------------------| # ▼ ---===> Uncommenting these ▼ here will have no effect. <====--- ▼ # |-----------------------------------------------------------------| # | [21, 41, 51, 52]: Yanfly takes care of these in his script. | # |-----------------------------------------------------------------| # | [53, 54, 55]: these are features that will conflict with | # | weapons, equipment, and/or shield-wearing in the actor's main | # | class. If you would like them to be added as features anyway, | # | ==> uncomment them in FORCED_FEATURES. <== | # |-----------------------------------------------------------------| # | [62, 64]: these are features whose data ID meanings are preset. | # | For 62: Use SPECL_FEATURES. For 64: Use PARTY_FEATURES. | | # | ==> Uncomment the data IDs to add in the relevant list. <== | # |-----------------------------------------------------------------| #----------------------------------------------------------------------------- # Feature Number Feature Name Feature Desc Notes #----------------------------------------------------------------------------- 11, #FEATURE_ELEMENT_RATE (Element Rate) 12, #FEATURE_DEBUFF_RATE (Debuff Rate) 13, #FEATURE_STATE_RATE (State Rate) 14, #FEATURE_STATE_RESIST (State Resist) <--- POSSIBLE CONFLICT #21, #FEATURE_PARAM (Parameter) <----------------- YANFLY 22, #FEATURE_XPARAM (Ex-Parameter) 23, #FEATURE_SPARAM (Sp-Parameter) 31, #FEATURE_ATK_ELEMENT (Atk Element) 32, #FEATURE_ATK_STATE (Atk State) 33, #FEATURE_ATK_SPEED (Atk Speed) 34, #FEATURE_ATK_TIMES (Atk Times+) #41, #FEATURE_STYPE_ADD (Add Skill Type) <------------ YANFLY 42, #FEATURE_STYPE_SEAL (Disable Sk. Type) <--- POSS CONFLICT 43, #FEATURE_SKILL_ADD (Add Skill) 44, #FEATURE_SKILL_SEAL (Disable Skill) <-- POSSIBLE CONFLICT #51, #FEATURE_EQUIP_WTYPE (Equip Weapon) <-------------- YANFLY #52, #FEATURE_EQUIP_ATYPE (Equip Armor) <--------------- YANFLY #53, #FEATURE_EQUIP_FIX (Lock Equip) <--------- WILL CONFLICT #54, #FEATURE_EQUIP_SEAL (Seal Equip) <--------- WILL CONFLICT #55, #FEATURE_SLOT_TYPE (Slot Type) <---------- WILL CONFLICT 61, #FEATURE_ACTION_PLUS (Action Times+) #62, #FEATURE_SPECIAL_FLAG (Special Flag) <-- SEE SPECL_FEATURES #63, #FEATURE_COLLAPSE_TYPE (Collapse Effect) <------- IRRELEVANT #64 #FEATURE_PARTY_ABILITY (Party Abilities) <SEE PARTY_FEATURES ]#Don't remove this. FORCED_FEATURES = [ # The features you want to force to override the relevant features in your # main class. For example, if your main class has enabled skill type 1 and # your subclass disables skill type 1, added features will not disable it. # You would have to uncomment 42 (disable skill type) in this list for it # to be disabled in the event of a conflict. #----------------------------------------------------------------------------- # Feature Number Feature Name Feature Desc Relevant Features #----------------------------------------------------------------------------- 14, #FEATURE_STATE_RESIST (State Resist) <------------------ 13 #42, #FEATURE_STYPE_SEAL (Disable Skill Type) <----------- 41 #44, #FEATURE_SKILL_SEAL (Disable Skill) <---------------- 43 #53, #FEATURE_EQUIP_FIX (Lock Equip) <------------- 51/52/53 #54, #FEATURE_EQUIP_SEAL (Seal Equip) <------------- 51/52/53 #55, #FEATURE_SLOT_TYPE (Slot Type) <-------------------- 55 ]#Don't remove this SPECL_FEATURES = [ # These are the features listed under 'special flag' in the features tab. # Uncomment a feature if you want it to be added when a subclass that has that # feature is equipped, or comment it out if you don't want it to be added. #----------------------------------------------------------------------------- # Data ID Number Data ID Name Feature Desc #----------------------------------------------------------------------------- #0, #FLAG_ID_AUTOBATTLE (Auto Battle) 1, #FLAG_ID_GUARD (Guard) 2, #FLAG_ID_SUBSTITUTE (Substitute) 3, #FLAG_ID_PRESERVE_TP (Preserve TP) ]#Don't remove this. PARTY_FEATURES = [ # These are the features listed under 'party ability' in the features tab. # Uncomment a feature if you want it to be added when a subclass that has that # feature is equipped, or comment it out if you don't want it to be added. #----------------------------------------------------------------------------- # Data ID Number Data ID Name Feature Desc #----------------------------------------------------------------------------- 0, #ABILITY_ENCOUNTER_HALF (Halve Encounters) 1, #ABILITY_ENCOUNTER_NONE (Disable Encounters) 2, #ABILITY_CANCEL_SURPRISE (Disable Surprise) 3, #ABILITY_RAISE_PREEMPTIVE (Increase Preemptive Strike Rate) 4, #ABILITY_GOLD_DOUBLE (Double Money Earned) 5, #ABILITY_DROP_ITEM_DOUBLE (Double Item Acquisition Rate) ]#Don't remove this. # --- # /Feature options end #===============================================================================# ▼ As Yanfly says:# Editting anything past this point may potentially result in causing computer# damage, incontinence, explosion of user's head, coma, death, and/or halitosis,# so edit at your own risk.#===============================================================================module EBON module REGEXP module BASEITEM # --- # Begin Subclass Compatibility (initial subclass values) SUB_INIT = /<(?:INITIAL_SUBCLASS|initial subclass):[ ](\d+|\d+\D+\d+)>/i end #BASEITEM end #REGEXPend #EBON #==============================================================================# ■ DataManager#============================================================================== module DataManager #-------------------------------------------------------------------------- # alias method: load_database #-------------------------------------------------------------------------- class <<self; alias load_database_esm load_database; end def self.load_database load_database_esm index = $data_classes.find {|cl| !cl.nil?} unless !index.exp_array.nil? for obj in $data_classes obj.setup_exp_array unless obj.nil? end end load_notetags_esm end #-------------------------------------------------------------------------- # new method: load_notetags_esm #-------------------------------------------------------------------------- def self.load_notetags_esm for act in $data_actors next if act.nil? act.load_notetags_esm end end end # DataManager # --- # /Subclass Compatibility (initial subclass values) #===============================================================================# ■ RPG::Class#=============================================================================== class RPG::Class # --- # Begin EXP Array (to reduce processing time of class_level) #-------------------------------------------------------------------------- # new method: setup_exp_array # (to setup exp array; initialize is a mystery for later solving) #-------------------------------------------------------------------------- def setup_exp_array array = [] (1..99).each do |i| array.push(exp_for_level(i)) end @exp_array = array end #-------------------------------------------------------------------------- # new method: exp_array # (to retrieve exp_array) #-------------------------------------------------------------------------- def exp_array @exp_array end # --- # /EXP Array (to reduce processing time of class_level) # --- # Subclass Compatibility (features) #-------------------------------------------------------------------------- # new method: change_features # (to restore original features or add new ones) #-------------------------------------------------------------------------- def change_features(features, _case = nil) _case ? @features += features : @features = features end # --- # /Subclass Compatibility (features) # --- # Subclass Compatibility (level 100+) #-------------------------------------------------------------------------- # new method: above_lv99_params #-------------------------------------------------------------------------- unless respond_to?("above_lv99_params") def above_lv99_params(param_id, level) return @params[param_id, level] if level <= 99 n = @params[param_id, 99] multiplier = [level - 99, 1].max change = (@params[param_id, 99] - @params[param_id, 98]) + 1 n += change * multiplier return n end end # --- # /Subclass Compatibility (level 100+) end #RPG::Class #===============================================================================# ■ RPG::Actor#=============================================================================== class RPG::Actor # --- # Begin Subclass Compatibility (initial subclass values) #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_reader :subclass_init #-------------------------------------------------------------------------- # common cache: load_notetags_esm #-------------------------------------------------------------------------- def load_notetags_esm @subclass_init = [0, 1] #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when EBON::REGEXP::BASEITEM::SUB_INIT init = $1.scan(/\d+/) @subclass_init[0] = $data_classes[init[0].to_i].nil? ? 0 : init[0].to_i @subclass_init[1] = init[1].to_i unless init[1].nil? #--- end } # self.note.split end end # --- # /Subclass Compatibility (initial subclass values) #==============================================================================# ■ BattleManager#============================================================================== module BattleManager # --- # Begin VA Compatibility (display_exp) #-------------------------------------------------------------------------- # overwrite method: display_exp #-------------------------------------------------------------------------- unless $imported["YEA-VictoryAftermath"] def self.display_exp if $game_troop.exp_total > 0 fmt = Vocab::ObtainExp $game_message.add('\.' + sprintf(fmt, $game_troop.exp_total)) end additional_exp = ($game_troop.exp_total * EBON::SUB_EXP_RATE).ceil if additional_exp > 0 fmt = EBON::VOCAB_ADDITIONAL_EXP $game_message.add('\.' + sprintf(fmt, additional_exp.group)) end gain_jp if $imported["YEA-JPManager"] end end #unless # --- # /VA Compatibility (display_exp) # --- # JP Compatibility (Enemy_Kill) #-------------------------------------------------------------------------- # overwrite method: gain_jp #-------------------------------------------------------------------------- def self.gain_jp $game_message.new_page amount = $game_troop.jp_total fmt = YEA::JP::VICTORY_MESSAGE for member in $game_party.members member.earn_jp(amount) if !member.subclass && EBON::SINGLE_CLASS_JP_BONUS member.earn_jp_alt(amount, member.class_id) end member.earn_jp_alt(amount, member.sub_id) if member.subclass next if $imported["YEA-VictoryAftermath"] value = member.battle_jp_earned.group $game_message.add('\.' + sprintf(fmt, member.name, value, Vocab::jp)) end unless $imported["YEA-VictoryAftermath"] wait_for_message fmt = EBON::VICTORY_MESSAGE for member in $game_party.members value = (amount * member.jpr * EBON::SUB_JP_RATE + member.battle_sub_jp_earned).ceil.group $game_message.add('\.' + sprintf(fmt, member.name, value, Vocab::jp)) if member.subclass end wait_for_message end end # --- # /JP Compatibility (Enemy_Kill) end # BattleManager #==============================================================================# ■ Game_Battler#============================================================================== class Game_Battler < Game_BattlerBase # --- # JP Compatibility (Action_JP) #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_reader :battle_sub_jp_earned #-------------------------------------------------------------------------- # alias method: on_battle_start #-------------------------------------------------------------------------- alias game_battler_on_battle_start_jp_yea on_battle_start def on_battle_start game_battler_on_battle_start_jp_yea @battle_sub_jp_earned = 0 end #-------------------------------------------------------------------------- # alias method: on_battle_end #-------------------------------------------------------------------------- alias game_battler_on_battle_end_jp_yea on_battle_end def on_battle_end game_battler_on_battle_end_jp_yea @battle_sub_jp_earned = 0 end #-------------------------------------------------------------------------- # alias method: item_user_effect # (to add jp to subclass when a monster is killed) #-------------------------------------------------------------------------- unless !$imported["YEA-JPManager"] alias game_battler_item_user_effect_jp_main item_user_effect def item_user_effect(user, item) game_battler_item_user_effect_jp_main(user, item) if user.actor? if $imported["EBON-JPGainEval"] unless !valid_jp_gain?(item) user.earn_jp_alt(item.jp_gain, user.sub_id) if user.subclass user.earn_jp_alt(item.jp_gain, user.class_id) if !user.subclass && EBON::SINGLE_CLASS_JP_BONUS end else user.earn_jp_alt(item.jp_gain, user.sub_id) if user.subclass user.earn_jp_alt(item.jp_gain, user.class_id) if !user.subclass && EBON::SINGLE_CLASS_JP_BONUS end end end end # --- # /JP Compatibility (Action_JP) end #Game_Battler #==============================================================================# ■ Game_BattlerBase#============================================================================== class Game_BattlerBase # --- # Subclass Compatibility (PBG) #-------------------------------------------------------------------------- # new method: sub_param_bonus_growth #-------------------------------------------------------------------------- def sub_param_bonus_growth(param_id) n = 0.0 unless !actor? || !self.subclass || !$imported["YEA-ParamBonusGrowth"] n += self.subclass.param_bonus_growth[param_id] end return n end # --- # /Subclass Compatibility (PBG) end #Game_BattlerBase #==============================================================================# ■ Game_Actor#============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :sub_level attr_accessor :subclass_id # --- # JP Compatibility (Enemy_Kill, Level_Up, Action_JP) #-------------------------------------------------------------------------- # new method: earn_jp_alt # (to give JP to sub/alternate class at a specific rate and record the amount # of subclass JP earned in battle) #-------------------------------------------------------------------------- def earn_jp_alt(jp, class_id = nil) class_id = @class_id if class_id.nil? value = (jp * jpr * EBON::SUB_JP_RATE).ceil if $game_party.in_battle @battle_sub_jp_earned = 0 if @battle_sub_jp_earned.nil? @battle_sub_jp_earned += value end gain_jp(value, class_id) end #-------------------------------------------------------------------------- # overwrite method: gain_jp # (to prevent extra @battle_jp_earned if the class sent to it isn't the main # class) #-------------------------------------------------------------------------- def gain_jp(jp, class_id = nil) class_id = @class_id if class_id.nil? init_jp if @jp.nil? @jp[class_id] = 0 if @jp[class_id].nil? @jp[class_id] += jp.to_i @jp[class_id] = [[@jp[class_id], YEA::JP::MAX_JP].min, 0].max @battle_jp_earned = 0 if @battle_jp_earned.nil? && $game_party.in_battle @battle_jp_earned += jp.to_i if $game_party.in_battle && class_id == @class_id end # --- # /JP Compatibility (Enemy_Kill, Level_Up, Action_JP) # --- # Error Prevent Functions #-------------------------------------------------------------------------- # alias method: setup # (to intialize actor's starting values at base level) #-------------------------------------------------------------------------- alias game_actor_setup_cs_yea setup def setup(actor_id) game_actor_setup_cs_yea(actor_id) setup_initial_subclass end #-------------------------------------------------------------------------- # overwrite method: init_subclass # (to reset subclass data to no subclass equipped) #-------------------------------------------------------------------------- def init_subclass @subclass_id = 0 @sub_level = 1 @max_sub_level = 1 @class_features = class_features @sub_features = [] end #-------------------------------------------------------------------------- # new method: setup_initial_subclass # (to initialize subclass from notes) #-------------------------------------------------------------------------- def setup_initial_subclass class_id = actor.subclass_init[0] == @class_id ? 0 : actor.subclass_init[0] return if !class_allowed?(class_id, :subclass) lv = [[actor.subclass_init[1], 1].max, find_max_sub_level(class_id)].min @exp[class_id] = $data_classes[class_id].exp_for_level(lv) if EBON::MAINTAIN_SUB_LEVELS @sub_level = class_level(class_id, "compare") @max_sub_level = find_max_sub_level(class_id) end change_subclass(class_id) for i in 0...8 do @param_plus[i] += sub_param_bonus_growth(i) * (lv - 1) end recover_all end #-------------------------------------------------------------------------- # overwrite method: initialize skills # (to initialize subclass skills as well) #-------------------------------------------------------------------------- def init_skills @skills = [] self.class.learnings.each do |learning| learn_skill(learning.skill_id) if learning.level <= @level end learn_other_skills if subclass end #-------------------------------------------------------------------------- # alias method: param_base # (to prevent errors if the subclass level is higher than 99) #--------------------------------------------------------------------------- alias yea_param_base_cs param_base def param_base(param_id) if subclass && @sub_level > 99 cur_exp = @exp[sub_id] @exp[sub_id] = subclass.exp_for_level(99) end result = yea_param_base_cs(param_id) unless !subclass || @sub_level <= 99 @exp[sub_id] = cur_exp subclass_rate = YEA::CLASS_SYSTEM::SUBCLASS_STAT_RATE if subclass_rate > 0 result += ((subclass.above_lv99_params(param_id, @sub_level) * subclass_rate).to_i) - ((subclass.above_lv99_params(param_id, 99) * subclass_rate).to_i) end end result.to_i end # --- # /Error Prevent Functions # --- # Return Functions #-------------------------------------------------------------------------- # new method: sub_id # (to set the value of subclass_id to 0 if nil and return the actor's # subclass ID) #-------------------------------------------------------------------------- def sub_id; @subclass_id; end #-------------------------------------------------------------------------- # new method: sub_exp # (to retrieve subclass experience) #-------------------------------------------------------------------------- def sub_exp; @exp[sub_id] || 0; end #-------------------------------------------------------------------------- # new method: sub_current_level_exp # (to retrieve subclass' exp to level up at current level) #-------------------------------------------------------------------------- def sub_current_level_exp; !subclass ? 0 : subclass.exp_for_level(@sub_level) end #-------------------------------------------------------------------------- # new method: sub_next_level_exp # (to retrieve subclass' exp to level up at next level) #-------------------------------------------------------------------------- def sub_next_level_exp !subclass ? 0 : subclass.exp_for_level(@sub_level + 1) end #-------------------------------------------------------------------------- # new method: max_sub_exp # (to return maximum subclass experience allowed) #-------------------------------------------------------------------------- def max_sub_exp(class_id = nil) if class_id return 0 if $data_classes[class_id].nil? _class = $data_classes[class_id] return _class.exp_for_level([find_max_sub_level(class_id) + 1, 2].max) - 1 end !subclass ? 0 : subclass.exp_for_level([max_sub_level + 1, 2].max) - 1 end #-------------------------------------------------------------------------- # overwrite method: class_level Edited by DisturbedInside/Ebonflame # (to determine level of class without relying on @level or @sub_level; # allows subclasses to be higher than classes and vice-versa) #-------------------------------------------------------------------------- def class_level(class_id, sub = false) return 1 if !$data_classes[class_id] if sub == false return @level if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS maxi = actor.max_level elsif sub == true return @sub_level if EBON::MAINTAIN_SUB_LEVELS maxi = find_max_sub_level(class_id) elsif sub == "compare" maxi = [actor.max_level, find_max_sub_level(class_id)].max end temp_class = $data_classes[class_id] class_exp = @exp[class_id] || 0 exp_max = [class_exp, (temp_class.exp_for_level(maxi + 1) - 1)].min # Note: Originally, DisturbedInside had this adjusting linearly for levels # above 99 (by 50744), but exp_for_level doesn't return linear values, and # since the rest of his code was based off exp_for_level, I changed it so # exp_max was non-linear as well. [~Ebonflame] exp_array = temp_class.exp_array # The exp for the most common levels are now stored in an array if you have # EBON - CSAdditionalFunctions or EBON - SubManager imported, for the sake of # a faster processing speed. If they aren't imported, change this line to: # exp_array = temp_class.respond_to?("exp_array") ? temp_class.exp_array : [] index = exp_array.index(exp_array.find {|val| val > exp_max}) return index unless index.nil? #--- DisturbedInside's code, slightly modified n = 100 # if you changed the index line, you'll need to change this line also: # n = temp_class.respond_to?("exp_array") ? 100 : 2 loop do break if temp_class.exp_for_level(n) > exp_max n += 1 end return n end #-------------------------------------------------------------------------- # overwrite method: subclass_level # (to return the value of the subclass' level without relying on @sub_level - # can evaluate classes as if they were subclasses even if they aren't # currently equipped as a subclass; allows subclasses to be higher than # classes) #-------------------------------------------------------------------------- def subclass_level(class_id = nil) !class_id && !subclass ? 1 : class_level((class_id || sub_id), true) end #-------------------------------------------------------------------------- # new method: compare_levels # (to return the highest level between class level and subclass level - # allows subclasses to be higher than classes) #-------------------------------------------------------------------------- def compare_levels(class_id) class_level(class_id, "compare") end #-------------------------------------------------------------------------- # new method: max_sub_level # (to implement customizeable subclass level caps; you can still level your # subclass if you make it your main class. @max_sub_level needs to be updated # every time the current subclass is changed.) #-------------------------------------------------------------------------- def max_sub_level; !subclass ? 1 : @max_sub_level; end #-------------------------------------------------------------------------- # new method: max_sub_level? # (to determine if subclass has reached max level) #-------------------------------------------------------------------------- def max_sub_level?; @sub_level >= max_sub_level; end #-------------------------------------------------------------------------- # new method: find_max_sub_level # (so we don't have to call the find function every time we check the max # sub level) #-------------------------------------------------------------------------- def find_max_sub_level(class_id = nil) class_id = sub_id if class_id.nil? if EBON::MAINTAIN_SUB_LEVELS max_sub_level = (EBON::MAX_SUB_LEVELS.collect {|sub| sub[1]} + [EBON::DEFAULT_MAX_SUB_LEVEL]).min else max_sub_level = EBON::MAX_SUB_LEVELS.find {|sub| sub[0] == class_id} max_sub_level = !max_sub_level.nil? ? [max_sub_level[1], 1].max : [EBON::DEFAULT_MAX_SUB_LEVEL, 1].max end return max_sub_level if $imported["YEA-AdjustLimits"] [max_sub_level, 99].min end #-------------------------------------------------------------------------- # new method: class_allowed? # (to determine if the actor is allowed to equip the class/subclass) #-------------------------------------------------------------------------- def class_allowed?(class_id, symbol) return false if !$data_classes[class_id] if symbol == :primary return false if class_id == sub_id and EBON::MAINTAIN_SUB_LEVELS || EBON::DISALLOW_NO_SUBCLASS return false if $imported["YEA-ClassSpecifics"] && $data_classes[class_id].subclass_only elsif symbol == :subclass return false if (@exp[class_id] || 0) > max_sub_exp(class_id) return false if class_id == @class_id or class_id == 0 && sub_id == 0 return false if class_id == sub_id || class_id == 0 and EBON::MAINTAIN_SUB_LEVELS || EBON::DISALLOW_NO_SUBCLASS return false if $imported["YEA-ClassSpecifics"] && !subclass_requirements_met?(class_id) end check = $imported["EBON-ULMaintain"] if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS || EBON::MAINTAIN_SUB_LEVELS check = $imported["YEA-ClassUnlockLevel"] if check.nil? return false if check && !@unlocked_classes.include?(class_id) && !class_unlock_level_requirements_met?($data_classes[class_id]) return true end # --- # /Return Functions # --- # Subclass Compatibility (features) #-------------------------------------------------------------------------- # alias method: change_class # (to reset class features on subclass change, correctly change subclass # if they're unequipping it, and prevent PBG from adding extra actor growth # if the new class is higher than the old class) #-------------------------------------------------------------------------- alias game_actor_change_class_cs_yea change_class def change_class(class_id, keep_exp = false) return if !class_allowed?(class_id, :primary) self.class.change_features(@class_features) unless sub_id == 0 forget_other_skills([@class_id], true) if !EBON::REMEMBER_CLASS_SKILLS init_subclass if class_id == sub_id new_level = class_level(class_id) if keep_exp || !$imported["YEA-ParameterBonusGrowth"] || new_level <= @level game_actor_change_class_cs_yea(class_id, keep_exp) else @class_id = class_id @level = class_level(@class_id) learn_class_skills(class_id) unlock_class(class_id) correct_subclass if $imported["YEA-ClassSpecifics"] end @class_features = class_features add_subclass_features if subclass learn_other_skills([@class_id, @level]) refresh #release_unequippable_items end #-------------------------------------------------------------------------- # overwrite method: change_subclass # (to reset @sub_level, @max_sub_level, skills, and class features on subclass # change. You need to call this in order to (permanently) change the actor's # subclass - don't just change @subclass_id. You've been warned.) #-------------------------------------------------------------------------- def change_subclass(class_id) return if !class_allowed?(class_id, :subclass) unlock_class(class_id) self.class.change_features(@class_features) forget_other_skills if !EBON::REMEMBER_SUBCLASS_SKILLS if sub_id == class_id || class_id == 0 init_subclass else if EBON::MAINTAIN_SUB_LEVELS @exp[class_id] = @exp[sub_id] unless sub_id == 0 @subclass_id = class_id else @subclass_id = class_id @max_sub_level = find_max_sub_level(class_id) @sub_level = subclass_level end add_subclass_features learn_other_skills end refresh #release_unequippable_items end #-------------------------------------------------------------------------- # new method: class_features # (to define original class features) #-------------------------------------------------------------------------- def class_features(sub_features = nil) sub_features ? @class_features : self.class.features end #-------------------------------------------------------------------------- # new method: add_subclass_features # (to judge which features should be added and add them) #-------------------------------------------------------------------------- def add_subclass_features subclass_features = sub_id == 0 ? [] : subclass.features @sub_features = [] for feature in subclass_features next if feature.code == 63 # Irrelevant next if [21, 41, 51, 52].include?(feature.code) # Yanfly if [14, 42, 43, 44, 53, 54, 55, 62, 64].include?(feature.code) # Special contents = @class_features + @sub_features next if contents.any? {|ft| ft.code == feature.code && ft.data_id == feature.data_id} # Useless to add these features again if [43, 53, 54, 55, 62, 64].include?(feature.code) if feature.code == 43 next if !EBON::ADDED_FEATURES.include?(feature.code) elsif feature.code == 62 next if !EBON::SPECL_FEATURES.include?(feature.data_id) elsif feature.code == 64 next if !EBON::PARTY_FEATURES.include?(feature.data_id) else next if !EBON::FORCED_FEATURES.include?(feature.code) end else code2 = feature.code - 1 contents = @class_features.any? {|ft| ft.code == code2 && ft.data_id == feature.data_id} next if contents && !EBON::FORCED_FEATURES.include?(feature.code) end else next if !EBON::ADDED_FEATURES.include?(feature.code) end @sub_features.push(feature) end self.class.change_features(@sub_features, true) end # --- # /Subclass Compatibility (features) # --- # Subclass Functionality (learned skills modification) #-------------------------------------------------------------------------- # new method: learn_other_skills # (to add a group of skills learned from a specific class.) # Default mode: adds skills learned from the current subclass up to/including # the current @sub_level. # Use: learn_other_skills. # Secondary mode: adds skills learned from another class up to/including # a specified level (or level 1). # Use: learn_other_skills([class_id]) # learn_other_skills([class_id, level]) #-------------------------------------------------------------------------- def learn_other_skills(special = nil) #read the note -^ if !special return if !subclass _class = sub_id level = @sub_level else return if !$data_classes[special[0]] _class = special[0] level = special[1] || 1 end $data_classes[_class].learnings.each do |learning| learn_skill(learning.skill_id) if learning.level <= level end end #-------------------------------------------------------------------------- # new method: forget_other_skills # (to remove a group of skills learned from a specific class.) # Default mode: removes skills learned from the current subclass from level # one up to/including the current @sub_level. Does not delete skills learned # in the main class before the actor's current @level. # Use: forget_other_skills. # Secondary mode: removes skills learned from any class beginning at/including # a specified level (or level 1). Does not delete skills learned in the # main class before the actor's current @level. # Use: forget_other_skills([class_id]) # forget_other_skills([class_id, level]) # Tertiary mode: Same as the default or secondary mode, but removes the skills # even if the main class learns them. # Use: forget_other_skills(nil, true) # forget_other_skills([class_id], true) # forget_other_skills([class_id, level], true) #-------------------------------------------------------------------------- def forget_other_skills(special = nil, forget_main = false) #read the note -^ class_skills = self.class.learnings if special return if !$data_classes[special[0]] _class = special[0] level = special[1] || 1 else return if !$data_classes[sub_id] _class = sub_id level = @sub_level end learnings = $data_classes[_class].learnings.sort_by {|skill| skill.level} dex = learnings.index(learnings.find {|learning| learning.level >= level}) return if !dex && special learnings = special ? learnings[dex, learnings.length] : learnings[0, (dex || learnings.length)] for skill in learnings forget_skill(skill.skill_id) if forget_main || class_skills.any? {|orig| orig.skill_id == skill.skill_id && orig.level <= @level} end end # --- # /Subclass Functionality (learned skills modification) # --- # Subclass Compatibility (PBG) #-------------------------------------------------------------------------- # new method: apply_sub_param_bonus_growth #-------------------------------------------------------------------------- def apply_sub_param_bonus_growth(rate = 1) for i in 0...8 do @param_plus[i] += sub_param_bonus_growth(i) * rate end end # --- # /Subclass Compatibility (PBG) # --- # Subclass Compatibility (leveling) #-------------------------------------------------------------------------- # new method: change_sub_level # (to forcefully change your actor's subclass' level) #-------------------------------------------------------------------------- def change_sub_level(level, show) return if sub_id == 0 level = [[level, max_sub_level].min, 1].max change_sub_exp(subclass.exp_for_level(level), show) end #-------------------------------------------------------------------------- # overwrite method: gain_exp # (to allow for exp gain in subclass/main class/both classes) #-------------------------------------------------------------------------- def gain_exp(exp, type = nil) enabled = !$imported["YEA-VictoryAftermath"] ? true : !SceneManager.scene_is?(Scene_Battle) alt_exp = (exp * EBON::SUB_EXP_RATE * final_exp_rate).ceil main_exp = (@exp[@class_id] || 0) + (exp * final_exp_rate).ceil if type == nil #both classes EBON::SINGLE_CLASS_EXP_BONUS == true && sub_id == 0 ? change_exp(main_exp + alt_exp, enabled) : change_exp(main_exp, enabled) change_sub_exp(sub_exp + alt_exp, enabled) if sub_id != 0 elsif type == 1 #main class change_exp(main_exp, enabled) elsif type == 2 #subclass change_sub_exp(sub_exp + exp, enabled) if sub_id != 0 end end #-------------------------------------------------------------------------- # new method: change_sub_exp # (to add exp to subclass. Prevents your subclass from gaining exp if it's # at max level) #-------------------------------------------------------------------------- def change_sub_exp(exp, show) return if sub_id == 0 max_exp = max_sub_exp return if sub_exp >= max_exp first_level = @sub_level @exp[sub_id] = [exp, max_exp].min last_skills = skills sub_level_up while !max_sub_level? && sub_exp >= sub_next_level_exp sub_level_down while sub_exp < sub_current_level_exp unless $imported["YEA-VictoryAftermath"] display_sub_level_up(skills - last_skills) if show && @sub_level > first_level end end #-------------------------------------------------------------------------- # new method: sub_level_up # (to trigger Param Bonus Growth Add-on) #-------------------------------------------------------------------------- def sub_level_up @sub_level += 1 if $imported["YEA-JPManager"] earn_jp_alt((EBON::SUB_LEVEL_JP / EBON::SUB_JP_RATE).ceil, sub_id) unless EBON::SUB_JP_RATE == 0 end apply_sub_param_bonus_growth if $imported["YEA-ParameterBonusGrowth"] subclass.learnings.each do |learning| learn_skill(learning.skill_id) if learning.level <= @sub_level end end #-------------------------------------------------------------------------- # new method: sub_level_down # (to lose PBG on level down) #-------------------------------------------------------------------------- def sub_level_down @sub_level -= 1 apply_sub_param_bonus_growth(-1) if $imported["YEA-ParameterBonusGrowth"] end #-------------------------------------------------------------------------- # new method: display_sub_level_up # (to display subclass leveling for default display_exp) #-------------------------------------------------------------------------- def display_sub_level_up(new_skills) $game_message.new_page fmt = EBON::VOCAB_SUB_LV_UP $game_message.add(sprintf(fmt, @name, Vocab::level, @sub_level, subclass.name)) new_skills.each do |skill| $game_message.add(sprintf(Vocab::ObtainSkill, skill.name)) end end # --- # /Subclass Compatibility (leveling) end #Game_Actor #==============================================================================# ■ Game_Troop#============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # new method: sub_jp_total #-------------------------------------------------------------------------- def sub_jp_total dead_members.inject(0) {|r, enemy| r += (enemy.jp * EBON::SUB_JP_RATE).ceil} end end # Game_Troop #==============================================================================# ■ Window_Base#============================================================================== class Window_Base < Window # --- # Begin JP Compatibility (draw subclass JP) #-------------------------------------------------------------------------- # new method: draw_actor_jp_classes #-------------------------------------------------------------------------- def draw_actor_jp_classes(actor, class_id, dx, dy, dw = 112) return if !$imported["YEA-JPManager"] if Icon.jp > 0 dw -= 24 draw_icon(Icon.jp, dx + dw, dy) dx -= 3 end sub = actor.sub_id fmt = sub == 0 ? "%s" : EBON::JP_FORMAT text_total = sprintf(fmt, actor.jp(class_id).group, actor.jp(sub).group) + Vocab::jp tsize = text_size(text_total).width text_no_jp = sprintf(fmt, actor.jp(class_id).group, actor.jp(sub).group) text_no_jp_size = text_size(text_no_jp).width jp_size = text_size(Vocab::jp).width if tsize > dw shrink = 1 - (dw.to_f / tsize.to_f) if shrink > 0.4 increase = (dw * (shrink - 0.4)).ceil if increase <= 12 #max spare space dw += increase dx -= increase jp_size = (jp_size * 0.6) text_no_jp_size = (text_no_jp_size * 0.6) else text_no_jp = actor.jp(class_id).group text_no_jp_size = text_size(text_no_jp).width if text_no_jp_size + jp_size > dw shrink = (dw.to_f / (text_no_jp_size + jp_size).to_f) jp_size = (jp_size * [0.6, shrink].min).ceil text_no_jp_size = (text_no_jp_size * [0.6, shrink].min).ceil end end else jp_size = (jp_size * (1 - shrink).abs).ceil text_no_jp_size = (text_no_jp_size * (1 - shrink).abs).ceil end end change_color(system_color) draw_text(dx + (dw - jp_size), dy, jp_size, line_height, Vocab::jp, 2) change_color(normal_color) draw_text(dx + (dw - text_no_jp_size) - jp_size, dy, text_no_jp_size, line_height, text_no_jp, 2) end #-------------------------------------------------------------------------- # alias method: draw_actor_simple_status #-------------------------------------------------------------------------- alias game_window_draw_actor_simple_status_cssm draw_actor_simple_status def draw_actor_simple_status(actor, dx, dy) dy -= line_height / 2 if !$imported["YEA-AceMenuEngine"] game_window_draw_actor_simple_status_cssm(actor, dx, dy) if EBON::DISPLAY_JP dy2 = $imported["YEA-AceMenuEngine"] ? dy - line_height / 2 : dy draw_actor_jp_classes(actor, actor.class_id, dx+3, dy2 + line_height * 3) end end # --- # /JP Compatibility (draw subclass JP) # --- # Subclass Compatibility (draw subclass level) #-------------------------------------------------------------------------- # overwrite method: draw_actor_level #-------------------------------------------------------------------------- alias game_window_draw_actor_level_cssm draw_actor_level def draw_actor_level(actor, x, y) if actor.sub_id == 0 || !EBON::CHANGE_LEVEL_FORMAT game_window_draw_actor_level_cssm(actor, x, y) else fmt = EBON::SUB_LVL_FORMAT text = sprintf(fmt, actor.level, actor.sub_level) tsize = text_size(text).width lvsize = text_size(Vocab::level_a).width change_color(system_color) draw_text(x, y, lvsize, line_height, Vocab::level_a) change_color(normal_color) draw_text(x + lvsize, y, [tsize, 144].min, line_height, text, 2) end end # --- # /Subclass Compatibility (draw subclass level) end #Window_Base #==============================================================================# ■ Window_Status#============================================================================== class Window_Status < Window_Selectable # --- # Subclass Compatibility (larger area for class to be displayed in # --- # status menu) #-------------------------------------------------------------------------- # * Draw Block 1 #-------------------------------------------------------------------------- alias game_window_draw_block1_cssm draw_block1 def draw_block1(y) if !EBON::DISPLAY_SUB_INFO game_window_draw_block1_cssm(y) else dw = (contents.width/3) - standard_padding s1 = text_size(@actor.class).width s2 = text_size(@actor.nickname).width draw_actor_name(@actor, standard_padding, y, dw) draw_actor_class(@actor, ((contents.width/2) - (s1/2)), y, dw) draw_actor_nickname(@actor, (contents.width - s2 - standard_padding), y, dw) end end # --- # /Subclass Compatibility (larger area for class to be displayed in # --- # status menu) # --- # Subclass Compatibility (show subclass exp) #-------------------------------------------------------------------------- # * Draw Experience Information #-------------------------------------------------------------------------- alias game_window_draw_exp_info_cssm draw_exp_info def draw_exp_info(x, y) if !EBON::DISPLAY_SUB_INFO draw_exp_info_cssm(x, y) else s_next = sprintf(Vocab::ExpNext, Vocab::level) s_size = text_size(s_next).width x += (((contents.width - x)/2) - (s_size/1.5)) dw = contents.width - x + 15 s1 = @actor.max_level? ? EBON::MAX_LV : @actor.exp.group s2 = @actor.max_level? ? EBON::MAX_LV : (@actor.next_level_exp - @actor.exp).group s3 = @actor.max_sub_level? ? EBON::MAX_LV : @actor.sub_exp.group s4 = @actor.sub_id == 0 || @actor.max_sub_level? ? EBON::MAX_LV : (@actor.sub_next_level_exp - @actor.sub_exp).group fmt = @actor.subclass_id == 0 ? "%s" : EBON::SUB_EXP_DISPLAY change_color(system_color) draw_text(x - 15, y + line_height * 0, dw, line_height, Vocab::ExpTotal) draw_text(x - 15, y + line_height * 2, dw, line_height, s_next) change_color(normal_color) draw_text(x, y + line_height * 1, dw, line_height, sprintf(fmt, s1, s3)) draw_text(x, y + line_height * 3, dw, line_height, sprintf(fmt, s2, s4)) end end # --- # /Subclass Compatibility (show subclass exp) end #Window_Status #==============================================================================# ■ Window_ClassList#============================================================================== class Window_ClassList < Window_Selectable # --- # Correction: Relative Level Display #-------------------------------------------------------------------------- # overwrite method: draw_class_level # (to show the correct relative class level) #-------------------------------------------------------------------------- def draw_class_level(item, rect) return if @actor.nil? if @command_window.current_symbol == :primary return if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS level = @actor.class_level(item.id) elsif @command_window.current_symbol == :subclass return if EBON::MAINTAIN_SUB_LEVELS level = @actor.class_level(item.id, true) end contents.font.size = YEA::CLASS_SYSTEM::LEVEL_FONT_SIZE text = sprintf(YEA::CLASS_SYSTEM::CLASS_LEVEL, level.group) draw_text(rect, text, 2) end # --- # /Correction: Relative Level Display # --- # Correction: enable? #-------------------------------------------------------------------------- # enable? #-------------------------------------------------------------------------- def enable?(item) return false if [email protected]_allowed?(item.id, @command_window.current_symbol) true end # --- # /Correction: enable? # --- # Hide Unequippable Classes #-------------------------------------------------------------------------- # include? #-------------------------------------------------------------------------- if EBON::HIDE_UNEQUIPPABLE_CLASSES def include?(item) cur = @command_window.current_symbol return false if ![:primary, :subclass].include?(cur) return true if item.id == @actor.class_id && cur == :primary or item.id == @actor.sub_id && cur == :subclass unlocked = YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS + @actor.unlocked_classes return true if unlocked.include?(item.id) && @actor.class_allowed?(item.id, cur) false end end # --- # /Hide Unequippable Classes end #Window_ClassList