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)
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
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)
if ft>0 then
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
return ft>-1 and mg:IsExists(c7986397.mfilterf,1,nil,tp,mg,dg,c)
end
......@@ -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
Duel.SetSelectedCard(c)
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
end
function c7986397.dlvfilter(c,tp,mg,rc,lv)
local lv2=lv-c:GetRitualLevel(rc)
return mg:CheckWithSumEqual(Card.GetRitualLevel,lv2,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)
function c7986397.dlvfilter(c,tp,mg,rc,mc)
Duel.SetSelectedCard(Group.FromCards(c,mc))
return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc)
end
function c7986397.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
......@@ -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)
end
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)
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()
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)
mg:Merge(dg)
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,nil)
end
local mat=Group.CreateGroup()
local lv=tc:GetLevel()
if ft<=0 then
if ft>0 then
if dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,tc) and Duel.SelectYesNo(tp,aux.Stringid(7986397,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
dmat=dg:FilterSelect(tp,c7986397.dlvfilter,1,1,nil,tp,mg,tc)
Duel.SetSelectedCard(dmat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
mat:Merge(dmat)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:FilterSelect(tp,c7986397.mfilterf,1,1,nil,tp,mg,dg,tc):GetFirst()
lv=lv-mat2:GetRitualLevel(tc)
mat:AddCard(mat2)
mg:RemoveCard(mat2)
mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
end
while lv~=0 do
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:FilterSelect(tp,c7986397.mfilterf,1,1,nil,tp,mg,dg,tc)
if dg:IsExists(c7986397.dlvfilter,1,nil,tp,mg,tc,mat:GetFirst()) and Duel.SelectYesNo(tp,aux.Stringid(7986397,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
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 tg=mg:FilterSelect(tp,c7986397.selcheck,1,1,nil,mg,dg,mat,tc):GetFirst()
mat:AddCard(tg)
if tg:IsLocation(LOCATION_DECK) then
mg:Sub(dg)
local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
mat:Merge(mat2)
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
lv=lv-tg:GetRitualLevel(tc)
end
tc:SetMaterial(mat)
local mat3=mat:Filter(Card.IsLocation,nil,LOCATION_DECK)
if mat3 then
mat:Sub(mat3)
Duel.SendtoGrave(mat3,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
if dmat then
mat:Sub(dmat)
Duel.SendtoGrave(dmat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
end
Duel.ReleaseRitualMaterial(mat)
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