[BRC] Implement Ashnod, the Uncaring

This commit is contained in:
Evan Kranzler 2022-11-06 12:24:44 -05:00
parent 8b52789b52
commit cf9a4a4eab
9 changed files with 132 additions and 16 deletions

View file

@ -0,0 +1,102 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.SacrificeCost;
import mage.abilities.effects.common.CopyStackObjectEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackAbility;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AshnodTheUncaring extends CardImpl {
public AshnodTheUncaring(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ARTIFICER);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// Deathtouch
this.addAbility(DeathtouchAbility.getInstance());
// Whenever you activate an ability of an artifact or creature that isn't a mana ability, if one or more permanents were sacrificed to activate it, you may copy that ability. You may choose new targets for the copy.
this.addAbility(new AshnodTheUncaringTriggeredAbility());
}
private AshnodTheUncaring(final AshnodTheUncaring card) {
super(card);
}
@Override
public AshnodTheUncaring copy() {
return new AshnodTheUncaring(this);
}
}
class AshnodTheUncaringTriggeredAbility extends TriggeredAbilityImpl {
AshnodTheUncaringTriggeredAbility() {
super(Zone.BATTLEFIELD, new CopyStackObjectEffect(), true);
}
private AshnodTheUncaringTriggeredAbility(final AshnodTheUncaringTriggeredAbility ability) {
super(ability);
}
@Override
public AshnodTheUncaringTriggeredAbility copy() {
return new AshnodTheUncaringTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!isControlledBy(event.getPlayerId())) {
return false;
}
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
if (stackAbility == null
|| stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl
|| stackAbility
.getStackAbility()
.getCosts()
.stream()
.noneMatch(SacrificeCost.class::isInstance)) {
return false;
}
Permanent permanent = game.getPermanent(stackAbility.getSourceId());
if (permanent == null || (!permanent.isArtifact(game) && !permanent.isCreature(game))) {
return false;
}
this.getEffects().setValue("stackObject", stackAbility);
return true;
}
@Override
public String getRule() {
return "Whenever you activate an ability of an artifact or creature that isn't a mana ability, " +
"if one or more permanents were sacrificed to activate it, " +
"you may copy that ability. You may choose new targets for the copy.";
}
}

View file

