--赤月礼赞·名仓由依 local m=33701427 local cm=_G["c"..m] function cm.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND+LOCATION_GRAVE) e1:SetCondition(cm.spcon) c:RegisterEffect(e1) --send to grave local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(cm.tgtg) e2:SetOperation(cm.tgop) c:RegisterEffect(e2) --recover local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_RECOVER) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BATTLE_DAMAGE) e3:SetCondition(cm.reccon) e3:SetOperation(cm.recop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CHANGE_DAMAGE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetTargetRange(1,0) e4:SetValue(cm.damval) c:RegisterEffect(e4) if not cm.global_check then cm.global_check=true cm[0]=0 cm[1]=0 local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DAMAGE) ge1:SetOperation(cm.checkop) Duel.RegisterEffect(ge1,0) local ge3=Effect.CreateEffect(c) ge3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge3:SetCode(EVENT_PHASE_START+PHASE_DRAW) ge3:SetOperation(cm.clear) Duel.RegisterEffect(ge3,0) end end function cm.spcon(e,c) if c==nil then return true end if c:IsHasEffect(EFFECT_NECRO_VALLEY) then return false end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and cm[tp]>=1200 end function cm.tgfilter(c) return c:IsCode(33701424) and c:IsAbleToGrave() end function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_HAND+LOCATION_DECK,0,2,nil) and g:GetCount()>0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,2,tp,LOCATION_HAND+LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function cm.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_HAND+LOCATION_DECK,0,2,2,nil) if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_EFFECT) end local ct=Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_GRAVE,0,nil,33701424) g=Duel.GetFieldGroup(tp,0,LOCATION_DECK+LOCATION_EXTRA) if g:GetCount()>0 then Duel.ConfirmCards(tp,g) Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TOGRAVE) local sg=g:Select(p,ct,ct,nil) local ct1=Duel.SendtoGrave(sg,REASON_EFFECT) Duel.ShuffleDeck(1-tp) Duel.ShuffleExtra(1-tp) if ct1>0 then Duel.Damage(1-tp,ct1*800,REASON_EFFECT) end end end function cm.reccon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function cm.recop(e,tp,eg,ep,ev,re,r,rp) Duel.Recover(tp,ev,REASON_EFFECT) end function cm.tdfilter(c) return c:IsCode(33701424) and c:IsAbleToDeck() end function cm.tgfilter1(c,rc) return c:GetReasonCard()==rc end function cm.damval(e,re,val,r,rp,rc) local tp=e:GetHandlerPlayer() local g=Duel.GetMatchingGroup(cm.tdfilter,tp,LOCATION_GRAVE,0,nil) local c=e:GetHandler() if rp~=tp and g:GetCount()>0 and c:IsAbleToDeck() and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) g=g:Select(tp,1,2,nil) g:AddCard(c) local ct=Duel.SendtoDeck(g,tp,1,REASON_EFFECT) if ct>0 then local ct1=Duel.Draw(tp,ct,REASON_EFFECT) if ct1>0 and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then local g1=Duel.GetOperatedGroup():Filter(cm.tgfilter1,nil,c) local ct2=Duel.SendtoGrave(g1,REASON_EFFECT) if ct2>0 then Duel.Recover(tp,ct2*1200,REASON_EFFECT) end end end end return val end function cm.checkop(e,tp,eg,ep,ev,re,r,rp) if bit.band(r,REASON_EFFECT)~=0 then cm[ep]=cm[ep]+ev end end function cm.clear(e,tp,eg,ep,ev,re,r,rp) cm[0]=0 cm[1]=0 end