-
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.
Fixes #229
- Loading branch information
Showing
4 changed files
with
89 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Magic | ||
module Cards | ||
class ExperimentalOverload < Sorcery | ||
card_name "Experimental Overload" | ||
cost "{2}{U}{R}" | ||
|
||
class WeirdToken < Token | ||
token_name "Weird" | ||
colors :blue, :red | ||
creature_type "Weird" | ||
end | ||
|
||
class Choice < Magic::Choice::SearchGraveyard | ||
def choices | ||
source.controller.graveyard | ||
end | ||
|
||
def amount | ||
1 | ||
end | ||
|
||
def resolve!(target:) | ||
target.move_to_hand! | ||
end | ||
end | ||
|
||
def resolve! | ||
weird_power = controller.graveyard.cards.count { |card| card.instant? || card.sorcery? } | ||
weird = controller.create_token( | ||
token_class: WeirdToken, | ||
base_power: weird_power, | ||
base_toughness: weird_power | ||
) | ||
|
||
game.choices.add(Choice.new(source: self)) | ||
end | ||
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
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,33 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Magic::Cards::ExperimentalOverload do | ||
include_context "two player game" | ||
let(:card) { Card("Experimental Overload") } | ||
|
||
before do | ||
p1.graveyard.add(Card("Shock")) | ||
end | ||
|
||
it "creates an X/X blue and red Weird creature token, with X being instant/sorceries in GY" do | ||
p1.add_mana(blue: 3, red: 1) | ||
p1.cast(card: card) do | ||
_1.pay_mana(generic: { blue: 2 }, blue: 1, red: 1) | ||
end | ||
|
||
game.tick! | ||
|
||
weird = creatures.first | ||
expect(weird.name).to eq("Weird") | ||
expect(weird.power).to eq(1) | ||
expect(weird.toughness).to eq(1) | ||
expect(weird.colors).to eq([:blue, :red]) | ||
|
||
choice = game.choices.first | ||
expect(choice).to be_a(Magic::Choice::SearchGraveyard) | ||
|
||
choice.resolve!(target: p1.graveyard.cards.first) | ||
|
||
shock = p1.hand.by_name("Shock").first | ||
expect(shock).to be_a(Magic::Cards::Shock) | ||
end | ||
end |