@ -26,6 +26,7 @@ public final class TheBrothersWarCommander extends ExpansionSet {
cards.add(new SetCardInfo("Arcane Signet", 132, Rarity.COMMON, mage.cards.a.ArcaneSignet.class)); cards.add(new SetCardInfo("Arcane Signet", 132, Rarity.COMMON, mage.cards.a.ArcaneSignet.class));
cards.add(new SetCardInfo("Armix, Filigree Thrasher", 103, Rarity.UNCOMMON, mage.cards.a.ArmixFiligreeThrasher.class)); cards.add(new SetCardInfo("Armix, Filigree Thrasher", 103, Rarity.UNCOMMON, mage.cards.a.ArmixFiligreeThrasher.class));
cards.add(new SetCardInfo("Ash Barrens", 174, Rarity.COMMON, mage.cards.a.AshBarrens.class)); cards.add(new SetCardInfo("Ash Barrens", 174, Rarity.COMMON, mage.cards.a.AshBarrens.class));
cards.add(new SetCardInfo("Ashnod the Uncaring", 4, Rarity.MYTHIC, mage.cards.a.AshnodTheUncaring.class));
cards.add(new SetCardInfo("Audacious Reshapers", 112, Rarity.RARE, mage.cards.a.AudaciousReshapers.class)); cards.add(new SetCardInfo("Audacious Reshapers", 112, Rarity.RARE, mage.cards.a.AudaciousReshapers.class));
cards.add(new SetCardInfo("Austere Command", 69, Rarity.RARE, mage.cards.a.AustereCommand.class)); cards.add(new SetCardInfo("Austere Command", 69, Rarity.RARE, mage.cards.a.AustereCommand.class));
cards.add(new SetCardInfo("Azorius Chancery", 175, Rarity.UNCOMMON, mage.cards.a.AzoriusChancery.class)); cards.add(new SetCardInfo("Azorius Chancery", 175, Rarity.UNCOMMON, mage.cards.a.AzoriusChancery.class));

View file

@ -0,0 +1,9 @@
package mage.abilities.costs;
/**
* An interface to identify costs that sacrifice permanents
*
* @author TheElk801
*/
public interface SacrificeCost extends Cost {
}

View file

@ -1,23 +1,23 @@
package mage.abilities.costs.common; package mage.abilities.costs.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl; import mage.abilities.costs.CostImpl;
import mage.abilities.costs.SacrificeCost;
import mage.constants.AbilityType; import mage.constants.AbilityType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class SacrificeAllCost extends CostImpl { public class SacrificeAllCost extends CostImpl implements SacrificeCost {
private final FilterPermanent filter; private final FilterPermanent filter;
private final List<Permanent> permanents = new ArrayList<>(); private final List<Permanent> permanents = new ArrayList<>();

View file

@ -1,18 +1,18 @@
package mage.abilities.costs.common; package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl; import mage.abilities.costs.CostImpl;
import mage.abilities.costs.SacrificeCost;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
*
* @author L_J (based on BetaSteward_at_googlemail.com) * @author L_J (based on BetaSteward_at_googlemail.com)
*/ */
public class SacrificeAttachedCost extends CostImpl { public class SacrificeAttachedCost extends CostImpl implements SacrificeCost {
public SacrificeAttachedCost() { public SacrificeAttachedCost() {
this.text = "Sacrifice enchanted creature"; this.text = "Sacrifice enchanted creature";

View file

@ -2,6 +2,7 @@ package mage.abilities.costs.common;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.SacrificeCost;
import mage.abilities.costs.UseAttachedCost; import mage.abilities.costs.UseAttachedCost;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -11,7 +12,7 @@ import java.util.UUID;
/** /**
* @author TheElk801 * @author TheElk801
*/ */
public class SacrificeAttachmentCost extends UseAttachedCost { public class SacrificeAttachmentCost extends UseAttachedCost implements SacrificeCost {
public SacrificeAttachmentCost() { public SacrificeAttachmentCost() {
super(); super();

View file

@ -1,18 +1,19 @@
package mage.abilities.costs.common; package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl; import mage.abilities.costs.CostImpl;
import mage.abilities.costs.SacrificeCost;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class SacrificeSourceCost extends CostImpl { public class SacrificeSourceCost extends CostImpl implements SacrificeCost {
public SacrificeSourceCost() { public SacrificeSourceCost() {
this.text = "sacrifice {this}"; this.text = "sacrifice {this}";

View file

@ -4,6 +4,7 @@ import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl; import mage.abilities.costs.CostImpl;
import mage.abilities.costs.SacrificeCost;
import mage.constants.AbilityType; import mage.constants.AbilityType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
@ -19,7 +20,7 @@ import java.util.UUID;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class SacrificeTargetCost extends CostImpl { public class SacrificeTargetCost extends CostImpl implements SacrificeCost {
private final List<Permanent> permanents = new ArrayList<>(); private final List<Permanent> permanents = new ArrayList<>();

View file

@ -2,6 +2,7 @@ package mage.abilities.costs.common;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.SacrificeCost;
import mage.abilities.costs.VariableCostImpl; import mage.abilities.costs.VariableCostImpl;
import mage.abilities.costs.VariableCostType; import mage.abilities.costs.VariableCostType;
import mage.filter.Filter; import mage.filter.Filter;
@ -12,7 +13,7 @@ import mage.target.common.TargetControlledPermanent;
/** /**
* @author LevelX2 * @author LevelX2
*/ */
public class SacrificeXTargetCost extends VariableCostImpl { public class SacrificeXTargetCost extends VariableCostImpl implements SacrificeCost {
protected final FilterControlledPermanent filter; protected final FilterControlledPermanent filter;
private final int minValue; private final int minValue;