Commit f7c0464e authored by mercury233's avatar mercury233

fix

parent 62e05118
...@@ -8,11 +8,11 @@ function c100265056.initial_effect(c) ...@@ -8,11 +8,11 @@ function c100265056.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--choose effect --choose effect
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW+CATEGORY_TOGRAVE+CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCountLimit(1,100265056)
e2:SetCondition(c100265056.effcon) e2:SetCondition(c100265056.effcon)
e2:SetTarget(c100265056.efftg) e2:SetTarget(c100265056.efftg)
e2:SetOperation(c100265056.effop) e2:SetOperation(c100265056.effop)
...@@ -31,22 +31,32 @@ function c100265056.effcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -31,22 +31,32 @@ function c100265056.effcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c100265056.cfilter,1,nil) return eg:IsExists(c100265056.cfilter,1,nil)
end end
function c100265056.efftg(e,tp,eg,ep,ev,re,r,rp,chk) function c100265056.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=Duel.IsPlayerCanDraw(tp,1) and (Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x1)==0) if chk==0 then
local b2=Duel.IsExistingMatchingCard(c100265056.setfilter,tp,LOCATION_DECK,0,1,nil) and (Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x2)==0) if Duel.GetFlagEffect(tp,100265056)==0 then
local b3=Duel.IsExistingMatchingCard(c100265056.tgfilter,tp,0,LOCATION_MZONE,1,nil) and (Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x4)==0) Duel.RegisterFlagEffect(tp,100265056,RESET_PHASE+PHASE_END,0,1)
local b4=(Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x8)==0) end
if chk==0 then return b1 or b2 or b3 or b4 end local flag=Duel.GetFlagEffectLabel(tp,100265056)
local b1=Duel.IsPlayerCanDraw(tp,1) and bit.band(flag,0x1)==0
local b2=Duel.IsExistingMatchingCard(c100265056.setfilter,tp,LOCATION_DECK,0,1,nil) and bit.band(flag,0x2)==0
local b3=Duel.IsExistingMatchingCard(c100265056.tgfilter,tp,0,LOCATION_MZONE,1,nil) and bit.band(flag,0x4)==0
local b4=bit.band(flag,0x8)==0
return Duel.GetFlagEffect(tp,100265156)==0 and (b1 or b2 or b3 or b4)
end
Duel.RegisterFlagEffect(tp,100265156,RESET_CHAIN,0,1)
end end
function c100265056.effop(e,tp,eg,ep,ev,re,r,rp) function c100265056.effop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end if Duel.GetFlagEffect(tp,100265056)==0 then
Duel.RegisterFlagEffect(tp,100265056,RESET_PHASE+PHASE_END,0,1)
end
local flag=Duel.GetFlagEffectLabel(tp,100265056)
local off=1 local off=1
local ops={} local ops={}
local opval={} local opval={}
local b1=Duel.IsPlayerCanDraw(tp,1) and (Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x1)==0) local b1=Duel.IsPlayerCanDraw(tp,1) and bit.band(flag,0x1)==0
local b2=Duel.IsExistingMatchingCard(c100265056.setfilter,tp,LOCATION_DECK,0,1,nil) and (Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x2)==0) local b2=Duel.IsExistingMatchingCard(c100265056.setfilter,tp,LOCATION_DECK,0,1,nil) and bit.band(flag,0x2)==0
local b3=Duel.IsExistingMatchingCard(c100265056.tgfilter,tp,0,LOCATION_MZONE,1,nil) and (Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x4)==0) local b3=Duel.IsExistingMatchingCard(c100265056.tgfilter,tp,0,LOCATION_MZONE,1,nil) and bit.band(flag,0x4)==0
local b4=(Duel.GetFlagEffect(tp,100265056)<=0 or bit.band(Duel.GetFlagEffectLabel(tp,100265056),0x8)==0) local b4=bit.band(flag,0x8)==0
if b1 then if b1 then
ops[off]=aux.Stringid(100265056,0) ops[off]=aux.Stringid(100265056,0)
opval[off-1]=1 opval[off-1]=1
...@@ -67,23 +77,18 @@ function c100265056.effop(e,tp,eg,ep,ev,re,r,rp) ...@@ -67,23 +77,18 @@ function c100265056.effop(e,tp,eg,ep,ev,re,r,rp)
opval[off-1]=4 opval[off-1]=4
off=off+1 off=off+1
end end
local sel=Duel.SelectOption(tp,table.unpack(ops))+1 local op=Duel.SelectOption(tp,table.unpack(ops))
local sel=opval[op]
if sel==1 then if sel==1 then
Duel.Draw(tp,1,REASON_EFFECT) Duel.Draw(tp,1,REASON_EFFECT)
if Duel.GetFlagEffect(tp,100265056)<=0 then Duel.SetFlagEffectLabel(tp,100265056,flag|0x1)
Duel.RegisterFlagEffect(tp,100265056,RESET_PHASE+PHASE_END,0,1)
end
Duel.SetFlagEffectLabel(tp,100265056,Duel.GetFlagEffectLabel(tp,100265056)|0x1)
elseif sel==2 then elseif sel==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,c100265056.setfilter,tp,LOCATION_DECK,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,c100265056.setfilter,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then if #g>0 then
Duel.SSet(tp,g) Duel.SSet(tp,g)
end end
if Duel.GetFlagEffect(tp,100265056)<=0 then Duel.SetFlagEffectLabel(tp,100265056,flag|0x2)
Duel.RegisterFlagEffect(tp,100265056,RESET_PHASE+PHASE_END,0,1)
end
Duel.SetFlagEffectLabel(tp,100265056,Duel.GetFlagEffectLabel(tp,100265056)|0x2)
elseif sel==3 then elseif sel==3 then
local g=Duel.GetMatchingGroup(c100265056.tgfilter,tp,0,LOCATION_MZONE,nil) local g=Duel.GetMatchingGroup(c100265056.tgfilter,tp,0,LOCATION_MZONE,nil)
if #g>0 then if #g>0 then
...@@ -97,15 +102,9 @@ function c100265056.effop(e,tp,eg,ep,ev,re,r,rp) ...@@ -97,15 +102,9 @@ function c100265056.effop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(tg,REASON_EFFECT) Duel.SendtoGrave(tg,REASON_EFFECT)
end end
end end
if Duel.GetFlagEffect(tp,100265056)<=0 then Duel.SetFlagEffectLabel(tp,100265056,flag|0x4)
Duel.RegisterFlagEffect(tp,100265056,RESET_PHASE+PHASE_END,0,1)
end
Duel.SetFlagEffectLabel(tp,100265056,Duel.GetFlagEffectLabel(tp,100265056)|0x4)
else else
Duel.Damage(1-tp,800,REASON_EFFECT) Duel.Damage(1-tp,800,REASON_EFFECT)
if Duel.GetFlagEffect(tp,100265056)<=0 then Duel.SetFlagEffectLabel(tp,100265056,flag|0x8)
Duel.RegisterFlagEffect(tp,100265056,RESET_PHASE+PHASE_END,0,1)
end
Duel.SetFlagEffectLabel(tp,100265056,Duel.GetFlagEffectLabel(tp,100265056)|0x8)
end end
end end
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