[C13] Added Azorius Herald, Oloro, Ageless Ascetic and Kingming 'Sleeping Dragon'. Sime fixes to commander handling.

This commit is contained in:
LevelX2 2013-11-25 07:28:56 +01:00
parent a85f4a9848
commit 0ad2d040b1
18 changed files with 442 additions and 32 deletions

View file

@ -73,8 +73,11 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
sourceCard = game.getCard(ability.getSourceId());
break;
case COMMAND:
ability.newId();
this.put(ability.getId(), new AbilityView(ability, "Emblem", new CardView("Emblem")));
sourceCard = game.getCard(ability.getSourceId());
if (sourceCard == null) {
ability.newId();
this.put(ability.getId(), new AbilityView(ability, "Emblem", new CardView("Emblem")));
}
break;
}
if (sourceCard != null) {

View file

@ -0,0 +1,74 @@
/*
* 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.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.SacrificeSourceUnlessConditionEffect;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class AzoriusHerald extends CardImpl<AzoriusHerald> {
public AzoriusHerald(UUID ownerId) {
super(ownerId, 6, "Azorius Herald", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.expansionSetCode = "C13";
this.subtype.add("Spirit");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Azorius Herald can't be blocked.
this.addAbility(new UnblockableAbility());
// When Azorius Herald enters the battlefield, you gain 4 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(4)));
// When Azorius Herald enters the battlefield, sacrifice it unless {U} was spent to cast it.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessConditionEffect(new ManaWasSpentCondition(ColoredManaSymbol.U)), false));
}
public AzoriusHerald(final AzoriusHerald card) {
super(card);
}
@Override
public AzoriusHerald copy() {
return new AzoriusHerald(this);
}
}

View file

@ -0,0 +1,69 @@
/*
* 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.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
* @author LevelX2
*/
public class KongmingSleepingDragon extends CardImpl<KongmingSleepingDragon> {
public KongmingSleepingDragon(UUID ownerId) {
super(ownerId, 16, "Kongming, 'Sleeping Dragon'", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.expansionSetCode = "C13";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Advisor");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Other creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1,1,Duration.WhileOnBattlefield, true)));
}
public KongmingSleepingDragon(final KongmingSleepingDragon card) {
super(card);
}
@Override
public KongmingSleepingDragon copy() {
return new KongmingSleepingDragon(this);
}
}

View file

@ -0,0 +1,111 @@
/*
* 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.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUntapTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.GainLifeControllerTriggeredAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class OloroAgelessAscetic extends CardImpl<OloroAgelessAscetic> {
public OloroAgelessAscetic(UUID ownerId) {
super(ownerId, 203, "Oloro, Ageless Ascetic", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{3}{W}{U}{B}");
this.expansionSetCode = "C13";
this.supertype.add("Legendary");
this.subtype.add("Giant");
this.subtype.add("Soldier");
this.color.setBlue(true);
this.color.setBlack(true);
this.color.setWhite(true);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// At the beginning of your upkeep, you gain 2 life.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GainLifeEffect(2), TargetController.YOU, false));
// Whenever you gain life, you may pay {1}. If you do, draw a card and each opponent loses 1 life.
this.addAbility(new GainLifeControllerTriggeredAbility(new DoIfCostPaid(new OloroAgelessAsceticEffect(), new GenericManaCost(1)),false));
// At the beginning of your upkeep, if Oloro, Ageless Ascetic is in the command zone, you gain 2 life.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND,
new GainLifeEffect(new StaticValue(2), "if Oloro, Ageless Ascetic is in the command zone, you gain 2 life"),TargetController.YOU, false));
}
public OloroAgelessAscetic(final OloroAgelessAscetic card) {
super(card);
}
@Override
public OloroAgelessAscetic copy() {
return new OloroAgelessAscetic(this);
}
}
class OloroAgelessAsceticEffect extends OneShotEffect<OloroAgelessAsceticEffect> {
public OloroAgelessAsceticEffect() {
super(Outcome.Benefit);
this.staticText = "draw a card and each opponent loses 1 life";
}
public OloroAgelessAsceticEffect(final OloroAgelessAsceticEffect effect) {
super(effect);
}
@Override
public OloroAgelessAsceticEffect copy() {
return new OloroAgelessAsceticEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
new DrawCardControllerEffect(1).apply(game, source);
new DamagePlayersEffect(1, TargetController.OPPONENT).apply(game, source);
return false;
}
}

View file

@ -28,7 +28,6 @@
package mage.sets.commander2013;
import java.util.UUID;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.costs.common.PayVariableLifeCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.GetXValue;

View file

@ -0,0 +1,52 @@
/*
* 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.dissension;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class AzoriusHerald extends mage.sets.commander2013.AzoriusHerald {
public AzoriusHerald(UUID ownerId) {
super(ownerId);
this.cardNumber = 2;
this.expansionSetCode = "DIS";
}
public AzoriusHerald(final AzoriusHerald card) {
super(card);
}
@Override
public AzoriusHerald copy() {
return new AzoriusHerald(this);
}
}

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PreventAllDamageEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Outcome;
@ -61,10 +62,10 @@ public class BatwingBrume extends CardImpl<BatwingBrume> {
// Prevent all combat damage that would be dealt this turn if {W} was spent to cast Batwing Brume. Each player loses 1 life for each attacking creature he or she controls if {B} was spent to cast Batwing Brume.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new PreventAllDamageEffect(Duration.EndOfTurn, true),
new ManaWasSpentCondition(ManaType.WHITE), "Prevent all combat damage that would be dealt this turn if {W} was spent to cast {this}", true));
new ManaWasSpentCondition(ColoredManaSymbol.W), "Prevent all combat damage that would be dealt this turn if {W} was spent to cast {this}", true));
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new BatwingBrumeEffect(),
new ManaWasSpentCondition(ManaType.BLACK), "Each player loses 1 life for each attacking creature he or she controls if {B} was spent to cast {this}"));
new ManaWasSpentCondition(ColoredManaSymbol.W), "Each player loses 1 life for each attacking creature he or she controls if {B} was spent to cast {this}"));
this.addInfo("Info1", "<i>(Do both if {W}{B} was spent.)<i>");
}

View file

@ -33,6 +33,7 @@ import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity;
@ -55,10 +56,10 @@ public class CankerousThirst extends CardImpl<CankerousThirst> {
// If {B} was spent to cast Cankerous Thirst, you may have target creature get -3/-3 until end of turn. If {G} was spent to cast Cankerous Thirst, you may have target creature get +3/+3 until end of turn.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new BoostTargetEffect(-3, -3, Duration.EndOfTurn),
new ManaWasSpentCondition(ManaType.BLACK), "If {B} was spent to cast {this}, you may have target creature get -3/-3 until end of turn", true));
new ManaWasSpentCondition(ColoredManaSymbol.B), "If {B} was spent to cast {this}, you may have target creature get -3/-3 until end of turn", true));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new BoostTargetEffect(3, 3, Duration.EndOfTurn),
new ManaWasSpentCondition(ManaType.GREEN), "If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn", true));
new ManaWasSpentCondition(ColoredManaSymbol.G), "If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn", true));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.addInfo("Info1", "<i>(Do both if {B}{G} was spent.)<i>");
}

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.ManaType;
@ -64,10 +65,10 @@ public class InvertTheSkies extends CardImpl<InvertTheSkies> {
// Creatures your opponents control lose flying until end of turn if {G} was spent to cast Invert the Skies, and creatures you control gain flying until end of turn if {U} was spent to cast it.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new InvertTheSkiesEffect(),
new ManaWasSpentCondition(ManaType.GREEN), "Creatures your opponents control lose flying until end of turn if {G} was spent to cast {this},", true));
new ManaWasSpentCondition(ColoredManaSymbol.G), "Creatures your opponents control lose flying until end of turn if {G} was spent to cast {this},", true));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfTurn),
new ManaWasSpentCondition(ManaType.BLUE), "and creatures you control gain flying until end of turn if {U} was spent to cast it", true));
new ManaWasSpentCondition(ColoredManaSymbol.U), "and creatures you control gain flying until end of turn if {U} was spent to cast it", true));
this.addInfo("Info1", "<i>(Do both if {G}{U} was spent.)<i>");
}

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Outcome;
@ -64,10 +65,10 @@ public class Moonhold extends CardImpl<Moonhold> {
effect2.setText("and can't play creature cards this turn if {W} was spent to cast it.");
this.getSpellAbility().addEffect(new ConditionalReplacementEffect(
effect,
new ManaWasSpentCondition(ManaType.RED), false));
new ManaWasSpentCondition(ColoredManaSymbol.R), false));
this.getSpellAbility().addEffect(new ConditionalReplacementEffect(
effect2,
new ManaWasSpentCondition(ManaType.WHITE), false));
new ManaWasSpentCondition(ColoredManaSymbol.W), false));
this.getSpellAbility().addTarget(new TargetPlayer(true));
this.addInfo("Info1", "<i>(Do both if {R}{W} was spent.)</i>");
}

View file

@ -33,6 +33,7 @@ import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity;
@ -65,10 +66,10 @@ public class UnnervingAssault extends CardImpl<UnnervingAssault> {
// Creatures your opponents control get -1/-0 until end of turn if {U} was spent to cast Unnerving Assault, and creatures you control get +1/+0 until end of turn if {R} was spent to cast it.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new BoostAllEffect(-1, 0, Duration.EndOfTurn, filter, false),
new ManaWasSpentCondition(ManaType.BLUE), "Creatures your opponents control get -1/0 until end of turn if {U} was spent to cast {this},"));
new ManaWasSpentCondition(ColoredManaSymbol.U), "Creatures your opponents control get -1/0 until end of turn if {U} was spent to cast {this},"));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new BoostAllEffect(1, 0, Duration.EndOfTurn, filter2, false),
new ManaWasSpentCondition(ManaType.RED), " and creatures you control get +1/0 until end of turn if {R} was spent to cast it"));
new ManaWasSpentCondition(ColoredManaSymbol.R), " and creatures you control get +1/0 until end of turn if {R} was spent to cast it"));
this.addInfo("Info1", "<i>(Do both if {U}{R} was spent.)</i>");
}

View file

@ -37,6 +37,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.constants.ColoredManaSymbol;
import mage.constants.ManaType;
/**
@ -56,10 +57,10 @@ public class DawnglowInfusion extends CardImpl<DawnglowInfusion> {
DynamicValue xValue = new ManacostVariableValue();
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new GainLifeEffect(xValue),
new ManaWasSpentCondition(ManaType.GREEN), "You gain X life if {G} was spent to cast {this}"));
new ManaWasSpentCondition(ColoredManaSymbol.G), "You gain X life if {G} was spent to cast {this}"));
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new GainLifeEffect(xValue),
new ManaWasSpentCondition(ManaType.WHITE), " And X life if {W} was spent to cast it"));
new ManaWasSpentCondition(ColoredManaSymbol.W), " And X life if {W} was spent to cast it"));
this.addInfo("Info1", "<i>(Do both if {G}{W} was spent.)</i>");

View file

@ -36,6 +36,7 @@ import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.ColoredManaSymbol;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
@ -63,10 +64,10 @@ public class Firespout extends CardImpl<Firespout> {
// Firespout deals 3 damage to each creature without flying if {R} was spent to cast Firespout and 3 damage to each creature with flying if {G} was spent to cast it.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DamageAllEffect(3, filter1),
new ManaWasSpentCondition(ManaType.RED), "{this} deals 3 damage to each creature without flying if {R} was spent to cast {this}"));
new ManaWasSpentCondition(ColoredManaSymbol.R), "{this} deals 3 damage to each creature without flying if {R} was spent to cast {this}"));
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DamageAllEffect(3, filter2),
new ManaWasSpentCondition(ManaType.GREEN), " And 3 damage to each creature with flying if {G} was spent to cast it"));
new ManaWasSpentCondition(ColoredManaSymbol.G), " And 3 damage to each creature with flying if {G} was spent to cast it"));
this.addInfo("Info1", "<i>(Do both if {R}{G} was spent.)</i>");

View file

@ -52,6 +52,7 @@ import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.game.command.Emblem;
/**
@ -608,10 +609,15 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
@Override
public boolean isInUseableZone(Game game, MageObject source, boolean checkLKI) {
// emblem are always actual (also true for a commander? LevelX)
if (zone.equals(Zone.COMMAND)) {
return true;
if (this.getSourceId() == null) { // commander effects
return true;
}
MageObject object = game.getObject(this.getSourceId());
// emblem are always actual
if (object != null && object instanceof Emblem) {
return true;
}
}
// try LKI first

View file

@ -28,9 +28,9 @@
package mage.abilities.condition.common;
import mage.constants.ManaType;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.ColoredManaSymbol;
import mage.game.Game;
/**
@ -41,14 +41,20 @@ import mage.game.Game;
public class ManaWasSpentCondition implements Condition {
protected ManaType manaType;
protected ColoredManaSymbol coloredManaSymbol;
public ManaWasSpentCondition(ManaType manaType) {
this.manaType = manaType;
public ManaWasSpentCondition(ColoredManaSymbol coloredManaSymbol) {
this.coloredManaSymbol = coloredManaSymbol;
}
@Override
public boolean apply(Game game, Ability source) {
return (source.getManaCostsToPay().getPayment().get(manaType) > 0);
return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0);
}
@Override
public String toString() {
return new StringBuilder("{").append(coloredManaSymbol.toString()).append("} was spent to cast it").toString();
}
}

View file

@ -32,10 +32,8 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.VariableCost;
import mage.counters.CounterType;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
@ -65,11 +63,14 @@ public class PayVariableLifeCost extends CostImpl<PayVariableLifeCost> implement
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Player controller = game.getPlayer(controllerId);
this.amountPaid = controller.getAmount(0, controller.getLife(), "Choose X", game);
if (this.amountPaid> 0) {
controller.loseLife(amountPaid, game);
if (controller != null) {
this.amountPaid = controller.getAmount(0, controller.getLife(), "Choose X (life to pay)", game);
if (this.amountPaid> 0) {
controller.loseLife(amountPaid, game);
}
game.informPlayers(new StringBuilder(controller.getName()).append(" pays ").append(amountPaid).append(" life.").toString());
this.paid = true;
}
this.paid = true;
return paid;
}

View file

@ -0,0 +1,82 @@
/*
* 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.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.condition.Condition;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class SacrificeSourceUnlessConditionEffect extends OneShotEffect<SacrificeSourceUnlessConditionEffect> {
protected Condition condition;
public SacrificeSourceUnlessConditionEffect(Condition condition) {
super(Outcome.Sacrifice);
this.condition = condition;
}
public SacrificeSourceUnlessConditionEffect(final SacrificeSourceUnlessConditionEffect effect) {
super(effect);
this.condition = effect.condition;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) {
if (condition.apply(game, source)) {
return true;
}
permanent.sacrifice(source.getSourceId(), game);
return true;
}
return false;
}
@Override
public SacrificeSourceUnlessConditionEffect copy() {
return new SacrificeSourceUnlessConditionEffect(this);
}
@Override
public String getText(Mode mode) {
StringBuilder sb = new StringBuilder("sacrifice {this} unless ");
sb.append(condition.toString());
return sb.toString();
}
}

View file

@ -471,7 +471,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
removed = true;
break;
case COMMAND:
game.getState().getCommand().remove((Commander)game.getObject(objectId));
// command object (commander) is only on the stack, so no removing neccessary here
removed = true;
break;
case PICK: