Implemented Hushbringer

This commit is contained in:
Evan Kranzler 2019-09-21 20:36:24 -04:00
parent 5a5e51a151
commit 3b6da056ea
3 changed files with 121 additions and 0 deletions

View file

@ -0,0 +1,119 @@
package mage.cards.h;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Hushbringer extends CardImpl {
public Hushbringer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.FAERIE);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// Creatures entering the battlefield or dying don't cause abilities to trigger.
this.addAbility(new SimpleStaticAbility(new HushbringerEffect()));
}
private Hushbringer(final Hushbringer card) {
super(card);
}
@Override
public Hushbringer copy() {
return new Hushbringer(this);
}
}
class HushbringerEffect extends ContinuousRuleModifyingEffectImpl {
HushbringerEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, false);
staticText = "Creatures entering the battlefield or dying don't cause abilities to trigger";
}
private HushbringerEffect(final HushbringerEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|| event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Ability ability = (Ability) getValue("targetAbility");
if (ability == null || ability.getAbilityType() != AbilityType.TRIGGERED) {
return false;
}
Permanent permanent;
switch (event.getType()) {
case ENTERS_THE_BATTLEFIELD:
permanent = ((EntersTheBattlefieldEvent) event).getTarget();
break;
case ZONE_CHANGE:
ZoneChangeEvent zEvent = ((ZoneChangeEvent) event);
if (!zEvent.isDiesEvent()) {
return false;
}
permanent = zEvent.getTarget();
break;
default:
return false;
}
if (permanent == null || !permanent.isCreature()) {
return false;
}
return (((TriggeredAbility) ability).checkTrigger(event, game));
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
MageObject enteringObject = game.getObject(event.getSourceId());
MageObject sourceObject = game.getObject(source.getSourceId());
Ability ability = (Ability) getValue("targetAbility");
if (enteringObject == null || sourceObject == null || ability == null) {
return null;
}
MageObject abilitObject = game.getObject(ability.getSourceId());
if (abilitObject == null) {
return null;
}
return sourceObject.getLogName() + " prevented ability of "
+ abilitObject.getLogName() + " from triggering.";
}
@Override
public HushbringerEffect copy() {
return new HushbringerEffect(this);
}
}

View file

@ -138,6 +138,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Harmonious Archon", 17, Rarity.MYTHIC, mage.cards.h.HarmoniousArchon.class));
cards.add(new SetCardInfo("Henge Walker", 221, Rarity.COMMON, mage.cards.h.HengeWalker.class));
cards.add(new SetCardInfo("Heraldic Banner", 222, Rarity.UNCOMMON, mage.cards.h.HeraldicBanner.class));
cards.add(new SetCardInfo("Hushbringer", 18, Rarity.RARE, mage.cards.h.Hushbringer.class));
cards.add(new SetCardInfo("Hypnotic Sprite", 49, Rarity.UNCOMMON, mage.cards.h.HypnoticSprite.class));
cards.add(new SetCardInfo("Idyllic Grange", 246, Rarity.COMMON, mage.cards.i.IdyllicGrange.class));
cards.add(new SetCardInfo("Improbable Alliance", 193, Rarity.UNCOMMON, mage.cards.i.ImprobableAlliance.class));

View file

@ -59,6 +59,7 @@ public final class ThroneOfEldraineCollectorsEdition extends ExpansionSet {
cards.add(new SetCardInfo("Gilded Goose", 369, Rarity.RARE, mage.cards.g.GildedGoose.class));
cards.add(new SetCardInfo("Happily Ever After", 337, Rarity.RARE, mage.cards.h.HappilyEverAfter.class));
cards.add(new SetCardInfo("Harmonious Archon", 338, Rarity.MYTHIC, mage.cards.h.HarmoniousArchon.class));
cards.add(new SetCardInfo("Hushbringer", 339, Rarity.RARE, mage.cards.h.Hushbringer.class));
cards.add(new SetCardInfo("Hypnotic Sprite", 283, Rarity.UNCOMMON, mage.cards.h.HypnoticSprite.class));
cards.add(new SetCardInfo("Irencrag Feat", 362, Rarity.RARE, mage.cards.i.IrencragFeat.class));
cards.add(new SetCardInfo("Irencrag Pyromancer", 363, Rarity.RARE, mage.cards.i.IrencragPyromancer.class));