Commit e289714f authored by GuGu's avatar GuGu

Update c20161.lua 格子检测

parent 2cd74f03
Pipeline #20014 passed with stage
in 47 seconds
--天空的花之都 --天空的花之都
function c20161.initial_effect(c) function c20161.initial_effect(c)
-- --
aux.AddCodeList(c,1192020) aux.AddCodeList(c,1192020)
-- --
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--indestructable --indestructable
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_FZONE) e3:SetRange(LOCATION_FZONE)
e3:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e3:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
e3:SetCountLimit(1) e3:SetCountLimit(1)
e3:SetValue(c20161.valcon) e3:SetValue(c20161.valcon)
c:RegisterEffect(e3) c:RegisterEffect(e3)
--special summon --special summon
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(20161,0)) e4:SetDescription(aux.Stringid(20161,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetRange(LOCATION_FZONE) e4:SetRange(LOCATION_FZONE)
e4:SetCode(EVENT_RECOVER) e4:SetCode(EVENT_RECOVER)
e4:SetCountLimit(1) e4:SetCountLimit(1)
e4:SetTarget(c20161.target) e4:SetTarget(c20161.target)
e4:SetOperation(c20161.operation) e4:SetOperation(c20161.operation)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
function c20161.spfilter(c,e,tp) function c20161.spfilter(c,e,tp)
return c:IsSetCard(0x123) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsSetCard(0x123) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and (c:IsLocation(LOCATION_DECK) and Duel.GetMZoneCount(tp)>0 or c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0)
end end
function c20161.target(e,tp,eg,ep,ev,re,r,rp,chk) function c20161.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return ((Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(c20161.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)) or (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c20161.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp))) end if chk==0 then return Duel.IsExistingMatchingCard(c20161.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA)
end end
function c20161.operation(e,tp,eg,ep,ev,re,r,rp) function c20161.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
if Duel.GetLocationCountFromEx(tp)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then local g=Duel.SelectMatchingCard(tp,c20161.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil,e,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) if g:GetCount()>0 then
local g=Duel.SelectMatchingCard(tp,c20161.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil,e,tp) local tc=g:GetFirst()
if g:GetCount()>0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
local tc=g:GetFirst() local e1=Effect.CreateEffect(e:GetHandler())
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
tc:CompleteProcedure() e1:SetCode(EVENT_BE_MATERIAL)
Duel.SpecialSummonComplete() e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
local e1=Effect.CreateEffect(e:GetHandler()) e1:SetReset(RESET_EVENT+0x1620000)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCondition(c20161.ccon)
e1:SetCode(EVENT_BE_MATERIAL) e1:SetOperation(c20161.cop)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) tc:RegisterEffect(e1)
e1:SetReset(RESET_EVENT+0x1620000) end
e1:SetCondition(c20161.ccon)
e1:SetOperation(c20161.cop)
tc:RegisterEffect(e1)
end
else
if Duel.GetLocationCountFromEx(tp)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c20161.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 then
local tc=g:GetFirst()
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
tc:CompleteProcedure()
Duel.SpecialSummonComplete()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BE_MATERIAL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1620000)
e1:SetCondition(c20161.ccon)
e1:SetOperation(c20161.cop)
tc:RegisterEffect(e1)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c20161.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
local tc=g:GetFirst()
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
tc:CompleteProcedure()
Duel.SpecialSummonComplete()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BE_MATERIAL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1620000)
e1:SetCondition(c20161.ccon)
e1:SetOperation(c20161.cop)
tc:RegisterEffect(e1)
end
end
end
end end
function c20161.ccon(e,tp,eg,ep,ev,re,r,rp) function c20161.ccon(e,tp,eg,ep,ev,re,r,rp)
return r==REASON_SYNCHRO return r==REASON_SYNCHRO
end end
function c20161.cop(e,tp,eg,ep,ev,re,r,rp) function c20161.cop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
--leave redirect --leave redirect
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
c:GetReasonCard():RegisterEffect(e1) c:GetReasonCard():RegisterEffect(e1)
end end
-- --
function c20161.valcon(e,re,r,rp) function c20161.valcon(e,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0 return bit.band(r,REASON_EFFECT)~=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