mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
fixed The Ozolith test (it wasn't actually failing)
This commit is contained in:
parent
9426da5ad3
commit
440adfa18b
2 changed files with 88 additions and 84 deletions
|
@ -14,9 +14,7 @@ import mage.constants.SuperType;
|
|||
import mage.constants.TargetController;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.Counters;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.CounterAnyPredicate;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
@ -61,14 +59,8 @@ public final class TheOzolith extends CardImpl {
|
|||
|
||||
class TheOzolithTriggeredAbility extends LeavesBattlefieldAllTriggeredAbility {
|
||||
|
||||
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(CounterAnyPredicate.instance);
|
||||
}
|
||||
|
||||
TheOzolithTriggeredAbility() {
|
||||
super(null, filter);
|
||||
super(null, StaticFilters.FILTER_CONTROLLED_CREATURE);
|
||||
}
|
||||
|
||||
private TheOzolithTriggeredAbility(final TheOzolithTriggeredAbility ability) {
|
||||
|
@ -85,8 +77,12 @@ class TheOzolithTriggeredAbility extends LeavesBattlefieldAllTriggeredAbility {
|
|||
return false;
|
||||
}
|
||||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||
Counters counters = permanent.getCounters(game);
|
||||
if (counters.values().stream().mapToInt(Counter::getCount).noneMatch(x -> x > 0)) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().clear();
|
||||
this.addEffect(new TheOzolithLeaveEffect(permanent.getCounters(game)));
|
||||
this.addEffect(new TheOzolithLeaveEffect(counters));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package org.mage.test.cards.single.iko;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
@ -12,48 +12,50 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*/
|
||||
public class TheOzolithTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String ozlth = "The Ozolith";
|
||||
private static final String frtld = "Fertilid";
|
||||
private static final String wlkncrps = "Walking Corpse";
|
||||
private static final String flgrn = "Fully Grown";
|
||||
private static final String mrdr = "Murder";
|
||||
private static final String ttrkt = "Tatterkite";
|
||||
private static final String bltbtl = "Blightbeetle";
|
||||
private static final String pnctrblst = "Puncture Blast";
|
||||
private static final String THE_OZOLITH = "The Ozolith";
|
||||
private static final String FERTILID = "Fertilid";
|
||||
private static final String WALKING_CORPSE = "Walking Corpse";
|
||||
private static final String FULLY_GROWN = "Fully Grown";
|
||||
private static final String MURDER = "Murder";
|
||||
private static final String TATTERKITE = "Tatterkite";
|
||||
private static final String BLIGHTBEETLE = "Blightbeetle";
|
||||
private static final String PUNCTURE_BLAST = "Puncture Blast";
|
||||
private static final String BRANCHING_EVOLUTION = "Branching Evolution";
|
||||
private static final String MARCH_OF_THE_MACHINES = "March of the Machines";
|
||||
|
||||
@Test
|
||||
public void testTheOzolithGetCounters() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Bayou", 6);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ozlth);
|
||||
addCard(Zone.BATTLEFIELD, playerA, frtld);
|
||||
addCard(Zone.HAND, playerA, flgrn);
|
||||
addCard(Zone.HAND, playerA, mrdr);
|
||||
addCard(Zone.BATTLEFIELD, playerA, THE_OZOLITH);
|
||||
addCard(Zone.BATTLEFIELD, playerA, FERTILID);
|
||||
addCard(Zone.HAND, playerA, FULLY_GROWN);
|
||||
addCard(Zone.HAND, playerA, MURDER);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flgrn, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, FULLY_GROWN, FERTILID);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mrdr, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, MURDER, FERTILID);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, frtld, 0);
|
||||
assertCounterCount(ozlth, CounterType.P1P1, 2);
|
||||
assertCounterCount(ozlth, CounterType.TRAMPLE, 1);
|
||||
assertPermanentCount(playerA, FERTILID, 0);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.P1P1, 2);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.TRAMPLE, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTheOzolithGiveCounters() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Bayou", 6);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ozlth);
|
||||
addCard(Zone.BATTLEFIELD, playerA, frtld);
|
||||
addCard(Zone.BATTLEFIELD, playerA, wlkncrps);
|
||||
addCard(Zone.HAND, playerA, flgrn);
|
||||
addCard(Zone.HAND, playerA, mrdr);
|
||||
addCard(Zone.BATTLEFIELD, playerA, THE_OZOLITH);
|
||||
addCard(Zone.BATTLEFIELD, playerA, FERTILID);
|
||||
addCard(Zone.BATTLEFIELD, playerA, WALKING_CORPSE);
|
||||
addCard(Zone.HAND, playerA, FULLY_GROWN);
|
||||
addCard(Zone.HAND, playerA, MURDER);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flgrn, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, FULLY_GROWN, FERTILID);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mrdr, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, MURDER, FERTILID);
|
||||
|
||||
setChoice(playerA, "Yes"); // Move counters at beginning of combat
|
||||
|
||||
|
@ -61,22 +63,22 @@ public class TheOzolithTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, frtld, 0);
|
||||
assertCounterCount(wlkncrps, CounterType.P1P1, 2);
|
||||
assertCounterCount(wlkncrps, CounterType.TRAMPLE, 1);
|
||||
assertCounterCount(ozlth, CounterType.P1P1, 0);
|
||||
assertCounterCount(ozlth, CounterType.TRAMPLE, 0);
|
||||
assertPermanentCount(playerA, FERTILID, 0);
|
||||
assertCounterCount(WALKING_CORPSE, CounterType.P1P1, 2);
|
||||
assertCounterCount(WALKING_CORPSE, CounterType.TRAMPLE, 1);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.P1P1, 0);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.TRAMPLE, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTheOzolithCantGiveAnyCounters() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ozlth);
|
||||
addCard(Zone.BATTLEFIELD, playerA, frtld);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ttrkt);
|
||||
addCard(Zone.HAND, playerA, mrdr);
|
||||
addCard(Zone.BATTLEFIELD, playerA, THE_OZOLITH);
|
||||
addCard(Zone.BATTLEFIELD, playerA, FERTILID);
|
||||
addCard(Zone.BATTLEFIELD, playerA, TATTERKITE);
|
||||
addCard(Zone.HAND, playerA, MURDER);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mrdr, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, MURDER, FERTILID);
|
||||
|
||||
setChoice(playerA, "Yes"); // Move counters at beginning of combat
|
||||
|
||||
|
@ -84,24 +86,24 @@ public class TheOzolithTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, frtld, 0);
|
||||
assertCounterCount(ttrkt, CounterType.P1P1, 0);
|
||||
assertCounterCount(ozlth, CounterType.P1P1, 2);
|
||||
assertPermanentCount(playerA, FERTILID, 0);
|
||||
assertCounterCount(TATTERKITE, CounterType.P1P1, 0);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.P1P1, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTheOzolithCantGiveSomeCounters() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Bayou", 6);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ozlth);
|
||||
addCard(Zone.BATTLEFIELD, playerA, frtld);
|
||||
addCard(Zone.BATTLEFIELD, playerA, wlkncrps);
|
||||
addCard(Zone.HAND, playerA, flgrn);
|
||||
addCard(Zone.HAND, playerA, mrdr);
|
||||
addCard(Zone.BATTLEFIELD, playerB, bltbtl);
|
||||
addCard(Zone.BATTLEFIELD, playerA, THE_OZOLITH);
|
||||
addCard(Zone.BATTLEFIELD, playerA, FERTILID);
|
||||
addCard(Zone.BATTLEFIELD, playerA, WALKING_CORPSE);
|
||||
addCard(Zone.HAND, playerA, FULLY_GROWN);
|
||||
addCard(Zone.HAND, playerA, MURDER);
|
||||
addCard(Zone.BATTLEFIELD, playerB, BLIGHTBEETLE);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flgrn, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, FULLY_GROWN, FERTILID);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mrdr, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, MURDER, FERTILID);
|
||||
|
||||
setChoice(playerA, "Yes"); // Move counters at beginning of combat
|
||||
|
||||
|
@ -109,26 +111,26 @@ public class TheOzolithTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, frtld, 0);
|
||||
assertCounterCount(wlkncrps, CounterType.P1P1, 0);
|
||||
assertCounterCount(wlkncrps, CounterType.TRAMPLE, 1);
|
||||
assertCounterCount(ozlth, CounterType.P1P1, 2);
|
||||
assertCounterCount(ozlth, CounterType.TRAMPLE, 0);
|
||||
assertPermanentCount(playerA, FERTILID, 0);
|
||||
assertCounterCount(WALKING_CORPSE, CounterType.P1P1, 0);
|
||||
assertCounterCount(WALKING_CORPSE, CounterType.TRAMPLE, 1);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.P1P1, 2);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.TRAMPLE, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTheOzolithMultiples() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Bayou", 6);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ozlth, 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, THE_OZOLITH, 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mirror Gallery");
|
||||
addCard(Zone.BATTLEFIELD, playerA, frtld);
|
||||
addCard(Zone.BATTLEFIELD, playerA, wlkncrps);
|
||||
addCard(Zone.HAND, playerA, flgrn);
|
||||
addCard(Zone.HAND, playerA, mrdr);
|
||||
addCard(Zone.BATTLEFIELD, playerA, FERTILID);
|
||||
addCard(Zone.BATTLEFIELD, playerA, WALKING_CORPSE);
|
||||
addCard(Zone.HAND, playerA, FULLY_GROWN);
|
||||
addCard(Zone.HAND, playerA, MURDER);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flgrn, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, FULLY_GROWN, FERTILID);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mrdr, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, MURDER, FERTILID);
|
||||
|
||||
setChoice(playerA, "Yes", 2); // Move counters at beginning of combat
|
||||
|
||||
|
@ -136,30 +138,36 @@ public class TheOzolithTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, frtld, 0);
|
||||
assertCounterCount(wlkncrps, CounterType.P1P1, 4);
|
||||
assertCounterCount(wlkncrps, CounterType.TRAMPLE, 2);
|
||||
assertCounterCount(ozlth, CounterType.P1P1, 0);
|
||||
assertCounterCount(ozlth, CounterType.TRAMPLE, 0);
|
||||
assertPermanentCount(playerA, FERTILID, 0);
|
||||
assertCounterCount(WALKING_CORPSE, CounterType.P1P1, 4);
|
||||
assertCounterCount(WALKING_CORPSE, CounterType.TRAMPLE, 2);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.P1P1, 0);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.TRAMPLE, 0);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testTheOzolithMinusPlus() {
|
||||
// TODO: this test fails because of incorrect last known information handling
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ozlth);
|
||||
addCard(Zone.BATTLEFIELD, playerA, frtld);
|
||||
addCard(Zone.HAND, playerA, pnctrblst);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Taiga", 9);
|
||||
addCard(Zone.BATTLEFIELD, playerA, THE_OZOLITH);
|
||||
addCard(Zone.BATTLEFIELD, playerA, MARCH_OF_THE_MACHINES);
|
||||
addCard(Zone.HAND, playerA, FERTILID);
|
||||
addCard(Zone.HAND, playerA, BRANCHING_EVOLUTION);
|
||||
addCard(Zone.HAND, playerA, PUNCTURE_BLAST);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, pnctrblst, frtld);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, FERTILID);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, BRANCHING_EVOLUTION);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, PUNCTURE_BLAST, FERTILID);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, frtld, 0);
|
||||
assertCounterCount(ozlth, CounterType.P1P1, 2);
|
||||
assertCounterCount(ozlth, CounterType.M1M1, 3);
|
||||
assertPermanentCount(playerA, FERTILID, 0);
|
||||
// The Ozolith should be a creature which received 4 +1/+1 counters and 3 -1/-1 counters
|
||||
// (2 +1/+1 counters from Fertilid doubled by Branching Evolution)
|
||||
assertType(THE_OZOLITH, CardType.CREATURE, true);
|
||||
// The counters then cancel out and there should only be a single +1/+1 counter left
|
||||
assertCounterCount(THE_OZOLITH, CounterType.P1P1, 1);
|
||||
assertCounterCount(THE_OZOLITH, CounterType.M1M1, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue