* Fireblast - Fixed that a wrong text was shown for the land sacrifice. Also that the spell was wrongly marked as castable also if only one mountain was on the battlefield.

This commit is contained in:
LevelX2 2016-06-20 16:23:03 +02:00
parent c15719b36b
commit 185f56a7da
2 changed files with 16 additions and 12 deletions

View file

@ -28,12 +28,12 @@
package mage.sets.visions;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent;
@ -42,12 +42,12 @@ import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author jeffwadsworth
*
*/
public class Fireblast extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Mountain");
private static final FilterControlledPermanent filter = new FilterControlledPermanent("two Mountains");
static {
filter.add(new SubtypePredicate("Mountain"));
}
@ -56,14 +56,13 @@ public class Fireblast extends CardImpl {
super(ownerId, 79, "Fireblast", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{R}{R}");
this.expansionSetCode = "VIS";
// You may sacrifice two Mountains rather than pay Fireblast's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true))));
// Fireblast deals 4 damage to target creature or player.
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
}
public Fireblast(final Fireblast card) {

View file

@ -51,7 +51,9 @@ public class SacrificeTargetCost extends CostImpl {
public SacrificeTargetCost(TargetControlledPermanent target) {
this.addTarget(target);
target.setNotTarget(true); // sacrifice is never targeted
this.text = "sacrifice " + (target.getTargetName().startsWith("an") || target.getTargetName().startsWith("a ") ? "" : "a ") + target.getTargetName();
this.text = "sacrifice "
+ ((target.getNumberOfTargets() != 1 || (target.getTargetName().startsWith("an") || target.getTargetName().startsWith("a ")))
? "" : "a ") + target.getTargetName();
target.setTargetName(target.getTargetName() + " (to sacrifice)");
}
@ -101,13 +103,16 @@ public class SacrificeTargetCost extends CostImpl {
}
int validTargets = 0;
int neededtargets = targets.get(0).getNumberOfTargets();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(((TargetControlledPermanent) targets.get(0)).getFilter(), controllerId, game)) {
if (game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) {
validTargets++;
if (validTargets >= neededtargets) {
return true;
}
}
}
return validTargets > 0;
return false;
}
@Override