mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
[CMR] Implemented Liesa, Shroud of Dusk
This commit is contained in:
parent
7d8baaf345
commit
b8feae7f3a
7 changed files with 98 additions and 19 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue