create a lua script of this quick spell card in edopro: (Dark Contract with the…
- User
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". the id archtype of "dark contract" is "ae", while "D/D/D" is "10af"
- Assistant
Here's the Lua script for your custom card "Dark Contract with the Overlord" with the card ID "7777":
--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 Extra Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) -- Description placeholder e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_XYZ_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.xyztg) e1:SetOperation(s.xyzop) e1:SetCountLimit(1,id) c:RegisterEffect(e1) --Effect 2: Banish from GY to add 1 "Dark Contract" Spell/Trap from Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) -- Description placeholder e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.thcon) e2:SetCost(aux.bfgcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) e2:SetCountLimit(1,id+1) c:RegisterEffect(e2) end function s.xyzfilter(c) return c:IsFaceup() and c:IsSetCard(0x10af) and c:IsType(TYPE_XYZ) end function s.spfilter(c,e,tp) return c:IsSetCard(0x10af) and c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,true) end function s.xyztg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.xyzfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g1=Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.xyzop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCountFromEx(tp)<=0 then return end local tc=Duel.GetFirstTarget() if not (tc and tc:IsRelateToEffect(e) and s.xyzfilter(tc) and tc:IsControler(tp)) then return end if tc:IsImmuneToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if sc then local mg=Group.FromCards(tc) sc:SetMaterial(mg) Duel.Overlay(sc,mg) if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,true,POS_FACEUP)~=0 then sc:CompleteProcedure() end end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return aux.exccon(e) and Duel.IsMainPhase() end function s.thfilter(c) return c:IsSetCard(0xae) 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 endExplanation:
-
Effect 1 (Activation Effect):
- Target: 1 "D/D/D" Xyz Monster you control.
- Operation: Special Summon 1 "D/D/D" Xyz Monster from your Extra Deck, ignoring its Summoning conditions, by using the targeted monster as material. This is treated as an Xyz Summon.
- Implementation Details:
- The
s.xyztgfunction handles targeting the appropriate "D/D/D" Xyz Monster on your field. - The
s.xyzopfunction performs the Special Summon from the Extra Deck and overlays the targeted monster as material.
- The
-
Effect 2 (Graveyard Effect):
- Condition: During your Main Phase, except the turn this card was sent to the GY.
- Cost: Banish this card from your GY.
- Effect: Add 1 "Dark Contract" Spell/Trap from your Deck to your hand, except "Dark Contract with the Overlord".
- Implementation Details:
- The
s.thconfunction checks if it is your Main Phase and not the turn this card was sent to the GY. - The
s.thtgfunction searches for a valid "Dark Contract" Spell/Trap in your Deck. - The
s.thopfunction adds the selected card to your hand.
- The
Note:
- The card uses the archetype IDs you provided:
- "Dark Contract" cards are identified with
0xae. - "D/D/D" cards are identified with
0x10af.
- "Dark Contract" cards are identified with
- The script ensures that each effect can only be used once per turn, as specified.
- Placeholders for descriptions (
aux.Stringid) are included. You should replace the description IDs (0,1) with the appropriate numbers corresponding to the text entries in your card's database.
-