manasimu 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c73ee6bfefc5a1611b3170d86b8dc27dbf75c58f2dc3f2be7d570679cedfab3
4
- data.tar.gz: f771ef43cafe46bcc75eed2c0964c42e39f32d7c1ab92a0e09e1a5b6ad6b4845
3
+ metadata.gz: edeb30bfc6e2c9a608856f5806fd5b34b8ab9cd6930462cd0dae8e219de08194
4
+ data.tar.gz: dc7eaa4a60ea42b6a842ccc13df0a4831ba4d805c0f12b2ecfa5d7969aed5304
5
5
  SHA512:
6
- metadata.gz: c1e61d71e665d98b74a8cfa52d877e2131be56484fdee9d78d85b1e072d5ffa5172444b7c0683c30c94e113f9876048b31d4bbb4af528fac08296d2650bb6ce1
7
- data.tar.gz: 5a6ea06c33e3227a1f4f74be5a6d4266069090ecda660e29ad7c9b717891367d4764943726f2a0cd32632fafd6e58e505526c6809ed0da87e67b3b133382dd7d
6
+ metadata.gz: 1647c593a3f49a13ecf430ff9aaf8df1d7286c74e73b179fc04b2badd05b72c2be9ee5ac44d8c2e1cb32d8ae8b7e6458c54e26b57f5b11f2fcf9e8b33f5486cf
7
+ data.tar.gz: a2398b09125d7b7fa8538e4068a48f3dceb3d0262b4b9e1a9ebdc174ff2f1cb4f236965f66329f55d6f2b23cc85abbb5f707529daa1b68097c1ed07094d9c8ec
data/lib/manasimu/card.rb CHANGED
@@ -7,12 +7,12 @@ class Card
7
7
  end
8
8
 
9
9
  def step_in_hands(turn)
10
- @card_type.step_in_hands(turn - 1, self)
10
+ @card_type.step_in_hands(turn, self)
11
11
  @can_play = false
12
12
  end
13
13
 
14
14
  def step_in_plays(turn)
15
- @card_type.step_in_plays(turn - 1, self)
15
+ @card_type.step_in_plays(turn, self)
16
16
  end
17
17
 
18
18
  def drawed(turn)
@@ -140,14 +140,14 @@ class CardType
140
140
  end
141
141
 
142
142
  def step_in_hands(turn, card)
143
- if turn >= 0 and card.can_play?
143
+ if card.can_play?
144
144
  @can_plays[turn] ||= 0
145
145
  @can_plays[turn] += 1
146
146
  end
147
147
  end
148
148
 
149
149
  def step_in_plays(turn, card)
150
- if turn >= 0 and card.mana_source? and not card.tapped?
150
+ if card.mana_source? and not card.tapped?
151
151
  @mana_sources[turn] ||= {}
152
152
  size = card.color_identity.length
153
153
  card.color_identity.each do |c|
@@ -328,14 +328,14 @@ class CardType
328
328
 
329
329
  def count(turn = nil)
330
330
  turn ||= converted_mana_cost
331
- played = @played [turn] || 0
332
- drawed = 0
331
+ played_count = @played[turn] || 0
332
+ drawed_count = 0
333
333
  (turn+1).times do |i|
334
- drawed += @drawed[i] || 0
334
+ drawed_count += @drawed[i] || 0
335
335
  end
336
- can_played = @can_plays[turn] || 0
337
- mana_sources = @mana_sources[turn] || {}
338
- [played, drawed, can_played, mana_sources]
336
+ can_played_count = @can_plays[turn] || 0
337
+ mana_sources_count = @mana_sources[turn] || {}
338
+ [played_count, drawed_count, can_played_count, mana_sources_count]
339
339
  end
340
340
 
341
341
  def to_s
data/lib/manasimu/game.rb CHANGED
@@ -1,8 +1,12 @@
1
1
  class Game
2
2
  attr_accessor :hands, :plays, :deck
3
3
 
4
- def initialize(deck)
5
- @deck = deck.shuffle(random: Random.new)
4
+ def initialize(deck, shuffle = true)
5
+ if shuffle
6
+ @deck = deck.shuffle(random: Random.new)
7
+ else
8
+ @deck = deck
9
+ end
6
10
  @deck.each { |card| card.reset }
7
11
  @hands = []
8
12
  @plays = []
@@ -17,15 +21,12 @@ class Game
17
21
  # puts "hands"
18
22
  # @hands.each do |card| puts " #{card}" end
19
23
 
20
- upkeep(turn)
21
24
  draw(turn)
25
+ play_cards = plan;
26
+ @hands.each { |card| card.step_in_hands(turn) }
22
27
  plan.each do |card|
23
28
  play(card, turn)
24
29
  end
25
- end
26
-
27
- def upkeep(turn)
28
- @hands.each { |card| card.step_in_hands(turn) }
29
30
  @plays.each { |card| card.step_in_plays(turn) }
30
31
  end
31
32
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manasimu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - so1itaryrove