Commit 153090a9 authored by Nemo Ma's avatar Nemo Ma

fix

parent 4e1212f4
......@@ -205,7 +205,7 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if #mg[i]>ft[i] then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451461,7))
local ct=math.min(#(mg[i]-pmg[i])+pft[i],ft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,nil,pft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,pft[i])
local ptg=tg:Filter(Card.IsPreviousLocation,nil,LOCATION_PZONE)
for tc in aux.Next(ptg) do cm.returntofield(tc) end
for tc in aux.Next(tg-ptg) do cm.returntofield(tc) end
......
......@@ -209,7 +209,7 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if #mg[i]>ft[i] then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451461,7))
local ct=math.min(#(mg[i]-pmg[i])+pft[i],ft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,nil,pft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,pft[i])
local ptg=tg:Filter(Card.IsPreviousLocation,nil,LOCATION_PZONE)
for tc in aux.Next(ptg) do cm.returntofield(tc) end
for tc in aux.Next(tg-ptg) do cm.returntofield(tc) end
......
......@@ -265,7 +265,7 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if #mg[i]>ft[i] then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451461,7))
local ct=math.min(#(mg[i]-pmg[i])+pft[i],ft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,nil,pft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,pft[i])
local ptg=tg:Filter(Card.IsPreviousLocation,nil,LOCATION_PZONE)
for tc in aux.Next(ptg) do cm.returntofield(tc) end
for tc in aux.Next(tg-ptg) do cm.returntofield(tc) end
......
......@@ -243,7 +243,7 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if #mg[i]>ft[i] then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451461,7))
local ct=math.min(#(mg[i]-pmg[i])+pft[i],ft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,nil,pft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,pft[i])
local ptg=tg:Filter(Card.IsPreviousLocation,nil,LOCATION_PZONE)
for tc in aux.Next(ptg) do cm.returntofield(tc) end
for tc in aux.Next(tg-ptg) do cm.returntofield(tc) end
......
......@@ -86,7 +86,7 @@ function cm.fselect(g,ng,goal,tp)
aux.GCheckAdditional=nil
return tc
end
function cm.fselect2(g,g1,lv,tp)
function cm.fselect3(g,g1,lv,tp)
return g:GetSum(cm.lvplus)==lv and Duel.GetMZoneCount(tp,g+g1)>0
end
function cm.hspcheck(g,ng,goal,tp)
......@@ -101,13 +101,13 @@ function cm.hspgcheck(g,c,mg,f,min,max,ext_params)
end
function cm.hspcheck2(g,g1,lv,tp)
Duel.SetSelectedCard(g)
return g:CheckSubGroup(cm.fselect2,1,#g,g1,lv,tp)
return g:CheckSubGroup(cm.fselect3,1,#g,g1,lv,tp)
end
function cm.hspgcheck2(g,c,mg,f,min,max,ext_params)
local g1,lv,tp=table.unpack(ext_params)
if g:GetSum(cm.lvplus)<=lv then return true end
Duel.SetSelectedCard(g)
return g:CheckSubGroup(cm.fselect2,1,#g,g1,lv,tp)
return g:CheckSubGroup(cm.fselect3,1,#g,g1,lv,tp)
end
function cm.accost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......@@ -264,7 +264,7 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if #mg[i]>ft[i] then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451461,7))
local ct=math.min(#(mg[i]-pmg[i])+pft[i],ft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,nil,pft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,pft[i])
local ptg=tg:Filter(Card.IsPreviousLocation,nil,LOCATION_PZONE)
for tc in aux.Next(ptg) do cm.returntofield(tc) end
for tc in aux.Next(tg-ptg) do cm.returntofield(tc) end
......
......@@ -89,7 +89,7 @@ function cm.fselect(g,ng,goal,tp)
aux.GCheckAdditional=nil
return tc
end
function cm.fselect2(g,g1,lv,tp)
function cm.fselect3(g,g1,lv,tp)
return g:GetSum(cm.lvplus)==lv and Duel.GetMZoneCount(tp,g+g1)>0
end
function cm.hspcheck(g,ng,goal,tp)
......@@ -104,13 +104,13 @@ function cm.hspgcheck(g,c,mg,f,min,max,ext_params)
end
function cm.hspcheck2(g,g1,lv,tp)
Duel.SetSelectedCard(g)
return g:CheckSubGroup(cm.fselect2,1,#g,g1,lv,tp)
return g:CheckSubGroup(cm.fselect3,1,#g,g1,lv,tp)
end
function cm.hspgcheck2(g,c,mg,f,min,max,ext_params)
local g1,lv,tp=table.unpack(ext_params)
if g:GetSum(cm.lvplus)<=lv then return true end
Duel.SetSelectedCard(g)
return g:CheckSubGroup(cm.fselect2,1,#g,g1,lv,tp)
return g:CheckSubGroup(cm.fselect3,1,#g,g1,lv,tp)
end
function cm.chcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......@@ -293,7 +293,7 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if #mg[i]>ft[i] then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451461,7))
local ct=math.min(#(mg[i]-pmg[i])+pft[i],ft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,nil,pft[i])
local tg=mg[i]:SelectSubGroup(tp,cm.fselect2,false,ct,ct,pft[i])
local ptg=tg:Filter(Card.IsPreviousLocation,nil,LOCATION_PZONE)
for tc in aux.Next(ptg) do cm.returntofield(tc) end
for tc in aux.Next(tg-ptg) do cm.returntofield(tc) end
......
......@@ -17,7 +17,7 @@ function c33200522.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_SZONE)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,33200522)
e2:SetCondition(c33200522.tzcon)
e2:SetTarget(c33200522.tztg)
......
......@@ -20,9 +20,9 @@ function c33200916.initial_effect(c)
e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,33210916)
e2:SetCost(c33200916.spcost)
e2:SetTarget(c33200916.sptg)
e2:SetOperation(c33200916.spop)
e2:SetCost(c33200916.spcost1)
e2:SetTarget(c33200916.sptg1)
e2:SetOperation(c33200916.spop1)
c:RegisterEffect(e2)
--remove
local e3=Effect.CreateEffect(c)
......@@ -70,18 +70,18 @@ end
function c33200916.tgfilter(c)
return (c:IsSetCard(0x332a) or c:IsSetCard(0x881)) and c:IsType(TYPE_MONSTER) and c:IsReleasable()
end
function c33200916.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
function c33200916.spcost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c33200916.tgfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,c33200916.tgfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,e:GetHandler())
Duel.Release(g,REASON_COST)
end
function c33200916.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
function c33200916.sptg1(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 c33200916.spop(e,tp,eg,ep,ev,re,r,rp)
function c33200916.spop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
......
......@@ -58,18 +58,15 @@ function cm.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,40009560)>0 or Duel.IsExistingMatchingCard(cm.dfilter,tp,LOCATION_MZONE,0,1,nil)
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local tc,c=Duel.GetFirstTarget(),e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
Duel.Destroy(tc,REASON_EFFECT)
end
end
function cm.immcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,40009560)>0
end
\ No newline at end of file
......@@ -12,10 +12,10 @@ function cm.initial_effect(c)
e2:SetDescription(aux.Stringid(m,0))
e2:SetCategory(CATEGORY_DISABLE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e2:SetCountLimit(1,m)
e2:SetCost(cm.descost)
e2:SetTarget(cm.target)
......@@ -42,10 +42,10 @@ function cm.descost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SendtoGrave(g,REASON_COST)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and aux.disfilter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(aux.disfilter1,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,aux.disfilter1,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if chkc then return chkc:IsOnField() and aux.NegateAnyFilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
local g=Duel.SelectTarget(tp,aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -9,7 +9,7 @@ end
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(cm.cost)
......@@ -18,6 +18,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
--set
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(cm.setcost)
......@@ -29,47 +30,59 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function cm.filter1(c)
function cm.tgfilter1(c)
return cm.Diablotherhood(c) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
end
function cm.filter2(c,e,tp)
function cm.spfilter(c,e,tp)
return cm.Diablotherhood(c) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.dfilter(c)
return c:IsFaceup() and c:IsCode(40010230)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local b1=Duel.IsExistingMatchingCard(cm.filter1,tp,LOCATION_DECK,0,1,nil)
local b2=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_DECK,0,1,nil,e,tp)
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>0
local b2=Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_DECK,0,1,nil)
--local b2=true
if chk==0 then return b1 or b2 end
if chk==0 then return b2 end
local op=0
if b1 and b2 then
if b1 then
if (Duel.GetFlagEffect(tp,40009560)>0 or Duel.IsExistingMatchingCard(cm.dfilter,tp,LOCATION_MZONE,0,1,nil)) then
op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1),aux.Stringid(m,2))
else
op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1))
end
elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(m,0))
else
op=Duel.SelectOption(tp,aux.Stringid(m,1))+1
end
e:SetLabel(op)
if op~=0 then
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
--Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,LOCATION_DECK)
if op==1 then
e:SetCategory(CATEGORY_TOGRAVE)
else
e:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,LOCATION_DECK)
end
else
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,LOCATION_DECK)
end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op~=1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,cm.filter1,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
local res=0
local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
if op~=1 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>0 then
local tg=g:Select(tp,1,1,nil)
res=Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEUP)
end
if op~=0 then
local g1=Duel.SelectMatchingCard(tp,cm.filter2,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local g1=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_DECK,0,1,1,nil)
if g1:GetCount()>0 then
Duel.SpecialSummon(g1,0,tp,tp,false,false,POS_FACEUP)
if op==2 and res~=0 then Duel.BreakEffect() end
Duel.SendtoGrave(g1,REASON_EFFECT)
end
end
end
......
......@@ -2594,7 +2594,6 @@ function cm.AllEffectRstop(e,tp,eg,ep,ev,re,r,rp)
end
end
if x then
Debug.Message(114)
local ex2=se:Clone()
ex2:SetCode(EVENT_LEAVE_FIELD)
sc:RegisterEffect(ex2)
......
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