added companion class for Nature's Claim and test game

master
melvin 2011-06-09 14:27:17 +08:00
parent c76e4303a9
commit cd3df78880
2 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,36 @@
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.*;
public class Nature_s_Claim {
public static final MagicSpellCardEvent e = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack.getCard(),
cardOnStack.getController(),
MagicTargetChoice.NEG_TARGET_ARTIFACT_OR_ENCHANTMENT,
new MagicDestroyTargetPicker(false),
new Object[]{cardOnStack},
this,
"Destroy target artifact or enchantment$. Its controller gains 4 life.");
}
@Override
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
game.doAction(new MagicMoveCardAction((MagicCardOnStack)data[0]));
final MagicPermanent permanent = event.getTarget(game,choiceResults,0);
if (permanent!=null) {
game.doAction(new MagicDestroyAction(permanent));
game.doAction(new MagicChangeLifeAction(permanent.getController(),4));
}
}
};
}

View File

@ -0,0 +1,44 @@
package magic.test;
import magic.model.*;
import magic.model.phase.MagicMainPhase;
class TestNaturesClaim extends TestGameBuilder {
/**
* Raging Ravine changed into 3/3 RG creature cannot block Guardian of the
* Guildpack which has protection from monocolored
* Fixed by making the protection check use getColorFlags in addition to getColoredTypeg
*/
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,"Nature's Claim",3);
P = opponent;
P.setLife(20);
addToLibrary(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
addToHand(P,"Signal Pest",3);
return game;
}
}