RushDuel.AttachAtkDef
Alias: RD.AttachAtkDef. Requires the matching Rush Duel Lua bootstrap.
Signature
RushDuel.AttachAtkDef(Effect e, Card card, int|function|nil atk, int|function|nil def, [int reset], [bool forced]) -> voidDescription
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
eEffect: Resolving source effect; its handler owns the modifiers.cardCard: Card receiving the modifiers.atkint|function|nil: ATK delta or value callback; nil and numeric 0 skip this branch.defint|function|nil: DEF delta or value callback; nil and numeric 0 skip this branch, and RD.IsCanChangeDef must pass.resetint(optional): Explicit reset mask shared by both modifiers. Omitting it adds no reset policy.forcedbool(optional): Passed to Card.RegisterEffect. Normally omit it rather than bypassing immunity.
Returns
No return values.
Example
RD.AttachAtkDef(e, tc, 1000, 0,
RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)Source
Rush/Utilities/RDAttach.lua:5
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
endGuided 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.
Script Examples
Moonforce Ziggy (120300014)
Source: Rush/Scripts/c120300014.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
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
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()