Implemented Malignant Growth

This commit is contained in:
Evan Kranzler 2019-01-30 23:13:08 -05:00
parent 67d999e5b0
commit fab929bf76
2 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,85 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfDrawTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MalignantGrowth extends CardImpl {
public MalignantGrowth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}{U}");
// Cumulative upkeep {1}
this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl("{1}")));
// At the beginning of your upkeep, put a growth counter on Malignant Growth.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new AddCountersSourceEffect(CounterType.GROWTH.createInstance()),
TargetController.YOU, false
));
// At the beginning of each opponent's draw step, that player draws an additional card for each growth counter on Malignant Growth, then Malignant Growth deals damage to the player equal to the number of cards he or she drew this way.
this.addAbility(new BeginningOfDrawTriggeredAbility(
new MalignantGrowthEffect(), TargetController.OPPONENT, false
));
}
private MalignantGrowth(final MalignantGrowth card) {
super(card);
}
@Override
public MalignantGrowth copy() {
return new MalignantGrowth(this);
}
}
class MalignantGrowthEffect extends OneShotEffect {
MalignantGrowthEffect() {
super(Outcome.Benefit);
staticText = "that player draws an additional card for each growth counter on {this}, " +
"then {this} deals damage to the player equal to the number of cards they drew this way.";
}
private MalignantGrowthEffect(final MalignantGrowthEffect effect) {
super(effect);
}
@Override
public MalignantGrowthEffect copy() {
return new MalignantGrowthEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player == null || permanent == null) {
return false;
}
int counters = permanent.getCounters(game).getCount(CounterType.GROWTH);
if (counters == 0) {
return true;
}
return player.damage(player.drawCards(counters, game), source.getSourceId(), game) > 0;
}
}

View file

@ -184,6 +184,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Lion's Eye Diamond", 307, Rarity.RARE, mage.cards.l.LionsEyeDiamond.class));
cards.add(new SetCardInfo("Locust Swarm", 226, Rarity.UNCOMMON, mage.cards.l.LocustSwarm.class));
cards.add(new SetCardInfo("Lure of Prey", 227, Rarity.RARE, mage.cards.l.LureOfPrey.class));
cards.add(new SetCardInfo("Malignant Growth", 272, Rarity.RARE, mage.cards.m.MalignantGrowth.class));
cards.add(new SetCardInfo("Mana Prism", 308, Rarity.UNCOMMON, mage.cards.m.ManaPrism.class));
cards.add(new SetCardInfo("Mangara's Tome", 309, Rarity.RARE, mage.cards.m.MangarasTome.class));
cards.add(new SetCardInfo("Marble Diamond", 310, Rarity.UNCOMMON, mage.cards.m.MarbleDiamond.class));