Advertisement
Guest User

Yanfly Subclass System

a guest
Jun 13th, 2010
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 124.40 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Yanfly Engine RD - Subclass Selection System
  4. # Last Date Updated: 2009.06.28
  5. # Level: Hard
  6. #
  7. # There's been a lot of scripts where class changing is possible, but I've yet
  8. # to see anything about a subclass system. Although this script allows changing
  9. # primary classes, its main focus is the subclass system. There are many rules
  10. # you may set for your subclass system. You can enable or disable equipment
  11. # sharing amongst classes. You can choose how subclasses affect your base stats
  12. # or not at all. You can determine how skills can be learned via subclass, etc.
  13. #
  14. # CLASS SYSTEM
  15. # Classes are now split between primary and secondary classes. You can set many
  16. # different rules for each class here inside the script. Secondary classes will
  17. # expand the skill pool and equipment pool an actor has. With the class system,
  18. # actors can also get a change in their base stats depending on which class they
  19. # have equipped at the time. They can also get different amounts of boosts for
  20. # their stats upon leveling up. The possibilities are vast.
  21. #
  22. # JP SYSTEM
  23. # There is a new stat for each actor called JP. This new stat can be earned
  24. # through various ways. It can be earned in battle, from items, attacking, using
  25. # skills and items, and guarding. All of that can be modified. What JP does is
  26. # allow your actors to learn new skills through a JP purchase system. These
  27. # skills are unlocked when JP is spent on them and an actor will permanently
  28. # have the skill at their disposal.
  29. #
  30. # UNLOCK SYSTEM
  31. # Classes are unlocked via directly class changing, items, or learning specific
  32. # skills. Scripted events can also directly unlock classes for actors if that's
  33. # what floats your boat. There is no direct tier system implemented with this
  34. # script since there is too many different ways people would love to have their
  35. # classes unlock and whatnot.
  36. #
  37. #===============================================================================
  38. # Updates:
  39. # ----------------------------------------------------------------------------
  40. # o 2009.06.28 - Added ALLOW_WEAPON and ALLOW_ARMOUR.
  41. # o 2009.05.26 - Compatibility with Scene Status ReDux
  42. # o 2009.05.17 - Small bugfix to the change actor graphics commands.
  43. # o 2009.05.16 - Upgrade Pack 2:
  44. # Primary-Only Classes and Subclass-Only Classes implemented.
  45. # Search for PRIMARY_ONLY_CLASSES and SUBCLASS_ONLY_CLASSES
  46. # Classes can now have special traits.
  47. # Actors can now change graphics when changing primary classes.
  48. # Can now event call the menus using the following:
  49. # $scene = Scene_Class_Change.new
  50. # $scene = Scene_Learn_Skill.new
  51. # Anti-crash methods updated.
  52. # o 2009.05.10 - Upgrade Pack 1:
  53. # Even more lag reduction.
  54. # Added level requirements and skill requirements.
  55. # Added Actor-Specific Common Skills Options
  56. # Added Primary-Class Only Skills Options
  57. # Added Subclass Only Skills Options
  58. # Added percentile growth rates dependent on primary and subclass
  59. # Added Actor-Restricted Classes Options
  60. # Added Primary/Subclass Stat Rate Percentage Options
  61. # Added two states that affect JP gain rate.
  62. # Added mechanic: Learning certain skills can unlock classes.
  63. # Fixed a few bugs regarding HP/MP during class changing.
  64. # o 2009.05.08 - Compatibility update with YERD Equip Skill Slots.
  65. # o 2009.05.07 - Lag Reduction. Ironed out crashes if people didn't input their
  66. # class data in correctly.
  67. # o 2009.05.05 - Finished demo. Fix up remaining bugs.
  68. # o 2009.04.30 - Finished script. Started creating demo.
  69. # o 2009.04.29 - Started script.
  70. #===============================================================================
  71. # How to Use: Hard Mode
  72. #===============================================================================
  73. #
  74. # I'm going to label all of this script as hard mode and above for multiple
  75. # reasons. This script is not meant to be taken lightly nor does it provide the
  76. # comfort of regular plug and playing that scripts with normal mode offer. I
  77. # made as much of the script to be plug and play as possible but it will still
  78. # require you to modify your classes properly before this skill will work the
  79. # way you would want it to. After all, this is your game.
  80. #
  81. # ----------------------------------------------------------------------------
  82. #
  83. # Here are some tags you can put into your skills' noteboxes to give them JP
  84. # related effects. Note that if you're not using the JP system at all, you can
  85. # just flat out ignore most of these.
  86. #
  87. # <unlock class x>
  88. # If a skill is learned with this tag, it will unlock class x for the character.
  89. # Input multiple of these tags to unlock multiple classes. The lock class tag
  90. # is not included due to potential save corruption and crashes.
  91. #
  92. # <require level x>
  93. # The actor must be at least x level before they can buy the skill with JP.
  94. #
  95. # <require skill x>
  96. # The actor must know skill x before they can buy the skill with JP. Insert
  97. # multiple of these tags to increase the amount of skills required.
  98. #
  99. # <jp cost x>
  100. # The skill will cost x jp for the actor to learn it.
  101. #
  102. # <jp boost set x>
  103. # If an actor uses this skill, that actor will gain x set amount of JP.
  104. #
  105. # <jp boost ran x>
  106. # If an actor uses this skill, that actor will gain x random amount of JP.
  107. #
  108. # ----------------------------------------------------------------------------
  109. #
  110. # Here are some tags you can put into your items' noteboxes to give them new
  111. # effects. These include JP effects but not all of them. Use accordingly.
  112. #
  113. # <gain jp x>
  114. # The item will give the target ally JP of x amount. JP is given to whatever
  115. # the ally's current class is.
  116. #
  117. # <unlock class x>
  118. # The item will unlock class x for the target ally. Use multiple of these tags
  119. # if you want an item to unlock more than one class.
  120. #
  121. # <lock class x>
  122. # The item will lock class x for the target ally. Use multiple of these tags if
  123. # you want an item to lock more than one class. Unlike the skill counterpart,
  124. # this will not corrupt the save file nor crash the game.
  125. #
  126. # <set primary x> <set subclass x>
  127. # This item will cause the target character to change primary or subclass to
  128. # whatever class x is. If subclass is set to 0, it'll remove the subclass.
  129. #
  130. # ----------------------------------------------------------------------------
  131. #
  132. # There's not much for enemy tags but here it is.
  133. #
  134. # <enemy jp x>
  135. # This determines the amount of JP given by that enemy. If nothing is determined
  136. # by this set value and you allow your enemies to give JP, then the JP delivered
  137. # will equal to the ENEMIES_DEFAULT amount.
  138. #
  139. # ----------------------------------------------------------------------------
  140. #
  141. # There's also not much for state tags but here they are.
  142. #
  143. # <bonus jp per x>
  144. # JP gain rate is x%. If x is 200, then the JP gain rate is 200%.
  145. #
  146. # <bonus jp set x>
  147. # x is added to JP gain. This means if JP gain is 20 and x is 10, total is 30.
  148. #
  149. #===============================================================================
  150. #
  151. # Compatibility
  152. # - Works With: KGC HelpExtension, EquipExtension, CustomMenuCommand
  153. # - Works With: Yanfly Display Skill Query, Equip Skill Slots
  154. # - Alias: Game_Battler: attack_effect, skill_effect, item_effect, item_test
  155. # - Alias: Game_Actor: setup, class_id=, equippable?, level_up, skills, base_*
  156. # - Alias: Game_Actor: a lot of special traits
  157. # - Alias: Scene_Battle: process_battle_start, execute_action_guard
  158. # - Alias: Scene_Battle: display_exp_and_gold
  159. # - Alias: Scene_Menu: create_command_window, update_command_selection,
  160. # - Alias: Scene_Menu: update_actor_selection
  161. # - Alias: Scene_Title: create_game_objects
  162. # - Overwrites: Window_Base: draw_actor_class
  163. #
  164. #===============================================================================
  165. # Credits:
  166. # KGC for Window_Command imports.
  167. #===============================================================================
  168.  
  169. $imported = {} if $imported == nil
  170. $imported["SubclassSelectionSystem"] = true
  171.  
  172. module YE
  173. module SUBCLASS
  174.  
  175. #---------------------------------------------------------------------------
  176. # CLASS SYSTEM
  177. #---------------------------------------------------------------------------
  178.  
  179. # This part sets a bunch of rules regarding subclasses. Each one will allow
  180. # you to designate how you would like the subclass system rules to flow.
  181. # Read each part carefully since this will affect how the subclass system
  182. # will work for YOUR game.
  183.  
  184. #---This allows actors to be able to wear equipment that is otherwise only
  185. # available for their equipped subclass. Set ALLOW_WEAPON to determine
  186. # whether or not characters can equip their subclass weapons. Set
  187. # ALLOW_ARMOUR to determine whether characters can equip subclass armours.
  188. ALLOW_EQUIP = true
  189. ALLOW_WEAPON = true
  190. ALLOW_ARMOUR = false
  191.  
  192. #---These are two important switches for your game. If they are enabled,
  193. # their respective options will allow actors to switch their primary class
  194. # or their subclass. If not, the option to change them will not appear.
  195. ALLOW_CHANGE_PRIMARY_SWITCH = 70
  196. ALLOW_CHANGE_SUBCLASS_SWITCH = 71
  197.  
  198. #---These are two important switches for your game. If they are enabled,
  199. # their respective options will appear in the menu. If not, they'll be
  200. # skipped.
  201. ENABLE_CLASS_CHANGE_SWITCH = 72
  202. ENABLE_LEARN_SKILLS_SWITCH = 73
  203.  
  204. # This part affects all of the text you see inside the Class Change Menu.
  205. # Changing OPTION will enable/disable it inside your menu. Everything else
  206. # will adjust the text that appears.
  207. MENU_CLASS_CHANGE_OPTION = true
  208. MENU_CLASS_CHANGE_TITLE = "Class Change"
  209. MENU_CLASS_CHANGE_PRIM = "Primary"
  210. MENU_CLASS_CHANGE_SUB = "Subclass"
  211. MENU_CLASS_CHANGE_LEARN = "Learn"
  212. MENU_CLASS_CHANGE_DONE = "Finish"
  213. MENU_CLASS_CHANGE_PARAM = ["MaxHP", "MaxMP", "ATK", "DEF", "SPI", "AGI"]
  214. MENU_CLASS_CHANGE_ICONS = [ 99, 100, 2, 52, 21, 48]
  215.  
  216. # This adjusts how the stats and arrows will appear.
  217. MENU_CLASS_CHANGE_USE_ICON = false
  218. MENU_CLASS_CHANGE_ARROW = ">"
  219. MENU_CLASS_CHANGE_ICON = 142
  220.  
  221. # This affects the display type for new stats.
  222. # Type 1 - Shows the new stat itself.
  223. # Type 2 - Shows the increase/decrease in the stat.
  224. MENU_CLASS_CHANGE_SDISPLAY = 1
  225.  
  226. # This allows you to designate icons for your classes. These will show up
  227. # whenever the class name is drawn.
  228. CLASS_ICONS ={
  229. # Class.ID => Icon ID
  230. 0 => 176, # Nil Class
  231. 1 => 667, # Librarian
  232. 2 => 43, # Mage
  233. 3 => 850, # Fencer
  234. 4 => 9, # Iaido Master
  235. 5 => 1210, # Gunslinger
  236. 6 => 128, # Cleric
  237. 7 => 119, # Arch-Mage
  238. 8 => 75, # Shaman
  239. } # Do not remove this.
  240.  
  241. #---This determines how the class and subclass is displayed inside menus.
  242. DISPLAY_FORMAT = "%s/%s"
  243.  
  244. # This allows you to set how the class abbreviations will be displayed
  245. # in windows that will display the class abbreviations over the full name.
  246. CLASS_ABBREVIATIONS ={
  247. # Class.ID => Icon ID
  248. 0 => "", # Nil Class
  249. 1 => "Lib", # Librarian
  250. 2 => "Ma", # Mage
  251. 3 => "Fe", # Fencer
  252. 4 => "Ia", # Iaido Master
  253. 5 => "Gu", # Gunslinger
  254. 6 => "Cl", # Cleric
  255. 7 => "Ar", # Arch-Mage
  256. 8 => "Sh", # Shaman
  257. } # Do not remove this.
  258.  
  259. #---This allows you to set complex class names if your classes managed to
  260. # meet a specific combination. Take into consideration the slashes if
  261. # those are used in your display format.
  262. USE_COMPLEX_CLASS_NAMES = true
  263.  
  264. # This is the string transformation data for full complex class naming.
  265. # Make sure you match it with the display format in order for it to change.
  266. COMPLEX_CLASS_NAMES_FULL ={
  267. # Combination Required => New Class Name
  268. "Mage/Fencer" => "Mystic Duelist",
  269. "Mage/Iaido Master" => "Rune Blade",
  270. "Mage/Gunslinger" => "Spell Gun",
  271. "Mage/Cleric" => "Enchanted Priestess",
  272. "Mage/Arch-Mage" => "Sorceress",
  273. "Mage/Shaman" => "Oracle",
  274. "Fencer/Iaido Master" => "Sword Master",
  275. "Fencer/Gunslinger" => "Assassin",
  276. "Fencer/Cleric" => "Divine Duelist",
  277. "Fencer/Arch-Mage" => "Spellblade",
  278. "Fencer/Shaman" => "Siren",
  279. "Iaido Master/Gunslinger" => "Weapon Master",
  280. "Iaido Master/Cleric" => "Paladin",
  281. "Iaido Master/Arch-Mage" => "Mana Blade",
  282. "Iaido Master/Shaman" => "Templar",
  283. "Gunslinger/Cleric" => "Battlefield Medic",
  284. "Gunslinger/Arch-Mage" => "Gun Mage",
  285. "Gunslinger/Shaman" => "Witch Hunter",
  286. "Cleric/Arch-Mage" => "War Priestess",
  287. "Cleric/Shaman" => "Druidess",
  288. "Arch-Mage/Shaman" => "Witch",
  289. } # Do not remove this.
  290.  
  291. # This is the string transformation data for abbreviated complex classes.
  292. # Make sure you match it with the display format in order for it to change.
  293. COMPLEX_CLASS_NAMES_ABBR ={
  294. # Combination Required => New Class Name
  295. "Ma/Fe" => "MD",
  296. "Ma/Ia" => "RB",
  297. "Ma/Gu" => "SG",
  298. "Ma/Cl" => "EP",
  299. "Ma/Ar" => "So",
  300. "Ma/Sh" => "Or",
  301. "Fe/Ia" => "SM",
  302. "Fe/Gu" => "As",
  303. "Fe/Cl" => "DD",
  304. "Fe/Ar" => "Sp",
  305. "Fe/Sh" => "Si",
  306. "Ia/Gu" => "WM",
  307. "Ia/Cl" => "Pa",
  308. "Ia/Ar" => "MB",
  309. "Ia/Sh" => "Te",
  310. "Gu/Cl" => "BM",
  311. "Gu/Ar" => "GM",
  312. "Gu/Sh" => "WH",
  313. "Cl/Ar" => "WP",
  314. "Cl/Sh" => "Dr",
  315. "Ar/Sh" => "Wi",
  316. } # Do not remove this.
  317.  
  318. #---These two options can set some classes to be equippable only as primary
  319. # or subclass. A primary-only class cannot be equipped as a subclass and
  320. # vice versa. If a class is in both, it can't be equipped at all unless
  321. # through force scripted or evented means.
  322. PRIMARY_ONLY_CLASSES = []
  323. SUBCLASS_ONLY_CLASSES = []
  324.  
  325. #---This part determines whether or not some actors are restricted to only
  326. # a certain set of classes. If they're not on this list, those actors will
  327. # have access to all classes. There is no example shown in the demo.
  328. ACTOR_RESTRICTED_CLASSES ={
  329. # ActorID => [Class ID's]
  330. 1 => [1, 2, 3, 4, 5, 6, 7, 8],
  331. 2 => [9],
  332. 3 => [10],
  333. 4 => [11],
  334. 5 => [12],
  335. 6 => [13],
  336. } # Do not remove this.
  337.  
  338. #---This allows actors to instantly learn their subclasses skills if they
  339. # meet the level requirements upon leveling up or simply changing classes.
  340. ALLOW_RETRO_LEARN = false
  341.  
  342. # This allows you to set which classes allow the actor to use which skills.
  343. # Even if the actors have learned skills outside of their class/subclass,
  344. # they won't be able to use them unless the actors equipped those classes.
  345. # Class 0 designates common skills allowed for all classes.
  346. CLASS_SKILL_ALLOW ={
  347. # ClassID => [Skill ID's]
  348. 0 => [],
  349. 1 => [],
  350. 2 => [1, 4, 5],
  351. 3 => [],
  352. 4 => [],
  353. 5 => [],
  354. 6 => [],
  355. 7 => [],
  356. 8 => [],
  357. } # Do not remove this.
  358.  
  359. #---This part determines actor-based common skills. In other words, these
  360. # skills will always be available for specific actors no matter what
  361. # primary class or subclass they have equipped
  362. ACTOR_COMMON_SKILLS ={
  363. # ActorID => [Skill ID's]
  364. 1 => [1, 4, 5],
  365. 2 => [],
  366. 3 => [],
  367. 4 => [],
  368. 5 => [],
  369. 6 => [],
  370. } # Do not remove this.
  371.  
  372. #---This part determines primary-class only skills. These skills will only
  373. # be available if the actor has the specific class equipped as primary.
  374. PRIMARY_ONLY_SKILLS ={
  375. # ClassID => [Skill ID's]
  376. 1 => [],
  377. 2 => [],
  378. 3 => [],
  379. 4 => [],
  380. 5 => [],
  381. 6 => [],
  382. 7 => [],
  383. 8 => [],
  384. } # Do not remove this.
  385.  
  386. #---This part determines subclass only skills. These skills will only
  387. # be available if the actor has the specific class equipped as a subclass.
  388. # There is no example of this shown in the demo.
  389. SUBCLASS_ONLY_SKILLS ={
  390. # ClassID => [Skill ID's]
  391. 1 => [],
  392. } # Do not remove this.
  393.  
  394. #---This determines whether or not actor stats are affected by their what
  395. # class they have equipped. You can also change whether or not subclasses
  396. # will affect the character's base stats at all.
  397. AFFECT_STATS_PRIMARY = true
  398. AFFECT_STATS_SUBCLASS = true
  399.  
  400. # This adjusts how classes affect the actor's stats.
  401. CLASS_STAT_RATE ={
  402. # Class.ID => [MaxHP, MaxMP, ATK, DEF, SPI, AGI]
  403. 0 => [100, 100, 100, 100, 100, 100],
  404. 1 => [1, 1, 1, 1, 1, 1],
  405. 2 => [100, 100, 100, 100, 100, 100],
  406. 3 => [ 90, 110, 80, 80, 110, 80],
  407. 4 => [ 85, 120, 70, 75, 120, 85],
  408. 5 => [ 115, 110, 100, 100, 110, 90],
  409. 6 => [ 120, 90, 115, 75, 115, 100],
  410. 7 => [ 125, 70, 125, 80, 70, 80],
  411. 8 => [ 80, 80, 85, 70, 80, 150],
  412. } # Do not remove this.
  413.  
  414. # This determines what percentage primary and subclasses affect the class
  415. # stat rates. Normally, you should leave primary at 100% to avoid problems.
  416. PRIMARY_STAT_RATE = 100
  417. SUBCLASS_STAT_RATE = 50
  418.  
  419. #---This determines whether or not actors will gain extra stat bonuses for
  420. # leveling with a specific class. You can decide if their primary class
  421. # will get the stat bonuses, the subclass getting the bonuses, or both.
  422. LEVEL_UP_BONUS_PRIMARY = true
  423. LEVEL_UP_BONUS_SUBCLASS = true
  424.  
  425. # This determines the extra boost in stats actors will get when they level
  426. # up with that class as their primary or secondary (depending on which is
  427. # set to true). If a class's ID isn't included here, that class will not
  428. # get any bonus stats upon level up. Not even class 0.
  429. CLASS_STAT_BONUS_SET ={
  430. # Class.ID => [MaxHP, MaxMP, ATK, DEF, SPI, AGI]
  431. 1 => [ 1, 1, 0, 0, 0, 0],
  432. 2 => [ 20, 0, 2, 3, 0, 1],
  433. 3 => [ 0, 10, 0, 1, 2, 0],
  434. 4 => [ 0, 20, 0, 0, 5, 0],
  435. 5 => [ 5, 5, 1, 1, 1, 0],
  436. 6 => [ 5, 0, 2, 0, 2, 1],
  437. 7 => [ 30, 0, 3, 0, 0, 0],
  438. 8 => [ 0, 0, 0, 0, 0, 5],
  439. } # Do not remove this.
  440.  
  441. # This also determines the extra boost in stats when actors level up. This
  442. # is different than the other table in the way that these stats are random
  443. # increases. This means they can range anywhere from 0 to the numbered
  444. # amount. You have to enable this growth first.
  445. BONUS_RANDOM_PRIMARY = true
  446. BONUS_RANDOM_SUBCLASS = true
  447. CLASS_STAT_BONUS_RAN ={
  448. # Class.ID => [MaxHP, MaxMP, ATK, DEF, SPI, AGI]
  449. 1 => [ 0, 0, 0, 0, 0, 0],
  450. 2 => [ 5, 0, 2, 2, 0, 2],
  451. 3 => [ 0, 5, 0, 2, 2, 0],
  452. 4 => [ 0, 5, 0, 0, 2, 0],
  453. 5 => [ 5, 5, 2, 2, 2, 0],
  454. 6 => [ 5, 0, 2, 0, 2, 2],
  455. 7 => [ 5, 0, 2, 0, 0, 0],
  456. 8 => [ 1, 1, 1, 1, 1, 5],
  457. } # Do not remove this.
  458.  
  459. # This determines the percentage growth rate applied depending if it's the
  460. # primary class or subclass. This affects both set and random increases.
  461. PRIMARY_GROWTH_RATE = 100
  462. SUBCLASS_GROWTH_RATE = 50
  463.  
  464. #---------------------------------------------------------------------------
  465. # CLASS TRAITS
  466. #---------------------------------------------------------------------------
  467.  
  468. # This section governs traits unique to certain classes. These traits are
  469. # effects you can normally see under the character tab, weapon tag, and
  470. # armour tag. Traits can be set for primary or subclass. If you want a trait
  471. # to exist for both, just put it in both hashes.
  472. #
  473. # Here is a list of all the traits you can add:
  474. # "auto battle" - Actor will automatically attack.
  475. # "super guard" - Actor will take even less damage when guarding.
  476. # "pharmacology" - Items will have double effect when used by actor.
  477. # "fast attack" - Actor will strike quicker when using normals.
  478. # "dual attack" - Actor will strike twice when using normals.
  479. # "prevent crit" - Critical hits don't work against actor.
  480. # "half mp cost" - Actor spends 50% less MP.
  481. # "double exp" - Actor gains double the exp.
  482. # "double jp" - Actor gains double the jp.
  483. #
  484. # "barehanded" - Actor gains a boost to attack if no weapons equipped.
  485. # "maxhp up" - Actor gains a boost to maxhp outside of class rates.
  486. # "maxmp up" - Actor gains a boost to maxmp outside of class rates.
  487. # "atk up" - Actor gains a boost to atk outside of class rates.
  488. # "def up" - Actor gains a boost to def outside of class rates.
  489. # "spi up" - Actor gains a boost to spi outside of class rates.
  490. # "agi up" - Actor gains a boost to agi outside of class rates.
  491. #
  492. # "no weapon" - Actor cannot use weapon slot.
  493. # "no shield" - Actor cannot use shield slot.
  494. # "no helmet" - Actor cannot use helmet slot.
  495. # "no armour" - Actor cannot use armour slot.
  496. # "no accessory" - Actor cannot use accessory slot.
  497. # "no equips" - Actor cannot use any equip slot.
  498. # "all weapon" - Actor can use all weapons.
  499. # "all shield" - Actor can wear all shields.
  500. # "all helmet" - Actor can wear all helmets.
  501. # "all armour" - Actor can wear all armours.
  502. # "all accessory" - Actor can wear all accessories.
  503. # "all equip" - Actor can wear everything.
  504. #
  505. # To give a class more than one trait, separate them by commas.
  506.  
  507. # This governs the traits available for classes when equipped as a primary
  508. # class. If you don't want a class to have a unique primary trait, either
  509. # remove the entry or keep the array blank.
  510. PRIMARY_TRAITS_HASH ={
  511. # Class.ID => [Traits]
  512. 1 => [],
  513. 2 => [],
  514. 3 => [],
  515. 4 => [],
  516. 5 => [],
  517. 6 => [],
  518. 7 => [],
  519. 8 => [],
  520. } # Do not remove this.
  521.  
  522. # This governs the traits available for classes when equipped as a subclass.
  523. # If you don't want a class to have a unique subclass trait, either remove
  524. # the entry or keep the array blank.
  525. SUBCLASS_TRAITS_HASH ={
  526. # Class.ID => [Traits]
  527. 1 => [],
  528. 2 => [],
  529. 3 => [],
  530. 4 => [],
  531. 5 => [],
  532. 6 => [],
  533. } # Do not remove this.
  534.  
  535. #---------------------------------------------------------------------------
  536. # CLASS CHANGE GRAPHIC
  537. #---------------------------------------------------------------------------
  538.  
  539. # This array lists which actors will change their graphic upon changing
  540. # classes. Note that this will only take effect if the primary class is
  541. # changed and not the subclass. If an actor's ID isn't listed here, that
  542. # actor's graphic is locked from being able to be changed.
  543. CHANGE_ACTOR_GRAPHICS = [0]
  544.  
  545. # This hash determines which graphics each individual actor will switch to
  546. # when changing classes. Note that if you don't list an actor ID, the hash
  547. # will automatically pool the actor together with Actor ID 0. For that
  548. # reason, do NOT remove actor 0's hash information. If a class ID doesn't
  549. # appear, the actor will retain its current graphic settings.
  550. GRAPHIC_HASH ={
  551. # Actor.ID => Do not remove Actor 0. It's a common pool for unlisted actors.
  552. 0 => [#ClassID, CharName, Ind, FaceName, Ind],
  553. [ 1, "Actor1", 0, "Actor1", 0],
  554. [ 2, "Actor1", 2, "Actor1", 2],
  555. [ 3, "Actor2", 2, "Actor2", 2],
  556. [ 4, "Actor2", 4, "Actor2", 4],
  557. [ 5, "Actor1", 4, "Actor1", 4],
  558. [ 6, "Evil", 4, "Evil", 4],
  559. [ 7, "Actor3", 0, "Actor3", 0],
  560. [ 8, "Actor3", 2, "Actor3", 2],
  561. ],#Next Instance
  562. } # Do not remove this.
  563.  
  564. # These govern the multipliers given to the various traits.
  565. BAREHAND_MULTIPLIER = 250 # Uses Yanfly Barehand modifier if have.
  566. MAXHP_MULTIPLIER = 125 # Additional multiplier regardless of rates.
  567. MAXMP_MULTIPLIER = 125 # Additional multiplier regardless of rates.
  568. ATK_MULTIPLIER = 150 # Additional multiplier regardless of rates.
  569. DEF_MULTIPLIER = 150 # Additional multiplier regardless of rates.
  570. SPI_MULTIPLIER = 150 # Additional multiplier regardless of rates.
  571. AGI_MULTIPLIER = 150 # Additional multiplier regardless of rates.
  572.  
  573. #---------------------------------------------------------------------------
  574. # JP SYSTEM
  575. #---------------------------------------------------------------------------
  576.  
  577. # The JP system is a system adapted from Final Fantasy Tactics. Your classes
  578. # will earn JP over battles and can use them to purchase new skills inside a
  579. # particular menu. This section will allow you to change JP system rules for
  580. # your game should you desire to use it.
  581. USE_JP_SYSTEM = true
  582. MAX_JP_EARNED = 9999
  583. JP_DEFINITION = "%d JP"
  584. JP_ICON = 145
  585.  
  586. # This determines whether or not enemies will give JP if killed and the
  587. # default amount if not set with <enemy jp x>.
  588. ENEMIES_GIVE_JP = true
  589. ENEMIES_SHOW_MSG = false
  590. ENEMIES_DEFAULT = 10
  591. ENEMIES_MESSAGE = "%s has earned %s JP from battle."
  592.  
  593. # This sets whether or not you'd like your actors to display the JP they've
  594. # earned in battle (since every action adds JP).
  595. DISPLAY_ACTOR_JP = true
  596. DISPLAY_ACTOR_MSG = "%s gained %d JP this battle."
  597.  
  598. # This will determine whether or not the Learn Skill scene can be accessed
  599. # from the main menu. This also adjusts the text for the scene's options.
  600. LEARN_SKILL_OPTION = true
  601. LEARN_SKILL_TITLE = "Learn Skills"
  602. LEARN_SKILL_SELECT = "Learn"
  603. LEARN_SKILL_CHANGE = "Change"
  604. LEARN_SKILL_DONE = "Finish"
  605.  
  606. # This affects the string data for the status window shown on the side.
  607. # This also affects what sound effect is played when buying skills.
  608. LEARN_SKILL_STATUS_HELP = "Select class you would like to learn skills for."
  609. LEARN_SKILL_STATUS_LEARNED = "%d%% Mastery"
  610. LEARN_SKILL_STATUS_ALL = "Mastered!"
  611. LEARN_SKILL_SHOP_LEARNED = "Learned"
  612. LEARN_SKILL_SHOP_STRING = "%s JP"
  613. LEARN_SKILL_SHOP_SOUND = RPG::SE.new("Equip", 80, 100)
  614.  
  615. # This is the string data used for required skills and levels before the
  616. # skill can be purchased with JP.
  617. REQUIRE_SKILL = "Requires"
  618. REQUIRE_LEVEL = "Level %d"
  619.  
  620. # These icons will replace the JP icon if the class is a primary only skill
  621. # or a subclass only skill.
  622. PRIMARY_ONLY_ICON = 208
  623. SUBCLASS_ONLY_ICON = 209
  624.  
  625. # JP is earned throughout battle from different effects. You can determine
  626. # what will earn JP here and by how much. Set amounts are the increases that
  627. # will always occur so long as the action is enabled. Random amounts will
  628. # increase the JP earned from 0 to that amount.
  629.  
  630. EARN_JP_VIA_ATTACK_ENABLE = true # Normal attacks will earn JP.
  631. EARN_JP_VIA_ATTACK_AMOUNT = 2 # Earns at least this amount of JP.
  632. EARN_JP_VIA_ATTACK_RANDOM = 1 # Earns up to this random amount.
  633.  
  634. EARN_JP_VIA_SKILL_ENABLE = true # Skills will earn JP.
  635. EARN_JP_VIA_SKILL_AMOUNT = 3 # Earns at least this amount of JP.
  636. EARN_JP_VIA_SKILL_RANDOM = 1 # Earns up to this random amount.
  637.  
  638. EARN_JP_VIA_GUARD_ENABLE = true # Guarding will earn JP.
  639. EARN_JP_VIA_GUARD_AMOUNT = 2 # Earns at least this amount of JP.
  640. EARN_JP_VIA_GUARD_RANDOM = 1 # Earns up to this random amount.
  641.  
  642. EARN_JP_VIA_ITEMS_ENABLE = true # Using items will earn JP.
  643. EARN_JP_VIA_ITEMS_AMOUNT = 2 # Earns at least this amount of JP.
  644. EARN_JP_VIA_ITEMS_RANDOM = 1 # Earns up to this random amount.
  645.  
  646. # This will determine the multipliers for earning JP split between primary
  647. # and subclasses. This effect is determined every time "gain_jp" definition
  648. # occurs within the script.
  649.  
  650. EARN_JP_MULTIPLIER_PRIMARY = 100 # Percentage for primary JP earning.
  651. EARN_JP_MULTIPLIER_SUBCLASS = 50 # Percentage for subclass JP earning.
  652.  
  653. #---------------------------------------------------------------------------
  654. # COMPATIBILITY ADD-ONS
  655. #---------------------------------------------------------------------------
  656.  
  657. # This following section is to determine compatibility showing for Display
  658. # Skill Query if you wish for that to be enabled.
  659. ENABLE_SKILL_QUERY = true
  660. SHOW_QUERY_BUTTON = Input::A
  661. SHOW_QUERY_HELP_WIN = true
  662. QUERY_HELP_WIN_TEXT = "Press Shift to view skill info."
  663.  
  664. end # SUBCLASS
  665. end # YE
  666.  
  667. #===============================================================================
  668. # Editting anything past this point may potentially result in causing computer
  669. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  670. # Therefore, edit at your own risk.
  671. #===============================================================================
  672.  
  673. module YE
  674. module REGEXP
  675. module BASEITEM
  676.  
  677. # These are skill related.
  678. JP_COST = /<(?:JP_COST|jp cost)[ ]*(\d+)>/i
  679. JP_BOOST_SET = /<(?:JP_BOOST_SET|jp boost set)[ ]*(\d+)>/i
  680. JP_BOOST_RAN = /<(?:JP_BOOST_RAN|jp boost ran)[ ]*(\d+)>/i
  681. REQUIRE_SKILL = /<(?:REQUIRE_SKILL|require skill)[ ]*(\d+)>/i
  682. REQUIRE_LEVEL = /<(?:REQUIRE_LEVEL|require level)[ ]*(\d+)>/i
  683.  
  684. # These are item related.
  685. GAIN_JP = /<(?:GAIN_JP|gain jp)[ ]*(\d+)>/i
  686. UNLOCK_CLASS = /<(?:UNLOCK_CLASS|unlock class)[ ]*(\d+)>/i
  687. LOCK_CLASS = /<(?:LOCK_CLASS|lock class)[ ]*(\d+)>/i
  688. SET_PRIMARY = /<(?:SET_PRIMARY|set primary)[ ]*(\d+)>/i
  689. SET_SUBCLASS = /<(?:SET_SUBCLASS|set subclass)[ ]*(\d+)>/i
  690.  
  691. end # BASEITEM
  692. module ENEMY
  693.  
  694. # These are enemy related
  695. ENEMY_JP = /<(?:ENEMY_JP|enemy jp)[ ]*(\d+)>/i
  696.  
  697. end # ENEMY
  698. module STATE
  699.  
  700. # This affects states.
  701. BONUS_JP_PER = /<(?:BONUS_JP_PER|bonus jp per)[ ]*(\d+)>/i
  702. BONUS_JP_SET = /<(?:BONUS_JP_SET|bonus jp set)[ ]*(\d+)>/i
  703.  
  704. end # STATE
  705. end # REGEXP
  706. end # YE
  707.  
  708. #===============================================================================
  709. # RPG::State
  710. #===============================================================================
  711.  
  712. class RPG::State
  713.  
  714. #--------------------------------------------------------------------------
  715. # Yanfly_Cache_SSS
  716. #--------------------------------------------------------------------------
  717. def yanfly_cache_state_sss
  718. @bonus_jp_per = 100; @bonus_jp_set = 0
  719.  
  720. self.note.split(/[\r\n]+/).each { |line|
  721. case line
  722. when YE::REGEXP::STATE::BONUS_JP_PER
  723. @bonus_jp_per = $1.to_i
  724. when YE::REGEXP::STATE::BONUS_JP_SET
  725. @bonus_jp_set = $1.to_i
  726. end
  727. }
  728. end # cache
  729.  
  730. #--------------------------------------------------------------------------
  731. # definitions
  732. #--------------------------------------------------------------------------
  733. def bonus_jp_per
  734. yanfly_cache_state_sss if @bonus_jp_per == nil
  735. return @bonus_jp_per
  736. end
  737. def bonus_jp_set
  738. yanfly_cache_state_sss if @bonus_jp_set == nil
  739. return @bonus_jp_set
  740. end
  741.  
  742. end
  743.  
  744. #===============================================================================
  745. # RPG::Enemy
  746. #===============================================================================
  747.  
  748. class RPG::Enemy
  749.  
  750. #--------------------------------------------------------------------------
  751. # Yanfly_Cache_SSS
  752. #--------------------------------------------------------------------------
  753. def yanfly_cache_enemy_sss
  754. @enemy_jp = YE::SUBCLASS::ENEMIES_DEFAULT
  755.  
  756. self.note.split(/[\r\n]+/).each { |line|
  757. case line
  758. when YE::REGEXP::ENEMY::ENEMY_JP
  759. @enemy_jp = $1.to_i
  760. end
  761. }
  762. end # cache
  763.  
  764. #--------------------------------------------------------------------------
  765. # definitions
  766. #--------------------------------------------------------------------------
  767. def enemy_jp
  768. yanfly_cache_enemy_sss if @enemy_jp == nil
  769. return @enemy_jp
  770. end
  771.  
  772. end
  773.  
  774. #===============================================================================
  775. # RPG::BaseItem
  776. #===============================================================================
  777.  
  778. class RPG::BaseItem
  779.  
  780. #--------------------------------------------------------------------------
  781. # Yanfly_Cache_SSS
  782. #--------------------------------------------------------------------------
  783. def yanfly_cache_baseitem_sss
  784. @jp_cost = 0; @jp_learn = false; @jp_boost_set = 0; @jp_boost_ran = 0
  785. @gain_jp = 0; @unlock_class = []; @lock_class = []
  786. @set_primary = 0; @set_subclass = -1
  787. @require_skill = []; @require_level = 0
  788.  
  789. self.note.split(/[\r\n]+/).each { |line|
  790. case line
  791. when YE::REGEXP::BASEITEM::JP_COST
  792. @jp_cost = $1.to_i
  793. @jp_learn = true
  794. when YE::REGEXP::BASEITEM::JP_BOOST_SET
  795. @jp_boost_set = $1.to_i
  796. when YE::REGEXP::BASEITEM::JP_BOOST_RAN
  797. @jp_boost_ran = $1.to_i
  798. when YE::REGEXP::BASEITEM::GAIN_JP
  799. @gain_jp = $1.to_i
  800. when YE::REGEXP::BASEITEM::REQUIRE_SKILL
  801. @require_skill.push($1.to_i)
  802. when YE::REGEXP::BASEITEM::REQUIRE_LEVEL
  803. @require_level = $1.to_i
  804.  
  805. when YE::REGEXP::BASEITEM::UNLOCK_CLASS
  806. @unlock_class.push($1.to_i)
  807. when YE::REGEXP::BASEITEM::LOCK_CLASS
  808. @lock_class.push($1.to_i)
  809. when YE::REGEXP::BASEITEM::SET_PRIMARY
  810. @set_primary = $1.to_i
  811. when YE::REGEXP::BASEITEM::SET_SUBCLASS
  812. @set_subclass = $1.to_i
  813. end
  814. }
  815. end # cache
  816.  
  817. #--------------------------------------------------------------------------
  818. # JP definitions
  819. #--------------------------------------------------------------------------
  820. def jp_cost
  821. yanfly_cache_baseitem_sss if @jp_cost == nil
  822. return @jp_cost
  823. end
  824.  
  825. def jp_learn?
  826. yanfly_cache_baseitem_sss if @jp_learn == nil
  827. return @jp_learn
  828. end
  829.  
  830. def jp_boost_set
  831. yanfly_cache_baseitem_sss if @jp_boost_set == nil
  832. return @jp_boost_set
  833. end
  834.  
  835. def jp_boost_ran
  836. yanfly_cache_baseitem_sss if @jp_boost_ran == nil
  837. return @jp_boost_ran
  838. end
  839.  
  840. def gain_jp
  841. yanfly_cache_baseitem_sss if @gain_jp == nil
  842. return @gain_jp
  843. end
  844.  
  845. def require_skill
  846. yanfly_cache_baseitem_sss if @require_skill == nil
  847. return @require_skill
  848. end
  849.  
  850. def require_level
  851. yanfly_cache_baseitem_sss if @require_level == nil
  852. return @require_level
  853. end
  854.  
  855. #--------------------------------------------------------------------------
  856. # class definitions
  857. #--------------------------------------------------------------------------
  858. def unlock_class
  859. yanfly_cache_baseitem_sss if @unlock_class == nil
  860. return @unlock_class
  861. end
  862.  
  863. def lock_class
  864. yanfly_cache_baseitem_sss if @lock_class == nil
  865. return @lock_class
  866. end
  867.  
  868. def set_primary
  869. yanfly_cache_baseitem_sss if @set_primary == nil
  870. return @set_primary
  871. end
  872.  
  873. def set_subclass
  874. yanfly_cache_baseitem_sss if @set_subclass == nil
  875. return @set_subclass
  876. end
  877.  
  878. end
  879.  
  880. #==============================================================================
  881. # Game_Battler
  882. #==============================================================================
  883.  
  884. class Game_Battler
  885.  
  886. #--------------------------------------------------------------------------
  887. # perform gain_jp
  888. #--------------------------------------------------------------------------
  889. def gain_jp(amount)
  890. return unless self.actor?
  891. class1 = self.class_id
  892. class2 = self.subclass_id unless self.subclass == nil
  893. for state in states
  894. amount *= state.bonus_jp_per
  895. amount /= 100
  896. end
  897. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  898. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  899. if pri_hash.include?("double jp") or pri_hash.include?("double jp gain")
  900. amount *= 2
  901. end
  902. end
  903. if YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.class.id) and
  904. self.subclass != nil
  905. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH[self.class.id]
  906. if sub_hash.include?("double jp") or sub_hash.include?("double jp gain")
  907. amount *= 2
  908. end
  909. end
  910. for state in states
  911. amount += state.bonus_jp_set
  912. end
  913. jp1 = amount * YE::SUBCLASS::EARN_JP_MULTIPLIER_PRIMARY
  914. jp1 /= 100
  915. jp2 = amount * YE::SUBCLASS::EARN_JP_MULTIPLIER_SUBCLASS
  916. jp2 /= 100
  917. self.jp_counter += [jp1, jp2].max if $scene.is_a?(Scene_Battle)
  918. change_jp(class1, jp1)
  919. change_jp(class2, jp2) unless self.subclass == nil
  920. end
  921.  
  922. #--------------------------------------------------------------------------
  923. # jp counter
  924. #--------------------------------------------------------------------------
  925. def jp_counter
  926. @jp_counter = 0 if @jp_counter == nil
  927. return @jp_counter
  928. end
  929.  
  930. def jp_counter=(newvalue)
  931. @jp_counter = 0 if @jp_counter == nil
  932. @jp_counter = newvalue
  933. end
  934.  
  935. #--------------------------------------------------------------------------
  936. # alias attack effect
  937. #--------------------------------------------------------------------------
  938. alias attack_effect_sss attack_effect unless $@
  939. def attack_effect(attacker)
  940. attack_effect_sss(attacker)
  941. return unless attacker.actor?
  942. return unless YE::SUBCLASS::EARN_JP_VIA_ATTACK_ENABLE
  943. amount = YE::SUBCLASS::EARN_JP_VIA_ATTACK_AMOUNT
  944. unless YE::SUBCLASS::EARN_JP_VIA_ATTACK_RANDOM == 0
  945. amount += rand(YE::SUBCLASS::EARN_JP_VIA_ATTACK_RANDOM)
  946. end
  947. attacker.gain_jp(amount)
  948. end
  949.  
  950. #--------------------------------------------------------------------------
  951. # alias skill effect
  952. #--------------------------------------------------------------------------
  953. alias skill_effect_sss skill_effect unless $@
  954. def skill_effect(user, skill)
  955. skill_effect_sss(user, skill)
  956. return unless user.actor?
  957. return unless YE::SUBCLASS::EARN_JP_VIA_SKILL_ENABLE
  958. return unless $scene.is_a?(Scene_Battle)
  959. amount = YE::SUBCLASS::EARN_JP_VIA_SKILL_AMOUNT
  960. unless YE::SUBCLASS::EARN_JP_VIA_SKILL_RANDOM == 0
  961. amount += rand(YE::SUBCLASS::EARN_JP_VIA_SKILL_RANDOM)
  962. end
  963. amount += skill.jp_boost_set unless skill.jp_boost_set <= 0
  964. amount += rand(skill.jp_boost_ran) unless skill.jp_boost_ran <= 0
  965. user.gain_jp(amount)
  966. end
  967.  
  968. #--------------------------------------------------------------------------
  969. # alias item effect
  970. #--------------------------------------------------------------------------
  971. alias item_effect_sss item_effect unless $@
  972. def item_effect(user, item)
  973. item_effect_sss(user, item)
  974. return unless user.actor?
  975. user.gain_jp(item.gain_jp)
  976. #----------------------------------
  977. if item.unlock_class != []
  978. for class_id in item.unlock_class
  979. user.unlock_class(class_id)
  980. end
  981. end
  982. if item.lock_class != []
  983. for class_id in item.lock_class
  984. user.lock_class(class_id)
  985. end
  986. end
  987. if item.set_primary > 0
  988. user.class_id = item.set_primary
  989. end
  990. if item.set_subclass > -1
  991. user.subclass_id = item.set_subclass
  992. end
  993. #----------------------------------
  994. return unless YE::SUBCLASS::EARN_JP_VIA_ITEMS_ENABLE
  995. return unless $scene.is_a?(Scene_Battle)
  996. amount = YE::SUBCLASS::EARN_JP_VIA_ITEMS_AMOUNT
  997. unless YE::SUBCLASS::EARN_JP_VIA_ITEMS_RANDOM == 0
  998. amount += rand(YE::SUBCLASS::EARN_JP_VIA_ITEMS_RANDOM)
  999. end
  1000. user.gain_jp(amount)
  1001. end
  1002.  
  1003. #--------------------------------------------------------------------------
  1004. # alias item test
  1005. #--------------------------------------------------------------------------
  1006. alias item_test_sss item_test unless $@
  1007. def item_test(user, item)
  1008. if self.actor?
  1009. return true if item.unlock_class != []
  1010. return true if item.lock_class != []
  1011. return true if item.gain_jp > 0
  1012. return true if item.set_primary > 0
  1013. return true if item.set_subclass > -1
  1014. end
  1015. return item_test_sss(user, item)
  1016. end
  1017.  
  1018. end
  1019.  
  1020. #===============================================================================
  1021. # Game_Actor
  1022. #===============================================================================
  1023.  
  1024. class Game_Actor < Game_Battler
  1025.  
  1026. #--------------------------------------------------------------------------
  1027. # Public Instance Variables
  1028. #--------------------------------------------------------------------------
  1029. attr_accessor :subclass_id
  1030.  
  1031. #--------------------------------------------------------------------------
  1032. # alias setup
  1033. #--------------------------------------------------------------------------
  1034. alias setup_sss setup unless $@
  1035. def setup(actor_id)
  1036. setup_sss(actor_id)
  1037. @subclass_id = 0 # This determines the subclass ID.
  1038. @unlocked_classes = [self.class.id] # What classes are unlocked.
  1039. @class_jp = {}
  1040. end
  1041.  
  1042. #--------------------------------------------------------------------------
  1043. # alias learn skill
  1044. #--------------------------------------------------------------------------
  1045. alias learn_skill_sss learn_skill unless $@
  1046. def learn_skill(skill_id)
  1047. learn_skill_sss(skill_id)
  1048. skill = $data_skills[skill_id]
  1049. if skill.unlock_class != []
  1050. for class_id in skill.unlock_class
  1051. self.unlock_class(class_id)
  1052. end
  1053. end
  1054. end
  1055.  
  1056. #--------------------------------------------------------------------------
  1057. # class actor graphic
  1058. #--------------------------------------------------------------------------
  1059. def class_actor_graphic
  1060. return unless YE::SUBCLASS::CHANGE_ACTOR_GRAPHICS.include?(self.id)
  1061. if YE::SUBCLASS::GRAPHIC_HASH.include?(self.id)
  1062. narray = YE::SUBCLASS::GRAPHIC_HASH[self.id]
  1063. else
  1064. narray = YE::SUBCLASS::GRAPHIC_HASH[0]
  1065. end
  1066. parray = [0, self.character_name, self.character_index,
  1067. self.face_name, self.face_index]
  1068. for tarray in narray
  1069. if @class_id == tarray[0]
  1070. parray = tarray
  1071. break
  1072. end
  1073. end
  1074. val1 = parray[1]; val2 = parray[2]; val3 = parray[3]; val4 = parray[4]
  1075. self.set_graphic(val1, val2, val3, val4)
  1076. return unless $game_party.members[0].id == self.id
  1077. $game_player.set_graphic(val1, val2)
  1078. end
  1079.  
  1080. #--------------------------------------------------------------------------
  1081. # alias class_id=
  1082. #--------------------------------------------------------------------------
  1083. alias class_id_equal_sss class_id= unless $@
  1084. def class_id=(class_id)
  1085. return if YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(class_id)
  1086. if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES.include?(self.id)
  1087. unless YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES[self.id].include?(class_id)
  1088. return
  1089. end
  1090. end
  1091. return if class_id == self.class.id
  1092. hp_per = (self.maxhp == 0) ? 0 : self.hp * 100 / self.maxhp
  1093. mp_per = (self.maxmp == 0) ? 0 : self.mp * 100 / self.maxmp
  1094. class_id_equal_sss(class_id)
  1095. class_actor_graphic
  1096. if self.subclass_id == self.class_id
  1097. self.subclass_id = 0
  1098. end
  1099. self.hp = Integer(hp_per * self.maxhp / 100)
  1100. self.mp = Integer(mp_per * self.maxmp / 100)
  1101. if YE::SUBCLASS::ALLOW_RETRO_LEARN
  1102. for i in self.class.learnings
  1103. learn_skill(i.skill_id) if i.level <= @level
  1104. end
  1105. end
  1106. unless @unlocked_classes.include?(@class_id)
  1107. @unlocked_classes.push(@class_id)
  1108. end
  1109. #---
  1110. for i in 0..4
  1111. change_equip(i, nil) unless equippable?(equips[i])
  1112. end
  1113. if $imported["EquipExtension"]
  1114. return if extra_armor_number == 0
  1115. for i in 5..armor_number
  1116. change_equip(i, nil) unless equippable?(equips[i])
  1117. end
  1118. end
  1119. purge_unequippable_skills if $imported["EquipSkillSlots"]
  1120. @unlocked_classes.sort!
  1121. end
  1122.  
  1123. #--------------------------------------------------------------------------
  1124. # return Subclass
  1125. #--------------------------------------------------------------------------
  1126. def subclass
  1127. @subclass_id = 0 if @subclass_id == nil
  1128. return $data_classes[@subclass_id]
  1129. end
  1130.  
  1131. #--------------------------------------------------------------------------
  1132. # change Subclass ID
  1133. #--------------------------------------------------------------------------
  1134. def subclass_id=(newvalue)
  1135. return if YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(newvalue)
  1136. if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES.include?(self.id)
  1137. unless YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES[self.id].include?(newvalue)
  1138. return
  1139. end
  1140. end
  1141. hp_per = (self.maxhp == 0) ? 0 : self.hp * 100 / self.maxhp
  1142. mp_per = (self.maxmp == 0) ? 0 : self.mp * 100 / self.maxmp
  1143. @subclass_id = newvalue
  1144. @subclass_id = 0 if @subclass_id == @class_id
  1145. self.hp = Integer(hp_per * self.maxhp / 100)
  1146. self.mp = Integer(mp_per * self.maxmp / 100)
  1147. return if @subclass_id == 0
  1148. if YE::SUBCLASS::ALLOW_RETRO_LEARN and self.subclass != nil
  1149. for i in self.subclass.learnings
  1150. learn_skill(i.skill_id) if i.level <= @level
  1151. end
  1152. end
  1153. unless @unlocked_classes.include?(@subclass_id)
  1154. @unlocked_classes.push(@subclass_id)
  1155. end
  1156. #---
  1157. for i in 0..4
  1158. change_equip(i, nil) unless equippable?(equips[i])
  1159. end
  1160. if $imported["EquipExtension"]
  1161. return if extra_armor_number == 0
  1162. for i in 5..armor_number
  1163. change_equip(i, nil) unless equippable?(equips[i])
  1164. end
  1165. end
  1166. purge_unequippable_skills if $imported["EquipSkillSlots"]
  1167. @unlocked_classes.sort!
  1168. end
  1169.  
  1170. #--------------------------------------------------------------------------
  1171. # clone class/subclass change
  1172. #--------------------------------------------------------------------------
  1173. def class_clone=(newvalue)
  1174. return if YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(newvalue)
  1175. @class_id = newvalue
  1176. for i in 0..4
  1177. change_equip(i, nil, true) unless equippable?(equips[i])
  1178. end
  1179. if $imported["EquipExtension"]
  1180. return if extra_armor_number == 0
  1181. for i in 5..armor_number
  1182. change_equip(i, nil, true) unless equippable?(equips[i])
  1183. end
  1184. end
  1185. end
  1186.  
  1187. def subclass_clone=(newvalue)
  1188. return if YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(newvalue)
  1189. return if newvalue == @class_id
  1190. @subclass_id = newvalue
  1191. @subclass_id = 0 if @subclass_id == @class_id
  1192. for i in 0..4
  1193. change_equip(i, nil, true) unless equippable?(equips[i])
  1194. end
  1195. if $imported["EquipExtension"]
  1196. return if extra_armor_number == 0
  1197. for i in 5..armor_number
  1198. change_equip(i, nil, true) unless equippable?(equips[i])
  1199. end
  1200. end
  1201. end
  1202.  
  1203. #--------------------------------------------------------------------------
  1204. # return unlocked classes
  1205. #--------------------------------------------------------------------------
  1206. def unlocked_classes
  1207. results = []
  1208. @unlocked_classes = [self.class.id] if @unlocked_classes == nil
  1209. @unlocked_classes.sort!
  1210. if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES.include?(self.id)
  1211. for class_id in @unlocked_classes
  1212. if YE::SUBCLASS::ACTOR_RESTRICTED_CLASSES[self.id].include?(class_id)
  1213. results.push(class_id)
  1214. end
  1215. end
  1216. else
  1217. results = @unlocked_classes
  1218. end
  1219. results.push(self.class.id) unless results.include?(self.class.id)
  1220. return results
  1221. end
  1222.  
  1223. #--------------------------------------------------------------------------
  1224. # perform unlock class
  1225. #--------------------------------------------------------------------------
  1226. def unlock_class(newclass_id)
  1227. @unlocked_classes = [self.class.id] if @unlocked_classes == nil
  1228. unless @unlocked_classes.include?(newclass_id)
  1229. @unlocked_classes.push(newclass_id)
  1230. end
  1231. @unlocked_classes.sort!
  1232. if YE::SUBCLASS::ALLOW_RETRO_LEARN
  1233. newsubclass = $data_classes[newclass_id]
  1234. for i in newsubclass.learnings
  1235. learn_skill(i.skill_id) if i.level <= @level
  1236. end
  1237. end
  1238. end
  1239.  
  1240. #--------------------------------------------------------------------------
  1241. # perform lock class
  1242. #--------------------------------------------------------------------------
  1243. def lock_class(newclass_id)
  1244. return if newclass_id == self.class.id
  1245. @unlocked_classes = [self.class.id] if @unlocked_classes == nil
  1246. @unlocked_classes.delete(newclass_id)
  1247. @unlocked_classes.sort!
  1248. end
  1249.  
  1250. #--------------------------------------------------------------------------
  1251. # perform unlock all classes
  1252. #--------------------------------------------------------------------------
  1253. def unlock_all_classes
  1254. for i in 0..$data_classes.size
  1255. unlock = $data_classes[i + 1]
  1256. self.unlock_class(unlock.id)
  1257. end
  1258. @unlocked_classes.sort!
  1259. end
  1260.  
  1261. #--------------------------------------------------------------------------
  1262. # perform lock all classes
  1263. #--------------------------------------------------------------------------
  1264. def lock_all_classes
  1265. for i in 0..$data_classes.size
  1266. unlock = $data_classes[i + 1]
  1267. self.lock_class(unlock.id)
  1268. end
  1269. @unlocked_classes.sort!
  1270. end
  1271.  
  1272. #--------------------------------------------------------------------------
  1273. # alias equippable?
  1274. #--------------------------------------------------------------------------
  1275. alias equippable_sss equippable? unless $@
  1276. def equippable?(item)
  1277. result = false
  1278. result = equippable_sss(item)
  1279. #---
  1280. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  1281. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1282. return false unless no_equip_hash(check_hash, item)
  1283. return true if all_equip_hash(check_hash, item)
  1284. end
  1285. #---
  1286. if YE::SUBCLASS::ALLOW_EQUIP and !result and self.subclass != nil
  1287. result = subclass_equippable?(item)
  1288. end
  1289. if YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.class.id) and
  1290. self.subclass != nil
  1291. check_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH[self.class.id]
  1292. return false unless no_equip_hash(check_hash, item)
  1293. return true if all_equip_hash(check_hash, item)
  1294. end
  1295. return result
  1296. end
  1297.  
  1298. #--------------------------------------------------------------------------
  1299. # no equip hash
  1300. #--------------------------------------------------------------------------
  1301. def no_equip_hash(check_hash, item)
  1302. if item.is_a?(RPG::Weapon)
  1303. return false if check_hash.include?("no equip")
  1304. return false if check_hash.include?("no equips")
  1305. return false if check_hash.include?("no equipment")
  1306. return false if check_hash.include?("no weapon")
  1307. return false if check_hash.include?("no weapons")
  1308. elsif item.is_a?(RPG::Armor)
  1309. case item.kind
  1310. when 0
  1311. return false if check_hash.include?("no shield")
  1312. return false if check_hash.include?("no shields")
  1313. when 1
  1314. return false if check_hash.include?("no helmet")
  1315. return false if check_hash.include?("no helmets")
  1316. when 2
  1317. return false if check_hash.include?("no armour")
  1318. return false if check_hash.include?("no armours")
  1319. return false if check_hash.include?("no armor")
  1320. return false if check_hash.include?("no armors")
  1321. when 3
  1322. return false if check_hash.include?("no accessory")
  1323. return false if check_hash.include?("no accessories")
  1324. end
  1325. end
  1326. return true
  1327. end
  1328.  
  1329. #--------------------------------------------------------------------------
  1330. # all equip hash
  1331. #--------------------------------------------------------------------------
  1332. def all_equip_hash(check_hash, item)
  1333. return true if check_hash.include?("all equip")
  1334. return true if check_hash.include?("all equips")
  1335. return true if check_hash.include?("all equipment")
  1336. if item.is_a?(RPG::Weapon)
  1337. return true if check_hash.include?("all weapon")
  1338. return true if check_hash.include?("all weapons")
  1339. elsif item.is_a?(RPG::Armor)
  1340. case item.kind
  1341. when 0
  1342. return true if check_hash.include?("all shield")
  1343. return true if check_hash.include?("all shields")
  1344. when 1
  1345. return true if check_hash.include?("all helmet")
  1346. return true if check_hash.include?("all helmets")
  1347. when 2
  1348. return true if check_hash.include?("all armour")
  1349. return true if check_hash.include?("all armours")
  1350. return true if check_hash.include?("all armor")
  1351. return true if check_hash.include?("all armors")
  1352. when 3
  1353. return true if check_hash.include?("all accessory")
  1354. return true if check_hash.include?("all accessories")
  1355. end
  1356. end
  1357. return false
  1358. end
  1359.  
  1360. #--------------------------------------------------------------------------
  1361. # subclass equippable?
  1362. #--------------------------------------------------------------------------
  1363. def subclass_equippable?(item)
  1364. return false if item == nil
  1365. if item.is_a?(RPG::Weapon) and YE::SUBCLASS::ALLOW_WEAPON
  1366. return self.subclass.weapon_set.include?(item.id)
  1367. elsif item.is_a?(RPG::Armor) and YE::SUBCLASS::ALLOW_ARMOUR
  1368. return false if two_swords_style and item.kind == 0
  1369. return self.subclass.armor_set.include?(item.id)
  1370. end
  1371. return false
  1372. end
  1373.  
  1374. #--------------------------------------------------------------------------
  1375. # alias level_up
  1376. #--------------------------------------------------------------------------
  1377. alias level_up_sss level_up unless $@
  1378. def level_up
  1379. #-----
  1380. prm_rate = YE::SUBCLASS::PRIMARY_GROWTH_RATE
  1381. sub_rate = YE::SUBCLASS::SUBCLASS_GROWTH_RATE
  1382. if YE::SUBCLASS::LEVEL_UP_BONUS_PRIMARY
  1383. if YE::SUBCLASS::CLASS_STAT_BONUS_SET.include?(self.class.id)
  1384. narray = YE::SUBCLASS::CLASS_STAT_BONUS_SET[self.class.id]
  1385. self.maxhp += (narray[0] * prm_rate) / 100
  1386. self.maxmp += (narray[1] * prm_rate) / 100
  1387. self.atk += (narray[2] * prm_rate) / 100
  1388. self.def += (narray[3] * prm_rate) / 100
  1389. self.spi += (narray[4] * prm_rate) / 100
  1390. self.agi += (narray[5] * prm_rate) / 100
  1391. end
  1392. end
  1393. #-----
  1394. if YE::SUBCLASS::BONUS_RANDOM_PRIMARY
  1395. if YE::SUBCLASS::CLASS_STAT_BONUS_RAN.include?(self.class.id)
  1396. narray = YE::SUBCLASS::CLASS_STAT_BONUS_RAN[self.class.id]
  1397. self.maxhp += (rand(narray[0]) * prm_rate) / 100 unless narray[0] == 0
  1398. self.maxmp += (rand(narray[1]) * prm_rate) / 100 unless narray[1] == 0
  1399. self.atk += (rand(narray[2]) * prm_rate) / 100 unless narray[2] == 0
  1400. self.def += (rand(narray[3]) * prm_rate) / 100 unless narray[3] == 0
  1401. self.spi += (rand(narray[4]) * prm_rate) / 100 unless narray[4] == 0
  1402. self.agi += (rand(narray[5]) * prm_rate) / 100 unless narray[5] == 0
  1403. end
  1404. end
  1405. #-----
  1406. if YE::SUBCLASS::LEVEL_UP_BONUS_SUBCLASS and self.subclass != nil
  1407. if YE::SUBCLASS::CLASS_STAT_BONUS_SET.include?(self.class.id)
  1408. narray = YE::SUBCLASS::CLASS_STAT_BONUS_SET[self.class.id]
  1409. self.maxhp += (narray[0] * sub_rate) / 100
  1410. self.maxmp += (narray[1] * sub_rate) / 100
  1411. self.atk += (narray[2] * sub_rate) / 100
  1412. self.def += (narray[3] * sub_rate) / 100
  1413. self.spi += (narray[4] * sub_rate) / 100
  1414. self.agi += (narray[5] * sub_rate) / 100
  1415. end
  1416. end
  1417. #-----
  1418. if YE::SUBCLASS::BONUS_RANDOM_SUBCLASS and self.subclass != nil
  1419. if YE::SUBCLASS::CLASS_STAT_BONUS_RAN.include?(self.class.id)
  1420. narray = YE::SUBCLASS::CLASS_STAT_BONUS_RAN[self.class.id]
  1421. self.maxhp += (rand(narray[0]) * sub_rate) / 100 unless narray[0] == 0
  1422. self.maxmp += (rand(narray[1]) * sub_rate) / 100 unless narray[1] == 0
  1423. self.atk += (rand(narray[2]) * sub_rate) / 100 unless narray[2] == 0
  1424. self.def += (rand(narray[3]) * sub_rate) / 100 unless narray[3] == 0
  1425. self.spi += (rand(narray[4]) * sub_rate) / 100 unless narray[4] == 0
  1426. self.agi += (rand(narray[5]) * sub_rate) / 100 unless narray[5] == 0
  1427. end
  1428. end
  1429. #-----
  1430. if YE::SUBCLASS::ALLOW_RETRO_LEARN and self.subclass != nil
  1431. for i in self.subclass.learnings
  1432. learn_skill(i.skill_id) if i.level <= @level
  1433. end
  1434. end
  1435. #-----
  1436. level_up_sss
  1437. end
  1438.  
  1439. #--------------------------------------------------------------------------
  1440. # alias skills
  1441. #--------------------------------------------------------------------------
  1442. alias skills_sss skills unless $@
  1443. def skills
  1444. original_skills = skills_sss
  1445. allowed_skills = YE::SUBCLASS::CLASS_SKILL_ALLOW[0]
  1446. if YE::SUBCLASS::ACTOR_COMMON_SKILLS.include?(self.id)
  1447. allowed_skills += YE::SUBCLASS::ACTOR_COMMON_SKILLS[self.id]
  1448. end
  1449. if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(self.class.id)
  1450. allowed_skills += YE::SUBCLASS::CLASS_SKILL_ALLOW[self.class.id]
  1451. if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(self.class.id)
  1452. allowed_skills += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[self.class.id]
  1453. end
  1454. end
  1455. unless self.subclass == nil
  1456. allowed_skills += YE::SUBCLASS::CLASS_SKILL_ALLOW[self.subclass.id]
  1457. if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(self.subclass.id)
  1458. allowed_skills += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[self.subclass.id]
  1459. end
  1460. end
  1461. result = []
  1462. for skill in original_skills
  1463. skill_id = skill.id
  1464. result.push(skill) if allowed_skills.include?(skill_id)
  1465. end
  1466. return result
  1467. end
  1468.  
  1469. #--------------------------------------------------------------------------
  1470. # skills_learned
  1471. #--------------------------------------------------------------------------
  1472. def skills_learned(class_id)
  1473. result = []
  1474. if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(class_id)
  1475. class_skills = YE::SUBCLASS::CLASS_SKILL_ALLOW[class_id]
  1476. if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(class_id)
  1477. class_skills += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[class_id]
  1478. end
  1479. if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(class_id)
  1480. class_skills += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[class_id]
  1481. end
  1482. for i in class_skills
  1483. result.push($data_skills[i]) if @skills.include?(i)
  1484. end
  1485. end
  1486. return result
  1487. end
  1488.  
  1489. #--------------------------------------------------------------------------
  1490. # alias base stats
  1491. #--------------------------------------------------------------------------
  1492. alias base_maxhp_sss base_maxhp unless $@
  1493. def base_maxhp
  1494. n = base_maxhp_sss
  1495. if YE::SUBCLASS::AFFECT_STATS_PRIMARY
  1496. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
  1497. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
  1498. else
  1499. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1500. end
  1501. n *= 100 + ((narray[0]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
  1502. n /= 100.0
  1503. end
  1504. if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
  1505. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
  1506. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
  1507. else
  1508. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1509. end
  1510. n *= 100 + ((narray[0]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
  1511. n /= 100.0
  1512. end
  1513. boost = false
  1514. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  1515. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1516. boost = true if check_hash.include?("maxhp up")
  1517. end
  1518. if self.subclass != nil and
  1519. YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
  1520. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
  1521. boost = true if check_hash.include?("maxhp up")
  1522. end
  1523. if boost
  1524. n *= YE::SUBCLASS::MAXHP_MULTIPLIER
  1525. n /= 100
  1526. end
  1527. return Integer(n)
  1528. end
  1529.  
  1530. alias base_maxmp_sss base_maxmp unless $@
  1531. def base_maxmp
  1532. n = base_maxmp_sss
  1533. if YE::SUBCLASS::AFFECT_STATS_PRIMARY
  1534. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
  1535. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
  1536. else
  1537. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1538. end
  1539. n *= 100 + ((narray[1]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
  1540. n /= 100.0
  1541. end
  1542. if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
  1543. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
  1544. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
  1545. else
  1546. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1547. end
  1548. n *= 100 + ((narray[1]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
  1549. n /= 100.0
  1550. end
  1551. boost = false
  1552. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  1553. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1554. boost = true if check_hash.include?("maxmp up")
  1555. end
  1556. if self.subclass != nil and
  1557. YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
  1558. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
  1559. boost = true if check_hash.include?("maxmp up")
  1560. end
  1561. if boost
  1562. n *= YE::SUBCLASS::MAXHP_MULTIPLIER
  1563. n /= 100
  1564. end
  1565. return Integer(n)
  1566. end
  1567.  
  1568. alias base_atk_sss base_atk unless $@
  1569. def base_atk
  1570. n = base_atk_sss
  1571. if YE::SUBCLASS::AFFECT_STATS_PRIMARY
  1572. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
  1573. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
  1574. else
  1575. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1576. end
  1577. n *= 100 + ((narray[2]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
  1578. n /= 100.0
  1579. end
  1580. if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
  1581. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
  1582. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
  1583. else
  1584. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1585. end
  1586. n *= 100 + ((narray[2]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
  1587. n /= 100.0
  1588. end
  1589. boost = false
  1590. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  1591. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1592. boost = true if check_hash.include?("atk up")
  1593. end
  1594. if self.subclass != nil and
  1595. YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
  1596. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
  1597. boost = true if check_hash.include?("atk up")
  1598. end
  1599. if boost
  1600. n *= YE::SUBCLASS::MAXHP_MULTIPLIER
  1601. n /= 100
  1602. end
  1603. unless $imported["BattlerStatBarehand"]
  1604. barehand_trait = false
  1605. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id) and
  1606. self.weapons[0] == nil and self.weapons[1] == nil
  1607. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1608. barehand_trait = true if check_hash.include?("barehanded")
  1609. barehand_trait = true if check_hash.include?("barehands")
  1610. end
  1611. if self.subclass != nil and !barehand_trait
  1612. if YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id) and
  1613. self.weapons[0] == nil and self.weapons[1] == nil
  1614. check_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH[self.subclass.id]
  1615. barehand_trait = true if check_hash.include?("barehanded")
  1616. barehand_trait = true if check_hash.include?("barehands")
  1617. end
  1618. end
  1619. n = barehanded_multiplier(n) if barehand_trait
  1620. end
  1621. return Integer(n)
  1622. end
  1623.  
  1624. unless method_defined?(:barehanded_multiplier)
  1625. def barehanded_multiplier(value)
  1626. value *= YE::SUBCLASS::BAREHAND_MULTIPLIER
  1627. value /= 100
  1628. return value
  1629. end
  1630. end
  1631.  
  1632. alias base_def_sss base_def unless $@
  1633. def base_def
  1634. n = base_def_sss
  1635. if YE::SUBCLASS::AFFECT_STATS_PRIMARY
  1636. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
  1637. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
  1638. else
  1639. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1640. end
  1641. n *= 100 + ((narray[3]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
  1642. n /= 100.0
  1643. end
  1644. if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
  1645. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
  1646. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
  1647. else
  1648. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1649. end
  1650. n *= 100 + ((narray[3]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
  1651. n /= 100.0
  1652. end
  1653. boost = false
  1654. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  1655. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1656. boost = true if check_hash.include?("def up")
  1657. end
  1658. if self.subclass != nil and
  1659. YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
  1660. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
  1661. boost = true if check_hash.include?("def up")
  1662. end
  1663. if boost
  1664. n *= YE::SUBCLASS::MAXHP_MULTIPLIER
  1665. n /= 100
  1666. end
  1667. return Integer(n)
  1668. end
  1669.  
  1670. alias base_spi_sss base_spi unless $@
  1671. def base_spi
  1672. n = base_spi_sss
  1673. if YE::SUBCLASS::AFFECT_STATS_PRIMARY
  1674. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
  1675. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
  1676. else
  1677. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1678. end
  1679. n *= 100 + ((narray[4]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
  1680. n /= 100.0
  1681. end
  1682. if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
  1683. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
  1684. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
  1685. else
  1686. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1687. end
  1688. n *= 100 + ((narray[4]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
  1689. n /= 100.0
  1690. end
  1691. boost = false
  1692. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  1693. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1694. boost = true if check_hash.include?("spi up")
  1695. end
  1696. if self.subclass != nil and
  1697. YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
  1698. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
  1699. boost = true if check_hash.include?("spi up")
  1700. end
  1701. if boost
  1702. n *= YE::SUBCLASS::MAXHP_MULTIPLIER
  1703. n /= 100
  1704. end
  1705. return Integer(n)
  1706. end
  1707.  
  1708. alias base_agi_sss base_agi unless $@
  1709. def base_agi
  1710. n = base_agi_sss
  1711. if YE::SUBCLASS::AFFECT_STATS_PRIMARY
  1712. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.class.id)
  1713. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.class.id]
  1714. else
  1715. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1716. end
  1717. n *= 100 + ((narray[5]-100) * YE::SUBCLASS::PRIMARY_STAT_RATE/100)
  1718. n /= 100.0
  1719. end
  1720. if YE::SUBCLASS::AFFECT_STATS_SUBCLASS and self.subclass != nil
  1721. if YE::SUBCLASS::CLASS_STAT_RATE.include?(self.subclass.id)
  1722. narray = YE::SUBCLASS::CLASS_STAT_RATE[self.subclass.id]
  1723. else
  1724. narray = YE::SUBCLASS::CLASS_STAT_RATE[0]
  1725. end
  1726. n *= 100 + ((narray[5]-100) * YE::SUBCLASS::SUBCLASS_STAT_RATE/100)
  1727. n /= 100.0
  1728. end
  1729. boost = false
  1730. if YE::SUBCLASS::PRIMARY_TRAITS_HASH.include?(self.class.id)
  1731. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.class.id]
  1732. boost = true if check_hash.include?("agi up")
  1733. end
  1734. if self.subclass != nil and
  1735. YE::SUBCLASS::SUBCLASS_TRAITS_HASH.include?(self.subclass.id)
  1736. check_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH[self.subclass.id]
  1737. boost = true if check_hash.include?("agi up")
  1738. end
  1739. if boost
  1740. n *= YE::SUBCLASS::MAXHP_MULTIPLIER
  1741. n /= 100
  1742. end
  1743. return Integer(n)
  1744. end
  1745.  
  1746. #--------------------------------------------------------------------------
  1747. # return class_jp
  1748. #--------------------------------------------------------------------------
  1749. def class_jp(id_value)
  1750. @class_jp = {} if @class_jp == nil
  1751. @class_jp[id_value] = 0 if @class_jp[id_value] == nil
  1752. limit = YE::SUBCLASS::MAX_JP_EARNED
  1753. @class_jp[id_value] = [@class_jp[id_value], limit].min
  1754. return @class_jp[id_value]
  1755. end
  1756.  
  1757. #--------------------------------------------------------------------------
  1758. # action change jp
  1759. #--------------------------------------------------------------------------
  1760. def change_jp(id_value, jp_earned = 1)
  1761. @class_jp = {} if @class_jp == nil
  1762. @class_jp[id_value] = 0 if @class_jp[id_value] == nil
  1763. @class_jp[id_value] += jp_earned
  1764. limit = YE::SUBCLASS::MAX_JP_EARNED
  1765. @class_jp[id_value] = [[@class_jp[id_value], limit].min, 0].max
  1766. end
  1767.  
  1768. #--------------------------------------------------------------------------
  1769. # forget all skills
  1770. #--------------------------------------------------------------------------
  1771. def forget_all_skills
  1772. @skills = []
  1773. end
  1774.  
  1775. #--------------------------------------------------------------------------
  1776. # alias auto battle
  1777. #--------------------------------------------------------------------------
  1778. alias auto_battle_sss auto_battle unless $@
  1779. def auto_battle
  1780. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1781. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1782. if pri_hash.include?(self.class.id)
  1783. return true if pri_hash[self.class.id].include?("auto battle")
  1784. end
  1785. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1786. return true if sub_hash[self.subclass.id].include?("auto battle")
  1787. end
  1788. auto_battle_sss
  1789. end
  1790.  
  1791. #--------------------------------------------------------------------------
  1792. # alias super guard
  1793. #--------------------------------------------------------------------------
  1794. alias super_guard_sss super_guard unless $@
  1795. def super_guard
  1796. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1797. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1798. if pri_hash.include?(self.class.id)
  1799. return true if pri_hash[self.class.id].include?("super guard")
  1800. end
  1801. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1802. return true if sub_hash[self.subclass.id].include?("super guard")
  1803. end
  1804. super_guard_sss
  1805. end
  1806.  
  1807. #--------------------------------------------------------------------------
  1808. # alias pharmacology
  1809. #--------------------------------------------------------------------------
  1810. alias pharmacology_sss pharmacology unless $@
  1811. def pharmacology
  1812. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1813. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1814. if pri_hash.include?(self.class.id)
  1815. return true if pri_hash[self.class.id].include?("pharmacology")
  1816. return true if pri_hash[self.class.id].include?("item boost")
  1817. end
  1818. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1819. return true if sub_hash[self.subclass.id].include?("pharmacology")
  1820. return true if sub_hash[self.subclass.id].include?("item boost")
  1821. end
  1822. pharmacology_sss
  1823. end
  1824.  
  1825. #--------------------------------------------------------------------------
  1826. # alias fast attack
  1827. #--------------------------------------------------------------------------
  1828. alias fast_attack_sss fast_attack unless $@
  1829. def fast_attack
  1830. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1831. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1832. if pri_hash.include?(self.class.id)
  1833. return true if pri_hash[self.class.id].include?("fast attack")
  1834. end
  1835. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1836. return true if sub_hash[self.subclass.id].include?("fast attack")
  1837. end
  1838. fast_attack_sss
  1839. end
  1840.  
  1841. #--------------------------------------------------------------------------
  1842. # alias dual_attack
  1843. #--------------------------------------------------------------------------
  1844. alias dual_attack_sss dual_attack unless $@
  1845. def dual_attack
  1846. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1847. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1848. if pri_hash.include?(self.class.id)
  1849. return true if pri_hash[self.class.id].include?("dual attack")
  1850. end
  1851. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1852. return true if sub_hash[self.subclass.id].include?("dual attack")
  1853. end
  1854. dual_attack_sss
  1855. end
  1856.  
  1857. #--------------------------------------------------------------------------
  1858. # alias prevent_critical
  1859. #--------------------------------------------------------------------------
  1860. alias prevent_critical_sss prevent_critical unless $@
  1861. def prevent_critical
  1862. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1863. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1864. if pri_hash.include?(self.class.id)
  1865. return true if pri_hash[self.class.id].include?("prevent critical")
  1866. return true if pri_hash[self.class.id].include?("prevent crit")
  1867. end
  1868. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1869. return true if sub_hash[self.subclass.id].include?("prevent critical")
  1870. return true if sub_hash[self.subclass.id].include?("prevent crit")
  1871. end
  1872. prevent_critical_sss
  1873. end
  1874.  
  1875. #--------------------------------------------------------------------------
  1876. # alias half_mp_cost
  1877. #--------------------------------------------------------------------------
  1878. alias half_mp_cost_sss half_mp_cost unless $@
  1879. def half_mp_cost
  1880. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1881. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1882. if pri_hash.include?(self.class.id)
  1883. return true if pri_hash[self.class.id].include?("half mp cost")
  1884. end
  1885. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1886. return true if sub_hash[self.subclass.id].include?("half mp cost")
  1887. end
  1888. half_mp_cost_sss
  1889. end
  1890.  
  1891. #--------------------------------------------------------------------------
  1892. # alias double_exp_gain
  1893. #--------------------------------------------------------------------------
  1894. alias double_exp_gain_sss double_exp_gain unless $@
  1895. def double_exp_gain
  1896. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1897. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1898. if pri_hash.include?(self.class.id)
  1899. return true if pri_hash[self.class.id].include?("double exp gain")
  1900. return true if pri_hash[self.class.id].include?("double exp")
  1901. end
  1902. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1903. return true if sub_hash[self.subclass.id].include?("double exp gain")
  1904. return true if sub_hash[self.subclass.id].include?("double exp")
  1905. end
  1906. double_exp_gain_sss
  1907. end
  1908.  
  1909. #--------------------------------------------------------------------------
  1910. # alias auto_hp_recover
  1911. #--------------------------------------------------------------------------
  1912. alias auto_hp_recover_sss auto_hp_recover unless $@
  1913. def auto_hp_recover
  1914. pri_hash = YE::SUBCLASS::PRIMARY_TRAITS_HASH
  1915. sub_hash = YE::SUBCLASS::SUBCLASS_TRAITS_HASH
  1916. if pri_hash.include?(self.class.id)
  1917. return true if pri_hash[self.class.id].include?("auto hp recover")
  1918. return true if pri_hash[self.class.id].include?("auto hp regen")
  1919. end
  1920. if self.subclass != nil and sub_hash.include?(self.subclass.id)
  1921. return true if sub_hash[self.subclass.id].include?("auto hp recover")
  1922. return true if sub_hash[self.subclass.id].include?("auto hp regen")
  1923. end
  1924. auto_hp_recover_sss
  1925. end
  1926.  
  1927. end # end Game Actor
  1928.  
  1929. #==============================================================================
  1930. # Game_Troop
  1931. #==============================================================================
  1932.  
  1933. class Game_Troop < Game_Unit
  1934.  
  1935. #--------------------------------------------------------------------------
  1936. # JP Total
  1937. #--------------------------------------------------------------------------
  1938. def jp_total
  1939. jp = 0
  1940. for enemy in dead_members
  1941. jp += enemy.enemy.enemy_jp unless enemy.hidden
  1942. end
  1943. return jp
  1944. end
  1945.  
  1946. end # Game_Troop
  1947.  
  1948. #==============================================================================
  1949. # Window_Command (imported from KGC)
  1950. #==============================================================================
  1951.  
  1952. class Window_Command < Window_Selectable
  1953. unless method_defined?(:add_command)
  1954. #--------------------------------------------------------------------------
  1955. # add command
  1956. #--------------------------------------------------------------------------
  1957. def add_command(command)
  1958. @commands << command
  1959. @item_max = @commands.size
  1960. item_index = @item_max - 1
  1961. refresh_command
  1962. draw_item(item_index)
  1963. return item_index
  1964. end
  1965. #--------------------------------------------------------------------------
  1966. # refresh command
  1967. #--------------------------------------------------------------------------
  1968. def refresh_command
  1969. buf = self.contents.clone
  1970. self.height = [self.height, row_max * WLH + 32].max
  1971. create_contents
  1972. self.contents.blt(0, 0, buf, buf.rect)
  1973. buf.dispose
  1974. end
  1975. #--------------------------------------------------------------------------
  1976. # insert command
  1977. #--------------------------------------------------------------------------
  1978. def insert_command(index, command)
  1979. @commands.insert(index, command)
  1980. @item_max = @commands.size
  1981. refresh_command
  1982. refresh
  1983. end
  1984. #--------------------------------------------------------------------------
  1985. # remove command
  1986. #--------------------------------------------------------------------------
  1987. def remove_command(command)
  1988. @commands.delete(command)
  1989. @item_max = @commands.size
  1990. refresh
  1991. end
  1992. end
  1993. end
  1994.  
  1995. #==============================================================================
  1996. # Scene_Battle
  1997. #==============================================================================
  1998.  
  1999. class Scene_Battle < Scene_Base
  2000.  
  2001. #--------------------------------------------------------------------------
  2002. # alias process_battle_start
  2003. #--------------------------------------------------------------------------
  2004. alias process_battle_start_sss process_battle_start unless $@
  2005. def process_battle_start
  2006. for actor in $game_party.members
  2007. actor.jp_counter = 0
  2008. end
  2009. process_battle_start_sss
  2010. end
  2011.  
  2012. #--------------------------------------------------------------------------
  2013. # alias execute_action_guard
  2014. #--------------------------------------------------------------------------
  2015. alias execute_action_guard_sss execute_action_guard unless $@
  2016. def execute_action_guard
  2017. execute_action_guard_sss
  2018. return unless @active_battler.actor?
  2019. return unless YE::SUBCLASS::EARN_JP_VIA_GUARD_ENABLE
  2020. amount = YE::SUBCLASS::EARN_JP_VIA_GUARD_AMOUNT
  2021. unless YE::SUBCLASS::EARN_JP_VIA_GUARD_RANDOM == 0
  2022. amount += rand(YE::SUBCLASS::EARN_JP_VIA_GUARD_RANDOM)
  2023. end
  2024. @active_battler.gain_jp(amount)
  2025. end
  2026.  
  2027. #--------------------------------------------------------------------------
  2028. # alias display_exp_and_gold
  2029. #--------------------------------------------------------------------------
  2030. alias display_exp_and_gold_sss display_exp_and_gold unless $@
  2031. def display_exp_and_gold
  2032. display_exp_and_gold_sss
  2033. return unless YE::SUBCLASS::USE_JP_SYSTEM
  2034. return unless YE::SUBCLASS::ENEMIES_GIVE_JP
  2035. jp = $game_troop.jp_total
  2036. if jp > 0
  2037. text = sprintf(YE::SUBCLASS::ENEMIES_MESSAGE, $game_party.name, jp)
  2038. $game_message.texts.push(text) if YE::SUBCLASS::ENEMIES_SHOW_MSG
  2039. end
  2040. if YE::SUBCLASS::DISPLAY_ACTOR_JP
  2041. $game_message.new_page
  2042. end
  2043. for actor in $game_party.members
  2044. actor.gain_jp(jp)
  2045. next unless YE::SUBCLASS::DISPLAY_ACTOR_JP
  2046. text = sprintf(YE::SUBCLASS::DISPLAY_ACTOR_MSG, actor.name, actor.jp_counter)
  2047. $game_message.texts.push('\>' + text)
  2048. end
  2049. wait_for_message if YE::SUBCLASS::DISPLAY_ACTOR_JP
  2050. end
  2051.  
  2052. end
  2053.  
  2054. #===============================================================================
  2055. # Scene Menu
  2056. #===============================================================================
  2057.  
  2058. class Scene_Menu < Scene_Base
  2059.  
  2060. #--------------------------------------------------------------------------
  2061. # alias create command window
  2062. #--------------------------------------------------------------------------
  2063. alias create_command_window_sss create_command_window unless $@
  2064. def create_command_window
  2065. create_command_window_sss
  2066. return if $imported["CustomMenuCommand"]
  2067. if YE::SUBCLASS::MENU_CLASS_CHANGE_OPTION and
  2068. $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH]
  2069. scc_text = YE::SUBCLASS::MENU_CLASS_CHANGE_TITLE
  2070. @command_class_change = @command_window.add_command(scc_text)
  2071. if @command_window.oy > 0
  2072. @command_window.oy -= Window_Base::WLH
  2073. end
  2074. end
  2075. if YE::SUBCLASS::USE_JP_SYSTEM and YE::SUBCLASS::LEARN_SKILL_OPTION and
  2076. $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH]
  2077. scc_text = YE::SUBCLASS::LEARN_SKILL_TITLE
  2078. @command_learn_skill = @command_window.add_command(scc_text)
  2079. if @command_window.oy > 0
  2080. @command_window.oy -= Window_Base::WLH
  2081. end
  2082. end
  2083. @command_window.index = @menu_index
  2084. end
  2085.  
  2086. #--------------------------------------------------------------------------
  2087. # alias update command selection
  2088. #--------------------------------------------------------------------------
  2089. alias update_command_selection_sss update_command_selection unless $@
  2090. def update_command_selection
  2091. call_yerd_command = 0
  2092. if Input.trigger?(Input::C)
  2093. case @command_window.index
  2094. when @command_class_change
  2095. call_yerd_command = 1
  2096. when @command_learn_skill
  2097. call_yerd_command = 1
  2098. end
  2099. end
  2100. if call_yerd_command == 1
  2101. if $game_party.members.size == 0
  2102. Sound.play_buzzer
  2103. return
  2104. end
  2105. Sound.play_decision
  2106. start_actor_selection
  2107. return
  2108. end
  2109. update_command_selection_sss
  2110. end
  2111.  
  2112. #--------------------------------------------------------------------------
  2113. # alias update actor selection
  2114. #--------------------------------------------------------------------------
  2115. alias update_actor_selection_sss update_actor_selection unless $@
  2116. def update_actor_selection
  2117. if Input.trigger?(Input::C)
  2118. $game_party.last_actor_index = @status_window.index
  2119. Sound.play_decision
  2120. case @command_window.index
  2121. when @command_class_change
  2122. $scene = Scene_Class_Change.new(@status_window.index,
  2123. @command_class_change)
  2124. return
  2125. when @command_learn_skill
  2126. $scene = Scene_Learn_Skill.new(@status_window.index,
  2127. @command_learn_skill)
  2128. return
  2129. end
  2130. end
  2131. update_actor_selection_sss
  2132. end
  2133.  
  2134. end # Scene Menu
  2135.  
  2136. #===============================================================================
  2137. # Scene Class Change
  2138. #===============================================================================
  2139.  
  2140. class Scene_Class_Change < Scene_Base
  2141.  
  2142. #--------------------------------------------------------------------------
  2143. # initialize
  2144. #--------------------------------------------------------------------------
  2145. def initialize(actor_index = 0, menu_index = nil)
  2146. @actor_index = actor_index
  2147. @menu_index = menu_index
  2148. end
  2149.  
  2150. #--------------------------------------------------------------------------
  2151. # start process
  2152. #--------------------------------------------------------------------------
  2153. def start
  2154. super
  2155. create_menu_background
  2156. @actor = $game_party.members[@actor_index]
  2157. @actor_window = Window_Class_Change_Actor.new(@actor)
  2158. @status_window = Window_Class_Change_Status.new(@actor)
  2159. @class_window = Window_Class_Change_Jobs.new(@actor)
  2160. create_command_window
  2161. @class_window.refresh
  2162. end
  2163.  
  2164. #--------------------------------------------------------------------------
  2165. # terminate
  2166. #--------------------------------------------------------------------------
  2167. def terminate
  2168. super
  2169. dispose_menu_background
  2170. @actor_window.dispose
  2171. @status_window.dispose
  2172. @class_window.dispose
  2173. @command_window.dispose
  2174. end
  2175.  
  2176. #--------------------------------------------------------------------------
  2177. # return scene
  2178. #--------------------------------------------------------------------------
  2179. def return_scene
  2180. if $imported["SceneStatusReDux"] and $game_temp.status_menu_flag
  2181. $scene = Scene_Status.new(@actor_index, $game_temp.status_menu_index)
  2182. elsif @menu_index == nil
  2183. $scene = Scene_Map.new
  2184. else
  2185. $scene = Scene_Menu.new(@menu_index)
  2186. end
  2187. end
  2188.  
  2189. #--------------------------------------------------------------------------
  2190. # * Switch to Next Actor Screen
  2191. #--------------------------------------------------------------------------
  2192. def next_actor
  2193. @actor_index += 1
  2194. @actor_index %= $game_party.members.size
  2195. $scene = Scene_Class_Change.new(@actor_index, @menu_index)
  2196. end
  2197. #--------------------------------------------------------------------------
  2198. # * Switch to Previous Actor Screen
  2199. #--------------------------------------------------------------------------
  2200. def prev_actor
  2201. @actor_index += $game_party.members.size - 1
  2202. @actor_index %= $game_party.members.size
  2203. $scene = Scene_Class_Change.new(@actor_index, @menu_index)
  2204. end
  2205.  
  2206. #--------------------------------------------------------------------------
  2207. # frame update
  2208. #--------------------------------------------------------------------------
  2209. def update
  2210. super
  2211. update_menu_background
  2212. if @command_window.active
  2213. update_command_window
  2214. elsif @class_window.active
  2215. update_class_window
  2216. end
  2217. end
  2218.  
  2219. #--------------------------------------------------------------------------
  2220. # create_command_window
  2221. #--------------------------------------------------------------------------
  2222. def create_command_window
  2223. actions = []
  2224. if $game_switches[YE::SUBCLASS::ALLOW_CHANGE_PRIMARY_SWITCH]
  2225. actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_PRIM)
  2226. @command_primary = actions.size - 1
  2227. end
  2228. if $game_switches[YE::SUBCLASS::ALLOW_CHANGE_SUBCLASS_SWITCH]
  2229. actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_SUB)
  2230. @command_sub = actions.size - 1
  2231. end
  2232. if YE::SUBCLASS::USE_JP_SYSTEM and
  2233. $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH]
  2234. actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_LEARN)
  2235. @command_learn = actions.size - 1
  2236. end
  2237. actions.push(YE::SUBCLASS::MENU_CLASS_CHANGE_DONE)
  2238. @command_done = actions.size - 1
  2239. @command_window = Window_Command.new(160, actions, 1, actions.size)
  2240. @command_window.x = 384
  2241. @command_window.y = 0
  2242. @command_window.height = 128
  2243. @command_window.active = true
  2244. @command_window.refresh
  2245. end
  2246.  
  2247. #--------------------------------------------------------------------------
  2248. # update_command_window
  2249. #--------------------------------------------------------------------------
  2250. def update_command_window
  2251. @command_window.update
  2252. if Input.trigger?(Input::B)
  2253. Sound.play_cancel
  2254. return_scene
  2255. elsif Input.trigger?(Input::UP)
  2256. @class_window.refresh
  2257. elsif Input.trigger?(Input::DOWN)
  2258. @class_window.refresh
  2259. elsif Input.trigger?(Input::C)
  2260. Sound.play_decision
  2261. case @command_window.index
  2262. when @command_done
  2263. return_scene
  2264. when @command_primary
  2265. @last_index = @class_window.item_max + 1
  2266. @command_window.active = false
  2267. @class_window.active = true
  2268. @class_window.refresh
  2269. when @command_sub
  2270. @last_index = @class_window.item_max + 1
  2271. @command_window.active = false
  2272. @class_window.active = true
  2273. @class_window.refresh
  2274. when @command_learn
  2275. $scene = Scene_Learn_Skill.new(@actor_index, @menu_index)
  2276. end
  2277. elsif Input.trigger?(Input::R)
  2278. Sound.play_cursor
  2279. next_actor
  2280. elsif Input.trigger?(Input::L)
  2281. Sound.play_cursor
  2282. prev_actor
  2283. end
  2284. end
  2285.  
  2286. #--------------------------------------------------------------------------
  2287. # update_class_window
  2288. #--------------------------------------------------------------------------
  2289. def update_class_window
  2290. @class_window.update
  2291. if @last_index != @class_window.index
  2292. @temp_actor = @actor.clone
  2293. if @command_window.index == @command_primary
  2294. class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
  2295. if @temp_actor.subclass_id == class_to_be.id
  2296. unless YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(class_to_be.id)
  2297. @temp_actor.subclass_clone = 0
  2298. end
  2299. end
  2300. @temp_actor.class_clone = class_to_be.id
  2301. elsif @command_window.index == @command_sub
  2302. class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
  2303. if @temp_actor.subclass_id == class_to_be.id
  2304. @temp_actor.subclass_clone = 0
  2305. else
  2306. @temp_actor.subclass_clone = class_to_be.id
  2307. end
  2308. end
  2309. @last_index = @class_window.index
  2310. @status_window.refresh(@temp_actor)
  2311. end
  2312. if Input.trigger?(Input::B)
  2313. Sound.play_cancel
  2314. @command_window.active = true
  2315. @class_window.active = false
  2316. @status_window.refresh
  2317. @temp_actor = nil
  2318. elsif Input.trigger?(Input::C)
  2319. case @command_window.index
  2320. when @command_primary
  2321. determine_primary
  2322. when @command_sub
  2323. determine_subclass
  2324. end
  2325. elsif Input.trigger?(Input::R)
  2326. Sound.play_cursor
  2327. next_actor
  2328. elsif Input.trigger?(Input::L)
  2329. Sound.play_cursor
  2330. prev_actor
  2331. end
  2332. end
  2333.  
  2334. #--------------------------------------------------------------------------
  2335. # determine primary
  2336. #--------------------------------------------------------------------------
  2337. def determine_primary
  2338. class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
  2339. if class_to_be == @actor.class
  2340. Sound.play_buzzer
  2341. elsif YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(class_to_be.id)
  2342. Sound.play_buzzer
  2343. elsif class_to_be == @actor.subclass
  2344. Sound.play_equip
  2345. @actor.class_id = class_to_be.id
  2346. @actor.subclass_id = 0
  2347. scene_refresh(@temp_actor)
  2348. else
  2349. Sound.play_equip
  2350. @actor.class_id = class_to_be.id
  2351. scene_refresh(@temp_actor)
  2352. end
  2353. end
  2354.  
  2355. #--------------------------------------------------------------------------
  2356. # determine subclass
  2357. #--------------------------------------------------------------------------
  2358. def determine_subclass
  2359. class_to_be = $data_classes[@actor.unlocked_classes[@class_window.index]]
  2360. if class_to_be == @actor.class
  2361. Sound.play_buzzer
  2362. elsif YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(class_to_be.id)
  2363. Sound.play_buzzer
  2364. else
  2365. Sound.play_equip
  2366. if @actor.subclass_id == class_to_be.id
  2367. @actor.subclass_id = 0
  2368. else
  2369. @actor.subclass_id = class_to_be.id
  2370. end
  2371. scene_refresh(@temp_actor)
  2372. end
  2373. end
  2374.  
  2375. #--------------------------------------------------------------------------
  2376. # scene_refresh
  2377. #--------------------------------------------------------------------------
  2378. def scene_refresh(fake = nil)
  2379. @actor_window.refresh
  2380. @class_window.refresh
  2381. @status_window.refresh(fake)
  2382. end
  2383.  
  2384. #--------------------------------------------------------------------------
  2385. # index_primary
  2386. #--------------------------------------------------------------------------
  2387. def index_primary
  2388. if @command_window != nil
  2389. return true if @command_window.index == @command_primary
  2390. end
  2391. return false
  2392. end
  2393.  
  2394. #--------------------------------------------------------------------------
  2395. # index_subclass
  2396. #--------------------------------------------------------------------------
  2397. def index_subclass
  2398. if @command_window != nil
  2399. return true if @command_window.index == @command_sub
  2400. end
  2401. return false
  2402. end
  2403.  
  2404. end # Scene Class Change
  2405.  
  2406. #===============================================================================
  2407. # Scene Learn Skill
  2408. #===============================================================================
  2409.  
  2410. class Scene_Learn_Skill < Scene_Base
  2411.  
  2412. #--------------------------------------------------------------------------
  2413. # initialize
  2414. #--------------------------------------------------------------------------
  2415. def initialize(actor_index = 0, menu_index = nil)
  2416. @actor_index = actor_index
  2417. @menu_index = menu_index
  2418. @last_index = -100
  2419. end
  2420.  
  2421. #--------------------------------------------------------------------------
  2422. # start process
  2423. #--------------------------------------------------------------------------
  2424. def start
  2425. super
  2426. create_menu_background
  2427. @actor = $game_party.members[@actor_index]
  2428. @help_window = Window_Help.new
  2429. if $imported["HelpExtension"]
  2430. @help_window.row_max = KGC::HelpExtension::ROW_MAX
  2431. end
  2432. dy = @help_window.height
  2433. @status_window = Window_Learn_Skill_Status.new(384, dy, @actor)
  2434. dy += 56
  2435. dh = 416 - @help_window.height - 56
  2436. @class_window = Window_Learn_Skill_Classes.new(0, dy, 384, dh, @actor)
  2437. create_command_window
  2438. create_skill_query
  2439. end
  2440.  
  2441. #--------------------------------------------------------------------------
  2442. # terminate
  2443. #--------------------------------------------------------------------------
  2444. def terminate
  2445. super
  2446. dispose_menu_background
  2447. @help_window.dispose
  2448. @status_window.dispose
  2449. @class_window.dispose
  2450. @command_window.dispose
  2451. @skill_data_window.dispose if @skill_data_window != nil
  2452. @help_info_window.dispose if @help_info_window != nil
  2453. end
  2454.  
  2455. #--------------------------------------------------------------------------
  2456. # return scene
  2457. #--------------------------------------------------------------------------
  2458. def return_scene
  2459. if $imported["SceneStatusReDux"] and $game_temp.status_menu_flag
  2460. $scene = Scene_Status.new(@actor_index, $game_temp.status_menu_index)
  2461. elsif @menu_index == nil
  2462. $scene = Scene_Map.new
  2463. else
  2464. $scene = Scene_Menu.new(@menu_index)
  2465. end
  2466. end
  2467.  
  2468. #--------------------------------------------------------------------------
  2469. # create_command_window
  2470. #--------------------------------------------------------------------------
  2471. def create_command_window
  2472. actions = []
  2473. actions.push(YE::SUBCLASS::LEARN_SKILL_SELECT)
  2474. @command_select = actions.size - 1
  2475. if YE::SUBCLASS::MENU_CLASS_CHANGE_OPTION and
  2476. $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH]
  2477. actions.push(YE::SUBCLASS::LEARN_SKILL_CHANGE)
  2478. @command_change = actions.size - 1
  2479. end
  2480. actions.push(YE::SUBCLASS::LEARN_SKILL_DONE)
  2481. @command_done = actions.size - 1
  2482. @command_window = Window_Command.new(384, actions, actions.size)
  2483. @command_window.x = 0
  2484. @command_window.y = @help_window.height
  2485. @command_window.active = true
  2486. @command_window.refresh
  2487. end
  2488.  
  2489. #--------------------------------------------------------------------------
  2490. # create skill query
  2491. #--------------------------------------------------------------------------
  2492. def create_skill_query
  2493. return unless $imported["DisplaySkillQuery"]
  2494. return unless YE::SUBCLASS::ENABLE_SKILL_QUERY
  2495. sdy = @help_window.height
  2496. sdh = 416 - sdy
  2497. @skill_data_window = Window_Skill_Data.new(0, sdy, 272, sdh)
  2498. @skill_data_window.active = false
  2499. @help_info_window = Window_Base.new(0, sdy, 384, 56)
  2500. text = YE::SUBCLASS::QUERY_HELP_WIN_TEXT
  2501. @help_info_window.contents.draw_text(2, 0, 344, 24, text, 1)
  2502. @help_info_window.visible = false
  2503. end
  2504.  
  2505. #--------------------------------------------------------------------------
  2506. # * Switch to Next Actor Screen
  2507. #--------------------------------------------------------------------------
  2508. def next_actor
  2509. @actor_index += 1
  2510. @actor_index %= $game_party.members.size
  2511. $scene = Scene_Learn_Skill.new(@actor_index, @menu_index)
  2512. end
  2513. #--------------------------------------------------------------------------
  2514. # * Switch to Previous Actor Screen
  2515. #--------------------------------------------------------------------------
  2516. def prev_actor
  2517. @actor_index += $game_party.members.size - 1
  2518. @actor_index %= $game_party.members.size
  2519. $scene = Scene_Learn_Skill.new(@actor_index, @menu_index)
  2520. end
  2521.  
  2522. #--------------------------------------------------------------------------
  2523. # frame update
  2524. #--------------------------------------------------------------------------
  2525. def update
  2526. super
  2527. update_menu_background
  2528. if $imported["DisplaySkillQuery"] and @skill_data_window.active
  2529. update_skill_query_window
  2530. elsif @command_window.active
  2531. update_command_window
  2532. elsif @class_window.active
  2533. update_class_window
  2534. elsif @skill_list_window != nil
  2535. update_skill_list_window
  2536. end
  2537. end
  2538.  
  2539. #--------------------------------------------------------------------------
  2540. # update_skill_query_window
  2541. #--------------------------------------------------------------------------
  2542. def update_skill_query_window
  2543. @skill_data_window.update
  2544. if Input.trigger?(Input::B)
  2545. Sound.play_cancel
  2546. @skill_data_window.disappear
  2547. @skill_list_window.active = true
  2548. elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
  2549. @skill_data_window.previous_page
  2550. elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
  2551. @skill_data_window.next_page
  2552. elsif Input.trigger?(Input::L)
  2553. @skill_data_window.top_page
  2554. elsif Input.trigger?(Input::R)
  2555. @skill_data_window.bottom_page
  2556. end
  2557. end
  2558.  
  2559. #--------------------------------------------------------------------------
  2560. # update_command_window
  2561. #--------------------------------------------------------------------------
  2562. def update_command_window
  2563. @command_window.update
  2564. if Input.trigger?(Input::B)
  2565. Sound.play_cancel
  2566. return_scene
  2567. elsif Input.trigger?(Input::C)
  2568. Sound.play_decision
  2569. case @command_window.index
  2570. when @command_done
  2571. return_scene
  2572. when @command_select
  2573. Sound.play_decision
  2574. @class_window.active = true
  2575. @command_window.active = false
  2576. class_id = $data_classes[@actor.unlocked_classes[@class_window.index]].id
  2577. @status_window.refresh(class_id)
  2578. text = YE::SUBCLASS::LEARN_SKILL_STATUS_HELP
  2579. @help_window.set_text(text)
  2580. when @command_change
  2581. $scene = Scene_Class_Change.new(@actor_index, @menu_index)
  2582. end
  2583. elsif Input.trigger?(Input::R)
  2584. Sound.play_cursor
  2585. next_actor
  2586. elsif Input.trigger?(Input::L)
  2587. Sound.play_cursor
  2588. prev_actor
  2589. end
  2590. end
  2591.  
  2592. #--------------------------------------------------------------------------
  2593. # update_class_window
  2594. #--------------------------------------------------------------------------
  2595. def update_class_window
  2596. @class_window.update
  2597. if @last_index != @class_window.index
  2598. class_id = $data_classes[@actor.unlocked_classes[@class_window.index]].id
  2599. @status_window.refresh(class_id)
  2600. @last_index = @class_window.index
  2601. end
  2602. if Input.trigger?(Input::B)
  2603. Sound.play_cancel
  2604. @class_window.active = false
  2605. @command_window.active = true
  2606. @status_window.refresh
  2607. @help_window.set_text("")
  2608. elsif Input.trigger?(Input::C)
  2609. Sound.play_decision
  2610. class_id = $data_classes[@actor.unlocked_classes[@class_window.index]].id
  2611. @skill_list_window = Window_Learn_Skill_List.new(@class_window, @actor, class_id)
  2612. @skill_list_window.help_window = @help_window
  2613. @class_window.active = false
  2614. @class_window.visible = false
  2615. show_query_info
  2616. elsif Input.trigger?(Input::R)
  2617. Sound.play_cursor
  2618. next_actor
  2619. elsif Input.trigger?(Input::L)
  2620. Sound.play_cursor
  2621. prev_actor
  2622. end
  2623. end
  2624.  
  2625. #--------------------------------------------------------------------------
  2626. # update_skill_list_window
  2627. #--------------------------------------------------------------------------
  2628. def update_skill_list_window
  2629. @skill_list_window.update
  2630. if Input.trigger?(Input::B)
  2631. Sound.play_cancel
  2632. @class_window.active = true
  2633. @class_window.visible = true
  2634. @skill_list_window.dispose
  2635. text = YE::SUBCLASS::LEARN_SKILL_STATUS_HELP
  2636. @help_window.set_text(text)
  2637. hide_query_info
  2638. elsif Input.trigger?(Input::C)
  2639. unless @skill_list_window.skill_id == nil
  2640. skill = $data_skills[@skill_list_window.skill_id]
  2641. if @actor.skill_learn?(skill)
  2642. Sound.play_buzzer
  2643. elsif skill.require_level >= @actor.level
  2644. Sound.play_buzzer
  2645. elsif !met_skill_requirements(skill)
  2646. Sound.play_buzzer
  2647. elsif skill.jp_cost > @actor.class_jp(@skill_list_window.class_id)
  2648. Sound.play_buzzer
  2649. else
  2650. YE::SUBCLASS::LEARN_SKILL_SHOP_SOUND.play
  2651. @actor.learn_skill(skill.id)
  2652. @actor.change_jp(@skill_list_window.class_id, -skill.jp_cost)
  2653. @skill_list_window.refresh
  2654. @status_window.refresh(@skill_list_window.class_id)
  2655. @class_window.refresh
  2656. end
  2657. end
  2658. elsif $imported["DisplaySkillQuery"] and
  2659. Input.trigger?(YE::SUBCLASS::SHOW_QUERY_BUTTON)
  2660. if @skill_list_window.skill_id == nil
  2661. skill = nil
  2662. else
  2663. skill = $data_skills[@skill_list_window.skill_id]
  2664. end
  2665. if skill != nil
  2666. Sound.play_decision
  2667. @skill_data_window.appear(skill, @skill_list_window, @actor, 2)
  2668. @skill_list_window.active = false
  2669. else
  2670. Sound.play_buzzer
  2671. end
  2672. end
  2673. end
  2674.  
  2675. #--------------------------------------------------------------------------
  2676. # met skill requirements
  2677. #--------------------------------------------------------------------------
  2678. def met_skill_requirements(skill)
  2679. return true if skill.require_skill == []
  2680. total_met = 0
  2681. for skill_id in skill.require_skill
  2682. if @actor.skill_learn?($data_skills[skill_id])
  2683. total_met += 1
  2684. end
  2685. end
  2686. if total_met == skill.require_skill.size
  2687. return true
  2688. else
  2689. return false
  2690. end
  2691. end
  2692.  
  2693. #--------------------------------------------------------------------------
  2694. # show/hide query info
  2695. #--------------------------------------------------------------------------
  2696. def show_query_info
  2697. return unless $imported["DisplaySkillQuery"]
  2698. return unless YE::SUBCLASS::SHOW_QUERY_HELP_WIN
  2699. @help_info_window.visible = true
  2700. @command_window.visible = false
  2701. end
  2702.  
  2703. def hide_query_info
  2704. return unless $imported["DisplaySkillQuery"]
  2705. return unless YE::SUBCLASS::SHOW_QUERY_HELP_WIN
  2706. @help_info_window.visible = false
  2707. @command_window.visible = true
  2708. end
  2709.  
  2710. end # Scene_Learn_Skill
  2711.  
  2712. #===============================================================================
  2713. # Scene Title
  2714. #===============================================================================
  2715.  
  2716. class Scene_Title < Scene_Base
  2717.  
  2718. #--------------------------------------------------------------------------
  2719. # alias create game objects
  2720. #--------------------------------------------------------------------------
  2721. alias create_game_objects_sss create_game_objects unless $@
  2722. def create_game_objects
  2723. create_game_objects_sss
  2724. $game_switches[YE::SUBCLASS::ALLOW_CHANGE_PRIMARY_SWITCH] = true
  2725. $game_switches[YE::SUBCLASS::ALLOW_CHANGE_SUBCLASS_SWITCH] = true
  2726. $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH] = true
  2727. $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH] = true
  2728. end
  2729.  
  2730. end # Scene_Title
  2731.  
  2732. #===============================================================================
  2733. # Window_Base
  2734. #===============================================================================
  2735.  
  2736. class Window_Base < Window
  2737.  
  2738. #--------------------------------------------------------------------------
  2739. # Draw Actor Class
  2740. #--------------------------------------------------------------------------
  2741. def draw_actor_class(actor, x, y, wd = 120, align = 0)
  2742. if actor.subclass == nil
  2743. text = actor.class.name
  2744. else
  2745. text = sprintf(YE::SUBCLASS::DISPLAY_FORMAT, actor.class.name,
  2746. actor.subclass.name)
  2747. end
  2748. if YE::SUBCLASS::USE_COMPLEX_CLASS_NAMES
  2749. if YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL.include?(text)
  2750. text = YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL[text]
  2751. end
  2752. end
  2753. self.contents.font.color = normal_color
  2754. self.contents.draw_text(x, y, wd, WLH, text, align)
  2755. end
  2756.  
  2757. #--------------------------------------------------------------------------
  2758. # Draw Actor Class Abbreviated
  2759. #--------------------------------------------------------------------------
  2760. def draw_actor_class_abbr(actor, x, y, wd = 120, align = 0)
  2761. if actor.subclass == nil
  2762. text = YE::SUBCLASS::CLASS_ABBREVIATIONS[actor.class.id]
  2763. else
  2764. class1 = YE::SUBCLASS::CLASS_ABBREVIATIONS[actor.class.id]
  2765. class2 = YE::SUBCLASS::CLASS_ABBREVIATIONS[actor.subclass.id]
  2766. text = sprintf(YE::SUBCLASS::DISPLAY_FORMAT, class1, class2)
  2767. end
  2768. if YE::SUBCLASS::USE_COMPLEX_CLASS_NAMES
  2769. if YE::SUBCLASS::COMPLEX_CLASS_NAMES_ABBR.include?(text)
  2770. text = YE::SUBCLASS::COMPLEX_CLASS_NAMES_ABBR[text]
  2771. end
  2772. end
  2773. self.contents.font.color = normal_color
  2774. self.contents.draw_text(x, y, wd, WLH, text, align)
  2775. end
  2776.  
  2777. end
  2778.  
  2779. #===============================================================================
  2780. # Window Class Change Actor
  2781. #===============================================================================
  2782.  
  2783. class Window_Class_Change_Actor < Window_Base
  2784.  
  2785. #--------------------------------------------------------------------------
  2786. # initialize
  2787. #--------------------------------------------------------------------------
  2788. def initialize(actor)
  2789. super(0, 0, 384, 128)
  2790. @actor = actor
  2791. refresh
  2792. end
  2793.  
  2794. #--------------------------------------------------------------------------
  2795. # refresh
  2796. #--------------------------------------------------------------------------
  2797. def refresh
  2798. self.contents.clear
  2799. draw_actor_face(@actor, 0, 0)
  2800. y = 0
  2801. draw_actor_name(@actor, 116, y)
  2802. if YE::SUBCLASS::CLASS_ICONS.include?(@actor.class.id)
  2803. icon = YE::SUBCLASS::CLASS_ICONS[@actor.class.id]
  2804. else
  2805. icon = YE::SUBCLASS::CLASS_ICONS[0]
  2806. end
  2807. if @actor.subclass != nil
  2808. y += WLH
  2809. draw_actor_class(@actor, 116, y, 200, 0)
  2810. end
  2811. y += WLH
  2812. sety = y
  2813. draw_icon(icon, 116, y)
  2814. self.contents.draw_text(140, y, 112, WLH, @actor.class.name, 0)
  2815. if @actor.subclass != nil
  2816. if YE::SUBCLASS::CLASS_ICONS.include?(@actor.subclass.id)
  2817. icon = YE::SUBCLASS::CLASS_ICONS[@actor.subclass.id]
  2818. else
  2819. icon = YE::SUBCLASS::CLASS_ICONS[0]
  2820. end
  2821. y += WLH
  2822. draw_icon(icon, 116, y)
  2823. self.contents.draw_text(140, y, 112, WLH, @actor.subclass.name, 0)
  2824. end
  2825. if YE::SUBCLASS::USE_JP_SYSTEM
  2826. y = sety
  2827. icon = YE::SUBCLASS::JP_ICON
  2828. draw_icon(icon, 256, y)
  2829. class_id = @actor.class.id
  2830. text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(class_id))
  2831. self.contents.draw_text(268, y, 80, WLH, text, 2)
  2832. y += WLH
  2833. if @actor.subclass != nil
  2834. draw_icon(icon, 256, y)
  2835. class_id = @actor.subclass.id
  2836. text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(class_id))
  2837. self.contents.draw_text(268, y, 80, WLH, text, 2)
  2838. end
  2839. end
  2840. end # end refresh
  2841.  
  2842. end # End Window Class Change Actor
  2843.  
  2844. #==============================================================================
  2845. # Window_Class_Change_Jobs
  2846. #==============================================================================
  2847.  
  2848. class Window_Class_Change_Jobs < Window_Selectable
  2849.  
  2850. #--------------------------------------------------------------------------
  2851. # initialize
  2852. #--------------------------------------------------------------------------
  2853. def initialize(actor)
  2854. super(272, 128, 272, 288)
  2855. @actor = actor
  2856. @column_max = 1
  2857. self.index = 0
  2858. self.active = false
  2859. refresh
  2860. end
  2861.  
  2862. #--------------------------------------------------------------------------
  2863. # refresh
  2864. #--------------------------------------------------------------------------
  2865. def refresh
  2866. @data = []
  2867. for class_id in @actor.unlocked_classes
  2868. @data.push(class_id)
  2869. end
  2870. @item_max = @data.size
  2871. create_contents
  2872. for i in 0...@item_max
  2873. draw_item(i)
  2874. end
  2875. end
  2876.  
  2877. #--------------------------------------------------------------------------
  2878. # draw item
  2879. #--------------------------------------------------------------------------
  2880. def draw_item(index)
  2881. rect = item_rect(index)
  2882. self.contents.clear_rect(rect)
  2883. iclass = $data_classes[@actor.unlocked_classes[index]]
  2884. if iclass.id != 0
  2885. rect.width -= 4
  2886. enabled = true
  2887. enabled = false if iclass == @actor.class
  2888. enabled = false if iclass == @actor.subclass
  2889. if $scene.index_primary
  2890. if YE::SUBCLASS::SUBCLASS_ONLY_CLASSES.include?(iclass.id)
  2891. enabled = false
  2892. end
  2893. elsif $scene.index_subclass
  2894. if YE::SUBCLASS::PRIMARY_ONLY_CLASSES.include?(iclass.id)
  2895. enabled = false
  2896. end
  2897. end
  2898. if YE::SUBCLASS::CLASS_ICONS.include?(iclass.id)
  2899. icon = YE::SUBCLASS::CLASS_ICONS[iclass.id]
  2900. else
  2901. icon = YE::SUBCLASS::CLASS_ICONS[0]
  2902. end
  2903. draw_icon(icon, rect.x, rect.y, enabled)
  2904. dx = rect.x
  2905. dy = rect.y
  2906. dw = rect.width
  2907. dh = rect.height
  2908. self.contents.font.color.alpha = enabled ? 255 : 128
  2909. self.contents.draw_text(dx+24, dy, dw-48, dh, iclass.name, 0)
  2910. if YE::SUBCLASS::USE_JP_SYSTEM
  2911. icon = YE::SUBCLASS::JP_ICON
  2912. draw_icon(icon, rect.width-24, rect.y, enabled)
  2913. jp = @actor.class_jp(iclass.id)
  2914. self.contents.draw_text(dw-104, dy, 80, dh, jp, 2)
  2915. end
  2916. end
  2917. end
  2918.  
  2919. end # Window_Class_Change_Jobs
  2920.  
  2921. #===============================================================================
  2922. # Window Class Change Status
  2923. #===============================================================================
  2924.  
  2925. class Window_Class_Change_Status < Window_Base
  2926.  
  2927. #--------------------------------------------------------------------------
  2928. # initialize
  2929. #--------------------------------------------------------------------------
  2930. def initialize(actor)
  2931. super(0, 128, 272, 288)
  2932. @real = actor
  2933. refresh
  2934. end
  2935.  
  2936. #--------------------------------------------------------------------------
  2937. # refresh
  2938. #--------------------------------------------------------------------------
  2939. def refresh(fake = nil)
  2940. self.contents.clear
  2941. self.contents.font.color = normal_color
  2942. if YE::SUBCLASS::CLASS_ICONS.include?(@real.class.id)
  2943. icon1 = YE::SUBCLASS::CLASS_ICONS[@real.class.id]
  2944. else
  2945. icon1 = YE::SUBCLASS::CLASS_ICONS[0]
  2946. end
  2947. if @real.subclass != nil
  2948. if YE::SUBCLASS::CLASS_ICONS.include?(@real.subclass.id)
  2949. icon2 = YE::SUBCLASS::CLASS_ICONS[@real.subclass.id]
  2950. else
  2951. icon2 = YE::SUBCLASS::CLASS_ICONS[0]
  2952. end
  2953. draw_icon(icon2, 50, 0)
  2954. end
  2955. draw_icon(icon1, 26, 0)
  2956. self.contents.font.color = system_color
  2957. draw_actor_class_abbr(@real, 80, 0, 60, 2)
  2958. dx = 0
  2959. dy = WLH
  2960. self.contents.font.color = system_color
  2961. for i in 0..5
  2962. text = YE::SUBCLASS::MENU_CLASS_CHANGE_PARAM[i]
  2963. icon = YE::SUBCLASS::MENU_CLASS_CHANGE_ICONS[i]
  2964. draw_icon(icon, dx, dy)
  2965. self.contents.draw_text(dx+24, dy, 60, WLH, text, 0)
  2966. dy += WLH
  2967. end
  2968. dx += 80
  2969. dy = WLH
  2970. self.contents.font.color = normal_color
  2971. for i in 0..5
  2972. case i
  2973. when 0
  2974. text = @real.maxhp
  2975. when 1
  2976. text = @real.maxmp
  2977. when 2
  2978. text = @real.atk
  2979. when 3
  2980. text = @real.def
  2981. when 4
  2982. text = @real.spi
  2983. when 5
  2984. text = @real.agi
  2985. end
  2986. self.contents.draw_text(dx, dy, 60, WLH, text, 2)
  2987. dy += WLH
  2988. end
  2989. dx += 60
  2990. dy = 0
  2991. self.contents.font.color = system_color
  2992. if YE::SUBCLASS::MENU_CLASS_CHANGE_USE_ICON
  2993. icon = YE::SUBCLASS::MENU_CLASS_CHANGE_ICON
  2994. for i in 0..6
  2995. draw_icon(icon, dx+3, dy)
  2996. dy += WLH
  2997. end
  2998. else
  2999. text = YE::SUBCLASS::MENU_CLASS_CHANGE_ARROW
  3000. for i in 0..6
  3001. self.contents.draw_text(dx, dy, 30, WLH, text, 1)
  3002. dy += WLH
  3003. end
  3004. end
  3005. return if fake == nil
  3006. dx += 30
  3007. dy = WLH
  3008. draw_actor_class_abbr(fake, dx, 0, 60, 0)
  3009. for i in 0..5
  3010. case i
  3011. when 0
  3012. old = @real.maxhp
  3013. new = fake.maxhp
  3014. when 1
  3015. old = @real.maxmp
  3016. new = fake.maxmp
  3017. when 2
  3018. old = @real.atk
  3019. new = fake.atk
  3020. when 3
  3021. old = @real.def
  3022. new = fake.def
  3023. when 4
  3024. old = @real.spi
  3025. new = fake.spi
  3026. when 5
  3027. old = @real.agi
  3028. new = fake.agi
  3029. end
  3030. self.contents.font.color = new_parameter_color(old, new)
  3031. if YE::SUBCLASS::MENU_CLASS_CHANGE_SDISPLAY == 1
  3032. text = new
  3033. else
  3034. text = sprintf("%+d", new - old)
  3035. end
  3036. self.contents.draw_text(dx, dy, 60, WLH, text, 0)
  3037. dy += WLH
  3038. end
  3039. end
  3040.  
  3041. #--------------------------------------------------------------------------
  3042. # New Parameter Colour
  3043. #--------------------------------------------------------------------------
  3044. def new_parameter_color(old_value, new_value)
  3045. if new_value > old_value
  3046. return power_up_color
  3047. elsif new_value == old_value
  3048. return normal_color
  3049. else
  3050. return power_down_color
  3051. end
  3052. end
  3053.  
  3054. end # End Window Class Change Status
  3055.  
  3056. #===============================================================================
  3057. # Window Learn Skill Status
  3058. #===============================================================================
  3059.  
  3060. class Window_Learn_Skill_Status < Window_Base
  3061.  
  3062. #--------------------------------------------------------------------------
  3063. # initialize
  3064. #--------------------------------------------------------------------------
  3065. def initialize(x, y, actor)
  3066. dh = 416 - y
  3067. super(x, y, 160, dh)
  3068. @actor = actor
  3069. refresh
  3070. end
  3071.  
  3072. #--------------------------------------------------------------------------
  3073. # refresh
  3074. #--------------------------------------------------------------------------
  3075. def refresh(class_id = nil)
  3076. self.contents.clear
  3077. sw = self.width - 32
  3078. dx = (sw / 2) - 48
  3079. dy = 0
  3080. self.contents.draw_text(0, dy, sw, WLH, @actor.name, 1)
  3081. dy += WLH
  3082. draw_actor_face(@actor, dx, dy)
  3083. return if class_id == nil
  3084.  
  3085. dy += WLH * 4
  3086. if YE::SUBCLASS::CLASS_ICONS.include?(class_id) and class_id != nil
  3087. icon = YE::SUBCLASS::CLASS_ICONS[class_id]
  3088. else
  3089. icon = YE::SUBCLASS::CLASS_ICONS[0]
  3090. end
  3091. draw_icon(icon, 0, dy)
  3092. text = $data_classes[class_id].name
  3093. self.contents.draw_text(24, dy, sw-24, WLH, text, 0)
  3094.  
  3095. dy += WLH
  3096. skills_learned = @actor.skills_learned(class_id).size
  3097. if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(class_id)
  3098. skill_size = YE::SUBCLASS::CLASS_SKILL_ALLOW[class_id].size
  3099. if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(class_id)
  3100. skill_size += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[class_id].size
  3101. end
  3102. if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(class_id)
  3103. skill_size += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[class_id].size
  3104. end
  3105. if skills_learned == skill_size
  3106. text = YE::SUBCLASS::LEARN_SKILL_STATUS_ALL
  3107. else
  3108. mastery = skills_learned * 100
  3109. mastery /= skill_size
  3110. text = sprintf(YE::SUBCLASS::LEARN_SKILL_STATUS_LEARNED, mastery)
  3111. end
  3112. self.contents.draw_text(0, dy, sw, WLH, text, 1)
  3113. end
  3114. dy += WLH
  3115. icon = YE::SUBCLASS::JP_ICON
  3116. draw_icon(icon, 0, dy)
  3117. text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(class_id))
  3118. self.contents.draw_text(24, dy, sw-24, WLH, text, 2)
  3119. end
  3120.  
  3121. end # end class Window_Learn_Skill_Status
  3122.  
  3123. #==============================================================================
  3124. # Window_Learn_Skill_Classes
  3125. #==============================================================================
  3126.  
  3127. class Window_Learn_Skill_Classes < Window_Selectable
  3128.  
  3129. #--------------------------------------------------------------------------
  3130. # initialize
  3131. #--------------------------------------------------------------------------
  3132. def initialize(wx, wy, ww, wh, actor)
  3133. super(wx, wy, ww, wh)
  3134. @actor = actor
  3135. @column_max = 1
  3136. self.index = 0
  3137. self.active = false
  3138. refresh
  3139. end
  3140.  
  3141. #--------------------------------------------------------------------------
  3142. # refresh
  3143. #--------------------------------------------------------------------------
  3144. def refresh
  3145. @data = []
  3146. for class_id in @actor.unlocked_classes
  3147. @data.push(class_id)
  3148. end
  3149. @item_max = @data.size
  3150. create_contents
  3151. for i in 0...@item_max
  3152. draw_item(i)
  3153. end
  3154. end
  3155.  
  3156. #--------------------------------------------------------------------------
  3157. # draw item
  3158. #--------------------------------------------------------------------------
  3159. def draw_item(index)
  3160. rect = item_rect(index)
  3161. self.contents.clear_rect(rect)
  3162. iclass = $data_classes[@actor.unlocked_classes[index]]
  3163. if iclass.id != 0
  3164. rect.width -= 4
  3165. if YE::SUBCLASS::CLASS_ICONS.include?(iclass.id)
  3166. icon = YE::SUBCLASS::CLASS_ICONS[iclass.id]
  3167. else
  3168. icon = YE::SUBCLASS::CLASS_ICONS[0]
  3169. end
  3170. draw_icon(icon, rect.x, rect.y)
  3171. dx = rect.x
  3172. dy = rect.y
  3173. dw = rect.width
  3174. dh = rect.height
  3175. self.contents.draw_text(dx+24, dy, 172, dh, iclass.name, 0)
  3176. icon = YE::SUBCLASS::JP_ICON
  3177. draw_icon(icon, rect.width-24, rect.y)
  3178. text = sprintf(YE::SUBCLASS::JP_DEFINITION, @actor.class_jp(iclass.id))
  3179. self.contents.draw_text(dw-104, dy, 80, dh, text, 2)
  3180. end
  3181. end
  3182.  
  3183. end # Window_Learn_Skill_Classes
  3184.  
  3185. #==============================================================================
  3186. # Window_Learn_Skill_List
  3187. #==============================================================================
  3188.  
  3189. class Window_Learn_Skill_List < Window_Selectable
  3190.  
  3191. #--------------------------------------------------------------------------
  3192. # initialize
  3193. #--------------------------------------------------------------------------
  3194. def initialize(window, actor, class_id)
  3195. wx = window.x
  3196. wy = window.y
  3197. ww = window.width
  3198. wh = window.height
  3199. super(wx, wy, ww, wh)
  3200. @actor = actor
  3201. @class_id = class_id
  3202. @column_max = 1
  3203. self.index = 0
  3204. self.active = true
  3205. refresh
  3206. end
  3207.  
  3208. #--------------------------------------------------------------------------
  3209. # refresh
  3210. #--------------------------------------------------------------------------
  3211. def refresh
  3212. @data = []
  3213. if YE::SUBCLASS::CLASS_SKILL_ALLOW.include?(@class_id)
  3214. class_skills = YE::SUBCLASS::CLASS_SKILL_ALLOW[@class_id]
  3215. if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(@class_id)
  3216. class_skills += YE::SUBCLASS::PRIMARY_ONLY_SKILLS[@class_id]
  3217. end
  3218. if YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(@class_id)
  3219. class_skills += YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[@class_id]
  3220. end
  3221. for skill_id in class_skills
  3222. @data.push(skill_id) if $data_skills[skill_id].jp_learn?
  3223. end
  3224. end
  3225. for skill in @actor.skills_learned(@class_id)
  3226. @data.push(skill.id)# unless @data.include?(skill.id)
  3227. end
  3228. @data = @data.uniq
  3229. @data.sort!
  3230. @item_max = @data.size
  3231. create_contents
  3232. for i in 0...@item_max
  3233. draw_item(i)
  3234. end
  3235. end
  3236.  
  3237. #--------------------------------------------------------------------------
  3238. # draw item
  3239. #--------------------------------------------------------------------------
  3240. def draw_item(index)
  3241. skill = $data_skills[@data[index]]
  3242. rect = item_rect(index)
  3243. self.contents.clear_rect(rect)
  3244. rect.width -= 4
  3245. enabled = true
  3246. enabled = false if @actor.skill_learn?(skill)
  3247. enabled = false if skill.require_level >= @actor.level
  3248. enabled = false if skill.jp_cost > @actor.class_jp(@class_id)
  3249. if skill.require_skill == []
  3250. met_skill_requirements = true
  3251. else
  3252. met_skill_requirements = false
  3253. total_met = 0
  3254. reqicon = 0
  3255. for skill_id in skill.require_skill
  3256. if @actor.skill_learn?($data_skills[skill_id])
  3257. total_met += 1
  3258. else
  3259. reqicon = $data_skills[skill_id].icon_index if reqicon == 0
  3260. end
  3261. end
  3262. met_skill_requirements = true if total_met == skill.require_skill.size
  3263. end
  3264. enabled = false unless met_skill_requirements
  3265. dx = rect.x
  3266. dy = rect.y
  3267. dw = rect.width
  3268. dh = rect.height
  3269. sw = self.width - 32
  3270. draw_icon(skill.icon_index, dx, dy, enabled)
  3271. self.contents.font.color.alpha = enabled ? 255 : 128
  3272. self.contents.draw_text(dx+24, dy, 172, dh, skill.name, 0)
  3273.  
  3274. icon = YE::SUBCLASS::JP_ICON
  3275. if YE::SUBCLASS::PRIMARY_ONLY_SKILLS.include?(@class_id) and
  3276. YE::SUBCLASS::PRIMARY_ONLY_SKILLS[@class_id].include?(skill.id)
  3277. icon = YE::SUBCLASS::PRIMARY_ONLY_ICON
  3278. elsif YE::SUBCLASS::SUBCLASS_ONLY_SKILLS.include?(@class_id) and
  3279. YE::SUBCLASS::SUBCLASS_ONLY_SKILLS[@class_id].include?(skill.id)
  3280. icon = YE::SUBCLASS::SUBCLASS_ONLY_ICON
  3281. end
  3282.  
  3283. if @actor.skill_learn?(skill)
  3284. text = YE::SUBCLASS::LEARN_SKILL_SHOP_LEARNED
  3285. elsif skill.require_level >= @actor.level
  3286. text = sprintf(YE::SUBCLASS::REQUIRE_LEVEL, skill.require_level)
  3287. elsif !met_skill_requirements
  3288. text = YE::SUBCLASS::REQUIRE_SKILL
  3289. icon = reqicon
  3290. else
  3291. text = sprintf(YE::SUBCLASS::LEARN_SKILL_SHOP_STRING, skill.jp_cost)
  3292. end
  3293.  
  3294. self.contents.draw_text(dw-104, dy, 80, dh, text, 2)
  3295. draw_icon(icon, dw-24, dy, enabled)
  3296. end
  3297.  
  3298. #--------------------------------------------------------------------------
  3299. # Skill
  3300. #--------------------------------------------------------------------------
  3301. def skill_id
  3302. return @data[self.index]
  3303. end
  3304.  
  3305. #--------------------------------------------------------------------------
  3306. # class_id
  3307. #--------------------------------------------------------------------------
  3308. def class_id
  3309. return @class_id
  3310. end
  3311.  
  3312. #--------------------------------------------------------------------------
  3313. # update help
  3314. #--------------------------------------------------------------------------
  3315. def update_help
  3316. if self.skill_id != nil
  3317. skill = $data_skills[self.skill_id]
  3318. else
  3319. skill = nil
  3320. end
  3321. @help_window.set_text(skill==nil ? "" : skill.description)
  3322. end
  3323.  
  3324. end # Window_Learn_Skill_List
  3325.  
  3326. #===============================================================================
  3327. #
  3328. # END OF FILE
  3329. #
  3330. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement