create a lua script of this quick spell card in edopro: (Dark Contract with the Overlord) Effect: "Target 1 "D/D/D" Xyz Monster you control; Special Summon from your Extra Deck 1 "D/D/D" Xyz Monster, ignoring its Summoning conditions, by using that monster you control as material. (This is treated as an Xyz Summon.) During your Main Phase, if this card is in your GY except the turn it was sent there: You can banish this card; add 1 "Dark Contract" Spell/Trap from your Deck to your hand, except "Dark Contract with the Overlord". You can only use each effect of "Dark Contract with the Overlord" once per turn." the id card is "7777"
Assistant
Sure! Below is the Lua script for the custom card "Dark Contract with the Overlord" with the card ID "7777" for EDOPro. This script includes both of the card's effects as specified.
lua
--Dark Contract with the Overlord
local s,id=GetID()
function s.initial_effect(c)
--Effect 1: Special Summon 1 "D/D/D" Xyz Monster from your Extra Deck
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,id)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--Effect 2: Add 1 "Dark Contract" Spell/Trap from Deck to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(aux.exccon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
e2:SetCountLimit(1,id+100)
c:RegisterEffect(e2)
end
--Filter for targeting "D/D/D" Xyz Monster you control
function s.filter1(c)
return c:IsFaceup() and c:IsSetCard(0xae) and c:IsType(TYPE_XYZ)
end
--Filter for Special Summoning "D/D/D" Xyz Monster from Extra Deck
function s.spfilter(c,e,tp)
return c:IsSetCard(0xae) and c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,true,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)
and Duel.GetLocationCountFromEx(tp)>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local tg=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end
if Duel.GetLocationCountFromEx(tp,tp,tc)<=0 then return end
if not aux.MustMaterialCheck(tc,tp,EFFECT_MUST_BE_XMATERIAL) then return end
local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp)
if #g==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=g:Select(tp,1,1,nil):GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if #mg~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(tc))
Duel.Overlay(sc,Group.FromCards(tc))
--Special Summon, ignoring summoning conditions
Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,true,false,POS_FACEUP)
sc:CompleteProcedure()
end
end
--Filter for adding "Dark Contract" Spell/Trap from Deck to hand
function s.thfilter(c)
return c:IsSetCard(0xaf) and c:IsType(TYPE_SPELL+TYPE_TRAP) and not c:IsCode(id) 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
Explanation:
Effect 1: When this Quick-Play Spell Card is activated, it targets 1 face-up "D/D/D" Xyz Monster you control. It then allows you to Special Summon 1 "D/D/D" Xyz Monster from your Extra Deck, ignoring its Summoning conditions, by using the targeted monster as material. The original monster's overlays are transferred to the new monster, and this is treated as an Xyz Summon.
The function s.sptg handles targeting the appropriate monster.
The function s.spop executes the Special Summon, overlaying materials, and ignoring summoning conditions.
Effect 2: During your Main Phase, except the turn this card was sent to the GY, you can banish this card from your GY to add 1 "Dark Contract" Spell/Trap from your Deck to your hand, except "Dark Contract with the Overlord".
The function s.thtg sets up the search target.
The function s.thop executes the actual search and adds the card to your hand.
Notes:
The script uses the card ID 7777 as specified.
Both effects are limited to once per turn using SetCountLimit.
The auxiliary functions aux.exccon and aux.bfgcost are used to check the condition (not sent to the GY this turn) and handle the cost (banishing this card) respectively.
Replace 0xae with the appropriate set code for "D/D/D" and 0xaf for "Dark Contract" if they differ.
How to Use:
Create the Script File:
Save the script above as c7777.lua in your EDOPro script directory.
Add the Card Images:
Place the card image named 7777.jpg in the appropriate pics directory.
Update the Card Database:
Ensure you have the card details in your cards.cdb database file with the matching ID 7777.
Test the Card:
Launch EDOPro and test the card in a duel to ensure it functions as intended.
Let me know if you need any further assistance or modifications!