Skip to content

Commit

Permalink
Add Heroic Intervention
Browse files Browse the repository at this point in the history
Fixes #375
  • Loading branch information
radar committed Jan 16, 2024
1 parent 2409aaa commit cbb0874
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/magic/cards/heroic_intervention.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Magic
module Cards
HeroicIntervention = Instant("Heroic Intervention") do
cost generic: 1, green: 1
end

class HeroicIntervention < Instant
def resolve!
owner.permanents.each do
_1.grant_keyword(Keywords::HEXPROOF, until_eot: true)
_1.grant_keyword(Keywords::INDESTRUCTIBLE, until_eot: true)
end
end
end
end
end
27 changes: 27 additions & 0 deletions spec/cards/heroic_intervention_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'spec_helper'

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

before do
ResolvePermanent("Island", owner: p1)
ResolvePermanent("Wood Elves", owner: p1)
ResolvePermanent("Sol Ring", owner: p1)
ResolvePermanent("Selfless Savior", owner: p2)
end

subject { Card("Heroic Intervention", owner: p1) }

it "all permanents you control gain hexproof and indestructible" do
cast_and_resolve(card: subject)

island = p1.permanents.by_name("Island").first
wood_elves = p1.permanents.by_name("Wood Elves").first
sol_ring = p1.permanents.by_name("Sol Ring").first

[island, wood_elves, sol_ring].each do |permanent|
expect(permanent.hexproof?).to eq(true)
expect(permanent.indestructible?).to eq(true)
end
end
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def add_to_stack_and_resolve(action)
game.stack.resolve!
end

def cast_and_resolve(card:, player:, targeting: nil, &block)
def cast_and_resolve(card:, player: card.owner, targeting: nil, &block)
action = cast_action(card: card, player: player, targeting: targeting, &block)
game.stack.add(action)
game.stack.resolve!
Expand Down

0 comments on commit cbb0874

Please sign in to comment.