-
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 #228
- Loading branch information
Showing
12 changed files
with
114 additions
and
14 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Magic | ||
module Cards | ||
class DireFleetWarmonger < Creature | ||
card_name "Dire Fleet Warmonger" | ||
type "Creature -- Orc Pirate" | ||
cost generic: 1, black: 1, red: 1 | ||
power 3 | ||
toughness 3 | ||
|
||
class Choice < Magic::Choice | ||
def target_choices | ||
other_creatures_you_control | ||
end | ||
|
||
def resolve!(choice:) | ||
trigger_effect(:sacrifice, target: choice) | ||
trigger_effect(:modify_power_toughness, power: 2, toughness: 2, target: source) | ||
trigger_effect(:grant_keyword, keyword: :trample, target: source) | ||
end | ||
end | ||
|
||
|
||
def event_handlers | ||
{ | ||
Events::BeginningOfCombat => -> (receiver, event) do | ||
return unless event.active_player == owner | ||
|
||
game.choices.add(DireFleetWarmonger::Choice.new(source: receiver)) | ||
|
||
|
||
end | ||
} | ||
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
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,17 @@ | ||
module Magic | ||
module Effects | ||
class GrantKeyword < TargetedEffect | ||
attr_reader :keyword | ||
|
||
def initialize(keyword:, **args) | ||
super(**args) | ||
@keyword = keyword | ||
end | ||
|
||
|
||
def resolve! | ||
target.grant_keyword(Keywords.one(keyword)) | ||
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,10 @@ | ||
module Magic | ||
module Effects | ||
class Sacrifice < TargetedEffect | ||
def resolve! | ||
target.sacrifice! | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Magic::Cards::DireFleetWarmonger do | ||
include_context "two player game" | ||
|
||
let!(:permanent) { ResolvePermanent("Dire Fleet Warmonger") } | ||
let!(:wood_elves) { ResolvePermanent("Wood Elves") } | ||
|
||
context "beginning of combat, may sacrifice another creature" do | ||
before do | ||
skip_to_combat! | ||
end | ||
|
||
it "is offered a choice" do | ||
choice = game.choices.last | ||
expect(choice).to be_a(described_class::Choice) | ||
expect(choice.target_choices).to eq([wood_elves]) | ||
|
||
game.resolve_choice!(choice: wood_elves) | ||
|
||
expect(wood_elves.card.zone).to be_graveyard | ||
|
||
expect(permanent.power).to eq(5) | ||
expect(permanent.toughness).to eq(5) | ||
expect(permanent.trample?).to eq(true) | ||
end | ||
end | ||
end |