Commit ebf4af30 authored by Nemo Ma's avatar Nemo Ma

fix

parent 48d79995
...@@ -29,7 +29,7 @@ function c10080420.initial_effect(c) ...@@ -29,7 +29,7 @@ function c10080420.initial_effect(c)
c:RegisterEffect(e6) c:RegisterEffect(e6)
end end
function c10080420.Isshinka(c) function c10080420.Isshinka(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and (c:IsSetCard(0x10e) or c:IsCode(5338223,8632967,14154221,24362891,25573054,34026662,62991886,64815084,74100225,77840540,88760522,93504463,10080420)) return c:IsType(TYPE_SPELL+TYPE_TRAP) and (c:IsSetCard(0x10e) or c:IsCode(5338223,7373632,8632967,14154221,22431243,24362891,25573054,34026662,34572613,38179121,62991886,64815084,74100225,77840540,84808313,88760522,93504463,10080420))
end end
function c10080420.spcon(e,tp,eg,ep,ev,re,r,rp) function c10080420.spcon(e,tp,eg,ep,ev,re,r,rp)
return rp==tp and c10080420.Isshinka(re:GetHandler()) return rp==tp and c10080420.Isshinka(re:GetHandler())
...@@ -85,4 +85,4 @@ function c10080420.leaveop(e,tp,eg,ep,ev,re,r,rp) ...@@ -85,4 +85,4 @@ function c10080420.leaveop(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,Duel.GetFieldGroup(tp,LOCATION_HAND,0)) Duel.ConfirmCards(1-tp,Duel.GetFieldGroup(tp,LOCATION_HAND,0))
local g=Duel.GetMatchingGroup(c10080420.leavefilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,nil) local g=Duel.GetMatchingGroup(c10080420.leavefilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,nil)
Duel.SendtoGrave(g,REASON_EFFECT) Duel.SendtoGrave(g,REASON_EFFECT)
end end
\ No newline at end of file
...@@ -48,7 +48,7 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) ...@@ -48,7 +48,7 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tg,REASON_EFFECT) Duel.Destroy(tg,REASON_EFFECT)
end end
function s.dfilter(c,tp) function s.dfilter(c,tp)
return c:IsPreviousControler(1-tp) and c:IsComplexReason(REASON_EFFECT+REASON_DESTROY) return c:IsPreviousControler(1-tp) and c:IsReason(REASON_EFFECT)
end end
function s.damcon(e,tp,eg) function s.damcon(e,tp,eg)
return eg:IsExists(s.dfilter,1,nil,tp) return eg:IsExists(s.dfilter,1,nil,tp)
......
...@@ -7,11 +7,16 @@ function cm.initial_effect(c) ...@@ -7,11 +7,16 @@ function cm.initial_effect(c)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH) e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(cm.condition)
e1:SetOperation(cm.activate) e1:SetOperation(cm.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function cm.actfilter(c) function cm.actfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSetCard(0x9d) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSetCard(0x9d) and not c:IsCode(m)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
return g:IsExists(cm.actfilter,1,nil)
end end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
...@@ -50,7 +55,7 @@ function cm.actcon(con) ...@@ -50,7 +55,7 @@ function cm.actcon(con)
end end
end end
function cm.cfilter(c) function cm.cfilter(c)
return c:IsSetCard(0x9d) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeckAsCost() return c:IsSetCard(0x9d) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end end
function cm.costchk(e,te_or_c,tp) function cm.costchk(e,te_or_c,tp)
return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_GRAVE,0,1,nil) return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_GRAVE,0,1,nil)
...@@ -81,4 +86,4 @@ function cm.costop(e,tp,eg,ep,ev,re,r,rp) ...@@ -81,4 +86,4 @@ function cm.costop(e,tp,eg,ep,ev,re,r,rp)
end end
function cm.aclimit(e,re,tp) function cm.aclimit(e,re,tp)
return re:GetHandler():IsLocation(LOCATION_DECK) and re:GetHandler():IsCode(e:GetHandler():GetCode()) return re:GetHandler():IsLocation(LOCATION_DECK) and re:GetHandler():IsCode(e:GetHandler():GetCode())
end end
\ No newline at end of file
...@@ -41,10 +41,6 @@ function c29002022.xyzop(e,tp,chk) ...@@ -41,10 +41,6 @@ function c29002022.xyzop(e,tp,chk)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
end end
function c29002022.xyzop(e,tp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,29002022)==0 end
Duel.RegisterFlagEffect(tp,29002022,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c29002022.spcost(e,tp,eg,ep,ev,re,r,rp,chk) function c29002022.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
......
...@@ -34,9 +34,8 @@ end ...@@ -34,9 +34,8 @@ end
function cm.filter(c) function cm.filter(c)
return c:IsAttribute(ATTRIBUTE_DARK) return c:IsAttribute(ATTRIBUTE_DARK)
end end
function cm.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal,chk) function cm.rtf(c,filter,e,tp,m1,m2,level_function,greater_or_equal)
if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp,chk)) if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c) local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
if m2 then if m2 then
mg:Merge(m2) mg:Merge(m2)
...@@ -52,31 +51,35 @@ function cm.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_e ...@@ -52,31 +51,35 @@ function cm.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_e
aux.GCheckAdditional=nil aux.GCheckAdditional=nil
return res return res
end end
function cm.spfilter3(c,e,tp,mg) function cm.f3(c,filter,e,tp,m1,m2,level_function,greater_or_equal,rg)
return cm.DragWizard(c) and bit.band(c:GetType(),0x81)==0x81 and c:IsAbleToGrave() local mchk=cm.DragWizard(c) and bit.band(c:GetType(),0x81)==0x81 and c:IsAbleToGrave()
and Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_GRAVE,0,1,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater") if mchk and cm.rtf(c,filter,e,tp,m1,m2,level_function,greater_or_equal) then
end rg:AddCard(c)
function cm.spfilter4(c) end
return cm.DragWizard(c) and bit.band(c:GetType(),0x81)==0x81 and c:IsAbleToGrave() return mchk and #rg>0
-- and Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_GRAVE,0,1,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater")
end end
function cm.rtg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.rtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local mg=Duel.GetRitualMaterial(tp) local mg=Duel.GetRitualMaterial(tp)
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 local rg=Duel.GetMatchingGroup(cm.rtf,tp,LOCATION_GRAVE,0,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater")
and Duel.IsExistingMatchingCard(cm.spfilter4,tp,LOCATION_DECK,0,1,nil) return Duel.IsExistingMatchingCard(cm.f3,tp,LOCATION_DECK,0,1,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater",rg)
end end
--Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end end
function cm.rtop(e,tp,eg,ep,ev,re,r,rp) function cm.rtop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local mg=Duel.GetRitualMaterial(tp)
local mg=Duel.GetRitualMaterial(tp) local rg=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.rtf),tp,LOCATION_GRAVE,0,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater")
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local ag=Duel.SelectMatchingCard(tp,cm.spfilter4,tp,LOCATION_DECK,0,1,1,nil) local ag=Duel.SelectMatchingCard(tp,cm.f3,tp,LOCATION_DECK,0,1,1,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater",rg)
if ag:GetCount()>0 and Duel.SendtoGrave(ag,REASON_EFFECT)~=0 then if #ag>0 and Duel.SendtoGrave(ag,REASON_EFFECT)~=0 then
local agc=ag:GetFirst()
if agc:IsLocation(LOCATION_GRAVE) and agc:IsAttribute(ATTRIBUTE_DARK) and agc:IsType(TYPE_RITUAL) then
rg=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.rtf),tp,LOCATION_GRAVE,0,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater")
end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(aux.RitualUltimateFilter),tp,LOCATION_GRAVE,0,1,1,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater") local tg=rg:FilterSelect(tp,aux.NecroValleyFilter(cm.rtf),1,1,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater")
local tc=tg:GetFirst() local tc=tg:GetFirst()
if tc then if tc then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc) mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
......
...@@ -108,24 +108,27 @@ function cm.initial_effect(c) ...@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc) sg:AddCard(tc)
cg:RemoveCard(tc) cg:RemoveCard(tc)
end end
--Duel.HintSelection(g)
Duel.HintSelection(sg) Duel.HintSelection(sg)
return sg return sg
end end
_SendtoDeck=Duel.SendtoDeck _SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason) function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(7439100)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
end return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoDeck(tg,tp,seq,reason) if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
end end
end end
...@@ -133,19 +136,21 @@ function cm.initial_effect(c) ...@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end end
_SendtoHand=Duel.SendtoHand _SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason) function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(7439100)==7439100+id and cm.rfilter(tg,7439100+id) then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoHand(tg,1-tg:GetControler(),reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
end return _SendtoHand(tg,1-tg:GetControler(),reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoHand(tg,tp,reason) if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
end end
end end
...@@ -259,34 +264,164 @@ function cm.initial_effect(c) ...@@ -259,34 +264,164 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone() local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" then if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id) ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then if ag:GetCount()~=0 then
cg2:Merge(ag) cg2:Merge(ag)
end end
end end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst() local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc) --sg:AddCard(tc)
return tc return tc
end end
end end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max) return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
--_CheckGroupRecursiveCapture=aux.CheckGroupRecursiveCapture
--function aux.CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params)
-- if Duel.GetCurrentChain()~=0 and Duel.GetFlagEffect(0,7439099)~=0 then
-- local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
-- local ag=Party_time_table[7439100+id]
-- if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
-- sg:AddCard(c)
-- local sg2=sg:Clone()
-- local pg=sg:Filter(cm.rfilter,nil,7439100+id)
-- sg2:Sub(pg)
-- if aux.GCheckAdditional and (c:GetFlagEffectLabel(7439100)~=id and not aux.GCheckAdditional(sg2,c,g,f,min,max,ext_params) ) then
-- sg:RemoveCard(c)
-- return false
-- end
-- local res=#sg>=min and #sg<=max and f(sg2,table.unpack(ext_params))
-- if res then
-- aux.SubGroupCaptured:Clear()
-- aux.SubGroupCaptured:Merge(sg)
-- else
-- res=#sg<max and g:IsExists(aux. CheckGroupRecursiveCapture,1,sg2,sg,g,f,min,max,ext_params)
-- end
-- sg:RemoveCard(c)
-- return res
-- end
-- end
-- return _CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params)
--end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand _DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...) function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
local ag=Party_time_table[7439100+id] local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local ag=Party_time_table[7439100+id]
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...) if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not g or g:GetCount()<=0 then return false end local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if aux.GetValueType(ag)=="Group" then if not g or g:GetCount()<=0 then return false end
ag=ag:Filter(cm.rfilter,nil,7439100+id) if aux.GetValueType(ag)=="Group" then
if ag:GetCount()~=0 then ag=ag:Filter(cm.rfilter,nil,7439100+id)
g:Merge(ag) if ag:GetCount()~=0 then
g:Merge(ag)
end
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
return _DiscardHand(tp,f,min,max,reason,cg,...) return _DiscardHand(tp,f,min,max,reason,cg,...)
end end
......
...@@ -109,24 +109,27 @@ function cm.initial_effect(c) ...@@ -109,24 +109,27 @@ function cm.initial_effect(c)
g:RemoveCard(tc) g:RemoveCard(tc)
cg:DeleteGroup() cg:DeleteGroup()
end end
--Duel.HintSelection(g)
Duel.HintSelection(sg) Duel.HintSelection(sg)
return sg return sg
end end
_SendtoDeck=Duel.SendtoDeck _SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason) function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
end return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoDeck(tg,tp,seq,reason) if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
end end
end end
...@@ -134,19 +137,21 @@ function cm.initial_effect(c) ...@@ -134,19 +137,21 @@ function cm.initial_effect(c)
end end
_SendtoHand=Duel.SendtoHand _SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason) function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoHand(tg,1-tg:GetControler(),reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
end return _SendtoHand(tg,1-tg:GetControler(),reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoHand(tg,tp,reason) if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
end end
end end
...@@ -260,34 +265,137 @@ function cm.initial_effect(c) ...@@ -260,34 +265,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone() local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" then if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id) ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then if ag:GetCount()~=0 then
cg2:Merge(ag) cg2:Merge(ag)
end end
end end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst() local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc) --sg:AddCard(tc)
return tc return tc
end end
end end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max) return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand _DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...) function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
local ag=Party_time_table[7439100+id] local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local ag=Party_time_table[7439100+id]
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...) if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not g or g:GetCount()<=0 then return false end local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if aux.GetValueType(ag)=="Group" then if not g or g:GetCount()<=0 then return false end
ag=ag:Filter(cm.rfilter,nil,7439100+id) if aux.GetValueType(ag)=="Group" then
if ag:GetCount()~=0 then ag=ag:Filter(cm.rfilter,nil,7439100+id)
g:Merge(ag) if ag:GetCount()~=0 then
g:Merge(ag)
end
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
return _DiscardHand(tp,f,min,max,reason,cg,...) return _DiscardHand(tp,f,min,max,reason,cg,...)
end end
......
...@@ -108,24 +108,27 @@ function cm.initial_effect(c) ...@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc) sg:AddCard(tc)
cg:RemoveCard(tc) cg:RemoveCard(tc)
end end
--Duel.HintSelection(g)
Duel.HintSelection(sg) Duel.HintSelection(sg)
return sg return sg
end end
_SendtoDeck=Duel.SendtoDeck _SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason) function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
end return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoDeck(tg,tp,seq,reason) if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
end end
end end
...@@ -133,19 +136,21 @@ function cm.initial_effect(c) ...@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end end
_SendtoHand=Duel.SendtoHand _SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason) function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoHand(tg,1-tg:GetControler(),reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
end return _SendtoHand(tg,1-tg:GetControler(),reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoHand(tg,tp,reason) if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
end end
end end
...@@ -259,34 +264,137 @@ function cm.initial_effect(c) ...@@ -259,34 +264,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone() local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" then if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id) ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then if ag:GetCount()~=0 then
cg2:Merge(ag) cg2:Merge(ag)
end end
end end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst() local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc) --sg:AddCard(tc)
return tc return tc
end end
end end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max) return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand _DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...) function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
local ag=Party_time_table[7439100+id] local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local ag=Party_time_table[7439100+id]
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...) if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not g or g:GetCount()<=0 then return false end local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if aux.GetValueType(ag)=="Group" then if not g or g:GetCount()<=0 then return false end
ag=ag:Filter(cm.rfilter,nil,7439100+id) if aux.GetValueType(ag)=="Group" then
if ag:GetCount()~=0 then ag=ag:Filter(cm.rfilter,nil,7439100+id)
g:Merge(ag) if ag:GetCount()~=0 then
g:Merge(ag)
end
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
return _DiscardHand(tp,f,min,max,reason,cg,...) return _DiscardHand(tp,f,min,max,reason,cg,...)
end end
......
...@@ -108,24 +108,27 @@ function cm.initial_effect(c) ...@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc) sg:AddCard(tc)
cg:RemoveCard(tc) cg:RemoveCard(tc)
end end
--Duel.HintSelection(g)
Duel.HintSelection(sg) Duel.HintSelection(sg)
return sg return sg
end end
_SendtoDeck=Duel.SendtoDeck _SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason) function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
end return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoDeck(tg,tp,seq,reason) if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
end end
end end
...@@ -133,19 +136,21 @@ function cm.initial_effect(c) ...@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end end
_SendtoHand=Duel.SendtoHand _SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason) function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoHand(tg,1-tg:GetControler(),reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
end return _SendtoHand(tg,1-tg:GetControler(),reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoHand(tg,tp,reason) if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
end end
end end
...@@ -259,34 +264,137 @@ function cm.initial_effect(c) ...@@ -259,34 +264,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone() local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" then if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id) ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then if ag:GetCount()~=0 then
cg2:Merge(ag) cg2:Merge(ag)
end end
end end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst() local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc) --sg:AddCard(tc)
return tc return tc
end end
end end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max) return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand _DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...) function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
local ag=Party_time_table[7439100+id] local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local ag=Party_time_table[7439100+id]
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...) if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not g or g:GetCount()<=0 then return false end local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if aux.GetValueType(ag)=="Group" then if not g or g:GetCount()<=0 then return false end
ag=ag:Filter(cm.rfilter,nil,7439100+id) if aux.GetValueType(ag)=="Group" then
if ag:GetCount()~=0 then ag=ag:Filter(cm.rfilter,nil,7439100+id)
g:Merge(ag) if ag:GetCount()~=0 then
g:Merge(ag)
end
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
return _DiscardHand(tp,f,min,max,reason,cg,...) return _DiscardHand(tp,f,min,max,reason,cg,...)
end end
......
...@@ -108,24 +108,27 @@ function cm.initial_effect(c) ...@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc) sg:AddCard(tc)
cg:RemoveCard(tc) cg:RemoveCard(tc)
end end
--Duel.HintSelection(g)
Duel.HintSelection(sg) Duel.HintSelection(sg)
return sg return sg
end end
_SendtoDeck=Duel.SendtoDeck _SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason) function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
end return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoDeck(tg,tp,seq,reason) if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end end
end end
end end
...@@ -133,19 +136,21 @@ function cm.initial_effect(c) ...@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end end
_SendtoHand=Duel.SendtoHand _SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason) function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
return _SendtoHand(tg,1-tg:GetControler(),reason) if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
end return _SendtoHand(tg,1-tg:GetControler(),reason)
if not tp and aux.GetValueType(tg)=="Group" then end
local sg=tg:Filter(cm.rfilter,nil,7439100+id) if not tp and aux.GetValueType(tg)=="Group" then
if sg and sg:GetCount()>0 then local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
tg:Sub(sg) if sg and sg:GetCount()>0 then
if tg and tg:GetCount()>0 then tg:Sub(sg)
_SendtoHand(tg,tp,reason) if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end end
end end
end end
...@@ -259,34 +264,137 @@ function cm.initial_effect(c) ...@@ -259,34 +264,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone() local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" then if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id) ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then if ag:GetCount()~=0 then
cg2:Merge(ag) cg2:Merge(ag)
end end
end end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst() local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc) --sg:AddCard(tc)
return tc return tc
end end
end end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max) return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand _DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...) function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if Duel.GetCurrentChain()~=0 then
local ag=Party_time_table[7439100+id] local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then local ag=Party_time_table[7439100+id]
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...) if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not g or g:GetCount()<=0 then return false end local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if aux.GetValueType(ag)=="Group" then if not g or g:GetCount()<=0 then return false end
ag=ag:Filter(cm.rfilter,nil,7439100+id) if aux.GetValueType(ag)=="Group" then
if ag:GetCount()~=0 then ag=ag:Filter(cm.rfilter,nil,7439100+id)
g:Merge(ag) if ag:GetCount()~=0 then
g:Merge(ag)
end
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end end
return _DiscardHand(tp,f,min,max,reason,cg,...) return _DiscardHand(tp,f,min,max,reason,cg,...)
end end
......
...@@ -46,9 +46,9 @@ function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -46,9 +46,9 @@ function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,e:GetHandler():GetOwner(),LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,e:GetHandler():GetOwner(),LOCATION_DECK)
end end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp) function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local c=e:GetHandler() local c=e:GetHandler()
if Duel.GetLocationCount(c:GetOwner(),LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(c:GetOwner(),cm.spfilter,c:GetOwner(),LOCATION_DECK,0,1,1,nil,e,c:GetOwner()) local g=Duel.SelectMatchingCard(c:GetOwner(),cm.spfilter,c:GetOwner(),LOCATION_DECK,0,1,1,nil,e,c:GetOwner())
if g:GetCount()>0 then if g:GetCount()>0 then
local tg=g:GetFirst() local tg=g:GetFirst()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment