* Cabal Slaver - Fixed that the discard effect for damaged opponents did not work.

This commit is contained in:
LevelX2 2015-09-02 12:26:16 +02:00
parent 2c4d23bbb4
commit 22adee71ca
2 changed files with 11 additions and 11 deletions

View file

@ -43,6 +43,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
* @author markedagain * @author markedagain
*/ */
public class CabalSlaver extends CardImpl { public class CabalSlaver extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("Goblin"); private static final FilterPermanent filter = new FilterPermanent("Goblin");
static { static {
@ -58,7 +59,7 @@ public class CabalSlaver extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Whenever a Goblin deals combat damage to a player, that player discards a card. // Whenever a Goblin deals combat damage to a player, that player discards a card.
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(new DiscardTargetEffect(1),filter, false, SetTargetPointer.NONE, true)); this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(new DiscardTargetEffect(1), filter, false, SetTargetPointer.PLAYER, true));
} }
public CabalSlaver(final CabalSlaver card) { public CabalSlaver(final CabalSlaver card) {

View file

@ -1,16 +1,16 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.abilities.common; package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -43,8 +42,8 @@ import mage.target.targetpointer.FixedTarget;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImpl { public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImpl {
private final FilterPermanent filter; private final FilterPermanent filter;
private final SetTargetPointer setTargetPointer; private final SetTargetPointer setTargetPointer;
private final boolean onlyCombat; private final boolean onlyCombat;
@ -81,12 +80,12 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
if (!setTargetPointer.equals(SetTargetPointer.NONE)) { if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setValue("damage", event.getAmount()); effect.setValue("damage", event.getAmount());
switch(setTargetPointer) { switch (setTargetPointer) {
case PLAYER: case PLAYER:
effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
break; break;
case PERMANENT: case PERMANENT:
effect.setTargetPointer(new FixedTarget(permanent.getId())); effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game)));
break; break;
} }
@ -100,7 +99,7 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
@Override @Override
public String getRule() { public String getRule() {
return "Whenever " + filter.getMessage() + " deals "+(onlyCombat ? "combat ":"") + "damage to a player, " + super.getRule(); return "Whenever " + filter.getMessage() + " deals " + (onlyCombat ? "combat " : "") + "damage to a player, " + super.getRule();
} }
} }