Skip to content

Duel.Destroy ​

Signature ​

lua
Duel.Destroy(Card|Group targets, int reason, [int dest], [int reason_player]) -> int

Description ​

Destroys targets for reason and returns the number of cards actually destroyed. dest defaults to LOCATION_GRAVE. reason_player defaults to the current Chain's reason player. Use REASON_EFFECT for normal card effects and reserve REASON_RULE for rule/procedure cleanup. Use Duel.SetOperationInfo with CATEGORY_DESTROY in the target callback when the cards or source location are known before resolution.

How To Use It ​

Use this during resolution after checking that the target is still related to the effect.

The return value is important. It is 0 when no card was actually destroyed, for example because the card left the expected place or could not be destroyed.

lua
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then
    -- follow-up that requires successful destruction
end

Use Duel.SetOperationInfo(0,CATEGORY_DESTROY,...) in the Target callback when the destruction is known before resolution.

Parameters ​

  • targets Card|Group
  • reason int
  • dest int optional
  • reason_player int optional

Returns ​

  • int

Source ​

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

Guided Examples ​

Learn how to use this function in context:

Used By ​

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

  • Detected in 2744 indexed script(s).
  • Search this function in the Script Explorer with Duel.Destroy.
CardIDScriptDetected Calls
Astrograph Sorcerer, the Starfrost Magician48171151Scripts/c48171151.lua1
Astrograph Sorcerer76794549Scripts/c76794549.lua1
Mementotlan Fusion66518509Scripts/c66518509.lua1
Enneacraft - Asta.PIXEA28454232Scripts/c28454232.lua1
Odd-Eyes Revolution Dragon16306932Scripts/c16306932.lua1
Graydle Split75361204Scripts/c75361204.lua2
Enneacraft - Archa.TAIL81237046Scripts/c81237046.lua1
D/D/D/D Dimensional King Arc Crisis71398055Scripts/c71398055.lua1
Dark End Evaporation Dragon62002838Scripts/c62002838.lua1
Future Fusion Nova92058902Scripts/c92058902.lua2
Enneacraft - Atil.SPIA71801447Scripts/c71801447.lua2
Enneacraft - Aiza.LEON82359538Scripts/c82359538.lua1
Junoldo the Shadespirit Power Patron10266279Scripts/c10266279.lua2
D/D/D/D Super-Dimensional Sovereign Emperor Zero Paradox97417863Scripts/c97417863.lua2
Bujinki Ahashima71095768Scripts/c71095768.lua1
Tellusion the Magna Warrior24431911Scripts/c24431911.lua1
Vidolium the Unstable Power Patron of Unity70488851Scripts/c70488851.lua1
Chronograph Sorcerer12289247Scripts/c12289247.lua1
DoSolfachord Coolia80776622Scripts/c80776622.lua1
Rescue Hamster50485594Scripts/c50485594.lua1
A Bao A Qu, the Lightless Shadow4731783Scripts/c4731783.lua1
Camelot, Realm of Noble Knights and Noble Arms15635751Scripts/c15635751.lua1
Earthbound Servant Geo Gremlin8690387Scripts/c8690387.lua1
Mitsurugi Magatama76725398Scripts/c76725398.lua1
...and 2720 more

Script Examples ​

Astrograph Sorcerer, the Starfrost Magician (48171151) ​

Source: Scripts/c48171151.lua

lua
	local c=e:GetHandler()
	if not c:IsRelateToChain() then return end
	if Duel.Destroy(c,REASON_EFFECT)==0 then return end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
	local g=Duel.SelectMatchingCard(tp,s.pfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,tp)

Astrograph Sorcerer (76794549) ​

Source: Scripts/c76794549.lua

lua
function c76794549.rpop(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	if c:IsRelateToEffect(e) and Duel.Destroy(c,REASON_EFFECT)>0 then
		Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(76794549,6))
		local g=Duel.SelectMatchingCard(tp,c76794549.rpfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)

Mementotlan Fusion (66518509) ​

Source: Scripts/c66518509.lua

lua
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
	local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_MZONE,0,1,1,nil)
	if Duel.Destroy(g,REASON_EFFECT)<1 then return end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
	local sg=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil)