* Cards drawn this turn - fixed rollback error on some cards usage;

This commit is contained in:
Oleg Agafonov 2020-12-20 14:30:42 +04:00
parent e5faadf1c9
commit a2c046993d
10 changed files with 11 additions and 8 deletions

View file

@ -36,7 +36,7 @@ public final class Eyekite extends CardImpl {
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new BoostSourceEffect(2, 0, Duration.WhileOnBattlefield),
EyekiteCondition.instance, "{this} gets +2/+0 as long as you've drawn two or more cards this turn."
)), new CardsDrawnThisTurnWatcher());
)));
}
private Eyekite(final Eyekite card) {

View file

@ -33,7 +33,6 @@ public final class FistsOfFlame extends CardImpl {
StaticValue.get(0), Duration.EndOfTurn
).setText("and gets +1/+0 for each card you've drawn this turn."));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addWatcher(new CardsDrawnThisTurnWatcher());
}
private FistsOfFlame(final FistsOfFlame card) {

View file

@ -48,7 +48,7 @@ public final class GnarledSage extends CardImpl {
"and has vigilance"
));
this.addAbility(ability, new CardsDrawnThisTurnWatcher());
this.addAbility(ability);
}
private GnarledSage(final GnarledSage card) {

View file

@ -33,7 +33,7 @@ public final class KydeleChosenOfKruphix extends CardImpl {
DynamicManaAbility ability = new DynamicManaAbility(
Mana.ColorlessMana(1), CardsDrawnThisTurnDynamicValue.instance,
new TapSourceCost(), null, false, CardsDrawnThisTurnDynamicValue.instance);
this.addAbility(ability, new CardsDrawnThisTurnWatcher());
this.addAbility(ability);
// Partner
this.addAbility(PartnerAbility.getInstance());

View file

@ -35,7 +35,7 @@ public final class SpinehornMinotaur extends CardImpl {
new GainAbilitySourceEffect(DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield),
SpinehornMinotaurCondition.instance, "As long as you've drawn two or more cards this turn, " +
"{this} has double strike"
)), new CardsDrawnThisTurnWatcher());
)));
}
private SpinehornMinotaur(final SpinehornMinotaur card) {

View file

@ -42,7 +42,7 @@ public final class ThoughtSponge extends CardImpl {
CounterType.P1P1.createInstance(), ThoughtSpongeValue.instance, false
), "with a number of +1/+1 counters on it equal to " +
"the greatest number of cards an opponent has drawn this turn"
), new CardsDrawnThisTurnWatcher());
));
// When Thought Sponge dies, draw cards equal to its power.
this.addAbility(new DiesSourceTriggeredAbility(

View file

@ -35,7 +35,7 @@ public final class ThunderingDjinn extends CardImpl {
CardsDrawnThisTurnDynamicValue.instance
).setText("it deals damage to any target equal to the number of cards you've drawn this turn."), false);
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability, new CardsDrawnThisTurnWatcher());
this.addAbility(ability);
}
private ThunderingDjinn(final ThunderingDjinn card) {

View file

@ -34,7 +34,7 @@ public final class TomeAnima extends CardImpl {
new GainAbilitySourceEffect(new CantBeBlockedSourceAbility(), Duration.WhileOnBattlefield),
TomeAnimaCondition.instance,
"{this} can't be blocked as long as you've drawn two or more cards this turn"
)), new CardsDrawnThisTurnWatcher());
)));
}
private TomeAnima(final TomeAnima card) {

View file

@ -1123,6 +1123,7 @@ public abstract class GameImpl implements Game, Serializable {
getState().addWatcher(new DamageDoneWatcher());
getState().addWatcher(new PlanarRollWatcher());
getState().addWatcher(new PlayersAttackedThisTurnWatcher());
getState().addWatcher(new CardsDrawnThisTurnWatcher());
}
public void initPlayerDefaultWatchers(UUID playerId) {

View file

@ -17,6 +17,9 @@ public class CardsDrawnThisTurnWatcher extends Watcher {
private final Map<UUID, Integer> cardsDrawnThisTurn = new HashMap<>();
/**
* It's a default game watcher, so no need to init it with card code
*/
public CardsDrawnThisTurnWatcher() {
super(WatcherScope.GAME);
}