forked from Fluorohydride/ygopro-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc10691144.lua
More file actions
64 lines (64 loc) · 2 KB
/
c10691144.lua
File metadata and controls
64 lines (64 loc) · 2 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
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
--氷結界の鏡
function c10691144.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(c10691144.activate)
c:RegisterEffect(e1)
end
function c10691144.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,10691144)~=0 then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_REMOVE)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetCondition(c10691144.rmcon)
e1:SetOperation(c10691144.rmop)
Duel.RegisterEffect(e1,tp)
Duel.RegisterFlagEffect(tp,10691144,RESET_PHASE+PHASE_END,0,1)
end
function c10691144.rmcon(e,tp,eg,ep,ev,re,r,rp)
if not (re:GetOwnerPlayer()==1-tp and re:IsActiveType(TYPE_MONSTER) and re:IsActivated()) then
return false
end
local flag=0
local tc=eg:GetFirst()
while tc do
local ploc=tc:GetPreviousLocation()
if tc:GetPreviousControler()==tp and bit.band(ploc,0x1e)~=0 then
flag=bit.bor(flag,ploc)
end
tc=eg:GetNext()
end
e:SetLabel(flag)
return flag~=0
end
function c10691144.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup()
local flag=e:GetLabel()
if bit.band(flag,LOCATION_HAND)~=0 then
local rg=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_HAND,nil)
if rg:GetCount()>0 then
local ct=1
if rg:GetCount()>1 then ct=Duel.SelectOption(tp,aux.Stringid(10691144,3),aux.Stringid(10691144,4))+1 end
g:Merge(rg:RandomSelect(tp,ct))
end
end
if bit.band(flag,LOCATION_ONFIELD)~=0 then
local rg=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,nil)
if rg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
g:Merge(rg:Select(tp,1,2,nil))
end
end
if bit.band(flag,LOCATION_GRAVE)~=0 then
local rg=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,nil)
if rg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
g:Merge(rg:Select(tp,1,2,nil))
end
end
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end