-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathc160014037.lua
55 lines (55 loc) · 1.89 KB
/
c160014037.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
--昂光天使エッセル
--Rising Light Angel Esser
--scripted by YoshiDuels
local s,id=GetID()
function s.initial_effect(c)
--Send the top 2 cards of your Deck to the GY
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DECKDES+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
--Register when a player Special Summons a monster
aux.GlobalCheck(s,function()
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(s.checkop)
Duel.RegisterEffect(ge1,0)
end)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
for tc in eg:Iter() do
Duel.RegisterFlagEffect(tc:GetSummonPlayer(),id,RESET_PHASE|PHASE_END,0,1)
end
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return not Duel.HasFlagEffect(tp,id)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,2) end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,2)
Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,1-tp,0)
end
function s.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
--Effect
if Duel.DiscardDeck(tp,2,REASON_EFFECT)~=2 then return end
if Duel.GetTurnCount()==2 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp)
and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp)
if #sg>0 then
Duel.BreakEffect()
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
end