mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Removed CardUtil.copyTo for permanents. Refactored 2 cards.
This commit is contained in:
parent
8f6741a612
commit
f1f2d7640f
3 changed files with 30 additions and 19 deletions
|
@ -35,14 +35,13 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.util.CardUtil;
|
import mage.util.functions.ApplyToPermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -63,6 +62,8 @@ public class Cryptoplasm extends CardImpl<Cryptoplasm> {
|
||||||
this.color.setBlue(true);
|
this.color.setBlue(true);
|
||||||
this.power = new MageInt(2);
|
this.power = new MageInt(2);
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
|
||||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmTransformEffect(), Constants.TargetController.YOU, true);
|
Ability ability = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmTransformEffect(), Constants.TargetController.YOU, true);
|
||||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
@ -91,18 +92,31 @@ class CryptoplasmTransformEffect extends ContinuousEffectImpl<CryptoplasmTransfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, final Ability source) {
|
||||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
|
||||||
if (card == null || permanent == null)
|
if (creature == null || permanent == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
/*
|
||||||
CardUtil.copyTo(permanent).from(card, game);
|
CardUtil.copyTo(permanent).from(card, game);
|
||||||
|
|
||||||
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmTransformEffect(), Constants.TargetController.YOU, true);
|
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmTransformEffect(), Constants.TargetController.YOU, true);
|
||||||
upkeepAbility.addTarget(new TargetCreaturePermanent());
|
upkeepAbility.addTarget(new TargetCreaturePermanent());
|
||||||
permanent.addAbility(upkeepAbility, game);
|
permanent.addAbility(upkeepAbility, game);
|
||||||
|
*/
|
||||||
|
game.copyPermanent(creature, permanent, source, new ApplyToPermanent() {
|
||||||
|
@Override
|
||||||
|
public Boolean apply(Game game, Permanent permanent) {
|
||||||
|
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmTransformEffect(), Constants.TargetController.YOU, true);
|
||||||
|
upkeepAbility.addTarget(new TargetCreaturePermanent());
|
||||||
|
permanent.addAbility(upkeepAbility, source.getSourceId(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,27 +27,21 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.riseoftheeldrazi;
|
package mage.sets.riseoftheeldrazi;
|
||||||
|
|
||||||
import java.util.UUID;
|
import mage.Constants.*;
|
||||||
import mage.Constants.CardType;
|
|
||||||
import mage.Constants.Duration;
|
|
||||||
import mage.Constants.Layer;
|
|
||||||
import mage.Constants.Outcome;
|
|
||||||
import mage.Constants.Rarity;
|
|
||||||
import mage.Constants.SubLayer;
|
|
||||||
import mage.Constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.CardUtil;
|
import mage.util.functions.EmptyApplyToPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -128,14 +122,15 @@ class RenegadeDoppelgangerEffect extends ContinuousEffectImpl<RenegadeDoppelgang
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
|
||||||
if (card == null || permanent == null) {
|
if (creature == null || permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardUtil.copyTo(permanent).from(card, game);
|
//CardUtil.copyTo(permanent).from(card, game);
|
||||||
|
game.copyPermanent(creature, permanent, source, new EmptyApplyToPermanent());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,9 @@ public class CardUtil {
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target
|
||||||
*/
|
*/
|
||||||
public static CopyFunction copyTo(Card target) {
|
@Deprecated
|
||||||
|
//public static CopyFunction copyTo(Card target) {
|
||||||
|
private static CopyFunction copyTo(Card target) {
|
||||||
return new CopyFunction(target);
|
return new CopyFunction(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue