[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

@ -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