From 9c0f18c85064ea7b99704c6f504a2914b4e06f87 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 3 Sep 2024 17:49:26 -0400 Subject: [PATCH] [DSK] Implement Unwilling Vessel --- .../src/mage/cards/u/UnwillingVessel.java | 91 +++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 1 + .../main/java/mage/counters/CounterType.java | 1 + 3 files changed, 93 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/u/UnwillingVessel.java diff --git a/Mage.Sets/src/mage/cards/u/UnwillingVessel.java b/Mage.Sets/src/mage/cards/u/UnwillingVessel.java new file mode 100644 index 00000000000..72987205707 --- /dev/null +++ b/Mage.Sets/src/mage/cards/u/UnwillingVessel.java @@ -0,0 +1,91 @@ +package mage.cards.u; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.abilityword.EerieAbility; +import mage.abilities.common.DiesSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.token.SpiritBlueToken; +import mage.game.permanent.token.Token; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.IntStream; + +/** + * @author TheElk801 + */ +public final class UnwillingVessel extends CardImpl { + + public UnwillingVessel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Eerie -- Whenever an enchantment you control enters and whenever you fully unlock a Room, put a possession counter on Unwilling Vessel. + this.addAbility(new EerieAbility(new AddCountersSourceEffect(CounterType.POSSESSION.createInstance()))); + + // When Unwilling Vessel dies, create an X/X blue Spirit creature token with flying, where X is the number of counters on Unwilling Vessel. + this.addAbility(new DiesSourceTriggeredAbility(new UnwillingVesselEffect())); + } + + private UnwillingVessel(final UnwillingVessel card) { + super(card); + } + + @Override + public UnwillingVessel copy() { + return new UnwillingVessel(this); + } +} + +class UnwillingVesselEffect extends OneShotEffect { + + UnwillingVesselEffect() { + super(Outcome.Benefit); + staticText = "create an X/X blue Spirit creature token with flying, where X is the number of counters on {this}"; + } + + private UnwillingVesselEffect(final UnwillingVesselEffect effect) { + super(effect); + } + + @Override + public UnwillingVesselEffect copy() { + return new UnwillingVesselEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int count = Optional + .ofNullable(source.getSourcePermanentOrLKI(game)) + .map(permanent -> permanent.getCounters(game)) + .map(HashMap::values) + .map(Collection::stream) + .map(s -> s.mapToInt(Counter::getCount)) + .map(IntStream::sum) + .orElse(0); + Token token = new SpiritBlueToken(); + token.setPower(count); + token.setToughness(count); + return token.putOntoBattlefield(1, game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index 999cf34c8d1..d7f95911c88 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -62,6 +62,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet { cards.add(new SetCardInfo("Toby, Beastie Befriender", 35, Rarity.RARE, mage.cards.t.TobyBeastieBefriender.class)); cards.add(new SetCardInfo("Tyvar, the Pummeler", 408, Rarity.MYTHIC, mage.cards.t.TyvarThePummeler.class)); cards.add(new SetCardInfo("Unwanted Remake", 39, Rarity.UNCOMMON, mage.cards.u.UnwantedRemake.class)); + cards.add(new SetCardInfo("Unwilling Vessel", 81, Rarity.UNCOMMON, mage.cards.u.UnwillingVessel.class)); cards.add(new SetCardInfo("Valgavoth's Lair", 271, Rarity.RARE, mage.cards.v.ValgavothsLair.class)); cards.add(new SetCardInfo("Veteran Survivor", 40, Rarity.UNCOMMON, mage.cards.v.VeteranSurvivor.class)); cards.add(new SetCardInfo("Winter, Misanthropic Guide", 240, Rarity.RARE, mage.cards.w.WinterMisanthropicGuide.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index dde98c4a70a..29511e65425 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -174,6 +174,7 @@ public enum CounterType { POLYP("polyp"), POINT("point"), POISON("poison"), + POSSESSION("possession"), PRESSURE("pressure"), PREY("prey"), PUPA("pupa"),