-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathc7405310.lua
More file actions
33 lines (33 loc) · 1.14 KB
/
Copy pathc7405310.lua
File metadata and controls
33 lines (33 loc) · 1.14 KB
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
--エクストラゲート
function c7405310.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_HANDES_SELF)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c7405310.target)
e1:SetOperation(c7405310.operation)
c:RegisterEffect(e1)
end
function c7405310.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,1,e:GetHandler())
and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_EXTRA,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LVRANK)
local lv=Duel.AnnounceLevel(tp)
e:SetLabel(lv)
end
function c7405310.filter(c,lv)
return c:IsLevel(lv)
end
function c7405310.operation(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerCanRemove(tp) then return end
local g=Duel.GetMatchingGroup(c7405310.filter,1-tp,LOCATION_EXTRA,0,nil,e:GetLabel())
if g:GetCount()~=0 then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_REMOVE)
local rg=g:FilterSelect(1-tp,Card.IsAbleToRemove,1,1,nil)
if rg:GetCount()~=0 then
Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)
end
else
Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT+REASON_DISCARD)
end
end