Fixed card number of Search Warrant and fixed NPE of ExchangeControlTargetEffect (still some issues left)

This commit is contained in:
LevelX2 2012-10-01 08:25:46 +02:00
parent 7cdacbc926
commit 9481e44ae2
2 changed files with 15 additions and 5 deletions

View file

@ -114,26 +114,36 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl<ExchangeCo
@Override
public boolean apply(Game game, Ability source) {
int countChangeControl = 0;
if (this.lockedControllers != null) {
for (UUID permanentId : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null) {
UUID controllerId = this.lockedControllers.get(permanent.getId());
if (controllerId != null) {
permanent.changeControllerId(controllerId, game);
if(permanent.changeControllerId(controllerId, game)) {
++countChangeControl;
}
}
}
}
if (withSource) {
Permanent permanent = game.getPermanent(source.getSourceId());
UUID controllerId = this.lockedControllers.get(permanent.getId());
if (controllerId != null) {
permanent.changeControllerId(controllerId, game);
if (permanent != null) {
UUID controllerId = this.lockedControllers.get(permanent.getId());
if (controllerId != null) {
if (permanent.changeControllerId(controllerId, game)) {
++countChangeControl;
}
}
}
}
}
if (countChangeControl == 2) {
return true;
}
return false;
}
@Override