Class: RPG::UsableItem::Damage
- Inherits:
-
Object
- Object
- RPG::UsableItem::Damage
- Defined in:
- lib/R3EXS/RGSS3.rb
Instance Attribute Summary collapse
-
#critical ⇒ Object
Returns the value of attribute critical.
-
#element_id ⇒ Object
Returns the value of attribute element_id.
-
#formula ⇒ Object
Returns the value of attribute formula.
-
#type ⇒ Object
Returns the value of attribute type.
-
#variance ⇒ Object
Returns the value of attribute variance.
Instance Method Summary collapse
- #drain? ⇒ Boolean
- #eval(a, b, v) ⇒ Object
-
#initialize ⇒ Damage
constructor
A new instance of Damage.
- #none? ⇒ Boolean
- #recover? ⇒ Boolean
- #sign ⇒ Object
- #to_hp? ⇒ Boolean
- #to_mp? ⇒ Boolean
Constructor Details
#initialize ⇒ Damage
Returns a new instance of Damage.
967 968 969 970 971 972 973 |
# File 'lib/R3EXS/RGSS3.rb', line 967 def initialize @type = 0 @element_id = 0 @formula = '0' @variance = 20 @critical = false end |
Instance Attribute Details
#critical ⇒ Object
Returns the value of attribute critical.
1007 1008 1009 |
# File 'lib/R3EXS/RGSS3.rb', line 1007 def critical @critical end |
#element_id ⇒ Object
Returns the value of attribute element_id.
1004 1005 1006 |
# File 'lib/R3EXS/RGSS3.rb', line 1004 def element_id @element_id end |
#formula ⇒ Object
Returns the value of attribute formula.
1005 1006 1007 |
# File 'lib/R3EXS/RGSS3.rb', line 1005 def formula @formula end |
#type ⇒ Object
Returns the value of attribute type.
1003 1004 1005 |
# File 'lib/R3EXS/RGSS3.rb', line 1003 def type @type end |
#variance ⇒ Object
Returns the value of attribute variance.
1006 1007 1008 |
# File 'lib/R3EXS/RGSS3.rb', line 1006 def variance @variance end |
Instance Method Details
#drain? ⇒ Boolean
991 992 993 |
# File 'lib/R3EXS/RGSS3.rb', line 991 def drain? [5, 6].include?(@type) end |
#eval(a, b, v) ⇒ Object
999 1000 1001 |
# File 'lib/R3EXS/RGSS3.rb', line 999 def eval(a, b, v) [Kernel.eval(@formula), 0].max * sign rescue 0 end |
#none? ⇒ Boolean
975 976 977 |
# File 'lib/R3EXS/RGSS3.rb', line 975 def none? @type == 0 end |
#recover? ⇒ Boolean
987 988 989 |
# File 'lib/R3EXS/RGSS3.rb', line 987 def recover? [3, 4].include?(@type) end |
#sign ⇒ Object
995 996 997 |
# File 'lib/R3EXS/RGSS3.rb', line 995 def sign recover? ? -1 : 1 end |
#to_hp? ⇒ Boolean
979 980 981 |
# File 'lib/R3EXS/RGSS3.rb', line 979 def to_hp? [1, 3, 5].include?(@type) end |
#to_mp? ⇒ Boolean
983 984 985 |
# File 'lib/R3EXS/RGSS3.rb', line 983 def to_mp? [2, 4, 6].include?(@type) end |