Class: RPG::UsableItem::Damage

Inherits:
Object
  • Object
show all
Defined in:
lib/R3EXS/RGSS3.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDamage

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

#criticalObject

Returns the value of attribute critical.



985
986
987
# File 'lib/R3EXS/RGSS3.rb', line 985

def critical
  @critical
end

#element_idObject

Returns the value of attribute element_id.



982
983
984
# File 'lib/R3EXS/RGSS3.rb', line 982

def element_id
  @element_id
end

#formulaObject

Returns the value of attribute formula.



983
984
985
# File 'lib/R3EXS/RGSS3.rb', line 983

def formula
  @formula
end

#typeObject

Returns the value of attribute type.



981
982
983
# File 'lib/R3EXS/RGSS3.rb', line 981

def type
  @type
end

#varianceObject

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

Returns:

  • (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

Returns:

  • (Boolean)


953
954
955
# File 'lib/R3EXS/RGSS3.rb', line 953

def none?
    @type == 0
end

#recover?Boolean

Returns:

  • (Boolean)


965
966
967
# File 'lib/R3EXS/RGSS3.rb', line 965

def recover?
    [3, 4].include?(@type)
end

#signObject



973
974
975
# File 'lib/R3EXS/RGSS3.rb', line 973

def sign
    recover? ? -1 : 1
end

#to_hp?Boolean

Returns:

  • (Boolean)


957
958
959
# File 'lib/R3EXS/RGSS3.rb', line 957

def to_hp?
    [1, 3, 5].include?(@type)
end

#to_mp?Boolean

Returns:

  • (Boolean)


961
962
963
# File 'lib/R3EXS/RGSS3.rb', line 961

def to_mp?
    [2, 4, 6].include?(@type)
end