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

@ -45,7 +45,7 @@ import mage.target.TargetPlayer;
public class SearchWarrant extends CardImpl<SearchWarrant> {
public SearchWarrant(UUID ownerId) {
super(ownerId, 161, "Search Warrant", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{W}{U}");
super(ownerId, 193, "Search Warrant", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{W}{U}");
this.expansionSetCode = "RTR";
this.color.setBlue(true);

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