mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
2 DKA
This commit is contained in:
parent
e2740b3c2d
commit
1dbc0a2be5
9 changed files with 643 additions and 36 deletions
|
|
@ -0,0 +1,32 @@
|
|||
package org.mage.test.cards;
|
||||
|
||||
import mage.Constants;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class TestHuntmasterOfTheFells extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCard() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
|
||||
addCard(Constants.Zone.HAND, playerA, "Huntmaster of the Fells");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Ornithopter");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Huntmaster of the Fells");
|
||||
setStopAt(3, Constants.PhaseStep.DRAW);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 22);
|
||||
assertLife(playerB, 18);
|
||||
assertPermanentCount(playerA, "Wolf", 1);
|
||||
assertPermanentCount(playerA, "Huntmaster of the Fells", 0);
|
||||
assertPermanentCount(playerA, "Ravager of the Fells", 1);
|
||||
assertPermanentCount(playerB, "Ornithopter", 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package org.mage.test.cards;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* also tests emblems
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class TestSorinLordOfInnistrad extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCard() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sorin, Lord of Innistrad");
|
||||
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "+1: put a a 1/1 black Vampire creature token with lifelink onto the battlefield. ");
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
assertPermanentCount(playerA, "Sorin, Lord of Innistrad", 1);
|
||||
assertPermanentCount(playerA, "Vampire", 1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCard2() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sorin, Lord of Innistrad");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sejiri Merfolk");
|
||||
|
||||
addCounters(1, Constants.PhaseStep.UPKEEP, playerA, "Sorin, Lord of Innistrad", CounterType.LOYALTY, 1);
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "-2: You get an emblem with \"[creature you control get +1/+0. ]\". ");
|
||||
activateAbility(3, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "-2: You get an emblem with \"[creature you control get +1/+0. ]\". ");
|
||||
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
assertPermanentCount(playerA, "Sorin, Lord of Innistrad", 0);
|
||||
assertPermanentCount(playerA, "Sejiri Merfolk", 1);
|
||||
assertPowerToughness(playerA, "Sejiri Merfolk", 4, 1, Filter.ComparisonScope.Any);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCard3() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sorin, Lord of Innistrad");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Craw Wurm");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Angel of Mercy");
|
||||
|
||||
addCounters(1, Constants.PhaseStep.UPKEEP, playerA, "Sorin, Lord of Innistrad", CounterType.LOYALTY, 3);
|
||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "-6: ", "Craw Wurm^Angel of Mercy");
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 23);
|
||||
assertLife(playerB, 20);
|
||||
assertPermanentCount(playerA, "Sorin, Lord of Innistrad", 0);
|
||||
assertPermanentCount(playerA, "Craw Wurm", 1);
|
||||
assertPermanentCount(playerB, "Craw Wurm", 0);
|
||||
assertPermanentCount(playerA, "Angel of Mercy", 1);
|
||||
assertPermanentCount(playerB, "Angel of Mercy", 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ import mage.Constants;
|
|||
import mage.Constants.PhaseStep;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.counters.Counter;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.filter.common.FilterCreatureForCombat;
|
||||
|
|
@ -80,7 +81,7 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
command = command.substring(command.indexOf("activate:") + 9);
|
||||
String[] groups = command.split(";");
|
||||
for (Ability ability: this.getPlayable(game, true)) {
|
||||
if (ability.toString().equals(groups[0])) {
|
||||
if (ability.toString().startsWith(groups[0])) {
|
||||
if (groups.length > 1) {
|
||||
addTargets(ability, groups, game);
|
||||
}
|
||||
|
|
@ -90,6 +91,18 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (action.getAction().startsWith("addCounters:")) {
|
||||
String command = action.getAction();
|
||||
command = command.substring(command.indexOf("addCounters:") + 12);
|
||||
String[] groups = command.split(";");
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(groups[0])) {
|
||||
Counter counter = new Counter(groups[1], Integer.parseInt(groups[2]));
|
||||
permanent.addCounters(counter, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pass();
|
||||
|
|
@ -158,18 +171,21 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
}
|
||||
else if (group.startsWith("target=")) {
|
||||
target = group.substring(group.indexOf("target=") + 7);
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(target)) {
|
||||
ability.getTargets().get(0).addTarget(permanent.getId(), ability, game);
|
||||
break;
|
||||
String[] targets = target.split("\\^");
|
||||
for (String t: targets) {
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(t)) {
|
||||
ability.getTargets().get(0).addTarget(permanent.getId(), ability, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator<StackObject> it = game.getStack().iterator();
|
||||
while (it.hasNext()) {
|
||||
StackObject object = it.next();
|
||||
if (object.getName().equals(target)) {
|
||||
ability.getTargets().get(0).addTarget(object.getId(), ability, game);
|
||||
break;
|
||||
Iterator<StackObject> it = game.getStack().iterator();
|
||||
while (it.hasNext()) {
|
||||
StackObject object = it.next();
|
||||
if (object.getName().equals(t)) {
|
||||
ability.getTargets().get(0).addTarget(object.getId(), ability, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import org.mage.test.serverside.base.MageTestPlayerBase;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.PhaseStep;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import org.mage.test.player.TestPlayer;
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns card list containter for specified game zone and player.
|
||||
*
|
||||
|
|
@ -490,7 +491,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
player.addAction(turnNum, step, "activate:" + ability + ";target=" + targetName);
|
||||
}
|
||||
|
||||
public void useAbility(int turnNum, PhaseStep step, TestPlayer player, String cardName) {
|
||||
public void addCounters(int turnNum, PhaseStep step, TestPlayer player, String cardName, CounterType type, int count) {
|
||||
player.addAction(turnNum, step, "addCounters:" + cardName + ";" + type.getName() + ";" + count);
|
||||
}
|
||||
|
||||
public void attack(int turnNum, TestPlayer player, String attacker) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue