--斯坦乃恩之异星到来者 local m=40009942 local cm=_G["c"..m] cm.named_with_Foreigner=1 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) e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH) e1:SetCondition(cm.spcon) e1:SetOperation(cm.spop) e1:SetValue(SUMMON_VALUE_SELF) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(cm.tdcon) e2:SetOperation(cm.tdop) e2:SetLabelObject(e1) c:RegisterEffect(e2) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(m,0)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,m+1) e3:SetCost(cm.thcost) e3:SetTarget(cm.thtg) e3:SetOperation(cm.thop) c:RegisterEffect(e3) end function cm.spfilter(c) return c:IsCode(40009938,40009939,40009940,40009941) and c:IsFaceup() end function cm.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_REMOVED,0,3,nil) end function cm.spop(e,tp,eg,ep,ev,re,r,rp,c) e:SetLabel(1) end function cm.tdcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+SUMMON_VALUE_SELF end function cm.tdfilter2(c) return c:IsCode(40009938,40009939,40009940,40009941) and c:IsAbleToDeck() end function cm.tdop(e,tp,eg,ep,ev,re,r,rp) local dg=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.tdfilter2),tp,LOCATION_GRAVE,0,nil) if dg:GetCount()~=0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local sg=dg:Select(tp,1,1,nil) Duel.HintSelection(sg) Duel.SendtoDeck(sg,nil,2,REASON_EFFECT) end end function cm.thfilter(c) return c:IsCode(40009938,40009939,40009940,40009941) and c:IsAbleToRemoveAsCost() end function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) end function cm.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end