implement [CLB] Hezrou

This commit is contained in:
xenohedron 2024-12-08 20:25:51 -05:00
parent 94db57e9d4
commit 24687eb4af
6 changed files with 237 additions and 55 deletions

View file

@ -0,0 +1,26 @@
package mage.filter.predicate.permanent;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.BlockedThisTurnWatcher;
/**
* Requires BlockedThisTurnWatcher to be added to the card
*
* @author xenohedron
*/
public enum BlockedThisTurnPredicate implements Predicate<Permanent> {
instance;
@Override
public boolean apply(Permanent input, Game game) {
BlockedThisTurnWatcher watcher = game.getState().getWatcher(BlockedThisTurnWatcher.class);
return watcher != null && watcher.checkIfBlocked(input, game);
}
@Override
public String toString() {
return "blocked this turn";
}
}

View file

@ -1,4 +1,3 @@
package mage.watchers.common;
import mage.MageObjectReference;
@ -34,12 +33,7 @@ public class BlockedThisTurnWatcher extends Watcher {
}
public boolean checkIfBlocked(Permanent permanent, Game game) {
for (MageObjectReference mor : blockedThisTurnCreatures) {
if (mor.refersTo(permanent, game)) {
return true;
}
}
return false;
return blockedThisTurnCreatures.stream().anyMatch(mor -> mor.refersTo(permanent, game));
}
@Override