Skip to content

Commit

Permalink
Add Eternal Witness
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Nov 9, 2024
1 parent 26cf92e commit 38e4d12
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/magic/cards/elderfang_ritualist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Cards
class ElderfangRitualist < Creature
class Choice < Choice::SearchGraveyard
def choices
controller.graveyard
controller.graveyard.by_type("Elf")
end

def choice_amount
Expand Down
26 changes: 26 additions & 0 deletions lib/magic/cards/eternal_witness.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Magic
module Cards
EternalWitness = Creature("Eternal Witness") do
cost green: 1, generic: 2
power 2
toughness 1
creature_type "Human Shaman"

enters_the_battlefield do
game.add_choice(EternalWitness::Choice.new(actor: actor))
end
end

class EternalWitness < Creature
class Choice < Magic::Choice::May
def choices
controller.graveyard
end

def resolve!(target:)
target.move_to_hand!
end
end
end
end
end
27 changes: 27 additions & 0 deletions spec/cards/eternal_witness_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require "spec_helper"

RSpec.describe Magic::Cards::EternalWitness do
include_context "two player game"

context "when it enters" do
subject { Card("Eternal Witness") }

before do
p1.graveyard.add(Card("Wood Elves"))
end

it "can choose to return wood elves" do
p1.add_mana(green: 3)
p1.cast(card: subject) do
_1.auto_pay_mana
end

game.stack.resolve!

game.resolve_choice!(target: p1.graveyard.first)

expect(p1.hand.by_name("Wood Elves")).to be_one
expect(p1.graveyard.by_name("Wood Elves")).to be_none
end
end
end

0 comments on commit 38e4d12

Please sign in to comment.