* Some changes to token handling and some cards.

This commit is contained in:
LevelX2 2014-12-02 16:58:31 +01:00
parent 3d6467225a
commit 62a605d3e7
13 changed files with 91 additions and 55 deletions

View file

@ -64,7 +64,7 @@ public class FlamekinVillage extends CardImpl {
this.expansionSetCode = "C14"; this.expansionSetCode = "C14";
// As Flamekin Village enters the battlefield, you may reveal an Elemental card from your hand. If you don't, Flamekin Village enters the battlefield tapped. // As Flamekin Village enters the battlefield, you may reveal an Elemental card from your hand. If you don't, Flamekin Village enters the battlefield tapped.
this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new RevealTargetFromHandCost(new TargetCardInHand(filter))), "you may reveal a Merfolk card from your hand. If you don't, {this} enters the battlefield tapped")); this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new RevealTargetFromHandCost(new TargetCardInHand(filter))), "you may reveal a Elemental card from your hand. If you don't, {this} enters the battlefield tapped"));
// {tap}: Add {R} to your mana pool. // {tap}: Add {R} to your mana pool.
this.addAbility(new RedManaAbility()); this.addAbility(new RedManaAbility());

View file

@ -27,6 +27,9 @@
*/ */
package mage.sets.commander2014; package mage.sets.commander2014;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -128,25 +131,33 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Token token = new NahiriTheLithomancerKorSoldierToken(); Player controller = game.getPlayer(source.getControllerId());
if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) { if (controller != null) {
Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken()); Token token = new NahiriTheLithomancerKorSoldierToken();
if (tokenPermanent != null) { if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
//TODO: Make sure the Equipment can legally enchant the token, preferably on targetting. Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken());
Target target = new TargetControlledPermanent(0, 1, filter, true); if (tokenPermanent != null) {
if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { //TODO: Make sure the Equipment can legally enchant the token, preferably on targetting.
Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget()); Target target = new TargetControlledPermanent(0, 1, filter, true);
if (equipmentPermanent != null) { if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
Permanent attachedTo = game.getPermanent(equipmentPermanent.getAttachedTo()); controller.chooseUse(outcome, "Attach an Equipment you control to the created Token?", game)) {
if (attachedTo != null) { if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
attachedTo.removeAttachment(equipmentPermanent.getId(), game); Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget());
if (equipmentPermanent != null) {
Permanent attachedTo = game.getPermanent(equipmentPermanent.getAttachedTo());
if (attachedTo != null) {
attachedTo.removeAttachment(equipmentPermanent.getId(), game);
}
tokenPermanent.addAttachment(equipmentPermanent.getId(), game);
}
} }
tokenPermanent.addAttachment(equipmentPermanent.getId(), game);
} }
} }
} }
return true;
} }
return true; return false;
} }
} }
@ -187,22 +198,22 @@ class NahiriTheLithomancerSecondAbilityEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (player != null) { if (controller != null) {
if (player.chooseUse(Outcome.PutCardInPlay, "Put an Equipment from hand? (No = from graveyard)", game)) { if (controller.chooseUse(Outcome.PutCardInPlay, "Put an Equipment from hand? (No = from graveyard)", game)) {
Target target = new TargetCardInHand(0, 1, filter); Target target = new TargetCardInHand(0, 1, filter);
target.choose(Outcome.PutCardInPlay, source.getControllerId(), source.getSourceId(), game); controller.choose(outcome, target, source.getSourceId(), game);
Card card = player.getHand().get(target.getFirstTarget(), game); Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) { if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
} }
} }
else { else {
Target target = new TargetCardInYourGraveyard(0, 1, filter); Target target = new TargetCardInYourGraveyard(0, 1, filter);
target.choose(Outcome.PutCardInPlay, source.getControllerId(), source.getSourceId(), game); target.choose(Outcome.PutCardInPlay, source.getControllerId(), source.getSourceId(), game);
Card card = player.getGraveyard().get(target.getFirstTarget(), game); Card card = controller.getGraveyard().get(target.getFirstTarget(), game);
if (card != null) { if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId()); controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
} }
} }
return true; return true;

