mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[ZNR] fixed party count including opposing creatures, updated test (fixes #7061)
This commit is contained in:
parent
bdef7a0d2b
commit
100c130cec
2 changed files with 47 additions and 4 deletions
|
@ -9,6 +9,7 @@ import mage.constants.PhaseStep;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.player.TestPlayer;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
|
@ -17,8 +18,12 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
public class PartyCountTest extends CardTestPlayerBase {
|
||||
|
||||
private void makeTester() {
|
||||
makeTester(playerA);
|
||||
}
|
||||
|
||||
private void makeTester(TestPlayer player) {
|
||||
addCustomCardWithAbility(
|
||||
"tester", playerA,
|
||||
"tester", player,
|
||||
new SimpleActivatedAbility(
|
||||
new GainLifeEffect(PartyCount.instance), new ManaCostsImpl<>("{0}")
|
||||
)
|
||||
|
@ -26,16 +31,37 @@ public class PartyCountTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
private void useTester() {
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{0}:");
|
||||
useTester(playerA);
|
||||
}
|
||||
|
||||
private void useTester(TestPlayer player) {
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, player, "{0}:");
|
||||
}
|
||||
|
||||
private void makeCreature(String name, SubType... subTypes) {
|
||||
makeCreature(name, playerA, subTypes);
|
||||
}
|
||||
|
||||
private void makeCreature(String name, TestPlayer player, SubType... subTypes) {
|
||||
addCustomCardWithAbility(
|
||||
name, playerA, null, null,
|
||||
CardType.CREATURE, "{1}", Zone.BATTLEFIELD, subTypes
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoMembers() {
|
||||
makeTester();
|
||||
|
||||
useTester();
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleMember() {
|
||||
makeTester();
|
||||
|
@ -143,6 +169,23 @@ public class PartyCountTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 24);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpponent() {
|
||||
makeTester(playerA);
|
||||
makeTester(playerB);
|
||||
makeCreature("crt1", playerB, SubType.CLERIC);
|
||||
|
||||
useTester(playerA);
|
||||
useTester(playerB);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 21);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangelings() {
|
||||
makeTester();
|
||||
|
|
|
@ -5,7 +5,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -18,7 +18,7 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public enum PartyCount implements DynamicValue {
|
||||
instance;
|
||||
private static final FilterPermanent filter = new FilterCreaturePermanent();
|
||||
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
|
|
Loading…
Reference in a new issue