Class: Card::Base

Inherits:
Object show all
Includes:
HonorEarned, FromHash
Defined in:
lib/ascension/card.rb

Direct Known Subclasses

Monster, Purchaseable

Instance Attribute Summary collapse

Attributes included from HonorEarned

#honor_earned

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



33
34
35
# File 'lib/ascension/card.rb', line 33

def name
  @name
end

#realmObject

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 playing_on_command_line?
    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

Returns:

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

Returns:

  • (Boolean)


53
# File 'lib/ascension/card.rb', line 53

def construct?; kind_of?(Construct); end

#hero?Boolean

Returns:

  • (Boolean)


52
# File 'lib/ascension/card.rb', line 52

def hero?; kind_of?(Hero); end

#hydratedObject



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

#monster?Boolean

Returns:

  • (Boolean)


51
# File 'lib/ascension/card.rb', line 51

def monster?; kind_of?(Monster); end

#to_sObject



55
56
57
# File 'lib/ascension/card.rb', line 55

def to_s
  name
end