Commit d6bbd7a4 authored by DailyShana's avatar DailyShana

fix #1077

aux.Stringid(7986397,0): whether send 1 "Vendread" monster from your
Deck to the GY
parent d12bd90f
...@@ -17,13 +17,10 @@ function c7986397.filter(c,e,tp,m,ft) ...@@ -17,13 +17,10 @@ function c7986397.filter(c,e,tp,m,ft)
if not c:IsSetCard(0x106) or bit.band(c:GetType(),0x81)~=0x81 if not c:IsSetCard(0x106) or bit.band(c:GetType(),0x81)~=0x81
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c) local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c)
if c.mat_filter then
mg=mg:Filter(c.mat_filter,nil)
end
local dg=Duel.GetMatchingGroup(c7986397.dfilter,tp,LOCATION_DECK,0,nil) local dg=Duel.GetMatchingGroup(c7986397.dfilter,tp,LOCATION_DECK,0,nil)
if ft>0 then if ft>0 then
return mg:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c) return mg:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c)
or dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,c,c:GetLevel()) or dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,c)
else else
return ft>-1 and mg:IsExists(c7986397.mfilterf,1,nil,tp,mg,dg,c) return ft>-1 and mg:IsExists(c7986397.mfilterf,1,nil,tp,mg,dg,c)
end end
...@@ -32,25 +29,12 @@ function c7986397.mfilterf(c,tp,mg,dg,rc) ...@@ -32,25 +29,12 @@ function c7986397.mfilterf(c,tp,mg,dg,rc)
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then
Duel.SetSelectedCard(c) Duel.SetSelectedCard(c)
return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc) return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc)
or dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,rc,rc:GetLevel()-c:GetRitualLevel(rc)) or dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,rc,c)
else return false end else return false end
end end
function c7986397.dlvfilter(c,tp,mg,rc,lv) function c7986397.dlvfilter(c,tp,mg,rc,mc)
local lv2=lv-c:GetRitualLevel(rc) Duel.SetSelectedCard(Group.FromCards(c,mc))
return mg:CheckWithSumEqual(Card.GetRitualLevel,lv2,0,99,rc) return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc)
end
function c7986397.selcheck(c,mg1,dg,mat1,rc)
local mat=mat1:Clone()
local mg=mg1:Clone()
mat:AddCard(c)
if c:IsLocation(LOCATION_DECK) then
mg:Sub(dg)
else
mg:RemoveCard(c)
end
local sum=mat:GetSum(Card.GetRitualLevel,rc)
local lv=rc:GetLevel()-sum
return rc:IsLevelAbove(sum) and mg:CheckWithSumEqual(Card.GetRitualLevel,lv,0,99,rc)
end end
function c7986397.target(e,tp,eg,ep,ev,re,r,rp,chk) function c7986397.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
...@@ -61,43 +45,49 @@ function c7986397.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -61,43 +45,49 @@ function c7986397.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end end
function c7986397.activate(e,tp,eg,ep,ev,re,r,rp) function c7986397.activate(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetRitualMaterial(tp) local m=Duel.GetRitualMaterial(tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c7986397.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp,mg,ft) local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c7986397.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp,m,ft)
local tc=tg:GetFirst() local tc=tg:GetFirst()
if tc then if tc then
local mat,dmat
local mg=m:Filter(Card.IsCanBeRitualMaterial,tc,tc)
local dg=Duel.GetMatchingGroup(c7986397.dfilter,tp,LOCATION_DECK,0,nil) local dg=Duel.GetMatchingGroup(c7986397.dfilter,tp,LOCATION_DECK,0,nil)
mg:Merge(dg) if ft>0 then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc) if dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,tc) and Duel.SelectYesNo(tp,aux.Stringid(7986397,0)) then
if tc.mat_filter then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
mg=mg:Filter(tc.mat_filter,nil) dmat=dg:FilterSelect(tp,c7986397.dlvfilter,1,1,nil,tp,mg,tc)
end Duel.SetSelectedCard(dmat)
local mat=Group.CreateGroup() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local lv=tc:GetLevel() mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
if ft<=0 then mat:Merge(dmat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) else
local mat2=mg:FilterSelect(tp,c7986397.mfilterf,1,1,nil,tp,mg,dg,tc):GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
lv=lv-mat2:GetRitualLevel(tc) mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
mat:AddCard(mat2) end
mg:RemoveCard(mat2) else
end
while lv~=0 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local tg=mg:FilterSelect(tp,c7986397.selcheck,1,1,nil,mg,dg,mat,tc):GetFirst() mat=mg:FilterSelect(tp,c7986397.mfilterf,1,1,nil,tp,mg,dg,tc)
mat:AddCard(tg) if dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,tc,mat:GetFirst()) and Duel.SelectYesNo(tp,aux.Stringid(7986397,0)) then
if tg:IsLocation(LOCATION_DECK) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
mg:Sub(dg) dmat=dg:FilterSelect(tp,c7986397.dlvfilter,1,1,nil,tp,mg,tc,mat:GetFirst())
mat:Merge(dmat)
Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
mat:Merge(mat2)
else else
mg:RemoveCard(tg) Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
mat:Merge(mat2)
end end
lv=lv-tg:GetRitualLevel(tc)
end end
tc:SetMaterial(mat) tc:SetMaterial(mat)
local mat3=mat:Filter(Card.IsLocation,nil,LOCATION_DECK) if dmat then
if mat3 then mat:Sub(dmat)
mat:Sub(mat3) Duel.SendtoGrave(dmat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
Duel.SendtoGrave(mat3,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
end end
Duel.ReleaseRitualMaterial(mat) Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect() Duel.BreakEffect()
......
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