Skip to content

Duel.Damage ​

Signature ​

lua
Duel.Damage(int player, int value, int reason, [bool is_step]) -> int

Description ​

Deals value effect damage to player for reason and returns the damage actually applied. If damage is changed into LP recovery or prevented, the return value reflects the final applied damage. Negative input amounts are clamped to 0 by the local binding. With is_step=true, finish the damage/recovery batch with Duel.RDComplete.

How To Use It ​

Use this during resolution when a player takes effect damage or another scripted damage action.

lua
local dealt=Duel.Damage(1-tp,800,REASON_EFFECT)
if dealt>0 then
    -- follow-up that requires actual damage
end

The return value is the actual damage applied. If damage is reversed, prevented, or the input amount is below 0, the returned damage can be 0. For simultaneous LP changes, pass is_step=true for each call and finish with Duel.RDComplete().

Parameters ​

  • player int
  • value int
  • reason int
  • is_step bool optional - default: false

Returns ​

  • int

Source ​

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

Guided Examples ​

Learn how to use this function in context:

Used By ​

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

  • Detected in 824 indexed script(s).
  • Search this function in the Script Explorer with Duel.Damage.
CardIDScriptDetected Calls
Destiny HERO - Destro-Dogma25158975Scripts/c25158975.lua1
Enneacraft - Archa.TAIL81237046Scripts/c81237046.lua2
Enneacraft - Aiza.LEON82359538Scripts/c82359538.lua2
Starving Venemy Dragon93729065Scripts/c93729065.lua1
Vaylantz Genesis Grand Duke76075139Scripts/c76075139.lua1
Trickstar Light Stage35371948Scripts/c35371948.lua1
Forbidden Dark Contract with the Swamp King10833828Scripts/c10833828.lua1
Chaos Emperor, the Dragon of Armageddon4538826Scripts/c4538826.lua1
Grandpa Demetto44190146Scripts/c44190146.lua1
Meklord Astro Mekanikle63468625Scripts/c63468625.lua1
Number 4: Stealth Kragen67557908Scripts/c67557908.lua1
Genex Ally Triforce52709508Scripts/c52709508.lua1
Gladiator Beast Gaiodiaz90957527Scripts/c90957527.lua1
Cupid Pitch21915012Scripts/c21915012.lua1
Indiora Doom Volt the Cubic Emperor3775068Scripts/c3775068.lua1
Meklord Astro the Eradicator2992036Scripts/c2992036.lua1
Vulcan Dragni the Cubic King77387463Scripts/c77387463.lua1
Chaos Emperor Dragon - Envoy of the End82301904Scripts/c82301904.lua1
Dark Contract with the Swamp King73360025Scripts/c73360025.lua1
D/D/D Super Doom King Bright Armageddon72402069Scripts/c72402069.lua1
Master Spirit Tech Force - Pendulum Ruler68508433Scripts/c68508433.lua1
Black-Winged Assault Dragon73218989Scripts/c73218989.lua1
Earthbound Servant Geo Gremlina33202303Scripts/c33202303.lua1
Raidraptor - Rising Rebellion Falcon71222868Scripts/c71222868.lua1
...and 800 more

Script Examples ​

Destiny HERO - Destro-Dogma (25158975) ​

Source: Scripts/c25158975.lua

lua
function s.damop2(e,tp,eg,ep,ev,re,r,rp)
	Duel.Hint(HINT_CARD,0,id)
	Duel.Damage(1-tp,2000,REASON_EFFECT)
end
function s.fspcon(e,tp,eg,ep,ev,re,r,rp)

Enneacraft - Archa.TAIL (81237046) ​

Source: Scripts/c81237046.lua

lua
function s.damop1(e,tp,eg,ep,ev,re,r,rp)
	Duel.Hint(HINT_CARD,0,id)
	Duel.Damage(1-tp,900,REASON_EFFECT)
end
function s.regcon(e,tp,eg,ep,ev,re,r,rp)

Enneacraft - Aiza.LEON (82359538) ​

Source: Scripts/c82359538.lua

lua
	Duel.Hint(HINT_CARD,0,id)
	local ct=eg:FilterCount(Card.IsControler,nil,1-tp)
	Duel.Damage(1-tp,ct*900,REASON_EFFECT)
end
function s.regcon(e,tp,eg,ep,ev,re,r,rp)