diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java index c987cc821d..6c3efcdc6d 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java @@ -36,6 +36,7 @@ import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.continious.BoostOpponentsEffect; @@ -45,6 +46,7 @@ import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; /** * @@ -77,7 +79,6 @@ public class MassacreWurm extends CardImpl { class MassacreWurmTriggeredAbility extends TriggeredAbilityImpl { MassacreWurmTriggeredAbility() { super(Constants.Zone.BATTLEFIELD, new LoseLifeTargetEffect(2)); - this.addTarget(new TargetPlayer()); } MassacreWurmTriggeredAbility(final MassacreWurmTriggeredAbility ability) { @@ -96,7 +97,9 @@ class MassacreWurmTriggeredAbility extends TriggeredAbilityImpl> extends Serializable { public boolean apply(Game game, Ability source); public Outcome getOutcome(); public EffectType getEffectType(); + public void setTargetPointer(TargetPointer targetPointer); public T copy(); diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java index 090ccd69f9..4f3ed3aae5 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -63,7 +63,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getFirstTarget()); + Player player = game.getPlayer(targetPointer.getFirst(source)); if (player != null) { player.loseLife(amount, game); return true; @@ -73,7 +73,14 @@ public class LoseLifeTargetEffect extends OneShotEffect { @Override public String getText(Ability source) { - return "Target " + source.getTargets().get(0).getTargetName() + " loses " + Integer.toString(amount) + " life"; + StringBuffer result = new StringBuffer(); + if (source.getTargets().size() > 0) { + result.append("Target " + source.getTargets().get(0).getTargetName()); + } else { + result.append("that player"); + } + result.append(" loses ").append(amount).append(" life"); + return result.toString(); } diff --git a/Mage/src/mage/target/targetpointer/FixedTarget.java b/Mage/src/mage/target/targetpointer/FixedTarget.java new file mode 100644 index 0000000000..1f3c8266b1 --- /dev/null +++ b/Mage/src/mage/target/targetpointer/FixedTarget.java @@ -0,0 +1,36 @@ +package mage.target.targetpointer; + +import mage.abilities.Ability; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class FixedTarget implements TargetPointer { + private UUID target; + + public FixedTarget(UUID target) { + this.target = target; + } + + public FixedTarget(final FixedTarget fixedTarget) { + this.target = fixedTarget.target; + } + + @Override + public List getTargets(Ability source) { + ArrayList list = new ArrayList(1); + list.add(target); + return list; + } + + @Override + public UUID getFirst(Ability source) { + return target; + } + + @Override + public TargetPointer copy() { + return new FixedTarget(this); + } +}