* Commander storm abilities - fixed rollback error on card usage in non commander games;

This commit is contained in:
Oleg Agafonov 2021-09-04 17:15:51 +04:00
parent 18cca57b44
commit 84ea133ec5
9 changed files with 12 additions and 13 deletions

View file

@ -44,8 +44,8 @@ public abstract class GameCommanderImpl extends GameImpl {
protected void init(UUID choosingPlayerId) {
// Karn Liberated calls it to restart game, all data and commanders must be re-initialized
// plays watcher
state.addWatcher(new CommanderPlaysCountWatcher());
// add game mode specific watchers here
//state.addWatcher(new CommanderPlaysCountWatcher());
// move commanders to command zone
for (UUID playerId : state.getPlayerList(startingPlayerId)) {

View file

@ -161,6 +161,7 @@ public abstract class GameImpl implements Game {
this.startingLife = startingLife;
this.executingRollback = false;
this.startingHandSize = startingHandSize;
initGameDefaultWatchers();
}
@ -1266,6 +1267,7 @@ public abstract class GameImpl implements Game {
newWatchers.add(new CardsDrawnThisTurnWatcher());
newWatchers.add(new ManaSpentToCastWatcher());
newWatchers.add(new ManaPaidSourceWatcher());
newWatchers.add(new CommanderPlaysCountWatcher()); // commander plays count uses in non commander games by some cards
// runtime check - allows only GAME scope (one watcher per game)
newWatchers.forEach(watcher -> {

View file

@ -44,8 +44,8 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
@Override
protected void init(UUID choosingPlayerId) {
// plays watcher
state.addWatcher(new CommanderPlaysCountWatcher());
// add game mode specific watchers here
//state.addWatcher(new CommanderPlaysCountWatcher());
// move tiny leader to command zone
for (UUID playerId : state.getPlayerList(startingPlayerId)) {

View file

@ -12,11 +12,10 @@ import mage.watchers.Watcher;
import java.util.*;
/**
* Default game watcher, no need to add it with abilities
* <p>
* Calcs commanders play count only from command zone (spell or land)
* Cards like Remand can put command to hand and cast it without commander tax increase
* <p>
* Warning, if your code can be called in non commander games then you must watcher in your ability
* (example: you are using watcher in trigger, hint or effect, but do not checking another things like commander source or cost)
*
* @author JayDi85
*/