Commit ef44f86f authored by Vury Leo's avatar Vury Leo

Add 捕食植物トリアンティス and 召喚魔術 to new fusion

parent dc9d8d5c
--捕食植物トリアンティス
local s,id,o=GetID()
function s.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c)
-- if you Fusion Summon a DARK Fusion Monster, you can also use cards in your Pendulum Zones as monsters on the field, as material for its Fusion Summon.
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_EXTRA_FUSION_MATERIAL)
e1:SetRange(LOCATION_PZONE)
e1:SetTargetRange(LOCATION_PZONE,0)
e1:SetValue(s.mtval)
e1:SetOperation(function() return FusionSpell.FUSION_OPERATION_INHERIT end)
-- as of 2025 May, there is no card can add LOCATION_MZONE base on material group. So we can just check pre_select_mat_location.
e1:SetLabel(0xff,LOCATION_MZONE) --- only avaliable when pre_select_mat_location contains LOCATION_MZONE, 1st number is limitaion of count materials, set 0xff as a placeholder
c:RegisterEffect(e1)
--counter
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_COUNTER)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(s.ctcon)
e2:SetTarget(s.cttg)
e2:SetOperation(s.ctop)
c:RegisterEffect(e2)
end
function s.mtval(e,c)
return c and c:IsAttribute(ATTRIBUTE_DARK)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsLocation(LOCATION_GRAVE+LOCATION_EXTRA) and r==REASON_FUSION
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0
and Duel.IsExistingMatchingCard(Card.IsCanAddCounter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,0x1041,1) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
local g=Duel.GetMatchingGroup(Card.IsCanAddCounter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,0x1041,1)
if ct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local sg=g:Select(tp,1,ct,nil)
local sc=sg:GetFirst()
while sc do
if sc:AddCounter(0x1041,1) and sc:GetLevel()>1 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetCondition(s.lvcon)
e1:SetValue(1)
sc:RegisterEffect(e1)
end
sc=sg:GetNext()
end
end
end
function s.lvcon(e)
return e:GetHandler():GetCounter(0x1041)>0
end
\ No newline at end of file
--召喚魔術
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=FusionSpell.CreateSummonEffect(c,{
pre_select_mat_location=s.pre_select_mat_location,
pre_select_mat_opponent_location=s.pre_select_mat_opponent_location,
mat_operation_code_map={
{ [LOCATION_GRAVE|LOCATION_ONFIELD] = FusionSpell.FUSION_OPERATION_BANISH },
{ [0xff] = FusionSpell.FUSION_OPERATION_GRAVE }
},
extra_target=s.extra_target
})
e1:SetDescription(aux.Stringid(id,0))
c:RegisterEffect(e1)
--to deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,id)
e2:SetTarget(s.tdtg)
e2:SetOperation(s.tdop)
c:RegisterEffect(e2)
end
---@type FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
function s.pre_select_mat_location(tc,tp)
local res=LOCATION_HAND
if tc:IsSetCard(0xf4) then
res=res|LOCATION_MZONE|LOCATION_GRAVE
end
return res
end
---@type FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
function s.pre_select_mat_opponent_location(tc,tp)
local res=0
if tc:IsSetCard(0xf4) then
res=res|LOCATION_GRAVE
end
return res
end
function s.extra_target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
return true
end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,LOCATION_MZONE+LOCATION_GRAVE)
end
function s.thfilter(c)
return c:IsFaceup() and c:IsCode(86120751) and c:IsAbleToHand()
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.thfilter(chkc) end
if chk==0 then return e:GetHandler():IsAbleToDeck()
and Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
\ No newline at end of file
...@@ -2662,16 +2662,15 @@ function FusionSpell.GetSummonOperation( ...@@ -2662,16 +2662,15 @@ function FusionSpell.GetSummonOperation(
if fusion_effect==e then if fusion_effect==e then
--- fusion with fusion spell --- fusion with fusion spell
tc:SetMaterial(materials) tc:SetMaterial(materials)
local all_locations=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location)
---@type {[Effect]:true} ---@type {[Effect]:true}
local applied_extra_effects={} local applied_extra_effects={}
---@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,all_locations,pre_select_mat_opponent_location))==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))==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,all_locations,pre_select_mat_opponent_location)[1] local material_effect=FusionSpell.GetMaterialEffects(material,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)[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)
...@@ -2692,7 +2691,7 @@ function FusionSpell.GetSummonOperation( ...@@ -2692,7 +2691,7 @@ 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,all_locations,pre_select_mat_opponent_location))==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))==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.
...@@ -2701,7 +2700,7 @@ function FusionSpell.GetSummonOperation( ...@@ -2701,7 +2700,7 @@ function FusionSpell.GetSummonOperation(
---@type {[Effect]:Group} ---@type {[Effect]:Group}
local material_grouped_by_extra_material_effect={} local material_grouped_by_extra_material_effect={}
for material in aux.Next(materials_with_two_material_effect) do for material in aux.Next(materials_with_two_material_effect) do
local material_effect=FusionSpell.GetExtraMaterialEffect(material,tp,tc) local material_effect=FusionSpell.GetExtraMaterialEffect(material,tp,tc,pre_select_mat_location)
assert(material_effect~=nil, "We can not have a material w/o extra material effect when it has 2 options") assert(material_effect~=nil, "We can not have a material w/o extra material effect when it has 2 options")
material_grouped_by_extra_material_effect[material_effect]=material_grouped_by_extra_material_effect[material_effect] or Group.CreateGroup() material_grouped_by_extra_material_effect[material_effect]=material_grouped_by_extra_material_effect[material_effect] or Group.CreateGroup()
material_grouped_by_extra_material_effect[material_effect]:AddCard(material) material_grouped_by_extra_material_effect[material_effect]:AddCard(material)
...@@ -2779,12 +2778,10 @@ end ...@@ -2779,12 +2778,10 @@ end
---@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)
local all_locations=0 local all_locations=0
if pre_select_mat_location~=nil then if type(pre_select_mat_location)=="function" then
if type(pre_select_mat_location)=="function" then all_locations=all_locations|pre_select_mat_location(tc,tp)
all_locations=all_locations|pre_select_mat_location(tc,tp) else
else all_locations=all_locations|pre_select_mat_location
all_locations=all_locations|pre_select_mat_location
end
end end
if post_select_mat_location~=nil then if post_select_mat_location~=nil then
all_locations=all_locations|post_select_mat_location all_locations=all_locations|post_select_mat_location
...@@ -2793,7 +2790,7 @@ function FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location, ...@@ -2793,7 +2790,7 @@ function FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,
end end
---@param matfilter fun(c:Card):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter fun(c:Card):boolean 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 ---@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
function FusionSpell.GetMaterialsGroupForTargetCard( function FusionSpell.GetMaterialsGroupForTargetCard(
tc, tc,
...@@ -2838,7 +2835,7 @@ function FusionSpell.GetMaterialsGroupForTargetCard( ...@@ -2838,7 +2835,7 @@ function FusionSpell.GetMaterialsGroupForTargetCard(
can_be_fusion_spell_material=filter_by_operation(mc,tp,e) can_be_fusion_spell_material=filter_by_operation(mc,tp,e)
end end
local can_be_extra_material=false local can_be_extra_material=false
local extra_effect=FusionSpell.GetExtraMaterialEffect(mc,tp,tc) local extra_effect=FusionSpell.GetExtraMaterialEffect(mc,tp,tc,pre_select_mat_location)
if extra_effect~=nil then if extra_effect~=nil then
---@type FUSION_OPERATION_CODE ---@type FUSION_OPERATION_CODE
local operation_code=FusionSpell.FUSION_OPERATION_INHERIT local operation_code=FusionSpell.FUSION_OPERATION_INHERIT
...@@ -2870,7 +2867,7 @@ end ...@@ -2870,7 +2867,7 @@ end
---@param fusfilter fun(c:Card,tp:integer):boolean ---@param fusfilter fun(c:Card,tp:integer):boolean
---@param matfilter fun(c:Card,tp:integer):boolean ---@param matfilter fun(c:Card,tp:integer):boolean
---@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|function location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE)
---@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
function FusionSpell.SummonTargetFilter(c,fusfilter,matfilter,e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,sumtype,sumpos,pre_select_mat_opponent_location) function FusionSpell.SummonTargetFilter(c,fusfilter,matfilter,e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,sumtype,sumpos,pre_select_mat_opponent_location)
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
...@@ -3067,28 +3064,26 @@ end ...@@ -3067,28 +3064,26 @@ end
--Returns a list of effect, if element is the EFFECT_EXTRA_FUSION_MATERIAL, stands for it can be included by that extra material effect. --Returns a list of effect, if element is the EFFECT_EXTRA_FUSION_MATERIAL, stands for it can be included by that extra material effect.
--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_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
---@return (true|Effect)[] ---@return (true|Effect)[]
function FusionSpell.GetMaterialEffects(c,tp,summon_card,matlocation,pre_select_mat_opponent_location) function FusionSpell.GetMaterialEffects(c,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)
local res={} local res={}
local calculated_mat_opponent_location=0 local calculated_mat_opponent_location=0
if type(pre_select_mat_opponent_location)=="function" then if type(pre_select_mat_opponent_location)=="function" then
calculated_mat_opponent_location=pre_select_mat_opponent_location(summon_card,tp) calculated_mat_opponent_location=pre_select_mat_opponent_location(tc,tp)
else else
calculated_mat_opponent_location=pre_select_mat_opponent_location calculated_mat_opponent_location=pre_select_mat_opponent_location
end end
if c:IsControler(tp) and c:IsLocation(matlocation) then local all_locations=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location)
if c:IsControler(tp) and c:IsLocation(all_locations) then
table.insert(res,true) table.insert(res,true)
elseif c:IsControler(1-tp) and c:IsLocation(calculated_mat_opponent_location) then elseif c:IsControler(1-tp) and c:IsLocation(calculated_mat_opponent_location) then
table.insert(res,true) table.insert(res,true)
end end
local extra_effs={c:IsHasEffect(EFFECT_EXTRA_FUSION_MATERIAL)} local extra_effs={c:IsHasEffect(EFFECT_EXTRA_FUSION_MATERIAL)}
for _,eff in ipairs(extra_effs) do for _,eff in ipairs(extra_effs) do
if not summon_card then if FusionSpell.GetExtraMaterialEffectApplyForTargetCardWithFusionSpell(eff,c,tp,tc,pre_select_mat_location) then
table.insert(res,eff)
end
local val=eff:GetValue()
if (type(val)=="function" and val(eff,summon_card)) or val==1 then
table.insert(res,eff) table.insert(res,eff)
end end
end end
...@@ -3097,22 +3092,49 @@ end ...@@ -3097,22 +3092,49 @@ end
--Returns the 1st EFFECT_EXTRA_FUSION_MATERIAL is applied on Card c. --Returns the 1st EFFECT_EXTRA_FUSION_MATERIAL is applied on Card c.
--If summon_card is provided, it will filter on whether the effect's value function applies to that card. --If summon_card is provided, it will filter on whether the effect's value function applies to that card.
---@param c Card the material card card ---@param c Card the material card
---@param tp integer the player ---@param tp integer the player
---@param summon_card Card the target card ---@param tc Card the target card
function FusionSpell.GetExtraMaterialEffect(c,tp,summon_card) ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
function FusionSpell.GetExtraMaterialEffect(c,tp,tc,pre_select_mat_location)
local effs={c:IsHasEffect(EFFECT_EXTRA_FUSION_MATERIAL)} local effs={c:IsHasEffect(EFFECT_EXTRA_FUSION_MATERIAL)}
for _,eff in ipairs(effs) do for _,eff in ipairs(effs) do
if eff:CheckCountLimit(tp)==true then if FusionSpell.GetExtraMaterialEffectApplyForTargetCardWithFusionSpell(eff,c,tp,tc,pre_select_mat_location) then
if summon_card==nil then return eff
return eff end
end end
local val=eff:GetValue() end
if (type(val)=="function" and val(eff,summon_card)) or val==1 then
return eff ---@param extra_material_effect Effect the extra material effect
end ---@param mc Card the material card
---@param tp integer the player
---@param tc Card the target card
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@return boolean result whether the extra material effect can apply
function FusionSpell.GetExtraMaterialEffectApplyForTargetCardWithFusionSpell(extra_material_effect,mc,tp,tc,pre_select_mat_location)
if type(pre_select_mat_location)=="function" then
pre_select_mat_location=pre_select_mat_location(tc,tp)
end
--- can not use if count limit exhausted
if extra_material_effect:CheckCountLimit(tp)==false then
return false
end
--- 1st element of label is material count limit, 2nd is location requirement
local labels={extra_material_effect:GetLabel()}
if #labels>=2 then
local location_requirement=labels[2]
if pre_select_mat_location&location_requirement==0 then
return false
end end
end end
if tc==nil then
return true
end
local val=extra_material_effect:GetValue()
if (type(val)=="function" and val(extra_material_effect,tc)) or val==1 then
return true
end
return false
end end
-- when a target card can be summoned by multiple effect, ask for which to apply. -- when a target card can be summoned by multiple effect, ask for which to apply.
...@@ -3151,13 +3173,13 @@ end ...@@ -3151,13 +3173,13 @@ end
---@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|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
function FusionSpell.GetFusionSpellFCheckAdditionalFunction(fusion_spell_additional_fcheck_function,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location) function FusionSpell.GetFusionSpellFCheckAdditionalFunction(fusion_spell_additional_fcheck_function,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)
---@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,FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location),pre_select_mat_opponent_location) local material_effects=FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)
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
...@@ -3167,20 +3189,20 @@ function FusionSpell.GetFusionSpellFCheckAdditionalFunction(fusion_spell_additio ...@@ -3167,20 +3189,20 @@ function FusionSpell.GetFusionSpellFCheckAdditionalFunction(fusion_spell_additio
---@type {[Effect]:Group} ---@type {[Effect]:Group}
local material_grouped_by_extra_material_effect={} local material_grouped_by_extra_material_effect={}
for material in aux.Next(mandartory_extra_mg) do for material in aux.Next(mandartory_extra_mg) do
local material_effect=FusionSpell.GetExtraMaterialEffect(material,tp,tc) local material_effect=FusionSpell.GetExtraMaterialEffect(material,tp,tc,pre_select_mat_location)
material_grouped_by_extra_material_effect[material_effect]=material_grouped_by_extra_material_effect[material_effect] or Group.CreateGroup() material_grouped_by_extra_material_effect[material_effect]=material_grouped_by_extra_material_effect[material_effect] or Group.CreateGroup()
material_grouped_by_extra_material_effect[material_effect]:AddCard(material) material_grouped_by_extra_material_effect[material_effect]:AddCard(material)
end end
--- check count limit for each effect --- check count limit for each effect
for extra_material_effect,materials in pairs(material_grouped_by_extra_material_effect) do for extra_material_effect,materials in pairs(material_grouped_by_extra_material_effect) do
if extra_material_effect:GetLabel()~=nil then local labels={extra_material_effect:GetLabel()}
if #materials>extra_material_effect:GetLabel() then --- first element of label is the material count limit
return false if labels~=nil and #labels>0 and #materials>labels[1] then
end return false
end end
end end
local extra_mg=mg:Filter(FusionSpell.GetExtraMaterialEffect,nil,tp,tc) local extra_mg=mg:Filter(FusionSpell.GetExtraMaterialEffect,nil,tp,tc,pre_select_mat_location)
return fusion_spell_additional_fcheck_function(f_tp,mg-extra_mg,fc,mg) return fusion_spell_additional_fcheck_function(f_tp,mg-extra_mg,fc,mg)
end) end)
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