Commit ddccb34e authored by REIKAI's avatar REIKAI 💬

Update c16162000.lua

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