fix Vendetta, refactoring

This commit is contained in:
Loki 2011-10-15 13:52:27 +03:00
parent 5fbb8b1053
commit 260dada5f7
7 changed files with 23 additions and 21 deletions

View file

@ -31,7 +31,7 @@ package mage.sets.alarareborn;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.DestroyNoRegenTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -48,7 +48,7 @@ public class Terminate extends CardImpl<Terminate> {
this.color.setBlack(true);
this.color.setRed(true);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new DestroyNoRegenTargetEffect());
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
}
public Terminate(final Terminate card) {

View file

@ -32,14 +32,12 @@ import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.DestroyNoRegenTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -60,7 +58,7 @@ public class SealOfDoom extends CardImpl<SealOfDoom> {
super(ownerId, 53, "Seal of Doom", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
this.expansionSetCode = "DIS";
this.color.setBlack(true);
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DestroyNoRegenTargetEffect(), new SacrificeSourceCost());
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DestroyTargetEffect(true), new SacrificeSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}

View file

@ -30,10 +30,8 @@ package mage.sets.ravnika;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.effects.common.DestroyNoRegenTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter.ComparisonScope;
import mage.filter.FilterPermanent;
@ -58,7 +56,7 @@ public class Putrefy extends CardImpl<Putrefy> {
this.color.setBlack(true);
this.color.setGreen(true);
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new DestroyNoRegenTargetEffect());
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
}
public Putrefy (final Putrefy card) {

View file

@ -28,13 +28,15 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyNoRegenTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
@ -44,7 +46,7 @@ import mage.target.common.TargetCreaturePermanent;
/**
*
* @author North
* @author North, Loki
*/
public class Vendetta extends CardImpl<Vendetta> {
@ -62,7 +64,7 @@ public class Vendetta extends CardImpl<Vendetta> {
this.color.setBlack(true);
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
this.getSpellAbility().addEffect(new DestroyNoRegenTargetEffect());
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
this.getSpellAbility().addEffect(new VendettaEffect());
}
@ -95,7 +97,7 @@ class VendettaEffect extends OneShotEffect<VendettaEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent target = game.getPermanent(source.getFirstTarget());
Permanent target = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Constants.Zone.BATTLEFIELD);
if (player != null && target != null) {
player.loseLife(target.getToughness().getValue(), game);
return true;

View file

@ -30,7 +30,7 @@ package mage.sets.tempest;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.DestroyNoRegenTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -53,7 +53,7 @@ public class DarkBanishing extends CardImpl<DarkBanishing> {
super(ownerId, 11, "Dark Banishing", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{B}");
this.expansionSetCode = "TMP";
this.color.setBlack(true);
this.getSpellAbility().addEffect(new DestroyNoRegenTargetEffect());
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
}

View file

@ -30,7 +30,7 @@ package mage.sets.worldwake;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.DestroyNoRegenTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter.ComparisonType;
import mage.filter.common.FilterCreaturePermanent;
@ -56,7 +56,7 @@ public class Smother extends CardImpl<Smother> {
this.color.setBlack(true);
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
this.getSpellAbility().addEffect(new DestroyNoRegenTargetEffect());
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
}
public Smother(final Smother card) {

View file

@ -81,12 +81,16 @@ public class DestroyTargetEffect extends OneShotEffect<DestroyTargetEffect> {
@Override
public String getText(Mode mode) {
StringBuffer sb = new StringBuffer();
if (mode.getTargets().size() == 0) {
return "destroy that creature"; //TODO add possibility to specify text with targetPointer usage
sb.append("destroy that creature"); //TODO add possibility to specify text with targetPointer usage
} else if (mode.getTargets().get(0).getNumberOfTargets() == 1)
return "Destroy target " + mode.getTargets().get(0).getTargetName();
sb.append("Destroy target ").append(mode.getTargets().get(0).getTargetName());
else
return "Destroy " + mode.getTargets().get(0).getNumberOfTargets() + " target " + mode.getTargets().get(0).getTargetName();
sb.append("Destroy ").append(mode.getTargets().get(0).getNumberOfTargets()).append(" target ").append(mode.getTargets().get(0).getTargetName());
if (noRegen)
sb.append(". It can't be regenerated");
return sb.toString();
}
}