-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathc16329071.lua
More file actions
41 lines (41 loc) · 1.72 KB
/
Copy pathc16329071.lua
File metadata and controls
41 lines (41 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--星遺物に蠢く罠
function c16329071.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,16329071+EFFECT_COUNT_CODE_OATH)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c16329071.target)
e1:SetOperation(c16329071.activate)
c:RegisterEffect(e1)
end
function c16329071.filter(c)
return c:IsSetCard(0xfe) and not c:IsCode(16329071) and (c:IsLocation(LOCATION_HAND+LOCATION_GRAVE) or c:IsFaceup()) and c:IsAbleToDeck()
end
function c16329071.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c16329071.filter,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_ONFIELD+LOCATION_REMOVED,0,nil)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2)
and g:GetClassCount(Card.GetCode)>=5 end
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,5,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function c16329071.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c16329071.filter),tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_ONFIELD+LOCATION_REMOVED,0,nil)
if g:GetClassCount(Card.GetCode)<5 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=g:WithCheckSpec(aux.dncheck_spec):SelectSubGroup(tp,aux.TRUE,false,5,5)
local cg=sg:Filter(Card.IsLocation,nil,LOCATION_HAND)
if cg:GetCount()>0 then
Duel.ConfirmCards(1-tp,cg)
end
Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
local og=Duel.GetOperatedGroup()
if og:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
if ct==5 then
Duel.BreakEffect()
Duel.Draw(tp,2,REASON_EFFECT)
end
end