diff --git a/Mage.Sets/src/mage/cards/g/GreatUncleanOne.java b/Mage.Sets/src/mage/cards/g/GreatUncleanOne.java new file mode 100644 index 0000000000..c4adf62a34 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GreatUncleanOne.java @@ -0,0 +1,89 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.game.Game; +import mage.game.permanent.token.PlaguebearerOfNurgleToken; +import mage.players.Player; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GreatUncleanOne extends CardImpl { + + public GreatUncleanOne(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}"); + + this.subtype.add(SubType.DEMON); + this.power = new MageInt(4); + this.toughness = new MageInt(5); + + // Reverberating Summons -- At the beginning of your end step, each opponent loses 2 life. Then for each opponent who has less life than you, create a 1/3 black Demon creature token named Plaguebearer of Nurgle. + Ability ability = new BeginningOfEndStepTriggeredAbility( + new LoseLifeOpponentsEffect(2), TargetController.YOU, false + ); + ability.addEffect(new CreateTokenEffect( + new PlaguebearerOfNurgleToken(), GreatUncleanOneValue.instance + ).setText("then for each opponent who has less life than you, " + + "create a 1/3 black Demon creature token named Plaguebearer of Nurgle")); + this.addAbility(ability.withFlavorWord("Reverberating Summons")); + } + + private GreatUncleanOne(final GreatUncleanOne card) { + super(card); + } + + @Override + public GreatUncleanOne copy() { + return new GreatUncleanOne(this); + } +} + +enum GreatUncleanOneValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player == null) { + return 0; + } + int life = player.getLife(); + return game + .getOpponents(player.getId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .mapToInt(Player::getLife) + .map(l -> l < life ? 1 : 0) + .sum(); + } + + @Override + public GreatUncleanOneValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } + + @Override + public String toString() { + return "1"; + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index 1419759d60..573cb1af68 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -65,6 +65,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Game Trail", 282, Rarity.RARE, mage.cards.g.GameTrail.class)); cards.add(new SetCardInfo("Gargoyle Flock", 123, Rarity.RARE, mage.cards.g.GargoyleFlock.class)); cards.add(new SetCardInfo("Goliath Truck", 158, Rarity.UNCOMMON, mage.cards.g.GoliathTruck.class)); + cards.add(new SetCardInfo("Great Unclean One", 35, Rarity.RARE, mage.cards.g.GreatUncleanOne.class)); cards.add(new SetCardInfo("Hardened Scales", 215, Rarity.RARE, mage.cards.h.HardenedScales.class)); cards.add(new SetCardInfo("Harrow", 216, Rarity.COMMON, mage.cards.h.Harrow.class)); cards.add(new SetCardInfo("Herald of Slaanesh", 77, Rarity.UNCOMMON, mage.cards.h.HeraldOfSlaanesh.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/PlaguebearerOfNurgleToken.java b/Mage/src/main/java/mage/game/permanent/token/PlaguebearerOfNurgleToken.java new file mode 100644 index 0000000000..ad241d899c --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/PlaguebearerOfNurgleToken.java @@ -0,0 +1,32 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.Arrays; + +/** + * @author TheElk801 + */ +public final class PlaguebearerOfNurgleToken extends TokenImpl { + + public PlaguebearerOfNurgleToken() { + super("Plaguebearer of Nurgle", "1/3 black Demon creature token named Plaguebearer of Nurgle"); + cardType.add(CardType.CREATURE); + color.setBlack(true); + subtype.add(SubType.DEMON); + power = new MageInt(1); + toughness = new MageInt(3); + + availableImageSetCodes = Arrays.asList("40K"); + } + + public PlaguebearerOfNurgleToken(final PlaguebearerOfNurgleToken token) { + super(token); + } + + public PlaguebearerOfNurgleToken copy() { + return new PlaguebearerOfNurgleToken(this); + } +}