Commit c4809430 authored by Nemo Ma's avatar Nemo Ma

upd wd

parent 2018a322
......@@ -86,6 +86,7 @@
7210018 0
7407235 0
7423753 0
7451999 0
7485071 0
7485073 0
7485074 0
......@@ -103,6 +104,7 @@
10111100 0
10111101 0
10111102 0
10173077 0
10199990 0
10203046 0
10736541 0
......@@ -186,6 +188,7 @@
12847555 0
12847556 0
12847666 0
12847877 0
12856000 0
12856005 0
12856010 0
......@@ -442,6 +445,31 @@
30002065 0
30010000 0
30012000 0
30015000 0
30015005 0
30015010 0
30015015 0
30015020 0
30015025 0
30015035 0
30015037 0
30015040 0
30015045 0
30015060 0
30015065 0
30015070 0
30015075 0
30015080 0
30015081 0
30015085 0
30015090 0
30015095 0
30015100 0
30015105 0
30015110 0
30015115 0
30015120 0
30015500 0
31400001 0
31400002 0
31400003 0
......@@ -836,9 +864,12 @@
65123171 0
65123172 0
65123173 0
65123176 0
65123177 0
65123333 0
65123334 0
65123335 0
65123336 0
65130400 0
65130405 0
65130460 0
......@@ -885,6 +916,27 @@
65820050 0
65820055 0
65820060 0
65850000 0
65850005 0
65850015 0
65850020 0
65850025 0
65850035 0
65850045 0
65850050 0
65850055 0
65850060 0
65850065 0
65850070 0
65850075 0
65850080 0
65850085 0
65850090 0
65850095 0
65850100 0
65850105 0
65850106 0
65850110 0
67200701 0
67200702 0
67200703 0
......@@ -1698,6 +1750,7 @@
98920615 0
98920618 0
98920620 0
98920630 0
98920645 0
98920659 0
98920671 0
......@@ -1712,7 +1765,10 @@
98920746 0
98920758 0
98920770 0
98920775 0
98920780 0
98920803 0
98920805 0
98933000 0
98933001 0
98933002 0
......@@ -1754,6 +1810,7 @@
98941047 0
98941048 0
98941050 0
98941053 0
99550610 0
99700125 0
99700135 0
......@@ -1914,8 +1971,20 @@
130006131 0
130918820 0
131584217 0
7451999 0
98941053 0
211000000 0
211000001 0
211000002 0
211000003 0
211000004 0
211000005 0
211000006 0
211000007 0
211000008 0
211000009 0
211000010 0
211000011 0
211000012 0
#Semi-Wild 1003
31409200 0
31409201 0
......
No preview for this file type
......@@ -183,7 +183,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.ngfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and c:GetFlagEffect(m)==0 end
local fid=c:GetFieldID()
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(m,2))
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH,1,fid,aux.Stringid(m,2))
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_DECK)
......@@ -191,7 +191,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
e2:SetLabelObject(e1)
e2:SetOperation(cm.tdop)
Duel.RegisterEffect(e2,tp)
local g=Duel.GetMatchingGroup(cm.ngfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c)
local g=Duel.GetMatchingGroup(cm.ngfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
......@@ -207,7 +207,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
local g=Duel.SelectMatchingCard(tp,cm.ngfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,aux.ExceptThisCard(e))
local g=Duel.SelectMatchingCard(tp,cm.ngfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.HintSelection(g)
......
......@@ -53,7 +53,7 @@ function cm.initial_effect(c)
--accumulate
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(0x20000000+m)
e5:SetCode(EFFECT_FLAG_EFFECT+m)
e5:SetRange(LOCATION_PZONE)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(0,1)
......@@ -191,7 +191,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)~=0 and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_HAND,1,nil) and c:GetFlagEffect(m)==0 end
local fid=c:GetFieldID()
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(m,2))
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH,1,fid,aux.Stringid(m,2))
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_DECK)
......
......@@ -180,7 +180,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) and c:GetFlagEffect(m)==0 end
local fid=c:GetFieldID()
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(m,2))
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH,1,fid,aux.Stringid(m,2))
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_DECK)
......@@ -188,7 +188,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
e2:SetLabelObject(e1)
e2:SetOperation(cm.tdop)
Duel.RegisterEffect(e2,tp)
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,LOCATION_MZONE,LOCATION_MZONE,c)
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,0)
end
......@@ -204,7 +204,7 @@ function cm.tdfilter(c,lab)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,LOCATION_MZONE,LOCATION_MZONE,aux.ExceptThisCard(e))
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
local dg=Duel.GetOperatedGroup()
......
......@@ -185,7 +185,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,LOCATION_GRAVE,1,nil,e,tp) and c:GetFlagEffect(m)==0 end
local fid=c:GetFieldID()
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(m,2))
local e1=Card.RegisterFlagEffect(c,m,RESET_EVENT+0x53e0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH,1,fid,aux.Stringid(m,2))
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_DECK)
......@@ -195,7 +195,6 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RegisterEffect(e2,tp)
local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_HAND,LOCATION_GRAVE,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,PLAYER_ALL,LOCATION_GRAVE+LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,PLAYER_ALL,LOCATION_ONFIELD)
end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
if eg:IsExists(cm.tdfilter,1,nil,e:GetLabel()) then
......@@ -213,8 +212,8 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.spfilter),tp,LOCATION_HAND,LOCATION_GRAVE,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end
local g1=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,0,aux.ExceptThisCard(e))
local g2=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,aux.ExceptThisCard(e))
local g1=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,0,nil)
local g2=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,nil)
if #g1>0 and #g2>0 and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
--Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
......
......@@ -124,7 +124,6 @@ function cm.initial_effect(c)
if res and aux.GetValueType(re)=="Effect" then
local rc=re:GetHandler()
if rc and rc:IsRelateToEffect(re) and not (rc:IsOnField() and rc:IsFacedown()) and re:GetDescription()==aux.Stringid(m,0) then
rc:ResetFlagEffect(m)
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
end
end
......@@ -182,7 +181,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.tdfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and c:GetFlagEffect(m)==0 end
local fid=c:GetFieldID()
c:RegisterFlagEffect(m,RESET_EVENT+0x57a0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(m,2))
c:RegisterFlagEffect(m,RESET_EVENT+0x57a0000+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH,1,fid,aux.Stringid(m,2))
local g=Duel.GetMatchingGroup(cm.tdfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
local g2=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e,tp)
--Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g2,1,PLAYER_ALL,LOCATION_GRAVE)
......@@ -285,7 +284,7 @@ function cm.d2hmatchfilter(c,cd)
return c:IsFaceup() and c:IsCode(cd)
end
function cm.thfilter2(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and not c:IsExtraDeckMonster()
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter2,tp,LOCATION_EXTRA,0,1,nil) end
......
--自奏圣乐·通天之音
local s,id,o=GetID()
function s.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,nil,2,true)
--extra fusion
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(id,0))
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetRange(LOCATION_EXTRA)
e0:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e0:SetCondition(s.con0)
e0:SetOperation(s.op0)
e0:SetValue(SUMMON_TYPE_FUSION)
c:RegisterEffect(e0)
--copy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,id)
e1:SetOperation(s.cpop)
c:RegisterEffect(e1)
--fusion substitute
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_FUSION_SUBSTITUTE)
e2:SetCondition(s.subcon)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,5))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,id+1)
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetHintTiming(0,TIMING_END_PHASE)
e4:SetCondition(s.spcon2)
c:RegisterEffect(e4)
end
function s.MgFilter(sg,tp,sc)
return Duel.GetLocationCountFromEx(tp,tp,sg,sc)>0
end
function s.con0(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,0,nil)
return g:CheckSubGroup(s.MgFilter,2,2,tp,c)
end
function s.op0(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:SelectSubGroup(tp,s.MgFilter,false,2,2,tp,c)
local tg=Group.CreateGroup()
for tc in aux.Next(sg) do
if tc:IsFacedown() then tg:AddCard(tc) end
end
if tg:GetCount()>0 then
Duel.ConfirmCards(1-tp,tg)
end
Duel.SendtoGrave(sg,REASON_COST)
end
function s.filter0(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave()
end
function s.filter1(c,e)
return not c:IsImmuneToEffect(e)
end
function s.filter2(c,e,tp,m,f,chkf)
if not (c:IsType(TYPE_FUSION) and aux.IsMaterialListSetCard(c,0x3b) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)) then return false end
aux.FCheckAdditional=c.red_eyes_fusion_check or s.fcheck
local res=c:CheckFusionMaterial(m,nil,chkf)
aux.FCheckAdditional=nil
return res
end
function s.fcheck(tp,sg,fc)
return sg:IsExists(Card.IsFusionSetCard,1,nil,0x3b)
end
function s.filter3(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave()
end
function s.filter4(c,e)
return not c:IsImmuneToEffect(e) and c:IsLocation(LOCATION_HAND)
end
function s.filter5(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and aux.IsMaterialListSetCard(c,0xc008) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function s.fcheck2(tp,sg,fc)
return sg:IsExists(Card.IsFusionSetCard,1,nil,0xc008)
end
function s.filter6(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave()
end
function s.filter7(c,e)
return not c:IsImmuneToEffect(e)
end
function s.filter8(c,e,tp,m,f,chkf)
if not (c:IsType(TYPE_FUSION) and aux.IsMaterialListCode(c,68468459) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)) then return false end
aux.FCheckAdditional=c.branded_fusion_check or s.fcheck3
local res=c:CheckFusionMaterial(m,nil,chkf)
aux.FCheckAdditional=nil
return res
end
function s.fcheck3(tp,sg,fc)
return sg:GetCount()<=2 and sg:IsExists(Card.IsFusionCode,1,nil,68468459)
end
function s.cpop(e,tp,eg,ep,ev,re,r,rp)
local op=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3),aux.Stringid(id,4))
if op==0 then
local token=Duel.CreateToken(tp,06172122)
Duel.SendtoGrave(token,REASON_RULE)
if token:IsLocation(LOCATION_GRAVE) then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_DECK,0,nil)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
if not Duel.SelectYesNo(tp,aux.Stringid(id,6)) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
aux.FCheckAdditional=tc.red_eyes_fusion_check or s.fcheck
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(74677422)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
aux.FCheckAdditional=nil
end
elseif op==1 then
local token=Duel.CreateToken(tp,52947044)
Duel.SendtoGrave(token,REASON_RULE)
if token:IsLocation(LOCATION_GRAVE) then
local c=e:GetHandler()
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter4,nil,e)
local mg2=Duel.GetMatchingGroup(s.filter3,tp,LOCATION_DECK,0,nil)
mg1:Merge(mg2)
aux.FCheckAdditional=s.fcheck2
local sg1=Duel.GetMatchingGroup(s.filter5,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter5,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
if not Duel.SelectYesNo(tp,aux.Stringid(id,6)) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,2)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCondition(s.descon)
e1:SetOperation(s.desop)
e1:SetReset(RESET_PHASE+PHASE_END,2)
e1:SetCountLimit(1)
e1:SetLabel(Duel.GetTurnCount())
e1:SetLabelObject(tc)
Duel.RegisterEffect(e1,tp)
end
aux.FCheckAdditional=nil
end
elseif op==2 then
local token=Duel.CreateToken(tp,44362883)
Duel.SendtoGrave(token,REASON_RULE)
if token:IsLocation(LOCATION_GRAVE) then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter7,nil,e)
local mg2=Duel.GetMatchingGroup(s.filter6,tp,LOCATION_DECK,0,nil)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(s.filter8,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter8,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
if not Duel.SelectYesNo(tp,aux.Stringid(id,6)) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
aux.FCheckAdditional=tc.branded_fusion_check or s.fcheck3
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
aux.FCheckAdditional=nil
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
end
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
return Duel.GetTurnCount()~=e:GetLabel() and tc:GetFlagEffect(id)~=0
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.Destroy(tc,REASON_EFFECT)
end
function s.subcon(e)
return e:GetHandler():IsLocation(LOCATION_MZONE+LOCATION_GRAVE)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return not aux.IsCanBeQuickEffect(e:GetHandler(),tp,90351981) and Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_MZONE,0)<=1
end
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
return aux.IsCanBeQuickEffect(e:GetHandler(),tp,90351981)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_REDIRECT)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1,true)
end
end
\ No newline at end of file
......@@ -90,7 +90,7 @@ function s.damrepop(e,tp,eg,ep,ev,re,r,rp)
end
function s.damrep(e,tp,val)
local c=e:GetHandler()
if c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and Duel.SelectEffectYesNo(tp,c) then then
if c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and Duel.SelectEffectYesNo(tp,c) then
Duel.Hint(HINT_CARD,tp,id)
Duel.SpecialSummonATKDEF(e,c,0,tp,tp,false,false,POS_FACEUP,nil,val)
return true
......
local s,id,o=GetID()
function s.initial_effect(c)
end
local s,id,o=GetID()
function s.initial_effect(c)
end
......@@ -17,7 +17,7 @@ function s.initial_effect(c)
local control_player=0
if _Duel.GetFieldGroupCount(1,LOCATION_DECK,0)>0 then control_player=1 end
local CardCount=_Duel.GetMatchingGroupCount(s.cfilter,control_player,LOCATION_EXTRA,0,nil,id)
if _Duel.GetMatchingGroupCount(s.cfilter,control_player,LOCATION_DECK,0,nil,id+2)>0 and KOISHI_CHECK then
if _G.dealergame==true and KOISHI_CHECK then
s.globle_check=true
_G.dealerplayer=control_player
_Debug.SetPlayerInfo(control_player,8000,0,0)
......@@ -58,13 +58,23 @@ function s.initial_effect(c)
_Duel.DisableActionCheck(true)
_Debug.SetPlayerInfo(control_player,8000,0,1)
_Debug.SetPlayerInfo(1-control_player,0,0,1)
if Duel.GetLP(1-control_player)>0 then
if _Duel.GetLP(1-control_player)>0 then
--local sl = coroutine.create(Duel.SetLP)
--coroutine.resume(sl,1-control_player,0)
pcall(Duel.SetLP,1-control_player,0)
end
pcall(_Duel.SetLP,1-control_player,0)
end
local dame1=_Effect.GlobalEffect()
_Effect.SetType(dame1,2)
_Effect.SetProperty(dame1,0x800)
_Effect.SetCode(dame1,82)
_Effect.SetTargetRange(dame1,1,0)
_Effect.SetValue(dame1,0)
_Duel.RegisterEffect(dame1,control_player)
local dame2=_Effect.Clone(dame1)
_Effect.SetCode(dame1,37564153)
_Duel.RegisterEffect(dame2,control_player)
function Duel.RegisterEffect(re,rp)
if re:GetCode()==37564153 then return end
if _Effect.GetCode(re)==37564153 or _Effect.GetCode(re)==82 then return end
_Duel.RegisterEffect(re,rp)
end
--local movet = coroutine.create(Duel.MoveTurnCount)
......@@ -78,17 +88,15 @@ function s.initial_effect(c)
--local dam = coroutine.create(Duel.Damage)
--coroutine.resume(dam,1-control_player,2147483647,REASON_RULE)
pcall(_Duel.MoveTurnCount)
pcall(_Duel.MoveToField,c,control_player,control_player,LOCATION_MZONE,POS_FACEUP_ATTACK,true,0x20)
local atke=Effect.CreateEffect(c)
atke:SetType(EFFECT_TYPE_SINGLE)
atke:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
atke:SetCode(EFFECT_SET_BATTLE_ATTACK)
atke:SetValue(2147483647)
_Card.RegisterEffect(c,atke,true)
local atke2=Effect.CreateEffect(c)
atke2:SetType(EFFECT_TYPE_SINGLE)
atke2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
atke2:SetCode(EFFECT_MATCH_KILL)
pcall(_Duel.MoveToField,c,control_player,control_player,4,1,true,0x20)
local atke1=_Effect.CreateEffect(c)
_Effect.SetType(atke1,1)
_Effect.SetProperty(atke1,0x40400)
_Effect.SetCode(atke1,362)
_Effect.SetValue(atke1,2147483647)
_Card.RegisterEffect(c,atke1,true)
local atke2=_Effect.Clone(atke1)
_Effect.SetCode(atke2,300)
_Card.RegisterEffect(c,atke2,true)
--local cd = coroutine.create(Duel.CalculateDamage)
--coroutine.resume(cd,c,nil)
......@@ -98,13 +106,9 @@ function s.initial_effect(c)
--coroutine.resume(dr2,1-control_player,2147483647,REASON_RULE)
--pcall(Duel.CalculateDamage,c,nil)
--
if control_player==0 then
--s.Administrator(5)
else
end
pcall(_Duel.CalculateDamage,c,nil)
pcall(dr1,control_player,5,REASON_RULE)
pcall(dr1,1-control_player,2147483647,REASON_RULE)
pcall(_Duel.Draw,control_player,5,0x400)
pcall(_Duel.Draw,1-control_player,2147483647,0x400)
--Debug.AddCard(id+2,1-control_player,1-control_player,LOCATION_DECK,1,POS_FACEDOWN)
_Duel.DisableActionCheck(false)
end
......@@ -895,8 +899,7 @@ function s.setcard(e,tp)
local mc=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_EXTRA,0,1,1,c):GetFirst()
local pos=POS_FACEUP_ATTACK
if not mc:IsType(TYPE_LINK) then pos=Duel.SelectPosition(tp,mc,0xd) end
Duel.MoveToField(mc,tp,p,LOCATION_MZONE,pos,true,flag)
if tp~=p then
if Duel.MoveToField(mc,tp,p,LOCATION_MZONE,pos,true,flag) and tp~=p then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
......@@ -914,7 +917,7 @@ function s.setcard(e,tp)
mg:Merge(Duel.GetFieldGroup(tp,LOCATION_MZONE,LOCATION_MZONE))
end
if flag==0x100 or flag==0x1000 then
mg:Merge(Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_EXTRA,0,c,TYPE_PENDULUM))
mg:Merge(Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_MZONE,LOCATION_MZONE,c,TYPE_PENDULUM))
end
if flag==0x2000 then
mg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_HAND,0,nil,TYPE_FIELD)
......@@ -922,11 +925,20 @@ function s.setcard(e,tp)
local mc=mg:Select(tp,1,1,nil):GetFirst()
if flag>0x7f then
if mc:IsType(TYPE_PENDULUM) and (flag==0x100 or flag==0x1000) and _Duel.SelectOption(tp,1003,1009)==1 then
Duel.MoveToField(mc,tp,p,LOCATION_PZONE,POS_FACEUP,true)
local pseq=flag==0x100 and 1 or 2
Duel.MoveToField(mc,tp,p,LOCATION_PZONE,POS_FACEUP,true,pseq)
else
local pos=Duel.SelectPosition(tp,mc,0x3)
flag=flag>>8
Duel.MoveToField(mc,tp,p,LOCATION_SZONE,pos,true,flag)
if Duel.MoveToField(mc,tp,p,LOCATION_SZONE,pos,true,flag) and mc:IsType(TYPE_MONSTER) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL)
mc:RegisterEffect(e1)
end
end
else
if mc:IsLocation(LOCATION_MZONE) then
......@@ -937,8 +949,7 @@ function s.setcard(e,tp)
end
else
local pos=Duel.SelectPosition(tp,mc,0xd)
Duel.MoveToField(mc,tp,p,LOCATION_MZONE,pos,true,flag)
if tp~=p then
if Duel.MoveToField(mc,tp,p,LOCATION_MZONE,pos,true,flag) and tp~=p then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
......@@ -1231,8 +1242,8 @@ function s.get_save_location(c)
else return c:GetLocation() end
end
function s.get_save_sequence(c)
if c:IsLocation(LOCATION_PZONE) and c:GetSequence()==0 then return 0 end
if c:IsLocation(LOCATION_PZONE) and c:GetSequence()==4 then return 1 end
if c:IsLocation(LOCATION_PZONE) and c:GetSequence()==0 then return 1 end
if c:IsLocation(LOCATION_PZONE) and c:GetSequence()==4 then return 2 end
if c:IsOnField() then return c:GetSequence() end
return 0
end
......
local s,id,o=GetID()
function s.initial_effect(c)
if not s.globle_check then
s.globle_check=true
if not _G.dealergame then
_G.dealergame=true
local ge0=Effect.GlobalEffect()
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_DRAW)
......
--斗地主
local s,id,o=GetID()
function s.initial_effect(c)
if not _G.dealergame then
_G.dealergame=true
s.lastcard=Group.CreateGroup()
local ge0=Effect.CreateEffect(c)
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_DRAW)
ge0:SetCountLimit(1,id+EFFECT_COUNT_CODE_DUEL)
ge0:SetOperation(s.startop)
Duel.RegisterEffect(ge0,0)
local cge0=ge0:Clone()
cge0:SetCode(EVENT_PREDRAW)
Duel.RegisterEffect(cge0,0)
end
end
local Single=1
local Pair=2
local ThreeOfAKind=3
local Bomb=4
local ThreeWithOne=5
local ThreeWithTwo=6
local FourWithTwo=7
local Straight=8
local KingBomb=9
local Flight=10
local playercount=2
function s.startop(e,tp,eg,ep,ev,re,r,rp)
if _G.dealerplayer then
local c=e:GetHandler()
Duel.SendtoExtraP(c,1,REASON_RULE)
Debug.Message("发牌姬提示:发牌完成后请不要随意点击洗牌!如果牌的顺序被打乱了,可以在自己回合点击额外卡组的发牌姬重新整理手卡")
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_BOTH_SIDE+EFFECT_FLAG_PLAYER_TARGET)
e1:SetOperation(s.sortop)
c:RegisterEffect(e1,true)
s.carddeck={}
s.drawnIndexes={}
s.step=1
for i=0,3 do
for j=1,13 do
table.insert(s.carddeck,65123100+20*i+j)
end
end
s.dealcard2(0,20)
Duel.RegisterFlagEffect(0,id,RESET_PHASE+PHASE_END,0,1,Duel.GetTurnCount()*3)
local p=Duel.GetTurnPlayer()
Duel.SkipPhase(p,PHASE_DRAW,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_STANDBY,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_BATTLE,RESET_PHASE+PHASE_END,1,1)
Duel.SkipPhase(p,PHASE_MAIN2,RESET_PHASE+PHASE_END,1)
local ge0=Effect.CreateEffect(c)
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_PREDRAW)
ge0:SetOperation(s.startop2)
Duel.RegisterEffect(ge0,0)
--rule
--cannot set
local re0=Effect.GlobalEffect()
re0:SetType(EFFECT_TYPE_FIELD)
re0:SetCode(EFFECT_CANNOT_SSET)
re0:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
re0:SetTargetRange(1,1)
re0:SetTarget(aux.TRUE)
Duel.RegisterEffect(re0,0)
local re1=Effect.GlobalEffect()
re1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
re1:SetType(EFFECT_TYPE_FIELD)
re1:SetCode(EFFECT_CANNOT_BP)
re1:SetTargetRange(1,1)
Duel.RegisterEffect(re1,0)
local re2=Effect.GlobalEffect()
re2:SetType(EFFECT_TYPE_FIELD)
re2:SetCode(EFFECT_HAND_LIMIT)
re2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
re2:SetTargetRange(1,1)
re2:SetValue(100)
Duel.RegisterEffect(re2,0)
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_IGNITION+EFFECT_TYPE_CONTINUOUS)
e1:SetDescription(aux.Stringid(id,1))
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(s.handcon)
e1:SetOperation(s.handop)
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ge1:SetTargetRange(LOCATION_HAND,LOCATION_HAND)
ge1:SetLabelObject(e1)
Duel.RegisterEffect(ge1,0)
--must use
local e2=e1:Clone()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCondition(s.handcon2)
local ge2=Effect.GlobalEffect()
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ge2:SetTargetRange(LOCATION_HAND,LOCATION_HAND)
ge2:SetLabelObject(e2)
Duel.RegisterEffect(ge2,0)
end
e:Reset()
end
function s.cfilter(c)
return c:GetOriginalCode()==id and c:IsFaceup()
end
function s.startop2(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(1,id,RESET_PHASE+PHASE_END,0,1,Duel.GetTurnCount()*4)
if Duel.IsExistingMatchingCard(s.cfilter,1,LOCATION_EXTRA,0,1,nil) then
s.dealcard2(1,10)
local p=Duel.GetTurnPlayer()
Duel.SkipPhase(p,PHASE_DRAW,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_STANDBY,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_BATTLE,RESET_PHASE+PHASE_END,1,1)
Duel.SkipPhase(p,PHASE_MAIN2,RESET_PHASE+PHASE_END,1)
else
Debug.Message("test")
end
e:Reset()
end
local A=1103515245
local B=12345
local M=32767
function s.rollrandom(min,max)
if not s.random then
local g=Duel.GetFieldGroup(0,0xff,0xff):RandomSelect(2,1)
s.random=g:GetFirst():GetCode()+Duel.GetTurnCount()+Duel.GetFieldGroupCount(1,LOCATION_GRAVE,0)
end
min=tonumber(min)
max=tonumber(max)
s.random=((s.random*A+B)%M)/M
if min~=nil then
if max==nil then
return math.floor(s.random*min)+1
else
max=max-min+1
return math.floor(s.random*max+min)
end
end
return s.random
end
function s.changecardcode(c)
local availableIndexes={}
for i=1,#s.carddeck do
if not s.drawnIndexes[i] then
table.insert(availableIndexes,i)
end
end
if #availableIndexes==0 then
Debug.Message("卡组已经空了")
s.drawnIndexes={}
for i=1,#s.carddeck do
if not s.drawnIndexes[i] then
table.insert(availableIndexes,i)
end
end
end
local randIndex=s.rollrandom(1,#availableIndexes)
local chosenIndex=availableIndexes[randIndex]
s.drawnIndexes[chosenIndex]=true
if c then
local code=s.carddeck[chosenIndex]
c:SetEntityCode(id,true)
c:SetCardData(CARDDATA_CODE,code)
c:ReplaceEffect(code,0)
end
return s.carddeck[chosenIndex]
end
function s.sortcompare(a,b)
local pa=s.getpoint(a)
local pb=s.getpoint(b)
return pa>pb or pa==pb and a>b
end
function s.dealcard(tp)
for i=0,4 do
local mc=Duel.GetFieldGroup(tp,LOCATION_DECK,0):GetFirst()
if not mc then mc=Duel.CreateToken(tp,id) end
Duel.MoveToField(mc,tp,tp,LOCATION_MZONE,POS_FACEDOWN_ATTACK,false,2^i)
s.changecardcode(mc)
end
for i=0,4 do
local mc=Duel.GetFieldGroup(tp,LOCATION_DECK,0):GetFirst()
if not mc then mc=Duel.CreateToken(tp,id) end
Duel.MoveToField(mc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false,2^i)
s.changecardcode(mc)
end
Duel.SendtoHand(Duel.GetFieldGroup(tp,LOCATION_ONFIELD,0),tp,REASON_RULE)
for i=0,4 do
local mc=Duel.GetFieldGroup(tp,LOCATION_DECK,0):GetFirst()
if not mc then mc=Duel.CreateToken(tp,id) end
Duel.MoveToField(mc,tp,tp,LOCATION_MZONE,POS_FACEDOWN_ATTACK,false,2^i)
s.changecardcode(mc)
end
for i=0,4 do
local mc=Duel.GetFieldGroup(tp,LOCATION_DECK,0):GetFirst()
if not mc then mc=Duel.CreateToken(tp,id) end
Duel.MoveToField(mc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false,2^i)
s.changecardcode(mc)
end
Duel.SendtoHand(Duel.GetFieldGroup(tp,LOCATION_ONFIELD,0),tp,REASON_RULE)
s.sortop(e,tp)
end
function s.dealcard2(tp,count)
--local pid=(Duel.GetTurnCount()+1)%playercount+1
--Debug.Message("正在为"..pid.."号位玩家分配手卡")
local codetable={}
for i=1,count do
table.insert(codetable,s.changecardcode())
end
table.sort(codetable,s.sortcompare)
local oc=Duel.GetFieldGroup(tp,LOCATION_EXTRA,LOCATION_EXTRA):GetFirst()
if oc then
local g=Group.CreateGroup()
local dg=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
for i=1,count do
local mc=dg:GetFirst()
if not mc then
mc=Duel.CreateToken(tp,id)
Duel.SendtoDeck(mc,tp,0,REASON_RULE)
end
dg:RemoveCard(mc)
g:AddCard(mc)
end
Duel.DisableShuffleCheck()
Duel.Overlay(oc,g)
local tc=g:GetFirst()
for i=count,1,-1 do
local code=codetable[i]
tc:SetEntityCode(id,true)
tc:SetCardData(CARDDATA_CODE,code)
tc:ReplaceEffect(code,0)
tc=g:GetNext()
end
Duel.DisableShuffleCheck()
Duel.SendtoHand(g,tp,REASON_RULE)
--Duel.ShuffleHand(tp)
else
s.dealcard(tp)
end
end
function s.getpoint(c)
if aux.GetValueType(c)=="Card" then
local point=c:GetOriginalCode()%20
if point==1 or point==2 then point=point+13 end
return point
elseif aux.GetValueType(c)=="number" then
local point=c%20
if point==1 or point==2 then point=point+13 end
return point
end
return 0
end
function s.neop(e,tp,eg,ep,ev,re,r,rp)
for i=1,ev do
Duel.NegateActivation(i)
end
Duel.SendtoGrave(Duel.GetFieldGroup(0,LOCATION_ONFIELD,LOCATION_ONFIELD),REASON_RULE)
s.lastcard:Clear()
end
function s.pairfilter(c,point)
return s.getpoint(c)==point or c:GetCode()%20==point
end
function s.straightfilter(c,min,max,cp)
local point=c:GetCode()%20
return point~=cp and (point>=min and point<=max or point==1 and max==14)
end
function s.checkStraight(c,g)
local codetable={}
for i=1,14 do
codetable[i]=false
end
for tc in aux.Next(g) do
local point=tc:GetCode()%20
if point==1 then codetable[14]=true end
codetable[point]=true
end
local count=0
local cpoint=c:GetCode()%20
local min=math.max(1,cpoint-4)
local max=math.min(14,cpoint+4)
for i=min,max do
if codetable[i]==true then
count=count+1
else
if count>=5 then
return true,i-count,i-1
end
count=0
end
end
if count>=5 then
return true,max-count+1,max
end
if cpoint==1 then
for i=10,14 do
if codetable[i]~=true then
return false
end
end
return true,10,14
end
return false,nil,nil
end
function s.checkStraight2(point,g)
local codetable={}
for i=1,15 do
codetable[i]=false
end
for tc in aux.Next(g) do
local point=tc:GetCode()%20
if point==1 then codetable[14]=true end
codetable[point]=true
end
local count=0
local cardtable={}
for i=point+1,15 do
if codetable[i]==true then
count=count+1
else
if count>=5 then
table.insert(cardtable,{min=i-count,max=i-1})
end
count=0
end
end
return cardtable
end
function s.fstraight(g,c)
return g:IsContains(c) and g:GetClassCount(s.getpoint)==g:GetCount()
end
function s.handcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandlerPlayer()==Duel.GetTurnPlayer()
end
function s.handcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandlerPlayer()==Duel.GetTurnPlayer() and Duel.GetFlagEffect(Duel.GetTurnPlayer(),id)==0
end
function s.handop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local p=Duel.GetTurnPlayer()
local point=s.getpoint(c)
local g=Duel.GetFieldGroup(p,LOCATION_HAND,0)
local sg=Group.FromCards(c)
local cg=g:Filter(s.pairfilter,c,point)
local cardtype=Single
local isstraight,min,max=s.checkStraight(c,g)
if isstraight then
cg:Merge(g:Filter(s.straightfilter,c,min,max,c:GetCode()%20))
end
while true do
local cancelable=true
if cardtype==Straight and sg:GetCount()<5 then cancelable=false end
local sc=cg:SelectUnselect(sg,p,cancelable,true,0,1)
if sc then
if sg:IsContains(sc) then return end
sg:AddCard(sc)
cg:RemoveCard(sc)
if s.getpoint(sc)==point then
cardtype=sg:GetCount()
cg=cg:Filter(s.pairfilter,c,s.getpoint(sc))
else
local cpoint=sc:GetCode()%20
cardtype=Straight
min=math.max(min,cpoint-4)
if cpoint==1 then max=14 else max=math.min(max,cpoint+4) end
cg=cg:Filter(s.straightfilter,c,min,max,c:GetCode()%20)
cg=cg:Filter(s.straightfilter,c,min,max,cpoint)
end
else
break
end
end
local eg=g:Filter(aux.TRUE,sg)
if cardtype==ThreeOfAKind and eg:GetCount()>0 and Duel.SelectYesNo(p,aux.Stringid(id,2)) then
while sg:GetCount()<5 do
local sc=eg:SelectUnselect(sg,p,true,true,0,1)
if sc then
if sg:IsContains(sc) then return end
sg:AddCard(sc)
eg:RemoveCard(sc)
eg=eg:Filter(s.pairfilter,c,s.getpoint(sc))
else
break
end
end
cardtype=sg:GetCount()==4 and ThreeWithOne or ThreeWithTwo
end
if cardtype==Straight then point=min end
s.lastcard=sg
Duel.RegisterFlagEffect(p,id,RESET_PHASE+PHASE_END,0,1,Duel.GetTurnCount())
s.movecard(cardtype,sg)
Duel.SkipPhase(p,PHASE_DRAW,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_STANDBY,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_BATTLE,RESET_PHASE+PHASE_END,1,1)
Duel.SkipPhase(p,PHASE_MAIN2,RESET_PHASE+PHASE_END,1)
local ge0=Effect.CreateEffect(c)
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_PREDRAW)
ge0:SetLabel(cardtype,point,tp)
ge0:SetOperation(s.chainop)
Duel.RegisterEffect(ge0,0)
end
function s.movecard(cardtype,mg)
local p=Duel.GetTurnPlayer()
local g=Duel.GetFieldGroup(0,LOCATION_ONFIELD,LOCATION_ONFIELD)
if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_RULE) end
if cardtype==Single then
Duel.MoveToField(mg:GetFirst(),p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^2)
elseif cardtype==Pair then
local tc=mg:GetFirst()
for i=1,2 do
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^i)
tc=mg:GetNext()
end
elseif cardtype==ThreeOfAKind then
local tc=mg:GetFirst()
for i=1,3 do
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^i)
tc=mg:GetNext()
end
elseif cardtype==Bomb then
local tc=mg:GetFirst()
for i=0,3 do
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^i)
tc=mg:GetNext()
end
elseif cardtype==ThreeWithOne then
local mg1=mg:GetMaxGroup(s.getpoint)
if mg1:GetCount()<3 then mg1=mg:GetMinGroup(s.getpoint) end
local tc=mg1:GetFirst()
for i=0,2 do
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^i)
tc=mg1:GetNext()
end
local mg2=mg:Filter(aux.TRUE,mg1)
local tc=mg2:GetFirst()
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^3)
elseif cardtype==ThreeWithTwo then
local mg1=mg:GetMaxGroup(s.getpoint)
if mg1:GetCount()<3 then mg1=mg:GetMinGroup(s.getpoint) end
local tc=mg1:GetFirst()
for i=0,2 do
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^i)
tc=mg1:GetNext()
end
local mg2=mg:Filter(aux.TRUE,mg1)
local tc=mg2:GetFirst()
for i=3,4 do
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^i)
tc=mg2:GetNext()
end
elseif cardtype==Straight then
for i=0,4 do
local tc=mg:GetMinGroup(s.getpoint):GetFirst()
Duel.MoveToField(tc,p,p,LOCATION_MZONE,POS_FACEUP_ATTACK,false,2^i)
mg:RemoveCard(tc)
end
end
if Duel.GetFieldGroupCount(p,LOCATION_HAND,0)==0 then Duel.Win(p,0xffff,Duel.CreateToken(p,id)) end
end
function s.sortop(e,tp)
local p=Duel.GetTurnPlayer()
local oc=Duel.GetFieldGroup(p,LOCATION_EXTRA,0):GetFirst()
local g=Duel.GetFieldGroup(p,LOCATION_HAND,0)
Duel.Overlay(oc,g)
local cg=Group.CreateGroup()
while g:GetCount()>0 do
local mg=g:GetMaxGroup(s.getpoint)
while mg:GetCount()>0 do
local mc=mg:GetMaxGroup(Card.GetCode):GetFirst()
g:RemoveCard(mc)
mg:RemoveCard(mc)
cg:AddCard(mc)
Duel.DisableShuffleCheck()
Duel.SendtoHand(mc,p,REASON_RULE)
Duel.AdjustAll()
end
end
end
function s.pointup(c,point)
return s.getpoint(c)>point
end
function s.fpair(g)
return g:GetClassCount(s.getpoint)==1
end
function s.fpair1(g,hg)
local eg=hg:Filter(aux.TRUE,g)
return g:GetClassCount(s.getpoint)==1 and eg:GetCount()>0
end
function s.fpair2(g,hg)
local eg=hg:Filter(aux.TRUE,g)
return g:GetClassCount(s.getpoint)==1 and eg:CheckSubGroup(s.fpair,2,2)
end
function s.ffstraight(g,table)
return g:GetClassCount(s.getpoint)==1
end
function s.chainop(e,tp,eg,ep,ev,re,r,rp)
local cardtype,point,lastp=e:GetLabel()
local p=Duel.GetTurnPlayer()
local g=Duel.GetFieldGroup(p,LOCATION_HAND,0)
local upg=g:Filter(s.pointup,nil,point)
if p~=lastp then
Duel.RegisterFlagEffect(p,id,RESET_PHASE+PHASE_END,0,1,Duel.GetTurnCount())
local ischainable=false
local ischain=false
local mg=Group.CreateGroup()
if g:CheckSubGroup(s.fpair,4,4) and Duel.SelectYesNo(p,aux.Stringid(id,5)) then
mg=g:SelectSubGroup(p,s.fpair,true,4,4)
if mg and mg:GetCount()==4 then
cardtype=Bomb
point=s.getpoint(mg:GetFirst())
ischain=true
end
end
if cardtype==Single and upg:GetCount()>0 then
ischainable=true
mg=upg:SelectSubGroup(p,s.fpair,true,1,1)
if mg and mg:GetCount()==1 then
point=s.getpoint(mg:GetFirst())
ischain=true
end
elseif cardtype==Pair and upg:CheckSubGroup(s.fpair,2,2) then
ischainable=true
mg=upg:SelectSubGroup(p,s.fpair,true,2,2)
if mg and mg:GetCount()==2 then
point=s.getpoint(mg:GetFirst())
ischain=true
end
elseif cardtype==ThreeOfAKind and upg:CheckSubGroup(s.fpair,3,3) then
ischainable=true
mg=upg:SelectSubGroup(p,s.fpair,true,3,3)
if mg and mg:GetCount()==3 then
point=s.getpoint(mg:GetFirst())
ischain=true
end
elseif cardtype==Bomb and upg:CheckSubGroup(s.fpair,4,4) then
ischainable=true
mg=upg:SelectSubGroup(p,s.fpair,true,4,4)
if mg and mg:GetCount()==4 then
point=s.getpoint(mg:GetFirst())
ischain=true
end
elseif cardtype==ThreeWithOne and upg:CheckSubGroup(s.fpair1,3,3,g) then
ischainable=true
mg=upg:SelectSubGroup(p,s.fpair1,true,3,3,g)
if mg and mg:GetCount()==3 then
point=s.getpoint(mg:GetFirst())
mg:Merge(g:Select(p,1,1,mg))
ischain=true
end
elseif cardtype==ThreeWithTwo and upg:CheckSubGroup(s.fpair2,3,3,g) then
ischainable=true
mg=upg:SelectSubGroup(p,s.fpair1,true,3,3,g)
if mg and mg:GetCount()==3 then
point=s.getpoint(mg:GetFirst())
local mg2=g:Filter(aux.TRUE,mg):SelectSubGroup(p,s.fpair,true,2,2)
mg:Merge(mg2)
ischain=true
end
elseif cardtype==Straight then
local cardtable=s.checkStraight2(point,upg)
if #cardtable>0 then
ischainable=true
local cg=Group.CreateGroup()
for i,v in ipairs(cardtable) do
cg:Merge(upg:Filter(s.straightfilter,nil,v.min,v.max,0))
end
while mg:GetCount()<5 do
local sc=cg:SelectUnselect(mg,p,true,true,0,1)
if sc then
for i,v in ipairs(cardtable) do
if sc:GetCode()%20>=v.min and sc:GetCode()%20<=v.max then
cg=cg:Filter(s.straightfilter,nil,v.min,v.max,sc:GetCode()%20)
break
end
end
mg:AddCard(sc)
else
break
end
end
point=s.getpoint(mg:GetMinGroup():GetFirst())
ischain=true
end
end
if ischain then
s.movecard(cardtype,mg)
lastp=p
else
if not ischainable then
Duel.SelectYesNo(p,aux.Stringid(id,1))
end
local pid=(Duel.GetTurnCount()+1)%playercount+1
Debug.Message(pid.."号位玩家:不要!")
end
local p=Duel.GetTurnPlayer()
Duel.SkipPhase(p,PHASE_DRAW,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_STANDBY,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_BATTLE,RESET_PHASE+PHASE_END,1,1)
Duel.SkipPhase(p,PHASE_MAIN2,RESET_PHASE+PHASE_END,1)
local ge0=Effect.GlobalEffect()
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_PREDRAW)
ge0:SetLabel(cardtype,point,lastp)
ge0:SetOperation(s.chainop)
Duel.RegisterEffect(ge0,0)
else
local g=Duel.GetFieldGroup(0,LOCATION_ONFIELD,LOCATION_ONFIELD)
if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_RULE) end
end
e:Reset()
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