CyberForte

DoW HiddenSkill

Oct 10th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.91 KB | None | 0 0
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆               Hidden Skills - KGC_HiddenSkill              ◆ VX ◆
  3. #_/    ◇                  Last update : 2008/03/08                       ◇
  4. #_/    ◇                 Translation by Mr. Anonymous                    ◇
  5. #_/----------------------------------------------------------------------------
  6. #_/                       ◆ 2008/03/08 UPDATE ◆          
  7. #_/                     Compatablity is KCG_OverDrive
  8. #_/----------------------------------------------------------------------------
  9. #_/        Installation Note: Insert over other skill-related scripts.
  10. #_/----------------------------------------------------------------------------
  11. #_/  This script allows a designer to assign certain skills as 'hidden'.
  12. #_/  It primarly enhances effects like passive skills. I'm sure there are other
  13. #_/  creative uses. To utilize this effect, add <HIDDEN> in the specified
  14. #_/  skill's "Note" box.
  15. #_/============================================================================
  16. #_/  This script is meant to augment the KCG_PassiveSkill script.
  17. #_/  That script is not required however.
  18. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  19.  
  20. #==============================================================================
  21. # ★ Customization ★
  22. #==============================================================================
  23.  
  24. module KGC
  25. module HiddenSkill
  26.   # ◆ Hide the skill in the main skill menu.
  27.   HIDE_IN_MAP    = true
  28.   # ◆ Hide the skill in the battle skill menu.
  29.   HIDE_IN_BATTLE = true
  30.  
  31.   # This toggle automatically hides all skills tagged as <passive> when used
  32.   #  in conjunction with KCG_PassiveSkill
  33.   HIDE_PASSIVE_SKILL = true
  34. end
  35. end
  36.  
  37. # ◆ The Trigger for this effect is <hide> or <HIDDEN>.
  38.  
  39. $imported = {} if $imported == nil
  40. $imported["HiddenSkill"] = true
  41.  
  42. module KGC::HiddenSkill
  43.   # Regular Expression Definition
  44.   module Regexp
  45.     # Base Skill Module
  46.     module Skill
  47.       # Hidden (skill) String Tag
  48.       HIDDEN = /<(?:HIDDEN|hide)>/i
  49.     end
  50.   end
  51. end
  52.  
  53. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  54.  
  55. #==============================================================================
  56. # ■ RPG::Skill
  57. #==============================================================================
  58.  
  59. class RPG::Skill < RPG::UsableItem
  60.   #--------------------------------------------------------------------------
  61.   # ○ If the skill isn't hidden...
  62.   #--------------------------------------------------------------------------
  63.   def create_hidden_skill_cache
  64.     @__hidden = false
  65.  
  66.     self.note.split(/[\r\n]+/).each { |line|
  67.       case line
  68.       when KGC::HiddenSkill::Regexp::Skill::HIDDEN
  69.         # 非表示
  70.         @__hidden = true
  71.       end
  72.     }
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ○ If the skill is hidden...
  76.   #--------------------------------------------------------------------------
  77.   def hidden?
  78.     create_hidden_skill_cache if @__hidden == nil
  79.     return @__hidden
  80.   end
  81. end
  82.  
  83. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  84.  
  85. #==============================================================================
  86. # ■ Window_Skill
  87. #------------------------------------------------------------------------------
  88. # Imports settings incase KCG_PassiveSkill is imported.
  89. #==============================================================================
  90.  
  91. class Window_Skill < Window_Selectable
  92.   #--------------------------------------------------------------------------
  93.   # ○ Import Passive Skills
  94.   #     skill : passive
  95.   #--------------------------------------------------------------------------
  96.   unless $@
  97.     alias include_KGC_HiddenSkill? include? if method_defined?(:include?) unless $@
  98.   end
  99.   def include?(skill)
  100.     return false if skill == nil
  101.  
  102.     if defined?(include_KGC_HiddenSkill?)
  103.       return false unless include_KGC_HiddenSkill?(skill)
  104.     end
  105.  
  106.     hide = ($game_temp.in_battle ?
  107.       KGC::HiddenSkill::HIDE_IN_BATTLE : KGC::HiddenSkill::HIDE_IN_MAP)
  108.     return false if hide && skill.hidden?
  109.  
  110.     if $imported["PassiveSkill"] && KGC::HiddenSkill::HIDE_PASSIVE_SKILL
  111.       return false if skill.passive
  112.     end
  113.  
  114.     return true
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● Refresh
  118.   #--------------------------------------------------------------------------
  119.   def refresh
  120.     @data = []
  121.     for skill in @actor.skills
  122.       next unless include?(skill)
  123.       @data.push(skill)
  124.       if skill.id == @actor.last_skill_id
  125.         self.index = @data.size - 1
  126.       end
  127.     end
  128.     @item_max = @data.size
  129.     create_contents
  130.     for i in 0...@item_max
  131.       draw_item(i)
  132.     end
  133.   end
  134. end
Advertisement
Add Comment
Please, Sign In to add comment