mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
fixed Carnifex Demon not working when it dies in response to its activated ability
This commit is contained in:
parent
cdf8f615e3
commit
efa5df972f
1 changed files with 26 additions and 40 deletions
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -9,18 +7,17 @@ import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
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.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -28,20 +25,38 @@ import mage.game.permanent.Permanent;
|
||||||
*/
|
*/
|
||||||
public final class CarnifexDemon extends CardImpl {
|
public final class CarnifexDemon extends CardImpl {
|
||||||
|
|
||||||
public CarnifexDemon (UUID ownerId, CardSetInfo setInfo) {
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature");
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{B}");
|
|
||||||
|
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.subtype.add(SubType.DEMON);
|
||||||
|
|
||||||
this.power = new MageInt(6);
|
this.power = new MageInt(6);
|
||||||
this.toughness = new MageInt(6);
|
this.toughness = new MageInt(6);
|
||||||
|
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
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()));
|
ability.addCost(new RemoveCountersSourceCost(CounterType.M1M1.createInstance()));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CarnifexDemon (final CarnifexDemon card) {
|
public CarnifexDemon(final CarnifexDemon card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,32 +65,3 @@ public final class CarnifexDemon extends CardImpl {
|
||||||
return new CarnifexDemon(this);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue