[SNC] Implemented Soul of Emancipation

This commit is contained in:
Evan Kranzler 2022-04-14 22:55:36 -04:00
parent 6fd4615ede
commit 0e4126b237
2 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,105 @@
package mage.cards.s;
import mage.MageInt;
import mage.MageItem;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Angel33Token;
import mage.target.TargetPermanent;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author TheElk801
*/
public final class SoulOfEmancipation extends CardImpl {
private static final FilterPermanent filter = new FilterNonlandPermanent("other nonland permanents");
static {
filter.add(AnotherPredicate.instance);
}
public SoulOfEmancipation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{W}{U}");
this.subtype.add(SubType.AVATAR);
this.power = new MageInt(5);
this.toughness = new MageInt(7);
// When Soul of Emancipation enters the battlefield, destroy up to three other target nonland permanents. For each of those permanents, its controller creates a 3/3 white Angel creature token with flying.
Ability ability = new EntersBattlefieldTriggeredAbility(new SoulOfEmancipationEffect());
ability.addTarget(new TargetPermanent(0, 3, filter));
this.addAbility(ability);
}
private SoulOfEmancipation(final SoulOfEmancipation card) {
super(card);
}
@Override
public SoulOfEmancipation copy() {
return new SoulOfEmancipation(this);
}
}
class SoulOfEmancipationEffect extends OneShotEffect {
SoulOfEmancipationEffect() {
super(Outcome.Benefit);
staticText = "destroy up to three other target nonland permanents. For each of those permanents, " +
"its controller creates a 3/3 white Angel creature token with flying";
}
private SoulOfEmancipationEffect(final SoulOfEmancipationEffect effect) {
super(effect);
}
@Override
public SoulOfEmancipationEffect copy() {
return new SoulOfEmancipationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = this
.getTargetPointer()
.getTargets(game, source)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (permanents.isEmpty()) {
return false;
}
Map<UUID, Integer> playerMap = permanents
.stream()
.collect(Collectors.toMap(
MageItem::getId,
x -> 1,
Integer::sum
));
for (Permanent permanent : permanents) {
permanent.destroy(source, game);
}
for (Map.Entry<UUID, Integer> entry : playerMap.entrySet()) {
new Angel33Token().putOntoBattlefield(entry.getValue(), game, source, entry.getKey());
}
return true;
}
}

View file

@ -162,6 +162,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Slip Out the Back", 62, Rarity.UNCOMMON, mage.cards.s.SlipOutTheBack.class));
cards.add(new SetCardInfo("Snooping Newsie", 222, Rarity.COMMON, mage.cards.s.SnoopingNewsie.class));
cards.add(new SetCardInfo("Social Climber", 157, Rarity.COMMON, mage.cards.s.SocialClimber.class));
cards.add(new SetCardInfo("Soul of Emancipation", 223, Rarity.RARE, mage.cards.s.SoulOfEmancipation.class));
cards.add(new SetCardInfo("Spara's Headquarters", 257, Rarity.RARE, mage.cards.s.SparasHeadquarters.class));
cards.add(new SetCardInfo("Stimulus Package", 225, Rarity.UNCOMMON, mage.cards.s.StimulusPackage.class));
cards.add(new SetCardInfo("Strangle", 125, Rarity.COMMON, mage.cards.s.Strangle.class));