Skip to content

Commit

Permalink
Add Titanic Growth
Browse files Browse the repository at this point in the history
Fixes #221
  • Loading branch information
radar committed Feb 16, 2024
1 parent 96135c4 commit 87b92fd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/magic/cards/titanic_growth.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Magic
module Cards
class TitanicGrowth < Instant
card_name "Titanic Growth"
cost generic: 1, green: 1

def target_choices
creatures
end

def resolve!(target:)
trigger_effect(:modify_power_toughness, power: 4, toughness: 4, target: target, until_eot: true)
end
end
end
end
3 changes: 2 additions & 1 deletion lib/magic/effects/apply_power_toughness_modification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ module Effects
class ApplyPowerToughnessModification < TargetedEffect
attr_reader :power, :toughness

def initialize(power: 0, toughness: 0, **args)
def initialize(power: 0, toughness: 0, until_eot: true, **args)
@power = power
@toughness = toughness
@until_eot = until_eot
super(**args)
end

Expand Down
19 changes: 19 additions & 0 deletions spec/cards/titanic_growth_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

RSpec.describe Magic::Cards::TitanicGrowth do
include_context "two player game"
let!(:wood_elves) { ResolvePermanent("Wood Elves") }

it "gets +4/+4 until end of turn" do
p1.add_mana(green: 2)
p1.cast(card: Card("Titanic Growth")) do
_1.pay_mana(green: 1, generic: { green: 1 })
_1.targeting(wood_elves)
end

game.tick!

expect(wood_elves.power).to eq(5)
expect(wood_elves.toughness).to eq(5)
end
end

0 comments on commit 87b92fd

Please sign in to comment.