/
c74611888.lua
33 lines (33 loc) · 1.24 KB
/
c74611888.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
--手のひら返し
function c74611888.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_POSITION)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCondition(c74611888.condition)
e1:SetTarget(c74611888.target)
e1:SetOperation(c74611888.activate)
c:RegisterEffect(e1)
end
function c74611888.cfilter(c)
return c:IsFaceup() and not c:IsLevel(c:GetOriginalLevel()) and c:IsLevelAbove(1)
end
function c74611888.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c74611888.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
end
function c74611888.filter(c)
return c:IsFaceup() and c:IsCanTurnSet()
end
function c74611888.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c74611888.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(c74611888.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c74611888.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c74611888.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()>0 then
Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE)
end
end