Commit 192d9ddf authored by Grajade's avatar Grajade

Update c12047052.lua

parent 9e949301
Pipeline #4540 passed with stages
in 22 minutes and 44 seconds
......@@ -2,69 +2,64 @@
local m=12047052
local cm=_G["c"..m]
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_TOGRAVE)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(cm.cost)
c:RegisterEffect(e2)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_TOGRAVE)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(cm.cost)
c:RegisterEffect(e2)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_ONFIELD,0)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
c:CreateEffectRelation(e)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_REDIRECT)
e1:SetValue(LOCATION_DECKSHF)
c:RegisterEffect(e1,true)
e:SetLabel(2)
end
function cm.disfilter(c)
return c:IsAbleToDeck()
local c=e:GetHandler()
if chk==0 then return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_ONFIELD,0)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
c:CreateEffectRelation(e)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_REDIRECT)
e1:SetValue(LOCATION_DECKSHF)
c:RegisterEffect(e1,true)
e:SetLabel(2)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and cm.disfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.disfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectTarget(tp,cm.disfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,tc,1,0,0)
end
function cm.spfilter1(c)
return c:IsAbleToGrave()
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToDeck() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) and (Duel.IsPlayerCanDraw(tp,1) or (not e:GetHandler():IsLocation(LOCATION_SZONE))) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local tc=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,tc,1,0,0)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)
end
if true then
local dp=tc:GetOwner()
if Duel.IsExistingMatchingCard(cm.spfilter1,dp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(dp,aux.Stringid(m,1)) then
Duel.Hint(HINT_SELECTMSG,dp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(dp,cm.spfilter1,dp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
end
if not c:IsStatus(STATUS_ACT_FROM_HAND) and c:IsLocation(LOCATION_SZONE) and e:GetLabel()~=2 then
Duel.Draw(tp,1,REASON_EFFECT)
end
local shuffle=0
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
if Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)>0 then
shuffle=1
end
end
local dp=tc:GetOwner()
if Duel.IsExistingMatchingCard(Card.IsAbleToGrave,dp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(dp,aux.Stringid(m,1)) then
Duel.Hint(HINT_SELECTMSG,dp,HINTMSG_TOGRAVE)
local sg=Duel.SelectMatchingCard(dp,Card.IsAbleToGrave,dp,LOCATION_DECK,0,1,1,nil)
if Duel.SendtoGrave(sg,REASON_EFFECT)>0 then
shuffle=1
end
end
if shuffle==1 then Duel.ShuffleDeck(dp) end
if not c:IsStatus(STATUS_ACT_FROM_HAND) and e:GetLabel()~=2 then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function cm.handcon(e)
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_ONFIELD,0)==0
end
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_ONFIELD,0)==0
end
\ No newline at end of file
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