-
Notifications
You must be signed in to change notification settings - Fork 787
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Tadeas, Juniper Ascendant (#10490)
* added Tests for Tadeas * Fix and cleanup Tadeas Juniper Ascendant * Fix same power test to attack with creature with same power * Test: added test for tadeas elusive not applying for creatures without reach * Fix: creatures without reach can be blocked by higher power blockers * Fix: use TargetPointer instead of MageObjectReference --------- Co-authored-by: gravitybone <[email protected]>
- Loading branch information
Showing
2 changed files
with
184 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
Mage.Tests/src/test/java/org/mage/test/cards/single/slx/TadeasJuniperAscendantTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
package org.mage.test.cards.single.slx; | ||
|
||
import mage.constants.PhaseStep; | ||
import mage.constants.Zone; | ||
import mage.game.permanent.Permanent; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mage.test.serverside.base.CardTestPlayerBase; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class TadeasJuniperAscendantTest extends CardTestPlayerBase { | ||
|
||
@Before | ||
public void setUp() { | ||
addCard(Zone.BATTLEFIELD, playerA, "Tadeas, Juniper Ascendant"); // 1/3 | ||
addCard(Zone.BATTLEFIELD, playerA, "Sweet-Gum Recluse"); // 0/3 //Reach | ||
addCard(Zone.BATTLEFIELD, playerA, "Canopy Spider"); // 1/3 //Reach | ||
addCard(Zone.BATTLEFIELD, playerA, "Brood Weaver"); // 2/4 //Reach | ||
addCard(Zone.BATTLEFIELD, playerA, "Acolyte of Xathrid"); // 0/5 | ||
|
||
addCard(Zone.BATTLEFIELD, playerB, "Phyrexian Walker"); // 0/3 | ||
addCard(Zone.BATTLEFIELD, playerB, "Dryad Arbor"); // 1/1 | ||
addCard(Zone.BATTLEFIELD, playerB, "Runeclaw Bear"); // 2/2 | ||
addCard(Zone.BATTLEFIELD, playerB, "Southern Elephant"); // 3/4 | ||
} | ||
|
||
private Permanent getBlocker(String blocker, mage.game.Game game) { | ||
return game.getBattlefield().getAllActivePermanents() | ||
.stream() | ||
.filter(p -> p.getName().equals(blocker)) | ||
.findFirst() | ||
.get(); | ||
} | ||
|
||
@Test | ||
public void testAttackerLessThanTadeasAttackBlockerPowerEqualAttacker() { | ||
attack(1, playerA, "Canopy Spider"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent equalPowerBlocker = getBlocker("Dryad Arbor", game); | ||
assertTrue(game.getCombat().getGroups().get(0).canBlock(equalPowerBlocker, game), | ||
"equalPowerBlocker should be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerLessThanTadeasAttackBlockerPowerMoreThanAttacker() { | ||
attack(1, playerA, "Sweet-Gum Recluse"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent morePowerBlocker = getBlocker("Southern Elephant", game); | ||
assertFalse(game.getCombat().getGroups().get(0).canBlock(morePowerBlocker, game), | ||
"morePowerBlocker should not be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerLessThanTadeasAttackWithoutReachBlockerPowerMoreThanAttacker() { | ||
attack(1, playerA, "Canopy Spider"); | ||
attack(1, playerA, "Acolyte of Xathrid"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent morePowerBlocker = getBlocker("Runeclaw Bear", game); | ||
assertTrue(game.getCombat().getGroups().get(1).canBlock(morePowerBlocker, game), | ||
"morePowerBlocker should be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerEqualTadeasAttackBlockerPowerLessThanAttacker() { | ||
attack(1, playerA, "Canopy Spider"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent lessPowerBlocker = getBlocker("Phyrexian Walker", game); | ||
assertTrue(game.getCombat().getGroups().get(0).canBlock(lessPowerBlocker, game), | ||
"lessPowerBlocker should be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerEqualTadeasAttackBlockerPowerEqualAttacker() { | ||
attack(1, playerA, "Canopy Spider"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent equalPowerBlocker = getBlocker("Dryad Arbor", game); | ||
assertTrue(game.getCombat().getGroups().get(0).canBlock(equalPowerBlocker, game), | ||
"equalPowerBlocker should be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerEqualTadeasAttackBlockerPowerMoreThanAttacker() { | ||
attack(1, playerA, "Canopy Spider"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent morePowerBlocker = getBlocker("Southern Elephant", game); | ||
assertFalse(game.getCombat().getGroups().get(0).canBlock(morePowerBlocker, game), | ||
"morePowerBlocker should not be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerMoreThanTadeasAttackBlockerPowerLessThanAttacker() { | ||
attack(1, playerA, "Brood Weaver"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent lessPowerBlocker = getBlocker("Dryad Arbor", game); | ||
assertTrue(game.getCombat().getGroups().get(0).canBlock(lessPowerBlocker, game), | ||
"lessPowerBlocker should not be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerMoreThanTadeasAttackBlockerPowerEqualAttacker() { | ||
attack(1, playerA, "Brood Weaver"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent equalPowerBlocker = getBlocker("Runeclaw Bear", game); | ||
assertTrue(game.getCombat().getGroups().get(0).canBlock(equalPowerBlocker, game), | ||
"equalPowerBlocker should be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
|
||
@Test | ||
public void testAttackerMoreThanTadeasAttackBlockerPowerMoreThanAttacker() { | ||
attack(1, playerA, "Brood Weaver"); | ||
runCode("check blocking", 1, PhaseStep.DECLARE_BLOCKERS, playerB, (info, player, game) -> { | ||
Permanent morePowerBlocker = getBlocker("Southern Elephant", game); | ||
assertFalse(game.getCombat().getGroups().get(0).canBlock(morePowerBlocker, game), | ||
"morePowerBlocker should not be able to block"); | ||
}); | ||
|
||
setStrictChooseMode(true); | ||
setStopAt(1, PhaseStep.END_TURN); | ||
execute(); | ||
} | ||
} |