-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathc100000009.lua
113 lines (113 loc) · 3.67 KB
/
c100000009.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
--時械神 ラツィオン
function c100000009.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_DECK)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100000009,0))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetCondition(c100000009.ntcon)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e3:SetValue(1)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e4)
local e5=e3:Clone()
e5:SetCondition(c100000009.damcon)
e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
c:RegisterEffect(e5)
--damage
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e6:SetProperty(EFFECT_FLAG_DELAY)
e6:SetRange(LOCATION_MZONE)
e6:SetCode(EVENT_DRAW)
e6:SetCondition(c100000009.recon)
e6:SetOperation(c100000009.recop)
c:RegisterEffect(e6)
--to deck
local e7=Effect.CreateEffect(c)
e7:SetCategory(CATEGORY_TODECK)
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_PHASE+PHASE_BATTLE)
e7:SetProperty(EFFECT_FLAG_REPEAT)
e7:SetCountLimit(1)
e7:SetRange(LOCATION_MZONE)
e7:SetCondition(c100000009.condition)
e7:SetTarget(c100000009.target)
e7:SetOperation(c100000009.activate)
c:RegisterEffect(e7)
--to deck
local e8=Effect.CreateEffect(c)
e8:SetDescription(aux.Stringid(100000009,1))
e8:SetCategory(CATEGORY_TODECK)
e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e8:SetCode(EVENT_PHASE+PHASE_STANDBY)
e8:SetProperty(EFFECT_FLAG_REPEAT)
e8:SetCountLimit(1)
e8:SetRange(LOCATION_MZONE)
e8:SetCondition(c100000009.tdcon)
e8:SetTarget(c100000009.tdtg)
e8:SetOperation(c100000009.tdop)
c:RegisterEffect(e8)
end
function c100000009.ntcon(e,c)
if c==nil then return true end
return c:GetLevel()>4
and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c100000009.damcon(e)
return e:GetHandler():IsAttackPos()
end
function c100000009.recon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
function c100000009.recop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(1-tp,500,REASON_EFFECT)
end
function c100000009.filter(c)
return c:IsAbleToDeck()
end
function c100000009.condition(e)
local c=e:GetHandler()
return e:GetHandler():GetBattledGroupCount()>0 and
Duel.IsExistingMatchingCard(c100000009.filter,c:GetControler(),0,LOCATION_GRAVE,1,nil)
end
function c100000009.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(c100000009.filter,tp,0,LOCATION_GRAVE,1,c) end
local sg=Duel.GetMatchingGroup(c100000009.filter,tp,0,LOCATION_GRAVE,c)
Duel.SetOperationInfo(0,CATEGORY_TODECK,sg,sg:GetCount(),0,0)
end
function c100000009.activate(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(c100000009.filter,tp,0,LOCATION_GRAVE,e:GetHandler())
Duel.SendtoDeck(sg,nil,sg:GetCount(),REASON_EFFECT)
end
function c100000009.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c100000009.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
end
function c100000009.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
end
end