mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
Some tests and minor formatting.
This commit is contained in:
parent
91f0951ba2
commit
c449a9b2fd
3 changed files with 75 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import junit.framework.Assert;
|
|||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -90,5 +91,77 @@ public class PersistTest extends CardTestPlayerBase {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInteractionWithLifelink() {
|
||||
|
||||
// Kitchen Finks 3/2 {1}{G/W}{G/W}
|
||||
// Creature - Ouphe
|
||||
// When Kitchen Finks enters the battlefield, you gain 2 life.
|
||||
// Persist (When this creature dies, if it had no -1/-1 counters on it, return it to the battlefield under its owner's control with a -1/-1 counter on it.)
|
||||
//
|
||||
// Persist
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 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.BATTLEFIELD, playerB, "Wurmcoil Engine",1);
|
||||
|
||||
attack(2, playerB, "Wurmcoil Engine");
|
||||
block(2, playerA, "Kitchen Finks", "Wurmcoil Engine");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Wurmcoil Engine", 1);
|
||||
assertPermanentCount(playerA, "Kitchen Finks", 1);
|
||||
assertPowerToughness(playerA, "Kitchen Finks", 2,1);
|
||||
|
||||
assertLife(playerA, 22); // Kitchen Finks +2 life
|
||||
assertLife(playerB, 26); // Wurmcoil Engine +6 ife
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testInteractionWithToporOrb() {
|
||||
|
||||
// Kitchen Finks 3/2 {1}{G/W}{G/W}
|
||||
// Creature - Ouphe
|
||||
// When Kitchen Finks enters the battlefield, you gain 2 life.
|
||||
// Persist (When this creature dies, if it had no -1/-1 counters on it, return it to the battlefield under its owner's control with a -1/-1 counter on it.)
|
||||
//
|
||||
// Persist
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 2);
|
||||
|
||||
/**
|
||||
* 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.BATTLEFIELD, playerB, "Wurmcoil Engine",1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Torpor Orb",1);
|
||||
|
||||
attack(2, playerB, "Wurmcoil Engine");
|
||||
block(2, playerA, "Kitchen Finks", "Wurmcoil Engine");
|
||||
block(2, playerA, "Kitchen Finks", "Wurmcoil Engine");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Wurmcoil Engine", 0);
|
||||
assertPermanentCount(playerB, "Wurm", 2);
|
||||
assertPermanentCount(playerA, "Kitchen Finks", 2);
|
||||
assertPowerToughness(playerA, "Kitchen Finks", 2,1, Filter.ComparisonScope.Any);
|
||||
assertPowerToughness(playerA, "Kitchen Finks", 3,2, Filter.ComparisonScope.Any);
|
||||
|
||||
assertLife(playerA, 20); // No life from Kitchen Finks ETB becaus of Torpor Orb
|
||||
assertLife(playerB, 22); // AI assigns damage only 2 damage to one blocker so only 2 life link (It's a kind of bug (or bad play) of AI)
|
||||
|
||||
}
|
||||
|
||||
|
||||
// some tests were moved to LastKnownInformationTest
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||
import mage.filter.predicate.permanent.BlockingPredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -199,6 +200,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
String[] groups = command.split(";");
|
||||
FilterCreatureForCombatBlock filterBlocker = new FilterCreatureForCombatBlock();
|
||||
filterBlocker.add(new NamePredicate(groups[0]));
|
||||
filterBlocker.add(Predicates.not(new BlockingPredicate()));
|
||||
Permanent blocker = findPermanent(filterBlocker, playerId, game);
|
||||
if (blocker != null) {
|
||||
FilterAttackingCreature filterAttacker = new FilterAttackingCreature();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue