mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Added Vedalken Archmage, some minor formating and code cleanup.
This commit is contained in:
parent
c335b71564
commit
c17be6c3ab
4 changed files with 122 additions and 31 deletions
|
@ -49,6 +49,7 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -82,7 +83,7 @@ public class IsochronScepter extends CardImpl {
|
||||||
|
|
||||||
class IsochronScepterImprintEffect extends OneShotEffect {
|
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 {
|
static {
|
||||||
filter.add(new CardTypePredicate(CardType.INSTANT));
|
filter.add(new CardTypePredicate(CardType.INSTANT));
|
||||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 3));
|
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 3));
|
||||||
|
@ -99,24 +100,28 @@ class IsochronScepterImprintEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player.getHand().size() > 0) {
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
TargetCard target = new TargetCard(Zone.HAND, filter);
|
if (controller != null) {
|
||||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
|
if (controller.getHand().size() > 0) {
|
||||||
&& player.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
TargetCard target = new TargetCard(Zone.HAND, filter);
|
||||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
|
||||||
if (card != null) {
|
&& controller.choose(Outcome.Benefit, controller.getHand(), target, game)) {
|
||||||
card.moveToExile(source.getSourceId(), "Isochron Scepter (Imprint)", source.getSourceId(), game);
|
Card card = controller.getHand().get(target.getFirstTarget(), game);
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
if (card != null) {
|
||||||
if (permanent != null) {
|
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getLogName() +" (Imprint)", source.getSourceId(), game, Zone.HAND);
|
||||||
permanent.imprint(card.getId(), game);
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
permanent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(card.getName()).append("]").toString());
|
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
|
@Override
|
||||||
|
@ -144,25 +149,25 @@ class IsochronScepterCopyEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent scepter = game.getPermanent(source.getSourceId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (scepter == null) {
|
if (controller != null) {
|
||||||
scepter = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
Permanent scepter = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
}
|
if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) {
|
||||||
if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) {
|
Card imprintedInstant = game.getCard(scepter.getImprinted().get(0));
|
||||||
Card imprintedInstant = game.getCard(scepter.getImprinted().get(0));
|
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) {
|
||||||
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)) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());
|
||||||
if (controller != null && controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append("?").toString(), game)) {
|
if (copiedCard != null) {
|
||||||
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());
|
game.getExile().add(source.getSourceId(), "",copiedCard);
|
||||||
if (copiedCard != null) {
|
game.getState().setZone(copiedCard.getId(), Zone.EXILED);
|
||||||
game.getExile().add(source.getSourceId(), "",copiedCard);
|
if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", game)) {
|
||||||
game.getState().setZone(copiedCard.getId(), Zone.EXILED);
|
controller.cast(copiedCard.getSpellAbility(), game, true);
|
||||||
if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", game)) {
|
}
|
||||||
return controller.cast(copiedCard.getSpellAbility(), game, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
75
Mage.Sets/src/mage/sets/mirrodin/VedalkenArchmage.java
Normal file
75
Mage.Sets/src/mage/sets/mirrodin/VedalkenArchmage.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -52,6 +52,7 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -103,7 +104,7 @@ class CagedSunEffect1 extends OneShotEffect {
|
||||||
if (player.choose(Outcome.BoostCreature, colorChoice, game)) {
|
if (player.choose(Outcome.BoostCreature, colorChoice, game)) {
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
|
||||||
game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
|
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;
|
return false;
|
||||||
|
|
|
@ -504,4 +504,14 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
return false;
|
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>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue