Implemented Fiendish Duo

This commit is contained in:
Evan Kranzler 2019-10-12 11:31:58 -04:00
parent 2fb9153608
commit 6f600c0a50
2 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.f;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FiendishDuo extends CardImpl {
public FiendishDuo(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
this.subtype.add(SubType.DEVIL);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// If a source would deal damage to an opponent, it deals double that damage that player instead.
this.addAbility(new SimpleStaticAbility(new FiendishDuoEffect()));
}
private FiendishDuo(final FiendishDuo card) {
super(card);
}
@Override
public FiendishDuo copy() {
return new FiendishDuo(this);
}
}
class FiendishDuoEffect extends ReplacementEffectImpl {
FiendishDuoEffect() {
super(Duration.WhileOnBattlefield, Outcome.Damage);
staticText = "If a source would deal damage to an opponent, " +
"it deals double that damage to that player instead";
}
private FiendishDuoEffect(final FiendishDuoEffect effect) {
super(effect);
}
@Override
public FiendishDuoEffect copy() {
return new FiendishDuoEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
return player != null && player.hasOpponent(event.getTargetId(), game);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(CardUtil.addWithOverflowCheck(event.getAmount(), event.getAmount()));
return false;
}
}

View file

@ -20,6 +20,7 @@ public final class GameNight2019 extends ExpansionSet {
this.hasBasicLands = false; // TODO: change when spoiled
cards.add(new SetCardInfo("Earthshaker Giant", 5, Rarity.MYTHIC, mage.cards.e.EarthshakerGiant.class));
cards.add(new SetCardInfo("Fiendish Duo", 4, Rarity.MYTHIC, mage.cards.f.FiendishDuo.class));
cards.add(new SetCardInfo("Highcliff Felidar", 1, Rarity.MYTHIC, mage.cards.h.HighcliffFelidar.class));
cards.add(new SetCardInfo("Sphinx of Enlightenment", 2, Rarity.MYTHIC, mage.cards.s.SphinxOfEnlightenment.class));
}