-
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 #244
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 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,29 @@ | ||
module Magic | ||
module Cards | ||
Meteorite = Artifact("Meteorite") do | ||
cost generic: 5 | ||
|
||
enters_the_battlefield do | ||
game.choices.add(Meteorite::Choice.new(source: source)) | ||
end | ||
end | ||
|
||
class Meteorite < Artifact | ||
class Choice < Magic::Choice::Targeted | ||
def choices | ||
game.any_target | ||
end | ||
|
||
def resolve!(target:) | ||
source.trigger_effect(:deal_damage, target:, damage: 2) | ||
end | ||
end | ||
|
||
class ManaAbility < TapManaAbility | ||
choices :all | ||
end | ||
|
||
def activated_abilities = [ManaAbility] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Magic::Cards::Meteorite do | ||
include_context "two player game" | ||
|
||
let(:card) { Card("Meteorite") } | ||
|
||
it "deals 2 damage to any target" do | ||
cast_and_resolve(card: card) | ||
|
||
choice = game.choices.last | ||
expect(choice).to be_a(described_class::Choice) | ||
|
||
game.resolve_choice!(target: p2) | ||
|
||
expect(p2.life).to eq(18) | ||
end | ||
|
||
context "mana ability" do | ||
subject { ResolvePermanent("Meteorite") } | ||
let(:mana_ability) { subject.activated_abilities.first } | ||
|
||
it "lets player choose which mana" do | ||
p1.activate_mana_ability(ability: mana_ability) do | ||
_1.choose(:green) | ||
end | ||
|
||
expect(p1.mana_pool[:green]).to eq(1) | ||
end | ||
end | ||
end |