-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc77841719.lua
More file actions
44 lines (44 loc) · 1.66 KB
/
c77841719.lua
File metadata and controls
44 lines (44 loc) · 1.66 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
--Evilswarm Coppelia
function c77841719.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--control
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_CONTROL)
e2:SetDescription(aux.Stringid(77841719,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetCondition(c77841719.condition)
e2:SetTarget(c77841719.target)
e2:SetOperation(c77841719.operation)
c:RegisterEffect(e2)
end
function c77841719.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local crp=c:GetReasonPlayer()
return c:IsReason(REASON_EFFECT+REASON_BATTLE) and c:GetPreviousControler()==tp and tp~=crp and crp~=PLAYER_NONE
end
function c77841719.filter(c)
return c:IsFaceup() and c:IsControlerCanBeChanged()
end
function c77841719.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c77841719.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c77841719.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g=Duel.SelectTarget(tp,c77841719.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
end
function c77841719.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local tct=1
if Duel.GetTurnPlayer()~=tp then tct=2
elseif Duel.GetCurrentPhase()==PHASE_END then tct=3 end
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.GetControl(tc,tp,PHASE_END,tct)
end
end