/
c39037517.lua
75 lines (75 loc) · 2.55 KB
/
c39037517.lua
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--コアキメイル・ビートル
function c39037517.initial_effect(c)
aux.AddCodeList(c,36623431)
--cost
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c39037517.mtcon)
e1:SetOperation(c39037517.mtop)
c:RegisterEffect(e1)
--poschange
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(39037517,3))
e2:SetCategory(CATEGORY_POSITION)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(c39037517.target)
e2:SetOperation(c39037517.operation)
c:RegisterEffect(e2)
end
function c39037517.mtcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c39037517.cfilter1(c)
return c:IsCode(36623431) and c:IsAbleToGraveAsCost()
end
function c39037517.cfilter2(c)
return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_INSECT) and not c:IsPublic()
end
function c39037517.mtop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.HintSelection(Group.FromCards(c))
local g1=Duel.GetMatchingGroup(c39037517.cfilter1,tp,LOCATION_HAND,0,nil)
local g2=Duel.GetMatchingGroup(c39037517.cfilter2,tp,LOCATION_HAND,0,nil)
local select=2
if g1:GetCount()>0 and g2:GetCount()>0 then
select=Duel.SelectOption(tp,aux.Stringid(39037517,0),aux.Stringid(39037517,1),aux.Stringid(39037517,2))
elseif g1:GetCount()>0 then
select=Duel.SelectOption(tp,aux.Stringid(39037517,0),aux.Stringid(39037517,2))
if select==1 then select=2 end
elseif g2:GetCount()>0 then
select=Duel.SelectOption(tp,aux.Stringid(39037517,1),aux.Stringid(39037517,2))+1
else
select=Duel.SelectOption(tp,aux.Stringid(39037517,2))
select=2
end
if select==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=g1:Select(tp,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
elseif select==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g=g2:Select(tp,1,1,nil)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
else
Duel.Destroy(c,REASON_COST)
end
end
function c39037517.filter(c,e)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)
and (not e or c:IsRelateToEffect(e))
end
function c39037517.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c39037517.filter,1,nil) end
Duel.SetTargetCard(eg)
end
function c39037517.operation(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c39037517.filter,nil,e)
Duel.ChangePosition(g,POS_FACEUP_DEFENSE)
end