Duel.Equip
Signature
Duel.Equip(int player, Card c1, Card c2, [bool up], [bool is_step]) -> boolDescription
Equips c1 to c2 for player and returns true if the equip succeeds. up defaults to true and makes the Equip Card face-up. When is_step is true, call Duel.EquipComplete after all step equips have been created. Register or rely on an EFFECT_EQUIP_LIMIT so the card can legally remain equipped to that monster.
How To Use It
Use this after both the Equip Card and the monster it will equip to are still valid.
A self-equip effect usually creates an Equip Limit after the equip succeeds so the card stays attached only to the intended monster:
local tc=Duel.GetFirstTarget()
local c=e:GetHandler()
if tc and tc:IsRelateToEffect(e) and c:IsRelateToEffect(e) and Duel.Equip(tp,c,tc) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(function(e,ec) return ec==tc end)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
endWhen several cards are equipped as one procedure with is_step=true, call Duel.EquipComplete() after the final successful step.
Related Functions
Parameters
playerintc1Cardc2Cardupbooloptional - default: trueis_stepbooloptional - default: false
Returns
bool
Source
D:\Programs\GitHub\ygopro-core\libduel.cpp:4904
Guided Examples
Learn how to use this function in context:
- Methods for Affecting Cards
- Equip Spells and Equip Cards
- Functions That Move Cards Across Locations
- Union Monsters
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 664 indexed script(s).
- Search this function in the Script Explorer with
Duel.Equip.
Script Examples
Salamandra with Chain (62091148)
Source: Scripts/c62091148.lua
if not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.Equip(tp,c,tc) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)Fiendsmith's Sequence (49867899)
Source: Scripts/c49867899.lua
return
end
if not Duel.Equip(tp,c,tc) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)Spirit Illusion (71939275)
Source: Scripts/c71939275.lua
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
end
end