Implemented and test Ugin's Construct. TODO: refactor both construct's and Protean Hydra's prevention abilities to a generic ability

This commit is contained in:
antonig@sas.upenn.edu 2019-04-19 00:40:53 -04:00
parent 6e4ac3899b
commit 3fc9856f6f
3 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package mage.cards.u;
import java.util.UUID;
import mage.MageInt;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
import mage.abilities.common.SimpleStaticAbility;
import mage.counters.CounterType;
import mage.abilities.Ability;
import mage.abilities.effects.PreventionEffectImpl;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
* @author antoni-g
*/
public final class UginsConjurant extends CardImpl {
public UginsConjurant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}");
this.subtype.add(SubType.SPIRIT);
this.subtype.add(SubType.MONK);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Ugins Conjurant enters the battlefield with X +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance())));
// If damage would be dealt to Ugins Conjurant while it has a +1/+1 counter on it, prevent that damage and remove that many +1/+1 counters from Ugins Conjurant.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new UginsConjurantPrevention()));
}
private UginsConjurant(final UginsConjurant card) {
super(card);
}
@Override
public UginsConjurant copy() {
return new UginsConjurant(this);
}
static class UginsConjurantPrevention extends PreventionEffectImpl {
public UginsConjurantPrevention() {
super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, false, false);
staticText = "If damage would be dealt to {this}, prevent that damage and remove that many +1/+1 counters from it";
}
public UginsConjurantPrevention(final UginsConjurantPrevention effect) {
super(effect);
}
@Override
public UginsConjurantPrevention copy() {
return new UginsConjurantPrevention(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int damage = event.getAmount();
preventDamageAction(event, source, game);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); //MTG ruling Protean Hydra loses counters even if the damage isn't prevented
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getSourceId())) {
return true;
}
}
return false;
}
}
}

View file

@ -239,6 +239,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Topple the Statue", 35, Rarity.COMMON, mage.cards.t.ToppleTheStatue.class));
cards.add(new SetCardInfo("Totally Lost", 74, Rarity.COMMON, mage.cards.t.TotallyLost.class));
cards.add(new SetCardInfo("Turret Ogre", 148, Rarity.COMMON, mage.cards.t.TurretOgre.class));
cards.add(new SetCardInfo("Ugin's Conjurant", 3, Rarity.UNCOMMON, mage.cards.u.UginsConjurant.class));
cards.add(new SetCardInfo("Vivien's Arkbow", 181, Rarity.RARE, mage.cards.v.ViviensArkbow.class));
cards.add(new SetCardInfo("Vivien's Grizzly", 182, Rarity.COMMON, mage.cards.v.ViviensGrizzly.class));
cards.add(new SetCardInfo("Vivien, Champion of the Wilds", 180, Rarity.RARE, mage.cards.v.VivienChampionOfTheWilds.class));

View file

@ -34852,6 +34852,7 @@ The Haunt of Hightower|Ravnica Allegiance|273|M|{4}{B}{B}|Legendary Creature - V
Serra the Benevolent|Modern Horizons|26|M|{2}{W}{W}|Legendary Planeswalker - Serra|4|+2: Creatures you control with flying get +1/+1 until end of turn.$-3: Create a 4/4 white Angel creature token with flying and vigilance.$-6: You get an emblem with "If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead."|
Cabal Therapist|Modern Horizons|80|R|{B}|Creature - Horror|1|1|Menace$At the beginning of your precombat main phase, you may sacrifice a creature. When you do, choose a nonland card name, then target player reveals their hand and discards all cards with that name.|
Karn, the Great Creator|War of the Spark|1|R|{4}|Legendary Planeswalker - Karn|5|Activated abilities of artifacts your opponents control can't be activated.$+1: Until your next turn, up to one target noncreature artifact becomes an artifact creature with power and toughness each equal to its converted mana cost.$-2: You may choose an artifact card you own from outside the game or in exile, reveal that card, and put it into your hand.|
Ugin's Conjurant|War of the Spark|3|U|{X}|Creature - Spirit Monk|0|0|Ugins Conjurant enters the battlefield with X +1/+1 counters on it.$If damage would be dealt to Ugins Conjurant while it has a +1/+1 counter on it, prevent that damage and remove that many +1/+1 counters from Ugins Conjurant.|
Ajani's Pridemate|War of the Spark|4|U|{1}{W}|Creature - Cat Soldier|2|2|Whenever you gain life, put a +1/+1 counter on Ajani's Pridemate.|
Bond of Discipline|War of the Spark|6|U|{4}{W}|Sorcery|||Tap all creatures your opponents control. Creatures you control gain lifelink until end of turn.|
Bulwark Giant|War of the Spark|7|C|{5}{W}|Creature - Giant Soldier|3|6|When Bulwark Giant enters the battlefield, you gain 5 life.|