Skip to content

Duel.IsExistingMatchingCard ​

Signature ​

lua
Duel.IsExistingMatchingCard([function|nil f], int player, int s, int o, int count, [Card|Group|nil ex], ... any) -> bool

Description ​

Checks whether the specified locations contain at least count cards that satisfy filter f and are not excluded by ex. s is player's own location mask and o is the opponent's location mask from that player's viewpoint. Extra arguments after ex are passed to f.

How To Use It ​

Use this for activation checks that only need to know whether matching cards exist.

The filter receives each candidate card first, followed by any extra arguments after ex:

lua
function s.filter(c,e,tp)
    return c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end

if chk==0 then
    return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
end

Use Duel.IsExistingTarget instead when the card must become an official target of the activating effect.

Parameters ​

  • f function|nil optional
  • player int
  • s int
  • o int
  • count int
  • ex Card|Group|nil optional
  • ... any

Returns ​

  • bool

Source ​

  • D:\Programs\GitHub\ygopro-core\libduel.cpp:4972

Guided Examples ​

Learn how to use this function in context:

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 7601 indexed script(s).
  • Search this function in the Script Explorer with Duel.IsExistingMatchingCard.
CardIDScriptDetected Calls
Salamandra with Chain62091148Scripts/c62091148.lua3
Astrograph Sorcerer, the Starfrost Magician48171151Scripts/c48171151.lua1
Artmage Non-Finito74631897Scripts/c74631897.lua4
Pendulum Evolution55795155Scripts/c55795155.lua2
Levia-Dragoon - Daedalus78579058Scripts/c78579058.lua2
Lady's Dragonmaid48658295Scripts/c48658295.lua3
Azure Ocean Dragon Lord - Neo-Daedalus Rage41570943Scripts/c41570943.lua2
Eternal Favorite87532344Scripts/c87532344.lua5
Surprise Fusion35167375Scripts/c35167375.lua3
Astrograph Sorcerer76794549Scripts/c76794549.lua4
Spellbook of the Grand Circle11911336Scripts/c11911336.lua2
Ultra Polymerization76647978Scripts/c76647978.lua2
Goyo Emperor59255742Scripts/c59255742.lua1
Accel Synchro Stardust Dragon30983281Scripts/c30983281.lua5
Melffy Playtime Surprise58036097Scripts/c58036097.lua3
Ashtraja Susanoo17020474Scripts/c17020474.lua2
Deftero Enneacraft - "alazoneIA"92171126Scripts/c92171126.lua4
Destiny HERO - Destro-Dogma25158975Scripts/c25158975.lua3
Yomagna the Fire Phantom17350692Scripts/c17350692.lua2
Fiendsmith's Sequence49867899Scripts/c49867899.lua2
D/D/D Alfred the Divine Sage King11852093Scripts/c11852093.lua2
El Shaddoll Apkallone50907446Scripts/c50907446.lua1
Mementotlan Fusion66518509Scripts/c66518509.lua3
Meteoroa Drytron24166324Scripts/c24166324.lua2
...and 7577 more

Script Examples ​

Salamandra with Chain (62091148) ​

Source: Scripts/c62091148.lua

lua
		e2:SetReset(RESET_EVENT+RESETS_STANDARD)
		c:RegisterEffect(e2)
		if Duel.IsExistingMatchingCard(s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
			Duel.BreakEffect()
			Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)

Astrograph Sorcerer, the Starfrost Magician (48171151) ​

Source: Scripts/c48171151.lua

lua
	local c=e:GetHandler()
	if chk==0 then return c:IsDestructable()
		and Duel.IsExistingMatchingCard(s.pfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,tp) end
	Duel.SetOperationInfo(0,CATEGORY_DESTROY,c,1,0,0)
end

Artmage Non-Finito (74631897) ​

Source: Scripts/c74631897.lua

lua
	if Duel.GetFlagEffect(tp,id)>0 then return false end
	local rg=s.getrg(tp,c)
	return rg:GetCount()>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)