[MID] Implemented Unblinking Observer

This commit is contained in:
Evan Kranzler 2021-09-12 15:54:48 -04:00
parent cf5fa8185c
commit 6afe6c968a
2 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.u;
import mage.ConditionalMana;
import mage.MageInt;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.Cost;
import mage.abilities.keyword.DisturbAbility;
import mage.abilities.mana.ConditionalColoredManaAbility;
import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.abilities.mana.conditional.ManaCondition;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.SubType;
import mage.game.Game;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class UnblinkingObserver extends CardImpl {
public UnblinkingObserver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.HOMUNCULUS);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// {T}: Add {U}. Spend this mana only to pay a disturb cost or cast an instant or sorcery spell.
this.addAbility(new ConditionalColoredManaAbility(
new Mana(ManaType.BLUE, 1), new UnblinkingObserverManaBuilder()
));
}
private UnblinkingObserver(final UnblinkingObserver card) {
super(card);
}
@Override
public UnblinkingObserver copy() {
return new UnblinkingObserver(this);
}
}
class UnblinkingObserverManaBuilder extends ConditionalManaBuilder {
@Override
public ConditionalMana build(Object... options) {
return new UnblinkingObserverConditionalMana(this.mana);
}
@Override
public String getRule() {
return "Spend this mana only to pay a disturb cost or cast an instant or sorcery spell.";
}
}
class UnblinkingObserverConditionalMana extends ConditionalMana {
UnblinkingObserverConditionalMana(Mana mana) {
super(mana);
staticText = "Spend this mana only to pay a disturb cost or cast an instant or sorcery spell.";
addCondition(new UnblinkingObserverManaCondition());
}
}
class UnblinkingObserverManaCondition extends ManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (source instanceof SpellAbility) {
MageObject object = game.getObject(source.getSourceId());
return object != null && object.isInstantOrSorcery(game);
}
return source instanceof DisturbAbility;
}
@Override
public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) {
return apply(game, source);
}
}

View file

@ -292,6 +292,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Tovolar's Packleader", 204, Rarity.RARE, mage.cards.t.TovolarsPackleader.class));
cards.add(new SetCardInfo("Triskaidekaphile", 81, Rarity.RARE, mage.cards.t.Triskaidekaphile.class));
cards.add(new SetCardInfo("Turn the Earth", 205, Rarity.UNCOMMON, mage.cards.t.TurnTheEarth.class));
cards.add(new SetCardInfo("Unblinking Observer", 82, Rarity.COMMON, mage.cards.u.UnblinkingObserver.class));
cards.add(new SetCardInfo("Unnatural Growth", 206, Rarity.RARE, mage.cards.u.UnnaturalGrowth.class));
cards.add(new SetCardInfo("Unruly Mob", 40, Rarity.COMMON, mage.cards.u.UnrulyMob.class));
cards.add(new SetCardInfo("Untamed Pup", 187, Rarity.UNCOMMON, mage.cards.u.UntamedPup.class));