mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Charming Prince
This commit is contained in:
parent
09895e55f6
commit
fa9835db34
2 changed files with 114 additions and 0 deletions
113
Mage.Sets/src/mage/cards/c/CharmingPrince.java
Normal file
113
Mage.Sets/src/mage/cards/c/CharmingPrince.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.other.OwnerPredicate;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CharmingPrince extends CardImpl {
|
||||
|
||||
|
||||
private static final FilterPermanent filter = new FilterCreaturePermanent("another creature you own");
|
||||
|
||||
static {
|
||||
filter.add(new OwnerPredicate(TargetController.YOU));
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public CharmingPrince(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.NOBLE);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// When Charming Prince enters the battlefield, choose one —
|
||||
// • Scry 2.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ScryEffect(2));
|
||||
|
||||
// • You gain 3 life.
|
||||
ability.addMode(new Mode(new GainLifeEffect(3)));
|
||||
|
||||
// • Exile another target creature you own. Return it to the battlefield under your control at the beginning of the next end step.
|
||||
Mode mode = new Mode(new CharmingPrinceEffect());
|
||||
mode.addTarget(new TargetPermanent(filter));
|
||||
ability.addMode(mode);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private CharmingPrince(final CharmingPrince card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharmingPrince copy() {
|
||||
return new CharmingPrince(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CharmingPrinceEffect extends OneShotEffect {
|
||||
|
||||
CharmingPrinceEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Exile another target creature you own. " +
|
||||
"Return it to the battlefield under your control at the beginning of the next end step.";
|
||||
}
|
||||
|
||||
private CharmingPrinceEffect(final CharmingPrinceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharmingPrinceEffect copy() {
|
||||
return new CharmingPrinceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
||||
return false;
|
||||
}
|
||||
//create delayed triggered ability
|
||||
Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect();
|
||||
effect.setText("Return it to the battlefield under your control at the beginning of the next end step");
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId(), game));
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
|
@ -41,6 +41,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bramblefort Fink", 311, Rarity.UNCOMMON, mage.cards.b.BramblefortFink.class));
|
||||
cards.add(new SetCardInfo("Brimstone Trebuchet", 116, Rarity.COMMON, mage.cards.b.BrimstoneTrebuchet.class));
|
||||
cards.add(new SetCardInfo("Burning-Yard Trainer", 117, Rarity.UNCOMMON, mage.cards.b.BurningYardTrainer.class));
|
||||
cards.add(new SetCardInfo("Charming Prince", 335, Rarity.RARE, mage.cards.c.CharmingPrince.class));
|
||||
cards.add(new SetCardInfo("Chittering Witch", 319, Rarity.RARE, mage.cards.c.ChitteringWitch.class));
|
||||
cards.add(new SetCardInfo("Chulane, Teller of Tales", 326, Rarity.MYTHIC, mage.cards.c.ChulaneTellerOfTales.class));
|
||||
cards.add(new SetCardInfo("Clackbridge Troll", 84, Rarity.RARE, mage.cards.c.ClackbridgeTroll.class));
|
||||
|
|
Loading…
Reference in a new issue