* Some minor adjustements to test handling.

This commit is contained in:
LevelX2 2015-05-04 18:37:41 +02:00
parent 70480ebb5e
commit 1f44e1a592
3 changed files with 15 additions and 3 deletions

View file

@ -71,6 +71,7 @@ import mage.target.TargetSource;
import mage.target.TargetSpell;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetPermanentOrPlayer;
import static org.mage.test.serverside.base.CardTestPlayerBase.NO_TARGET;
/**
*
@ -134,7 +135,7 @@ public class TestPlayer extends ComputerPlayer {
for (Ability ability: this.getPlayable(game, true)) {
if (ability.toString().startsWith(groups[0])) {
Ability newAbility = ability.copy();
if (groups.length > 1) {
if (groups.length > 1 && !groups[1].equals("target=NO_TARGET")) {
if (!addTargets(newAbility, groups, game)) {
// targets could not be set -> try next priority
break;
@ -543,7 +544,7 @@ public class TestPlayer extends ComputerPlayer {
return null;
}
private boolean checkExecuteCondition(String[] groups, Game game) {
private boolean checkExecuteCondition(String[] groups, Game game) {
if (groups[2].startsWith("spellOnStack=")) {
String spellOnStack = groups[2].substring(13);
for (StackObject stackObject: game.getStack()) {

View file

@ -31,6 +31,8 @@ import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
*/
public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
public static final String NO_TARGET = "NO_TARGET";
protected enum ExpectedType {
TURN_NUMBER,
RESULT,
@ -39,7 +41,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
GRAVEYARD,
UNKNOWN
}
protected GameOptions gameOptions;
public CardTestPlayerBase() {

View file

@ -796,6 +796,15 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
player.addAction(turnNum, step, "activate:" + ability + "$target=" + targetName);
}
/**
*
* @param turnNum
* @param step
* @param player
* @param ability
* @param targetName if not target has to be defined use the constant NO_TARGET
* @param spellOnStack
*/
public void activateAbility(int turnNum, PhaseStep step, TestPlayer player, String ability, String targetName, String spellOnStack) {
StringBuilder sb = new StringBuilder("activate:").append(ability);
if (targetName != null && !targetName.isEmpty()) {