Commit e797c960 authored by nanahira's avatar nanahira

metacount

parent b450aeb0
......@@ -44,7 +44,7 @@ end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -30,7 +30,7 @@ end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(cm.filter,1,e:GetHandler(),tp) end
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,eg:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,#eg,0,0)
end
function cm.filter2(c,e,tp)
return c:IsRelateToEffect(e) and c:IsPreviousLocation(LOCATION_EXTRA) and (not c:IsType(TYPE_PENDULUM))
......
......@@ -55,7 +55,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
if #mg~=0 then
Duel.Overlay(sc,mg)
end
Duel.Overlay(sc,Group.FromCards(tc))
......
......@@ -25,7 +25,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(cm.filter,tp,LOCATION_GRAVE,0,3,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_GRAVE,0,3,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.tgfilter(c,e)
......
......@@ -51,7 +51,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
if #mg~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(c))
......
......@@ -86,7 +86,7 @@ function cm.operation2(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetMZoneCount(tp)
local g1=e:GetHandler():GetOverlayGroup()
local sg=g1:Filter(cm.filter7,nil,e,tp)
if ft==0 or sg:GetCount()==0 then return end
if ft==0 or #sg==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local mg=sg:Select(tp,ft,ft,nil)
local fid=e:GetHandler():GetFieldID()
......
......@@ -102,7 +102,7 @@ function cm.mtop(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,cm.mtfilter,tp,LOCATION_EXTRA,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Overlay(c,g)
end
end
......@@ -176,7 +176,7 @@ function cm.sppop(e,tp,eg,ep,ev,re,r,rp)
local sc=g:GetFirst()
if sc then
local mg=c:GetOverlayGroup()
if mg:GetCount()~=0 then
if #mg~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(c))
......
......@@ -24,7 +24,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -50,7 +50,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCountFromEx(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
local tc=g:GetFirst()
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and e:GetHandler():IsRelateToEffect(e) then
......
......@@ -43,7 +43,7 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -66,7 +66,7 @@ function cm.operation1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectMatchingCard(tp,cm.filter1,tp,LOCATION_DECK,0,1,1,nil)
local mg=g:GetFirst()
if g:GetCount()>0 then
if #g>0 then
Duel.Overlay(tc,mg)
end
end
......
......@@ -37,7 +37,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,cm.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc:GetCode(),tc:GetRank())
local mg=sg:GetFirst()
if sg:GetCount()>0 and Duel.SpecialSummon(mg,0,tp,tp,false,false,POS_FACEUP)~=0 then
if #sg>0 and Duel.SpecialSummon(mg,0,tp,tp,false,false,POS_FACEUP)~=0 then
if e:GetHandler():IsRelateToEffect(e) and e:IsHasType(EFFECT_TYPE_ACTIVATE) then
e:GetHandler():CancelToGrave()
Duel.Overlay(mg,Group.FromCards(e:GetHandler()))
......
......@@ -59,10 +59,10 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetMZoneCount(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 and not g:GetFirst():IsHasEffect(EFFECT_NECRO_VALLEY) then
if #g>0 and not g:GetFirst():IsHasEffect(EFFECT_NECRO_VALLEY) then
if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then
local g2=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_HAND+LOCATION_GRAVE,0,nil)
if g2:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
if #g2>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,2))
local sg2=g2:Select(tp,1,1,nil)
......
......@@ -60,7 +60,7 @@ end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -46,7 +46,7 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetMZoneCount(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
\ No newline at end of file
......@@ -38,7 +38,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
or ac:IsImmuneToEffect(e) or not ac:IsRelateToEffect(e) then return end
if tc:IsType(TYPE_XYZ) then
local og=ac:GetOverlayGroup()
if og:GetCount()>0 then
if #og>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(tc,Group.FromCards(ac))
......
......@@ -52,7 +52,7 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
if #og>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(c,Group.FromCards(tc))
......
......@@ -84,7 +84,7 @@ end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
......
......@@ -66,7 +66,7 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,e:GetHandler()) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.SendtoDeck(g,nil,0,REASON_EFFECT)
end
......@@ -103,7 +103,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(37564030,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,bc)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
......@@ -122,7 +122,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(37564030,4)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
local tc=g:GetFirst()
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
......
......@@ -28,7 +28,7 @@ end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 then
if #g>0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
......
......@@ -66,11 +66,11 @@ end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,g:GetCount(),tp,800)
Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,#g,tp,800)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
if g:GetCount()>0 then
if #g>0 then
g:ForEach(function(c)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -52,7 +52,7 @@ end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,532)
local sg=Duel.SelectMatchingCard(tp,Card.CheckRemoveOverlayCard,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp,1,REASON_EFFECT)
if sg:GetCount()==0 then return end
if #sg==0 then return end
Duel.HintSelection(sg)
sg:GetFirst():RemoveOverlayCard(tp,1,1,REASON_EFFECT)
end
\ No newline at end of file
......@@ -109,7 +109,7 @@ function cm.drop(e,tp,eg,ep,ev,re,r,rp)
tc:CancelToGrave()
end
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
if #og>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(c,Group.FromCards(tc))
......
......@@ -36,7 +36,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
if not (ar and cm.dtchk(tp) and c:IsRelateToEffect(e)) then return end
if (ar & LOCATION_HAND+LOCATION_DECK+LOCATION_EXTRA)~=0 then
local g1=Duel.GetMatchingGroup(cm.filter,tp,0,ar,nil)
if g1:GetCount()>0 then
if #g1>0 then
if ar==LOCATION_HAND then
g=g1:RandomSelect(tp,1)
else
......@@ -52,7 +52,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=g:GetFirst()
if tc and not tc:IsImmuneToEffect(e) then
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
if #og>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
if tc:IsFaceup() and tc:IsType(TYPE_SPELL+TYPE_TRAP) and ar==LOCATION_SZONE then
......
......@@ -38,7 +38,7 @@ function cm.mtop(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,cm.mtfilter,tp,LOCATION_EXTRA,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Overlay(c,g)
end
end
......
......@@ -73,7 +73,7 @@ end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_MZONE,1,nil) end
local sg=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,sg:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
cm.ct=cm.ct*10
......
......@@ -89,7 +89,7 @@ end
function cm.sppop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetMZoneCount(tp)<=0 then return end
local g=Duel.GetMatchingGroup(cm.fffilter,tp,LOCATION_EXTRA,LOCATION_EXTRA,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
for i=0,9 do
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(m,i))
end
......@@ -109,7 +109,7 @@ end
function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=eg:Filter(cm.filter,nil,1-tp)
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,g,#g,0,0)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -171,8 +171,8 @@ end
function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=eg:Filter(cm.filter,nil,1-tp)
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(cm.filter,nil,1-tp)
......@@ -187,7 +187,7 @@ end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
......
......@@ -78,7 +78,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
if #sg1>0 or (sg2~=nil and #sg2>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......
......@@ -41,7 +41,7 @@ function cm.xmop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.BreakEffect()
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
if #og>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(ssc,Group.FromCards(tc))
......
......@@ -36,7 +36,7 @@ function cm.mtop(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,cm.mtfilter,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Overlay(c,g)
end
end
......
......@@ -53,7 +53,7 @@ function cm.xyztg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.xyzop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.xyzfilter,tp,LOCATION_EXTRA,0,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=g:Select(tp,1,1,nil)
Duel.XyzSummon(tp,tg:GetFirst(),nil)
......
......@@ -25,8 +25,7 @@ function cm.filter(c,tg,tp)
return Duel.IsExistingMatchingCard(cm.xfilter,tp,LOCATION_EXTRA,0,1,nil,tg,c)
end
function cm.gcheck(g,xyzc)
local ct=g:GetCount()
return xyzc:IsXyzSummonable(g,ct,ct)
return xyzc:IsXyzSummonable(g,#g,#g)
end
function cm.xfilter(c,tg,tc)
return Senya.CheckGroup(tg,cm.gcheck,Group.FromCards(tc),2,63,c)
......@@ -35,7 +34,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local tg=Duel.GetMatchingGroup(cm.sfilter,p,LOCATION_MZONE,0,nil)
local g=Duel.GetFieldGroup(p,0,LOCATION_HAND)
if g:GetCount()>0 then
if #g>0 then
Duel.ConfirmCards(p,g)
if g:IsExists(cm.filter,1,nil,tg,p) and Duel.SelectYesNo(p,m*16) then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_XMATERIAL)
......
......@@ -122,8 +122,7 @@ function cm.goal(g,tp,lv,syncard,tuc)
for _,te in ipairs(pe) do
if not g:IsContains(te:GetHandler()) then return false end
end
local ct=g:GetCount()
return g:CheckWithSumEqual(cm.val,lv,ct,ct,syncard)
return g:CheckWithSumEqual(cm.val,lv,#g,#g,syncard)
end
function cm.syncon(e,c,tuner,mg)
if c==nil then return true end
......
......@@ -18,7 +18,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp,chk)
local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if hg:GetCount()==0 then return end
if #hg==0 then return end
local tc=hg:RandomSelect(tp,1):GetFirst()
if tc:GetFlagEffect(m)>0 then return end
tc:RegisterFlagEffect(m,0x1fe1000+RESET_PHASE+PHASE_END,0,1)
......
......@@ -55,7 +55,7 @@ end
function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -36,7 +36,7 @@ end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()>0 then
if #tg>0 then
Duel.Destroy(tg,REASON_EFFECT)
end
end
......@@ -39,7 +39,7 @@ end
function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local g=ac:Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
if #g>0 then
if Duel.Remove(g,0,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local og=Duel.GetOperatedGroup()
og:KeepAlive()
......
......@@ -26,7 +26,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not (c:IsFaceup() and c:IsRelateToEffect(e)) then return end
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,0,LOCATION_EXTRA,nil)
if g:GetCount()==0 then return end
if #g==0 then return end
local gc=g:RandomSelect(tp,1):GetFirst()
Duel.Remove(gc,POS_FACEUP,REASON_EFFECT)
local tc=Duel.GetOperatedGroup():GetFirst()
......
......@@ -46,7 +46,7 @@ function cm.xmop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.BreakEffect()
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
if #og>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(ssc,Group.FromCards(tc))
......
......@@ -31,11 +31,11 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetMatchingGroupCount(cm.effilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,nil)
if ct==0 then return end
local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if hg:GetCount()==0 then return end
if #hg==0 then return end
Duel.ConfirmCards(tp,hg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local sg=hg:Select(tp,1,ct,nil)
local g=sg:GetCount()
local g=#sg
local dr=g-1
Duel.SendtoDeck(sg,nil,2,REASON_EFFECT)
Duel.ShuffleHand(1-tp)
......
......@@ -82,13 +82,13 @@ function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,nil)
local g3=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_HAND,nil)
local sg=Group.CreateGroup()
if g1:GetCount()>0 and (g3:GetCount()==0 or Duel.SelectYesNo(tp,aux.Stringid(m,0))) then
if #g1>0 and (#g3==0 or Duel.SelectYesNo(tp,aux.Stringid(m,0))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg1=g1:Select(tp,1,1,nil)
Duel.HintSelection(sg1)
sg:Merge(sg1)
end
if g3:GetCount()>0 and (sg:GetCount()==0 or Duel.SelectYesNo(tp,aux.Stringid(m,1))) then
if #g3>0 and (#sg==0 or Duel.SelectYesNo(tp,aux.Stringid(m,1))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg3=g3:RandomSelect(tp,1)
sg:Merge(sg3)
......
......@@ -25,12 +25,12 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end
local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_EXTRA,nil)
if g:GetCount()==0 then return end
if #g==0 then return end
local gc=g:RandomSelect(tp,1):GetFirst()
Duel.ConfirmCards(tp,gc)
if gc:IsType(TYPE_XYZ) and gc:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(e:GetHandler()),gc)>0 and Senya.MustMaterialCheck(e:GetHandler(),tp,EFFECT_MUST_BE_XMATERIAL) then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
if #mg~=0 then
Duel.Overlay(gc,mg)
end
gc:SetMaterial(Group.FromCards(tc))
......
......@@ -69,8 +69,8 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=e:GetHandler():GetColumnGroup():Filter(function(c) return c:IsControler(1-tp) and c:IsAbleToDeck() end,nil)
if chk==0 then return g:GetCount()>0 end
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
if chk==0 then return #g>0 end
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
......
......@@ -24,7 +24,7 @@ end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetOverlayGroup(tp,0,1)
local val=g:GetCount()*300
local val=#g*300
if val~=0 then
Duel.SendtoGrave(g,REASON_EFFECT)
Duel.BreakEffect()
......
......@@ -23,7 +23,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
and Duel.IsExistingTarget(cm.filter,tp,LOCATION_REMOVED+LOCATION_GRAVE,LOCATION_REMOVED+LOCATION_GRAVE,5,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_REMOVED+LOCATION_GRAVE,LOCATION_REMOVED+LOCATION_GRAVE,5,5,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -62,11 +62,11 @@ end
function cm.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
end
function cm.operation1(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
end
end
\ No newline at end of file
......@@ -29,14 +29,14 @@ function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(cm.filter,1,e:GetHandler(),tp) end
local g=eg:Filter(cm.filter,nil,tp)
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,#g,0,0)
end
function cm.filter2(c,e,tp)
return c:IsRelateToEffect(e) and c:IsPreviousLocation(LOCATION_EXTRA) and (not c:IsType(TYPE_PENDULUM)) and c:IsControlerCanBeChanged() and c:GetSummonPlayer()==1-tp
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(cm.filter2,nil,e,tp)
if Duel.GetMZoneCount(tp)<g:GetCount() then return end
if Duel.GetMZoneCount(tp)<#g then return end
local tc=g:GetFirst()
while tc do
if Duel.GetControl(tc,tp) then
......
......@@ -92,7 +92,7 @@ end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
......
......@@ -41,12 +41,12 @@ function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_EXTRA,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
sg=g:Select(1-tp,1,1,nil)
Duel.SendtoGrave(sg,REASON_EFFECT)
local og=Duel.GetOperatedGroup()
if og:GetCount()>0 then
if #og>0 then
local tc=og:GetFirst()
if tc:IsLocation(LOCATION_GRAVE) then
tc:RegisterFlagEffect(37564225,RESET_EVENT+0x1fe0000,0,1)
......
......@@ -36,7 +36,7 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,tc:GetCode())
if g:GetCount()>0 then
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.SendtoGrave(tc,REASON_EFFECT)
......
......@@ -39,7 +39,7 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.drfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
......
......@@ -32,7 +32,7 @@ end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
......
......@@ -74,7 +74,7 @@ end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,0,LOCATION_ONFIELD,1,2,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
if e:GetHandler():GetFlagEffect(60151298)>0 then
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(m,2))
......
......@@ -35,17 +35,15 @@ function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if Duel.CheckLocation(tp,LOCATION_PZONE,0) then b1=b1+1 end
if Duel.CheckLocation(tp,LOCATION_PZONE,1) then b1=b1+1 end
local g=Duel.GetMatchingGroup(cm.dfilter,tp,0,LOCATION_SZONE,nil,e)
local ct=g:GetCount()
if chk==0 then return b1>0 and ct>0 end
if chk==0 then return b1>0 and #g>0 end
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local b1=0
if Duel.CheckLocation(tp,LOCATION_PZONE,0) then b1=b1+1 end
if Duel.CheckLocation(tp,LOCATION_PZONE,1) then b1=b1+1 end
local g=Duel.GetMatchingGroup(cm.dfilter,tp,0,LOCATION_PZONE,nil,e)
local ct=g:GetCount()
if not (b1>0 and ct>0) then return end
if b1>=ct then
if not (b1>0 and #g>0) then return end
if b1>=#g then
local tc=g:GetFirst()
while tc do
--Senya.ExileCard(tc)
......@@ -65,7 +63,7 @@ end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_PZONE,0,1,nil) end
local g=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_PZONE,0,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_PZONE,0,nil)
......
......@@ -47,7 +47,7 @@ function cm.tg2(c)
end
function cm.droperation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.tg2,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
end
end
\ No newline at end of file
......@@ -27,7 +27,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,0,LOCATION_EXTRA)
Duel.ConfirmCards(tp,g)
local tg=g:Filter(Card.IsCode,nil,cd)
if tg:GetCount()>0 then
if #tg>0 then
Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)
end
end
\ No newline at end of file
......@@ -33,7 +33,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,0,LOCATION_EXTRA,nil)
if g:GetCount()==0 then return end
if #g==0 then return end
local gc=g:RandomSelect(tp,1):GetFirst()
for i=0,3 do
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(m,i))
......
......@@ -62,7 +62,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
local tc=g:GetFirst()
Duel.SpecialSummon(tc,0,tp,tp,true,true,POS_FACEUP)
tc:CompleteProcedure()
......
......@@ -131,7 +131,7 @@ end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
......@@ -141,8 +141,8 @@ function cm.spptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local mg=c:GetMaterial()
local sumtype=c:GetSummonType()
if chk==0 then
return not ((sumtype & SUMMON_TYPE_FUSION)~=SUMMON_TYPE_FUSION or mg:GetCount()==0
or mg:GetCount()>Duel.GetMZoneCount(tp)
return not ((sumtype & SUMMON_TYPE_FUSION)~=SUMMON_TYPE_FUSION or #mg==0
or #mg>Duel.GetMZoneCount(tp)
or mg:IsExists(cm.mgfilter,1,nil,e,tp,c))
end
mg:KeepAlive()
......@@ -162,8 +162,8 @@ function cm.sppop(e,tp,eg,ep,ev,re,r,rp)
local mg=e:GetLabelObject()
local g=mg:Clone()
mg:DeleteGroup()
if not (g:GetCount()==0
or g:GetCount()>Duel.GetMZoneCount(tp)
if not (#g==0
or #g>Duel.GetMZoneCount(tp)
or g:IsExists(cm.mgfilterx,1,nil,e,tp,c)) then
local tc=g:GetFirst()
while tc do
......
......@@ -51,11 +51,11 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local g=tg:Select(tp,1,ct,nil)
tg:Sub(g)
sg:Merge(g)
ft=ft-g:GetCount()
ft=ft-#g
ect=ect-g:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)
until ft==0 or ect==0 or not Duel.SelectYesNo(tp,210)
local hg=tg:Filter(Card.IsLocation,nil,LOCATION_HAND)
if ft>0 and ect==0 and hg:GetCount()>0 and Duel.SelectYesNo(tp,210) then
if ft>0 and ect==0 and #hg>0 and Duel.SelectYesNo(tp,210) then
local g=hg:Select(tp,1,ft,nil)
sg:Merge(g)
end
......
......@@ -62,7 +62,7 @@ function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
e:Reset()
end)
Duel.RegisterEffect(e1,tp)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,sg:GetCount())
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,#sg)
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
......@@ -120,7 +120,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,cm.dfilter,tp,LOCATION_DECK,0,1,1,nil,tc)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
......
......@@ -58,7 +58,7 @@ function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,c)
if g:GetCount()==0 then return false end
if #g==0 then return false end
local g1,atk=g:GetMaxGroup(Card.GetAttack)
return c:GetAttack()~=atk and c:GetFlagEffect(37560310)==0
end
......@@ -67,7 +67,7 @@ end
function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,c)
if g:GetCount()==0 then return end
if #g==0 then return end
local g1,atk=g:GetMaxGroup(Card.GetAttack)
if c:IsRelateToEffect(e) and c:IsFaceup() and atk>0 then
local e1=Effect.CreateEffect(c)
......@@ -114,11 +114,11 @@ end
function cm.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.rmfilter,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
end
function cm.operation1(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,0,LOCATION_MZONE,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
end
end
......@@ -80,7 +80,7 @@ function cm.mtop(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,cm.mtfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Overlay(c,g)
end
end
\ No newline at end of file
......@@ -55,7 +55,7 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
local c=e:GetHandler()
if tg:GetCount()>0 and c:IsRelateToEffect(e) then
if #tg>0 and c:IsRelateToEffect(e) then
Duel.Overlay(c,tg)
end
end
......@@ -69,7 +69,7 @@ function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,0,LOCATION_MZONE,1,c,c:GetAttack()) end
local g=Duel.GetMatchingGroup(cm.filter,tp,0,LOCATION_MZONE,c,c:GetAttack())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -52,7 +52,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() or c:IsControler(1-tp) then return end
local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if hg:GetCount()==0 then return end
if #hg==0 then return end
Duel.ConfirmCards(tp,hg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPPO)
local sg=hg:Select(tp,1,1,nil)
......
......@@ -39,7 +39,7 @@ end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(cm.thfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>=3 then
if #g>=3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,3,3,nil)
Duel.ConfirmCards(1-tp,sg)
......
......@@ -124,7 +124,7 @@ end,
end,
[LOCATION_GRAVE]=function(e,tp)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,nil)
if g:GetCount()>0 then
if #g>0 then
Senya.order_table[e:GetLabel()][LOCATION_GRAVE]=2
Duel.Hint(HINT_CARD,0,m)
local sg=g:RandomSelect(tp,1)
......
......@@ -43,7 +43,7 @@ function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(cm.filter,1,e:GetHandler()) end
local g=eg:Filter(cm.filter,e:GetHandler(),tp)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0)
end
function cm.filter2(c,e)
return c:IsAbleToGrave() and c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e)
......
......@@ -41,7 +41,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -44,7 +44,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(cm.tgfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:Select(tp,1,1,nil)
Duel.SendtoGrave(sg,REASON_EFFECT)
......@@ -60,8 +60,7 @@ function cm.mgfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeXyzMaterial(nil) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup())
end
function cm.filtergoal(g,xyzc,tp)
local ct=g:GetCount()
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0 and xyzc:IsXyzSummonable(g,ct,ct)
return Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0 and xyzc:IsXyzSummonable(g,#g,#g)
end
function cm.xfilter(c,mg,tp)
return c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_LIGHT) and Senya.CheckGroup(mg,cm.filtergoal,nil,1,63,c,tp)
......@@ -79,7 +78,7 @@ end,
[2]=function(e,tp,eg,ep,ev,re,r,rp,chk)
local mg=Duel.GetMatchingGroup(cm.mgfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil)
local g=Duel.GetMatchingGroup(cm.xfilter,tp,LOCATION_EXTRA,0,nil,mg,tp)
if chk==0 then return g:GetCount()>0 end
if chk==0 then return #g>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end,
[3]=function(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -129,7 +128,7 @@ end,
if not e:GetHandler():IsRelateToEffect(e) then return end
local mg=Duel.GetMatchingGroup(cm.mgfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil)
local g=Duel.GetMatchingGroup(cm.xfilter,tp,LOCATION_EXTRA,0,nil,mg,tp)
if g:GetCount()==0 then return end
if #g==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=g:Select(tp,1,1,nil):GetFirst()
local sg=Senya.SelectGroup(tp,HINTMSG_XMATERIAL,mg,cm.filtergoal,nil,1,63,tc,tp)
......@@ -150,7 +149,7 @@ end,
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.ffilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
if #sg1>0 or (sg2~=nil and #sg2>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......
......@@ -56,7 +56,7 @@ function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_EXTRA,nil)
if g:GetCount()<2 then return end
if #g<2 then return end
local sg=g:RandomSelect(tp,2)
Duel.ConfirmCards(tp,sg)
local s1=sg:GetFirst():GetOriginalCode()
......@@ -109,7 +109,7 @@ function cm.FOperationCode2(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
local mg=eg:Filter(Auxiliary.FConditionFilterMix,c,c,sub,table.unpack(funs))
local sg=Group.CreateGroup()
if gc then sg:AddCard(gc) end
while sg:GetCount()<#funs do
while #sg<#funs do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local g=mg:FilterSelect(tp,Auxiliary.FSelectMix,1,1,sg,tp,mg,sg,c,sub,table.unpack(funs))
sg:Merge(g)
......
......@@ -51,7 +51,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,0,LOCATION_GRAVE,nil)
local ct=math.min(Duel.GetLocationCount(tp,LOCATION_SZONE),g:GetCount())
local ct=math.min(Duel.GetLocationCount(tp,LOCATION_SZONE),#g)
if ct==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local fg=Group.CreateGroup()
......
......@@ -64,7 +64,7 @@ end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_EXTRA+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.SpecialSummon(g,SUMMON_TYPE_SPECIAL,tp,tp,true,true,POS_FACEUP)
local tc=g:GetFirst()
......@@ -100,20 +100,20 @@ end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.filter(chkc) end
local fg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if chk==0 then return fg:GetCount()>0 and Duel.IsExistingTarget(cm.filter,tp,LOCATION_GRAVE,0,1,nil) end
if chk==0 then return #fg>0 and Duel.IsExistingTarget(cm.filter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_GRAVE,0,1,fg:GetCount(),nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_GRAVE,0,1,#fg,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
local fg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if not tg or tg:GetCount()==0 or tg:GetCount()>fg:GetCount() then return end
if not tg or #tg==0 or #tg>#fg then return end
Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
if ct>0 and ct<=fg:GetCount() then
if ct>0 and ct<=#fg then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=fg:Select(tp,1,ct,nil):Filter(Senya.NonImmuneFilter,nil,e)
Duel.HintSelection(sg)
......
......@@ -23,7 +23,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,cm.filter1,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 and Duel.Destroy(g,REASON_EFFECT)~=0 then
if #g>0 and Duel.Destroy(g,REASON_EFFECT)~=0 then
Duel.BreakEffect()
Duel.Draw(tp,2,REASON_EFFECT)
end
......
......@@ -71,7 +71,7 @@ function cm.mtop(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,cm.mtfilter,tp,LOCATION_EXTRA,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.Overlay(c,g)
end
end
......@@ -111,7 +111,7 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if mg:IsExists(cm.counterfilter,1,nil,e) then return end
if Duel.GetMZoneCount(tp,mg,tp)<=0 then return end
local fg=og:Filter(cm.filter3,nil,e,tp,mg)
if fg:GetCount()>0 then
if #fg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=fg:Select(tp,1,1,nil):GetFirst()
tc:SetMaterial(mg)
......@@ -175,7 +175,7 @@ function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.ffilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
if #sg1>0 or (sg2~=nil and #sg2>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......
......@@ -43,7 +43,7 @@ function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
Duel.MoveSequence(c,nseq)
end
local g=c:GetColumnGroup():Filter(function(c) return c:IsControler(1-tp) end,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.BreakEffect()
for tc in aux.Next(g) do
if tc:IsFaceup() and not tc:IsDisabled() then
......
......@@ -59,7 +59,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return maxc>0 and Duel.IsExistingTarget(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,maxc,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
......
......@@ -33,7 +33,7 @@ function cm.spcfilter(c,tp)
and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousSequence()>4
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:GetCount()==1 and eg:IsExists(cm.spcfilter,1,nil,tp)
return #eg==1 and eg:IsExists(cm.spcfilter,1,nil,tp)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......
......@@ -117,7 +117,7 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,cm.drfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,tc,e,tp)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Senya.OverlayGroup(c,g)
end
......
......@@ -16,7 +16,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -14,7 +14,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) and Duel.IsExistingTarget(cm.filter,tp,LOCATION_REMOVED+LOCATION_GRAVE,0,5,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_REMOVED+LOCATION_GRAVE,0,5,5,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -34,7 +34,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
if #mg~=0 then
Duel.Overlay(sc,mg)
end
Duel.Overlay(sc,Group.FromCards(tc))
......
......@@ -26,8 +26,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e2)
end
function cm.xyzcheck(g,xyzc)
local ct=g:GetCount()
if ct==1 and cm.ovfilter(g:GetFirst()) then return true end
if #g==1 and cm.ovfilter(g:GetFirst()) then return true end
if g:IsExists(function(c) return not c:IsXyzLevel(xyzc,5) end,1,nil) then return false end
return Senya.PrismXyzCheck(3,3)(g)
end
......
......@@ -21,8 +21,7 @@ function cm.initial_effect(c)
return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and c:CheckRemoveOverlayCard(tp,1,REASON_COST) and c:GetFlagEffect(m)==0
end
c:RemoveOverlayCard(tp,1,99,REASON_COST)
local ct=Duel.GetOperatedGroup():GetCount()
e:SetLabel(ct)
e:SetLabel(#Duel.GetOperatedGroup())
c:RegisterFlagEffect(m,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE_CAL,0,1)
end)
e3:SetOperation(Senya.PrismDamageCheckOperation)
......
......@@ -35,7 +35,7 @@ end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()>0 then
if #tg>0 then
Duel.Destroy(tg,REASON_EFFECT)
end
end
......@@ -47,7 +47,7 @@ function cm.exop(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectMatchingCard(tp,cm.drfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c,e)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Senya.OverlayGroup(e:GetHandler(),g)
end
......
......@@ -58,7 +58,7 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=c:GetBattleTarget()
if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToBattle() and not tc:IsImmuneToEffect(e) then
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
if #og>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(c,Group.FromCards(tc))
......
......@@ -64,7 +64,7 @@ function cm.operation1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil,e,tp,tc:GetCode())
if g:GetCount()>0 then
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
......
......@@ -32,7 +32,7 @@ function cm.operation1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil,e,tp,tc:GetCode())
if g:GetCount()>0 then
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
......
......@@ -38,10 +38,10 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetMZoneCount(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_DECK,0,1,nil,g:GetFirst():GetCode()) then
local g1=Duel.SelectMatchingCard(tp,cm.filter2,tp,LOCATION_DECK,0,1,1,nil,g:GetFirst():GetCode())
if g1:GetCount()>0 then
if #g1>0 then
Duel.BreakEffect()
Duel.SendtoHand(g1,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g1)
......
......@@ -75,7 +75,7 @@ end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -55,7 +55,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
end
end
local sg=ag:Filter(cm.tfilter,nil,e,tp)
if sg:GetCount()>0 and Duel.GetMZoneCount(tp)>=sg:GetCount() and not (sg:GetCount()>1 and Duel.IsPlayerAffectedByEffect(tp,59822133)) then
if #sg>0 and Duel.GetMZoneCount(tp)>=#sg and not (#sg>1 and Duel.IsPlayerAffectedByEffect(tp,59822133)) then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
local cval=math.floor(val[1]/2)
Duel.BreakEffect()
......
......@@ -81,14 +81,14 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerCanDraw(tp) or ct==0 then return end
for i=1,ct do
local g=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
if g:GetCount()==0 then break end
if #g==0 then break end
local tc=g:GetMinGroup(Card.GetSequence):GetFirst()
Duel.MoveSequence(tc,0)
end
local dct=ct-Duel.Draw(tp,ct,REASON_EFFECT)
if dct>0 then
local g=Duel.GetDecktopGroup(tp,dct)
if g:GetCount()==0 then return end
if #g==0 then return end
for tc in aux.Next(g) do
Duel.MoveSequence(tc,1)
end
......
......@@ -38,23 +38,23 @@ function cm.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=e:GetHandler():GetLinkedGroup():Filter(Card.IsAbleToHand,nil)
local z=e:GetHandler():GetLinkedZone()
local sg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_HAND,0,nil,e,tp)
local ct=sg:GetCount()
local ct=#sg
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=math.min(ct,1) end
if chk==0 then return z~=0 and ct>0 and Senya.CheckGroup(g,cm.thgcheck,nil,1,ct,tp,z) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,g:GetCount(),tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,#g,tp,LOCATION_HAND)
end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
if not cm.tdtg(e,tp,eg,ep,ev,re,r,rp,0) or not e:GetHandler():IsRelateToEffect(e) then return end
local z=e:GetHandler():GetLinkedZone()
local sg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_HAND,0,nil,e,tp)
local tg=e:GetHandler():GetLinkedGroup():Filter(Card.IsAbleToHand,nil)
local ct=sg:GetCount()
local ct=#sg
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=math.min(ct,1) end
local g1=Senya.SelectGroup(tp,HINTMSG_RTOHAND,tg,cm.thgcheck,nil,1,ct,tp,z)
local rct=Duel.SendtoHand(g1,nil,REASON_EFFECT)
local tsg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_HAND,0,nil,e,tp)
local minct=math.min(tsg:GetCount(),rct)
local minct=math.min(#tsg,rct)
minct=math.min(minct,Duel.GetMZoneCount(tp,nil,tp,LOCATION_REASON_TOFIELD,z))
if minct<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -63,7 +63,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local og=Duel.GetOperatedGroup()
if og:FilterCount(Senya.check_set_prism,nil)==2 then
local rg=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil)
if rg:GetCount()>0 and Duel.SelectYesNo(tp,m*16+1) then
if #rg>0 and Duel.SelectYesNo(tp,m*16+1) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local trg=rg:Select(tp,1,1,nil)
Duel.BreakEffect()
......
......@@ -22,7 +22,7 @@ function cm.cfilter(c)
end
function cm.rmcon(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.cfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil)
return g:GetCount()>6 and g:IsExists(Card.IsType,3,nil,TYPE_XYZ)
return #g>6 and g:IsExists(Card.IsType,3,nil,TYPE_XYZ)
end
function cm.rfilter(c,e)
if e and c:IsImmuneToEffect(e) then return false end
......@@ -37,13 +37,13 @@ function cm.scheck(g,c,tp)
end
function cm.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(cm.rfilter,tp,LOCATION_MZONE,0,e:GetHandler())
if chk==0 then return g:GetCount()>0 and Duel.IsExistingMatchingCard(cm.sfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp,g) end
if chk==0 then return #g>0 and Duel.IsExistingMatchingCard(cm.sfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp,g) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
end
function cm.gcheck(g,mft,eft)
local ect=g:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)
return ect<=eft and g:GetCount()-ect<=mft
return ect<=eft and #g-ect<=mft
end
function cm.RegisterBuff(c,ec)
local e1=Effect.CreateEffect(ec)
......@@ -73,7 +73,7 @@ function cm.RegisterBuff(c,ec)
end
function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.rfilter,tp,LOCATION_MZONE,0,e:GetHandler(),e)
if g:GetCount()==0 or not Duel.IsExistingMatchingCard(cm.sfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp,g) then return end
if #g==0 or not Duel.IsExistingMatchingCard(cm.sfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp,g) then return end
local ct=Duel.SendtoDeck(g,nil,0,REASON_EFFECT)
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local sg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,nil,e,tp)
......
......@@ -53,7 +53,7 @@ end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF)
local g1=Duel.SelectMatchingCard(tp,cm.filter1,tp,LOCATION_HAND,0,1,1,nil,tp)
if g1:GetCount()>0 then
if #g1>0 then
Duel.ConfirmCards(1-tp,g1)
local tc=g1:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
......
......@@ -25,7 +25,7 @@ end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
if Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and e:GetHandler():IsRelateToEffect(e) then
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleDeck(tp)
......@@ -40,7 +40,7 @@ function cm.bm_check_operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(37564765,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
......
......@@ -27,7 +27,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetMZoneCount(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if #g>0 then
if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 and e:GetHandler():IsRelateToEffect(e) then
Duel.ShuffleDeck(tp)
Duel.SendtoDeck(e:GetHandler(),nil,0,REASON_EFFECT)
......
......@@ -76,7 +76,7 @@ end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.HintSelection(g)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
......
......@@ -36,7 +36,7 @@ end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -48,7 +48,7 @@ end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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