[40K] Implemented Mandate of Abaddon

This commit is contained in:
Evan Kranzler 2022-10-05 19:41:30 -04:00
parent fe45045510
commit 7a5faa9061
2 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,73 @@
package mage.cards.m;
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.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MandateOfAbaddon extends CardImpl {
public MandateOfAbaddon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
// Choose target creature you control. Destroy all creatures with power less than that creature's power.
this.getSpellAbility().addEffect(new MandateOfAbaddonEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
}
private MandateOfAbaddon(final MandateOfAbaddon card) {
super(card);
}
@Override
public MandateOfAbaddon copy() {
return new MandateOfAbaddon(this);
}
}
class MandateOfAbaddonEffect extends OneShotEffect {
MandateOfAbaddonEffect() {
super(Outcome.Benefit);
staticText = "choose target creature you control. " +
"Destroy all creatures with power less than that creature's power";
}
private MandateOfAbaddonEffect(final MandateOfAbaddonEffect effect) {
super(effect);
}
@Override
public MandateOfAbaddonEffect copy() {
return new MandateOfAbaddonEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (creature == null) {
return false;
}
int power = creature.getPower().getValue();
for (Permanent permanent : game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_PERMANENT_CREATURE,
source.getControllerId(), source, game
)) {
if (permanent.getPower().getValue() < power) {
permanent.destroy(source, game);
}
}
return true;
}
}

View file

@ -149,6 +149,7 @@ public final class Warhammer40000 extends ExpansionSet {
cards.add(new SetCardInfo("Lord of Change", 24, Rarity.RARE, mage.cards.l.LordOfChange.class));
cards.add(new SetCardInfo("Lychguard", 39, Rarity.RARE, mage.cards.l.Lychguard.class));
cards.add(new SetCardInfo("Malanthrope", 132, Rarity.RARE, mage.cards.m.Malanthrope.class));
cards.add(new SetCardInfo("Mandate of Abaddon", 40, Rarity.RARE, mage.cards.m.MandateOfAbaddon.class));
cards.add(new SetCardInfo("Martial Coup", 189, Rarity.RARE, mage.cards.m.MartialCoup.class));
cards.add(new SetCardInfo("Mask of Memory", 243, Rarity.UNCOMMON, mage.cards.m.MaskOfMemory.class));
cards.add(new SetCardInfo("Mawloc", 133, Rarity.RARE, mage.cards.m.Mawloc.class));