--created by Meedogh, coded by Lyris local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() aux.AddOrigBigbangType(c) aux.AddBigbangProc(c,aux.NOT(aux.FilterEqualFunction(Card.GetVibe,0)),1,aux.FilterEqualFunction(Card.GetVibe,0),1) local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e0:SetCode(EVENT_SPSUMMON_SUCCESS) e0:SetCategory(CATEGORY_EQUIP) e0:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_BIGBANG) end) e0:SetTarget(cid.eqtg) e0:SetOperation(cid.eqop) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MATERIAL_CHECK) e1:SetValue(function(e,c) e:SetLabel(c:GetMaterialCount()) end) c:RegisterEffect(e1) e0:SetLabelObject(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_SEND_REPLACE) e2:SetRange(LOCATION_MZONE) e2:SetTarget(cid.reptg) e2:SetOperation(cid.repop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e3:SetCountLimit(1) e3:SetCondition(cid.atkcon) e3:SetOperation(cid.atkop) c:RegisterEffect(e3) end function cid.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and bc:IsSummonType(SUMMON_TYPE_SPECIAL) and c:IsRelateToBattle() and (Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()) end function cid.filter(c) return c:GetTextAttack()>0 or c:GetTextDefense()>0 end function cid.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetEquipGroup():FilterSelect(tp,cid.filter,1,1,nil):GetFirst() if Duel.Destroy(tc,REASON_EFFECT)~=0 then local op=Duel.SelectOption(tp,1371,1372) Duel.BreakEffect() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(op>0 and tc:GetTextDefense() or tc:GetTextAttack()) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end end function cid.eqfilter(c,tp) return c:IsType(TYPE_MONSTER) and not c:IsForbidden() and c:CheckUniqueOnField(tp) end function cid.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(cid.eqfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0) end function cid.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) if ft<=0 or c:IsFacedown() or not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,cid.eqfilter,tp,LOCATION_GRAVE,0,1,math.min(ft,e:GetLabelObject():GetLabel()),nil,tp) for tc in aux.Next(g) do if Duel.Equip(tp,tc,c) then local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(cid.eqlimit) tc:RegisterEffect(e1) end end end function cid.eqlimit(e,c) return e:GetOwner()==c end function cid.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local g=c:GetEquipGroup():Filter(Card.IsDestructable,nil,e) if chk==0 then return r&REASON_EFFECT~=0 and re and not c:IsReason(REASON_REPLACE) and #g>0 and c:GetFlagEffect(id)==0 end if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE) local tg=g:Select(tp,1,1,nil) e:SetLabelObject(tg:GetFirst()) tg:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED,true) c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) return true else return false end end function cid.repop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() tc:SetStatus(STATUS_DESTROY_CONFIRMED,false) Duel.Destroy(tc,REASON_EFFECT+REASON_REPLACE) end