1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-10 17:00:08 -09:00

- Added requested card Retraced Image.

This commit is contained in:
Jeff 2019-03-08 10:55:12 -06:00
parent ba407dcdae
commit fe4c595227
2 changed files with 250 additions and 168 deletions
Mage.Sets/src/mage

View file

@ -0,0 +1,81 @@
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author jeffwadsworth
*/
public final class RetracedImage extends CardImpl {
public RetracedImage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}");
// Reveal a card in your hand, then put that card onto the battlefield if it has the same name as a permanent.
this.getSpellAbility().addEffect(new RetracedImageEffect());
}
private RetracedImage(final RetracedImage card) {
super(card);
}
@Override
public RetracedImage copy() {
return new RetracedImage(this);
}
}
class RetracedImageEffect extends OneShotEffect {
public RetracedImageEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "Reveal a card in your hand, then put that card onto the battlefield if it has the same name as a permanent";
}
public RetracedImageEffect(final RetracedImageEffect effect) {
super(effect);
}
@Override
public RetracedImageEffect copy() {
return new RetracedImageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCardInHand target = new TargetCardInHand();
if (target.canChoose(controller.getId(), game)
&& controller.choose(outcome, target, source.getSourceId(), game)) {
Card chosenCard = game.getCard(target.getFirstTarget());
if (chosenCard != null) {
Cards cards = new CardsImpl();
cards.add(chosenCard);
controller.revealCards(source, cards, game);
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
if (permanent.getName().equals(chosenCard.getName())) {
return controller.moveCards(chosenCard, Zone.BATTLEFIELD, source, game);
}
}
}
}
}
return false;
}
}

View file

@ -136,6 +136,7 @@ public final class Torment extends ExpansionSet {
cards.add(new SetCardInfo("Rancid Earth", 78, Rarity.COMMON, mage.cards.r.RancidEarth.class));
cards.add(new SetCardInfo("Reborn Hero", 14, Rarity.RARE, mage.cards.r.RebornHero.class));
cards.add(new SetCardInfo("Restless Dreams", 79, Rarity.COMMON, mage.cards.r.RestlessDreams.class));
cards.add(new SetCardInfo("Retraced Image", 46, Rarity.RARE, mage.cards.r.RetracedImage.class));
cards.add(new SetCardInfo("Sengir Vampire", 80, Rarity.RARE, mage.cards.s.SengirVampire.class));
cards.add(new SetCardInfo("Seton's Scout", 138, Rarity.UNCOMMON, mage.cards.s.SetonsScout.class));
cards.add(new SetCardInfo("Shade's Form", 81, Rarity.COMMON, mage.cards.s.ShadesForm.class));