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)
end
--ef1
function c51562806.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function c51562806.thfilter(c)
return c:IsSetCard(0x351a) and c:IsFaceup() and (c:IsAbleToHand() or c:IsAbleToDeck()) and not c:IsCode(51562806)
function c51562806.thfilter(c,e)
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
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
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c51562806.thfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,2,2,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE)
local mg=Duel.GetMatchingGroup(c51562806.thfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,e)
if chkc then return false end
if chk==0 then return mg:CheckSubGroup(c51562806.thgfilter,1,2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
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
function c51562806.thop(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g:GetCount()<2 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tc=g:Select(tp,1,1,nil):GetFirst()
local g2=g:__bxor(tc)
if tc then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
Duel.SendtoDeck(g2,nil,2,REASON_EFFECT)
end
local sg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local mg=sg:Filter(Card.IsRelateToEffect,nil,e)
if mg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=mg:FilterSelect(tp,Card.IsAbleToHand,1,1,nil)
mg:Sub(tg)
if tg:GetCount()>0 then
Duel.SendtoHand(tg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tg)
end
if mg:GetCount()>0 then
Duel.SendtoDeck(mg,nil,2,REASON_EFFECT)
end
end
end
--ef2
function c51562806.tdfilter(c)
......@@ -64,23 +79,26 @@ function c51562806.tsselect(g)
end
function c51562806.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
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
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
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
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()
if tc:IsRelateToEffect(e) then
local tg=Group.__add(tc,e:GetHandler())
Duel.SendtoDeck(tg,nil,2,REASON_EFFECT)
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
local tg=Group.FromCards(e:GetHandler(),tc)
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)
local g=tsg:SelectSubGroup(tp,c51562806.tsselect,false,2,2)
local sc=g:GetFirst()
while sc do
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:SetType(EFFECT_TYPE_SINGLE)
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