Skip to content

Commit

Permalink
Add Temple of Malady
Browse files Browse the repository at this point in the history
Fixes #264
  • Loading branch information
radar committed Jan 29, 2024
1 parent bf41d9e commit 2e2ef04
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/magic/cards/temple_of_malady.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module Magic
module Cards
TempleOfMalady = Card("Temple of Malady") do
type "Land"

enters_the_battlefield do
game.add_choice(Choice::Scry.new(source: source))
end
end

class TempleOfMalady < Card
def enters_tapped?
true
end

class ManaAbility < Magic::TapManaAbility
choices :black, :green
end

def activated_abilities = [ManaAbility]
end
end
end
48 changes: 48 additions & 0 deletions spec/cards/temple_of_malady_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
require 'spec_helper'

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

let(:card) { Card("Temple Of Malady") }

let!(:permanent) do
p1.play_land(land: card)
p1.permanents.by_name("Temple of Malady").first
end

it "enters the battlefield tapped" do
game.stack.resolve!
expect(permanent).to be_tapped
end

it "scries one" do
choice = game.choices.last
expect(choice).to be_a(Magic::Choice::Scry)

game.resolve_choice!(top: [choice.choices.first])
end

it "taps for black" do
p1.activate_mana_ability(ability: permanent.activated_abilities.first) do
_1.choose(:black)
end

expect(p1.mana_pool[:black]).to eq(1)
end

it "taps for green" do
p1.activate_mana_ability(ability: permanent.activated_abilities.first) do
_1.choose(:green)
end

expect(p1.mana_pool[:green]).to eq(1)
end

it "cannot tap for another color" do
expect {
p1.activate_mana_ability(ability: permanent.activated_abilities.first) do
_1.choose(:blue)
end
}.to raise_error("Invalid choice made for mana ability:")
end
end

0 comments on commit 2e2ef04

Please sign in to comment.