-
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.
- Loading branch information
Showing
2 changed files
with
70 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,38 @@ | ||
module Magic | ||
module Cards | ||
ElvishArchdruid = Creature("Elvish Archdruid") do | ||
power 2 | ||
toughness 2 | ||
cost generic: 1, green: 2 | ||
creature_type "Elf Druid" | ||
|
||
class PowerAndToughnessModification < Abilities::Static::PowerAndToughnessModification | ||
def initialize(source:) | ||
@source = source | ||
end | ||
|
||
def power | ||
1 | ||
end | ||
|
||
def toughness | ||
1 | ||
end | ||
|
||
def applicable_targets | ||
source.controller.creatures.by_type("Elf") - [source] | ||
end | ||
end | ||
|
||
class ManaAbility < Magic::TapManaAbility | ||
def resolve! | ||
source.controller.add_mana(green: source.controller.creatures.by_type("Elf").count) | ||
end | ||
end | ||
|
||
def activated_abilities = [ManaAbility] | ||
|
||
def static_abilities = [PowerAndToughnessModification] | ||
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,32 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe Magic::Cards::ElvishArchdruid do | ||
include_context "two player game" | ||
|
||
subject! { ResolvePermanent("Elvish Archdruid", owner: p1) } | ||
let!(:lathril) { ResolvePermanent("Lathril, Blade Of The Elves", owner: p1) } | ||
|
||
context "static ability" do | ||
it "gives lathril +1/+1" do | ||
expect(lathril.power).to eq(3) | ||
expect(lathril.toughness).to eq(4) | ||
end | ||
|
||
it "does not give itself the boost" do | ||
expect(subject.power).to eq(2) | ||
expect(subject.toughness).to eq(2) | ||
end | ||
end | ||
|
||
context "mana ability" do | ||
def activate_ability | ||
p1.activate_ability(ability: subject.activated_abilities.first) | ||
end | ||
|
||
it "adds green mana" do | ||
activate_ability | ||
# 1 mana from the Archdruid, 1 from Lathril | ||
expect(p1.mana_pool[:green]).to eq(2) | ||
end | ||
end | ||
end |