Skip to content

Commit

Permalink
Acidic Slime's target must be chosen on cast
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Feb 23, 2024
1 parent 6c4407e commit 20594d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
15 changes: 7 additions & 8 deletions lib/magic/cards/acidic_slime.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
module Magic
module Cards
AcidicSlime = Creature("Acidic Slime") do
class AcidicSlime < Creature
card_name "Acidic Slime"
cost generic: 3, green: 2
creature_type("Ooze")
creature_type "Ooze"
keywords :deathtouch
power 2
toughness 2

enters_the_battlefield do
game.choices.add(AcidicSlime::Choice.new(actor: actor))
def target_choices
game.battlefield.cards.by_any_type("Artifact", "Enchantment", "Land")
end
end

class AcidicSlime < Creature
class Choice < Choice::DestroyTarget
def choices = game.battlefield.cards.by_any_type("Artifact", "Enchantment", "Land")
def resolve!(target:)
trigger_effect(:destroy_target, target: target)
end
end
end
Expand Down
12 changes: 8 additions & 4 deletions spec/cards/acidic_slime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
end

it "triggers a destroy effect" do
cast_and_resolve(card: subject, player: p1)
effect = game.choices.first
p1.add_mana(green: 5)
p1.cast(card: subject) do
_1.auto_pay_mana
_1.targeting(land)
end

expect(effect).to be_a(Magic::Choice::DestroyTarget)
expect(effect.choices).to match_array([land, enchantment, artifact])
game.tick!

expect(land.card.zone).to be_graveyard
end
end
end

0 comments on commit 20594d1

Please sign in to comment.