create a lua script for this monster card in edopro : ""2+ Dragon monsters, including at least 1 "Hieratic" Monster
When this card is Link Summoned: You can Special Summon 1 "Hieratic" Monster or 1 Normal Dragon Monster from your hand, Deck, or GY in Defense Position, but its effects are negated (if any). Once per turn, when your opponent activates a card or effect (Quick Effect): You can Tribute 1 "Hieratic" monster or 1 Normal Dragon monster from your hand or field; negate the activation, and if you do, banish that card. If this card is destroyed by your opponent's card (by battle or card effect): You can Special Summon 1 "Hieratic" Xyz Monster from your Extra Deck, ignoring its Summoning conditions, and attach this monster as an xyz material"
Assistant
Certainly! I've created a Lua script for your custom "Hieratic" Link Monster card in EDOPRO based on the effect you've provided. Below is the script with comments explaining each part:
lua
--"Hieratic" Link Monster Script
function c12345678.initial_effect(c)
--Link Summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c, c12345678.matfilter, 2, 99, c12345678.lcheck)
--Effect 1: Special Summon on Link Summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(12345678,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(c12345678.spcon1)
e1:SetTarget(c12345678.sptg1)
e1:SetOperation(c12345678.spop1)
c:RegisterEffect(e1)
--Effect 2: Negate opponent's card or effect
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(12345678,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(c12345678.negcon)
e2:SetCost(c12345678.negcost)
e2:SetTarget(c12345678.negtg)
e2:SetOperation(c12345678.negop)
c:RegisterEffect(e2)
--Effect 3: Special Summon "Hieratic" Xyz Monster on destruction
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(12345678,2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(c12345678.spcon2)
e3:SetTarget(c12345678.sptg2)
e3:SetOperation(c12345678.spop2)
c:RegisterEffect(e3)
end
--Link Material Filter: Dragon monsters
function c12345678.matfilter(c)
return c:IsRace(RACE_DRAGON)
end
--Link Material Check: Must include at least 1 "Hieratic" monster
function c12345678.lcheck(g, lc)
return g:IsExists(Card.IsSetCard, 1, nil, 0x69)
end
--Effect 1 Condition: When Link Summoned
function c12345678.spcon1(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 c12345678.spfilter1(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 c12345678.sptg1(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0 then
return Duel.IsExistingMatchingCard(c12345678.spfilter1, tp, LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE, 0, 1, nil, e, tp)
and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
end
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
--Effect 1 Operation: Special Summon and negate effects
function c12345678.spop1(e, tp, eg, ep, ev, re, r, rp)
if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then return end
local c = e:GetHandler()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local g = Duel.SelectMatchingCard(tp, c12345678.spfilter1, tp, LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
local tc = g:GetFirst()
if tc and Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP_DEFENSE) then
--Negate its effects
local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
Duel.SpecialSummonComplete()
end
--Effect 2 Condition: When opponent activates a card or effect
function c12345678.negcon(e, tp, eg, ep, ev, re, r, rp)
return rp ~= tp and Duel.IsChainNegatable(ev)
end
--Effect 2 Cost: Tribute from hand or field
function c12345678.cfilter(c)
return c:IsSetCard(0x69) or (c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL))
end
function c12345678.negcost(e, tp, eg, ep, ev, re, r, rp, chk)
local handg = Duel.GetMatchingGroup(c12345678.cfilter, tp, LOCATION_HAND, 0, nil)
local fieldg = Duel.GetMatchingGroup(c12345678.cfilter, tp, LOCATION_MZONE, 0, nil)
if chk == 0 then return handg:GetCount() > 0 or fieldg:GetCount() > 0 end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
local g = Group.CreateGroup()
g:Merge(handg)
g:Merge(fieldg)
local sg = g:Select(tp, 1, 1, nil)
local tc = sg:GetFirst()
if tc:IsLocation(LOCATION_HAND) then
Duel.SendtoGrave(tc, REASON_COST+REASON_RELEASE)
else
Duel.Release(tc, REASON_COST)
end
end
--Effect 2 Target: Negate activation and banish
function c12345678.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():IsRelateToEffect(re) and re:GetHandler():IsAbleToRemove() then
Duel.SetOperationInfo(0, CATEGORY_REMOVE, eg, 1, 0, 0)
end
end
--Effect 2 Operation: Negate and banish
function c12345678.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: When destroyed by opponent
function c12345678.spcon2(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_MZONE)
and c:GetReasonPlayer() ~= tp and c:IsPreviousControler(tp)
end
--Effect 3 Target: Special Summon "Hieratic" Xyz Monster from Extra Deck
function c12345678.spfilter2(c, e, tp)
return c:IsSetCard(0x69) and c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_XYZ, tp, true, true)
end
function c12345678.sptg2(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0 then
return Duel.GetLocationCountFromEx(tp) > 0
and Duel.IsExistingMatchingCard(c12345678.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 and attach as material
function c12345678.spop2(e, tp, eg, ep, ev, re, r, rp)
if Duel.GetLocationCountFromEx(tp) <= 0 then return end
local c = e:GetHandler()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local tg = Duel.SelectMatchingCard(tp, c12345678.spfilter2, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp)
local sc = tg:GetFirst()
if sc then
Duel.SpecialSummon(sc, SUMMON_TYPE_XYZ, tp, tp, true, true, POS_FACEUP)
if c:IsRelateToEffect(e) and sc:IsType(TYPE_XYZ) then
Duel.BreakEffect()
Duel.Overlay(sc, Group.FromCards(c))
end
sc:CompleteProcedure()
end
end
Explanation:
Link Summon Procedure: The card requires 2 or more Dragon monsters, including at least 1 "Hieratic" monster. This is implemented using aux.AddLinkProcedure with a custom material filter and a material check function.
Effect 1 (On Link Summon): 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 GY in Defense Position, and its effects are negated.
Effect 2 (Negate and Banish): Once per turn, when your opponent activates a card or effect, you can Tribute a "Hieratic" monster or Normal Dragon monster from your hand or field to negate the activation and banish that card.
Effect 3 (Special Summon on Destruction): 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, and attach this card as Xyz Material.
Note:
Replace 12345678 with the actual card ID you assign to this custom card.
String IDs (aux.Stringid) are used for effect descriptions. Ensure you have the corresponding text in your card's string file.
Usage:
Add this script to your EDOPRO script folder with the name matching your card ID (e.g., c12345678.lua).
Make sure to create the corresponding card database entry and localization strings for your custom card.
This script should provide all the functionalities described in your card's effect within EDOPRO.