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.
945 946 947 948 949 950 951 |
# File 'lib/R3EXS/RGSS3.rb', line 945 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.
985 986 987 |
# File 'lib/R3EXS/RGSS3.rb', line 985 def critical @critical end |
#element_id ⇒ Object
Returns the value of attribute element_id.
982 983 984 |
# File 'lib/R3EXS/RGSS3.rb', line 982 def element_id @element_id end |
#formula ⇒ Object
Returns the value of attribute formula.
983 984 985 |
# File 'lib/R3EXS/RGSS3.rb', line 983 def formula @formula end |
#type ⇒ Object
Returns the value of attribute type.
981 982 983 |
# File 'lib/R3EXS/RGSS3.rb', line 981 def type @type end |
#variance ⇒ Object
Returns the value of attribute variance.
984 985 986 |
# File 'lib/R3EXS/RGSS3.rb', line 984 def variance @variance end |
Instance Method Details
#drain? ⇒ Boolean
969 970 971 |
# File 'lib/R3EXS/RGSS3.rb', line 969 def drain? [5, 6].include?(@type) end |
#eval(a, b, v) ⇒ Object
977 978 979 |
# File 'lib/R3EXS/RGSS3.rb', line 977 def eval(a, b, v) [Kernel.eval(@formula), 0].max * sign rescue 0 end |
#none? ⇒ Boolean
953 954 955 |
# File 'lib/R3EXS/RGSS3.rb', line 953 def none? @type == 0 end |
#recover? ⇒ Boolean
965 966 967 |
# File 'lib/R3EXS/RGSS3.rb', line 965 def recover? [3, 4].include?(@type) end |
#sign ⇒ Object
973 974 975 |
# File 'lib/R3EXS/RGSS3.rb', line 973 def sign recover? ? -1 : 1 end |
#to_hp? ⇒ Boolean
957 958 959 |
# File 'lib/R3EXS/RGSS3.rb', line 957 def to_hp? [1, 3, 5].include?(@type) end |
#to_mp? ⇒ Boolean
961 962 963 |
# File 'lib/R3EXS/RGSS3.rb', line 961 def to_mp? [2, 4, 6].include?(@type) end |