fixed Carnifex Demon not working when it dies in response to its activated ability
-
-
package mage.cards.c;
import java.util.UUID;
@@ -9,18 +7,17 @@ import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
-import mage.abilities.effects.OneShotEffect;
+import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
-import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
-import mage.game.Game;
-import mage.game.permanent.Permanent;
+import mage.filter.common.FilterCreaturePermanent;
+import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@@ -28,15 +25,33 @@ import mage.game.permanent.Permanent;
*/
public final class CarnifexDemon extends CardImpl {
+ private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature");
+
+ static {
+ filter.add(new AnotherPredicate());
+ }
+
public CarnifexDemon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
this.subtype.add(SubType.DEMON);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
+
this.addAbility(FlyingAbility.getInstance());
- this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(2)), "{this} enters the battlefield with two -1/-1 counters on it"));
- Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CarnifexDemonEffect(), new ManaCostsImpl("{B}"));
+
+ this.addAbility(new EntersBattlefieldAbility(
+ new AddCountersSourceEffect(CounterType.M1M1.createInstance(2)),
+ "{this} enters the battlefield with two -1/-1 counters on it"
+ ));
+
+ Ability ability = new SimpleActivatedAbility(
+ Zone.BATTLEFIELD,
+ new AddCountersAllEffect(
+ CounterType.M1M1.createInstance(),
+ filter
+ ), new ManaCostsImpl("{B}")
+ );
ability.addCost(new RemoveCountersSourceCost(CounterType.M1M1.createInstance()));
this.addAbility(ability);
}
@@ -50,32 +65,3 @@ public final class CarnifexDemon extends CardImpl {
return new CarnifexDemon(this);
}
}
-
-class CarnifexDemonEffect extends OneShotEffect {
- public CarnifexDemonEffect() {
- super(Outcome.UnboostCreature);
- staticText = "Put a -1/-1 counter on each other creature";
- }
-
- public CarnifexDemonEffect(final CarnifexDemonEffect effect) {
- super(effect);
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- Permanent p = game.getPermanent(source.getSourceId());
- if (p != null) {
- for (Permanent t : game.getBattlefield().getAllActivePermanents()) {
- if (t.isCreature() && !t.getId().equals(source.getSourceId()))
- t.addCounters(CounterType.M1M1.createInstance(), source, game);
- }
- }
- return false;
- }
-
- @Override
- public CarnifexDemonEffect copy() {
- return new CarnifexDemonEffect(this);
- }
-
-}
\ No newline at end of file
