Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/magic/cards/rangers_guile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module Magic
module Cards
RangersGuile = Instant("Ranger's Guile") do
cost green: 1
end

class RangersGuile < Instant
def single_target?
true
end

def target_choices
controller.creatures
end

def resolve!(target:)
target.modify_power(1)
target.modify_toughness(1)
target.grant_hexproof!
end
end
end
end
49 changes: 49 additions & 0 deletions spec/cards/rangers_guile_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

require 'spec_helper'

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

let!(:wood_elves) { ResolvePermanent("Wood Elves", owner: p1) }

it "gives target creature you control +1/+1 and hexproof until end of turn" do
p1.add_mana(green: 1)
p1.cast(card: Card("Ranger's Guile")) do
_1.auto_pay_mana
_1.targeting(wood_elves)
end

game.stack.resolve!
game.tick!

expect(wood_elves.power).to eq(2)
expect(wood_elves.toughness).to eq(2)
expect(wood_elves.hexproof?).to eq(true)
expect(wood_elves.keyword_grant_modifiers.first.until_eot?).to eq(true)
end

it "the +1/+1 boost and hexproof wear off after end of turn" do
p1.add_mana(green: 1)
p1.cast(card: Card("Ranger's Guile")) do
_1.auto_pay_mana
_1.targeting(wood_elves)
end

game.stack.resolve!
game.tick!

expect(wood_elves.power).to eq(2)
expect(wood_elves.toughness).to eq(2)
expect(wood_elves.hexproof?).to eq(true)

game.current_turn.end!
game.current_turn.cleanup!
game.next_turn
game.tick!

expect(wood_elves.power).to eq(1)
expect(wood_elves.toughness).to eq(1)
expect(wood_elves.hexproof?).to eq(false)
end
end
Loading