diff --git a/Mage.Sets/src/mage/cards/d/DulcetSirens.java b/Mage.Sets/src/mage/cards/d/DulcetSirens.java index 9e05e50512..376dd7dd06 100644 --- a/Mage.Sets/src/mage/cards/d/DulcetSirens.java +++ b/Mage.Sets/src/mage/cards/d/DulcetSirens.java @@ -1,47 +1,42 @@ - package mage.cards.d; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.RequirementEffect; +import mage.abilities.effects.common.combat.MustAttackOpponentWithCreatureTargetEffect; import mage.abilities.keyword.MorphAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetOpponent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class DulcetSirens extends CardImpl { public DulcetSirens(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); this.subtype.add(SubType.SIREN); this.power = new MageInt(1); this.toughness = new MageInt(3); // {U}, {T}: Target creature attacks target opponent this turn if able. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DulcetSirensForceAttackEffect(Duration.EndOfTurn), new ManaCostsImpl<>("{U}")); + Ability ability = new SimpleActivatedAbility( + new MustAttackOpponentWithCreatureTargetEffect(), new ManaCostsImpl<>("{U}") + ); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); - ability.addTarget(new TargetOpponent()); + ability.addTarget(new TargetOpponent()); this.addAbility(ability); - // Morph {U} this.addAbility(new MorphAbility(new ManaCostsImpl<>("{U}"))); } @@ -55,48 +50,3 @@ public final class DulcetSirens extends CardImpl { return new DulcetSirens(this); } } - -class DulcetSirensForceAttackEffect extends RequirementEffect { - - public DulcetSirensForceAttackEffect(Duration duration) { - super(duration); - staticText = "Target creature attacks target opponent this turn if able"; - } - - public DulcetSirensForceAttackEffect(final DulcetSirensForceAttackEffect effect) { - super(effect); - } - - @Override - public DulcetSirensForceAttackEffect copy() { - return new DulcetSirensForceAttackEffect(this); - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - if (this.getTargetPointer().getTargets(game, source).contains(permanent.getId())) { - return true; - } - return false; - } - - @Override - public boolean mustAttack(Game game) { - return true; - } - - @Override - public boolean mustBlock(Game game) { - return false; - } - - @Override - public UUID mustAttackDefender(Ability source, Game game) { - Target target = source.getTargets().get(1); - if (target != null) { - return target.getFirstTarget(); - } - return null; - } - -} diff --git a/Mage.Sets/src/mage/cards/r/Ravener.java b/Mage.Sets/src/mage/cards/r/Ravener.java new file mode 100644 index 0000000000..11a6e9617f --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/Ravener.java @@ -0,0 +1,51 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.combat.MustAttackOpponentWithCreatureTargetEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.RavenousAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.target.common.TargetCreaturePermanent; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Ravener extends CardImpl { + + public Ravener(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{G}{U}"); + + this.subtype.add(SubType.TYRANID); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Ravenous + this.addAbility(new RavenousAbility()); + + // When Ravener enters the battlefield, target creature attacks target opponent this turn if able. + Ability ability = new EntersBattlefieldTriggeredAbility(new MustAttackOpponentWithCreatureTargetEffect()); + ability.addTarget(new TargetCreaturePermanent()); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + private Ravener(final Ravener card) { + super(card); + } + + @Override + public Ravener copy() { + return new Ravener(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index d0cded40f5..6e4271038a 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -167,6 +167,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Primaris Eliminator", 50, Rarity.RARE, mage.cards.p.PrimarisEliminator.class)); cards.add(new SetCardInfo("Purestrain Genestealer", 97, Rarity.UNCOMMON, mage.cards.p.PurestrainGenestealer.class)); cards.add(new SetCardInfo("Rampant Growth", 220, Rarity.COMMON, mage.cards.r.RampantGrowth.class)); + cards.add(new SetCardInfo("Ravener", 138, Rarity.RARE, mage.cards.r.Ravener.class)); cards.add(new SetCardInfo("Reconnaissance Mission", 193, Rarity.UNCOMMON, mage.cards.r.ReconnaissanceMission.class)); cards.add(new SetCardInfo("Reliquary Tower", 291, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class)); cards.add(new SetCardInfo("Reverberate", 207, Rarity.RARE, mage.cards.r.Reverberate.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/MustAttackOpponentWithCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/MustAttackOpponentWithCreatureTargetEffect.java new file mode 100644 index 0000000000..7ff66b1c9f --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/MustAttackOpponentWithCreatureTargetEffect.java @@ -0,0 +1,51 @@ +package mage.abilities.effects.common.combat; + +import mage.abilities.Ability; +import mage.abilities.effects.RequirementEffect; +import mage.constants.Duration; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.Target; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public class MustAttackOpponentWithCreatureTargetEffect extends RequirementEffect { + + public MustAttackOpponentWithCreatureTargetEffect() { + super(Duration.EndOfTurn); + staticText = "target creature attacks target opponent this turn if able"; + } + + private MustAttackOpponentWithCreatureTargetEffect(final MustAttackOpponentWithCreatureTargetEffect effect) { + super(effect); + } + + @Override + public MustAttackOpponentWithCreatureTargetEffect copy() { + return new MustAttackOpponentWithCreatureTargetEffect(this); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return this.getTargetPointer().getTargets(game, source).contains(permanent.getId()); + } + + @Override + public boolean mustAttack(Game game) { + return true; + } + + @Override + public boolean mustBlock(Game game) { + return false; + } + + @Override + public UUID mustAttackDefender(Ability source, Game game) { + return Optional.ofNullable(source.getTargets().get(1)).map(Target::getFirstTarget).orElse(null); + } +}