Some changes to SacrificeOpponent effect.

This commit is contained in:
LevelX2 2013-09-13 14:11:07 +02:00
parent 2cea0215a2
commit f7af238919
4 changed files with 19 additions and 13 deletions

View file

@ -32,7 +32,7 @@ import mage.abilities.effects.common.SacrificeOpponentsEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterLandPermanent;
/**
*
@ -47,7 +47,7 @@ public class YawningFissure extends CardImpl<YawningFissure> {
this.color.setRed(true);
// Each opponent sacrifices a land.
this.getSpellAbility().addEffect(new SacrificeOpponentsEffect(new FilterControlledLandPermanent()));
this.getSpellAbility().addEffect(new SacrificeOpponentsEffect(new FilterLandPermanent()));
}
public YawningFissure(final YawningFissure card) {

View file

@ -36,7 +36,6 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
@ -65,7 +64,7 @@ public class ButcherOfMalakir extends CardImpl<ButcherOfMalakir> {
this.addAbility(FlyingAbility.getInstance());
// Whenever Butcher of Malakir or another creature you control dies, each opponent sacrifices a creature.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new SacrificeOpponentsEffect(new FilterControlledCreaturePermanent()), false, filter));
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new SacrificeOpponentsEffect(new FilterCreaturePermanent()), false, filter));
}
public ButcherOfMalakir(final ButcherOfMalakir card) {

View file

@ -122,8 +122,10 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(preText);
if (preText.endsWith("player") || preText.endsWith("opponent")) {
if (preText != null) {
sb.append(preText);
}
if (preText != null && (preText.endsWith("player") || preText.endsWith("opponent"))) {
sb.append(" sacrifices ");
} else {
sb.append(" sacrifice ");

View file

@ -36,7 +36,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -52,16 +52,16 @@ import mage.util.CardUtil;
public class SacrificeOpponentsEffect extends OneShotEffect<SacrificeOpponentsEffect> {
protected DynamicValue amount;
protected FilterControlledPermanent filter;
protected FilterPermanent filter;
public SacrificeOpponentsEffect(FilterControlledPermanent filter) {
public SacrificeOpponentsEffect(FilterPermanent filter) {
this(1, filter);
}
public SacrificeOpponentsEffect(int amount, FilterControlledPermanent filter) {
public SacrificeOpponentsEffect(int amount, FilterPermanent filter) {
this(new StaticValue(amount), filter);
}
public SacrificeOpponentsEffect(DynamicValue amount, FilterControlledPermanent filter) {
public SacrificeOpponentsEffect(DynamicValue amount, FilterPermanent filter) {
super(Outcome.Sacrifice);
this.amount = amount;
this.filter = filter;
@ -108,10 +108,15 @@ public class SacrificeOpponentsEffect extends OneShotEffect<SacrificeOpponentsEf
StringBuilder sb = new StringBuilder();
sb.append("Each opponent sacrifices ");
if (amount.toString().equals("X")) {
sb.append(amount.toString()).append(" ");
sb.append(amount.toString());
} else {
sb.append(CardUtil.numberToText(amount.toString()));
if (amount.toString().equals("1")) {
sb.append("a");
} else {
sb.append(CardUtil.numberToText(amount.toString()));
}
}
sb.append(" ");
sb.append(filter.getMessage());
staticText = sb.toString();
}