/
c75719089.lua
40 lines (40 loc) · 1.6 KB
/
c75719089.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
--栄光の聖騎士団
function c75719089.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,75719089+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c75719089.target)
e1:SetOperation(c75719089.activate)
c:RegisterEffect(e1)
end
function c75719089.filter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x107a)
and Duel.IsExistingMatchingCard(c75719089.eqfilter,tp,LOCATION_DECK,0,1,nil,c,tp)
end
function c75719089.eqfilter(c,tc,tp)
return c:IsType(TYPE_EQUIP) and c:CheckEquipTarget(tc) and c:CheckUniqueOnField(tp) and not c:IsForbidden()
end
function c75719089.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c75719089.filter(chkc,tp) end
local ft=0
if e:GetHandler():IsLocation(LOCATION_HAND) then ft=1 end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>ft
and Duel.IsExistingTarget(c75719089.filter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c75719089.filter,tp,LOCATION_MZONE,0,1,1,nil,tp)
end
function c75719089.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,c75719089.eqfilter,tp,LOCATION_DECK,0,1,1,nil,tc,tp)
if g:GetCount()>0 then
Duel.Equip(tp,g:GetFirst(),tc)
end
end
end