* Fixed some problems with creation of tokens of target permanents (fixes #1244).

This commit is contained in:
LevelX2 2015-09-08 18:13:32 +02:00
parent 39cfbec82f
commit e37c9a6472
24 changed files with 383 additions and 130 deletions

View file

@ -40,12 +40,9 @@ import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.EmptyToken;
import mage.game.permanent.token.Token;
import mage.players.Player; import mage.players.Player;
import mage.players.PlayerList; import mage.players.PlayerList;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.util.CardUtil;
/** /**
* *
@ -57,7 +54,6 @@ public class TemptWithReflections extends CardImpl {
super(ownerId, 60, "Tempt with Reflections", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}"); super(ownerId, 60, "Tempt with Reflections", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}");
this.expansionSetCode = "C13"; this.expansionSetCode = "C13";
// Tempting offer - Choose target creature you control. Put a token onto the battlefield that's a copy of that creature. Each opponent may put a token onto the battlefield that's a copy of that creature. For each opponent who does, put a token onto the battlefield that's a copy of that creature. // Tempting offer - Choose target creature you control. Put a token onto the battlefield that's a copy of that creature. Each opponent may put a token onto the battlefield that's a copy of that creature. For each opponent who does, put a token onto the battlefield that's a copy of that creature.
this.getSpellAbility().addEffect(new TemptWithReflectionsEffect()); this.getSpellAbility().addEffect(new TemptWithReflectionsEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
@ -115,7 +111,7 @@ class TemptWithReflectionsEffect extends OneShotEffect {
player = playerList.getNext(game); player = playerList.getNext(game);
} while (!player.getId().equals(game.getActivePlayerId())); } while (!player.getId().equals(game.getActivePlayerId()));
for (UUID playerId: playersSaidYes) { for (UUID playerId : playersSaidYes) {
effect = new PutTokenOntoBattlefieldCopyTargetEffect(playerId); effect = new PutTokenOntoBattlefieldCopyTargetEffect(playerId);
effect.setTargetPointer(getTargetPointer()); effect.setTargetPointer(getTargetPointer());
effect.apply(game, source); effect.apply(game, source);

View file

@ -53,7 +53,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.EmptyToken; import mage.game.permanent.token.EmptyToken;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.util.functions.ApplyToPermanent; import mage.util.functions.AbilityApplier;
/** /**
* *
@ -61,6 +61,12 @@ import mage.util.functions.ApplyToPermanent;
*/ */
public class ProgenitorMimic extends CardImpl { public class ProgenitorMimic extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("no Token");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
public ProgenitorMimic(UUID ownerId) { public ProgenitorMimic(UUID ownerId) {
super(ownerId, 92, "Progenitor Mimic", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{G}{U}"); super(ownerId, 92, "Progenitor Mimic", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{G}{U}");
this.expansionSetCode = "DGM"; this.expansionSetCode = "DGM";
@ -72,9 +78,15 @@ public class ProgenitorMimic extends CardImpl {
// You may have Progenitor Mimic enter the battlefield as a copy of any creature on the battlefield // You may have Progenitor Mimic enter the battlefield as a copy of any creature on the battlefield
// except it gains "At the beginning of your upkeep, if this creature isn't a token, // except it gains "At the beginning of your upkeep, if this creature isn't a token,
// put a token onto the battlefield that's a copy of this creature." // put a token onto the battlefield that's a copy of this creature."
AbilityApplier applier = new AbilityApplier(
new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new ProgenitorMimicCopyEffect(), TargetController.YOU, false),
new SourceMatchesFilterCondition(filter),
"At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature.")
);
this.addAbility(new SimpleStaticAbility( this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, Zone.BATTLEFIELD,
new EntersBattlefieldEffect(new CopyPermanentEffect(new ProgenitorMimicApplyToPermanent()), new EntersBattlefieldEffect(new CopyPermanentEffect(applier),
"You may have {this} enter the battlefield as a copy of any creature on the battlefield except it gains \"At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature.\"", "You may have {this} enter the battlefield as a copy of any creature on the battlefield except it gains \"At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature.\"",
true))); true)));
} }
@ -89,24 +101,6 @@ public class ProgenitorMimic extends CardImpl {
} }
} }
class ProgenitorMimicApplyToPermanent extends ApplyToPermanent {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("no Token");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
@Override
public Boolean apply(Game game, Permanent permanent) {
Ability ability = new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new ProgenitorMimicCopyEffect(), TargetController.YOU, false),
new SourceMatchesFilterCondition(filter),
"At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature.");
permanent.addAbility(ability, game);
return true;
}
}
class ProgenitorMimicCopyEffect extends OneShotEffect { class ProgenitorMimicCopyEffect extends OneShotEffect {
public ProgenitorMimicCopyEffect() { public ProgenitorMimicCopyEffect() {

View file

@ -28,10 +28,8 @@
package mage.sets.innistrad; package mage.sets.innistrad;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -41,6 +39,9 @@ import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.ObjectSourcePlayer; import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate; import mage.filter.predicate.ObjectSourcePlayerPredicate;
@ -55,8 +56,6 @@ import mage.util.functions.ApplyToPermanent;
*/ */
public class EvilTwin extends CardImpl { public class EvilTwin extends CardImpl {
public EvilTwin(UUID ownerId) { public EvilTwin(UUID ownerId) {
super(ownerId, 212, "Evil Twin", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}{B}"); super(ownerId, 212, "Evil Twin", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}{B}");
this.expansionSetCode = "ISD"; this.expansionSetCode = "ISD";
@ -99,6 +98,16 @@ class EvilTwinApplyToPermanent extends ApplyToPermanent {
permanent.addAbility(ability, game); permanent.addAbility(ability, game);
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{U}{B}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter));
mageObject.getAbilities().add(ability);
return true;
}
} }
class EvilTwinPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> { class EvilTwinPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {

View file

@ -28,7 +28,7 @@
package mage.sets.limitedalpha; package mage.sets.limitedalpha;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.EntersBattlefieldEffect;
@ -50,7 +50,7 @@ import mage.util.functions.ApplyToPermanent;
/** /**
* *
* @author KholdFuzion * @author KholdFuzion
*
*/ */
public class CopyArtifact extends CardImpl { public class CopyArtifact extends CardImpl {
@ -58,7 +58,6 @@ public class CopyArtifact extends CardImpl {
super(ownerId, 54, "Copy Artifact", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); super(ownerId, 54, "Copy Artifact", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.expansionSetCode = "LEA"; this.expansionSetCode = "LEA";
// You may have Copy Artifact enter the battlefield as a copy of any artifact on the battlefield, except it's an enchantment in addition to its other types. // You may have Copy Artifact enter the battlefield as a copy of any artifact on the battlefield, except it's an enchantment in addition to its other types.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect( Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
new CopyArtifactEffect(), new CopyArtifactEffect(),
@ -79,6 +78,25 @@ public class CopyArtifact extends CardImpl {
class CopyArtifactEffect extends OneShotEffect { class CopyArtifactEffect extends OneShotEffect {
ApplyToPermanent applier = new ApplyToPermanent() {
@Override
public Boolean apply(Game game, Permanent permanent) {
if (!permanent.getCardType().contains(CardType.ENCHANTMENT)) {
permanent.getCardType().add(CardType.ENCHANTMENT);
}
return true;
}
@Override
public Boolean apply(Game game, MageObject mageObject) {
if (!mageObject.getCardType().contains(CardType.ENCHANTMENT)) {
mageObject.getCardType().add(CardType.ENCHANTMENT);
}
return true;
}
};
private static final FilterPermanent filter = new FilterPermanent("artifact"); private static final FilterPermanent filter = new FilterPermanent("artifact");
static { static {
@ -104,16 +122,7 @@ class CopyArtifactEffect extends OneShotEffect {
player.choose(Outcome.Copy, target, source.getSourceId(), game); player.choose(Outcome.Copy, target, source.getSourceId(), game);
Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget()); Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget());
if (copyFromPermanent != null) { if (copyFromPermanent != null) {
game.copyPermanent(copyFromPermanent, sourcePermanent, source, new ApplyToPermanent() { game.copyPermanent(copyFromPermanent, sourcePermanent, source, applier);
@Override
public Boolean apply(Game game, Permanent permanent) {
if (!permanent.getCardType().contains(CardType.ENCHANTMENT)) {
permanent.getCardType().add(CardType.ENCHANTMENT);
}
return true;
}
});
return true; return true;
} }
} }

View file

@ -29,6 +29,7 @@ package mage.sets.magic2012;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BecomesTargetTriggeredAbility; import mage.abilities.common.BecomesTargetTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -115,6 +116,18 @@ class PhantasmalImageCopyEffect extends OneShotEffect {
//permanent.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), game); //permanent.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), game);
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
if (!mageObject.getSubtype().contains("Illusion")) {
mageObject.getSubtype().add("Illusion");
}
// Add directly because the created permanent is only used to copy from, so there is no need to add the ability to e.g. TriggeredAbilities
mageObject.getAbilities().add(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()));
//permanent.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), game);
return true;
}
}); });
return true; return true;

View file

@ -47,7 +47,7 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.util.functions.ApplyToPermanent; import mage.util.functions.AbilityApplier;
/** /**
* *
@ -82,6 +82,7 @@ public class MercurialPretender extends CardImpl {
return new MercurialPretender(this); return new MercurialPretender(this);
} }
} }
class MercurialPretenderCopyEffect extends OneShotEffect { class MercurialPretenderCopyEffect extends OneShotEffect {
public MercurialPretenderCopyEffect() { public MercurialPretenderCopyEffect() {
@ -103,16 +104,10 @@ class MercurialPretenderCopyEffect extends OneShotEffect {
player.choose(Outcome.Copy, target, source.getSourceId(), game); player.choose(Outcome.Copy, target, source.getSourceId(), game);
Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget()); Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget());
if (copyFromPermanent != null) { if (copyFromPermanent != null) {
game.copyPermanent(copyFromPermanent, sourcePermanent, source, new ApplyToPermanent() { game.copyPermanent(copyFromPermanent, sourcePermanent, source,
@Override
public Boolean apply(Game game, Permanent permanent) {
// {2}{U}{U}: Return this creature to its owner's hand. // {2}{U}{U}: Return this creature to its owner's hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{2}{U}{U}")); new AbilityApplier(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{2}{U}{U}")))
permanent.addAbility(ability, game); );
return true;
}
});
return true; return true;
} }
} }

View file

@ -29,6 +29,7 @@ package mage.sets.mirrodinbesieged;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -110,6 +111,15 @@ class CryptoplasmEffect extends OneShotEffect {
permanent.addAbility(upkeepAbility, source.getSourceId(), game); permanent.addAbility(upkeepAbility, source.getSourceId(), game);
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true);
upkeepAbility.addTarget(new TargetCreaturePermanent());
mageObject.getAbilities().add(upkeepAbility);
return true;
}
}); });
game.addEffect(effect, source); game.addEffect(effect, source);

View file

@ -25,20 +25,20 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.newphyrexia; package mage.sets.newphyrexia;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
@ -60,7 +60,7 @@ public class PhyrexianMetamorph extends CardImpl {
new CardTypePredicate(CardType.CREATURE))); new CardTypePredicate(CardType.CREATURE)));
} }
public PhyrexianMetamorph (UUID ownerId) { public PhyrexianMetamorph(UUID ownerId) {
super(ownerId, 42, "Phyrexian Metamorph", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}{UP}"); super(ownerId, 42, "Phyrexian Metamorph", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}{UP}");
this.expansionSetCode = "NPH"; this.expansionSetCode = "NPH";
this.subtype.add("Shapeshifter"); this.subtype.add("Shapeshifter");
@ -71,11 +71,17 @@ public class PhyrexianMetamorph extends CardImpl {
ApplyToPermanent phyrexianMetamorphApplier = new ApplyToPermanent() { ApplyToPermanent phyrexianMetamorphApplier = new ApplyToPermanent() {
@Override @Override
public Boolean apply(Game game, Permanent permanent) { public Boolean apply(Game game, Permanent permanent) {
if (!permanent.getCardType().contains(CardType.ARTIFACT)) { return apply(game, (MageObject) permanent);
permanent.getCardType().add(CardType.ARTIFACT); }
@Override
public Boolean apply(Game game, MageObject mageObject) {
if (!mageObject.getCardType().contains(CardType.ARTIFACT)) {
mageObject.getCardType().add(CardType.ARTIFACT);
} }
return true; return true;
} }
}; };
// {UP} ( can be paid with either {U} or 2 life.) // {UP} ( can be paid with either {U} or 2 life.)
@ -86,7 +92,7 @@ public class PhyrexianMetamorph extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
} }
public PhyrexianMetamorph (final PhyrexianMetamorph card) { public PhyrexianMetamorph(final PhyrexianMetamorph card) {
super(card); super(card);
} }

View file

@ -28,16 +28,17 @@
package mage.sets.planechase2012; package mage.sets.planechase2012;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
import mage.abilities.keyword.NinjutsuAbility; import mage.abilities.keyword.NinjutsuAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.util.functions.ApplyToPermanent; import mage.util.functions.ApplyToPermanent;
@ -60,7 +61,7 @@ public class SakashimasStudent extends CardImpl {
// Ninjutsu {1}{U} // Ninjutsu {1}{U}
this.addAbility(new NinjutsuAbility(new ManaCostsImpl("{1}{U}"))); this.addAbility(new NinjutsuAbility(new ManaCostsImpl("{1}{U}")));
// You may have Sakashima's Student enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types. // You may have Sakashima's Student enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,new EntersBattlefieldEffect( this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
new CopyPermanentEffect(new SakashimasStudentApplyToPermanent()), new CopyPermanentEffect(new SakashimasStudentApplyToPermanent()),
"You may have {this} enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types", "You may have {this} enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types",
true))); true)));
@ -86,4 +87,13 @@ class SakashimasStudentApplyToPermanent extends ApplyToPermanent {
} }
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
if (!mageObject.getSubtype().contains("Ninja")) {
mageObject.getSubtype().add("Ninja");
}
return true;
}
} }

View file

@ -29,6 +29,7 @@ package mage.sets.saviorsofkamigawa;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -119,6 +120,21 @@ class SakashimaTheImpostorCopyEffect extends OneShotEffect {
), game); ), game);
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
if (!mageObject.getSupertype().contains("Legendary")) {
mageObject.getSubtype().add("Legendary");
}
mageObject.setName("Sakashima the Impostor");
// {2}{U}{U}: Return Sakashima the Impostor to its owner's hand at the beginning of the next end step
mageObject.getAbilities().add(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnToHandSourceEffect(true)), false),
new ManaCostsImpl("{2}{U}{U}")
));
return true;
}
}); });
return true; return true;

View file

@ -29,6 +29,7 @@ package mage.sets.theros;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
@ -77,6 +78,14 @@ public class ArtisanOfForms extends CardImpl {
class ArtisanOfFormsApplyToPermanent extends ApplyToPermanent { class ArtisanOfFormsApplyToPermanent extends ApplyToPermanent {
@Override
public Boolean apply(Game game, MageObject mageObject) {
Effect effect = new CopyPermanentEffect(new ArtisanOfFormsApplyToPermanent());
effect.setText("have {this} become a copy of target creature and gain this ability");
mageObject.getAbilities().add(new HeroicAbility(effect, true));
return true;
}
@Override @Override
public Boolean apply(Game game, Permanent permanent) { public Boolean apply(Game game, Permanent permanent) {
Effect effect = new CopyPermanentEffect(new ArtisanOfFormsApplyToPermanent()); Effect effect = new CopyPermanentEffect(new ArtisanOfFormsApplyToPermanent());
@ -84,4 +93,5 @@ class ArtisanOfFormsApplyToPermanent extends ApplyToPermanent {
permanent.addAbility(new HeroicAbility(effect, true), game); permanent.addAbility(new HeroicAbility(effect, true), game);
return true; return true;
} }
} }

View file

@ -29,6 +29,7 @@ package mage.sets.unlimitededition;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -115,6 +116,15 @@ class VesuvanDoppelgangerCopyEffect extends OneShotEffect {
new VesuvanDoppelgangerCopyEffect(), TargetController.YOU, true, false, rule2)); new VesuvanDoppelgangerCopyEffect(), TargetController.YOU, true, false, rule2));
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
mageObject.getColor(game).setColor(sourcePermanent.getColor(game));
mageObject.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
new VesuvanDoppelgangerCopyEffect(), TargetController.YOU, true, false, rule2));
return true;
}
}); });
return true; return true;
} }

View file

@ -29,6 +29,7 @@ package mage.sets.vintagemasters;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
@ -86,4 +87,12 @@ class DacksDuplicateApplyToPermanent extends ApplyToPermanent {
permanent.addAbility(HasteAbility.getInstance(), game); permanent.addAbility(HasteAbility.getInstance(), game);
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
mageObject.getAbilities().add(new DethroneAbility());
mageObject.getAbilities().add(HasteAbility.getInstance());
return true;
}
} }

View file

@ -38,28 +38,28 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class ArtisanOfFormsTest extends CardTestPlayerBase { public class ArtisanOfFormsTest extends CardTestPlayerBase {
/** /**
* Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a target creature. * Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a
* If Cackling Counterpart later resolves, it should copy the creature that Artisan of Forms copies, not * target creature. If Cackling Counterpart later resolves, it should copy
* the Artisan itself. * the creature that Artisan of Forms copies, not the Artisan itself.
*/ */
@Test @Test
public void testCopyTriggeredByCracklingCounterpart() { public void testCopyTriggeredByCracklingCounterpart() {
// Heroic - Whenever you cast a spell that targets Artisan of Forms, you may have Artisan of Forms become a copy of target creature and gain this ability. // Heroic - Whenever you cast a spell that targets Artisan of Forms, you may have Artisan of Forms become a copy of target creature and gain this ability.
addCard(Zone.BATTLEFIELD, playerA, "Artisan of Forms"); addCard(Zone.HAND, playerA, "Artisan of Forms"); // {1}{U}
// {1}{U}{U} Put a token onto the battlefield that's a copy of target creature you control. // {1}{U}{U} Put a token onto the battlefield that's a copy of target creature you control.
addCard(Zone.HAND, playerA, "Cackling Counterpart"); addCard(Zone.HAND, playerA, "Cackling Counterpart");
addCard(Zone.BATTLEFIELD, playerA, "Island",3); addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Artisan of Forms");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms");
addTarget(playerA, "Silvercoat Lion"); addTarget(playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
assertLife(playerA, 20); assertLife(playerA, 20);
@ -71,17 +71,17 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
// 1 + 2 Silvercoat Lion at the end // 1 + 2 Silvercoat Lion at the end
assertPermanentCount(playerA, "Silvercoat Lion", 2); assertPermanentCount(playerA, "Silvercoat Lion", 2);
for (Permanent permanent :currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) { for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
if (permanent.getName().equals("Silvercoat Lion")) { if (permanent.getName().equals("Silvercoat Lion")) {
Assert.assertEquals("Creature has to have Cast + Heroic ability", 2, permanent.getAbilities().size()); Assert.assertEquals("Creature has to have Cast + Heroic ability", 2, permanent.getAbilities().size());
} }
} }
} }
/** /**
* Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a target creature. * Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a
* If populate spell later resolves, it should copy the creature that Artisan of Forms copies, not * target creature. If populate spell later resolves, it should copy the
* the Artisan itself. * creature that Artisan of Forms copies, not the Artisan itself.
*/ */
@Test @Test
public void testCopyTriggeredByPopulate() { public void testCopyTriggeredByPopulate() {
@ -90,9 +90,9 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Artisan of Forms"); addCard(Zone.BATTLEFIELD, playerA, "Artisan of Forms");
// {1}{U}{U} Put a token onto the battlefield that's a copy of target creature you control. // {1}{U}{U} Put a token onto the battlefield that's a copy of target creature you control.
addCard(Zone.HAND, playerA, "Cackling Counterpart"); addCard(Zone.HAND, playerA, "Cackling Counterpart");
addCard(Zone.BATTLEFIELD, playerA, "Island",3); addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.HAND, playerA, "Eyes in the Skies"); addCard(Zone.HAND, playerA, "Eyes in the Skies");
addCard(Zone.BATTLEFIELD, playerA, "Plains",4); addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
@ -114,7 +114,7 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
// 3 Silvercoat Lion at the end // 3 Silvercoat Lion at the end
assertPermanentCount(playerA, "Silvercoat Lion", 3); assertPermanentCount(playerA, "Silvercoat Lion", 3);
for (Permanent permanent :currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) { for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
if (permanent.getName().equals("Silvercoat Lion")) { if (permanent.getName().equals("Silvercoat Lion")) {
Assert.assertEquals("Creature has to have Cast + Heroic ability", 2, permanent.getAbilities().size()); Assert.assertEquals("Creature has to have Cast + Heroic ability", 2, permanent.getAbilities().size());
} }

View file

@ -94,4 +94,35 @@ public class FelhideSpiritbinderTest extends CardTestPlayerBase {
assertLife(playerB, 20); assertLife(playerB, 20);
} }
@Test
public void testCopyATokenCreature() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.HAND, playerA, "Call of the Herd", 1);
// Inspired - Whenever Felhide Spiritbinder becomes untapped, you may pay {1}{R}.
// If you do, put a token onto the battlefield that's a copy of another target creature
// except it's an enchantment in addition to its other types. It gains haste. Exile it at the beginning of the next end step.
addCard(Zone.BATTLEFIELD, playerB, "Felhide Spiritbinder", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Call of the Herd");
attack(2, playerB, "Felhide Spiritbinder");
setStopAt(4, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Elephant", 1);
assertPermanentCount(playerB, "Elephant", 1);
assertAbility(playerB, "Elephant", HasteAbility.getInstance(), true);
Permanent copiedTokenElephant = getPermanent("Elephant", playerB);
Assert.assertEquals("Elephant has Enchantment card type", true, copiedTokenElephant.getCardType().contains(CardType.ENCHANTMENT));
assertLife(playerA, 17);
assertLife(playerB, 20);
}
} }

View file

@ -82,28 +82,27 @@ public class FlameshadowConjuringTest extends CardTestPlayerBase {
// Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature. // Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature.
// That token gains haste. Exile it at the beginning of the next end step. // That token gains haste. Exile it at the beginning of the next end step.
addCard(Zone.BATTLEFIELD, playerA, "Flameshadow Conjuring", 1); addCard(Zone.BATTLEFIELD, playerA, "Flameshadow Conjuring", 1);
// Sacrifice a creature: Nantuko Husk gets +2/+2 until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Nantuko Husk", 1);
// Deathtouch, lifelink // Deathtouch, lifelink
// When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield. // When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield.
addCard(Zone.HAND, playerA, "Wurmcoil Engine", 1); // 6/6 - {6} addCard(Zone.HAND, playerA, "Wurmcoil Engine", 1); // 6/6 - {6}
addCard(Zone.BATTLEFIELD, playerB, "Plains", 3);
// Destroy target attacking creature.
addCard(Zone.HAND, playerB, "Kill Shot", 1); // {2}{U}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wurmcoil Engine"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wurmcoil Engine");
setChoice(playerA, "Yes"); setChoice(playerA, "Yes");
attack(1, playerA, "Wurmcoil Engine"); attack(1, playerA, "Wurmcoil Engine");
attack(1, playerA, "Nantuko Husk");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice a creature"); castSpell(1, PhaseStep.END_COMBAT, playerB, "Kill Shot", "Wurmcoil Engine");
// addTarget(playerA, "Wurmcoil Engine[only copy]");
setChoice(playerA, "Wurmcoil Engine[only copy]");
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
assertGraveyardCount(playerB, "Kill Shot", 1);
assertPermanentCount(playerA, "Wurmcoil Engine", 1); assertPermanentCount(playerA, "Wurmcoil Engine", 1);
assertPowerToughness(playerA, "Nantuko Husk", 4, 4); assertLife(playerB, 14);
assertLife(playerB, 12);
assertLife(playerA, 26); assertLife(playerA, 26);
assertPermanentCount(playerA, "Wurm", 2); assertPermanentCount(playerA, "Wurm", 2);

View file

@ -33,19 +33,14 @@ import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.EmptyToken; import mage.game.permanent.token.EmptyToken;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.util.functions.ApplyToPermanent; import mage.util.functions.ApplyToPermanent;
import mage.util.functions.EmptyApplyToPermanent; import mage.util.functions.EmptyApplyToPermanent;
@ -72,6 +67,13 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
this(playerId, null, false); this(playerId, null, false);
} }
/**
*
* @param playerId null the token is controlled/owned by the controller of
* the source ability
* @param additionalCardType the token gains tis card types in addition
* @param gainsHaste the token gains haste
*/
public PutTokenOntoBattlefieldCopyTargetEffect(UUID playerId, CardType additionalCardType, boolean gainsHaste) { public PutTokenOntoBattlefieldCopyTargetEffect(UUID playerId, CardType additionalCardType, boolean gainsHaste) {
super(Outcome.PutCreatureInPlay); super(Outcome.PutCreatureInPlay);
this.playerId = playerId; this.playerId = playerId;
@ -113,28 +115,19 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
EmptyToken token = new EmptyToken(); EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(copyFromPermanent); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer) CardUtil.copyTo(token).from(copyFromPermanent); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
applier.apply(game, token);
if (additionalCardType != null && !token.getCardType().contains(additionalCardType)) { if (additionalCardType != null && !token.getCardType().contains(additionalCardType)) {
token.getCardType().add(additionalCardType); token.getCardType().add(additionalCardType);
} }
if (gainsHaste) { if (gainsHaste) {
token.addAbility(HasteAbility.getInstance()); token.addAbility(HasteAbility.getInstance());
} }
token.putOntoBattlefield(1, game, source.getSourceId(), playerId == null ? source.getControllerId() : playerId); token.putOntoBattlefield(1, game, source.getSourceId(), playerId == null ? source.getControllerId() : playerId);
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
Permanent tokenPermanent = game.getPermanent(tokenId); Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) { if (tokenPermanent != null) {
addedTokenPermanents.add(tokenPermanent); addedTokenPermanents.add(tokenPermanent);
game.copyPermanent(copyFromPermanent, tokenPermanent, source, applier);
if (additionalCardType != null) {
ContinuousEffect effect = new AddCardTypeTargetEffect(additionalCardType, Duration.Custom);
effect.setTargetPointer(new FixedTarget(tokenPermanent, game));
game.addEffect(effect, source);
}
if (gainsHaste) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(tokenPermanent, game));
game.addEffect(effect, source);
}
} }
} }
return true; return true;

