added tests and incomplete code for Frost Titan's abilities

master
melvin 2011-07-06 17:06:39 +08:00
parent 185873d2ac
commit 688156ef74
3 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,63 @@
package magic.card;
import magic.model.event.*;
import magic.model.stack.*;
import magic.model.choice.*;
import magic.model.target.*;
import magic.model.action.*;
import magic.model.trigger.*;
import magic.model.condition.*;
import magic.model.*;
public class Frost_Titan {
public static final MagicTrigger T1 = new MagicTrigger(MagicTriggerType.WhenTargeted) {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
final MagicSource source = (MagicSource)data;
if (source.getController() != permanent.getController()) {
//counter source unless its controller pay {2}
}
return null;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
}
};
//tap target permanent. It doesn't untap during its controller's next untap step.
public static final MagicTrigger T2 = new MagicTrigger(MagicTriggerType.WhenComesIntoPlay) {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
return null;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
}
};
public static final MagicTrigger T3 = new MagicTrigger(MagicTriggerType.WhenAttacks) {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
return null;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
}
};
}

View File

@ -0,0 +1,44 @@
package magic.test;
import magic.model.*;
import magic.model.phase.*;
import magic.ai.*;
class TestMCTSCrash extends TestGameBuilder {
public MagicGame getGame() {
final MagicTournament tournament=new MagicTournament();
tournament.setDifficulty(6);
final MagicPlayerProfile profile=new MagicPlayerProfile("bgruw");
final MagicPlayerDefinition player1=new MagicPlayerDefinition("Player",false,profile,15);
final MagicPlayerDefinition player2=new MagicPlayerDefinition("Computer",true,profile,14);
tournament.setPlayers(new MagicPlayerDefinition[]{player1,player2});
tournament.setStartPlayer(0);
tournament.setAIs(new MagicAI[]{null, new MCTSAI(true, true)});
final MagicGame game=tournament.nextGame(true);
game.setPhase(MagicMainPhase.getFirstInstance());
final MagicPlayer player=game.getPlayer(0);
final MagicPlayer opponent=game.getPlayer(1);
MagicPlayer P = player;
P.setLife(20);
addToLibrary(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
createPermanent(game,P,"Sword of Feast and Famine",false,2);
createPermanent(game,P,"Marisi's Twinclaws",false, 2);
P = opponent;
P.setLife(20);
addToLibrary(P, "Plains", 10);
addToHand(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
createPermanent(game,P,"Mogg Fanatic", false, 1);
createPermanent(game,P,"Knight of Meadowgrain", false, 2);
return game;
}
}

View File

@ -0,0 +1,41 @@
package magic.test;
import magic.model.*;
import magic.model.phase.MagicMainPhase;
class TestSunTitan extends TestGameBuilder {
public MagicGame getGame() {
final MagicTournament tournament=new MagicTournament();
tournament.setDifficulty(6);
final MagicPlayerProfile profile=new MagicPlayerProfile("bgruw");
final MagicPlayerDefinition player1=new MagicPlayerDefinition("Player",false,profile,15);
final MagicPlayerDefinition player2=new MagicPlayerDefinition("Computer",true,profile,14);
tournament.setPlayers(new MagicPlayerDefinition[]{player1,player2});
tournament.setStartPlayer(0);
final MagicGame game=tournament.nextGame(true);
game.setPhase(MagicMainPhase.getFirstInstance());
final MagicPlayer player=game.getPlayer(0);
final MagicPlayer opponent=game.getPlayer(1);
MagicPlayer P = player;
P.setLife(20);
addToLibrary(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
addToHand(P,"Kor Firewalker",3);
addToHand(P,"Sun Titan",3);
P = opponent;
P.setLife(20);
addToLibrary(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
createPermanent(game,P,"Phyrexian Crusader",false,3);
addToHand(P,"Lightning Bolt",3);
return game;
}
}