[CMR] Implemented Liesa, Shroud of Dusk

This commit is contained in:
Evan Kranzler 2020-11-08 17:45:33 -05:00
parent 7d8baaf345
commit b8feae7f3a
7 changed files with 98 additions and 19 deletions

View file

@ -60,7 +60,7 @@ public class OathbreakerFreeForAll extends GameCommanderImpl {
// basic commmander restrict (oathbreaker may ask to move, signature force to move)
commanderAbility.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, isSignatureSpell, getCommanderTypeName(commander)));
commanderAbility.addEffect(new CommanderCostModification(commander.getId()));
commanderAbility.addEffect(new CommanderCostModification(commander));
// signature spell restrict (spell can be casted on player's commander on battlefield)
if (isSignatureSpell) {

View file

@ -0,0 +1,74 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastAllTriggeredAbility;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.watchers.common.CommanderPlaysCountWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LiesaShroudOfDusk extends CardImpl {
public LiesaShroudOfDusk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Rather than pay {2} for each previous time you've cast this spell from the command zone this game, pay 2 life that many times.
this.addAbility(new SimpleStaticAbility(new InfoEffect(
"Rather than pay {2} for each previous time you've cast this spell " +
"from the command zone this game, pay 2 life that many times."
)));
// Flying
this.addAbility(FlyingAbility.getInstance());
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// Whenever a player casts a spell, they lose 2 life.
this.addAbility(new SpellCastAllTriggeredAbility(
new LoseLifeTargetEffect(2).setText("they lose 2 life"),
StaticFilters.FILTER_SPELL_A, false, SetTargetPointer.PLAYER
));
}
private LiesaShroudOfDusk(final LiesaShroudOfDusk card) {
super(card);
}
@Override
public LiesaShroudOfDusk copy() {
return new LiesaShroudOfDusk(this);
}
@Override
public boolean commanderCost(Game game, Ability source, Ability abilityToModify) {
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
int castCount = watcher.getPlaysCount(getId());
if (castCount > 0) {
abilityToModify.addCost(new PayLifeCost(2 * castCount));
}
return true;
}
}

View file

@ -269,6 +269,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Kydele, Chosen of Kruphix", 524, Rarity.MYTHIC, mage.cards.k.KydeleChosenOfKruphix.class));
cards.add(new SetCardInfo("Laboratory Drudge", 78, Rarity.RARE, mage.cards.l.LaboratoryDrudge.class));
cards.add(new SetCardInfo("Lathiel, the Bounteous Dawn", 285, Rarity.RARE, mage.cards.l.LathielTheBounteousDawn.class));
cards.add(new SetCardInfo("Liesa, Shroud of Dusk", 286, Rarity.RARE, mage.cards.l.LiesaShroudOfDusk.class));
cards.add(new SetCardInfo("Lifecrafter's Gift", 240, Rarity.COMMON, mage.cards.l.LifecraftersGift.class));
cards.add(new SetCardInfo("Lightning-Rig Crew", 190, Rarity.UNCOMMON, mage.cards.l.LightningRigCrew.class));
cards.add(new SetCardInfo("Livio, Oathsworn Sentinel", 31, Rarity.RARE, mage.cards.l.LivioOathswornSentinel.class));

View file

@ -3,14 +3,11 @@ package mage.abilities.effects.common.cost;
import mage.abilities.Ability;
import mage.abilities.common.CastCommanderAbility;
import mage.abilities.common.PlayLandAsCommanderAbility;
import mage.cards.Card;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.util.ManaUtil;
import mage.watchers.common.CommanderPlaysCountWatcher;
import java.util.UUID;
/**
* @author Plopman
@ -25,32 +22,28 @@ import java.util.UUID;
public class CommanderCostModification extends CostModificationEffectImpl {
private final UUID commanderId;
private final Card commander;
public CommanderCostModification(UUID commanderId) {
public CommanderCostModification(Card commander) {
super(Duration.Custom, Outcome.Neutral, CostModificationType.INCREASE_COST);
this.commanderId = commanderId;
this.commander = commander;
}
public CommanderCostModification(final CommanderCostModification effect) {
super(effect);
this.commanderId = effect.commanderId;
this.commander = effect.commander;
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
int castCount = watcher.getPlaysCount(commanderId);
if (castCount > 0) {
abilityToModify.getManaCostsToPay().add(ManaUtil.createManaCost(2 * castCount, false));
}
return true;
return commander.commanderCost(game, source, abilityToModify);
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return commanderId.equals(abilityToModify.getSourceId())
&& (abilityToModify instanceof CastCommanderAbility || abilityToModify instanceof PlayLandAsCommanderAbility);
return commander.getId().equals(abilityToModify.getSourceId())
&& (abilityToModify instanceof CastCommanderAbility
|| abilityToModify instanceof PlayLandAsCommanderAbility);
}
@Override

View file

@ -13,6 +13,8 @@ import mage.filter.FilterMana;
import mage.game.Game;
import mage.game.GameState;
import mage.game.permanent.Permanent;
import mage.util.ManaUtil;
import mage.watchers.common.CommanderPlaysCountWatcher;
import java.util.List;
import java.util.UUID;
@ -180,4 +182,13 @@ public interface Card extends MageObject {
default boolean isOwnedBy(UUID controllerId) {
return getOwnerId().equals(controllerId);
}
default boolean commanderCost(Game game, Ability source, Ability abilityToModify) {
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
int castCount = watcher.getPlaysCount(getId());
if (castCount > 0) {
abilityToModify.getManaCostsToPay().add(ManaUtil.createManaCost(2 * castCount, false));
}
return true;
}
}

View file

@ -103,7 +103,7 @@ public abstract class GameCommanderImpl extends GameImpl {
public void initCommanderEffects(Card commander, Player player, Ability commanderAbility) {
// all commander effects must be independent from sourceId or controllerId
commanderAbility.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, false, "Commander"));
commanderAbility.addEffect(new CommanderCostModification(commander.getId()));
commanderAbility.addEffect(new CommanderCostModification(commander));
}
//20130711

View file

@ -59,7 +59,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
commander.moveToZone(Zone.COMMAND, null, this, true);
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Commander effects"));
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, false, "Commander"));
ability.addEffect(new CommanderCostModification(commander.getId()));
ability.addEffect(new CommanderCostModification(commander));
// Commander rule #4 was removed Jan. 18, 2016
// ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
CommanderInfoWatcher watcher = new CommanderInfoWatcher("Commander", commander.getId(), false);