[KHM] Implemented Boreal Outrider

This commit is contained in:
Evan Kranzler 2021-01-21 19:16:04 -05:00
parent 241ef4c6eb
commit 567059ea82
4 changed files with 130 additions and 2 deletions

View file

@ -0,0 +1,111 @@
package mage.cards.b;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BorealOutrider extends CardImpl {
public BorealOutrider(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.addSuperType(SuperType.SNOW);
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Whenever you cast a creature spell, if {S} of any of that spell's color was spent to cast it, that creature enters the battlefield with an additional +1/+1 counter on it.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new SpellCastControllerTriggeredAbility(
new BorealOutriderEffect(), StaticFilters.FILTER_SPELL_A_CREATURE, false
), BorealOutriderCondition.instance, "Whenever you cast a creature spell, " +
"if {S} of any of that spell's color was spent to cast it, that creature " +
"enters the battlefield with an additional +1/+1 counter on it."
));
}
private BorealOutrider(final BorealOutrider card) {
super(card);
}
@Override
public BorealOutrider copy() {
return new BorealOutrider(this);
}
}
enum BorealOutriderCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Spell spell = (Spell) source.getEffects().get(0).getValue("spellCast");
return spell != null
&& spell
.getSpellAbility()
.getManaCostsToPay()
.getUsedManaToPay()
.checkSnow(spell.getColor(game));
}
}
class BorealOutriderEffect extends ReplacementEffectImpl {
BorealOutriderEffect() {
super(Duration.EndOfStep, Outcome.BoostCreature);
}
private BorealOutriderEffect(BorealOutriderEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Spell spell = (Spell) getValue("spellCast");
return spell != null && event.getTargetId().equals(spell.getCard().getId());
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(), source, game, event.getAppliedEffects());
discard();
}
return false;
}
@Override
public BorealOutriderEffect copy() {
return new BorealOutriderEffect(this);
}
}

View file

@ -106,6 +106,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Blizzard Brawl", 162, Rarity.UNCOMMON, mage.cards.b.BlizzardBrawl.class));
cards.add(new SetCardInfo("Bloodline Pretender", 235, Rarity.UNCOMMON, mage.cards.b.BloodlinePretender.class));
cards.add(new SetCardInfo("Bloodsky Berserker", 80, Rarity.UNCOMMON, mage.cards.b.BloodskyBerserker.class));
cards.add(new SetCardInfo("Boreal Outrider", 163, Rarity.UNCOMMON, mage.cards.b.BorealOutrider.class));
cards.add(new SetCardInfo("Bound in Gold", 5, Rarity.COMMON, mage.cards.b.BoundInGold.class));
cards.add(new SetCardInfo("Breakneck Berserker", 124, Rarity.COMMON, mage.cards.b.BreakneckBerserker.class));
cards.add(new SetCardInfo("Bretagard Stronghold", 253, Rarity.UNCOMMON, mage.cards.b.BretagardStronghold.class));

View file

@ -1013,6 +1013,21 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
+ any.getSnowAmount();
}
public boolean checkSnow(ObjectColor color) {
if (color.isWhite() && white.getSnowAmount() > 0) {
return true;
} else if (color.isBlue() && blue.getSnowAmount() > 0) {
return true;
} else if (color.isBlack() && black.getSnowAmount() > 0) {
return true;
} else if (color.isRed() && red.getSnowAmount() > 0) {
return true;
} else if (color.isGreen() && green.getSnowAmount() > 0) {
return true;
}
return false;
}
/**
* Returns this objects total mana minus the passed in {@link Mana}'s mana.
*

View file

@ -70,10 +70,11 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
if (rememberSource) {
this.getEffects().setValue("spellCast", spell);
if (rememberSourceAsCard) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getCard().getId(), game));
this.getEffects().setTargetPointer(new FixedTarget(spell.getCard().getId(), game));
} else {
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId(), game));
this.getEffects().setTargetPointer(new FixedTarget(spell.getId(), game));
}
}