[WHO] Implement Clara Oswald

This commit is contained in:
theelk801 2023-10-10 15:17:45 -04:00
parent a49704296c
commit 09dbdccfb2
3 changed files with 95 additions and 6 deletions

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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);
}