Commit 729f7525 authored by Huangnan's avatar Huangnan

fix

parent 57925fbc
Pipeline #33558 passed with stages
in 82 minutes and 2 seconds
No preview for this file type
......@@ -65,7 +65,7 @@ end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
return loc~=LOCATION_MZONE and loc~=LOCATION_SZONE and loc~=LOCATION_FZONE and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
return loc&LOCATION_ONFIELD==0 and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
--乱炖龙仔-龙之舞世界
local s,id,o=GetID()
function s.initial_effect(c)
c:EnableCounterPermit(0x0866)
c:EnableCounterPermit(0x866)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
......@@ -70,7 +70,7 @@ function s.cfilter2(c,tp)
and c:IsSetCard(0x866) and c:IsFaceup()
end
function s.counter(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x1866,2)
e:GetHandler():AddCounter(0x866,2)
end
function s.cncon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.cfilter1,1,nil)
......@@ -79,16 +79,16 @@ function s.cncon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.cfilter2,1,nil,tp)
end
function s.thcost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x1866,2,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x1866,2,REASON_COST)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x866,2,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x866,2,REASON_COST)
end
function s.thcost4(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x1866,4,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x1866,4,REASON_COST)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x866,4,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x866,4,REASON_COST)
end
function s.thcost8(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x1866,8,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x1866,8,REASON_COST)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x866,8,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x866,8,REASON_COST)
end
function s.thfilter1(c)
return c:IsSetCard(0x866) and c:IsAbleToHand() and c:IsType(TYPE_MONSTER)
......
......@@ -3,16 +3,16 @@ local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_ACTIVATING)
e1:SetCode(EVENT_CUSTOM+m)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.spcon)
--e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetRange(LOCATION_MZONE)
--e1:SetCondition(cm.spcon)
e1:SetOperation(cm.bkop)
c:RegisterEffect(e1)
if not cm.global_check then
......@@ -22,27 +22,132 @@ function cm.initial_effect(c)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(cm.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_ACTIVATING)
ge2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
ge2:SetOperation(cm.chkop)
Duel.RegisterEffect(ge2,0)
end
if not cm.NecroceanCheck then
cm.NecroceanCheck=true
local ne1=Effect.CreateEffect(c)
ne1:SetType(EFFECT_TYPE_SINGLE)
ne1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
ne1:SetCondition(cm.syncon)
ne1:SetCode(EFFECT_HAND_SYNCHRO)
ne1:SetTargetRange(0,1)
local ne2=Effect.CreateEffect(c)
ne2:SetType(EFFECT_TYPE_SINGLE)
ne2:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
ne2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
ne2:SetCondition(cm.syncon)
ne2:SetTarget(cm.syntg)
ne2:SetValue(1)
ne2:SetOperation(cm.synop)
local ne3=Effect.CreateEffect(c)
ne3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ne3:SetTargetRange(LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE)
ne3:SetTarget(cm.eftg)
ne3:SetLabelObject(ne1)
Duel.RegisterEffect(ne3,tp)
local ne4=ne3:Clone()
ne4:SetLabelObject(ne2)
Duel.RegisterEffect(ne4,tp)
end
end
function cm.eftg(e,c)
return Duel.GetFlagEffect(0,m+53752000)+Duel.GetFlagEffect(1,m+53752000)>0
end
function cm.synfilter(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function cm.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c)
local ct=g:GetCount()
local res=cm.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c)
return res
end
function cm.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and g:FilterCount(Card.IsLocation,nil,LOCATION_HAND)<=1
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
end
function cm.syncon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.syntg(e,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local tp=syncard:GetControler()
local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
return mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end
function cm.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local lv=syncard:GetLevel()
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
for i=1,maxc do
local cg=mg:Filter(cm.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if cm.syngoal(g,tp,lv,syncard,minc,i) then
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg=cg:Select(tp,minct,99,nil)
if sg:GetCount()==0 then break end
g:Merge(sg)
end
Duel.SetSynchroMaterial(g)
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
--local tp=e:GetHandlerPlayer()
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1)
end
function cm.chkop(e,tp,eg,ep,ev,re,r,rp)
--if not e:GetHandler():IsOnField() then return end
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+m,e,r,rp,ep,ev)
end
function cm.filter(c,tp)
local ocheck=false
if c:GetOriginalCode()==53752002 or (c:GetOriginalCode()>=53752008 and c:GetOriginalCode()<=53752013) then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if c:IsSynchroSummonable(nil) then ocheck=true end
end
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
return c:IsSynchroSummonable(nil,mg)
return c:IsSynchroSummonable(nil,mg) or ocheck==true
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
local g=Duel.GetDecktopGroup(tp,num)
--Debug.Message(tp)
--Debug.Message(g:IsExists(Card.IsAbleToHand,1,nil))
return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
--Debug.Message(Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp))
--Debug.Message(g:GetCount()>=num)
--Debug.Message(Duel.GetMZoneCount(tp)>0)
local gc=false
if Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) then gc=true end
if Duel.GetFlagEffect(tp,m+53752000)~=0 then Duel.ResetFlagEffect(tp,m+53752000) end
return gc and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=e:GetHandlerPlayer()
--local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
if Duel.GetMZoneCount(tp)>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.ConfirmDecktop(tp,num)
......@@ -54,11 +159,26 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil,tp)
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
local spg=ssg:Select(tp,1,1,nil)
local spc=ssg:Select(tp,1,1,nil):GetFirst()
if Duel.GetMZoneCount(tp,c)>0 then
Duel.SynchroSummon(tp,spg:GetFirst(),nil,mg)
local b1=false
local b2=false
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if spc:GetOriginalCode()==53752002 or (spc:GetOriginalCode()>=53752008 and spc:GetOriginalCode()<=53752013) and spc:IsSynchroSummonable(nil) then b1=true end
Duel.ResetFlagEffect(tp,m+53752000)
if spc:IsSynchroSummonable(nil,mg) then b2=true end
local op=aux.SelectFromOptions(tp,
{b1,aux.Stringid(60002404,1)},
{b2,aux.Stringid(60002404,2)})
if op==1 then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
Duel.SynchroSummon(tp,spc,nil)
Duel.ResetFlagEffect(tp,m+53752000)
elseif op==2 then
Duel.SynchroSummon(tp,spc,nil,mg)
end
end
end
else
......
......@@ -3,16 +3,16 @@ local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_ACTIVATING)
e1:SetCode(EVENT_CUSTOM+m)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.spcon)
--e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetRange(LOCATION_MZONE)
--e1:SetCondition(cm.spcon)
e1:SetOperation(cm.bkop)
c:RegisterEffect(e1)
if not cm.global_check then
......@@ -22,27 +22,132 @@ function cm.initial_effect(c)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(cm.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_ACTIVATING)
ge2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
ge2:SetOperation(cm.chkop)
Duel.RegisterEffect(ge2,0)
end
if not cm.NecroceanCheck then
cm.NecroceanCheck=true
local ne1=Effect.CreateEffect(c)
ne1:SetType(EFFECT_TYPE_SINGLE)
ne1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
ne1:SetCondition(cm.syncon)
ne1:SetCode(EFFECT_HAND_SYNCHRO)
ne1:SetTargetRange(0,1)
local ne2=Effect.CreateEffect(c)
ne2:SetType(EFFECT_TYPE_SINGLE)
ne2:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
ne2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
ne2:SetCondition(cm.syncon)
ne2:SetTarget(cm.syntg)
ne2:SetValue(1)
ne2:SetOperation(cm.synop)
local ne3=Effect.CreateEffect(c)
ne3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ne3:SetTargetRange(LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE)
ne3:SetTarget(cm.eftg)
ne3:SetLabelObject(ne1)
Duel.RegisterEffect(ne3,tp)
local ne4=ne3:Clone()
ne4:SetLabelObject(ne2)
Duel.RegisterEffect(ne4,tp)
end
end
function cm.eftg(e,c)
return Duel.GetFlagEffect(0,m+53752000)+Duel.GetFlagEffect(1,m+53752000)>0
end
function cm.synfilter(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function cm.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c)
local ct=g:GetCount()
local res=cm.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c)
return res
end
function cm.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and g:FilterCount(Card.IsLocation,nil,LOCATION_HAND)<=1
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
end
function cm.syncon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.syntg(e,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local tp=syncard:GetControler()
local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
return mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end
function cm.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local lv=syncard:GetLevel()
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
for i=1,maxc do
local cg=mg:Filter(cm.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if cm.syngoal(g,tp,lv,syncard,minc,i) then
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg=cg:Select(tp,minct,99,nil)
if sg:GetCount()==0 then break end
g:Merge(sg)
end
Duel.SetSynchroMaterial(g)
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
--local tp=e:GetHandlerPlayer()
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1)
end
function cm.chkop(e,tp,eg,ep,ev,re,r,rp)
--if not e:GetHandler():IsOnField() then return end
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+m,e,r,rp,ep,ev)
end
function cm.filter(c,tp)
local ocheck=false
if c:GetOriginalCode()==53752002 or (c:GetOriginalCode()>=53752008 and c:GetOriginalCode()<=53752013) then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if c:IsSynchroSummonable(nil) then ocheck=true end
end
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
return c:IsSynchroSummonable(nil,mg)
return c:IsSynchroSummonable(nil,mg) or ocheck==true
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
local g=Duel.GetDecktopGroup(tp,num)
--Debug.Message(tp)
--Debug.Message(g:IsExists(Card.IsAbleToHand,1,nil))
return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
--Debug.Message(Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp))
--Debug.Message(g:GetCount()>=num)
--Debug.Message(Duel.GetMZoneCount(tp)>0)
local gc=false
if Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) then gc=true end
if Duel.GetFlagEffect(tp,m+53752000)~=0 then Duel.ResetFlagEffect(tp,m+53752000) end
return gc and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=e:GetHandlerPlayer()
--local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
if Duel.GetMZoneCount(tp)>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.ConfirmDecktop(tp,num)
......@@ -54,11 +159,26 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil,tp)
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
local spg=ssg:Select(tp,1,1,nil)
local spc=ssg:Select(tp,1,1,nil):GetFirst()
if Duel.GetMZoneCount(tp,c)>0 then
Duel.SynchroSummon(tp,spg:GetFirst(),nil,mg)
local b1=false
local b2=false
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if spc:GetOriginalCode()==53752002 or (spc:GetOriginalCode()>=53752008 and spc:GetOriginalCode()<=53752013) and spc:IsSynchroSummonable(nil) then b1=true end
Duel.ResetFlagEffect(tp,m+53752000)
if spc:IsSynchroSummonable(nil,mg) then b2=true end
local op=aux.SelectFromOptions(tp,
{b1,aux.Stringid(60002404,1)},
{b2,aux.Stringid(60002404,2)})
if op==1 then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
Duel.SynchroSummon(tp,spc,nil)
Duel.ResetFlagEffect(tp,m+53752000)
elseif op==2 then
Duel.SynchroSummon(tp,spc,nil,mg)
end
end
end
else
......
......@@ -3,16 +3,16 @@ local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_ACTIVATING)
e1:SetCode(EVENT_CUSTOM+m)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.spcon)
--e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetRange(LOCATION_MZONE)
--e1:SetCondition(cm.spcon)
e1:SetOperation(cm.bkop)
c:RegisterEffect(e1)
if not cm.global_check then
......@@ -22,27 +22,132 @@ function cm.initial_effect(c)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(cm.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_ACTIVATING)
ge2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
ge2:SetOperation(cm.chkop)
Duel.RegisterEffect(ge2,0)
end
if not cm.NecroceanCheck then
cm.NecroceanCheck=true
local ne1=Effect.CreateEffect(c)
ne1:SetType(EFFECT_TYPE_SINGLE)
ne1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
ne1:SetCondition(cm.syncon)
ne1:SetCode(EFFECT_HAND_SYNCHRO)
ne1:SetTargetRange(0,1)
local ne2=Effect.CreateEffect(c)
ne2:SetType(EFFECT_TYPE_SINGLE)
ne2:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
ne2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
ne2:SetCondition(cm.syncon)
ne2:SetTarget(cm.syntg)
ne2:SetValue(1)
ne2:SetOperation(cm.synop)
local ne3=Effect.CreateEffect(c)
ne3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ne3:SetTargetRange(LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE)
ne3:SetTarget(cm.eftg)
ne3:SetLabelObject(ne1)
Duel.RegisterEffect(ne3,tp)
local ne4=ne3:Clone()
ne4:SetLabelObject(ne2)
Duel.RegisterEffect(ne4,tp)
end
end
function cm.eftg(e,c)
return Duel.GetFlagEffect(0,m+53752000)+Duel.GetFlagEffect(1,m+53752000)>0
end
function cm.synfilter(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function cm.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c)
local ct=g:GetCount()
local res=cm.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c)
return res
end
function cm.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and g:FilterCount(Card.IsLocation,nil,LOCATION_HAND)<=1
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
end
function cm.syncon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.syntg(e,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local tp=syncard:GetControler()
local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
return mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end
function cm.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local lv=syncard:GetLevel()
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
for i=1,maxc do
local cg=mg:Filter(cm.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if cm.syngoal(g,tp,lv,syncard,minc,i) then
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg=cg:Select(tp,minct,99,nil)
if sg:GetCount()==0 then break end
g:Merge(sg)
end
Duel.SetSynchroMaterial(g)
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
--local tp=e:GetHandlerPlayer()
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1)
end
function cm.chkop(e,tp,eg,ep,ev,re,r,rp)
--if not e:GetHandler():IsOnField() then return end
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+m,e,r,rp,ep,ev)
end
function cm.filter(c,tp)
local ocheck=false
if c:GetOriginalCode()==53752002 or (c:GetOriginalCode()>=53752008 and c:GetOriginalCode()<=53752013) then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if c:IsSynchroSummonable(nil) then ocheck=true end
end
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
return c:IsSynchroSummonable(nil,mg)
return c:IsSynchroSummonable(nil,mg) or ocheck==true
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
local g=Duel.GetDecktopGroup(tp,num)
--Debug.Message(tp)
--Debug.Message(g:IsExists(Card.IsAbleToHand,1,nil))
return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
--Debug.Message(Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp))
--Debug.Message(g:GetCount()>=num)
--Debug.Message(Duel.GetMZoneCount(tp)>0)
local gc=false
if Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) then gc=true end
if Duel.GetFlagEffect(tp,m+53752000)~=0 then Duel.ResetFlagEffect(tp,m+53752000) end
return gc and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=e:GetHandlerPlayer()
--local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
if Duel.GetMZoneCount(tp)>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.ConfirmDecktop(tp,num)
......@@ -54,11 +159,26 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil,tp)
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
local spg=ssg:Select(tp,1,1,nil)
local spc=ssg:Select(tp,1,1,nil):GetFirst()
if Duel.GetMZoneCount(tp,c)>0 then
Duel.SynchroSummon(tp,spg:GetFirst(),nil,mg)
local b1=false
local b2=false
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if spc:GetOriginalCode()==53752002 or (spc:GetOriginalCode()>=53752008 and spc:GetOriginalCode()<=53752013) and spc:IsSynchroSummonable(nil) then b1=true end
Duel.ResetFlagEffect(tp,m+53752000)
if spc:IsSynchroSummonable(nil,mg) then b2=true end
local op=aux.SelectFromOptions(tp,
{b1,aux.Stringid(60002404,1)},
{b2,aux.Stringid(60002404,2)})
if op==1 then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
Duel.SynchroSummon(tp,spc,nil)
Duel.ResetFlagEffect(tp,m+53752000)
elseif op==2 then
Duel.SynchroSummon(tp,spc,nil,mg)
end
end
end
else
......
......@@ -3,16 +3,16 @@ local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_ACTIVATING)
e1:SetCode(EVENT_CUSTOM+m)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.spcon)
--e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetRange(LOCATION_MZONE)
--e1:SetCondition(cm.spcon)
e1:SetOperation(cm.bkop)
c:RegisterEffect(e1)
if not cm.global_check then
......@@ -22,27 +22,132 @@ function cm.initial_effect(c)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(cm.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_ACTIVATING)
ge2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
ge2:SetOperation(cm.chkop)
Duel.RegisterEffect(ge2,0)
end
if not cm.NecroceanCheck then
cm.NecroceanCheck=true
local ne1=Effect.CreateEffect(c)
ne1:SetType(EFFECT_TYPE_SINGLE)
ne1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
ne1:SetCondition(cm.syncon)
ne1:SetCode(EFFECT_HAND_SYNCHRO)
ne1:SetTargetRange(0,1)
local ne2=Effect.CreateEffect(c)
ne2:SetType(EFFECT_TYPE_SINGLE)
ne2:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
ne2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
ne2:SetCondition(cm.syncon)
ne2:SetTarget(cm.syntg)
ne2:SetValue(1)
ne2:SetOperation(cm.synop)
local ne3=Effect.CreateEffect(c)
ne3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ne3:SetTargetRange(LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE)
ne3:SetTarget(cm.eftg)
ne3:SetLabelObject(ne1)
Duel.RegisterEffect(ne3,tp)
local ne4=ne3:Clone()
ne4:SetLabelObject(ne2)
Duel.RegisterEffect(ne4,tp)
end
end
function cm.eftg(e,c)
return Duel.GetFlagEffect(0,m+53752000)+Duel.GetFlagEffect(1,m+53752000)>0
end
function cm.synfilter(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function cm.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c)
local ct=g:GetCount()
local res=cm.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c)
return res
end
function cm.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and g:FilterCount(Card.IsLocation,nil,LOCATION_HAND)<=1
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
end
function cm.syncon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.syntg(e,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local tp=syncard:GetControler()
local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
return mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end
function cm.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local lv=syncard:GetLevel()
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
for i=1,maxc do
local cg=mg:Filter(cm.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if cm.syngoal(g,tp,lv,syncard,minc,i) then
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg=cg:Select(tp,minct,99,nil)
if sg:GetCount()==0 then break end
g:Merge(sg)
end
Duel.SetSynchroMaterial(g)
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
--local tp=e:GetHandlerPlayer()
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1)
end
function cm.chkop(e,tp,eg,ep,ev,re,r,rp)
--if not e:GetHandler():IsOnField() then return end
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+m,e,r,rp,ep,ev)
end
function cm.filter(c,tp)
local ocheck=false
if c:GetOriginalCode()==53752002 or (c:GetOriginalCode()>=53752008 and c:GetOriginalCode()<=53752013) then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if c:IsSynchroSummonable(nil) then ocheck=true end
end
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
return c:IsSynchroSummonable(nil,mg)
return c:IsSynchroSummonable(nil,mg) or ocheck==true
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
local g=Duel.GetDecktopGroup(tp,num)
--Debug.Message(tp)
--Debug.Message(g:IsExists(Card.IsAbleToHand,1,nil))
return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
--Debug.Message(Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp))
--Debug.Message(g:GetCount()>=num)
--Debug.Message(Duel.GetMZoneCount(tp)>0)
local gc=false
if Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) then gc=true end
if Duel.GetFlagEffect(tp,m+53752000)~=0 then Duel.ResetFlagEffect(tp,m+53752000) end
return gc and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=e:GetHandlerPlayer()
--local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
if Duel.GetMZoneCount(tp)>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.ConfirmDecktop(tp,num)
......@@ -54,11 +159,26 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil,tp)
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
local spg=ssg:Select(tp,1,1,nil)
local spc=ssg:Select(tp,1,1,nil):GetFirst()
if Duel.GetMZoneCount(tp,c)>0 then
Duel.SynchroSummon(tp,spg:GetFirst(),nil,mg)
local b1=false
local b2=false
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if spc:GetOriginalCode()==53752002 or (spc:GetOriginalCode()>=53752008 and spc:GetOriginalCode()<=53752013) and spc:IsSynchroSummonable(nil) then b1=true end
Duel.ResetFlagEffect(tp,m+53752000)
if spc:IsSynchroSummonable(nil,mg) then b2=true end
local op=aux.SelectFromOptions(tp,
{b1,aux.Stringid(60002404,1)},
{b2,aux.Stringid(60002404,2)})
if op==1 then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
Duel.SynchroSummon(tp,spc,nil)
Duel.ResetFlagEffect(tp,m+53752000)
elseif op==2 then
Duel.SynchroSummon(tp,spc,nil,mg)
end
end
end
else
......
......@@ -3,16 +3,16 @@ local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_ACTIVATING)
e1:SetCode(EVENT_CUSTOM+m)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.spcon)
--e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetRange(LOCATION_MZONE)
--e1:SetCondition(cm.spcon)
e1:SetOperation(cm.bkop)
c:RegisterEffect(e1)
if not cm.global_check then
......@@ -22,27 +22,132 @@ function cm.initial_effect(c)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(cm.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_ACTIVATING)
ge2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
ge2:SetOperation(cm.chkop)
Duel.RegisterEffect(ge2,0)
end
if not cm.NecroceanCheck then
cm.NecroceanCheck=true
local ne1=Effect.CreateEffect(c)
ne1:SetType(EFFECT_TYPE_SINGLE)
ne1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
ne1:SetCondition(cm.syncon)
ne1:SetCode(EFFECT_HAND_SYNCHRO)
ne1:SetTargetRange(0,1)
local ne2=Effect.CreateEffect(c)
ne2:SetType(EFFECT_TYPE_SINGLE)
ne2:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
ne2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
ne2:SetCondition(cm.syncon)
ne2:SetTarget(cm.syntg)
ne2:SetValue(1)
ne2:SetOperation(cm.synop)
local ne3=Effect.CreateEffect(c)
ne3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ne3:SetTargetRange(LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE)
ne3:SetTarget(cm.eftg)
ne3:SetLabelObject(ne1)
Duel.RegisterEffect(ne3,tp)
local ne4=ne3:Clone()
ne4:SetLabelObject(ne2)
Duel.RegisterEffect(ne4,tp)
end
end
function cm.eftg(e,c)
return Duel.GetFlagEffect(0,m+53752000)+Duel.GetFlagEffect(1,m+53752000)>0
end
function cm.synfilter(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function cm.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c)
local ct=g:GetCount()
local res=cm.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c)
return res
end
function cm.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and g:FilterCount(Card.IsLocation,nil,LOCATION_HAND)<=1
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
end
function cm.syncon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.syntg(e,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local tp=syncard:GetControler()
local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
return mg:IsExists(cm.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end
function cm.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local lv=syncard:GetLevel()
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(cm.synfilter,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(cm.synfilter,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
for i=1,maxc do
local cg=mg:Filter(cm.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if cm.syngoal(g,tp,lv,syncard,minc,i) then
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg=cg:Select(tp,minct,99,nil)
if sg:GetCount()==0 then break end
g:Merge(sg)
end
Duel.SetSynchroMaterial(g)
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
--local tp=e:GetHandlerPlayer()
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1)
end
function cm.chkop(e,tp,eg,ep,ev,re,r,rp)
--if not e:GetHandler():IsOnField() then return end
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+m,e,r,rp,ep,ev)
end
function cm.filter(c,tp)
local ocheck=false
if c:GetOriginalCode()==53752002 or (c:GetOriginalCode()>=53752008 and c:GetOriginalCode()<=53752013) then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if c:IsSynchroSummonable(nil) then ocheck=true end
end
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
return c:IsSynchroSummonable(nil,mg)
return c:IsSynchroSummonable(nil,mg) or ocheck==true
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
local g=Duel.GetDecktopGroup(tp,num)
--Debug.Message(tp)
--Debug.Message(g:IsExists(Card.IsAbleToHand,1,nil))
return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
--Debug.Message(Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp))
--Debug.Message(g:GetCount()>=num)
--Debug.Message(Duel.GetMZoneCount(tp)>0)
local gc=false
if Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil,tp) then gc=true end
if Duel.GetFlagEffect(tp,m+53752000)~=0 then Duel.ResetFlagEffect(tp,m+53752000) end
return gc and g:GetCount()>=num and g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetMZoneCount(tp)>0
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=e:GetHandlerPlayer()
--local tp=e:GetHandlerPlayer()
local num=Duel.GetFlagEffect(0,m)
if Duel.GetMZoneCount(tp)>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.ConfirmDecktop(tp,num)
......@@ -54,11 +159,26 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil)
local ssg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_EXTRA,0,nil,tp)
local mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,TYPE_MONSTER)
local spg=ssg:Select(tp,1,1,nil)
local spc=ssg:Select(tp,1,1,nil):GetFirst()
if Duel.GetMZoneCount(tp,c)>0 then
Duel.SynchroSummon(tp,spg:GetFirst(),nil,mg)
local b1=false
local b2=false
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
if spc:GetOriginalCode()==53752002 or (spc:GetOriginalCode()>=53752008 and spc:GetOriginalCode()<=53752013) and spc:IsSynchroSummonable(nil) then b1=true end
Duel.ResetFlagEffect(tp,m+53752000)
if spc:IsSynchroSummonable(nil,mg) then b2=true end
local op=aux.SelectFromOptions(tp,
{b1,aux.Stringid(60002404,1)},
{b2,aux.Stringid(60002404,2)})
if op==1 then
Duel.RegisterFlagEffect(tp,m+53752000,0,0,1)
Duel.SynchroSummon(tp,spc,nil)
Duel.ResetFlagEffect(tp,m+53752000)
elseif op==2 then
Duel.SynchroSummon(tp,spc,nil,mg)
end
end
end
else
......
......@@ -228,8 +228,8 @@ function cm.lvop(e,tp,eg,ep,ev,re,r,rp)
local rg=Duel.GetMatchingGroup(cm.rmfil,tp,LOCATION_EXTRA,0,nil,xlv):Select(tp,1,1,nil)
if rg and Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) then
local rmvg=Duel.GetOperatedGroup()
e:SetLabelObject(rmvg)
rmvg:KeepAlive()
e:SetLabelObject(rmvg)
local code=rmvg:GetFirst():GetCode()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -65,30 +65,33 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp)
-- Case 1: 只有自己
if case==1 then
-- 对方怪兽攻防半减
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetValue(function(e,c) return math.ceil(c:GetAttack()/2) end)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
e2:SetValue(function(e,c) return math.ceil(c:GetDefense()/2) end)
c:RegisterEffect(e2)
-- 效果无效化
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,LOCATION_MZONE)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_DISABLE_EFFECT)
c:RegisterEffect(e4)
local g=Duel.GetMatchingGroup(Card.IsFaceup,1-tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(function(e,c) return math.ceil(c:GetAttack()/2) end)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
e2:SetValue(function(e,c) return math.ceil(c:GetDefense()/2) end)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_DISABLE_EFFECT)
e4:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e4)
tc=g:GetNext()
end
-- Case 2: 只有对方
elseif case==2 then
......
......@@ -20,6 +20,7 @@ function cm.initial_effect(c)
e2:SetType(EFFECT_TYPE_XMATERIAL+EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAINING)
e2:SetCountLimit(1)
e2:SetCondition(cm.discon)
e2:SetOperation(cm.disop)
c:RegisterEffect(e2)
end
......@@ -144,9 +145,13 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
end
end
end
function cm.discon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(m+100)==0
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsChainNegatable(ev) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
Duel.Hint(HINT_CARD,0,81902502)
Duel.NegateEffect(ev)
Duel.RegisterFlagEffect(m+100,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,4))
end
end
\ No newline at end of file
......@@ -1242,8 +1242,8 @@
!setname 0x3864 黑暗升华怪兽
!setname 0x3865 蛇心流
!setname 0x5865 伽古拉
!setname 0x866 乱炖龙仔(字段)
!counter 0x0866 龙之舞指示物(指示物)
!setname 0x866 乱炖龙仔
!counter 0x0866 龙之舞指示物
#02 1164477469 648 0x410-0x41f
!setname 0x5410 终末旅者
......
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