* 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

@ -40,7 +40,7 @@ public final class CaptainVargusWrath extends CardImpl {
Duration.EndOfTurn, filter, false, true
), false, "Whenever {this} attacks, Pirates you control get +1/+1 until end of turn " +
"for each time you've cast a commander from the command zone this game."
).addHint(CaptainVargusWrathValue.getHint()), new CommanderPlaysCountWatcher());
).addHint(CaptainVargusWrathValue.getHint()));
}
private CaptainVargusWrath(final CaptainVargusWrath card) {

View file

@ -25,7 +25,6 @@ public final class CommandersInsight extends CardImpl {
// Target player draws X cards plus an additional card for each time they've cast a commander from the command zone this game.
this.getSpellAbility().addEffect(new CommandersInsightEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addWatcher(new CommanderPlaysCountWatcher());
}
private CommandersInsight(final CommandersInsight card) {

View file

@ -27,8 +27,7 @@ public final class CommandersInsignia extends CardImpl {
// Creatures you control get +1/+1 for each time you've cast your commander from the command zone this game.
this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(
CommandersInsigniaValue.instance, CommandersInsigniaValue.instance, Duration.WhileOnBattlefield
).setText("Creatures you control get +1/+1 for each time you've cast your commander from the command zone this game.")),
new CommanderPlaysCountWatcher());
).setText("Creatures you control get +1/+1 for each time you've cast your commander from the command zone this game.")));
}
private CommandersInsignia(final CommandersInsignia card) {

View file

@ -44,7 +44,7 @@ public final class JeskaThriceReborn extends CardImpl {
CounterType.LOYALTY.createInstance(0), JeskaThriceRebornValue.instance, false
), "with a loyalty counter on her for each time " +
"you've cast a commander from the command zone this game"
).addHint(JeskaThriceRebornValue.getHint()), new CommanderPlaysCountWatcher());
).addHint(JeskaThriceRebornValue.getHint()));
// +0: Choose target creature. Until your next turn, if that creature would deal combat damage to one of your opponents, it deals triple that damage to that player instead.
Ability ability = new LoyaltyAbility(new JeskaThriceRebornEffect(), 0);

View file

@ -38,7 +38,7 @@ public final class MythUnbound extends CardImpl {
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new MythUnboundCostReductionEffect()
), new CommanderPlaysCountWatcher());
));
// Whenever your commander is put into the command zone from anywhere, draw a card.
this.addAbility(new ZoneChangeAllTriggeredAbility(

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
*/