--La'lice, Sunhewn Aspirant local ref,id=GetID() Duel.LoadScript("Sunhew.lua") function ref.initial_effect(c) Sunhew.EnableDisengage() --Special Summon local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ENGAGE) e1:SetRange(LOCATION_HAND+LOCATION_SZONE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==tp end) e1:SetTarget(ref.sstg) e1:SetOperation(ref.ssop) c:RegisterEffect(e1) --Search local e2=Sunhew.LeaveHandTemplate(c) e2:Desc(1) e2:SetCategory(CATEGORIES_SEARCH) e2:SetRange(LOCATION_GRAVE) e2:HOPT() e2:SetCost(aux.bfgcost) e2:SetTarget(ref.thtg) e2:SetOperation(ref.thop) c:RegisterEffect(e2) end --Special Summon function ref.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function ref.tdfilter(c) return Sunhew.Is(c) and not c:IsForbidden() end function ref.ssop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 and Duel.IsExistingMatchingCard(ref.tdfilter,tp,LOCATION_REMOVED,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,ref.tdfilter,tp,LOCATION_REMOVED,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT+REASON_RETURN) end end end --Search function ref.thfilter(c) return Sunhew.Is(c) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() and not c:IsCode(id) end function ref.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(ref.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function ref.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,ref.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)~=0 then Duel.ConfirmCards(1-tp,g) end end