mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[AFR] Implemented True Polymorph
This commit is contained in:
parent
ace3a8be86
commit
3fe9524e3f
2 changed files with 92 additions and 0 deletions
91
Mage.Sets/src/mage/cards/t/TruePolymorph.java
Normal file
91
Mage.Sets/src/mage/cards/t/TruePolymorph.java
Normal file
|
@ -0,0 +1,91 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.other.AnotherTargetPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TruePolymorph extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifact or creature");
|
||||
private static final FilterPermanent filter2;
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
));
|
||||
filter2 = filter.copy();
|
||||
filter.add(new AnotherTargetPredicate(1));
|
||||
filter2.add(new AnotherTargetPredicate(2));
|
||||
}
|
||||
|
||||
public TruePolymorph(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}{U}");
|
||||
|
||||
// Target artifact or creature becomes a copy of another target artifact or creature.
|
||||
this.getSpellAbility().addEffect(new TruePolymorphEffect());
|
||||
Target target = new TargetPermanent(filter);
|
||||
target.setTargetTag(1);
|
||||
this.getSpellAbility().addTarget(target.withChooseHint("becomes a copy"));
|
||||
target = new TargetPermanent(filter2);
|
||||
target.setTargetTag(2);
|
||||
this.getSpellAbility().addTarget(target.withChooseHint("to copy"));
|
||||
}
|
||||
|
||||
private TruePolymorph(final TruePolymorph card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TruePolymorph copy() {
|
||||
return new TruePolymorph(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TruePolymorphEffect extends OneShotEffect {
|
||||
|
||||
TruePolymorphEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "target artifact or creature becomes a copy of another target artifact or creature";
|
||||
}
|
||||
|
||||
private TruePolymorphEffect(final TruePolymorphEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TruePolymorphEffect copy() {
|
||||
return new TruePolymorphEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent copyTo = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (copyTo == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent copyFrom = game.getPermanentOrLKIBattlefield(source.getTargets().get(1).getFirstTarget());
|
||||
if (copyFrom == null) {
|
||||
return false;
|
||||
}
|
||||
game.copyPermanent(Duration.Custom, copyFrom, copyTo.getId(), source, new EmptyCopyApplier());
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -198,6 +198,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Treasure Vault", 261, Rarity.RARE, mage.cards.t.TreasureVault.class));
|
||||
cards.add(new SetCardInfo("Trelasarra, Moon Dancer", 236, Rarity.UNCOMMON, mage.cards.t.TrelasarraMoonDancer.class));
|
||||
cards.add(new SetCardInfo("Triumphant Adventurer", 237, Rarity.RARE, mage.cards.t.TriumphantAdventurer.class));
|
||||
cards.add(new SetCardInfo("True Polymorph", 80, Rarity.RARE, mage.cards.t.TruePolymorph.class));
|
||||
cards.add(new SetCardInfo("Underdark Basilisk", 208, Rarity.COMMON, mage.cards.u.UnderdarkBasilisk.class));
|
||||
cards.add(new SetCardInfo("Unexpected Windfall", 164, Rarity.COMMON, mage.cards.u.UnexpectedWindfall.class));
|
||||
cards.add(new SetCardInfo("Valor Singer", 165, Rarity.COMMON, mage.cards.v.ValorSinger.class));
|
||||
|
|
Loading…
Reference in a new issue