mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TLA] Implement Obsessive Pursuit
This commit is contained in:
parent
26488bf6e2
commit
04af8e94ab
6 changed files with 106 additions and 49 deletions
|
|
@ -4,6 +4,8 @@ package mage.abilities.dynamicvalue.common;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.PermanentsSacrificedWatcher;
|
||||
|
||||
|
|
@ -11,20 +13,27 @@ import mage.watchers.common.PermanentsSacrificedWatcher;
|
|||
* @author Susucr
|
||||
*/
|
||||
public enum PermanentsSacrificedThisTurnCount implements DynamicValue {
|
||||
instance;
|
||||
ALL(true),
|
||||
YOU(false);
|
||||
private final boolean all;
|
||||
private final Hint hint;
|
||||
|
||||
PermanentsSacrificedThisTurnCount(boolean all) {
|
||||
this.all = all;
|
||||
this.hint = new ValueHint("Permanents " + (all ? "" : "you ") + "sacrificed this turn", this);
|
||||
}
|
||||
|
||||
@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;
|
||||
return this.all
|
||||
? watcher.getThisTurnSacrificedPermanents()
|
||||
: watcher.getThisTurnSacrificedPermanents(sourceAbility.getControllerId()).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermanentsSacrificedThisTurnCount copy() {
|
||||
return PermanentsSacrificedThisTurnCount.instance;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -34,7 +43,10 @@ public enum PermanentsSacrificedThisTurnCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "permanents sacrificed this turn";
|
||||
return "the number of permanents " + (this.all ? "" : "you've ") + "sacrificed this turn";
|
||||
}
|
||||
|
||||
public Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
package mage.abilities.hint.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsSacrificedThisTurnCount;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public enum PermanentsSacrificedThisTurnHint implements Hint {
|
||||
instance;
|
||||
|
||||
private static final Hint hint = new ValueHint(
|
||||
"Permanents sacrificed this turn", PermanentsSacrificedThisTurnCount.instance
|
||||
);
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
return hint.getText(game, ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermanentsSacrificedThisTurnHint copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue