diff --git a/Mage.Sets/src/mage/cards/d/DelinaWildMage.java b/Mage.Sets/src/mage/cards/d/DelinaWildMage.java new file mode 100644 index 00000000000..93e2ef4e026 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DelinaWildMage.java @@ -0,0 +1,97 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.EndOfCombatTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.abilities.effects.common.ExileSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DelinaWildMage extends CardImpl { + + public DelinaWildMage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.SHAMAN); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Whenever Delina, Wild Mage attacks, choose target creature you control, then roll a d20. + // 1-14 | Create a tapped and attacking token that's a copy of that creature except it's not legendary and it has "Exile this creature at end of combat." + // 15-20 | Create one of those tokens. You may roll again. + Ability ability = new AttacksTriggeredAbility(new DelinaWildMageEffect()); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + } + + private DelinaWildMage(final DelinaWildMage card) { + super(card); + } + + @Override + public DelinaWildMage copy() { + return new DelinaWildMage(this); + } +} + +class DelinaWildMageEffect extends OneShotEffect { + + DelinaWildMageEffect() { + super(Outcome.Benefit); + staticText = "choose target creature you control, then roll a d20." + + "
1-14 | Create a tapped and attacking token that's a copy of that creature " + + "except it's not legendary and it has \"Exile this creature at end of combat.\"" + + "
15-20 | Create one of those tokens. You may roll again."; + } + + private DelinaWildMageEffect(final DelinaWildMageEffect effect) { + super(effect); + } + + @Override + public DelinaWildMageEffect copy() { + return new DelinaWildMageEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect( + source.getControllerId(), null, + false, 1, true, true + ); + effect.setIsntLegendary(true); + effect.addAdditionalAbilities(new EndOfCombatTriggeredAbility( + new ExileSourceEffect(), false, "Exile this creature at end of combat." + )); + effect.setTargetPointer(getTargetPointer()); + while (true) { + int result = player.rollDice(source, game, 20); + effect.apply(game, source); + if (result < 15 || 20 < result || !player.chooseUse(outcome, "Roll again?", source, game)) { + break; + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 1da60107d77..fd5a0b957a5 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -65,6 +65,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Dawnbringer Cleric", 9, Rarity.COMMON, mage.cards.d.DawnbringerCleric.class)); cards.add(new SetCardInfo("Deadly Dispute", 94, Rarity.COMMON, mage.cards.d.DeadlyDispute.class)); cards.add(new SetCardInfo("Death-Priest of Myrkul", 95, Rarity.UNCOMMON, mage.cards.d.DeathPriestOfMyrkul.class)); + cards.add(new SetCardInfo("Delina, Wild Mage", 138, Rarity.RARE, mage.cards.d.DelinaWildMage.class)); cards.add(new SetCardInfo("Delver's Torch", 10, Rarity.COMMON, mage.cards.d.DelversTorch.class)); cards.add(new SetCardInfo("Demogorgon's Clutches", 96, Rarity.UNCOMMON, mage.cards.d.DemogorgonsClutches.class)); cards.add(new SetCardInfo("Den of the Bugbear", 254, Rarity.RARE, mage.cards.d.DenOfTheBugbear.class)); diff --git a/Mage/src/main/java/mage/abilities/common/EndOfCombatTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EndOfCombatTriggeredAbility.java index 27aad8c6185..4c06840bd2f 100644 --- a/Mage/src/main/java/mage/abilities/common/EndOfCombatTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EndOfCombatTriggeredAbility.java @@ -7,17 +7,24 @@ import mage.game.Game; import mage.game.events.GameEvent; /** - * * @author LevelX2 */ public class EndOfCombatTriggeredAbility extends TriggeredAbilityImpl { + private final String rule; + public EndOfCombatTriggeredAbility(Effect effect, boolean optional) { + this(effect, optional, null); + } + + public EndOfCombatTriggeredAbility(Effect effect, boolean optional, String rule) { super(Zone.BATTLEFIELD, effect, optional); + this.rule = rule; } public EndOfCombatTriggeredAbility(final EndOfCombatTriggeredAbility ability) { super(ability); + this.rule = ability.rule; } @Override @@ -37,6 +44,14 @@ public class EndOfCombatTriggeredAbility extends TriggeredAbilityImpl { @Override public String getTriggerPhrase() { - return "At end of combat, " ; + return "At end of combat, "; + } + + @Override + public String getRule() { + if (rule != null) { + return rule; + } + return super.getRule(); } }