[KHM] Implemented Warchanter Skald

This commit is contained in:
Evan Kranzler 2020-12-28 15:46:34 -05:00
parent 5246e1630b
commit 84b32a8ee7
3 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,64 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedSourceTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.DwarfBerserkerToken;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WarchanterSkald extends CardImpl {
public WarchanterSkald(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.subtype.add(SubType.DWARF);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Whenever Warchanter Skald becomes tapped, if it's enchanted or equipped, create a 2/1 red Dwarf Berserker creature token.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BecomesTappedSourceTriggeredAbility(new CreateTokenEffect(new DwarfBerserkerToken())),
WarchanterSkaldCondition.instance, "Whenever {this} becomes tapped, " +
"if it's enchanted or equipped, create a 2/1 red Dwarf Berserker creature token."
));
}
private WarchanterSkald(final WarchanterSkald card) {
super(card);
}
@Override
public WarchanterSkald copy() {
return new WarchanterSkald(this);
}
}
enum WarchanterSkaldCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentOrLKI(game);
return permanent != null && permanent
.getAttachments()
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.anyMatch(p -> p.hasSubtype(SubType.AURA, game) || p.hasSubtype(SubType.EQUIPMENT, game));
}
}

View file

@ -56,6 +56,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Surtland Flinger", 377, Rarity.RARE, mage.cards.s.SurtlandFlinger.class));
cards.add(new SetCardInfo("Toski, Bearer of Secrets", 197, Rarity.RARE, mage.cards.t.ToskiBearerOfSecrets.class));
cards.add(new SetCardInfo("Valkyrie Harbinger", 374, Rarity.RARE, mage.cards.v.ValkyrieHarbinger.class));
cards.add(new SetCardInfo("Warchanter Skald", 381, Rarity.UNCOMMON, mage.cards.w.WarchanterSkald.class));
cards.add(new SetCardInfo("Youthful Valkyrie", 382, Rarity.UNCOMMON, mage.cards.y.YouthfulValkyrie.class));
}
}

View file

@ -0,0 +1,26 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
public final class DwarfBerserkerToken extends TokenImpl {
public DwarfBerserkerToken() {
super("Dwarf Berserker", "2/1 red Dwarf Berserker creature token");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add(SubType.DWARF);
subtype.add(SubType.BERSERKER);
power = new MageInt(2);
toughness = new MageInt(1);
}
public DwarfBerserkerToken(final DwarfBerserkerToken token) {
super(token);
}
public DwarfBerserkerToken copy() {
return new DwarfBerserkerToken(this);
}
}