diff --git a/Mage.Sets/src/mage/cards/m/MarchOfSouls.java b/Mage.Sets/src/mage/cards/m/MarchOfSouls.java index e8b392c6f702..afb8a682f0e9 100644 --- a/Mage.Sets/src/mage/cards/m/MarchOfSouls.java +++ b/Mage.Sets/src/mage/cards/m/MarchOfSouls.java @@ -13,19 +13,16 @@ import mage.game.permanent.token.SpiritWhiteToken; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; /** - * * @author LoneFox - */ public final class MarchOfSouls extends CardImpl { public MarchOfSouls(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}"); // Destroy all creatures. They can't be regenerated. For each creature destroyed this way, its controller creates a 1/1 white Spirit creature token with flying. this.getSpellAbility().addEffect(new MarchOfSoulsEffect()); @@ -59,22 +56,18 @@ public MarchOfSoulsEffect copy() { @Override public boolean apply(Game game, Ability source) { - List creatures = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, - source.getControllerId(), source.getSourceId(), game); Map playersWithCreatures = new HashMap<>(); - for(Permanent p : creatures) { + for (Permanent p : game.getBattlefield().getActivePermanents( + StaticFilters.FILTER_PERMANENT_CREATURES, + source.getControllerId(), source.getSourceId(), game + )) { UUID controllerId = p.getControllerId(); - if(p.destroy(source.getSourceId(), game, true)) { - if(playersWithCreatures.containsKey(controllerId)) { - playersWithCreatures.put(controllerId, playersWithCreatures.get(controllerId) + 1); - } - else { - playersWithCreatures.put(controllerId, 1); - } + if (p.destroy(source.getSourceId(), game, true)) { + playersWithCreatures.put(controllerId, playersWithCreatures.getOrDefault(controllerId, 0) + 1); } } SpiritWhiteToken token = new SpiritWhiteToken(); - for(UUID playerId : playersWithCreatures.keySet()) { + for (UUID playerId : playersWithCreatures.keySet()) { token.putOntoBattlefield(playersWithCreatures.get(playerId), game, source.getSourceId(), playerId); } return true; diff --git a/Mage.Sets/src/mage/cards/r/RampageOfTheClans.java b/Mage.Sets/src/mage/cards/r/RampageOfTheClans.java new file mode 100644 index 000000000000..887a1786e20a --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RampageOfTheClans.java @@ -0,0 +1,77 @@ +package mage.cards.r; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.CentaurToken; +import mage.game.permanent.token.Token; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RampageOfTheClans extends CardImpl { + + public RampageOfTheClans(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}"); + + // Destroy all artifacts and enchantments. For each permanent destroyed this way, its controller creates a 3/3 green Centaur creature token. + this.getSpellAbility().addEffect(new RampageOfTheClansEffect()); + } + + private RampageOfTheClans(final RampageOfTheClans card) { + super(card); + } + + @Override + public RampageOfTheClans copy() { + return new RampageOfTheClans(this); + } +} + +class RampageOfTheClansEffect extends OneShotEffect { + + RampageOfTheClansEffect() { + super(Outcome.Benefit); + staticText = "Destroy all artifacts and enchantments. " + + "For each permanent destroyed this way, " + + "its controller creates a 3/3 green Centaur creature token."; + } + + private RampageOfTheClansEffect(final RampageOfTheClansEffect effect) { + super(effect); + } + + @Override + public RampageOfTheClansEffect copy() { + return new RampageOfTheClansEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Map playersWithPermanents = new HashMap<>(); + for (Permanent p : game.getBattlefield().getActivePermanents( + StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT, + source.getControllerId(), source.getSourceId(), game + )) { + UUID controllerId = p.getControllerId(); + if (p.destroy(source.getSourceId(), game, false)) { + playersWithPermanents.put(controllerId, playersWithPermanents.getOrDefault(controllerId, 0) + 1); + } + } + Token token = new CentaurToken(); + for (UUID playerId : playersWithPermanents.keySet()) { + token.putOntoBattlefield(playersWithPermanents.get(playerId), game, source.getSourceId(), playerId); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index e926d7523b2a..3671cdfdd5e0 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -96,6 +96,7 @@ private RavnicaAllegiance() { cards.add(new SetCardInfo("Rakdos Guildgate", 256, Rarity.COMMON, mage.cards.r.RakdosGuildgate.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Rakdos Locket", 237, Rarity.COMMON, mage.cards.r.RakdosLocket.class)); cards.add(new SetCardInfo("Rakdos, the Showstopper", 199, Rarity.MYTHIC, mage.cards.r.RakdosTheShowstopper.class)); + cards.add(new SetCardInfo("Rampage of the Clans", 134, Rarity.RARE, mage.cards.r.RampageOfTheClans.class)); cards.add(new SetCardInfo("Ravager Wurm", 200, Rarity.MYTHIC, mage.cards.r.RavagerWurm.class)); cards.add(new SetCardInfo("Rix Maadi Reveler", 109, Rarity.RARE, mage.cards.r.RixMaadiReveler.class)); cards.add(new SetCardInfo("Seraph of the Scales", 205, Rarity.MYTHIC, mage.cards.s.SeraphOfTheScales.class));