mirror of
https://github.com/correl/mage.git
synced 2025-01-14 03:00:10 +00:00
- [NEO] added Containment Construct
This commit is contained in:
parent
c8a4fb827a
commit
eb8e8b7890
2 changed files with 122 additions and 0 deletions
121
Mage.Sets/src/mage/cards/c/ContainmentConstruct.java
Normal file
121
Mage.Sets/src/mage/cards/c/ContainmentConstruct.java
Normal file
|
@ -0,0 +1,121 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class ContainmentConstruct extends CardImpl {
|
||||
|
||||
public ContainmentConstruct(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
|
||||
|
||||
this.subtype.add(SubType.CONSTRUCT);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever you discard a card, you may exile that card from your graveyard. If you do, you may play that card this turn.
|
||||
this.addAbility(new ContainmentConstructTriggeredAbility());
|
||||
|
||||
}
|
||||
|
||||
private ContainmentConstruct(final ContainmentConstruct card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainmentConstruct copy() {
|
||||
return new ContainmentConstruct(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ContainmentConstructTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public ContainmentConstructTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new ContainmentConstructEffect(), false);
|
||||
}
|
||||
|
||||
public ContainmentConstructTriggeredAbility(final ContainmentConstructTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainmentConstructTriggeredAbility copy() {
|
||||
return new ContainmentConstructTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DISCARDED_CARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId() == this.getControllerId()
|
||||
&& game.getState().getZone(event.getTargetId()) == Zone.GRAVEYARD) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever you discard a card, ";
|
||||
}
|
||||
}
|
||||
|
||||
class ContainmentConstructEffect extends OneShotEffect {
|
||||
|
||||
public ContainmentConstructEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "you may exile that card from your graveyard. If you do, you may play that card this turn";
|
||||
}
|
||||
|
||||
public ContainmentConstructEffect(final ContainmentConstructEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainmentConstructEffect copy() {
|
||||
return new ContainmentConstructEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card discardedCard = game.getCard(targetPointer.getFirst(game, source));
|
||||
Card containmentConstruct = game.getCard(source.getSourceId());
|
||||
if (discardedCard != null
|
||||
&& containmentConstruct != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller.chooseUse(Outcome.Benefit, "Do you want to exile the discarded card? You may play it this turn from exile.", source, game)) {
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source);
|
||||
controller.moveCardsToExile(discardedCard, source, game, true, exileId, "Exiled by " + containmentConstruct.getIdName());
|
||||
PlayFromNotOwnHandZoneTargetEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(discardedCard.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -66,6 +66,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Coiling Stalker", 179, Rarity.COMMON, mage.cards.c.CoilingStalker.class));
|
||||
cards.add(new SetCardInfo("Colossal Skyturtle", 216, Rarity.UNCOMMON, mage.cards.c.ColossalSkyturtle.class));
|
||||
cards.add(new SetCardInfo("Commune with Spirits", 180, Rarity.COMMON, mage.cards.c.CommuneWithSpirits.class));
|
||||
cards.add(new SetCardInfo("Containment Construct", 243, Rarity.UNCOMMON, mage.cards.c.ContainmentConstruct.class));
|
||||
cards.add(new SetCardInfo("Covert Technician", 49, Rarity.UNCOMMON, mage.cards.c.CovertTechnician.class));
|
||||
cards.add(new SetCardInfo("Crackling Emergence", 136, Rarity.COMMON, mage.cards.c.CracklingEmergence.class));
|
||||
cards.add(new SetCardInfo("Debt to the Kami", 92, Rarity.COMMON, mage.cards.d.DebtToTheKami.class));
|
||||
|
|
Loading…
Reference in a new issue