Skip to content

Commit 1702865

Browse files
authored
"Thousand-Eyes Spell" script update
Updated it to use the Ritual and Fusion procedures.
1 parent 8a69aa3 commit 1702865

File tree

1 file changed

+53
-138
lines changed

1 file changed

+53
-138
lines changed

skill/c300204003.lua

Lines changed: 53 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -3,153 +3,68 @@ local s,id=GetID()
33
function s.initial_effect(c)
44
aux.AddSkillProcedure(c,1,false,s.flipcon,s.flipop)
55
end
6+
s.listed_names={64631466,63519819} --"Relinquished", "Thousand-Eyes Restrict"
67
function s.flipcon(e,tp,eg,ep,ev,re,r,rp)
7-
--condition
8-
return aux.CanActivateSkill(tp) and (s.fusTarget(e,tp,eg,ep,ev,re,r,rp,0) or s.ritTarget(e,tp,eg,ep,ev,re,r,rp,0))
9-
and Duel.GetFlagEffect(tp,id)==0
8+
return aux.CanActivateSkill(tp) and not Duel.HasFlagEffect(tp,id) and s.cost(e,tp,eg,ep,ev,re,r,rp,0)
9+
end
10+
function s.costfilter(c,e,tp,eg,ep,ev,re,r,rp)
11+
if not c:IsDiscardable() then return false end
12+
local rit_params={filter=function(ritual_c) return ritual_c:IsCode(64631466) and ritual_c~=c end,lvtype=RITPROC_GREATER,forcedselection=s.rcheck(c)}
13+
local fus_params={fusfilter=aux.FilterBoolFunction(Card.IsCode,63519819),extrafil=s.fextra(c)}
14+
return Ritual.Target(rit_params)(e,tp,eg,ep,ev,re,r,rp,0)
15+
or Fusion.SummonEffTG(fus_params)(e,tp,eg,ep,ev,re,r,rp,0)
16+
end
17+
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
18+
if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil,e,tp,eg,ep,ev,re,r,rp) end
19+
Duel.DiscardHand(tp,s.costfilter,1,1,REASON_COST|REASON_DISCARD,nil,e,tp,eg,ep,ev,re,r,rp)
20+
end
21+
function s.fextra(exc)
22+
return function(e,tp,mg)
23+
return nil,s.fcheck(exc)
24+
end
25+
end
26+
function s.fcheck(exc)
27+
return function(tp,sg,fc)
28+
return not (exc and sg:IsContains(exc))
29+
end
30+
end
31+
function s.rcheck(exc)
32+
return function(e,tp,sg,rc)
33+
return not (exc and sg:IsContains(exc))
34+
end
1035
end
11-
s.listed_names={64631466,63519819}
1236
function s.flipop(e,tp,eg,ep,ev,re,r,rp)
1337
Duel.Hint(HINT_SKILL_FLIP,tp,id|(1<<32))
1438
Duel.Hint(HINT_CARD,tp,id)
15-
--ritual
16-
local g1=s.ritTarget(e,tp,eg,ep,ev,re,r,rp,0)
17-
--fusion
18-
local g2=s.fusTarget(e,tp,eg,ep,ev,re,r,rp,0)
19-
local opt=0
20-
if g1 and g2 then
21-
opt=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))
22-
elseif g1 then
23-
opt=Duel.SelectOption(tp,aux.Stringid(id,1))
24-
elseif g2 then
25-
opt=Duel.SelectOption(tp,aux.Stringid(id,2))+1
26-
else return end
27-
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
28-
--cannot conduct BP this turn
39+
--Soft OPT
40+
Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1)
41+
--Discard 1 card
42+
s.cost(e,tp,eg,ep,ev,re,r,rp,1)
43+
local rit_params={filter=aux.FilterBoolFunction(Card.IsCode,64631466),lvtype=RITPROC_GREATER,forcedselection=s.rcheck(c)}
44+
local fus_params={fusfilter=aux.FilterBoolFunction(Card.IsCode,63519819),extrafil=s.fextra(c)}
45+
local b1=Ritual.Target(rit_params)(e,tp,eg,ep,ev,re,r,rp,0)
46+
local b2=Fusion.SummonEffTG(fus_params)(e,tp,eg,ep,ev,re,r,rp,0)
47+
local op=Duel.SelectEffect(tp,
48+
{b1,aux.Stringid(id,1)},
49+
{b2,aux.Stringid(id,2)})
50+
if op==1 then
51+
--Ritual Summon 1 "Relinquished" from your hand by Tributing a monster from your hand or field whose Level is 1 or more, also flip this card over
52+
Ritual.Target(rit_params)(e,tp,eg,ep,ev,re,r,rp,1)
53+
Ritual.Operation(rit_params)(e,tp,eg,ep,ev,re,r,rp)
54+
elseif op==2 then
55+
--Fusion Summon 1 "Thousand-Eyes Restrict" from your Extra Deck, using monsters from your hand or field as Fusion Material, also flip this card over
56+
Fusion.SummonEffTG(fus_params)(e,tp,eg,ep,ev,re,r,rp,1)
57+
Fusion.SummonEffOP(params)(e,tp,eg,ep,ev,re,r,rp)
58+
end
59+
--You cannot conduct your Battle Phase this turn
2960
local e1=Effect.CreateEffect(e:GetHandler())
61+
e1:SetDescription(aux.Stringid(id,3))
3062
e1:SetType(EFFECT_TYPE_FIELD)
63+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
3164
e1:SetCode(EFFECT_CANNOT_BP)
32-
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
3365
e1:SetTargetRange(1,0)
34-
e1:SetReset(RESET_PHASE+PHASE_END)
66+
e1:SetReset(RESET_PHASE|PHASE_END)
3567
Duel.RegisterEffect(e1,tp)
36-
aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,3),nil)
37-
if opt==0 then
38-
s.ritTarget(e,tp,eg,ep,ev,re,r,rp,1)
39-
local mg=Duel.GetRitualMaterial(tp)
40-
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
41-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
42-
local tc=Duel.SelectMatchingCard(tp,s.ritfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mg,ft):GetFirst()
43-
if tc then
44-
mg:Match(Card.IsCanBeRitualMaterial,tc,tc)
45-
local mat=nil
46-
if ft>0 then
47-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
48-
mat=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc)
49-
else
50-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
51-
mat=mg:FilterSelect(tp,s.mfilterf,1,1,nil,tp,mg,tc)
52-
Duel.SetSelectedCard(mat)
53-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
54-
local mat2=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc)
55-
mat:Merge(mat2)
56-
end
57-
tc:SetMaterial(mat)
58-
Duel.ReleaseRitualMaterial(mat)
59-
Duel.BreakEffect()
60-
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
61-
tc:CompleteProcedure()
62-
end
63-
else
64-
s.fusTarget(e,tp,eg,ep,ev,re,r,rp,1)
65-
local chkf=tp
66-
local mg1=Duel.GetFusionMaterial(tp):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e)
67-
local sg1=Duel.GetMatchingGroup(s.fusfilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
68-
local mg2=nil
69-
local sg2=nil
70-
local ce=Duel.GetChainMaterial(tp)
71-
if ce~=nil then
72-
local fgroup=ce:GetTarget()
73-
mg2=fgroup(ce,e,tp)
74-
local mf=ce:GetValue()
75-
sg2=Duel.GetMatchingGroup(s.fusfilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
76-
end
77-
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
78-
local sg=sg1:Clone()
79-
if sg2 then sg:Merge(sg2) end
80-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
81-
local tg=sg:Select(tp,1,1,nil)
82-
local tc=tg:GetFirst()
83-
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
84-
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
85-
tc:SetMaterial(mat1)
86-
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
87-
Duel.BreakEffect()
88-
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
89-
else
90-
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
91-
local fop=ce:GetOperation()
92-
fop(ce,e,tp,tc,mat2)
93-
end
94-
tc:CompleteProcedure()
95-
end
96-
end
68+
--Flip this card over
9769
Duel.Hint(HINT_SKILL_FLIP,tp,id|(2<<32))
9870
end
99-
--ritual
100-
function s.ritDiscardFilter(c,e,tp,m,ft)
101-
return c:IsDiscardable() and Duel.IsExistingMatchingCard(s.ritfilter,tp,LOCATION_HAND,0,1,c,e,tp,m-c,ft)
102-
end
103-
function s.ritual_filter(c)
104-
return c:IsRitualMonster() and c:IsCode(64631466)
105-
end
106-
function s.ritfilter(c,e,tp,m,ft)
107-
if not s.ritual_filter(c) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
108-
local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c)
109-
if ft>0 then
110-
return mg:CheckWithSumGreater(Card.GetRitualLevel,c:GetLevel(),c)
111-
else
112-
return mg:IsExists(s.mfilterf,1,nil,tp,mg,c)
113-
end
114-
end
115-
function s.mfilterf(c,tp,mg,rc)
116-
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) then
117-
Duel.SetSelectedCard(c)
118-
return mg:CheckWithSumGreater(Card.GetRitualLevel,rc:GetLevel(),rc)
119-
else
120-
return false
121-
end
122-
end
123-
function s.ritTarget(e,tp,eg,ep,ev,re,r,rp,chk)
124-
local mg=Duel.GetRitualMaterial(tp)
125-
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
126-
if chk==0 then return ft>-1 and Duel.IsExistingMatchingCard(s.ritDiscardFilter,tp,LOCATION_HAND,0,1,nil,e,tp,mg,ft) end
127-
Duel.DiscardHand(tp,s.ritDiscardFilter,1,1,REASON_COST+REASON_DISCARD,nil,e,tp,mg,ft)
128-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
129-
end
130-
--fusion
131-
function s.cfilter(c,e,tp)
132-
if not c:IsDiscardable() then return false end
133-
local chkf=tp
134-
local mg1=Duel.GetFusionMaterial(tp)
135-
local res=Duel.IsExistingMatchingCard(s.fusfilter,tp,LOCATION_EXTRA,0,1,c,e,tp,mg1-c,nil,chkf)
136-
if not res then
137-
local ce=Duel.GetChainMaterial(tp)
138-
if ce~=nil then
139-
local fgroup=ce:GetTarget()
140-
local mg2=fgroup(ce,e,tp)
141-
local mf=ce:GetValue()
142-
res=Duel.IsExistingMatchingCard(s.fusfilter,tp,LOCATION_EXTRA,0,1,c,e,tp,mg2-c,mf,chkf)
143-
end
144-
end
145-
return res
146-
end
147-
function s.fusfilter(c,e,tp,m,f,chkf)
148-
return c:IsType(TYPE_FUSION) and (not f or f(c)) and c:IsCode(63519819)
149-
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
150-
end
151-
function s.fusTarget(e,tp,eg,ep,ev,re,r,rp,chk)
152-
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
153-
Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST+REASON_DISCARD,nil,e,tp)
154-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
155-
end

0 commit comments

Comments
 (0)