[ONE] Implement Tekuthal, Inquiry Dominus (#9921)

This commit is contained in:
Grath 2023-01-28 18:21:34 -05:00 committed by GitHub
parent 2167b7cb4f
commit a151e979e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 137 additions and 27 deletions

View file

@ -0,0 +1,104 @@
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.common.RemoveCounterCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetPermanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author Grath
*/
public final class TekuthalInquiryDominus extends CardImpl {
private static final FilterControlledPermanent filter
= new FilterControlledPermanent("other artifacts, creatures, and planeswalkers");
static {
filter.add(AnotherPredicate.instance);
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.CREATURE.getPredicate(),
CardType.PLANESWALKER.getPredicate()
));
}
public TekuthalInquiryDominus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.HORROR);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
// If you would proliferate, proliferate twice instead.
this.addAbility(new SimpleStaticAbility(new TekuthalInquiryDominusEffect()));
// {1}{U/P}{U/P}, Remove three counters from among other artifacts, creatures, and planeswalkers you control: Put an indestructible counter on Tekuthal, Inquiry Dominus.
Ability ability = new SimpleActivatedAbility(new AddCountersSourceEffect(CounterType.INDESTRUCTIBLE.createInstance()), new ManaCostsImpl<>("{1}{U/P}{U/P}"));
ability.addCost(new RemoveCounterCost(new TargetPermanent(
0, Integer.MAX_VALUE,
filter
), null, 3));
this.addAbility(ability);
}
private TekuthalInquiryDominus(final TekuthalInquiryDominus card) {
super(card);
}
@Override
public TekuthalInquiryDominus copy() {
return new TekuthalInquiryDominus(this);
}
}
class TekuthalInquiryDominusEffect extends ReplacementEffectImpl {
TekuthalInquiryDominusEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "If you would proliferate, proliferate twice instead.";
}
private TekuthalInquiryDominusEffect(final TekuthalInquiryDominusEffect effect) {
super(effect);
}
@Override
public TekuthalInquiryDominusEffect copy() {
return new TekuthalInquiryDominusEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PROLIFERATE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.isControlledBy(event.getPlayerId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2));
return false;
}
}

View file

@ -170,6 +170,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Tainted Observer", 217, Rarity.UNCOMMON, mage.cards.t.TaintedObserver.class));
cards.add(new SetCardInfo("Tamiyo's Immobilizer", 69, Rarity.UNCOMMON, mage.cards.t.TamiyosImmobilizer.class));
cards.add(new SetCardInfo("Tamiyo's Logbook", 70, Rarity.UNCOMMON, mage.cards.t.TamiyosLogbook.class));
cards.add(new SetCardInfo("Tekuthal, Inquiry Dominus", 71, Rarity.MYTHIC, mage.cards.t.TekuthalInquiryDominus.class));
cards.add(new SetCardInfo("Terramorphic Expanse", 261, Rarity.COMMON, mage.cards.t.TerramorphicExpanse.class));
cards.add(new SetCardInfo("Testament Bearer", 111, Rarity.COMMON, mage.cards.t.TestamentBearer.class));
cards.add(new SetCardInfo("The Autonomous Furnace", 247, Rarity.COMMON, mage.cards.t.TheAutonomousFurnace.class));

View file

@ -52,37 +52,42 @@ public class ProliferateEffect extends OneShotEffect {
if (controller == null) {
return false;
}
Target target = new TargetPermanentOrPlayer(0, Integer.MAX_VALUE, filter, true);
Map<String, Serializable> options = new HashMap<>();
options.put("UI.right.btn.text", "Done");
controller.choose(Outcome.Benefit, target, source, game, options);
for (UUID chosen : target.getTargets()) {
Permanent permanent = game.getPermanent(chosen);
if (permanent != null) {
for (Counter counter : permanent.getCounters(game).values()) {
GameEvent event = new GameEvent(GameEvent.EventType.PROLIFERATE, getId(), source, source.getControllerId(), 1, true);
if (game.replaceEvent(event)) {
return false;
}
for (int i = 0; i < event.getAmount(); i++) {
Target target = new TargetPermanentOrPlayer(0, Integer.MAX_VALUE, filter, true);
Map<String, Serializable> options = new HashMap<>();
options.put("UI.right.btn.text", "Done");
controller.choose(Outcome.Benefit, target, source, game, options);
for (UUID chosen : target.getTargets()) {
Permanent permanent = game.getPermanent(chosen);
if (permanent != null) {
for (Counter counter : permanent.getCounters(game).values()) {
Counter newCounter = CounterType.findByName(counter.getName()).createInstance();
if (permanent.addCounters(newCounter, source.getControllerId(), source, game)) {
game.informPlayers(permanent.getName() + " had " + newCounter.getDescription() + " added to it.");
}
}
continue;
}
Player player = game.getPlayer(chosen);
if (player == null) {
continue;
}
for (Counter counter : player.getCounters().values()) {
Counter newCounter = CounterType.findByName(counter.getName()).createInstance();
if (permanent.addCounters(newCounter, source.getControllerId(), source, game)) {
game.informPlayers(permanent.getName() + " had " + newCounter.getDescription() + " added to it.");
if (player.addCounters(newCounter, source.getControllerId(), source, game)) {
game.informPlayers(player.getLogName() + " had " + newCounter.getDescription() + " added to them.");
}
}
continue;
}
Player player = game.getPlayer(chosen);
if (player == null) {
continue;
}
for (Counter counter : player.getCounters().values()) {
Counter newCounter = CounterType.findByName(counter.getName()).createInstance();
if (player.addCounters(newCounter, source.getControllerId(), source, game)) {
game.informPlayers(player.getLogName() + " had " + newCounter.getDescription() + " added to them.");
}
}
game.fireEvent(GameEvent.getEvent(
GameEvent.EventType.PROLIFERATED,
controller.getId(), source, controller.getId()
));
}
game.fireEvent(GameEvent.getEvent(
GameEvent.EventType.PROLIFERATED,
controller.getId(), source, controller.getId()
));
return true;
}

View file

@ -307,7 +307,7 @@ public class GameEvent implements Serializable {
CAN_TAKE_MULLIGAN,
SCRY, SCRIED, SCRY_TO_BOTTOM,
SURVEIL, SURVEILED,
PROLIFERATED,
PROLIFERATE, PROLIFERATED,
FATESEALED,
FLIP_COIN, COIN_FLIPPED,
REPLACE_ROLLED_DIE, // for Clam-I-Am workaround only