--created by ZEN, coded by ZEN & Lyris local cid,id=GetID() function cid.initial_effect(c) aux.AddLinkProcedure(c,nil,2,3,cid.lcheck) c:EnableReviveLimit() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(cid.stattg) e1:SetValue(500) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:Desc(1) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_LEAVE_GRAVE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e3:SetTarget(cid.target) e3:SetOperation(cid.operation) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:Desc(2) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCode(EVENT_MOVE) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,id) e4:SetCategory(CATEGORY_DRAW) e4:SetCondition(cid.drcon) e4:SetTarget(cid.drtg) e4:SetOperation(cid.drop) c:RegisterEffect(e4) end function cid.lcheck(g) return g:IsExists(Card.IsLinkSetCard,1,nil,0xd7c) end function cid.stattg(e,c) return c:IsSetCard(0xd7c) and c:GetSequence()<5 end function cid.filter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xd7c) and not c:IsForbidden() end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cid.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(cid.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(cid.filter),tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,#g,0,0) local sg=Duel.GetMatchingGroupCount(cid.sfilter,tp,LOCATION_SZONE,LOCATION_SZONE,nil) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,(sg+#g)*400) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end local tc=Duel.GetFirstTarget() if not tc:IsRelateToChain() or not Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then return end local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET) e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS) tc:RegisterEffect(e1) local ct=Duel.GetMatchingGroupCount(cid.sfilter,tp,LOCATION_SZONE,LOCATION_SZONE,nil) if c:IsRelateToChain() and c:IsFaceup() and ct>0 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(ct*400) e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END) c:RegisterEffect(e2) end end function cid.sfilter(c) return c:GetSequence()<5 end function cid.cfilter(c,tp) return c:IsLocation(LOCATION_SZONE) and c:GetSequence()<5 and c:IsControler(tp) and c:IsFaceup() and c:IsSetCard(0xd7c) end function cid.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(cid.cfilter,1,nil,tp) end function cid.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function cid.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end