Merge origin/master

This commit is contained in:
LevelX2 2015-04-20 10:57:39 +02:00
commit 89ce87e16e
57 changed files with 2814 additions and 1336 deletions

View file

@ -0,0 +1,51 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.abilities.activated;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PutOntoBattlefieldTest extends CardTestPlayerBase {
/**
* Tests to put a token onto the battlefield
*/
@Test
public void testOozeFlux() {
// Enchantment
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
addCard(Zone.BATTLEFIELD, playerA, "Ooze Flux");
// Trample
// Kalonian Hydra enters the battlefield with four +1/+1 counters on it.
// Whenever Kalonian Hydra attacks, double the number of +1/+1 counters on each creature you control.
addCard(Zone.BATTLEFIELD, playerA, "Kalonian Hydra");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{G},");
setChoice(playerA, "X=2"); // Remove how many
setChoice(playerA,"Kalonian Hydra");
setChoice(playerA, "X=2"); // Remove from Hydra
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, "Kalonian Hydra", 2, 2);
assertPermanentCount(playerA, "Ooze", 1);
assertPowerToughness(playerA, "Ooze", 2, 2);
}
}

View file

@ -30,7 +30,6 @@ package org.mage.test.cards.abilities.other;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -42,7 +41,7 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
/**
* Soulfire Grand Master
* Creature â Human Monk 2/2, 1W (2)
* Creature - Human Monk 2/2, 1W (2)
* Lifelink
* Instant and sorcery spells you control have lifelink.
* {2}{U/R}{U/R}: The next time you cast an instant or sorcery spell from
@ -233,5 +232,67 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
assertLife(playerA, 20);
}
/**
* I activated the ability of Soulfire grand master, it resolved, then i cast Stoke the Flames
* on Whisperwood Elemental, my opponenet sacrificed the elemental, so stoke didnt resolve,
* but i still got the life from lifelink.
*/
@Test
public void testSoulfireStokeTheFlames() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
addCard(Zone.HAND, playerA, "Stoke the Flames");
addCard(Zone.BATTLEFIELD, playerA, "Soulfire Grand Master", 1);
addCard(Zone.BATTLEFIELD, playerB, "Whisperwood Elemental", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{U/R}{U/R}:");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Stoke the Flames", "Whisperwood Elemental");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Sacrifice {this}", null ,"{this} deals 4 damage");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Stoke the Flames", 1); // no legal target left so the spell is countered and goes to graveyard
assertGraveyardCount(playerB, "Whisperwood Elemental", 1);
assertLife(playerB, 20);
assertLife(playerA, 20);
}
/**
* Check if second ability resolved, the next spell that is counterer
* won't go to hand back because it did not resolve
*
*/
@Test
public void testSoulfireCounteredSpellDontGoesBack() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
addCard(Zone.HAND, playerA, "Stoke the Flames");
addCard(Zone.BATTLEFIELD, playerA, "Soulfire Grand Master", 1);
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
addCard(Zone.HAND, playerB, "Counterspell", 1);
addCard(Zone.BATTLEFIELD, playerB, "Whisperwood Elemental", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{U/R}{U/R}:");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Stoke the Flames", "Whisperwood Elemental");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Counterspell", "Stoke the Flames");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerB, "Counterspell", 1);
assertGraveyardCount(playerA, "Stoke the Flames", 1); // no legal target left so the spell is countered and goes to graveyard
assertLife(playerB, 20);
assertLife(playerA, 20);
}
}

View file

@ -74,16 +74,20 @@ public class DungeonGeistsTest extends CardTestPlayerBase {
public void testWithBlink() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
// When Dungeon Geists enters the battlefield, tap target creature an opponent controls.
// That creature doesn't untap during its controller's untap step for as long as you control Dungeon Geists.
addCard(Zone.HAND, playerA, "Dungeon Geists");
addCard(Zone.HAND, playerA, "Cloudshift");
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard");
addTarget(playerA, "Craw Wurm"); // first target Craw Wurm
addTarget(playerA, "Elite Vanguard"); // after Cloudshift effect (return back to battlefield) target Elite Vanguard
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dungeon Geists");
addTarget(playerA, "Craw Wurm"); // first target Craw Wurm
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Dungeon Geists");
addTarget(playerA, "Elite Vanguard"); // after Cloudshift effect (return back to battlefield) target Elite Vanguard
setStopAt(2, PhaseStep.DRAW);
execute();

View file

@ -0,0 +1,66 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.triggers.state;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class SynodCenturionTest extends CardTestPlayerBase {
/**
* Check that Synod Centurion gets sacrificed if no other artifacts are on the battlefield
*
*/
@Test
public void testAlone() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
addCard(Zone.BATTLEFIELD, playerA, "Demon's Horn");
addCard(Zone.HAND, playerA, "Shatter");
addCard(Zone.HAND, playerA, "Synod Centurion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Synod Centurion");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Shatter", "Demon's Horn");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Demon's Horn", 1);
assertGraveyardCount(playerA, "Shatter", 1);
assertGraveyardCount(playerA, "Synod Centurion", 1);
}
/**
* Check that Synod Centurion gets sacrificed if the only other
* artifact left the battlefiled for a short time
*
*/
@Test
public void testWithFlicker() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 6);
addCard(Zone.BATTLEFIELD, playerA, "Bottle Gnomes");
addCard(Zone.HAND, playerA, "Cloudshift");
addCard(Zone.HAND, playerA, "Synod Centurion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Synod Centurion");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Bottle Gnomes");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Bottle Gnomes", 1);
assertGraveyardCount(playerA, "Cloudshift", 1);
assertGraveyardCount(playerA, "Synod Centurion", 1);
}
}

View file

@ -502,6 +502,18 @@ public class TestPlayer extends ComputerPlayer {
return super.announceXCost(min, max, message, game, ability, null);
}
@Override
public int getAmount(int min, int max, String message, Game game) {
if (!choices.isEmpty()) {
if (choices.get(0).startsWith("X=")) {
int xValue = Integer.parseInt(choices.get(0).substring(2));
choices.remove(0);
return xValue;
}
}
return super.getAmount(min, max, message, game);
}
protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
if (permanents.size() > 0) {