-
Notifications
You must be signed in to change notification settings - Fork 132
/
c10045474.lua
87 lines (87 loc) · 3.28 KB
/
c10045474.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
--無限泡影
---@param c Card
function c10045474.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetTarget(c10045474.target)
e1:SetOperation(c10045474.activate)
c:RegisterEffect(e1)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(10045474,0))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCondition(c10045474.handcon)
c:RegisterEffect(e2)
end
function c10045474.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and aux.NegateMonsterFilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(aux.NegateMonsterFilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
Duel.SelectTarget(tp,aux.NegateMonsterFilter,tp,0,LOCATION_MZONE,1,1,nil)
end
function c10045474.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsCanBeDisabledByEffect(e) then
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
if not c:IsStatus(STATUS_ACT_FROM_HAND) and c:IsLocation(LOCATION_SZONE) then
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_DISABLE)
e4:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE)
e4:SetTarget(c10045474.distg)
e4:SetReset(RESET_PHASE+PHASE_END)
e4:SetLabel(c:GetSequence(),c:GetFieldID())
Duel.RegisterEffect(e4,tp)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_CHAIN_SOLVING)
e5:SetOperation(c10045474.disop)
e5:SetReset(RESET_PHASE+PHASE_END)
e5:SetLabel(c:GetSequence())
Duel.RegisterEffect(e5,tp)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e6:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e6:SetTarget(c10045474.distg)
e6:SetReset(RESET_PHASE+PHASE_END)
e6:SetLabel(c:GetSequence())
Duel.RegisterEffect(e6,tp)
Duel.Hint(HINT_ZONE,tp,0x1<<(c:GetSequence()+8))
end
end
end
function c10045474.distg(e,c)
local seq,fid=e:GetLabel()
local tp=e:GetHandlerPlayer()
return c:IsType(TYPE_SPELL+TYPE_TRAP) and aux.GetColumn(c,tp)==seq and c:GetFieldID()~=fid
end
function c10045474.disop(e,tp,eg,ep,ev,re,r,rp)
local tseq=e:GetLabel()
local controller,loc,seq=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CONTROLER,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SEQUENCE)
if loc&LOCATION_SZONE~=0 and seq<=4 and re:IsActiveType(TYPE_SPELL+TYPE_TRAP)
and ((controller==tp and seq==tseq) or (controller==1-tp and seq==4-tseq)) then
Duel.NegateEffect(ev)
end
end
function c10045474.handcon(e)
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_ONFIELD,0)==0
end