From 2f936c7c7896e126573b3d4abe68c8a008e1a452 Mon Sep 17 00:00:00 2001 From: Noah Gleason Date: Sun, 24 Jun 2018 21:55:15 -0400 Subject: [PATCH] Remove useless watcher --- .../src/mage/cards/g/GiantAlbatross.java | 13 ++-- .../watchers/common/DealtDamageToWatcher.java | 64 ------------------- 2 files changed, 5 insertions(+), 72 deletions(-) delete mode 100644 Mage/src/main/java/mage/watchers/common/DealtDamageToWatcher.java diff --git a/Mage.Sets/src/mage/cards/g/GiantAlbatross.java b/Mage.Sets/src/mage/cards/g/GiantAlbatross.java index b9ec60ce36..d2c05f3e8c 100644 --- a/Mage.Sets/src/mage/cards/g/GiantAlbatross.java +++ b/Mage.Sets/src/mage/cards/g/GiantAlbatross.java @@ -1,7 +1,5 @@ package mage.cards.g; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.MageObjectReference; import mage.abilities.Ability; @@ -11,20 +9,19 @@ import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DoIfCostPaid; -import mage.cards.Card; -import mage.constants.Outcome; -import mage.constants.SubType; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.watchers.Watcher; -import mage.watchers.common.DealtDamageToWatcher; -import mage.watchers.common.PlayerDamagedBySourceWatcher; + +import java.util.List; +import java.util.UUID; /** * diff --git a/Mage/src/main/java/mage/watchers/common/DealtDamageToWatcher.java b/Mage/src/main/java/mage/watchers/common/DealtDamageToWatcher.java deleted file mode 100644 index 3862841bb7..0000000000 --- a/Mage/src/main/java/mage/watchers/common/DealtDamageToWatcher.java +++ /dev/null @@ -1,64 +0,0 @@ -package mage.watchers.common; - -import mage.MageObject; -import mage.MageObjectReference; -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; - -public class DealtDamageToWatcher extends Watcher { - - public final Set dealtDamageToSource = new HashSet<>(); - - public DealtDamageToWatcher() { - super(DealtDamageToWatcher.class.getSimpleName(), WatcherScope.CARD); - } - - public DealtDamageToWatcher(final DealtDamageToWatcher watcher) { - super(watcher); - this.dealtDamageToSource.addAll(watcher.dealtDamageToSource); - } - - @Override - public DealtDamageToWatcher copy() { - return new DealtDamageToWatcher(this); - } - - @Override - public void watch(GameEvent event, Game game) { - boolean eventHasAppropriateType = event.getType() == GameEvent.EventType.DAMAGED_CREATURE || - event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER; - if (eventHasAppropriateType && sourceId.equals(event.getTargetId())) { - MageObjectReference mor = new MageObjectReference(event.getSourceId(), game); - dealtDamageToSource.add(mor); - } - } - - @Override - public void reset() { - super.reset(); - dealtDamageToSource.clear(); - } - - public boolean didDamage(UUID sourceId, Game game) { - MageObject mageObject = game.getObject(sourceId); - if (mageObject != null) { - return didDamage(new MageObjectReference(mageObject, game)); - } - return false; - } - - private boolean didDamage(MageObjectReference objectReference) { - return dealtDamageToSource.contains(objectReference); - } - - public boolean didDamage(Permanent permanent, Game game) { - return dealtDamageToSource.contains(new MageObjectReference(permanent, game)); - } -}