-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
97 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Magic | ||
module Cards | ||
ReadTheTides = Sorcery("Read the Tides") do | ||
cost generic: 5, blue: 1 | ||
|
||
class DrawThreeCards < Magic::Effect | ||
def resolve | ||
game.add_effect(Effects::DrawCards.new(source: source, player: controller, number_to_draw: 3)) | ||
end | ||
end | ||
|
||
class ReturnUpToTwoTargetCreatures < Magic::Effect | ||
def choices | ||
game.battlefield.creatures | ||
end | ||
|
||
def targeting(*targets) | ||
@targets = targets | ||
self | ||
end | ||
|
||
def resolve | ||
targets.each(&:return_to_hand) | ||
end | ||
end | ||
|
||
modes DrawThreeCards, ReturnUpToTwoTargetCreatures | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,10 @@ def game | |
source.game | ||
end | ||
|
||
def controller | ||
source.controller | ||
end | ||
|
||
def requires_targets? | ||
false | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Magic::Cards::ReadTheTides do | ||
include_context "two player game" | ||
|
||
let(:read_the_tides) { Card("Read The Tides") } | ||
|
||
it "chooses draw three cards" do | ||
expect(p1).to receive(:draw!).exactly(3).times | ||
|
||
mode_class = read_the_tides.modes.first | ||
|
||
p1.add_mana(blue: 6) | ||
p1.cast(card: read_the_tides, mode: read_the_tides.choose_mode(mode_class)) do | ||
_1.pay_mana(blue: 1, generic: { blue: 5 }) | ||
end | ||
|
||
game.tick! | ||
end | ||
|
||
context "wood elves on the field" do | ||
let!(:wood_elves) { ResolvePermanent("Wood Elves", owner: p2) } | ||
|
||
it "chooses return a single target" do | ||
mode_class = read_the_tides.modes.last | ||
p1.add_mana(blue: 6) | ||
p1.cast(card: read_the_tides, mode: read_the_tides.choose_mode(mode_class).targeting(wood_elves)) do | ||
_1.pay_mana(blue: 1, generic: { blue: 5 }) | ||
end | ||
|
||
game.tick! | ||
expect(p2.hand.by_name("Wood Elves").count).to eq(1) | ||
end | ||
end | ||
end |