mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* Fixed a problem that watcher added from cards are not reset between games of a match (fixes #3228).
This commit is contained in:
parent
c0f02259ec
commit
09e4435a89
4 changed files with 15 additions and 22 deletions
|
|
@ -34,14 +34,12 @@ import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.common.MorbidCondition;
|
import mage.abilities.condition.common.MorbidCondition;
|
||||||
import mage.abilities.costs.AdjustingSourceCosts;
|
import mage.abilities.costs.AdjustingSourceCosts;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
|
||||||
import mage.abilities.keyword.DeathtouchAbility;
|
import mage.abilities.keyword.DeathtouchAbility;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
|
||||||
import mage.filter.common.FilterLandPermanent;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
import mage.watchers.common.MorbidWatcher;
|
import mage.watchers.common.MorbidWatcher;
|
||||||
|
|
|
||||||
|
|
@ -981,6 +981,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getState().setChoosingPlayerId(null);
|
getState().setChoosingPlayerId(null);
|
||||||
|
state.getWatchers().reset(); // watcher objects from cards are reused during match so reset all card watchers already added
|
||||||
Watchers watchers = state.getWatchers();
|
Watchers watchers = state.getWatchers();
|
||||||
// add default watchers
|
// add default watchers
|
||||||
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.*;
|
import mage.abilities.*;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
|
@ -58,9 +60,6 @@ import mage.util.ThreadLocalStringBuilder;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
import mage.watchers.Watchers;
|
import mage.watchers.Watchers;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,12 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.watchers.common;
|
package mage.watchers.common;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.WatcherScope;
|
import mage.constants.WatcherScope;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -56,13 +52,12 @@ public class MorbidWatcher extends Watcher {
|
||||||
if (condition) {
|
if (condition) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
|
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||||
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
&& ((ZoneChangeEvent) event).isDiesEvent()
|
||||||
if (p != null && p.isCreature()) {
|
&& ((ZoneChangeEvent) event).getTarget().isCreature()) {
|
||||||
condition = true;
|
condition = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MorbidWatcher copy() {
|
public MorbidWatcher copy() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue