mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Remove useless watcher
This commit is contained in:
parent
a1bfe071c8
commit
2f936c7c78
2 changed files with 5 additions and 72 deletions
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -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<MageObjectReference> 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));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue