fixed some ability cost issues - mainly affects AI's

This commit is contained in:
BetaSteward 2011-11-22 10:59:13 -05:00
parent b975d98bf5
commit 1627f81953
19 changed files with 69 additions and 78 deletions

View file

@ -34,7 +34,7 @@ import mage.Constants.Rarity;
import mage.MageInt;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.mana.BasicManaAbility;
import mage.cards.CardImpl;
@ -56,7 +56,7 @@ public class KnotvineMystic extends CardImpl<KnotvineMystic>{
this.power = new MageInt(2);
this.toughness = new MageInt(2);
Ability ability = new KnotvineMysticManaAbility();
ability.addCost(new ManaCostsImpl("{1}"));
ability.addManaCost(new GenericManaCost(1));
this.addAbility(ability);
}

View file

@ -89,7 +89,7 @@ public class HearthcageGiant extends CardImpl<HearthcageGiant> {
class RedElementalToken extends Token {
RedElementalToken() {
super("Elemental", "3/1 red Elemental Shaman creature token");
super("Elemental Shaman", "3/1 red Elemental Shaman creature token");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Elemental");

View file

@ -53,10 +53,10 @@ public class BrittleEffigy extends CardImpl<BrittleEffigy> {
super(ownerId, 202, "Brittle Effigy", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "M11";
Costs costs = new CostsImpl();
costs.add(new GenericManaCost(4));
costs.add(new TapSourceCost());
costs.add(new ExileSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(), costs);
ability.addManaCost(new GenericManaCost(4));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -32,9 +32,8 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.ScryEffect;
@ -49,10 +48,9 @@ public class CrystalBall extends CardImpl<CrystalBall> {
public CrystalBall(UUID ownerId) {
super(ownerId, 203, "Crystal Ball", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "M11";
Costs costs = new CostsImpl();
costs.add(new GenericManaCost(1));
costs.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(2), costs));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(2), new TapSourceCost());
ability.addManaCost(new GenericManaCost(1));
this.addAbility(ability);
}
public CrystalBall(final CrystalBall card) {

View file

@ -35,12 +35,9 @@ import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -55,10 +52,8 @@ public class ElixirOfImmortality extends CardImpl<ElixirOfImmortality> {
public ElixirOfImmortality(UUID ownerId) {
super(ownerId, 206, "Elixir of Immortality", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "M11";
Costs costs = new CostsImpl();
costs.add(new GenericManaCost(2));
costs.add(new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ElixerOfImmortalityEffect(), costs);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ElixerOfImmortalityEffect(), new TapSourceCost());
ability.addManaCost(new GenericManaCost(2));
this.addAbility(ability);
}

View file

@ -35,9 +35,6 @@ import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DamageTargetEffect;
@ -58,10 +55,8 @@ public class EmberHauler extends CardImpl<EmberHauler> {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
Costs<Cost> costs = new CostsImpl();
costs.add(new GenericManaCost(1));
costs.add(new SacrificeSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), costs);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new SacrificeSourceCost());
ability.addManaCost(new GenericManaCost(1));
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);
}

View file

@ -64,10 +64,10 @@ public class FaunaShaman extends CardImpl<FaunaShaman> {
this.toughness = new MageInt(2);
Costs<Cost> costs = new CostsImpl();
costs.add(new ColoredManaCost(ColoredManaSymbol.G));
costs.add(new TapSourceCost());
costs.add(new DiscardTargetCost(new TargetCardInHand(new FilterCreatureCard())));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryRevealPutInHandEffect(new TargetCardInLibrary(new FilterCreatureCard())), costs);
ability.addManaCost(new ColoredManaCost(ColoredManaSymbol.G));
this.addAbility(ability);
}

View file

@ -35,12 +35,9 @@ import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ScryEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -55,10 +52,9 @@ public class SorcerersStrongbox extends CardImpl<SorcerersStrongbox> {
public SorcerersStrongbox(UUID ownerId) {
super(ownerId, 213, "Sorcerer's Strongbox", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{4}");
this.expansionSetCode = "M11";
Costs costs = new CostsImpl();
costs.add(new GenericManaCost(2));
costs.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SorcerersStrongboxEffect(), costs));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SorcerersStrongboxEffect(), new TapSourceCost());
ability.addManaCost(new GenericManaCost(2));
this.addAbility(ability);
}
public SorcerersStrongbox(final SorcerersStrongbox card) {

View file

@ -60,10 +60,8 @@ public class VoltaicKey extends CardImpl<VoltaicKey> {
public VoltaicKey(UUID ownerId) {
super(ownerId, 219, "Voltaic Key", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "M11";
Costs costs = new CostsImpl();
costs.add(new GenericManaCost(1));
costs.add(new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), costs);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new TapSourceCost());
ability.addManaCost(new GenericManaCost(1));
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}

View file

@ -40,8 +40,6 @@ import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersCount;
@ -64,9 +62,7 @@ public class ChimericMass extends CardImpl<ChimericMass> {
super(ownerId, 141, "Chimeric Mass", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{X}");
this.expansionSetCode = "SOM";
this.addAbility(new EntersBattlefieldAbility(new ChimericMassEffect(), "{this} enters the battlefield with X charge counters on it"));
Costs costs = new CostsImpl();
costs.add(new GenericManaCost(1));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericMassToken(), "", Duration.EndOfTurn), costs));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericMassToken(), "", Duration.EndOfTurn), new GenericManaCost(1)));
}
public ChimericMass(final ChimericMass card) {

View file

@ -95,7 +95,7 @@ class MyrBattlesphereAbility extends TriggeredAbilityImpl<MyrBattlesphereAbility
public MyrBattlesphereAbility() {
super(Zone.BATTLEFIELD, new BoostSourceEffect(new GetXValue(), new StaticValue(0), Duration.EndOfTurn), true);
this.addEffect(new MyrBattlesphereEffect());
this.addCost(new TapVariableTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false)));
this.addCost(new TapVariableTargetCost(new TargetControlledCreaturePermanent(1, Integer.MAX_VALUE, filter, false)));
}
public MyrBattlesphereAbility(final MyrBattlesphereAbility ability) {
@ -106,7 +106,9 @@ class MyrBattlesphereAbility extends TriggeredAbilityImpl<MyrBattlesphereAbility
public boolean checkInterveningIfClause(Game game) {
if (costs.isPaid())
return true;
if (costs.canPay(this.getId(), this.getControllerId(), game))
return costs.pay(this, game, this.getId(), this.getControllerId(), false);
return false;
}
@Override

View file

@ -120,10 +120,12 @@ class PainfulQuandryEffect extends OneShotEffect<PainfulQuandryEffect> {
Player player = game.getPlayer(targetPointer.getFirst(source));
if (player != null) {
Cost cost = new DiscardTargetCost(new TargetCardInHand());
if (cost.canPay(player.getId(), player.getId(), game)) {
if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
player.loseLife(5, game);
}
return true;
}
}
return false;
}

