From 2a5aaa9c72f01e7432d26cda881687f7b34d74d9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 8 Apr 2019 21:44:02 -0400 Subject: [PATCH] Implemented Challenger Troll --- .../src/mage/cards/c/ChallengerTroll.java | 80 +++++++++++++++++++ Mage.Sets/src/mage/sets/WarOfTheSpark.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ChallengerTroll.java diff --git a/Mage.Sets/src/mage/cards/c/ChallengerTroll.java b/Mage.Sets/src/mage/cards/c/ChallengerTroll.java new file mode 100644 index 00000000000..65a3055c7a0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ChallengerTroll.java @@ -0,0 +1,80 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ChallengerTroll extends CardImpl { + + public ChallengerTroll(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); + + this.subtype.add(SubType.TROLL); + this.power = new MageInt(6); + this.toughness = new MageInt(5); + + // Each creature you control with power 4 or greater can't be blocked by more than one creature. + this.addAbility(new SimpleStaticAbility(new ChallengerTrollEffect())); + } + + private ChallengerTroll(final ChallengerTroll card) { + super(card); + } + + @Override + public ChallengerTroll copy() { + return new ChallengerTroll(this); + } +} + +class ChallengerTrollEffect extends ContinuousEffectImpl { + + ChallengerTrollEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "Each creature you control with power 4 or greater can't be blocked by more than one creature."; + } + + private ChallengerTrollEffect(final ChallengerTrollEffect effect) { + super(effect); + } + + @Override + public ChallengerTrollEffect copy() { + return new ChallengerTrollEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + if (layer != Layer.RulesEffects) { + return false; + } + for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { + if (permanent != null && permanent.isControlledBy(source.getControllerId()) + && permanent.isCreature() && permanent.getPower().getValue() >= 4) { + permanent.setMaxBlockedBy(1); + } + } + return true; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.RulesEffects; + } +} diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index 9179c1178b1..f3c1767dc05 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -39,6 +39,7 @@ public final class WarOfTheSpark extends ExpansionSet { cards.add(new SetCardInfo("Bolt Bend", 115, Rarity.UNCOMMON, mage.cards.b.BoltBend.class)); cards.add(new SetCardInfo("Bulwark Giant", 7, Rarity.COMMON, mage.cards.b.BulwarkGiant.class)); cards.add(new SetCardInfo("Burning Prophet", 117, Rarity.COMMON, mage.cards.b.BurningProphet.class)); + cards.add(new SetCardInfo("Challenger Troll", 157, Rarity.UNCOMMON, mage.cards.c.ChallengerTroll.class)); cards.add(new SetCardInfo("Courage in Crisis", 158, Rarity.COMMON, mage.cards.c.CourageInCrisis.class)); cards.add(new SetCardInfo("Cruel Celebrant", 188, Rarity.UNCOMMON, mage.cards.c.CruelCelebrant.class)); cards.add(new SetCardInfo("Crush Dissent", 47, Rarity.COMMON, mage.cards.c.CrushDissent.class));