forked from External/mage
[filters] Replaced TargetController condition with Predicate
This commit is contained in:
parent
021e2b59df
commit
4563e518a6
76 changed files with 235 additions and 191 deletions
|
|
@ -35,6 +35,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
|
|
@ -87,7 +88,7 @@ public class CantTargetControlledEffect extends ReplacementEffectImpl<CantTarget
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.TARGET) {
|
||||
filterTarget.setTargetController(TargetController.YOU);
|
||||
filterTarget.add(new ControllerPredicate(TargetController.YOU));
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && filterTarget.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
||||
if (filterSource == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue