-
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 #230
- Loading branch information
Showing
5 changed files
with
96 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Magic | ||
module Cards | ||
class EpitaphGolem < Creature | ||
name "Epitaph Golem" | ||
artifact_creature_type "Golem" | ||
cost generic: 4 | ||
|
||
class Ability < ActivatedAbility | ||
costs "{2}" | ||
|
||
def target_choices | ||
controller.graveyard | ||
end | ||
|
||
def resolve!(target:) | ||
trigger_effect(:move_zone, source: source, target: target, destination: controller.library) | ||
end | ||
end | ||
|
||
def activated_abilities | ||
[Ability] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Magic | ||
module Effects | ||
class MoveZone < TargetedEffect | ||
attr_reader :destination | ||
|
||
def initialize(destination:, **args) | ||
@destination = destination | ||
super(**args) | ||
end | ||
|
||
def requires_choices? | ||
false | ||
end | ||
|
||
def resolve! | ||
target.move_zone!(destination) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Magic::Cards::EpitaphGolem do | ||
include_context "two player game" | ||
|
||
let!(:permanent) { ResolvePermanent("Epitaph Golem") } | ||
let!(:wood_elves) { Card("Wood Elves") } | ||
|
||
before do | ||
p1.graveyard.add(wood_elves) | ||
end | ||
|
||
it "can move card from graveyard to library" do | ||
p1.add_mana(white: 2) | ||
p1.activate_ability(ability: permanent.activated_abilities.first) do | ||
_1.pay_mana(generic: { white: 2 }) | ||
_1.targeting(wood_elves) | ||
end | ||
|
||
expect(wood_elves.zone).to be_library | ||
expect(p1.library.last).to eq(wood_elves) | ||
end | ||
end |