[DSK] Implement Unwilling Vessel

This commit is contained in:
theelk801 2024-09-03 17:49:26 -04:00
parent e0913b4081
commit 9c0f18c850
3 changed files with 93 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));

View file

@ -174,6 +174,7 @@ public enum CounterType {
POLYP("polyp"),
POINT("point"),
POISON("poison"),
POSSESSION("possession"),
PRESSURE("pressure"),
PREY("prey"),
PUPA("pupa"),