-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc39238953.lua
More file actions
59 lines (59 loc) · 1.95 KB
/
c39238953.lua
File metadata and controls
59 lines (59 loc) · 1.95 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--天声の服従
function c39238953.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c39238953.cost)
e1:SetTarget(c39238953.target)
e1:SetOperation(c39238953.activate)
c:RegisterEffect(e1)
end
function c39238953.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,2000) end
Duel.PayLPCost(tp,2000)
end
function c39238953.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,0,LOCATION_DECK,1,nil)
or Duel.IsPlayerCanSpecialSummon(tp) end
Duel.Hint(HINT_SELECTMSG,tp,564)
local ac=Duel.AnnounceCard(tp,TYPE_MONSTER)
Duel.SetTargetParam(ac)
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,ANNOUNCE_CARD)
end
function c39238953.activate(e,tp,eg,ep,ev,re,r,rp)
local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
local g=Duel.GetFieldGroup(tp,0,LOCATION_DECK)
if g:GetCount()<1 then return end
Duel.ConfirmCards(1-tp,g)
Duel.Hint(HINT_SELECTMSG,1-tp,526)
local sg=g:FilterSelect(1-tp,Card.IsCode,1,1,nil,ac)
local tc=sg:GetFirst()
if tc then
Duel.ConfirmCards(tp,sg)
local b1=tc:IsAbleToHand()
local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and tc:IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEUP_ATTACK,tp)
local sel=0
if b1 and b2 then
Duel.Hint(HINT_SELECTMSG,1-tp,555)
sel=Duel.SelectOption(1-tp,aux.Stringid(39238953,0),aux.Stringid(39238953,1))+1
elseif b1 then
Duel.Hint(HINT_SELECTMSG,1-tp,555)
sel=Duel.SelectOption(1-tp,aux.Stringid(39238953,0))+1
elseif b2 then
Duel.Hint(HINT_SELECTMSG,1-tp,555)
sel=Duel.SelectOption(1-tp,aux.Stringid(39238953,1))+2
end
if sel==1 then
Duel.SendtoHand(sg,tp,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
elseif sel==2 then
Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP_ATTACK)
end
else
Duel.ConfirmCards(tp,g)
end
Duel.ShuffleDeck(1-tp)
end