Implement Gloom Sower from Core 2021 (#6665)

* Implement Gloom Sower from Core 2021

* Remove unused imports
This commit is contained in:
arcox 2020-06-18 22:06:00 +00:00 committed by GitHub
parent c6e803a4e9
commit 096d44320d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,81 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author arcox
*/
public final class GloomSower extends CardImpl {
public GloomSower(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
this.subtype.add(SubType.HORROR);
this.power = new MageInt(8);
this.toughness = new MageInt(6);
// Whenever Gloom Sower becomes blocked by a creature, that creatures controller loses 2 life and you gain 2 life.
Ability ability = new BecomesBlockedByCreatureTriggeredAbility(new GloomSowerEffect(), false);
Effect effect = new GainLifeEffect(2);
effect.setText("and you gain 2 life");
ability.addEffect(effect);
this.addAbility(ability);
}
private GloomSower(final GloomSower card) {
super(card);
}
@Override
public GloomSower copy() {
return new GloomSower(this);
}
}
class GloomSowerEffect extends OneShotEffect {
GloomSowerEffect() {
super(Outcome.LoseLife);
staticText = "that creature's controller loses 2 life";
}
private GloomSowerEffect(final GloomSowerEffect effect) {
super(effect);
}
@Override
public GloomSowerEffect copy() {
return new GloomSowerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null) {
return false;
}
Player player = game.getPlayer(permanent.getControllerId());
if (player == null) {
return false;
}
player.loseLife(2, game, false);
return true;
}
}

View file

@ -120,6 +120,7 @@ public final class CoreSet2021 extends ExpansionSet {
cards.add(new SetCardInfo("Garruk, Savage Herald", 336, Rarity.MYTHIC, mage.cards.g.GarrukSavageHerald.class));
cards.add(new SetCardInfo("Garruk, Unleashed", 183, Rarity.MYTHIC, mage.cards.g.GarrukUnleashed.class));
cards.add(new SetCardInfo("Ghostly Pilferer", 52, Rarity.RARE, mage.cards.g.GhostlyPilferer.class));
cards.add(new SetCardInfo("Gloom Sower", 100, Rarity.COMMON, mage.cards.g.GloomSower.class));
cards.add(new SetCardInfo("Glorious Anthem", 21, Rarity.RARE, mage.cards.g.GloriousAnthem.class));
cards.add(new SetCardInfo("Goblin Arsonist", 147, Rarity.COMMON, mage.cards.g.GoblinArsonist.class));
cards.add(new SetCardInfo("Goblin Wizardry", 148, Rarity.COMMON, mage.cards.g.GoblinWizardry.class));