diff --git a/Mage.Sets/src/mage/cards/b/Blightbeetle.java b/Mage.Sets/src/mage/cards/b/Blightbeetle.java new file mode 100644 index 0000000000..9172cd7b7b --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/Blightbeetle.java @@ -0,0 +1,88 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Blightbeetle extends CardImpl { + + public Blightbeetle(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); + + this.subtype.add(SubType.INSECT); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Protection from green + this.addAbility(ProtectionAbility.from(ObjectColor.GREEN)); + + // Creatures your opponents control can't have +1/+1 counters put on them. + this.addAbility(new SimpleStaticAbility(new BlightbeetleEffect())); + } + + private Blightbeetle(final Blightbeetle card) { + super(card); + } + + @Override + public Blightbeetle copy() { + return new Blightbeetle(this); + } +} + +class BlightbeetleEffect extends ContinuousRuleModifyingEffectImpl { + + BlightbeetleEffect() { + super(Duration.WhileOnBattlefield, Outcome.Detriment); + staticText = "Creatures your opponents control can't have +1/+1 counters put on them"; + } + + private BlightbeetleEffect(final BlightbeetleEffect effect) { + super(effect); + } + + @Override + public BlightbeetleEffect copy() { + return new BlightbeetleEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ADD_COUNTERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (!event.getData().equals(CounterType.P1P1.getName())) { + return false; + } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent == null || !permanent.isCreature()) { + return false; + } + Player player = game.getPlayer(permanent.getControllerId()); + if (player == null || !player.hasOpponent(source.getControllerId(), game)) { + return false; + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index f02986d611..0f8ff457b4 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -32,6 +32,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Atemsis, All-Seeing", 46, Rarity.RARE, mage.cards.a.AtemsisAllSeeing.class)); cards.add(new SetCardInfo("Barkhide Troll", 165, Rarity.UNCOMMON, mage.cards.b.BarkhideTroll.class)); cards.add(new SetCardInfo("Bishop of Wings", 8, Rarity.RARE, mage.cards.b.BishopOfWings.class)); + cards.add(new SetCardInfo("Blightbeetle", 87, Rarity.UNCOMMON, mage.cards.b.Blightbeetle.class)); cards.add(new SetCardInfo("Bone Splinters", 92, Rarity.COMMON, mage.cards.b.BoneSplinters.class)); cards.add(new SetCardInfo("Captivating Gyre", 51, Rarity.UNCOMMON, mage.cards.c.CaptivatingGyre.class)); cards.add(new SetCardInfo("Chandra's Embercat", 129, Rarity.COMMON, mage.cards.c.ChandrasEmbercat.class));