@@ -47,7 +47,7 @@ function Ritual.WholeLevelTributeValue(cond)
4747end
4848-- Ritual Summon
4949Ritual .CreateProc = aux .FunctionWithNamedArgs (
50- function (c ,_type ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
50+ function (c ,_type ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
5151 -- lv can be a function (like GetLevel/GetOriginalLevel), fixed level, if nil it defaults to GetLevel
5252 if filter and type (filter )== " function" then
5353 local mt = c .__index
@@ -65,17 +65,17 @@ function(c,_type,filter,lv,desc,extrafil,extraop,matfilter,stage2,location,force
6565 e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
6666 e1 :SetType (EFFECT_TYPE_ACTIVATE )
6767 e1 :SetCode (EVENT_FREE_CHAIN )
68- e1 :SetTarget (Ritual .Target (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,specificmatfilter ,requirementfunc ,sumpos ,extratg ))
69- e1 :SetOperation (Ritual .Operation (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ))
68+ e1 :SetTarget (Ritual .Target (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self ))
69+ e1 :SetOperation (Ritual .Operation (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos , self ))
7070 return e1
71- end ," handler" ," lvtype" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" )
71+ end ," handler" ," lvtype" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" , " self " )
7272
7373Ritual .AddProc = aux .FunctionWithNamedArgs (
74- function (c ,_type ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
75- local e1 = Ritual .CreateProc (c ,_type ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
74+ function (c ,_type ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
75+ local e1 = Ritual .CreateProc (c ,_type ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
7676 c :RegisterEffect (e1 )
7777 return e1
78- end ," handler" ," lvtype" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" )
78+ end ," handler" ," lvtype" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" , " self " )
7979
8080local function WrapTableReturn (func )
8181 if func then
@@ -127,7 +127,7 @@ local function GetDefaultSummonFromLocation()
127127 return Duel .IsDuelType (DUEL_EXTRA_DECK_RITUAL ) and LOCATION_EXTRA or LOCATION_HAND
128128end
129129Ritual .Target = aux .FunctionWithNamedArgs (
130- function (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
130+ function (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
131131 location = location or GetDefaultSummonFromLocation ()
132132 sumpos = sumpos or POS_FACEUP
133133 return function (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
@@ -163,7 +163,7 @@ function(filter,_type,lv,extrafil,extraop,matfilter,stage2,location,forcedselect
163163 if extratg then extratg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ) end
164164 Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,location )
165165 end
166- end ," filter" ," lvtype" ," lv" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" )
166+ end ," filter" ," lvtype" ," lv" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" , " self " )
167167
168168function Auxiliary .RitualCheckAdditionalLevel (c ,rc )
169169 local raw_level = c :GetRitualLevel (rc )
@@ -220,10 +220,12 @@ function Ritual.Finishcon(sc,lv,forcedselection,requirementfunc,_type)
220220end
221221
222222Ritual .Operation = aux .FunctionWithNamedArgs (
223- function (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos )
223+ function (filter ,_type ,lv ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos , self )
224224 location = location or GetDefaultSummonFromLocation ()
225225 sumpos = sumpos or POS_FACEUP
226226 return function (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
227+ local c = e :GetHandler ()
228+ if self and not c :IsRelateToEffect (e ) then return end
227229 local mg = Duel .GetRitualMaterial (tp ,not requirementfunc )
228230 local mg2 = extrafil and extrafil (e ,tp ,eg ,ep ,ev ,re ,r ,rp ) or Group .CreateGroup ()
229231 -- if an EFFECT_EXTRA_RITUAL_MATERIAL effect has a forcedselection of its own
@@ -251,8 +253,13 @@ function(filter,_type,lv,extrafil,extraop,matfilter,stage2,location,forcedselect
251253 end
252254 Ritual .CheckMatFilter (matfilter ,e ,tp ,mg ,mg2 )
253255 local ft = Duel .GetLocationCount (tp ,LOCATION_MZONE )
254- Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
255- local tg = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (Ritual .Filter ),tp ,location ,0 ,1 ,1 ,nil ,filter ,_type ,e ,tp ,mg ,mg2 ,func ,specificmatfilter ,lv ,requirementfunc ,sumpos )
256+ local tg = Group .CreateGroup ()
257+ if not self then
258+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
259+ tg = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (Ritual .Filter ),tp ,location ,0 ,1 ,1 ,nil ,filter ,_type ,e ,tp ,mg ,mg2 ,func ,specificmatfilter ,lv ,requirementfunc ,sumpos )
260+ elseif Ritual .Filter (c ,filter ,_type ,e ,tp ,mg ,mg2 ,func ,specificmatfilter ,lv ,requirementfunc ,sumpos ) and not c :IsHasEffect (EFFECT_NECRO_VALLEY ) then
261+ tg :AddCard (c )
262+ end
256263 if # tg > 0 then
257264 local tc = tg :GetFirst ()
258265 local lv = (lv and (type (lv )== " function" and lv (tc )) or lv ) or tc :GetLevel ()
@@ -321,13 +328,13 @@ function(filter,_type,lv,extrafil,extraop,matfilter,stage2,location,forcedselect
321328 Ritual .SummoningLevel = nil
322329 end
323330 end
324- end ," filter" ," lvtype" ," lv" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" )
331+ end ," filter" ," lvtype" ," lv" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" , " self " )
325332
326333-- Ritual Summon, geq fixed lv
327334Ritual .AddProcGreater = aux .FunctionWithNamedArgs (
328- function (c ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
329- return Ritual .AddProc (c ,RITPROC_GREATER ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
330- end ," handler" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" )
335+ function (c ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
336+ return Ritual .AddProc (c ,RITPROC_GREATER ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
337+ end ," handler" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" , " self " )
331338
332339function Ritual .AddProcCode (c ,_type ,lv ,desc ,...)
333340 if not c :IsStatus (STATUS_COPYING_EFFECT ) and c .fit_monster == nil then
343350
344351-- Ritual Summon, equal to
345352Ritual .AddProcEqual = aux .FunctionWithNamedArgs (
346- function (c ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
347- return Ritual .AddProc (c ,RITPROC_EQUAL ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg )
348- end ," handler" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" )
353+ function (c ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
354+ return Ritual .AddProc (c ,RITPROC_EQUAL ,filter ,lv ,desc ,extrafil ,extraop ,matfilter ,stage2 ,location ,forcedselection ,customoperation ,specificmatfilter ,requirementfunc ,sumpos ,extratg , self )
355+ end ," handler" ," filter" ," lv" ," desc" ," extrafil" ," extraop" ," matfilter" ," stage2" ," location" ," forcedselection" ," customoperation" ," specificmatfilter" ," requirementfunc" ," sumpos" ," extratg" , " self " )
349356
350357function Ritual .AddProcEqualCode (c ,lv ,desc ,...)
351358 return Ritual .AddProcCode (c ,RITPROC_EQUAL ,lv ,desc ,... )
0 commit comments