Commit 77dd0d4f authored by Grajade's avatar Grajade

Update c51562806.lua

parent 7b32188d
Pipeline #6873 failed with stages
in 44 minutes and 45 seconds
...@@ -26,31 +26,46 @@ function c51562806.initial_effect(c) ...@@ -26,31 +26,46 @@ function c51562806.initial_effect(c)
end end
--ef1 --ef1
function c51562806.thcost(e,tp,eg,ep,ev,re,r,rp,chk) function c51562806.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD) Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end end
function c51562806.thfilter(c) function c51562806.thfilter(c,e)
return c:IsSetCard(0x351a) and c:IsFaceup() and (c:IsAbleToHand() or c:IsAbleToDeck()) and not c:IsCode(51562806) return c:IsSetCard(0x351a) and c:IsFaceup() and (c:IsAbleToHand() or c:IsAbleToDeck()) and c:IsCanBeEffectTarget(e) and not c:IsCode(51562806)
end
function c51562806.thcfilter(c,g)
local num1=(g:GetCount()-1)
local num2=(g:FilterCount(Card.IsAbleToDeck,c))
return num1==num2 and c:IsAbleToHand()
end
function c51562806.thgfilter(g)
return g:IsExists(c51562806.thcfilter,1,nil,g)
end end
function c51562806.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c51562806.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(c51562806.thfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,2,nil) end local mg=Duel.GetMatchingGroup(c51562806.thfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,e)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) if chkc then return false end
local g=Duel.SelectTarget(tp,c51562806.thfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,2,2,nil) if chk==0 then return mg:CheckSubGroup(c51562806.thgfilter,1,2) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE) local g=mg:SelectSubGroup(tp,c51562806.thgfilter,false,1,2)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE)
end end
function c51562806.thop(e,tp,eg,ep,ev,re,r,rp,chk) function c51562806.thop(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g:GetCount()<2 then return end local mg=sg:Filter(Card.IsRelateToEffect,nil,e)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) if mg:GetCount()>0 then
local tc=g:Select(tp,1,1,nil):GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g2=g:__bxor(tc) local tg=mg:FilterSelect(tp,Card.IsAbleToHand,1,1,nil)
if tc then mg:Sub(tg)
Duel.SendtoHand(tc,nil,REASON_EFFECT) if tg:GetCount()>0 then
Duel.ConfirmCards(1-tp,tc) Duel.SendtoHand(tg,nil,REASON_EFFECT)
Duel.SendtoDeck(g2,nil,2,REASON_EFFECT) Duel.ConfirmCards(1-tp,tg)
end end
if mg:GetCount()>0 then
Duel.SendtoDeck(mg,nil,2,REASON_EFFECT)
end
end
end end
--ef2 --ef2
function c51562806.tdfilter(c) function c51562806.tdfilter(c)
...@@ -64,23 +79,26 @@ function c51562806.tsselect(g) ...@@ -64,23 +79,26 @@ function c51562806.tsselect(g)
end end
function c51562806.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) function c51562806.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
local tsg=Duel.GetMatchingGroup(c51562806.tsfilter,tp,LOCATION_DECK,0,nil) local tsg=Duel.GetMatchingGroup(c51562806.tsfilter,tp,LOCATION_DECK,0,nil)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(tp) and c51562806.tdfilter(chkc) end
if chk==0 then return tsg:CheckSubGroup(c51562806.tsselect,2,2) and Duel.IsExistingTarget(c51562806.tdfilter,tp,LOCATION_SZONE,0,1,e:GetHandler()) and e:GetHandler():IsAbleToDeck() end if chk==0 then return tsg:CheckSubGroup(c51562806.tsselect,2,2) and Duel.IsExistingTarget(c51562806.tdfilter,tp,LOCATION_SZONE,0,1,e:GetHandler()) and e:GetHandler():IsAbleToDeck() end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c51562806.tdfilter,tp,LOCATION_SZONE,0,1,1,e:GetHandler()) local g=Duel.SelectTarget(tp,c51562806.tdfilter,tp,LOCATION_SZONE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) g:AddCard(e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,2,0,0)
end end
function c51562806.tdop(e,tp,eg,ep,ev,re,r,rp) function c51562806.tdop(e,tp,eg,ep,ev,re,r,rp)
local tsg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c51562806.tsfilter),tp,LOCATION_DECK,0,nil) local c=e:GetHandler()
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
local tg=Group.__add(tc,e:GetHandler()) local tg=Group.FromCards(e:GetHandler(),tc)
Duel.SendtoDeck(tg,nil,2,REASON_EFFECT) if Duel.SendtoDeck(tg,nil,2,REASON_EFFECT)<0 then return end
local tsg=Duel.GetMatchingGroup(c51562806.tsfilter,tp,LOCATION_DECK,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=tsg:SelectSubGroup(tp,c51562806.tsselect,false,2,2) local g=tsg:SelectSubGroup(tp,c51562806.tsselect,false,2,2)
local sc=g:GetFirst() local sc=g:GetFirst()
while sc do while sc do
Duel.MoveToField(sc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) Duel.MoveToField(sc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(sc) local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
......
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