Attempt to fix a crash caused by an effect of type EFFECT_TYPE_XMATERIAL no longer having an associated handler if the material granting the effect was detached in the same chain in which its effect was activated
If one of such effect has no side effects (no count limit and no value function to execute) glob it with all the other effects, as whichever is picked won't affect the internal lua state and make the player choose the effect only when there is one of such effects that has a count limit or a function to execute.
Semantically the proper operator to use for oneline increments is the preincrement one, the postincrement is the one to be used only in teh cases where the previous value is required.
Make it a templated function taking the parameter type at compile time, this allows performing more sanity checks, and fixes the situations with ambiguity of 0 with nullptr, also fixing some isntances where such behaviour was present.
Removes ambiguity when the core needs a full unsigned 32 bit integer that could be altered when returned as signed integer since lua_Integer is an int64.
Update Effect.SetCountLimit to allow passing a table containing id and hopt index as 3rd parameter, used for when cards have multiple hopt effects that can be acivated.
Also updated Effect.GetCountLimit to reflect this change
Now grant_effect_container is instead a struct containing both an ordered an unordered map, the unordered map is the primairy one, and it's the one that holds the actual values, the sorted map holds only pointers to those elements. This should avoid the crashes when iterating the map and erasing elements, while also allowing to have a sorted access to the elements.
Being unordered, it didn't assure a costant ordering of the effects, possibly changing the order in which they were registered during the duel and making the replays non deterministic
Have base class lua_obj also register the type of the parameter, so that we don't have to rely on calling lua functions, but the value of teh struct can be directly checked
* immune effect
Now card::filter_immune_effect() will collect all immune effect.
The condition check is moved to effect::is_immuned().
* format
* tweak
* remove unnecessary calling filter_immune_effect
Co-authored-by: DailyShana <8469304+DailyShana@users.noreply.github.com>