mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
C20 Tayam, Luminous Enigma (#6453)
* C20 Tayam, Luminous Enigma WIP * fix counter removal cost * add author tag * static * staticText
This commit is contained in:
parent
e1fd213e0f
commit
a1118292f2
3 changed files with 240 additions and 2 deletions
237
Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java
Normal file
237
Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java
Normal file
|
@ -0,0 +1,237 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.RemoveCounterCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.*;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterPermanentCard;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.filter.predicate.permanent.CounterPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author htrajan
|
||||
*/
|
||||
public final class TayamLuminousEnigma extends CardImpl {
|
||||
|
||||
public TayamLuminousEnigma(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{B}{G}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.NIGHTMARE);
|
||||
this.subtype.add(SubType.BEAST);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Each other creature you control enters the battlefield with an additional vigilance counter on it.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TayamLuminousEnigmaReplacementEffect()));
|
||||
|
||||
// {3}, Remove three counters from among creatures you control: Put the top three cards of your library into your graveyard, then return a permanent card with converted mana cost 3 or less from your graveyard to the battlefield.
|
||||
PutTopCardOfLibraryIntoGraveControllerEffect millEffect = new PutTopCardOfLibraryIntoGraveControllerEffect(3);
|
||||
millEffect.concatBy(".");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, millEffect, new GenericManaCost(3));
|
||||
ability.addCost(new TayamLuminousEnigmaCost());
|
||||
TayamLuminousEnigmaEffect effect = new TayamLuminousEnigmaEffect();
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private TayamLuminousEnigma(final TayamLuminousEnigma card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TayamLuminousEnigma copy() {
|
||||
return new TayamLuminousEnigma(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TayamLuminousEnigmaCost extends RemoveCounterCost {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a creature with a counter among creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(new CounterPredicate(null));
|
||||
}
|
||||
|
||||
public TayamLuminousEnigmaCost() {
|
||||
super(new TargetPermanent(1, 1, filter, true), null, 3);
|
||||
}
|
||||
|
||||
public TayamLuminousEnigmaCost(TayamLuminousEnigmaCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
paid = false;
|
||||
int countersRemoved = 0;
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
for (int i = 0; i < countersToRemove; i++) {
|
||||
if (target.choose(Outcome.UnboostCreature, controllerId, sourceId, game)) {
|
||||
UUID targetId = getOnlyElement(target.getTargets());
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
if (!permanent.getCounters(game).isEmpty()) {
|
||||
String counterName = null;
|
||||
if (permanent.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>();
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (permanent.getCounters(game).getCount(counter.getName()) > 0) {
|
||||
choices.add(counter.getName());
|
||||
}
|
||||
}
|
||||
choice.setChoices(choices);
|
||||
choice.setMessage("Choose a counter to remove from " + permanent.getLogName());
|
||||
if (!controller.choose(Outcome.UnboostCreature, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
counterName = choice.getChoice();
|
||||
} else {
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (counter.getCount() > 0) {
|
||||
counterName = counter.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counterName != null) {
|
||||
permanent.removeCounters(counterName, 1, game);
|
||||
target.clearChosen();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder(controller.getLogName())
|
||||
.append(" removes a ")
|
||||
.append(counterName).append(" counter from ")
|
||||
.append(permanent.getName()).toString());
|
||||
}
|
||||
countersRemoved++;
|
||||
if (countersRemoved == countersToRemove) {
|
||||
paid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TayamLuminousEnigmaCost copy() {
|
||||
return new TayamLuminousEnigmaCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Remove three counters from among creatures you control";
|
||||
}
|
||||
}
|
||||
|
||||
class TayamLuminousEnigmaEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterPermanentCard("permanent card in your graveyard with converted mana cost 3 or less");
|
||||
|
||||
static {
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4));
|
||||
}
|
||||
|
||||
TayamLuminousEnigmaEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = ", then return a permanent card with converted mana cost 3 or less from your graveyard to the battlefield";
|
||||
}
|
||||
|
||||
private TayamLuminousEnigmaEffect(TayamLuminousEnigmaEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TayamLuminousEnigmaEffect copy() {
|
||||
return new TayamLuminousEnigmaEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null || player.getGraveyard().count(filter, game) == 0) {
|
||||
return false;
|
||||
}
|
||||
TargetCard target = new TargetCardInYourGraveyard(filter);
|
||||
target.setNotTarget(true);
|
||||
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
|
||||
return false;
|
||||
}
|
||||
return player.moveCards(game.getCard(target.getFirstTarget()), Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
|
||||
class TayamLuminousEnigmaReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
TayamLuminousEnigmaReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
staticText = "Each other creature you control enters the battlefield with an additional vigilance counter on it.";
|
||||
}
|
||||
|
||||
private TayamLuminousEnigmaReplacementEffect(final TayamLuminousEnigmaReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return creature != null
|
||||
&& creature.isCreature()
|
||||
&& !source.getSourceId().equals(creature.getId())
|
||||
&& creature.isControlledBy(source.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.VIGILANCE.createInstance(), source, game, event.getAppliedEffects());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TayamLuminousEnigmaReplacementEffect copy() {
|
||||
return new TayamLuminousEnigmaReplacementEffect(this);
|
||||
}
|
||||
}
|
|
@ -304,6 +304,7 @@ public final class Commander2020Edition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Swarm Intelligence", 124, Rarity.RARE, mage.cards.s.SwarmIntelligence.class));
|
||||
cards.add(new SetCardInfo("Swiftfoot Boots", 254, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class));
|
||||
cards.add(new SetCardInfo("Talrand, Sky Summoner", 125, Rarity.RARE, mage.cards.t.TalrandSkySummoner.class));
|
||||
cards.add(new SetCardInfo("Tayam, Luminous Enigma", 16, Rarity.MYTHIC, mage.cards.t.TayamLuminousEnigma.class));
|
||||
cards.add(new SetCardInfo("Tectonic Reformation", 162, Rarity.RARE, mage.cards.t.TectonicReformation.class));
|
||||
cards.add(new SetCardInfo("Temple of the False God", 319, Rarity.UNCOMMON, mage.cards.t.TempleOfTheFalseGod.class));
|
||||
cards.add(new SetCardInfo("Temur Charm", 230, Rarity.UNCOMMON, mage.cards.t.TemurCharm.class));
|
||||
|
|
|
@ -23,10 +23,10 @@ import java.util.UUID;
|
|||
*/
|
||||
public class RemoveCounterCost extends CostImpl {
|
||||
|
||||
private TargetPermanent target;
|
||||
protected TargetPermanent target;
|
||||
private String name;
|
||||
private CounterType counterTypeToRemove;
|
||||
private int countersToRemove;
|
||||
protected int countersToRemove;
|
||||
|
||||
public RemoveCounterCost(TargetPermanent target) {
|
||||
this(target, null);
|
||||
|
|
Loading…
Reference in a new issue