/
c71340250.lua
136 lines (136 loc) · 4.77 KB
/
c71340250.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
136
--ミキサーロイド
function c71340250.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71340250,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,71340250)
e1:SetCost(c71340250.cost)
e1:SetTarget(c71340250.target)
e1:SetOperation(c71340250.operation)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71340250,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1,71340251)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(c71340250.spcost)
e2:SetTarget(c71340250.sptg)
e2:SetOperation(c71340250.spop)
c:RegisterEffect(e2)
end
function c71340250.costfilter(c,tp,ft)
return c:IsRace(RACE_MACHINE) and (ft>0 or (c:IsControler(tp) and c:GetSequence()<5)) and (c:IsControler(tp) or c:IsFaceup())
end
function c71340250.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then return ft>-1 and Duel.CheckReleaseGroup(tp,c71340250.costfilter,1,nil,tp,ft) end
local sg=Duel.SelectReleaseGroup(tp,c71340250.costfilter,1,1,nil,tp,ft)
Duel.Release(sg,REASON_COST)
end
function c71340250.filter(c,e,tp)
return c:IsSetCard(0x16) and c:IsNonAttribute(ATTRIBUTE_WIND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c71340250.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71340250.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c71340250.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c71340250.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c71340250.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
return true
end
function c71340250.cfilter(c)
return c:IsRace(RACE_MACHINE) and c:IsAbleToRemoveAsCost()
end
function c71340250.spfilter(c,e,tp,lv)
return c:IsSetCard(0x16) and c:IsType(TYPE_FUSION) and c:IsLevelBelow(lv)
and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function c71340250.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
if e:GetLabel()~=100 then return false end
e:SetLabel(0)
local cg=Duel.GetMatchingGroup(c71340250.cfilter,tp,LOCATION_GRAVE,0,nil)
return c:IsAbleToRemoveAsCost()
and Duel.IsExistingMatchingCard(c71340250.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,cg:GetCount())
end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
local cg=Duel.GetMatchingGroup(c71340250.cfilter,tp,LOCATION_GRAVE,0,nil)
local tg=Duel.GetMatchingGroup(c71340250.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp,cg:GetCount())
local lvt={}
local tc=tg:GetFirst()
while tc do
local tlv=0
tlv=tlv+tc:GetLevel()
lvt[tlv]=tlv
tc=tg:GetNext()
end
local pc=1
for i=1,12 do
if lvt[i] then lvt[i]=nil lvt[pc]=i pc=pc+1 end
end
lvt[pc]=nil
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(71340250,2))
local lv=Duel.AnnounceNumber(tp,table.unpack(lvt))
local rg1=Group.CreateGroup()
if lv>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg2=cg:Select(tp,lv-1,lv-1,c)
rg1:Merge(rg2)
end
rg1:AddCard(c)
Duel.Remove(rg1,POS_FACEUP,REASON_COST)
e:SetLabel(lv)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c71340250.sfilter(c,e,tp,lv)
return c:IsSetCard(0x16) and c:IsType(TYPE_FUSION) and c:IsLevel(lv)
and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function c71340250.spop(e,tp,eg,ep,ev,re,r,rp)
local lv=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c71340250.sfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,lv)
local tc=g:GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)~=0 then
local fid=e:GetHandler():GetFieldID()
tc:RegisterFlagEffect(71340250,RESET_EVENT+RESETS_STANDARD,0,1,fid)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(tc)
e1:SetCondition(c71340250.descon)
e1:SetOperation(c71340250.desop)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
function c71340250.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffectLabel(71340250)==e:GetLabel() then
return true
else
e:Reset()
return false
end
end
function c71340250.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.Destroy(tc,REASON_EFFECT)
end