-
-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Sometimes, the type signature of a function changes depending on its usage elsewhere in the script.
In the following example, s.spcon takes e,tp,eg,ep,ev,re,r,rp as parameters due to it being set as the condition of trigger effect.
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)But if it was set as the condition of a non-activating Special Summon effect, it only takes e,c:
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)This is common for functions passed to SetTarget, SetCondition, SetOperation, and SetValue. It's somewhat unique to ygopro scripting, or at least there doesn't seem to be other projects that attempt to document types that change like this beyond just explaining their usage in the description.
Currently, the only way to sort-of represent this is to document types like ConditionFunction to have different overloads, and each overload specifying what values correspond to them via their description.