-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc34467241.lua
More file actions
76 lines (76 loc) · 2.58 KB
/
Copy pathc34467241.lua
File metadata and controls
76 lines (76 loc) · 2.58 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--Levia, Eleanor's Servant
function c34467241.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(34467241,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c34467241.tg)
e1:SetOperation(c34467241.op)
c:RegisterEffect(e1)
--synchro effect
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(34467241,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,0x1c0+TIMING_MAIN_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c34467241.sccon)
e2:SetTarget(c34467241.sctarg)
e2:SetOperation(c34467241.scop)
c:RegisterEffect(e2)
end
function c34467241.filter(c)
return c:IsCode(77366257) and c:IsAbleToHand()
end
function c34467241.filter2(c)
return c:IsCode(77366257) and c:IsFaceup()
end
function c34467241.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c34467241.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c34467241.op(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstMatchingCard(c34467241.filter,tp,LOCATION_DECK,0,nil)
if tc then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
function c34467241.sccon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_CHAINING) and Duel.GetTurnPlayer()~=tp
and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.IsExistingMatchingCard(c34467241.filter2,e:GetHandler():GetControler(),LOCATION_MZONE,0,1,nil)
end
function c34467241.get_synchroable_group(tp)
local tg = Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_MZONE,0,nil,TYPE_TUNER)
local tuner = tg:GetFirst()
local sg=Group.CreateGroup()
while tuner do
local g=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,tuner)
if g then
sg:Merge(g)
end
tuner=tg:GetNext()
end
return sg
end
function c34467241.sctarg(e,tp,eg,ep,ev,re,r,rp,chk)
local sg=c34467241.get_synchroable_group(tp)
if chk==0 then
return sg:GetCount()>0
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,1,tp,LOCATION_EXTRA)
end
function c34467241.scop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetControler()~=tp or not c:IsRelateToEffect(e) then return end
local g=c34467241.get_synchroable_group(tp)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SynchroSummon(tp,sg:GetFirst(),nil)
end
end