# Don't touch, all customizations can be done in the script above.
#===============================================================================
module S_B::CLASS
module_function
def permit_jobchange(enabled = true)
if enabled
$game_switches[S_B::CLASS::DISABLE_CLASS] = false
else
$game_switches[S_B::CLASS::DISABLE_CLASS] = true
end
end
#--------------------------------------------------------------------------
def check_class_level(actor, class_id, variable_id = 0)
level = 0
c = $data_classes[class_id]
level = $game_actors[actor].class_level[c.id]
$game_variables[variable_id] = level if variable_id > 0
return level
end
#--------------------------------------------------------------------------
def actor_class_list_size(actor, variable_id = 0)
class_list = $game_actors[actor].unlocked_classes
$game_variables[variable_id] = class_list.size if variable_id > 0
return class_list
end
end
#===============================================================================
class Game_Interpreter
include S_B::CLASS
end
#===============================================================================
module Vocab
ObtainClassExp = S_B::CLASS::ObtainClassExp
ClassLevelUp = S_B::CLASS::ClassLevelUp
Display_Actor_Msg = S_B::CLASS::DISPLAY_ACTOR_MSG
Classes_Vocab = S_B::CLASS::MENU_CLASS_CHANGE_TITLE
def self.jp
return S_B::CLASS::CLASS_EXP
end
def self.jp_a
return S_B::CLASS::CLASS_EXP_A
end
end
$imported = {} if $imported == nil
$imported["JobChange"] = true
#===============================================================================
module YE
module REGEXP
module BASEITEM
# These are skill related.
JP_BOOST_SET = /<(?:JP_BOOST_SET|jp_boost_set)\s*(\d+)>/i
JP_BOOST_RAN = /<(?:JP_BOOST_RAN|jp_boost_ran)\s*(\d+)>/i
# These are item related.
GAIN_JP = /<(?:GAIN_JP|gain_jp)\s*(\d+)>/i
UNLOCK_CLASS = /<(?:UNLOCK_CLASS|unlock class)[ ]*(\d+)>/i
LOCK_CLASS = /<(?:LOCK_CLASS|lock class)[ ]*(\d+)>/i
end # BASEITEM
module ENEMY
# These are enemy related
ENEMY_JP = /<(?:ENEMY_JP|enemy_jp)\s*(\d+)>/i
end # ENEMY
module STATE
# This affects states.
BONUS_JP_PER = /<(?:BONUS_JP_PER|bonus_jp_per)[ ]*(\d+)(?:%|%)?>/i
BONUS_JP_SET = /<(?:BONUS_JP_SET|bonus_jp_set)[ ]*(\d+)>/i
end # STATE
end # REGEXP
end # YE
#===============================================================================
# RPG::State *from yanfly
#===============================================================================
class RPG::State
#--------------------------------------------------------------------------
# Yanfly_Cache_SSS
#--------------------------------------------------------------------------
def yanfly_cache_state_sss
@bonus_jp_per = 100; @bonus_jp_set = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when YE::REGEXP::STATE::BONUS_JP_PER
@bonus_jp_per = $1.to_i
when YE::REGEXP::STATE::BONUS_JP_SET
@bonus_jp_set = $1.to_i
end
}
end # cache
#--------------------------------------------------------------------------
# definitions
#--------------------------------------------------------------------------
def bonus_jp_per
yanfly_cache_state_sss if @bonus_jp_per == nil
return @bonus_jp_per
end
def bonus_jp_set
yanfly_cache_state_sss if @bonus_jp_set == nil
return @bonus_jp_set
end
end
#===============================================================================
# RPG::BaseItem *from yanfly
#===============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# Yanfly_Cache_SSS
#--------------------------------------------------------------------------
def yanfly_cache_baseitem_sss
@jp_boost_set = 0; @jp_boost_ran = 0
@gain_jp = 0; @unlock_class = []; @lock_class = []
self.note.split(/[\r\n]+/).each { |line|
case line
when YE::REGEXP::BASEITEM::JP_BOOST_SET
@jp_boost_set = $1.to_i
when YE::REGEXP::BASEITEM::JP_BOOST_RAN
@jp_boost_ran = $1.to_i
when YE::REGEXP::BASEITEM::GAIN_JP
@gain_jp = $1.to_i
when YE::REGEXP::BASEITEM::UNLOCK_CLASS
@unlock_class.push($1.to_i)
when YE::REGEXP::BASEITEM::LOCK_CLASS
@lock_class.push($1.to_i)
end
}
end # cache
#--------------------------------------------------------------------------
# JP definitions
#--------------------------------------------------------------------------
def jp_boost_set
yanfly_cache_baseitem_sss if @jp_boost_set == nil
return @jp_boost_set
end
def jp_boost_ran
yanfly_cache_baseitem_sss if @jp_boost_ran == nil
return @jp_boost_ran
end
def gain_jp
yanfly_cache_baseitem_sss if @gain_jp == nil
return @gain_jp
end
#--------------------------------------------------------------------------
# class definitions
#--------------------------------------------------------------------------
def unlock_class
yanfly_cache_baseitem_sss if @unlock_class == nil
return @unlock_class
end
def lock_class
yanfly_cache_baseitem_sss if @lock_class == nil
return @lock_class
end
end
#===============================================================================
# RPG::Enemy *from yanfly
#===============================================================================
class RPG::Enemy
#--------------------------------------------------------------------------
# Yanfly_Cache_SSS
#--------------------------------------------------------------------------
def yanfly_cache_enemy_sss
@enemy_jp = S_B::CLASS::ENEMIES_JP_DEFAULT
self.note.split(/[\r\n]+/).each { |line|
case line
when YE::REGEXP::ENEMY::ENEMY_JP
@enemy_jp = $1.to_i
end
}
end # cache
#--------------------------------------------------------------------------
# definitions
#--------------------------------------------------------------------------
def enemy_jp
yanfly_cache_enemy_sss if @enemy_jp == nil
return @enemy_jp
end
end
#==============================================================================
# ** Game_Actor *from prexus and TBK and blackmorning
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :jp_list
attr_accessor :jp_exp
attr_accessor :class_level
#--------------------------------------------------------------------------
alias job_initialize initialize unless $@
#--------------------------------------------------------------------------
def initialize(actor_id)
job_initialize(actor_id)
@exist_character_graphics = []
end
#--------------------------------------------------------------------------
alias job_setup setup unless $@
#--------------------------------------------------------------------------
def setup(actor_id)
job_setup(actor_id) #default
@jp_list = {}
for id in 1..$data_classes.size - 1
next unless $data_classes[id]
@jp_list[id] = Array.new(101)
end
make_jp_exp_list
@jp_exp = {}
@jp_exp.default = 0
@class_level = {}
@class_level.default = 1
@skills = []
define_skills
@unlocked_classes = S_B::CLASS::AVAILABLE_CLASSES[self.id] # What classes are unlocked.
@unlocked_classes = [self.class.id] if S_B::CLASS::AVAILABLE_CLASSES[self.id] == nil
end
#--------------------------------------------------------------------------
# * Calculate JP Experience
#--------------------------------------------------------------------------
def make_jp_exp_list
for id in 1..$data_classes.size - 1
next unless $data_classes[id]
if S_B::CLASS::Custom_JP_Needed_For_Level
if S_B::CLASS::CLASS_JP_MOD.include?(id)
jp_basis = S_B::CLASS::CLASS_JP_MOD[id][0]
jp_inflation = S_B::CLASS::CLASS_JP_MOD[id][1]
else
jp_basis = S_B::CLASS::CLASS_JP_MOD_BASIS
jp_inflation = S_B::CLASS::CLASS_JP_MOD_INFLATION
end
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
@jp_list[id][1] = @jp_list[id][maxlevel+1] = 0
m = jp_basis
n = (0.75 + jp_inflation / 200.0);
for i in 2..(maxlevel)
@jp_list[id][i] = @jp_list[id][i - 1] + Integer(m)
m *= 1 + n;
n *= 0.5;
end
else
@jp_list[id] = @exp_list
end
end
end
#--------------------------------------------------------------------------
def forget_class_skills(id = nil)
for skill in @skills
@skills.delete(skill.skill_id)
end
id = @class_id if id == nil
for i in $data_classes[id].learnings
forget_skill(i.skill_id) unless S_B::CLASS::KEEP_SKILLS or S_B::CLASS::SPECIAL_CLASS_ACTORS.include?(actor.id)
end
end
#--------------------------------------------------------------------------
def define_skills(id = nil)
id = @class_id if id == nil
if !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
for i in $data_classes[id].learnings
learn_skill(i.skill_id) if i.level <= @level
end
else
for i in $data_classes[id].learnings
learn_skill(i.skill_id) if i.level <= @class_level[id]
end
end
end
#--------------------------------------------------------------------------
def change_jp(jp, id = nil, show = false)
id = @class_id if id == nil
last_level = @class_level[id]
last_skills = skills
@jp_exp[id] = [[jp, 999999].min, 0].max
while @jp_exp[id] >= @jp_list[id][@class_level[id] + 1] and @jp_list[id][@class_level[id] + 1] > 0
class_level_up(id)
end
while @jp_exp[id] < @jp_list[id][@class_level[id]]
class_level_down(id)
end
if show and @class_level[id] > last_level
display_class_level_up(skills - last_skills, id)
end
end
#--------------------------------------------------------------------------
def jp_exp_s(id = nil)
id = @class_id if id == nil
return @jp_list[id][@class_level[id]+1] > 0 ? @jp_exp[id] : "-------"
end
#--------------------------------------------------------------------------
# * Get jp - numeric for calculations
#--------------------------------------------------------------------------
def now_jp_exp(id = nil)
id = @class_id if id == nil
return @jp_exp[id] - @jp_list[id][@class_level[id]]
end
#--------------------------------------------------------------------------
def next_jp_exp_s(id = nil)
id = @class_id if id == nil
return @jp_list[id][@class_level[id]+1] > 0 ? @jp_list[id][@class_level[id]+1] : "-------"
end
#--------------------------------------------------------------------------
def next_class_rest_exp_s(id = nil)
id = @class_id if id == nil
return @jp_list[id][@class_level[id]+1] > 0 ? (@jp_list[id][@class_level[id]+1] - @jp_exp[id]) : "-------"
end
#--------------------------------------------------------------------------
def class_level_up(id = nil, adjust = false)
id = @class_id if id == nil
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
@class_level[id] += 1 unless @class_level[id] == maxlevel
@jp_exp[id] = @jp_list[id][@class_level[id]]
if S_B::CLASS::LEVEL_UP_BONUSES
if S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::STAT_BONUS.include?(id)
self.maxhp += S_B::CLASS::STAT_BONUS[id][0]
self.maxmp += S_B::CLASS::STAT_BONUS[id][1]
self.atk += S_B::CLASS::STAT_BONUS[id][2]
self.def += S_B::CLASS::STAT_BONUS[id][3]
self.spi += S_B::CLASS::STAT_BONUS[id][4]
self.agi += S_B::CLASS::STAT_BONUS[id][5]
self.res += S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
self.dex += S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
end
end
define_skills
define_skills(id) if S_B::CLASS::KEEP_SKILLS or S_B::CLASS::SPECIAL_CLASS_ACTORS.include?(actor.id)
end
#--------------------------------------------------------------------------
def class_level_down(id = nil, adjust = false)
id = @class_id if id == nil
@class_level[id] -= 1 unless @class_level[id] == 1
@jp_exp[id] = @jp_list[id][@class_level[id]]
if S_B::CLASS::LEVEL_UP_BONUSES
if S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::LOSE_STAT_BONUS && S_B::CLASS::STAT_BONUS.include?(id)
self.maxhp -= S_B::CLASS::STAT_BONUS[id][0]
self.maxmp -= S_B::CLASS::STAT_BONUS[id][1]
self.atk -= S_B::CLASS::STAT_BONUS[id][2]
self.def -= S_B::CLASS::STAT_BONUS[id][3]
self.spi -= S_B::CLASS::STAT_BONUS[id][4]
self.agi -= S_B::CLASS::STAT_BONUS[id][5]
self.res -= S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
self.dex -= S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
end
end
define_skills
define_skills(id) if S_B::CLASS::KEEP_SKILLS or S_B::CLASS::SPECIAL_CLASS_ACTORS.include?(actor.id)
end
#--------------------------------------------------------------------------
# level up
#--------------------------------------------------------------------------
def level_up
@level += 1
if S_B::CLASS::LEVEL_UP_BONUSES
if !S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::STAT_BONUS.include?(id)
self.maxhp += S_B::CLASS::STAT_BONUS[id][0]
self.maxmp += S_B::CLASS::STAT_BONUS[id][1]
self.atk += S_B::CLASS::STAT_BONUS[id][2]
self.def += S_B::CLASS::STAT_BONUS[id][3]
self.spi += S_B::CLASS::STAT_BONUS[id][4]
self.agi += S_B::CLASS::STAT_BONUS[id][5]
self.res += S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
self.dex += S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
end
end
end
#--------------------------------------------------------------------------
alias jp_leveldown level_down unless $@
#--------------------------------------------------------------------------
def level_down
jp_leveldown
if S_B::CLASS::LEVEL_UP_BONUSES
if !S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::LOSE_STAT_BONUS && S_B::CLASS::STAT_BONUS.include?(id)
self.maxhp -= S_B::CLASS::STAT_BONUS[id][0]
self.maxmp -= S_B::CLASS::STAT_BONUS[id][1]
self.atk -= S_B::CLASS::STAT_BONUS[id][2]
self.def -= S_B::CLASS::STAT_BONUS[id][3]
self.spi -= S_B::CLASS::STAT_BONUS[id][4]
self.agi -= S_B::CLASS::STAT_BONUS[id][5]
self.res -= S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
self.dex -= S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
end
end
end
#--------------------------------------------------------------------------
def jp_received(jp, id = nil, show = false)
id = @class_id if id == nil
change_jp(@jp_exp[id] + jp, id, show)
end
#--------------------------------------------------------------------------
# forget all skills
#--------------------------------------------------------------------------
def forget_all_skills
@skills = []
end
#--------------------------------------------------------------------------
def class_change_level(level, id = nil, show = false)
id = @class_id if id == nil
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
level = [[level, maxlevel].min, 1].max
change_jp(@jp_list[id][level], id, show)
end
#--------------------------------------------------------------------------
def class_id=(class_id)
forget_class_skills
@class_id = class_id
for i in 0..4 # Remove unequippable items
change_equip(i, nil) unless equippable?(equips[i])
end
if $imported["EquipExtension"]
return if extra_armor_number == 0
for i in 5..armor_number
change_equip(i, nil) unless equippable?(equips[i])
end
end
purge_unequippable if $imported["EquipmentOverhaul"]
unless @unlocked_classes.include?(@class_id)
@unlocked_classes.push(@class_id)
end
@unlocked_classes.sort!
purge_unequippable_skills if $imported["EquipSkillSlots"]
define_skills
pic_name = "$#{actor.id}_#{$data_classes[class_id].id}"
if S_B::CLASS::CHANGE_GRAPHIC && graphic_exist?(pic_name)
$game_actors[@actor_id].set_graphic(pic_name, 0, @face_name, @face_index)
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# return unlocked classes
#--------------------------------------------------------------------------
def unlocked_classes
results = []
@unlocked_classes = [self.class.id] if @unlocked_classes == nil
@unlocked_classes.sort!
results = @unlocked_classes
results.push(self.class.id) unless results.include?(self.class.id)
return results
end
#--------------------------------------------------------------------------
# perform unlock class
#--------------------------------------------------------------------------
def unlock_class(newclass_id)
@unlocked_classes = [self.class.id] if @unlocked_classes == nil
unless @unlocked_classes.include?(newclass_id)
@unlocked_classes.push(newclass_id)
end
@unlocked_classes.sort!
end
#--------------------------------------------------------------------------
# perform lock class
#--------------------------------------------------------------------------
def lock_class(newclass_id)
return if newclass_id == self.class.id
@unlocked_classes = [self.class.id] if @unlocked_classes == nil
@unlocked_classes.delete(newclass_id)
@unlocked_classes.sort!
end
#--------------------------------------------------------------------------
# perform unlock all classes
#--------------------------------------------------------------------------
def unlock_all_classes
for i in 0..$data_classes.size
unlock = $data_classes[i + 1]
self.unlock_class(unlock.id)
end
@unlocked_classes.sort!
end
#--------------------------------------------------------------------------
# perform lock all classes
#--------------------------------------------------------------------------
def lock_all_classes
for i in 0..$data_classes.size
unlock = $data_classes[i + 1]
self.lock_class(unlock.id)
end
@unlocked_classes.sort!
end
#--------------------------------------------------------------------------
# * Determine if Graphic Filename Exists
#--------------------------------------------------------------------------
def graphic_exist?(filename)
return true if @exist_character_graphics.include?(filename)
begin
Cache.character(filename)
@exist_character_graphics.push(filename)
return true
rescue
return false
end
end
#--------------------------------------------------------------------------
def display_class_level_up(new_skills, id)
$game_message.new_page
i = @class_id
c = $data_classes[i]
level = @class_level[c.id]
text = sprintf(Vocab::ClassLevelUp, @name, $data_classes[id].name, Vocab::level, level.to_s)
$game_message.texts.push(text)
for skill in new_skills
text = sprintf(Vocab::ObtainSkill, skill.name)
$game_message.texts.push(text)
end
end
#--------------------------------------------------------------------------
# * Show Level Up Message
# new_skills : Array of newly learned skills
#--------------------------------------------------------------------------
def display_level_up(new_skills)
text = sprintf(Vocab::LevelUp, @name, Vocab::level, @level)
$game_message.texts.push(text)
for skill in new_skills
text = sprintf(Vocab::ObtainSkill, skill.name)
$game_message.texts.push(text)
end
end
#--------------------------------------------------------------------------
# * Get Critical Ratio
#--------------------------------------------------------------------------
alias job_cri cri unless $@
def cri
n = job_cri
n += 4 if self.job_critical_bonus
return n
end
#=============================================================================
# * Change Actor Options based on Class *from TBK
#=============================================================================
if S_B::CLASS::CHANGE_ACTOR_OPTIONS
#--------------------------------------------------------------------------
# * Get [Critical Bonus] Option
#--------------------------------------------------------------------------
def job_critical_bonus
return true if S_B::CLASS::CRITICAL_CLASSES.include?(@class_id)
end
#--------------------------------------------------------------------------
# * Get [Dual Wield] Option
#--------------------------------------------------------------------------
alias job_two_sword two_swords_style unless $@
def two_swords_style
return true if S_B::CLASS::TWOSWORDS_CLASSES.include?(@class_id)
job_two_sword
end
#--------------------------------------------------------------------------
# * Get [Automatic Battle] Option
#--------------------------------------------------------------------------
alias job_auto_battle auto_battle unless $@
def auto_battle
return true if S_B::CLASS::AUTOBATTLE_CLASSES.include?(@class_id)
job_auto_battle
end
#--------------------------------------------------------------------------
# * Get [Super Guard] Option
#--------------------------------------------------------------------------
alias job_super_guard super_guard unless $@
def super_guard
return true if S_B::CLASS::SUPERGUARD_CLASSES.include?(@class_id)
job_super_guard
end
#--------------------------------------------------------------------------
# * Get [Pharmocology] Option
#--------------------------------------------------------------------------
alias job_pharmacology pharmacology unless $@
def pharmacology
return true if S_B::CLASS::PHARMACOLOGY_CLASSES.include?(@class_id)
job_pharmacology
end
#--------------------------------------------------------------------------
# * Get [Half MP Cost] Option
#--------------------------------------------------------------------------
alias job_half_mp_cost half_mp_cost unless $@
def half_mp_cost
return true if S_B::CLASS::HALP_MP_CLASSES.include?(@class_id)
job_half_mp_cost
end
#--------------------------------------------------------------------------
# * Get [HP Recover] Option
#--------------------------------------------------------------------------
alias job_auto_hp_recover auto_hp_recover unless $@
def auto_hp_recover
return true if S_B::CLASS::HP_RECOVER.include?(@class_id)
job_auto_hp_recover
end
#--------------------------------------------------------------------------
# * Get [Fast Attack] Option
#--------------------------------------------------------------------------
alias job_fast_attack fast_attack unless $@
def fast_attack
return true if S_B::CLASS::FAST_ATTACK.include?(@class_id)
job_fast_attack
end
else
def job_critical_bonus
return false
end
end
def base_stat_class(type, actclass = @class_id)
if S_B::CLASS::CHANGE_BASE_STATS and S_B::CLASS::BASE_STAT_CHANGE.include?(actclass)
multiplier = S_B::CLASS::BASE_STAT_CHANGE[actclass][type] - 1
elsif S_B::CLASS::CHANGE_BASE_STATS
multiplier = S_B::CLASS::BASE_STAT_CHANGE[0][type] - 1
else
multiplier = 0
end
if type == 6 && $imported["BattlerStatRES"]
if YEZ::STAT::ACTOR_BASE_RES.include?(@actor_id)
n = eval(YEZ::STAT::ACTOR_BASE_RES[@actor_id])
else
n = eval(YEZ::STAT::ACTOR_BASE_RES[0])
end
value = multiplier * n
elsif type == 6 && $imported["RES Stat"]
if YEM::STATS::RES::ACTOR_BASE.include?(@actor_id)
n = eval(YEM::STATS::RES::ACTOR_BASE[@actor_id])
else
n = eval(YEM::STATS::RES::ACTOR_BASE[0])
end
value = multiplier * n
elsif type == 7 && $imported["BattlerStatDEX"]
if YEZ::STAT::ACTOR_BASE_DEX.include?(@actor_id)
n = eval(YEZ::STAT::ACTOR_BASE_DEX[@actor_id])
else
n = eval(YEZ::STAT::ACTOR_BASE_DEX[0])
end
value = multiplier * n
elsif type == 7 && $imported["DEX Stat"]
if YEM::STATS::DEX::ACTOR_BASE.include?(@actor_id)
n = eval(YEM::STATS::DEX::ACTOR_BASE[@actor_id])
else
n = eval(YEM::STATS::DEX::ACTOR_BASE[0])
end
value = multiplier * n
elsif $imported["LimitBreak"]
value = multiplier * base_parameter(type)
else
value = multiplier * actor.parameters[type, @level]
end
return Integer(value)
end
def barehand?
if S_B::CLASS::BAREHANDED_CLASSES.include?(@class_id)
if self.weapons[0] == nil and self.weapons[1] == nil
return true
else
return false
end
else
return false
end
end
#--------------------------------------------------------------------------
# bare handed multiplier
#--------------------------------------------------------------------------
def barehanded_multiplier(value)
multiplier = S_B::CLASS::BAREHAND_BASE_MULTIPLIER
id = @class_id
classlevel = @class_level[id]
multiplier += S_B::CLASS::BAREHAND_PER_LEVEL_BOOST * (classlevel - 1)
multiplier = [S_B::CLASS::BAREHAND_MAX_MULTIPLIER, multiplier].min
value *= multiplier
value /= 100
return value
end
#============================================================================#
# * Change Parameters based on Class #
#============================================================================#
#--------------------------------------------------------------------------
# * Get Basic Maximum HP
#--------------------------------------------------------------------------
alias job_base_maxhp base_maxhp unless $@
def base_maxhp
n = job_base_maxhp
n += base_stat_class(0)
return Integer(n)
end
#--------------------------------------------------------------------------
# * Get basic Maximum MP
#--------------------------------------------------------------------------
alias job_base_maxmp base_maxmp unless $@
def base_maxmp
n = job_base_maxmp
n += base_stat_class(1)
return Integer(n)
end
#--------------------------------------------------------------------------
# * Get Basic Attack
#--------------------------------------------------------------------------
alias job_base_atk base_atk unless $@
def base_atk
n = job_base_atk
n += base_stat_class(2)
barehand_trait = self.barehand?
n = barehanded_multiplier(n) if barehand_trait
return Integer(n)
end
#--------------------------------------------------------------------------
# * Get Basic Defense
#--------------------------------------------------------------------------
alias job_base_def base_def unless $@
def base_def
n = job_base_def
n += base_stat_class(3)
return Integer(n)
end
#--------------------------------------------------------------------------
# * Get Basic Spirit
#--------------------------------------------------------------------------
alias job_base_spi base_spi unless $@
def base_spi
n = job_base_spi
n += base_stat_class(4)
return Integer(n)
end
#--------------------------------------------------------------------------
# * Get Basic Agility
#--------------------------------------------------------------------------
alias job_base_agi base_agi unless $@
def base_agi
n = job_base_agi
n += base_stat_class(5)
return Integer(n)
end
#--------------------------------------------------------------------------
# * Get Basic Resistance
#--------------------------------------------------------------------------
if $imported["BattlerStatRES"] or $imported["RES Stat"]
alias job_base_res base_res unless $@
def base_res
n = job_base_res
n += base_stat_class(6)
return Integer(n)
end
end
#--------------------------------------------------------------------------
# * Get Basic Dexterity
#--------------------------------------------------------------------------
if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
alias job_base_dex base_dex unless $@
def base_dex
n = job_base_dex
n += base_stat_class(7)
return Integer(n)
end
end
end
#===============================================================================
# *Window_Base
#===============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Class Level
#--------------------------------------------------------------------------
def draw_class_level(actor, x, y)
w = 60
i = actor.class_id
c = $data_classes[i]
level = actor.class_level[c.id]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
unless level == maxlevel
self.contents.font.color = system_color
self.contents.draw_text(x, y, w - 30, WLH, "(#{Vocab::level_a}.")
self.contents.draw_text(x, y, w, WLH, "#{level.to_s})", 2)
end
end
#--------------------------------------------------------------------------
alias job_draw_actor_class draw_actor_class unless $@
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
i = actor.class_id
c = $data_classes[i]
level = actor.class_level[c.id]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
if level == maxlevel
w = x + 108
draw_icon(S_B::CLASS::MASTERED_ICON, x, y, enabled = true)
job_draw_actor_class(actor, x + 24, y)
else
job_draw_actor_class(actor, x, y)
end
end
#--------------------------------------------------------------------------
# * Draw Class Experience
#--------------------------------------------------------------------------
def draw_jp_exp(actor, x, y)
w = self.contents.width
i = actor.class_id
c = $data_classes[i]
level = actor.class_level[c.id]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
unless level == maxlevel
s1 = actor.jp_exp_s(c.id)
s2 = actor.next_class_rest_exp_s(c.id)
s_next = "#{Vocab.jp} needed"
self.contents.font.color = system_color
self.contents.draw_text(x, y, w, WLH, Vocab.jp)
self.contents.draw_text(x, y + WLH, w, WLH, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, w, WLH, s1, 2)
self.contents.draw_text(x, y + WLH, w, WLH, s2, 2)
end
end
end
#===============================================================================
# ■ Scene_Title
#===============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● Create various game objects
#--------------------------------------------------------------------------
alias job_create_game_objects create_game_objects unless $@
def create_game_objects
job_create_game_objects
unless S_B::CLASS::MENU_CLASS_CHANGE_OPTION
$game_switches[S_B::CLASS::DISABLE_CLASS] = true
$game_switches[S_B::CLASS::HIDE_CLASS] = true
end
end
end
#===============================================================================
# ■ Game_Party
#===============================================================================
class Game_Party
#--------------------------------------------------------------------------
def jobchange_enable?
if $game_switches[S_B::CLASS::DISABLE_CLASS]
return false
else
return true
end
end
end
#==============================================================================
# ** Game_Troop (addon) *from yanfly
#==============================================================================
class Game_Troop < Game_Unit
attr_accessor :jp_total
#--------------------------------------------------------------------------
def jp_total
jp = 0
if S_B::CLASS::ENEMIES_GIVE_JP
for enemy in dead_members
jp += enemy.enemy.enemy_jp unless enemy.hidden
end
end
return jp
end
end
#==============================================================================
# Game_Battler *from yanfly
#==============================================================================
class Game_Battler
attr_accessor :jp_counter
#--------------------------------------------------------------------------
# perform gain_jp
#--------------------------------------------------------------------------
def gain_jp_battle(amount)
return unless self.actor?
jp = amount
for state in states
jp *= state.bonus_jp_per
jp /= 100
end
for state in states
jp += state.bonus_jp_set
end
if double_exp_gain
jp *= 2
end
self.jp_counter += jp if $scene.is_a?(Scene_Battle)
end
#--------------------------------------------------------------------------
# jp counter
#--------------------------------------------------------------------------
def jp_counter
@jp_counter = 0 if @jp_counter == nil
return @jp_counter
end
def jp_counter=(newvalue)
@jp_counter = 0 if @jp_counter == nil
@jp_counter = newvalue
end
#--------------------------------------------------------------------------
# alias attack effect
#--------------------------------------------------------------------------
alias attack_effect_sss attack_effect unless $@
def attack_effect(attacker)
attack_effect_sss(attacker)
return unless attacker.actor?
return unless S_B::CLASS::USE_BONUS_JP
return unless S_B::CLASS::EARN_JP_VIA_ATTACK_ENABLE
amount = S_B::CLASS::EARN_JP_VIA_ATTACK_AMOUNT
unless S_B::CLASS::EARN_JP_VIA_ATTACK_RANDOM == 0
amount += rand(S_B::CLASS::EARN_JP_VIA_ATTACK_RANDOM)
end
attacker.gain_jp_battle(amount)
end
#--------------------------------------------------------------------------
# alias skill effect
#--------------------------------------------------------------------------
alias skill_effect_sss skill_effect unless $@
def skill_effect(user, skill)
skill_effect_sss(user, skill)
return unless user.actor?
return unless S_B::CLASS::USE_BONUS_JP
return unless S_B::CLASS::EARN_JP_VIA_SKILL_ENABLE
return unless $scene.is_a?(Scene_Battle)
amount = S_B::CLASS::EARN_JP_VIA_SKILL_AMOUNT
unless S_B::CLASS::EARN_JP_VIA_SKILL_RANDOM == 0
amount += rand(S_B::CLASS::EARN_JP_VIA_SKILL_RANDOM)
end
amount += skill.jp_boost_set unless skill.jp_boost_set <= 0
jp += rand(skill.jp_boost_ran) unless skill.jp_boost_ran <= 0
user.gain_jp_battle(amount)
end
#--------------------------------------------------------------------------
# alias item effect
#--------------------------------------------------------------------------
alias item_effect_sss item_effect unless $@
def item_effect(user, item)
item_effect_sss(user, item)
return unless user.actor?
user.jp_received(item.gain_jp, nil, true)
#----------------------------------
if item.unlock_class != []
for class_id in item.unlock_class
user.unlock_class(class_id)
end
end
if item.lock_class != []
for class_id in item.lock_class
user.lock_class(class_id)
end
end
#----------------------------------
return unless S_B::CLASS::USE_BONUS_JP
return unless S_B::CLASS::EARN_JP_VIA_ITEMS_ENABLE
return unless $scene.is_a?(Scene_Battle)
amount = S_B::CLASS::EARN_JP_VIA_ITEMS_AMOUNT
unless S_B::CLASS::EARN_JP_VIA_ITEMS_RANDOM == 0
amount += rand(S_B::CLASS::EARN_JP_VIA_ITEMS_RANDOM)
end
user.gain_jp_battle(amount)
end
#--------------------------------------------------------------------------
# alias item test
#--------------------------------------------------------------------------
alias item_test_sss item_test unless $@
def item_test(user, item)
if self.actor?
return true if item.unlock_class != []
return true if item.lock_class != []
return true if item.gain_jp > 0
end
return item_test_sss(user, item)
end
end
#==============================================================================
# ** Scene_Battle (addon) *from yanfly
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias process_battle_start
#--------------------------------------------------------------------------
alias process_battle_start_sss process_battle_start unless $@
def process_battle_start
for actor in $game_party.members
actor.jp_counter = 0
end
process_battle_start_sss
end
#--------------------------------------------------------------------------
# alias execute_action_guard
#--------------------------------------------------------------------------
alias execute_action_guard_sss execute_action_guard unless $@
def execute_action_guard
execute_action_guard_sss
return unless @active_battler.actor?
return unless S_B::CLASS::USE_BONUS_JP
return unless S_B::CLASS::EARN_JP_VIA_GUARD_ENABLE
amount = S_B::CLASS::EARN_JP_VIA_GUARD_AMOUNT
unless S_B::CLASS::EARN_JP_VIA_GUARD_RANDOM == 0
amount += rand(S_B::CLASS::EARN_JP_VIA_GUARD_RANDOM)
end
@active_battler.gain_jp_battle(amount)
end
alias job_display_exp_and_gold display_exp_and_gold unless $@
def display_exp_and_gold
@ignore_wait_for_message = true
# call the original code
job_display_exp_and_gold
display_JP
@ignore_wait_for_message = false
wait_for_message
end
#--------------------------------------------------------------------------
def display_JP
jp = 0
jp = $game_troop.jp_total if S_B::CLASS::ENEMIES_GIVE_JP
if jp > 0
text = sprintf(Vocab::ObtainClassExp, jp)
$game_message.texts.push('\.' + text)
end
for actor in $game_party.existing_members
jp = 0
jp = $game_troop.jp_total if S_B::CLASS::ENEMIES_GIVE_JP
unless $imported["battleresults"]
if S_B::CLASS::USE_BONUS_JP && S_B::CLASS::DISPLAY_BONUS_JP
i = actor.class_id
c = $data_classes[i]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
if actor.jp_counter > 0 && actor.class_level != maxlevel
text = sprintf(Vocab::Display_Actor_Msg, actor.name, actor.jp_counter)
$game_message.texts.push('\>' + text)
end
end
end
if actor.double_exp_gain
jp *= 2
end
for state in actor.states
jp *= state.bonus_jp_per
jp /= 100
end
for state in actor.states
jp += state.bonus_jp_set
end
jp = jp + actor.jp_counter if S_B::CLASS::USE_BONUS_JP
last_level = actor.class_level
last_skills = actor.skills
actor.jp_received(jp, nil, true)
end
end
end
#==============================================================================
# ** Scene_Job (new) *from prexus
#==============================================================================
class Scene_Job < Scene_Base
#--------------------------------------------------------------------------
def initialize(actor_index = 0, menu_index = 0)
@menu_index = menu_index
@actor_index = actor_index
end
#--------------------------------------------------------------------------
def start
@actor = $game_party.members[@actor_index]
create_menu_background
create_windows
@classlist_window.refresh
end
#--------------------------------------------------------------------------
def create_windows
@classlist_window = Window_ClassPick.new(@actor)
@classchange_window = Window_Class_Change.new(@actor)
@skills_window = Window_ShowSkills.new(@actor)
@help_window = Window_Help.new
@help_window.visible = false
@help_window.close
@help_window2 = Window_Help.new
@classchange_window.x = 0
@classlist_window.y = @classchange_window.y = @help_window2.height
@classchange_window.width = @classlist_window.width = Graphics.width / 2
@classlist_window.x = @classchange_window.width
@classlist_window.height = @classchange_window.height = Graphics.height - @help_window2.height
@classlist_window.index = 0
@help_window.width = 448
@help_window.x = @skills_window.x = (Graphics.width - @help_window.width)/2
@help_window.y = 280
@help_window.create_contents
@skills_window.help_window = @help_window
@skills_window.help_window.back_opacity = 255
@confirm_window = Window_Confirm.new
end
#--------------------------------------------------------------------------
def update_windows
@classlist_window.update(@actor)
@classchange_window.update
@skills_window.update
@help_window.update
@help_window2.update
@confirm_window.update
if @classlist_window.active
@classchange_window.set(@actor, @classlist_window.item)
id = @classlist_window.item.id
if S_B::CLASS::Class_Descriptions.include?(id)
@help_window2.set_text(S_B::CLASS::Class_Descriptions[id][0])
else
@help_window2.set_text("")
end
end
end
#--------------------------------------------------------------------------
def terminate
super
@classlist_window.dispose if @classlist_window != nil
@classchange_window.dispose if @classchange_window != nil
@skills_window.dispose if @skills_window != nil
@help_window.dispose if @help_window != nil
@help_window2.dispose if @help_window2 != nil
@confirm_window.dispose if @confirm_window != nil
end
#--------------------------------------------------------------------------
def update
super
update_menu_background
update_windows
if @classlist_window.active
update_class_list
elsif @skills_window.active
update_skills_list
elsif @confirm_window.active
update_confirm_window
end
end
#--------------------------------------------------------------------------
# * Switch to Next Actor Screen
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Job.new(@actor_index, @menu_index)
end
#--------------------------------------------------------------------------
# * Switch to Previous Actor Screen
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Job.new(@actor_index, @menu_index)
end
#--------------------------------------------------------------------------
# * Return to previous scene
#--------------------------------------------------------------------------
def return_scene
if $imported["SceneStatusReDux"] and $game_temp.status_menu_flag
$scene = Scene_Status.new(@actor_index, $game_temp.status_menu_index)
elsif @menu_index == 0
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(@menu_index)
end
end
#--------------------------------------------------------------------------
def update_class_list
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
if @classlist_window.item.id == @classlist_window.actor.class_id
Sound.play_buzzer
return
end
Sound.play_decision
@confirm_window.visible = true
@confirm_window.active = true
@confirm_window.index = 0
@confirm_window.open
@classlist_window.active = false
elsif Input.trigger?(S_B::CLASS::SHOW_SKILLS_WINDOW)
Sound.play_decision
@skills_window.set(@actor, @classlist_window.item.id)
@skills_window.active = true
@skills_window.index = 0
@skills_window.open
@help_window.visible = true
@help_window.open
@classlist_window.active = false
elsif Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
Sound.play_cursor
prev_actor
end
end
def update_skills_list
if Input.trigger?(Input::B)
Sound.play_cancel
@classlist_window.active = true
@skills_window.active = false
@skills_window.index = -1
@skills_window.close
@help_window.close
end
end
def update_confirm_window
if Input.trigger?(Input::B)
Sound.play_cancel
if @confirm_window.index == 1
@confirm_window.active = false
@confirm_window.index = -1
@confirm_window.close
@classlist_window.active = true
return
else
@confirm_window.index = 1
return
end
elsif Input.trigger?(Input::C)
case @confirm_window.index
when 0
Sound.play_decision
actor = @classlist_window.actor
actor.class_id = @classlist_window.item.id
#Check to make sure that
if @actor.hp > @actor.maxhp
@actor.hp = @actor.maxhp
end
if @actor.mp > @actor.maxmp
@actor.mp = @actor.maxmp
end
@confirm_window.active = false
@confirm_window.index = -1
@confirm_window.close
@classlist_window.refresh
@classchange_window.refresh
@classlist_window.active = true
when 1
@confirm_window.active = false
@confirm_window.index = -1
@confirm_window.close
@classlist_window.active = true
return
end
end
end
end
#==============================================================================
# ** Window_ClassPick
# window where selectable class list is generated
#==============================================================================
class Window_ClassPick < Window_Selectable
#--------------------------------------------------------------------------
def initialize(actor)
super(Graphics.width / 2, 48, Graphics.width / 2, Graphics.height - (WLH + 32))
create_contents
@actor = actor
self.index = 0
self.active = true
refresh
end
#--------------------------------------------------------------------------
def update(actor = nil)
super()
return if actor == @actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
def actor
return @actor
end
#--------------------------------------------------------------------------
def item
return $data_classes[@actor.unlocked_classes[index]]
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for class_id in @actor.unlocked_classes
@data.push(class_id)
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# draw item
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
iclass = $data_classes[@actor.unlocked_classes[index]]
if iclass.id != 0
rect.width -= 4
enabled = true
enabled = false if iclass == @actor.class
level = @actor.class_level[iclass.id]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[iclass.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
if level == maxlevel
icon = S_B::CLASS::MASTERED_ICON
elsif S_B::CLASS::USE_ICONS_FOR_CLASSES
if S_B::CLASS::Class_Icons.include?(iclass.id)
icon = S_B::CLASS::Class_Icons[iclass.id]
else
icon = S_B::CLASS::Class_Icons[0]
end
end
draw_icon(icon, rect.x, rect.y, enabled)
dx = rect.x
dy = rect.y
dw = rect.width
dh = rect.height
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(dx+24, dy, dw-48, dh, iclass.name, 0)
unless !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
self.contents.draw_text(dx, dy, dw, dh, "Lv. " + level.to_s, 2)
end
end
end
end
#==============================================================================
# ** Window_Class_Change
#==============================================================================
class Window_Class_Change < Window_Base
#--------------------------------------------------------------------------
def initialize(actor = nil, class_obj = nil)
super(0, 48, Graphics.width / 2, Graphics.height - (WLH + 32))
create_contents
@actor = actor
@class_obj = class_obj
refresh
end
#--------------------------------------------------------------------------
def actor
return @actor
end
#--------------------------------------------------------------------------
def item
return @class_obj
end
#--------------------------------------------------------------------------
def set(actor, class_obj)
old_actor = @actor
@actor = actor
old_class_obj = @class_obj
@class_obj = class_obj
refresh if (old_actor != @actor) or (old_class_obj != @class_obj)
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
return unless @actor
c = (@class_obj != nil ? @class_obj : $data_classes[@actor.class_id])
x, y = 0, 0
w = self.contents.width
hy = self.contents.height - WLH * 4
self.draw_actor_face(@actor, x + 2, y + 2)
draw_basic_info(112, 0)
self.contents.font.color = system_color
self.contents.draw_text(x, hy + WLH * 0, w, WLH, "Class:")
unless !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
self.contents.draw_text(x, hy + WLH * 1, w, WLH, "Class #{Vocab::level_a}:")
s_next = ("#{Vocab.jp} needed:")
self.contents.draw_text(x, hy + WLH * 2, w, WLH, Vocab.jp)
self.contents.draw_text(x, hy + WLH * 3, w, WLH, s_next)
end
dy = WLH * 4
y1 = (hy - dy - 80)/2
y = y1 + dy
draw_parameters(x, y)
return unless @class_obj
self.contents.font.color = normal_color
self.contents.draw_text(x, hy + WLH * 0, w, WLH, c.name,2)
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
s1 = @actor.jp_exp_s(c.id)
s2 = @actor.next_class_rest_exp_s(c.id)
if @actor.class_level[c.id] == maxlevel
draw_icon(S_B::CLASS::MASTERED_ICON, w - 24, hy + WLH * 1, enabled = true)
self.contents.font.color = normal_color
self.contents.draw_text(x, hy + WLH * 1, w - 24, WLH, "Mastered",2)
else
unless !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
self.contents.draw_text(x, hy + WLH * 1, w, WLH, @actor.class_level[c.id], 2)
self.contents.font.color = normal_color
end
end
self.contents.draw_text(x, hy + WLH * 2, w, WLH, s1, 2)
self.contents.draw_text(x, hy + WLH * 3, w, WLH, s2, 2)
end
def draw_basic_info(x, y)
w = self.contents.width
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 0, w, WLH, "Name:")
self.contents.font.color = normal_color
self.contents.draw_text(x, y + WLH * 1, w - 112, WLH, actor.name, 2)
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 2, w, WLH, "Current Class:")
self.contents.font.color = normal_color
self.contents.draw_text(x, y + WLH * 3, w - 112, WLH, actor.class.name, 2)
self.draw_actor_level(@actor, x - 112, y + WLH * 4)
self.draw_icon(S_B::CLASS::Skills_Icon, w - 24, y + WLH * 4)
self.contents.font.color = system_color
self.contents.draw_text(x - 112, y + WLH * 4, w - 24, WLH, 'Skills', 2)
end
def draw_parameters(x, y)
last_font_size = self.contents.font.size
if $imported["BattlerStatRES"] || $imported["BattlerStatDEX"] || $imported["RES Stat"] || $imported["DEX Stat"]
self.contents.font.size = 13
a = 13
else
self.contents.font.size = 15
a = 15
end
draw_parameter(x, y + a * 0, 0)
draw_parameter(x, y + a * 1, 1)
draw_parameter(x, y + a * 2, 2)
draw_parameter(x, y + a * 3, 3)
draw_parameter(x, y + a * 4, 4)
draw_parameter(x, y + a * 5, 5)
b = 0
draw_parameter(x, y + a * 6, 6) if $imported["BattlerStatRES"] or $imported["RES Stat"]
b = 13 if $imported["BattlerStatRES"] or $imported["RES Stat"]
draw_parameter(x, y + a * 6 + b, 7) if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
self.contents.font.size = last_font_size
end
#--------------------------------------------------------------------------
# * Draw Parameters
#--------------------------------------------------------------------------
def draw_parameter(x, y, type)
c = (@class_obj != nil ? @class_obj : $data_classes[@actor.class_id])
case type
when 0
name = Vocab::hp_a
value = @actor.maxhp
when 1
name = Vocab::mp_a
value = @actor.maxmp
when 2
name = Vocab::atk
value = @actor.atk
when 3
name = Vocab::def
value = @actor.def
when 4
name = Vocab::spi
value = @actor.spi
when 5
name = Vocab::agi
value = @actor.agi
when 6
name = "RES"
value = @actor.res
when 7
name = "DEX"
value = @actor.dex
end
old = @actor.base_stat_class(type)
if @class_obj
new = @actor.base_stat_class(type, c.id)
new_value = value - old + new
difference = new - old
if difference > 0
difference = "+ #{new - old}"
end
end
self.contents.font.color = system_color
self.contents.draw_text(x + 26, y, 80, WLH, name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 70, y, 30, WLH, value, 2)
self.contents.font.color = system_color
self.contents.draw_text(x + 122, y, 20, WLH, "-->", 1)
if new_value != nil
self.contents.font.color = new_parameter_color(value, new_value)
if S_B::CLASS::SHOW_DIFFERENCE
if difference == 0
self.contents.draw_text(x + 152, y, 30, WLH, "---", 2)
else
self.contents.draw_text(x + 152, y, 30, WLH, difference, 2)
end
else
self.contents.draw_text(x + 152, y, 30, WLH, new_value, 2)
end
end
end
def new_parameter_color(old_value, new_value)
if new_value > old_value # Get stronger
return power_up_color
elsif new_value == old_value # No change
return normal_color
else # Get weaker
return power_down_color
end
end
end
#==============================================================================
# ** Window_ShowSkills
#==============================================================================
class Window_ShowSkills < Window_Selectable
#--------------------------------------------------------------------------
def initialize(actor, class_id = nil)
super(48, 80, 448, 200)
@actor = actor
@class_id = (class_id != nil ? class_id : @actor.class_id)
@item_max = $data_classes[@class_id].learnings.size
@column_max = 3
create_contents
self.index = -1
self.active = false
self.openness = 0
self.back_opacity = 255
refresh
end
#--------------------------------------------------------------------------
def set(actor, class_id)
old_actor = @actor
@actor = actor
old_class_id = @class_id
@class_id = class_id
@item_max = $data_classes[@class_id].learnings.size unless @class_id == nil
create_contents
refresh
end
#--------------------------------------------------------------------------
def refresh
return if @class_id == nil
return if $data_classes[@class_id].learnings.empty?
for i in 0...@item_max
rect = item_rect(i)
learning = $data_classes[@class_id].learnings[i]
next unless learning
self.contents.font.color.alpha = (@actor.class_level[@class_id] >= learning.level ? 255 : 128)
self.contents.draw_text(rect, $data_skills[learning.skill_id].name)
end
end
#--------------------------------------------------------------------------
def update_help
if $data_classes[@class_id].learnings.empty?
self.help_window.set_text('')
return
end
level = $data_classes[@class_id].learnings[self.index].level
skill = $data_skills[$data_classes[@class_id].learnings[self.index].skill_id]
self.help_window.set_text(skill == nil ? '' : "[Level #{level}] #{skill.description}")
end
end
#==============================================================================
# ** Window_Confirm
#==============================================================================
class Window_Confirm < Window_Selectable
#--------------------------------------------------------------------------
def initialize(index = -1)
dx = (Graphics.width - 160)/2
super(dx, 168, 160, 80)
create_contents
@item_max = 2
@column_max = 2
self.index = index
self.active = false
self.openness = 0
refresh
end
#--------------------------------------------------------------------------
def refresh
for i in 0..@item_max
rect = item_rect(i)
self.contents.clear_rect(rect)
end
self.contents.draw_text(0, 0, self.contents.width, WLH, "Confirm?", 1)
rect = item_rect(0)
self.contents.draw_text(rect, "Yes", 1)
rect = item_rect(1)
self.contents.draw_text(rect, "No", 1)
end
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = (index / @column_max * WLH) + WLH
return rect
end
end
#==============================================================================
# ** Character_Class
#==============================================================================
class Character_Class
def self.new_class(actor, class_id)
$game_actors[actor].unlock_class(class_id)
end
#--------------------------------------------------------------------------
def self.remove_class(actor, class_id)
$game_actors[actor].lock_class(class_id)
end
end
#==============================================================================
# Window_Command (imported from KGC)
#==============================================================================
class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# add command
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# refresh command
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# insert command
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# remove command
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
end
#===============================================================================
# Scene Menu
#===============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# alias create command window
#--------------------------------------------------------------------------
alias create_command_window_sss create_command_window unless $@
def create_command_window
create_command_window_sss
return if $imported["CustomMenuCommand"]
return if $game_switches[S_B::CLASS::HIDE_CLASS]
if S_B::CLASS::MENU_CLASS_CHANGE_OPTION || $game_party.jobchange_enable?
scc_text = Vocab::Classes_Vocab
@command_class_change = @command_window.add_command(scc_text)
@command_window.draw_item(@command_class_change,
$game_party.jobchange_enable?)
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
end
@command_window.index = @menu_index
end
#--------------------------------------------------------------------------
# alias update command selection
#--------------------------------------------------------------------------
alias update_command_selection_sss update_command_selection unless $@
def update_command_selection
call_job_command = 0
if Input.trigger?(Input::C)
case @command_window.index
when @command_class_change
call_job_command = 1
end
end
if call_job_command == 1
if $game_party.members.size == 0 || !$game_party.jobchange_enable?
Sound.play_buzzer
return
end
Sound.play_decision
start_actor_selection
return
end
update_command_selection_sss
end
#--------------------------------------------------------------------------
# alias update actor selection
#--------------------------------------------------------------------------
alias update_actor_selection_sss update_actor_selection unless $@
def update_actor_selection
if Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when @command_class_change
$scene = Scene_Job.new(@status_window.index,
@command_class_change)
return
end
end
update_actor_selection_sss
end
end # Scene Menu
if S_B::CLASS::SHOW_CLASS_LVL_STATUS && (S_B::CLASS::USE_BONUS_JP || S_B::CLASS::ENEMIES_GIVE_JP)
#==============================================================================
# ** Window_MenuStatus
#==============================================================================
class Window_Status < Window_Base
def draw_actor_class(actor, x, y)
i = actor.class_id
c = $data_classes[i]
level = actor.class_level[c.id]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
if level == maxlevel
w = x + 108
draw_icon(S_B::CLASS::MASTERED_ICON, x, y, true)
job_draw_actor_class(actor, x + 24, y)
else
job_draw_actor_class(actor, x + 60, y)
draw_class_level(actor, x, y)
end
end
end
class Window_Status_Actor < Window_Base
def draw_actor_class(actor, x, y)
i = actor.class_id
c = $data_classes[i]
level = actor.class_level[c.id]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
if level == maxlevel
w = x + 108
draw_icon(S_B::CLASS::MASTERED_ICON, x, y, true)
job_draw_actor_class(actor, x + 24, y)
else
job_draw_actor_class(actor, x + 60, y)
draw_class_level(actor, x, y)
end
end
end
end
if S_B::CLASS::SHOW_CLASS_LVL_MAIN && (S_B::CLASS::USE_BONUS_JP || S_B::CLASS::ENEMIES_GIVE_JP)
class Window_MenuStatus < Window_Selectable
def draw_actor_class(actor, x, y)
i = actor.class_id
c = $data_classes[i]
level = actor.class_level[c.id]
maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
if level == maxlevel
w = x + 108
draw_icon(S_B::CLASS::MASTERED_ICON, x, y, true)
job_draw_actor_class(actor, x + 24, y)
else
self.contents.font.color = normal_color
self.contents.draw_text(x + 40, y, 108 - 20, WLH, actor.class.name)
draw_class_level(actor, x - 20, y)
end
end
end
end