previous fix wasn't 100% correct.

This commit is contained in:
magenoxx 2011-02-12 23:50:03 +03:00
parent e189543699
commit 27010a2089
3 changed files with 14 additions and 2 deletions

View file

@ -279,7 +279,7 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
targets = threats(opponentId, ((FilterCreatureOrPlayer)t.getFilter()).getCreatureFilter(), game);
}
for (Permanent permanent: targets) {
if (((TargetPermanent)target).canTarget(playerId, permanent.getId(), source, game)) {
if (t.canTarget(playerId, permanent.getId(), source, game)) {
target.addTarget(permanent.getId(), source, game);
return true;
}

View file

@ -1,5 +1,5 @@
#Generated by Maven
#Sat Feb 12 11:24:53 MSK 2011
#Sat Feb 12 23:42:53 MSK 2011
version=0.6
groupId=org.mage
artifactId=Mage-Tournament-BoosterDraft

View file

@ -107,6 +107,18 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
return false;
}
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
if (source != null)
//TODO: check for replacement effects
return permanent.canBeTargetedBy(game.getObject(source.getSourceId())) && filter.match(permanent, controllerId, game);
else
return filter.match(permanent, controllerId, game);
}
return false;
}
/**
* Checks if there are enough {@link Permanent} or {@link Player} that can be chosen. Should only be used
* for Ability targets since this checks for protection, shroud etc.