Commit 47840bc7 authored by wind2009's avatar wind2009

Merge branch 'new-fusion-Darklord' into 'master'

Add 堕天使 to new fusion + add skip_location_count_check to new fusion

See merge request !44
parents 101089d7 48e04da5
--叛逆の堕天使 --叛逆の堕天使
function c54527349.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
--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) extra_target=s.extra_target,
e1:SetCode(EVENT_FREE_CHAIN) stage_x_operation=s.stage_x_operation
})
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1,54527349+EFFECT_COUNT_CODE_OATH) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetCost(c54527349.cost) e1:SetTarget(s.target)
e1:SetTarget(c54527349.target) e1:SetCost(s.cost)
e1:SetOperation(c54527349.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c54527349.filter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsAttribute(ATTRIBUTE_DARK)
end end
function c54527349.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsAttribute(ATTRIBUTE_DARK) and (not f or f(c)) --- @param c Card
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) function s.costfilter(c,e,tp)
end if not (c:IsFaceupEx() and c:IsSetCard(0xef) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()) then
function c54527349.costfilter(c,e,tp) return false
local chkf=tp end
local mg1=Duel.GetFusionMaterial(tp) local res_cell=Duel.GetLocationCountFromEx(tp,tp,c,TYPE_FUSION)
if mg1:IsContains(c) then mg1:RemoveCard(c) end --- Create a temp fusion effect that can not use candidate cost monster as material, if we have a slot on field, skip the location count check
local res=Duel.IsExistingMatchingCard(c54527349.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) --- stage_x_operation omit as it is only called in operation
if not res then local fusion_effect=FusionSpell.CreateSummonEffect(e:GetHandler(),{
local ce=Duel.GetChainMaterial(tp) fusfilter=s.fusfilter,
if ce~=nil then matfilter=function(mc) return mc~=c end,
local fgroup=ce:GetTarget() extra_target=s.extra_target,
local mg2=fgroup(ce,e,tp) skip_location_count_check=(res_cell>0)
if mg2:IsContains(c) then mg2:RemoveCard(c) end })
local mf=ce:GetValue() if fusion_effect:GetTarget()(e,tp,nil,nil,nil,nil,nil,nil,0)==false then
res=Duel.IsExistingMatchingCard(c54527349.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf) return false
end
end end
return (c:IsFaceup() or c:IsLocation(LOCATION_HAND)) and c:IsSetCard(0xef) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() and res return true
end end
function c54527349.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100,0) function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c54527349.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil,e,tp) end if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c54527349.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil,e,tp) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil,e,tp)
e:SetLabel(100,g:GetFirst():GetAttack()) e:SetLabel(g:GetFirst():GetAttack())
Duel.SendtoGrave(g,REASON_COST) Duel.SendtoGrave(g,REASON_COST)
end end
function c54527349.target(e,tp,eg,ep,ev,re,r,rp,chk)
local label,rec=e:GetLabel() function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if e:IsCostChecked() then
--- cost could be paid, location count check done there
local fusion_effect_no_location_count_check=FusionSpell.CreateSummonEffect(e:GetHandler(),{
fusfilter=s.fusfilter,
extra_target=s.extra_target,
skip_location_count_check=true
})
return fusion_effect_no_location_count_check:GetTarget()(e,tp,eg,ep,ev,re,r,rp,chk)
else
--- cost bypassed, location count check done here
local fusion_effect_with_location_count_check=FusionSpell.CreateSummonEffect(e:GetHandler(),{
fusfilter=s.fusfilter,
extra_target=s.extra_target,
skip_location_count_check=false
})
return fusion_effect_with_location_count_check:GetTarget()(e,tp,eg,ep,ev,re,r,rp,chk)
end
end
function s.extra_target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp return true
local mg1=Duel.GetFusionMaterial(tp)
local res=Duel.IsExistingMatchingCard(c54527349.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 mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c54527349.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
e:SetLabel(0,0)
return label==100 or res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
local cat=e:GetCategory() local cat=e:GetCategory()
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and label==100 and rec>0 then local rec=e:GetLabel()
e:SetCategory(bit.bor(cat,CATEGORY_RECOVER)) if e:IsCostChecked() and rec>0 then
e:SetCategory(cat|CATEGORY_RECOVER)
else else
e:SetCategory(bit.band(cat,bit.bnot(CATEGORY_RECOVER))) --- in case of copy, reset the label
e:SetLabel(0)
e:SetCategory(cat&(~CATEGORY_RECOVER))
end end
end end
function c54527349.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp --- @type FUSION_SPELL_STAGE_X_CALLBACK_FUNCTION
local mg1=Duel.GetFusionMaterial(tp):Filter(c54527349.filter1,nil,e) function s.stage_x_operation(e,tc,tp,stage)
local sg1=Duel.GetMatchingGroup(c54527349.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) if stage==FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then
local mg2=nil local rec=e:GetLabel()
local sg2=nil if rec>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c54527349.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,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 not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
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)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
local label,rec=e:GetLabel()
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and label==100 and rec>0 and Duel.SelectYesNo(tp,aux.Stringid(54527349,0)) then
Duel.BreakEffect() Duel.BreakEffect()
Duel.Recover(tp,rec,REASON_EFFECT) Duel.Recover(tp,rec,REASON_EFFECT)
e:SetLabel(0)
end end
end end
end end
...@@ -2324,6 +2324,8 @@ FusionSpell = {} ...@@ -2324,6 +2324,8 @@ FusionSpell = {}
--- @field fusion_spell_matfilter? FUSION_SPELL_MATFILTER_FUNCTION --- @field fusion_spell_matfilter? FUSION_SPELL_MATFILTER_FUNCTION
--- Whether skip the IsCanBeSpecialSummoned check, for クロック・リザード, default false --- Whether skip the IsCanBeSpecialSummoned check, for クロック・リザード, default false
--- @field skip_summon_check? boolean --- @field skip_summon_check? boolean
--- Whether skip the location count check, default false, used for 叛逆の堕天使, only works for target function
--- @field skip_location_count_check? boolean
--- 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
...@@ -2403,6 +2405,7 @@ function FusionSpell.CreateSummonEffect(c,opts) ...@@ -2403,6 +2405,7 @@ function FusionSpell.CreateSummonEffect(c,opts)
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
local skip_summon_check=opts.skip_summon_check or false local skip_summon_check=opts.skip_summon_check or false
local skip_location_count_check=opts.skip_location_count_check or false
-- Ensure material operation fallbacks are present -- Ensure material operation fallbacks are present
table.insert(mat_operation_code_map,{ [LOCATION_GRAVE] = FusionSpell.FUSION_OPERATION_BANISH }) table.insert(mat_operation_code_map,{ [LOCATION_GRAVE] = FusionSpell.FUSION_OPERATION_BANISH })
...@@ -2429,7 +2432,8 @@ function FusionSpell.CreateSummonEffect(c,opts) ...@@ -2429,7 +2432,8 @@ function FusionSpell.CreateSummonEffect(c,opts)
post_select_mat_opponent_location, post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter, fusion_spell_matfilter,
skip_summon_check skip_summon_check,
skip_location_count_check
)) ))
e1:SetOperation(FusionSpell.GetSummonOperation( e1:SetOperation(FusionSpell.GetSummonOperation(
fusfilter, fusfilter,
...@@ -2469,6 +2473,7 @@ end ...@@ -2469,6 +2473,7 @@ end
---@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 FUSION_SPELL_MATFILTER_FUNCTION 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
---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード ---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード
---@param skip_location_count_check boolean Whether skip the location count check, default false, used for 叛逆の堕天使
function FusionSpell.GetSummonTarget( function FusionSpell.GetSummonTarget(
fusfilter, fusfilter,
matfilter, matfilter,
...@@ -2485,7 +2490,8 @@ function FusionSpell.GetSummonTarget( ...@@ -2485,7 +2490,8 @@ function FusionSpell.GetSummonTarget(
post_select_mat_opponent_location, post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter, fusion_spell_matfilter,
skip_summon_check skip_summon_check,
skip_location_count_check
) )
return function(e,tp,eg,ep,ev,re,r,rp,chk) return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
...@@ -2509,7 +2515,8 @@ function FusionSpell.GetSummonTarget( ...@@ -2509,7 +2515,8 @@ function FusionSpell.GetSummonTarget(
post_select_mat_opponent_location, post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter, fusion_spell_matfilter,
skip_summon_check) skip_summon_check,
skip_location_count_check)
end, end,
tp,fuslocation,0,1,nil) tp,fuslocation,0,1,nil)
if sg==true then if sg==true then
...@@ -2517,7 +2524,7 @@ function FusionSpell.GetSummonTarget( ...@@ -2517,7 +2524,7 @@ function FusionSpell.GetSummonTarget(
end end
-- --- check for chain material targets -- --- check for chain material targets
if sumtype&SUMMON_TYPE_FUSION~=0 then if sumtype&SUMMON_TYPE_FUSION~=0 then
local ce_sg=FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc,skip_summon_check) local ce_sg=FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc,skip_summon_check,skip_location_count_check)
if ce_sg==true then if ce_sg==true then
return true return true
end end
...@@ -2585,14 +2592,15 @@ function FusionSpell.GetSummonOperation( ...@@ -2585,14 +2592,15 @@ function FusionSpell.GetSummonOperation(
post_select_mat_opponent_location, post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter, fusion_spell_matfilter,
skip_summon_check) skip_summon_check,
false --[[skip_location_count_check]])
end, end,
tp,fuslocation,0,nil) tp,fuslocation,0,nil)
fusion_targets:Merge(sg) fusion_targets:Merge(sg)
--- check for chain material targets --- check for chain material targets
local ce_sgs={} local ce_sgs={}
if sumtype&SUMMON_TYPE_FUSION~=0 then if sumtype&SUMMON_TYPE_FUSION~=0 then
ce_sgs=FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,aux.NecroValleyFilter(matfilter),additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc,skip_summon_check) ce_sgs=FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,aux.NecroValleyFilter(matfilter),additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc,skip_summon_check,false--[[skip_location_count_check]])
--- add chain material targets --- add chain material targets
for _,ce_sg in pairs(ce_sgs) do for _,ce_sg in pairs(ce_sgs) do
fusion_targets:Merge(ce_sg) fusion_targets:Merge(ce_sg)
...@@ -2917,6 +2925,7 @@ function FusionSpell.GetOperationCodeByMaterialLocation(location,mat_operation_c ...@@ -2917,6 +2925,7 @@ function FusionSpell.GetOperationCodeByMaterialLocation(location,mat_operation_c
end end
end end
---@param c Card the candidate card to summon
---@param fusfilter fun(c:Card,e:Effect,tp:integer):boolean ---@param fusfilter fun(c:Card,e:Effect,tp:integer):boolean
---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION 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 (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)
...@@ -2926,6 +2935,7 @@ end ...@@ -2926,6 +2935,7 @@ end
---@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 fun(c:Card):boolean a material must pass this to be legal as material come from fusion spell
---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード ---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード
---@param skip_location_count_check boolean Whether skip the location count check, default false, used for 叛逆の堕天使
function FusionSpell.SummonTargetFilter( function FusionSpell.SummonTargetFilter(
c, c,
fusfilter, fusfilter,
...@@ -2943,7 +2953,8 @@ function FusionSpell.SummonTargetFilter( ...@@ -2943,7 +2953,8 @@ function FusionSpell.SummonTargetFilter(
post_select_mat_opponent_location, post_select_mat_opponent_location,
gc, gc,
fusion_spell_matfilter, fusion_spell_matfilter,
skip_summon_check) skip_summon_check,
skip_location_count_check)
if not c:IsType(TYPE_FUSION) or fusfilter(c,e,tp)==false then if not c:IsType(TYPE_FUSION) or fusfilter(c,e,tp)==false then
return false return false
end end
...@@ -2976,7 +2987,8 @@ function FusionSpell.SummonTargetFilter( ...@@ -2976,7 +2987,8 @@ function FusionSpell.SummonTargetFilter(
e, e,
mat_operation_code_map) 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)
local res=c:CheckFusionMaterial(mg,gc(e),tp) local chkf=FusionSpell.GetCheckFieldPlayer(tp,skip_location_count_check)
local res=c:CheckFusionMaterial(mg,gc(e),chkf)
aux.FCheckAdditional=nil aux.FCheckAdditional=nil
aux.FGoalCheckAdditional=nil aux.FGoalCheckAdditional=nil
return res return res
...@@ -2985,8 +2997,9 @@ end ...@@ -2985,8 +2997,9 @@ end
---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION 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
---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード ---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード
---@param skip_location_count_check boolean Whether skip the location count check, default false, used for 叛逆の堕天使
---@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,skip_summon_check) function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc,skip_summon_check,skip_location_count_check)
local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)} local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)}
---@type {[Effect]:Group} ---@type {[Effect]:Group}
local chain_material_targets={} local chain_material_targets={}
...@@ -2998,7 +3011,7 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add ...@@ -2998,7 +3011,7 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add
if #chain_mg>0 then if #chain_mg>0 then
local ce_fusfilter=ce:GetValue() local ce_fusfilter=ce:GetValue()
local ce_sg=Duel.GetMatchingGroup(function(c) local ce_sg=Duel.GetMatchingGroup(function(c)
return FusionSpell.ChainMaterialSummonTargetFilter(c,aux.AND(ce_fusfilter,fusfilter),e,tp,chain_mg,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,gc,skip_summon_check) return FusionSpell.ChainMaterialSummonTargetFilter(c,aux.AND(ce_fusfilter,fusfilter),e,tp,chain_mg,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,gc,skip_summon_check,skip_location_count_check)
end,tp,fuslocation,0,nil) end,tp,fuslocation,0,nil)
if #ce_sg>0 then if #ce_sg>0 then
chain_material_targets[ce]=ce_sg chain_material_targets[ce]=ce_sg
...@@ -3012,8 +3025,9 @@ end ...@@ -3012,8 +3025,9 @@ end
---@param matfilter FUSION_SPELL_MATFILTER_FUNCTION 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
---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード ---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード
---@param skip_location_count_check boolean Whether skip the location count check, default false, used for 叛逆の堕天使
---@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,skip_summon_check) function FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc,skip_summon_check,skip_location_count_check)
local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)} local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)}
---@type {[Effect]:Group} ---@type {[Effect]:Group}
for _,ce in ipairs(chain_material_effects) do for _,ce in ipairs(chain_material_effects) do
...@@ -3023,7 +3037,7 @@ function FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter ...@@ -3023,7 +3037,7 @@ function FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter
if #chain_mg>0 then if #chain_mg>0 then
local ce_fusfilter=ce:GetValue() local ce_fusfilter=ce:GetValue()
local res=Duel.IsExistingMatchingCard(function(c) local res=Duel.IsExistingMatchingCard(function(c)
return FusionSpell.ChainMaterialSummonTargetFilter(c,aux.AND(ce_fusfilter,fusfilter or aux.TRUE),e,tp,chain_mg,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,gc,skip_summon_check) return FusionSpell.ChainMaterialSummonTargetFilter(c,aux.AND(ce_fusfilter,fusfilter or aux.TRUE),e,tp,chain_mg,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,gc,skip_summon_check,skip_location_count_check)
end, end,
tp,fuslocation,0,1,nil) tp,fuslocation,0,1,nil)
if res==true then if res==true then
...@@ -3038,8 +3052,9 @@ end ...@@ -3038,8 +3052,9 @@ end
---@param fusfilter fun(c:Card,e:Effect,tp:integer):boolean ---@param fusfilter fun(c:Card,e:Effect,tp:integer):boolean
---@param gc fun(e:Effect):Card|nil ---@param gc fun(e:Effect):Card|nil
---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード ---@param skip_summon_check boolean whether skip the IsCanBeSpecialSummoned check, for クロック・リザード
---@param skip_location_count_check boolean Whether skip the location count check, default false, used for 叛逆の堕天使
---@return boolean result Whether c could be fusion summoned by this chain material effect ---@return boolean result Whether c could be fusion summoned by this chain material effect
function FusionSpell.ChainMaterialSummonTargetFilter(c,fusfilter,e,tp,mg,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,gc,skip_summon_check) function FusionSpell.ChainMaterialSummonTargetFilter(c,fusfilter,e,tp,mg,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,gc,skip_summon_check,skip_location_count_check)
if not c:IsType(TYPE_FUSION) or fusfilter(c,e,tp)==false then if not c:IsType(TYPE_FUSION) or fusfilter(c,e,tp)==false then
return false return false
end end
...@@ -3050,7 +3065,8 @@ function FusionSpell.ChainMaterialSummonTargetFilter(c,fusfilter,e,tp,mg,additio ...@@ -3050,7 +3065,8 @@ function FusionSpell.ChainMaterialSummonTargetFilter(c,fusfilter,e,tp,mg,additio
end end
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunctionForChainMaterial(additional_fcheck,e) aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunctionForChainMaterial(additional_fcheck,e)
aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial(additional_fgoalcheck,e) aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial(additional_fgoalcheck,e)
local res=c:CheckFusionMaterial(mg,gc(e),tp) local chkf=FusionSpell.GetCheckFieldPlayer(tp,skip_location_count_check)
local res=c:CheckFusionMaterial(mg,gc(e),chkf)
aux.FCheckAdditional=nil aux.FCheckAdditional=nil
aux.FGoalCheckAdditional=nil aux.FGoalCheckAdditional=nil
return res return res
...@@ -3413,3 +3429,13 @@ function FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial( ...@@ -3413,3 +3429,13 @@ function FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial(
return fusion_spell_additional_fgoalcheck_function(f_tp,Group.CreateGroup(),fc,mg,e) return fusion_spell_additional_fgoalcheck_function(f_tp,Group.CreateGroup(),fc,mg,e)
end) end)
end end
--- @param tp integer
--- @param skip_location_count_check boolean
--- @return integer chkf the player id to check the field count
function FusionSpell.GetCheckFieldPlayer(tp,skip_location_count_check)
if skip_location_count_check==true then
return PLAYER_NONE
end
return tp
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