added Roil Elemental

master
melvin 2012-06-14 21:44:45 +08:00
parent cd9461271e
commit c68141c63f
3 changed files with 138 additions and 0 deletions

View File

@ -0,0 +1,14 @@
name=Roil Elemental
url=http://magiccards.info/zen/en/62.html
image=http://magiccards.info/scans/en/zen/62.jpg
value=4
rarity=R
type=Creature
subtype=Elemental
color=u
converted=6
cost={3}{U}{U}{U}
pt=3/2
ability=flying
timing=main
requires_card_code

View File

@ -0,0 +1,80 @@
package magic.card;
import magic.model.MagicAbility;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicRemoveStaticAction;
import magic.model.action.MagicAddStaticAction;
import magic.model.action.MagicAddTriggerAction;
import magic.model.action.MagicTapAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.choice.MagicMayChoice;
import magic.model.event.MagicEvent;
import magic.model.mstatic.MagicLayer;
import magic.model.mstatic.MagicStatic;
import magic.model.target.MagicTargetFilter;
import magic.model.target.MagicTargetHint;
import magic.model.trigger.MagicWhenOtherComesIntoPlayTrigger;
public class Roil_Elemental {
public static final Object T = new MagicWhenOtherComesIntoPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPermanent played) {
final MagicPlayer player = permanent.getController();
return (player == played.getController() && played.isLand()) ?
new MagicEvent(
permanent,
player,
new MagicMayChoice(
player + " may gain control of target creature for as long as you control " + permanent + ".",
MagicTargetChoice.NEG_TARGET_CREATURE),
MagicEvent.NO_DATA,
this,
"You may$ gain control of target creature$ for as long as you control " + permanent + ".") :
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
public void doAction(final MagicPermanent perm) {
final MagicPermanent source = (MagicPermanent)event.getSource();
final MagicTargetFilter filter = new MagicTargetFilter.MagicPermanentTargetFilter(perm);
final MagicStatic S = new MagicStatic(MagicLayer.Control,filter) {
final int you = source.getController().getIndex();
@Override
public MagicPlayer getController(
final MagicGame game,
final MagicPermanent permanent,
final MagicPlayer player) {
return game.getPlayer(you);
}
@Override
public boolean condition(
final MagicGame game,
final MagicPermanent source,
final MagicPermanent target) {
if (you != source.getController().getIndex()) {
//remove this static after the update
game.addDelayedAction(new MagicRemoveStaticAction(source, this));
return false;
} else {
return true;
}
}
};
game.doAction(new MagicAddStaticAction(source, S));
};
});
}
}
};
}

View File

@ -0,0 +1,44 @@
package magic.test;
import magic.model.MagicGame;
import magic.model.MagicPlayer;
import magic.model.MagicPlayerDefinition;
import magic.model.MagicPlayerProfile;
import magic.model.MagicDuel;
import magic.model.phase.MagicMainPhase;
class TestRoilElemental extends TestGameBuilder {
public MagicGame getGame() {
final MagicDuel duel=new MagicDuel();
duel.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);
duel.setPlayers(new MagicPlayerDefinition[]{player1,player2});
duel.setStartPlayer(0);
final MagicGame game=duel.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,"Roil Elemental",1);
P = opponent;
P.setLife(20);
addToLibrary(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
createPermanent(game,P,"Serra Angel",false,1);
addToHand(P,"Act of Treason",1);
return game;
}
}