diff --git a/Mage.Sets/src/mage/cards/c/ClaraOswald.java b/Mage.Sets/src/mage/cards/c/ClaraOswald.java new file mode 100644 index 00000000000..53b1863d768 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ClaraOswald.java @@ -0,0 +1,92 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.CommanderChooseColorAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.keyword.DoctorsCompanionAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.NumberOfTriggersEvent; +import mage.game.permanent.Permanent; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ClaraOswald extends CardImpl { + + public ClaraOswald(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(2); + this.toughness = new MageInt(6); + + // Impossible Girl -- If Clara Oswald is your commander, choose a color before the game begins. Clara Oswald is the chosen color. + this.addAbility(new CommanderChooseColorAbility().withFlavorWord("Impossible Girl")); + + // If a triggered ability of a Doctor you control triggers, that ability triggers an additional time. + this.addAbility(new SimpleStaticAbility(new ClaraOswaldEffect())); + + // Doctor's companion + this.addAbility(DoctorsCompanionAbility.getInstance()); + } + + private ClaraOswald(final ClaraOswald card) { + super(card); + } + + @Override + public ClaraOswald copy() { + return new ClaraOswald(this); + } +} + +class ClaraOswaldEffect extends ReplacementEffectImpl { + + ClaraOswaldEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "if a triggered ability of a Doctor you control triggers, " + + "that ability triggers an additional time"; + } + + private ClaraOswaldEffect(final ClaraOswaldEffect effect) { + super(effect); + } + + @Override + public ClaraOswaldEffect copy() { + return new ClaraOswaldEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (!(event instanceof NumberOfTriggersEvent)) { + return false; + } + Permanent permanent = game.getPermanent(((NumberOfTriggersEvent) event).getSourceId()); + return permanent != null + && permanent.isControlledBy(source.getControllerId()) + && permanent.hasSubtype(SubType.DOCTOR, game); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(CardUtil.overflowInc(event.getAmount(), 1)); + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/DoctorWho.java b/Mage.Sets/src/mage/sets/DoctorWho.java index aba33726694..1a05a09fce9 100644 --- a/Mage.Sets/src/mage/sets/DoctorWho.java +++ b/Mage.Sets/src/mage/sets/DoctorWho.java @@ -39,6 +39,7 @@ public final class DoctorWho extends ExpansionSet { cards.add(new SetCardInfo("Choked Estuary", 261, Rarity.RARE, mage.cards.c.ChokedEstuary.class)); cards.add(new SetCardInfo("Cinder Glade", 262, Rarity.RARE, mage.cards.c.CinderGlade.class)); cards.add(new SetCardInfo("City of Death", 99, Rarity.RARE, mage.cards.c.CityOfDeath.class)); + cards.add(new SetCardInfo("Clara Oswald", 9, Rarity.RARE, mage.cards.c.ClaraOswald.class)); cards.add(new SetCardInfo("Clockspinning", 215, Rarity.COMMON, mage.cards.c.Clockspinning.class)); cards.add(new SetCardInfo("Clockwork Droid", 172, Rarity.UNCOMMON, mage.cards.c.ClockworkDroid.class)); cards.add(new SetCardInfo("Command Tower", 263, Rarity.COMMON, mage.cards.c.CommandTower.class)); diff --git a/Mage/src/main/java/mage/abilities/common/CommanderChooseColorAbility.java b/Mage/src/main/java/mage/abilities/common/CommanderChooseColorAbility.java index 1063dfece4c..231aa9689ec 100644 --- a/Mage/src/main/java/mage/abilities/common/CommanderChooseColorAbility.java +++ b/Mage/src/main/java/mage/abilities/common/CommanderChooseColorAbility.java @@ -1,6 +1,7 @@ package mage.abilities.common; import mage.abilities.StaticAbility; +import mage.abilities.effects.common.InfoEffect; import mage.cards.Card; import mage.constants.Zone; @@ -10,7 +11,7 @@ import mage.constants.Zone; public class CommanderChooseColorAbility extends StaticAbility { public CommanderChooseColorAbility() { - super(Zone.ALL, null); + super(Zone.ALL, new InfoEffect("if {this} is your commander, choose a color before the game begins. {this} is the chosen color")); } private CommanderChooseColorAbility(final CommanderChooseColorAbility ability) { @@ -22,11 +23,6 @@ public class CommanderChooseColorAbility extends StaticAbility { return new CommanderChooseColorAbility(this); } - @Override - public String getRule() { - return "If {this} is your commander, choose a color before the game begins. {this} is the chosen color."; - } - public static boolean checkCard(Card card) { return card.getAbilities().stream().anyMatch(CommanderChooseColorAbility.class::isInstance); }