--Inari local cid,id=GetID() function cid.initial_effect(c) --spirit return aux.EnableSpiritReturn(c,EVENT_SUMMON_SUCCESS,EVENT_FLIP) aux.EnableUnionAttribute(c,cid.eqlimit) --cannot special summon local e0=Effect.CreateEffect(c) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(aux.FALSE) c:RegisterEffect(e0) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetTarget(cid.eqtg) e1:SetOperation(cid.eqop) c:RegisterEffect(e1) --unequip local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetTarget(cid.sptg) e2:SetOperation(cid.spop) c:RegisterEffect(e2) --immune local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_EQUIP) e4:SetCode(EFFECT_IMMUNE_EFFECT) e4:SetValue(cid.efilter) c:RegisterEffect(e4) --to hand local e8=Effect.CreateEffect(c) e8:SetDescription(aux.Stringid(id,1)) e8:SetCategory(CATEGORY_TOHAND) e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e8:SetProperty(EFFECT_FLAG_DELAY) e8:SetCode(EVENT_TO_GRAVE) e8:SetCondition(cid.thcon) e8:SetTarget(cid.thtg) e8:SetOperation(cid.thop) c:RegisterEffect(e8) end function cid.eqlimit(e,c) return c:IsType(TYPE_SPIRIT) or e:GetHandler():GetEquipTarget()==c end function cid.filter(c) local ct1,ct2=c:GetUnionCount() return c:IsFaceup() and c:IsType(TYPE_SPIRIT) and ct2==0 end function cid.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and cid.filter(chkc) end if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(cid.filter,tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,cid.filter,tp,LOCATION_MZONE,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) c:RegisterFlagEffect(id,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1) end function cid.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end if not tc:IsRelateToEffect(e) or not cid.filter(tc) then Duel.SendtoGrave(c,REASON_EFFECT) return end if not Duel.Equip(tp,c,tc,false) then return end aux.SetUnionState(c) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetFlagEffect(id)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) c:RegisterFlagEffect(id,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP) end function cid.efilter(e,te) return te:GetOwnerPlayer()~=e:GetHandlerPlayer() and te:GetOwner()~=e:GetOwner() end function cid.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_LOST_TARGET) and c:GetPreviousEquipTarget():IsLocation(LOCATION_HAND) end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end