Class: Played

Inherits:
Cards show all
Defined in:
lib/ascension/cards.rb

Instance Attribute Summary

Attributes inherited from Cards

#game, #side

Instance Method Summary collapse

Methods inherited from Cards

#[], #[]=, #banish, #clear!, #each, #empty?, #first, #get_one, #hydrate!, #include?, #index, #pop, #remove, #shuffle!, #size, #to_s_cards

Instance Method Details

#<<(card) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ascension/cards.rb', line 107

def <<(card)
  super
  apply(card)
  
  side.fire_event(Event::CardPlayed.new(:card => card))
  
  if card.kind_of?(Card::Construct)
    remove(card)
    side.constructs << card
  end
end

#apply(card) ⇒ Object



102
103
104
105
106
# File 'lib/ascension/cards.rb', line 102

def apply(card)
  pool.runes += card.runes
  pool.power += card.power
  card.apply_abilities(side)
end

#discard!Object



118
119
120
121
122
# File 'lib/ascension/cards.rb', line 118

def discard!
  each { |c| side.discard << c }
  clear!
  self.pool!
end