View file

@ -68,7 +68,7 @@ public class RequiemAngel extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Whenever another non-Spirit creature you control dies, put a 1/1 white Spirit creature token with flying onto the battlefield. // Whenever another non-Spirit creature you control dies, put a 1/1 white Spirit creature token with flying onto the battlefield.
this.addAbility(new DiesCreatureTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken(), 1), false, filter)); this.addAbility(new DiesCreatureTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken(expansionSetCode), 1), false, filter));
} }
public RequiemAngel(final RequiemAngel card) { public RequiemAngel(final RequiemAngel card) {

View file

@ -87,7 +87,7 @@ public class IbHalfheartGoblinTactician extends CardImpl {
// Sacrifice two Mountains: Put two 1/1 red Goblin creature tokens onto the battlefield. // Sacrifice two Mountains: Put two 1/1 red Goblin creature tokens onto the battlefield.
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD, Zone.BATTLEFIELD,
new CreateTokenEffect(new GoblinToken("EVG"), 2), new CreateTokenEffect(new GoblinToken(expansionSetCode), 2),
new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true)))); new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true))));
} }

View file

@ -36,6 +36,7 @@ import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
@ -49,11 +50,10 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCardInOpponentsGraveyard; import mage.target.common.TargetCardInOpponentsGraveyard;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -127,8 +127,12 @@ class DiluvianPrimordialEffect extends OneShotEffect {
if (target instanceof TargetCardInOpponentsGraveyard) { if (target instanceof TargetCardInOpponentsGraveyard) {
Card targetCard = game.getCard(target.getFirstTarget()); Card targetCard = game.getCard(target.getFirstTarget());
if (player != null && targetCard != null) { if (player != null && targetCard != null) {
player.cast(targetCard.getSpellAbility(), game, true); if (player.chooseUse(outcome, "Cast " + targetCard.getName() +"?", game)) {
game.addEffect(new DiluvianPrimordialReplacementEffect(targetCard.getId()), source); player.cast(targetCard.getSpellAbility(), game, true);
ContinuousEffect effect = new DiluvianPrimordialReplacementEffect();
effect.setTargetPointer(new FixedTarget(targetCard.getId()));
game.addEffect(effect, source);
}
} }
} }
} }
@ -138,16 +142,13 @@ class DiluvianPrimordialEffect extends OneShotEffect {
class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl { class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
private UUID cardid; public DiluvianPrimordialReplacementEffect() {
public DiluvianPrimordialReplacementEffect(UUID cardid) {
super(Duration.EndOfTurn, Outcome.Exile); super(Duration.EndOfTurn, Outcome.Exile);
this.cardid = cardid; staticText = "If a card cast this way would be put into a graveyard this turn, exile it instead";
} }
public DiluvianPrimordialReplacementEffect(final DiluvianPrimordialReplacementEffect effect) { public DiluvianPrimordialReplacementEffect(final DiluvianPrimordialReplacementEffect effect) {
super(effect); super(effect);
this.cardid = effect.cardid;
} }
@Override @Override
@ -162,14 +163,13 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
UUID eventObject = ((ZoneChangeEvent) event).getTargetId(); Player controller = game.getPlayer(source.getControllerId());
StackObject card = game.getStack().getStackObject(eventObject); if (controller != null) {
if (card instanceof Spell) { Card card = game.getCard(getTargetPointer().getFirst(game, source));
game.rememberLKI(card.getId(), Zone.STACK, (Spell) card); if (card != null) {
} controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.STACK);
if (card instanceof Card && card != null && eventObject == cardid) { return true;
((Card) card).moveToExile(id, "Diluvian Primordial", id, game); }
return true;
} }
return false; return false;
} }
@ -179,7 +179,7 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
if (event.getType() == EventType.ZONE_CHANGE) { if (event.getType() == EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.GRAVEYARD if (zEvent.getToZone() == Zone.GRAVEYARD
&& ((ZoneChangeEvent) event).getTargetId() == cardid) { && ((ZoneChangeEvent) event).getTargetId().equals(getTargetPointer().getFirst(game, source))) {
return true; return true;
} }
} }

