Here's a Lua script for your custom card "HIERATIC DRAGON OF GOLDEN SOVEREIGNTY" designed for EDOPro. This script includes all the effects you've described. Please make sure to adjust the card ID (id) to match your custom card's assigned ID in your card database.
--Hieratic Dragon of Golden Sovereignty
local s,id=GetID()
function s.initial_effect(c)
--Link Summon
c:EnableReviveLimit()
Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON),2,99,s.lcheck)
--When Link Summoned: Special Summon 1 "Hieratic" or Normal Dragon monster from hand, Deck, or GY
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0)) -- Description index 0
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(s.spcon)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--Quick Effect: Tribute to negate and banish
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1)) -- Description index 1
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.negcon)
e2:SetCost(s.negcost)
e2:SetTarget(s.negtg)
e2:SetOperation(s.negop)
c:RegisterEffect(e2)
--If destroyed by opponent: Special Summon 1 "Hieratic" Xyz Monster from Extra Deck
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2)) -- Description index 2
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.spcon2)
e3:SetTarget(s.sptg2)
e3:SetOperation(s.spop2)
c:RegisterEffect(e3)
end
--Link Summon condition: Requires at least 1 "Hieratic" monster
function s.lcheck(g,lc,sumtype,tp)
return g:IsExists(Card.IsSetCard,1,nil,0x69)
end
--Effect 1 condition: When this card is Link Summoned
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
--Effect 1 target: Special Summon target from hand, Deck, or GY
function s.spfilter(c,e,tp)
return (c:IsSetCard(0x69) or (c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL)))
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
--Effect 1 operation: Special Summon and negate its effects
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then
-- Negate its effects (if any)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
--Effect 2 condition: When your opponent activates a card or effect
function s.negcon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and re:IsActiveType(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP) and Duel.IsChainNegatable(ev)
end
--Effect 2 cost: Tribute 1 "Hieratic" or Normal Dragon monster from hand or field
function s.costfilter(c)
return (c:IsSetCard(0x69) or (c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL))) and c:IsReleasable()
end
function s.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.costfilter,1,false,nil,nil) end
local g=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,false,nil,nil)
Duel.Release(g,REASON_COST)
end
--Effect 2 target: Negate activation and banish the card
function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsAbleToRemove() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
--Effect 2 operation: Negate and banish
function s.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
end
end
--Effect 3 condition: If destroyed by opponent's card
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return (c:IsReason(REASON_BATTLE) or (rp==1-tp and c:IsReason(REASON_EFFECT))) and c:IsPreviousLocation(LOCATION_MZONE)
end
--Effect 3 target: Special Summon 1 "Hieratic" Xyz Monster from Extra Deck
function s.spfilter2(c,e,tp)
return c:IsSetCard(0x69) and c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
end
function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_XYZ)>0
and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
--Effect 3 operation: Special Summon the Xyz Monster
function s.spop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_XYZ)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
if tc then
Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
tc:CompleteProcedure()
end
end
Explanation of the Script:
- Link Summon Procedure: The card requires 2 or more Dragon monsters, including at least 1 "Hieratic" monster. The
s.lcheck function ensures that at least one "Hieratic" monster is used as material.
- Effect 1: When this card is Link Summoned, it allows you to Special Summon a "Hieratic" monster or a Normal Dragon monster from your hand, Deck, or Graveyard in Defense Position with its effects negated.
- Effect 2: Once per turn, when your opponent activates a card or effect, you can Tribute a "Hieratic" monster or a Normal Dragon monster from your hand or field to negate the activation and banish the card.
- Effect 3: If this card is destroyed by your opponent (by battle or card effect), you can Special Summon a "Hieratic" Xyz Monster from your Extra Deck, ignoring its Summoning conditions.
Notes:
- Replace
GetID() with the actual ID assigned to your custom card if needed.
- The script uses
aux.Stringid(id, n) for descriptions. Ensure that your card's description texts are properly indexed in your cdb (card database) file corresponding to the indices used in the script (0, 1, 2).
- This script assumes standard behavior for card effects and interactions. Adjustments may be necessary based on the specifics of your environment or additional card interactions.
Testing:
After adding the script and the corresponding card data to your EDOPro environment, test the card thoroughly to ensure all effects work as intended. Pay special attention to interactions with other cards, especially when dealing with the Special Summon from the Extra Deck and negation effects.