forked from External/mage
[WHO] Time Reaper, Add target adjuster for "that player controls/owns" damage trigger targets (#12528)
* Implement Time Reaper, start rework * Create DamagedPlayerControlsTargetAdjuster, convert Aberrant to use it * Always add targets for EachOpponentPermanentTargetsAdjuster * Improve target name, finish Time Reaper * Convert some cards * Improve documentation, more cards * More cards, fix cards that needed to use owner instead of controller * Fix unfinished AlelaCunningConqueror changes * more cards * All remaining cards * Fix target type * Remove outdated attempt at TargetController.SOURCE_EFFECT_TARGET_POINTER * Finish removal of SOURCE_EFFECT_TARGET_POINTER * Change targetAdjuster blueprint target to be set inside setTargetAdjuster, add error checking * Always add Target Adjuster after Target * Add comment * Fix TolarianContemptTest to skip opponent with no valid targets * Forgot to git add the new abstract GenericTargetAdjuster * Test now possible after merge, fix missed ChangeOfPlans adjuster order * Text and optional-ness fixes * Always set target pointer
This commit is contained in:
parent
bccf323c0f
commit
7cb669603f
172 changed files with 891 additions and 2219 deletions
|
|
@ -26,7 +26,11 @@ import mage.counters.Counter;
|
|||
import mage.filter.Filter;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.card.OwnerIdPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.CardState;
|
||||
import mage.game.Game;
|
||||
import mage.game.GameState;
|
||||
|
|
@ -2079,6 +2083,15 @@ public final class CardUtil {
|
|||
return stream.filter(clazz::isInstance).map(clazz::cast).filter(Objects::nonNull);
|
||||
}
|
||||
|
||||
public static void AssertNoControllerOwnerPredicates(Target target) {
|
||||
List<Predicate> list = new ArrayList<>();
|
||||
Predicates.collectAllComponents(target.getFilter().getPredicates(), target.getFilter().getExtraPredicates(), list);
|
||||
if (list.stream().anyMatch(p -> p instanceof TargetController.ControllerPredicate || p instanceof TargetController.OwnerPredicate
|
||||
|| p instanceof OwnerIdPredicate || p instanceof ControllerIdPredicate)) {
|
||||
throw new IllegalArgumentException("Wrong code usage: target adjuster will add controller/owner predicate, but target's filter already has one - " + target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move card or permanent to dest zone and add counter to it
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue