diff --git a/Mage.Sets/src/mage/cards/j/Joust.java b/Mage.Sets/src/mage/cards/j/Joust.java new file mode 100644 index 00000000000..813bb56ac07 --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/Joust.java @@ -0,0 +1,88 @@ +package mage.cards.j; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Joust extends CardImpl { + + private static final FilterPermanent filter + = new FilterCreaturePermanent("creature you don't control"); + + static { + filter.add(new ControllerPredicate(TargetController.NOT_YOU)); + } + + public Joust(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}"); + + // Choose target creature you control and target creature you don't control. The creature you control gets +2/+1 until end of turn if it's a Knight. Then those creatures fight each other. + this.getSpellAbility().addEffect(new JoustEffect()); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + private Joust(final Joust card) { + super(card); + } + + @Override + public Joust copy() { + return new Joust(this); + } +} + +class JoustEffect extends OneShotEffect { + + JoustEffect() { + super(Outcome.Benefit); + staticText = "Choose target creature you control and target creature you don't control. " + + "The creature you control gets +2/+1 until end of turn if it's a Knight. " + + "Then those creatures fight each other."; + } + + private JoustEffect(final JoustEffect effect) { + super(effect); + } + + @Override + public JoustEffect copy() { + return new JoustEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget()); + Permanent creature2 = game.getPermanent(source.getTargets().get(0).getFirstTarget()); + if (creature1 == null) { + return false; + } + if (creature1.hasSubtype(SubType.KNIGHT, game)) { + ContinuousEffect effect = new BoostTargetEffect(2, 1, Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(creature1.getId(), game)); + game.addEffect(effect, source); + } + if (creature2 == null) { + return true; + } + game.applyEffects(); + return creature1.fight(creature2, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 39ada437efd..84b07947a68 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -66,6 +66,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Golden Egg", 220, Rarity.COMMON, mage.cards.g.GoldenEgg.class)); cards.add(new SetCardInfo("Heraldic Banner", 222, Rarity.UNCOMMON, mage.cards.h.HeraldicBanner.class)); cards.add(new SetCardInfo("Inspiring Veteran", 194, Rarity.UNCOMMON, mage.cards.i.InspiringVeteran.class)); + cards.add(new SetCardInfo("Joust", 129, Rarity.UNCOMMON, mage.cards.j.Joust.class)); cards.add(new SetCardInfo("Jousting Dummy", 224, Rarity.COMMON, mage.cards.j.JoustingDummy.class)); cards.add(new SetCardInfo("Keeper of Fables", 163, Rarity.UNCOMMON, mage.cards.k.KeeperOfFables.class)); cards.add(new SetCardInfo("Knights' Charge", 328, Rarity.RARE, mage.cards.k.KnightsCharge.class));