diff --git a/lib/magic/cards/titanic_growth.rb b/lib/magic/cards/titanic_growth.rb new file mode 100644 index 0000000..1c9d6e2 --- /dev/null +++ b/lib/magic/cards/titanic_growth.rb @@ -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 diff --git a/lib/magic/effects/apply_power_toughness_modification.rb b/lib/magic/effects/apply_power_toughness_modification.rb index 5fb1261..ae1ddc2 100644 --- a/lib/magic/effects/apply_power_toughness_modification.rb +++ b/lib/magic/effects/apply_power_toughness_modification.rb @@ -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 diff --git a/spec/cards/titanic_growth_spec.rb b/spec/cards/titanic_growth_spec.rb new file mode 100644 index 0000000..9503c44 --- /dev/null +++ b/spec/cards/titanic_growth_spec.rb @@ -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