Commit f7c0464e authored by mercury233's avatar mercury233

fix

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