mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Lazav, Dimir Mastermind - Fixed a problem that was caused when the owner of the copied card left the game.
This commit is contained in:
parent
97e1ebc569
commit
2974771cb5
1 changed files with 16 additions and 13 deletions
|
@ -28,7 +28,6 @@
|
||||||
package mage.cards.l;
|
package mage.cards.l;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||||
|
@ -85,7 +84,6 @@ public class LazavDimirMastermind extends CardImpl {
|
||||||
|
|
||||||
class LazavDimirEffect extends ContinuousEffectImpl {
|
class LazavDimirEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
protected UUID IdOfCopiedCard;
|
|
||||||
protected Card cardToCopy;
|
protected Card cardToCopy;
|
||||||
|
|
||||||
public LazavDimirEffect() {
|
public LazavDimirEffect() {
|
||||||
|
@ -96,7 +94,6 @@ class LazavDimirEffect extends ContinuousEffectImpl {
|
||||||
public LazavDimirEffect(final LazavDimirEffect effect) {
|
public LazavDimirEffect(final LazavDimirEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.cardToCopy = effect.cardToCopy;
|
this.cardToCopy = effect.cardToCopy;
|
||||||
this.IdOfCopiedCard = effect.IdOfCopiedCard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,17 +102,23 @@ class LazavDimirEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void init(Ability source, Game game) {
|
||||||
|
super.init(source, game);
|
||||||
Card card = game.getCard(((FixedTarget) getTargetPointer()).getTarget());
|
Card card = game.getCard(((FixedTarget) getTargetPointer()).getTarget());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
if (card != null) {
|
||||||
if (card == null || permanent == null) {
|
|
||||||
discard();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (IdOfCopiedCard == null || !IdOfCopiedCard.equals(card.getId())) {
|
|
||||||
IdOfCopiedCard = card.getId();
|
|
||||||
cardToCopy = card.copy();
|
cardToCopy = card.copy();
|
||||||
cardToCopy.assignNewId();
|
cardToCopy.assignNewId();
|
||||||
|
} else {
|
||||||
|
discard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (permanent == null) {
|
||||||
|
discard();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
permanent.getPower().setValue(cardToCopy.getPower().getValue());
|
permanent.getPower().setValue(cardToCopy.getPower().getValue());
|
||||||
permanent.getToughness().setValue(cardToCopy.getToughness().getValue());
|
permanent.getToughness().setValue(cardToCopy.getToughness().getValue());
|
||||||
|
|
Loading…
Reference in a new issue