Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here's a code snippet that should do what you're asking for:
- ```lua
- local s,id,o=GetID()
- function s.initial_effect(c)
- local e1=Effect.CreateEffect(c)
- e1:SetType(EFFECT_TYPE_ACTIVATE)
- e1:SetCode(EVENT_FREE_CHAIN)
- e1:SetCondition(s.condition)
- e1:SetTarget(s.target)
- e1:SetOperation(s.activate)
- c:RegisterEffect(e1)
- end
- function s.condition(e,tp,eg,ep,ev,re,r,rp)
- return not Duel.IsExistingMatchingCard(aux.FilterFaceupFunction(Card.IsSetCard,0x123),tp,0,LOCATION_MZONE,1,nil) -- 0x123 is the setcode for "titan" monsters
- end
- function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
- if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end
- end
- function s.filter(c)
- return c:IsSetCard(0x456) and c:IsAbleToHand() -- 0x456 is the setcode for "lightning" cards
- end
- function s.activate(e,tp,eg,ep,ev,re,r,rp)
- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
- local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil)
- if #g>0 then
- Duel.SendtoHand(g,nil,REASON_EFFECT)
- Duel.ConfirmCards(1-tp,g)
- if g:GetFirst():IsCode(10000000) then -- 10000000 is the card code for "lightning-Maria"
- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
- local g=Duel.SelectMatchingCard(tp,Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,1,nil)
- if #g>0 then
- Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT)
- end
- end
- end
- end
- ```
- This script creates an effect for a spell card that can only be activated if your opponent controls no "titan" monsters. When activated it allows you to add 1 "lightning" card from your deck to your hand. If you added "lightning-Maria" with this effect it also allows you to banish one facedown card your opponent controls. The effect of this card can only be activated once per turn.
- Please note that you'll need to replace `0x123` and `0x456` with the actual setcodes for "titan" and "lightning" cards respectively. You'll also need to replace `10000000` with the actual card code for "lightning-Maria".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement