--灯火之追思 local m=28327037 local cm=_G["c"..m] Duel.LoadScript("c28327000.lua") function cm.initial_effect(c) aux.AddCodeList(c,28327000) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH) e1:SetCost(cm.cost) e1:SetTarget(cm.target) e1:SetOperation(cm.operation) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(m,ACTIVITY_SPSUMMON,cm.counterfilter) end function cm.counterfilter(c) return c:GetSummonLocation()~=LOCATION_EXTRA end function cm.countcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(m,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) e1:SetLabelObject(e) e1:SetTarget(cm.splimit) Duel.RegisterEffect(e1,tp) end function cm.splimit(e,c,sump,sumtype,sumpos,targetp,se) return c:IsLocation(LOCATION_EXTRA) end function cm.filter(c) return c:GetType()==TYPE_SPELL+TYPE_RITUAL and aux.IsCodeListed(c,28327000) and c:IsAbleToDeckAsCost() and c:CheckActivateEffect(true,true,false)~=nil and (not c:IsLocation(LOCATION_REMOVED) or c:IsFaceup()) end function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local te=e:GetLabelObject() local tg=te:GetTarget() return tg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end if chk==0 then if e:GetLabel()==0 then return false end e:SetLabel(0) return cm.countcost(e,tp,eg,ep,ev,re,r,rp,0) and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end e:SetLabel(0) cm.countcost(e,tp,eg,ep,ev,re,r,rp,1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil) local te=g:GetFirst():CheckActivateEffect(true,true,false) e:SetLabelObject(te) Duel.SendtoDeck(g,nil,2,REASON_COST) e:SetProperty(te:GetProperty()) local tg=te:GetTarget() if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end Duel.ClearOperationInfo(0) end function cm.operation(e,tp,eg,ep,ev,re,r,rp) local te=e:GetLabelObject() if not te then return end local op=te:GetOperation() if op then op(e,tp,eg,ep,ev,re,r,rp) end end