Commit ebf4af30 authored by Nemo Ma's avatar Nemo Ma

fix

parent 48d79995
......@@ -29,7 +29,7 @@ function c10080420.initial_effect(c)
c:RegisterEffect(e6)
end
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
function c10080420.spcon(e,tp,eg,ep,ev,re,r,rp)
return rp==tp and c10080420.Isshinka(re:GetHandler())
......@@ -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))
local g=Duel.GetMatchingGroup(c10080420.leavefilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
end
\ No newline at end of file
end
......@@ -48,7 +48,7 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tg,REASON_EFFECT)
end
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
function s.damcon(e,tp,eg)
return eg:IsExists(s.dfilter,1,nil,tp)
......
......@@ -7,11 +7,16 @@ function cm.initial_effect(c)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(cm.condition)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
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
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -50,7 +55,7 @@ function cm.actcon(con)
end
end
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
function cm.costchk(e,te_or_c,tp)
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)
end
function cm.aclimit(e,re,tp)
return re:GetHandler():IsLocation(LOCATION_DECK) and re:GetHandler():IsCode(e:GetHandler():GetCode())
end
\ No newline at end of file
end
......@@ -41,10 +41,6 @@ function c29002022.xyzop(e,tp,chk)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
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)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
......
......@@ -34,9 +34,8 @@ end
function cm.filter(c)
return c:IsAttribute(ATTRIBUTE_DARK)
end
function cm.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal,chk)
if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp,chk))
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
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)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
if m2 then
mg:Merge(m2)
......@@ -52,31 +51,35 @@ function cm.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_e
aux.GCheckAdditional=nil
return res
end
function cm.spfilter3(c,e,tp,mg)
return 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")
end
function cm.spfilter4(c)
return 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")
function cm.f3(c,filter,e,tp,m1,m2,level_function,greater_or_equal,rg)
local mchk=cm.DragWizard(c) and bit.band(c:GetType(),0x81)==0x81 and c:IsAbleToGrave()
if mchk and cm.rtf(c,filter,e,tp,m1,m2,level_function,greater_or_equal) then
rg:AddCard(c)
end
return mchk and #rg>0
end
function cm.rtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg=Duel.GetRitualMaterial(tp)
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter4,tp,LOCATION_DECK,0,1,nil)
local mg=Duel.GetRitualMaterial(tp)
local rg=Duel.GetMatchingGroup(cm.rtf,tp,LOCATION_GRAVE,0,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater")
return Duel.IsExistingMatchingCard(cm.f3,tp,LOCATION_DECK,0,1,nil,cm.filter,e,tp,mg,mg2,Card.GetLevel,"Greater",rg)
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)
end
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)
local ag=Duel.SelectMatchingCard(tp,cm.spfilter4,tp,LOCATION_DECK,0,1,1,nil)
if ag:GetCount()>0 and Duel.SendtoGrave(ag,REASON_EFFECT)~=0 then
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>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)
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()
if tc then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
......
......@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(7439100)==7439100+id then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
......@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(7439100)==7439100+id and cm.rfilter(tg,7439100+id) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
......@@ -259,34 +264,164 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
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)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
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)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
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
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
......
......@@ -109,24 +109,27 @@ function cm.initial_effect(c)
g:RemoveCard(tc)
cg:DeleteGroup()
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
......@@ -134,19 +137,21 @@ function cm.initial_effect(c)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
......@@ -260,34 +265,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
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)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
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)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
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
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
......
......@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
......@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
......@@ -259,34 +264,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
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)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
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)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
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
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
......
......@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
......@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
......@@ -259,34 +264,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
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)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
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)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
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
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
......
......@@ -108,24 +108,27 @@ function cm.initial_effect(c)
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
......@@ -133,19 +136,21 @@ function cm.initial_effect(c)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
......@@ -259,34 +264,137 @@ function cm.initial_effect(c)
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
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)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
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)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
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
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
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
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
......
......@@ -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)
end
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()
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())
if g:GetCount()>0 then
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