[LTC] Implement Archivist of Gondor

This commit is contained in:
theelk801 2023-06-11 21:26:23 -04:00
parent c2ae74759d
commit cb283cdf82
4 changed files with 82 additions and 1 deletions

View file

@ -0,0 +1,63 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.BecomesMonarchSourceEffect;
import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CommanderPredicate;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ArchivistOfGondor extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(CommanderPredicate.instance);
filter.add(TargetController.YOU.getOwnerPredicate());
}
public ArchivistOfGondor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ADVISOR);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// When your commander deals combat damage to a player, if there is no monarch, you become the monarch.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new DealsDamageToAPlayerAllTriggeredAbility(
new BecomesMonarchSourceEffect(), filter, false,
SetTargetPointer.NONE, true
), (game, source) -> game.getMonarchId() == null, "When your commander " +
"deals combat damage to a player, if there is no monarch, you become the monarch."
));
// At the beginning of the monarch's end step, that player draws a card.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new DrawCardTargetEffect(1), TargetController.MONARCH, false
));
}
private ArchivistOfGondor(final ArchivistOfGondor card) {
super(card);
}
@Override
public ArchivistOfGondor copy() {
return new ArchivistOfGondor(this);
}
}

View file

@ -23,6 +23,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet {
cards.add(new SetCardInfo("Arbor Elf", 232, Rarity.COMMON, mage.cards.a.ArborElf.class));
cards.add(new SetCardInfo("Arcane Denial", 184, Rarity.COMMON, mage.cards.a.ArcaneDenial.class));
cards.add(new SetCardInfo("Arcane Signet", 273, Rarity.COMMON, mage.cards.a.ArcaneSignet.class));
cards.add(new SetCardInfo("Archivist of Gondor", 18, Rarity.RARE, mage.cards.a.ArchivistOfGondor.class));
cards.add(new SetCardInfo("Asceticism", 233, Rarity.RARE, mage.cards.a.Asceticism.class));
cards.add(new SetCardInfo("Ash Barrens", 295, Rarity.UNCOMMON, mage.cards.a.AshBarrens.class));
cards.add(new SetCardInfo("Banishing Light", 161, Rarity.UNCOMMON, mage.cards.b.BanishingLight.class));

View file

@ -92,6 +92,14 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
case MONARCH:
if (!event.getPlayerId().equals(game.getMonarchId())) {
break;
}
if (getTargets().isEmpty()) {
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
return false;
}
@ -120,6 +128,8 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
return "At the beginning of the end step of enchanted permanent's controller, " + generateConditionString();
case ENCHANTED:
return "At the beginning of enchanted player's end step, " + generateConditionString();
case MONARCH:
return "At the beginning the monarch's end step, " + generateConditionString();
}
return "";
}

View file

@ -26,7 +26,8 @@ public enum TargetController {
NEXT,
EACH_PLAYER,
ENCHANTED,
SOURCE_TARGETS;
SOURCE_TARGETS,
MONARCH;
private final OwnerPredicate ownerPredicate;
private final PlayerPredicate playerPredicate;
@ -79,6 +80,8 @@ public enum TargetController {
return permanent != null && input.getObject().isOwnedBy(permanent.getAttachedTo());
case SOURCE_TARGETS:
return card.isOwnedBy(input.getSource().getFirstTarget());
case MONARCH:
return card.isOwnedBy(game.getMonarchId());
case ANY:
return true;
default:
@ -118,6 +121,8 @@ public enum TargetController {
return !player.getId().equals(playerId);
case SOURCE_TARGETS:
return player.equals(input.getSource().getFirstTarget());
case MONARCH:
return player.getId().equals(game.getMonarchId());
default:
throw new UnsupportedOperationException("TargetController not supported");
}
@ -159,6 +164,8 @@ public enum TargetController {
return permanent != null && input.getObject().isControlledBy(permanent.getAttachedTo());
case SOURCE_TARGETS:
return object.isControlledBy(input.getSource().getFirstTarget());
case MONARCH:
return object.isControlledBy(game.getMonarchId());
case ANY:
return true;
default: