Commit 95ef6ff6 authored by Tachibana's avatar Tachibana

得得得得得

parent dd6e1ff6
Pipeline #12083 passed with stages
in 24 minutes and 38 seconds
......@@ -65,15 +65,15 @@ end
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerAffectedByEffect(tp,33401655)
end
function cm.refilter(c)
function cm.refilter1(c)
return ((c:IsType(TYPE_EFFECT) and c:IsDisabled()) or c:IsType(TYPE_NORMAL) or c:IsType(TYPE_TOKEN)) and c:IsReleasable()
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,0x34f,2,REASON_COST) or Duel.IsExistingMatchingCard(cm.refilter,tp,LOCATION_MZONE,0,1,nil) end
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,0x34f,2,REASON_COST) or Duel.IsExistingMatchingCard(cm.refilter1,tp,LOCATION_MZONE,0,1,nil) end
local b1=Duel.IsCanRemoveCounter(tp,1,0,0x34f,2,REASON_COST)
local b2=Duel.IsExistingMatchingCard(cm.refilter,tp,LOCATION_MZONE,0,1,nil)
local b2=Duel.IsExistingMatchingCard(cm.refilter1,tp,LOCATION_MZONE,0,1,nil)
if b2 and (not b1 or Duel.SelectYesNo(tp,aux.Stringid(m,2))) then
local g=Duel.SelectMatchingCard(tp,cm.refilter,tp,LOCATION_MZONE,0,1,1,nil)
local g=Duel.SelectMatchingCard(tp,cm.refilter1,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Release(g,REASON_COST)
e:SetLabel(1)
else
......@@ -93,7 +93,7 @@ function cm.thop2(e,tp,eg,ep,ev,re,r,rp)
local g2=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if #g2>0 then
Duel.HintSelection(g2)
if Duel.Destroy(g2,REASON_EFFECT)~=0 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
if Duel.Destroy(g2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(tp,aux.disfilter1,tp,LOCATION_ONFIELD,0,1,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
local tg=Duel.SelectMatchingCard(tp,aux.disfilter1,tp,LOCATION_ONFIELD,0,1,1,nil)
local tc=tg:GetFirst()
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
......
......@@ -19,24 +19,33 @@ function cm.initial_effect(c)
e3:SetCode(EFFECT_REMAIN_FIELD)
c:RegisterEffect(e3)
end
function cm.refilter(c,tp,re)
local flag=true
local value={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_RELEASE)}
if #value>0 then
for k,re in ipairs(value) do
local val=re:GetTarget()
if val and val(re,c,tp) then
flag=false
end
end
end
return c:IsReleasable() or (c:IsType(TYPE_SPELL+TYPE_TRAP) and flag)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if Duel.IsExistingMatchingCard(Card.IsReleasable,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,e:GetHandler()) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
if Duel.IsExistingMatchingCard(cm.refilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,e:GetHandler(),tp) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,Card.IsReleasable,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,99,e:GetHandler())
local ss=Duel.Release(g,REASON_COST)
local g=Duel.SelectMatchingCard(tp,cm.refilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,99,e:GetHandler(),tp)
local ss=Duel.SendtoGrave(g,REASON_COST+REASON_RELEASE)
e:SetLabel(ss)
end
end
function cm.filter(c)
return c:IsFaceup() and c:IsCanAddCounter(0x34f,2)
end
function cm.chlimit(e,ep,tp)
return tp==ep
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and cm.filter(chkc) end
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_ONFIELD,0,1,nil) end
if chk==0 then return true end
if e:GetLabel()~=0 then
Duel.SetChainLimit(cm.chlimit)
end
......
......@@ -1852,12 +1852,72 @@ function cm.ORsideLink(c,f,min,max,gf,code)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_EXTRA)
if max==nil then max=c:GetLink() end
e1:SetCondition(cm.LinkCondition(f,min,max,gf,code))
e1:SetCondition(aux.LinkCondition(f,min,max,gf,code))
e1:SetTarget(aux.LinkTarget(f,min,max,gf))
e1:SetOperation(aux.LinkOperation(f,min,max,gf))
e1:SetValue(SUMMON_TYPE_LINK)
c:RegisterEffect(e1)
end
function cm.LConditionFilter(c,f,lc)
return (c:IsFaceup() or not c:IsOnField()) and c:IsCanBeLinkMaterial(lc) and (not f or f(c))
end
function cm.LExtraFilter(c,f,lc,tp)
if c:IsLocation(LOCATION_ONFIELD) and not c:IsFaceup() then return false end
if not c:IsCanBeLinkMaterial(lc) or f and not f(c) then return false end
local le={c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
for _,te in pairs(le) do
local tf=te:GetValue()
local related,valid=tf(te,lc,nil,c,tp)
if related then return true end
end
return false
end
function cm.GetLinkCount(c)
if c:IsType(TYPE_LINK) and c:GetLink()>1 then
return 1+0x10000*c:GetLink()
else return 1 end
end
function cm.GetLinkMaterials(tp,f,lc)
local mg=Duel.GetMatchingGroup(cm.LConditionFilter,tp,LOCATION_MZONE,0,nil,f,lc)
local mg2=Duel.GetMatchingGroup(cm.LExtraFilter,tp,LOCATION_HAND+LOCATION_SZONE,LOCATION_ONFIELD,nil,f,lc,tp)
if mg2:GetCount()>0 then mg:Merge(mg2) end
return mg
end
function cm.LCheckOtherMaterial(c,mg,lc,tp)
local le={c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
local res1=false
local res2=true
for _,te in pairs(le) do
local f=te:GetValue()
local related,valid=f(te,lc,mg,c,tp)
if related then res2=false end
if related and valid then res1=true end
end
return res1 or res2
end
function cm.LUncompatibilityFilter(c,sg,lc,tp)
local mg=sg:Filter(aux.TRUE,c)
return not cm.LCheckOtherMaterial(c,mg,lc,tp)
end
function cm.LCheckGoal(sg,tp,lc,gf,lmat)
return sg:CheckWithSumEqual(cm.GetLinkCount,lc:GetLink(),#sg,#sg)
and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg))
and not sg:IsExists(cm.LUncompatibilityFilter,1,nil,sg,lc,tp)
and (not lmat or sg:IsContains(lmat))
end
function cm.LExtraMaterialCount(mg,lc,tp)
for tc in aux.Next(mg) do
local le={tc:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
for _,te in pairs(le) do
local sg=mg:Filter(aux.TRUE,tc)
local f=te:GetValue()
local related,valid=f(te,lc,sg,tc,tp)
if related and valid then
te:UseCountLimit(tp)
end
end
end
end
function cm.LinkCondition(f,minc,maxc,gf,code)
return function(e,c,og,lmat,min,max)
if c==nil then return true end
......@@ -1887,6 +1947,61 @@ function cm.LinkCondition(f,minc,maxc,gf,code)
return mg:CheckSubGroup(aux.LCheckGoal,minc,maxc,tp,c,gf,lmat)
end
end
function cm.LinkTarget(f,minc,maxc,gf)
return function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,lmat,min,max)
local minc=minc
local maxc=maxc
if min then
if min>minc then minc=min end
if max<maxc then maxc=max end
if minc>maxc then return false end
end
local mg=nil
if og then
mg=og:Filter(cm.LConditionFilter,nil,f,c)
else
mg=cm.GetLinkMaterials(tp,f,c)
end
if lmat~=nil then
if not cm.LConditionFilter(lmat,f,c) then return false end
mg:AddCard(lmat)
end
local fg=aux.GetMustMaterialGroup(tp,EFFECT_MUST_BE_LMATERIAL)
Duel.SetSelectedCard(fg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local cancel=Duel.IsSummonCancelable()
local sg=mg:SelectSubGroup(tp,cm.LCheckGoal,cancel,minc,maxc,tp,c,gf,lmat)
if sg then
sg:KeepAlive()
e:SetLabelObject(sg)
return true
else return false end
end
end
function cm.LinkOperation(f,minc,maxc,gf)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,lmat,min,max)
local g=e:GetLabelObject()
c:SetMaterial(g)
cm.LExtraMaterialCount(g,c,tp)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_LINK)
g:DeleteGroup()
end
end
function cm.EnableExtraDeckSummonCountLimit()
if cm.ExtraDeckSummonCountLimit~=nil then return end
cm.ExtraDeckSummonCountLimit={}
cm.ExtraDeckSummonCountLimit[0]=1
cm.ExtraDeckSummonCountLimit[1]=1
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
ge1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge1:SetOperation(cm.ExtraDeckSummonCountLimitReset)
Duel.RegisterEffect(ge1,0)
end
function cm.ExtraDeckSummonCountLimitReset()
cm.ExtraDeckSummonCountLimit[0]=1
cm.ExtraDeckSummonCountLimit[1]=1
end
function cm.HartrazCheck(c)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
......
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