Skip to content

Duel.GetTargetCount ​

Signature ​

lua
Duel.GetTargetCount(function|nil filter, int player, int location1, int location2, Card|Group|nil exception, [... any]) -> int

Description ​

Counts cards matching filter in the given field locations that can be used as effect targets, excluding exception when supplied.

Parameters ​

  • filter function|nil
  • player int
  • location1 int
  • location2 int
  • exception Card|Group|nil
  • ... any optional

Returns ​

  • int

Source ​

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

Used By ​

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

  • Detected in 26 indexed script(s).
  • Search this function in the Script Explorer with Duel.GetTargetCount.
CardIDScriptDetected Calls
D/D/D Alfred the Divine Sage King11852093Scripts/c11852093.lua1
Amazement Administrator Arlekino94821366Scripts/c94821366.lua1
Astrazma Urania18738846Scripts/c18738846.lua1
Tauzenet Wadjet73490148Scripts/c73490148.lua1
Gouki The Master Ogre30286474Scripts/c30286474.lua1
Exstellarknight Constellar Ptolemy Ω76195332Scripts/c6195332.lua1
Sacred Noble Knight of King Custennin78876707Scripts/c78876707.lua1
Legendary Lord Six Samurai - Enishi70634245Scripts/c70634245.lua1
Red Dragon Archfiend's Chains92936364Scripts/c92936364.lua1
Clown Crew Finale84031736Scripts/c84031736.lua1
Infinitrack Earth Slicer97584719Scripts/c97584719.lua1
Ragnaraika Selene Snapper75352507Scripts/c75352507.lua1
Jade Dragon Mech69191257Scripts/c69191257.lua1
Barrage Blast51369889Scripts/c51369889.lua1
Dark Armed Dragon Punisher39030883Scripts/c39030883.lua1
Gungnir, Dragon of the Ice Barrier65749035Scripts/c65749035.lua1
Brionac, Dragon of the Ice Barrier50321796Scripts/c50321796.lua1
Superdreadnought Rail Cannon Flying Launcher38354018Scripts/c38354018.lua1
Superheavy Samurai Steam Train King17775525Scripts/c17775525.lua1
XYZ Hyper Cannon21723081Scripts/c21723081.lua1
Predaplast72129804Scripts/c72129804.lua1
Dance Princess of the Ice Barrier59546528Scripts/c59546528.lua1
Linkslayer35595518Scripts/c35595518.lua1
Red Ogre68722455Scripts/c68722455.lua1
...and 2 more

Script Examples ​

D/D/D Alfred the Divine Sage King (11852093) ​

Source: Scripts/c11852093.lua

lua
function s.tftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
	if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and s.tffilter(chkc,tp) end
	local count1=Duel.GetTargetCount(s.tffilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil,tp)
	local count2=Duel.GetMatchingGroupCount(s.mfilter,tp,LOCATION_MZONE,0,nil)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and count1>0 and count2>0 end

Amazement Administrator Arlekino (94821366) ​

Source: Scripts/c94821366.lua

lua
function c94821366.descost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(c94821366.costfilter,tp,LOCATION_GRAVE,0,1,nil) end
	local rt=Duel.GetTargetCount(nil,tp,0,LOCATION_ONFIELD,nil)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g=Duel.SelectMatchingCard(tp,c94821366.costfilter,tp,LOCATION_GRAVE,0,1,rt,nil)

Astrazma Urania (18738846) ​

Source: Scripts/c18738846.lua

lua
end
function s.discost(e,tp,eg,ep,ev,re,r,rp,chk)
	local ct=Duel.GetTargetCount(aux.NegateAnyFilter,tp,0,LOCATION_ONFIELD,nil)
	if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end
	local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND,0,nil)