Commit 15138ce6 authored by wind2009's avatar wind2009

Fix 影装騎士 ブラック・ジャック

parent 4bf96670
Pipeline #41496 canceled with stages
in 9 seconds
...@@ -43,11 +43,11 @@ function s.initial_effect(c) ...@@ -43,11 +43,11 @@ function s.initial_effect(c)
e5:SetCondition(s.descon) e5:SetCondition(s.descon)
c:RegisterEffect(e5) c:RegisterEffect(e5)
end end
function s.desfilter(c) function s.desfilter(c,tp)
return c:IsLocation(LOCATION_SZONE) return c:IsLocation(LOCATION_SZONE) and c:IsControler(1-tp)
end end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp) function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and eg:IsExists(s.desfilter,1,e:GetHandler()) return eg:IsExists(s.desfilter,1,e:GetHandler(),tp)
end end
function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
...@@ -60,31 +60,33 @@ end ...@@ -60,31 +60,33 @@ end
function s.eqop(e,tp,eg,ep,ev,re,r,rp) function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<1 then return end if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<1 then return end
local g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_MONSTER)
local dcount=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0) local dcount=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
local seq=-1 local seq=-1
local tc=g:GetFirst() local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_MONSTER)
local tc=mg:GetFirst()
local qc=nil local qc=nil
while tc do while tc do
if tc:GetSequence()>seq then if tc:GetSequence()>seq then
seq=tc:GetSequence() seq=tc:GetSequence()
qc=tc qc=tc
end end
tc=g:GetNext() tc=mg:GetNext()
end end
if seq==-1 then if seq==-1 then
Duel.ConfirmDecktop(tp,dcount) Duel.ConfirmDecktop(tp,dcount)
local g=Duel.GetDecktopGroup(tp,dcount) local dg=Duel.GetDecktopGroup(tp,dcount)
Duel.SortDecktop(tp,tp,#g) Duel.DisableShuffleCheck()
for i=1,#g do Duel.SortDecktop(tp,tp,#dg)
local mg=Duel.GetDecktopGroup(tp,1) for i=1,#dg do
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM) local mvg=Duel.GetDecktopGroup(tp,1)
Duel.MoveSequence(mvg:GetFirst(),SEQ_DECKBOTTOM)
end end
return return
end end
Duel.ConfirmDecktop(tp,dcount-seq) Duel.ConfirmDecktop(tp,dcount-seq)
local g=Duel.GetDecktopGroup(tp,dcount-seq-1) local cg=Duel.GetDecktopGroup(tp,dcount-seq-1)
if c:IsRelateToChain() and c:IsFaceup() then if c:IsRelateToChain() and c:IsFaceup() and qc then
Duel.DisableShuffleCheck()
if s.eqfilter(qc,c,tp) then if s.eqfilter(qc,c,tp) then
if Duel.Equip(tp,qc,c) then if Duel.Equip(tp,qc,c) then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
...@@ -99,14 +101,14 @@ function s.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -99,14 +101,14 @@ function s.eqop(e,tp,eg,ep,ev,re,r,rp)
else else
Duel.SendtoGrave(qc,REASON_RULE) Duel.SendtoGrave(qc,REASON_RULE)
end end
else elseif qc then
Duel.SendtoGrave(qc,REASON_RULE) Duel.SendtoGrave(qc,REASON_RULE)
end end
if #g>0 then if #cg>0 then
Duel.SortDecktop(tp,tp,#g) Duel.SortDecktop(tp,tp,#cg)
for i=1,#g do for i=1,#cg do
local mg=Duel.GetDecktopGroup(tp,1) local mvg=Duel.GetDecktopGroup(tp,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM) Duel.MoveSequence(mvg:GetFirst(),SEQ_DECKBOTTOM)
end end
end end
end 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