mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
* 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:
parent
09e37835b7
commit
80ed481de5
2 changed files with 18 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue