Commit 284b5b8c authored by Vury Leo's avatar Vury Leo

tuning インフェルノイド・ティエラ

parent a5578101
......@@ -2,7 +2,15 @@
local s,id,o=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0xbb),2,true)
Fusion.AddFusionProcedure(c,{
slots={
Fusion.Slot.Group({
min=2,
max=2,
filter=function(mc,tc) return mc:IsFusionSetCard(0xbb) end,
})
}
})
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
......
......@@ -3684,12 +3684,12 @@ function Fusion.SearchGroup(e,leftovers,mg_base,grp,tc,fgoalcheck,chkf,additiona
end
-- Compute a parallel fcheck array
local hasFCheck=aux.FCheckAdditional~=nil
local hasFCheck=additional_fcheck~=nil
local fcheck_ok={}
if hasFCheck then
for i,c in ipairs(matched) do
mg_base:AddCard(c)
fcheck_ok[i]=aux.FCheckAdditional(tc:GetOwner(),mg_base,tc)
fcheck_ok[i]=additional_fcheck(tc:GetOwner(),mg_base,tc)
mg_base:RemoveCard(c)
end
else
......@@ -3766,7 +3766,7 @@ function Fusion.SearchGroup(e,leftovers,mg_base,grp,tc,fgoalcheck,chkf,additiona
local mg_p=mg_base:Clone()
mg_p:Merge(Group.FromCards(table.unpack(partial)))
-- if it fails, mark prune = true
if not aux.FCheckAdditional(tc:GetOwner(),mg_p,tc) then
if not additional_fcheck(tc:GetOwner(),mg_p,tc) then
prune=true
end
end
......@@ -4492,24 +4492,41 @@ function Fusion.MultiOperation(tc,patterns)
local finishable=sg:GetCount()>=min_req and cond(e,sg,gc,chkf,selected,false--[[allow_extras]],false--[[slots_only]],locked_codes,additional_fcheck,additional_fgoalcheck,fcheck_signature)
local addable=Group.CreateGroup()
-- check fcheck on the *current* sg
local prev_ok=true
if additional_fcheck~=nil then
prev_ok=additional_fcheck(tc:GetOwner(),sg,tc)
local result_cache={}
local use_sig=(fcheck_signature~=nil or (additional_fcheck==nil and additional_fgoalcheck==nil))
for _,pat in ipairs(patterns) do
if pat.fgoalcheck~=nil then
use_sig=false
end
end
for _,mc in ipairs(eg_arr) do
if not sg:IsContains(mc) then
sg:AddCard(mc)
-- early FCheckAdditional prune: if adding this card would cause fcheck to fail, we can not add it
-- check fcheck again
local new_ok=true
if additional_fcheck~=nil then
new_ok=additional_fcheck(tc:GetOwner(),sg,tc)
end
-- prune if it was OK before but fails now
if not (prev_ok and not new_ok) then
if use_sig==true then
-- compute a stable signature for this mc
local sig=Fusion.GetMaterialCardSignature(mc,tc,active_patterns,fcheck_signature)
-- look up whether we already tested this shape
local can_add=result_cache[sig]
if can_add==nil then
-- first time seeing this signature: do the real test
local found=false
sg:AddCard(mc)
-- completion test against active patterns
for _,pat in ipairs(active_patterns) do
if Fusion.CanCompleteFromMappings(e,sg,mg,pat.slots,pat.matfilter,pat.fgoalcheck,tc,gc,chkf,locked_codes,additional_fcheck,additional_fgoalcheck,fcheck_signature) then
found=true
break
end
end
sg:RemoveCard(mc)
result_cache[sig]=found
can_add=found
end
-- if it passed, add to the selectable set
if can_add then
addable:AddCard(mc)
end
else
sg:AddCard(mc)
-- completion test against active patterns
for _,pat in ipairs(active_patterns) do
if Fusion.CanCompleteFromMappings(e,sg,mg,pat.slots,pat.matfilter,pat.fgoalcheck,tc,gc,chkf,locked_codes,additional_fcheck,additional_fgoalcheck,fcheck_signature) then
......@@ -4517,8 +4534,8 @@ function Fusion.MultiOperation(tc,patterns)
break
end
end
sg:RemoveCard(mc)
end
sg:RemoveCard(mc)
end
end
......@@ -4658,3 +4675,62 @@ function Fusion.SelectFusionMaterial(tp,tc,mg,gc,chkf,opts)
local sg=eff:GetOperation()(eff,tp,mg,gc,chkf,opts)
return sg
end
function Fusion.GetMaterialCardSignature(mc,tc,patterns,fcheck_signature)
-- helper to serialize any list‐style table into a sorted, comma‐separated string
local function serializeList(list)
local out={}
for _,v in ipairs(list) do
table.insert(out,tostring(v))
end
table.sort(out)
return table.concat(out,",")
end
local parts={}
-- for each pattern and each slot, record:
-- whether mc fits the slot’s code/matfilter
-- for group slots, the has_same and unique_by results
for _,pat in ipairs(patterns) do
for _,slot in ipairs(pat.slots) do
-- single‑slot checks
if slot.match_code or slot.match_codes or slot.filter then
local match,is_sub=Fusion.MatchSlot(mc,slot,tc)
table.insert(parts,match and "1" or "0")
table.insert(parts,is_sub and "1" or "0")
end
-- group‑slot checks
if slot.group then
if slot.group.filter then
table.insert(parts,slot.group.filter(mc) and "1" or "0")
end
if slot.group.has_same then
if slot.group.has_same then
for _,fn in ipairs(slot.group.has_same) do
local raw=fn(mc,tc)
if type(raw)=="table" then
-- serialize a returned list/array into a stable string
table.insert(parts,"[" .. serializeList(raw) .. "]")
else
-- assume bitmask or simple value
table.insert(parts,tostring(raw))
end
end
end
end
if slot.group.unique_by then
local raw=slot.group.unique_by(mc)
table.insert(parts,"[" .. serializeList(raw) .. "]")
end
end
end
end
-- optional fcheck_signature dimension
if fcheck_signature then
table.insert(parts,tostring(fcheck_signature(mc)))
end
return table.concat(parts, "|")
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