mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Some changes to restrained event handling (simultaneous events) (fixes #897).
This commit is contained in:
parent
a5967d9b2a
commit
568f62c66f
8 changed files with 1023 additions and 935 deletions
|
@ -1,145 +1,146 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.WatcherScope;
|
import mage.constants.WatcherScope;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.predicate.mageobject.NamePredicate;
|
import mage.filter.predicate.mageobject.NamePredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class SiftThroughSands extends CardImpl {
|
public class SiftThroughSands extends CardImpl {
|
||||||
|
|
||||||
private static final String rule = "If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library";
|
private static final String rule = "If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library";
|
||||||
private static final FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
private static final FilterCreatureCard filter = new FilterCreatureCard("a card named The Unspeakable");
|
||||||
static {
|
static {
|
||||||
filter.add(new NamePredicate("The Unspeakable"));
|
filter.add(new NamePredicate("The Unspeakable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SiftThroughSands(UUID ownerId) {
|
public SiftThroughSands(UUID ownerId) {
|
||||||
super(ownerId, 84, "Sift Through Sands", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
super(ownerId, 84, "Sift Through Sands", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||||
this.expansionSetCode = "CHK";
|
this.expansionSetCode = "CHK";
|
||||||
this.subtype.add("Arcane");
|
this.subtype.add("Arcane");
|
||||||
|
|
||||||
this.color.setBlue(true);
|
this.color.setBlue(true);
|
||||||
|
|
||||||
// Draw two cards, then discard a card.
|
// Draw two cards, then discard a card.
|
||||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
|
||||||
Effect effect = new DiscardControllerEffect(1);
|
Effect effect = new DiscardControllerEffect(1);
|
||||||
effect.setText(", then discard a card");
|
effect.setText(", then discard a card");
|
||||||
this.getSpellAbility().addEffect(effect);
|
this.getSpellAbility().addEffect(effect);
|
||||||
// If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library.
|
|
||||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, true), new SiftThroughSandsCondition(), rule));
|
// If you've cast a spell named Peer Through Depths and a spell named Reach Through Mists this turn, you may search your library for a card named The Unspeakable, put it onto the battlefield, then shuffle your library.
|
||||||
this.getSpellAbility().addWatcher(new SiftThroughSandsWatcher());
|
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, true), new SiftThroughSandsCondition(), rule));
|
||||||
}
|
this.getSpellAbility().addWatcher(new SiftThroughSandsWatcher());
|
||||||
|
}
|
||||||
public SiftThroughSands(final SiftThroughSands card) {
|
|
||||||
super(card);
|
public SiftThroughSands(final SiftThroughSands card) {
|
||||||
}
|
super(card);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public SiftThroughSands copy() {
|
@Override
|
||||||
return new SiftThroughSands(this);
|
public SiftThroughSands copy() {
|
||||||
}
|
return new SiftThroughSands(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
class SiftThroughSandsCondition implements Condition {
|
|
||||||
|
class SiftThroughSandsCondition implements Condition {
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
@Override
|
||||||
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get("SiftThroughSandsWatcher", source.getControllerId());
|
public boolean apply(Game game, Ability source) {
|
||||||
if (watcher != null) {
|
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get("SiftThroughSandsWatcher", source.getControllerId());
|
||||||
return watcher.conditionMet();
|
if (watcher != null) {
|
||||||
}
|
return watcher.conditionMet();
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
class SiftThroughSandsWatcher extends Watcher {
|
|
||||||
|
class SiftThroughSandsWatcher extends Watcher {
|
||||||
boolean castPeerThroughDepths = false;
|
|
||||||
boolean castReachThroughMists = false;
|
boolean castPeerThroughDepths = false;
|
||||||
|
boolean castReachThroughMists = false;
|
||||||
public SiftThroughSandsWatcher() {
|
|
||||||
super("SiftThroughSandsWatcher", WatcherScope.PLAYER);
|
public SiftThroughSandsWatcher() {
|
||||||
}
|
super("SiftThroughSandsWatcher", WatcherScope.PLAYER);
|
||||||
|
}
|
||||||
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {
|
|
||||||
super(watcher);
|
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {
|
||||||
this.castPeerThroughDepths = watcher.castPeerThroughDepths;
|
super(watcher);
|
||||||
this.castReachThroughMists = watcher.castReachThroughMists;
|
this.castPeerThroughDepths = watcher.castPeerThroughDepths;
|
||||||
}
|
this.castReachThroughMists = watcher.castReachThroughMists;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public SiftThroughSandsWatcher copy() {
|
@Override
|
||||||
return new SiftThroughSandsWatcher(this);
|
public SiftThroughSandsWatcher copy() {
|
||||||
}
|
return new SiftThroughSandsWatcher(this);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void watch(GameEvent event, Game game) {
|
@Override
|
||||||
if (condition == true) { //no need to check - condition has already occured
|
public void watch(GameEvent event, Game game) {
|
||||||
return;
|
if (condition == true) { //no need to check - condition has already occured
|
||||||
}
|
return;
|
||||||
if (event.getType() == EventType.SPELL_CAST
|
}
|
||||||
&& controllerId == event.getPlayerId()) {
|
if (event.getType() == EventType.SPELL_CAST
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
&& controllerId == event.getPlayerId()) {
|
||||||
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
castPeerThroughDepths = true;
|
if (spell.getCard().getName().equals("Peer Through Depths")) {
|
||||||
} else if (spell.getCard().getName().equals("Reach Through Mists")) {
|
castPeerThroughDepths = true;
|
||||||
castReachThroughMists = true;
|
} else if (spell.getCard().getName().equals("Reach Through Mists")) {
|
||||||
}
|
castReachThroughMists = true;
|
||||||
condition = castPeerThroughDepths && castReachThroughMists;
|
}
|
||||||
}
|
condition = castPeerThroughDepths && castReachThroughMists;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void reset() {
|
@Override
|
||||||
super.reset();
|
public void reset() {
|
||||||
this.castPeerThroughDepths = false;
|
super.reset();
|
||||||
this.castReachThroughMists = false;
|
this.castPeerThroughDepths = false;
|
||||||
}
|
this.castReachThroughMists = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class DungeonGeists extends CardImpl {
|
||||||
this.expansionSetCode = "DKA";
|
this.expansionSetCode = "DKA";
|
||||||
this.subtype.add("Spirit");
|
this.subtype.add("Spirit");
|
||||||
|
|
||||||
this.color.setBlue(true);
|
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
@ -112,40 +111,52 @@ class DungeonGeistsEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return false;
|
return event.getType() == GameEvent.EventType.UNTAP || event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
||||||
// the battlefield triggered ability the source dies (or will be exiled), then the ZONE_CHANGE or LOST_CONTROL
|
// the battlefield triggered ability the source dies (or will be exiled), then the ZONE_CHANGE or LOST_CONTROL
|
||||||
// event will happen before this effect is applied ever)
|
// event will happen before this effect is applied ever)
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||||
if (sourcePermanent == null || !sourcePermanent.getControllerId().equals(source.getControllerId())) {
|
if (sourcePermanent == null || !sourcePermanent.getControllerId().equals(source.getControllerId())) {
|
||||||
this.used = true;
|
discard();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.LOST_CONTROL) {
|
switch(event.getType()) {
|
||||||
if (event.getTargetId().equals(source.getSourceId())) {
|
case ZONE_CHANGE:
|
||||||
discard();
|
// end effect if source does a zone move
|
||||||
return false;
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
}
|
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||||
|
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
||||||
|
discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case UNTAP:
|
||||||
|
// prevent to untap the target creature
|
||||||
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
||||||
|
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||||
|
if (targetCreature != null) {
|
||||||
|
return targetCreature.getControllerId().equals(game.getActivePlayerId());
|
||||||
|
} else {
|
||||||
|
discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LOST_CONTROL:
|
||||||
|
// end effect if source control is changed
|
||||||
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
|
discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
|
||||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
|
||||||
discard();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
|
||||||
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,16 +74,20 @@ public class DungeonGeistsTest extends CardTestPlayerBase {
|
||||||
public void testWithBlink() {
|
public void testWithBlink() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 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, "Dungeon Geists");
|
||||||
addCard(Zone.HAND, playerA, "Cloudshift");
|
addCard(Zone.HAND, playerA, "Cloudshift");
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
|
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
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");
|
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");
|
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);
|
setStopAt(2, PhaseStep.DRAW);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -215,14 +215,20 @@ public abstract class AbilityImpl implements Ability {
|
||||||
else {
|
else {
|
||||||
game.addEffect((ContinuousEffect) effect, this);
|
game.addEffect((ContinuousEffect) effect, this);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* All restrained trigger events are fired now.
|
||||||
|
* To restrain the events is mainly neccessary because of the movement of multiple object at once.
|
||||||
|
* If the event is fired directly as one object moved, other objects are not already in the correct zone
|
||||||
|
* to check for their effects. (e.g. Valakut, the Molten Pinnacle)
|
||||||
|
*/
|
||||||
|
game.getState().handleSimultaneousEvent(game);
|
||||||
|
game.resetShortLivingLKI();
|
||||||
/**
|
/**
|
||||||
* game.applyEffects() has to be done at least for every effect that moves cards/permanent between zones,
|
* game.applyEffects() has to be done at least for every effect that moves cards/permanent between zones,
|
||||||
* so Static effects work as intened if dependant from the moved objects zone it is in
|
* so Static effects work as intened if dependant from the moved objects zone it is in
|
||||||
* Otherwise for example were static abilities with replacement effects deactivated to late
|
* Otherwise for example were static abilities with replacement effects deactivated to late
|
||||||
* Example: {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
|
* Example: {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
|
||||||
*/
|
*/
|
||||||
// game.applyEffects();
|
|
||||||
// some effects must be applied before next effect is resolved, because effect is dependend.
|
|
||||||
if (effect.applyEffectsAfter()) {
|
if (effect.applyEffectsAfter()) {
|
||||||
game.applyEffects();
|
game.applyEffects();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -108,7 +108,7 @@ public class PermanentToken extends PermanentImpl {
|
||||||
if (!game.replaceEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED))) {
|
if (!game.replaceEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED))) {
|
||||||
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
||||||
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
|
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
|
||||||
game.fireEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED));
|
game.addSimultaneousEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,8 +201,8 @@ public class Spell implements StackObject, Card {
|
||||||
result |= spellAbility.resolve(game);
|
result |= spellAbility.resolve(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.getState().handleSimultaneousEvent(game);
|
// game.getState().handleSimultaneousEvent(game);
|
||||||
game.resetShortLivingLKI();
|
// game.resetShortLivingLKI();
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue