--Scoob, Scout Fang of Gust Vine function c160008986.initial_effect(c) --pendulum summon aux.EnablePendulumAttribute(c) --splimit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_PZONE) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE) e2:SetTargetRange(1,0) e2:SetTarget(c160008986.splimit) e2:SetCondition(c160008986.splimcon) c:RegisterEffect(e2) --cannot special summon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_SPSUMMON_CONDITION) e3:SetValue(c160008986.splimit2) c:RegisterEffect(e3) --summon,flip local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(160008986,0)) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e4:SetCode(EVENT_SUMMON_SUCCESS) e4:SetOperation(c160008986.retreg) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EVENT_FLIP) c:RegisterEffect(e5) local e6=e4:Clone() e6:SetCode(EVENT_SPSUMMON_SUCCESS) e6:SetCondition(c160008986.condition1) c:RegisterEffect(e6) --tohand local e7=Effect.CreateEffect(c) e7:SetDescription(aux.Stringid(160008986,0)) e7:SetCategory(CATEGORY_SPECIAL_SUMMON) e7:SetType(EFFECT_TYPE_IGNITION) e7:SetRange(LOCATION_PZONE) e7:SetCountLimit(1) e7:SetCost(c160008986.adcost) e7:SetTarget(c160008986.adtarget) e7:SetOperation(c160008986.adoperation) c:RegisterEffect(e7) --tohand local e8=Effect.CreateEffect(c) e8:SetDescription(aux.Stringid(160008986,1)) e8:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e8:SetCode(EVENT_PHASE+PHASE_END) e8:SetRange(LOCATION_PZONE) e8:SetCountLimit(1,160008986) e8:SetCondition(c160008986.thcon) e8:SetCost(c160008986.thcost) e8:SetTarget(c160008986.thtg) e8:SetOperation(c160008986.thop) c:RegisterEffect(e8) --spsummon local e9=Effect.CreateEffect(c) e9:SetDescription(aux.Stringid(160008986,1)) e9:SetCategory(CATEGORY_SPECIAL_SUMMON) e9:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e9:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e9:SetCode(EVENT_SUMMON_SUCCESS) e9:SetTarget(c160008986.sptg) e9:SetOperation(c160008986.spop) c:RegisterEffect(e9) local e10=e9:Clone() e10:SetCode(EVENT_FLIP) c:RegisterEffect(e10) local e11=e9:Clone() e11:SetCode(EVENT_SPSUMMON_SUCCESS) e11:SetCondition(c160008986.condition1) c:RegisterEffect(e11) --leave field local e12=Effect.CreateEffect(c) e12:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e12:SetCode(EVENT_LEAVE_FIELD) e12:SetOperation(c160008986.leave) c:RegisterEffect(e12) e9:SetLabelObject(e12) e10:SetLabelObject(e12) e11:SetLabelObject(e12) end function c160008986.splimit(e,c,sump,sumtype,sumpos,targetp) if c:IsSetCard(0x885a) and c:IsType(TYPE_MONSTER) then return false end return bit.band(sumtype,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function c160008986.splimcon(e) return not e:GetHandler():IsForbidden() end function c160008986.splimit2(e,se,sp,st) return bit.band(st,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function c160008986.retreg(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --to hand local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetDescription(aux.Stringid(160008986,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetReset(RESET_EVENT+0x1ee0000+RESET_PHASE+PHASE_END) e1:SetCondition(c160008986.retcon) e1:SetTarget(c160008986.rettg) e1:SetOperation(c160008986.retop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) c:RegisterEffect(e2) end function c160008986.retcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsHasEffect(EFFECT_SPIRIT_DONOT_RETURN) then return false end if e:IsHasType(EFFECT_TYPE_TRIGGER_F) then return not c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN) else return c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN) end end function c160008986.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function c160008986.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.SendtoHand(c,nil,REASON_EFFECT) end end function c160008986.cfilter(c) return c:IsSetCard(0x885a) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() end function c160008986.adcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c160008986.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c160008986.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_EFFECT) end function c160008986.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==tp end function c160008986.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToExtra() end Duel.SendtoExtraP(e:GetHandler(),POS_FACEUP,REASON_COST) end function c160008986.adfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x885a) and c:IsType(TYPE_MONSTER) and not c:IsCode(160008986) and c:IsAbleToHand() end function c160008986.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c160008986.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c160008986.adfilter,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 c160008986.filter1(c,e) return c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e) end function c160008986.filter2(c,e,tp,m,f,chkf) return c:IsType(TYPE_FUSION) and c:IsSetCard(0x885a) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) end function c160008986.adtarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp local mg1=Duel.GetMatchingGroup(Card.IsCanBeFusionMaterial,tp,LOCATION_HAND+LOCATION_MZONE,0,nil) local res=Duel.IsExistingMatchingCard(c160008986.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp,mg1,nil,chkf) if not res then local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() local mg2=fgroup(ce,e,tp) local mf=ce:GetValue() res=Duel.IsExistingMatchingCard(c160008986.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp,mg2,mf,chkf) end end return res end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function c160008986.adoperation(e,tp,eg,ep,ev,re,r,rp) local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp local mg1=Duel.GetMatchingGroup(c160008986.filter1,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,e) local sg1=Duel.GetMatchingGroup(c160008986.filter2,tp,LOCATION_GRAVE,0,nil,e,tp,mg1,nil,chkf) local mg2=nil local sg2=nil local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() mg2=fgroup(ce,e,tp) local mf=ce:GetValue() sg2=Duel.GetMatchingGroup(c160008986.filter2,tp,LOCATION_GRAVE,0,nil,e,tp,mg2,mf,chkf) end if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then local sg=sg1:Clone() if sg2 then sg:Merge(sg2) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=sg:Select(tp,1,1,nil) local tc=tg:GetFirst() if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) tc:SetMaterial(mat1) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) else local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local fop=ce:GetOperation() fop(ce,e,tp,tc,mat2) end tc:CompleteProcedure() else local cg1=Duel.GetFieldGroup(tp,LOCATION_HAND+LOCATION_MZONE,0) local cg2=Duel.GetFieldGroup(tp,LOCATION_GRAVE,0) if cg1:GetCount()>1 and cg2:IsExists(Card.IsFacedown,1,nil) and Duel.IsPlayerCanSpecialSummon(tp) and not Duel.IsPlayerAffectedByEffect(tp,27581098) then Duel.ConfirmCards(1-tp,cg1) Duel.ConfirmCards(1-tp,cg2) Duel.ShuffleHand(tp) end end end function c160008986.condition1(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_PENDULUM end function c160008986.condition2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_PENDULUM end function c160008986.xxlfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsSetCard(0x885a) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c160008986.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c160008986.xxlfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c160008986.xxlfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c160008986.xxlfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c160008986.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_ATTACK) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e2,true) Duel.SpecialSummonComplete() if c:IsRelateToEffect(e) then c:SetCardTarget(tc) e:GetLabelObject():SetLabelObject(tc) c:CreateRelation(tc,RESET_EVENT+0x5020000) tc:CreateRelation(c,RESET_EVENT+0x1fe0000) end end end function c160008986.retreg(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --to hand local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetDescription(aux.Stringid(160008986,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetReset(RESET_EVENT+0x1ee0000+RESET_PHASE+PHASE_END) e1:SetCondition(c160008986.retcon) e1:SetTarget(c160008986.rettg) e1:SetOperation(c160008986.retop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) c:RegisterEffect(e2) end function c160008986.retcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsHasEffect(EFFECT_SPIRIT_DONOT_RETURN) then return false end if e:IsHasType(EFFECT_TYPE_TRIGGER_F) then return not c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN) else return c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN) end end function c160008986.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function c160008986.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.SendtoHand(c,nil,REASON_EFFECT) end end function c160008986.leave(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=e:GetLabelObject() if tc and c:IsRelateToCard(tc) and tc:IsRelateToCard(c) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end