Commit 958d30ae authored by Vury Leo's avatar Vury Leo

tuning 白の枢機竜

parent 2ecb3ab8
--沼地のドロゴン --沼地のドロゴン
function c54757758.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
--fusion material --fusion material
c:EnableReviveLimit() c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,c54757758.ffilter,2,true) Fusion.AddFusionProcedure(c,{
slots={
Fusion.Slot.Group({
min=2,
max=2,
--- @param mc Card
unique_by=function(mc) return {mc:GetRace()} end,
has_same={
function(mc,tc) return mc:GetFusionAttribute(tc:GetOwner()) end,
}
})
}
})
--cannot be target --cannot be target
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
...@@ -17,35 +30,35 @@ function c54757758.initial_effect(c) ...@@ -17,35 +30,35 @@ function c54757758.initial_effect(c)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(c54757758.tglimit) e2:SetTarget(s.tglimit)
e2:SetValue(aux.tgoval) e2:SetValue(aux.tgoval)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--att change --att change
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(54757758,0)) e3:SetDescription(aux.Stringid(id,0))
e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN) e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE) e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1) e3:SetCountLimit(1)
e3:SetTarget(c54757758.atttg) e3:SetTarget(s.atttg)
e3:SetOperation(c54757758.attop) e3:SetOperation(s.attop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c54757758.ffilter(c,fc,sub,mg,sg) function s.ffilter(c,fc,sub,mg,sg)
return not sg or sg:FilterCount(aux.TRUE,c)==0 return not sg or sg:FilterCount(aux.TRUE,c)==0
or (sg:IsExists(Card.IsFusionAttribute,1,c,c:GetFusionAttribute()) or (sg:IsExists(Card.IsFusionAttribute,1,c,c:GetFusionAttribute())
and not sg:IsExists(Card.IsRace,1,c,c:GetRace())) and not sg:IsExists(Card.IsRace,1,c,c:GetRace()))
end end
function c54757758.tglimit(e,c) function s.tglimit(e,c)
return c:IsAttribute(e:GetHandler():GetAttribute()) return c:IsAttribute(e:GetHandler():GetAttribute())
end end
function c54757758.atttg(e,tp,eg,ep,ev,re,r,rp,chk) function s.atttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE)
local aat=Duel.AnnounceAttribute(tp,1,ATTRIBUTE_ALL&~e:GetHandler():GetAttribute()) local aat=Duel.AnnounceAttribute(tp,1,ATTRIBUTE_ALL&~e:GetHandler():GetAttribute())
e:SetLabel(aat) e:SetLabel(aat)
end end
function c54757758.attop(e,tp,eg,ep,ev,re,r,rp) function s.attop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
......
...@@ -3673,9 +3673,9 @@ function Fusion.SearchGroup(e,leftovers,mg_base,grp,tc,fgoalcheck,chkf) ...@@ -3673,9 +3673,9 @@ function Fusion.SearchGroup(e,leftovers,mg_base,grp,tc,fgoalcheck,chkf)
local function dfs(start,depth) local function dfs(start,depth)
-- If we have at least grp.min cards, test this subset immediately -- If we have at least grp.min cards, test this subset immediately
if depth>=grp.min then if depth>grp.min then
-- build subset group and merged material group -- build subset group and merged material group
local sub_g_arr={table.unpack(comb,1,depth)} local sub_g_arr={table.unpack(comb,1,depth-1)}
local subG=Group.FromCards(table.unpack(sub_g_arr)) local subG=Group.FromCards(table.unpack(sub_g_arr))
local mg_tmp=mg_base:Clone() local mg_tmp=mg_base:Clone()
mg_tmp:Merge(subG) mg_tmp:Merge(subG)
...@@ -3696,28 +3696,58 @@ function Fusion.SearchGroup(e,leftovers,mg_base,grp,tc,fgoalcheck,chkf) ...@@ -3696,28 +3696,58 @@ function Fusion.SearchGroup(e,leftovers,mg_base,grp,tc,fgoalcheck,chkf)
end end
-- Stop recursing if we've hit grp.max -- Stop recursing if we've hit grp.max
if depth==grp.max then if depth>grp.max then
return false return false
end end
-- Prune if not enough cards remain to reach grp.min -- Prune if not enough cards remain to reach grp.min
if #matched-start+1+depth<grp.min then if #matched-start+depth<grp.min then
return false return false
end end
-- Otherwise, try adding one more card -- Otherwise, try adding one more card
for i=start,#matched do for i=start,#matched do
comb[depth+1]=matched[i] comb[depth]=matched[i]
if dfs(i+1,depth+1) then local prune=false
return true local partial={table.unpack(comb,1,depth)}
-- aux.FCheckAdditional prune
if not prune and aux.FCheckAdditional then
local mg_p=mg_base:Clone()
mg_p:Merge(Group.FromCards(table.unpack(partial)))
if not aux.FCheckAdditional(tc:GetOwner(),mg_p,tc) then
prune=true
end
end end
comb[depth+1]=nil
-- early unique_by prune on partial subset via UniqueByMatching
if not prune and grp.unique_by then
local part_matcher=Fusion.UniqueByMatching(grp.unique_by,#partial)
if not part_matcher(partial) then
prune=true
end
end
-- early has_same prune on partial subset
if not prune and grp.has_same and #partial>1 then
if not Fusion.CheckHasSame(grp,partial,e) then
prune=true
end
end
if not prune then
if dfs(i+1,depth+1) then
return true
end
end
comb[depth]=nil
end end
return false return false
end end
-- kick off the DFS -- kick off the DFS
return dfs(1,0) return dfs(1,1)
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