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
09df6880
You need to sign in or sign up before continuing.
Commit
09df6880
authored
Apr 07, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
datas
parent
2791e83a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
265 additions
and
2 deletions
+265
-2
.gitmodules
.gitmodules
+1
-1
2pick/2Pick_Merge.1.2.8.cdb
2pick/2Pick_Merge.1.2.8.cdb
+0
-0
2pick/pick.lua
2pick/pick.lua
+263
-0
ocgcore
ocgcore
+1
-1
No files found.
.gitmodules
View file @
09df6880
[submodule "ocgcore"]
[submodule "ocgcore"]
path = ocgcore
path = ocgcore
url = https://github.com/
purerosefallen
/ygopro-core.git
url = https://github.com/
moecube
/ygopro-core.git
[submodule "script"]
[submodule "script"]
path = script
path = script
url = https://github.com/Smile-DK/ygopro-scripts.git
url = https://github.com/Smile-DK/ygopro-scripts.git
2pick/2Pick_Merge.1.2.8.cdb
0 → 100644
View file @
09df6880
File added
2pick/pick.lua
0 → 100644
View file @
09df6880
os
=
require
(
"os"
)
io
=
require
(
"io"
)
--globals
local
main
=
{[
0
]
=
{},[
1
]
=
{}}
local
extra
=
{[
0
]
=
{},[
1
]
=
{}}
local
main_nonadv
=
{[
0
]
=
{},[
1
]
=
{}}
local
main_monster
=
{[
0
]
=
{},[
1
]
=
{}}
local
main_spell
=
{[
0
]
=
{},[
1
]
=
{}}
local
main_trap
=
{[
0
]
=
{},[
1
]
=
{}}
local
main_plain
=
{[
0
]
=
{},[
1
]
=
{}}
local
main_adv
=
{[
0
]
=
{},[
1
]
=
{}}
local
main_new
=
{[
0
]
=
{},[
1
]
=
{}}
local
extra_sp
=
{
[
TYPE_FUSION
]
=
{[
0
]
=
{},[
1
]
=
{}},
[
TYPE_SYNCHRO
]
=
{[
0
]
=
{},[
1
]
=
{}},
[
TYPE_XYZ
]
=
{[
0
]
=
{},[
1
]
=
{}},
[
TYPE_LINK
]
=
{[
0
]
=
{},[
1
]
=
{}},
}
local
xyz_plain
=
{[
0
]
=
{},[
1
]
=
{}}
local
xyz_adv
=
{[
0
]
=
{},[
1
]
=
{}}
local
extra_fixed
=
{
62709239
,
95169481
}
local
special_hanoi_force
=
{[
0
]
=
{
44095762
,
35595518
},[
1
]
=
{
44095762
,
35595518
}}
function
Auxiliary
.
SplitData
(
inputstr
)
local
t
=
{}
for
str
in
string.gmatch
(
inputstr
,
"([^|]+)"
)
do
table.insert
(
t
,
tonumber
(
str
))
end
return
t
end
function
Auxiliary
.
LoadDB
(
p
,
pool
)
local
file
=
nil
if
_WIN32
then
file
=
io.popen
(
"bash echo \"
select
*
from
datas
;
\
" | sqlite3 "
..
pool
)
else
file
=
io.popen
(
"echo \"
select
*
from
datas
;
\
" | sqlite3 "
..
pool
)
end
for
line
in
file
:
lines
()
do
local
data
=
Auxiliary
.
SplitData
(
line
)
local
code
=
data
[
1
]
local
ot
=
data
[
2
]
local
cat
=
data
[
5
]
local
lv
=
data
[
8
]
&
0xff
if
(
cat
&
TYPE_FUSION
+
TYPE_SYNCHRO
+
TYPE_XYZ
+
TYPE_LINK
)
>
0
then
table.insert
(
extra
[
p
],
code
)
for
tp
,
list
in
pairs
(
extra_sp
)
do
if
(
cat
&
tp
)
>
0
then
table.insert
(
list
[
p
],
code
)
end
end
if
(
cat
&
TYPE_XYZ
)
>
0
then
if
lv
>
4
then
table.insert
(
xyz_adv
[
p
],
code
)
else
table.insert
(
xyz_plain
[
p
],
code
)
end
end
elseif
(
cat
&
TYPE_TOKEN
)
==
0
then
if
(
ot
==
4
)
then
table.insert
(
main_new
[
p
],
code
)
end
if
(
cat
&
TYPE_MONSTER
)
>
0
then
table.insert
(
main_monster
[
p
],
code
)
if
lv
>
4
then
table.insert
(
main_adv
[
p
],
code
)
else
table.insert
(
main_plain
[
p
],
code
)
table.insert
(
main_nonadv
[
p
],
code
)
end
elseif
(
cat
&
TYPE_SPELL
)
>
0
then
table.insert
(
main_nonadv
[
p
],
code
)
table.insert
(
main_spell
[
p
],
code
)
elseif
(
cat
&
TYPE_TRAP
)
>
0
then
table.insert
(
main_nonadv
[
p
],
code
)
table.insert
(
main_trap
[
p
],
code
)
end
table.insert
(
main
[
p
],
code
)
end
end
file
:
close
()
end
--to do: multi card pools
function
Auxiliary
.
LoadCardPools
()
local
pool_list
=
{}
local
file
=
io.popen
(
"ls 2pick/*.cdb"
)
for
pool
in
file
:
lines
()
do
table.insert
(
pool_list
,
pool
)
end
file
:
close
()
for
p
=
0
,
1
do
Auxiliary
.
LoadDB
(
p
,
pool_list
[
math.random
(
#
pool_list
)])
end
end
function
Auxiliary
.
SaveDeck
()
for
p
=
0
,
1
do
local
g
=
Duel
.
GetFieldGroup
(
p
,
0xff
,
0
)
Duel
.
SavePickDeck
(
p
,
g
)
end
end
function
Auxiliary
.
SinglePick
(
p
,
list
,
count
,
ex_list
,
ex_count
,
copy
,
lv_diff
,
fixed
)
if
not
Duel
.
IsPlayerNeedToPickDeck
(
p
)
then
return
end
local
g1
=
Group
.
CreateGroup
()
local
g2
=
Group
.
CreateGroup
()
local
ag
=
Group
.
CreateGroup
()
local
plist
=
list
[
p
]
for
_
,
g
in
ipairs
({
g1
,
g2
})
do
--for i=1,count do
-- local code=plist[math.random(#plist)]
-- g:AddCard(Duel.CreateToken(p,code))
--end
local
pick_count
=
0
while
pick_count
<
count
do
local
code
=
plist
[
math.random
(
#
plist
)]
local
lv
=
Duel
.
ReadCard
(
code
,
CARDDATA_LEVEL
)
if
not
ag
:
IsExists
(
Card
.
IsCode
,
1
,
nil
,
code
)
and
not
(
lv_diff
and
g
:
IsExists
(
Card
.
IsLevel
,
1
,
nil
,
lv
))
then
local
card
=
Duel
.
CreateToken
(
p
,
code
)
g
:
AddCard
(
card
)
ag
:
AddCard
(
card
)
pick_count
=
pick_count
+
1
end
end
if
ex_list
and
ex_count
then
--for i=1,ex_count do
-- local code=ex_plist[math.random(#ex_plist)]
-- g:AddCard(Duel.CreateToken(p,code))
--end
local
ex_plist
=
ex_list
[
p
]
local
ex_pick_count
=
0
while
ex_pick_count
<
ex_count
do
local
code
=
ex_plist
[
math.random
(
#
ex_plist
)]
local
lv
=
Duel
.
ReadCard
(
code
,
CARDDATA_LEVEL
)
if
not
ag
:
IsExists
(
Card
.
IsCode
,
1
,
nil
,
code
)
and
not
(
lv_diff
and
g
:
IsExists
(
Card
.
IsLevel
,
1
,
nil
,
lv
))
then
local
card
=
Duel
.
CreateToken
(
p
,
code
)
g
:
AddCard
(
card
)
ag
:
AddCard
(
card
)
ex_pick_count
=
ex_pick_count
+
1
end
end
end
if
fixed
then
for
_
,
code
in
ipairs
(
fixed
)
do
local
card
=
Duel
.
CreateToken
(
p
,
code
)
g
:
AddCard
(
card
)
end
end
Duel
.
SendtoDeck
(
g
,
nil
,
0
,
REASON_RULE
)
end
local
sg
=
g1
:
Clone
()
sg
:
Merge
(
g2
)
Duel
.
ResetTimeLimit
(
p
,
70
)
Duel
.
Hint
(
HINT_SELECTMSG
,
p
,
HINTMSG_TODECK
)
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
if
sc
:
IsLocation
(
LOCATION_DECK
)
then
Duel
.
ConfirmCards
(
p
,
tg
)
end
Duel
.
Exile
(
rg
,
REASON_RULE
)
if
copy
then
local
g3
=
Group
.
CreateGroup
()
for
nc
in
aux
.
Next
(
tg
)
do
local
copy_code
=
nc
:
GetOriginalCode
()
g3
:
AddCard
(
Duel
.
CreateToken
(
p
,
copy_code
))
end
Duel
.
SendtoDeck
(
g3
,
nil
,
0
,
REASON_RULE
)
end
end
function
Auxiliary
.
StartPick
(
e
)
for
p
=
0
,
1
do
if
Duel
.
IsPlayerNeedToPickDeck
(
p
)
then
local
g
=
Duel
.
GetFieldGroup
(
p
,
0xff
,
0
)
Duel
.
Exile
(
g
,
REASON_RULE
)
end
end
for
i
=
1
,
5
do
local
list
=
main
local
count
=
4
local
ex_list
=
nil
local
ex_count
=
nil
if
i
==
1
then
list
=
main_nonadv
count
=
2
ex_list
=
main_plain
ex_count
=
2
elseif
i
<
4
then
list
=
main_plain
count
=
3
ex_list
=
main_adv
ex_count
=
1
elseif
i
==
4
then
list
=
main_spell
elseif
i
==
5
then
list
=
main_trap
end
for
p
=
0
,
1
do
Auxiliary
.
SinglePick
(
p
,
list
,
count
,
ex_list
,
ex_count
,
true
)
end
end
--for p=0,1 do
-- if Duel.IsPlayerNeedToPickDeck(p) then
-- Duel.ResetTimeLimit(p,70)
-- local cg=Duel.GetFieldGroup(p,LOCATION_DECK,0)
-- Duel.ConfirmCards(p,cg)
-- end
--end
for
tp
,
list
in
pairs
(
extra_sp
)
do
if
tp
~=
TYPE_FUSION
then
for
p
=
0
,
1
do
if
tp
==
TYPE_XYZ
then
Auxiliary
.
SinglePick
(
p
,
xyz_plain
,
3
,
xyz_adv
,
1
,
false
)
else
local
lv_diff
=
(
tp
==
TYPE_SYNCHRO
)
Auxiliary
.
SinglePick
(
p
,
list
,
4
,
nil
,
nil
,
false
,
lv_diff
)
end
end
end
end
for
i
=
1
,
2
do
for
p
=
0
,
1
do
if
i
==
1
then
Auxiliary
.
SinglePick
(
p
,
extra
,
4
,
nil
,
nil
,
false
)
else
Auxiliary
.
SinglePick
(
p
,
extra
,
2
,
nil
,
nil
,
false
,
false
,
extra_fixed
)
end
end
end
for
p
=
0
,
1
do
Auxiliary
.
SinglePick
(
p
,
special_hanoi_force
,
1
,
nil
,
nil
,
true
)
end
Auxiliary
.
SaveDeck
()
for
p
=
0
,
1
do
if
Duel
.
IsPlayerNeedToPickDeck
(
p
)
then
Duel
.
ShuffleDeck
(
p
)
Duel
.
ResetTimeLimit
(
p
)
end
end
for
p
=
0
,
1
do
Duel
.
Draw
(
p
,
Duel
.
GetStartCount
(
p
),
REASON_RULE
)
end
e
:
Reset
()
end
function
Auxiliary
.
Load2PickRule
()
math.randomseed
(
os.time
())
Auxiliary
.
LoadCardPools
()
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
ocgcore
@
4e8b00aa
Subproject commit
c544bb506d96e83a5a7274c244a5cd90f5c1edba
Subproject commit
4e8b00aa667e5759dc018f2cd108eeace99a2f99
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