View file

@ -49,6 +49,7 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
import mage.abilities.costs.mana.GenericManaCost;
/**
*
@ -63,20 +64,19 @@ public class TrigonOfCorruption extends CardImpl<TrigonOfCorruption> {
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
Costs costs = new CostsImpl();
costs.add(new ManaCostsImpl("{2}"));
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
costs.add(new TapSourceCost());
Effect putCounterEffect = new AddCountersTargetEffect(CounterType.M1M1.createInstance());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, putCounterEffect, costs);
ability.addManaCost(new GenericManaCost(2));
Target target = new TargetCreaturePermanent();
target.setRequired(true);
ability.addTarget(target);
this.addAbility(ability);
Costs costs2 = new CostsImpl();
costs2.add(new ManaCostsImpl("{B}{B}"));
costs2.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), costs2));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl("{B}{B}"));
this.addAbility(ability2);
}
public TrigonOfCorruption (final TrigonOfCorruption card) {

View file

@ -46,6 +46,8 @@ import mage.counters.common.ChargeCounter;
import mage.game.permanent.token.InsectInfectToken;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.GenericManaCost;
/**
* @author nantuko
@ -61,15 +63,15 @@ public class TrigonOfInfestation extends CardImpl<TrigonOfInfestation> {
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
Costs costs = new CostsImpl();
costs.add(new ManaCostsImpl("{2}"));
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
costs.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(insectToken), costs));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(insectToken), costs);
ability.addManaCost(new GenericManaCost(2));
this.addAbility(ability);
Costs costs2 = new CostsImpl();
costs2.add(new ManaCostsImpl("{G}{G}"));
costs2.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), costs2));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl("{G}{G}"));
this.addAbility(ability2);
}
public TrigonOfInfestation(final TrigonOfInfestation card) {

View file

@ -45,6 +45,8 @@ import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.GenericManaCost;
/**
* @author nantuko
@ -58,15 +60,15 @@ public class TrigonOfMending extends CardImpl<TrigonOfMending> {
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
Costs costs = new CostsImpl();
costs.add(new ManaCostsImpl("{2}"));
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
costs.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), costs));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), costs);
ability.addManaCost(new GenericManaCost(2));
this.addAbility(ability);
Costs costs2 = new CostsImpl();
costs2.add(new ManaCostsImpl("{W}{W}"));
costs2.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), costs2));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl("{W}{W}"));
this.addAbility(ability2);
}
public TrigonOfMending(final TrigonOfMending card) {

View file

@ -50,6 +50,7 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
import mage.abilities.costs.mana.GenericManaCost;
/**
* @author Loki
@ -63,20 +64,19 @@ public class TrigonOfRage extends CardImpl<TrigonOfRage> {
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
Costs costs = new CostsImpl();
costs.add(new ManaCostsImpl("{2}"));
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
costs.add(new TapSourceCost());
Effect pumpEffect = new BoostTargetEffect(3, 0, Duration.EndOfTurn);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, pumpEffect, costs);
ability.addManaCost(new GenericManaCost(2));
Target target = new TargetCreaturePermanent();
target.setRequired(true);
ability.addTarget(target);
this.addAbility(ability);
Costs costs2 = new CostsImpl();
costs2.add(new ManaCostsImpl("{R}{R}"));
costs2.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), costs2));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl("{R}{R}"));
this.addAbility(ability2);
}
public TrigonOfRage(final TrigonOfRage card) {

View file

@ -45,6 +45,8 @@ import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.GenericManaCost;
/**
* @author nantuko
@ -58,15 +60,15 @@ public class TrigonOfThought extends CardImpl<TrigonOfThought> {
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
Costs costs = new CostsImpl();
costs.add(new ManaCostsImpl("{2}"));
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
costs.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), costs));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), costs);
ability.addManaCost(new GenericManaCost(2));
this.addAbility(ability);
Costs costs2 = new CostsImpl();
costs2.add(new ManaCostsImpl("{U}{U}"));
costs2.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), costs2));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl("{U}{U}"));
this.addAbility(ability2);
}
public TrigonOfThought(final TrigonOfThought card) {

View file

@ -68,7 +68,7 @@ public class TapVariableTargetCost extends CostImpl<TapVariableTargetCost> imple
amountPaid = 0;
while (true) {
target.clearChosen();
if (target.choose(Outcome.Tap, controllerId, sourceId, game)) {
if (target.canChoose(sourceId, controllerId, game) && target.choose(Outcome.Tap, controllerId, sourceId, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null && permanent.tap(game)) {
amountPaid++;

View file

@ -60,10 +60,13 @@ public class SetCardColorAttachedEffect extends ContinuousEffectImpl<SetCardColo
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent target = game.getPermanent(equipment.getAttachedTo());
if (target != null) {
target.getColor().setColor(setColor);
}
return true;
}
}
return false;
}
@Override
public SetCardColorAttachedEffect copy() {