Added Vedalken Archmage, some minor formating and code cleanup.

This commit is contained in:
LevelX2 2014-07-23 23:59:51 +02:00
parent c335b71564
commit c17be6c3ab
4 changed files with 122 additions and 31 deletions

View file

@ -49,6 +49,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
/**
*
@ -82,7 +83,7 @@ public class IsochronScepter extends CardImpl {
class IsochronScepterImprintEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("card with converted mana cost 2 or less from your hand");
private static final FilterCard filter = new FilterCard("instant card with converted mana cost 2 or less from your hand");
static {
filter.add(new CardTypePredicate(CardType.INSTANT));
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 3));
@ -99,24 +100,28 @@ class IsochronScepterImprintEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player.getHand().size() > 0) {
TargetCard target = new TargetCard(Zone.HAND, filter);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& player.choose(Outcome.Benefit, player.getHand(), target, game)) {
Card card = player.getHand().get(target.getFirstTarget(), game);
if (card != null) {
card.moveToExile(source.getSourceId(), "Isochron Scepter (Imprint)", source.getSourceId(), game);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.imprint(card.getId(), game);
permanent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(card.getName()).append("]").toString());
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null) {
if (controller.getHand().size() > 0) {
TargetCard target = new TargetCard(Zone.HAND, filter);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.choose(Outcome.Benefit, controller.getHand(), target, game)) {
Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) {
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getLogName() +" (Imprint)", source.getSourceId(), game, Zone.HAND);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.imprint(card.getId(), game);
permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"));
}
}
return true;
}
}
return true;
}
return true;
return false;
}
@Override
@ -144,25 +149,25 @@ class IsochronScepterCopyEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent scepter = game.getPermanent(source.getSourceId());
if (scepter == null) {
scepter = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
}
if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) {
Card imprintedInstant = game.getCard(scepter.getImprinted().get(0));
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append("?").toString(), game)) {
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());
if (copiedCard != null) {
game.getExile().add(source.getSourceId(), "",copiedCard);
game.getState().setZone(copiedCard.getId(), Zone.EXILED);
if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", game)) {
return controller.cast(copiedCard.getSpellAbility(), game, true);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent scepter = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) {
Card imprintedInstant = game.getCard(scepter.getImprinted().get(0));
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) {
if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append("?").toString(), game)) {
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());
if (copiedCard != null) {
game.getExile().add(source.getSourceId(), "",copiedCard);
game.getState().setZone(copiedCard.getId(), Zone.EXILED);
if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", game)) {
controller.cast(copiedCard.getSpellAbility(), game, true);
}
}
}
}
}
return true;
}
return false;
}

View file

@ -0,0 +1,75 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mirrodin;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterSpell;
import mage.filter.common.FilterArtifactCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
/**
*
* @author LevelX2
*/
public class VedalkenArchmage extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public VedalkenArchmage(UUID ownerId) {
super(ownerId, 55, "Vedalken Archmage", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
this.expansionSetCode = "MRD";
this.subtype.add("Vedalken");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(0);
this.toughness = new MageInt(2);
// Whenever you cast an artifact spell, draw a card.
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filter, false));
}
public VedalkenArchmage(final VedalkenArchmage card) {
super(card);
}
@Override
public VedalkenArchmage copy() {
return new VedalkenArchmage(this);
}
}

View file

@ -52,6 +52,7 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
@ -103,7 +104,7 @@ class CagedSunEffect1 extends OneShotEffect {
if (player.choose(Outcome.BoostCreature, colorChoice, game)) {
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
permanent.addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + colorChoice.getColor().getDescription()));
}
}
return false;

View file

@ -504,4 +504,14 @@ public class CardUtil {
}
return false;
}
/**
* Adds tags to mark the additional info of a card
* (e.g. blue font color)
* @param text text body
* @return
*/
public static String addToolTipMarkTags(String text) {
return "<font color = 'blue'>" + text + "</font>";
}
}