mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[KHM] Implemented Karfell Harbinger
This commit is contained in:
parent
eaf29da63f
commit
83c103f17f
3 changed files with 145 additions and 0 deletions
88
Mage.Sets/src/mage/cards/k/KarfellHarbinger.java
Normal file
88
Mage.Sets/src/mage/cards/k/KarfellHarbinger.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
package mage.cards.k;
|
||||
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.keyword.ForetellAbility;
|
||||
import mage.abilities.mana.ConditionalColoredManaAbility;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
import mage.abilities.mana.conditional.ManaCondition;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class KarfellHarbinger extends CardImpl {
|
||||
|
||||
public KarfellHarbinger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||
|
||||
this.subtype.add(SubType.ZOMBIE);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// {T}: Add {U}. Spend this mana only to foretell a card from your hand or cast an instant or sorcery spell.
|
||||
this.addAbility(new ConditionalColoredManaAbility(new Mana(ManaType.BLUE, 1), new KarfellHarbingerManaBuilder()));
|
||||
}
|
||||
|
||||
private KarfellHarbinger(final KarfellHarbinger card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KarfellHarbinger copy() {
|
||||
return new KarfellHarbinger(this);
|
||||
}
|
||||
}
|
||||
|
||||
class KarfellHarbingerManaBuilder extends ConditionalManaBuilder {
|
||||
|
||||
@Override
|
||||
public ConditionalMana build(Object... options) {
|
||||
return new KarfellHarbingerConditionalMana(this.mana);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Spend this mana only to foretell a card from your hand or cast an instant or sorcery spell.";
|
||||
}
|
||||
}
|
||||
|
||||
class KarfellHarbingerConditionalMana extends ConditionalMana {
|
||||
|
||||
KarfellHarbingerConditionalMana(Mana mana) {
|
||||
super(mana);
|
||||
staticText = "Spend this mana only to foretell a card from your hand or cast an instant or sorcery spell.";
|
||||
addCondition(new KarfellHarbingerManaCondition());
|
||||
}
|
||||
}
|
||||
|
||||
class KarfellHarbingerManaCondition extends ManaCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
return object != null && object.isInstantOrSorcery();
|
||||
}
|
||||
return source instanceof ForetellAbility;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) {
|
||||
return apply(game, source);
|
||||
}
|
||||
}
|
|
@ -178,6 +178,7 @@ public final class Kaldheim extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Jaspera Sentinel", 178, Rarity.COMMON, mage.cards.j.JasperaSentinel.class));
|
||||
cards.add(new SetCardInfo("Jorn, God of Winter", 179, Rarity.RARE, mage.cards.j.JornGodOfWinter.class));
|
||||
cards.add(new SetCardInfo("Kardur's Vicious Return", 217, Rarity.UNCOMMON, mage.cards.k.KardursViciousReturn.class));
|
||||
cards.add(new SetCardInfo("Karfell Harbinger", 65, Rarity.COMMON, mage.cards.k.KarfellHarbinger.class));
|
||||
cards.add(new SetCardInfo("Karfell Kennel-Master", 101, Rarity.COMMON, mage.cards.k.KarfellKennelMaster.class));
|
||||
cards.add(new SetCardInfo("Kaya the Inexorable", 218, Rarity.MYTHIC, mage.cards.k.KayaTheInexorable.class));
|
||||
cards.add(new SetCardInfo("Kaya's Onslaught", 18, Rarity.UNCOMMON, mage.cards.k.KayasOnslaught.class));
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package org.mage.test.cards.single.khm;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class KarfellHarbingerTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testForetellMana() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Karfell Harbinger");
|
||||
addCard(Zone.HAND, playerA, "Augury Raven");
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{2}: Foretell");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertHandCount(playerA, "Augury Raven", 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpellMana() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Karfell Harbinger");
|
||||
addCard(Zone.HAND, playerA, "Obsessive Search");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Obsessive Search");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, "Obsessive Search", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOtherMana() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Karfell Harbinger");
|
||||
addCard(Zone.HAND, playerA, "Flying Men");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flying Men");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, "Flying Men", 1);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue