foul-magics/Mage/src/main/java/mage/abilities/dynamicvalue/common/PermanentsSacrificedThisTurnCount.java
Susucre 496faaf5cb
[LTR] Implement The Balrog, Durin's Bane (#10515)
* [LTR] Implement The Balrog, Durin's Bane

I could use someone more experienced for this card:
Should the watcher `PermanentsSacrificedWatcher` be initialized locally in the card's class, or is a global initializing in GameImpl.java alright? I went for the latter for now, as my base for implementing the static cost reduction was Blood for the Blood God!

* apply review

* no longer instantiate watcher on every game.
2023-07-01 12:53:31 -04:00

40 lines
997 B
Java

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.PermanentsSacrificedWatcher;
/**
* @author Susucr
*/
public enum PermanentsSacrificedThisTurnCount implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
PermanentsSacrificedWatcher watcher = game.getState().getWatcher(PermanentsSacrificedWatcher.class);
if (watcher != null) {
return watcher.getThisTurnSacrificedPermanents();
}
return 0;
}
@Override
public PermanentsSacrificedThisTurnCount copy() {
return PermanentsSacrificedThisTurnCount.instance;
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "permanents sacrificed this turn";
}
}