Commit 755e54b7 authored by Vury Leo's avatar Vury Leo

Add 調弦の魔術師

parent 849699be
......@@ -3468,14 +3468,14 @@ function Fusion.AddFusionProcedure(c, opts)
e:SetType(EFFECT_TYPE_SINGLE)
e:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e:SetCode(EFFECT_FUSION_MATERIAL)
e:SetCondition(Fusion.SeededCondition(c,patterns))
e:SetOperation(Fusion.SeededOperation(c,patterns))
e:SetCondition(Fusion.FusionCondition(c,patterns))
e:SetOperation(Fusion.FusionOperation(c,patterns))
e:SetDescription(1379)
c:RegisterEffect(e)
end
---@param allow_extras boolean whether to allow extra materials for checking propose
function Fusion.FusionCondition(tc,slots,mat_filter,fgoalcheck,allow_extras,selected)
function Fusion.BasicCondition(tc,slots,mat_filter,fgoalcheck,allow_extras,selected)
--g:Material group(nil for Instant Fusion)
--gc:Material already used
--chkf: check field, default:PLAYER_NONE
......@@ -3643,6 +3643,42 @@ function Fusion.FusionCondition(tc,slots,mat_filter,fgoalcheck,allow_extras,sele
end
end
end
-- build mg
local mg=Group.FromCards(table.unpack(S))
-- merge selected
mg:Merge(selected)
-- merge in the DFS‐used cards
for idx,flag in pairs(used) do
if flag then
mg:AddCard(cards[idx])
end
end
if fgoalcheck then
if not fgoalcheck(mg) then
return false
end
end
if aux.FCheckAdditional then
if not aux.FCheckAdditional(tc:GetOwner(),mg,tc) then
return false
end
end
if aux.FGoalCheckAdditional then
if not aux.FGoalCheckAdditional(tc:GetOwner(),mg,tc) then
return false
end
end
if not aux.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_F)(mg) then
return false
end
-- ensure there's at least one free Monster Zone if chkf requests a field-checked summon
if chkf&0xf~=PLAYER_NONE then
local tp=chkf&0xf
if Duel.GetLocationCountFromEx(tp,tp,mg,tc)<=0 then
return false
end
end
return true
end
......@@ -3724,7 +3760,9 @@ function Fusion.FusionCondition(tc,slots,mat_filter,fgoalcheck,allow_extras,sele
return false
end
end
if not aux.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_F)(mg) then
return false
end
-- ensure there's at least one free Monster Zone if chkf requests a field-checked summon
if chkf&0xf~=PLAYER_NONE then
local tp=chkf&0xf
......@@ -4194,7 +4232,7 @@ function Fusion.CanCompleteFromMappings(e,sel,eg,slots,mat_filter,fgoalcheck,tc,
-- if nothing remains, we exhausted slots, check fgoal
if #rem_slots==0 then
if (fgoalcheck==nil or fgoalcheck(sel)==true) and (aux.FGoalCheckAdditional==nil or aux.FGoalCheckAdditional(tc:GetOwner(),sel,tc)) then
if (fgoalcheck==nil or fgoalcheck(sel)==true) and (aux.FGoalCheckAdditional==nil or aux.FGoalCheckAdditional(tc:GetOwner(),sel,tc)) and aux.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_F)(sel) then
Fusion.LockedCodes=old_locked
return true
else
......@@ -4204,7 +4242,7 @@ function Fusion.CanCompleteFromMappings(e,sel,eg,slots,mat_filter,fgoalcheck,tc,
end
-- delegate to FusionCondition (allow_extras = true)
local search_cond=Fusion.FusionCondition(tc,rem_slots,mat_filter,fgoalcheck,true,sel)
local search_cond=Fusion.BasicCondition(tc,rem_slots,mat_filter,fgoalcheck,true,sel)
if search_cond(e,rem_pool,gc,chkf) then
Fusion.LockedCodes=old_locked
return true
......@@ -4341,7 +4379,7 @@ function Fusion.BuildPatterns(opts)
return patterns
end
-- Helper: combine multiple patterns into one condition function (no goto)
-- Helper: combine multiple patterns into one condition function
function Fusion.MultiCondition(tc,patterns,allow_extras)
return function(e,g,gc,chkf,selected)
if not g then return false end
......@@ -4358,7 +4396,7 @@ function Fusion.MultiCondition(tc,patterns,allow_extras)
end
end
if ok then
local cond=Fusion.FusionCondition(tc,pat.slots,pat.mat_filter,pat.fgoalcheck,allow_extras,selected)
local cond=Fusion.BasicCondition(tc,pat.slots,pat.mat_filter,pat.fgoalcheck,allow_extras,selected)
if cond(e,g,gc,chkf) then
return true
end
......@@ -4493,7 +4531,7 @@ end
--- then, if none complete, falls back to the strict DFS.
--- @param tc Card
--- @param patterns table[]
function Fusion.SeededCondition(tc,patterns)
function Fusion.FusionCondition(tc,patterns)
return function(e,g,gc,chkf)
if not g then return false end
......@@ -4516,7 +4554,7 @@ function Fusion.SeededCondition(tc,patterns)
end
function Fusion.SeededOperation(c,patterns)
function Fusion.FusionOperation(c,patterns)
return function(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
-- build selected = {gc}
local selected = Group.CreateGroup()
......
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