--残杀的影魔 local m=14060016 local cm=_G["c"..m] function cm.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetOperation(cm.activate) c:RegisterEffect(e1) --The true Activate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(m,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(cm.tgcon) e2:SetOperation(cm.tgop) c:RegisterEffect(e2) --To grave local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(m,3)) e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetTarget(cm.tdtg) e3:SetOperation(cm.tdop) c:RegisterEffect(e3) end function cm.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then c:CancelToGrave() if Duel.SendtoDeck(c,nil,2,REASON_EFFECT) then local gc=Duel.GetFieldGroup(tp,LOCATION_HAND,0):FilterCount(Card.IsAbleToGrave,nil) if gc>0 and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then Duel.BreakEffect() local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_HAND,0,1,gc,nil) if #g>0 then Duel.SendtoGrave(g,nil,REASON_EFFECT) end end end end end function cm.tgcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not c:IsPreviousLocation(LOCATION_FZONE) end function cm.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local te=c:GetActivateEffect() local b1=te:IsActivatable(tp) if b1 then local fc=Duel.GetFieldCard(tp,LOCATION_SZONE,5) if fc then Duel.SendtoGrave(fc,REASON_RULE) Duel.BreakEffect() end Duel.MoveToField(c,tp,tp,LOCATION_FZONE,POS_FACEUP,true) te:UseCountLimit(tp,1,true) local tep=c:GetControler() local cost=te:GetCost() if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end Duel.RaiseEvent(c,4179255,te,0,tp,tp,Duel.GetCurrentChain()) end end function cm.tgfilter(c) return c:IsSetCard(0x1406) and c:IsAbleToGrave() end function cm.tdfilter(c) return (c:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) or c:IsFaceup()) and c:IsAbleToDeck() end function cm.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.tdfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA) end function cm.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.tdfilter),tp,LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA,0,1,3,nil) if g:GetCount()>0 then if Duel.SendtoDeck(g,nil,2,REASON_EFFECT) and Duel.GetFlagEffect(tp,m)==0 and Duel.SelectYesNo(tp,aux.Stringid(m,4)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g1=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if g1:GetCount()>0 then Duel.SendtoGrave(g1,REASON_EFFECT) Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1) end end end end