-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc84769941.lua
82 lines (82 loc) · 2.87 KB
/
c84769941.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
--Super Anti-Kaiju War Machine Mecha-Dogoran
function c84769941.initial_effect(c)
c:EnableUnsummonable()
c:SetUniqueOnField(1,0,20000000,LOCATION_MZONE)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c84769941.spcon)
c:RegisterEffect(e1)
--equip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(84769941,0))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCategory(CATEGORY_EQUIP)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(c84769941.eqcost)
e2:SetTarget(c84769941.eqtg)
e2:SetOperation(c84769941.eqop)
c:RegisterEffect(e2)
--atk
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetRange(LOCATION_MZONE)
e3:SetValue(c84769941.atkval)
c:RegisterEffect(e3)
end
function c84769941.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0xd3)
end
function c84769941.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c84769941.cfilter,tp,0,LOCATION_MZONE,1,nil)
end
function c84769941.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,1,0x37,2,REASON_COST) end
Duel.RemoveCounter(tp,1,1,0x37,2,REASON_COST)
end
function c84769941.eqfilter(c)
return c:IsSetCard(0xd3) and c:IsType(TYPE_MONSTER)
end
function c84769941.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c84769941.eqfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND)
end
function c84769941.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,c84769941.eqfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc and not tc:IsHasEffect(EFFECT_NECRO_VALLEY) then
if not Duel.Equip(tp,tc,c,true) then return end
tc:RegisterFlagEffect(84769941,RESET_EVENT+0x1fe0000,0,0)
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c84769941.eqlimit)
tc:RegisterEffect(e1)
end
end
function c84769941.eqlimit(e,c)
return e:GetOwner()==c
end
function c84769941.atkfilter(c)
return c:IsSetCard(0xd3) and c:GetAttack()>=0 and c:GetFlagEffect(84769941)~=0
end
function c84769941.atkval(e,c)
local g=e:GetHandler():GetEquipGroup():Filter(c84769941.atkfilter,nil)
return g:GetSum(Card.GetAttack)
end