Add Hivestone tests

This commit is contained in:
Alexsandro 2017-01-11 14:08:34 -02:00
parent 4bf2137e9d
commit 1d91e04ac1
2 changed files with 38 additions and 7 deletions

View file

@ -10,6 +10,7 @@ import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -49,10 +50,11 @@ class CreaturesAreSliversEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
for (Permanent perm : permanents) { for (Permanent perm : permanents) {
List<String> cardSubType = perm.getSubtype(game); List<String> cardSubType = perm.getSubtype(game);
if (!cardSubType.contains("Sliver")) { if (!cardSubType.contains("Sliver") && perm.getOwnerId() == player.getId()) {
cardSubType.add("Sliver"); cardSubType.add("Sliver");
} }
} }

View file

@ -1,13 +1,14 @@
package org.mage.test.cards.single.tsp; package org.mage.test.cards.single.tsp;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.Filter;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* Created by Alexsandr0x. * Created by Alexsandr0x.
*/ */
public class HivestoneTest extends CardTestPlayerBase { public class HivestoneTest extends CardTestPlayerBase {
/** /**
@ -15,8 +16,21 @@ public class HivestoneTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void abilityCheckTest() { public void abilityCheckTest() {
// Coloca criatura qualquer em campo, uma no player A e outra no player B, checa se addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1);
// receberam o subtipo addCard(Zone.BATTLEFIELD, playerA, "Hivestone", 1);
addCard(Zone.BATTLEFIELD, playerA, "Muscle Sliver", 1);
addCard(Zone.BATTLEFIELD, playerB, "Runeclaw Bear", 1);
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPowerToughness(playerA, "Grizzly Bears", 3, 3, Filter.ComparisonScope.Any);
assertPowerToughness(playerB, "Runeclaw Bear", 2, 2, Filter.ComparisonScope.Any);
} }
/** /**
@ -25,7 +39,22 @@ public class HivestoneTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void rootSliverTest() { public void rootSliverTest() {
// com o root sliver e a hivestone em campo, tenta counterar uma carta que não é sliver vinda addCard(Zone.HAND, playerA, "Grizzly Bears", 1);
// da mão (tem que funcionar, ja que a carta não é sliver na stack) addCard(Zone.BATTLEFIELD, playerA, "Hivestone", 1);
// Root Sliver can't be countered. Sliver spells can't be countered by spells or abilities.
addCard(Zone.BATTLEFIELD, playerA, "Root Sliver", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
addCard(Zone.HAND, playerB, "Counterspell");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Counterspell", "Grizzly Bears", "Grizzly Bears");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, 1);
} }
} }