From efca24d6178fa0c564a139131a8e44765b6a3ffb Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Mon, 11 Jan 2021 18:02:18 -0600 Subject: [PATCH] [KHM] Implemented Koma, Cosmos Serpent --- .../src/mage/cards/k/KomaCosmosSerpent.java | 104 ++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + .../game/permanent/token/KomasCoilToken.java | 26 +++++ 3 files changed, 131 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KomaCosmosSerpent.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/KomasCoilToken.java diff --git a/Mage.Sets/src/mage/cards/k/KomaCosmosSerpent.java b/Mage.Sets/src/mage/cards/k/KomaCosmosSerpent.java new file mode 100644 index 0000000000..3220849f28 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KomaCosmosSerpent.java @@ -0,0 +1,104 @@ +package mage.cards.k; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.CantBeCounteredSourceAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.KomasCoilToken; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author weirddan455 + */ +public final class KomaCosmosSerpent extends CardImpl { + + private static final FilterControlledPermanent filter + = new FilterControlledPermanent(SubType.SERPENT, "another Serpent"); + + static { + filter.add(AnotherPredicate.instance); + } + + public KomaCosmosSerpent(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}{U}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.SERPENT); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // This spell can't be countered. + this.addAbility(new CantBeCounteredSourceAbility()); + + // At the beginning of each upkeep, create a 3/3 blue Serpent creature token named Koma's Coil. + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + Zone.BATTLEFIELD, new CreateTokenEffect(new KomasCoilToken()), TargetController.EACH_PLAYER, false, false + )); + + // Sacrifice another Serpent: Choose one — + // • Tap target permanent. Its activated abilities can't be activated this turn. + Ability ability = new SimpleActivatedAbility( + new TapTargetEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filter)) + ); + ability.addEffect(new KomaCosmosSerpentEffect()); + ability.addTarget(new TargetPermanent()); + + // • Koma, Cosmos Serpent gains indestructible until end of turn. + ability.addMode(new Mode(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn))); + this.addAbility(ability); + } + + private KomaCosmosSerpent(final KomaCosmosSerpent card) { + super(card); + } + + @Override + public KomaCosmosSerpent copy() { + return new KomaCosmosSerpent(this); + } +} + +class KomaCosmosSerpentEffect extends RestrictionEffect { + + public KomaCosmosSerpentEffect() { + super(Duration.EndOfTurn); + staticText = "Its activated abilities can't be activated this turn"; + } + + private KomaCosmosSerpentEffect(final KomaCosmosSerpentEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return permanent.getId().equals(getTargetPointer().getFirst(game, source)); + } + + @Override + public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game, boolean canUseChooseDialogs) { + return false; + } + + @Override + public KomaCosmosSerpentEffect copy() { + return new KomaCosmosSerpentEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index bb656ae059..10d297157e 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -97,6 +97,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("Koma, Cosmos Serpent", 221, Rarity.MYTHIC, mage.cards.k.KomaCosmosSerpent.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)); diff --git a/Mage/src/main/java/mage/game/permanent/token/KomasCoilToken.java b/Mage/src/main/java/mage/game/permanent/token/KomasCoilToken.java new file mode 100644 index 0000000000..231d5abed7 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/KomasCoilToken.java @@ -0,0 +1,26 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +public final class KomasCoilToken extends TokenImpl { + + public KomasCoilToken() { + super("Koma's Coil", "3/3 blue Serpent creature token named Koma's Coil"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.SERPENT); + color.setBlue(true); + power = new MageInt(3); + toughness = new MageInt(3); + } + + private KomasCoilToken(final KomasCoilToken token) { + super(token); + } + + @Override + public KomasCoilToken copy() { + return new KomasCoilToken(this); + } +}