From b254b9528da7b40fe599ab3b1cc00746a592d8a8 Mon Sep 17 00:00:00 2001 From: padfoothelix Date: Sat, 29 Mar 2025 02:52:15 +0100 Subject: [PATCH] [WHO] Implement The Second Doctor (#13435) --- .../src/mage/cards/t/TheSecondDoctor.java | 141 ++++++++++++++++++ Mage.Sets/src/mage/sets/DoctorWho.java | 14 +- 2 files changed, 148 insertions(+), 7 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/t/TheSecondDoctor.java diff --git a/Mage.Sets/src/mage/cards/t/TheSecondDoctor.java b/Mage.Sets/src/mage/cards/t/TheSecondDoctor.java new file mode 100644 index 00000000000..3553ed8bf51 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheSecondDoctor.java @@ -0,0 +1,141 @@ +package mage.cards.t; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author padfoothelix + */ +public final class TheSecondDoctor extends CardImpl { + + public TheSecondDoctor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.TIME_LORD); + this.subtype.add(SubType.DOCTOR); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Players have no maximum hand size. + this.addAbility(new SimpleStaticAbility(new MaximumHandSizeControllerEffect( + Integer.MAX_VALUE, Duration.WhileOnBattlefield, + MaximumHandSizeControllerEffect.HandSizeModification.SET, TargetController.ANY + ))); + + // How Civil of You -- At the beginning of your end step, each player may draw a card. Each opponent who does can't attack you or permanents you control during their next turn. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new TheSecondDoctorEffect()).withFlavorWord("How Civil of You")); + } + + private TheSecondDoctor(final TheSecondDoctor card) { + super(card); + } + + @Override + public TheSecondDoctor copy() { + return new TheSecondDoctor(this); + } +} + +class TheSecondDoctorEffect extends OneShotEffect { + TheSecondDoctorEffect() { + super(Outcome.Benefit); + this.staticText = "each player may draw a card. Each opponent who does can't attack you or permanents you control during their next turn."; + } + + private TheSecondDoctorEffect(final TheSecondDoctorEffect effect) { + super(effect); + } + + @Override + public TheSecondDoctorEffect copy() { + return new TheSecondDoctorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null + && player.chooseUse(Outcome.DrawCard, "Draw a card ?", source, game) + && player.drawCards(1, source, game) > 0 + && game.getOpponents(controller.getId()).contains(playerId)) { + RestrictionEffect effect = new TheSecondDoctorCantAttackEffect(player.getId()); + game.addEffect(effect, source); + } + } + return true; + } +} + +class TheSecondDoctorCantAttackEffect extends RestrictionEffect { + + private final UUID opponentId; + + public TheSecondDoctorCantAttackEffect(UUID opponentId) { + super(Duration.UntilEndOfYourNextTurn); + this.opponentId = opponentId; + staticText = ""; + } + + private TheSecondDoctorCantAttackEffect(final TheSecondDoctorCantAttackEffect effect) { + super(effect); + this.opponentId = effect.opponentId; + } + + @Override + public TheSecondDoctorCantAttackEffect copy() { + return new TheSecondDoctorCantAttackEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + if (opponentId != null) { + setStartingControllerAndTurnNum(game, opponentId, game.getActivePlayerId()); + } else { + discard(); + } + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return game.isActivePlayer(opponentId); + } + + @Override + public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) { + UUID controllerId = source.getControllerId(); + // defender is null + if (defenderId == null) { + return true; + } + // defender is a permanent + Permanent defender = game.getPermanent(defenderId); + if (defender != null) { + return !defender.isControlledBy(controllerId); + } + // defender is a player + return !defenderId.equals(controllerId); + } +} diff --git a/Mage.Sets/src/mage/sets/DoctorWho.java b/Mage.Sets/src/mage/sets/DoctorWho.java index b70357f6180..c0009b9bb88 100644 --- a/Mage.Sets/src/mage/sets/DoctorWho.java +++ b/Mage.Sets/src/mage/sets/DoctorWho.java @@ -1010,13 +1010,13 @@ public final class DoctorWho extends ExpansionSet { cards.add(new SetCardInfo("The Rani", 754, Rarity.RARE, mage.cards.t.TheRani.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("The Sea Devils", 108, Rarity.RARE, mage.cards.t.TheSeaDevils.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("The Sea Devils", 713, Rarity.RARE, mage.cards.t.TheSeaDevils.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("The Second Doctor", "553z", Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("The Second Doctor", 1031, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("The Second Doctor", 1144, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("The Second Doctor", 156, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("The Second Doctor", 440, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("The Second Doctor", 553, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("The Second Doctor", 761, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Second Doctor", "553z", Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Second Doctor", 1031, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Second Doctor", 1144, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Second Doctor", 156, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Second Doctor", 440, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Second Doctor", 553, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Second Doctor", 761, Rarity.RARE, mage.cards.t.TheSecondDoctor.class, NON_FULL_USE_VARIOUS)); //cards.add(new SetCardInfo("The Seventh Doctor", "558z", Rarity.RARE, mage.cards.t.TheSeventhDoctor.class, NON_FULL_USE_VARIOUS)); //cards.add(new SetCardInfo("The Seventh Doctor", 1033, Rarity.RARE, mage.cards.t.TheSeventhDoctor.class, NON_FULL_USE_VARIOUS)); //cards.add(new SetCardInfo("The Seventh Doctor", 1149, Rarity.RARE, mage.cards.t.TheSeventhDoctor.class, NON_FULL_USE_VARIOUS));