* GUI: added card icon for announced X value (card cast);

This commit is contained in:
Oleg Agafonov 2021-07-19 13:40:21 +04:00
parent fc0ff6c22d
commit 76082e1d7a
9 changed files with 353 additions and 12 deletions

View file

@ -7,7 +7,9 @@ import mage.game.Game;
import mage.watchers.common.ManaSpentToCastWatcher;
public enum ManacostVariableValue implements DynamicValue {
REGULAR, ETB;
REGULAR, // if you need X on cast/activate (in stack)
ETB; // if you need X after ETB (in battlefield)
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
@ -15,7 +17,10 @@ public enum ManacostVariableValue implements DynamicValue {
return sourceAbility.getManaCostsToPay().getX();
}
ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class);
return watcher != null ? watcher.getAndResetLastXValue(sourceAbility.getSourceId()) : sourceAbility.getManaCostsToPay().getX();
if (watcher != null) {
return watcher.getAndResetLastXValue(sourceAbility);
}
return 0;
}
@Override