mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Implemented Archfiend of Spite
This commit is contained in:
parent
c143e606ca
commit
1ac6a7a5a2
2 changed files with 143 additions and 0 deletions
142
Mage.Sets/src/mage/cards/a/ArchfiendOfSpite.java
Normal file
142
Mage.Sets/src/mage/cards/a/ArchfiendOfSpite.java
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.SacrificeEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.abilities.keyword.MadnessAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ArchfiendOfSpite extends CardImpl {
|
||||||
|
|
||||||
|
public ArchfiendOfSpite(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.DEMON);
|
||||||
|
this.power = new MageInt(6);
|
||||||
|
this.toughness = new MageInt(6);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever a source an opponent controls deals damage to Archfiend of Spite, that source's controller loses that much life unless they sacrifice that many permanents.
|
||||||
|
this.addAbility(new ArchfiendOfSpiteAbility());
|
||||||
|
|
||||||
|
// Madness {3}{B}{B}
|
||||||
|
this.addAbility(new MadnessAbility(this, new ManaCostsImpl("{3}{B}{B}")));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArchfiendOfSpite(final ArchfiendOfSpite card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArchfiendOfSpite copy() {
|
||||||
|
return new ArchfiendOfSpite(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ArchfiendOfSpiteAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
ArchfiendOfSpiteAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArchfiendOfSpiteAbility(final ArchfiendOfSpiteAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArchfiendOfSpiteAbility copy() {
|
||||||
|
return new ArchfiendOfSpiteAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
if (!event.getTargetId().equals(getSourceId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
UUID sourceControllerId = game.getControllerId(event.getSourceId());
|
||||||
|
if (sourceControllerId == null ||
|
||||||
|
!game.getOpponents(getControllerId()).contains(sourceControllerId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.getEffects().clear();
|
||||||
|
this.addEffect(new ArchfiendOfSpiteEffect(event.getAmount(), sourceControllerId));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Whenever a source an opponent controls deals damage to {this}, " +
|
||||||
|
"that source's controller loses that much life unless they sacrifice that many permanents.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ArchfiendOfSpiteEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private final UUID playerId;
|
||||||
|
private final int amount;
|
||||||
|
private final Effect effect;
|
||||||
|
|
||||||
|
ArchfiendOfSpiteEffect(int amount, UUID playerId) {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.playerId = playerId;
|
||||||
|
this.amount = amount;
|
||||||
|
this.effect = new SacrificeEffect(StaticFilters.FILTER_PERMANENTS, amount, "");
|
||||||
|
this.effect.setTargetPointer(new FixedTarget(playerId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArchfiendOfSpiteEffect(final ArchfiendOfSpiteEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.playerId = effect.playerId;
|
||||||
|
this.amount = effect.amount;
|
||||||
|
this.effect = effect.effect.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArchfiendOfSpiteEffect copy() {
|
||||||
|
return new ArchfiendOfSpiteEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT, playerId, game).size() < amount
|
||||||
|
|| player.chooseUse(outcome, "Lose " + amount + " life or sacrifice " + amount + " permanents?",
|
||||||
|
null, "Lose " + amount + " life",
|
||||||
|
"Sacrifice " + amount + " permanents", source, game
|
||||||
|
)) {
|
||||||
|
return player.loseLife(amount, game, false) > 0;
|
||||||
|
}
|
||||||
|
return effect.apply(game, source);
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ public final class Commander2019Edition extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Anje Falkenrath", 37, Rarity.MYTHIC, mage.cards.a.AnjeFalkenrath.class));
|
cards.add(new SetCardInfo("Anje Falkenrath", 37, Rarity.MYTHIC, mage.cards.a.AnjeFalkenrath.class));
|
||||||
cards.add(new SetCardInfo("Anje's Ravager", 22, Rarity.RARE, mage.cards.a.AnjesRavager.class));
|
cards.add(new SetCardInfo("Anje's Ravager", 22, Rarity.RARE, mage.cards.a.AnjesRavager.class));
|
||||||
cards.add(new SetCardInfo("Apex Altisaur", 31, Rarity.RARE, mage.cards.a.ApexAltisaur.class));
|
cards.add(new SetCardInfo("Apex Altisaur", 31, Rarity.RARE, mage.cards.a.ApexAltisaur.class));
|
||||||
|
cards.add(new SetCardInfo("Archfiend of Spite", 14, Rarity.RARE, mage.cards.a.ArchfiendOfSpite.class));
|
||||||
cards.add(new SetCardInfo("Armillary Sphere", 209, Rarity.COMMON, mage.cards.a.ArmillarySphere.class));
|
cards.add(new SetCardInfo("Armillary Sphere", 209, Rarity.COMMON, mage.cards.a.ArmillarySphere.class));
|
||||||
cards.add(new SetCardInfo("Ash Barrens", 227, Rarity.COMMON, mage.cards.a.AshBarrens.class));
|
cards.add(new SetCardInfo("Ash Barrens", 227, Rarity.COMMON, mage.cards.a.AshBarrens.class));
|
||||||
cards.add(new SetCardInfo("Asylum Visitor", 103, Rarity.RARE, mage.cards.a.AsylumVisitor.class));
|
cards.add(new SetCardInfo("Asylum Visitor", 103, Rarity.RARE, mage.cards.a.AsylumVisitor.class));
|
||||||
|
|
Loading…
Reference in a new issue