Continuous effects of layer 2 not handled correctly
Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins
Continuous effects of layer 2 not handled correctly
by LevelX » 21 Jun 2014, 14:24
Recently I encountered the following situation in a match:
First I played a Control Magic on a creature of my opponent.
Later he plays a Mind Control on the same creature to get it back.
The problem was, that creature never lost summoning sickness.
Clearly this happened because we apply all continuous effects one after another (order by time stamp) every time we apply effects.
So in XMage the control of the creature changes every time the effects were applied what happened quite often during one turn.
I checked the rules (maybe they are not that clear at this point) but I got answers from rule boards, that the control does not change anymore, after the second enchantment is casted. That means, that our handling (at least in this layer) is not correct and has to be changed to only apply the latest effect for each target while applying the continuous effects.
Probably this can also be a problem in other layers, but I did not thought about that in detail yet.
Any ideas how to fix that behaviour or other thoughts about that issue are much appreciated.
First I played a Control Magic on a creature of my opponent.
Later he plays a Mind Control on the same creature to get it back.
The problem was, that creature never lost summoning sickness.
Clearly this happened because we apply all continuous effects one after another (order by time stamp) every time we apply effects.
So in XMage the control of the creature changes every time the effects were applied what happened quite often during one turn.
I checked the rules (maybe they are not that clear at this point) but I got answers from rule boards, that the control does not change anymore, after the second enchantment is casted. That means, that our handling (at least in this layer) is not correct and has to be changed to only apply the latest effect for each target while applying the continuous effects.
Probably this can also be a problem in other layers, but I did not thought about that in detail yet.
Any ideas how to fix that behaviour or other thoughts about that issue are much appreciated.
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
Re: Continuous effects of layer 2 not handled correctly
by quercitron » 23 Jun 2014, 13:26
Don't know about other layers, but I have some ideas how to fix ControlChangingEffects layer.
I think we can change control and make all actions connected to this at one place, when all ControlChangingEffects layer effects have been applied already (now for example we set controlledFromStartOfControllerTurn to false every time changeController method is called; it's the reason of issue with summoning sickness).
There will be three steps:
1. reset controller before ControlChangingEffects layer effects
2. when changeController is called we just change controllerId
3. right after ControlChangingEffects layer effects we check control change for all permanents (now we do it at the end of general applyEffects method), and only in this step make all actions connected to control change:
For tricky cases, e.g. when Mind Control is controlled by Steal Enchantment that is controlled by Steal Enchantment, we can reapply ControlChangingEffects layer effects again and again while control change events happen.
I can try to implement this approach if you think it is reasonable.
I think we can change control and make all actions connected to this at one place, when all ControlChangingEffects layer effects have been applied already (now for example we set controlledFromStartOfControllerTurn to false every time changeController method is called; it's the reason of issue with summoning sickness).
There will be three steps:
1. reset controller before ControlChangingEffects layer effects
- Code: Select all
this.beforeResetControllerId = this.controllerId
this.controllerId = this.originControllerId
2. when changeController is called we just change controllerId
- Code: Select all
Player newController = game.getPlayer(newControllerId);
if (newController != null && (!newController.hasLeft() || !newController.hasLost())) {
this.controllerId = newControllerId
}
3. right after ControlChangingEffects layer effects we check control change for all permanents (now we do it at the end of general applyEffects method), and only in this step make all actions connected to control change:
- Code: Select all
if (!this.controllerId.equals(this.beforeResetControllerId) {
this.removeFromCombat(game);
this.controlledFromStartOfControllerTurn = false;
this.abilities.setControllerId(this.controllerId);
game.getContinuousEffects().setController(this.objectId, this.controllerId);
game.fireEvent(new GameEvent(EventType.LOST_CONTROL, this.objectId, this.objectId, this.beforeResetControllerId));
game.fireEvent(new GameEvent(EventType.GAINED_CONTROL, this.objectId, this.objectId, this.controllerId));
}
For tricky cases, e.g. when Mind Control is controlled by Steal Enchantment that is controlled by Steal Enchantment, we can reapply ControlChangingEffects layer effects again and again while control change events happen.
I can try to implement this approach if you think it is reasonable.
- quercitron
- Posts: 17
- Joined: 09 Nov 2011, 08:32
- Has thanked: 0 time
- Been thanked: 1 time
Re: Continuous effects of layer 2 not handled correctly
by LevelX » 23 Jun 2014, 13:40
Thanks, sounds very good.I guess it will work.
Go for the implementation.
Go for the implementation.
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests