mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
[JOU] Added 9 cards. Fixed some bugs of JOU cards.
This commit is contained in:
parent
fc56b8bc88
commit
959d55fef2
15 changed files with 713 additions and 16 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue