Class: Parse::Phrase::Basic

Inherits:
Base show all
Defined in:
lib/ascension/parse.rb

Instance Attribute Summary

Attributes inherited from Base

#category, #raw

Instance Method Summary collapse

Methods inherited from Base

#ability, #add_honor, #add_power, #draw_cards, #trigger

Instance Method Details

#mod_card(card) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/ascension/parse.rb', line 101

def mod_card(card)
  if category == :runes
    card.runes += before_clause.to_i if before_clause.to_i > 0
  elsif category == :power || category == :add_power
    card.power += before_clause.to_i
  elsif category == :draw_cards
    card.abilities << lambda do |side|
      draw_cards(side)
    end
  elsif category.kind_of?(Class)
    card.abilities << category.new(:optional => optional, :parent_card => card)
  else
    raise "unknown category #{category}"
  end
end