implement [LCC] Xavier Sal, Infested Captain

adjustments/docs in RemoveCounterCost
This commit is contained in:
xenohedron 2023-11-25 01:49:19 -05:00
parent e113f42427
commit 47197f7c39
3 changed files with 68 additions and 5 deletions

View file

@ -0,0 +1,56 @@
package mage.cards.x;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.RemoveCounterCost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PopulateEffect;
import mage.abilities.effects.common.counter.ProliferateEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author xenohedron
*/
public final class XavierSalInfestedCaptain extends CardImpl {
public XavierSalInfestedCaptain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{G}{U}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.FUNGUS);
this.subtype.add(SubType.PIRATE);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// {T}, Remove a counter from another permanent you control: Populate. Activate only as a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(new PopulateEffect(), new TapSourceCost());
ability.addCost(new RemoveCounterCost(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_PERMANENT)));
this.addAbility(ability);
// {T}, Sacrifice another creature: Proliferate. Activate only as a sorcery.
Ability ability2 = new ActivateAsSorceryActivatedAbility(new ProliferateEffect(), new TapSourceCost());
ability2.addCost(new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE));
this.addAbility(ability2);
}
private XavierSalInfestedCaptain(final XavierSalInfestedCaptain card) {
super(card);
}
@Override
public XavierSalInfestedCaptain copy() {
return new XavierSalInfestedCaptain(this);
}
}

View file

@ -293,6 +293,7 @@ public final class LostCavernsOfIxalanCommander extends ExpansionSet {
cards.add(new SetCardInfo("Windfall", 180, Rarity.UNCOMMON, mage.cards.w.Windfall.class));
cards.add(new SetCardInfo("Worn Powerstone", 120, Rarity.UNCOMMON, mage.cards.w.WornPowerstone.class));
cards.add(new SetCardInfo("Wrathful Raptors", 88, Rarity.RARE, mage.cards.w.WrathfulRaptors.class));
cards.add(new SetCardInfo("Xavier Sal, Infested Captain", 14, Rarity.RARE, mage.cards.x.XavierSalInfestedCaptain.class));
cards.add(new SetCardInfo("Xenagos, God of Revels", 295, Rarity.MYTHIC, mage.cards.x.XenagosGodOfRevels.class));
cards.add(new SetCardInfo("Xolatoyac, the Smiling Flood", 8, Rarity.MYTHIC, mage.cards.x.XolatoyacTheSmilingFlood.class));
cards.add(new SetCardInfo("Yahenni, Undying Partisan", 214, Rarity.RARE, mage.cards.y.YahenniUndyingPartisan.class));

View file

@ -10,15 +10,12 @@ import mage.constants.Outcome;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetCard;
import mage.target.TargetObject;
import mage.target.TargetPermanent;
import mage.util.CardUtil;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
@ -32,16 +29,25 @@ public class RemoveCounterCost extends CostImpl {
private final CounterType counterTypeToRemove;
protected final int countersToRemove;
/**
* Remove one counter of any type from the target
*/
public RemoveCounterCost(Target target) {
this(target, null);
}
/**
* Remove one counter of the specified type from the target
*/
public RemoveCounterCost(Target target, CounterType counterTypeToRemove) {
this(target, counterTypeToRemove, 1);
}
/**
* Remove a number of counters of the specified type from the target
*/
public RemoveCounterCost(Target target, CounterType counterTypeToRemove, int countersToRemove) {
this.target = target;
this.target = target.withNotTarget(true); // cost is never targeted
this.counterTypeToRemove = counterTypeToRemove;
this.countersToRemove = countersToRemove;
@ -76,7 +82,7 @@ public class RemoveCounterCost extends CostImpl {
} else if (target instanceof TargetCard) { // For Mari, the Killing Quill
outcome = Outcome.Neutral;
} else {
throw new RuntimeException(
throw new IllegalArgumentException(
"Wrong target type provided for RemoveCounterCost. Provided " + target.getClass() + ". " +
"From ability " + ability);
}