Added another test.

This commit is contained in:
LevelX2 2015-04-19 09:13:58 +02:00
parent 59a9a97910
commit a5967d9b2a
4 changed files with 289 additions and 230 deletions

View file

@ -52,8 +52,6 @@ public class MimingSlime extends CardImpl {
super(ownerId, 126, "Miming Slime", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
this.expansionSetCode = "GTC";
this.color.setGreen(true);
// Put an X/X green Ooze creature token onto the battlefield, where X is the greatest power among creatures you control.
this.getSpellAbility().addEffect(new MimingSlimeEffect());
}

View file

@ -54,8 +54,6 @@ public class OozeFlux extends CardImpl {
super(ownerId, 128, "Ooze Flux", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
this.expansionSetCode = "GTC";
this.color.setGreen(true);
// {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.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new OozeFluxCreateTokenEffect(new OozeToken()),new ManaCostsImpl("{1}{G}"));
ability.addCost(new RemoveVariableCountersTargetCost(new FilterControlledCreaturePermanent("creatures you control"), CounterType.P1P1, "one or more", 1));
@ -74,7 +72,7 @@ public class OozeFlux extends CardImpl {
class OozeFluxCreateTokenEffect extends OneShotEffect {
private Token token;
private final Token token;
public OozeFluxCreateTokenEffect(Token token) {
super(Outcome.PutCreatureInPlay);

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

@ -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) {