Effect.SetCondition
Signature
lua
Effect.SetCondition(Effect e, function con_func) -> voidDescription
Sets e's condition callback. The callback decides whether the effect can apply or be activated in the current context.
How To Use It
Conditions answer whether the effect can apply or be activated in the current context.
Keep condition callbacks side-effect free. They may be called while the engine is only checking legality:
lua
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL)
end
e1:SetCondition(s.spcon)For activated effects, costs and targets still get their own legality checks. The condition should describe the timing or state requirement that belongs to the effect itself.
Related Functions
Parameters
eEffectcon_funcfunction
Source
D:\Programs\GitHub\ygopro-core\libeffect.cpp:625
Guided Examples
Learn how to use this function in context:
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 9115 indexed script(s).
- Search this function in the Script Explorer with
Effect.SetCondition.
Script Examples
Salamandra with Chain (62091148)
Source: Scripts/c62091148.lua
lua
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCondition(aux.dscon)
e1:SetCost(s.cost)
e1:SetTarget(s.target)Astrograph Sorcerer, the Starfrost Magician (48171151)
Source: Scripts/c48171151.lua
lua
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,id+o)
e2:SetCondition(s.spcon1)
e2:SetTarget(s.sptg1)
e2:SetOperation(s.spop1)Artmage Non-Finito (74631897)
Source: Scripts/c74631897.lua
lua
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetCode(EVENT_SPSUMMON_SUCCESS)
e0:SetCondition(s.condition)
e0:SetOperation(s.regop)
c:RegisterEffect(e0)