* Geode Golem - fixed duplicated commander tax on damage trigger (#7593);

This commit is contained in:
Oleg Agafonov 2021-02-22 16:11:13 +04:00
parent 650acf9e1e
commit f6c0f4c712
4 changed files with 230 additions and 84 deletions

View file

@ -1,52 +0,0 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.watchers.common.CommanderPlaysCountWatcher;
/**
* @author JayDi85
*/
public class CommanderPlaysCount implements DynamicValue {
private Integer multiplier;
public CommanderPlaysCount() {
this(1);
}
public CommanderPlaysCount(Integer multiplier) {
this.multiplier = multiplier;
}
public CommanderPlaysCount(final CommanderPlaysCount dynamicValue) {
this.multiplier = dynamicValue.multiplier;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
int value = 0;
if (watcher != null) {
value = watcher.getPlaysCount(sourceAbility.getSourceId());
}
return value * multiplier;
}
@Override
public CommanderPlaysCount copy() {
return new CommanderPlaysCount(this);
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -181,6 +181,14 @@ public interface Card extends MageObject {
return getOwnerId().equals(controllerId);
}
/**
* Commander tax calculation. Can be change from {2} to life life cost (see Liesa, Shroud of Dusk)
*
* @param game
* @param source
* @param abilityToModify
* @return
*/
default boolean commanderCost(Game game, Ability source, Ability abilityToModify) {
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
int castCount = watcher.getPlaysCount(getMainCard().getId());