Page 1 of 1

Ordering of static effects

PostPosted: 23 Jun 2011, 21:02
by Sloth
There were some bug reports concerning Lignify played on a card that granted a static pump effect. The problem lies in the ordering of static effects. Here is what's happening in checkStateEffects:

1. stAnimate effects get removed
2. stAnimate effects get added
3. stSetPT effects get removed
4. stSetPT effects get added
5. stPump effects get removed
6. stPump effects get added

The problem is when checkStateEffects is called the first time after Lignify was cast. Lignify removes all keywords from the enchanted card in step 2, but the information is needed in step 5 to remove the old stPump effect.
My quick solution is to reorder the effects to:

1. stAnimate effects get removed
3. stSetPT effects get removed
5. stPump effects get removed
2. stAnimate effects get added
4. stSetPT effects get added
6. stPump effects get added

But maybe we can discuss improving the whole system to be closer to the layer system or to improve the performance (someone reported slow downs caused by static effects).

Re: Ordering of static effects

PostPosted: 24 Jun 2011, 01:44
by Braids
if my familiarity with the official rules serves correct, this sort of thing is applied in timestamp order. does that help?

Re: Ordering of static effects

PostPosted: 24 Jun 2011, 06:40
by Sloth
Braids wrote:if my familiarity with the official rules serves correct, this sort of thing is applied in timestamp order. does that help?
Actually it's a wild mix of layers, dependencies and lastly timestamps that define the ordering.

Another thing that's easy to do, to speed things up:
At the moment everything is checked twice in checkStateEffects which is correct sometimes, but only if the gamestate is changed by a static effect. I will add a boolean "checkAgain" that is turned true if something is destroyed or unequipped and if nothing happens static effects won't be checked again. This should almost half the time used up by checkStateEffects.