Sinister Concierge - improved text, card logic and game logs (#13312)

This commit is contained in:
padfoothelix 2025-02-09 00:43:43 +01:00 committed by GitHub
parent 57c1fc9ef2
commit 1774c2ec36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 102 additions and 19 deletions

View file

@ -4,7 +4,8 @@ import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.ExileSourceWithTimeCountersCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
@ -45,12 +46,15 @@ public class SinisterConcierge extends CardImpl {
// If you do, exile up to one target creature and put three time counters on it.
// Each card exiled this way that doesn't have suspend gains suspend.
// (For each card with suspend, its owner removes a time counter from it at the beginning of their upkeep.
// When the last is removed, they cast it without paying its mana cost. Those creature spells have haste.)
Ability ability = new DiesSourceTriggeredAbility(
// When the last is removed, they may cast it without paying its mana cost. Those creature spells have haste.)
Cost cost = new ExileSourceWithTimeCountersCost(3, false, true, Zone.GRAVEYARD);
// Paying the cost sends the Concierge to the right exile zone (Suspended cards of) and gives it suspend.
cost.setText("exile it and put three time counters on it");
Ability ability = new DiesSourceTriggeredAbility(
new DoIfCostPaid(
new SinisterConciergeEffect(),
new ExileSourceFromGraveCost()
).setText("you may exile it and put three time counters on it")
cost
)
);
ability.addTarget(new TargetCreaturePermanent(0, 1));
this.addAbility(ability);
@ -69,11 +73,10 @@ public class SinisterConcierge extends CardImpl {
class SinisterConciergeEffect extends OneShotEffect {
public SinisterConciergeEffect() {
super(Outcome.Removal);
this.staticText = "you may exile it and put three time counters on it. " +
"If you do, exile up to one target creature and put three time counters on it. " +
this.staticText = "exile up to one target creature and put three time counters on it. " +
"Each card exiled this way that doesn't have suspend gains suspend. " +
"<i>(For each card with suspend, its owner removes a time counter from it at the beginning of their upkeep. " +
"When the last is removed, they cast it without paying its mana cost. Those creature spells have haste.)</i>";
"When the last is removed, they may cast it without paying its mana cost. Those creature spells have haste.)</i>";
}
private SinisterConciergeEffect(final SinisterConciergeEffect effect) {
@ -88,23 +91,15 @@ class SinisterConciergeEffect extends OneShotEffect {
return false;
}
// Put the time counters on the Sinister Concierge and give it Suspend
if (game.getState().getZone(card.getId()) == Zone.EXILED) {
Effect addCountersSourceEffect = new AddCountersSourceEffect(CounterType.TIME.createInstance(), StaticValue.get(3), false ,true);
boolean sourceCardShouldGetSuspend = addCountersSourceEffect.apply(game, source);
if (sourceCardShouldGetSuspend && !card.getAbilities(game).containsClass(SuspendAbility.class)) {
game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source);
}
}
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (targetCreature == null){
return false;
}
// Exile, put time counters, and give suspend for target
Effect exileTarget = new ExileTargetEffect();
Player controllerTarget = game.getPlayer(targetCreature.getControllerId());
UUID exileId = SuspendAbility.getSuspendExileId(controllerTarget.getId(), game);
Effect exileTarget = new ExileTargetEffect(exileId, "Suspended cards of " + controllerTarget.getName());
exileTarget.setTargetPointer(this.getTargetPointer().copy());
if (exileTarget.apply(game, source)) {
Effect addCountersTargetEffect = new AddCountersTargetEffect(CounterType.TIME.createInstance(3));

View file

@ -0,0 +1,88 @@
package mage.abilities.costs.common;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.effects.common.continuous.GainSuspendEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.Card;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.MageObjectReference;
import mage.players.Player;
/**
* @author padfoot
*/
public class ExileSourceWithTimeCountersCost extends CostImpl {
private final int counters;
private final boolean checksSuspend;
private final boolean givesSuspend;
private final Zone fromZone;
public ExileSourceWithTimeCountersCost(int counters) {
this (counters, true, false, null);
}
public ExileSourceWithTimeCountersCost(int counters, boolean givesSuspend, boolean checksSuspend, Zone fromZone) {
this.counters = counters;
this.givesSuspend = givesSuspend;
this.checksSuspend = checksSuspend;
this.fromZone = fromZone;
this.text = "exile {this} " +
((fromZone != null) ? " from your " + fromZone.toString().toLowerCase(Locale.ENGLISH) : "") +
" and put " + counters + " time counters on it" +
(givesSuspend ? ". It gains suspend" : "") +
(checksSuspend ? ". If it doesn't have suspend, it gains suspend" : "");
}
private ExileSourceWithTimeCountersCost(final ExileSourceWithTimeCountersCost cost) {
super(cost);
this.counters = cost.counters;
this.givesSuspend = cost.givesSuspend;
this.checksSuspend = cost.checksSuspend;
this.fromZone = cost.fromZone;
}
@Override
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
Player controller = game.getPlayer(controllerId);
if (controller == null) {
return paid;
}
Card card = game.getCard(source.getSourceId());
boolean hasSuspend = card.getAbilities(game).containsClass(SuspendAbility.class);
if (card != null && (fromZone == null || fromZone == game.getState().getZone(source.getSourceId()))) {
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);
if (controller.moveCardsToExile(card, source, game, true, exileId, "Suspended cards of " + controller.getName())) {
card.addCounters(CounterType.TIME.createInstance(counters), controller.getId(), source, game);
game.informPlayers(controller.getLogName() + " exiles " + card.getLogName() + ((fromZone != null) ? " from their " + fromZone.toString().toLowerCase(Locale.ENGLISH) : "") + " with " + counters + " time counters on it.");
if (givesSuspend || (checksSuspend && !hasSuspend)) {
game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source);
}
}
// 117.11. The actions performed when paying a cost may be modified by effects.
// Even if they are, meaning the actions that are performed don't match the actions
// that are called for, the cost has still been paid.
// so return state here is not important because the user indended to exile the target anyway
paid = true;
}
return paid;
}
@Override
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
return (game.getCard(source.getSourceId()) != null && (fromZone == null || fromZone == game.getState().getZone(source.getSourceId())));
}
@Override
public ExileSourceWithTimeCountersCost copy() {
return new ExileSourceWithTimeCountersCost(this);
}
}