Commit af801c37 authored by POLYMER's avatar POLYMER

fix

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