-
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 #80
- Loading branch information
Showing
8 changed files
with
89 additions
and
8 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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ def can_attack? | |
false | ||
end | ||
|
||
def can_block? | ||
def can_block?(_) | ||
false | ||
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,30 @@ | ||
module Magic | ||
module Cards | ||
Shacklegeist = Creature("Shacklegeist") do | ||
creature_type "Spirit" | ||
power 2 | ||
toughness 2 | ||
keywords :flying | ||
|
||
def can_block?(permanent) | ||
permanent.flying? | ||
end | ||
end | ||
|
||
class Shacklegeist < Creature | ||
class ActivatedAbility < Magic::ActivatedAbility | ||
def costs = [Costs::MultiTap.new(-> (c) { c.type?("Spirit") }, 2)] | ||
|
||
def target_choices | ||
game.battlefield.not_controlled_by(controller).creatures | ||
end | ||
|
||
def resolve!(target:) | ||
trigger_effect(:tap, target: target) | ||
end | ||
end | ||
|
||
def activated_abilities = [ActivatedAbility] | ||
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,10 @@ | ||
module Magic | ||
module Effects | ||
class Tap < TargetedEffect | ||
|
||
def resolve! | ||
target.tap! | ||
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
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::Shacklegeist do | ||
include_context "two player game" | ||
let(:roaming_ghostlight) { ResolvePermanent("Roaming Ghostlight", owner: p2) } | ||
let(:wood_elves) { ResolvePermanent("Wood Elves", owner: p2) } | ||
subject(:shacklegeist) { ResolvePermanent("Shacklegeist") } | ||
|
||
it "can only block creatures with flying" do | ||
expect(shacklegeist.can_block?(roaming_ghostlight)).to eq(true) | ||
expect(shacklegeist.can_block?(wood_elves)).to eq(false) | ||
end | ||
|
||
context "taps two untapped spirits, to tap another creature" do | ||
before do | ||
p1.create_token(token: Magic::Tokens::Spirit) | ||
end | ||
|
||
it "taps the creature" do | ||
token_spirit = p1.creatures.by_name("Spirit").first | ||
|
||
p1.activate_ability(ability: shacklegeist.activated_abilities.first) do | ||
_1.pay_multi_tap([shacklegeist, token_spirit]) | ||
_1.targeting(wood_elves) | ||
end | ||
|
||
game.tick! | ||
|
||
expect(wood_elves).to be_tapped | ||
end | ||
end | ||
end |