mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
Added test (failing because bug not fixed yet). Some minor changes.
This commit is contained in:
parent
9dde5c2810
commit
fb819f1f51
4 changed files with 96 additions and 10 deletions
|
@ -28,16 +28,16 @@
|
|||
package mage.sets.tenthedition;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,10 @@ public class NantukoHusk extends CardImpl {
|
|||
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledCreaturePermanent())));
|
||||
|
||||
// Sacrifice a creature: Nantuko Husk gets +2/+2 until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn),
|
||||
new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature")))));
|
||||
}
|
||||
|
||||
public NantukoHusk(final NantukoHusk card) {
|
||||
|
|
|
@ -72,4 +72,42 @@ public class FlameshadowConjuringTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* I created a token copy of Wurmcoil Engine and sacrificed it. This gave me
|
||||
* 4 tokens
|
||||
*/
|
||||
@Test
|
||||
public void testWurmcoilEngine() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7);
|
||||
// Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature.
|
||||
// That token gains haste. Exile it at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Flameshadow Conjuring", 1);
|
||||
// Sacrifice a creature: Nantuko Husk gets +2/+2 until end of turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Nantuko Husk", 1);
|
||||
|
||||
// Deathtouch, lifelink
|
||||
// When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield.
|
||||
addCard(Zone.HAND, playerA, "Wurmcoil Engine", 1); // 6/6 - {6}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wurmcoil Engine");
|
||||
setChoice(playerA, "Yes");
|
||||
|
||||
attack(1, playerA, "Wurmcoil Engine");
|
||||
attack(1, playerA, "Nantuko Husk");
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice a creature");
|
||||
// addTarget(playerA, "Wurmcoil Engine[only copy]");
|
||||
setChoice(playerA, "Wurmcoil Engine[only copy]");
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Wurmcoil Engine", 1);
|
||||
assertPowerToughness(playerA, "Nantuko Husk", 4, 4);
|
||||
assertLife(playerB, 12);
|
||||
assertLife(playerA, 26);
|
||||
|
||||
assertPermanentCount(playerA, "Wurm", 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||
import mage.filter.predicate.permanent.BlockingPredicate;
|
||||
import mage.filter.predicate.permanent.SummoningSicknessPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.Graveyard;
|
||||
import mage.game.Table;
|
||||
|
@ -478,6 +479,7 @@ public class TestPlayer implements Player {
|
|||
FilterCreatureForCombat filter = new FilterCreatureForCombat();
|
||||
filter.add(new NamePredicate(groups[0]));
|
||||
filter.add(Predicates.not(new AttackingPredicate()));
|
||||
filter.add(Predicates.not(new SummoningSicknessPredicate()));
|
||||
Permanent attacker = findPermanent(filter, computerPlayer.getId(), game);
|
||||
if (attacker != null && attacker.canAttack(defenderId, game)) {
|
||||
computerPlayer.declareAttacker(attacker.getId(), defenderId, game, false);
|
||||
|
@ -571,21 +573,37 @@ public class TestPlayer implements Player {
|
|||
String[] targetList = choose2.split("\\^");
|
||||
boolean targetFound = false;
|
||||
for (String targetName : targetList) {
|
||||
boolean originOnly = false;
|
||||
boolean copyOnly = false;
|
||||
if (targetName.endsWith("]")) {
|
||||
if (targetName.endsWith("[no copy]")) {
|
||||
originOnly = true;
|
||||
targetName = targetName.substring(0, targetName.length() - 9);
|
||||
}
|
||||
if (targetName.endsWith("[only copy]")) {
|
||||
copyOnly = true;
|
||||
targetName = targetName.substring(0, targetName.length() - 11);
|
||||
}
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterPermanent, game)) {
|
||||
if (target.getTargets().contains(permanent.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (permanent.getName().equals(targetName)) {
|
||||
if (target.isNotTarget() || ((TargetPermanent) target).canTarget(computerPlayer.getId(), permanent.getId(), null, game)) {
|
||||
target.add(permanent.getId(), game);
|
||||
targetFound = true;
|
||||
break;
|
||||
if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) {
|
||||
target.add(permanent.getId(), game);
|
||||
targetFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ((permanent.getName() + "-" + permanent.getExpansionSetCode()).equals(targetName)) {
|
||||
if (target.isNotTarget() || ((TargetPermanent) target).canTarget(computerPlayer.getId(), permanent.getId(), null, game)) {
|
||||
target.add(permanent.getId(), game);
|
||||
targetFound = true;
|
||||
break;
|
||||
if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) {
|
||||
target.add(permanent.getId(), game);
|
||||
targetFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 mage.filter.predicate.permanent;
|
||||
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SummoningSicknessPredicate implements Predicate<Permanent> {
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return input.hasSummoningSickness();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Summoning sickness";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue