[KHM] Implemented Calamity Bearer (#7354)

This commit is contained in:
Daniel Bomar 2021-01-09 14:32:49 -06:00 committed by GitHub
parent 1823d96721
commit 2b64613c4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 99 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));