Commit fd733b60 authored by POLYMER's avatar POLYMER

fix

parent a0c71d7f
...@@ -45,49 +45,49 @@ function cm.initial_effect(c) ...@@ -45,49 +45,49 @@ function cm.initial_effect(c)
e6:SetValue(0x6d) e6:SetValue(0x6d)
c:RegisterEffect(e6) c:RegisterEffect(e6)
end end
function cm.RegisterMergedEvent_ToSingleCard(c,code,events) function cm.RegisterMergedEvent_ToSingleCard(c,code,event)
local g=Group.CreateGroup() local g0=Group.CreateGroup()
g:KeepAlive() g0:KeepAlive()
local g1=Group.CreateGroup()
g1:KeepAlive()
local mt=getmetatable(c) local mt=getmetatable(c)
local seed=0 local seed=event
if type(events) == "table" then
for _, event in ipairs(events) do
seed = seed + event
end
else
seed = events
end
while(mt[seed]==true) do while(mt[seed]==true) do
seed = seed + 1 seed = seed + 1
end end
mt[seed]=true mt[seed]=true
local event_code_single = (code ~ (seed << 16)) | EVENT_CUSTOM local event_code_single = (code ~ (seed << 16)) | EVENT_CUSTOM
if type(events) == "table" then
for _, event in ipairs(events) do
cm.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,event,event_code_single)
end
else
cm.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,events,event_code_single)
end
--listened to again
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e3:SetCode(EVENT_MOVE)
e3:SetLabelObject(g)
e3:SetOperation(cm.ThisCardMovedToPublicResetCheck_ToSingleCard)
c:RegisterEffect(e3)
return event_code_single
end
function cm.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,event,event_code_single)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(event) e1:SetCode(event)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e1:SetRange(0xff) e1:SetRange(0xff)
e1:SetLabel(event_code_single) e1:SetLabel(event_code_single)
e1:SetLabelObject(g) e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
e1:SetOperation(cm.MergedDelayEventCheck1_ToSingleCard) local c=e:GetOwner()
if rp==0 then
g0:Merge(eg:Filter(function(c) return c:IsType(TYPE_MONSTER) end,nil))
elseif rp==1 then
g1:Merge(eg:Filter(function(c) return c:IsType(TYPE_MONSTER) end,nil))
end
if Duel.CheckEvent(EVENT_MOVE) then
local _,meg=Duel.CheckEvent(EVENT_MOVE,true)
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
g0:Clear()
g1:Clear()
end
end
if Duel.GetCurrentChain()==0 and #g0>0 then
local _eg=g0:Clone()
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,0,ep,ev)
g0:Clear()
end
if Duel.GetCurrentChain()==0 and #g1>0 then
local _eg1=g1:Clone()
Duel.RaiseEvent(_eg1,e:GetLabel(),re,r,1,ep,ev)
g1:Clear()
end
end)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--[[local _GetCode=Effect.GetCode --[[local _GetCode=Effect.GetCode
function Effect.GetCode(e,...) function Effect.GetCode(e,...)
...@@ -109,51 +109,45 @@ function cm.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,event,event_code_s ...@@ -109,51 +109,45 @@ function cm.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,event,event_code_s
for _,code in ipairs(ec) do for _,code in ipairs(ec) do
local ce=e1:Clone() local ce=e1:Clone()
ce:SetCode(code) ce:SetCode(code)
ce:SetOperation(cm.MergedDelayEventCheck2_ToSingleCard) ce:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetOwner()
if Duel.CheckEvent(EVENT_MOVE) then
local _,meg=Duel.CheckEvent(EVENT_MOVE,true)
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
g0:Clear()
g1:Clear()
end
end
if #g0>0 then
local _eg=g0:Clone()
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,0,ep,ev)
g0:Clear()
end
if #g1>0 then
local _eg1=g1:Clone()
Duel.RaiseEvent(_eg1,e:GetLabel(),re,r,1,ep,ev)
g1:Clear()
end
end)
c:RegisterEffect(ce) c:RegisterEffect(ce)
end end
end --listened to again
function cm.MergedDelayEventCheck1_ToSingleCard(e,tp,eg,ep,ev,re,r,rp) local e3=Effect.CreateEffect(c)
local g=e:GetLabelObject() e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
local c=e:GetOwner() e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
if rp~=1-tp then return end e3:SetCode(EVENT_MOVE)
g:Merge(eg:Filter(function(c,tp) return c:IsType(TYPE_MONSTER) end,nil)) e3:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
if Duel.CheckEvent(EVENT_MOVE) then local c=e:GetOwner()
local _,meg=Duel.CheckEvent(EVENT_MOVE,true) if c:IsFaceup() or c:IsPublic() then
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then g0:Clear()
g:Clear() g1:Clear()
end end
end end)
if Duel.GetCurrentChain()==0 and #g>0 then c:RegisterEffect(e3)
local _eg=g:Clone() return event_code_single
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,rp,ep,ev)
g:Clear()
end
end
function cm.MergedDelayEventCheck2_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if Duel.CheckEvent(EVENT_MOVE) then
local _,meg=Duel.CheckEvent(EVENT_MOVE,true)
local c=e:GetOwner()
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
g:Clear()
end
end
if #g>0 then
local _eg=g:Clone()
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,rp,ep,ev)
g:Clear()
end
end
function cm.ThisCardMovedToPublicResetCheck_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetOwner()
local g=e:GetLabelObject()
if c:IsFaceup() or c:IsPublic() then
g:Clear()
end
end end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp) function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return true --and rp==1-tp return rp==1-tp
end end
function cm.tgfilter(c) function cm.tgfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsLocation(LOCATION_GRAVE) return c:IsType(TYPE_MONSTER) and c:IsLocation(LOCATION_GRAVE)
...@@ -199,7 +193,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -199,7 +193,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp) function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return true --rp==1-tp return rp==1-tp
end end
function cm.thfilter(c) function cm.thfilter(c)
return c:IsSetCard(0x97b) and c:IsAbleToHand() return c:IsSetCard(0x97b) and c:IsAbleToHand()
......
...@@ -43,7 +43,7 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp) ...@@ -43,7 +43,7 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp)
res=1 res=1
Duel.BreakEffect() Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,s.rmfilter,tp,0,LOCATION_MZONE,1,1,nil) local g=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_MZONE,nil)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT) Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end end
if res==0 if res==0
......
...@@ -77,7 +77,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -77,7 +77,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end end
elseif op==2 then elseif op==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,c,e,tp) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,c,e,tp)
if g:GetCount()>0 then if g:GetCount()>0 then
g:AddCard(c) g:AddCard(c)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
......
...@@ -189,8 +189,10 @@ function s.retop(e,tp,eg,ep,ev,re,r,rp) ...@@ -189,8 +189,10 @@ function s.retop(e,tp,eg,ep,ev,re,r,rp)
if c:GetFlagEffectLabel(id)==fid then if c:GetFlagEffectLabel(id)==fid then
Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_CARD,0,id)
local ex=0x60 local ex=0x60
if not Duel.CheckLocation(pi,LOCATION_MZONE,i) then for i=0,4 do
ex=ex|2^i if not Duel.CheckLocation(pi,LOCATION_MZONE,i) then
ex=ex|2^i
end
end end
if ex==0x7f then if ex==0x7f then
Duel.SendtoGrave(c,REASON_RULE+REASON_RETURN) Duel.SendtoGrave(c,REASON_RULE+REASON_RETURN)
......
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