Class: RPG::UsableItem
- Inherits:
-
BaseItem
show all
- Defined in:
- lib/rpg/usable_item.rb,
lib/rpg/usable_item/effect.rb,
lib/rpg/usable_item/damage.rb
Defined Under Namespace
Classes: Damage, Effect
Instance Attribute Summary (collapse)
Attributes inherited from BaseItem
#description, #features, #icon_index, #id, #name, #note
Instance Method Summary
(collapse)
Constructor Details
Returns a new instance of UsableItem
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/rpg/usable_item.rb', line 3
def initialize
super
@scope = 0
@occasion = 0
@speed = 0
@success_rate = 100
@repeats = 1
@tp_gain = 0
@hit_type = 0
@animation_id = 0
@damage = RPG::UsableItem::Damage.new
@effects = []
end
|
Instance Attribute Details
- (Object) animation_id
Returns the value of attribute animation_id
61
62
63
|
# File 'lib/rpg/usable_item.rb', line 61
def animation_id
@animation_id
end
|
- (Object) damage
Returns the value of attribute damage
66
67
68
|
# File 'lib/rpg/usable_item.rb', line 66
def damage
@damage
end
|
- (Object) effects
Returns the value of attribute effects
67
68
69
|
# File 'lib/rpg/usable_item.rb', line 67
def effects
@effects
end
|
- (Object) hit_type
Returns the value of attribute hit_type
65
66
67
|
# File 'lib/rpg/usable_item.rb', line 65
def hit_type
@hit_type
end
|
- (Object) occasion
Returns the value of attribute occasion
59
60
61
|
# File 'lib/rpg/usable_item.rb', line 59
def occasion
@occasion
end
|
- (Object) repeats
Returns the value of attribute repeats
63
64
65
|
# File 'lib/rpg/usable_item.rb', line 63
def repeats
@repeats
end
|
- (Object) scope
Returns the value of attribute scope
58
59
60
|
# File 'lib/rpg/usable_item.rb', line 58
def scope
@scope
end
|
- (Object) speed
Returns the value of attribute speed
60
61
62
|
# File 'lib/rpg/usable_item.rb', line 60
def speed
@speed
end
|
- (Object) success_rate
Returns the value of attribute success_rate
62
63
64
|
# File 'lib/rpg/usable_item.rb', line 62
def success_rate
@success_rate
end
|
- (Object) tp_gain
Returns the value of attribute tp_gain
64
65
66
|
# File 'lib/rpg/usable_item.rb', line 64
def tp_gain
@tp_gain
end
|
Instance Method Details
- (Boolean) battle_ok?
43
44
45
|
# File 'lib/rpg/usable_item.rb', line 43
def battle_ok?
[0, 1].include?(@occasion)
end
|
- (Boolean) certain?
49
50
51
|
# File 'lib/rpg/usable_item.rb', line 49
def certain?
@hit_type == 0
end
|
- (Boolean) for_all?
37
38
39
|
# File 'lib/rpg/usable_item.rb', line 37
def for_all?
[2, 8, 10].include?(@scope)
end
|
- (Boolean) for_dead_friend?
22
23
24
|
# File 'lib/rpg/usable_item.rb', line 22
def for_dead_friend?
[9, 10].include?(@scope)
end
|
- (Boolean) for_friend?
19
20
21
|
# File 'lib/rpg/usable_item.rb', line 19
def for_friend?
[7, 8, 9, 10, 11].include?(@scope)
end
|
- (Boolean) for_one?
28
29
30
|
# File 'lib/rpg/usable_item.rb', line 28
def for_one?
[1, 3, 7, 9, 11].include?(@scope)
end
|
- (Boolean) for_opponent?
16
17
18
|
# File 'lib/rpg/usable_item.rb', line 16
def for_opponent?
[1, 2, 3, 4, 5, 6].include?(@scope)
end
|
- (Boolean) for_random?
31
32
33
|
# File 'lib/rpg/usable_item.rb', line 31
def for_random?
[3, 4, 5, 6].include?(@scope)
end
|
- (Boolean) for_user?
25
26
27
|
# File 'lib/rpg/usable_item.rb', line 25
def for_user?
@scope == 11
end
|
- (Boolean) magical?
55
56
57
|
# File 'lib/rpg/usable_item.rb', line 55
def magical?
@hit_type == 2
end
|
46
47
48
|
# File 'lib/rpg/usable_item.rb', line 46
def
[0, 2].include?(@occasion)
end
|
- (Boolean) need_selection?
40
41
42
|
# File 'lib/rpg/usable_item.rb', line 40
def need_selection?
[1, 7, 9].include?(@scope)
end
|
- (Object) number_of_targets
34
35
36
|
# File 'lib/rpg/usable_item.rb', line 34
def number_of_targets
for_random? ? @scope - 2 : 0
end
|
- (Boolean) physical?
52
53
54
|
# File 'lib/rpg/usable_item.rb', line 52
def physical?
@hit_type == 1
end
|