mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Some changes to token handling and some cards.
This commit is contained in:
parent
3d6467225a
commit
62a605d3e7
13 changed files with 91 additions and 55 deletions
|
@ -64,7 +64,7 @@ public class FlamekinVillage extends CardImpl {
|
|||
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.
|
||||
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.
|
||||
this.addAbility(new RedManaAbility());
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.sets.commander2014;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -128,25 +131,33 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Token token = new NahiriTheLithomancerKorSoldierToken();
|
||||
if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
|
||||
Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken());
|
||||
if (tokenPermanent != null) {
|
||||
//TODO: Make sure the Equipment can legally enchant the token, preferably on targetting.
|
||||
Target target = new TargetControlledPermanent(0, 1, filter, true);
|
||||
if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
|
||||
Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget());
|
||||
if (equipmentPermanent != null) {
|
||||
Permanent attachedTo = game.getPermanent(equipmentPermanent.getAttachedTo());
|
||||
if (attachedTo != null) {
|
||||
attachedTo.removeAttachment(equipmentPermanent.getId(), game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Token token = new NahiriTheLithomancerKorSoldierToken();
|
||||
if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
|
||||
Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken());
|
||||
if (tokenPermanent != null) {
|
||||
//TODO: Make sure the Equipment can legally enchant the token, preferably on targetting.
|
||||
Target target = new TargetControlledPermanent(0, 1, filter, true);
|
||||
if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
|
||||
controller.chooseUse(outcome, "Attach an Equipment you control to the created Token?", game)) {
|
||||
if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), 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
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (player.chooseUse(Outcome.PutCardInPlay, "Put an Equipment from hand? (No = from graveyard)", game)) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.chooseUse(Outcome.PutCardInPlay, "Put an Equipment from hand? (No = from graveyard)", game)) {
|
||||
Target target = new TargetCardInHand(0, 1, filter);
|
||||
target.choose(Outcome.PutCardInPlay, source.getControllerId(), source.getSourceId(), game);
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
Card card = controller.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
|
||||
controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
|
||||
}
|
||||
}
|
||||
else {
|
||||
Target target = new TargetCardInYourGraveyard(0, 1, filter);
|
||||
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) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
|
||||
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ public class RequiemAngel extends CardImpl {
|
|||
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.
|
||||
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) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class IbHalfheartGoblinTactician extends CardImpl {
|
|||
// Sacrifice two Mountains: Put two 1/1 red Goblin creature tokens onto the battlefield.
|
||||
this.addAbility(new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new CreateTokenEffect(new GoblinToken("EVG"), 2),
|
||||
new CreateTokenEffect(new GoblinToken(expansionSetCode), 2),
|
||||
new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true))));
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -49,11 +50,10 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -127,8 +127,12 @@ class DiluvianPrimordialEffect extends OneShotEffect {
|
|||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
if (player != null && targetCard != null) {
|
||||
player.cast(targetCard.getSpellAbility(), game, true);
|
||||
game.addEffect(new DiluvianPrimordialReplacementEffect(targetCard.getId()), source);
|
||||
if (player.chooseUse(outcome, "Cast " + targetCard.getName() +"?", game)) {
|
||||
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 {
|
||||
|
||||
private UUID cardid;
|
||||
|
||||
public DiluvianPrimordialReplacementEffect(UUID cardid) {
|
||||
public DiluvianPrimordialReplacementEffect() {
|
||||
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) {
|
||||
super(effect);
|
||||
this.cardid = effect.cardid;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,14 +163,13 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
UUID eventObject = ((ZoneChangeEvent) event).getTargetId();
|
||||
StackObject card = game.getStack().getStackObject(eventObject);
|
||||
if (card instanceof Spell) {
|
||||
game.rememberLKI(card.getId(), Zone.STACK, (Spell) card);
|
||||
}
|
||||
if (card instanceof Card && card != null && eventObject == cardid) {
|
||||
((Card) card).moveToExile(id, "Diluvian Primordial", id, game);
|
||||
return true;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (card != null) {
|
||||
controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.STACK);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
|
|||
if (event.getType() == EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& ((ZoneChangeEvent) event).getTargetId() == cardid) {
|
||||
&& ((ZoneChangeEvent) event).getTargetId().equals(getTargetPointer().getFirst(game, source))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class HordelingOutburst extends CardImpl {
|
|||
this.color.setRed(true);
|
||||
|
||||
// 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) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class MarduAscendancy extends CardImpl {
|
|||
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.
|
||||
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.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(0, 3, Duration.EndOfTurn, filter, false),
|
||||
|
|
|
@ -42,6 +42,7 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
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);
|
||||
|
||||
// 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}
|
||||
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{R}{W}{B}")));
|
||||
|
@ -80,8 +81,8 @@ public class PonybackBrigade extends CardImpl {
|
|||
|
||||
class PonybackBrigadeAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public PonybackBrigadeAbility() {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new GoblinToken("KTK"), 3), false);
|
||||
public PonybackBrigadeAbility(Token token) {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(token, 3), false);
|
||||
this.setWorksFaceDown(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,11 +63,17 @@ public class ContestedWarZone extends CardImpl {
|
|||
public ContestedWarZone(UUID ownerId) {
|
||||
super(ownerId, 144, "Contested War Zone", Rarity.RARE, new CardType[]{CardType.LAND}, null);
|
||||
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());
|
||||
|
||||
// {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.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new ContestedWarZoneAbility());
|
||||
}
|
||||
|
||||
public ContestedWarZone(final ContestedWarZone card) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BeetlebackChief extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// 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)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ public class LiquimetalCoating extends CardImpl {
|
|||
public LiquimetalCoating (UUID ownerId) {
|
||||
super(ownerId, 171, "Liquimetal Coating", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
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.addTarget(new TargetPermanent());
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
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}");
|
||||
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.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
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) {
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
*/
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.constants.CardType;
|
||||
|
||||
/**
|
||||
|
@ -37,12 +39,22 @@ import mage.constants.CardType;
|
|||
*/
|
||||
public class GoblinToken extends Token {
|
||||
|
||||
static List<String> imageSetCodes = Arrays.asList(
|
||||
"M10", "C14", "KTK", "EVG"
|
||||
);
|
||||
|
||||
public GoblinToken() {
|
||||
this("M10");
|
||||
this(imageSetCodes.get(new Random().nextInt(imageSetCodes.size())));
|
||||
}
|
||||
|
||||
public GoblinToken(String originalExpansionSetCode) {
|
||||
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);
|
||||
subtype.add("Goblin");
|
||||
|
||||
|
@ -50,4 +62,4 @@ public class GoblinToken extends Token {
|
|||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue