[JOU] Added 9 cards. Fixed some bugs of JOU cards.

This commit is contained in:
LevelX2 2014-04-16 17:38:41 +02:00
parent fc56b8bc88
commit 959d55fef2
15 changed files with 713 additions and 16 deletions

View file

@ -45,7 +45,7 @@ import mage.target.common.TargetCardInHand;
*/
public class DiscardTargetCost extends CostImpl<DiscardTargetCost> {
List<Card> cards = new ArrayList<Card>();
List<Card> cards = new ArrayList<>();
protected boolean randomDiscard;
public DiscardTargetCost(TargetCardInHand target) {

View file

@ -96,8 +96,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl<ExchangeCo
for (UUID permanentId : targetPointer.getTargets(game, source)) {
if (permanent1 == null) {
permanent1 = game.getPermanent(permanentId);
}
if (permanent2 == null) {
} else if (permanent2 == null) {
permanent2 = game.getPermanent(permanentId);
}
}

View file

@ -38,6 +38,7 @@ import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
@ -96,15 +97,26 @@ public class GainControlTargetEffect extends ContinuousEffectImpl<GainControlTar
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
if (controllingPlayerId != null) {
return permanent.changeControllerId(controllingPlayerId, game);
} else {
return permanent.changeControllerId(source.getControllerId(), game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
boolean targetStillExists = false;
for (UUID permanentId: this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null) {
targetStillExists = true;
if (controllingPlayerId != null) {
permanent.changeControllerId(controllingPlayerId, game);
} else {
permanent.changeControllerId(source.getControllerId(), game);
}
}
}
}
this.discard();
if (!targetStillExists) {
// no valid target exists, effect can be discarded
this.discard();
}
return true;
}
return false;
}