From e966b760fbe442878d21cc2b88c72f8fa3fd6d19 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 11 Jan 2021 08:54:26 -0500 Subject: [PATCH] [KHM] Implemented Littjara Kinseekers --- .../src/mage/cards/l/LittjaraKinseekers.java | 88 +++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + Utils/mtg-cards-data.txt | 2 +- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/l/LittjaraKinseekers.java diff --git a/Mage.Sets/src/mage/cards/l/LittjaraKinseekers.java b/Mage.Sets/src/mage/cards/l/LittjaraKinseekers.java new file mode 100644 index 0000000000..928b0edfb4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LittjaraKinseekers.java @@ -0,0 +1,88 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.abilities.keyword.ChangelingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.*; + +/** + * @author TheElk801 + */ +public final class LittjaraKinseekers extends CardImpl { + + public LittjaraKinseekers(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); + + this.subtype.add(SubType.SHAPESHIFTER); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Changeling + this.setIsAllCreatureTypes(true); + this.addAbility(ChangelingAbility.getInstance()); + + // When Littjara Kinseekers enters the battlefield, if you control three or more creatures that share a creature type, put a +1/+1 counter on Littjara Kinseekers, then scry 1. + Ability ability = new ConditionalInterveningIfTriggeredAbility( + new EntersBattlefieldTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()) + ), LittjaraKinseekersCondition.instance, "When {this} enters the battlefield, " + + "if you control three or more creatures that share a creature type, " + + "put a +1/+1 counter on {this}, then scry 1." + ); + ability.addEffect(new ScryEffect(1)); + this.addAbility(ability); + } + + private LittjaraKinseekers(final LittjaraKinseekers card) { + super(card); + } + + @Override + public LittjaraKinseekers copy() { + return new LittjaraKinseekers(this); + } +} + +enum LittjaraKinseekersCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + List permanentList = game.getBattlefield().getActivePermanents( + StaticFilters.FILTER_CONTROLLED_CREATURE, + source.getControllerId(), source.getSourceId(), game + ); + permanentList.removeIf(Objects::isNull); + long changelings = permanentList + .stream() + .filter(Objects::nonNull) + .filter(MageObject::isAllCreatureTypes) + .count(); + if (changelings > 2) { + return true; + } + permanentList.removeIf(MageObject::isAllCreatureTypes); + Map typeMap = new HashMap<>(); + return permanentList + .stream() + .map(permanent -> permanent.getSubtype(game)) + .flatMap(Collection::stream) + .mapToInt(subType -> typeMap.compute(subType, (s, i) -> i == null ? 1 : Integer.sum(i, 1))) + .anyMatch(x -> x + changelings > 2); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 9165750d0b..341ef9cca3 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -96,6 +96,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Kaya's Onslaught", 18, Rarity.UNCOMMON, mage.cards.k.KayasOnslaught.class)); cards.add(new SetCardInfo("Koll, the Forgemaster", 220, Rarity.UNCOMMON, mage.cards.k.KollTheForgemaster.class)); cards.add(new SetCardInfo("Koma's Faithful", 102, Rarity.COMMON, mage.cards.k.KomasFaithful.class)); + cards.add(new SetCardInfo("Littjara Kinseekers", 66, Rarity.COMMON, mage.cards.l.LittjaraKinseekers.class)); cards.add(new SetCardInfo("Magda, Brazen Outlaw", 142, Rarity.RARE, mage.cards.m.MagdaBrazenOutlaw.class)); cards.add(new SetCardInfo("Masked Vandal", 184, Rarity.COMMON, mage.cards.m.MaskedVandal.class)); cards.add(new SetCardInfo("Maskwood Nexus", 240, Rarity.RARE, mage.cards.m.MaskwoodNexus.class)); diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 32854c4b37..a7ec6b5189 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -40035,7 +40035,7 @@ Cosmos Charger|Kaldheim|51|R|{3}{U}|Creature - Horse Spirit|3|3|Flash$Flying$For Giant's Amulet|Kaldheim|59|U|{U}|Artifact - Equipment|||When Giant's Amulet enters the battlefield, you may pay {3}{U}. If you do, create a 4/4 blue Giant Wizard creature token, then attach Giant's Amulet to it.$Equipped creature gets +0/+1 and has "This creature has hexproof as long as it's untapped."$Equip {2}| Glimpse the Cosmos|Kaldheim|60|U|{1}{U}|Sorcery|||Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.$As long as you control a Giant, you may cast Glimpse the Cosmos from your graveyard by paying {U} rather than paying its mana cost. If you cast Glimpse the Cosmos this way and it would be put into your graveyard, exile it instead.| Inga Rune-Eyes|Kaldheim|64|U|{3}{U}|Legendary Creature - Human Wizard|3|3|When Inga Rune-Eyes enters the battlefield, scry 3.$When Inga Rune-Eyes dies, draw three cards if three or more creatures died this turn.| -Littjara Kinseekers|Kaldheim|66|C|{3}{U}|Creature - Shapeshifter|2|4|Changeling (This card is every creature type.$When Littjara Kinseekers enters the battlefield, if you control three or more creatures that share a creature type, put a +1/+1 counter on Littjara Kinseekers, then scry 1.| +Littjara Kinseekers|Kaldheim|66|C|{3}{U}|Creature - Shapeshifter|2|4|Changeling$When Littjara Kinseekers enters the battlefield, if you control three or more creatures that share a creature type, put a +1/+1 counter on Littjara Kinseekers, then scry 1.| Ravenform|Kaldheim|72|C|{2}{U}|Sorcery|||Exile target artifact or creature. Its controller creates a 1/1 blue Bird creature token with flying.$Foretell {U}| Reflections of Littjara|Kaldheim|73|R|{4}{U}|Enchantment|||As Reflections of Littjara enters the battlefield, choose a creature type.$Whenever you cast a spell of the chosen type, copy that spell.| Saw It Coming|Kaldheim|76|U|{1}{U}{U}|Instant|||Counter target spell.$Foretell {1}{U}|