Commit e232a4a6 authored by salix5's avatar salix5 Committed by GitHub

fix 鎖龍蛇-スカルデット etc. (#1955)

parent 0f9c1f25
......@@ -61,24 +61,9 @@ function s.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function s.dfilter(c,tp)
return c:IsLocation(LOCATION_DECK) and c:IsControler(tp)
end
function s.activate2(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if #tg>0 and Duel.SendtoDeck(tg,nil,SEQ_DECKTOP,REASON_EFFECT)>0 then
local p=tp
for i=1,2 do
local dg=tg:Filter(s.dfilter,nil,p)
if #dg>1 then
Duel.SortDecktop(tp,p,#dg)
end
for i=1,#dg do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
p=1-tp
end
if #tg>0 and aux.PlaceCardsOnDeckBottom(tp,tg)>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
......
......@@ -28,16 +28,12 @@ end
function c11434258.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)~=0 and Duel.GetFieldGroupCount(p,LOCATION_HAND,0)>1 then
Duel.BreakEffect()
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,p,LOCATION_HAND,0,nil)
if g:GetCount()==0 then return end
Duel.ShuffleHand(p)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK)
local sg=g:Select(p,2,2,nil)
Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)
Duel.SortDecktop(p,p,2)
for i=1,2 do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
aux.PlaceCardsOnDeckBottom(p,sg)
end
end
......@@ -62,15 +62,8 @@ function c14386013.drop(e,tp,eg,ep,ev,re,r,rp)
aux.GCheckAdditional=nil
if sg then
Duel.ConfirmCards(1-p,sg)
Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)
local og=Duel.GetOperatedGroup()
local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_DECK)
local ct=aux.PlaceCardsOnDeckBottom(p,sg)
if ct==0 then return end
Duel.SortDecktop(p,p,ct)
for i=1,ct do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
Duel.BreakEffect()
Duel.Draw(p,ct,REASON_EFFECT)
end
......
......@@ -26,16 +26,12 @@ function c16598965.activate(e,tp,eg,ep,ev,re,r,rp)
if f1 and (not f2 or Duel.SelectYesNo(tp,aux.Stringid(16598965,1))) and Duel.Draw(tp,3,REASON_EFFECT)==3 then
res=true
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_HAND,0,nil)
if #g<2 then return end
if g:GetCount()<2 then return end
Duel.ShuffleHand(tp)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=g:Select(tp,2,2,nil)
Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)
Duel.SortDecktop(tp,tp,2)
for i=1,2 do
local mg=Duel.GetDecktopGroup(tp,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
aux.PlaceCardsOnDeckBottom(tp,sg)
end
if f2 and (not res or Duel.SelectYesNo(tp,aux.Stringid(16598965,2))) and Duel.Draw(1-tp,1,REASON_EFFECT)==1 then
Duel.ShuffleHand(1-tp)
......
......@@ -25,6 +25,6 @@ function c32619583.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(1-tp,aux.TRUE,tp,0,LOCATION_HAND,2,2,nil)
Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT)
aux.PlaceCardsOnDeckBottom(1-tp,g)
end
end
......@@ -99,19 +99,7 @@ function c37961969.activate(e,tp,eg,ep,ev,re,r,rp)
local cg=mat1:Filter(c37961969.fdfilter,nil)
Duel.ConfirmCards(1-tp,cg)
end
Duel.SendtoDeck(mat1,nil,SEQ_DECKTOP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
local p=tp
for i=1,2 do
local dg=mat1:Filter(c37961969.seqfilter,nil,p)
if #dg>1 then
Duel.SortDecktop(tp,p,#dg)
end
for i=1,#dg do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
p=1-tp
end
aux.PlaceCardsOnDeckBottom(tp,mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
......@@ -125,6 +113,3 @@ end
function c37961969.fdfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsFacedown() or c:IsLocation(LOCATION_HAND)
end
function c37961969.seqfilter(c,tp)
return c:IsLocation(LOCATION_DECK) and c:IsControler(tp)
end
......@@ -32,15 +32,12 @@ function c51335426.activate(e,tp,eg,ep,ev,re,r,rp)
if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_EXTRA) then
if Duel.Draw(p,ct,REASON_EFFECT)==ct then
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,p,LOCATION_HAND,0,nil)
if g:GetCount()==0 then return end
if g:GetCount()<ct then return end
Duel.ShuffleHand(p)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK)
local sg=g:Select(p,ct,ct,nil)
Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)
Duel.SortDecktop(p,p,ct)
for i=1,ct do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
aux.PlaceCardsOnDeckBottom(p,sg)
end
end
end
......@@ -72,15 +72,8 @@ function c55521751.drop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(p,c55521751.drfilter,p,LOCATION_HAND,0,1,2,nil)
if g:GetCount()>0 then
Duel.ConfirmCards(1-p,g)
Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)
local og=Duel.GetOperatedGroup()
local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_DECK)
local ct=aux.PlaceCardsOnDeckBottom(p,g)
if ct==0 then return end
Duel.SortDecktop(p,p,ct)
for i=1,ct do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
Duel.BreakEffect()
Duel.Draw(p,ct,REASON_EFFECT)
end
......
......@@ -106,19 +106,7 @@ function c572850.activate(e,tp,eg,ep,ev,re,r,rp)
local cg=mat1:Filter(c572850.fdfilter,nil)
Duel.ConfirmCards(1-tp,cg)
end
Duel.SendtoDeck(mat1,nil,SEQ_DECKTOP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
local p=tp
for i=1,2 do
local dg=mat1:Filter(c572850.seqfilter,nil,p)
if #dg>1 then
Duel.SortDecktop(tp,p,#dg)
end
for i=1,#dg do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
p=1-tp
end
aux.PlaceCardsOnDeckBottom(tp,mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
......@@ -132,6 +120,3 @@ end
function c572850.fdfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsFacedown() or c:IsLocation(LOCATION_HAND)
end
function c572850.seqfilter(c,tp)
return c:IsLocation(LOCATION_DECK) and c:IsControler(tp)
end
......@@ -93,19 +93,7 @@ function c74078255.activate(e,tp,eg,ep,ev,re,r,rp)
local cg=mat1:Filter(c74078255.fdfilter,nil)
Duel.ConfirmCards(1-tp,cg)
end
Duel.SendtoDeck(mat1,nil,SEQ_DECKTOP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
local p=tp
for i=1,2 do
local dg=mat1:Filter(c74078255.seqfilter,nil,p)
if #dg>1 then
Duel.SortDecktop(tp,p,#dg)
end
for i=1,#dg do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
p=1-tp
end
aux.PlaceCardsOnDeckBottom(tp,mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
......@@ -119,6 +107,3 @@ end
function c74078255.fdfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsFacedown() or c:IsLocation(LOCATION_HAND)
end
function c74078255.seqfilter(c,tp)
return c:IsLocation(LOCATION_DECK) and c:IsControler(tp)
end
......@@ -117,15 +117,11 @@ function c74997493.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)==4 then
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,p,LOCATION_HAND,0,nil)
if g:GetCount()==0 then return end
if g:GetCount()<3 then return end
Duel.ShuffleHand(p)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK)
local sg=g:Select(p,3,3,nil)
Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)
Duel.SortDecktop(p,p,3)
for i=1,3 do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
aux.PlaceCardsOnDeckBottom(p,sg)
end
end
......@@ -39,9 +39,6 @@ function s.fstg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE+LOCATION_REMOVED)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.dfilter(c,tp)
return c:IsLocation(LOCATION_DECK) and c:IsControler(tp)
end
function s.fsop(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp|0x200
local mg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.fsfilter1),tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,e)
......@@ -58,20 +55,7 @@ function s.fsop(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,cf)
end
local ng=mat:Filter(Card.IsCode,nil,89943723)
if #mat>0 and Duel.SendtoDeck(mat,nil,SEQ_DECKTOP,REASON_EFFECT)>0 then
local p=tp
for i=1,2 do
local dg=mat:Filter(s.dfilter,nil,p)
if #dg>1 then
Duel.SortDecktop(tp,p,#dg)
end
for i=1,#dg do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),1)
end
p=1-tp
end
end
aux.PlaceCardsOnDeckBottom(tp,mat)
Duel.BreakEffect()
Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
if ng:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then
......
......@@ -62,10 +62,10 @@ function c77683371.drop(e,tp,eg,ep,ev,re,r,rp)
if ct>0 and Duel.Draw(p,ct,REASON_EFFECT)==ct then
local tg=Duel.GetMatchingGroup(Card.IsAbleToDeck,p,LOCATION_HAND,0,nil)
if tg:GetCount()==0 then return end
Duel.ShuffleHand(p)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK)
local sg=tg:Select(p,ct,ct,nil)
Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)
Duel.SortDecktop(p,p,ct)
aux.PlaceCardsOnDeckTop(p,sg)
end
end
......@@ -31,13 +31,11 @@ function c82016179.activate(e,tp,eg,ep,ev,re,r,rp)
local sg2=g:Select(p,1,1,sg1:GetFirst())
sg1:Merge(sg2)
Duel.ConfirmCards(1-p,sg1)
Duel.SendtoDeck(sg1,nil,SEQ_DECKTOP,REASON_EFFECT)
Duel.SortDecktop(p,p,2)
aux.PlaceCardsOnDeckTop(p,sg1)
else
local hg=Duel.GetFieldGroup(p,LOCATION_HAND,0)
Duel.ConfirmCards(1-p,hg)
local ct=Duel.SendtoDeck(hg,nil,SEQ_DECKTOP,REASON_EFFECT)
Duel.SortDecktop(p,p,ct)
aux.PlaceCardsOnDeckTop(p,hg)
end
end
end
......@@ -39,15 +39,7 @@ function s.act(e,tp,eg,ep,ev,re,r,rp)
Duel.ShuffleHand(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.GetFieldGroup(p,LOCATION_HAND,0):Select(p,d,d,nil)
Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)
local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK)
if ct>0 then
Duel.SortDecktop(p,p,ct)
for i=1,ct do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
end
aux.PlaceCardsOnDeckBottom(tp,g)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_END
......
......@@ -62,9 +62,6 @@ end
function c90488465.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c90488465.dfilter(c,tp)
return c:IsLocation(LOCATION_DECK) and c:IsControler(tp)
end
function c90488465.tdop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
......@@ -73,19 +70,7 @@ function c90488465.tdop(e,tp,eg,ep,ev,re,r,rp)
if sg:GetCount()>0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
tg:Sub(sg)
end
Duel.SendtoDeck(tg,nil,SEQ_DECKTOP,REASON_EFFECT)
local p=tp
for i=1,2 do
local dg=tg:Filter(c90488465.dfilter,nil,p)
if #dg>1 then
Duel.SortDecktop(tp,p,#dg)
end
for i=1,#dg do
local mg=Duel.GetDecktopGroup(p,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
p=1-tp
aux.PlaceCardsOnDeckBottom(tp,tg)
end
end
end
......@@ -2984,3 +2984,41 @@ function Auxiliary.ThisCardInGraveAlreadyReset2(e)
e1:Reset()
e:Reset()
end
--Player p place g on the top of Deck in any order
function Auxiliary.PlaceCardsOnDeckTop(p,g,reason)
if reason==nil then reason=REASON_EFFECT end
Duel.SendtoDeck(g,nil,SEQ_DECKTOP,reason)
local og=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_DECK)
local ct1=og:FilterCount(Card.IsControler,nil,p)
local ct2=og:FilterCount(Card.IsControler,nil,1-p)
if ct1>0 then
Duel.SortDecktop(p,p,ct1)
end
if ct2>0 then
Duel.SortDecktop(p,1-p,ct2)
end
return #og
end
--Player p place g on the bottom of Deck in any order
function Auxiliary.PlaceCardsOnDeckBottom(p,g,reason)
if reason==nil then reason=REASON_EFFECT end
Duel.SendtoDeck(g,nil,SEQ_DECKTOP,reason)
local og=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_DECK)
local ct1=og:FilterCount(Card.IsControler,nil,p)
local ct2=og:FilterCount(Card.IsControler,nil,1-p)
if ct1>0 then
Duel.SortDecktop(p,p,ct1)
for i=1,ct1 do
local tc=Duel.GetDecktopGroup(p,1):GetFirst()
Duel.MoveSequence(tc,SEQ_DECKBOTTOM)
end
end
if ct2>0 then
Duel.SortDecktop(p,1-p,ct2)
for i=1,ct2 do
local tc=Duel.GetDecktopGroup(1-p,1):GetFirst()
Duel.MoveSequence(tc,SEQ_DECKBOTTOM)
end
end
return #og
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