estriole

EST - SKILL TYPE SEAL MANAGER

Feb 8th, 2013
484
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2. EST - SKILL TYPE SEAL MANAGER
  3. v.1.0
  4.  
  5. version history
  6. v.1.0 - 2013.02.08 - finish the script
  7.  
  8. Feature:
  9. 1) seal the skill type COMMAND in battle.
  10. 2) can seal ALL skill type using notetags (instead of adding it one by one)
  11. 3) can seal skill type which belong to certain category (you define it)
  12.    instead of adding it one by one.
  13.  
  14. Introduction:
  15. when we add skill type to actor and then add trait to seal that skill type...
  16. in battle the command of that skill type still enabled. then when we enter the command
  17. inside the skill list then the skills are all greyed. this script change this behavior.
  18. so now the skill type COMMAND is greyed instead. it will inform player faster
  19. that those skill types is Sealed (because of enemy making you silenced, etc).
  20. without need to enter the skill window to know that that skill type sealed.
  21.  
  22. this script also provide way to add notetags to seal ALL skill type instead of adding
  23. each skill type you want to seal one by one to traits box.
  24.  
  25. this script also provide way to add notetags to seal CERTAIN group of skill type
  26. instead of adding each skill type you want to seal one by one to trait box.
  27.  
  28. Compatibility
  29. if using any script that change 'attack'/'guard' skill id such as yanfly weapon attack replace,
  30. victor's attack and guard skill, and other...
  31.  
  32. you MUST made the attack and guard skill SKILL TYPE to None. or it will be disabled too
  33. when you give tag <all_stype_seal>. since basically the attack, and guard is also skill.
  34. and if have skill type it will check if the skill type sealed then the command is sealed.
  35.  
  36. if you still NEED to use stype_id for your attack / guard skill. for whatever the purpose is...
  37. add the configuration what skill type id that don't get sealed using all skill seal  
  38. then you need to seal the stype manually using trait box.
  39.  
  40. How to use:
  41. basically just seal the skill via trait box and you'll see the difference.
  42.  
  43. advanced usage:
  44. 1) seal all skill type:
  45. give notetags to actor/class/subclass/weapon/armor/state
  46. <all_stype_seal>
  47.  
  48. 2) seal skill type by category:
  49. first define the category inside the hash in module ESTRIOLE.
  50. format is like this:
  51. :category => [stypeid,stypeid,stypeid,stypeid],
  52. then just give notetags to the actor/class/subclass/weapon/armor/state
  53. <x_stype_seal>
  54. where x replaced by the category name you define above (minus :)
  55.  
  56. =end
  57.  
  58. module ESTRIOLE
  59.   EXCLUDED_STYPE_SEAL_ALL = []  # array of stype id that NOT sealed when using <all_stype_seal> notetags
  60.                                    # Skill type: "None" will ALWAYS excluded  
  61.   STYPE_CATEGORY = { #do not touch
  62.   :physical => [1,8],         #add your category here (:category). then add the stype id in that category
  63.   :magical => [2,3,4,5,6,7],  #don't forget give ,(coma) at end of category.
  64.   :supernatural => [8,2,3],   #remember don't use :all as category. since it won't be read.
  65.  
  66.   }#do not touch
  67.   #----------------------------------------------------------------------------#
  68.   # from above setting you can use notetags like this:
  69.   #  <x_stype_seal>
  70.   #  x=> your category name
  71.   #
  72.   # from above example:
  73.   #  <physical_stype_seal> -> will seal stype 1 and 8
  74.   #
  75.   #----------------------------------------------------------------------------#
  76. end
  77.  
  78. class RPG::BaseItem
  79.   def all_stype_seal?
  80.     return false if !@note[/<all_stype_seal>/i]
  81.     return true if @note[/<all_stype_seal>/i]
  82.   end
  83.   def stype_category_seal?(cat)
  84.     return false if !@note[/<#{cat}_stype_seal>/i]
  85.     return true if @note[/<#{cat}_stype_seal>/i]
  86.   end
  87. end
  88.  
  89. class Game_Actor < Game_Battler
  90.   def all_stype_seal?
  91.     return true if actor.all_stype_seal?
  92.     return true if $data_classes[@class_id].all_stype_seal?
  93.     return true if $imported["YEA-ClassSystem"] &&
  94.                    $data_classes[@subclass_id] &&
  95.                    $data_classes[@subclass_id].all_stype_seal?
  96.     equips.each do |equip|
  97.      next if !equip
  98.      return true if equip.all_stype_seal?
  99.     end    
  100.     states.each do |state|
  101.      return true if state.all_stype_seal?
  102.     end
  103.     return false
  104.   end
  105.   def stype_category_seal?(cat)
  106.     return true if actor.stype_category_seal?(cat)
  107.     return true if $data_classes[@class_id].stype_category_seal?(cat)
  108.     return true if $imported["YEA-ClassSystem"] &&
  109.                    $data_classes[@subclass_id] &&
  110.                    $data_classes[@subclass_id].stype_category_seal?(cat)
  111.     equips.each do |equip|
  112.      next if !equip
  113.      return true if equip.stype_category_seal?(cat)
  114.     end    
  115.     states.each do |state|
  116.      return true if state.stype_category_seal?(cat)
  117.     end
  118.     return false    
  119.   end
  120.   alias est_stype_seal_modify_skill_type_sealed? skill_type_sealed?  
  121.   def skill_type_sealed?(stype_id)
  122.     excluded = [0] + ESTRIOLE::EXCLUDED_STYPE_SEAL_ALL
  123.     return true if all_stype_seal? && !excluded.include?(stype_id)
  124.     ESTRIOLE::STYPE_CATEGORY.each do |cat|
  125.      return true if stype_category_seal?(cat[0].to_s) if cat[1].include?(stype_id) && stype_id != 0
  126.     end
  127.     est_stype_seal_modify_skill_type_sealed?(stype_id)
  128.   end
  129. end
  130.  
  131. class Window_ActorCommand < Window_Command
  132.   alias est_stype_seal_modify_command_list make_command_list
  133.   def make_command_list
  134.     est_stype_seal_modify_command_list
  135.     modify_stype_seal
  136.   end
  137.   def modify_stype_seal
  138.     @list.each do |command|
  139.       next if command[:symbol] != :skill
  140.       command[:enabled] = command[:enabled] && !@actor.skill_type_sealed?(command[:ext]) if command[:ext] != nil
  141.     end
  142.   end
  143. end
RAW Paste Data