* Leeching Sliver - Fixed that all defending players of combat lost life instead of only the defending player of Leeching Sliver.

This commit is contained in:
LevelX2 2016-03-16 10:12:56 +01:00
parent 32c014f2f8
commit 867fe61007
4 changed files with 32 additions and 78 deletions

View file

@ -29,17 +29,11 @@ package mage.sets.alarareborn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.effects.common.LoseLifeDefendingPlayerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -53,13 +47,11 @@ public class VedalkenGhoul extends CardImpl {
this.subtype.add("Vedalken");
this.subtype.add("Zombie");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Whenever Vedalken Ghoul becomes blocked, defending player loses 4 life.
this.addAbility(new VedalkenGhoulTriggeredAbility());
this.addAbility(new BecomesBlockedTriggeredAbility(new LoseLifeDefendingPlayerEffect(4, true), false));
}
@ -72,43 +64,3 @@ public class VedalkenGhoul extends CardImpl {
return new VedalkenGhoul(this);
}
}
class VedalkenGhoulTriggeredAbility extends TriggeredAbilityImpl {
public VedalkenGhoulTriggeredAbility() {
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(4), false);
}
public VedalkenGhoulTriggeredAbility(final VedalkenGhoulTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.CREATURE_BLOCKED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getSourceId())) {
UUID defendingPlayer = game.getCombat().getDefenderId(this.getSourceId());
if (defendingPlayer != null) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(defendingPlayer));
}
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} becomes blocked, defending player loses 4 life.";
}
@Override
public VedalkenGhoulTriggeredAbility copy() {
return new VedalkenGhoulTriggeredAbility(this);
}
}

View file

@ -31,13 +31,12 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.LoseLifeDefendingPlayerEffect;
import mage.abilities.keyword.DevoidAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.SetTargetPointer;
/**
*
@ -60,8 +59,7 @@ public class SilentSkimmer extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Silent Skimmer attacks, defending player loses 2 life.
this.addAbility(new AttacksTriggeredAbility(new LoseLifeTargetEffect(2), false,
"Whenever {this} attacks, defending player loses 2 life", SetTargetPointer.PLAYER));
this.addAbility(new AttacksTriggeredAbility(new LoseLifeDefendingPlayerEffect(2, true), false));
}

View file

@ -27,6 +27,7 @@
*/
package mage.sets.magic2015;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.AttacksCreatureYouControlTriggeredAbility;
import mage.abilities.effects.common.LoseLifeDefendingPlayerEffect;
@ -36,8 +37,6 @@ import mage.constants.Rarity;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import java.util.UUID;
/**
* @author noxx
*/
@ -58,7 +57,7 @@ public class LeechingSliver extends CardImpl {
this.toughness = new MageInt(1);
// Whenever a Sliver you control attacks, defending player loses 1 life.
this.addAbility(new AttacksCreatureYouControlTriggeredAbility(new LoseLifeDefendingPlayerEffect(1), false, filter));
this.addAbility(new AttacksCreatureYouControlTriggeredAbility(new LoseLifeDefendingPlayerEffect(1, true), false, filter, true));
}
public LeechingSliver(final LeechingSliver card) {