· 7 years ago · Mar 04, 2019, 07:56 PM
1#==============================================================================
2# ** JobChanger for VX, by Blackmorning
3# last updated 31/07/10 (Version 2.02)
4# Some features taken from tkblackknight, Prexus & Yanfly Job Changers
5# and from Enelvon
6#==============================================================================
7=begin
8********************************************************************************
9Updates
10********************************************************************************
1131/07/10
12- cleaned up a few points, some bugs fixed (higher class levels)
1312/07/10
14- compatible with YEM Battler Stat: RES and Battler Stat: DEX (requested by Kaimi)
1523/06/10
16- change in how skills are forgotten when changing classes
1716/02/10
18- compatible with YEZ Battler Stat: RES and Battler Stat: DEX (requested by sol003)
1918/11/09
20- fixed jp earned during fight (noticed by Slajmboll)
2123/08/09
22- minor visual improvements when no jp is used
2304/08/09
24- when not gaining jp by any means, skills are learnt by actor level (original way)
2528/07/09
26- can make items to add/remove classes
27- fixed class adding and removing from list (now works when reloading)
28- fixed when class level up bonus based on actor's level
2922/07/09
30- bug fix
31# requests by Andrelvis
32- can modify jp needed to go up a level
33- icons can appear next to class in job changer window
3420/07/09
35- level up bonuses can be by either class level or actor level
36- skills fix when initialized actor is higher level
3716/07/09
38- fixed minor issue with custom menus
3914/07/09
40- added check actor class list size
4113/07/09
42- customizable description of class on help window
4330/06/09
44- level up stat bonuses now based on class level.
45( ie. stats increase as class level increases )
4629/06/09
47- compability fix with special classes (ie. OriginalWij sequence skills)
48- issue fixed when regular level up
4928/06/09
50- minor formatting errors cleared up
51- check any actor class level and assign it to a variable
52( good for creating events to add classes )
53- fixed issue with character change
5426/06/09
55- skill window help opacity 255
56- item (jp gain) fixed
57- can show class level in status & menu status screen
58#===============================================================================
59WHAT IT DOES:
60 * This script basically gives you an interface to allow the player to select
61 which Class to switch to for each character.
62 * Actors Base Stats can be changed based on class
63 * Added BigEd781's Class Dependant Stat Bonuses
64 * Actor options (ie. Super Guard, 2-swords, autobattle, pharmacology) can be
65 based on Class chosen
66 * Actor character graphic can be based on Class chosen
67 *******************************************************************************
68 Added = From Prexus - Job Changer (v1.0) & Yanfly
69 * Experience is totalled for characters and their Classes, individually.
70 * Classes gain levels, Jobs determine what skills you learn.
71 * Class Levels/Exp are remembered when changing jobs.
72 *******************************************************************************
73Script calls (events):
74 To assign an actor's class list size to a variable
75 actor_class_list_size(actor, variable_id)
76 For example:
77 actor_class_list_size(1, 5)
78 assigns actor 1 class list size to variable 5
79
80 To assign an actor's class level to a variable
81 check_class_level(actor, class_id, variable_id)
82 For example:
83 check_class_level(1, 1, 5)
84 assigns actor 1 class 1 level to variable 5
85
86 To increase the level of a specific job for an actor:
87 <#Game_Actor>.class_level_up(ID of Class)
88 For example:
89 $game_party.members[0].class_level_up(2)
90
91 * Allows you to enable or disable the JobChange screen on the main command menu.
92 This also actives or deactivates CLASSES_SWITCH.
93 permit_jobchange(true/false)
94
95 New script commands: Used in script in Event Commands
96
97 Character_Class.new_class(actor,class_id):
98
99 *Adds a class to the selected actor:
100 Character_Class.new_class(1,6)
101 Ralph learns Dark Knight or:
102 Character_Class.new_class($game_party.actors[2].id,6)
103 party actor 2 learns Dark Knight
104
105 *Removes Class from character
106 Character_Class.remove_class(actor_id,class_id)
107 doesn't work if character is currently at that class
108
109********************************************************************************
110 Added from Yanfly
111 ********************
112 *SKILL TAGS - notebox.
113 ********************
114 <jp_boost_set x>
115 If an actor uses this skill, that actor will gain x set amount of JP.
116
117 <jp_boost_ran x>
118 If an actor uses this skill, that actor will gain x random amount of JP.
119 ********************
120 *ITEM TAGS - notebox.
121 ********************
122 <gain_jp x>
123 The item will give the target ally JP of x amount. JP is given to whatever
124 the ally's current class is.
125
126 <unlock class x>
127 The item will unlock class x for the target ally. Use multiple of these tags
128 if you want an item to unlock more than one class.
129
130 <lock class x>
131 The item will lock class x for the target ally. Use multiple of these tags if
132 you want an item to lock more than one class.
133 ********************
134 *ENEMY TAGS - notebox.
135 ********************
136 <enemy_jp x>
137 This determines the amount of JP given by that enemy. If nothing is determined
138 by this set value and you allow your enemies to give JP, then the JP delivered
139 will equal to the ENEMIES_DEFAULT amount.
140
141 ********************
142 *STATE TAGS - notebox
143 ********************
144
145 <bonus_jp_per x>
146 JP gain rate is x%. If x is 200, then the JP gain rate is 200%.
147
148 <bonus_jp_set x>
149 x is added to JP gain. This means if JP gain is 20 and x is 10, total is 30.
150
151********************************************************************************
152 * Not 100% tested, please report any bugs
153********************************************************************************
154=end
155#===============================================================================
156# * Customize *
157#===============================================================================
158module S_B
159module CLASS
160 #-----------------------------------------------------------------------------
161 # Name for the experience gained for Job class
162 #-----------------------------------------------------------------------------
163 CLASS_EXP = "Job EXP"
164 CLASS_EXP_A = "JP"
165 #-----------------------------------------------------------------------------
166 # What appears in the menu to call script
167 #-----------------------------------------------------------------------------
168 MENU_CLASS_CHANGE_TITLE = "Job"
169 #-----------------------------------------------------------------------------
170 # Shows actors' class level in main menu & status screens
171 #-----------------------------------------------------------------------------
172 SHOW_CLASS_LVL_MAIN = true
173 SHOW_CLASS_LVL_STATUS = true
174 #-----------------------------------------------------------------------------
175 # Whether or not class changing is allowed at the begining of the game
176 #-----------------------------------------------------------------------------
177 MENU_CLASS_CHANGE_OPTION = false
178 #-----------------------------------------------------------------------------
179 # Switch ID to enable class changing in the menu
180 #-----------------------------------------------------------------------------
181 DISABLE_CLASS = 101
182 HIDE_CLASS = 102
183 #-----------------------------------------------------------------------------
184 # JP earned through various battle options *Yanfly
185 #-----------------------------------------------------------------------------
186 USE_BONUS_JP = false
187 # This sets whether or not you'd like your actors to display the JP they've
188 # earned in battle (since every action adds JP)
189 DISPLAY_BONUS_JP = false
190 DISPLAY_ACTOR_MSG = "%s earned %d #{S_B::CLASS::CLASS_EXP_A}!"
191 # JP is earned throughout battle from different effects. You can determine
192 # what will earn JP here and by how much. Set amounts are the increases that
193 # will always occur so long as the action is enabled. Random amounts will
194 # increase the JP earned from 0 to that amount.
195
196 EARN_JP_VIA_ATTACK_ENABLE = true # Normal attacks will earn JP.
197 EARN_JP_VIA_ATTACK_AMOUNT = 3 # Earns at least this amount of JP.
198 EARN_JP_VIA_ATTACK_RANDOM = 0 # Earns up to this random amount.
199
200 EARN_JP_VIA_SKILL_ENABLE = true # Skills will earn JP.
201 EARN_JP_VIA_SKILL_AMOUNT = 5 # Earns at least this amount of JP.
202 EARN_JP_VIA_SKILL_RANDOM = 0 # Earns up to this random amount.
203
204 EARN_JP_VIA_GUARD_ENABLE = false # Guarding will earn JP.
205 EARN_JP_VIA_GUARD_AMOUNT = 2 # Earns at least this amount of JP.
206 EARN_JP_VIA_GUARD_RANDOM = 0 # Earns up to this random amount.
207
208 EARN_JP_VIA_ITEMS_ENABLE = true # Using items will earn JP.
209 EARN_JP_VIA_ITEMS_AMOUNT = 1 # Earns at least this amount of JP.
210 EARN_JP_VIA_ITEMS_RANDOM = 0 # Earns up to this random amount.
211 #-----------------------------------------------------------------------------
212 # JP from enemies *Yanfly
213 # This determines whether or not enemies will give JP if killed and the
214 # default amount if not set with <enemy jp x>.
215 #-----------------------------------------------------------------------------
216 ENEMIES_GIVE_JP = true
217 ENEMIES_JP_DEFAULT = 0
218 #-----------------------------------------------------------------------------
219 # Vocab for end of combat *Prexus
220 #-----------------------------------------------------------------------------
221 ObtainClassExp = "%s #{S_B::CLASS::CLASS_EXP_A} was earned!"
222 # first %s is # of JP earned
223 ClassLevelUp = "%s is now %s %s %s!"
224 # first %s is actor, second %s is class, third & fourth %s is level
225 #-----------------------------------------------------------------------------
226 # Maximum level per job *Blackmorning and Mithran
227 # DO NOT go above 99
228 #-----------------------------------------------------------------------------
229 MAX_CLASS_LEVEL_DEFAULT = 40
230 CLASS_MAX_LEVELS = {} # Do not alter this line!
231 # Below here, set up the individiual max levels for each class.
232 # CLASS_MAX_LEVELS[class_id] = maxlevel
233 CLASS_MAX_LEVELS[8] = 20
234 # ie Paladin is capped at level 30
235 CLASS_MAX_LEVELS[9] = 20
236 # ie Warrior is capped at level 99
237 CLASS_MAX_LEVELS[10] = 20
238 # ie Priest is capped at level 99
239 CLASS_MAX_LEVELS[11] = 20
240 # ie Magician is capped at level 50
241 CLASS_MAX_LEVELS[12] = 20
242 # ie Magician is capped at level 50
243 CLASS_MAX_LEVELS[13] = 20
244
245 #-----------------------------------------------------------------------------
246 # Icon used to show MAX level *Blackmorning
247 #-----------------------------------------------------------------------------
248 MASTERED_ICON = 102
249 #-----------------------------------------------------------------------------
250 # Icon beside skills in class menu
251 #-----------------------------------------------------------------------------
252 Skills_Icon = 128
253 #-----------------------------------------------------------------------------
254 # Button to show skills window in job change
255 #-----------------------------------------------------------------------------
256 SHOW_SKILLS_WINDOW = Input::A
257 #-----------------------------------------------------------------------------
258 # CLASS SPECIFIC CHARACTER GFX - *Enelvon
259 # file format:
260 # $"actor_ID"_"class_ID"
261 # ie. $1_5 for actor 1, class 5
262 #-----------------------------------------------------------------------------
263 CHANGE_GRAPHIC = true
264 #-----------------------------------------------------------------------------
265 # Available classes are the classes that each actor starts out with.
266 AVAILABLE_CLASSES = { # don't remove
267 # format: actor_id => [class_id, class_id...],
268 #-----------------------------------------------------------------------------
269 1 => [1,2,3,4,5,6,7],
270 2 => [2,5],
271 3 => [3,6],
272 4 => [4,7],
273 5 => [1,2,5,6],
274 6 => [5,6],
275 7 => [7],
276 8 => [7,8],
277 } # don't remove
278 #-----------------------------------------------------------------------------
279 # If set to true, actor keeps skills learned when changing classes
280 # if false, loses ALL skills learnt by previous class (those specific to the class)
281 #-----------------------------------------------------------------------------
282 KEEP_SKILLS = true
283 #-----------------------------------------------------------------------------
284 # Enter the ID's of the characters that always keep their skills
285 # characters that ignore KEEP_SKILLS = false
286 #-----------------------------------------------------------------------------
287 SPECIAL_CLASS_ACTORS = [5]
288 #-----------------------------------------------------------------------------
289 # Define which Class_ID's use these special options. *TBK
290 #-----------------------------------------------------------------------------
291 CHANGE_ACTOR_OPTIONS = true
292 CRITICAL_CLASSES = [0]
293 FIRE_CLASSES = [3,9]
294 WATER_CLASSES = [5,11]
295 THUNDER_CLASSES = [2,8]
296 ICE_CLASSES = [7,13]
297 EARTH_CLASSES = [6,12]
298 AIR_CLASSES = [4,10]
299 HEAL_CLASSES = [5,11]
300 TWOSWORDS_CLASSES = [0]
301 # Actor will automatically attack.
302 AUTOBATTLE_CLASSES = [0]
303 # Actor will take even less damage when guarding.
304 SUPERGUARD_CLASSES = [0,0,0]
305 # Items will have double effect when used by actor.
306 PHARMACOLOGY_CLASSES = [0]
307 #-----------------------------------------------------------------------------
308 HALP_MP_CLASSES = [14]
309 HP_RECOVER = [14]
310 FAST_ATTACK = [14]
311 #-----------------------------------------------------------------------------
312 # Yanfly Engine RD - Battler Stat: Barehand
313 # Last Date Updated: 2009.05.14
314 #-----------------------------------------------------------------------------
315 # For those that would like to give their actors stronger strength when no
316 # weapon is equipped, there is a barehand stat now. You can adjust how strong
317 # an actor's barehanded multiplier will grow each level so that way, you don't
318 # have your actors going over the top strong from the beginning.
319 #-----------------------------------------------------------------------------
320 # This is the array of classes that can fight barehanded.
321 BAREHANDED_CLASSES = [14]
322 # This is the multiplier given to base attack when no weapon is equipped.
323 BAREHAND_BASE_MULTIPLIER = 150
324 BAREHAND_PER_LEVEL_BOOST = 5 # based on class level
325 BAREHAND_MAX_MULTIPLIER = 400
326 #-----------------------------------------------------------------------------
327 # CLASS "BASED STAT MULTIPLIER" - *Enelv-on - specifically for the JobChanger
328 # Redesigned by Blackmorning
329 #-----------------------------------------------------------------------------
330 # Below are the Multipliers for each Class ID/Stat
331 # Class ID => Stat Multipliers
332 # example: if you want Class_ID #1 to have normal MAXHP (ie 100%)
333 # you would set the multiplier to 1.0
334 #-----------------------------------------------------------------------------
335 # This determines whether or not actor stats are affected by their what
336 # class they have equipped.
337 CHANGE_BASE_STATS = true
338 # This affects the display type for new stats.
339 # if true, Shows the increase/decrease in the stat.
340 # if false, Shows the new stat itself.
341 SHOW_DIFFERENCE = true
342 #-----------------------------------------------------------------------------
343 BASE_STAT_CHANGE = { # <--- Do not remove
344 # res and dex only active with YEZ Battler stats res and dex
345 # Class HP MP ATK DEF INT AGI RES DEX
346 0 => [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], #default
347 1 => [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], #default
348 2 => [ 1.0, 1.0, 0.9, 0.9, 1.2, 1.0, 1.0], #Mage
349 3 => [ 1.0, 1.0, 1.2, 1.0, 0.9, 1.0, 0.9], #Warrior
350 4 => [ 1.0, 1.0, 1.0, 0.9, 0.9, 1.2, 1.0], #Sneak
351 5 => [ 1.0, 1.0, 0.9, 1.0, 1.1, 0.9, 1.1], #Medic
352 6 => [ 1.0, 1.0, 1.1, 1.1, 1.0, 0.8, 1.0], #Knight
353 7 => [ 1.0, 1.0, 0.8, 0.8, 1.2, 1.2, 1.0], #Phantom
354 8 => [ 1.0, 1.0, 0.7, 0.7, 1.4, 1.0, 1.0], #Wizard
355 9 => [ 1.0, 1.0, 1.4, 1.0, 0.6, 1.0, 1.0], #Berserker
356 10 => [ 1.0, 1.0, 1.0, 0.7, 0.7, 1.4, 1.0], #Assassin
357 11 => [ 1.0, 1.0, 0.7, 1.3, 1.3, 0.7, 1.0], #Saint
358 12 => [ 1.0, 1.0, 1.0, 1.4, 1.0, 0.6, 1.0], #Sentinel
359 13 => [ 1.0, 1.0, 0.6, 0.6, 1.4, 1.4, 1.0], #Wraith
360
361 } # Do not remove this.
362 #==========================================================================
363 # BigEd781's Class Dependant Stat Bonuses
364 #--------------------------------------------------------------------------
365 # The purpose of this is to allow one to set stat
366 # bonuses upon class level up depending on the player's class.
367 #==========================================================================
368 # * When the below value is set to "true", the table of constant values
369 # below it are used to determine class level up bonuses are, depending
370 # on the class.
371 #-----------------------------------------------------------------------------
372 LEVEL_UP_BONUSES = false
373
374 CLASS_LEVEL_UP_BONUS_CLASS_DEP = true
375 # if true, bonuses based on class level
376 # if false, bonuses based on actor level
377 #-----------------------------------------------------------------------------
378 # * Configuration module
379 #-----------------------------------------------------------------------------
380 STAT_BONUS = { # <--- Do not remove
381 # res and dex only active with YEZ Battler stats res and dex
382 # Class HP MP ATK DEF INT AGI RES DEX
383 1 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Adventurer
384 2 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Mage
385 3 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Warrior
386 4 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Thief
387 5 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Medic
388 6 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Knight
389 7 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Phantom
390 8 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Wizard
391 9 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Berserker
392 10 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Assassin
393 11 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Saint
394 12 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Sentinel
395 13 => [ 0, 0, 0, 0, 0, 0, 0, 0, 0], #Wraith
396
397 } # Do not remove this.
398 #-----------------------------------------------------------------------------
399 # if level is decreased, are stat bonuses lost?
400 #=============================================================================
401 LOSE_STAT_BONUS = true
402 #=============================================================================
403 # Description of the class for the help window
404 #-----------------------------------------------------------------------------
405 # format: class_id => ["description"],
406 Class_Descriptions = { # <--- Do not remove
407 1 =>["[Wk: None][Res: None] Well rounded. Uses swords."], #Hero
408 2 =>["[Wk: Earth][Res: Electric] Frail, yet strong. Uses staves."], #Beserker
409 3 =>["[Wk: Water][Res: Fire] Very powerful. Uses axes."], #Priest
410 4 =>["[Wk: Electric][Res: Water] Quick and nimble. Uses knives."], #Magician
411 5 =>["[Wk: Ice][Res: Wind] Heals allies. Uses staves."],#Knight
412 6 =>["[Wk: Wind][Res: Earth] A durable defender. Uses axes."], #Dark Knight
413 7 =>["[Wk: Fire][Res: Ice] Clever and mysterious. Uses knives."], #Grappler
414 8 =>["[S.Wk: Earth][Nul: Electric] Expert magician. Uses staves."], #Beserker
415 9 =>["[S.Wk: Water][Nul: Fire] Expert Warrior. Uses axes."], #Priest
416 10 =>["[S.Wk: Electric][Nul: Water] Expert Sneak. Uses knives."], #Magician
417 11 =>["[S.Wk: Ice][Nul: Wind] Expert Medic. Uses staves."],#Knight
418 12 =>["[S.Wk: Wind][Nul: Earth] Expert Guard. Uses axes."], #Dark Knight
419 13 =>["[S.Wk: Fire][Nul: Ice] Expert Phantom. Uses knives."], #Grappler
420 }# <--- Do not remove
421 #=============================================================================
422 # icons appear next to class in job changer window # requested by Andrelvis
423 USE_ICONS_FOR_CLASSES = true
424 # format: class_id => [icon_id],
425 Class_Icons = { # <--- Do not remove
426 0 => 0, #default if no icon assigned
427 1 => 2,
428 2 => 32,
429 3 => 6,
430 4 => 48,
431 5 => 189,
432 6 => 52,
433 7 => 39,
434 8 => 32,
435 9 => 6,
436 10 => 48,
437 11=> 189,
438 12 => 52,
439 13 => 39,
440 } # <--- Do not remove
441 #-----------------------------------------------------------------------------
442 Custom_JP_Needed_For_Level = true
443 # If true, uses exp_list as starting values and similar formula.
444 # If false, solely uses exp_list for jp needed for class level up.
445 CLASS_JP_MOD_BASIS = 20
446 CLASS_JP_MOD_INFLATION = 10
447
448 CLASS_JP_MOD = {# <--- Do not remove
449 #format: class_id => [basis, inflation],
450 14 => [20, 15],
451 15 => [10, 20],
452 16 => [25, 25],
453 }# <--- Do not remove
454
455
456end
457end
458#=============================================================================
459# * End Customization *
460#=============================================================================
461
462# Don't touch, all customizations can be done in the script above.
463#===============================================================================
464module S_B::CLASS
465 module_function
466 def permit_jobchange(enabled = true)
467 if enabled
468 $game_switches[S_B::CLASS::DISABLE_CLASS] = false
469 else
470 $game_switches[S_B::CLASS::DISABLE_CLASS] = true
471 end
472 end
473 #--------------------------------------------------------------------------
474 def check_class_level(actor, class_id, variable_id = 0)
475 level = 2
476 c = $data_classes[class_id]
477 level = $game_actors[actor].class_level[c.id]
478 $game_variables[variable_id] = level if variable_id > 0
479 return level
480 end
481 #--------------------------------------------------------------------------
482 def actor_class_list_size(actor, variable_id = 0)
483 class_list = $game_actors[actor].unlocked_classes
484 $game_variables[variable_id] = class_list.size if variable_id > 0
485 return class_list
486 end
487end
488#===============================================================================
489class Game_Interpreter
490 include S_B::CLASS
491end
492#===============================================================================
493module Vocab
494 ObtainClassExp = S_B::CLASS::ObtainClassExp
495 ClassLevelUp = S_B::CLASS::ClassLevelUp
496 Display_Actor_Msg = S_B::CLASS::DISPLAY_ACTOR_MSG
497 Classes_Vocab = S_B::CLASS::MENU_CLASS_CHANGE_TITLE
498 def self.jp
499 return S_B::CLASS::CLASS_EXP
500 end
501 def self.jp_a
502 return S_B::CLASS::CLASS_EXP_A
503 end
504end
505$imported = {} if $imported == nil
506$imported["JobChange"] = true
507#===============================================================================
508module YE
509 module REGEXP
510 module BASEITEM
511 # These are skill related.
512 JP_BOOST_SET = /<(?:JP_BOOST_SET|jp_boost_set)\s*(\d+)>/i
513 JP_BOOST_RAN = /<(?:JP_BOOST_RAN|jp_boost_ran)\s*(\d+)>/i
514 # These are item related.
515 GAIN_JP = /<(?:GAIN_JP|gain_jp)\s*(\d+)>/i
516 UNLOCK_CLASS = /<(?:UNLOCK_CLASS|unlock class)[ ]*(\d+)>/i
517 LOCK_CLASS = /<(?:LOCK_CLASS|lock class)[ ]*(\d+)>/i
518 end # BASEITEM
519 module ENEMY
520 # These are enemy related
521 ENEMY_JP = /<(?:ENEMY_JP|enemy_jp)\s*(\d+)>/i
522 end # ENEMY
523 module STATE
524 # This affects states.
525 BONUS_JP_PER = /<(?:BONUS_JP_PER|bonus_jp_per)[ ]*(\d+)(?:%|%)?>/i
526 BONUS_JP_SET = /<(?:BONUS_JP_SET|bonus_jp_set)[ ]*(\d+)>/i
527 end # STATE
528 end # REGEXP
529end # YE
530#===============================================================================
531# RPG::State *from yanfly
532#===============================================================================
533class RPG::State
534 #--------------------------------------------------------------------------
535 # Yanfly_Cache_SSS
536 #--------------------------------------------------------------------------
537 def yanfly_cache_state_sss
538 @bonus_jp_per = 100; @bonus_jp_set = 0
539 self.note.split(/[\r\n]+/).each { |line|
540 case line
541 when YE::REGEXP::STATE::BONUS_JP_PER
542 @bonus_jp_per = $1.to_i
543 when YE::REGEXP::STATE::BONUS_JP_SET
544 @bonus_jp_set = $1.to_i
545 end
546 }
547 end # cache
548 #--------------------------------------------------------------------------
549 # definitions
550 #--------------------------------------------------------------------------
551 def bonus_jp_per
552 yanfly_cache_state_sss if @bonus_jp_per == nil
553 return @bonus_jp_per
554 end
555 def bonus_jp_set
556 yanfly_cache_state_sss if @bonus_jp_set == nil
557 return @bonus_jp_set
558 end
559end
560#===============================================================================
561# RPG::BaseItem *from yanfly
562#===============================================================================
563class RPG::BaseItem
564 #--------------------------------------------------------------------------
565 # Yanfly_Cache_SSS
566 #--------------------------------------------------------------------------
567 def yanfly_cache_baseitem_sss
568 @jp_boost_set = 0; @jp_boost_ran = 0
569 @gain_jp = 0; @unlock_class = []; @lock_class = []
570 self.note.split(/[\r\n]+/).each { |line|
571 case line
572 when YE::REGEXP::BASEITEM::JP_BOOST_SET
573 @jp_boost_set = $1.to_i
574 when YE::REGEXP::BASEITEM::JP_BOOST_RAN
575 @jp_boost_ran = $1.to_i
576 when YE::REGEXP::BASEITEM::GAIN_JP
577 @gain_jp = $1.to_i
578 when YE::REGEXP::BASEITEM::UNLOCK_CLASS
579 @unlock_class.push($1.to_i)
580 when YE::REGEXP::BASEITEM::LOCK_CLASS
581 @lock_class.push($1.to_i)
582 end
583 }
584 end # cache
585 #--------------------------------------------------------------------------
586 # JP definitions
587 #--------------------------------------------------------------------------
588 def jp_boost_set
589 yanfly_cache_baseitem_sss if @jp_boost_set == nil
590 return @jp_boost_set
591 end
592 def jp_boost_ran
593 yanfly_cache_baseitem_sss if @jp_boost_ran == nil
594 return @jp_boost_ran
595 end
596 def gain_jp
597 yanfly_cache_baseitem_sss if @gain_jp == nil
598 return @gain_jp
599 end
600 #--------------------------------------------------------------------------
601 # class definitions
602 #--------------------------------------------------------------------------
603 def unlock_class
604 yanfly_cache_baseitem_sss if @unlock_class == nil
605 return @unlock_class
606 end
607 def lock_class
608 yanfly_cache_baseitem_sss if @lock_class == nil
609 return @lock_class
610 end
611end
612#===============================================================================
613# RPG::Enemy *from yanfly
614#===============================================================================
615class RPG::Enemy
616 #--------------------------------------------------------------------------
617 # Yanfly_Cache_SSS
618 #--------------------------------------------------------------------------
619 def yanfly_cache_enemy_sss
620 @enemy_jp = S_B::CLASS::ENEMIES_JP_DEFAULT
621 self.note.split(/[\r\n]+/).each { |line|
622 case line
623 when YE::REGEXP::ENEMY::ENEMY_JP
624 @enemy_jp = $1.to_i
625 end
626 }
627 end # cache
628 #--------------------------------------------------------------------------
629 # definitions
630 #--------------------------------------------------------------------------
631 def enemy_jp
632 yanfly_cache_enemy_sss if @enemy_jp == nil
633 return @enemy_jp
634 end
635end
636#==============================================================================
637# ** Game_Actor *from prexus and TBK and blackmorning
638#==============================================================================
639class Game_Actor < Game_Battler
640 attr_accessor :jp_list
641 attr_accessor :jp_exp
642 attr_accessor :class_level
643 #--------------------------------------------------------------------------
644 alias job_initialize initialize unless $@
645 #--------------------------------------------------------------------------
646 def initialize(actor_id)
647 job_initialize(actor_id)
648 @exist_character_graphics = []
649 end
650 #--------------------------------------------------------------------------
651 alias job_setup setup unless $@
652 #--------------------------------------------------------------------------
653 def setup(actor_id)
654 job_setup(actor_id) #default
655 @jp_list = {}
656
657 for id in 1..$data_classes.size - 1
658 next unless $data_classes[id]
659 @jp_list[id] = Array.new(101)
660 end
661
662 make_jp_exp_list
663
664 @jp_exp = {}
665 @jp_exp.default = 0
666 @class_level = {}
667 @class_level.default = 1
668 @skills = []
669 define_skills
670 @unlocked_classes = S_B::CLASS::AVAILABLE_CLASSES[self.id] # What classes are unlocked.
671 @unlocked_classes = [self.class.id] if S_B::CLASS::AVAILABLE_CLASSES[self.id] == nil
672
673 end
674 #--------------------------------------------------------------------------
675 # * Calculate JP Experience
676 #--------------------------------------------------------------------------
677 def make_jp_exp_list
678 for id in 1..$data_classes.size - 1
679 next unless $data_classes[id]
680 if S_B::CLASS::Custom_JP_Needed_For_Level
681 if S_B::CLASS::CLASS_JP_MOD.include?(id)
682 jp_basis = S_B::CLASS::CLASS_JP_MOD[id][0]
683 jp_inflation = S_B::CLASS::CLASS_JP_MOD[id][1]
684 else
685 jp_basis = S_B::CLASS::CLASS_JP_MOD_BASIS
686 jp_inflation = S_B::CLASS::CLASS_JP_MOD_INFLATION
687 end
688 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[id]
689 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
690 @jp_list[id][1] = @jp_list[id][maxlevel+1] = 0
691 m = jp_basis
692 n = (0.5 + jp_inflation / 200.0);
693 for i in 2..(maxlevel)
694 @jp_list[id][i] = @jp_list[id][i - 1] + Integer(m)
695 m *= 1 + n;
696 n *= 0.895;
697 end
698 else
699 @jp_list[id] = @exp_list
700 end
701 end
702 end
703 #--------------------------------------------------------------------------
704 def forget_class_skills(id = nil)
705 id = @class_id if id == nil
706 for i in $data_classes[id].learnings
707 forget_skill(i.skill_id) unless S_B::CLASS::KEEP_SKILLS or S_B::CLASS::SPECIAL_CLASS_ACTORS.include?(actor.id)
708 end
709 end
710 #--------------------------------------------------------------------------
711 def define_skills(id = nil)
712 id = @class_id if id == nil
713 if !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
714 for i in $data_classes[id].learnings
715 learn_skill(i.skill_id) if i.level <= @level
716 end
717 else
718 for i in $data_classes[id].learnings
719 learn_skill(i.skill_id) if i.level <= @class_level[id]
720 end
721 end
722 end
723 #--------------------------------------------------------------------------
724 def change_jp(jp, id = nil, show = false)
725 id = @class_id if id == nil
726 last_level = @class_level[id]
727 last_skills = skills
728 @jp_exp[id] = [[jp, 999999].min, 0].max
729 while @jp_exp[id] >= @jp_list[id][@class_level[id] + 1] and @jp_list[id][@class_level[id] + 1] > 0
730 class_level_up(id)
731 end
732 while @jp_exp[id] < @jp_list[id][@class_level[id]]
733 class_level_down(id)
734 end
735 if show and @class_level[id] > last_level
736 display_class_level_up(skills - last_skills, id)
737 end
738 end
739 #--------------------------------------------------------------------------
740 def jp_exp_s(id = nil)
741 id = @class_id if id == nil
742 return @jp_list[id][@class_level[id]+1] > 0 ? @jp_exp[id] : "-------"
743 end
744 #--------------------------------------------------------------------------
745 # * Get jp - numeric for calculations
746 #--------------------------------------------------------------------------
747 def now_jp_exp(id = nil)
748 id = @class_id if id == nil
749 return @jp_exp[id] - @jp_list[id][@class_level[id]]
750 end
751 #--------------------------------------------------------------------------
752 def next_jp_exp_s(id = nil)
753 id = @class_id if id == nil
754 return @jp_list[id][@class_level[id]+1] > 0 ? @jp_list[id][@class_level[id]+1] : "-------"
755 end
756 #--------------------------------------------------------------------------
757 def next_class_rest_exp_s(id = nil)
758 id = @class_id if id == nil
759 return @jp_list[id][@class_level[id]+1] > 0 ? (@jp_list[id][@class_level[id]+1] - @jp_exp[id]) : "-------"
760 end
761 #--------------------------------------------------------------------------
762 def class_level_up(id = nil, adjust = false)
763 id = @class_id if id == nil
764 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[id]
765 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
766 @class_level[id] += 1 unless @class_level[id] == maxlevel
767 @jp_exp[id] = @jp_list[id][@class_level[id]]
768 if S_B::CLASS::LEVEL_UP_BONUSES
769 if S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::STAT_BONUS.include?(id)
770 self.maxhp += S_B::CLASS::STAT_BONUS[id][0]
771 self.maxmp += S_B::CLASS::STAT_BONUS[id][1]
772 self.atk += S_B::CLASS::STAT_BONUS[id][2]
773 self.def += S_B::CLASS::STAT_BONUS[id][3]
774 self.spi += S_B::CLASS::STAT_BONUS[id][4]
775 self.agi += S_B::CLASS::STAT_BONUS[id][5]
776 self.res += S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
777 self.dex += S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
778 end
779 end
780 define_skills
781 define_skills(id) if S_B::CLASS::KEEP_SKILLS or S_B::CLASS::SPECIAL_CLASS_ACTORS.include?(actor.id)
782 end
783 #--------------------------------------------------------------------------
784 def class_level_down(id = nil, adjust = false)
785 id = @class_id if id == nil
786 @class_level[id] -= 1 unless @class_level[id] == 1
787 @jp_exp[id] = @jp_list[id][@class_level[id]]
788 if S_B::CLASS::LEVEL_UP_BONUSES
789 if S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::LOSE_STAT_BONUS && S_B::CLASS::STAT_BONUS.include?(id)
790 self.maxhp -= S_B::CLASS::STAT_BONUS[id][0]
791 self.maxmp -= S_B::CLASS::STAT_BONUS[id][1]
792 self.atk -= S_B::CLASS::STAT_BONUS[id][2]
793 self.def -= S_B::CLASS::STAT_BONUS[id][3]
794 self.spi -= S_B::CLASS::STAT_BONUS[id][4]
795 self.agi -= S_B::CLASS::STAT_BONUS[id][5]
796 self.res -= S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
797 self.dex -= S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
798 end
799 end
800 define_skills
801 define_skills(id) if S_B::CLASS::KEEP_SKILLS or S_B::CLASS::SPECIAL_CLASS_ACTORS.include?(actor.id)
802 end
803 #--------------------------------------------------------------------------
804 # level up
805 #--------------------------------------------------------------------------
806 def level_up
807 @level += 1
808 if S_B::CLASS::LEVEL_UP_BONUSES
809 if !S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::STAT_BONUS.include?(id)
810 self.maxhp += S_B::CLASS::STAT_BONUS[id][0]
811 self.maxmp += S_B::CLASS::STAT_BONUS[id][1]
812 self.atk += S_B::CLASS::STAT_BONUS[id][2]
813 self.def += S_B::CLASS::STAT_BONUS[id][3]
814 self.spi += S_B::CLASS::STAT_BONUS[id][4]
815 self.agi += S_B::CLASS::STAT_BONUS[id][5]
816 self.res += S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
817 self.dex += S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
818 end
819 end
820 end
821 #--------------------------------------------------------------------------
822 alias jp_leveldown level_down unless $@
823 #--------------------------------------------------------------------------
824 def level_down
825 jp_leveldown
826 if S_B::CLASS::LEVEL_UP_BONUSES
827 if !S_B::CLASS::CLASS_LEVEL_UP_BONUS_CLASS_DEP && S_B::CLASS::LOSE_STAT_BONUS && S_B::CLASS::STAT_BONUS.include?(id)
828 self.maxhp -= S_B::CLASS::STAT_BONUS[id][0]
829 self.maxmp -= S_B::CLASS::STAT_BONUS[id][1]
830 self.atk -= S_B::CLASS::STAT_BONUS[id][2]
831 self.def -= S_B::CLASS::STAT_BONUS[id][3]
832 self.spi -= S_B::CLASS::STAT_BONUS[id][4]
833 self.agi -= S_B::CLASS::STAT_BONUS[id][5]
834 self.res -= S_B::CLASS::STAT_BONUS[id][6] if $imported["BattlerStatRES"] or $imported["RES Stat"]
835 self.dex -= S_B::CLASS::STAT_BONUS[id][7] if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
836 end
837 end
838 end
839 #--------------------------------------------------------------------------
840 def jp_received(jp, id = nil, show = false)
841 id = @class_id if id == nil
842 change_jp(@jp_exp[id] + jp, id, show)
843 end
844 #--------------------------------------------------------------------------
845 # forget all skills
846 #--------------------------------------------------------------------------
847 def forget_all_skills
848 @skills = []
849 end
850 #--------------------------------------------------------------------------
851 def class_change_level(level, id = nil, show = false)
852 id = @class_id if id == nil
853 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[id]
854 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
855 level = [[level, maxlevel].min, 1].max
856 change_jp(@jp_list[id][level], id, show)
857 end
858 #--------------------------------------------------------------------------
859 def class_id=(class_id)
860 forget_class_skills
861 @class_id = class_id
862 for i in 0..4 # Remove unequippable items
863 change_equip(i, nil) unless equippable?(equips[i])
864 end
865 if $imported["EquipExtension"]
866 return if extra_armor_number == 0
867 for i in 5..armor_number
868 change_equip(i, nil) unless equippable?(equips[i])
869 end
870 end
871 purge_unequippable if $imported["EquipmentOverhaul"]
872 unless @unlocked_classes.include?(@class_id)
873 @unlocked_classes.push(@class_id)
874 end
875 @unlocked_classes.sort!
876 purge_unequippable_skills if $imported["SkillCPSystem"]
877 define_skills
878 pic_name = "$#{actor.id}_#{$data_classes[class_id].id}"
879 if S_B::CLASS::CHANGE_GRAPHIC && graphic_exist?(pic_name)
880 $game_actors[@actor_id].set_graphic(pic_name, 0, @face_name, @face_index)
881 $game_player.refresh
882 end
883 end
884 #--------------------------------------------------------------------------
885 # return unlocked classes
886 #--------------------------------------------------------------------------
887 def unlocked_classes
888 results = []
889 @unlocked_classes = [self.class.id] if @unlocked_classes == nil
890 @unlocked_classes.sort!
891 results = @unlocked_classes
892 results.push(self.class.id) unless results.include?(self.class.id)
893 return results
894 end
895 #--------------------------------------------------------------------------
896 # perform unlock class
897 #--------------------------------------------------------------------------
898 def unlock_class(newclass_id)
899 @unlocked_classes = [self.class.id] if @unlocked_classes == nil
900 unless @unlocked_classes.include?(newclass_id)
901 @unlocked_classes.push(newclass_id)
902 end
903 @unlocked_classes.sort!
904 end
905 #--------------------------------------------------------------------------
906 # perform lock class
907 #--------------------------------------------------------------------------
908 def lock_class(newclass_id)
909 return if newclass_id == self.class.id
910 @unlocked_classes = [self.class.id] if @unlocked_classes == nil
911 @unlocked_classes.delete(newclass_id)
912 @unlocked_classes.sort!
913 end
914 #--------------------------------------------------------------------------
915 # perform unlock all classes
916 #--------------------------------------------------------------------------
917 def unlock_all_classes
918 for i in 0..$data_classes.size
919 unlock = $data_classes[i + 1]
920 self.unlock_class(unlock.id)
921 end
922 @unlocked_classes.sort!
923 end
924 #--------------------------------------------------------------------------
925 # perform lock all classes
926 #--------------------------------------------------------------------------
927 def lock_all_classes
928 for i in 0..$data_classes.size
929 unlock = $data_classes[i + 1]
930 self.lock_class(unlock.id)
931 end
932 @unlocked_classes.sort!
933 end
934 #--------------------------------------------------------------------------
935 # * Determine if Graphic Filename Exists
936 #--------------------------------------------------------------------------
937 def graphic_exist?(filename)
938 return true if @exist_character_graphics.include?(filename)
939 begin
940 Cache.character(filename)
941 @exist_character_graphics.push(filename)
942 return true
943 rescue
944 return false
945 end
946 end
947 #--------------------------------------------------------------------------
948 def display_class_level_up(new_skills, id)
949 $game_message.new_page
950 i = @class_id
951 c = $data_classes[i]
952 level = @class_level[c.id]
953 text = sprintf(Vocab::ClassLevelUp, @name, $data_classes[id].name, Vocab::level, level.to_s)
954 $game_message.texts.push(text)
955 for skill in new_skills
956 text = sprintf(Vocab::ObtainSkill, skill.name)
957 $game_message.texts.push(text)
958 end
959 end
960 #--------------------------------------------------------------------------
961 # * Show Level Up Message
962 # new_skills : Array of newly learned skills
963 #--------------------------------------------------------------------------
964 def display_level_up(new_skills)
965 text = sprintf(Vocab::LevelUp, @name, Vocab::level, @level)
966 $game_message.texts.push(text)
967 for skills in new_skills
968 text = sprintf(Vocab::ObtainSkill, actor.name)
969 $game_message.texts.push(text)
970 end
971 end
972 #--------------------------------------------------------------------------
973 # * Get Critical Ratio
974 #--------------------------------------------------------------------------
975 alias job_cri cri unless $@
976 def cri
977 n = job_cri
978 n += 4 if self.job_critical_bonus
979 return n
980 end
981
982 #--------------------------------------------------------------------------
983 # * Get Fpow
984 #--------------------------------------------------------------------------
985 alias job_fpow fpow unless $@
986 def fpow
987 n = job_fpow
988 n += 10 if self.job_fpow_bonus
989 return n
990 end
991 #--------------------------------------------------------------------------
992 # * Get Wpow
993 #--------------------------------------------------------------------------
994 alias job_wpow wpow unless $@
995 def wpow
996 n = job_wpow
997 n += 10 if self.job_wpow_bonus
998 return n
999 end
1000 #--------------------------------------------------------------------------
1001 # * Get Tpow
1002 #--------------------------------------------------------------------------
1003 alias job_tpow tpow unless $@
1004 def tpow
1005 n = job_tpow
1006 n += 10 if self.job_tpow_bonus
1007 return n
1008 end
1009 #--------------------------------------------------------------------------
1010 # * Get Ipow
1011 #--------------------------------------------------------------------------
1012 alias job_ipow ipow unless $@
1013 def ipow
1014 n = job_ipow
1015 n += 10 if self.job_ipow_bonus
1016 return n
1017 end
1018 #--------------------------------------------------------------------------
1019 # * Get Epow
1020 #--------------------------------------------------------------------------
1021 alias job_epow epow unless $@
1022 def epow
1023 n = job_epow
1024 n += 10 if self.job_epow_bonus
1025 return n
1026 end
1027 #--------------------------------------------------------------------------
1028 # * Get Apow
1029 #--------------------------------------------------------------------------
1030 alias job_apow apow unless $@
1031 def apow
1032 n = job_apow
1033 n += 10 if self.job_apow_bonus
1034 return n
1035 end
1036 #--------------------------------------------------------------------------
1037 # * Get hpow
1038 #--------------------------------------------------------------------------
1039 alias job_hpow hpow unless $@
1040 def hpow
1041 n = job_hpow
1042 n += 10 if self.job_hpow_bonus
1043 return n
1044 end
1045 #--------------------------------------------------------------------------
1046 # * Get Fres
1047 #--------------------------------------------------------------------------
1048 alias job_fres fres unless $@
1049 def fres
1050 n = job_fres
1051 n -= 25 if self.job_fpow_bonus
1052 n += 50 if self.job_ipow_bonus
1053 return n
1054 end
1055 #--------------------------------------------------------------------------
1056 # * Get Wres
1057 #--------------------------------------------------------------------------
1058 alias job_wres wres unless $@
1059 def wres
1060 n = job_wres
1061 n -= 25 if self.job_wpow_bonus
1062 n += 50 if self.job_fpow_bonus
1063 return n
1064 end
1065 #--------------------------------------------------------------------------
1066 # * Get Tres
1067 #--------------------------------------------------------------------------
1068 alias job_tres tres unless $@
1069 def tres
1070 n = job_tres
1071 n -= 25 if self.job_tpow_bonus
1072 n += 50 if self.job_wpow_bonus
1073 return n
1074 end
1075 #--------------------------------------------------------------------------
1076 # * Get Ires
1077 #--------------------------------------------------------------------------
1078 alias job_ires ires unless $@
1079 def ires
1080 n = job_ires
1081 n -= 25 if self.job_ipow_bonus
1082 n += 50 if self.job_apow_bonus
1083 return n
1084 end
1085 #--------------------------------------------------------------------------
1086 # * Get Eres
1087 #--------------------------------------------------------------------------
1088 alias job_eres eres unless $@
1089 def eres
1090 n = job_eres
1091 n -= 25 if self.job_epow_bonus
1092 n += 50 if self.job_tpow_bonus
1093 return n
1094 end
1095 #--------------------------------------------------------------------------
1096 # * Get Ares
1097 #--------------------------------------------------------------------------
1098 alias job_ares ares unless $@
1099 def ares
1100 n = job_ares
1101 n -= 25 if self.job_apow_bonus
1102 n += 50 if self.job_epow_bonus
1103 return n
1104 end
1105
1106 #=============================================================================
1107 # * Change Actor Options based on Class *from TBK
1108 #=============================================================================
1109 if S_B::CLASS::CHANGE_ACTOR_OPTIONS
1110 #--------------------------------------------------------------------------
1111 # * Get [Critical Bonus] Option
1112 #--------------------------------------------------------------------------
1113 def job_critical_bonus
1114 return true if S_B::CLASS::CRITICAL_CLASSES.include?(@class_id)
1115 end
1116 #--------------------------------------------------------------------------
1117 # * Get [Fire] Option
1118 #--------------------------------------------------------------------------
1119 def job_fpow_bonus
1120 return true if S_B::CLASS::FIRE_CLASSES.include?(@class_id)
1121 end
1122 #--------------------------------------------------------------------------
1123 # * Get [Water] Option
1124 #--------------------------------------------------------------------------
1125 def job_wpow_bonus
1126 return true if S_B::CLASS::WATER_CLASSES.include?(@class_id)
1127 end
1128 #--------------------------------------------------------------------------
1129 # * Get [Thunder] Option
1130 #--------------------------------------------------------------------------
1131 def job_tpow_bonus
1132 return true if S_B::CLASS::THUNDER_CLASSES.include?(@class_id)
1133 end
1134 #--------------------------------------------------------------------------
1135 # * Get [Ice] Option
1136 #--------------------------------------------------------------------------
1137 def job_ipow_bonus
1138 return true if S_B::CLASS::ICE_CLASSES.include?(@class_id)
1139 end
1140 #--------------------------------------------------------------------------
1141 # * Get [Earth] Option
1142 #--------------------------------------------------------------------------
1143 def job_epow_bonus
1144 return true if S_B::CLASS::EARTH_CLASSES.include?(@class_id)
1145 end
1146 #--------------------------------------------------------------------------
1147 # * Get [Air] Option
1148 #--------------------------------------------------------------------------
1149 def job_apow_bonus
1150 return true if S_B::CLASS::AIR_CLASSES.include?(@class_id)
1151 end
1152 #--------------------------------------------------------------------------
1153 # * Get [Heal] Option
1154 #--------------------------------------------------------------------------
1155 def job_hpow_bonus
1156 return true if S_B::CLASS::HEAL_CLASSES.include?(@class_id)
1157 end
1158 #--------------------------------------------------------------------------
1159 # * Get [Dual Wield] Option
1160 #--------------------------------------------------------------------------
1161 alias job_two_sword two_swords_style unless $@
1162 def two_swords_style
1163 return true if S_B::CLASS::TWOSWORDS_CLASSES.include?(@class_id)
1164 job_two_sword
1165 end
1166 #--------------------------------------------------------------------------
1167 # * Get [Automatic Battle] Option
1168 #--------------------------------------------------------------------------
1169 alias job_auto_battle auto_battle unless $@
1170 def auto_battle
1171 return true if S_B::CLASS::AUTOBATTLE_CLASSES.include?(@class_id)
1172 job_auto_battle
1173 end
1174 #--------------------------------------------------------------------------
1175 # * Get [Super Guard] Option
1176 #--------------------------------------------------------------------------
1177 alias job_super_guard super_guard unless $@
1178 def super_guard
1179 return true if S_B::CLASS::SUPERGUARD_CLASSES.include?(@class_id)
1180 job_super_guard
1181 end
1182 #--------------------------------------------------------------------------
1183 # * Get [Pharmocology] Option
1184 #--------------------------------------------------------------------------
1185 alias job_pharmacology pharmacology unless $@
1186 def pharmacology
1187 return true if S_B::CLASS::PHARMACOLOGY_CLASSES.include?(@class_id)
1188 job_pharmacology
1189 end
1190 #--------------------------------------------------------------------------
1191 # * Get [Half MP Cost] Option
1192 #--------------------------------------------------------------------------
1193 alias job_half_mp_cost half_mp_cost unless $@
1194 def half_mp_cost
1195 return true if S_B::CLASS::HALP_MP_CLASSES.include?(@class_id)
1196 job_half_mp_cost
1197 end
1198 #--------------------------------------------------------------------------
1199 # * Get [HP Recover] Option
1200 #--------------------------------------------------------------------------
1201 alias job_auto_hp_recover auto_hp_recover unless $@
1202 def auto_hp_recover
1203 return true if S_B::CLASS::HP_RECOVER.include?(@class_id)
1204 job_auto_hp_recover
1205 end
1206 #--------------------------------------------------------------------------
1207 # * Get [Fast Attack] Option
1208 #--------------------------------------------------------------------------
1209 alias job_fast_attack fast_attack unless $@
1210 def fast_attack
1211 return true if S_B::CLASS::FAST_ATTACK.include?(@class_id)
1212 job_fast_attack
1213 end
1214 else
1215 def job_critical_bonus
1216 return false
1217 end
1218 end
1219
1220 def base_stat_class(type, actclass = @class_id)
1221 if S_B::CLASS::CHANGE_BASE_STATS and S_B::CLASS::BASE_STAT_CHANGE.include?(actclass)
1222 multiplier = S_B::CLASS::BASE_STAT_CHANGE[actclass][type] - 1
1223 elsif S_B::CLASS::CHANGE_BASE_STATS
1224 multiplier = S_B::CLASS::BASE_STAT_CHANGE[0][type] - 1
1225 else
1226 multiplier = 0
1227 end
1228 if $imported["BattlerStatRES"]
1229 if YEZ::STAT::ACTOR_BASE_RES.include?(@actor_id)
1230 n = eval(YEZ::STAT::ACTOR_BASE_RES[@actor_id])
1231 else
1232 n = eval(YEZ::STAT::ACTOR_BASE_RES[0])
1233 end
1234 value = multiplier * n
1235 elsif $imported["RES Stat"]
1236 if YEM::STATS::RES::ACTOR_BASE.include?(@actor_id)
1237 n = eval(YEM::STATS::RES::ACTOR_BASE[@actor_id])
1238 else
1239 n = eval(YEM::STATS::RES::ACTOR_BASE[0])
1240 end
1241 value = multiplier * n
1242 elsif type == 7 && $imported["BattlerStatDEX"]
1243 if YEZ::STAT::ACTOR_BASE_DEX.include?(@actor_id)
1244 n = eval(YEZ::STAT::ACTOR_BASE_DEX[@actor_id])
1245 else
1246 n = eval(YEZ::STAT::ACTOR_BASE_DEX[0])
1247 end
1248 value = multiplier * n
1249 elsif type == 7 && $imported["DEX Stat"]
1250 if YEM::STATS::DEX::ACTOR_BASE.include?(@actor_id)
1251 n = eval(YEM::STATS::DEX::ACTOR_BASE[@actor_id])
1252 else
1253 n = eval(YEM::STATS::DEX::ACTOR_BASE[0])
1254 end
1255 value = multiplier * n
1256 elsif $imported["LimitBreak"]
1257 value = multiplier * base_parameter(type)
1258 else
1259 value = multiplier * actor.parameters[type, @level]
1260 end
1261 return Integer(value)
1262 end
1263
1264 def barehand?
1265 if S_B::CLASS::BAREHANDED_CLASSES.include?(@class_id)
1266 if self.weapons[0] == nil and self.weapons[1] == nil
1267 return true
1268 else
1269 return false
1270 end
1271 else
1272 return false
1273 end
1274 end
1275 #--------------------------------------------------------------------------
1276 # bare handed multiplier
1277 #--------------------------------------------------------------------------
1278 def barehanded_multiplier(value)
1279 multiplier = S_B::CLASS::BAREHAND_BASE_MULTIPLIER
1280 id = @class_id
1281 classlevel = @class_level[id]
1282 multiplier += S_B::CLASS::BAREHAND_PER_LEVEL_BOOST * (classlevel - 1)
1283 multiplier = [S_B::CLASS::BAREHAND_MAX_MULTIPLIER, multiplier].min
1284 value *= multiplier
1285 value /= 100
1286 return value
1287 end
1288 #============================================================================#
1289 # * Change Parameters based on Class #
1290 #============================================================================#
1291 #--------------------------------------------------------------------------
1292 # * Get Basic Maximum HP
1293 #--------------------------------------------------------------------------
1294 alias job_base_maxhp base_maxhp unless $@
1295 def base_maxhp
1296 n = job_base_maxhp
1297 n += base_stat_class(0)
1298 return Integer(n)
1299 end
1300 #--------------------------------------------------------------------------
1301 # * Get basic Maximum MP
1302 #--------------------------------------------------------------------------
1303 alias job_base_maxmp base_maxmp unless $@
1304 def base_maxmp
1305 n = job_base_maxmp
1306 n += base_stat_class(1)
1307 return Integer(n)
1308 end
1309 #--------------------------------------------------------------------------
1310 # * Get Basic Attack
1311 #--------------------------------------------------------------------------
1312 alias job_base_atk base_atk unless $@
1313 def base_atk
1314 n = job_base_atk
1315 n += base_stat_class(2)
1316 barehand_trait = self.barehand?
1317 n = barehanded_multiplier(n) if barehand_trait
1318 return Integer(n)
1319 end
1320 #--------------------------------------------------------------------------
1321 # * Get Basic Defense
1322 #--------------------------------------------------------------------------
1323 alias job_base_def base_def unless $@
1324 def base_def
1325 n = job_base_def
1326 n += base_stat_class(3)
1327 return Integer(n)
1328 end
1329 #--------------------------------------------------------------------------
1330 # * Get Basic Spirit
1331 #--------------------------------------------------------------------------
1332 alias job_base_spi base_spi unless $@
1333 def base_spi
1334 n = job_base_spi
1335 n += base_stat_class(4)
1336 return Integer(n)
1337 end
1338 #--------------------------------------------------------------------------
1339 # * Get Basic Agility
1340 #--------------------------------------------------------------------------
1341 alias job_base_agi base_agi unless $@
1342 def base_agi
1343 n = job_base_agi
1344 n += base_stat_class(5)
1345 return Integer(n)
1346 end
1347 #--------------------------------------------------------------------------
1348 # * Get Basic Resistance
1349 #--------------------------------------------------------------------------
1350 if $imported["BattlerStatRES"] or $imported["RES Stat"]
1351 alias job_base_res base_res unless $@
1352 def base_res
1353 n = job_base_res
1354 n += base_stat_class(6)
1355 return Integer(n)
1356 end
1357 end
1358 #--------------------------------------------------------------------------
1359 # * Get Basic Dexterity
1360 #--------------------------------------------------------------------------
1361 if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
1362 alias job_base_dex base_dex unless $@
1363 def base_dex
1364 n = job_base_dex
1365 n += base_stat_class(7)
1366 return Integer(n)
1367 end
1368 end
1369end
1370#===============================================================================
1371# *Window_Base
1372#===============================================================================
1373class Window_Base < Window
1374 #--------------------------------------------------------------------------
1375 # * Draw Class Level
1376 #--------------------------------------------------------------------------
1377 def draw_class_level(actor, x, y)
1378 w = 60
1379 i = actor.class_id
1380 c = $data_classes[i]
1381 level = actor.class_level[c.id]
1382 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
1383 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
1384 unless level == maxlevel
1385 self.contents.font.color = system_color
1386 self.contents.draw_text(x, y, w - 30, WLH, "(#{Vocab::level_a}.")
1387 self.contents.draw_text(x, y, w, WLH, "#{level.to_s})", 2)
1388 end
1389 end
1390 #--------------------------------------------------------------------------
1391 alias job_draw_actor_class draw_actor_class unless $@
1392 #--------------------------------------------------------------------------
1393 def draw_actor_class(actor, x, y)
1394 i = actor.class_id
1395 c = $data_classes[i]
1396 level = actor.class_level[c.id]
1397 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
1398 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
1399 if level == maxlevel
1400 w = x + 108
1401 draw_icon(S_B::CLASS::MASTERED_ICON, x, y, enabled = true)
1402 job_draw_actor_class(actor, x + 24, y)
1403 else
1404 job_draw_actor_class(actor, x, y)
1405 end
1406 end
1407 #--------------------------------------------------------------------------
1408 # * Draw Class Experience
1409 #--------------------------------------------------------------------------
1410 def draw_jp_exp(actor, x, y)
1411 w = self.contents.width
1412 i = actor.class_id
1413 c = $data_classes[i]
1414 level = actor.class_level[c.id]
1415 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
1416 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
1417 unless level == maxlevel
1418 s1 = actor.jp_exp_s(c.id)
1419 s2 = actor.next_class_rest_exp_s(c.id)
1420 s_next = "#{Vocab.jp} needed"
1421 self.contents.font.color = system_color
1422 self.contents.draw_text(x, y, w, WLH, Vocab.jp)
1423 self.contents.draw_text(x, y + WLH, w, WLH, s_next)
1424 self.contents.font.color = normal_color
1425 self.contents.draw_text(x, y, w, WLH, s1, 2)
1426 self.contents.draw_text(x, y + WLH, w, WLH, s2, 2)
1427 end
1428 end
1429end
1430#===============================================================================
1431# ¦ Scene_Title
1432#===============================================================================
1433class Scene_Title < Scene_Base
1434 #--------------------------------------------------------------------------
1435 # ? Create various game objects
1436 #--------------------------------------------------------------------------
1437 alias job_create_game_objects create_game_objects unless $@
1438 def create_game_objects
1439 job_create_game_objects
1440 unless S_B::CLASS::MENU_CLASS_CHANGE_OPTION
1441 $game_switches[S_B::CLASS::DISABLE_CLASS] = true
1442 $game_switches[S_B::CLASS::HIDE_CLASS] = true
1443 end
1444 end
1445end
1446#===============================================================================
1447# ¦ Game_Party
1448#===============================================================================
1449class Game_Party
1450 #--------------------------------------------------------------------------
1451 def jobchange_enable?
1452 if $game_switches[S_B::CLASS::DISABLE_CLASS]
1453 return false
1454 else
1455 return true
1456 end
1457 end
1458end
1459
1460#==============================================================================
1461# ** Game_Troop (addon) *from yanfly
1462#==============================================================================
1463class Game_Troop < Game_Unit
1464 attr_accessor :jp_total
1465 #--------------------------------------------------------------------------
1466 def jp_total
1467 jp = 0
1468 if S_B::CLASS::ENEMIES_GIVE_JP
1469 for enemy in dead_members
1470 jp += enemy.enemy.enemy_jp unless enemy.hidden
1471 end
1472 end
1473 return jp
1474 end
1475end
1476#==============================================================================
1477# Game_Battler *from yanfly
1478#==============================================================================
1479class Game_Battler
1480 attr_accessor :jp_counter
1481 #--------------------------------------------------------------------------
1482 # perform gain_jp
1483 #--------------------------------------------------------------------------
1484 def gain_jp_battle(amount)
1485 return unless self.actor?
1486 jp = amount
1487 for state in states
1488 jp *= state.bonus_jp_per
1489 jp /= 100
1490 end
1491 for state in states
1492 jp += state.bonus_jp_set
1493 end
1494 if double_exp_gain
1495 jp *= 2
1496 end
1497 self.jp_counter += jp if $scene.is_a?(Scene_Battle)
1498 end
1499 #--------------------------------------------------------------------------
1500 # jp counter
1501 #--------------------------------------------------------------------------
1502 def jp_counter
1503 @jp_counter = 0 if @jp_counter == nil
1504 return @jp_counter
1505 end
1506 def jp_counter=(newvalue)
1507 @jp_counter = 0 if @jp_counter == nil
1508 @jp_counter = newvalue
1509 end
1510 #--------------------------------------------------------------------------
1511 # alias attack effect
1512 #--------------------------------------------------------------------------
1513 alias attack_effect_sss attack_effect unless $@
1514 def attack_effect(attacker)
1515 attack_effect_sss(attacker)
1516 return unless attacker.actor?
1517 return unless S_B::CLASS::USE_BONUS_JP
1518 return unless S_B::CLASS::EARN_JP_VIA_ATTACK_ENABLE
1519 amount = S_B::CLASS::EARN_JP_VIA_ATTACK_AMOUNT
1520 unless S_B::CLASS::EARN_JP_VIA_ATTACK_RANDOM == 0
1521 amount += rand(S_B::CLASS::EARN_JP_VIA_ATTACK_RANDOM)
1522 end
1523 attacker.gain_jp_battle(amount)
1524 end
1525 #--------------------------------------------------------------------------
1526 # alias skill effect
1527 #--------------------------------------------------------------------------
1528 alias skill_effect_sss skill_effect unless $@
1529 def skill_effect(user, skill)
1530 skill_effect_sss(user, skill)
1531 return unless user.actor?
1532 return unless S_B::CLASS::USE_BONUS_JP
1533 return unless S_B::CLASS::EARN_JP_VIA_SKILL_ENABLE
1534 return unless $scene.is_a?(Scene_Battle)
1535 amount = S_B::CLASS::EARN_JP_VIA_SKILL_AMOUNT
1536 unless S_B::CLASS::EARN_JP_VIA_SKILL_RANDOM == 0
1537 amount += rand(S_B::CLASS::EARN_JP_VIA_SKILL_RANDOM)
1538 end
1539 amount += skill.jp_boost_set unless skill.jp_boost_set <= 0
1540 jp += rand(skill.jp_boost_ran) unless skill.jp_boost_ran <= 0
1541 user.gain_jp_battle(amount)
1542 end
1543 #--------------------------------------------------------------------------
1544 # alias item effect
1545 #--------------------------------------------------------------------------
1546 alias item_effect_sss item_effect unless $@
1547 def item_effect(user, item)
1548 item_effect_sss(user, item)
1549 return unless user.actor?
1550 user.jp_received(item.gain_jp, nil, true)
1551 #----------------------------------
1552 if item.unlock_class != []
1553 for class_id in item.unlock_class
1554 user.unlock_class(class_id)
1555 end
1556 end
1557 if item.lock_class != []
1558 for class_id in item.lock_class
1559 user.lock_class(class_id)
1560 end
1561 end
1562 #----------------------------------
1563 return unless S_B::CLASS::USE_BONUS_JP
1564 return unless S_B::CLASS::EARN_JP_VIA_ITEMS_ENABLE
1565 return unless $scene.is_a?(Scene_Battle)
1566 amount = S_B::CLASS::EARN_JP_VIA_ITEMS_AMOUNT
1567 unless S_B::CLASS::EARN_JP_VIA_ITEMS_RANDOM == 0
1568 amount += rand(S_B::CLASS::EARN_JP_VIA_ITEMS_RANDOM)
1569 end
1570 user.gain_jp_battle(amount)
1571 end
1572 #--------------------------------------------------------------------------
1573 # alias item test
1574 #--------------------------------------------------------------------------
1575 alias item_test_sss item_test unless $@
1576 def item_test(user, item)
1577 if self.actor?
1578 return true if item.unlock_class != []
1579 return true if item.lock_class != []
1580 return true if item.gain_jp > 0
1581 end
1582 return item_test_sss(user, item)
1583 end
1584end
1585#==============================================================================
1586# ** Scene_Battle (addon) *from yanfly
1587#==============================================================================
1588class Scene_Battle < Scene_Base
1589 #--------------------------------------------------------------------------
1590 # alias process_battle_start
1591 #--------------------------------------------------------------------------
1592 alias process_battle_start_sss process_battle_start unless $@
1593 def process_battle_start
1594 for actor in $game_party.members
1595 actor.jp_counter = 0
1596 end
1597 process_battle_start_sss
1598 end
1599 #--------------------------------------------------------------------------
1600 # alias execute_action_guard
1601 #--------------------------------------------------------------------------
1602 alias execute_action_guard_sss execute_action_guard unless $@
1603 def execute_action_guard
1604 execute_action_guard_sss
1605 return unless @active_battler.actor?
1606 return unless S_B::CLASS::USE_BONUS_JP
1607 return unless S_B::CLASS::EARN_JP_VIA_GUARD_ENABLE
1608 amount = S_B::CLASS::EARN_JP_VIA_GUARD_AMOUNT
1609 unless S_B::CLASS::EARN_JP_VIA_GUARD_RANDOM == 0
1610 amount += rand(S_B::CLASS::EARN_JP_VIA_GUARD_RANDOM)
1611 end
1612 @active_battler.gain_jp_battle(amount)
1613 end
1614
1615 alias job_display_exp_and_gold display_exp_and_gold unless $@
1616 def display_exp_and_gold
1617 @ignore_wait_for_message = true
1618 # call the original code
1619
1620 job_display_exp_and_gold
1621
1622 display_JP
1623 @ignore_wait_for_message = false
1624 wait_for_message
1625 end
1626 #--------------------------------------------------------------------------
1627 def display_JP
1628 jp = 0
1629 jp = $game_troop.jp_total if S_B::CLASS::ENEMIES_GIVE_JP
1630 if jp > 0
1631 text = sprintf(Vocab::ObtainClassExp, jp)
1632 $game_message.texts.push('\.' + text)
1633 end
1634 for actor in $game_party.existing_members
1635 jp = 0
1636 jp = $game_troop.jp_total if S_B::CLASS::ENEMIES_GIVE_JP
1637
1638 unless $imported["battleresults"]
1639 if S_B::CLASS::USE_BONUS_JP && S_B::CLASS::DISPLAY_BONUS_JP
1640 i = actor.class_id
1641 c = $data_classes[i]
1642 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
1643 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
1644 if actor.jp_counter > 0 && actor.class_level != maxlevel
1645 text = sprintf(Vocab::Actor_Msg, actor.name, actor.jp_counter)
1646 $game_message.texts.push('\>' + text)
1647 end
1648 end
1649 end
1650 if actor.double_exp_gain
1651 jp *= 2
1652 end
1653 for state in actor.states
1654 jp *= state.bonus_jp_per
1655 jp /= 100
1656 end
1657 for state in actor.states
1658 jp += state.bonus_jp_set
1659 end
1660 jp = jp + actor.jp_counter if S_B::CLASS::USE_BONUS_JP
1661 last_level = actor.class_level
1662 last_skills = actor.skills
1663 actor.jp_received(jp, nil, true)
1664 end
1665 end
1666end
1667#==============================================================================
1668# ** Scene_Job (new) *from prexus
1669#==============================================================================
1670class Scene_Job < Scene_Base
1671 #--------------------------------------------------------------------------
1672 def initialize(actor_index = 0, menu_index = 0)
1673 @menu_index = menu_index
1674 @actor_index = actor_index
1675 end
1676 #--------------------------------------------------------------------------
1677 def start
1678 @actor = $game_party.members[@actor_index]
1679 create_menu_background
1680 create_windows
1681 @classlist_window.refresh
1682 end
1683 #--------------------------------------------------------------------------
1684 def create_windows
1685 @classlist_window = Window_ClassPick.new(@actor)
1686 @classchange_window = Window_Class_Change.new(@actor)
1687 @skills_window = Window_ShowSkills.new(@actor)
1688 @help_window = Window_Help.new
1689 @help_window.visible = false
1690 @help_window.close
1691 @help_window2 = Window_Help.new
1692 @classchange_window.x = 0
1693 @classlist_window.y = @classchange_window.y = @help_window2.height
1694 @classchange_window.width = @classlist_window.width = Graphics.width / 2
1695 @classlist_window.x = @classchange_window.width
1696 @classlist_window.height = @classchange_window.height = Graphics.height - @help_window2.height
1697 @classlist_window.index = 0
1698 @help_window.width = 544
1699 @help_window.height = 64
1700 @help_window.x = 0
1701 @help_window.y = 354
1702 @help_window.back_opacity = 255
1703 @help_window.create_contents
1704 @skills_window.help_window = @help_window
1705 @skills_window.help_window.back_opacity = 255
1706 @confirm_window = Window_Confirm.new
1707 end
1708 #--------------------------------------------------------------------------
1709 def update_windows
1710 @classlist_window.update(@actor)
1711 @classchange_window.update
1712 @skills_window.update
1713 @help_window.update
1714 @help_window2.update
1715 @confirm_window.update
1716 if @classlist_window.active
1717 @classchange_window.set(@actor, @classlist_window.item)
1718 id = @classlist_window.item.id
1719 if S_B::CLASS::Class_Descriptions.include?(id)
1720 @help_window2.set_text(S_B::CLASS::Class_Descriptions[id][0])
1721 else
1722 @help_window2.set_text("")
1723 end
1724 end
1725 end
1726 #--------------------------------------------------------------------------
1727 def terminate
1728 super
1729 dispose_menu_background
1730 @classlist_window.dispose
1731 @classchange_window.dispose
1732 @skills_window.dispose
1733 @help_window.dispose
1734 @help_window2.dispose
1735 @confirm_window.dispose
1736 end
1737 #--------------------------------------------------------------------------
1738 def update
1739 super
1740 update_menu_background
1741 update_windows
1742 if @classlist_window.active
1743 update_class_list
1744 elsif @skills_window.active
1745 update_skills_list
1746 elsif @confirm_window.active
1747 update_confirm_window
1748 end
1749 end
1750 #--------------------------------------------------------------------------
1751 # * Switch to Next Actor Screen
1752 #--------------------------------------------------------------------------
1753 def next_actor
1754 @actor_index += 1
1755 @actor_index %= $game_party.members.size
1756 $scene = Scene_Job.new(@actor_index, @menu_index)
1757 end
1758 #--------------------------------------------------------------------------
1759 # * Switch to Previous Actor Screen
1760 #--------------------------------------------------------------------------
1761 def prev_actor
1762 @actor_index += $game_party.members.size - 1
1763 @actor_index %= $game_party.members.size
1764 $scene = Scene_Job.new(@actor_index, @menu_index)
1765 end
1766 #--------------------------------------------------------------------------
1767 # * Return to previous scene
1768 #--------------------------------------------------------------------------
1769 def return_scene
1770 if $imported["SceneStatusReDux"]
1771 update_menu_background
1772 $scene = Scene_Menu.new(3)
1773 elsif @menu_index == 0
1774 $scene = Scene_Map.new
1775 else
1776 $scene = Scene_Menu.new(@menu_index)
1777 end
1778 end
1779 #--------------------------------------------------------------------------
1780 def update_class_list
1781 if Input.trigger?(Input::B)
1782 Sound.play_cancel
1783 return_scene
1784 elsif Input.trigger?(Input::C)
1785 if @classlist_window.item.id == @classlist_window.actor.class_id
1786 Sound.play_buzzer
1787 return
1788 end
1789 Sound.play_decision
1790 @confirm_window.visible = true
1791 @confirm_window.active = true
1792 @confirm_window.index = 0
1793 @confirm_window.open
1794 @classlist_window.active = false
1795 elsif Input.trigger?(S_B::CLASS::SHOW_SKILLS_WINDOW)
1796 Sound.play_decision
1797 @skills_window.set(@actor, @classlist_window.item.id)
1798 @skills_window.active = true
1799 @skills_window.index = 1
1800 @skills_window.open
1801 @help_window.visible = true
1802 @help_window.open
1803 @classlist_window.active = false
1804 elsif Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
1805 Sound.play_cursor
1806 next_actor
1807 elsif Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
1808 Sound.play_cursor
1809 prev_actor
1810 end
1811 end
1812 def update_skills_list
1813 if Input.trigger?(Input::B)
1814 Sound.play_cancel
1815 @classlist_window.active = true
1816 @skills_window.active = false
1817 @skills_window.index = -1
1818 @skills_window.close
1819 @help_window.close
1820 end
1821 end
1822 def update_confirm_window
1823 if Input.trigger?(Input::B)
1824 Sound.play_cancel
1825 if @confirm_window.index == 1
1826 @confirm_window.active = false
1827 @confirm_window.index = -1
1828 @confirm_window.close
1829 @classlist_window.active = true
1830 return
1831 else
1832 @confirm_window.index = 1
1833 return
1834 end
1835 elsif Input.trigger?(Input::C)
1836 case @confirm_window.index
1837 when 0
1838 Sound.play_decision
1839 actor = @classlist_window.actor
1840 actor.class_id = @classlist_window.item.id
1841 #Check to make sure that
1842 if @actor.hp > @actor.maxhp
1843 @actor.hp = @actor.maxhp
1844 end
1845 if @actor.mp > @actor.maxmp
1846 @actor.mp = @actor.maxmp
1847 end
1848 @confirm_window.active = false
1849 @confirm_window.index = -1
1850 @confirm_window.close
1851 @classlist_window.refresh
1852 @classchange_window.refresh
1853 @classlist_window.active = true
1854 when 1
1855 @confirm_window.active = false
1856 @confirm_window.index = -1
1857 @confirm_window.close
1858 @classlist_window.active = true
1859 return
1860 end
1861 end
1862 end
1863end
1864
1865#==============================================================================
1866# ** Window_ClassPick
1867# window where selectable class list is generated
1868#==============================================================================
1869class Window_ClassPick < Window_Selectable
1870 #--------------------------------------------------------------------------
1871 def initialize(actor)
1872 super(Graphics.width / 2, 48, Graphics.width / 2, Graphics.height - (WLH + 32))
1873 create_contents
1874 @actor = actor
1875 self.index = 0
1876 self.active = true
1877 refresh
1878 end
1879 #--------------------------------------------------------------------------
1880 def update(actor = nil)
1881 super()
1882 return if actor == @actor
1883 @actor = actor
1884 refresh
1885 end
1886 #--------------------------------------------------------------------------
1887 def actor
1888 return @actor
1889 end
1890 #--------------------------------------------------------------------------
1891 def item
1892 return $data_classes[@actor.unlocked_classes[index]]
1893 end
1894 #--------------------------------------------------------------------------
1895 # refresh
1896 #--------------------------------------------------------------------------
1897 def refresh
1898 @data = []
1899 for class_id in @actor.unlocked_classes
1900 @data.push(class_id)
1901 end
1902 @item_max = @data.size
1903 create_contents
1904 for i in 0...@item_max
1905 draw_item(i)
1906 end
1907 end
1908 #--------------------------------------------------------------------------
1909 # draw item
1910 #--------------------------------------------------------------------------
1911 def draw_item(index)
1912 rect = item_rect(index)
1913 self.contents.clear_rect(rect)
1914 iclass = $data_classes[@actor.unlocked_classes[index]]
1915 if iclass.id != 0
1916 rect.width -= 4
1917 enabled = true
1918 enabled = false if iclass == @actor.class
1919 level = @actor.class_level[iclass.id]
1920 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[iclass.id]
1921 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
1922 if level == maxlevel
1923 icon = S_B::CLASS::MASTERED_ICON
1924 elsif S_B::CLASS::USE_ICONS_FOR_CLASSES
1925 if S_B::CLASS::Class_Icons.include?(iclass.id)
1926 icon = S_B::CLASS::Class_Icons[iclass.id]
1927 else
1928 icon = S_B::CLASS::Class_Icons[0]
1929 end
1930 end
1931 draw_icon(icon, rect.x, rect.y, enabled)
1932 dx = rect.x
1933 dy = rect.y
1934 dw = rect.width
1935 dh = rect.height
1936 self.contents.font.color.alpha = enabled ? 255 : 128
1937 self.contents.draw_text(dx+24, dy, dw-48, dh, iclass.name, 0)
1938 unless !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
1939 self.contents.draw_text(dx, dy, dw, dh, "Lv. " + level.to_s, 2)
1940 end
1941 end
1942 end
1943end
1944#==============================================================================
1945# ** Window_Class_Change
1946#==============================================================================
1947class Window_Class_Change < Window_Base
1948 #--------------------------------------------------------------------------
1949 def initialize(actor = nil, class_obj = nil)
1950 super(0, 48, Graphics.width / 2, Graphics.height - (WLH + 32))
1951 create_contents
1952 @actor = actor
1953 @class_obj = class_obj
1954 refresh
1955 end
1956 #--------------------------------------------------------------------------
1957 def actor
1958 return @actor
1959 end
1960 #--------------------------------------------------------------------------
1961 def item
1962 return @class_obj
1963 end
1964 #--------------------------------------------------------------------------
1965 def set(actor, class_obj)
1966 old_actor = @actor
1967 @actor = actor
1968 old_class_obj = @class_obj
1969 @class_obj = class_obj
1970 refresh if (old_actor != @actor) or (old_class_obj != @class_obj)
1971 end
1972 #--------------------------------------------------------------------------
1973 def refresh
1974 self.contents.clear
1975
1976 return unless @actor
1977 c = (@class_obj != nil ? @class_obj : $data_classes[@actor.class_id])
1978 x, y = 0, 0
1979 w = self.contents.width
1980 hy = self.contents.height - WLH * 4
1981 self.draw_actor_face(@actor, x + 2, y + 2)
1982
1983 draw_basic_info(112, 0)
1984 self.contents.font.color = system_color
1985 self.contents.draw_text(x, hy + WLH * 0, w, WLH, "Class:")
1986 unless !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
1987 self.contents.draw_text(x, hy + WLH * 1, w, WLH, "Class #{Vocab::level_a}:")
1988 s_next = ("#{Vocab.jp} needed:")
1989 self.contents.draw_text(x, hy + WLH * 2, w, WLH, Vocab.jp)
1990 self.contents.draw_text(x, hy + WLH * 3, w, WLH, s_next)
1991 end
1992 dy = WLH * 4
1993
1994 y1 = (hy - dy - 80)/2
1995 y = y1 + dy
1996
1997 draw_parameters(x, y)
1998
1999 return unless @class_obj
2000 self.contents.font.color = normal_color
2001 self.contents.draw_text(x, hy + WLH * 0, w, WLH, c.name,2)
2002 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
2003 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
2004 s1 = @actor.jp_exp_s(c.id)
2005 s2 = @actor.next_class_rest_exp_s(c.id)
2006 if @actor.class_level[c.id] == maxlevel
2007 draw_icon(S_B::CLASS::MASTERED_ICON, w - 24, hy + WLH * 1, enabled = true)
2008 self.contents.font.color = normal_color
2009 self.contents.draw_text(x, hy + WLH * 1, w - 24, WLH, "Mastered",2)
2010 else
2011 unless !S_B::CLASS::USE_BONUS_JP && !S_B::CLASS::ENEMIES_GIVE_JP
2012 self.contents.draw_text(x, hy + WLH * 1, w, WLH, @actor.class_level[c.id], 2)
2013 self.contents.font.color = normal_color
2014 end
2015 end
2016 self.contents.draw_text(x, hy + WLH * 2, w, WLH, s1, 2)
2017 self.contents.draw_text(x, hy + WLH * 3, w, WLH, s2, 2)
2018 end
2019
2020 def draw_basic_info(x, y)
2021 w = self.contents.width
2022 self.contents.font.color = system_color
2023 self.contents.draw_text(x, y + WLH * 0, w, WLH, "Name:")
2024 self.contents.font.color = normal_color
2025 self.contents.draw_text(x, y + WLH * 1, w - 112, WLH, actor.name, 2)
2026 self.contents.font.color = system_color
2027 self.contents.draw_text(x, y + WLH * 2, w, WLH, "Current Class:")
2028 self.contents.font.color = normal_color
2029 self.contents.draw_text(x, y + WLH * 3, w - 112, WLH, actor.class.name, 2)
2030 self.draw_actor_level(@actor, x - 112, y + WLH * 4)
2031 self.draw_icon(S_B::CLASS::Skills_Icon, w - 24, y + WLH * 4)
2032 self.contents.font.color = system_color
2033 self.contents.draw_text(x - 112, y + WLH * 4, w - 24, WLH, 'Skills', 2)
2034 end
2035
2036 def draw_parameters(x, y)
2037 last_font_size = self.contents.font.size
2038 if $imported["BattlerStatRES"] || $imported["BattlerStatDEX"] || $imported["RES Stat"] || $imported["DEX Stat"]
2039 self.contents.font.size = 13
2040 a = 13
2041 else
2042 self.contents.font.size = 15
2043 a = 15
2044 end
2045 draw_parameter(x, y + a * 0, 0)
2046 draw_parameter(x, y + a * 1, 1)
2047 draw_parameter(x, y + a * 2, 2)
2048 draw_parameter(x, y + a * 3, 3)
2049 draw_parameter(x, y + a * 4, 4)
2050 draw_parameter(x, y + a * 5, 5)
2051 b = 0
2052 draw_parameter(x, y + a * 6, 6) if $imported["BattlerStatRES"] or $imported["RES Stat"]
2053 b = 13 if $imported["BattlerStatRES"] or $imported["RES Stat"]
2054 draw_parameter(x, y + a * 6 + b, 7) if $imported["BattlerStatDEX"] or $imported["DEX Stat"]
2055 self.contents.font.size = last_font_size
2056 end
2057 #--------------------------------------------------------------------------
2058 # * Draw Parameters
2059 #--------------------------------------------------------------------------
2060 def draw_parameter(x, y, type)
2061 c = (@class_obj != nil ? @class_obj : $data_classes[@actor.class_id])
2062 case type
2063 when 0
2064 name = Vocab::hp_a
2065 value = @actor.maxhp
2066 when 1
2067 name = Vocab::mp_a
2068 value = @actor.maxmp
2069 when 2
2070 name = Vocab::atk
2071 value = @actor.atk
2072 when 3
2073 name = Vocab::def
2074 value = @actor.def
2075 when 4
2076 name = Vocab::spi
2077 value = @actor.spi
2078 when 5
2079 name = Vocab::agi
2080 value = @actor.agi
2081 when 6
2082 name = "MND"
2083 value = @actor.res
2084 when 7
2085 name = "DEX"
2086 value = @actor.dex
2087 end
2088 old = @actor.base_stat_class(type)
2089 if @class_obj
2090 new = @actor.base_stat_class(type, c.id)
2091 new_value = value - old + new
2092 difference = new - old
2093 if difference > 0
2094 difference = "+ #{new - old}"
2095 end
2096 end
2097 self.contents.font.color = system_color
2098 self.contents.draw_text(x + 26, y, 80, WLH, name)
2099 self.contents.font.color = normal_color
2100 self.contents.draw_text(x + 70, y, 30, WLH, value, 2)
2101 self.contents.font.color = system_color
2102 self.contents.draw_text(x + 122, y, 20, WLH, "-->", 1)
2103 if new_value != nil
2104 self.contents.font.color = new_parameter_color(value, new_value)
2105 if S_B::CLASS::SHOW_DIFFERENCE
2106 if difference == 0
2107 self.contents.draw_text(x + 152, y, 30, WLH, "---", 2)
2108 else
2109 self.contents.draw_text(x + 152, y, 30, WLH, difference, 2)
2110 end
2111 else
2112 self.contents.draw_text(x + 152, y, 30, WLH, new_value, 2)
2113 end
2114 end
2115 end
2116
2117 def new_parameter_color(old_value, new_value)
2118 if new_value > old_value # Get stronger
2119 return power_up_color
2120 elsif new_value == old_value # No change
2121 return normal_color
2122 else # Get weaker
2123 return power_down_color
2124 end
2125 end
2126end
2127#==============================================================================
2128# ** Window_ShowSkills
2129#==============================================================================
2130class Window_ShowSkills < Window_Selectable
2131 #--------------------------------------------------------------------------
2132 def initialize(actor, class_id = nil)
2133 super(0, 56, 408, 360)
2134 @actor = actor
2135 @class_id = (class_id != nil ? class_id : @actor.class_id)
2136 @item_max = $data_classes[@class_id].learnings.size
2137 @column_max = 3
2138 create_contents
2139 self.index = -1
2140 self.active = false
2141 self.openness = 0
2142 self.back_opacity = 255
2143 refresh
2144 end
2145 #--------------------------------------------------------------------------
2146 def set(actor, class_id)
2147 old_actor = @actor
2148 @actor = actor
2149 old_class_id = @class_id
2150 @class_id = class_id
2151 @item_max = $data_classes[@class_id].learnings.size unless @class_id == nil
2152 create_contents
2153 refresh
2154 end
2155 #--------------------------------------------------------------------------
2156 def refresh
2157 return if @class_id == nil
2158 return if $data_classes[@class_id].learnings.empty?
2159 for i in 0...@item_max
2160 rect = item_rect(i)
2161 learning = $data_classes[@class_id].learnings[i]
2162 next unless learning
2163 self.contents.font.color.alpha = (@actor.class_level[@class_id] >= learning.level ? 255 : 128)
2164 self.contents.draw_text(rect, $data_skills[learning.skill_id].name)
2165 end
2166 end
2167 #--------------------------------------------------------------------------
2168 def update_help
2169 if $data_classes[@class_id].learnings.empty?
2170 self.help_window.set_text('')
2171 self.back_opacity = 255
2172 return
2173 end
2174 level = $data_classes[@class_id].learnings[self.index].level
2175 skill = $data_skills[$data_classes[@class_id].learnings[self.index].skill_id]
2176 self.help_window.set_text(skill == nil ? '' : "[Level #{level}] #{skill.description}")
2177 self.back_opacity = 255
2178 end
2179end
2180#==============================================================================
2181# ** Window_Confirm
2182#==============================================================================
2183class Window_Confirm < Window_Selectable
2184 #--------------------------------------------------------------------------
2185 def initialize(index = -1)
2186 dx = (Graphics.width - 160)/2
2187 super(dx, 168, 160, 80)
2188 create_contents
2189 @item_max = 2
2190 @column_max = 2
2191 self.index = index
2192 self.active = false
2193 self.openness = 0
2194 refresh
2195 end
2196 #--------------------------------------------------------------------------
2197 def refresh
2198 for i in 0..@item_max
2199 rect = item_rect(i)
2200 self.contents.clear_rect(rect)
2201 end
2202 self.contents.draw_text(0, 0, self.contents.width, WLH, "Confirm?", 1)
2203 rect = item_rect(0)
2204 self.contents.draw_text(rect, "Yes", 1)
2205 rect = item_rect(1)
2206 self.contents.draw_text(rect, "No", 1)
2207 end
2208 #--------------------------------------------------------------------------
2209 def item_rect(index)
2210 rect = Rect.new(0, 0, 0, 0)
2211 rect.width = (contents.width + @spacing) / @column_max - @spacing
2212 rect.height = WLH
2213 rect.x = index % @column_max * (rect.width + @spacing)
2214 rect.y = (index / @column_max * WLH) + WLH
2215 return rect
2216 end
2217end
2218#==============================================================================
2219# ** Character_Class
2220#==============================================================================
2221class Character_Class
2222 def self.new_class(actor, class_id)
2223 $game_actors[actor].unlock_class(class_id)
2224 end
2225 #--------------------------------------------------------------------------
2226 def self.remove_class(actor, class_id)
2227 $game_actors[actor].lock_class(class_id)
2228 end
2229end
2230
2231#==============================================================================
2232# Window_Command (imported from KGC)
2233#==============================================================================
2234
2235class Window_Command < Window_Selectable
2236unless method_defined?(:add_command)
2237 #--------------------------------------------------------------------------
2238 # add command
2239 #--------------------------------------------------------------------------
2240 def add_command(command)
2241 @commands << command
2242 @item_max = @commands.size
2243 item_index = @item_max - 1
2244 refresh_command
2245 draw_item(item_index)
2246 return item_index
2247 end
2248 #--------------------------------------------------------------------------
2249 # refresh command
2250 #--------------------------------------------------------------------------
2251 def refresh_command
2252 buf = self.contents.clone
2253 self.height = [self.height, row_max * WLH + 32].max
2254 create_contents
2255 self.contents.blt(0, 0, buf, buf.rect)
2256 buf.dispose
2257 end
2258 #--------------------------------------------------------------------------
2259 # insert command
2260 #--------------------------------------------------------------------------
2261 def insert_command(index, command)
2262 @commands.insert(index, command)
2263 @item_max = @commands.size
2264 refresh_command
2265 refresh
2266 end
2267 #--------------------------------------------------------------------------
2268 # remove command
2269 #--------------------------------------------------------------------------
2270 def remove_command(command)
2271 @commands.delete(command)
2272 @item_max = @commands.size
2273 refresh
2274 end
2275end
2276end
2277#===============================================================================
2278# Scene Menu
2279#===============================================================================
2280class Scene_Menu < Scene_Base
2281 #--------------------------------------------------------------------------
2282 # alias create command window
2283 #--------------------------------------------------------------------------
2284 alias create_command_window_sss create_command_window unless $@
2285 def create_command_window
2286 create_command_window_sss
2287 return if $imported["CustomMenuCommand"]
2288 return if $game_switches[S_B::CLASS::HIDE_CLASS]
2289 if S_B::CLASS::MENU_CLASS_CHANGE_OPTION || $game_party.jobchange_enable?
2290 scc_text = Vocab::Classes_Vocab
2291 @command_class_change = @command_window.add_command(scc_text)
2292 @command_window.draw_item(@command_class_change,
2293 $game_party.jobchange_enable?)
2294 if @command_window.oy > 0
2295 @command_window.oy -= Window_Base::WLH
2296 end
2297 end
2298 @command_window.index = @menu_index
2299 end
2300 #--------------------------------------------------------------------------
2301 # alias update command selection
2302 #--------------------------------------------------------------------------
2303 alias update_command_selection_sss update_command_selection unless $@
2304 def update_command_selection
2305 call_job_command = 0
2306 if Input.trigger?(Input::C)
2307 case @command_window.index
2308 when @command_class_change
2309 call_job_command = 1
2310 end
2311 end
2312 if call_job_command == 1
2313 if $game_party.members.size == 0 || !$game_party.jobchange_enable?
2314 Sound.play_buzzer
2315 return
2316 end
2317 Sound.play_decision
2318 start_actor_selection
2319 return
2320 end
2321 update_command_selection_sss
2322 end
2323
2324 #--------------------------------------------------------------------------
2325 # alias update actor selection
2326 #--------------------------------------------------------------------------
2327 alias update_actor_selection_sss update_actor_selection unless $@
2328 def update_actor_selection
2329 if Input.trigger?(Input::C)
2330 $game_party.last_actor_index = @status_window.index
2331 Sound.play_decision
2332 case @command_window.index
2333 when @command_class_change
2334 $scene = Scene_Job.new(@status_window.index,
2335 @command_class_change)
2336 return
2337 end
2338 end
2339 update_actor_selection_sss
2340 end
2341
2342end # Scene Menu
2343if S_B::CLASS::SHOW_CLASS_LVL_STATUS && (S_B::CLASS::USE_BONUS_JP || S_B::CLASS::ENEMIES_GIVE_JP)
2344 #==============================================================================
2345 # ** Window_MenuStatus
2346 #==============================================================================
2347 class Window_Status < Window_Base
2348 def draw_actor_class(actor, x, y)
2349 i = actor.class_id
2350 c = $data_classes[i]
2351 level = actor.class_level[c.id]
2352 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
2353 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
2354 if level == maxlevel
2355 w = x + 108
2356 draw_icon(S_B::CLASS::MASTERED_ICON, x, y, true)
2357 job_draw_actor_class(actor, x + 24, y)
2358 else
2359 job_draw_actor_class(actor, x + 60, y)
2360 draw_class_level(actor, x, y)
2361 end
2362 end
2363 end
2364 class Window_Status_Actor < Window_Base
2365 def draw_actor_class(actor, x, y)
2366 i = actor.class_id
2367 c = $data_classes[i]
2368 level = actor.class_level[c.id]
2369 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
2370 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
2371 if level == maxlevel
2372 w = x + 108
2373 draw_icon(S_B::CLASS::MASTERED_ICON, x, y, true)
2374 job_draw_actor_class(actor, x + 24, y)
2375 else
2376 job_draw_actor_class(actor, x + 60, y)
2377 draw_class_level(actor, x, y)
2378 end
2379 end
2380 end
2381end
2382if S_B::CLASS::SHOW_CLASS_LVL_MAIN && (S_B::CLASS::USE_BONUS_JP || S_B::CLASS::ENEMIES_GIVE_JP)
2383 class Window_MenuStatus < Window_Selectable
2384 def draw_actor_class(actor, x, y)
2385 i = actor.class_id
2386 c = $data_classes[i]
2387 level = actor.class_level[c.id]
2388 maxlevel = S_B::CLASS::CLASS_MAX_LEVELS[c.id]
2389 maxlevel = S_B::CLASS::MAX_CLASS_LEVEL_DEFAULT if maxlevel == nil
2390 if level == maxlevel
2391 w = x + 108
2392 draw_icon(S_B::CLASS::MASTERED_ICON, x, y, true)
2393 job_draw_actor_class(actor, x + 24, y)
2394 else
2395 self.contents.font.color = normal_color
2396 self.contents.draw_text(x + 40, y, 108 - 20, WLH, actor.class.name)
2397 draw_class_level(actor, x - 20, y)
2398 end
2399 end
2400 end
2401end