diff --git a/Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java b/Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java new file mode 100644 index 00000000000..e707e31a309 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java @@ -0,0 +1,85 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PutOnLibraryTargetEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.effects.common.RollDieWithResultTableEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetOpponentsCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PowerOfPersuasion extends CardImpl { + + public PowerOfPersuasion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}"); + + // Choose target creature an opponent controls, then roll a d20. + RollDieWithResultTableEffect effect = new RollDieWithResultTableEffect( + 20, "choose target creature an opponent controls, then roll a d20" + ); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetOpponentsCreaturePermanent()); + + // 1-9 | Return it to its owner's hand. + effect.addTableEntry(1, 9, new ReturnToHandTargetEffect().setText("return it to its owner's hand")); + + // 10-19 | Its owner puts it on the top of bottom of their library. + effect.addTableEntry(10, 19, new PowerOfPersuasionEffect()); + + // 20 | Gain control of it until the end of your next turn. + effect.addTableEntry(20, 20, new GainControlTargetEffect( + Duration.UntilEndOfYourNextTurn, true + ).setText("gain control of it until the end of your next turn")); + } + + private PowerOfPersuasion(final PowerOfPersuasion card) { + super(card); + } + + @Override + public PowerOfPersuasion copy() { + return new PowerOfPersuasion(this); + } +} + +class PowerOfPersuasionEffect extends OneShotEffect { + + PowerOfPersuasionEffect() { + super(Outcome.Benefit); + staticText = "its owner puts it on the top of bottom of their library"; + } + + private PowerOfPersuasionEffect(final PowerOfPersuasionEffect effect) { + super(effect); + } + + @Override + public PowerOfPersuasionEffect copy() { + return new PowerOfPersuasionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(game.getOwnerId(source.getFirstTarget())); + if (player == null) { + return false; + } + if (player.chooseUse(Outcome.Detriment, "Put the targeted object on the top or bottom of your library?", + "", "Top", "Bottom", source, game)) { + return new PutOnLibraryTargetEffect(true).apply(game, source); + } + return new PutOnLibraryTargetEffect(false).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index f913f1e1d7b..15ac7a43aac 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -164,6 +164,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Portable Hole", 33, Rarity.UNCOMMON, mage.cards.p.PortableHole.class)); cards.add(new SetCardInfo("Potion of Healing", 34, Rarity.COMMON, mage.cards.p.PotionOfHealing.class)); cards.add(new SetCardInfo("Power Word Kill", 114, Rarity.UNCOMMON, mage.cards.p.PowerWordKill.class)); + cards.add(new SetCardInfo("Power of Persuasion", 67, Rarity.UNCOMMON, mage.cards.p.PowerOfPersuasion.class)); cards.add(new SetCardInfo("Precipitous Drop", 115, Rarity.COMMON, mage.cards.p.PrecipitousDrop.class)); cards.add(new SetCardInfo("Price of Loyalty", 159, Rarity.COMMON, mage.cards.p.PriceOfLoyalty.class)); cards.add(new SetCardInfo("Priest of Ancient Lore", 35, Rarity.COMMON, mage.cards.p.PriestOfAncientLore.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/RollDieWithResultTableEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RollDieWithResultTableEffect.java index 91ae661d6db..cb566ca6a74 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RollDieWithResultTableEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RollDieWithResultTableEffect.java @@ -79,15 +79,12 @@ public class RollDieWithResultTableEffect extends OneShotEffect { sb.append(prefixText).append('.'); for (TableEntry tableEntry : this.resultsTable) { sb.append("
"); - if (tableEntry.min == tableEntry.max) { - sb.append(tableEntry.max); - sb.append(' '); - } else { + if (tableEntry.min != tableEntry.max) { sb.append(tableEntry.min); sb.append('-'); - sb.append(tableEntry.max); - sb.append(" | "); } + sb.append(tableEntry.max); + sb.append(" | "); sb.append(CardUtil.getTextWithFirstCharUpperCase(tableEntry.effects.getText(mode))); } return sb.toString();