Class: RPG::UsableItem::Damage
- Inherits:
-
Object
- Object
- RPG::UsableItem::Damage
- Defined in:
- lib/rgss3/rpg.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.
527 528 529 530 531 532 533 |
# File 'lib/rgss3/rpg.rb', line 527 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.
559 560 561 |
# File 'lib/rgss3/rpg.rb', line 559 def critical @critical end |
#element_id ⇒ Object
Returns the value of attribute element_id.
556 557 558 |
# File 'lib/rgss3/rpg.rb', line 556 def element_id @element_id end |
#formula ⇒ Object
Returns the value of attribute formula.
557 558 559 |
# File 'lib/rgss3/rpg.rb', line 557 def formula @formula end |
#type ⇒ Object
Returns the value of attribute type.
555 556 557 |
# File 'lib/rgss3/rpg.rb', line 555 def type @type end |
#variance ⇒ Object
Returns the value of attribute variance.
558 559 560 |
# File 'lib/rgss3/rpg.rb', line 558 def variance @variance end |
Instance Method Details
#drain? ⇒ Boolean
546 547 548 |
# File 'lib/rgss3/rpg.rb', line 546 def drain? [5,6].include?(@type) end |
#eval(a, b, v) ⇒ Object
552 553 554 |
# File 'lib/rgss3/rpg.rb', line 552 def eval(a, b, v) [Kernel.eval(@formula), 0].max * sign rescue 0 end |
#none? ⇒ Boolean
534 535 536 |
# File 'lib/rgss3/rpg.rb', line 534 def none? @type == 0 end |
#recover? ⇒ Boolean
543 544 545 |
# File 'lib/rgss3/rpg.rb', line 543 def recover? [3,4].include?(@type) end |
#sign ⇒ Object
549 550 551 |
# File 'lib/rgss3/rpg.rb', line 549 def sign recover? ? -1 : 1 end |
#to_hp? ⇒ Boolean
537 538 539 |
# File 'lib/rgss3/rpg.rb', line 537 def to_hp? [1,3,5].include?(@type) end |
#to_mp? ⇒ Boolean
540 541 542 |
# File 'lib/rgss3/rpg.rb', line 540 def to_mp? [2,4,6].include?(@type) end |