Skip to content

Commit

Permalink
Add Silent Dart
Browse files Browse the repository at this point in the history
Fixes #248
  • Loading branch information
radar committed Jan 31, 2024
1 parent 581ba0a commit 6079d97
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/magic/cards/silent_dart.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module Magic
module Cards
SilentDart = Artifact("Silent Dart") do
cost 1
end

class SilentDart < Artifact
class ActivatedAbility < ActivatedAbility
def costs
[
Costs::Mana.new(generic: 4),
Costs::Sacrifice.new(source)
]
end

def target_choices
game.battlefield.creatures
end

def resolve!(target:)
trigger_effect(:deal_damage, damage: 3, target: target)
end
end

def activated_abilities
[ActivatedAbility]
end
end
end
end
20 changes: 20 additions & 0 deletions spec/cards/silent_dart_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require "spec_helper"

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

subject(:permanent) { ResolvePermanent("Silent Dart") }
let!(:wood_elves) { ResolvePermanent("Wood Elves") }

it "deals 3 damage to any target" do
expect(game.battlefield.creatures.count).to eq(1)

p1.add_mana(black: 4)
p1.activate_ability(ability: permanent.activated_abilities.first) do
_1.targeting(wood_elves)
_1.pay_mana(generic: { black: 4 })
end

expect(wood_elves.damage).to eq(3)
end
end

0 comments on commit 6079d97

Please sign in to comment.