Skip to content

Effect.SetCondition ​

Signature ​

lua
Effect.SetCondition(Effect e, function con_func) -> void

Description ​

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.

Parameters ​

  • e Effect
  • con_func function

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.
CardIDScriptDetected Calls
Salamandra with Chain62091148Scripts/c62091148.lua2
Astrograph Sorcerer, the Starfrost Magician48171151Scripts/c48171151.lua2
Artmage Non-Finito74631897Scripts/c74631897.lua3
Pendulum Evolution55795155Scripts/c55795155.lua2
Levia-Dragoon - Daedalus78579058Scripts/c78579058.lua3
Lady's Dragonmaid48658295Scripts/c48658295.lua1
Azure Ocean Dragon Lord - Neo-Daedalus Rage41570943Scripts/c41570943.lua2
Eternal Favorite87532344Scripts/c87532344.lua2
Astrograph Sorcerer76794549Scripts/c76794549.lua2
Spellbook of the Grand Circle11911336Scripts/c11911336.lua1
Goyo Emperor59255742Scripts/c59255742.lua3
Accel Synchro Stardust Dragon30983281Scripts/c30983281.lua2
Melffy Playtime Surprise58036097Scripts/c58036097.lua1
Ashtraja Susanoo17020474Scripts/c17020474.lua1
Deftero Enneacraft - "alazoneIA"92171126Scripts/c92171126.lua2
Destiny HERO - Destro-Dogma25158975Scripts/c25158975.lua3
Yomagna the Fire Phantom17350692Scripts/c17350692.lua1
El Shaddoll Apkallone50907446Scripts/c50907446.lua1
Mementotlan Fusion66518509Scripts/c66518509.lua2
Meteoroa Drytron24166324Scripts/c24166324.lua1
Favorite HERO Flame Wingman13243124Scripts/c13243124.lua2
Mixousia the Confounder80843006Scripts/c80843006.lua1
Gem-Knight Dispersion24220368Scripts/c24220368.lua1
Invoked Sorath43989315Scripts/c43989315.lua1
...and 9091 more

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)