Skip to content

Duel.IsCanAddCounter ​

Signature ​

lua
Duel.IsCanAddCounter(int player, [int countertype], [int count], [Card c]) -> bool

Description ​

With only player, checks whether player is not forbidden from placing counters. With countertype, count, and c, checks player-wide counter placement restrictions for that card target. It does not replace Card.IsCanAddCounter; use the Card check when you need to confirm the card's permit, face-up state, location, and counter limit.

Parameters ​

  • player int - Player attempting to place counters.
  • countertype int optional - Counter type to test when the card-target overload is used.
  • count int optional - Number of counters to test when the card-target overload is used.
  • c Card optional - Card target passed to player-level counter-placement restriction effects.

Returns ​

  • bool - true when the player-level placement check passes; this does not by itself prove c can hold or receive the counters.

Source ​

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

Guided Examples ​

Learn how to use this function in context:

Used By ​

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

  • Detected in 24 indexed script(s).
  • Search this function in the Script Explorer with Duel.IsCanAddCounter.
CardIDScriptDetected Calls
Endymion, the Mighty Master of Magic3611830Scripts/c3611830.lua1
Reflection of Endymion39000945Scripts/c39000945.lua2
Magister of Endymion66104644Scripts/c66104644.lua2
Cubic Rebirth71442223Scripts/c71442223.lua1
Limit Code86607583Scripts/c86607583.lua1
Servant of Endymion92559258Scripts/c92559258.lua2
Cubic Mandala8837932Scripts/c8837932.lua1
Mythical Beast Medusa54965929Scripts/c54965929.lua1
Forge a New Future27104921Scripts/c27104921.lua1
Summer Schoolwork Successful!77751766Scripts/c77751766.lua1
Link Turret55034079Scripts/c55034079.lua1
Ursarctic Radiation32692693Scripts/c32692693.lua1
Apocavities28531163Scripts/c28531163.lua1
Gouki Cage Match85638822Scripts/c85638822.lua1
Mythical Bestiary38325384Scripts/c38325384.lua1
Kaiju Capture Mission81057455Scripts/c81057455.lua1
War Rock Ordeal71331215Scripts/c71331215.lua1
Linkbelt Wall Dragon63092423Scripts/c63092423.lua1
Okiku's Dish Count89086647Scripts/c89086647.lua1
Pitch-Black Power Stone34029630Scripts/c34029630.lua1
Battlewasp - Nest25221249Scripts/c25221249.lua1
Double Payback5914184Scripts/c5914184.lua1
Cauldron of the Old Man91740879Scripts/c91740879.lua1
Gadget Box8025950Scripts/c8025950.lua1

Script Examples ​

Endymion, the Mighty Master of Magic (3611830) ​

Source: Scripts/c3611830.lua

lua
	local c=e:GetHandler()
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
		and Duel.IsCanAddCounter(tp,0x1,1,c) end
	local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
	Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)

Reflection of Endymion (39000945) ​

Source: Scripts/c39000945.lua

lua
end
function c39000945.spfilter(c,e,tp)
	return c:IsCanHaveCounter(0x1) and Duel.IsCanAddCounter(tp,0x1,1,c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c39000945.sptg(e,tp,eg,ep,ev,re,r,rp,chk)

Magister of Endymion (66104644) ​

Source: Scripts/c66104644.lua

lua
end
function c66104644.spfilter(c,e,tp)
	return c:IsFaceup() and c:IsCanHaveCounter(0x1) and Duel.IsCanAddCounter(tp,0x1,1,c)
		and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end