mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
[VOW] Implemented Magma Pummeler
This commit is contained in:
parent
6fb6ef56f9
commit
8716ecdb3d
2 changed files with 106 additions and 0 deletions
105
Mage.Sets/src/mage/cards/m/MagmaPummeler.java
Normal file
105
Mage.Sets/src/mage/cards/m/MagmaPummeler.java
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||||
|
import mage.abilities.effects.PreventionEffectImpl;
|
||||||
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
|
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.target.common.TargetAnyTarget;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class MagmaPummeler extends CardImpl {
|
||||||
|
|
||||||
|
public MagmaPummeler(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{R}{R}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.ELEMENTAL);
|
||||||
|
this.power = new MageInt(0);
|
||||||
|
this.toughness = new MageInt(0);
|
||||||
|
|
||||||
|
// Magma Pummeler enters the battlefield with X +1/+1 counters on it.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance())));
|
||||||
|
|
||||||
|
// If damage would be dealt to Magma Pummeler while it has a +1/+1 counter on it, prevent that damage and remove that many +1/+1 counters from it. When one or more counters are removed from Magma Pummeler this way, it deals that much damage to any target.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new MagmaPummelerEffect()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private MagmaPummeler(final MagmaPummeler card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MagmaPummeler copy() {
|
||||||
|
return new MagmaPummeler(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MagmaPummelerEffect extends PreventionEffectImpl {
|
||||||
|
|
||||||
|
public MagmaPummelerEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, false, false);
|
||||||
|
staticText = "If damage would be dealt to {this} while it has a +1/+1 counter on it, " +
|
||||||
|
"prevent that damage and remove that many +1/+1 counters from it. " +
|
||||||
|
"When one or more counters are removed from {this} this way, it deals that much damage to any target.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private MagmaPummelerEffect(final MagmaPummelerEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MagmaPummelerEffect copy() {
|
||||||
|
return new MagmaPummelerEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
int damage = event.getAmount();
|
||||||
|
preventDamageAction(event, source, game);
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int beforeCounters = permanent.getCounters(game).getCount(CounterType.P1P1);
|
||||||
|
permanent.removeCounters(CounterType.P1P1.createInstance(damage), source, game);
|
||||||
|
int countersRemoved = beforeCounters - permanent.getCounters(game).getCount(CounterType.P1P1);
|
||||||
|
if (countersRemoved > 0) {
|
||||||
|
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
|
||||||
|
new DamageTargetEffect(countersRemoved), false,
|
||||||
|
"{this} deals that much damage to any target"
|
||||||
|
);
|
||||||
|
ability.addTarget(new TargetAnyTarget());
|
||||||
|
game.fireReflexiveTriggeredAbility(ability, source);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
return super.applies(event, source, game)
|
||||||
|
&& permanent != null
|
||||||
|
&& event.getTargetId().equals(source.getSourceId())
|
||||||
|
&& permanent.getCounters(game).containsKey(CounterType.P1P1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -211,6 +211,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Lanterns' Lift", 66, Rarity.COMMON, mage.cards.l.LanternsLift.class));
|
cards.add(new SetCardInfo("Lanterns' Lift", 66, Rarity.COMMON, mage.cards.l.LanternsLift.class));
|
||||||
cards.add(new SetCardInfo("Lightning Wolf", 168, Rarity.COMMON, mage.cards.l.LightningWolf.class));
|
cards.add(new SetCardInfo("Lightning Wolf", 168, Rarity.COMMON, mage.cards.l.LightningWolf.class));
|
||||||
cards.add(new SetCardInfo("Lunar Rejection", 67, Rarity.UNCOMMON, mage.cards.l.LunarRejection.class));
|
cards.add(new SetCardInfo("Lunar Rejection", 67, Rarity.UNCOMMON, mage.cards.l.LunarRejection.class));
|
||||||
|
cards.add(new SetCardInfo("Magma Pummeler", 169, Rarity.UNCOMMON, mage.cards.m.MagmaPummeler.class));
|
||||||
cards.add(new SetCardInfo("Malicious Invader", 121, Rarity.UNCOMMON, mage.cards.m.MaliciousInvader.class));
|
cards.add(new SetCardInfo("Malicious Invader", 121, Rarity.UNCOMMON, mage.cards.m.MaliciousInvader.class));
|
||||||
cards.add(new SetCardInfo("Manaform Hellkite", 170, Rarity.MYTHIC, mage.cards.m.ManaformHellkite.class));
|
cards.add(new SetCardInfo("Manaform Hellkite", 170, Rarity.MYTHIC, mage.cards.m.ManaformHellkite.class));
|
||||||
cards.add(new SetCardInfo("Markov Purifier", 241, Rarity.UNCOMMON, mage.cards.m.MarkovPurifier.class));
|
cards.add(new SetCardInfo("Markov Purifier", 241, Rarity.UNCOMMON, mage.cards.m.MarkovPurifier.class));
|
||||||
|
|
Loading…
Reference in a new issue