--代伦之异星招来者 local m=40009932 local cm=_G["c"..m] cm.named_with_Foreigner=1 function cm.initial_effect(c) --cannot spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCost(cm.drcost) e1:SetTarget(cm.drtg) e1:SetOperation(cm.drop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(m,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,m) e2:SetCost(cm.spcost) e2:SetTarget(cm.sptg) e2:SetOperation(cm.spop) c:RegisterEffect(e2) end function cm.Foreigner(c) local m=_G["c"..c:GetCode()] return m and m.named_with_Foreigner end function cm.cfilter(c) return cm.Foreigner(c) and c:IsDiscardable() end function cm.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() and Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local g=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_HAND,0,1,1,e:GetHandler()) g:AddCard(e:GetHandler()) Duel.SendtoGrave(g,REASON_DISCARD+REASON_COST) end function cm.filter(c) return c:IsCode(40009938,40009939,40009940,40009941) and c:IsAbleToDeck() and not c:IsPublic() end function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp) and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end function cm.drop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(p,cm.filter,p,LOCATION_HAND,0,1,63,nil) if g:GetCount()>0 then Duel.ConfirmCards(1-p,g) local ct=Duel.SendtoDeck(g,nil,2,REASON_EFFECT) Duel.ShuffleDeck(p) Duel.BreakEffect() Duel.Draw(p,ct+1,REASON_EFFECT) end end function cm.spcfilter(c) return c:IsCode(40009938,40009939,40009940,40009941) and c:IsAbleToRemoveAsCost() end function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReleasable() and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cm.spcfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.Release(e:GetHandler(),REASON_COST) Duel.Remove(g,POS_FACEUP,REASON_COST) end function cm.spfilter2(c,e,tp) return cm.Foreigner(c) and not c:IsCode(m) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and cm.spfilter2(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingTarget(cm.spfilter2,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,cm.spfilter2,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function cm.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end