Fixed Powder Keg sac ability cost

This commit is contained in:
Evan Kranzler 2017-08-03 14:45:44 -04:00
parent e6eb415236
commit d6586cd103

View file

@ -32,6 +32,7 @@ import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
@ -51,13 +52,14 @@ import mage.game.permanent.Permanent;
public class PowderKeg extends CardImpl {
public PowderKeg(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// At the beginning of your upkeep, you may put a fuse counter on Powder Keg.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.FUSE.createInstance(), true), TargetController.YOU, true));
// {T}, Sacrifice Powder Keg: Destroy each artifact and creature with converted mana cost equal to the number of fuse counters on Powder Keg.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PowderKegEffect(), new SacrificeSourceCost());
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
@ -93,7 +95,7 @@ class PowderKegEffect extends OneShotEffect {
}
int count = p.getCounters(game).getCount(CounterType.FUSE);
for (Permanent perm: game.getBattlefield().getAllActivePermanents()) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
if (perm.getConvertedManaCost() == count && ((perm.isArtifact())
|| (perm.isCreature()))) {
perm.destroy(source.getSourceId(), game, false);
@ -108,4 +110,4 @@ class PowderKegEffect extends OneShotEffect {
return new PowderKegEffect(this);
}
}
}