Commit cde70fa1 authored by nanahira's avatar nanahira

Auto Push by Nanahira

parent 354e711a
......@@ -65,7 +65,7 @@ function cm.replace_register_effect(f,p)
local cost=e:GetCost()
e:SetCost(function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local let={Duel.FilterPlayerEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local let={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
for _,le in pairs(let) do
local cres=Senya.GetEffectValue(le,c:GetActivateEffect(),le:GetHandlerPlayer())
if cres and cres~=0 then return false end
......
......@@ -37,8 +37,8 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 then return end
local ct=1
if Card.FilterEffect then
local exte={c:FilterEffect(37564427)}
if Card.IsHasEffect then
local exte={c:IsHasEffect(37564427)}
for _,te in ipairs(exte) do
if Duel.SelectEffectYesNo(tp,te:GetHandler()) then
Duel.Hint(HINT_CARD,0,te:GetHandler():GetOriginalCode())
......
......@@ -68,9 +68,16 @@ function cm.xyzcon(e,c,og,min,max)
else
mg=Duel.GetMatchingGroup(cm.xyzfilter,tp,LOCATION_MZONE,0,nil,c)
local exg=Duel.GetMatchingGroup(cm.xyzfilter1,tp,LOCATION_PZONE,0,nil,c)
if exg:GetCount()==2 and Duel.GetLocationCountFromEx(tp,tp,exg,c)>0 and Duel.GetFlagEffect(tp,m)==0 then return true end
if exg:GetCount()==2 and Duel.GetLocationCountFromEx(tp,tp,exg,c)>0 and Duel.GetFlagEffect(tp,m)==0 and not Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_XMATERIAL) then return true end
end
return Senya.CheckGroup(mg,Senya.CheckFieldFilter,nil,minc,maxc,tp,c)
local sg=Group.CreateGroup()
local ce={Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_XMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
if not mg:IsContains(tc) then return false end
sg:AddCard(tc)
end
return Senya.CheckGroup(mg,Senya.CheckFieldFilter,sg,minc,maxc,tp,c)
end
function cm.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local g=nil
......@@ -89,7 +96,7 @@ function cm.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
else
mg=Duel.GetMatchingGroup(cm.xyzfilter,tp,LOCATION_MZONE,0,nil,c)
local exg=Duel.GetMatchingGroup(cm.xyzfilter1,tp,LOCATION_PZONE,0,nil,c)
if exg:GetCount()==2 and Duel.GetLocationCountFromEx(tp,tp,exg,c)>0 and Duel.GetFlagEffect(tp,m)==0 and (not Senya.CheckGroup(mg,Senya.CheckFieldFilter,nil,minc,maxc,tp,c) or Duel.SelectYesNo(tp,m*16)) then
if exg:GetCount()==2 and Duel.GetLocationCountFromEx(tp,tp,exg,c)>0 and Duel.GetFlagEffect(tp,m)==0 and not Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_XMATERIAL) and (not Senya.CheckGroup(mg,Senya.CheckFieldFilter,nil,minc,maxc,tp,c) or Duel.SelectYesNo(tp,m*16)) then
Duel.HintSelection(exg)
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
c:SetMaterial(exg)
......@@ -97,7 +104,13 @@ function cm.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
return
end
end
g=Senya.SelectGroup(tp,HINTMSG_XMATERIAL,mg,Senya.CheckFieldFilter,nil,minc,maxc,tp,c)
local sg=Group.CreateGroup()
local ce={Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_XMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
sg:AddCard(tc)
end
g=Senya.SelectGroup(tp,HINTMSG_XMATERIAL,mg,Senya.CheckFieldFilter,sg,minc,maxc,tp,c)
end
c:SetMaterial(g)
Senya.OverlayGroup(c,g,false,true)
......
......@@ -56,4 +56,4 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,g)
end
end
end
end
\ No newline at end of file
......@@ -128,7 +128,7 @@ end
function cm.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
sg:AddCard(c)
local ct=sg:GetCount()
local res=(ct>=min and f(sg,table.unpack(ext_params)))
local res=(ct>=min and ct<= max and f(sg,table.unpack(ext_params)))
or (ct<max and g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params))
sg:RemoveCard(c)
return res
......@@ -141,7 +141,7 @@ function cm.CheckGroup(g,f,cg,min,max,...)
local sg=Group.CreateGroup()
if cg then sg:Merge(cg) end
local ct=sg:GetCount()
if ct>=min and ct<max and f(sg,...) then return true end
if ct>=min and ct<=max and f(sg,...) then return true end
return g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params)
end
if Group.SelectUnselect then
......@@ -155,7 +155,7 @@ if Group.SelectUnselect then
local ct=sg:GetCount()
local ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
while ct<max and ag:GetCount()>0 do
local finish=(ct>=min and f(sg,...))
local finish=(ct>=min and and ct<=max and f(sg,...))
local seg=sg:Clone()
local dmin=min-cg:GetCount()
local dmax=math.min(max-cg:GetCount(),g:GetCount())
......@@ -183,7 +183,7 @@ if Group.SelectUnselect then
local ct=sg:GetCount()
local ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
while ct<max and ag:GetCount()>0 do
local finish=(ct>=min and f(sg,...))
local finish=(ct>=min and ct<=max and f(sg,...))
local cancel=finish or ct==0
local seg=sg:Clone()
local dmin=min-cg:GetCount()
......@@ -218,7 +218,7 @@ else
local ag=g:Filter(cm.CheckGroupRecursive,sg,sg,g,f,min,max,ext_params)
while ct<max and ag:GetCount()>0 do
local minc=1
local finish=(ct>=min and f(sg,...))
local finish=(ct>=min and ct<=max and f(sg,...))
if finish then
minc=0
if cm.master_rule_3_flag and not Duel.SelectYesNo(tp,210) then break end
......@@ -301,19 +301,13 @@ function cm.XyzProcedureCustomTuneMagicianFilter(c,te)
return f(te,c)
end
function cm.XyzProcedureCustomTuneMagicianCheck(c,g)
local eset={c:FilterEffect(EFFECT_TUNE_MAGICIAN_X)}
local eset={c:IsHasEffect(EFFECT_TUNE_MAGICIAN_X)}
for _,te in ipairs(eset) do
if g:IsExists(cm.XyzProcedureCustomTuneMagicianFilter,1,c,te) then return true end
end
return false
end
function cm.XyzProcedureCustomCheck(g,xyzc,tp,gf)
if EFFECT_MUST_BE_XMATERIAL then
local eset={Duel.FilterPlayerEffect(tp,EFFECT_MUST_BE_XMATERIAL)}
for _,te in ipairs(eset) do
if not g:IsContains(te:GetHandler()) then return false end
end
end
if g:IsExists(cm.XyzProcedureCustomTuneMagicianCheck,1,nil,g) then return false end
return not gf or gf(g,xyzc,tp)
end
......@@ -354,7 +348,14 @@ function cm.XyzProcedureCustomCondition(func,gf,minct,maxct,ext_params)
else
mg=Duel.GetMatchingGroup(cm.XyzProcedureCustomFilter,tp,LOCATION_MZONE,0,nil,c,func,ext_params)
end
return maxc>=minc and cm.CheckGroup(mg,cm.CheckFieldFilter,nil,minc,maxc,tp,c,cm.XyzProcedureCustomCheck,c,tp,gf)
local sg=Group.CreateGroup()
local ce={Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_XMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
if not mg:IsContains(tc) then return false end
sg:AddCard(tc)
end
return maxc>=minc and cm.CheckGroup(mg,cm.CheckFieldFilter,sg,minc,maxc,tp,c,cm.XyzProcedureCustomCheck,c,tp,gf)
end
end
function cm.XyzProcedureCustomTarget(func,gf,minct,maxct,ext_params)
......@@ -375,7 +376,12 @@ function cm.XyzProcedureCustomTarget(func,gf,minct,maxct,ext_params)
minc=math.max(minc,min)
maxc=math.min(maxc,max)
end
g=cm.SelectGroupWithCancel(tp,HINTMSG_XMATERIAL,mg,cm.CheckFieldFilter,nil,minc,maxc,tp,c,cm.XyzProcedureCustomCheck,c,tp,gf)
local ce={Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_XMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
sg:AddCard(tc)
end
g=cm.SelectGroupWithCancel(tp,HINTMSG_XMATERIAL,mg,cm.CheckFieldFilter,sg,minc,maxc,tp,c,cm.XyzProcedureCustomCheck,c,tp,gf)
end
if g then
g:KeepAlive()
......@@ -816,8 +822,8 @@ function cm.PrismDamageCheckOperation(e,tp,eg,ep,ev,re,r,rp)
local bc=c:GetBattleTarget()
if ct==0 then return end
if c:IsRelateToEffect(e) and c:IsFaceup() then
if Card.FilterEffect then
local exte={c:FilterEffect(37564427)}
if Card.IsHasEffect then
local exte={c:IsHasEffect(37564427)}
for _,te in ipairs(exte) do
if Duel.SelectEffectYesNo(tp,te:GetHandler()) then
Duel.Hint(HINT_CARD,0,te:GetHandler():GetOriginalCode())
......@@ -1094,9 +1100,9 @@ function cm.PendConditionNanahira()
else
g=Duel.GetMatchingGroup(aux.PConditionFilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,nil,e,tp,lscale,rscale)
end
if Card.FilterEffect then
local ext1={c:FilterEffect(37564541)}
local ext2={rpz:FilterEffect(37564541)}
if Card.IsHasEffect then
local ext1={c:IsHasEffect(37564541)}
local ext2={rpz:IsHasEffect(37564541)}
for i,te in pairs(ext1) do
local t=cm.order_table[te:GetValue()]
if (t.location==LOCATION_EXTRA and eft>0) or (t.location~=LOCATION_EXTRA and mft>0) then
......@@ -1154,9 +1160,9 @@ function cm.PendOperationNanahira()
else
tg=Duel.GetMatchingGroup(aux.PConditionFilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,nil,e,tp,lscale,rscale)
end
if Card.FilterEffect then
local ext1={c:FilterEffect(37564541)}
local ext2={rpz:FilterEffect(37564541)}
if Card.IsHasEffect then
local ext1={c:IsHasEffect(37564541)}
local ext2={rpz:IsHasEffect(37564541)}
for i,te in pairs(ext1) do
local t=cm.order_table[te:GetValue()]
if (t.location==LOCATION_EXTRA and eft>0) or (t.location~=LOCATION_EXTRA and mft>0) then
......@@ -1749,13 +1755,19 @@ return function(e,g,gc,chkfnf)
local chkf=bit.band(chkfnf,0xff)
local mg=g:Filter(cm.FusionFilter_3L,nil,e:GetHandler(),mf,sub)
local tp=e:GetHandlerPlayer()
local exg=Duel.GetMatchingGroup(cm.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon)
mg:Merge(exg)
local sg=Group.CreateGroup()
if gc then
if not cm.FusionFilter_3L(gc,fc,mf,sub) then return false end
sg:AddCard(gc)
end
local exg=Duel.GetMatchingGroup(cm.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon)
mg:Merge(exg)
local ce={Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_FMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
if not mg:IsContains(tc) then return false end
sg:AddCard(tc)
end
return cm.CheckGroup(mg,cm.FusionCheck_3L,sg,1,max,min,tp,c,f,chkfnf,sub)
end
end
......@@ -1764,10 +1776,17 @@ return function(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
local c=e:GetHandler()
local chkf=bit.band(chkfnf,0xff)
local mg=eg:Filter(cm.FusionFilter_3L,nil,e:GetHandler(),mf,sub)
local sg=Group.CreateGroup()
if gc then sg:AddCard(gc) end
local exg=Duel.GetMatchingGroup(cm.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon)
mg:Merge(exg)
local sg=Group.CreateGroup()
if gc then
sg:AddCard(gc)
end
local ce={Duel.IsPlayerAffectedByEffect(EFFECT_MUST_BE_FMATERIAL)}
for _,te in ipairs(ce) do
local tc=te:GetHandler()
sg:AddCard(tc)
end
local g=cm.SelectGroup(tp,HINTMSG_FMATERIAL,mg,cm.FusionCheck_3L,sg,1,max,min,tp,c,f,chkf,sub)
Duel.SetFusionMaterial(g)
end
......@@ -1884,8 +1903,8 @@ function cm.enable_kaguya_check_3L()
Duel.RegisterEffect(ge3,0)
end
function cm.CheckKoishiCount(c)
if Card.FilterEffect then
local t={c:FilterEffect(37564826)}
if Card.IsHasEffect then
local t={c:IsHasEffect(37564826)}
local res=1
for i,te in pairs(t) do
res=math.max(res,te:GetValue())
......@@ -1999,8 +2018,8 @@ function cm.RemoveEffect_3L(tp,tc,ct,maxct,chk,...)
local effect_list=cm.GetGainedList_3L(tc)
local avaliable_list={}
local omit_list={...}
if Card.FilterEffect then
local oet={tc:FilterEffect(37564827)}
if Card.IsHasEffect then
local oet={tc:IsHasEffect(37564827)}
for i,oe in pairs(oet) do
local of=cm.order_table[oe:GetValue()]
local og=of(tc)
......@@ -2465,7 +2484,7 @@ function cm.GetEffectValue(e,...)
end
--custom ocgcore needed
function cm.CheckEffect(c,code,...)
local eset={c:FilterEffect(code)}
local eset={c:IsHasEffect(code)}
for _,te in ipairs(eset) do
local res=cm.GetEffectValue(te,...)
if res and res~=0 then return res end
......@@ -2473,7 +2492,7 @@ function cm.CheckEffect(c,code,...)
return false
end
function cm.CheckPlayerEffect(p,code,...)
local eset={Duel.FilterPlayerEffect(p,code)}
local eset={Duel.IsPlayerAffectedByEffect(p,code)}
for _,te in ipairs(eset) do
local res=cm.GetEffectValue(te,...)
if res and res~=0 then return res end
......
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