[IKO] added test for Zirda, the Dawnwaker

This commit is contained in:
Evan Kranzler 2021-03-14 11:40:08 -04:00
parent e0336d4d65
commit 13ac8f2c01
2 changed files with 86 additions and 13 deletions

View file

@ -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;
@ -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

View file

@ -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);
}
}