Duel.GetMatchingGroup
Signature
lua
Duel.GetMatchingGroup([function|nil f], int player, int s, int o, [Card|Group|nil ex], ... any) -> GroupDescription
Returns a Group containing cards from the specified locations 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 when you need to keep or further process all matching cards rather than only checking if they exist.
s and o are location masks from player's point of view. For example, LOCATION_MZONE,0 means that player's Monster Zone, while 0,LOCATION_MZONE means the opponent's Monster Zone.
lua
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if #g>0 then
Duel.HintSelection(g)
endParameters
ffunction|niloptional - Filter callback; nil accepts cards that pass location and exclusion checks.playerint- Reference player for the s and o location masks.sint- Location mask on player's side.oint- Location mask on the opponent's side from player's viewpoint.exCard|Group|niloptional - Card or Group excluded from the result; nil excludes nothing....any- Extra values forwarded to f after the candidate Card.
Returns
Group- New Group containing every matching card.
Source
D:\Programs\GitHub\ygopro-core\libduel.cpp:4969
Guided Examples
Learn how to use this function in context:
- Methods for Affecting Cards
- Beginner Script Ladder
- Filters, Card Objects, and Group Objects
- First Scripts To Study
- Min/Max Stat Card Selection
- Special Summon-Only Monster Guide
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 3272 indexed script(s).
- Search this function in the Script Explorer with
Duel.GetMatchingGroup.
Script Examples
Salamandra with Chain (62091148)
Source: Scripts/c62091148.lua
lua
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp)
local mg2=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_GRAVE,0,nil)
mg1:Merge(mg2)
local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)Astrograph Sorcerer, the Starfrost Magician (48171151)
Source: Scripts/c48171151.lua
lua
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter0,nil,e)
local mg2=Duel.GetMatchingGroup(s.filter1,tp,LOCATION_EXTRA,0,nil,e)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)Artmage Non-Finito (74631897)
Source: Scripts/c74631897.lua
lua
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
local g=s.getrg(tp,c)
local g2=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local tc=g2:SelectUnselect(nil,tp,false,true,1,1)