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
81a1b411
Commit
81a1b411
authored
Jul 13, 2025
by
Vury Leo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add has_same
parent
5ca698c3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
127 additions
and
71 deletions
+127
-71
c11765832.lua
c11765832.lua
+2
-2
procedure.lua
procedure.lua
+125
-69
No files found.
c11765832.lua
View file @
81a1b411
...
...
@@ -2,7 +2,7 @@
local
s
,
id
,
o
=
GetID
()
function
s
.
initial_effect
(
c
)
c
:
EnableReviveLimit
()
aux
.
AddFusionProcFunRep
(
c
,
s
.
ffilter
,
2
,
true
)
--
aux.AddFusionProcFunRep(c,s.ffilter,2,true)
Fusion
.
AddFusionProcedure
(
c
,{
slots
=
{
Fusion
.
Slot
.
Group
({
...
...
@@ -10,7 +10,7 @@ function s.initial_effect(c)
max
=
2
,
unique_by
=
function
(
mc
)
return
{
mc
:
GetCode
(),
mc
:
GetFusionCode
()
}
end
,
has_same
=
{
function
(
mc
)
return
mc
:
GetFusionAttribute
(
)
end
,
function
(
mc
,
tc
)
return
mc
:
GetFusionAttribute
(
tc
:
GetOwner
()
)
end
,
function
(
mc
)
return
mc
:
GetRace
()
end
,
}
})
...
...
procedure.lua
View file @
81a1b411
...
...
@@ -3500,11 +3500,11 @@ function Fusion.FusionCondition(slots,allow_extras)
end
-- all has_same on S
for
_
,
fn
in
ipairs
(
grp
.
has_same
)
do
local
v0
=
fn
(
S
[
1
])
local
v0
=
fn
(
S
[
1
]
,
e
:
GetHandler
()
)
if
type
(
v0
)
==
"number"
then
local
mask
=
v0
for
j
=
2
,
#
S
do
mask
=
mask
&
fn
(
S
[
j
])
mask
=
mask
&
fn
(
S
[
j
]
,
e
:
GetHandler
()
)
if
mask
==
0
then
return
false
end
end
else
...
...
@@ -3512,7 +3512,7 @@ function Fusion.FusionCondition(slots,allow_extras)
for
_
,
key
in
ipairs
(
v0
)
do
common
[
key
]
=
true
end
for
j
=
2
,
#
S
do
local
next_common
=
{}
for
_
,
key
in
ipairs
(
fn
(
S
[
j
]))
do
for
_
,
key
in
ipairs
(
fn
(
S
[
j
]
,
e
:
GetHandler
()
))
do
if
common
[
key
]
then
next_common
[
key
]
=
true
end
...
...
@@ -3533,7 +3533,7 @@ function Fusion.FusionCondition(slots,allow_extras)
end
for
idx
=
start
,
n
do
table.insert
(
comb
,
idx
)
dfs_comb
(
idx
+
1
)
dfs_comb
(
idx
+
1
)
table.remove
(
comb
)
if
found
then
return
end
end
...
...
@@ -3543,12 +3543,12 @@ function Fusion.FusionCondition(slots,allow_extras)
if
not
found
then
return
false
end
else
for
_
,
fn
in
ipairs
(
grp
.
has_same
)
do
local
v0
=
fn
(
matched
[
1
])
local
v0
=
fn
(
matched
[
1
]
,
e
:
GetHandler
()
)
if
type
(
v0
)
==
"number"
then
-- bitmask path
local
common_mask
=
v0
for
j
=
2
,
#
matched
do
common_mask
=
common_mask
&
fn
(
matched
[
j
])
common_mask
=
common_mask
&
fn
(
matched
[
j
]
,
e
:
GetHandler
()
)
if
common_mask
==
0
then
return
false
end
...
...
@@ -3561,7 +3561,7 @@ function Fusion.FusionCondition(slots,allow_extras)
end
for
j
=
2
,
#
matched
do
local
next_common
=
{}
for
_
,
k
in
ipairs
(
fn
(
matched
[
j
]))
do
for
_
,
k
in
ipairs
(
fn
(
matched
[
j
]
,
e
:
GetHandler
()
))
do
if
common
[
k
]
then
next_common
[
k
]
=
true
end
...
...
@@ -3663,7 +3663,7 @@ function Fusion.FusionOperation(slots)
max_req
=
max_req
+
1
end
end
local
max_req
=
math.min
(
max_req
,
eg
:
GetCount
())
max_req
=
math.min
(
max_req
,
eg
:
GetCount
())
-- prompt player
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_FMATERIAL
)
...
...
@@ -3812,17 +3812,19 @@ function Fusion.FindAllMappings(cards_sel,slots,handler)
-- passes all uniqueness checks → record it
local
copy
=
{}
for
k
,
v
in
pairs
(
mapping
)
do
copy
[
k
]
=
v
copy
[
k
]
=
v
end
table.insert
(
all_maps
,
copy
)
table.insert
(
all_maps
,
copy
)
return
end
local
tc
=
cards_sel
[
idx
]
local
any_match
=
false
-- track if we managed to assign tc
-- try single slots
for
i
,
slot
in
ipairs
(
slots
)
do
if
not
slot
.
group
and
not
filled
[
i
]
and
Fusion
.
MatchSlot
(
tc
,
slot
,
handler
)
then
if
not
slot
.
group
and
not
filled
[
i
]
and
Fusion
.
MatchSlot
(
tc
,
slot
,
handler
)
then
any_match
=
true
filled
[
i
]
=
true
mapping
[
idx
]
=
i
dfs
(
idx
+
1
)
...
...
@@ -3835,9 +3837,50 @@ function Fusion.FindAllMappings(cards_sel,slots,handler)
for
i
,
slot
in
ipairs
(
slots
)
do
if
slot
.
group
then
local
assigned
=
group_assigned
[
i
]
local
max_ok
=
assigned
<
slot
.
group
.
max
if
max_ok
and
(
not
slot
.
group
.
filter
or
slot
.
group
.
filter
(
tc
))
then
group_assigned
[
i
]
=
assigned
+
1
if
assigned
<
slot
.
group
.
max
then
-- base filter
if
not
slot
.
group
.
filter
or
slot
.
group
.
filter
(
tc
)
then
-- has_same check: only if there's already ≥1 in this slot
local
ok
=
true
if
slot
.
group
.
has_same
and
assigned
>
0
then
for
_
,
fn
in
ipairs
(
slot
.
group
.
has_same
)
do
-- start intersection with this candidate
local
v0
=
fn
(
tc
,
handler
)
if
type
(
v0
)
==
"number"
then
-- bitmask path
local
mask
=
v0
-- AND with each already‐assigned card
for
j
=
1
,
idx
-
1
do
if
mapping
[
j
]
==
i
then
mask
=
mask
&
fn
(
cards_sel
[
j
],
handler
)
if
mask
==
0
then
break
end
end
end
if
mask
==
0
then
ok
=
false
end
else
-- list-of-keys path
local
common
=
{}
for
_
,
k
in
ipairs
(
v0
)
do
common
[
k
]
=
true
end
-- intersect with each already-assigned card
for
j
=
1
,
idx
-
1
do
if
mapping
[
j
]
==
i
then
local
next_c
=
{}
for
_
,
k
in
ipairs
(
fn
(
cards_sel
[
j
],
handler
))
do
if
common
[
k
]
then
next_c
[
k
]
=
true
end
end
common
=
next_c
if
not
next
(
common
)
then
break
end
end
end
if
not
next
(
common
)
then
ok
=
false
end
end
if
not
ok
then
break
end
end
end
if
ok
then
any_match
=
true
group_assigned
[
i
]
=
assigned
+
1
mapping
[
idx
]
=
i
dfs
(
idx
+
1
)
group_assigned
[
i
]
=
assigned
...
...
@@ -3846,6 +3889,13 @@ function Fusion.FindAllMappings(cards_sel,slots,handler)
end
end
end
end
-- If we couldn’t assign tc to any slot, prune this branch
if
not
any_match
then
return
end
end
dfs
(
1
)
return
all_maps
...
...
@@ -3914,16 +3964,23 @@ function Fusion.CanCompleteFromMappings(e,sel,eg,slots,handler,gc,chkf)
end
-- if this slot has a has_same, wrap its filter to include only sames
if
slot
.
group
.
has_same
then
-- only if there is at least one already‐selected card for this slot…
local
has_sel
=
false
for
_
,
mapped_i
in
pairs
(
mapping
)
do
if
mapped_i
==
i
then
has_sel
=
true
break
end
end
if
has_sel
then
-- precompute, for each fn in has_same, the overlap of already-mapped cards
local
used_overlap
=
{}
-- fn → (number mask) or (table of keys)
for
_
,
fn
in
ipairs
(
slot
.
group
.
has_same
)
do
local
bitmask
,
keytbl
=
nil
,{}
-- fold each selected card’s fn(...) into either bitmask or keytbl
for
idx
,
mapped_i
in
pairs
(
mapping
)
do
if
mapped_i
==
i
then
local
v
=
fn
(
cards_sel
[
idx
]
)
local
v
=
fn
(
cards_sel
[
idx
],
handler
)
if
type
(
v
)
==
"number"
then
bitmask
=
bitmask
and
(
bitmask
&
v
)
or
v
elseif
type
(
v
)
==
"table"
then
...
...
@@ -3933,7 +3990,6 @@ function Fusion.CanCompleteFromMappings(e,sel,eg,slots,handler,gc,chkf)
end
end
end
-- store whichever collapsed structure is nonempty
if
bitmask
then
used_overlap
[
fn
]
=
bitmask
...
...
@@ -3941,17 +3997,16 @@ function Fusion.CanCompleteFromMappings(e,sel,eg,slots,handler,gc,chkf)
used_overlap
[
fn
]
=
keytbl
end
end
-- wrap the existing filter so it also enforces all has_same overlaps
local
prev
=
new_filter
new_filter
=
function
(
t
c
)
new_filter
=
function
(
m
c
)
-- original criteria
if
prev
and
not
prev
(
t
c
)
then
if
prev
and
not
prev
(
m
c
)
then
return
false
end
-- for each fn in has_same, check against the precomputed overlap
for
fn
,
overlap
in
pairs
(
used_overlap
)
do
local
v
=
fn
(
tc
)
local
v
=
fn
(
mc
,
handler
)
if
type
(
overlap
)
==
"number"
then
-- bitmask path
if
(
overlap
&
v
)
==
0
then
...
...
@@ -3974,6 +4029,7 @@ function Fusion.CanCompleteFromMappings(e,sel,eg,slots,handler,gc,chkf)
return
true
end
end
end
if
need
>
0
then
-- preserve the full group slot
table.insert
(
rem_slots
,{
...
...
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