[LTR] Implement Witch-king of Angmar (#10563)

* Add card

* Add TapSourceEffect

* De-duplicate watcher logic

* Abstract and fix(?) logic

* Fix sacrifice targets

* Controller instead of Owner

* Add tests, fix, and refactor

* Throw if controller not supported

* Fix test (not supposed to start tapped)
This commit is contained in:
Bobby McCann 2023-07-06 00:22:21 +01:00 committed by GitHub
parent 008662be5e
commit c8564efbb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 202 additions and 28 deletions

View file

@ -27,7 +27,8 @@ public enum TargetController {
EACH_PLAYER,
ENCHANTED,
SOURCE_TARGETS,
MONARCH;
MONARCH,
SOURCE_CONTROLLER;
private final OwnerPredicate ownerPredicate;
private final PlayerPredicate playerPredicate;
@ -78,6 +79,8 @@ public enum TargetController {
case ENCHANTED:
Permanent permanent = input.getSource().getSourcePermanentIfItStillExists(game);
return permanent != null && input.getObject().isOwnedBy(permanent.getAttachedTo());
case SOURCE_CONTROLLER:
return card.isOwnedBy(input.getSource().getControllerId());
case SOURCE_TARGETS:
return card.isOwnedBy(input.getSource().getFirstTarget());
case MONARCH:
@ -119,8 +122,10 @@ public enum TargetController {
game.getPlayer(playerId).hasOpponent(player.getId(), game);
case NOT_YOU:
return !player.getId().equals(playerId);
case SOURCE_CONTROLLER:
return player.getId().equals(input.getSource().getControllerId());
case SOURCE_TARGETS:
return player.equals(input.getSource().getFirstTarget());
return player.getId().equals(input.getSource().getFirstTarget());
case MONARCH:
return player.getId().equals(game.getMonarchId());
default:
@ -162,6 +167,8 @@ public enum TargetController {
case ENCHANTED:
Permanent permanent = input.getSource().getSourcePermanentIfItStillExists(game);
return permanent != null && input.getObject().isControlledBy(permanent.getAttachedTo());
case SOURCE_CONTROLLER:
return object.isControlledBy(input.getSource().getControllerId());
case SOURCE_TARGETS:
return object.isControlledBy(input.getSource().getFirstTarget());
case MONARCH: