Class: FetchLandCard
Instance Attribute Summary collapse
Attributes inherited from Card
#card_type, #id, #side
Instance Method Summary
collapse
Methods inherited from TapLandCard
#step_in_plays, #tapped?, #tappend=
Methods inherited from Card
#can_play?, #color_identity, #color_identity_size, #converted_mana_cost, #drawed, #edges, #initialize, #is_land?, #mana_cost, #mana_source?, #mana_source_size, #max_flow, #playable?, #played, #played?, #price, #set_code, #step_in_hands, #step_in_plays, #tapped?, #to_s, #type, #types
Constructor Details
This class inherits a constructor from Card
Instance Attribute Details
#deck ⇒ Object
Returns the value of attribute deck.
2
3
4
|
# File 'lib/manasimu/card/fetchland.rb', line 2
def deck
@deck
end
|
Instance Method Details
48
49
50
51
52
53
|
# File 'lib/manasimu/card/fetchland.rb', line 48
def configure
mana_types = ManaType.all
@mana_source = mana_types.map {|mana_type| mana_type.color}.flatten.uniq
@fetched = nil
self
end
|
#first_produce_symbol=(color) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/manasimu/card/fetchland.rb', line 21
def first_produce_symbol=(color)
super(color)
basic_land = @deck
.select { |card| card.instance_of? BasicLandCard }
.select { |card| color.to_i.to_s == color || card.mana_source.include?(color) }
.first
if basic_land
@fetched = color
@deck.delete basic_land
@deck.shuffle!
@fetch_source = basic_land.mana_source
@fetches = [basic_land]
else
raise Exception.new('basic land is empty')
end
@deck
end
|
#mana_produced? ⇒ Boolean
61
62
63
|
# File 'lib/manasimu/card/fetchland.rb', line 61
def mana_produced?
not @fetched.nil?
end
|
#mana_source ⇒ Object
39
40
41
42
|
# File 'lib/manasimu/card/fetchland.rb', line 39
def mana_source
raise Exception.new('you should resolve first') if not @fetch_source
@fetch_source
end
|
#mana_source=(m) ⇒ Object
44
45
46
|
# File 'lib/manasimu/card/fetchland.rb', line 44
def mana_source=(m)
@mana_source = m
end
|
#reset ⇒ Object
55
56
57
58
59
|
# File 'lib/manasimu/card/fetchland.rb', line 55
def reset
super
@fetched = nil
@fetch_source = nil
end
|
#resolve(side, hands, plays, deck) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/manasimu/card/fetchland.rb', line 5
def resolve(side, hands, plays, deck)
super(side, hands, plays, deck)
return @fetch_source if @fetch_source
if deck
@fetches = deck
.select { |card| card.instance_of? BasicLandCard }
.select { |card| @mana_source.include? card.mana_source[0] }
.uniq { |card| card.card_type }
@deck = deck
@fetch_source = @fetches.map { |card| card.mana_source }.flatten.uniq
else
@fetches = []
@fetch_source = []
end
end
|