Duel.GetTargetsRelateToChain
Signature
Duel.GetTargetsRelateToChain() -> GroupDescription
Returns all target cards currently related to the resolving Chain. This is the relation-aware helper for multi-target operations; targets that left their expected place are omitted from the returned Group. The returned Group can be empty, so check its count before applying a follow-up action.
How To Use It
Use this during resolution when a targeting effect selected more than one card and only the targets still related to the Chain should be affected.
local g=Duel.GetTargetsRelateToChain()
if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
endThe returned Group can be empty. It is built from the current Chain's target cards and relation state, so it is usually clearer than manually filtering CHAININFO_TARGET_CARDS.
Related Functions
Returns
Group- New Group containing the current Chain targets whose Chain relation is still valid; empty when none qualify.
Source
D:\Programs\GitHub\ygopro-core\libduel.cpp:4950
Guided Examples
Learn how to use this function in context:
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 177 indexed script(s).
- Search this function in the Script Explorer with
Duel.GetTargetsRelateToChain.
Script Examples
Astrograph Sorcerer, the Starfrost Magician (48171151)
Source: Scripts/c48171151.lua
if not c:IsRelateToChain() then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end
local desg=Duel.GetTargetsRelateToChain():Filter(s.spfilter1,nil,e,tp)
if #desg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)Ashtraja Susanoo (17020474)
Source: Scripts/c17020474.lua
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetTargetsRelateToChain()
if aux.NecroValleyNegateCheck(g) then return end
local sg=g:Filter(aux.NecroValleyFilter(),nil)D/D/D Alfred the Divine Sage King (11852093)
Source: Scripts/c11852093.lua
end
function s.tfop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetTargetsRelateToChain()
local sct=Duel.GetLocationCount(tp,LOCATION_SZONE)
local ct=math.min(g:GetCount(),sct)