Skip to content

RushDuel.AttachAtkDef ​

Alias: RD.AttachAtkDef. Requires the matching Rush Duel Lua bootstrap.

Signature ​

lua
RushDuel.AttachAtkDef(Effect e, Card card, int|function|nil atk, int|function|nil def, [int reset], [bool forced]) -> void

Description ​

Registers a single-card EFFECT_UPDATE_ATTACK effect for nonzero, non-nil atk, and an EFFECT_UPDATE_DEFENSE effect for nonzero, non-nil def only when RD.IsCanChangeDef(card) passes. That predicate is card:IsDefenseAbove(0) and not RD.IsMaximumMode(card): it requires the core's valid, nonnegative DEF check and excludes Maximum-mode monsters. It does not block the ATK branch. Both modifiers are created through RD.CreateSingleEffect with e:GetHandler() as owner, FLAG_ATTACH_EFFECT as label, and the supplied reset/forced values. No automatic duration is added when reset is omitted. Pass RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END for the usual until-End-Phase card modifier. This helper returns no values and does not report whether the card's final stats changed. forced is passed to Card.RegisterEffect; leave it nil/false for normal effect-immunity handling.

Parameters ​

  • e Effect: Resolving source effect; its handler owns the modifiers.
  • card Card: Card receiving the modifiers.
  • atk int|function|nil: ATK delta or value callback; nil and numeric 0 skip this branch.
  • def int|function|nil: DEF delta or value callback; nil and numeric 0 skip this branch, and RD.IsCanChangeDef must pass.
  • reset int (optional): Explicit reset mask shared by both modifiers. Omitting it adds no reset policy.
  • forced bool (optional): Passed to Card.RegisterEffect. Normally omit it rather than bypassing immunity.

Returns ​

No return values.

Example ​

lua
RD.AttachAtkDef(e, tc, 1000, 0,
    RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)

Source ​

Rush/Utilities/RDAttach.lua:5

lua
function RushDuel.AttachAtkDef(e, card, atk, def, reset, forced)
    if atk ~= nil and atk ~= 0 then
        RushDuel.CreateSingleEffect(e, nil, card, EFFECT_UPDATE_ATTACK, atk, reset, forced)
    end
    if def ~= nil and def ~= 0 and RushDuel.IsCanChangeDef(card) then
        RushDuel.CreateSingleEffect(e, nil, card, EFFECT_UPDATE_DEFENSE, def, reset, forced)
    end
end

Guided Examples ​

Learn how to use this function in context:

Used By ​

Generated from the local Rush/Scripts/ folder and rush_cards.cdb.

  • Detected in 561 indexed script(s).
  • Search this function in the Script Explorer with RushDuel.AttachAtkDef.
CardIDScriptDetected Calls
Moonforce Ziggy120300014Rush/Scripts/c120300014.lua1
Volcalizing Salamandeus120272039Rush/Scripts/c120272039.lua1
Brassdes of the Wicked Wheels120304033Rush/Scripts/c120304033.lua1
Super Galaxy King Lord of Galactica [R]120254039Rush/Scripts/c120254039.lua1
Wako Gozen Riletta120309021Rush/Scripts/c120309021.lua1
Mega Jointech Fortrex [R]120249005Rush/Scripts/c120249005.lua1
Insect Taurus120300060Rush/Scripts/c120300060.lua1
Galactica Lost Oblivion120277042Rush/Scripts/c120277042.lua1
Bluetech Burst Rex120261044Rush/Scripts/c120261044.lua2
Red-Reboot Enhanced Boost Dragon120253037Rush/Scripts/c120253037.lua1
Lovely Rabbit120300018Rush/Scripts/c120300018.lua1
Star Cat Destronya120235037Rush/Scripts/c120235037.lua1
Supreme Machine Magnum Overlord [L]120150001Rush/Scripts/c120150001.lua1
Royal Rebel's Heavy Metal120130031Rush/Scripts/c120130031.lua1
Prophecy Phrase the Colors of the Wind120228024Rush/Scripts/c120228024.lua1
Galactica Supreme Oblivion120245003Rush/Scripts/c120245003.lua1
Yamiterasu the Divine Ruler120199036Rush/Scripts/c120199036.lua1
Rising HERO Argent F120304043Rush/Scripts/c120304043.lua1
Excutie Riding!120249064Rush/Scripts/c120249064.lua1
Super Princess of the Flock - Max Mutton [L]120293007Rush/Scripts/c120293007.lua1
Dicemite Gyame Double-Up Chirori120272040Rush/Scripts/c120272040.lua1
Celeb Rose Influencers120257044Rush/Scripts/c120257044.lua1
Abyssal Sea Dragon Abyss Kraken [L]120239016Rush/Scripts/c120239016.lua1
Destructor Emperor Bakhakaiser120264045Rush/Scripts/c120264045.lua1
...and 537 more

Script Examples ​

Moonforce Ziggy (120300014) ​

Source: Rush/Scripts/c120300014.lua

lua
				if RD.SendToDeckBottom(g,e,tp,REASON_EFFECT)~=0
					and c:IsFaceup() and c:IsRelateToEffect(e) then
					RD.AttachAtkDef(e,c,0,500,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
				end
			end)

Volcalizing Salamandeus (120272039) ​

Source: Rush/Scripts/c120272039.lua

lua
	if g:GetCount()==0 then return end
	g:ForEach(function(tc)
		RD.AttachAtkDef(e,tc,-3000,0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
	end)
	local c=e:GetHandler()

Brassdes of the Wicked Wheels (120304033) ​

Source: Rush/Scripts/c120304033.lua

lua
	local c=e:GetHandler()
	if c:IsFaceup() and c:IsRelateToEffect(e) then
		RD.AttachAtkDef(e,c,2000,0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
		RD.CanSelectAndDoAction(aux.Stringid(m,1),HINTMSG_ATOHAND,aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_GRAVE,0,1,1,nil,function(g)
			Duel.BreakEffect()