Class: Ability::ChoiceInstance

Inherits:
Object
  • Object
show all
Includes:
FromHash
Defined in:
lib/ascension/ability.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#choiceObject

Returns the value of attribute choice.



11
12
13
# File 'lib/ascension/ability.rb', line 11

def choice
  @choice
end

#sideObject

Returns the value of attribute side.



11
12
13
# File 'lib/ascension/ability.rb', line 11

def side
  @side
end

Instance Method Details

#addl_json_attributesObject



14
15
16
# File 'lib/ascension/ability.rb', line 14

def addl_json_attributes
  %w(choosable_cards name)
end

#delete!Object



37
38
39
# File 'lib/ascension/ability.rb', line 37

def delete!
  side.choices -= [self]
end

#execute!(chosen_card) ⇒ Object



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

def execute!(chosen_card)
  choice.action(chosen_card,side)
  delete!
end

#nameObject



17
18
19
# File 'lib/ascension/ability.rb', line 17

def name
  choice.class.to_s
end

#save!Object



28
29
30
# File 'lib/ascension/ability.rb', line 28

def save!
  side.choices << self
end