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