View file

@ -47,7 +47,7 @@ public class HordelingOutburst extends CardImpl {
this.color.setRed(true); this.color.setRed(true);
// Put 3 1/1 red Goblin creature tokens onto the battlefield. // Put 3 1/1 red Goblin creature tokens onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new GoblinToken("KTK"), 3)); this.getSpellAbility().addEffect(new CreateTokenEffect(new GoblinToken(expansionSetCode), 3));
} }
public HordelingOutburst(final HordelingOutburst card) { public HordelingOutburst(final HordelingOutburst card) {

View file

@ -69,7 +69,7 @@ public class MarduAscendancy extends CardImpl {
this.color.setWhite(true); this.color.setWhite(true);
// Whenever a nontoken creature you control attacks, put a 1/1 red Goblin creature token onto the battlefield tapped and attacking. // Whenever a nontoken creature you control attacks, put a 1/1 red Goblin creature token onto the battlefield tapped and attacking.
this.addAbility(new AttacksCreatureYourControlTriggeredAbility(new CreateTokenEffect(new GoblinToken("KTK"), 1, true, true), false, attackFilter)); this.addAbility(new AttacksCreatureYourControlTriggeredAbility(new CreateTokenEffect(new GoblinToken(expansionSetCode), 1, true, true), false, attackFilter));
// Sacrifice Mardu Ascendancy: Creatures you control get +0/+3 until end of turn. // Sacrifice Mardu Ascendancy: Creatures you control get +0/+3 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(0, 3, Duration.EndOfTurn, filter, false), this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(0, 3, Duration.EndOfTurn, filter, false),

View file

@ -42,6 +42,7 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.GoblinToken; import mage.game.permanent.token.GoblinToken;
import mage.game.permanent.token.Token;
/** /**
* *
@ -62,7 +63,7 @@ public class PonybackBrigade extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// When Ponyback Brigade enters the battlefield or is turned face up, put three 1/1 red Goblin creature tokens onto the battlefield. // When Ponyback Brigade enters the battlefield or is turned face up, put three 1/1 red Goblin creature tokens onto the battlefield.
this.addAbility(new PonybackBrigadeAbility()); this.addAbility(new PonybackBrigadeAbility(new GoblinToken(expansionSetCode)));
// Morph {2}{R}{W}{B} // Morph {2}{R}{W}{B}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{R}{W}{B}"))); this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{R}{W}{B}")));
@ -80,8 +81,8 @@ public class PonybackBrigade extends CardImpl {
class PonybackBrigadeAbility extends TriggeredAbilityImpl { class PonybackBrigadeAbility extends TriggeredAbilityImpl {
public PonybackBrigadeAbility() { public PonybackBrigadeAbility(Token token) {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new GoblinToken("KTK"), 3), false); super(Zone.BATTLEFIELD, new CreateTokenEffect(token, 3), false);
this.setWorksFaceDown(true); this.setWorksFaceDown(true);
} }

View file

@ -63,11 +63,17 @@ public class ContestedWarZone extends CardImpl {
public ContestedWarZone(UUID ownerId) { public ContestedWarZone(UUID ownerId) {
super(ownerId, 144, "Contested War Zone", Rarity.RARE, new CardType[]{CardType.LAND}, null); super(ownerId, 144, "Contested War Zone", Rarity.RARE, new CardType[]{CardType.LAND}, null);
this.expansionSetCode = "MBS"; this.expansionSetCode = "MBS";
// Whenever a creature deals combat damage to you, that creature's controller gains control of Contested War Zone.
this.addAbility(new ContestedWarZoneAbility());
// {T}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {1}, {T}: Attacking creatures get +1/+0 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.EndOfTurn, filter, false), new ManaCostsImpl("{1}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.EndOfTurn, filter, false), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);
this.addAbility(new ContestedWarZoneAbility());
} }
public ContestedWarZone(final ContestedWarZone card) { public ContestedWarZone(final ContestedWarZone card) {

View file

@ -52,7 +52,7 @@ public class BeetlebackChief extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// When Beetleback Chief enters the battlefield, put two 1/1 red Goblin creature tokens onto the battlefield. // When Beetleback Chief enters the battlefield, put two 1/1 red Goblin creature tokens onto the battlefield.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinToken(), 2))); this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinToken(expansionSetCode), 2)));
} }

View file

@ -50,6 +50,8 @@ public class LiquimetalCoating extends CardImpl {
public LiquimetalCoating (UUID ownerId) { public LiquimetalCoating (UUID ownerId) {
super(ownerId, 171, "Liquimetal Coating", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); super(ownerId, 171, "Liquimetal Coating", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "SOM"; this.expansionSetCode = "SOM";
// {T}: Target permanent becomes an artifact in addition to its other types until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfTurn), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfTurn), new TapSourceCost());
ability.addTarget(new TargetPermanent()); ability.addTarget(new TargetPermanent());
this.addAbility(ability); this.addAbility(ability);

View file

@ -34,6 +34,7 @@ import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -54,11 +55,14 @@ public class PanicSpellbomb extends CardImpl {
super(ownerId, 191, "Panic Spellbomb", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}"); super(ownerId, 191, "Panic Spellbomb", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "SOM"; this.expansionSetCode = "SOM";
// Tap, Sacrifice Panic Spellbomb: Target creature can't block this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBlockTargetEffect(Duration.EndOfTurn), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBlockTargetEffect(Duration.EndOfTurn), new TapSourceCost());
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
this.addAbility(new DiesTriggeredAbility(new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{R}")), false));
// When Panic Spellbomb is put into a graveyard from the battlefield, you may pay Red. If you do, draw a card.
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{R}")), false));
} }
public PanicSpellbomb(final PanicSpellbomb card) { public PanicSpellbomb(final PanicSpellbomb card) {

View file

@ -27,8 +27,10 @@
*/ */
package mage.game.permanent.token; package mage.game.permanent.token;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor;
import mage.constants.CardType; import mage.constants.CardType;
/** /**
@ -37,12 +39,22 @@ import mage.constants.CardType;
*/ */
public class GoblinToken extends Token { public class GoblinToken extends Token {
static List<String> imageSetCodes = Arrays.asList(
"M10", "C14", "KTK", "EVG"
);
public GoblinToken() { public GoblinToken() {
this("M10"); this(imageSetCodes.get(new Random().nextInt(imageSetCodes.size())));
} }
public GoblinToken(String originalExpansionSetCode) { public GoblinToken(String originalExpansionSetCode) {
super("Goblin", "1/1 red Goblin creature token"); super("Goblin", "1/1 red Goblin creature token");
this.setOriginalExpansionSetCode(originalExpansionSetCode); if (!imageSetCodes.contains(originalExpansionSetCode)) {
this.setOriginalExpansionSetCode(imageSetCodes.get(new Random().nextInt(imageSetCodes.size())));
} else {
this.setOriginalExpansionSetCode(originalExpansionSetCode);
}
cardType.add(CardType.CREATURE); cardType.add(CardType.CREATURE);
subtype.add("Goblin"); subtype.add("Goblin");
@ -50,4 +62,4 @@ public class GoblinToken extends Token {
power = new MageInt(1); power = new MageInt(1);
toughness = new MageInt(1); toughness = new MageInt(1);
} }
} }