mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Implemented Rampage of the Clans
This commit is contained in:
parent
0293b91c25
commit
4c2a9172eb
3 changed files with 86 additions and 15 deletions
|
@ -13,19 +13,16 @@ import mage.game.permanent.Permanent;
|
|||
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 @@ class MarchOfSoulsEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
List<Permanent> creatures = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES,
|
||||
source.getControllerId(), source.getSourceId(), game);
|
||||
Map<UUID, Integer> 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;
|
||||
|
|
77
Mage.Sets/src/mage/cards/r/RampageOfTheClans.java
Normal file
77
Mage.Sets/src/mage/cards/r/RampageOfTheClans.java
Normal file
|
@ -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<UUID, Integer> 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;
|
||||
}
|
||||
}
|
|
@ -96,6 +96,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
|
|||
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));
|
||||
|
|
Loading…
Reference in a new issue