estriole

EST - SUIKODEN RUNE

Feb 5th, 2013
1,589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 76.46 KB | None | 0 0
  1. =begin
  2. ================================================================================
  3. EST - SUIKODEN RUNE
  4. v3.1
  5.  
  6. Licenses:
  7. Free to use in all project (except the one containing pornography)
  8. as long as i credited (ESTRIOLE).
  9. ================================================================================
  10. Compatibility:
  11. put this script below these script if you're using them:
  12. 1) yanfly equip engine
  13. 2) Tsukihime Effect Manager
  14. 3) yanfly battle command list
  15. in fact this script might compatible with lots of script as long as this put below
  16. it. (let's hope so)
  17.  
  18. --------------------------------------------------------------------------------
  19. Introduction
  20. this make suikoden like equip rune scene mechanism.
  21.  
  22. --------------------------------------------------------------------------------
  23. Feature
  24. 1) suikoden like equip rune mechanism
  25. 2) we can create runes that exclusive to certain actor
  26. 3) we can set starting runes for actor/class/subclass
  27. 4) we can set sealed rune slot for actor/class/subclass
  28. 5) by combining 3) and 4) we got fixed rune in certain slot
  29. 6) can make certain rune only able to equip in certain slot (ex: blue gate only at head slot)
  30. 7) extendable slots (for one who want to use it other than suikoden rune system)
  31.    we can make equipping 'medal', 'artefact', etc whatever you want.
  32. 8) custom rune slot for actor/class/subclass
  33. 7) skill menu CAN be replaced with rune skill menu. it's scene skill but instead of
  34.    choosing stype. it choose rune.
  35. 8) advanced auto rune slot unseal
  36. --------------------------------------------------------------------------------
  37. version history
  38. v.1.0 - 2013.02.02 - finish the script
  39. v.1.1 - 2013.02.03 - compatibility patches. added more feature.
  40. v.1.2 - 2013.02.04 - add battle rune usage mechanism.
  41. v.1.3 - 2013.02.05 - added method to recognize slot name for starting,
  42.                      sealing, set rune, etc. (old method that use index still works too).
  43.                      made custom rune slot each character now possible because of that.
  44. v.1.4 - 2013.02.06 - > fix minor bugs rune window in battle.
  45.                      > fix major bug when having more slots than visible line number.
  46.                      > add manual configuration for in battle rune slot window.
  47.                      the configuration determine how many lines is the window height.
  48.                      why creating that? yes! compatibility for custom battle engine.
  49.                      > add manual configuration for the rune_skill list window in scene rune
  50.                      the configuration determine which window the rune skill window will overlap.
  51.                      the rune skill window will inherit overlapped position and size.
  52.                      then when rune skill window shown the overlapped window will be hidden. vice versa.
  53.                      why creating that? yes! compatibility for other equip engine script.
  54. v.1.5 - 2013.02.06 - >forget modifying the on_actor_ok and on_actor_cancel. fixed
  55.                      >missing @rune_slot_window.deactivate in method on_slot_ok. fixed
  56.                      >fix other canceling issues
  57. v.1.6 - 2013.02.07 - >can use notetags to 'write' the rune skill list window in equip rune scene.
  58.                      useful if you don't want to add the skills via runes (just unlock the skill type).
  59.                      the notetags will determine what the skill to drawn at the rune skill list window.
  60.                      if no notetags it will use default method which 'read' the rune trait box for added skills.
  61.                      >add switch to show the rune command in battle (example you don't want
  62.                      the rune to show at first. and after certain event then the rune command shows.
  63.                      >notetags to seal the rune (greyed). can be used in actor, class, weapon, armor,
  64.                      and states. <rune_seal> :D.
  65. v.1.7 - 2013.02.08 - >fix some errors when still having no subclass (if using yanfly class script)
  66. v.1.8 - 2013.02.12 - >add method to check objects rune or not. for making compatibility patch
  67.                      >added falcao mana stones enchantment compatibility patch
  68.                      >IF you want rune still listed at the falcao mana stones just change the
  69.                      configuration in module ESTRIOLE. LIST_RUNE_IN_FALCAO_MANA_STONE = true
  70. v.1.9 - 2013.02.13 - >inspiration struct me and make me found a way to make
  71.                      compatibility for scene that not supposed to list rune in
  72.                      their list. (example falcao mana stones)
  73.                      >removed the configuration created in v.1.8
  74.                      >add configuration for what scene that not include runes
  75.                      in Game_Actor equips method. so we have both compatibility with
  76.                      1)script that use equips method to do some effect or linked skill
  77.                      2)script that use equips method to list equipment but not supposed to include runes. :D.
  78.                      if you want RUNE to excluded from equip in that scene...
  79.                      then add the scene name in module ESTRIOLE::SCENE_NOT_INCLUDE_RUNE
  80.                      just search this: SCENE_NOT_INCLUDE_RUNE
  81. v.2.0 - 2013.05.16 - >requested by zombiebear. added compatibility patch to
  82.                      Nasty Extra Stat script. now you can make runes which when
  83.                      attached to actor. could give you extra stats.
  84.                      (you need still to modify the window for showing extra stats
  85.                      changes in scene_equip though since this script only reuse what the
  86.                      scene_equip use. that's for compatibility with another equip
  87.                      script...)
  88. v.2.1 - 2013.05.23 - >thanks to detailed bug report from darkro... fix the bug
  89.                      where the skill window not refreshing when accessing it using rune.
  90. v.2.2 - 2013.05.26 - >updated the regexp just to make it the same as notetags grabber
  91.                      because i often copy paste method from this script for the notetag.
  92.                      no effect in this script. since this script don't use '-' and '.'
  93. v.2.3 - 2013.06.11 - >updated the regexp to latest format used in EST - SIMPLE NOTETAGS GRABBER
  94.                    - >Add scene rune skill. it's basically skill scene but selecting
  95.                      rune instead of skill type. there's configuration to make it replace scene_skill.
  96.                      (it will replace the skill menu. so no need to set up any menu script)
  97.                      also the rune item will use the skill type that you ADD at the rune...
  98.                      to determine what skills that can be selected...
  99.                      it will use the first skill type you add at the trait box of the rune (armor)
  100. v.2.4 - 2013.06.12 - >last update made some type to the manual rune skill notetags. fixed it
  101.                    - >update the sealed rune slots feature. now equip and state can seal the rune slot.
  102.                    - >now we can add new runeslots in game see how to use section
  103.                    - >now we can remove runeslots in game see how to use section
  104.                    - >script call to switch from skill menu mode or rune skill menu mode
  105.                      in game see how to use section
  106. v.2.5 - 2013.06.21 - >minor silly bugfix which caused this script can't work without yanfly equip engine.
  107. v.2.6 - 2013.07.02 - >add Scene_RuneShop. it's the same with Scene_Rune except it have cost to attach / remove
  108.                       i decide to separate the scene in case someone want the no cost equip rune feature.
  109.                      >fix skill mode not able to togle
  110. v.2.7 - 2013.07.27 - > add patch and configuration to AUTOMATICALLY add the menu command to
  111.                       menu if using YANFLY MENU ENGINE script. you can choose which command to add
  112.                       (3 possible menu - rune skill, rune attach, rune shop)
  113.                       automatically disable hijack scene_skill feature if the rune_skill is added in menu
  114. v.2.8 - 2013.11.12 - > fix regexp multiline mode. so it won't go over the next regexp
  115.                      > rework the seal slot method to EVENT seal slot.
  116.                      > add EVENT unseal slot method
  117.                      both EVENT seal and unseal will override ANY seal/unseal.
  118.                      this is your last modification to rune_slots.
  119.                      > add auto unseal rune slot notetags. now when certain requirement met
  120.                      it will automatically unseal the slot. UNLESS SEALED BY EVENT!!!!
  121.                      how to use it? Search WHAT'S NEW IN V.2.8
  122. v.2.9 - 2013.11.15 - > ADD(not replace) new notetags format for custom_rune and sealed rune slot.
  123.                      old notetags have problem recognizing > as runeslot name. so if
  124.                      you put: ">Fire" it won't be recognized. old notetags STILL can be USED!!!
  125.                      i make it that way so if people already using old format and
  126.                      have like 108 character... they won't have to change anything.
  127.                      new notetags format:
  128.                      <custom_rune>
  129.                      "a:","b:","c:",
  130.                      ">Fire:", "Etc"
  131.                      </custom_rune>
  132.                      <sealed_rune_slot>
  133.                      ">Fire:", 0
  134.                      </sealed_rune_slot>
  135.                      if new notetags format exist. this script will IGNORE old format notetags!!!
  136.                      
  137.                      > rework the code a little bit so auto unseal runeslot notetags
  138.                      could support slot index without putting it to ""
  139.                      before:
  140.                      <auto_unseal_rune_slot>
  141.                       "0" => "p.gold > 1000",
  142.                       1 => "p.gold > 100000"
  143.                      </auto_unseal_rune_slot>
  144.                      will only have auto unseal first slot (0). now both works!
  145. v.3.0 - 2013.11.17 - > choose the actor when selecting rune skill/rune attach/rune shop from menu
  146.                      ONLY IF using yanfly menu script!!!                    
  147. v.3.1 - 2013.11.26 - > compatibility patch to Formar ATB/Stamina script.
  148.                      make sure to put my script BELOW Formar ATB/Stamina script
  149.                        
  150. --------------------------------------------------------------------------------
  151. How to use:
  152. 1) create the 'rune' and set the actor who can equip them
  153. ================================================================================
  154. -> rune is basically armor. set it with any armor type you want (remember armor type NOT equipment type)
  155. (if you're confused... armor type located ABOVE the equipment type in the database armor)
  156. but it's better to use new one instead of using General Armor, Magic Armor that comes
  157. with the default database. then make sure give your actors ability to equip that armor type
  158.  
  159. example: we create armor type "Rune" and armor type "Only Ted Rune"
  160. then we set armor 1 named Fire Rune with that armor type "Rune"
  161. then we set armor 2 named Water Rune with that armor type "Rune"
  162. then we set armor 3 named Soul Eater Rune with that armor type "Only Ted Rune"
  163. then we set actor 1 named Eric to able to equip armor type "Rune" (trait box)
  164. then we set actor 2 named Ted to able to equip armor type "Rune" and armor type "Only Ted Rune"
  165. thus eric able to equip fire and water rune. but cannot equip soul eater rune.
  166. while ted able to equip fire, water, and soul eater rune.
  167. so we can make runes exclusive to certain actors
  168.  
  169. -> second step is give that armor notetags
  170. <equip type: Rune>
  171.  
  172. this to set the armor etype (not atype like above setting). and make it recognizeable
  173. as 'rune'.
  174. basically armor type(step above) is set to allow which actor can equip the rune
  175. and equipment type is set to make the armor recognizeable as rune in the first place.
  176.  
  177. ================================================================================
  178.  
  179. 2) in trait box. give parameter increase, skills, and skill types to 'runes'
  180. ================================================================================
  181. -> just use database armor trait box. you could add stat increase/skill/whatever supported
  182. -> for skill added. it will be shown in the rune scene.
  183.    if using yanfly equip engine support for 4 skill MAX. if using default support 5 skill MAX
  184.    since i do some lookup at the trait box and make the first added skill
  185.    i found as lv 1, second as lv 2, etc. so basically just put the skill add in right
  186.    order. lower level skill is at the higher position in the trait box.
  187. -> ADD trait to give actor the CORRECT SKILL TYPE in the 'rune'
  188.    i made the script read the trait box to make it used for scene_battle rune command.
  189.    so if the rune didn't give any skill type then the rune's skill is unusable in battle
  190.    (shown but will be greyed out and cannot be used)
  191.    unless you add the trait using another equipment/class/actor trait box. but
  192.    that defeat the purpose of using rune in battle.
  193.    the skill type added search function also will return the first skill type added.
  194.    so if you added 2 skill type added in that rune. in battle when you choose that rune. it will
  195.    open skill window with the upper skill type in the trait box.
  196.    'rune' added skill type command also won't be shown in actor command in battle.
  197.    it will only accessible via rune command. in case you want your actor able
  198.    to access skill via other means other than runes... it's better that you didn't give
  199.    the actor SAME skill type as what the rune gives (via class, equipment, etc)
  200.    since it will delete the skill type command.
  201.    ex: Earth rune give skill type "Earth Magic".
  202.        Eric equip Earth Sword which give "Earth Magic".
  203.        then Eric can use the earth magic but only accessible using rune command.
  204.        usual "Earth Magic" command will not shown.
  205.    ex2:Earth rune give skill type "Earth Magic"
  206.        Eric Equip Earth Sword which give "Earth Sword Magic" (different stype)
  207.        then Eric can use "Earth Magic" from rune command
  208.        while the usual "Earth Sword Magic" command is shown and Eric able to access it
  209.    
  210. ================================================================================
  211.          
  212. 3) Add the runes to inventory :D. either by event command change armor or giving
  213.    it as monster drop.
  214.  
  215. ================================================================================  
  216.    
  217. 4) call the scene:
  218. SceneManager.call(Scene_Rune)
  219. i didn't add menu feature yet since in suikoden you CANNOT access this scene from menu.
  220. you need to visit runemaster :D. but you could easily add it if you're using yanfly menu script.
  221.  
  222. SceneManager.call(Scene_RuneShop)
  223. call this scene if you want it as rune shop (require cost to attach/remove)
  224. you can search HOW TO DEFINE ATTACH / REMOVE COST to learn how to set the notetags
  225.  
  226. # NOW there's a configuration to auto add those scenes (and rune skill) to menu
  227. if using yanfly menu engine. CHEERS!!!
  228.  
  229. ================================================================================
  230.  
  231. 5) profit $$$
  232.  
  233. ================================================================================
  234.    
  235. 6) extra features:
  236.  
  237. ================================================================================
  238.  
  239.                       ACTOR/CLASS/SUBCLASS NOTETAGS
  240.  
  241. ================================================================================
  242.  
  243. ->ADD STARTING RUNE to character. there's two method. one is using slot index.
  244. other using slot name.
  245. first method: add notetags in actor/class/subclass
  246.  
  247. <start_rune_x: y>
  248. x => rune slot (start at 0. first one is 0, second one is 1, etc)
  249. y => rune id (if the rune id armor is not a 'rune' then it won't equip the rune)
  250.  
  251. ex: <start_rune_0: 55>
  252. will add rune 55 (if rune) in slot 0 (first slot)
  253.  
  254. second method: add notetags in actor/class/subclass
  255. <start_rune_"x": y>
  256. x => rune slot name. CASE SENSITIVE!!!!. it's put inside "".
  257. y => rune id (if the rune id armor is not a 'rune' then it won't equip the rune)
  258.  
  259. ex: <start_rune_"Lh:": 55>
  260. will add rune 55 (if rune) in slot named "Lh:" if slot named that exist
  261.  
  262. ================================================================================
  263.  
  264. -> to give certain actor custom rune slot
  265. old notetags... still working but will ignore > as rune slot name
  266. <custom_rune: "a:","b:","c:","d:",">ex:">
  267. will make actor tagged with that to have runeslot:
  268. a:
  269. b:
  270. c:
  271. d:
  272. you can add more string to increase rune slot number.
  273.  
  274. NEW NOTETAGS FORMAT from v2.9. now will recognize > as rune slot name
  275. if the new notetags format exist... old format will be ignored.
  276. <custom_rune>
  277. "a:","b:","c:","d:",">ex:"
  278. </custom_rune>
  279. will make actor tagged with that to have runeslot:
  280. a:
  281. b:
  282. c:
  283. d:
  284. >ex:
  285.  
  286. ================================================================================
  287.  
  288.                ACTOR/CLASS/SUBCLASS/WEAPON/ARMOR/STATE NOTETAGS
  289.  
  290. ================================================================================
  291.  
  292. ->to seal rune slot (cannot be modified):
  293. add notetags in actor/class/subclass
  294. <sealed_rune_slot: x, y, z>
  295. x y z is the id of rune slot (starting at 0)
  296. x y z can also be rune slot name but need to put inside "". and CASE SENSITIVE!!!!
  297.  
  298. ex: <sealed_rune_slot: 0, "H :", 2>
  299. will make rune slot 0 (the first one), slot named "H :", slot 2(third one)
  300. cannot be modified. useful make fixed rune.
  301. to make it fixed rune just set the starting rune for that character then seal it
  302.  
  303. NEW NOTETAGS FORMAT from v2.9. now will recognize > as rune slot name
  304. if the new notetags format exist... old format will be ignored.
  305. <sealed_rune_slot>
  306. x, y, z
  307. </sealed_rune_slot>
  308. ex:
  309. <sealed_rune_slot>
  310. 0, "H :", "2"
  311. </sealed_rune_slot>
  312. will make rune slot 0 (the first one), slot named "H :", third slot(index 2)
  313. cannot be modified. useful make fixed rune.
  314.  
  315. --------------------------------------------------------------------------------
  316.  
  317. -> UNSEAL the runeslot if the condition met from notetags in actor/class/subclass/equipment/state
  318. <auto_unseal_rune_slot>
  319. "SLOTNAME" => "REQUIREMENT",
  320. "SLOTNAME" => "REQUIREMENT",
  321. "SLOTNAME" => "REQUIREMENT",
  322. "SLOTNAME" => "REQUIREMENT",
  323. "SLOTNAME" => "REQUIREMENT",
  324. </auto_unseal_rune_slot>
  325.  
  326. SLOTNAME = name of the slot (or index of the slot). NEED TO PUT INSIDE ""
  327. REQUIREMENT = the requirement when the slot unsealed automatically.
  328. you can use any method inside Game_Actor class such as:
  329. level, atk, agi
  330. and i also add some shortcut variables to make the requirement shorter:
  331. ------------><-----------------------
  332.       s = $game_switches
  333.       v = $game_variables
  334.       p = $game_party
  335.       a = $game_actors
  336.       gs = $game_system
  337.       pt = $game_system.playtime
  338.       bc = $game_system.battle_count
  339.       sc = $game_system.save_count
  340. ------------><-----------------------
  341. ex:
  342. <auto_unseal_rune_slot>
  343. "Head" => "level > 10 && sc > 10",
  344. "Lips" => "agi > 400 || bc > 10",
  345. "0" => "p.gold > 1000",
  346. 1 => "p.gold > 100000"
  347. </auto_unseal_rune_slot>
  348. will automatically unseal the:
  349. "Head" slot if actor level > 10 AND save count > 10
  350. "Lips" slot if actor agi > 400 OR battle count > 10
  351. first slot if party gold > 1000
  352. second slot if party gold > 100000
  353. #notice that you could use slot index and slot index in quotes. it's new feature
  354. from v2.9
  355.  
  356. ================================================================================
  357.  
  358. now you can seal the actor from using runes in battle (command greyed). just give notetags to database object.
  359. <rune_seal>
  360.  
  361. if given to actor then the actor won't able to use rune command. (people without magic capability?)
  362. if given to class then every actor with that class cannot use rune. (class that cannot use rune?)
  363. if given to equip then if actor equip that weapon/armor then cannot use rune (cursed weapon, armor, etc?)
  364. if given to state then every actor that have that state cannot use rune.
  365.  
  366. using states... you can create mother earth skill which prevent all allies and
  367. all enemies to use rune for 3 turns.
  368.  
  369. ================================================================================
  370.  
  371.                        RUNE(ARMOR) NOTETAGS
  372.  
  373. ================================================================================
  374.  
  375. ->to specify certain rune only able to equipped in certain slot.
  376. i provide two way:
  377. a> set the forbidden slot for that rune. give notetags to the armor:
  378.  
  379. <forbidden_rune_slots: x, y, z>
  380. x y z is the id of the rune slot the rune NOT allowed to shown on the list. slot start at 0
  381. x y z can also be rune slot name but need to put inside "". and CASE SENSITIVE!!!!
  382.  
  383. ex: <forbidden_rune_slots: 0, "Rh:">
  384.  
  385. will make that rune(armor) not shown in runeslot 0 (first) and runeslot named "Rh:"
  386. but will appear in all other slot available
  387.  
  388. b> the other way is to set what slot that rune is ALLOWED to appear (reverse of no 1)
  389.  
  390. <only_rune_slots: x, y, z>
  391. x y z is the id of the rune slot that the rune IS allowed to shown on the list. slot start at 0
  392. x y z can also be rune slot name but need to put inside "". and CASE SENSITIVE!!!!
  393.  
  394. ex: <only_rune_slots: 0, "Lh:">
  395.  
  396. will make that rune(armor) only shown in runeslot 0 (first) and runeslot named "Lh:"
  397. but will NOT appear in all other slot available
  398.  
  399. ================================================================================
  400.  
  401. If you're adding the skill via other way than runes (in class maybe. for setting level the skill can be used).
  402. and use runes only to unlock the skill type. but you still want to show some rune skill in windows.
  403. you could add these notetags to the rune(Armor).
  404.  
  405. <rune_skills: a, b, c, d >
  406. a b c d = id of the skills.
  407. ex:
  408. <rune_skills: 33, 42, 21 >
  409. will shown on window rune skill list like this:
  410. Lv1: skill 33
  411. Lv2: skill 42
  412. Lv3: skill 21
  413.  
  414. if you're adding this notetags it will use this notetags value to determine what
  415. to show in the rune skill list window. if not given notetags, it will use previous method.
  416. 'read' the rune trait box and search for added skills feature.
  417.  
  418. ================================================================================
  419. HOW TO DEFINE ATTACH / REMOVE COST
  420.  
  421. add cost to attaching or removing rune. give notetags to armor item:
  422. <rune_attach_cost: x>
  423. <rune_remove_cost: x>
  424. change x to price you want
  425. if item not given notetags it will use the default cost defined in ESTRIOLE module
  426.  
  427. ================================================================================
  428.  
  429. 7) in game modification (for event, etc)
  430.  
  431. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  432.  
  433. ->to give rune to certain slot for actor
  434. script call:
  435.  
  436. actor_set_rune(actor_id,rune_slot,rune_id,swap_inventory = false)
  437.  
  438. actor_id => id of the actor in database
  439. rune_slot => slot position (first one is 0, second is 1, etc)
  440.              or slot name inside "". CASE SENSITIVE!!!
  441. rune_id => rune id (armor id in database). i also made check to return if it's not a 'rune'
  442. swap_inventory => true : will equip the inventory rune instead of giving free runes. if didn't have it then do nothing
  443.                   false: will give free rune and set it to the slot
  444.                   default is set to false
  445. ex: actor_set_rune(1,0,56)
  446. will give rune 56 for free(if rune). then attach it to runeslot 0 (first slot)
  447. for actor 1.
  448. ex: actor_set_rune(1,"Rh:",56,true)
  449. will searh rune 56 in inventory. if exist.. attach it to runeslot named "Rh:"
  450. for actor 1
  451.  
  452. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  453.  
  454. ->to seal(cannot change) certain slot for actor
  455. script call:
  456.  
  457. actor_seal_rune(actor_id,rune_slot)
  458. actor_id => id of the actor in database
  459. rune_slot => slot position (first one is 0, second is 1, etc)
  460.              or slot name inside "". CASE SENSITIVE!!!
  461.  
  462. ex: actor_seal_rune(1,2)
  463. will seal actor 1's rune slot 2 (third slot).
  464. ex: actor_seal_rune(1,"H :")
  465. will seal actor 1's rune slot named "H :".
  466.  
  467. ->to unseal(can change) certain slot for actor
  468. script call:
  469.  
  470. actor_unseal_rune(actor_id,rune_slot)
  471. actor_id => id of the actor in database
  472. rune_slot => slot position (first one is 0, second is 1, etc)
  473.              or slot name inside "". CASE SENSITIVE!!!
  474.  
  475. ex: actor_unseal_rune(1,2)
  476. will unseal actor 1's rune slot 2 (third slot).
  477. ex: actor_unseal_rune(1,"H :")
  478. will unseal actor 1's rune slot named "H :".
  479.  
  480. UNSEAL will have more priority over SEAL...
  481.  
  482. THESE SEAL AND UNSEAL METHOD WILL OVERRIDE ANY ACTOR / CLASS / EQUIP / STATE
  483. this is your final modification to your rune slot seal / unseal.
  484.  
  485. -> if you want to reset it using actor/class/equip/state seal/unseal.
  486. use these script call:
  487.  
  488. actor_reset_seal(actor_id, rune_slot)
  489. actor_id => change to actor id you want to reset the seal
  490. rune_slot => name of the slot that want to use default seal method
  491.              if this not spefified then reset all slots
  492.  
  493.  
  494. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  495.  
  496. ->to add new rune slot
  497. script call:
  498.  
  499. add_rune_slot(actor_id,rune_slot_name,pos,allow_duplicate, rune_id)
  500. actor_id => id of the actor in database *required
  501. rune_slot_name => the new rune slot name *required
  502. pos => position of the slots (1 is the first slot, 2 is 2nd slot, etc, 0 means put as the last slot)
  503.        *optional. if not set it will use 0 (last slot)
  504. allow_duplicate => if true will add the slot even there's already slot with same name
  505.                    if false will not add the slot when there's already slot with same name
  506.                    *optional. if not set it will use true (allow duplicated slot name)
  507. rune_id => if you want the new slot auto set with rune. add the rune id here
  508.            *optional. if not set it will use nil (none)
  509.  
  510.  
  511. example:
  512. add_rune_slot(3,"Tail",0,false,67)
  513. will add actor 3 slot named "Tail". not allowing duplicate. will set armor 67 as rune on that slot
  514. (if it's a rune)
  515.  
  516. ->to remove rune slot
  517. script call:
  518.  
  519. rem_rune_slot(actor_id,slot_name,put_item_to_bag)
  520. actor_id => id of the actor in database *required
  521. slot_name => name of the slot to removed *required *case sensitive
  522. put_item_to_bag => true -> put equipped rune to bag
  523.                    false -> delete the equipped rune
  524.                    *optional. if not set it will use true (put item to bag)
  525.  
  526.                    
  527. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  528.  
  529. ->to change skill mode
  530.                    
  531. $game_system.rune_skill_mode = true/false
  532.  
  533. true -> will use Scene_MenuRune when choosing skill from menu
  534. false -> will use Scene_Skill when choosing skill from menu
  535.  
  536. ================================================================================                  
  537.  
  538. WHAT'S NEW IN V.2.8
  539.  
  540. ================================================================================
  541.  
  542. now we have more advanced rune slot seal and unseal method. here's the order
  543. the seal implemented: (the lower number overriden by higher number)
  544.  
  545. 1) SEAL the runeslot from notetags in actor/class/subclass/equipment/state
  546. <sealed_rune_slot: x, y, z>
  547. ex:
  548. <sealed_rune_slot: 0, "Lips", "Head">
  549. it will seal the first slot, slot named "Lips", and slot named "Head"
  550.  
  551. 2) UNSEAL the runeslot if the condition met from notetags in actor/class/subclass/equipment/state
  552. <auto_unseal_rune_slot>
  553. "SLOTNAME" => "REQUIREMENT",
  554. "SLOTNAME" => "REQUIREMENT",
  555. "SLOTNAME" => "REQUIREMENT",
  556. "SLOTNAME" => "REQUIREMENT",
  557. "SLOTNAME" => "REQUIREMENT",
  558. </auto_unseal_rune_slot>
  559.  
  560. SLOTNAME = name of the slot (or index of the slot). NEED TO PUT INSIDE ""
  561. REQUIREMENT = the requirement when the slot unsealed automatically.
  562. you can use any method inside Game_Actor class such as:
  563. level, atk, agi
  564. and i also add some shortcut variables to make the requirement shorter:
  565. ------------><-----------------------
  566.       s = $game_switches
  567.       v = $game_variables
  568.       p = $game_party
  569.       a = $game_actors
  570.       gs = $game_system
  571.       pt = $game_system.playtime
  572.       bc = $game_system.battle_count
  573.       sc = $game_system.save_count
  574. ------------><-----------------------
  575. ex:
  576. <auto_unseal_rune_slot>
  577. "Head" => "level > 10 && sc > 10",
  578. "Lips" => "agi > 400 || bc > 10",
  579. "0" => "p.gold > 1000",
  580. 1 => "p.gold > 100000"
  581. </auto_unseal_rune_slot>
  582. will automatically unseal the:
  583. "Head" slot if actor level > 10 AND save count > 10
  584. "Lips" slot if actor agi > 400 OR battle count > 10
  585. first slot if party gold > 1000
  586. second slot if party gold > 100000
  587. #notice that you could use slot index and slot index in quotes.
  588.  
  589. 3) SEAL the runeslot from event using script call:
  590. ->to seal(cannot change) certain slot for actor
  591. script call:
  592.  
  593. actor_seal_rune(actor_id,rune_slot)
  594. actor_id => id of the actor in database
  595. rune_slot => slot position (first one is 0, second is 1, etc)
  596.              or slot name inside "". CASE SENSITIVE!!!
  597.  
  598. ex: actor_seal_rune(1,2)
  599. will seal actor 1's rune slot 2 (third slot).
  600. ex: actor_seal_rune(1,"H :")
  601. will seal actor 1's rune slot named "H :".
  602.  
  603. 4) UNSEAL the runeslot from event using script call:
  604. ->to unseal(can change) certain slot for actor
  605. script call:
  606.  
  607. actor_unseal_rune(actor_id,rune_slot)
  608. actor_id => id of the actor in database
  609. rune_slot => slot position (first one is 0, second is 1, etc)
  610.              or slot name inside "". CASE SENSITIVE!!!
  611.  
  612. ex: actor_unseal_rune(1,2)
  613. will unseal actor 1's rune slot 2 (third slot).
  614. ex: actor_unseal_rune(1,"H :")
  615. will unseal actor 1's rune slot named "H :".
  616.  
  617. SO BASICALLY 4> override 3> override 2> override 1>
  618.  
  619. and 3> and 4> is the final modification to the runeslot. since we might want
  620. to create event where we want the certain slot SEALED no matter what.
  621.  
  622. Note: if you want to reset event seal.
  623. use these script call:
  624.  
  625. actor_reset_seal(actor_id, rune_slot)
  626. actor_id => change to actor id you want to reset the seal
  627. rune_slot => name of the slot that want to use default seal method
  628.              if this not spefified then reset all slots
  629.                
  630. ================================================================================
  631.  
  632. Author Note
  633.  
  634. ================================================================================
  635.  
  636. None
  637.  
  638. ================================================================================
  639. =end
  640.  
  641. $imported = {} if $imported.nil?
  642. $imported["EST - SUIKODEN RUNE"] = true
  643.  
  644. module ESTRIOLE
  645. ################ START CONFIGURATION ###########################################
  646.    
  647.   RUNE_SLOT_ID = 101            #give this etype_id that don't conflict with yanfly equip engine setting you set
  648.   RUNE_SKILL_LIST_POINTER = "â–º" #change this to "-" if you have custom font issues
  649.   RUNE_SLOT_SPACE = 50          #size of the rune slot name. raise this if you use longer slot name
  650.   RUNE_REMOVE_EQUIP_ICON = 185  #set this if you're NOT using yanfly equip engine
  651.   RUNE_NOTHING_ICON = 185       #set this if you're NOT using yanfly equip engine
  652.  
  653.   #RUNE COST RELATED
  654.   RUNE_DEFAULT_ATTACH_COST = 1000
  655.   RUNE_DEFAULT_REMOVE_COST = 500
  656.  
  657.   # you could set the default rune slot below.
  658.   RUNE_SLOT_NAME = ["H :","Lh:","Rh:"]
  659.   # you can add more slot just by adding above array new string
  660.   # if you want custom slot each actor just give notetags (see how to use)
  661.    
  662.   ### RUNE COMMAND IN MENU RELATED ###########################################  
  663.   RUNE_REPLACE_SKILL_MENU = true
  664.   # if you set above to true it will replace skill menu to rune skill menu
  665.   # if set to false it will use default skill menu. and if you want to call
  666.   # rune skill menu you must call it with: SceneManager.call(Scene_MenuRune)
  667.  
  668.   # ADD the "SCENE" that it's game_actor equips method not included runes in it BELOW.
  669.   # Warning PUT THE SCENE NAME IN STRING!!!!. i make it string for better compatibility
  670.   SCENE_NOT_INCLUDE_RUNE = [#do not touch this line
  671.   "Scene_ManaStones",
  672.   "Scene_Party",
  673.   ]#do not touch this line
  674.   # DON'T Forget the ,(coma) after each scene name.
  675.   # the "SCENE" child class WILL still include runes.
  676.   # ex: Scene_Equip < Scene_MenuBase
  677.   # if you put "Scene_MenuBase" in array above. then Scene_Equip still have runes
  678.   # returned from game_actor equips method. to make it not using runes add "Scene_Equip".
  679.   # it's better to NEVER ADD "Scene_Rune" in above array. add that at your own RISK!
  680.  
  681.   ### AUTO ADD IN YANFLY MENU ENGINE CONFIG ####################################
  682.   #change the display name to what you want as menu name
  683.     EST_RUNE_CUSTOM_COMMAND = {
  684.   #                      ["Display Name", EnableSwitch, ShowSwitch,      Handler Method],
  685.     :est_rune_skill   => [  "Rune Skill",     0,          0, :command_est_rune_skill],
  686.     :est_rune_attach  => [  "Rune Attach",    0,          0, :command_est_rune_attach],
  687.     :est_rune_shop    => [  "Rune Shop",      0,          0, :command_est_rune_shop],
  688.   } # <- Do not delete.
  689.  
  690.   ### set to true if you want to auto add the menu if using yanfly menu engine
  691.   ADD_EST_RUNE_SKILL = true
  692.   ADD_EST_RUNE_ATTACH = true
  693.   ADD_EST_RUNE_SHOP = true
  694.  
  695.   ### the position of the menu (0 is the first)
  696.   EST_RUNE_SKILL_POS = 3
  697.   EST_RUNE_ATTACH_POS = 4
  698.   EST_RUNE_SHOP_POS = 5
  699.    
  700.   ### RUNE COMMAND IN BATTLE RELATED ###########################################
  701.   RUNE_BATTLE_SHOW_SWITCH = 0     #switch if on will show rune command. if off rune command is not shown.
  702.                                   #if you don't want to use it change it to 0
  703.   RUNE_BATTLE_DISABLED_SWITCH = 0 #switch if on all actor will not able to access rune in battle (greyed)
  704.                                   #if you don't want to use it change it to 0
  705.   RUNE_VOCAB = "Rune"             #this what shown in battle command
  706.   RUNE_COMMAND_POSITION = 2       #default 2nd slot (below attack)
  707.   RUNE_BATTLE_WINDOW = {
  708.   :x => 0,                        # set x of the rune in battle window
  709.   :y => 0,                        # set y of the rune in battle window
  710.   :w => 250,                      # set width of the rune in battle window
  711.   :slots => 3,                    # number of slots space for the window
  712.   }
  713.  
  714.   ##############################################################################
  715.   # DO NOT TOUCH BELOW IF YOU'RE USING EITHER YANFLY EQUIP ENGINE OR DEFAULT EQUIP ENGINE
  716.   # change this hash below ONLY if you have compatibility with your equip scene script.
  717.   #-----------------------------------------------------------------------------
  718.   RUNE_SKILL_LIST_SETTING = {
  719.   :overlap_window => "@slot_window",  
  720.   #change above to window name(in "") you want the @rune_skill_window to overlap
  721.   #the @rune_skill_window will positioned and sized just like the overlapped window
  722.   #then the overlapped window will also hidden when @rune_skill_window shown
  723.   }
  724.   #above is SET for default equip system. don't change it if you're not using equip scene script.
  725.   #if using yanfly equip engine above ALL above settings is ignored!!! and will use yanfly setting instead  
  726.  
  727.   ### do not edit below this unless you know what you're doing
  728.   if $imported["YEA-AceMenuEngine"]  
  729.   RUNE_REPLACE_SKILL_MENU = false if ADD_EST_RUNE_SKILL
  730.   YEA::MENU::CUSTOM_COMMANDS.merge!(EST_RUNE_CUSTOM_COMMAND)
  731.   YEA::MENU::COMMANDS.insert(EST_RUNE_SKILL_POS,:est_rune_skill) if ADD_EST_RUNE_SKILL
  732.   YEA::MENU::COMMANDS.insert(EST_RUNE_ATTACH_POS,:est_rune_attach) if ADD_EST_RUNE_ATTACH
  733.   YEA::MENU::COMMANDS.insert(EST_RUNE_SHOP_POS,:est_rune_shop) if ADD_EST_RUNE_SHOP
  734.   end
  735.   ### do not edit this  
  736.  
  737. ################# END CONFIGURATION ############################################
  738. end
  739.  
  740. if $imported["YEA-AceEquipEngine"]
  741.   module YEA
  742.     module EQUIP
  743.       RUNE_TYPES ={
  744.       # TypeID => ["Type Name", Removable?, Optimize?],
  745.         "#{ESTRIOLE::RUNE_SLOT_ID}".to_i => [ESTRIOLE::RUNE_VOCAB, true, false],
  746.       } # Do not remove this.    
  747.       TYPES.merge!(RUNE_TYPES)
  748.     end
  749.   end
  750. end
  751.  
  752. if !$imported["YEA-AceEquipEngine"]
  753.   module Icon  
  754.     def self.remove_equip; return ESTRIOLE::RUNE_REMOVE_EQUIP_ICON; end
  755.     def self.nothing_equip; return ESTRIOLE::RUNE_NOTHING_ICON; end
  756.   end # Icon
  757. end
  758.  
  759. module SceneManager
  760.   def self.scene_any?(array_scene)
  761.     array_scene.each {|scene_class|
  762.       return true if @scene.class.to_s == scene_class.to_s
  763.     }
  764.     return false
  765.   end
  766. end
  767.  
  768. class RPG::BaseItem
  769.   def old_sealed_rune_slots
  770.     return [] if !note[/<sealed_rune_slot:([^>]*)>/im]
  771.     a = note[/<sealed_rune_slot:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  772.     return noteargs = a        
  773.   end
  774.  
  775.   def sealed_rune_slots
  776.     return old_sealed_rune_slots if !note[/<sealed_rune_slots?>(?:[^<]|<[^\/])*<\/sealed_rune_slots?>/i]
  777.     a = note[/<sealed_rune_slots?>(?:[^<]|<[^\/])*<\/sealed_rune_slots?>/i].scan(/(?:!<sealed_rune_slots?>|(.*)\r)/)
  778.     a.delete_at(0)    
  779.     a = a.join("\r\n")
  780.     return noteargs = eval("[#{a}]") rescue []
  781.   end
  782.   def auto_unseal_rune_slot
  783.     return {} if !note[/<auto_unseal_rune_slot?>(?:[^<]|<[^\/])*<\/auto_unseal_rune_slot?>/i]
  784.     a = note[/<auto_unseal_rune_slot?>(?:[^<]|<[^\/])*<\/auto_unseal_rune_slot?>/i].scan(/(?:!<auto_unseal_rune_slot?>|(.*)\r)/)
  785.     a.delete_at(0)    
  786.     a = a.join("\r\n")
  787.     return noteargs = eval("{#{a}}") rescue {}
  788.   end
  789.   def starting_rune(index)
  790.     return [] if !note[/<start_rune_#{index}:([^>]*)>/im]
  791.     a = note[/<start_rune_#{index}:(.*)>/im].scan(/:([^>]*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  792.     a.collect!{|x| x.to_i}
  793.     return noteargs = a        
  794.   end
  795.   def starting_rune_ex(slot_name)
  796.     return [] if !note[/<start_rune_"#{slot_name}":([^>]*)>/im]
  797.     a = note[/<start_rune_"#{slot_name}":([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  798.     a.collect!{|x| x.to_i}
  799.     return noteargs = a        
  800.   end
  801.   def custom_rune
  802.     return old_custom_rune if !note[/<custom_rune?>(?:[^<]|<[^\/])*<\/custom_rune?>/i]
  803.     a = note[/<custom_rune?>(?:[^<]|<[^\/])*<\/custom_rune?>/i].scan(/(?:!<custom_rune?>|(.*)\r)/)
  804.     a.delete_at(0)    
  805.     a = a.join("\r\n")
  806.     return noteargs = eval("[#{a}]") rescue []    
  807.   end
  808.   def old_custom_rune
  809.     return [] if !note[/<custom_rune:([^>]*)>/im]
  810.     a = note[/<custom_rune:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  811.     return noteargs = a        
  812.   end
  813.   def rune_seal?
  814.     return false if !note[/<rune_seal>/im]
  815.     return true if note[/<rune_seal>/im]
  816.   end
  817.   def rune?
  818.     return false if !note[/<equip type:([^>]*)>/im]
  819.     a = note[/<equip type:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  820.     etype = a[0][/rune/im] ? ESTRIOLE::RUNE_SLOT_ID : a[0].to_i
  821.     return true if etype == ESTRIOLE::RUNE_SLOT_ID && self.is_a?(RPG::Armor)
  822.     return false
  823.   end
  824. end
  825.  
  826. class RPG::Armor < RPG::EquipItem
  827.   def forbidden_rune_slots
  828.     return [] if !note[/<forbidden_rune_slots:([^>]*)>/im]
  829.     a = note[/<forbidden_rune_slots:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  830.     return noteargs = a        
  831.   end
  832.   def only_rune_slots
  833.     return [] if !note[/<only_rune_slots:([^>]*)>/im]
  834.     a = note[/<only_rune_slots:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  835.     return noteargs = a        
  836.   end
  837.   def manual_rune_skills
  838.     return nil if !note[/<rune_skills:([^>]*)>/im]
  839.     a = note[/<rune_skills:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  840.     a.collect!{|x| x.to_i}
  841.     return noteargs = a        
  842.   end  
  843.   def rune_attach_cost
  844.     return ESTRIOLE::RUNE_DEFAULT_ATTACH_COST if !note[/<rune_attach_cost:([^>]*)>/im]
  845.     a = note[/<rune_attach_cost:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  846.     return noteargs = a[0].to_i    
  847.   end
  848.   def rune_remove_cost
  849.     return ESTRIOLE::RUNE_DEFAULT_REMOVE_COST if !note[/<rune_remove_cost:([^>]*)>/im]
  850.     a = note[/<rune_remove_cost:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  851.     return noteargs = a[0].to_i        
  852.   end
  853.  
  854.   if !$imported["YEA-AceEquipEngine"]
  855.     def etype_id
  856.       custom_etype = get_custom_etype
  857.       return custom_etype if custom_etype
  858.       return @etype_id
  859.     end
  860.     def get_custom_etype
  861.     return nil if !@note[/<equip type:([^>]*)>/im]
  862.     a = note[/<equip type:([^>]*)>/im].scan(/:(.*)/m).flatten[0].scan(/(?:"(.*?)"|\{(.*?)\}|\[(.*?)\]| ([-\w.\w]+)|([-\w.\w]+),|,([-\w.\w]+))/m).flatten.compact
  863.     etype = a[0][/rune/im] ? ESTRIOLE::RUNE_SLOT_ID : a[0].to_i
  864.     return noteargs = etype
  865.     end
  866.   end
  867.  
  868.  
  869. end
  870.  
  871. class Game_System
  872.   attr_accessor :rune_skill_mode
  873.   def rune_skill_mode
  874.     @rune_skill_mode = ESTRIOLE::RUNE_REPLACE_SKILL_MENU if @rune_skill_mode.nil?
  875.     @rune_skill_mode
  876.   end
  877. end
  878. class Game_Actor < Game_Battler
  879.   attr_accessor :runes
  880.   attr_accessor :sealed_rune_slot
  881.   alias est_rune_game_actor_init initialize
  882.   def initialize(actor_id)
  883.     est_rune_game_actor_init(actor_id)
  884.     @runes = Array.new(rune_slots_name.size,nil)
  885.     init_runes
  886.   end
  887.   def init_runes
  888.     for i in 0..@runes.size-1
  889.       @runes[i] = $data_armors[starting_rune(i)] if starting_rune(i) && $data_armors[starting_rune(i)].etype_id == ESTRIOLE::RUNE_SLOT_ID
  890.     end
  891.     @hp = mhp
  892.     @mp = mmp
  893.   end
  894.   def rune_enabled?
  895.     return false if check_rune_seal
  896.     return false if $game_switches[ESTRIOLE::RUNE_BATTLE_DISABLED_SWITCH]
  897.     return true
  898.   end
  899.   def check_rune_seal
  900.     return true if actor.rune_seal?
  901.     return true if $data_classes[@class_id].rune_seal?
  902.     return true if $imported["YEA-ClassSystem"] &&
  903.                    $data_classes[@subclass_id] &&
  904.                    $data_classes[@subclass_id].rune_seal?
  905.     equips.each do |equip|
  906.       next if !equip
  907.       return true if equip.rune_seal?
  908.     end    
  909.     states.each do |state|
  910.       return true if state.rune_seal?
  911.     end
  912.     return false
  913.   end
  914.   def starting_rune(index)
  915.     return actor.starting_rune_ex(rune_slots_name[index])[0] if actor.starting_rune_ex(rune_slots_name[index]) != []
  916.     return actor.starting_rune(index)[0] if actor.starting_rune(index)
  917.     return $data_classes[@class_id].starting_rune_ex(rune_slots_name[index])[0] if $data_classes[@class_id].starting_rune_ex(rune_slots_name[index])  != []
  918.     return $data_classes[@class_id].starting_rune(index)[0] if $data_classes[@class_id].starting_rune(index)
  919.     return $data_classes[@subclass_id].starting_rune_ex(rune_slots_name[index])[0] if $imported["YEA-ClassSystem"] &&
  920.                                                                                       $data_classes[@subclass_id] &&
  921.                                                                                       $data_classes[@subclass_id].starting_rune_ex(rune_slots_name[index]) != []
  922.     return $data_classes[@subclass_id].starting_rune(index)[0] if $imported["YEA-ClassSystem"] &&
  923.                                                                   $data_classes[@subclass_id] &&
  924.                                                                   $data_classes[@subclass_id].starting_rune(index)
  925.     return nil
  926.   end
  927.   def sealed_rune_slots
  928.     @sealed_rune_slot = get_sealed_rune_slots
  929.     auto_unseal_requirement
  930.     @sealed_rune_slot += event_sealed_rune_slots
  931.     @sealed_rune_slot -= event_unsealed_rune_slots    
  932.     @sealed_rune_slot
  933.   end
  934.   def auto_unseal_requirement
  935.     s = $game_switches
  936.     v = $game_variables
  937.     p = $game_party
  938.     a = $game_actors
  939.     gs = $game_system
  940.     pt = $game_system.playtime
  941.     bc = $game_system.battle_count
  942.     sc = $game_system.save_count
  943.     actor.auto_unseal_rune_slot.each do |slot,req|
  944.       @sealed_rune_slot -= [slot] if eval(req) rescue false
  945.     end
  946.     $data_classes[@class_id].auto_unseal_rune_slot.each do |slot,req|
  947.       @sealed_rune_slot -= [slot] if eval(req) rescue false
  948.     end
  949.     if chk = subclass rescue false
  950.       subclass.auto_unseal_rune_slot.each do |slot,req|
  951.         @sealed_rune_slot -= [slot] if eval(req) rescue false
  952.       end
  953.     end
  954.     equips.each do |equip|
  955.       next if !equip
  956.       equip.auto_unseal_rune_slot.each do |slot,req|
  957.         @sealed_rune_slot -= [slot] if eval(req) rescue false
  958.       end
  959.     end    
  960.     states.each do |state|
  961.       state.auto_unseal_rune_slot.each do |slot,req|
  962.         @sealed_rune_slot -= [slot] if eval(req) rescue false
  963.       end
  964.     end    
  965.   end
  966.   def event_sealed_rune_slots
  967.     @event_sealed_rune_slots = [] if !@event_sealed_rune_slots
  968.     return @event_sealed_rune_slots
  969.   end
  970.   def event_sealed_rune_slots=(val)
  971.     return if @event_sealed_rune_slots == val
  972.     @event_sealed_rune_slots = val
  973.   end
  974.   def event_unsealed_rune_slots
  975.     @event_unsealed_rune_slots = [] if !@event_unsealed_rune_slots
  976.     return @event_unsealed_rune_slots
  977.   end
  978.   def event_unsealed_rune_slots=(val)
  979.     return if @event_unsealed_rune_slots == val
  980.     @event_unsealed_rune_slots = val
  981.   end
  982.  
  983.   def get_sealed_rune_slots
  984.     sealed_slot = []
  985.     sealed_slot = sealed_slot + actor.sealed_rune_slots if actor.sealed_rune_slots
  986.     sealed_slot = sealed_slot + $data_classes[@class_id].sealed_rune_slots if $data_classes[@class_id].sealed_rune_slots
  987.     sealed_slot = sealed_slot + $data_classes[@subclass_id].sealed_rune_slots if $imported["YEA-ClassSystem"] &&
  988.                                                             $data_classes[@subclass_id] &&
  989.                                                             $data_classes[@subclass_id].sealed_rune_slots
  990.     equips.each do |equip|
  991.       next if !equip
  992.       sealed_slot = sealed_slot + equip.sealed_rune_slots if equip.sealed_rune_slots
  993.     end    
  994.     states.each do |state|
  995.       sealed_slot = sealed_slot + state.sealed_rune_slots if state.sealed_rune_slots
  996.     end
  997.     return sealed_slot
  998.   end
  999.   def rune_slots
  1000.     @rune_slots = Array.new(rune_slots_name.size,ESTRIOLE::RUNE_SLOT_ID) if !@rune_slots
  1001.     @rune_slots
  1002.   end
  1003.   def rune_slots_name
  1004.     @rune_slots_name = get_rune_slots_name if !@rune_slots_name
  1005.     @rune_slots_name
  1006.   end
  1007.   def get_rune_slots_name
  1008.     return actor.custom_rune if actor.custom_rune != []
  1009.     return $data_classes[@class_id].custom_rune if $data_classes[@class_id].custom_rune != []
  1010.     return $data_classes[@subclass_id].custom_rune if $imported["YEA-ClassSystem"] &&
  1011.                                                       $data_classes[@subclass_id] &&
  1012.                                                       $data_classes[@subclass_id].custom_rune != []
  1013.     return ESTRIOLE::RUNE_SLOT_NAME.dup    
  1014.   end
  1015.   def change_rune(slot_id, item)
  1016.     return unless trade_item_with_party(item, runes[slot_id])
  1017.     return if item && rune_slots[slot_id] != item.etype_id
  1018.     @runes[slot_id] = item
  1019.     refresh
  1020.   end
  1021.   def set_rune(slot_id, item)
  1022.     trade_item_with_party(nil, runes[slot_id])
  1023.     return if item && rune_slots[slot_id] != item.etype_id
  1024.     @runes[slot_id] = item
  1025.     refresh    
  1026.   end
  1027.   def force_change_rune(slot_id, item)
  1028.     @runes[slot_id] = item
  1029.     refresh
  1030.   end
  1031.    
  1032.   alias est_suikoden_rune_equips equips
  1033.   def equips
  1034.     equip = est_suikoden_rune_equips
  1035.     runes = [] if @runes.nil?
  1036.     runes = @runes if !@runes.nil?
  1037.     return equips = equip + runes if !SceneManager.scene_any?(ESTRIOLE::SCENE_NOT_INCLUDE_RUNE)
  1038.     return equip
  1039.   end
  1040.   alias est_rune_game_actor_feature_objects feature_objects
  1041.   def feature_objects
  1042.     cond = SceneManager.scene_any?(ESTRIOLE::SCENE_NOT_INCLUDE_RUNE)
  1043.     return obj = est_rune_game_actor_feature_objects + @runes.compact if cond && @runes
  1044.     est_rune_game_actor_feature_objects
  1045.   end    
  1046.   def runes_object
  1047.     @runes.compact
  1048.   end
  1049.   def runes
  1050.     @runes
  1051.   end
  1052.   #add rune slot ingame patch
  1053.   def add_rune_slot(rune_slot_name,pos=-1,allow_duplicate = true,rune)
  1054.     return if @rune_slots_name.include?(rune_slot_name) && !allow_duplicate
  1055.     rune_slots #to init the variable if still nil
  1056.     rune_slots_name #to init the variable if still nil
  1057.     @runes.insert(pos,rune)
  1058.     @rune_slots.insert(pos,ESTRIOLE::RUNE_SLOT_ID)
  1059.     @rune_slots_name.insert(pos,rune_slot_name)
  1060.   end
  1061.   def rem_rune_slot(slot,put_item_to_bag = true)
  1062.     rune_slots #to init the variable if still nil
  1063.     rune_slots_name #to init the variable if still nil
  1064.     slot = @rune_slots_name.index(slot) rescue nil
  1065.     return if !slot
  1066.     return if slot > @runes.size-1
  1067.     item = @runes[slot]
  1068.     @runes.delete_at(slot)
  1069.     @rune_slots.delete_at(slot)
  1070.     @rune_slots_name.delete_at(slot)
  1071.     $game_party.gain_item(item, 1) if item && put_item_to_bag
  1072.   end
  1073.   #tsukihime effect manager patch. runes can have effects too :D.
  1074.   # you can create rune who damage all enemy at start of battle
  1075.   # this useful to create fury rune. why? add the fury state after reviving
  1076.   if $imported["Effect_Manager"]
  1077.     alias est_suikoden_rune_effect_objects effect_objects
  1078.     def effect_objects
  1079.       prev_effects = est_suikoden_rune_effect_objects
  1080.       runes = [] if @runes.nil?
  1081.       runes = @runes.compact if !@runes.nil?
  1082.       return new_effects = prev_effects + runes    
  1083.     end
  1084.   end
  1085. end
  1086.  
  1087. class Window_RuneCommand < Window_EquipCommand
  1088.   def make_command_list
  1089.     add_command("Attach",   :attach)
  1090.     add_command("Remove", :remove)
  1091.     add_command("Leave",    :quit)
  1092.   end
  1093. end
  1094.  
  1095. class Window_RuneSlot < Window_EquipSlot
  1096.   def draw_item(index)
  1097.     return unless @actor
  1098.     rect = item_rect_for_text(index)
  1099.     change_color(system_color, enable?(index))
  1100.     draw_text(rect.x, rect.y, ESTRIOLE::RUNE_SLOT_SPACE, line_height, slot_name(index))
  1101.     item = @actor.runes[index]
  1102.     dx = rect.x + ESTRIOLE::RUNE_SLOT_SPACE
  1103.     dw = contents.width - dx - 24
  1104.     if item.nil?
  1105.       draw_nothing_equip(dx, rect.y, false, dw)
  1106.     else
  1107.       draw_item_name(item, dx, rect.y, enable?(index), dw)
  1108.     end
  1109.   end
  1110.   def draw_nothing_equip(dx, dy, enabled, dw)
  1111.     change_color(normal_color, enabled)
  1112.     draw_icon(Icon.nothing_equip, dx, dy, enabled)
  1113.     text = "Nothing"
  1114.     draw_text(dx + 24, dy, dw - 24, line_height, text)
  1115.   end  
  1116.  
  1117.   def slot_name(index)
  1118.     return @actor.rune_slots_name[index] if @actor
  1119.     return ""
  1120.   end
  1121.  
  1122.   def item_max
  1123.     @actor ? @actor.rune_slots.size : 0
  1124.   end
  1125.  
  1126.   def cost_window=(cost_window)
  1127.     return if @cost_window == cost_window
  1128.     @cost_window = cost_window
  1129.     refresh
  1130.   end
  1131.  
  1132.   def item
  1133.     @actor ? @actor.runes[@index] : nil
  1134.   end
  1135.  
  1136.   def enable?(index)
  1137.     return false if !@actor
  1138.     return false if @actor.sealed_rune_slots.include?(index)
  1139.     return false if @actor.sealed_rune_slots.include?(index.to_s)
  1140.     return false if @actor.sealed_rune_slots.include?(@actor.rune_slots_name[index])
  1141.     return true
  1142.   end
  1143.  
  1144.   alias est_suikoden_rune_refresh refresh
  1145.   def refresh
  1146.     create_contents
  1147.     est_suikoden_rune_refresh
  1148.   end
  1149.   alias est_suikoden_rune_update_help_cost update_help
  1150.   def update_help
  1151.     est_suikoden_rune_update_help_cost
  1152.     @cost_window.set_item_slot(item) if @cost_window
  1153.   end
  1154. end # Window_EquipSlot
  1155.  
  1156. class Window_RuneItem < Window_EquipItem
  1157.   def rune_skill_window=(rune_skill_window)
  1158.     @rune_skill_window = rune_skill_window
  1159.     call_update_help
  1160.   end
  1161.   def cost_window=(cost_window)
  1162.     return if @cost_window == cost_window
  1163.     @cost_window = cost_window
  1164.     refresh
  1165.   end
  1166.   def include?(item)
  1167.     return true if item == nil
  1168.     return false unless item.is_a?(RPG::EquipItem)
  1169.     return false if @slot_id < 0
  1170.     return false if item.etype_id != @actor.rune_slots[@slot_id]
  1171.     return false if item.forbidden_rune_slots.include?(@slot_id.to_s)
  1172.     return false if item.forbidden_rune_slots.include?(@actor.rune_slots_name[@slot_id])
  1173.     return false if !item.only_rune_slots.include?(@slot_id.to_i.to_s) &&
  1174.                     !item.only_rune_slots.include?(@actor.rune_slots_name[@slot_id]) &&
  1175.                     item.only_rune_slots != []
  1176.     return @actor.equippable?(item)
  1177.   end
  1178.   def draw_remove_equip(rect)
  1179.     draw_icon(Icon.remove_equip, rect.x, rect.y)
  1180.     text = "- Remove -"
  1181.     rect.x += 24
  1182.     rect.width -= 24
  1183.     draw_text(rect, text)
  1184.   end
  1185.   def enable?(item)
  1186.       if item.nil? && !@actor.nil?
  1187.         etype_id = @actor.rune_slots[@slot_id]
  1188.         return YEA::EQUIP::TYPES[etype_id][1] if $imported["YEA-AceEquipEngine"]
  1189.       end
  1190.     return @actor.equippable?(item)
  1191.   end
  1192.   def update_help
  1193.     @help_window.set_item(item)
  1194.     @cost_window.set_item(item) if @cost_window
  1195.     if @actor && @status_window
  1196.       temp_actor = Marshal.load(Marshal.dump(@actor))
  1197.       temp_actor.force_change_rune(@slot_id, item)
  1198.       @status_window.set_temp_actor(temp_actor)
  1199.     end
  1200.     @rune_skill_window.item = item if @rune_skill_window
  1201.   end
  1202. end
  1203.  
  1204. class Window_RuneSkill < Window_Base
  1205.   def initialize(dx, dy, dw, dh)
  1206.     super(dx, dy, dw, dh)
  1207.     @item = nil
  1208.     self.visible = false
  1209.   end
  1210.   #--------------------------------------------------------------------------
  1211.   # actor=
  1212.   #--------------------------------------------------------------------------
  1213.   def item=(item)
  1214.     return if @item == item
  1215.     @item = item
  1216.     refresh
  1217.   end
  1218.   #--------------------------------------------------------------------------
  1219.   # refresh
  1220.   #--------------------------------------------------------------------------
  1221.   def refresh
  1222.     contents.clear
  1223.     return unless @item
  1224.     skills = get_skill(@item)
  1225.     i = 0
  1226.     skills.each do |skill|
  1227.       draw_text(0,i*line_height,48,line_height,"Lv #{i+1} #{ESTRIOLE::RUNE_SKILL_LIST_POINTER} ")
  1228.       draw_item_name(skill,48,i*line_height)
  1229.       i += 1
  1230.     end
  1231.   end
  1232.   def get_skill(item)
  1233.     skills = []
  1234.     if item.manual_rune_skills
  1235.       item.manual_rune_skills.each do |skill_id|
  1236.         skills.push($data_skills[skill_id])
  1237.       end
  1238.     else
  1239.     features = item.features
  1240.       features.each do |ft|
  1241.         skills.push($data_skills[ft.data_id]) if ft.code == 43
  1242.       end
  1243.     end
  1244.     return skills
  1245.   end
  1246. end
  1247.  
  1248. class Window_RuneGold < Window_Gold
  1249.   def initialize
  1250.     super#(0, 0, window_width, fitting_height(1))
  1251.     refresh
  1252.   end
  1253.   def contents_height
  1254.     height - standard_padding * 2 - 6
  1255.   end
  1256.   def window_width
  1257.     return 160
  1258.   end
  1259.   def draw_currency_value(value, unit, x, y, width)
  1260.     make_font_smaller
  1261.     cx = text_size(unit).width
  1262.     change_color(system_color)
  1263.     draw_text(x, y, width, line_height, "Fund", 3)
  1264.     change_color(normal_color)
  1265.     draw_text(x, y, width - cx - 2, line_height, value, 2)
  1266.     change_color(system_color)
  1267.     draw_text(x, y, width, line_height, unit, 2)
  1268.     reset_font_settings
  1269.   end
  1270. end
  1271. class Window_RuneCost < Window_Gold
  1272.   def initialize
  1273.     super
  1274.     refresh
  1275.   end
  1276.   def set_item(item)
  1277.     return if @item == item
  1278.     @item = item
  1279.     refresh
  1280.   end
  1281.   def set_item_slot(item)
  1282.     return if @item_slot == item
  1283.     @item_slot = item
  1284.     refresh
  1285.   end
  1286.   def mode=(mode)
  1287.     return if @mode == mode
  1288.     @mode = mode
  1289.     refresh
  1290.   end
  1291.   def contents_height
  1292.     height - standard_padding * 2 - 6
  1293.   end
  1294.   def window_width
  1295.     return 160
  1296.   end
  1297.   def draw_currency_value(value, unit, x, y, width)
  1298.     make_font_smaller
  1299.     cx = text_size(unit).width
  1300.     change_color(system_color)
  1301.     draw_text(x, y, width, line_height, "Cost", 3)
  1302.     change_color(normal_color)
  1303.     draw_text(x, y, width - cx - 2, line_height, value, 2)
  1304.     change_color(system_color)
  1305.     draw_text(x, y, width, line_height, unit, 2)
  1306.     reset_font_settings
  1307.   end
  1308.   def value
  1309.     case @mode
  1310.     when :attach
  1311.     remove_cost = @item_slot.rune_remove_cost rescue 0      
  1312.     attach_cost = @item.rune_attach_cost rescue 0
  1313. #    return total_cost = @item ? remove_cost + attach_cost : 0
  1314.     return total_cost = remove_cost + attach_cost
  1315.     when :remove
  1316.     remove_cost = @item_slot.rune_remove_cost rescue 0      
  1317.     else
  1318.     cost = 0
  1319.     end
  1320.   end
  1321. end
  1322.  
  1323. class Scene_Rune < Scene_Equip  
  1324.   alias est_suikoden_rune_start start
  1325.   def start
  1326.     $game_party.menu_actor = $game_party.members[0] if !$game_party.menu_actor
  1327.     est_suikoden_rune_start
  1328.   end  
  1329.   alias escape_scene_update update
  1330.   def update
  1331.     escape_scene_update
  1332.     return_scene if Input.trigger?(:B)
  1333.   end
  1334.   alias est_suikoden_rune_create_command_window create_command_window
  1335.   def create_command_window
  1336.     est_suikoden_rune_create_command_window
  1337.     wx = @command_window.x
  1338.     wy = @command_window.y
  1339.     ww = @command_window.width
  1340.     @command_window.dispose
  1341.     @command_window = Window_RuneCommand.new(wx, wy, ww)
  1342.     @command_window.viewport = @viewport
  1343.     @command_window.help_window = @help_window
  1344.     @command_window.set_handler(:attach,    method(:command_attach))
  1345.     @command_window.set_handler(:remove, method(:command_remove))
  1346.     @command_window.set_handler(:quit,   method(:return_scene))
  1347.     @command_window.set_handler(:pagedown, method(:next_actor))
  1348.     @command_window.set_handler(:pageup,   method(:prev_actor))    
  1349.   end  
  1350.   alias est_suikoden_rune_next_actor next_actor
  1351.   def next_actor
  1352.     est_suikoden_rune_next_actor
  1353.     @slot_window.select(0)
  1354.   end
  1355.   alias est_suikoden_rune_prev_actor prev_actor
  1356.   def prev_actor
  1357.     est_suikoden_rune_prev_actor
  1358.     @slot_window.select(0)
  1359.   end
  1360.   def command_attach
  1361.     @slot_window.set_handler(:ok,       method(:on_slot_ok_attach))
  1362.     @slot_window.activate
  1363.     @slot_window.select(0)
  1364.   end
  1365.   def command_remove
  1366.     @slot_window.set_handler(:ok,       method(:on_slot_ok_remove))
  1367.     @slot_window.activate
  1368.     @slot_window.select(0)
  1369.   end
  1370.   def overlap_rune_skill_window
  1371.     return @actor_window if @actor_window && $imported["YEA-AceEquipEngine"]
  1372.     return eval("#{ESTRIOLE::RUNE_SKILL_LIST_SETTING[:overlap_window]}")
  1373.     return nil
  1374.   end  
  1375.   def on_slot_ok_attach
  1376.     on_slot_ok
  1377.     overlap_rune_skill_window.hide if overlap_rune_skill_window
  1378.     @rune_skill_window.show
  1379.     @item_window.set_handler(:ok,     method(:on_item_ok))    
  1380.   end
  1381.   def on_slot_ok_remove
  1382.     Sound.play_equip
  1383.     @actor.change_rune(@slot_window.index, nil)
  1384.     @slot_window.activate
  1385.     @slot_window.refresh
  1386.     @item_window.unselect
  1387.     @item_window.refresh
  1388.     @actor_window.refresh if $imported["YEA-AceEquipEngine"]
  1389.     @slot_window.show
  1390.     @item_window.hide if $imported["YEA-AceEquipEngine"]
  1391.     @status_window.refresh
  1392.   end
  1393.   alias est_suikoden_rune_create_slot_window create_slot_window  
  1394.   def create_slot_window
  1395.     est_suikoden_rune_create_slot_window
  1396.     wx = @slot_window.x
  1397.     wy = @slot_window.y
  1398.     ww = @slot_window.width
  1399.     @slot_window.dispose
  1400.     @slot_window = Window_RuneSlot.new(wx, wy, ww)
  1401.     @slot_window.viewport = @viewport
  1402.     @slot_window.help_window = @help_window
  1403.     @slot_window.status_window = @status_window
  1404.     @slot_window.actor = @actor
  1405.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1406.   end
  1407.   alias est_suikoden_rune_create_item_window create_item_window
  1408.   def create_item_window
  1409.     est_suikoden_rune_create_item_window
  1410.     wx = @item_window.x
  1411.     wy = @item_window.y
  1412.     ww = @item_window.width
  1413.     wh = @item_window.height
  1414.     @item_window.dispose
  1415.     @item_window = Window_RuneItem.new(wx, wy, ww, wh)
  1416.     @item_window.viewport = @viewport
  1417.     @item_window.help_window = @help_window
  1418.     @item_window.status_window = @status_window
  1419.     @item_window.actor = @actor
  1420.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1421.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1422.     @slot_window.item_window = @item_window
  1423.     @item_window.hide if $imported["YEA-AceEquipEngine"]
  1424.     create_rune_skill_window
  1425.     @item_window.rune_skill_window = @rune_skill_window
  1426.   end
  1427.   def create_rune_skill_window
  1428.     if $imported["YEA-AceEquipEngine"]
  1429.     wx = @actor_window.x
  1430.     wy = @actor_window.y
  1431.     ww = @actor_window.width
  1432.     wh = @actor_window.height
  1433.     @rune_skill_window = Window_RuneSkill.new(wx, wy, ww, wh)
  1434.     else
  1435.     wx = eval("#{ESTRIOLE::RUNE_SKILL_LIST_SETTING[:overlap_window]}.x")
  1436.     wy = eval("#{ESTRIOLE::RUNE_SKILL_LIST_SETTING[:overlap_window]}.y")
  1437.     ww = eval("#{ESTRIOLE::RUNE_SKILL_LIST_SETTING[:overlap_window]}.width")
  1438.     wh = eval("#{ESTRIOLE::RUNE_SKILL_LIST_SETTING[:overlap_window]}.height")
  1439.     @rune_skill_window = Window_RuneSkill.new(wx, wy, ww, wh)
  1440.     end
  1441.     @rune_skill_window.viewport = @viewport
  1442.     @rune_skill_window.item = nil
  1443.   end
  1444.   alias est_suikoden_rune_on_item_ok on_item_ok
  1445.   def on_item_ok
  1446.     Sound.play_equip
  1447.     @actor.change_rune(@slot_window.index, @item_window.item)
  1448.     @slot_window.activate
  1449.     @slot_window.refresh
  1450.     @item_window.unselect
  1451.     @item_window.refresh
  1452.     @actor_window.refresh if @actor_window
  1453.     @item_window.hide if $imported["YEA-AceEquipEngine"]
  1454.     @rune_skill_window.hide
  1455.     @slot_window.show
  1456.     overlap_rune_skill_window.show if overlap_rune_skill_window
  1457.   end
  1458.   alias on_item_cancel_switch_window on_item_cancel
  1459.   def on_item_cancel
  1460.     on_item_cancel_switch_window
  1461.     @rune_skill_window.hide
  1462.     overlap_rune_skill_window.show if overlap_rune_skill_window
  1463.   end  
  1464. end
  1465.  
  1466. #scene rune but with cost....
  1467. class Scene_RuneShop < Scene_Rune  
  1468.   def start
  1469.     super
  1470.     create_gold_and_cost_window
  1471.   end    
  1472.   def create_gold_and_cost_window
  1473.     @gold_window = Window_RuneGold.new
  1474.     @cost_window = Window_RuneCost.new
  1475.     @item_window.cost_window = @cost_window
  1476.     @slot_window.cost_window = @cost_window
  1477.     if $imported["YEA-AceEquipEngine"] == true
  1478.     @gold_window.width = @command_window.width
  1479.     @gold_window.height = @command_window.height/2
  1480.     @gold_window.x = @command_window.x
  1481.     @gold_window.z = @help_window.z + 100
  1482.     @gold_window.y = @command_window.y
  1483.     @cost_window.width = @command_window.width
  1484.     @cost_window.height = @command_window.height/2
  1485.     @cost_window.x = @gold_window.x
  1486.     @cost_window.z = @help_window.z + 100
  1487.     @cost_window.y = @gold_window.y + @gold_window.height
  1488.     else
  1489.     @gold_window.width = @command_window.width/2
  1490.     @gold_window.x = @command_window.x
  1491.     @gold_window.z = @help_window.z + 100
  1492.     @gold_window.y = @command_window.y
  1493.     @cost_window.width = @command_window.width/2
  1494.     @cost_window.x = @gold_window.x + @gold_window.width
  1495.     @cost_window.z = @help_window.z + 100
  1496.     @cost_window.y = @command_window.y
  1497.     end
  1498.     @gold_window.hide
  1499.     @cost_window.hide
  1500.   end
  1501.  
  1502.   def command_attach
  1503.     @gold_window.show
  1504.     @cost_window.show
  1505.     @command_window.hide
  1506.     @cost_window.mode = :attach
  1507.     super
  1508.   end
  1509.   def command_remove
  1510.     @gold_window.show
  1511.     @cost_window.show
  1512.     @command_window.hide
  1513.     @cost_window.mode = :remove
  1514.     super
  1515.   end
  1516.   def on_slot_ok_remove
  1517.     return not_enough_money(@slot_window) if $game_party.gold < @cost_window.value
  1518.     Sound.play_equip
  1519.     $game_party.lose_gold(@cost_window.value)
  1520.     @gold_window.refresh
  1521.     @actor.change_rune(@slot_window.index, nil)
  1522.     @slot_window.activate
  1523.     @slot_window.refresh
  1524.     @item_window.unselect
  1525.     @item_window.refresh
  1526.     @actor_window.refresh if $imported["YEA-AceEquipEngine"]
  1527.     @slot_window.show
  1528.     @item_window.hide if $imported["YEA-AceEquipEngine"]
  1529.     @status_window.refresh
  1530.   end
  1531.   def on_slot_cancel
  1532.     @gold_window.hide
  1533.     @cost_window.hide
  1534.     @command_window.show
  1535.     super
  1536.   end
  1537.   def on_item_ok
  1538.     return not_enough_money(@item_window) if $game_party.gold < @cost_window.value
  1539.     $game_party.lose_gold(@cost_window.value)
  1540.     @gold_window.refresh
  1541.     super
  1542.     @cost_window.set_item(nil)
  1543.   end
  1544.   def not_enough_money(window)
  1545.     Sound.play_buzzer
  1546.     window.activate
  1547.   end
  1548.   def on_item_cancel
  1549.     @cost_window.set_item(nil)
  1550.     super
  1551.   end  
  1552. end
  1553.  
  1554. class Game_Interpreter
  1555.   def actor_set_rune(actor_id,rune_slot,rune_id,swap_inventory = false)
  1556.     actor = $game_actors[actor_id] rescue nil
  1557.     rune = rune_id ? $data_armors[rune_id] : nil
  1558.     rune_slot = get_rune_slot_id(actor,rune_slot) if rune_slot.is_a?(String)
  1559.     return if !actor
  1560.     return if !rune_slot
  1561.     return if rune.etype_id != ESTRIOLE::RUNE_SLOT_ID
  1562.     actor.change_rune(rune_slot,rune) if swap_inventory
  1563.     actor.set_rune(rune_slot,rune) if !swap_inventory
  1564.   end
  1565.   def add_rune_slot(actor_id,rune_slot_name,pos = 0,allow_duplicate = true, rune_id = nil)
  1566.     actor = $game_actors[actor_id]
  1567.     rune = rune_id ? $data_armors[rune_id] : nil
  1568.     rune = nil if rune && rune.etype_id != ESTRIOLE::RUNE_SLOT_ID
  1569.     pos = 0 if !pos
  1570.     actor.add_rune_slot(rune_slot_name,pos-1,allow_duplicate,rune)
  1571.   end
  1572.   def rem_rune_slot(actor_id,slot_name,put_item_to_bag = true)
  1573.     actor = $game_actors[actor_id]
  1574.     actor.rem_rune_slot(slot_name,put_item_to_bag)
  1575.   end
  1576.   def actor_seal_rune(actor_id,rune_slot)
  1577.     actor = $game_actors[actor_id]
  1578.     return if !actor
  1579.     return if !rune_slot
  1580.     actor.event_unsealed_rune_slots
  1581.     actor.event_unsealed_rune_slots -= [rune_slot]
  1582.     actor.event_unsealed_rune_slots.uniq!
  1583.     actor.event_sealed_rune_slots
  1584.     actor.event_sealed_rune_slots += [rune_slot]
  1585.     actor.event_sealed_rune_slots.uniq!
  1586.   end
  1587.   def actor_unseal_rune(actor_id,rune_slot)
  1588.     actor = $game_actors[actor_id]
  1589.     return if !actor
  1590.     return if !rune_slot
  1591.     actor.event_unsealed_rune_slots
  1592.     actor.event_unsealed_rune_slots += [rune_slot]
  1593.     actor.event_unsealed_rune_slots.uniq!
  1594.     actor.event_sealed_rune_slots
  1595.     actor.event_sealed_rune_slots -= [rune_slot]
  1596.     actor.event_sealed_rune_slots.uniq!
  1597.   end
  1598.   def actor_reset_seal(actor_id, rune_slot = nil)
  1599.     actor = $game_actors[actor_id]
  1600.     return if !actor    
  1601.     actor.event_unsealed_rune_slots
  1602.     actor.event_sealed_rune_slots
  1603.    
  1604.     actor.event_unsealed_rune_slots = nil if !rune_slot
  1605.     actor.event_sealed_rune_slots = nil if !rune_slot
  1606.    
  1607.     return unless rune_slot
  1608.     actor.event_unsealed_rune_slots -= [rune_slot]
  1609.     actor.event_sealed_rune_slots -= [rune_slot]    
  1610.   end
  1611.  
  1612.   def get_rune_slot_id(actor,string)
  1613.     return actor.rune_slots_name.index(string)
  1614.   end
  1615. end
  1616.  
  1617. #####################   BATTLE RUNE PART   #####################################
  1618.  
  1619. class Window_ActorCommand < Window_Command
  1620.   alias est_suikoden_rune_make_command_list make_command_list
  1621.   def make_command_list
  1622.     est_suikoden_rune_make_command_list
  1623.     add_rune_command
  1624.   end
  1625.   def add_rune_command
  1626.     return if !@actor
  1627.     if $game_switches[ESTRIOLE::RUNE_BATTLE_SHOW_SWITCH] || ESTRIOLE::RUNE_BATTLE_SHOW_SWITCH <= 0
  1628.     pos = ESTRIOLE::RUNE_COMMAND_POSITION - 1
  1629.     pos = ESTRIOLE::RUNE_COMMAND_POSITION if ESTRIOLE::RUNE_COMMAND_POSITION < 1
  1630.     @list.insert(pos,{:name=>ESTRIOLE::RUNE_VOCAB, :symbol=>:rune, :enabled=>@actor.rune_enabled?, :ext=>"rune"})
  1631.     end
  1632.     #removing the stype added by the rune
  1633.     runes_added_stype = []
  1634.     @actor.runes.each do |rune|
  1635.     runes_added_stype.push(check_stype(rune)) if check_stype(rune)  
  1636.     end
  1637.     @list = @list.select{|command|!runes_added_stype.include?(command[:ext])}
  1638.   end
  1639.   def check_stype(item)
  1640.     return nil if !item
  1641.     features = item.features
  1642.     features.each do |ft|
  1643.       return stype = ft.data_id if ft.code == 41
  1644.     end
  1645.     return nil
  1646.   end  
  1647. end
  1648.  
  1649. class Window_RuneSlot_Battle < Window_RuneSlot
  1650.   def initialize(dx, dy, dw)
  1651.     super(dx, dy, dw)
  1652.     @actor = nil
  1653.     self.height = fitting_height(ESTRIOLE::RUNE_BATTLE_WINDOW[:slots])
  1654.     refresh
  1655.   end  
  1656.   def actor
  1657.     @actor
  1658.   end
  1659.   def enable?(index)
  1660.   return false if !@actor
  1661.   return false if !check_stype(@actor.runes[index])
  1662.   return true
  1663.   end
  1664.   def check_stype(item)
  1665.     return nil if !item
  1666.     features = item.features
  1667.     features.each do |ft|
  1668.       return stype = ft.data_id if ft.code == 41
  1669.     end
  1670.     return nil
  1671.   end  
  1672. end # Window_EquipSlot
  1673.  
  1674. class Window_ActorCommand < Window_Command
  1675.   def current_symbol=(symbol)
  1676.     current_data[:symbol] = symbol
  1677.   end
  1678. end
  1679.  
  1680. class Scene_Battle < Scene_Base
  1681.   alias est_suikoden_rune_create_all_windows create_all_windows
  1682.   def create_all_windows
  1683.     est_suikoden_rune_create_all_windows
  1684.     create_rune_list_window
  1685.   end
  1686.  
  1687.   def create_rune_list_window
  1688.     wx = ESTRIOLE::RUNE_BATTLE_WINDOW[:x]
  1689.     wy = ESTRIOLE::RUNE_BATTLE_WINDOW[:y]
  1690.     ww = ESTRIOLE::RUNE_BATTLE_WINDOW[:w]
  1691.     @rune_slot_window = Window_RuneSlot_Battle.new(wx, wy, ww)
  1692.     @rune_slot_window.set_handler(:ok,   method(:on_slot_ok))
  1693.     @rune_slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1694.     @rune_slot_window.hide
  1695.   end
  1696.  
  1697.   def on_slot_ok
  1698.     item = @rune_slot_window.item
  1699.     stype = check_stype(item)
  1700.     @rune_slot_window.activate
  1701.     return Sound.play_buzzer if !stype
  1702.     @rune_slot_window.hide
  1703.     @skill_window.actor = @rune_slot_window.actor
  1704.     @skill_window.stype_id = stype
  1705.     @from_rune = true
  1706.     @rune_slot_window.deactivate
  1707.     @skill_window.refresh
  1708.     @skill_window.show.activate.select(0)
  1709.   end
  1710.  
  1711.   def check_stype(item)
  1712.     features = item.features
  1713.     features.each do |ft|
  1714.       return stype = ft.data_id if ft.code == 41
  1715.     end
  1716.     return nil
  1717.   end  
  1718.    
  1719.   def on_slot_cancel
  1720.     @rune_slot_window.hide.deactivate
  1721.     @actor_command_window.activate
  1722.     @from_rune = false
  1723.   end
  1724.  
  1725.   alias est_suikoden_rune_create_actor_command_window create_actor_command_window
  1726.   def create_actor_command_window
  1727.     est_suikoden_rune_create_actor_command_window
  1728.     @actor_command_window.set_handler(:rune,  method(:command_rune))
  1729.   end
  1730.  
  1731.   def command_rune
  1732.     @rune_slot_window.actor = BattleManager.actor
  1733.     @rune_slot_window.show.activate.select(0)
  1734.   end
  1735.  
  1736.   alias est_suikoden_rune_on_skill_ok on_skill_ok
  1737.   def on_skill_ok
  1738.     est_suikoden_rune_on_skill_ok
  1739.   end
  1740.  
  1741.   alias est_suikoden_rune_on_skill_cancel on_skill_cancel
  1742.   def on_skill_cancel
  1743.     est_suikoden_rune_on_skill_cancel
  1744.     if @from_rune
  1745.     @actor_command_window.deactivate
  1746.     @rune_slot_window.show.activate
  1747.     @from_rune = false  
  1748.     end
  1749.   end
  1750.  
  1751.   alias est_suikoden_rune_on_enemy_ok on_enemy_ok
  1752.   def on_enemy_ok
  1753.     est_suikoden_rune_on_enemy_ok
  1754.     @rune_slot_window.deactivate
  1755.     @from_rune = false  
  1756.   end
  1757.  
  1758.   alias est_suikoden_rune_on_enemy_cancel on_enemy_cancel
  1759.   def on_enemy_cancel
  1760.     @actor_command_window.current_symbol = :skill if @actor_command_window.current_symbol == :rune
  1761.     est_suikoden_rune_on_enemy_cancel
  1762.     @actor_command_window.current_symbol = :rune if @from_rune
  1763.   end
  1764.  
  1765.   alias est_suikoden_rune_on_actor_ok on_actor_ok
  1766.   def on_actor_ok
  1767.     est_suikoden_rune_on_actor_ok
  1768.     @rune_slot_window.deactivate
  1769.     @from_rune = false      
  1770.   end
  1771.   alias est_suikoden_rune_on_actor_cancel on_actor_cancel
  1772.   def on_actor_cancel
  1773.     @actor_command_window.current_symbol = :skill if @actor_command_window.current_symbol == :rune
  1774.     est_suikoden_rune_on_actor_cancel    
  1775.     @actor_command_window.current_symbol = :rune if @from_rune
  1776.   end  
  1777. end
  1778.  
  1779. # Rune Menu Patch
  1780. module SceneManager
  1781.   class << self; alias est_rune_menu_hijack_call call; end  
  1782.   def self.call(scene_class)
  1783.     scene_class = Scene_MenuRune if scene_class == Scene_Skill && $game_system.rune_skill_mode
  1784.     est_rune_menu_hijack_call(scene_class)
  1785.   end
  1786. end
  1787.  
  1788. class Scene_MenuRune < Scene_Skill
  1789.   alias est_suikoden_rune_create_command_window create_command_window
  1790.   def create_command_window
  1791.     est_suikoden_rune_create_command_window
  1792.     wx = @command_window.x
  1793.     wy = @command_window.y
  1794.     ww = 250
  1795.     @command_window.dispose
  1796.     @command_window = Window_MenuRune.new(wx, wy, ww)
  1797.     @command_window.viewport = @viewport
  1798.     @command_window.help_window = @help_window
  1799.     @command_window.actor = @actor
  1800.     @command_window.set_handler(:skill,    method(:command_skill))
  1801.     @command_window.set_handler(:cancel,   method(:return_scene))
  1802.     @command_window.set_handler(:pagedown, method(:next_actor))
  1803.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1804.   end  
  1805.   alias est_suikoden_rune_create_status_window create_status_window
  1806.   def create_status_window
  1807.     est_suikoden_rune_create_status_window
  1808.     wx = @status_window.x
  1809.     wy = @status_window.y
  1810.     ww = @status_window.width
  1811.     ww = Graphics.width - @command_window.width
  1812.     @status_window.dispose
  1813.     @status_window = Window_MenuRuneStatus.new(wx, wy, ww)#(@command_window.width, y)#Window_MenuRune.new(wx, wy, ww)
  1814.     @status_window.viewport = @viewport
  1815.     @status_window.actor = @actor    
  1816.   end  
  1817. end
  1818.  
  1819. class Window_MenuRuneStatus < Window_SkillStatus
  1820.   def initialize(x, y, w)
  1821.     @width = w
  1822.     super(x, y)
  1823.     @actor = nil
  1824.   end
  1825.   def window_width
  1826.     return @width
  1827.   end    
  1828.   def refresh
  1829.     contents.clear
  1830.     return unless @actor
  1831.     draw_actor_face(@actor, 0, 0)
  1832.     draw_actor_simple_status(@actor, 108, 0)
  1833.   end
  1834.   def draw_actor_simple_status(actor, x, y)
  1835.     draw_actor_name(actor, x, y)
  1836.     draw_actor_level(actor, contents_width-55, y + line_height * 1)
  1837.     draw_actor_icons(actor, 0, y + line_height * 3)
  1838.     draw_actor_class(actor, x , y + line_height * 1,contents_width-108-60)
  1839.     draw_actor_hp(actor, x, y + line_height * 2, contents_width-108)
  1840.     draw_actor_mp(actor, x, y + line_height * 3, contents_width-108)
  1841.   end
  1842.   def draw_actor_hp(actor, x, y, width = 160)
  1843.     draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1844.     change_color(system_color)
  1845.     draw_text(x, y, 30, line_height, Vocab::hp_a)
  1846.     draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  1847.       hp_color(actor), normal_color)
  1848.   end
  1849.   def draw_actor_mp(actor, x, y, width = 160)
  1850.     if $imported[:ve_mp_level]
  1851.     draw_actor_mp_level(actor, x, y, width)
  1852.     else
  1853.     draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1854.     change_color(system_color)
  1855.     draw_text(x, y, 30, line_height, Vocab::mp_a)
  1856.     draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  1857.       mp_color(actor), normal_color)
  1858.     end
  1859.   end
  1860.  
  1861. end
  1862.  
  1863. class Window_MenuRune < Window_SkillCommand
  1864.   def initialize(x, y, w)
  1865.     @width = w
  1866.     super(x, y)
  1867.     @actor = nil
  1868.   end
  1869.   def window_width
  1870.     return @width
  1871.   end    
  1872.   def make_command_list
  1873.     return unless @actor
  1874.     @actor.runes.each do |rune|
  1875.       name = rune ? rune.name : "None"
  1876.       stype = rune ? get_stype(rune) : 0
  1877.       add_command(name, :skill, true, stype)
  1878.     end
  1879.   end
  1880.   def rune
  1881.     @actor && @actor.runes && index >= 0 ? @actor.runes[index] : nil
  1882.   end
  1883.   def update_help
  1884.     @help_window.set_item(rune)
  1885.   end  
  1886.   def draw_item(index)
  1887.     runeslotname = @actor.rune_slots_name[index]
  1888.     rect = item_rect_for_text(index)
  1889.     change_color(system_color, command_enabled?(index))
  1890.     draw_text(rect.x, rect.y, ESTRIOLE::RUNE_SLOT_SPACE, line_height, runeslotname,3)
  1891.     item = @actor.runes[index]
  1892.     dx = rect.x + ESTRIOLE::RUNE_SLOT_SPACE
  1893.     dw = contents.width - dx - 24
  1894.     if item.nil?
  1895.       draw_nothing_equip(dx, rect.y, false, dw)
  1896.     else
  1897.       draw_item_name(item, dx, rect.y, command_enabled?(index), dw)
  1898.     end
  1899.   end
  1900.  
  1901.   def draw_nothing_equip(dx, dy, enabled, dw)
  1902.     change_color(normal_color, enabled)
  1903.     draw_icon(Icon.nothing_equip, dx, dy, enabled)
  1904.     text = "Nothing"
  1905.     draw_text(dx + 24, dy, dw - 24, line_height, text)
  1906.   end  
  1907.  
  1908.   def get_stype(item)
  1909.     features = item.features
  1910.     features.each do |ft|
  1911.       return ft.data_id if ft.code == 41
  1912.     end
  1913.     return 0
  1914.   end
  1915. end
  1916.  
  1917. #compatibility patch for falcao mana stones. he didn't use imported but
  1918. #the method is not used in other script so i guess it doesn't matter.
  1919. class Scene_Rune < Scene_Equip
  1920.   def update_manacalling
  1921.   end
  1922.   def update_enchant_help
  1923.   end
  1924. end
  1925.  
  1926. #compatibility patch for Nasty extra stats. you have to modify the window to
  1927. #show the extra stats yourself though. this patch only to make equipped runes
  1928. #can grant xstats
  1929. if chk_nastyextrastats = Z26::STATS rescue false
  1930.   class Game_Actor < Game_Battler
  1931.     alias est_nasty_compt_change_rune change_rune
  1932.     def change_rune(slot_id, item)
  1933.       last_item = @runes[slot_id]
  1934.       est_nasty_compt_change_rune(slot_id, item)
  1935.       z26variate_equip(item)
  1936.       z26variate_equip(last_item, false)
  1937.     end
  1938.   end
  1939. end
  1940.  
  1941. # yanfly menu engine auto add patch
  1942. class Scene_Menu < Scene_MenuBase
  1943.   alias est_on_personal_ok on_personal_ok
  1944.   def on_personal_ok
  1945.     case @command_window.current_symbol
  1946.     when :est_rune_attach
  1947.       SceneManager.call(Scene_Rune)
  1948.     when :est_rune_skill
  1949.       SceneManager.call(Scene_MenuRune)
  1950.     when :est_rune_shop
  1951.       SceneManager.call(Scene_RuneShop)
  1952.     else
  1953.       est_on_personal_ok
  1954.     end
  1955.   end      
  1956.   def command_est_rune_skill
  1957.     command_personal
  1958.   end
  1959.   def command_est_rune_attach
  1960.     command_personal
  1961.   end
  1962.   def command_est_rune_shop
  1963.     command_personal
  1964.   end
  1965. end
  1966.  
  1967. # formar ATB/Stamina compatibility patch. make sure my script BELOW formar ATB/Stamina
  1968. if chk_formar_atb = CBS::MAX_STAMINA rescue false
  1969.   class Scene_Battle < Scene_Base
  1970.     def inputting?
  1971.       return @actor_command_window.active || @skill_window.active ||
  1972.         @item_window.active || @actor_window.active || @enemy_window.active ||
  1973.         @rune_slot_window.active
  1974.     end  
  1975.   end
  1976. end
Add Comment
Please, Sign In to add comment