-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc37564005.lua
80 lines (79 loc) · 2.54 KB
/
c37564005.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
--元素精灵·萨尼
local m=37564005
local cm=_G["c"..m]
cm.Senya_name_with_elem=true
function cm.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.condition)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
end
function cm.sdfilter(c)
return c:IsType(TYPE_MONSTER) and c:GetRank()~=4
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():GetControler()~=tp
and not Duel.IsExistingMatchingCard(cm.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then
Duel.NegateAttack()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e2:SetValue(1)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetValue(cm.efilter)
e3:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(e:GetHandler())
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetCountLimit(1)
e4:SetLabel(0)
e4:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN)
e4:SetLabelObject(c)
e4:SetCondition(cm.rmcon)
e4:SetOperation(cm.rmop)
Duel.RegisterEffect(e4,tp)
c:CreateEffectRelation(e4)
end
end
function cm.efilter(e,te)
return te:GetOwner()~=e:GetOwner()
end
function cm.rmcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetLabelObject()
return Duel.GetTurnCount()~=e:GetLabel() and Duel.GetTurnPlayer()==tp and c:IsRelateToEffect(e)
end
function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetLabelObject()
if c:IsRelateToEffect(e) then
Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
end
end