Class: Ability::DoCenterAction

Inherits:
BaseChoice show all
Defined in:
lib/ascension/ability.rb

Instance Attribute Summary

Attributes inherited from Base

#parent_card

Instance Method Summary collapse

Methods inherited from BaseChoice

#call, #card_choice, #side_for_card_choice

Methods inherited from Base

#call_until_nil, #choice_instance

Instance Method Details

#action(card, side) ⇒ Object



147
148
149
150
151
152
153
# File 'lib/ascension/ability.rb', line 147

def action(card,side)
  if card.monster?
    side.defeat(card)
  else
    side.purchase(card)
  end
end

#can?(card, side) ⇒ Boolean

Returns:

  • (Boolean)


139
140
141
142
143
144
145
146
# File 'lib/ascension/ability.rb', line 139

def can?(card,side)
  if card.monster?
    raise card.name unless card.power_cost
    side.played.pool.power >= card.power_cost
  else
    side.played.pool.can_purchase?(card)
  end
end

#choosable_cards(side) ⇒ Object



136
137
138
# File 'lib/ascension/ability.rb', line 136

def choosable_cards(side)
  side.game.center_wc.select { |x| can?(x,side) }
end

#optionalObject



135
# File 'lib/ascension/ability.rb', line 135

def optional; true; end