Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-scripts-888
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-scripts-888
Commits
9f9014b3
Commit
9f9014b3
authored
Jul 03, 2025
by
Vury Leo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init mat filter
parent
f5ac4633
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
55 deletions
+119
-55
c86137485.lua
c86137485.lua
+1
-1
procedure.lua
procedure.lua
+118
-54
No files found.
c86137485.lua
View file @
9f9014b3
...
...
@@ -2,10 +2,10 @@
local
s
,
id
,
o
=
GetID
()
function
s
.
initial_effect
(
c
)
--synchro summon
aux
.
AddSynchroProcedure
(
c
,
aux
.
FilterBoolFunction
(
Card
.
IsRace
,
RACE_FIEND
),
aux
.
NonTuner
(
nil
),
1
)
Synchro
.
AddSynchroProcedure
(
c
,{
tuner_race
=
RACE_FIEND
,
})
aux
.
AddSynchroProcedure
(
c
,
aux
.
FilterBoolFunction
(
Card
.
IsRace
,
RACE_FIEND
),
aux
.
NonTuner
(
nil
),
1
)
c
:
EnableReviveLimit
()
--chain attack
local
e1
=
Effect
.
CreateEffect
(
c
)
...
...
procedure.lua
View file @
9f9014b3
...
...
@@ -3417,7 +3417,7 @@ function Synchro.FindValidSelection(candidates,target_level,
Synchro.SortMaterials(candidates,tc,tuner_filter)
-- Find the index of the last level card
local
level_prune_index
=
0
local level_prune_index=
-1
for i, c in ipairs(candidates) do
if Synchro.IsLevelAlter(c) then
level_prune_index=i
...
...
@@ -3425,7 +3425,7 @@ function Synchro.FindValidSelection(candidates,target_level,
end
-- Find the index of the last hand card
local
hand_prune_index
=
0
local hand_prune_index=
-1
for i, c in ipairs(candidates) do
if Synchro.IsHandAlter(c) then
hand_prune_index=i
...
...
@@ -3433,7 +3433,7 @@ function Synchro.FindValidSelection(candidates,target_level,
end
-- Find the index of the last race card
local
race_prune_index
=
0
local race_prune_index=
-1
for i, c in ipairs(candidates) do
if Synchro.IsRaceAlter(c) then
race_prune_index=i
...
...
@@ -3459,6 +3459,7 @@ function Synchro.FindValidSelection(candidates,target_level,
hand_count_limit=0,
hand_count=0,
genomix_race=nil,
material_limit_filter=aux.TRUE,
},
{
level_prune_index=level_prune_index,
...
...
@@ -3530,25 +3531,51 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f
end
local mc=candidates[index]
for
_
,
diff
in
ipairs
(
Synchro
.
GenerateVariantForCard
(
state
,
mc
,
#
selected
+
1
,
tc
,
prune_tuner_filter
,
prune_non_tuner_filter
))
do
-- apply diff
local
branch_state
=
Synchro
.
ApplyVariantState
(
state
,
mc
,
diff
,
tuner_race
,
prune_tuner_filter
,
non_tuner_race
,
prune_non_tuner_filter
,
tc
,
prune_level
)
table.insert
(
selected
,
mc
)
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
,
base_mapper
,
selected
,
index
+
1
,
branch_state
,
prune_indexes
)
then
local can_include=true
--- to include one material it must fit all applied filter
if not state.material_limit_filter(nil,mc) then
can_include=false
end
local append_material_limit_filter=nil
if can_include==true then
--- to include one material, all selected ones must fit its material limit
local material_limit_effect=mc:IsHasEffect(EFFECT_TUNER_MATERIAL_LIMIT)
if material_limit_effect~=nil then
append_material_limit_filter=material_limit_effect:GetTarget()
assert(append_material_limit_filter~=nil,"we have a material limit effect but it does not have target function")
for _,selected_mat in ipairs(selected) do
if not append_material_limit_filter(material_limit_effect,selected_mat) then
can_include=false
break
end
end
end
end
--- include branch
if can_include then
for _,diff in ipairs(Synchro.GenerateVariantForCard(
state,mc,#selected+1,tc,prune_tuner_filter,prune_non_tuner_filter
)) do
-- apply diff
local branch_state=Synchro.ApplyVariantState(
state,mc,diff,tuner_race,prune_tuner_filter,non_tuner_race,prune_non_tuner_filter,tc,prune_level,append_material_limit_filter
)
table.insert(selected,mc)
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,
base_mapper,selected,index+1,branch_state,prune_indexes
) then
table.remove(selected)
return true
end
table.remove(selected)
return
true
end
table.remove
(
selected
)
end
-- exclude branch
...
...
@@ -3612,44 +3639,69 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
--- use the min select level as hint
for _,state in ipairs(selected_states) do
for lvl,_ in pairs(state.possible_sums) do
if
lvl
<
selected_level_min
then
if lvl
<
selected_level_min then
selected_level_min=lvl
end
end
end
for _,state in ipairs(selected_states) do
for _,candidate in ipairs(cg_arr) do
local can_include=true
for
_
,
candidate
in
ipairs
(
cg_arr
)
do
-- simulate adding candidate to sg_arr
local
test_selection
=
{}
for
_
,
card
in
ipairs
(
sg_arr
)
do
table.insert
(
test_selection
,
card
)
end
table.insert
(
test_selection
,
candidate
)
-- build rest_candidates without candidate
local
rest_candidates
=
{}
for
_
,
other
in
ipairs
(
cg_arr
)
do
if
other
~=
candidate
then
table.insert
(
rest_candidates
,
other
)
--- to include one material it must fit all applied filter
if not state.material_limit_filter(nil,candidate) then
can_include=false
end
end
local
base_states
=
Synchro
.
BuildStatesFromSelection
(
test_selection
,
tuner_race
,
tuner_filter
,
non_tuner_race
,
non_tuner_filter
,
base_mapper
,
tc
,
math.huge
)
for
_
,
init_state
in
ipairs
(
base_states
)
do
if
Synchro
.
FindValidSelection
(
rest_candidates
,
target_level
,
tuner_race
,
tuner_filter
,
non_tuner_race
,
non_tuner_filter
,
tc
,
tuner_min
,
tuner_max
,
non_tuner_min
,
non_tuner_max
,
base_mapper
,
test_selection
,
init_state
)
then
addable
:
AddCard
(
candidate
)
break
local append_material_limit_filter=nil
if can_include==true then
--- to include one material, all selected ones must fit its material limit
local material_limit_effect=candidate:IsHasEffect(EFFECT_TUNER_MATERIAL_LIMIT)
if material_limit_effect~=nil then
append_material_limit_filter=material_limit_effect:GetTarget()
for _,selected_mat in ipairs(sg_arr) do
if not append_material_limit_filter(material_limit_effect,selected_mat) then
can_include=false
break
end
end
end
end
if can_include then
-- simulate adding candidate to sg_arr
local test_selection={}
for _, card in ipairs(sg_arr) do table.insert(test_selection,card) end
table.insert(test_selection,candidate)
-- build rest_candidates without candidate
local rest_candidates={}
for _, other in ipairs(cg_arr) do
if other~=candidate then
table.insert(rest_candidates,other)
end
end
local base_states=Synchro.BuildStatesFromSelection(
test_selection,
tuner_race,tuner_filter,
non_tuner_race,non_tuner_filter,
base_mapper,
tc,math.huge
)
for _,init_state in ipairs(base_states) do
if Synchro.FindValidSelection(
rest_candidates,target_level,
tuner_race,tuner_filter,
non_tuner_race,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max,
base_mapper,test_selection,init_state)
then
addable:AddCard(candidate)
break
end
end
end
end
end
...
...
@@ -3778,6 +3830,7 @@ function Synchro.BuildStatesFromSelection(selection,tuner_race,tuner_filter,non_
hand_count_limit=0,
hand_count=0,
genomix_race=nil,
material_limit_filter=aux.TRUE,
}
}
...
...
@@ -3786,13 +3839,19 @@ function Synchro.BuildStatesFromSelection(selection,tuner_race,tuner_filter,non_
for idx,card in ipairs(selection)do
local next_states={}
local material_limit_effect=card:IsHasEffect(EFFECT_TUNER_MATERIAL_LIMIT)
local append_material_limit_filter=nil
if material_limit_effect~=nil then
append_material_limit_filter=material_limit_effect:GetTarget()
end
for _,st in ipairs(states) do
for _,diff in ipairs(Synchro.GenerateVariantForCard(
st,card,idx,tc,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter
)) do
-- merge diff into full state
local new_state = Synchro.ApplyVariantState(
st
,
card
,
diff
,
tuner_race
,
tuner_filter
,
non_tuner_race
,
non_tuner_filter
,
tc
,
prune_level
st,card,diff,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,prune_level
,append_material_limit_filter
)
table.insert(next_states,new_state)
end
...
...
@@ -3928,7 +3987,7 @@ end
-- Helper to apply a diff to a base state
function
Synchro
.
ApplyVariantState
(
st
,
card
,
diff
,
tuner_race
,
tuner_filter
,
non_tuner_race
,
non_tuner_filter
,
tc
,
prune_level
)
function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,prune_level
,append_material_limit_filter
)
-- compute increments using provided filters
local tuner_inc=tuner_filter(card,tc) and 1 or 0
local non_tuner_inc=non_tuner_filter(card,tc) and 1 or 0
...
...
@@ -3938,6 +3997,10 @@ function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_filter,non_tune
st.level_mapper(card,tc),
prune_level
)
local new_material_limit_filter=st.material_limit_filter
if append_material_limit_filter~=nil then
new_material_limit_filter=aux.AND(append_material_limit_filter,st.material_limit_filter)
end
return {
possible_sums=diff.possible_sums or possible_sums,
tuner_count=st.tuner_count+tuner_inc,
...
...
@@ -3946,6 +4009,7 @@ function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_filter,non_tune
level_mapper_priority=diff.level_mapper_priority or st.level_mapper_priority,
hand_count_limit=diff.hand_count_limit or st.hand_count_limit,
hand_count=st.hand_count+hand_inc,
genomix_race
=
diff
.
genomix_race
or
st
.
genomix_race
genomix_race=diff.genomix_race or st.genomix_race,
material_limit_filter=new_material_limit_filter,
}
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment