/
c34487429.lua
135 lines (135 loc) · 4.97 KB
/
c34487429.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
--虹の古代都市-レインボー・ルイン
function c34487429.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--Destroy replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetRange(LOCATION_FZONE)
e2:SetCondition(c34487429.desrepcon)
e2:SetValue(1)
c:RegisterEffect(e2)
--Negate
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(34487429,1))
e3:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_CHAINING)
e3:SetRange(LOCATION_FZONE)
e3:SetCondition(c34487429.discon)
e3:SetCost(c34487429.discost)
e3:SetTarget(c34487429.distg)
e3:SetOperation(c34487429.disop)
c:RegisterEffect(e3)
--draw
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(34487429,2))
e4:SetCategory(CATEGORY_DRAW)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_FZONE)
e4:SetCountLimit(1)
e4:SetCondition(c34487429.drcon)
e4:SetTarget(c34487429.drtg)
e4:SetOperation(c34487429.drop)
c:RegisterEffect(e4)
--special summon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(34487429,3))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_FZONE)
e5:SetCountLimit(1)
e5:SetCondition(c34487429.spcon)
e5:SetTarget(c34487429.sptg)
e5:SetOperation(c34487429.spop)
c:RegisterEffect(e5)
--damage reduce
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(34487429,0))
e6:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e6:SetRange(LOCATION_FZONE)
e6:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e6:SetCondition(c34487429.rdcon)
e6:SetOperation(c34487429.rdop)
c:RegisterEffect(e6)
end
function c34487429.filter1(c)
return c:IsFaceup() and c:IsSetCard(0x1034)
end
function c34487429.desrepcon(e)
return Duel.IsExistingMatchingCard(c34487429.filter1,e:GetHandler():GetControler(),LOCATION_SZONE,0,1,nil)
end
function c34487429.discon(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_SZONE,0,3,nil,0x1034)
end
function c34487429.filter2(c)
return c:IsFaceup() and c:IsSetCard(0x1034) and c:IsAbleToGraveAsCost()
end
function c34487429.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c34487429.filter2,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c34487429.filter2,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c34487429.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c34487429.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
function c34487429.drcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c34487429.filter1,tp,LOCATION_SZONE,0,4,nil)
end
function c34487429.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c34487429.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c34487429.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c34487429.filter1,tp,LOCATION_SZONE,0,5,nil)
end
function c34487429.filter3(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0x1034) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c34487429.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(tp) and c34487429.filter3(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c34487429.filter3,tp,LOCATION_SZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c34487429.filter3,tp,LOCATION_SZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c34487429.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
function c34487429.rdcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp and e:GetHandler():GetFlagEffect(34487429)==0
and Duel.IsExistingMatchingCard(c34487429.filter1,tp,LOCATION_SZONE,0,2,nil)
end
function c34487429.rdop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectEffectYesNo(tp,e:GetHandler()) then
Duel.ChangeBattleDamage(tp,math.floor(ev/2))
e:GetHandler():RegisterFlagEffect(34487429,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
end