-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc92408984.lua
50 lines (50 loc) · 1.82 KB
/
c92408984.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--Dragon's bead
function c92408984.initial_effect(c)
--Activate
--Removed the part of the script that allows its effect to be used when the card is flipped up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--instant(chain)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(92408984,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_CHAINING)
e2:SetCondition(c92408984.condition2)
e2:SetCost(c92408984.cost2)
e2:SetTarget(c92408984.target2)
e2:SetOperation(c92408984.operation2)
c:RegisterEffect(e2)
end
function c92408984.cfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsRace(RACE_DRAGON)
end
function c92408984.condition2(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end
if not re:GetHandler():IsType(TYPE_TRAP) then return false end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if not tg or not tg:IsExists(c92408984.cfilter,1,nil) then return false end
return Duel.IsChainNegatable(ev)
end
function c92408984.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c92408984.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
if eg:GetFirst():IsLocation(LOCATION_ONFIELD) then
eg:GetFirst():CreateEffectRelation(e)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c92408984.operation2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.NegateEffect(ev)
if re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end