Duel.IsExistingMatchingCard
Signature
lua
Duel.IsExistingMatchingCard([function|nil f], int player, int s, int o, int count, [Card|Group|nil ex], ... any) -> boolDescription
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)
endUse Duel.IsExistingTarget instead when the card must become an official target of the activating effect.
Parameters
ffunction|niloptionalplayerintsintointcountintexCard|Group|niloptional...any
Returns
bool
Source
D:\Programs\GitHub\ygopro-core\libduel.cpp:4972
Guided Examples
Learn how to use this function in context:
- Methods for Affecting Cards
- Filters, Card Objects, and Group Objects
- First Scripts To Study
- Min/Max Stat Card Selection
- Selection And Group Handling
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.
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)
endArtmage 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)