Skip to content

Commit

Permalink
Fix all remaining specs
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Nov 7, 2024
1 parent 3ed5b3d commit d1c7be2
Show file tree
Hide file tree
Showing 23 changed files with 33 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/magic/cards/primal_might.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def resolve!(targets:, value_for_x:)
toughness: value_for_x
)

game.tick!

first_creature.fight(second_creature)
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/magic/cards/tide_skimmer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class TideSkimmer < Creature
cost "{3}{U}"
creature_type "Drake"
keywords :flying
power 2
toughness 3

class AttackerTrigger < TriggeredAbility
def should_perform?
Expand Down
4 changes: 1 addition & 3 deletions lib/magic/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ def add_effect(effect)
end

logger.debug "Resolving effect: #{effect}"
result = effect.resolve!
tick!
result
effect.resolve!
end

def tick!
Expand Down
2 changes: 1 addition & 1 deletion spec/cards/animal_sanctuary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def activate_ability
_1.pay_mana(generic: { green: 2 })
_1.targeting(rambunctious_mutt)
end

game.stack.resolve!
game.tick!
end

it "puts a +1/+1 counter on target creature" do
Expand Down
2 changes: 2 additions & 0 deletions spec/cards/basris_solidarity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
it "adds a counter to each creature under p1's control" do
cast_and_resolve(card: subject, player: p1)

game.tick!

expect(wood_elves.counters.count).to eq(1)
expect(wood_elves.power).to eq(2)
expect(wood_elves.toughness).to eq(2)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/bog_badger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
action.pay_kicker(black: 1)
game.take_action(action)
game.stack.resolve!
game.tick!

creatures = p1.creatures
expect(creatures.all? { |c| c.has_keyword?(:menace) }).to eq(true)
Expand Down
2 changes: 2 additions & 0 deletions spec/cards/burn_bright_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
end

game.stack.resolve!
game.tick!

expect(onakke_ogre.power).to eq(6)
expect(onakke_ogre.toughness).to eq(2)
Expand All @@ -36,6 +37,7 @@
_1.pay_mana(red: 1, generic: { red: 2 })
end
game.stack.resolve!
game.tick!

expect(cloudkin_seer.power).to eq(2)
expect(onakke_ogre.power).to eq(6)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/charge_through_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
action.targeting(wood_elves)
game.take_action(action)
game.stack.resolve!
game.tick!
expect(wood_elves.trample?).to eq(true)
expect(charge_through.zone).to be_graveyard
end
Expand Down
1 change: 1 addition & 0 deletions spec/cards/containment_priest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

expect{
game.stack.resolve!
game.tick!
}.to change { game.exile.cards.count }.by(1)
expect(game.battlefield.permanents.count).to eq(1)
expect(game.battlefield.permanents.map(&:name)).to_not include('Story Seeker')
Expand Down
1 change: 1 addition & 0 deletions spec/cards/defiant_strike_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
.targeting(wood_elves)
game.take_action(action)
game.stack.resolve!
game.tick!

buff = wood_elves.modifiers.first
expect(buff.power_modification).to eq(1)
Expand Down
2 changes: 2 additions & 0 deletions spec/cards/doomwake_giant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
end

game.stack.resolve!
game.tick!

aggregate_failures do
expect(p1_ajanis_pridemate.power).to eq(2)
Expand Down Expand Up @@ -50,6 +51,7 @@
end

game.stack.resolve!
game.tick!

aggregate_failures do
expect(p1_ajanis_pridemate.power).to eq(2)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/feat_of_resistance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
action.pay_mana(white: 1, generic: { white: 1})
game.take_action(action)
game.stack.resolve!
game.tick!

expect(wood_elves.power).to eq(2)
expect(wood_elves.toughness).to eq(2)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/grasp_of_darkness_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
.targeting(wood_elves)
game.take_action(action)
game.stack.resolve!
game.tick!
expect(wood_elves.power).to eq(-3)
expect(wood_elves.toughness).to eq(-3)
expect(wood_elves).to be_dead
Expand Down
1 change: 1 addition & 0 deletions spec/cards/heroic_intervention_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

it "all permanents you control gain hexproof and indestructible" do
cast_and_resolve(card: subject)
game.tick!

island = p1.permanents.by_name("Island").first
wood_elves = p1.permanents.by_name("Wood Elves").first
Expand Down
3 changes: 3 additions & 0 deletions spec/cards/massacre_girl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
end

game.stack.resolve!
game.tick!

# This dies to the ETB -1/-1 triggered ability
expect(wood_elves.card.zone).to be_graveyard

game.tick!
# This dies to the "creature died" -1/-1 triggered ability
expect(alpine_watchdog.card.zone).to be_graveyard
end
Expand Down
1 change: 1 addition & 0 deletions spec/cards/primal_might_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
_1.pay_mana(green: 1, x: { green: 3 })
end
game.stack.resolve!
game.tick!

expect(wood_elves.power).to eq(4)
expect(alpine_watchdog.damage).to eq(4)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/rookie_mistake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
_1.pay_mana(blue: 1)
end
game.stack.resolve!
game.tick!

expect(wood_elves.toughness).to eq(3)
expect(pack_leader.power).to eq(0)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/rousing_read_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
end

game.stack.resolve!
game.tick!

choice = game.choices.last
game.resolve_choice!(card: choice.cards.first)
Expand Down
2 changes: 2 additions & 0 deletions spec/cards/shalais_acolyte_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
action.pay_kicker(generic: { white: 1 }, green: 1)
game.take_action(action)
game.stack.resolve!
game.tick!

permanent = p1.creatures.by_name("Shalai's Acolyte").first
expect(permanent.power).to eq(5)
Expand All @@ -26,6 +27,7 @@
action.pay_mana(white: 1, generic: { white: 4 })
game.take_action(action)
game.stack.resolve!
game.tick!

permanent = p1.creatures.by_name("Shalai's Acolyte").first
expect(permanent.power).to eq(3)
Expand Down
2 changes: 2 additions & 0 deletions spec/cards/siege_striker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

action = Magic::Actions::TapPermanent.new(game: game, player: p1, permanent: wood_elves)
game.take_action(action)
game.tick!

expect(siege_striker.power).to eq(2)
expect(siege_striker.toughness).to eq(2)
Expand All @@ -35,6 +36,7 @@

action = Magic::Actions::TapPermanent.new(game: game, player: p1, permanent: wood_elves)
game.take_action(action)
game.tick!

expect(siege_striker.power).to eq(1)
expect(siege_striker.toughness).to eq(1)
Expand Down
2 changes: 2 additions & 0 deletions spec/cards/sure_strike_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
_1.pay_mana(generic: { red: 1 }, red: 1).targeting(onakke_ogre)
end
game.stack.resolve!
game.tick!

expect(onakke_ogre.power).to eq(7)
expect(onakke_ogre.toughness).to eq(2)

game.current_turn.end!
game.current_turn.cleanup!
game.next_turn
game.tick!

expect(onakke_ogre.power).to eq(4)
expect(onakke_ogre.first_strike?).to eq(false)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/titanic_growth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
end

game.stack.resolve!
game.tick!

expect(wood_elves.power).to eq(5)
expect(wood_elves.toughness).to eq(5)
Expand Down
1 change: 1 addition & 0 deletions spec/cards/watcher_of_the_spheres_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
end

it "adds a +1/+1 buff" do
game.tick!
expect(watcher_of_the_spheres.power).to eq(3)
expect(watcher_of_the_spheres.toughness).to eq(3)
end
Expand Down

0 comments on commit d1c7be2

Please sign in to comment.