Commit af801c37 authored by POLYMER's avatar POLYMER

fix

parent f4022f78
local s,id=GetID() local s,id=GetID()
function s.initial_effect(c) function s.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_SZONE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END+TIMING_END_PHASE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,id)
e1:SetTarget(s.distg)
e1:SetOperation(s.disop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1)) e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY)
e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_DESTROYED) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1,id+1) e2:SetRange(LOCATION_SZONE)
e2:SetTarget(s.relog) e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetOperation(s.retop) e2:SetCountLimit(1,id)
e2:SetTarget(s.distg)
e2:SetOperation(s.disop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCountLimit(1,id+1)
e3:SetTarget(s.relog)
e3:SetOperation(s.retop)
c:RegisterEffect(e3)
end end
function s.desfilter(c,lv) function s.desfilter(c,lv)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_MONSTER) return c:IsSetCard(0x5f51) and c:IsType(TYPE_MONSTER)
and c:GetLevel()>lv and c:IsDestructable() and c:GetLevel()>lv and c:IsDestructable()
end end
function s.distgfilter(c,tp) function s.distgfilter(c,tp)
local lv=c:GetOriginalLevel() local lv=c:GetOriginalLevel()
return c:IsFaceup() and lv>0 return c:IsFaceup() and lv>0
and Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil,lv) and Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil,lv)
end end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.distgfilter(chkc,tp) end if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.distgfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(s.distgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp) end if chk==0 then return Duel.IsExistingTarget(s.distgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp) end
...@@ -38,13 +49,12 @@ function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -38,13 +49,12 @@ function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DISABLE,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_HAND+LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_HAND+LOCATION_MZONE)
end end
function s.disop(e,tp,eg,ep,ev,re,r,rp) function s.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if not (tc and tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end if not (tc and tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end
local c=e:GetHandler() local c=e:GetHandler()
local lv=tc:GetOriginalLevel() local lv=tc:GetOriginalLevel()
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE) e1:SetCode(EFFECT_DISABLE)
...@@ -56,7 +66,6 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp) ...@@ -56,7 +66,6 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp)
local e3=e1:Clone() local e3=e1:Clone()
e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetCode(EFFECT_DISABLE_EFFECT)
tc:RegisterEffect(e3) tc:RegisterEffect(e3)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil,lv) local dg=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil,lv)
if #dg>0 then if #dg>0 then
...@@ -68,13 +77,14 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp) ...@@ -68,13 +77,14 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(dc,REASON_EFFECT) Duel.Destroy(dc,REASON_EFFECT)
end end
end end
function s.relog(e,tp,eg,ep,ev,re,r,rp,chk) function s.relog(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
end end
function s.retop(e,tp,eg,ep,ev,re,r,rp) function s.retop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then if c:IsRelateToChain() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end end
end 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