From dfcb795adab49c4c9d7aa87847faed4f84908e58 Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Mon, 1 Apr 2019 18:07:13 +0100 Subject: [PATCH] Implement some WAR cards --- Mage.Sets/src/mage/cards/b/BloodArtist.java | 2 +- .../src/mage/cards/c/CruelCelebrant.java | 51 +++++++++++ Mage.Sets/src/mage/sets/WarOfTheSpark.java | 4 + ...reatureOrPlaneswalkerTriggeredAbility.java | 87 +++++++++++++++++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/c/CruelCelebrant.java create mode 100644 Mage/src/main/java/mage/abilities/common/DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility.java diff --git a/Mage.Sets/src/mage/cards/b/BloodArtist.java b/Mage.Sets/src/mage/cards/b/BloodArtist.java index 866650d4183..66a09bd8355 100644 --- a/Mage.Sets/src/mage/cards/b/BloodArtist.java +++ b/Mage.Sets/src/mage/cards/b/BloodArtist.java @@ -29,7 +29,7 @@ public final class BloodArtist extends CardImpl { // Whenever Blood Artist or another creature dies, target player loses 1 life and you gain 1 life. Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new LoseLifeTargetEffect(1), false); - ability.addEffect(new GainLifeEffect(1)); + ability.addEffect(new GainLifeEffect(1).concatBy("and")); Target target = new TargetPlayer(); ability.addTarget(target); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/c/CruelCelebrant.java b/Mage.Sets/src/mage/cards/c/CruelCelebrant.java new file mode 100644 index 00000000000..6134d211674 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CruelCelebrant.java @@ -0,0 +1,51 @@ + +package mage.cards.c; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author Ketsuban + */ +public final class CruelCelebrant extends CardImpl { + + private static final FilterCreatureOrPlaneswalkerPermanent filter = new FilterCreatureOrPlaneswalkerPermanent("creature or planeswalker you control"); + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public CruelCelebrant(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}"); + + this.subtype.add(SubType.VAMPIRE); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Whenever Cruel Celebrant or another creature or planeswalker you control dies, each opponent loses 1 life and you gain 1 life. + Ability ability = new DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(new LoseLifeOpponentsEffect(1), false, filter); + ability.addEffect(new GainLifeEffect(1).concatBy("and")); + this.addAbility(ability); + + } + + public CruelCelebrant(final CruelCelebrant card) { + super(card); + } + + @Override + public CruelCelebrant copy() { + return new CruelCelebrant(this); + } +} diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index 4d18dbdd663..d9962d505d1 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -28,9 +28,13 @@ public final class WarOfTheSpark extends ExpansionSet { cards.add(new SetCardInfo("Arlinn's Wolf", 151, Rarity.COMMON, mage.cards.a.ArlinnsWolf.class)); cards.add(new SetCardInfo("Arlinn, Voice of the Pack", 150, Rarity.UNCOMMON, mage.cards.a.ArlinnVoiceOfThePack.class)); cards.add(new SetCardInfo("Augur of Bolas", 41, Rarity.UNCOMMON, mage.cards.a.AugurOfBolas.class)); + cards.add(new SetCardInfo("Burning Prophet", 117, Rarity.COMMON, mage.cards.b.BurningProphet.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)); + cards.add(new SetCardInfo("Dovin's Veto", 193, Rarity.UNCOMMON, mage.cards.d.DovinsVeto.class)); cards.add(new SetCardInfo("Dreadhorde Invasion", 86, Rarity.RARE, mage.cards.d.DreadhordeInvasion.class)); cards.add(new SetCardInfo("Emergence Zone", 245, Rarity.UNCOMMON, mage.cards.e.EmergenceZone.class)); + cards.add(new SetCardInfo("Erratic Visionary", 48, Rarity.COMMON, mage.cards.e.ErraticVisionary.class)); cards.add(new SetCardInfo("Flux Channeler", 52, Rarity.UNCOMMON, mage.cards.f.FluxChanneler.class)); cards.add(new SetCardInfo("Forest", 262, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Forest", 263, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/abilities/common/DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility.java new file mode 100644 index 00000000000..6d43388909b --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility.java @@ -0,0 +1,87 @@ + +package mage.abilities.common; + +import mage.MageObject; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; + +/** + * @author noxx + */ +public class DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility extends TriggeredAbilityImpl { + + protected FilterCreatureOrPlaneswalkerPermanent filter; + + public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(Effect effect, boolean optional) { + this(effect, optional, new FilterCreatureOrPlaneswalkerPermanent()); + } + + public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(Effect effect, boolean optional, FilterCreatureOrPlaneswalkerPermanent filter) { + super(Zone.ALL, effect, optional); // Needs "ALL" if the source itself should trigger or multiple (incl. source go to grave) + this.filter = filter; + } + + public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility ability) { + super(ability); + this.filter = ability.filter; + } + + @Override + public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility copy() { + return new DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean isInUseableZone(Game game, MageObject source, GameEvent event) { + Permanent sourcePermanent = null; + if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) { + sourcePermanent = game.getPermanent(getSourceId()); + } else { + if (game.getShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) { + sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD); + } + } + if (sourcePermanent == null) { + return false; + } + return hasSourceObjectAbility(game, sourcePermanent, event); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + + if (game.getPermanentOrLKIBattlefield(getSourceId()) == null) { + return false; + } + + if (zEvent.isDiesEvent()) { + if (zEvent.getTarget() != null) { + if (zEvent.getTarget().getId().equals(this.getSourceId())) { + return true; + } else { + if (filter.match(zEvent.getTarget(), getSourceId(), getControllerId(), game)) { + return true; + } + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} or another " + filter.getMessage() + " dies, " + super.getRule(); + } +}