Implemented Ironscale Hydra

This commit is contained in:
Evan Kranzler 2019-12-20 19:57:59 -05:00
parent 88a1b9fe22
commit f5e5df6d6e
2 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,81 @@
package mage.cards.i;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
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 java.util.UUID;
/**
* @author TheElk801
*/
public final class IronscaleHydra extends CardImpl {
public IronscaleHydra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.subtype.add(SubType.HYDRA);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// If a creature would deal combat damage to Ironscale Hydra, prevent that damage and put a +1/+1 counter on Ironscale Hydra.
this.addAbility(new SimpleStaticAbility(new IronscaleHydraEffect()));
}
private IronscaleHydra(final IronscaleHydra card) {
super(card);
}
@Override
public IronscaleHydra copy() {
return new IronscaleHydra(this);
}
}
class IronscaleHydraEffect extends PreventionEffectImpl {
private static final Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance());
IronscaleHydraEffect() {
super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, true, false);
staticText = "If a creature would deal combat damage to {this}, " +
"prevent that damage and put a +1/+1 counter on {this}.";
}
private IronscaleHydraEffect(final IronscaleHydraEffect effect) {
super(effect);
}
@Override
public IronscaleHydraEffect copy() {
return new IronscaleHydraEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!super.applies(event, source, game)
|| !event.getTargetId().equals(source.getSourceId())) {
return false;
}
Permanent damageSource = game.getPermanent(event.getSourceId());
return damageSource != null && damageSource.isCreature();
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
effect.apply(game, source);
return super.replaceEvent(event, source, game);
}
}

View file

@ -39,6 +39,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Hero of the Winds", 23, Rarity.UNCOMMON, mage.cards.h.HeroOfTheWinds.class));
cards.add(new SetCardInfo("Indomitable Will", 25, Rarity.COMMON, mage.cards.i.IndomitableWill.class));
cards.add(new SetCardInfo("Inevitable End", 102, Rarity.UNCOMMON, mage.cards.i.InevitableEnd.class));
cards.add(new SetCardInfo("Ironscale Hydra", 296, Rarity.RARE, mage.cards.i.IronscaleHydra.class));
cards.add(new SetCardInfo("Island", 251, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Klothys's Design", 176, Rarity.UNCOMMON, mage.cards.k.KlothyssDesign.class));
cards.add(new SetCardInfo("Leonin of the Lost Pride", 28, Rarity.COMMON, mage.cards.l.LeoninOfTheLostPride.class));