[filters] Replaced conditions in StackObject filters with Predicates

This commit is contained in:
North 2012-07-17 18:58:18 +03:00
parent 8598f9ead1
commit b7f57c8a23
9 changed files with 63 additions and 167 deletions

View file

@ -86,18 +86,15 @@ public class CantCounterControlledEffect extends ReplacementEffectImpl<CantCount
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.COUNTER) {
filterTarget.getControllerId().clear();
filterTarget.getControllerId().add(source.getControllerId());
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null) {
if (filterTarget.match(spell, game)) {
if (filterSource == null)
if (spell != null && spell.getControllerId().equals(source.getControllerId())
&& filterTarget.match(spell, game)) {
if (filterSource == null)
return true;
else {
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && filterSource.match(sourceObject, game)) {
return true;
else {
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && filterSource.match(sourceObject, game)) {
return true;
}
}
}
}