* Summoning Trap - Fixed error that occured if countered with Remand and fixed check that the counter was cast by opponent.

This commit is contained in:
LevelX2 2013-08-27 15:18:45 +02:00
parent 09e37835b7
commit 80ed481de5
2 changed files with 18 additions and 4 deletions

View file

@ -163,6 +163,9 @@ class CastedSpellsWithSpellTarget extends WatcherImpl<CastedSpellsWithSpellTarge
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {
StackObject stackObject = game.getStack().getStackObject(event.getTargetId());
if (stackObject == null) {
stackObject = (StackObject) game.getLastKnownInformation(event.getTargetId(), Zone.STACK);
}
if (stackObject != null && stackObject.getStackAbility() != null) {
for (Target target: stackObject.getStackAbility().getTargets()) {
if (target instanceof TargetSpell && target.getFirstTarget() != null) {

View file

@ -47,6 +47,7 @@ import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetCard;
import mage.watchers.Watcher;
@ -108,10 +109,20 @@ class SummoningTrapWatcher extends WatcherImpl<SummoningTrapWatcher> {
if (condition == true) {// no need to check - condition has already occured
return;
}
if (event.getType() == EventType.COUNTERED
&& game.getStack().getStackObject(event.getTargetId()).getCardType().contains(CardType.CREATURE)
&& game.getOpponents(controllerId).contains(event.getPlayerId())) {
condition = true;
if (event.getType() == EventType.COUNTERED) {
StackObject stackObject = game.getStack().getStackObject(event.getTargetId());
if (stackObject == null) {
stackObject = (StackObject) game.getLastKnownInformation(event.getTargetId(), Zone.STACK);
}
StackObject counterObject = game.getStack().getStackObject(event.getSourceId());
if (counterObject == null) {
counterObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK);
}
if (stackObject != null && counterObject != null
&& stackObject.getCardType().contains(CardType.CREATURE)
&& game.getOpponents(controllerId).contains(counterObject.getControllerId())) {
condition = true;
}
}
}
}