--Automate ID local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_TOHAND|CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) e1:HOPT() c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) Duel.AddCustomActivityCounter(id,ACTIVITY_FLIPSUMMON,s.counterfilter) end function s.counterfilter(c) return c:IsSetCard(ARCHE_BOMBER_GOBLIN,ARCHE_GRENADE_TYPE) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 and Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 and Duel.GetCustomActivityCount(id,tp,ACTIVITY_FLIPSUMMON)==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:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SUMMON) Duel.RegisterEffect(e2,tp) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON) Duel.RegisterEffect(e3,tp) Duel.RegisterHint(tp,id,PHASE_END,1,id,1,EFFECT_FLAG_OATH) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not s.counterfilter(c) end function s.thfilter(c,tp) return c:IsSetCard(ARCHE_BOMBER_GOBLIN) and c:IsAbleToHand() and (not tp or Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,c,tp)) end function s.plfilter(c,tp) return c:IsSetCard(ARCHE_GRENADE_TYPE) and c:IsType(TYPE_MONSTER) and not c:IsForbidden() and c:CheckUniqueOnField(tp,LOCATION_SZONE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local ft=0 local c=e:GetHandler() if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not c:IsType(TYPE_FIELD) and not c:IsInBackrow() then ft=1 end return Duel.GetLocationCount(tp,LOCATION_SZONE)>ft and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g1=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp) if #g1<=0 then g1=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) end if g1:GetCount()>0 and Duel.SearchAndCheck(g1,tp) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g2=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil,tp) if #g2>0 then local tc=g2:GetFirst() if Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(TYPE_SPELL|TYPE_CONTINUOUS) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&(~RESET_TURN_SET))) tc:RegisterEffect(e1) end end end end