View file

@ -137,7 +137,7 @@ public class Token extends MageObjectImpl {
return false; return false;
} }
lastAddedTokenIds.clear(); lastAddedTokenIds.clear();
// TODO: Check this setCode handling because it makes no sens if token put into play with e.g. "Feldon of the third Path" // TODO: Check this setCode handling because it makes no sense if token put into play with e.g. "Feldon of the third Path"
Card source = game.getCard(sourceId); Card source = game.getCard(sourceId);
String setCode; String setCode;
if (this.getOriginalExpansionSetCode() != null && !this.getOriginalExpansionSetCode().isEmpty()) { if (this.getOriginalExpansionSetCode() != null && !this.getOriginalExpansionSetCode().isEmpty()) {

View file

@ -0,0 +1,59 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.util.functions;
import mage.MageObject;
import mage.abilities.Ability;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class AbilityApplier extends ApplyToPermanent {
private final Ability ability;
public AbilityApplier(Ability ability) {
this.ability = ability;
}
@Override
public Boolean apply(Game game, Permanent permanent) {
permanent.addAbility(ability, game);
return true;
}
@Override
public Boolean apply(Game game, MageObject mageObject) {
mageObject.getAbilities().add(ability);
return true;
}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.util.functions;
import mage.MageObject;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public abstract class ApplyToMageObject {
public abstract Boolean apply(Game game, MageObject mageObject);
}

View file

@ -7,7 +7,7 @@ import mage.game.permanent.Permanent;
/** /**
* @author noxx * @author noxx
*/ */
public abstract class ApplyToPermanent implements Serializable { public abstract class ApplyToPermanent extends ApplyToMageObject implements Serializable {
public abstract Boolean apply(Game game, Permanent permanent); public abstract Boolean apply(Game game, Permanent permanent);
} }

View file

@ -0,0 +1,36 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.util.functions;
/**
*
* @author LevelX2
*/
public class CardTypeApplier {
}

View file

@ -78,7 +78,7 @@ public class CopyTokenFunction implements Function<Token, Card> {
target.setOriginalExpansionSetCode(source.getExpansionSetCode()); target.setOriginalExpansionSetCode(source.getExpansionSetCode());
target.setOriginalCardNumber(source.getCardNumber()); target.setOriginalCardNumber(source.getCardNumber());
if (source instanceof Card) { if (source instanceof Card) {
target.setCopySourceCard((Card) source); target.setCopySourceCard(source);
} }
} }

View file

@ -1,5 +1,6 @@
package mage.util.functions; package mage.util.functions;
import mage.MageObject;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -8,8 +9,15 @@ import mage.game.permanent.Permanent;
*/ */
public class EmptyApplyToPermanent extends ApplyToPermanent { public class EmptyApplyToPermanent extends ApplyToPermanent {
@Override
public Boolean apply(Game game, Permanent permanent) { public Boolean apply(Game game, Permanent permanent) {
// do nothing // do nothing
return true; return true;
} }
@Override
public Boolean apply(Game game, MageObject mageObject) {
return true;
}
} }