Skip to content

Commit 7b1186b

Browse files
committed
Optimize Shining Hope Road (Manga)
1 parent 429c8c9 commit 7b1186b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

unofficial/c511600071.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ s.listed_series={SET_NUMBER,SET_NUMBER_S}
1717
function s.matfilter(c,e)
1818
return c:IsSetCard(SET_NUMBER) and c:IsCanBeEffectTarget(e)
1919
end
20-
function s.rescon(sg,e,tp,g)
21-
return Duel.IsExistingMatchingCard(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,nil,nil,sg,#sg,#sg)
20+
function s.rescon(xyzg)
21+
return function(sg,e,tp,g)
22+
--If no xyz can be summoned using at least the currently seelcted cards as forced materials, stop
23+
return xyzg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,#sg,#sg),
24+
not xyzg:IsExists(Card.IsXyzSummonable,1,nil,sg,g,#sg,#g)
25+
end
2226
end
2327
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
2428
if chkc then return false end
@@ -33,13 +37,13 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
3337
_c:RegisterEffect(e1,true)
3438
_c:AssumeProperty(ASSUME_RANK,_c:GetRank()+1)
3539
end
40+
local xyzg=Duel.GetMatchingGroup(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,nil,nil,mg)
3641
if chk==0 then
37-
local res=Duel.IsExistingMatchingCard(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,nil,nil,mg)
3842
notSg:ForEach(function(_c) _c:ResetEffect(id,RESET_CARD) end)
39-
return res
43+
return #xyzg>0
4044
end
4145
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
42-
local tg=aux.SelectUnselectGroup(mg,e,tp,1,99,s.rescon,1,tp,HINTMSG_XMATERIAL,s.rescon)
46+
local tg=aux.SelectUnselectGroup(mg,e,tp,1,#mg,s.rescon(xyzg),1,tp,HINTMSG_XMATERIAL,s.rescon(xyzg))
4347
Duel.SetTargetCard(tg)
4448
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,tg,#tg,0,0)
4549
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)

utility.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ function Auxiliary.SelectUnselectGroup(g,e,tp,minc,maxc,rescon,chk,seltp,hintmsg
17601760
local hintmsg=hintmsg or 0
17611761
local sg=Group.CreateGroup()
17621762
while true do
1763-
local finishable = #sg>=minc and (not finishcon or finishcon(sg,e,tp,g))
1763+
local finishable = #sg>=minc and (not finishcon or (finishcon(sg,e,tp,g)))
17641764
local mg=g:Filter(Auxiliary.SelectUnselectLoop,sg,sg,g,e,tp,minc,maxc,rescon)
17651765
if (breakcon and breakcon(sg,e,tp,mg)) or #mg<=0 or #sg>=maxc then break end
17661766
Duel.Hint(HINT_SELECTMSG,seltp,hintmsg)

0 commit comments

Comments
 (0)