Commit 25b76f81 authored by Nemo Ma's avatar Nemo Ma

fix

parent fa73c171
...@@ -24,6 +24,25 @@ function cm.initial_effect(c) ...@@ -24,6 +24,25 @@ function cm.initial_effect(c)
local _CRemoveOverlayCard=Card.RemoveOverlayCard local _CRemoveOverlayCard=Card.RemoveOverlayCard
local _FilterSelect=Group.FilterSelect local _FilterSelect=Group.FilterSelect
local _Select=Group.Select local _Select=Group.Select
local function Local_RandomSelect(g,tp,ct)
local cg=g:Clone()
local sg=Group.CreateGroup()
if aux.GetValueType(g)~="Group" or #g<=0 then return sg end
if ct>#g then ct=#g end
if not cm.r then
cm.r=Duel.GetFieldGroup(0,LOCATION_DECK+LOCATION_HAND,LOCATION_DECK+LOCATION_EXTRA):GetSum(Card.GetCode)
end
while #sg<ct do
local id=cm.roll(0,#cg)
local tc=cg:GetFirst()
if id>1 then
for i=1,id-1,1 do tc=cg:GetNext() end
end
sg:AddCard(tc)
cg:RemoveCard(tc)
end
return sg
end
function Duel.SelectMatchingCard(sp,f,p,s,o,min,max,nc,...) function Duel.SelectMatchingCard(sp,f,p,s,o,min,max,nc,...)
if Duel.GetFlagEffect(0,m)>0 and min==1 and max==1 then if Duel.GetFlagEffect(0,m)>0 and min==1 and max==1 then
local g=Duel.GetMatchingGroup(f,p,s,o,nc,...) local g=Duel.GetMatchingGroup(f,p,s,o,nc,...)
...@@ -83,7 +102,9 @@ function cm.initial_effect(c) ...@@ -83,7 +102,9 @@ function cm.initial_effect(c)
function Duel.RemoveOverlayCard(sp,s,o,min,max,r) function Duel.RemoveOverlayCard(sp,s,o,min,max,r)
if Duel.GetFlagEffect(0,m)>0 and min==1 and max==1 then if Duel.GetFlagEffect(0,m)>0 and min==1 and max==1 then
local og=Duel.GetOverlayGroup(sp,s,o) local og=Duel.GetOverlayGroup(sp,s,o)
og=og:Select(sp,min,max,nil) Duel.Hint(HINT_CARD,0,m)
cm[sp]=cm[sp]+1
og=Local_RandomSelect(og,sp,1)
local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT) local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local dc=og:GetFirst() local dc=og:GetFirst()
local c=nil local c=nil
...@@ -98,7 +119,9 @@ function cm.initial_effect(c) ...@@ -98,7 +119,9 @@ function cm.initial_effect(c)
function Card.RemoveOverlayCard(oc,sp,min,max,r) function Card.RemoveOverlayCard(oc,sp,min,max,r)
if Duel.GetFlagEffect(0,m)>0 and min==1 and max==1 then if Duel.GetFlagEffect(0,m)>0 and min==1 and max==1 then
local og=oc:GetOverlayGroup() local og=oc:GetOverlayGroup()
og=og:Select(sp,min,max,nil) Duel.Hint(HINT_CARD,0,m)
cm[sp]=cm[sp]+1
og=Local_RandomSelect(og,sp,1)
local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT) local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local ct=Duel.SendtoGrave(og,r) local ct=Duel.SendtoGrave(og,r)
if ct>0 and e then Duel.RaiseSingleEvent(oc,EVENT_DETACH_MATERIAL,e,0,0,0,0) end if ct>0 and e then Duel.RaiseSingleEvent(oc,EVENT_DETACH_MATERIAL,e,0,0,0,0) end
......
...@@ -123,7 +123,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -123,7 +123,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
if dc==1 or dc==2 or dc==3 then if dc==1 or dc==2 or dc==3 then
Duel.Damage(tp,1500,REASON_EFFECT) Duel.Damage(tp,1500,REASON_EFFECT)
else else
Damage(1-tp,dc*500,REASON_EFFECT) Duel.Damage(1-tp,dc*500,REASON_EFFECT)
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)
......
...@@ -82,12 +82,12 @@ function cm.sumop(e,tp,eg,ep,ev,re,r,rp) ...@@ -82,12 +82,12 @@ function cm.sumop(e,tp,eg,ep,ev,re,r,rp)
Duel.MSet(tp,c,true,nil) Duel.MSet(tp,c,true,nil)
end end
end end
function cm.cfilter1(c) function cm.cfilter1(c,tp)
return c:IsAbleToRemoveAsCost() return c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,1,c)
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter1,tp,LOCATION_GRAVE,LOCATION_GRAVE,3,nil) and Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 end if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter1,tp,LOCATION_GRAVE,LOCATION_GRAVE,3,nil,tp) and Duel.GetCustomActivityCount(m,tp,ACTIVITY_SPSUMMON)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,cm.cfilter1,tp,LOCATION_GRAVE,LOCATION_GRAVE,3,3,nil) local g=Duel.SelectMatchingCard(tp,cm.cfilter1,tp,LOCATION_GRAVE,LOCATION_GRAVE,3,3,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST) Duel.Remove(g,POS_FACEUP,REASON_COST)
...@@ -98,14 +98,15 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -98,14 +98,15 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0) e1:SetTargetRange(1,0)
e1:SetTarget(cm.splimit)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
end end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,2,nil) end if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,LOCATION_ONFIELD+LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,LOCATION_ONFIELD+LOCATION_GRAVE)
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp) function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:Select(tp,1,1,nil) local sg=g:Select(tp,1,1,nil)
......
...@@ -35,7 +35,7 @@ function cm.op(e,tp) ...@@ -35,7 +35,7 @@ function cm.op(e,tp)
cm.initial_effect=function() end cm.initial_effect=function() end
tc:ReplaceEffect(m,0) tc:ReplaceEffect(m,0)
cm.initial_effect=ini cm.initial_effect=ini
tc.initial_effect(tc) if tc.initial_effect then tc.initial_effect(tc) end
end end
function Duel.SetChainLimit(...) function Duel.SetChainLimit(...)
return return
...@@ -48,7 +48,7 @@ function cm.hapeop(e) ...@@ -48,7 +48,7 @@ function cm.hapeop(e)
for p=0,1 do for p=0,1 do
for _,val in pairs(cm.codelist) do for _,val in pairs(cm.codelist) do
for _,ae in pairs({Duel.IsPlayerAffectedByEffect(p,val)}) do for _,ae in pairs({Duel.IsPlayerAffectedByEffect(p,val)}) do
if ae:GetType()&EFFECT_TYPE_SINGLE==0 then if ae:GetType()&EFFECT_TYPE_SINGLE==0 and ae:GetProperty()&EFFECT_FLAG_UNCOPYABLE==0 then
ae:SetCondition(aux.FALSE) ae:SetCondition(aux.FALSE)
end end
end end
......
...@@ -25,7 +25,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -25,7 +25,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
og=Group.__sub(g,cg) og=Group.__sub(g,cg)
else og=g end else og=g end
end end
local b1=#og>0 and og:IsExists(Card.IsAbleToHand,1,nil) and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_TRAP) local b1=#og>0 and og:IsExists(Card.IsAbleToHand,1,nil) and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_SPELL)
local b2=Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) local b2=Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil)
if chk==0 then return b1 or b2 end if chk==0 then return b1 or b2 end
local op=0 local op=0
...@@ -43,7 +43,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -43,7 +43,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
e:SetLabel(op) e:SetLabel(op)
if op~=1 then if op~=1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp,TYPE_TRAP) local ac=Duel.AnnounceCard(tp,TYPE_SPELL)
Duel.SetTargetParam(ac) Duel.SetTargetParam(ac)
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0) Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0)
end end
......
...@@ -25,7 +25,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -25,7 +25,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
og=Group.__sub(g,cg) og=Group.__sub(g,cg)
else og=g end else og=g end
end end
local b1=#og>0 and og:IsExists(Card.IsAbleToHand,1,nil) and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_SPELL) local b1=#og>0 and og:IsExists(Card.IsAbleToHand,1,nil) and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_TRAP)
local b2=Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) local b2=Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil)
if chk==0 then return b1 or b2 end if chk==0 then return b1 or b2 end
local op=0 local op=0
...@@ -43,7 +43,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -43,7 +43,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
e:SetLabel(op) e:SetLabel(op)
if op~=1 then if op~=1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp,TYPE_SPELL) local ac=Duel.AnnounceCard(tp,TYPE_TRAP)
Duel.SetTargetParam(ac) Duel.SetTargetParam(ac)
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0) Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0)
end end
......
...@@ -40,7 +40,7 @@ function cm.spfilter(c,e,tp) ...@@ -40,7 +40,7 @@ function cm.spfilter(c,e,tp)
return c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeck() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end if chk==0 then return e:GetHandler():IsAbleToDeck() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,e:GetHandler(),e,tp) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end end
......
...@@ -190,6 +190,7 @@ function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -190,6 +190,7 @@ function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
end end
Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT) Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)
local ct=Duel.GetOperatedGroup():FilterCount(Card.IsCode,nil,7429151) local ct=Duel.GetOperatedGroup():FilterCount(Card.IsCode,nil,7429151)
local tdg=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil)
local p=tp local p=tp
for i=1,2 do for i=1,2 do
local dg=g:Filter(cm.seqfilter,nil,p) local dg=g:Filter(cm.seqfilter,nil,p)
......
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