Skip to content
TheChatArchiveThe Chat Archive
o1-preview-2024-09-12· OpenAIAi2 WildChat-4.8M (AI2)

Create a lua script for this Monster card "Hieratic Dragon of Anuket" for edopro: "You…

  1. User

    Create a lua script for this Monster card "Hieratic Dragon of Anuket" for edopro: "You can Special Summon this card (from your hand) by banishing 1 "Hieratic" monster from your GY. During your Main Phase: You can Tribute this card; Special Summon up to 2 "Hieratic" monsters from your hand and/or GY in Defense Position, but their effects are negated. Then, you can destroy up to 2 cards on the field. If this card is Tributed: You can add 1 "Hieratic" Spell/Trap from your Deck to your hand. You can only use each effect of "Hieratic Dragon of Anuket" once per turn."

  2. Assistant
    --Hieratic Dragon of Anuket
    local s,id=GetID()
    function s.initial_effect(c)
        --Special Summon from hand by banishing 1 "Hieratic" monster from GY
        local e1=Effect.CreateEffect(c)
        e1:SetDescription(aux.Stringid(id,0))
        e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
        e1:SetType(EFFECT_TYPE_IGNITION)
        e1:SetRange(LOCATION_HAND)
        e1:SetCountLimit(1,id)
        e1:SetCost(s.spcost1)
        e1:SetTarget(s.sptg1)
        e1:SetOperation(s.spop1)
        c:RegisterEffect(e1)
        --Tribute this card; Special Summon up to 2 "Hieratic" monsters, then destroy up to 2 cards
        local e2=Effect.CreateEffect(c)
        e2:SetDescription(aux.Stringid(id,1))
        e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY)
        e2:SetType(EFFECT_TYPE_IGNITION)
        e2:SetRange(LOCATION_MZONE)
        e2:SetCountLimit(1,id+100)
        e2:SetCost(s.spcost2)
        e2:SetTarget(s.sptg2)
        e2:SetOperation(s.spop2)
        c:RegisterEffect(e2)
        --If Tributed: Add 1 "Hieratic" Spell/Trap from Deck to hand
        local e3=Effect.CreateEffect(c)
        e3:SetDescription(aux.Stringid(id,2))
        e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
        e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
        e3:SetProperty(EFFECT_FLAG_DELAY)
        e3:SetCode(EVENT_RELEASE)
        e3:SetCountLimit(1,id+200)
        e3:SetTarget(s.thtg)
        e3:SetOperation(s.thop)
        c:RegisterEffect(e3)
    end
    function s.cfilter(c)
        return c:IsSetCard(0x69) and c:IsAbleToRemoveAsCost()
    end
    function s.spcost1(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
        Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
        local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
        Duel.Remove(g,POS_FACEUP,REASON_COST)
    end
    function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
        Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
    end
    function s.spop1(e,tp,eg,ep,ev,re,r,rp)
        local c=e:GetHandler()
        if c:IsRelateToEffect(e) then
            Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
        end
    end
    function s.spcost2(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then return e:GetHandler():IsReleasable() end
        Duel.Release(e:GetHandler(),REASON_COST)
    end
    function s.spfilter(c,e,tp)
        return c:IsSetCard(0x69) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_DEFENSE)
    end
    function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
        local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
        if e:GetHandler():IsLocation(LOCATION_MZONE) then ft=ft+1 end
        if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end
        Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
        Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,0,LOCATION_ONFIELD)
    end
    function s.spop2(e,tp,eg,ep,ev,re,r,rp)
        local c=e:GetHandler()
        local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
        if ft<=0 then return end
        if ft>2 then ft=2 end
        Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
        local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,ft,nil,e,tp)
        if #g>0 then
            for tc in aux.Next(g) do
                Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
                --Negate effects
                local e1=Effect.CreateEffect(c)
                e1:SetType(EFFECT_TYPE_SINGLE)
                e1:SetCode(EFFECT_DISABLE)
                e1:SetReset(RESET_EVENT+RESETS_STANDARD)
                tc:RegisterEffect(e1)
                local e2=e1:Clone()
                e2:SetCode(EFFECT_DISABLE_EFFECT)
                tc:RegisterEffect(e2)
            end
            Duel.SpecialSummonComplete()
            --Then, you can destroy up to 2 cards on the field
            local dg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
            if #dg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
                Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
                local sg=dg:Select(tp,1,2,nil)
                Duel.HintSelection(sg)
                Duel.Destroy(sg,REASON_EFFECT)
            end
        end
    end
    function s.thfilter(c)
        return c:IsSetCard(0x69) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
    end
    function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
        Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
    end
    function s.thop(e,tp,eg,ep,ev,re,r,rp)
        Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
        local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
        if #g>0 then
            Duel.SendtoHand(g,nil,REASON_EFFECT)
            Duel.ConfirmCards(1-tp,g)
        end
    end