forked from External/mage
implement [CLB] Hezrou
This commit is contained in:
parent
94db57e9d4
commit
24687eb4af
6 changed files with 237 additions and 55 deletions
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue