diff --git a/Mage.Sets/src/mage/cards/z/ZellixSanityFlayer.java b/Mage.Sets/src/mage/cards/z/ZellixSanityFlayer.java new file mode 100644 index 0000000000..1d67560c19 --- /dev/null +++ b/Mage.Sets/src/mage/cards/z/ZellixSanityFlayer.java @@ -0,0 +1,93 @@ +package mage.cards.z; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.ChooseABackgroundAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.MillCardsTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.MilledCardsEvent; +import mage.game.permanent.token.Horror2Token; +import mage.target.TargetPlayer; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ZellixSanityFlayer extends CardImpl { + + public ZellixSanityFlayer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HORROR); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Hive Mind — Whenever a player mills one or more creature cards, you create a 1/1 black Horror creature token. + this.addAbility(new ZellixSanityFlayerTriggeredAbility()); + + // {1}, {T}: Target player mills three cards. + Ability ability = new SimpleActivatedAbility(new MillCardsTargetEffect(3), new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + + // Choose a Background + this.addAbility(ChooseABackgroundAbility.getInstance()); + } + + private ZellixSanityFlayer(final ZellixSanityFlayer card) { + super(card); + } + + @Override + public ZellixSanityFlayer copy() { + return new ZellixSanityFlayer(this); + } +} + +class ZellixSanityFlayerTriggeredAbility extends TriggeredAbilityImpl { + + ZellixSanityFlayerTriggeredAbility() { + super(Zone.BATTLEFIELD, new CreateTokenEffect(new Horror2Token())); + this.withFlavorWord("Hive Mind"); + } + + private ZellixSanityFlayerTriggeredAbility(final ZellixSanityFlayerTriggeredAbility ability) { + super(ability); + } + + @Override + public ZellixSanityFlayerTriggeredAbility copy() { + return new ZellixSanityFlayerTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.MILLED_CARDS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return ((MilledCardsEvent) event).getCards().count(StaticFilters.FILTER_CARD_CREATURE, game) > 0; + } + + @Override + public String getTriggerPhrase() { + return "Whenever a player mills one or more creature cards, you"; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 3e14e28bc6..9166a85d9c 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -306,6 +306,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Young Blue Dragon", 106, Rarity.COMMON, mage.cards.y.YoungBlueDragon.class)); cards.add(new SetCardInfo("Young Red Dragon", 210, Rarity.COMMON, mage.cards.y.YoungRedDragon.class)); cards.add(new SetCardInfo("Your Temple Is Under Attack", 52, Rarity.COMMON, mage.cards.y.YourTempleIsUnderAttack.class)); + cards.add(new SetCardInfo("Zellix, Sanity Flayer", 652, Rarity.MYTHIC, mage.cards.z.ZellixSanityFlayer.class)); cards.add(new SetCardInfo("Zevlor, Elturel Exile", 296, Rarity.RARE, mage.cards.z.ZevlorElturelExile.class)); cards.add(new SetCardInfo("Zhentarim Bandit", 158, Rarity.COMMON, mage.cards.z.ZhentarimBandit.class)); } diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index 5ac5560d7d..985ae9448f 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -102,6 +102,7 @@ public class GameEvent implements Serializable { DAMAGE_PLAYER, MILL_CARDS, MILLED_CARD, + MILLED_CARDS, /* DAMAGED_PLAYER targetId the id of the damaged player sourceId sourceId of the ability which caused the damage diff --git a/Mage/src/main/java/mage/game/events/MilledCardsEvent.java b/Mage/src/main/java/mage/game/events/MilledCardsEvent.java new file mode 100644 index 0000000000..12c837b046 --- /dev/null +++ b/Mage/src/main/java/mage/game/events/MilledCardsEvent.java @@ -0,0 +1,24 @@ +package mage.game.events; + +import mage.abilities.Ability; +import mage.cards.Cards; +import mage.cards.CardsImpl; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public class MilledCardsEvent extends GameEvent { + + private final Cards cards = new CardsImpl(); + + public MilledCardsEvent(Ability source, UUID playerId, Cards cards) { + super(EventType.MILLED_CARDS, playerId, source, playerId); + this.cards.addAll(cards); + } + + public Cards getCards() { + return cards; + } +} diff --git a/Mage/src/main/java/mage/game/permanent/token/Horror2Token.java b/Mage/src/main/java/mage/game/permanent/token/Horror2Token.java new file mode 100644 index 0000000000..0c0eee0839 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/Horror2Token.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 Horror2Token extends TokenImpl { + + public Horror2Token() { + super("Horror Token", "1/1 black Horror creature token"); + cardType.add(CardType.CREATURE); + color.setBlack(true); + subtype.add(SubType.HORROR); + power = new MageInt(1); + toughness = new MageInt(1); + + availableImageSetCodes = Arrays.asList("CLB"); + } + + public Horror2Token(final Horror2Token token) { + super(token); + } + + public Horror2Token copy() { + return new Horror2Token(this); + } +} diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index a03d9521f4..65508fb1cc 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -4852,6 +4852,7 @@ public abstract class PlayerImpl implements Player, Serializable { for (Card card : cards.getCards(game)) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MILLED_CARD, card.getId(), source, getId())); } + game.fireEvent(new MilledCardsEvent(source, getId(), cards)); return cards; }