[40K] Implement Plague Drone (#9685)

This commit is contained in:
PurpleCrowbar 2022-10-29 03:06:56 +01:00 committed by GitHub
parent 129d900401
commit a2b54310e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class PlagueDrone extends CardImpl {
public PlagueDrone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.DEMON);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Rot Fly If an opponent would gain life, that player loses that much life instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlagueDroneReplacementEffect()).withFlavorWord("Rot Fly"));
}
private PlagueDrone(final PlagueDrone card) {
super(card);
}
@Override
public PlagueDrone copy() {
return new PlagueDrone(this);
}
}
class PlagueDroneReplacementEffect extends ReplacementEffectImpl {
public PlagueDroneReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "If an opponent would gain life, that player loses that much life instead";
}
public PlagueDroneReplacementEffect(final PlagueDroneReplacementEffect effect) {
super(effect);
}
@Override
public PlagueDroneReplacementEffect copy() {
return new PlagueDroneReplacementEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.GAIN_LIFE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
return controller.hasOpponent(event.getPlayerId(), game);
}
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
opponent.loseLife(event.getAmount(), game, source, false);
}
return true;
}
}

View file

@ -192,6 +192,7 @@ public final class Warhammer40000 extends ExpansionSet {
cards.add(new SetCardInfo("Past in Flames", 206, Rarity.MYTHIC, mage.cards.p.PastInFlames.class));
cards.add(new SetCardInfo("Path of Ancestry", 287, Rarity.COMMON, mage.cards.p.PathOfAncestry.class));
cards.add(new SetCardInfo("Pink Horror", 136, Rarity.RARE, mage.cards.p.PinkHorror.class));
cards.add(new SetCardInfo("Plague Drone", 47, Rarity.RARE, mage.cards.p.PlagueDrone.class));
cards.add(new SetCardInfo("Plains", 306, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plasmancer", 48, Rarity.UNCOMMON, mage.cards.p.Plasmancer.class));
cards.add(new SetCardInfo("Polluted Mire", 288, Rarity.COMMON, mage.cards.p.PollutedMire.class));