Commit a7fe5ddc authored by GuGu's avatar GuGu

Update c21126.lua

parent 54c7f05a
Pipeline #40801 passed with stage
in 6 seconds
......@@ -9,12 +9,11 @@ function c21126.initial_effect(c)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(21126,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c21126.descon)
e2:SetCost(c21126.scost)
e2:SetTarget(c21126.destg)
e2:SetOperation(c21126.desop)
c:RegisterEffect(e2)
......@@ -23,7 +22,7 @@ function c21126.smfilter(c)
return (c:IsSetCard(0x208) and c:IsType(TYPE_DUAL)) or c:IsSetCard(0x137)
end
function c21126.sumop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,21126)~=0 then return end
if Duel.GetFlagEffect(tp,21126)~=0 or Duel.GetTurnCount()>=11 then return end
local reseturn=11-Duel.GetTurnCount()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
......@@ -38,25 +37,27 @@ function c21126.descon(e,tp,eg,ep,ev,re,r,rp)
e:SetLabel(e:GetHandler():GetPreviousControler())
return e:GetHandler():IsPreviousLocation(LOCATION_HAND) or e:GetHandler():IsPreviousLocation(LOCATION_DECK)
end
function c21126.scost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeckAsCost,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeckAsCost,tp,LOCATION_GRAVE,0,1,1,e:GetHandler())
Duel.SendtoDeck(g,nil,1,REASON_COST)
end
function c21126.filter(c)
return c:IsDestructable()
end
function c21126.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c21126.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c21126.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
if chkc then return chkc:IsOnField() and c21126.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c21126.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c21126.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c21126.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
if not Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_GRAVE,0,1,e:GetHandler()) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_GRAVE,0,1,1,e:GetHandler())
Duel.ConfirmCards(1-tp,g)
if Duel.SendtoDeck(g,nil,1,REASON_EFFECT)~=0 then
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
end
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