Commit 31c61cce authored by mercury233's avatar mercury233 Committed by GitHub

update Auxiliary.EnableNeosReturn (#1856)

parent 6dbef078
......@@ -12,7 +12,7 @@ function c40080312.initial_effect(c)
e1:SetValue(c40080312.splimit)
c:RegisterEffect(e1)
--return
aux.EnableNeosReturn(c,c40080312.retop)
aux.EnableNeosReturn(c,c40080312.retop,c40080312.set_category)
--draw
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(40080312,1))
......@@ -28,6 +28,11 @@ c40080312.material_setcode=0x8
function c40080312.splimit(e,se,sp,st)
return not e:GetHandler():IsLocation(LOCATION_EXTRA)
end
function c40080312.set_category(e,tp,eg,ep,ev,re,r,rp)
e:SetCategory(CATEGORY_TODECK+CATEGORY_REMOVE)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler(),tp,POS_FACEDOWN)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
end
function c40080312.retop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
......
......@@ -12,7 +12,7 @@ function c90050480.initial_effect(c)
e1:SetValue(c90050480.splimit)
c:RegisterEffect(e1)
--return
aux.EnableNeosReturn(c,c90050480.retop)
aux.EnableNeosReturn(c,c90050480.retop,c90050480.set_category)
--act limit
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(90050480,1))
......@@ -31,6 +31,11 @@ end
function c90050480.splimit(e,se,sp,st)
return not e:GetHandler():IsLocation(LOCATION_EXTRA)
end
function c90050480.set_category(e,tp,eg,ep,ev,re,r,rp)
e:SetCategory(CATEGORY_TODECK+CATEGORY_DESTROY)
local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function c90050480.retop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
......
......@@ -211,7 +211,7 @@ function Auxiliary.SpiritReturnOperation(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
function Auxiliary.EnableNeosReturn(c,operation)
function Auxiliary.EnableNeosReturn(c,operation,set_category)
--return
local e1=Effect.CreateEffect(c)
e1:SetDescription(1105)
......@@ -221,29 +221,35 @@ function Auxiliary.EnableNeosReturn(c,operation)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(Auxiliary.NeosReturnConditionForced)
e1:SetTarget(Auxiliary.NeosReturnTargetForced)
e1:SetTarget(Auxiliary.NeosReturnTargetForced(set_category))
e1:SetOperation(operation)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCondition(Auxiliary.NeosReturnConditionOptional)
e2:SetTarget(Auxiliary.NeosReturnTargetOptional)
e2:SetTarget(Auxiliary.NeosReturnTargetOptional(set_category))
c:RegisterEffect(e2)
return e1,e2
end
function Auxiliary.NeosReturnConditionForced(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsHasEffect(42015635)
end
function Auxiliary.NeosReturnTargetForced(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
function Auxiliary.NeosReturnTargetForced(set_category)
return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
if set_category then set_category(e,tp,eg,ep,ev,re,r,rp) end
end
end
function Auxiliary.NeosReturnConditionOptional(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsHasEffect(42015635)
end
function Auxiliary.NeosReturnTargetOptional(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToExtra() end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
function Auxiliary.NeosReturnTargetOptional(set_category)
return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToExtra() end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
if set_category then set_category(e,tp,eg,ep,ev,re,r,rp) end
end
end
function Auxiliary.IsUnionState(effect)
local c=effect:GetHandler()
......
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