From 9528a89416588236dba9bf3edc7945eb014b8992 Mon Sep 17 00:00:00 2001 From: L_J Date: Wed, 21 Feb 2018 01:22:46 +0100 Subject: [PATCH] Implemented cards --- .../src/mage/cards/m/MinionOfTheWastes.java | 113 ++++++++++++ Mage.Sets/src/mage/cards/n/NamelessRace.java | 136 ++++++++++++++ Mage.Sets/src/mage/cards/r/Runesword.java | 173 ++++++++++++++++++ Mage.Sets/src/mage/cards/t/TheFallen.java | 146 +++++++++++++++ Mage.Sets/src/mage/sets/Chronicles.java | 2 + Mage.Sets/src/mage/sets/MastersEdition.java | 1 + Mage.Sets/src/mage/sets/Tempest.java | 1 + Mage.Sets/src/mage/sets/TheDark.java | 3 + 8 files changed, 575 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java create mode 100644 Mage.Sets/src/mage/cards/n/NamelessRace.java create mode 100644 Mage.Sets/src/mage/cards/r/Runesword.java create mode 100644 Mage.Sets/src/mage/cards/t/TheFallen.java diff --git a/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java new file mode 100644 index 0000000000..35064a7591 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java @@ -0,0 +1,113 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author L_J + */ +public class MinionOfTheWastes extends CardImpl { + + public MinionOfTheWastes(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{B}"); + this.subtype.add(SubType.MINION); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // As Minion of the Wastes enters the battlefield, pay any amount of life. The amount you pay can't be more than the total number of white nontoken permanents your opponents control plus the total number of white cards in their graveyards. + this.addAbility(new AsEntersBattlefieldAbility(new MinionOfTheWastesEffect())); + + // Minion of the Wastes's power and toughness are each equal to the life paid as it entered the battlefield. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("{this}'s power and toughness are each equal to the life paid as it entered the battlefield"))); + } + + public MinionOfTheWastes(final MinionOfTheWastes card) { + super(card); + } + + @Override + public MinionOfTheWastes copy() { + return new MinionOfTheWastes(this); + } +} + +class MinionOfTheWastesEffect extends OneShotEffect { + + public MinionOfTheWastesEffect() { + super(Outcome.LoseLife); + staticText = "pay any amount of life"; + } + + public MinionOfTheWastesEffect(final MinionOfTheWastesEffect effect) { + super(effect); + } + + @Override + public MinionOfTheWastesEffect copy() { + return new MinionOfTheWastesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Card sourceCard = game.getCard(source.getSourceId()); + int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game); + controller.loseLife(payAmount, game, false); + game.informPlayers(new StringBuilder(sourceCard.getLogName()).append(": ").append(controller.getLogName()) + .append(" pays ").append(payAmount).append(" life").toString()); + game.addEffect(new SetPowerToughnessSourceEffect(payAmount, payAmount, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/n/NamelessRace.java b/Mage.Sets/src/mage/cards/n/NamelessRace.java new file mode 100644 index 0000000000..0f413268eb --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NamelessRace.java @@ -0,0 +1,136 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.n; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.CardsInAllGraveyardsCount; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubLayer; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.other.OwnerPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author L_J + */ +public class NamelessRace extends CardImpl { + + public NamelessRace(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // As Nameless Race enters the battlefield, pay any amount of life. The amount you pay can't be more than the total number of white nontoken permanents your opponents control plus the total number of white cards in their graveyards. + this.addAbility(new AsEntersBattlefieldAbility(new NamelessRaceEffect())); + + // Nameless Race's power and toughness are each equal to the life paid as it entered the battlefield. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("{this}'s power and toughness are each equal to the life paid as it entered the battlefield"))); + } + + public NamelessRace(final NamelessRace card) { + super(card); + } + + @Override + public NamelessRace copy() { + return new NamelessRace(this); + } +} + +class NamelessRaceEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterPermanent("white nontoken permanents your opponents control"); + private static final FilterCard filter2 = new FilterCard("white cards in their graveyards"); + + static { + filter.add(new ColorPredicate(ObjectColor.WHITE)); + filter.add(Predicates.not(new TokenPredicate())); + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + filter2.add(new ColorPredicate(ObjectColor.WHITE)); + filter2.add(new OwnerPredicate(TargetController.OPPONENT)); + } + + public NamelessRaceEffect() { + super(Outcome.LoseLife); + staticText = "pay any amount of life. The amount you pay can't be more than the total number of white nontoken permanents your opponents control plus the total number of white cards in their graveyards"; + } + + public NamelessRaceEffect(final NamelessRaceEffect effect) { + super(effect); + } + + @Override + public NamelessRaceEffect copy() { + return new NamelessRaceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Card sourceCard = game.getCard(source.getSourceId()); + int permanentsInPlay = new PermanentsOnBattlefieldCount(filter).calculate(game, source, null); + int cardsInGraveyards = new CardsInAllGraveyardsCount(filter2).calculate(game, source, null); + int maxAmount = Math.min(permanentsInPlay + cardsInGraveyards, controller.getLife()); + int payAmount = controller.getAmount(0, maxAmount, "Pay up to " + maxAmount + " life", game); + controller.loseLife(payAmount, game, false); + game.informPlayers(new StringBuilder(sourceCard.getLogName()).append(": ").append(controller.getLogName()) + .append(" pays ").append(payAmount).append(" life").toString()); + game.addEffect(new SetPowerToughnessSourceEffect(payAmount, payAmount, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/r/Runesword.java b/Mage.Sets/src/mage/cards/r/Runesword.java new file mode 100644 index 0000000000..a5ece84153 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/Runesword.java @@ -0,0 +1,173 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.r; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.common.TargetAttackingCreature; +import mage.target.targetpointer.FixedTarget; +import mage.watchers.common.DamagedByWatcher; + +/** + * + * @author L_J + */ +public class Runesword extends CardImpl { + + public Runesword(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}"); + + // {3}, {T}: Target attacking creature gets +2/+0 until end of turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Duration.EndOfTurn), new GenericManaCost(3)); + // When that creature leaves the battlefield this turn, sacrifice Runesword. + ability.addEffect(new RuneswordCreateTriggeredAbilityEffect()); + // If the creature deals damage to a creature this turn, the creature dealt damage can't be regenerated this turn. + ability.addEffect(new RuneswordCantBeRegeneratedEffect()); + // If a creature dealt damage by the targeted creature would die this turn, exile that creature instead. + SimpleStaticAbility ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new DealtDamageToCreatureBySourceDies(this, Duration.Custom)); + ability2.addWatcher(new DamagedByWatcher()); + ability2.setRuleVisible(false); + ability.addEffect(new GainAbilityTargetEffect(ability2, Duration.EndOfTurn, null, false).setText( + "If a creature dealt damage by the targeted creature would die this turn, exile that creature instead")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetAttackingCreature()); + this.addAbility(ability); + } + + public Runesword(final Runesword card) { + super(card); + } + + @Override + public Runesword copy() { + return new Runesword(this); + } +} + +class RuneswordCreateTriggeredAbilityEffect extends OneShotEffect { + + public RuneswordCreateTriggeredAbilityEffect() { + super(Outcome.PutCreatureInPlay); + staticText = "When that creature leaves the battlefield this turn, sacrifice {this}"; + } + + public RuneswordCreateTriggeredAbilityEffect(final RuneswordCreateTriggeredAbilityEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); + Permanent targetObject = game.getPermanent(this.getTargetPointer().getFirst(game, source)); + if (sourceObject != null && targetObject != null) { + Effect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + sourceObject.getName()); + sacrificeEffect.setTargetPointer(new FixedTarget(sourceObject, game)); + LeavesBattlefieldTriggeredAbility triggerAbility = new LeavesBattlefieldTriggeredAbility(sacrificeEffect, false); + triggerAbility.setRuleVisible(false); + ContinuousEffect continuousEffect = new GainAbilityTargetEffect(triggerAbility, Duration.EndOfTurn); + continuousEffect.setTargetPointer(new FixedTarget(targetObject, game)); + game.addEffect(continuousEffect, source); + return true; + } + return false; + } + + @Override + public RuneswordCreateTriggeredAbilityEffect copy() { + return new RuneswordCreateTriggeredAbilityEffect(this); + } +} + +class RuneswordCantBeRegeneratedEffect extends ContinuousRuleModifyingEffectImpl { + + private UUID targetCreatureId; + + public RuneswordCantBeRegeneratedEffect() { + super(Duration.EndOfTurn, Outcome.Benefit, false, false); + this.staticText = "If the creature deals damage to a creature this turn, the creature dealt damage can't be regenerated this turn"; + } + + public RuneswordCantBeRegeneratedEffect(final RuneswordCantBeRegeneratedEffect effect) { + super(effect); + targetCreatureId = effect.targetCreatureId; + } + + @Override + public RuneswordCantBeRegeneratedEffect copy() { + return new RuneswordCantBeRegeneratedEffect(this); + } + + public void init(Ability source, Game game) { + targetCreatureId = getTargetPointer().getFirst(game, source); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == EventType.REGENERATE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (targetCreatureId != null) { + DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), targetCreatureId); + if (watcher != null) { + return watcher.wasDamaged(event.getTargetId(), game); + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/cards/t/TheFallen.java b/Mage.Sets/src/mage/cards/t/TheFallen.java new file mode 100644 index 0000000000..ab009381c6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheFallen.java @@ -0,0 +1,146 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.t; + +import java.util.*; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.WatcherScope; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.watchers.Watcher; + +/** + * + * @author L_J + */ +public class TheFallen extends CardImpl { + + public TheFallen(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}{B}"); + this.subtype.add(SubType.ZOMBIE); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // At the beginning of your upkeep, The Fallen deals 1 damage to each opponent it has dealt damage to this game. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TheFallenEffect(), TargetController.YOU, false), new TheFallenWatcher()); + } + + public TheFallen(final TheFallen card) { + super(card); + } + + @Override + public TheFallen copy() { + return new TheFallen(this); + } +} + +class TheFallenEffect extends OneShotEffect { + + public TheFallenEffect() { + super(Outcome.Damage); + this.staticText = "{this} deals 1 damage to each opponent it has dealt damage to this game"; + } + + public TheFallenEffect(final TheFallenEffect effect) { + super(effect); + } + + @Override + public TheFallenEffect copy() { + return new TheFallenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + TheFallenWatcher watcher = (TheFallenWatcher) game.getState().getWatchers().get(TheFallenWatcher.class.getSimpleName()); + if (watcher != null && watcher.getPlayerDealtDamageThisGame(source.getSourceId()) != null) { + for (UUID playerId : watcher.getPlayerDealtDamageThisGame(source.getSourceId())) { + if (!source.getControllerId().equals(playerId)) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.damage(1, source.getSourceId(), game, false, true); + } + } + } + return true; + } + return false; + } +} + +class TheFallenWatcher extends Watcher { + + private Map> playersDealtDamageThisGame = new HashMap<>(); // Map> + + public TheFallenWatcher() { + super(TheFallenWatcher.class.getSimpleName(), WatcherScope.GAME); + } + + public TheFallenWatcher(final TheFallenWatcher watcher) { + super(watcher); + playersDealtDamageThisGame = new HashMap<>(watcher.playersDealtDamageThisGame); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null) { + Set toAdd; + if (playersDealtDamageThisGame.get(event.getSourceId()) == null) { + toAdd = new HashSet<>(); + } else { + toAdd = playersDealtDamageThisGame.get(event.getSourceId()); + } + toAdd.add(event.getPlayerId()); + playersDealtDamageThisGame.put(event.getSourceId(), toAdd); + } + } + } + + public Set getPlayerDealtDamageThisGame(UUID creatureId) { + return playersDealtDamageThisGame.get(creatureId); + } + + @Override + public TheFallenWatcher copy() { + return new TheFallenWatcher(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Chronicles.java b/Mage.Sets/src/mage/sets/Chronicles.java index 44a3c47cfe..75eb7d6636 100644 --- a/Mage.Sets/src/mage/sets/Chronicles.java +++ b/Mage.Sets/src/mage/sets/Chronicles.java @@ -128,6 +128,7 @@ public class Chronicles extends ExpansionSet { cards.add(new SetCardInfo("Repentant Blacksmith", 67, Rarity.COMMON, mage.cards.r.RepentantBlacksmith.class)); cards.add(new SetCardInfo("Revelation", 40, Rarity.RARE, mage.cards.r.Revelation.class)); cards.add(new SetCardInfo("Rubinia Soulsinger", 118, Rarity.RARE, mage.cards.r.RubiniaSoulsinger.class)); + cards.add(new SetCardInfo("Runesword", 86, Rarity.COMMON, mage.cards.r.Runesword.class)); cards.add(new SetCardInfo("Safe Haven", 93, Rarity.RARE, mage.cards.s.SafeHaven.class)); cards.add(new SetCardInfo("Scavenger Folk", 41, Rarity.COMMON, mage.cards.s.ScavengerFolk.class)); cards.add(new SetCardInfo("Sentinel", 87, Rarity.RARE, mage.cards.s.Sentinel.class)); @@ -139,6 +140,7 @@ public class Chronicles extends ExpansionSet { cards.add(new SetCardInfo("Stangg", 121, Rarity.RARE, mage.cards.s.Stangg.class)); cards.add(new SetCardInfo("Storm Seeker", 42, Rarity.UNCOMMON, mage.cards.s.StormSeeker.class)); cards.add(new SetCardInfo("Teleport", 26, Rarity.RARE, mage.cards.t.Teleport.class)); + cards.add(new SetCardInfo("The Fallen", 10, Rarity.UNCOMMON, mage.cards.t.TheFallen.class)); cards.add(new SetCardInfo("The Wretched", 11, Rarity.RARE, mage.cards.t.TheWretched.class)); cards.add(new SetCardInfo("Tobias Andrion", 122, Rarity.UNCOMMON, mage.cards.t.TobiasAndrion.class)); cards.add(new SetCardInfo("Tormod's Crypt", 89, Rarity.COMMON, mage.cards.t.TormodsCrypt.class)); diff --git a/Mage.Sets/src/mage/sets/MastersEdition.java b/Mage.Sets/src/mage/sets/MastersEdition.java index d38ce5df2e..cdf94aba0e 100644 --- a/Mage.Sets/src/mage/sets/MastersEdition.java +++ b/Mage.Sets/src/mage/sets/MastersEdition.java @@ -114,6 +114,7 @@ public class MastersEdition extends ExpansionSet { cards.add(new SetCardInfo("Erg Raiders", 68, Rarity.COMMON, mage.cards.e.ErgRaiders.class)); cards.add(new SetCardInfo("Eureka", 117, Rarity.RARE, mage.cards.e.Eureka.class)); cards.add(new SetCardInfo("Exile", 12, Rarity.COMMON, mage.cards.e.Exile.class)); + cards.add(new SetCardInfo("The Fallen", 69, Rarity.UNCOMMON, mage.cards.t.TheFallen.class)); cards.add(new SetCardInfo("Feast or Famine", 70, Rarity.COMMON, mage.cards.f.FeastOrFamine.class)); cards.add(new SetCardInfo("Fire Covenant", 145, Rarity.UNCOMMON, mage.cards.f.FireCovenant.class)); cards.add(new SetCardInfo("Fissure", 93, Rarity.COMMON, mage.cards.f.Fissure.class)); diff --git a/Mage.Sets/src/mage/sets/Tempest.java b/Mage.Sets/src/mage/sets/Tempest.java index 4766f25acd..e764804b94 100644 --- a/Mage.Sets/src/mage/sets/Tempest.java +++ b/Mage.Sets/src/mage/sets/Tempest.java @@ -196,6 +196,7 @@ public class Tempest extends ExpansionSet { cards.add(new SetCardInfo("Meditate", 76, Rarity.RARE, mage.cards.m.Meditate.class)); cards.add(new SetCardInfo("Metallic Sliver", 287, Rarity.COMMON, mage.cards.m.MetallicSliver.class)); cards.add(new SetCardInfo("Mindwhip Sliver", 39, Rarity.UNCOMMON, mage.cards.m.MindwhipSliver.class)); + cards.add(new SetCardInfo("Minion of the Wastes", 40, Rarity.RARE, mage.cards.m.MinionOfTheWastes.class)); cards.add(new SetCardInfo("Mirri's Guile", 130, Rarity.RARE, mage.cards.m.MirrisGuile.class)); cards.add(new SetCardInfo("Mnemonic Sliver", 77, Rarity.UNCOMMON, mage.cards.m.MnemonicSliver.class)); cards.add(new SetCardInfo("Mogg Cannon", 288, Rarity.UNCOMMON, mage.cards.m.MoggCannon.class)); diff --git a/Mage.Sets/src/mage/sets/TheDark.java b/Mage.Sets/src/mage/sets/TheDark.java index 4fe90148e6..f67cff2be9 100644 --- a/Mage.Sets/src/mage/sets/TheDark.java +++ b/Mage.Sets/src/mage/sets/TheDark.java @@ -126,6 +126,7 @@ public class TheDark extends ExpansionSet { cards.add(new SetCardInfo("Miracle Worker", 86, Rarity.COMMON, mage.cards.m.MiracleWorker.class)); cards.add(new SetCardInfo("Morale", 87, Rarity.COMMON, mage.cards.m.Morale.class)); cards.add(new SetCardInfo("Murk Dwellers", 11, Rarity.COMMON, mage.cards.m.MurkDwellers.class)); + cards.add(new SetCardInfo("Nameless Race", 12, Rarity.RARE, mage.cards.n.NamelessRace.class)); cards.add(new SetCardInfo("Necropolis", 102, Rarity.RARE, mage.cards.n.Necropolis.class)); cards.add(new SetCardInfo("Niall Silvain", 45, Rarity.RARE, mage.cards.n.NiallSilvain.class)); cards.add(new SetCardInfo("Orc General", 72, Rarity.UNCOMMON, mage.cards.o.OrcGeneral.class)); @@ -135,6 +136,7 @@ public class TheDark extends ExpansionSet { cards.add(new SetCardInfo("Psychic Allergy", 33, Rarity.RARE, mage.cards.p.PsychicAllergy.class)); cards.add(new SetCardInfo("Rag Man", 13, Rarity.RARE, mage.cards.r.RagMan.class)); cards.add(new SetCardInfo("Riptide", 34, Rarity.COMMON, mage.cards.r.Riptide.class)); + cards.add(new SetCardInfo("Runesword", 104, Rarity.RARE, mage.cards.r.Runesword.class)); cards.add(new SetCardInfo("Safe Haven", 115, Rarity.RARE, mage.cards.s.SafeHaven.class)); cards.add(new SetCardInfo("Savaen Elves", 47, Rarity.COMMON, mage.cards.s.SavaenElves.class)); cards.add(new SetCardInfo("Scarecrow", 105, Rarity.RARE, mage.cards.s.Scarecrow.class)); @@ -152,6 +154,7 @@ public class TheDark extends ExpansionSet { cards.add(new SetCardInfo("Stone Calendar", 108, Rarity.RARE, mage.cards.s.StoneCalendar.class)); cards.add(new SetCardInfo("Sunken City", 35, Rarity.COMMON, mage.cards.s.SunkenCity.class)); cards.add(new SetCardInfo("Tangle Kelp", 36, Rarity.RARE, mage.cards.t.TangleKelp.class)); + cards.add(new SetCardInfo("The Fallen", 15, Rarity.RARE, mage.cards.t.TheFallen.class)); cards.add(new SetCardInfo("Tivadar's Crusade", 91, Rarity.UNCOMMON, mage.cards.t.TivadarsCrusade.class)); cards.add(new SetCardInfo("Tormod's Crypt", 109, Rarity.UNCOMMON, mage.cards.t.TormodsCrypt.class)); cards.add(new SetCardInfo("Tower of Coireall", 110, Rarity.RARE, mage.cards.t.TowerOfCoireall.class));