mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
[IKO] added test for Zirda, the Dawnwaker
This commit is contained in:
parent
e0336d4d65
commit
13ac8f2c01
2 changed files with 86 additions and 13 deletions
|
@ -2,8 +2,8 @@ package mage.cards.z;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
@ -20,6 +20,7 @@ import mage.game.Game;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -40,7 +41,7 @@ public final class ZirdaTheDawnwaker extends CardImpl {
|
|||
// Companion — Each permanent card in your starting deck has an activated ability.
|
||||
this.addAbility(new CompanionAbility(ZirdaTheDawnwakerCompanionCondition.instance));
|
||||
|
||||
// Abilities you activate that aren't mana abilities cost {2} less to activate.
|
||||
// Abilities you activate that aren't mana abilities cost {2} less to activate.
|
||||
// This effect can't reduce the mana in that cost to less than one mana.
|
||||
this.addAbility(new SimpleStaticAbility(new ZirdaTheDawnwakerEffect()));
|
||||
|
||||
|
@ -76,13 +77,9 @@ enum ZirdaTheDawnwakerCompanionCondition implements CompanionCondition {
|
|||
return deck
|
||||
.stream()
|
||||
.filter(MageObject::isPermanent)
|
||||
.allMatch(card -> card
|
||||
.getAbilities()
|
||||
.stream()
|
||||
.map(Ability::getAbilityType)
|
||||
.anyMatch(abilityType -> abilityType == AbilityType.ACTIVATED
|
||||
|| abilityType == AbilityType.MANA)
|
||||
);
|
||||
.map(MageObject::getAbilities)
|
||||
.flatMap(Collection::stream)
|
||||
.anyMatch(ActivatedAbility.class::isInstance);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,8 +97,10 @@ class ZirdaTheDawnwakerEffect extends CostModificationEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
int reduceMax = CardUtil.calculateActualPossibleGenericManaReduction(abilityToModify.getManaCostsToPay().getMana(), 2, 1);
|
||||
if (reduceMax <= 0) {
|
||||
int reduceMax = CardUtil.calculateActualPossibleGenericManaReduction(
|
||||
abilityToModify.getManaCostsToPay().getMana(), 2, 1
|
||||
);
|
||||
if (reduceMax < 1) {
|
||||
return true;
|
||||
}
|
||||
CardUtil.reduceCost(abilityToModify, reduceMax);
|
||||
|
@ -112,8 +111,7 @@ class ZirdaTheDawnwakerEffect extends CostModificationEffectImpl {
|
|||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify.getAbilityType() == AbilityType.ACTIVATED
|
||||
&& abilityToModify.isControlledBy(source.getControllerId())
|
||||
&& abilityToModify.getAbilityType() != AbilityType.MANA; // no mana abilities
|
||||
&& abilityToModify.isControlledBy(source.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package org.mage.test.cards.single.iko;
|
||||
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ZirdaTheDawnwakerTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String zirda = "Zirda, the Dawnwaker";
|
||||
private static final String golem = "Igneous Golem";
|
||||
private static final String mauler = "Barkhide Mauler";
|
||||
private static final String geth = "Geth, Lord of the Vault";
|
||||
private static final String lion = "Silvercoat Lion";
|
||||
|
||||
@Test
|
||||
public void testReduceToOne() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, zirda);
|
||||
addCard(Zone.BATTLEFIELD, playerA, golem);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertTapped("Swamp", true);
|
||||
assertAbility(playerA, golem, TrampleAbility.getInstance(), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCycling() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, zirda);
|
||||
addCard(Zone.HAND, playerA, mauler);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertTapped("Swamp", true);
|
||||
assertGraveyardCount(playerA, mauler, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithGeth() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, zirda);
|
||||
addCard(Zone.BATTLEFIELD, playerA, geth);
|
||||
addCard(Zone.GRAVEYARD, playerB, lion);
|
||||
|
||||
setChoice(playerA, "X=2");
|
||||
addTarget(playerA, lion);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{X}{B}");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, lion, 1);
|
||||
assertTapped(lion, true);
|
||||
assertGraveyardCount(playerB, 2);
|
||||
assertGraveyardCount(playerB, lion, 0);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue