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
02e33615
Commit
02e33615
authored
Jan 01, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Will load default deck
parent
8b2a3e39
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
42 deletions
+53
-42
2pick/pick.lua
2pick/pick.lua
+13
-26
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+3
-3
gframe/single_duel.cpp
gframe/single_duel.cpp
+16
-10
gframe/single_duel.h
gframe/single_duel.h
+1
-0
ocgcore/field.h
ocgcore/field.h
+1
-0
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+2
-1
ocgcore/libduel.cpp
ocgcore/libduel.cpp
+9
-0
ocgcore/ocgapi.cpp
ocgcore/ocgapi.cpp
+6
-1
ocgcore/ocgapi.h
ocgcore/ocgapi.h
+1
-1
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+1
-0
No files found.
2pick/pick.lua
View file @
02e33615
...
...
@@ -88,8 +88,8 @@ function Auxiliary.SaveDeck()
Duel
.
SavePickDeck
(
p
,
g
)
end
end
function
Auxiliary
.
SinglePick
(
p
,
list
,
count
)
if
not
Duel
.
IsPlayerNeedToPickDeck
(
p
)
then
return
end
local
g1
=
Group
.
CreateGroup
()
local
g2
=
Group
.
CreateGroup
()
for
_
,
g
in
ipairs
({
g1
,
g2
})
do
...
...
@@ -111,6 +111,7 @@ function Auxiliary.SinglePick(p,list,count)
end
function
Auxiliary
.
SinglePickForMain
(
p
,
list
,
count
)
if
not
Duel
.
IsPlayerNeedToPickDeck
(
p
)
then
return
end
local
g1
=
Group
.
CreateGroup
()
local
g2
=
Group
.
CreateGroup
()
for
_
,
g
in
ipairs
({
g1
,
g2
})
do
...
...
@@ -139,29 +140,13 @@ 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
)
if
g
:
GetCount
()
>=
80
then
--already picked
Auxiliary
.
SaveDeck
()
Duel
.
Draw
(
0
,
5
,
REASON_RULE
)
Duel
.
Draw
(
1
,
5
,
REASON_RULE
)
e
:
Reset
()
return
end
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
if i==9 then
list=semi_limited
elseif i==10 then
list=limited
count=3
elseif i==11 then
list=forbidden
count=1
end]]
local
list
=
main_monster
if
i
==
4
then
list
=
main_spell
...
...
@@ -170,7 +155,6 @@ function Auxiliary.StartPick(e)
end
for
p
=
0
,
1
do
Auxiliary
.
SinglePickForMain
(
p
,
list
,
4
)
--Auxiliary.SinglePick(p,main,4)
end
end
for
tp
,
list
in
pairs
(
extra_sp
)
do
...
...
@@ -180,14 +164,17 @@ function Auxiliary.StartPick(e)
end
end
end
for
i
=
1
,
1
do
for
i
=
1
,
2
do
for
p
=
0
,
1
do
Auxiliary
.
SinglePick
(
p
,
extra
,
4
)
end
end
Auxiliary
.
SaveDeck
()
Duel
.
ShuffleDeck
(
0
)
Duel
.
ShuffleDeck
(
1
)
for
p
=
0
,
1
do
if
Duel
.
IsPlayerNeedToPickDeck
(
p
)
then
Duel
.
ShuffleDeck
(
p
)
end
end
Duel
.
Draw
(
0
,
5
,
REASON_RULE
)
Duel
.
Draw
(
1
,
5
,
REASON_RULE
)
e
:
Reset
()
...
...
gframe/deck_manager.cpp
View file @
02e33615
...
...
@@ -110,11 +110,11 @@ int DeckManager::CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tc
if
(
!
list
)
return
0
;
int
dc
=
0
;
if
(
deck
.
main
.
size
()
>
1
)
if
(
deck
.
main
.
size
()
<
40
||
deck
.
main
.
size
()
>
60
)
return
(
DECKERROR_MAINCOUNT
<<
28
)
+
deck
.
main
.
size
();
if
(
deck
.
extra
.
size
()
>
0
)
if
(
deck
.
extra
.
size
()
>
15
)
return
(
DECKERROR_EXTRACOUNT
<<
28
)
+
deck
.
extra
.
size
();
if
(
deck
.
side
.
size
()
>
0
)
if
(
deck
.
side
.
size
()
>
15
)
return
(
DECKERROR_SIDECOUNT
<<
28
)
+
deck
.
side
.
size
();
for
(
size_t
i
=
0
;
i
<
deck
.
main
.
size
();
++
i
)
{
...
...
gframe/single_duel.cpp
View file @
02e33615
...
...
@@ -27,6 +27,10 @@ SingleDuel::SingleDuel(bool is_match) {
cache_recorder
=
0
;
replay_recorder
=
0
;
#endif
//2pick
int
cardlist
[
128
];
cardlist
[
0
]
=
89631139
;
deckManager
.
LoadDeck
(
default_deck
,
cardlist
,
1
,
0
);
}
SingleDuel
::~
SingleDuel
()
{
}
...
...
@@ -365,7 +369,7 @@ void SingleDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
return
;
if
(
is_ready
)
{
unsigned
int
deckerror
=
0
;
if
(
!
host_info
.
no_check_deck
)
{
/*
if(!host_info.no_check_deck) {
if(deck_error[dp->type]) {
deckerror = (DECKERROR_UNKNOWNCARD << 28) + deck_error[dp->type];
} else {
...
...
@@ -373,7 +377,7 @@ void SingleDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
bool allow_tcg = host_info.rule == 1 || host_info.rule == 2;
deckerror = deckManager.CheckDeck(pdeck[dp->type], host_info.lflist, allow_ocg, allow_tcg);
}
}
}
*/
if
(
deckerror
)
{
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
(
dp
->
type
<<
4
)
|
PLAYERCHANGE_NOTREADY
;
...
...
@@ -522,12 +526,12 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
swapped
=
true
;
}
//2pick deck check
if
(
pick_deck_saved
[
0
])
pdeck
[
0
]
=
pick_deck
[
0
];
if
(
pick_deck_saved
[
1
])
pdeck
[
1
]
=
pick_deck
[
1
];
pick_deck_saved
[
0
]
=
false
;
pick_deck_saved
[
1
]
=
false
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
if
(
pick_deck_saved
[
i
])
pdeck
[
i
]
=
pick_deck
[
i
];
else
pdeck
[
i
]
=
default_deck
;
}
dp
->
state
=
CTOS_RESPONSE
;
ReplayHeader
rh
;
rh
.
id
=
0x31707279
;
...
...
@@ -557,8 +561,10 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
set_message_handler
((
message_handler
)
SingleDuel
::
MessageHandler
);
rnd
.
reset
(
seed
);
pduel
=
create_duel
(
rnd
.
rand
());
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
,
!
pick_deck_saved
[
0
]);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
,
!
pick_deck_saved
[
1
]);
pick_deck_saved
[
0
]
=
false
;
pick_deck_saved
[
1
]
=
false
;
int
opt
=
(
int
)
host_info
.
duel_rule
<<
16
;
if
(
host_info
.
no_shuffle_deck
)
opt
|=
DUEL_PSEUDO_SHUFFLE
;
...
...
gframe/single_duel.h
View file @
02e33615
...
...
@@ -45,6 +45,7 @@ public:
protected:
//2pick
Deck
default_deck
;
Deck
pick_deck
[
2
];
bool
pick_deck_saved
[
2
];
...
...
ocgcore/field.h
View file @
02e33615
...
...
@@ -71,6 +71,7 @@ struct player_info {
int32
lp
;
int32
start_count
;
int32
draw_count
;
int32
pick_needed
;
uint32
used_location
;
uint32
disabled_location
;
uint32
extra_p_count
;
...
...
ocgcore/interpreter.cpp
View file @
02e33615
...
...
@@ -371,6 +371,7 @@ static const struct luaL_Reg grouplib[] = {
static
const
struct
luaL_Reg
duellib
[]
=
{
//2pick
{
"SavePickDeck"
,
scriptlib
::
duel_save_pick_deck
},
{
"IsPlayerNeedToPickDeck"
,
scriptlib
::
duel_is_player_need_to_pick_deck
},
//modded
{
"SelectField"
,
scriptlib
::
duel_select_field
},
{
"GetMasterRule"
,
scriptlib
::
duel_get_master_rule
},
...
...
ocgcore/libduel.cpp
View file @
02e33615
...
...
@@ -32,6 +32,15 @@ int32 scriptlib::duel_save_pick_deck(lua_State * L) {
}
return
0
;
}
int32
scriptlib
::
duel_is_player_need_to_pick_deck
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
p
=
lua_tonumberint
(
L
,
1
);
if
(
p
!=
0
&&
p
!=
1
)
luaL_error
(
L
,
"Parameter 1 should be 0 or 1."
,
2
);;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
player
[
p
].
pick_needed
);
return
1
;
}
//modded
int32
scriptlib
::
duel_select_field
(
lua_State
*
L
)
{
check_action_permission
(
L
);
...
...
ocgcore/ocgapi.cpp
View file @
02e33615
...
...
@@ -111,7 +111,7 @@ extern "C" DECL_DLLEXPORT void end_duel(ptr pduel) {
delete
pd
;
}
}
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
ptr
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
)
{
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
ptr
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
,
bool
pick_needed
)
{
duel
*
pd
=
(
duel
*
)
pduel
;
if
(
lp
>
0
)
pd
->
game_field
->
player
[
playerid
].
lp
=
lp
;
...
...
@@ -119,6 +119,11 @@ extern "C" DECL_DLLEXPORT void set_player_info(ptr pduel, int32 playerid, int32
pd
->
game_field
->
player
[
playerid
].
start_count
=
startcount
;
if
(
drawcount
>=
0
)
pd
->
game_field
->
player
[
playerid
].
draw_count
=
drawcount
;
//2pick
if
(
pick_needed
)
pd
->
game_field
->
player
[
playerid
].
pick_needed
=
TRUE
;
else
pd
->
game_field
->
player
[
playerid
].
pick_needed
=
FALSE
;
}
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
ptr
pduel
,
byte
*
buf
)
{
strcpy
((
char
*
)
buf
,
((
duel
*
)
pduel
)
->
strbuffer
);
...
...
ocgcore/ocgapi.h
View file @
02e33615
...
...
@@ -38,7 +38,7 @@ uint32 handle_message(void* pduel, uint32 message_type);
extern
"C"
DECL_DLLEXPORT
ptr
create_duel
(
uint32
seed
);
extern
"C"
DECL_DLLEXPORT
void
start_duel
(
ptr
pduel
,
int32
options
);
extern
"C"
DECL_DLLEXPORT
void
end_duel
(
ptr
pduel
);
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
ptr
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
);
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
ptr
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
,
bool
pick_needed
=
false
);
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
ptr
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
get_message
(
ptr
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
process
(
ptr
pduel
);
...
...
ocgcore/scriptlib.h
View file @
02e33615
...
...
@@ -18,6 +18,7 @@ public:
static
int32
check_action_permission
(
lua_State
*
L
);
//2pick
static
int32
duel_save_pick_deck
(
lua_State
*
L
);
static
int32
duel_is_player_need_to_pick_deck
(
lua_State
*
L
);
//millux
static
int32
card_is_ritual_type
(
lua_State
*
L
);
//modded
...
...
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