This commit is contained in:
BetaSteward 2010-10-06 01:51:53 +00:00
parent 2cf247d68b
commit 5eae8136e4
70 changed files with 1286 additions and 399 deletions

View file

@ -30,15 +30,18 @@ package mage.abilities.effects.common;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.TargetController;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.filter.FilterObject;
import mage.filter.FilterPermanent;
import mage.filter.FilterStackObject;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
/**
*
@ -47,9 +50,9 @@ import mage.game.permanent.Permanent;
public class CantTargetControlledEffect extends ReplacementEffectImpl<CantTargetControlledEffect> {
private FilterPermanent filterTarget;
private FilterObject filterSource;
private FilterStackObject filterSource;
public CantTargetControlledEffect(FilterPermanent filterTarget, FilterObject filterSource, Duration duration) {
public CantTargetControlledEffect(FilterPermanent filterTarget, FilterStackObject filterSource, Duration duration) {
super(duration, Outcome.Benefit);
this.filterTarget = filterTarget;
this.filterSource = filterSource;
@ -83,14 +86,15 @@ public class CantTargetControlledEffect extends ReplacementEffectImpl<CantTarget
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.TARGET) {
filterTarget.getControllerId().clear();
filterTarget.getControllerId().add(source.getControllerId());
filterTarget.setTargetController(TargetController.YOU);
// filterTarget.getControllerId().clear();
// filterTarget.getControllerId().add(source.getControllerId());
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && filterTarget.match(permanent)) {
if (permanent != null && filterTarget.match(permanent, source.getControllerId(), game)) {
if (filterSource == null)
return true;
else {
MageObject sourceObject = game.getObject(source.getSourceId());
StackObject sourceObject = game.getStack().getStackObject(source.getSourceId());
if (sourceObject != null && filterSource.match(sourceObject)) {
return true;
}