Commit 21ec9e5d authored by oilloillo's avatar oilloillo

fix setType

parent 0e537522
--深绿结界 --深绿结界
local M = c999007 local M = c999007
local Mid = 999007 local Mid = 999007
function M.initial_effect(c) function M.initial_effect(c)
--Activate --Activate
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN) e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0) c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetDescription(aux.Stringid(Mid, 0)) e1:SetDescription(aux.Stringid(Mid, 0))
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetRange(LOCATION_SZONE) e1:SetRange(LOCATION_SZONE)
e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(M.sptg) e1:SetTarget(M.sptg)
e1:SetOperation(M.spop) e1:SetOperation(M.spop)
e1:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE) e1:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=e1:Clone() local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2) c:RegisterEffect(e2)
-- to hand -- to hand
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetDescription(aux.Stringid(Mid, 1)) e3:SetDescription(aux.Stringid(Mid, 1))
e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_GRAVE+LOCATION_DECK) e3:SetRange(LOCATION_GRAVE+LOCATION_DECK)
e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetCountLimit(1, Mid) e3:SetCountLimit(1, Mid)
e3:SetCost(M.thcost) e3:SetCost(M.thcost)
e3:SetTarget(M.thtg) e3:SetTarget(M.thtg)
e3:SetOperation(M.thop) e3:SetOperation(M.thop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function M.spfliter(c, tp) function M.spfliter(c, tp)
return c:IsLocation(LOCATION_MZONE) and c:GetSummonPlayer() == tp and c:IsCanBeFusionMaterial() and c:IsAbleToGrave() return c:IsLocation(LOCATION_MZONE) and c:GetSummonPlayer() == tp and c:IsCanBeFusionMaterial() and c:IsAbleToGrave()
end end
function M.fusionfilter(c, e, tp, mc, chkf) function M.fusionfilter(c, e, tp, mc, chkf)
return c:IsType(TYPE_FUSION) and c:IsRace(RACE_PLANT) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false) return c:IsType(TYPE_FUSION) and c:IsRace(RACE_PLANT) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false)
and Duel.IsExistingMatchingCard(M.matfilter, tp, LOCATION_DECK+LOCATION_HAND+LOCATION_MZONE, 0, 1, nil, mc, c, chkf) and Duel.IsExistingMatchingCard(M.matfilter, tp, LOCATION_DECK+LOCATION_HAND+LOCATION_MZONE, 0, 1, nil, mc, c, chkf)
and Duel.GetLocationCountFromEx(tp, tp, mc, c) and Duel.GetLocationCountFromEx(tp, tp, mc, c)
end end
function M.matfilter(c, mc, fc, chkf) function M.matfilter(c, mc, fc, chkf)
if not (c:IsCanBeFusionMaterial() and c:IsAbleToGrave()) then return false end if not (c:IsCanBeFusionMaterial() and c:IsAbleToGrave()) then return false end
local mg = Group.FromCards(mc, c) local mg = Group.FromCards(mc, c)
return fc:CheckFusionMaterial(mg, nil, chkf) return fc:CheckFusionMaterial(mg, nil, chkf)
end end
function M.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function M.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if not e:GetHandler():IsOnField() then return false end if not e:GetHandler():IsOnField() then return false end
if not eg or eg:GetCount()==0 then return false end if not eg or eg:GetCount()==0 then return false end
if chk == 0 then if chk == 0 then
local g = eg:Filter(M.spfliter, nil, tp) local g = eg:Filter(M.spfliter, nil, tp)
if g:GetCount() == 1 then if g:GetCount() == 1 then
local chkf = Duel.GetLocationCountFromEx(tp, tp, g:GetFirst(), TYPE_FUSION) > 0 and PLAYER_NONE or tp local chkf = Duel.GetLocationCountFromEx(tp, tp, g:GetFirst(), TYPE_FUSION) > 0 and PLAYER_NONE or tp
return Duel.IsExistingMatchingCard(M.fusionfilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, g:GetFirst(), chkf) return Duel.IsExistingMatchingCard(M.fusionfilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, g:GetFirst(), chkf)
end end
return false return false
end end
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA) Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
end end
function M.spop(e,tp,eg,ep,ev,re,r,rp) function M.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end if not e:GetHandler():IsRelateToEffect(e) then return end
local g = eg:Filter(M.spfliter, nil, tp) local g = eg:Filter(M.spfliter, nil, tp)
if g:GetCount() ~= 1 then return end if g:GetCount() ~= 1 then return end
local chkf = Duel.GetLocationCountFromEx(tp, tp, g:GetFirst(), TYPE_FUSION) > 0 and PLAYER_NONE or tp local chkf = Duel.GetLocationCountFromEx(tp, tp, g:GetFirst(), TYPE_FUSION) > 0 and PLAYER_NONE or tp
local mc = g:GetFirst() local mc = g:GetFirst()
local fg = Duel.GetMatchingGroup(M.fusionfilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mc, chkf) local fg = Duel.GetMatchingGroup(M.fusionfilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mc, chkf)
if fg:GetCount() > 0 then if fg:GetCount() > 0 then
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local fc = fg:Select(tp, 1, 1, nil):GetFirst() local fc = fg:Select(tp, 1, 1, nil):GetFirst()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FMATERIAL)
local mg = Duel.SelectMatchingCard(tp, M.matfilter, tp, LOCATION_DECK+LOCATION_HAND+LOCATION_MZONE, 0, 1, 1, nil, mc, fc, chkf) local mg = Duel.SelectMatchingCard(tp, M.matfilter, tp, LOCATION_DECK+LOCATION_HAND+LOCATION_MZONE, 0, 1, 1, nil, mc, fc, chkf)
mg:Merge(g) mg:Merge(g)
fc:SetMaterial(mg) fc:SetMaterial(mg)
Duel.SendtoGrave(mg, REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.SendtoGrave(mg, REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect() Duel.BreakEffect()
Duel.SpecialSummon(fc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP) Duel.SpecialSummon(fc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP)
fc:CompleteProcedure() fc:CompleteProcedure()
end end
end end
-- --
function M.thcost(e,tp,eg,ep,ev,re,r,rp,chk) function M.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp, 1000) end if chk==0 then return Duel.CheckLPCost(tp, 1000) end
Duel.PayLPCost(tp, 1000) Duel.PayLPCost(tp, 1000)
end end
function M.thfilter(c, tp) function M.thfilter(c, tp)
return c:IsType(TYPE_SYNCHRO) and c:IsSetCard(0xaa6) and c:GetSummonPlayer() == tp return c:IsType(TYPE_SYNCHRO) and c:IsSetCard(0xaa6) and c:GetSummonPlayer() == tp
end end
function M.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function M.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c = e:GetHandler() local c = e:GetHandler()
if chk == 0 then return eg:FilterCount(M.thfilter, nil, tp) > 0 and c:IsAbleToHand() end if chk == 0 then return eg:FilterCount(M.thfilter, nil, tp) > 0 and c:IsAbleToHand() end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, c, 1, tp, c:GetLocation()) Duel.SetOperationInfo(0, CATEGORY_TOHAND, c, 1, tp, c:GetLocation())
end end
function M.thop(e,tp,eg,ep,ev,re,r,rp) function M.thop(e,tp,eg,ep,ev,re,r,rp)
local c = e:GetHandler() local c = e:GetHandler()
if c:IsAbleToHand() and c:IsLocation(LOCATION_GRAVE+LOCATION_DECK) then if c:IsAbleToHand() and c:IsLocation(LOCATION_GRAVE+LOCATION_DECK) then
Duel.SendtoHand(c, nil, REASON_EFFECT) Duel.SendtoHand(c, nil, REASON_EFFECT)
Duel.ConfirmCards(1-tp, c) Duel.ConfirmCards(1-tp, c)
end 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