Functions from the auxiliary library, assume the stack has always at least 5 empty slots, add macro ensure_luaL_stack to wrap every such call so that the stack is checked for enough free space beforehand. This will make mandatory to use the latest version of visual studio 2017 as minimum for windows (it was already being required for c++17 support regardless), as it needs the conformant c++ preprocessor option to be used.
Made the function more constexpr friendly, removing the need to perform the switch at runtime.
Also now when a parameter doesn't match the required type, its type will also be printed in the error as well.
Rewrite the whole ``process`` function of the processor to use instead tag dispatching on variant objects.
Each single processor message got rewritten as a struct, inheriting from a base templated Process struct, containing only the required data for that process, rather than using the generic structure that ended up needing to spam bitwise operations to pack as many arguments in a byte as possible. This makes things easier to follow and streamlines the addition of new processes:
- Define its struct with the parameters it expects by also providing a constructor
- If the process requires an answer, inherit it from ``Process<true>``, if it requires no answer, inherit it from ``Process<false>``
- Add such struct to the ``processors`` variant type
- Declare and implement its corresponding ``bool process(Processors::NewProcess& arg);`` function
Added new flags for Duel.GetChainInfo:
TRIGGERING_STATUS: the status of the card
TRIGGERING_SUMMON_LOCATION: the summon location of the card
TRIGGERING_SUMMON_TYPE: its summon type
TRIGGERING_SUMMON_PROC_COMPLETE: if the card was properly summoned or not when it triggered the effect
TRIGGERING_SETCODES: the archetypes the card had when it activated the effect
It was entirely redoundant as the info it returned are obtainable via Duel.GetCurrentChain in the case the passed index was 0, and in any other circumstance the returned information was needed already to call Duel.GetChainInfo in first place
Import the changes from the script implementation for Duel.ConfirmCards.
It will now raise EVENT_CONFIRM whenever a card is revealed, and EVENT_TOHAND_CONFIRM whenever a card is revealed, the current event was EVENT_TO_HAND and it's currently in the hand, needed to interact with "Puppet King", "Puppet Queen" and "Vanquish Soul Jiaolong".
---------
Co-authored-by: Edoardo Lolletti <edoardo762@gmail.com>
Added Duel.IsMainPhase, Duel.IsBatlePhase, Duel.IsPhase and Duel.IsTurnPlayer.
Update Card.IsCanBeEffectTarget: Prevent tokens that are no longer on the field from being valid cards for this function
Update lua functions to already have the pduel parameter passed inside them, thus not needing to manually retrieve them in the functions.
Add also a yieldk macro that does the same thing but for the yield continuation function, removing the redoundancies
Most of the library functions are used as "class member functions" where the first parameter is always the corresponding lua object, update the LUA_FUNCTION macro so that the functions already have a "self" parameter corresponding to the already parsed lua object.
Added a new LUA_STATIC_FUNCTION macro for functions that are to be called without an associated object
* Update Card.IsReleasable to accept a second, optional parameter for the reason. Update GetReleaseGroup, GetReleaseGroupCount the same way as well, with the new parameter being the 4th. Defaulting it to REASON_COST will prevent massive script changes (cards that tribute by effect already use Card.IsReleasableByEffect).
* Update EFFECT_CANNOT_RELEASE to pass the reason and the reason effect a 4th and 5th parameters to its target function
* Pass the reason down the line until get_release_list, check_release_list,is_player_can_release and card::is_releasable_by_nonsummon, updating internal function calls accordingly
---------
Co-authored-by: Edoardo Lolletti <edoardo762@gmail.com>
Do the required changes to make Duel.AnnounceRace work with the new types and also any possible newly added type removing some hardcodings down the way and adding some extra checks, also apply the same updates to Duel.AnnounceAttribute