Skip to content

Commit

Permalink
[WHO] Implement Clara Oswald
Browse files Browse the repository at this point in the history
  • Loading branch information
theelk801 committed Oct 10, 2023
1 parent a497042 commit 09dbdcc
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 6 deletions.
92 changes: 92 additions & 0 deletions Mage.Sets/src/mage/cards/c/ClaraOswald.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/sets/DoctorWho.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private DoctorWho() {
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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -10,7 +11,7 @@
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) {
Expand All @@ -22,11 +23,6 @@ public CommanderChooseColorAbility copy() {
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);
}
Expand Down

0 comments on commit 09dbdcc

Please sign in to comment.