-
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 #82
- Loading branch information
Showing
2 changed files
with
57 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,31 @@ | ||
module Magic | ||
module Cards | ||
class SpinedMegalodon < Creature | ||
card_name "Spined Megalodon" | ||
creature_type "Shark" | ||
cost generic: 5, blue: 2 | ||
power 5 | ||
toughness 7 | ||
|
||
keywords :hexproof | ||
|
||
class ScryTrigger < TriggeredAbility::Base | ||
def should_perform? | ||
return false if event.attacks.none? { |attack| attack.attacker == actor } | ||
true | ||
end | ||
|
||
def call | ||
actor.add_choice(:scry, actor: actor) | ||
end | ||
end | ||
|
||
|
||
def event_handlers | ||
{ | ||
Events::PreliminaryAttackersDeclared => ScryTrigger | ||
} | ||
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,26 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Magic::Cards::SpinedMegalodon do | ||
include_context "two player game" | ||
|
||
let(:permanent) { ResolvePermanent("Spined Megalodon") } | ||
|
||
it "has hexproof" do | ||
expect(permanent).to be_hexproof | ||
end | ||
|
||
it "scries 1 when it attacks" do | ||
skip_to_combat! | ||
|
||
current_turn.declare_attackers! | ||
|
||
p1.declare_attacker( | ||
attacker: permanent, | ||
target: p2 | ||
) | ||
|
||
current_turn.attackers_declared! | ||
|
||
expect(game.choices.first).to be_a(Magic::Choice::Scry) | ||
end | ||
end |