[40K] Implemented Assault Intercessor

This commit is contained in:
Evan Kranzler 2022-09-26 21:03:01 -04:00
parent b0f4830d60
commit 8bd0477dcf
2 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Controllable;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AssaultIntercessor extends CardImpl {
public AssaultIntercessor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{B}");
this.subtype.add(SubType.ASTARTES);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Menace
this.addAbility(new MenaceAbility());
// Chainsword -- Whenever a creature an opponent controls dies, that player loses 2 life.
this.addAbility(new DiesCreatureTriggeredAbility(
new AssaultIntercessorEffect(), false,
StaticFilters.FILTER_OPPONENTS_PERMANENT_A_CREATURE
).withFlavorWord("Chainsword"));
}
private AssaultIntercessor(final AssaultIntercessor card) {
super(card);
}
@Override
public AssaultIntercessor copy() {
return new AssaultIntercessor(this);
}
}
class AssaultIntercessorEffect extends OneShotEffect {
AssaultIntercessorEffect() {
super(Outcome.Benefit);
staticText = "that player loses 2 life";
}
private AssaultIntercessorEffect(final AssaultIntercessorEffect effect) {
super(effect);
}
@Override
public AssaultIntercessorEffect copy() {
return new AssaultIntercessorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return Optional
.ofNullable(getValue("creatureDied"))
.filter(Objects::nonNull)
.map(Permanent.class::cast)
.map(Controllable::getControllerId)
.map(game::getPlayer)
.filter(Objects::nonNull)
.map(player -> player.loseLife(2, game, source, false) > 0)
.orElse(false);
}
}

View file

@ -34,6 +34,7 @@ public final class Warhammer40000 extends ExpansionSet {
cards.add(new SetCardInfo("Arcane Signet", 227, Rarity.COMMON, mage.cards.a.ArcaneSignet.class));
cards.add(new SetCardInfo("Arco-Flagellant", 29, Rarity.RARE, mage.cards.a.ArcoFlagellant.class));
cards.add(new SetCardInfo("Ash Barrens", 265, Rarity.COMMON, mage.cards.a.AshBarrens.class));
cards.add(new SetCardInfo("Assault Intercessor", 104, Rarity.RARE, mage.cards.a.AssaultIntercessor.class));
cards.add(new SetCardInfo("Assault Suit", 230, Rarity.UNCOMMON, mage.cards.a.AssaultSuit.class));
cards.add(new SetCardInfo("Atalan Jackal", 105, Rarity.RARE, mage.cards.a.AtalanJackal.class));
cards.add(new SetCardInfo("Barren Moor", 266, Rarity.UNCOMMON, mage.cards.b.BarrenMoor.class));