mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* 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:
parent
c15719b36b
commit
185f56a7da
2 changed files with 16 additions and 12 deletions
|
@ -28,12 +28,12 @@
|
||||||
package mage.sets.visions;
|
package mage.sets.visions;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
@ -42,11 +42,11 @@ import mage.target.common.TargetCreatureOrPlayer;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class Fireblast extends CardImpl {
|
public class Fireblast extends CardImpl {
|
||||||
|
|
||||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Mountain");
|
private static final FilterControlledPermanent filter = new FilterControlledPermanent("two Mountains");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(new SubtypePredicate("Mountain"));
|
filter.add(new SubtypePredicate("Mountain"));
|
||||||
|
@ -56,7 +56,6 @@ public class Fireblast extends CardImpl {
|
||||||
super(ownerId, 79, "Fireblast", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{R}{R}");
|
super(ownerId, 79, "Fireblast", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{R}{R}");
|
||||||
this.expansionSetCode = "VIS";
|
this.expansionSetCode = "VIS";
|
||||||
|
|
||||||
|
|
||||||
// You may sacrifice two Mountains rather than pay Fireblast's mana cost.
|
// You may sacrifice two Mountains rather than pay Fireblast's mana cost.
|
||||||
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true))));
|
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true))));
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@ public class SacrificeTargetCost extends CostImpl {
|
||||||
public SacrificeTargetCost(TargetControlledPermanent target) {
|
public SacrificeTargetCost(TargetControlledPermanent target) {
|
||||||
this.addTarget(target);
|
this.addTarget(target);
|
||||||
target.setNotTarget(true); // sacrifice is never targeted
|
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)");
|
target.setTargetName(target.getTargetName() + " (to sacrifice)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,13 +103,16 @@ public class SacrificeTargetCost extends CostImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
int validTargets = 0;
|
int validTargets = 0;
|
||||||
|
int neededtargets = targets.get(0).getNumberOfTargets();
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(((TargetControlledPermanent) targets.get(0)).getFilter(), controllerId, game)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(((TargetControlledPermanent) targets.get(0)).getFilter(), controllerId, game)) {
|
||||||
if (game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) {
|
if (game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) {
|
||||||
validTargets++;
|
validTargets++;
|
||||||
|
if (validTargets >= neededtargets) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return validTargets > 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue