Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
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-2pick
Commits
26a441d1
Commit
26a441d1
authored
Dec 09, 2017
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp_pick
parent
e19cfbd4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
1 deletion
+134
-1
expansions/2pick.lua
expansions/2pick.lua
+130
-0
expansions/sqlite_cmd.txt
expansions/sqlite_cmd.txt
+3
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+1
-1
No files found.
expansions/2pick.lua
0 → 100644
View file @
26a441d1
os
=
require
(
"os"
)
io
=
require
(
"io"
)
--globals
local
main
=
{}
local
extra
=
{}
local
forbidden_check
=
{}
local
limited_check
=
{}
local
semi_limited_check
=
{}
local
forbidden
=
{}
local
limited
=
{}
local
semi_limited
=
{}
function
Auxiliary
.
LoadLFList
()
local
started
=
false
for
line
in
io.lines
(
"lflist.conf"
)
do
if
line
:
find
(
"!"
)
then
if
started
then
break
else
started
=
true
end
elseif
started
then
local
fstart
=
line
:
find
(
" 0"
)
local
lstart
=
line
:
find
(
" 1"
)
local
sstart
=
line
:
find
(
" 2"
)
if
fstart
then
local
code
=
tonumber
(
line
:
sub
(
1
,
fstart
-
1
))
if
code
then
forbidden_check
[
code
]
=
true
end
elseif
lstart
then
local
code
=
tonumber
(
line
:
sub
(
1
,
lstart
-
1
))
if
code
then
limited_check
[
code
]
=
true
end
elseif
sstart
then
local
code
=
tonumber
(
line
:
sub
(
1
,
sstart
-
1
))
if
code
then
semi_limited_check
[
code
]
=
true
end
end
end
end
end
function
Auxiliary
.
LoadDB
()
os.execute
(
"sqlite3 cards.cdb < expansions/sqlite_cmd.txt"
)
for
line
in
io.lines
(
"card_list.txt"
)
do
local
col
=
line
:
find
(
"|"
)
local
code
=
tonumber
(
line
:
sub
(
1
,
col
-
1
))
local
cat
=
tonumber
(
line
:
sub
(
col
+
1
,
#
line
))
if
(
cat
&
TYPE_FUSION
+
TYPE_SYNCHRO
+
TYPE_XYZ
+
TYPE_LINK
)
>
0
then
table.insert
(
extra
,
code
)
else
table.insert
(
main
,
code
)
if
forbidden_check
[
code
]
then
table.insert
(
forbidden
,
code
)
elseif
limited_check
[
code
]
then
table.insert
(
limited
,
code
)
elseif
semi_limited_check
[
code
]
then
table.insert
(
semi_limited
,
code
)
end
end
end
end
function
Auxiliary
.
SinglePick
(
p
,
list
)
local
g1
=
Group
.
CreateGroup
()
local
g2
=
Group
.
CreateGroup
()
for
_
,
g
in
ipairs
({
g1
,
g2
})
do
for
i
=
1
,
2
do
local
code
=
list
[
math.random
()]
g
:
AddCard
(
Duel
.
CreateToken
(
p
,
code
))
end
Duel
.
Remove
(
g
,
POS_FACEDOWN
,
REASON_RULE
)
end
local
sg
=
g1
:
Clone
()
sg
:
Merge
(
g2
)
local
sc
=
sg
:
Select
(
p
,
1
,
1
,
nil
):
GetFirst
()
local
tg
=
g1
:
IsContains
(
sc
)
and
g1
or
g2
local
rg
=
g1
:
IsContains
(
sc
)
and
g2
or
g1
Duel
.
SendtoDeck
(
tg
,
p
,
0
,
REASON_RULE
)
Duel
.
Exile
(
rg
,
REASON_RULE
)
end
function
Auxiliary
.
StartPick
(
e
)
math.randomseed
(
os.time
())
local
g
=
Duel
.
GetFieldGroup
(
0
,
LOCATION_HAND
|
LOCATION_DECK
|
LOCATION_EXTRA
,
LOCATION_HAND
|
LOCATION_DECK
|
LOCATION_EXTRA
)
Duel
.
Exile
(
g
,
REASON_RULE
)
local
pick_count
=
1
for
i
=
1
,
10
do
local
list
=
main
if
i
==
7
then
list
=
semi_limited
elseif
i
==
8
or
i
==
9
then
list
=
limited
elseif
i
==
10
then
list
=
forbidded
for
p
=
0
,
1
do
Auxiliary
.
SinglePick
(
p
,
list
)
end
end
for
i
=
1
,
5
do
for
p
=
0
,
1
do
Auxiliary
.
SinglePick
(
p
,
extra
)
end
end
Duel
.
Draw
(
0
,
5
,
REASON_RULE
)
Duel
.
Draw
(
1
,
5
,
REASON_RULE
)
e
:
Reset
()
end
function
Auxiliary
.
Load2PickRule
()
Card
.
IsSetCard
=
Auxiliary
.
TRUE
Card
.
IsOriginalSetCard
=
Auxiliary
.
TRUE
Auxiliary
.
LoadLFList
()
Auxiliary
.
LoadDB
()
local
e1
=
Effect
.
GlobalEffect
()
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetCode
(
EFFECT_ADD_RACE
)
e1
:
SetProperty
(
EFFECT_FLAG_IGNORE_RANGE
|
EFFECT_FLAG_IGNORE_IMMUNE
|
EFFECT_FLAG_SET_AVAILABLE
)
e1
:
SetTargetRange
(
0xff
,
0xff
)
e1
:
SetValue
(
RACE_ALL
)
Duel
.
RegisterEffect
(
e1
,
0
)
local
e1
=
Effect
.
GlobalEffect
()
e1
:
SetType
(
EFFECT_TYPE_FIELD
)
e1
:
SetCode
(
EFFECT_ADD_ATTRIBUTE
)
e1
:
SetProperty
(
EFFECT_FLAG_IGNORE_RANGE
|
EFFECT_FLAG_IGNORE_IMMUNE
|
EFFECT_FLAG_SET_AVAILABLE
)
e1
:
SetTargetRange
(
0xff
,
0xff
)
e1
:
SetValue
(
ATTRIBUTE_ALL
)
Duel
.
RegisterEffect
(
e1
,
0
)
local
e1
=
Effect
.
GlobalEffect
()
e1
:
SetType
(
EFFECT_TYPE_FIELD
|
EFFECT_TYPE_CONTINUOUS
)
e1
:
SetCode
(
EVENT_ADJUST
)
e1
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
)
e1
:
SetOperation
(
Auxiliary
.
StartPick
)
Duel
.
RegisterEffect
(
e1
,
0
)
end
expansions/sqlite_cmd.txt
0 → 100644
View file @
26a441d1
.output card_list.txt
select id,type from datas;
.output stdout
gframe/deck_manager.cpp
View file @
26a441d1
...
@@ -74,7 +74,7 @@ int DeckManager::CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tc
...
@@ -74,7 +74,7 @@ int DeckManager::CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tc
if
(
!
list
)
if
(
!
list
)
return
0
;
return
0
;
int
dc
=
0
;
int
dc
=
0
;
if
(
deck
.
main
.
size
()
>
0
)
if
(
deck
.
main
.
size
()
>
1
)
return
(
DECKERROR_MAINCOUNT
<<
28
)
+
deck
.
main
.
size
();
return
(
DECKERROR_MAINCOUNT
<<
28
)
+
deck
.
main
.
size
();
if
(
deck
.
extra
.
size
()
>
0
)
if
(
deck
.
extra
.
size
()
>
0
)
return
(
DECKERROR_EXTRACOUNT
<<
28
)
+
deck
.
extra
.
size
();
return
(
DECKERROR_EXTRACOUNT
<<
28
)
+
deck
.
extra
.
size
();
...
...
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