Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #
  3. #Use the switch to determine the item's availability.
  4. #
  5. #How to use
  6. #Put <ITEM_USE_SWITCH_n> (n is the switch number) in the item Note box.
  7. #When that switch is ON, the item cannot be used.
  8. #
  9. #★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  10.  
  11. #--------------------------------------------------------------------------
  12. # ★ Switch number to enable
  13. #--------------------------------------------------------------------------
  14. class RPG::BaseItem
  15.   def item_use_switch
  16.     /<ITEM_USE_SWITCH_(\d+)>/ =~ note ? $1.to_i : 0
  17.   end
  18. end
  19.  
  20.  
  21. #==============================================================================
  22. # ■ Game_BattlerBase
  23. #------------------------------------------------------------------------------
  24. # Class for handling battlers. Includes ability value and calculation methods.
  25. # This class is used as a superclass of the Game_BattlerBase.
  26. #==============================================================================
  27. class Game_BattlerBase
  28.   #--------------------------------------------------------------------------
  29.   # ● Skill / item availability check
  30.   #--------------------------------------------------------------------------
  31.   def usable?(item)
  32.     if item != nil
  33.       if item.item_use_switch != 0
  34.         return false if $game_switches[item.item_use_switch] == true
  35.       end
  36.     end
  37.     return skill_conditions_met?(item) if item.is_a?(RPG::Skill)
  38.     return item_conditions_met?(item)  if item.is_a?(RPG::Item)
  39.     return false
  40.   end
  41. end