[MKM] Implement Teysa, Opulent Oligarch

This commit is contained in:
Susucre 2024-01-28 17:08:05 +01:00
parent 9b4c274e57
commit 25a08c736f
2 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,124 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.ZoneChangeAllTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.keyword.InvestigateEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.token.WhiteBlackSpiritToken;
import mage.players.Player;
import mage.watchers.common.PlayerLostLifeWatcher;
import java.util.UUID;
/**
* @author Susucr
*/
public final class TeysaOpulentOligarch extends CardImpl {
private static final Hint hint = new ValueHint("Opponents who lost life this turn", TeysaOpulentOligarchDynamicValue.instance);
private static final FilterPermanent filterClue = new FilterPermanent();
static {
filterClue.add(TargetController.YOU.getControllerPredicate());
filterClue.add(SubType.CLUE.getPredicate());
}
public TeysaOpulentOligarch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{B}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ADVISOR);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Deathtouch
this.addAbility(DeathtouchAbility.getInstance());
// At the beginning of your end step, investigate for each opponent who lost life this turn.
this.addAbility(
new BeginningOfEndStepTriggeredAbility(
new InvestigateEffect(TeysaOpulentOligarchDynamicValue.instance),
TargetController.YOU,
false
).addHint(hint)
);
// Whenever a Clue you control is put into a graveyard from the battlefield, create a 1/1 white and black Spirit creature token with flying. This ability triggers only once each turn.
TriggeredAbility trigger = new ZoneChangeAllTriggeredAbility(
Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.GRAVEYARD,
new CreateTokenEffect(new WhiteBlackSpiritToken()),
filterClue,
"Whenever a Clue you control is put into a graveyard from the battlefield, ",
false
);
trigger.setTriggersOnceEachTurn(true);
this.addAbility(trigger);
}
private TeysaOpulentOligarch(final TeysaOpulentOligarch card) {
super(card);
}
@Override
public TeysaOpulentOligarch copy() {
return new TeysaOpulentOligarch(this);
}
}
/**
* derived from {@link mage.cards.s.StrefanMaurerProgenitor}
*/
enum TeysaOpulentOligarchDynamicValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller == null) {
return 0;
}
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
int numOpponentsWhoLostLife = 0;
if (watcher != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
if (controller.hasOpponent(playerId, game) && watcher.getLifeLost(playerId) > 0) {
numOpponentsWhoLostLife++;
}
}
}
return numOpponentsWhoLostLife;
}
@Override
public DynamicValue copy() {
return instance;
}
@Override
public String getMessage() {
return "opponents who lost life this turn";
}
@Override
public String toString() {
return "1";
}
}

View file

@ -190,6 +190,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
cards.add(new SetCardInfo("Surveillance Monitor", 73, Rarity.UNCOMMON, mage.cards.s.SurveillanceMonitor.class));
cards.add(new SetCardInfo("Suspicious Detonation", 145, Rarity.COMMON, mage.cards.s.SuspiciousDetonation.class));
cards.add(new SetCardInfo("Swamp", 274, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Teysa, Opulent Oligarch", 234, Rarity.RARE, mage.cards.t.TeysaOpulentOligarch.class));
cards.add(new SetCardInfo("The Chase Is On", 116, Rarity.COMMON, mage.cards.t.TheChaseIsOn.class));
cards.add(new SetCardInfo("They Went This Way", 178, Rarity.COMMON, mage.cards.t.TheyWentThisWay.class));
cards.add(new SetCardInfo("Thinking Cap", 257, Rarity.COMMON, mage.cards.t.ThinkingCap.class));