Commit 9f9bc48f authored by wind2009's avatar wind2009

Merge branch 'new-fusion-post-opponent' into 'master'

Add Defense of the Temple to new fusion + add post_select_mat_opponent_location to procedure

See merge request !50
parents 0b073d96 2ab2ad5f
...@@ -4,7 +4,8 @@ function s.initial_effect(c) ...@@ -4,7 +4,8 @@ function s.initial_effect(c)
--Activate --Activate
local e1=FusionSpell.CreateSummonEffect(c,{ local e1=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter, fusfilter=s.fusfilter,
pre_select_mat_opponent_location=LOCATION_MZONE, post_select_mat_opponent_location=LOCATION_MZONE,
fusion_spell_matfilter=s.fusion_spell_matfilter,
additional_fcheck=s.fcheck additional_fcheck=s.fcheck
}) })
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
...@@ -16,6 +17,14 @@ function s.fusfilter(c) ...@@ -16,6 +17,14 @@ function s.fusfilter(c)
return c:IsRace(RACE_CYBERSE) return c:IsRace(RACE_CYBERSE)
end end
function s.fusion_spell_matfilter(c,e,tp)
--- if it comes from opponent, it must be a link monster
if c:IsControler(1-tp) and not c:IsType(TYPE_LINK) then
return false
end
return true
end
---@type FUSION_FGCHECK_FUNCTION ---@type FUSION_FGCHECK_FUNCTION
function s.fcheck(tp,mg,fc,mg_all) function s.fcheck(tp,mg,fc,mg_all)
-- Filter the group to get only the opponent’s Fusion Materials -- Filter the group to get only the opponent’s Fusion Materials
...@@ -25,12 +34,7 @@ function s.fcheck(tp,mg,fc,mg_all) ...@@ -25,12 +34,7 @@ function s.fcheck(tp,mg,fc,mg_all)
if #mg_opponent>1 then if #mg_opponent>1 then
return false return false
end end
-- Any opponent material used must be a LINK monster -- If using an opponent’s monster, you must also use at least one @イグニスター monster belongs to you
---@param c Card
if mg_opponent:IsExists(function(c) return not c:IsType(TYPE_LINK) end,1,nil) then
return false
end
-- If using an opponent’s monster, you must also use at least one “@Ignister” monster you control
---@param c Card ---@param c Card
if #mg_opponent>0 and not mg_all:IsExists(function(c) if #mg_opponent>0 and not mg_all:IsExists(function(c)
return c:IsControler(tp) and c:IsFusionSetCard(0x135) return c:IsControler(tp) and c:IsFusionSetCard(0x135)
......
...@@ -3,12 +3,11 @@ local s,id,o=GetID() ...@@ -3,12 +3,11 @@ local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
aux.AddCodeList(c,29762407,22082432) aux.AddCodeList(c,29762407,22082432)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=FusionSpell.CreateSummonEffect(c,{
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) fusfilter=s.fusfilter,
e1:SetType(EFFECT_TYPE_ACTIVATE) post_select_mat_opponent_location=LOCATION_MZONE,
e1:SetCode(EVENT_FREE_CHAIN) additional_fcheck=s.fcheck
e1:SetTarget(s.target) })
e1:SetOperation(s.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--search --search
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
...@@ -23,93 +22,39 @@ function s.initial_effect(c) ...@@ -23,93 +22,39 @@ function s.initial_effect(c)
e2:SetOperation(s.thop) e2:SetOperation(s.thop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function s.filter0(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave() function s.fusfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH)
end end
function s.filter1(c,e)
return not c:IsImmuneToEffect(e) ---@type FUSION_FGCHECK_FUNCTION
end function s.fcheck(tp,mg,fc,mg_all)
function s.filter2(c,e,tp,m,f,chkf) -- Filter the group to get only the opponent’s Fusion Materials
if not (c:IsType(TYPE_FUSION) and c:IsAttribute(ATTRIBUTE_EARTH) and (not f or f(c)) ---@param c Card
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)) then return false end local mg_opponent=mg:Filter(function(c) return c:IsControler(1-tp) end,nil)
aux.FCheckAdditional=s.fcheck -- If using an opponent’s monster, you must also use at least one monster mentioned "Temple of the Kings" you control
local res=c:CheckFusionMaterial(m,nil,chkf) ---@param c Card
aux.FCheckAdditional=nil if #mg_opponent>0 and not mg_all:IsExists(function(c)
return res return c:IsControler(tp) and aux.IsCodeListed(c,29762407)==true and c:IsOnField()
end end,1,nil) then
function s.ffilter(c,tp) return false
return aux.IsCodeListed(c,29762407) and c:IsControler(tp) and c:IsOnField()
end
function s.fcheck(tp,sg,fc)
return not sg:IsExists(Card.IsControler,1,nil,1-tp) or sg:IsExists(s.ffilter,1,nil,tp)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(s.filter0,tp,0,LOCATION_MZONE,nil)
mg1:Merge(mg2)
local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(s.filter0,tp,0,LOCATION_MZONE,nil):Filter(s.filter1,nil,e)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or ce and not Duel.SelectYesNo(tp,ce:GetDescription())) then
aux.FCheckAdditional=tc.branded_fusion_check or s.fcheck
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
aux.FCheckAdditional=nil
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
elseif ce then
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end end
return true
end end
function s.thcon(e,tp,eg,ep,ev,re,r,rp,chk) function s.thcon(e,tp,eg,ep,ev,re,r,rp,chk)
return Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceupEx,Card.IsCode),tp,LOCATION_ONFIELD,0,1,nil,29762407) return Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceupEx,Card.IsCode),tp,LOCATION_ONFIELD,0,1,nil,29762407)
end end
function s.thfilter(c) function s.thfilter(c)
return c:IsCode(22082432) and c:IsAbleToHand() return c:IsCode(22082432) and c:IsAbleToHand()
end end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end end
function s.thop(e,tp,eg,ep,ev,re,r,rp) function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
......
...@@ -2262,6 +2262,7 @@ end ...@@ -2262,6 +2262,7 @@ end
FusionSpell = {} FusionSpell = {}
---@alias FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION fun(tc:Card,tp:integer):integer ---@alias FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION fun(tc:Card,tp:integer):integer
---@alias FUSION_SPELL_MATFILTER_FUNCTION fun(c:Card,e:Effect,tp:integer):boolean
--- A check function for Fusion FCheckAdditional/FGoalCheckAdditional. --- A check function for Fusion FCheckAdditional/FGoalCheckAdditional.
--- Parameters: --- Parameters:
...@@ -2280,10 +2281,10 @@ FusionSpell = {} ...@@ -2280,10 +2281,10 @@ FusionSpell = {}
--- Optional filter for valid Fusion Materials. --- Optional filter for valid Fusion Materials.
--- Use only under strong constraints (e.g., D-Fusion effects). --- Use only under strong constraints (e.g., D-Fusion effects).
--- If some card can not be used even under Chain Material or EXTRA_FUSION_MATERIAL, use this filter. --- If some card can not be used even under Chain Material or EXTRA_FUSION_MATERIAL, use this filter.
--- @field matfilter? fun(c:Card,e:Effect,tp:integer):boolean --- @field matfilter? FUSION_SPELL_MATFILTER_FUNCTION
--- Location(s) to look for materials before knowing which ones will be used. --- Location(s) to look for materials before knowing which ones will be used.
--- Defaults to `LOCATION_HAND | LOCATION_MZONE`. --- Defaults to `LOCATION_HAND | LOCATION_MZONE`.
--- @field pre_select_mat_location? integer|fun():integer --- @field pre_select_mat_location? integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
--- List of operations to perform on materials based on location. --- List of operations to perform on materials based on location.
--- Defaults to: --- Defaults to:
--- ```lua --- ```lua
...@@ -2311,14 +2312,16 @@ FusionSpell = {} ...@@ -2311,14 +2312,16 @@ FusionSpell = {}
--- Optional extra targeting logic (e.g., to show hints or manage chains). --- Optional extra targeting logic (e.g., to show hints or manage chains).
--- @field extra_target? fun(e:Effect, tp:integer, eg:Group, ep:integer, ev:integer, re:Effect, r:integer, rp:integer, chk:integer):nil --- @field extra_target? fun(e:Effect, tp:integer, eg:Group, ep:integer, ev:integer, re:Effect, r:integer, rp:integer, chk:integer):nil
--- Opponent-side locations to search for materials before they are selected. --- Opponent-side locations to search for materials before they are selected.
--- @field pre_select_mat_opponent_location? integer|fun():integer --- @field pre_select_mat_opponent_location? integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
--- Opponent-side locations to search for materials after they are selected.
--- @field post_select_mat_opponent_location? integer
--- Function that returns a card that must be included in the fusion materials --- Function that returns a card that must be included in the fusion materials
--- @field gc? fun(e:Effect):Card|nil --- @field gc? fun(e:Effect):Card|nil
--- Function that material must pass to be legal as material come from fusion spell --- Function that material must pass to be legal as material come from fusion spell
--- Use under weak constraints (e.g., Vision Fusion). --- Use under weak constraints (e.g., Vision Fusion).
--- If some card can not be used by fusion spell, but could be used with EXTRA_FUSION_MATERIAL, use this filter. --- If some card can not be used by fusion spell, but could be used with EXTRA_FUSION_MATERIAL, use this filter.
--- Fusion with Chain Material will never call this function, as no material comes from fusion spell. --- Fusion with Chain Material will never call this function, as no material comes from fusion spell.
--- @field fusion_spell_matfilter? fun(c:Card):boolean --- @field fusion_spell_matfilter? FUSION_SPELL_MATFILTER_FUNCTION
--- Add LOCATION_EXTRA and opponent mzone to EFFECT_EXTRA_FUSION_MATERIAL list, remove once core updated --- Add LOCATION_EXTRA and opponent mzone to EFFECT_EXTRA_FUSION_MATERIAL list, remove once core updated
...@@ -2394,6 +2397,7 @@ function FusionSpell.CreateSummonEffect(c,opts) ...@@ -2394,6 +2397,7 @@ function FusionSpell.CreateSummonEffect(c,opts)
local stage_x_operation=opts.stage_x_operation or aux.TRUE local stage_x_operation=opts.stage_x_operation or aux.TRUE
local extra_target=opts.extra_target or aux.TRUE local extra_target=opts.extra_target or aux.TRUE
local pre_select_mat_opponent_location=opts.pre_select_mat_opponent_location or 0 local pre_select_mat_opponent_location=opts.pre_select_mat_opponent_location or 0
local post_select_mat_opponent_location=opts.post_select_mat_opponent_location or 0
local gc=opts.gc or function() return nil end local gc=opts.gc or function() return nil end
local fusion_spell_matfilter=opts.fusion_spell_matfilter or aux.TRUE local fusion_spell_matfilter=opts.fusion_spell_matfilter or aux.TRUE
...@@ -2419,6 +2423,7 @@ function FusionSpell.CreateSummonEffect(c,opts) ...@@ -2419,6 +2423,7 @@ function FusionSpell.CreateSummonEffect(c,opts)
sumpos, sumpos,
extra_target, extra_target,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter fusion_spell_matfilter
)) ))
...@@ -2435,6 +2440,7 @@ function FusionSpell.CreateSummonEffect(c,opts) ...@@ -2435,6 +2440,7 @@ function FusionSpell.CreateSummonEffect(c,opts)
sumpos, sumpos,
stage_x_operation, stage_x_operation,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter fusion_spell_matfilter
)) ))
...@@ -2443,7 +2449,7 @@ function FusionSpell.CreateSummonEffect(c,opts) ...@@ -2443,7 +2449,7 @@ function FusionSpell.CreateSummonEffect(c,opts)
end end
---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned ---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned
---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order ---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
---@param post_select_mat_location integer location where to find the materials after known the materials ---@param post_select_mat_location integer location where to find the materials after known the materials
...@@ -2454,8 +2460,9 @@ end ...@@ -2454,8 +2460,9 @@ end
---@param sumpos integer summon position ---@param sumpos integer summon position
---@param extra_target fun(e:Effect, tp:integer, eg:Group, ep:integer, ev:integer, re:Effect, r:integer, rp:integer, chk:integer):nil extra target function to add opration info etc ---@param extra_target fun(e:Effect, tp:integer, eg:Group, ep:integer, ev:integer, re:Effect, r:integer, rp:integer, chk:integer):nil extra target function to add opration info etc
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location ---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
---@param post_select_mat_opponent_location integer location where to find the materials after known the materials on opponent location
---@param gc fun(e:Effect):Card|nil Function that returns a card that must be included in the fusion materials ---@param gc fun(e:Effect):Card|nil Function that returns a card that must be included in the fusion materials
---@param fusion_spell_matfilter fun(c:Card):boolean a material must pass this to be legal as material come from fusion spell ---@param fusion_spell_matfilter FUSION_SPELL_MATFILTER_FUNCTION a material must pass this to be legal as material come from fusion spell
function FusionSpell.GetSummonTarget( function FusionSpell.GetSummonTarget(
fusfilter, fusfilter,
matfilter, matfilter,
...@@ -2469,6 +2476,7 @@ function FusionSpell.GetSummonTarget( ...@@ -2469,6 +2476,7 @@ function FusionSpell.GetSummonTarget(
sumpos, sumpos,
extra_target, extra_target,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter fusion_spell_matfilter
) )
...@@ -2491,6 +2499,7 @@ function FusionSpell.GetSummonTarget( ...@@ -2491,6 +2499,7 @@ function FusionSpell.GetSummonTarget(
additional_fgoalcheck, additional_fgoalcheck,
sumtype,sumpos, sumtype,sumpos,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter) fusion_spell_matfilter)
end, end,
...@@ -2513,7 +2522,7 @@ function FusionSpell.GetSummonTarget( ...@@ -2513,7 +2522,7 @@ function FusionSpell.GetSummonTarget(
end end
---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned ---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned
---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order ---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
---@param post_select_mat_location integer location where to find the materials after known the materials ---@param post_select_mat_location integer location where to find the materials after known the materials
...@@ -2524,8 +2533,9 @@ end ...@@ -2524,8 +2533,9 @@ end
---@param sumpos integer summon position ---@param sumpos integer summon position
---@param stage_x_operation function callback function when special summon is in progress. will be called with different stage name ---@param stage_x_operation function callback function when special summon is in progress. will be called with different stage name
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location ---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
---@param post_select_mat_opponent_location integer location where to find the materials after known the materials on opponent location
---@param gc fun(e:Effect):Card|nil Function that returns a card that must be included in the fusion materials ---@param gc fun(e:Effect):Card|nil Function that returns a card that must be included in the fusion materials
---@param fusion_spell_matfilter fun(c:Card):boolean a material must pass this to be legal as material come from fusion spell ---@param fusion_spell_matfilter FUSION_SPELL_MATFILTER_FUNCTION a material must pass this to be legal as material come from fusion spell
function FusionSpell.GetSummonOperation( function FusionSpell.GetSummonOperation(
fusfilter, fusfilter,
matfilter, matfilter,
...@@ -2539,6 +2549,7 @@ function FusionSpell.GetSummonOperation( ...@@ -2539,6 +2549,7 @@ function FusionSpell.GetSummonOperation(
sumpos, sumpos,
stage_x_operation, stage_x_operation,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter fusion_spell_matfilter
) )
...@@ -2561,6 +2572,7 @@ function FusionSpell.GetSummonOperation( ...@@ -2561,6 +2572,7 @@ function FusionSpell.GetSummonOperation(
additional_fgoalcheck, additional_fgoalcheck,
sumtype,sumpos, sumtype,sumpos,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter) fusion_spell_matfilter)
end, end,
...@@ -2613,8 +2625,19 @@ function FusionSpell.GetSummonOperation( ...@@ -2613,8 +2625,19 @@ function FusionSpell.GetSummonOperation(
post_select_mat_location, post_select_mat_location,
sumtype, sumtype,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
fusion_spell_matfilter) fusion_spell_matfilter)
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunction(additional_fcheck,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map) aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunction(
additional_fcheck,
tp,
tc,
pre_select_mat_location,
post_select_mat_location,
pre_select_mat_opponent_location,
post_select_mat_opponent_location,
fusion_spell_matfilter,
e,
mat_operation_code_map)
aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(additional_fgoalcheck,tp,tc,pre_select_mat_location,e) aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(additional_fgoalcheck,tp,tc,pre_select_mat_location,e)
materials=Duel.SelectFusionMaterial(tp,tc,mg,gc(e),tp) materials=Duel.SelectFusionMaterial(tp,tc,mg,gc(e),tp)
aux.FCheckAdditional=nil aux.FCheckAdditional=nil
...@@ -2646,11 +2669,23 @@ function FusionSpell.GetSummonOperation( ...@@ -2646,11 +2669,23 @@ function FusionSpell.GetSummonOperation(
---@type {[FUSION_OPERATION_FUNCTION]:Group} ---@type {[FUSION_OPERATION_FUNCTION]:Group}
local material_grouped_by_op={} local material_grouped_by_op={}
local materials_with_one_material_effect=materials:Filter(function(mc) return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map))==1 end,nil) local materials_with_one_material_effect=materials:Filter(function(mc)
return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,post_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map))==1
end,nil)
for material in aux.Next(materials_with_one_material_effect) do for material in aux.Next(materials_with_one_material_effect) do
--For material that can be material only by 1 effect, either fusion spell or extra material effect, do the operation on it. --For material that can be material only by 1 effect, either fusion spell or extra material effect, do the operation on it.
local fusion_operation=nil local fusion_operation=nil
local material_effect=FusionSpell.GetMaterialEffects(material,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map)[1] local material_effect=FusionSpell.GetMaterialEffects(
material,
tp,
tc,
pre_select_mat_location,
post_select_mat_location,
pre_select_mat_opponent_location,
post_select_mat_opponent_location,
fusion_spell_matfilter,
e,
mat_operation_code_map)[1]
if material_effect==true then if material_effect==true then
local fusion_operation_code=FusionSpell.GetOperationCodeByMaterialLocation(material:GetLocation(),mat_operation_code_map) local fusion_operation_code=FusionSpell.GetOperationCodeByMaterialLocation(material:GetLocation(),mat_operation_code_map)
...@@ -2672,7 +2707,9 @@ function FusionSpell.GetSummonOperation( ...@@ -2672,7 +2707,9 @@ function FusionSpell.GetSummonOperation(
material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup() material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup()
material_grouped_by_op[fusion_operation]:AddCard(material) material_grouped_by_op[fusion_operation]:AddCard(material)
end end
local materials_with_two_material_effect=materials:Filter(function(mc) return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map))==2 end,nil) local materials_with_two_material_effect=materials:Filter(function(mc)
return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,post_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map))==2
end,nil)
assert(#materials_with_one_material_effect+#materials_with_two_material_effect==#materials, "We can not have one material have zero/3+ material effect yet") assert(#materials_with_one_material_effect+#materials_with_two_material_effect==#materials, "We can not have one material have zero/3+ material effect yet")
--For material that can be material by multiple effect, ask user which to apply. --For material that can be material by multiple effect, ask user which to apply.
--As of 2025 May, if a material could be used as extra material, it must be able to be used as fusion spell material. The code below is based on this assumption. --As of 2025 May, if a material could be used as extra material, it must be able to be used as fusion spell material. The code below is based on this assumption.
...@@ -2786,7 +2823,7 @@ function FusionSpell.GetSummonOperation( ...@@ -2786,7 +2823,7 @@ function FusionSpell.GetSummonOperation(
end end
end end
---@param pre_select_mat_location integer|(fun(tc:Card,tp:integer):integer) location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param post_select_mat_location integer location where to find the materials after known the materials ---@param post_select_mat_location integer location where to find the materials after known the materials
---@return integer locations all possible locations of the material ---@return integer locations all possible locations of the material
function FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location) function FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location)
...@@ -2803,13 +2840,14 @@ end ...@@ -2803,13 +2840,14 @@ end
---@param tc Card the target card to summon ---@param tc Card the target card to summon
---@param tp integer the triggering player ---@param tp integer the triggering player
---@param e Effect the fusion effect ---@param e Effect the fusion effect
---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order ---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
---@param post_select_mat_location integer location where to find the materials after known the materials ---@param post_select_mat_location integer location where to find the materials after known the materials
---@param sumtype integer summon type ---@param sumtype integer summon type
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location ---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
---@param fusion_spell_matfilter fun(c:Card,tp:integer):boolean a material must pass this to be legal as material come from fusion spell ---@param post_select_mat_opponent_location integer location where to find the materials after known the materials on opponent location
---@param fusion_spell_matfilter FUSION_SPELL_MATFILTER_FUNCTION a material must pass this to be legal as material come from fusion spell
function FusionSpell.GetMaterialsGroupForTargetCard( function FusionSpell.GetMaterialsGroupForTargetCard(
tc, tc,
tp, tp,
...@@ -2820,16 +2858,12 @@ function FusionSpell.GetMaterialsGroupForTargetCard( ...@@ -2820,16 +2858,12 @@ function FusionSpell.GetMaterialsGroupForTargetCard(
post_select_mat_location, post_select_mat_location,
sumtype, sumtype,
pre_select_mat_opponent_location, pre_select_mat_opponent_location,
post_select_mat_opponent_location,
fusion_spell_matfilter fusion_spell_matfilter
) )
local all_locations=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location) local all_locations=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location)
local mg=FusionSpell.GetFusionMaterial(tp,all_locations) local mg=FusionSpell.GetFusionMaterial(tp,all_locations)
local calculated_mat_opponent_location=0 local calculated_mat_opponent_location=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_opponent_location,post_select_mat_opponent_location)
if type(pre_select_mat_opponent_location)=="function" then
calculated_mat_opponent_location=pre_select_mat_opponent_location(tc,tp)
else
calculated_mat_opponent_location=pre_select_mat_opponent_location
end
local opponent_mg=FusionSpell.GetFusionMaterialFromOpponentLocation(tp,calculated_mat_opponent_location) local opponent_mg=FusionSpell.GetFusionMaterialFromOpponentLocation(tp,calculated_mat_opponent_location)
if #opponent_mg>0 then if #opponent_mg>0 then
mg:Merge(opponent_mg) mg:Merge(opponent_mg)
...@@ -2848,7 +2882,7 @@ function FusionSpell.GetMaterialsGroupForTargetCard( ...@@ -2848,7 +2882,7 @@ function FusionSpell.GetMaterialsGroupForTargetCard(
mg=mg:Filter(function(mc) return FusionSpell.IsCanBeFusionMaterial(mc,tc,sumtype) end,nil) mg=mg:Filter(function(mc) return FusionSpell.IsCanBeFusionMaterial(mc,tc,sumtype) end,nil)
--- a material must come from at least one source, either from fusion spell or EXTRA_FUSION_MATERIAL --- a material must come from at least one source, either from fusion spell or EXTRA_FUSION_MATERIAL
mg=mg:Filter(function(mc) mg=mg:Filter(function(mc)
local effects=FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map) local effects=FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,post_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map)
if #effects<1 then if #effects<1 then
return false return false
end end
...@@ -2870,18 +2904,57 @@ function FusionSpell.GetOperationCodeByMaterialLocation(location,mat_operation_c ...@@ -2870,18 +2904,57 @@ function FusionSpell.GetOperationCodeByMaterialLocation(location,mat_operation_c
end end
---@param fusfilter fun(c:Card,tp:integer):boolean ---@param fusfilter fun(c:Card,tp:integer):boolean
---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|function location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE) ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE)
---@param post_select_mat_location integer location where to find the materials after known the materials
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location ---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
---@param post_select_mat_opponent_location integer location where to find the materials before known the materials on opponent location
---@param gc fun(e:Effect):Card|nil ---@param gc fun(e:Effect):Card|nil
---@param fusion_spell_matfilter fun(c:Card):boolean a material must pass this to be legal as material come from fusion spell ---@param fusion_spell_matfilter FUSION_SPELL_MATFILTER_FUNCTION a material must pass this to be legal as material come from fusion spell
function FusionSpell.SummonTargetFilter(c,fusfilter,matfilter,e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,pre_select_mat_opponent_location,gc,fusion_spell_matfilter) function FusionSpell.SummonTargetFilter(
c,
fusfilter,
matfilter,
e,
tp,
pre_select_mat_location,
mat_operation_code_map,
post_select_mat_location,
additional_fcheck,
additional_fgoalcheck,
sumtype,
sumpos,
pre_select_mat_opponent_location,
post_select_mat_opponent_location,
gc,
fusion_spell_matfilter)
local res=c:IsType(TYPE_FUSION) and fusfilter(c,tp) and c:IsCanBeSpecialSummoned(e,sumtype,tp,false,false,sumpos) local res=c:IsType(TYPE_FUSION) and fusfilter(c,tp) and c:IsCanBeSpecialSummoned(e,sumtype,tp,false,false,sumpos)
if res==false then if res==false then
return false return false
end end
local mg=FusionSpell.GetMaterialsGroupForTargetCard(c,tp,e,matfilter,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,sumtype,pre_select_mat_opponent_location,fusion_spell_matfilter) local mg=FusionSpell.GetMaterialsGroupForTargetCard(
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunction(additional_fcheck,tp,c,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map) c,
tp,
e,
matfilter,
pre_select_mat_location,
mat_operation_code_map,
post_select_mat_location,
sumtype,
pre_select_mat_opponent_location,
post_select_mat_opponent_location,
fusion_spell_matfilter)
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunction(
additional_fcheck,
tp,
c,
pre_select_mat_location,
post_select_mat_location,
pre_select_mat_opponent_location,
post_select_mat_opponent_location,
fusion_spell_matfilter,
e,
mat_operation_code_map)
aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(additional_fgoalcheck,tp,c,pre_select_mat_location,e) aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(additional_fgoalcheck,tp,c,pre_select_mat_location,e)
res=c:CheckFusionMaterial(mg,gc(e),tp) res=c:CheckFusionMaterial(mg,gc(e),tp)
aux.FCheckAdditional=nil aux.FCheckAdditional=nil
...@@ -2889,7 +2962,7 @@ function FusionSpell.SummonTargetFilter(c,fusfilter,matfilter,e,tp,pre_select_ma ...@@ -2889,7 +2962,7 @@ function FusionSpell.SummonTargetFilter(c,fusfilter,matfilter,e,tp,pre_select_ma
return res return res
end end
---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION filter for the materials, use it only under very strong limitation like D-Fusion.
---@param gc fun(e:Effect):Card|nil ---@param gc fun(e:Effect):Card|nil
---@return {[Effect]:Group} effect_targets_map Return a map of different chain material to potiential fusion targets ---@return {[Effect]:Group} effect_targets_map Return a map of different chain material to potiential fusion targets
function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc) function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc)
...@@ -2914,7 +2987,7 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add ...@@ -2914,7 +2987,7 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add
return chain_material_targets return chain_material_targets
end end
---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION filter for the materials, use it only under very strong limitation like D-Fusion.
---@param gc fun(e:Effect):Card|nil ---@param gc fun(e:Effect):Card|nil
---@return boolean res return whether there is a valid target for any chain material effect ---@return boolean res return whether there is a valid target for any chain material effect
function FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc) function FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc)
...@@ -3124,27 +3197,23 @@ end ...@@ -3124,27 +3197,23 @@ end
--if element is true, stands for it can be included by the fusion effect itself. --if element is true, stands for it can be included by the fusion effect itself.
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location ---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
---@param fusion_spell_matfilter fun(c:Card):boolean a material must pass this to be legal as material come from fusion spell ---@param post_select_mat_opponent_location integer location where to find the materials after known the materials on opponent location
---@param fusion_spell_matfilter FUSION_SPELL_MATFILTER_FUNCTION a material must pass this to be legal as material come from fusion spell
---@param e Effect the fusion effect ---@param e Effect the fusion effect
---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order ---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
---@return (true|Effect)[] ---@return (true|Effect)[]
function FusionSpell.GetMaterialEffects(c,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map) function FusionSpell.GetMaterialEffects(c,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,post_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map)
local res={} local res={}
local calculated_mat_opponent_location=0 local calculated_mat_opponent_location=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_opponent_location,post_select_mat_opponent_location)
if type(pre_select_mat_opponent_location)=="function" then
calculated_mat_opponent_location=pre_select_mat_opponent_location(tc,tp)
else
calculated_mat_opponent_location=pre_select_mat_opponent_location
end
local all_locations=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location) local all_locations=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location)
if c:IsControler(tp) and c:IsLocation(all_locations) and fusion_spell_matfilter(c) then if c:IsControler(tp) and c:IsLocation(all_locations) and fusion_spell_matfilter(c,e,tp) then
--- in order to be qualified for being material, it need to be able to perform the operation. --- in order to be qualified for being material, it need to be able to perform the operation.
---@type FUSION_FILTER_FUNCTION ---@type FUSION_FILTER_FUNCTION
local filter_by_operation=FusionSpell.GetFusionFilterByCode(FusionSpell.GetOperationCodeByMaterialLocation(c:GetLocation(),mat_operation_code_map)) local filter_by_operation=FusionSpell.GetFusionFilterByCode(FusionSpell.GetOperationCodeByMaterialLocation(c:GetLocation(),mat_operation_code_map))
if filter_by_operation(c,tp,e) then if filter_by_operation(c,tp,e) then
table.insert(res,true) table.insert(res,true)
end end
elseif c:IsControler(1-tp) and c:IsLocation(calculated_mat_opponent_location) and fusion_spell_matfilter(c) then elseif c:IsControler(1-tp) and c:IsLocation(calculated_mat_opponent_location) and fusion_spell_matfilter(c,e,tp) then
--- in order to be qualified for being material, it need to be able to perform the operation. --- in order to be qualified for being material, it need to be able to perform the operation.
---@type FUSION_FILTER_FUNCTION ---@type FUSION_FILTER_FUNCTION
local filter_by_operation=FusionSpell.GetFusionFilterByCode(FusionSpell.GetOperationCodeByMaterialLocation(c:GetLocation(),mat_operation_code_map)) local filter_by_operation=FusionSpell.GetFusionFilterByCode(FusionSpell.GetOperationCodeByMaterialLocation(c:GetLocation(),mat_operation_code_map))
...@@ -3234,18 +3303,29 @@ end ...@@ -3234,18 +3303,29 @@ end
--- @param fusion_spell_additional_fcheck_function FUSION_FGCHECK_FUNCTION --- @param fusion_spell_additional_fcheck_function FUSION_FGCHECK_FUNCTION
--- @param tp integer --- @param tp integer
--- @param tc Card --- @param tc Card
--- @param pre_select_mat_location integer|function location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE) --- @param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE)
--- @param post_select_mat_location integer? --- @param post_select_mat_location integer
--- @param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location --- @param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
--- @param fusion_spell_matfilter fun(c:Card):boolean a material must pass this to be legal as material come from fusion spell --- @param post_select_mat_opponent_location integer location where to find the materials after known the materials on opponent location
--- @param fusion_spell_matfilter FUSION_SPELL_MATFILTER_FUNCTION a material must pass this to be legal as material come from fusion spell
--- @param e Effect the fusion effect --- @param e Effect the fusion effect
--- @param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order --- @param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
function FusionSpell.GetFusionSpellFCheckAdditionalFunction(fusion_spell_additional_fcheck_function,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map) function FusionSpell.GetFusionSpellFCheckAdditionalFunction(
fusion_spell_additional_fcheck_function,
tp,
tc,
pre_select_mat_location,
post_select_mat_location,
pre_select_mat_opponent_location,
post_select_mat_opponent_location,
fusion_spell_matfilter,
e,
mat_operation_code_map)
---@param mg Group ---@param mg Group
return (function(f_tp,mg,fc) return (function(f_tp,mg,fc)
--- filter out materials that can only be added by extra material effects, and check the count limit --- filter out materials that can only be added by extra material effects, and check the count limit
local mandartory_extra_mg=mg:Filter(function (mc) local mandartory_extra_mg=mg:Filter(function (mc)
local material_effects=FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map) local material_effects=FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location,post_select_mat_opponent_location,fusion_spell_matfilter,e,mat_operation_code_map)
if (#material_effects)==1 and material_effects[1]~=true then if (#material_effects)==1 and material_effects[1]~=true then
return true return true
end end
...@@ -3278,7 +3358,7 @@ end ...@@ -3278,7 +3358,7 @@ end
--- @param fusion_spell_additional_fgoalcheck_function FUSION_FGCHECK_FUNCTION --- @param fusion_spell_additional_fgoalcheck_function FUSION_FGCHECK_FUNCTION
--- @param tp integer --- @param tp integer
--- @param tc Card --- @param tc Card
--- @param pre_select_mat_location integer|function location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE) --- @param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE)
--- @param e Effect the fusion effect --- @param e Effect the fusion effect
function FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(fusion_spell_additional_fgoalcheck_function,tp,tc,pre_select_mat_location,e) function FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(fusion_spell_additional_fgoalcheck_function,tp,tc,pre_select_mat_location,e)
---@param mg Group ---@param mg Group
......
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