mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[STX] Implement Conspiracy Theorist (#7728)
* [STX] Implement Conspiracy Theorist
This commit is contained in:
parent
7d2b1b4ade
commit
af0f705b5e
4 changed files with 171 additions and 2 deletions
143
Mage.Sets/src/mage/cards/c/ConspiracyTheorist.java
Normal file
143
Mage.Sets/src/mage/cards/c/ConspiracyTheorist.java
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.common.AttacksTriggeredAbility;
|
||||||
|
import mage.abilities.costs.CompositeCost;
|
||||||
|
import mage.abilities.costs.common.DiscardCardCost;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.FilterCard;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.DiscardedCardsEvent;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetCard;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author htrajan
|
||||||
|
*/
|
||||||
|
public final class ConspiracyTheorist extends CardImpl {
|
||||||
|
|
||||||
|
public ConspiracyTheorist(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.HUMAN);
|
||||||
|
this.subtype.add(SubType.SHAMAN);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// Whenever Conspiracy Theorist attacks, you may pay {1} and discard a card. If you do, draw a card.
|
||||||
|
this.addAbility(new AttacksTriggeredAbility(new DoIfCostPaid(new DrawCardSourceControllerEffect(1),
|
||||||
|
new CompositeCost(new ManaCostsImpl<>("{1}"), new DiscardCardCost(), "pay {1} and discard a card"))
|
||||||
|
.setText("you may pay {1} and discard a card. If you do, draw a card"), false));
|
||||||
|
|
||||||
|
// Whenever you discard one or more nonland cards, you may exile one of them from your graveyard. If you do, you may cast it this turn.
|
||||||
|
this.addAbility(new ConspiracyTheoristAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConspiracyTheorist(final ConspiracyTheorist card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConspiracyTheorist copy() {
|
||||||
|
return new ConspiracyTheorist(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConspiracyTheoristAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
ConspiracyTheoristAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConspiracyTheoristAbility(ConspiracyTheoristAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DISCARDED_CARDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
if (event.getPlayerId().equals(getControllerId())) {
|
||||||
|
DiscardedCardsEvent discardedCardsEvent = (DiscardedCardsEvent) event;
|
||||||
|
Set<Card> discardedNonLandCards = discardedCardsEvent.getDiscardedCards().getCards(StaticFilters.FILTER_CARD_NON_LAND, game);
|
||||||
|
if (discardedNonLandCards.size() > 0) {
|
||||||
|
this.getEffects().clear();
|
||||||
|
this.getEffects().add(new ConspiracyTheoristEffect(discardedNonLandCards));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConspiracyTheoristAbility copy() {
|
||||||
|
return new ConspiracyTheoristAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Whenever you discard one or more nonland cards, you may exile one of them from your graveyard. If you do, you may cast it this turn.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConspiracyTheoristEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private final Set<Card> discardedCards;
|
||||||
|
|
||||||
|
ConspiracyTheoristEffect(Set<Card> discardedCards) {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.discardedCards = discardedCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConspiracyTheoristEffect(ConspiracyTheoristEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.discardedCards = effect.discardedCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
CardsImpl cards = new CardsImpl(discardedCards);
|
||||||
|
TargetCard target = new TargetCard(Zone.GRAVEYARD, new FilterCard("card to exile"));
|
||||||
|
boolean validTarget = cards.stream()
|
||||||
|
.anyMatch(card -> target.canTarget(card, game));
|
||||||
|
if (validTarget && controller.chooseUse(Outcome.Benefit, "Exile a card?", source, game)) {
|
||||||
|
if (controller.choose(Outcome.Benefit, cards, target, game)) {
|
||||||
|
Card card = cards.get(target.getFirstTarget(), game);
|
||||||
|
if (card != null && controller.moveCards(card, Zone.EXILED, source, game)) {
|
||||||
|
// you may cast it this turn
|
||||||
|
CardUtil.makeCardPlayable(game, source, card, Duration.EndOfTurn, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConspiracyTheoristEffect copy() {
|
||||||
|
return new ConspiracyTheoristEffect(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,6 +70,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Cogwork Archivist", 254, Rarity.COMMON, mage.cards.c.CogworkArchivist.class));
|
cards.add(new SetCardInfo("Cogwork Archivist", 254, Rarity.COMMON, mage.cards.c.CogworkArchivist.class));
|
||||||
cards.add(new SetCardInfo("Combat Professor", 11, Rarity.COMMON, mage.cards.c.CombatProfessor.class));
|
cards.add(new SetCardInfo("Combat Professor", 11, Rarity.COMMON, mage.cards.c.CombatProfessor.class));
|
||||||
cards.add(new SetCardInfo("Confront the Past", 67, Rarity.RARE, mage.cards.c.ConfrontThePast.class));
|
cards.add(new SetCardInfo("Confront the Past", 67, Rarity.RARE, mage.cards.c.ConfrontThePast.class));
|
||||||
|
cards.add(new SetCardInfo("Conspiracy Theorist", 94, Rarity.RARE, mage.cards.c.ConspiracyTheorist.class));
|
||||||
cards.add(new SetCardInfo("Containment Breach", 125, Rarity.UNCOMMON, mage.cards.c.ContainmentBreach.class));
|
cards.add(new SetCardInfo("Containment Breach", 125, Rarity.UNCOMMON, mage.cards.c.ContainmentBreach.class));
|
||||||
cards.add(new SetCardInfo("Crackle with Power", 95, Rarity.MYTHIC, mage.cards.c.CrackleWithPower.class));
|
cards.add(new SetCardInfo("Crackle with Power", 95, Rarity.MYTHIC, mage.cards.c.CrackleWithPower.class));
|
||||||
cards.add(new SetCardInfo("Cram Session", 170, Rarity.COMMON, mage.cards.c.CramSession.class));
|
cards.add(new SetCardInfo("Cram Session", 170, Rarity.COMMON, mage.cards.c.CramSession.class));
|
||||||
|
|
25
Mage/src/main/java/mage/game/events/DiscardedCardsEvent.java
Normal file
25
Mage/src/main/java/mage/game/events/DiscardedCardsEvent.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package mage.game.events;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.cards.Cards;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author htrajan
|
||||||
|
*/
|
||||||
|
public class DiscardedCardsEvent extends GameEvent {
|
||||||
|
|
||||||
|
private final Cards discardedCards;
|
||||||
|
|
||||||
|
public DiscardedCardsEvent(Ability source, UUID playerId, int amount, Cards discardedCards) {
|
||||||
|
super(EventType.DISCARDED_CARDS, null, source, playerId, amount, false);
|
||||||
|
this.discardedCards = new CardsImpl(discardedCards);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cards getDiscardedCards() {
|
||||||
|
return discardedCards;
|
||||||
|
}
|
||||||
|
}
|
|
@ -748,7 +748,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!discardedCards.isEmpty()) {
|
if (!discardedCards.isEmpty()) {
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARDS, null, source, playerId, discardedCards.size()));
|
game.fireEvent(new DiscardedCardsEvent(source, playerId, discardedCards.size(), discardedCards));
|
||||||
}
|
}
|
||||||
return discardedCards;
|
return discardedCards;
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, card.getId(), source, playerId));
|
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, card.getId(), source, playerId));
|
||||||
|
|
||||||
if (fireFinalEvent) {
|
if (fireFinalEvent) {
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARDS, null, source, playerId, 1));
|
game.fireEvent(new DiscardedCardsEvent(source, playerId, 1, new CardsImpl(card)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue