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
4
Merge Requests
4
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 @@
...
@@ -2,10 +2,10 @@
local
s
,
id
,
o
=
GetID
()
local
s
,
id
,
o
=
GetID
()
function
s
.
initial_effect
(
c
)
function
s
.
initial_effect
(
c
)
--synchro summon
--synchro summon
aux
.
AddSynchroProcedure
(
c
,
aux
.
FilterBoolFunction
(
Card
.
IsRace
,
RACE_FIEND
),
aux
.
NonTuner
(
nil
),
1
)
Synchro
.
AddSynchroProcedure
(
c
,{
Synchro
.
AddSynchroProcedure
(
c
,{
tuner_race
=
RACE_FIEND
,
tuner_race
=
RACE_FIEND
,
})
})
aux
.
AddSynchroProcedure
(
c
,
aux
.
FilterBoolFunction
(
Card
.
IsRace
,
RACE_FIEND
),
aux
.
NonTuner
(
nil
),
1
)
c
:
EnableReviveLimit
()
c
:
EnableReviveLimit
()
--chain attack
--chain attack
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
...
...
procedure.lua
View file @
9f9014b3
...
@@ -3417,7 +3417,7 @@ function Synchro.FindValidSelection(candidates,target_level,
...
@@ -3417,7 +3417,7 @@ function Synchro.FindValidSelection(candidates,target_level,
Synchro
.
SortMaterials
(
candidates
,
tc
,
tuner_filter
)
Synchro
.
SortMaterials
(
candidates
,
tc
,
tuner_filter
)
-- Find the index of the last level card
-- 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
for
i
,
c
in
ipairs
(
candidates
)
do
if
Synchro
.
IsLevelAlter
(
c
)
then
if
Synchro
.
IsLevelAlter
(
c
)
then
level_prune_index
=
i
level_prune_index
=
i
...
@@ -3425,7 +3425,7 @@ function Synchro.FindValidSelection(candidates,target_level,
...
@@ -3425,7 +3425,7 @@ function Synchro.FindValidSelection(candidates,target_level,
end
end
-- Find the index of the last hand card
-- 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
for
i
,
c
in
ipairs
(
candidates
)
do
if
Synchro
.
IsHandAlter
(
c
)
then
if
Synchro
.
IsHandAlter
(
c
)
then
hand_prune_index
=
i
hand_prune_index
=
i
...
@@ -3433,7 +3433,7 @@ function Synchro.FindValidSelection(candidates,target_level,
...
@@ -3433,7 +3433,7 @@ function Synchro.FindValidSelection(candidates,target_level,
end
end
-- Find the index of the last race card
-- 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
for
i
,
c
in
ipairs
(
candidates
)
do
if
Synchro
.
IsRaceAlter
(
c
)
then
if
Synchro
.
IsRaceAlter
(
c
)
then
race_prune_index
=
i
race_prune_index
=
i
...
@@ -3459,6 +3459,7 @@ function Synchro.FindValidSelection(candidates,target_level,
...
@@ -3459,6 +3459,7 @@ function Synchro.FindValidSelection(candidates,target_level,
hand_count_limit
=
0
,
hand_count_limit
=
0
,
hand_count
=
0
,
hand_count
=
0
,
genomix_race
=
nil
,
genomix_race
=
nil
,
material_limit_filter
=
aux
.
TRUE
,
},
},
{
{
level_prune_index
=
level_prune_index
,
level_prune_index
=
level_prune_index
,
...
@@ -3530,25 +3531,51 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f
...
@@ -3530,25 +3531,51 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_f
end
end
local
mc
=
candidates
[
index
]
local
mc
=
candidates
[
index
]
for
_
,
diff
in
ipairs
(
Synchro
.
GenerateVariantForCard
(
local
can_include
=
true
state
,
mc
,
#
selected
+
1
,
tc
,
prune_tuner_filter
,
prune_non_tuner_filter
))
do
--- to include one material it must fit all applied filter
-- apply diff
if
not
state
.
material_limit_filter
(
nil
,
mc
)
then
local
branch_state
=
Synchro
.
ApplyVariantState
(
can_include
=
false
state
,
mc
,
diff
,
tuner_race
,
prune_tuner_filter
,
non_tuner_race
,
prune_non_tuner_filter
,
tc
,
prune_level
end
)
table.insert
(
selected
,
mc
)
local
append_material_limit_filter
=
nil
if
Synchro
.
CanCompleteSelection
(
if
can_include
==
true
then
candidates
,
target_level
,
--- to include one material, all selected ones must fit its material limit
tuner_race
,
tuner_filter
,
local
material_limit_effect
=
mc
:
IsHasEffect
(
EFFECT_TUNER_MATERIAL_LIMIT
)
non_tuner_race
,
non_tuner_filter
,
tc
,
if
material_limit_effect
~=
nil
then
tuner_min
,
tuner_max
,
non_tuner_min
,
non_tuner_max
,
append_material_limit_filter
=
material_limit_effect
:
GetTarget
()
base_mapper
,
selected
,
index
+
1
,
branch_state
,
prune_indexes
assert
(
append_material_limit_filter
~=
nil
,
"we have a material limit effect but it does not have target function"
)
)
then
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
)
table.remove
(
selected
)
return
true
end
end
table.remove
(
selected
)
end
end
-- exclude branch
-- exclude branch
...
@@ -3612,44 +3639,69 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
...
@@ -3612,44 +3639,69 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
--- use the min select level as hint
--- use the min select level as hint
for
_
,
state
in
ipairs
(
selected_states
)
do
for
_
,
state
in
ipairs
(
selected_states
)
do
for
lvl
,
_
in
pairs
(
state
.
possible_sums
)
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
selected_level_min
=
lvl
end
end
end
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
--- to include one material it must fit all applied filter
-- simulate adding candidate to sg_arr
if
not
state
.
material_limit_filter
(
nil
,
candidate
)
then
local
test_selection
=
{}
can_include
=
false
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
end
local
base_states
=
Synchro
.
BuildStatesFromSelection
(
local
append_material_limit_filter
=
nil
test_selection
,
if
can_include
==
true
then
tuner_race
,
tuner_filter
,
--- to include one material, all selected ones must fit its material limit
non_tuner_race
,
non_tuner_filter
,
local
material_limit_effect
=
candidate
:
IsHasEffect
(
EFFECT_TUNER_MATERIAL_LIMIT
)
base_mapper
,
if
material_limit_effect
~=
nil
then
tc
,
math.huge
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
for
_
,
init_state
in
ipairs
(
base_states
)
do
can_include
=
false
if
Synchro
.
FindValidSelection
(
break
rest_candidates
,
target_level
,
end
tuner_race
,
tuner_filter
,
end
non_tuner_race
,
non_tuner_filter
,
tc
,
end
tuner_min
,
tuner_max
,
non_tuner_min
,
non_tuner_max
,
end
base_mapper
,
test_selection
,
init_state
)
then
if
can_include
then
addable
:
AddCard
(
candidate
)
-- simulate adding candidate to sg_arr
break
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
end
end
end
...
@@ -3778,6 +3830,7 @@ function Synchro.BuildStatesFromSelection(selection,tuner_race,tuner_filter,non_
...
@@ -3778,6 +3830,7 @@ function Synchro.BuildStatesFromSelection(selection,tuner_race,tuner_filter,non_
hand_count_limit
=
0
,
hand_count_limit
=
0
,
hand_count
=
0
,
hand_count
=
0
,
genomix_race
=
nil
,
genomix_race
=
nil
,
material_limit_filter
=
aux
.
TRUE
,
}
}
}
}
...
@@ -3786,13 +3839,19 @@ function Synchro.BuildStatesFromSelection(selection,tuner_race,tuner_filter,non_
...
@@ -3786,13 +3839,19 @@ function Synchro.BuildStatesFromSelection(selection,tuner_race,tuner_filter,non_
for
idx
,
card
in
ipairs
(
selection
)
do
for
idx
,
card
in
ipairs
(
selection
)
do
local
next_states
=
{}
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
_
,
st
in
ipairs
(
states
)
do
for
_
,
diff
in
ipairs
(
Synchro
.
GenerateVariantForCard
(
for
_
,
diff
in
ipairs
(
Synchro
.
GenerateVariantForCard
(
st
,
card
,
idx
,
tc
,
tuner_race
,
tuner_filter
,
non_tuner_race
,
non_tuner_filter
st
,
card
,
idx
,
tc
,
tuner_race
,
tuner_filter
,
non_tuner_race
,
non_tuner_filter
))
do
))
do
-- merge diff into full state
-- merge diff into full state
local
new_state
=
Synchro
.
ApplyVariantState
(
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
)
table.insert
(
next_states
,
new_state
)
end
end
...
@@ -3928,7 +3987,7 @@ end
...
@@ -3928,7 +3987,7 @@ end
-- Helper to apply a diff to a base state
-- 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
-- compute increments using provided filters
local
tuner_inc
=
tuner_filter
(
card
,
tc
)
and
1
or
0
local
tuner_inc
=
tuner_filter
(
card
,
tc
)
and
1
or
0
local
non_tuner_inc
=
non_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
...
@@ -3938,6 +3997,10 @@ function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_filter,non_tune
st
.
level_mapper
(
card
,
tc
),
st
.
level_mapper
(
card
,
tc
),
prune_level
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
{
return
{
possible_sums
=
diff
.
possible_sums
or
possible_sums
,
possible_sums
=
diff
.
possible_sums
or
possible_sums
,
tuner_count
=
st
.
tuner_count
+
tuner_inc
,
tuner_count
=
st
.
tuner_count
+
tuner_inc
,
...
@@ -3946,6 +4009,7 @@ function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_filter,non_tune
...
@@ -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
,
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_limit
=
diff
.
hand_count_limit
or
st
.
hand_count_limit
,
hand_count
=
st
.
hand_count
+
hand_inc
,
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
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