Commit 5910339b authored by Vury Leo's avatar Vury Leo

fix 救世竜 セイヴァー・ドラゴン

parent 6f34e2a9
--アクセルシンクロ・スターダスト・ドラゴン --アクセルシンクロ・スターダスト・ドラゴン
function c30983281.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,44508094) aux.AddCodeList(c,44508094)
--synchro summon --synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
...@@ -7,66 +8,66 @@ function c30983281.initial_effect(c) ...@@ -7,66 +8,66 @@ function c30983281.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--special summon --special summon
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(30983281,0)) e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,30983281) e1:SetCountLimit(1,id)
e1:SetCondition(c30983281.spcon) e1:SetCondition(s.spcon)
e1:SetTarget(c30983281.sptg) e1:SetTarget(s.sptg)
e1:SetOperation(c30983281.spop) e1:SetOperation(s.spop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--synchro effect --synchro effect
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(30983281,1)) e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,30983282) e2:SetCountLimit(1,id+o)
e2:SetCondition(c30983281.sccon) e2:SetCondition(s.sccon)
e2:SetCost(c30983281.sccost) e2:SetCost(s.sccost)
e2:SetTarget(c30983281.sctg) e2:SetTarget(s.sctg)
e2:SetOperation(c30983281.scop) e2:SetOperation(s.scop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c30983281.spcon(e,tp,eg,ep,ev,re,r,rp) function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO) return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end end
function c30983281.spfilter(c,e,tp) function s.spfilter(c,e,tp)
return c:IsLevelBelow(2) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsLevelBelow(2) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function c30983281.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c30983281.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end end
function c30983281.spop(e,tp,eg,ep,ev,re,r,rp) function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c30983281.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end end
function c30983281.sccon(e,tp,eg,ep,ev,re,r,rp) function s.sccon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2 return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end end
function c30983281.excostfilter(c,tp) function s.excostfilter(c,tp)
return c:IsAbleToRemoveAsCost() and c:IsHasEffect(84012625,tp) return c:IsAbleToRemoveAsCost() and c:IsHasEffect(84012625,tp)
end end
function c30983281.synfilter(c,tp,g) function s.synfilter(c,tp,g)
return c:IsSynchroSummonable(nil,g,#g-1,#g-1) and aux.SynMixHandCheck(g,tp,c) return c:IsSynchroSummonable(nil,g,#g-1,#g-1) and aux.SynMixHandCheck(g,tp,c)
end end
function c30983281.syncheck(g,tp,exc) function s.syncheck(g,tp,exc)
return Duel.IsExistingMatchingCard(c30983281.synfilter,tp,LOCATION_EXTRA,0,1,exc,tp,g) return Duel.IsExistingMatchingCard(s.synfilter,tp,LOCATION_EXTRA,0,1,exc,tp,g)
end end
function c30983281.spcheck(c,tp,rc,mg,opchk) function s.spcheck(c,tp,rc,mg,opchk)
return Duel.GetLocationCountFromEx(tp,tp,rc,c)>0 return Duel.GetLocationCountFromEx(tp,tp,rc,c)>0
and (opchk or mg:CheckSubGroup(c30983281.syncheck,2,#mg,tp,c)) and (opchk or mg:CheckSubGroup(s.syncheck,2,#mg,tp,c))
end end
function c30983281.scfilter(c,e,tp,rc,chkrel,chknotrel,tgchk,opchk) function s.scfilter(c,e,tp,rc,chkrel,chknotrel,tgchk,opchk)
if not (c:IsCode(44508094) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false)) then return false end if not (c:IsCode(44508094) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false)) then return false end
local mg=Duel.GetSynchroMaterial(tp) local mg=Duel.GetSynchroMaterial(tp)
if mg:IsExists(Card.GetHandSynchro,1,nil) then if mg:IsExists(Card.GetHandSynchro,1,nil) then
...@@ -75,21 +76,21 @@ function c30983281.scfilter(c,e,tp,rc,chkrel,chknotrel,tgchk,opchk) ...@@ -75,21 +76,21 @@ function c30983281.scfilter(c,e,tp,rc,chkrel,chknotrel,tgchk,opchk)
end end
mg:AddCard(c) mg:AddCard(c)
if tgchk then if tgchk then
return c30983281.spcheck(c,tp,nil,mg,opchk) return s.spcheck(c,tp,nil,mg,opchk)
else else
return (chkrel and c30983281.spcheck(c,tp,rc,mg-rc)) or (chknotrel and c30983281.spcheck(c,tp,nil,mg)) return (chkrel and s.spcheck(c,tp,rc,mg-rc)) or (chknotrel and s.spcheck(c,tp,nil,mg))
end end
end end
function c30983281.sccost(e,tp,eg,ep,ev,re,r,rp,chk) function s.sccost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
local ect1=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and c29724053[tp] local ect1=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and c29724053[tp]
local ect2=aux.ExtraDeckSummonCountLimit and Duel.IsPlayerAffectedByEffect(tp,92345028) local ect2=aux.ExtraDeckSummonCountLimit and Duel.IsPlayerAffectedByEffect(tp,92345028)
and aux.ExtraDeckSummonCountLimit[tp] and aux.ExtraDeckSummonCountLimit[tp]
local g=Duel.GetMatchingGroup(c30983281.excostfilter,tp,LOCATION_GRAVE,0,nil,tp) local g=Duel.GetMatchingGroup(s.excostfilter,tp,LOCATION_GRAVE,0,nil,tp)
local chkrel=c:IsReleasable() local chkrel=c:IsReleasable()
local chknotrel=g:GetCount()>0 local chknotrel=g:GetCount()>0
local b1=chkrel and Duel.IsExistingMatchingCard(c30983281.scfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,chkrel,nil) local b1=chkrel and Duel.IsExistingMatchingCard(s.scfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,chkrel,nil)
local b2=chknotrel and Duel.IsExistingMatchingCard(c30983281.scfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,nil,chknotrel) local b2=chknotrel and Duel.IsExistingMatchingCard(s.scfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,nil,chknotrel)
if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2)
and (not ect1 or ect1>1) and (not ect2 or ect2>1) and (b1 or b2) and (not ect1 or ect1>1) and (not ect2 or ect2>1) and (b1 or b2)
and aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_SMATERIAL) end and aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_SMATERIAL) end
...@@ -110,7 +111,7 @@ function c30983281.sccost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -110,7 +111,7 @@ function c30983281.sccost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Release(rc,REASON_COST) Duel.Release(rc,REASON_COST)
end end
end end
function c30983281.sctg(e,tp,eg,ep,ev,re,r,rp,chk) function s.sctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
if e:IsCostChecked() then return true end if e:IsCostChecked() then return true end
local c=e:GetHandler() local c=e:GetHandler()
...@@ -120,26 +121,26 @@ function c30983281.sctg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -120,26 +121,26 @@ function c30983281.sctg(e,tp,eg,ep,ev,re,r,rp,chk)
return Duel.IsPlayerCanSpecialSummonCount(tp,2) return Duel.IsPlayerCanSpecialSummonCount(tp,2)
and (not ect1 or ect1>1) and (not ect2 or ect2>1) and (not ect1 or ect1>1) and (not ect2 or ect2>1)
and aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_SMATERIAL) and aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_SMATERIAL)
and Duel.IsExistingMatchingCard(c30983281.scfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,nil,nil,true) and Duel.IsExistingMatchingCard(s.scfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,nil,nil,true)
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end end
function c30983281.scop(e,tp,eg,ep,ev,re,r,rp) function s.scop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c30983281.scfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c,nil,nil,true,true) local g=Duel.SelectMatchingCard(tp,s.scfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c,nil,nil,true,true)
local tc=g:GetFirst() local tc=g:GetFirst()
local res=false local res=false
if tc then if tc then
tc:SetMaterial(nil) tc:SetMaterial(nil)
if Duel.SpecialSummonStep(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP) then if Duel.SpecialSummonStep(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(30983281,2)) e1:SetDescription(aux.Stringid(id,2))
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT)
e1:SetRange(LOCATION_MZONE) e1:SetRange(LOCATION_MZONE)
e1:SetValue(c30983281.immval) e1:SetValue(s.immval)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetOwnerPlayer(tp) e1:SetOwnerPlayer(tp)
tc:RegisterEffect(e1,true) tc:RegisterEffect(e1,true)
...@@ -152,21 +153,40 @@ function c30983281.scop(e,tp,eg,ep,ev,re,r,rp) ...@@ -152,21 +153,40 @@ function c30983281.scop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,nil) local tg=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,nil)
if res and tg:GetCount()>0 then if res and tg:GetCount()>0 then
Duel.BreakEffect() Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local opt=Duel.SelectOption(tp,1164,1379)
local sg=tg:Select(tp,1,1,nil) if opt==0 then
local e1=Effect.CreateEffect(c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
e1:SetDescription(aux.Stringid(30983281,2)) local sg=tg:Select(tp,1,1,nil)
e1:SetType(EFFECT_TYPE_SINGLE) local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetDescription(aux.Stringid(id,2))
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(c30983281.immval) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD+RESET_PHASE+PHASE_END) e1:SetRange(LOCATION_MZONE)
e1:SetOwnerPlayer(tp) e1:SetValue(s.immval)
sg:GetFirst():RegisterEffect(e1,true) e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD+RESET_PHASE+PHASE_END)
Duel.SynchroSummon(tp,sg:GetFirst(),nil) e1:SetOwnerPlayer(tp)
sg:GetFirst():RegisterEffect(e1,true)
Duel.SynchroSummon(tp,sg:GetFirst(),nil)
else
local synchro_effect=AccelSynchro.CreateSummonEffect(c,{
stage_x_operation=function(e,tc)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,2))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(s.immval)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD+RESET_PHASE+PHASE_END)
e1:SetOwnerPlayer(tp)
tc:GetFirst():RegisterEffect(e1,true)
end
})
synchro_effect:GetOperation()(e,tp,eg,ep,ev,re,r,rp)
end
end end
end end
function c30983281.immval(e,te) function s.immval(e,te)
return te:GetOwnerPlayer()~=e:GetOwnerPlayer() and te:IsActivated() return te:GetOwnerPlayer()~=e:GetOwnerPlayer() and te:IsActivated()
end end
...@@ -3394,8 +3394,10 @@ function Synchro.GetSynchroMaterial(tp,tc,level_mapper) ...@@ -3394,8 +3394,10 @@ function Synchro.GetSynchroMaterial(tp,tc,level_mapper)
local effs={mc:IsHasEffect(EFFECT_EXTRA_SYNCHRO_MATERIAL)} local effs={mc:IsHasEffect(EFFECT_EXTRA_SYNCHRO_MATERIAL)}
for _,eff in ipairs(effs) do for _,eff in ipairs(effs) do
local v=eff:GetValue() local v=eff:GetValue()
if type(v)=='function' and v(eff,tc) then if type(v)=='function' then
return true if v(eff,tc) then
return true
end
elseif v then elseif v then
return true return true
end end
...@@ -3410,8 +3412,10 @@ function Synchro.GetSynchroMaterial(tp,tc,level_mapper) ...@@ -3410,8 +3412,10 @@ function Synchro.GetSynchroMaterial(tp,tc,level_mapper)
local effs={mc:IsHasEffect(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)} local effs={mc:IsHasEffect(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)}
for _,eff in ipairs(effs) do for _,eff in ipairs(effs) do
local v=eff:GetValue() local v=eff:GetValue()
if type(v)=='function' and v(eff,tc)==true then if type(v)=='function' then
return false if v(eff,tc)==true then
return false
end
elseif v then elseif v then
return false return false
end end
...@@ -3445,6 +3449,7 @@ function Synchro.AddSynchroProcedure(c,params) ...@@ -3445,6 +3449,7 @@ function Synchro.AddSynchroProcedure(c,params)
local level_mapper=params.level_mapper or Synchro.DefaultLevelMapper local level_mapper=params.level_mapper or Synchro.DefaultLevelMapper
local scheck=params.scheck or aux.TRUE local scheck=params.scheck or aux.TRUE
local hand_count_mapper=params.hand_count_mapper or Synchro.DefaultHandCountMapper local hand_count_mapper=params.hand_count_mapper or Synchro.DefaultHandCountMapper
local sgoalcheck=params.sgoalcheck or aux.TRUE
local drop_default_tuner_filter=params.drop_default_tuner_filter or false local drop_default_tuner_filter=params.drop_default_tuner_filter or false
local drop_default_non_tuner_filter=params.drop_default_non_tuner_filter or false local drop_default_non_tuner_filter=params.drop_default_non_tuner_filter or false
...@@ -3464,8 +3469,8 @@ function Synchro.AddSynchroProcedure(c,params) ...@@ -3464,8 +3469,8 @@ function Synchro.AddSynchroProcedure(c,params)
e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA) e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck)) e1:SetCondition(Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck))
e1:SetTarget(Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck)) e1:SetTarget(Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck))
e1:SetOperation(Synchro.SynOperation()) e1:SetOperation(Synchro.SynOperation())
e1:SetValue(SUMMON_TYPE_SYNCHRO) e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1) c:RegisterEffect(e1)
...@@ -3478,8 +3483,8 @@ function Synchro.AddSynchroProcedure(c,params) ...@@ -3478,8 +3483,8 @@ function Synchro.AddSynchroProcedure(c,params)
e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA) e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck)) e2:SetCondition(Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck))
e2:SetTarget(Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck)) e2:SetTarget(Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck))
e2:SetOperation(Synchro.SynOperation()) e2:SetOperation(Synchro.SynOperation())
e2:SetValue(SUMMON_TYPE_SYNCHRO) e2:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e2) c:RegisterEffect(e2)
...@@ -3492,7 +3497,8 @@ function Synchro.FindValidSelection(candidates,target_level, ...@@ -3492,7 +3497,8 @@ function Synchro.FindValidSelection(candidates,target_level,
non_tuner_race,non_tuner_filter,tc, non_tuner_race,non_tuner_filter,tc,
tuner_min,tuner_max, tuner_min,tuner_max,
non_tuner_min,non_tuner_max, non_tuner_min,non_tuner_max,
level_mapper,hand_count_mapper,scheck, level_mapper,hand_count_mapper,
scheck,sgoalcheck,
pre_select,state) pre_select,state)
Synchro.SortMaterials(candidates,tc,tuner_filter) Synchro.SortMaterials(candidates,tc,tuner_filter)
...@@ -3528,7 +3534,8 @@ function Synchro.FindValidSelection(candidates,target_level, ...@@ -3528,7 +3534,8 @@ function Synchro.FindValidSelection(candidates,target_level,
non_tuner_race,non_tuner_filter,tc, non_tuner_race,non_tuner_filter,tc,
tuner_min,tuner_max, tuner_min,tuner_max,
non_tuner_min,non_tuner_max, non_tuner_min,non_tuner_max,
level_mapper,hand_count_mapper,scheck, level_mapper,hand_count_mapper,
scheck,sgoalcheck,
pre_select or {}, pre_select or {},
1, 1,
state, state,
...@@ -3557,6 +3564,7 @@ end ...@@ -3557,6 +3564,7 @@ end
--- @param non_tuner_max integer|table -- Maximum number of non-Tuners. --- @param non_tuner_max integer|table -- Maximum number of non-Tuners.
--- @param level_mapper fun(mc:Card,tc:Card):integer[] -- Returns possible levels for mc. --- @param level_mapper fun(mc:Card,tc:Card):integer[] -- Returns possible levels for mc.
--- @param scheck fun(selected:Card[]):boolean -- Optional card-group check (e.g. Judgment’s same-Attribute). --- @param scheck fun(selected:Card[]):boolean -- Optional card-group check (e.g. Judgment’s same-Attribute).
--- @param sgoalcheck fun(selected:Card[]):boolean -- Optional final card-group check (e.g. Majestic Star Dragon).
--- @param selected Card[] -- Materials chosen so far. --- @param selected Card[] -- Materials chosen so far.
--- @param index integer -- Next candidate index (1-based). --- @param index integer -- Next candidate index (1-based).
--- @param state table -- DFS state: --- @param state table -- DFS state:
...@@ -3576,7 +3584,7 @@ end ...@@ -3576,7 +3584,7 @@ end
--- race_prune_index integer --- race_prune_index integer
--- @return boolean True if a valid selection exists, false otherwise. --- @return boolean True if a valid selection exists, false otherwise.
function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc, function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,selected,index,state,prune_indexes) tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck,selected,index,state,prune_indexes)
if state.tuner_count>tuner_max then return false end if state.tuner_count>tuner_max then return false end
if state.non_tuner_count>non_tuner_max then return false end if state.non_tuner_count>non_tuner_max then return false end
...@@ -3626,6 +3634,9 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f ...@@ -3626,6 +3634,9 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f
if index>#candidates then if index>#candidates then
-- check if target_level achievable exactly -- check if target_level achievable exactly
if not sgoalcheck(Group.FromCards(table.unpack(selected))) then
return false
end
if state.possible_sums[target_level] and if state.possible_sums[target_level] and
state.tuner_count>=tuner_min and state.tuner_count>=tuner_min and
state.non_tuner_count>=non_tuner_min then state.non_tuner_count>=non_tuner_min then
...@@ -3658,7 +3669,7 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f ...@@ -3658,7 +3669,7 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f
tuner_race,tuner_filter, tuner_race,tuner_filter,
non_tuner_race,non_tuner_filter,tc, non_tuner_race,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max, tuner_min,tuner_max,non_tuner_min,non_tuner_max,
level_mapper,hand_count_mapper,scheck, level_mapper,hand_count_mapper,scheck,sgoalcheck,
selected,index+1,branch_state,prune_indexes selected,index+1,branch_state,prune_indexes
) then ) then
table.remove(selected) table.remove(selected)
...@@ -3670,15 +3681,30 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f ...@@ -3670,15 +3681,30 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f
-- exclude branch -- exclude branch
if Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc, if Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,selected,index+1,state,prune_indexes) then tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck,selected,index+1,state,prune_indexes) then
return true return true
end end
return false return false
end end
--- Synchro condition generator using tuner/non-tuner min/max counts and filters --- Dynamically generates a Synchro Summon condition by combining tuner/non-tuner
function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck) --- minimum and maximum counts, filters, and mapper functions.
---
--- @param tuner_race number The race ID that qualifies as a tuner. `nil` means no race restriction.
--- @param tuner_filter fun(mc:Card,tc:Card):boolean A predicate function to further filter tuner candidates.
--- Receives a card object and returns true if it’s valid.
--- @param non_tuner_race number The race ID that qualifies as a non-tuner. `nil` means no race restriction.
--- @param non_tuner_filter fun(mc:Card,tc:Card):boolean A predicate function to further filter non-tuner candidates.
--- @param tuner_min number The minimum number of tuners required as materials.
--- @param tuner_max number The maximum number of tuners allowed as materials.
--- @param non_tuner_min number The minimum number of non-tuners required as materials.
--- @param non_tuner_max number The maximum number of non-tuners allowed as materials.
--- @param level_mapper fun(mc,tc):integer[] returns a list of possible “level values” for that card.
--- @param hand_count_mapper fun(mc,tc):integer
--- @param scheck fun(mg:Group):boolean Called during selection to prune branches when it’s impossible to meet the conditions.
--- @param sgoalcheck fun(mg:Group):boolean Called after full selection to verify the final Synchro Summon condition.
function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck)
--- @param mg Group --- @param mg Group
return function(e,c,smat,mg,min,max,accel_synchro_opts) return function(e,c,smat,mg,min,max,accel_synchro_opts)
if c==nil then return true end if c==nil then return true end
...@@ -3704,12 +3730,12 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f ...@@ -3704,12 +3730,12 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f
local old_scheck=scheck local old_scheck=scheck
--- @param g Group --- @param g Group
scheck=aux.AND(function(g) scheck=aux.AND(function(g)
if not g:IsExists(function(mc) return mc:IsType(TYPE_TUNER) and mc:IsSetCard(0x2) end,1,nil) then if not g:IsExists(function(mc) return mc:IsType(TYPE_TUNER) and mc:IsSetCard(0x2) end,1,nil) then
return false return false
end end
return true return true
end, end,
old_scheck) old_scheck)
end end
local target_level=c:GetLevel() local target_level=c:GetLevel()
...@@ -3732,14 +3758,14 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f ...@@ -3732,14 +3758,14 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f
local pre_selected_states=Synchro.BuildStatesFromSelection(pre_selected_arr,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,level_mapper,hand_count_mapper,c,math.huge,skip_hand_count_check) local pre_selected_states=Synchro.BuildStatesFromSelection(pre_selected_arr,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,level_mapper,hand_count_mapper,c,math.huge,skip_hand_count_check)
for _,state in ipairs(pre_selected_states) do for _,state in ipairs(pre_selected_states) do
if Synchro.FindValidSelection(candidates,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,c,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,pre_selected_arr,state) then if Synchro.FindValidSelection(candidates,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,c,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck,pre_selected_arr,state) then
return true return true
end end
end end
end end
end end
function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck) function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck)
return function(e,tp,eg,ep,ev,re,r,rp,chk,tc,smat,mg,min,max,accel_synchro_opts) return function(e,tp,eg,ep,ev,re,r,rp,chk,tc,smat,mg,min,max,accel_synchro_opts)
--- accel synchro has already selected their materials, skip material selection step --- accel synchro has already selected their materials, skip material selection step
if mg~=nil and #mg==min then if mg~=nil and #mg==min then
...@@ -3846,7 +3872,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt ...@@ -3846,7 +3872,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
tuner_race,tuner_filter, tuner_race,tuner_filter,
non_tuner_race,non_tuner_filter,tc, non_tuner_race,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max, tuner_min,tuner_max,non_tuner_min,non_tuner_max,
level_mapper,hand_count_mapper,scheck,test_selection,init_state) level_mapper,hand_count_mapper,scheck,sgoalcheck,test_selection,init_state)
then then
addable:AddCard(candidate) addable:AddCard(candidate)
break break
...@@ -3863,7 +3889,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt ...@@ -3863,7 +3889,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
break break
end end
local finishable=Synchro.IsSelectionValid(sg_arr,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper) local finishable=Synchro.IsSelectionValid(sg_arr,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,sgoalcheck)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local picked=Group.SelectUnselect(addable,sg,tp,finishable,true,selected_level_min,target_level) local picked=Group.SelectUnselect(addable,sg,tp,finishable,true,selected_level_min,target_level)
...@@ -3958,7 +3984,10 @@ function Synchro.SynOperation() ...@@ -3958,7 +3984,10 @@ function Synchro.SynOperation()
end end
end end
function Synchro.IsSelectionValid(selection,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper) function Synchro.IsSelectionValid(selection,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,sgoalcheck)
if not sgoalcheck(Group.FromCards(table.unpack(selection))) then
return false
end
local states=Synchro.BuildStatesFromSelection( local states=Synchro.BuildStatesFromSelection(
selection, selection,
tuner_race,tuner_filter, tuner_race,tuner_filter,
...@@ -4463,6 +4492,7 @@ function AccelSynchro.CreateSummonEffect(c,opts) ...@@ -4463,6 +4492,7 @@ function AccelSynchro.CreateSummonEffect(c,opts)
local skip_hand_count_check=opts.skip_hand_count_check or false local skip_hand_count_check=opts.skip_hand_count_check or false
local additional_scheck=opts.additional_scheck local additional_scheck=opts.additional_scheck
local material_operation=opts.material_operation local material_operation=opts.material_operation
local stage_x_operation=opts.stage_x_operation or aux.TRUE
local e=Effect.CreateEffect(c) local e=Effect.CreateEffect(c)
-- e:SetDescription(1164) -- e:SetDescription(1164)
e:SetDescription(1379) --- 启用扩展卡包调试模式 e:SetDescription(1379) --- 启用扩展卡包调试模式
...@@ -4471,7 +4501,7 @@ function AccelSynchro.CreateSummonEffect(c,opts) ...@@ -4471,7 +4501,7 @@ function AccelSynchro.CreateSummonEffect(c,opts)
e:SetCode(EVENT_FREE_CHAIN) e:SetCode(EVENT_FREE_CHAIN)
e:SetRange(LOCATION_MZONE) e:SetRange(LOCATION_MZONE)
e:SetTarget(AccelSynchro.GetSummonTarget(synfilter,mg,gc,skip_hand_count_check,additional_scheck)) e:SetTarget(AccelSynchro.GetSummonTarget(synfilter,mg,gc,skip_hand_count_check,additional_scheck))
e:SetOperation(AccelSynchro.GetSummonOperation(synfilter,mg,gc,skip_hand_count_check,additional_scheck,material_operation)) e:SetOperation(AccelSynchro.GetSummonOperation(synfilter,mg,gc,skip_hand_count_check,additional_scheck,material_operation,stage_x_operation))
return e return e
end end
...@@ -4486,7 +4516,7 @@ function AccelSynchro.GetSummonTarget(synfilter,mg,gc,skip_hand_count_check,addi ...@@ -4486,7 +4516,7 @@ function AccelSynchro.GetSummonTarget(synfilter,mg,gc,skip_hand_count_check,addi
end end
end end
function AccelSynchro.GetSummonOperation(synfilter,mg,gc,skip_hand_count_check,additional_scheck,material_operation) function AccelSynchro.GetSummonOperation(synfilter,mg,gc,skip_hand_count_check,additional_scheck,material_operation,stage_x_operation)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
mg=mg or Duel.GetSynchroMaterial(tp) mg=mg or Duel.GetSynchroMaterial(tp)
local g=Duel.GetMatchingGroup(function(tc) return synfilter(tc) end,tp,LOCATION_EXTRA,0,nil) local g=Duel.GetMatchingGroup(function(tc) return synfilter(tc) end,tp,LOCATION_EXTRA,0,nil)
...@@ -4529,6 +4559,7 @@ function AccelSynchro.GetSummonOperation(synfilter,mg,gc,skip_hand_count_check,a ...@@ -4529,6 +4559,7 @@ function AccelSynchro.GetSummonOperation(synfilter,mg,gc,skip_hand_count_check,a
assert(tc~=nil) assert(tc~=nil)
assert(selected_proc~=nil) assert(selected_proc~=nil)
AccelSynchro.OverwriteMaterialOperationCode=material_operation AccelSynchro.OverwriteMaterialOperationCode=material_operation
stage_x_operation(e,tc)
Duel.SynchroSummon(tp,tc,nil,mat,#mat,#mat) Duel.SynchroSummon(tp,tc,nil,mat,#mat,#mat)
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