Commit 192d9ddf authored by Grajade's avatar Grajade

Update c12047052.lua

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