Commit 5aeea846 authored by Tachibana's avatar Tachibana

eme

parent 4c402fac
Pipeline #6197 passed with stages
in 23 minutes and 56 seconds
......@@ -17,7 +17,7 @@ function cm.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_TO_HAND)
e2:SetRange(LOCATION_PZONE)
e2:SetCountLimit(1)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCondition(cm.ddcon)
e2:SetTarget(cm.ddtg)
e2:SetOperation(cm.ddop)
......@@ -72,23 +72,26 @@ function cm.disop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.ddcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DRAW
return Duel.GetCurrentPhase()~=PHASE_DRAW
end
function cm.posfilter(c)
return c:IsCanChangePosition()
end
function cm.ddfilter(c,tp)
return c:IsControler(1-tp) and c:IsPreviousLocation(LOCATION_DECK)
end
function cm.ddtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,0,nil)
local rg=eg:Filter(cm.ddfilter,nil,tp)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.posfilter(chkc) and rg:GetCount()~=0 end
if chk==0 then return Duel.IsExistingTarget(cm.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,cm.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function cm.ddop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst()
if g:GetCount()>0 and tc:GetPosition()==POS_FACEDOWN_DEFENSE then
Duel.HintSelection(g)
Duel.ChangePosition(g,POS_FACEUP)
elseif g:GetCount()>0 and tc:GetPosition()==POS_FACEUP then
Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE)
end
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
Duel.ChangePosition(tc,POS_FACEUP_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
end
function cm.negcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -9,25 +9,25 @@ function cm.initial_effect(c)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_GRAVE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,m)
e1:SetCost(aux.bfgcost)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
c:RegisterEffect(e1)
end
function cm.posfilter(c)
return c:IsCanChangePosition()
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,0,nil)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.posfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,cm.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst()
if g:GetCount()>0 and tc:GetPosition()==POS_FACEDOWN_DEFENSE then
Duel.HintSelection(g)
Duel.ChangePosition(g,POS_FACEUP)
elseif g:GetCount()>0 and tc:GetPosition()==POS_FACEUP then
Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE)
end
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
Duel.ChangePosition(tc,POS_FACEUP_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment