--Lifefoster Cosmo'n local cid,id=GetID() function cid.initial_effect(c) --pendulum summon aux.EnablePendulumAttribute(c) --tohand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetCost(cid.thcost) e1:SetTarget(cid.thtg) e1:SetOperation(cid.thop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetCondition(cid.spcon) e2:SetCost(cid.spcost) e2:SetTarget(cid.sptg) e2:SetOperation(cid.spop) c:RegisterEffect(e2) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,cid.counterfilter) end function cid.counterfilter(c) return c:GetSummonLocation()~=LOCATION_EXTRA or c:IsType(TYPE_BIGBANG) end function cid.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,800) end Duel.PayLPCost(tp,800) end function cid.thfilter(c) return c:IsSetCard(0x1da2) and c:IsLevelAbove(5) and c:IsAbleToHand() end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function cid.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,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:SetTargetRange(1,0) e1:SetTarget(cid.splimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function cid.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsType(TYPE_BIGBANG) and c:IsLocation(LOCATION_EXTRA) end function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==1 end function cid.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,2,nil) and cid.cost(e,tp,eg,ep,ev,re,r,rp,0) end Duel.DiscardHand(tp,Card.IsAbleToGraveAsCost,2,2,REASON_COST) cid.cost(e,tp,eg,ep,ev,re,r,rp,1) end function cid.spfilter(c,e,tp) return (c:IsSetCard(0x1da2) or c:IsSetCard(0xcf11)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_DECK,0,1,1,g1:GetFirst(),e,tp) g1:Merge(g2) if g1:GetCount()>0 then local fid=e:GetHandler():GetCode() local tc=g1:GetFirst() while tc do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_ACTIVATE) e2:SetTargetRange(1,0) e2:SetValue(cid.aclimit) e2:SetLabel(tc:GetCode()) e2:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e2,tp) tc=g1:GetNext() end Duel.SpecialSummonComplete() end end function cid.aclimit(e,re,tp) return re:GetHandler():IsCode(e:GetLabel()) and re:IsActiveType(TYPE_MONSTER) end