Commit ddccb34e authored by REIKAI's avatar REIKAI 💬

Update c16162000.lua

parent b902a59b
Pipeline #16686 passed with stages
in 26 minutes and 27 seconds
--外星人研究院 --外星人研究院
local m=16162000 local m=16162000
local cm=_G["c"..m] local cm=_G["c"..m]
Duel.LoadScript("c16199990.lua") Duel.LoadScript("c16199990.lua")
function cm.initial_effect(c) function cm.initial_effect(c)
c:EnableCounterPermit(0x100e) c:EnableCounterPermit(0x100e)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.target) e1:SetTarget(cm.target)
e1:SetOperation(cm.activate) e1:SetOperation(cm.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--add counter --add counter
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_TO_GRAVE) e2:SetCode(EVENT_TO_GRAVE)
e2:SetRange(LOCATION_FZONE) e2:SetRange(LOCATION_FZONE)
e2:SetOperation(cm.acop) e2:SetOperation(cm.acop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
local e3=e2:Clone() local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3) c:RegisterEffect(e3)
local e4=e2:Clone() local e4=e2:Clone()
e4:SetCode(EVENT_SUMMON_SUCCESS) e4:SetCode(EVENT_SUMMON_SUCCESS)
c:RegisterEffect(e4) c:RegisterEffect(e4)
--to hand --to hand
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION) e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_FZONE) e3:SetRange(LOCATION_FZONE)
e3:SetCountLimit(1) e3:SetCountLimit(1)
e3:SetCost(cm.thcost) e3:SetCost(cm.thcost)
e3:SetTarget(cm.thtg) e3:SetTarget(cm.thtg)
e3:SetOperation(cm.thop) e3:SetOperation(cm.thop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
cm.counter_add_list={0x100e} cm.counter_add_list={0x100e}
function cm.filter(c) function cm.filter(c)
return c:IsListedACounter() and c:IsAbleToHand() return c:IsListedACounter() and c:IsAbleToHand()
end end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
end end
end end
function cm.cfilter(c) function cm.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsListedACounter() and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) return c:IsType(TYPE_MONSTER) and c:IsListedACounter() and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
end end
function cm.acop(e,tp,eg,ep,ev,re,r,rp) function cm.acop(e,tp,eg,ep,ev,re,r,rp)
local ct=eg:FilterCount(cm.cfilter,nil) local ct=eg:FilterCount(cm.cfilter,nil)
if ct>0 then if ct>0 then
e:GetHandler():AddCounter(0x100e,ct,true) e:GetHandler():AddCounter(0x100e,ct,true)
end end
end end
function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100) e:SetLabel(100)
return true return true
end end
function cm.gfilter(g,tp,c) function cm.gfilter(g,tp,c)
local ct=g:GetSum(Card.GetLevel) local ct=g:GetSum(Card.GetLevel)
return c:IsCanRemoveCounter(0x100e,ct,REASON_COST) return c:IsCanRemoveCounter(tp,0x100e,ct,REASON_COST)
end end
function cm.gfilter2(g,lv) function cm.gfilter2(g,lv)
local ct=g:GetSum(Card.GetLevel) local ct=g:GetSum(Card.GetLevel)
return ct <= lv return ct <= lv
end end
function cm.spcheck(c,e,tp) function cm.spcheck(c,e,tp)
return c:IsListedACounter() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsListedACounter() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
local g=Duel.GetMatchingGroup(cm.spcheck,tp,LOCATION_HAND+LOCATION_GRAVE,0,nil,e,tp) local g=Duel.GetMatchingGroup(cm.spcheck,tp,LOCATION_HAND+LOCATION_GRAVE,0,nil,e,tp)
local count = Duel.GetLocationCount(tp,LOCATION_MZONE) local count = Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then if Duel.IsPlayerAffectedByEffect(tp,59822133) then
count = 1 count = 1
end end
if chk==0 then if chk==0 then
if e:GetLabel() == 100 then if e:GetLabel() == 100 then
return g:CheckSubGroup(cm.gfilter,1,count,tp,c) return g:CheckSubGroup(cm.gfilter,1,count,tp,c)
else else
return false return false
end end
end end
local ct1 = c:GetCounter(0x100e) local ct1 = c:GetCounter(0x100e)
c:RemoveCounter(tp,0x100e,ct1,REASON_COST) c:RemoveCounter(tp,0x100e,ct1,REASON_COST)
Duel.SetTargetParam(ct1) Duel.SetTargetParam(ct1)
e:SetLabel(0) e:SetLabel(0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end end
function cm.thop(e,tp,eg,ep,ev,re,r,rp) function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local level = Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) local level = Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
local g=Duel.GetMatchingGroup(cm.spcheck,tp,LOCATION_HAND+LOCATION_GRAVE,0,nil,e,tp) local g=Duel.GetMatchingGroup(cm.spcheck,tp,LOCATION_HAND+LOCATION_GRAVE,0,nil,e,tp)
local count = Duel.GetLocationCount(tp,LOCATION_MZONE) local count = Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then if Duel.IsPlayerAffectedByEffect(tp,59822133) then
count = 1 count = 1
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:SelectSubGroup(tp,cm.gfilter2,false,1,count,level) local sg=g:SelectSubGroup(tp,cm.gfilter2,false,1,count,level)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
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