Skip to content

Commit 8dded85

Browse files
authored
"Mitsurugi Ritual" fix
Its "you can only use each effect of "Mitsurugi Ritual" once per turn" condition should be ignored when applying its effect via "End of the World Ruler".
1 parent 26d7429 commit 8dded85

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

official/c81560239.lua

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function s.initial_effect(c)
99
e1:SetCategory(CATEGORY_RELEASE+CATEGORY_SPECIAL_SUMMON)
1010
e1:SetType(EFFECT_TYPE_ACTIVATE)
1111
e1:SetCode(EVENT_FREE_CHAIN)
12+
e1:SetCost(s.effcost)
1213
e1:SetTarget(s.efftg)
1314
e1:SetOperation(s.effop)
1415
c:RegisterEffect(e1)
@@ -28,22 +29,33 @@ end
2829
function s.tributelimit(e,tp,g,sc)
2930
return #g<=2,#g>2
3031
end
31-
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
32+
function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk)
33+
e:SetLabel(-100)
3234
local params1={lvtype=RITPROC_EQUAL,filter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),location=LOCATION_DECK,matfilter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE)}
3335
local params2={lvtype=RITPROC_EQUAL,filter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),matfilter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),extrafil=s.extragroup,extraop=s.extraop,forcedselection=s.tributelimit}
3436
local b1=not Duel.HasFlagEffect(tp,id) and Ritual.Target(params1)(e,tp,eg,ep,ev,re,r,rp,0)
3537
local b2=not Duel.HasFlagEffect(tp,id+1) and Ritual.Target(params2)(e,tp,eg,ep,ev,re,r,rp,0)
3638
if chk==0 then return b1 or b2 end
39+
end
40+
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
41+
local cost_skip=e:GetLabel()~=-100
42+
local params1={lvtype=RITPROC_EQUAL,filter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),location=LOCATION_DECK,matfilter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE)}
43+
local params2={lvtype=RITPROC_EQUAL,filter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),matfilter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),extrafil=s.extragroup,extraop=s.extraop,forcedselection=s.tributelimit}
44+
local b1=(cost_skip or not Duel.HasFlagEffect(tp,id))
45+
and Ritual.Target(params1)(e,tp,eg,ep,ev,re,r,rp,0)
46+
local b2=(cost_skip or not Duel.HasFlagEffect(tp,id+1))
47+
and Ritual.Target(params2)(e,tp,eg,ep,ev,re,r,rp,0)
48+
if chk==0 then e:SetLabel(0) return b1 or b2 end
3749
local op=Duel.SelectEffect(tp,
38-
{b1,aux.Stringid(id,1)},
39-
{b2,aux.Stringid(id,2)})
50+
{b1,aux.Stringid(id,1)},
51+
{b2,aux.Stringid(id,2)})
4052
e:SetLabel(op)
4153
if op==1 then
42-
Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1)
54+
if not cost_skip then Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end
4355
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
4456
Duel.SetOperationInfo(0,CATEGORY_RELEASE,nil,1,tp,LOCATION_HAND|LOCATION_MZONE)
4557
elseif op==2 then
46-
Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1)
58+
if not cost_skip then Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) end
4759
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
4860
Duel.SetOperationInfo(0,CATEGORY_RELEASE,nil,1,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_DECK)
4961
end
@@ -57,4 +69,4 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp)
5769
local params2={lvtype=RITPROC_EQUAL,filter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),matfilter=aux.FilterBoolFunction(Card.IsRace,RACE_REPTILE),extrafil=s.extragroup,extraop=s.extraop,forcedselection=s.tributelimit}
5870
Ritual.Operation(params2)(e,tp,eg,ep,ev,re,r,rp)
5971
end
60-
end
72+
end

0 commit comments

Comments
 (0)