Class: Card::Base
- Includes:
- HonorEarned, FromHash
- Defined in:
- lib/ascension/card.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#realm ⇒ Object
Returns the value of attribute realm.
Attributes included from HonorEarned
Instance Method Summary collapse
- #apply_abilities(side) ⇒ Object
- #apply_triggers(event, side) ⇒ Object
- #basic_card? ⇒ Boolean
- #construct? ⇒ Boolean
- #hero? ⇒ Boolean
- #hydrated ⇒ Object
- #monster? ⇒ Boolean
- #to_s ⇒ Object
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
33 34 35 |
# File 'lib/ascension/card.rb', line 33 def name @name end |
#realm ⇒ Object
Returns the value of attribute realm.
22 23 24 |
# File 'lib/ascension/card.rb', line 22 def realm @realm end |
Instance Method Details
#apply_abilities(side) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ascension/card.rb', line 34 def apply_abilities(side) if abilities.each { |a| a.call(side) } else abilities.each do |a| if a.respond_to?(:choice_instance) a.choice_instance(side).save! else a.call(side) end end end end |
#apply_triggers(event, side) ⇒ Object
47 48 49 |
# File 'lib/ascension/card.rb', line 47 def apply_triggers(event, side) triggers.each { |a| a.call(event, side) } end |
#basic_card? ⇒ Boolean
59 60 61 |
# File 'lib/ascension/card.rb', line 59 def basic_card? ["Heavy Infantry","Mystic","Cultist","Apprentice","Militia","Standin"].include?(name) end |
#construct? ⇒ Boolean
53 |
# File 'lib/ascension/card.rb', line 53 def construct?; kind_of?(Construct); end |
#hydrated ⇒ Object
63 64 65 66 67 68 |
# File 'lib/ascension/card.rb', line 63 def hydrated return self if basic_card? res = Parse.get(name).clone res.card_id = card_id res end |
#to_s ⇒ Object
55 56 57 |
# File 'lib/ascension/card.rb', line 55 def to_s name end |