mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
[NEO] Implemented Kumano Faces Kakkazan / Etching of Kumano (#8674)
* [NEO] Implemented Kumano Faces Kakkazan / Etching of Kumano * [NEO] Etching of Kumano - Clean up watcher controller check Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
parent
cff38b74b9
commit
0694fd3ef7
4 changed files with 311 additions and 0 deletions
|
|
@ -0,0 +1,45 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public class DamagedByControlledWatcher extends Watcher {
|
||||
|
||||
private final HashSet<MageObjectReference> damagedPermanents = new HashSet<>();
|
||||
|
||||
public DamagedByControlledWatcher() {
|
||||
super(WatcherScope.PLAYER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_PERMANENT) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
if (controllerId != null && controllerId.equals(game.getControllerId(event.getSourceId()))) {
|
||||
damagedPermanents.add(new MageObjectReference(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
damagedPermanents.clear();
|
||||
}
|
||||
|
||||
public boolean wasDamaged(Permanent permanent, Game game) {
|
||||
return damagedPermanents.contains(new MageObjectReference(permanent, game));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue