Implemented Warbriar Blessing

This commit is contained in:
Evan Kranzler 2020-01-11 14:48:07 -05:00
parent 0d7dc61282
commit 50a40290e4
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.w;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WarbriarBlessing extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("creature you don't control");
static {
filter.add(TargetController.NOT_YOU.getControllerPredicate());
}
public WarbriarBlessing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
this.subtype.add(SubType.AURA);
// Enchant creature you control
TargetPermanent auraTarget = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE);
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When Warbriar Blessing enters the battlefield, enchanted creature fights up to one target creature you don't control.
ability = new EntersBattlefieldTriggeredAbility(new WarbriarBlessingEffect());
ability.addTarget(new TargetPermanent(0, 1, filter, false));
this.addAbility(ability);
// Enchanted creature gets +0/+2.
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(0, 2)));
}
private WarbriarBlessing(final WarbriarBlessing card) {
super(card);
}
@Override
public WarbriarBlessing copy() {
return new WarbriarBlessing(this);
}
}
class WarbriarBlessingEffect extends OneShotEffect {
WarbriarBlessingEffect() {
super(Outcome.Benefit);
staticText = "enchanted creature fights up to one target creature you don't control";
}
private WarbriarBlessingEffect(final WarbriarBlessingEffect effect) {
super(effect);
}
@Override
public WarbriarBlessingEffect copy() {
return new WarbriarBlessingEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
Permanent opponentsPermanent = game.getPermanent(source.getFirstTarget());
if (permanent == null || opponentsPermanent == null) {
return false;
}
Permanent attach = game.getPermanent(permanent.getAttachedTo());
if (attach == null) {
return false;
}
return attach.fight(opponentsPermanent, source, game);
}
}

View file

@ -273,6 +273,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Vexing Gull", 79, Rarity.COMMON, mage.cards.v.VexingGull.class)); cards.add(new SetCardInfo("Vexing Gull", 79, Rarity.COMMON, mage.cards.v.VexingGull.class));
cards.add(new SetCardInfo("Victory's Envoy", 289, Rarity.RARE, mage.cards.v.VictorysEnvoy.class)); cards.add(new SetCardInfo("Victory's Envoy", 289, Rarity.RARE, mage.cards.v.VictorysEnvoy.class));
cards.add(new SetCardInfo("Voracious Typhon", 203, Rarity.COMMON, mage.cards.v.VoraciousTyphon.class)); cards.add(new SetCardInfo("Voracious Typhon", 203, Rarity.COMMON, mage.cards.v.VoraciousTyphon.class));
cards.add(new SetCardInfo("Warbriar Blessing", 204, Rarity.COMMON, mage.cards.w.WarbriarBlessing.class));
cards.add(new SetCardInfo("Warden of the Chained", 230, Rarity.UNCOMMON, mage.cards.w.WardenOfTheChained.class)); cards.add(new SetCardInfo("Warden of the Chained", 230, Rarity.UNCOMMON, mage.cards.w.WardenOfTheChained.class));
cards.add(new SetCardInfo("Wavebreak Hippocamp", 80, Rarity.RARE, mage.cards.w.WavebreakHippocamp.class)); cards.add(new SetCardInfo("Wavebreak Hippocamp", 80, Rarity.RARE, mage.cards.w.WavebreakHippocamp.class));
cards.add(new SetCardInfo("Whirlwind Denial", 81, Rarity.UNCOMMON, mage.cards.w.WhirlwindDenial.class)); cards.add(new SetCardInfo("Whirlwind Denial", 81, Rarity.UNCOMMON, mage.cards.w.WhirlwindDenial.class));