Commit 757eb906 authored by nekrozar's avatar nekrozar Committed by GitHub

update EFFECT_EXTRA_LINK_MATERIAL (#1206)

parent fee0ec6a
...@@ -6,16 +6,9 @@ function c2347477.initial_effect(c) ...@@ -6,16 +6,9 @@ function c2347477.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL) e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL)
e1:SetRange(LOCATION_HAND) e1:SetRange(LOCATION_HAND)
e1:SetCondition(c2347477.matcon) e1:SetCountLimit(1,2347477)
e1:SetValue(c2347477.matval) e1:SetValue(c2347477.matval)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCondition(c2347477.ctcon)
e2:SetOperation(c2347477.ctop)
c:RegisterEffect(e2)
--search --search
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(2347477,0)) e3:SetDescription(aux.Stringid(2347477,0))
...@@ -23,15 +16,12 @@ function c2347477.initial_effect(c) ...@@ -23,15 +16,12 @@ function c2347477.initial_effect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_BE_MATERIAL) e3:SetCode(EVENT_BE_MATERIAL)
e3:SetCountLimit(1,2347477) e3:SetCountLimit(1,2347478)
e3:SetCondition(c2347477.thcon) e3:SetCondition(c2347477.thcon)
e3:SetTarget(c2347477.thtg) e3:SetTarget(c2347477.thtg)
e3:SetOperation(c2347477.thop) e3:SetOperation(c2347477.thop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c2347477.matcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),2347477)==0
end
function c2347477.mfilter(c) function c2347477.mfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_CYBERSE) return c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_CYBERSE)
end end
...@@ -41,12 +31,6 @@ end ...@@ -41,12 +31,6 @@ end
function c2347477.matval(e,c,mg) function c2347477.matval(e,c,mg)
return c:IsSetCard(0x101) and mg:IsExists(c2347477.mfilter,1,nil) and not mg:IsExists(c2347477.exmfilter,1,nil) return c:IsSetCard(0x101) and mg:IsExists(c2347477.mfilter,1,nil) and not mg:IsExists(c2347477.exmfilter,1,nil)
end end
function c2347477.ctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND)
end
function c2347477.ctop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,2347477,RESET_PHASE+PHASE_END,0,1)
end
function c2347477.thcon(e,tp,eg,ep,ev,re,r,rp) function c2347477.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
e:SetLabel(0) e:SetLabel(0)
......
...@@ -6,16 +6,9 @@ function c30114823.initial_effect(c) ...@@ -6,16 +6,9 @@ function c30114823.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL) e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL)
e1:SetRange(LOCATION_HAND) e1:SetRange(LOCATION_HAND)
e1:SetCondition(c30114823.matcon) e1:SetCountLimit(1,30114823)
e1:SetValue(c30114823.matval) e1:SetValue(c30114823.matval)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCondition(c30114823.ctcon)
e2:SetOperation(c30114823.ctop)
c:RegisterEffect(e2)
--to grave --to grave
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(30114823,0)) e3:SetDescription(aux.Stringid(30114823,0))
...@@ -23,15 +16,12 @@ function c30114823.initial_effect(c) ...@@ -23,15 +16,12 @@ function c30114823.initial_effect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_BE_MATERIAL) e3:SetCode(EVENT_BE_MATERIAL)
e3:SetCountLimit(1,30114823) e3:SetCountLimit(1,30114824)
e3:SetCondition(c30114823.tdcon) e3:SetCondition(c30114823.tdcon)
e3:SetTarget(c30114823.tdtg) e3:SetTarget(c30114823.tdtg)
e3:SetOperation(c30114823.tdop) e3:SetOperation(c30114823.tdop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c30114823.matcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),30114823)==0
end
function c30114823.mfilter(c) function c30114823.mfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_CYBERSE) return c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_CYBERSE)
end end
...@@ -41,12 +31,6 @@ end ...@@ -41,12 +31,6 @@ end
function c30114823.matval(e,c,mg) function c30114823.matval(e,c,mg)
return c:IsSetCard(0x101) and mg:IsExists(c30114823.mfilter,1,nil) and not mg:IsExists(c30114823.exmfilter,1,nil) return c:IsSetCard(0x101) and mg:IsExists(c30114823.mfilter,1,nil) and not mg:IsExists(c30114823.exmfilter,1,nil)
end end
function c30114823.ctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND)
end
function c30114823.ctop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,30114823,RESET_PHASE+PHASE_END,0,1)
end
function c30114823.tdcon(e,tp,eg,ep,ev,re,r,rp) function c30114823.tdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
e:SetLabel(0) e:SetLabel(0)
......
...@@ -6,16 +6,9 @@ function c75130221.initial_effect(c) ...@@ -6,16 +6,9 @@ function c75130221.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL) e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL)
e1:SetRange(LOCATION_HAND) e1:SetRange(LOCATION_HAND)
e1:SetCondition(c75130221.matcon) e1:SetCountLimit(1,75130221)
e1:SetValue(c75130221.matval) e1:SetValue(c75130221.matval)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCondition(c75130221.ctcon)
e2:SetOperation(c75130221.ctop)
c:RegisterEffect(e2)
--disable --disable
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(75130221,0)) e3:SetDescription(aux.Stringid(75130221,0))
...@@ -23,15 +16,12 @@ function c75130221.initial_effect(c) ...@@ -23,15 +16,12 @@ function c75130221.initial_effect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_BE_MATERIAL) e3:SetCode(EVENT_BE_MATERIAL)
e3:SetCountLimit(1,75130221) e3:SetCountLimit(1,75130222)
e3:SetCondition(c75130221.discon) e3:SetCondition(c75130221.discon)
e3:SetTarget(c75130221.distg) e3:SetTarget(c75130221.distg)
e3:SetOperation(c75130221.disop) e3:SetOperation(c75130221.disop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c75130221.matcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),75130221)==0
end
function c75130221.mfilter(c) function c75130221.mfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_CYBERSE) return c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_CYBERSE)
end end
...@@ -41,12 +31,6 @@ end ...@@ -41,12 +31,6 @@ end
function c75130221.matval(e,c,mg) function c75130221.matval(e,c,mg)
return c:IsSetCard(0x101) and mg:IsExists(c75130221.mfilter,1,nil) and not mg:IsExists(c75130221.exmfilter,1,nil) return c:IsSetCard(0x101) and mg:IsExists(c75130221.mfilter,1,nil) and not mg:IsExists(c75130221.exmfilter,1,nil)
end end
function c75130221.ctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND)
end
function c75130221.ctop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,75130221,RESET_PHASE+PHASE_END,0,1)
end
function c75130221.discon(e,tp,eg,ep,ev,re,r,rp) function c75130221.discon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
e:SetLabel(0) e:SetLabel(0)
......
...@@ -1823,9 +1823,9 @@ end ...@@ -1823,9 +1823,9 @@ end
function Auxiliary.LConditionFilter(c,f,lc) function Auxiliary.LConditionFilter(c,f,lc)
return c:IsFaceup() and c:IsCanBeLinkMaterial(lc) and (not f or f(c)) return c:IsFaceup() and c:IsCanBeLinkMaterial(lc) and (not f or f(c))
end end
function Auxiliary.LExtraFilter(c,f,lc) function Auxiliary.LExtraFilter(c,f,lc,tp)
if c:IsLocation(LOCATION_ONFIELD) and not c:IsFaceup() then return false end if c:IsLocation(LOCATION_ONFIELD) and not c:IsFaceup() then return false end
return c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL) and c:IsCanBeLinkMaterial(lc) and (not f or f(c)) return c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp) and c:IsCanBeLinkMaterial(lc) and (not f or f(c))
end end
function Auxiliary.GetLinkCount(c) function Auxiliary.GetLinkCount(c)
if c:IsType(TYPE_LINK) and c:GetLink()>1 then if c:IsType(TYPE_LINK) and c:GetLink()>1 then
...@@ -1834,28 +1834,40 @@ function Auxiliary.GetLinkCount(c) ...@@ -1834,28 +1834,40 @@ function Auxiliary.GetLinkCount(c)
end end
function Auxiliary.GetLinkMaterials(tp,f,lc) function Auxiliary.GetLinkMaterials(tp,f,lc)
local mg=Duel.GetMatchingGroup(Auxiliary.LConditionFilter,tp,LOCATION_MZONE,0,nil,f,lc) local mg=Duel.GetMatchingGroup(Auxiliary.LConditionFilter,tp,LOCATION_MZONE,0,nil,f,lc)
local mg2=Duel.GetMatchingGroup(Auxiliary.LExtraFilter,tp,LOCATION_HAND+LOCATION_SZONE,LOCATION_ONFIELD,nil,f,lc) local mg2=Duel.GetMatchingGroup(Auxiliary.LExtraFilter,tp,LOCATION_HAND+LOCATION_SZONE,LOCATION_ONFIELD,nil,f,lc,tp)
if mg2:GetCount()>0 then mg:Merge(mg2) end if mg2:GetCount()>0 then mg:Merge(mg2) end
return mg return mg
end end
function Auxiliary.LCheckOtherMaterial(c,mg,lc) function Auxiliary.LCheckOtherMaterial(c,mg,lc,tp)
local le={c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL)} local le={c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
for _,te in pairs(le) do for _,te in pairs(le) do
local f=te:GetValue() local f=te:GetValue()
if f and not f(te,lc,mg) then return false end if f and not f(te,lc,mg) then return false end
end end
return true return true
end end
function Auxiliary.LUncompatibilityFilter(c,sg,lc) function Auxiliary.LUncompatibilityFilter(c,sg,lc,tp)
local mg=sg:Filter(aux.TRUE,c) local mg=sg:Filter(aux.TRUE,c)
return not Auxiliary.LCheckOtherMaterial(c,mg,lc) return not Auxiliary.LCheckOtherMaterial(c,mg,lc,tp)
end end
function Auxiliary.LCheckGoal(sg,tp,lc,gf,lmat) function Auxiliary.LCheckGoal(sg,tp,lc,gf,lmat)
return sg:CheckWithSumEqual(Auxiliary.GetLinkCount,lc:GetLink(),#sg,#sg) return sg:CheckWithSumEqual(Auxiliary.GetLinkCount,lc:GetLink(),#sg,#sg)
and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg)) and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg))
and not sg:IsExists(Auxiliary.LUncompatibilityFilter,1,nil,sg,lc) and not sg:IsExists(Auxiliary.LUncompatibilityFilter,1,nil,sg,lc,tp)
and (not lmat or sg:IsContains(lmat)) and (not lmat or sg:IsContains(lmat))
end end
function Auxiliary.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()
if not f or f(te,lc,sg) then
te:UseCountLimit(tp)
end
end
end
end
function Auxiliary.LinkCondition(f,minc,maxc,gf) function Auxiliary.LinkCondition(f,minc,maxc,gf)
return function(e,c,og,lmat,min,max) return function(e,c,og,lmat,min,max)
if c==nil then return true end if c==nil then return true end
...@@ -1919,6 +1931,7 @@ function Auxiliary.LinkOperation(f,minc,maxc,gf) ...@@ -1919,6 +1931,7 @@ function Auxiliary.LinkOperation(f,minc,maxc,gf)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,lmat,min,max) return function(e,tp,eg,ep,ev,re,r,rp,c,og,lmat,min,max)
local g=e:GetLabelObject() local g=e:GetLabelObject()
c:SetMaterial(g) c:SetMaterial(g)
Auxiliary.LExtraMaterialCount(g,c,tp)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_LINK) Duel.SendtoGrave(g,REASON_MATERIAL+REASON_LINK)
g:DeleteGroup() g:DeleteGroup()
end end
......
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