mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Fix missing reset code
This commit is contained in:
parent
090ea444d9
commit
2d3804079f
16 changed files with 78 additions and 74 deletions
|
|
@ -1,20 +1,19 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
*
|
||||
* Amount of damage received by a player this turn
|
||||
* <p>
|
||||
* Amount of damage received by a player this turn
|
||||
*/
|
||||
public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher {
|
||||
|
||||
|
|
@ -48,6 +47,7 @@ public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
amountOfDamageReceivedThisTurn.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*
|
||||
* Counts cards drawn during draw step
|
||||
* <p>
|
||||
* Counts cards drawn during draw step
|
||||
*/
|
||||
|
||||
public class CardsDrawnDuringDrawStepWatcher extends Watcher {
|
||||
|
|
@ -54,6 +52,7 @@ public class CardsDrawnDuringDrawStepWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
amountOfCardsDrawnThisTurn.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
|
|
@ -49,6 +48,7 @@ public class CastSpellLastTurnWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
amountOfSpellsCastOnPrevTurn.clear();
|
||||
amountOfSpellsCastOnPrevTurn.putAll(amountOfSpellsCastOnCurrentTurn);
|
||||
amountOfSpellsCastOnCurrentTurn.clear();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
|
|
@ -6,8 +5,10 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko, BetaSteward_at_googlemail.com (spjspj)
|
||||
|
|
@ -46,6 +47,7 @@ public class CastSpellYourLastTurnWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
if (amountOfSpellsCastOnPrevTurn != null
|
||||
&& lastActivePlayer != null
|
||||
&& amountOfSpellsCastOnPrevTurn.get(lastActivePlayer) != null) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
|
|
@ -7,7 +6,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
|
||||
|
|
@ -28,6 +26,7 @@ public class ChooseBlockersRedundancyWatcher extends Watcher { // workaround for
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
copyCount = 0;
|
||||
copyCountApply = 0;
|
||||
}
|
||||
|
|
@ -44,7 +43,7 @@ public class ChooseBlockersRedundancyWatcher extends Watcher { // workaround for
|
|||
public void increment() {
|
||||
copyCount++;
|
||||
copyCountApply = copyCount;
|
||||
}
|
||||
}
|
||||
|
||||
public void decrement() {
|
||||
if (copyCountApply > 0) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
*
|
||||
* Return the last player that was attacked by specified creature this turn
|
||||
* <p>
|
||||
* Return the last player that was attacked by specified creature this turn
|
||||
*/
|
||||
public class CreatureAttackedWhichPlayerWatcher extends Watcher {
|
||||
|
||||
|
|
@ -48,6 +48,7 @@ public class CreatureAttackedWhichPlayerWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
getPlayerAttackedThisTurnByCreature.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
|
@ -45,6 +45,7 @@ public class CreaturesDiedWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
amountOfCreaturesThatDiedByController.clear();
|
||||
amountOfCreaturesThatDiedByOwner.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -15,8 +10,11 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
||||
|
|
@ -53,7 +51,7 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
|||
if (!revealedOrOnBattlefield) {
|
||||
revealedOrOnBattlefield = game.getBattlefield().countAll(filter, spell.getControllerId(), game) > 0;
|
||||
}
|
||||
if (revealedOrOnBattlefield){
|
||||
if (revealedOrOnBattlefield) {
|
||||
castWithDragonOnTheBattlefield.add(spell.getId());
|
||||
}
|
||||
|
||||
|
|
@ -63,6 +61,7 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
castWithDragonOnTheBattlefield.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @author Loki
|
||||
|
|
@ -48,9 +49,9 @@ public class LandfallWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
playerPlayedLand.clear();
|
||||
landEnteredBattlefield.clear();
|
||||
super.reset();
|
||||
}
|
||||
|
||||
public boolean landPlayed(UUID playerId) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.keyword.MiracleAbility;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -18,6 +12,11 @@ import mage.game.events.GameEvent;
|
|||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Counts amount of cards drawn this turn by players. Asks players about Miracle
|
||||
* ability to be activated if it the first card drawn this turn.
|
||||
|
|
@ -80,6 +79,7 @@ public class MiracleWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
amountOfCardsDrawnThisTurn.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import mage.watchers.Watcher;
|
|||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2 (spjspj)
|
||||
*/
|
||||
public class PermanentsEnteredBattlefieldYourLastTurnWatcher extends Watcher {
|
||||
|
|
@ -62,6 +61,7 @@ public class PermanentsEnteredBattlefieldYourLastTurnWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
if (enteringBattlefieldLastTurn != null
|
||||
&& lastActivePlayer != null
|
||||
&& enteringBattlefieldLastTurn.get(lastActivePlayer) != null) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/*
|
||||
* Counts the number of times the planar die has been rolled per player per turn
|
||||
|
|
@ -40,7 +40,7 @@ public class PlanarRollWatcher extends Watcher {
|
|||
if (amount == null) {
|
||||
amount = 1;
|
||||
} else {
|
||||
amount ++;
|
||||
amount++;
|
||||
}
|
||||
numberTimesPlanarDieRolled.put(playerId, amount);
|
||||
}
|
||||
|
|
@ -53,6 +53,7 @@ public class PlanarRollWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
numberTimesPlanarDieRolled.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
|
|
@ -47,9 +48,9 @@ public class PlayLandWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
playerPlayedLand.clear();
|
||||
landPlayed.clear();
|
||||
super.reset();
|
||||
}
|
||||
|
||||
public boolean landPlayed(UUID playerId) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
|
@ -72,6 +70,7 @@ public class PlayerLostLifeNonCombatWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
amountOfLifeLostLastTurn.clear();
|
||||
amountOfLifeLostLastTurn.putAll(amountOfLifeLostThisTurn);
|
||||
amountOfLifeLostThisTurn.clear();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/*
|
||||
* Counts amount of life lost current or last turn by players.
|
||||
* This watcher is automatically started in gameImpl.init for each game
|
||||
|
|
@ -70,6 +70,7 @@ public class PlayerLostLifeWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
amountOfLifeLostLastTurn.clear();
|
||||
amountOfLifeLostLastTurn.putAll(amountOfLifeLostThisTurn);
|
||||
amountOfLifeLostThisTurn.clear();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
|
@ -13,8 +9,11 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class RevoltWatcher extends Watcher {
|
||||
|
|
@ -49,6 +48,7 @@ public class RevoltWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
revoltActivePlayerIds.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue