diff --git a/Mage.Sets/src/mage/cards/c/CalamityBearer.java b/Mage.Sets/src/mage/cards/c/CalamityBearer.java new file mode 100644 index 00000000000..2e500729ab7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CalamityBearer.java @@ -0,0 +1,98 @@ +package mage.cards.c; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.util.CardUtil; + +/** + * + * @author weirddan455 + */ +public final class CalamityBearer extends CardImpl { + + public CalamityBearer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); + + this.subtype.add(SubType.GIANT); + this.subtype.add(SubType.BERSERKER); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // If a Giant source you control would deal damage to a permanent or player, + // it deals double that damage to that permanent or player instead. + this.addAbility(new SimpleStaticAbility(new CalamityBearerEffect())); + } + + private CalamityBearer(final CalamityBearer card) { + super(card); + } + + @Override + public CalamityBearer copy() { + return new CalamityBearer(this); + } +} + +class CalamityBearerEffect extends ReplacementEffectImpl { + + CalamityBearerEffect() { + super(Duration.WhileOnBattlefield, Outcome.Damage); + this.staticText = "If a Giant source you control would deal damage to a permanent or player, " + + "it deals double that damage to that permanent or player instead"; + } + + private CalamityBearerEffect(final CalamityBearerEffect effect) { + super(effect); + } + + @Override + public CalamityBearerEffect copy() { + return new CalamityBearerEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(CardUtil.addWithOverflowCheck(event.getAmount(), event.getAmount())); + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + switch (event.getType()) { + case DAMAGE_CREATURE: + case DAMAGE_PLANESWALKER: + case DAMAGE_PLAYER: + return true; + default: + return false; + } + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getAmount() > 0 && source.isControlledBy(game.getControllerId(event.getSourceId()))) { + MageObject sourceObject; + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (sourcePermanent == null) { + sourceObject = game.getObject(event.getSourceId()); + } else { + sourceObject = sourcePermanent; + } + return sourceObject != null && sourceObject.hasSubtype(SubType.GIANT, game); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 2ec45c3244b..cbfe1b2d87a 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -55,6 +55,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Binding the Old Gods", 206, Rarity.UNCOMMON, mage.cards.b.BindingTheOldGods.class)); cards.add(new SetCardInfo("Blightstep Pathway", 252, Rarity.RARE, mage.cards.b.BlightstepPathway.class)); cards.add(new SetCardInfo("Bretagard Stronghold", 253, Rarity.UNCOMMON, mage.cards.b.BretagardStronghold.class)); + cards.add(new SetCardInfo("Calamity Bearer", 125, Rarity.RARE, mage.cards.c.CalamityBearer.class)); cards.add(new SetCardInfo("Canopy Tactician", 378, Rarity.RARE, mage.cards.c.CanopyTactician.class)); cards.add(new SetCardInfo("Cleaving Reaper", 376, Rarity.RARE, mage.cards.c.CleavingReaper.class)); cards.add(new SetCardInfo("Darkbore Pathway", 254, Rarity.RARE, mage.cards.d.DarkborePathway.class));