Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
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
nanahira
ygopro
Commits
cb12d793
Commit
cb12d793
authored
Jun 12, 2012
by
argon.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
puz
parent
82c273f8
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
396 additions
and
115 deletions
+396
-115
gframe/client_card.cpp
gframe/client_card.cpp
+38
-0
gframe/client_field.cpp
gframe/client_field.cpp
+5
-1
gframe/client_field.h
gframe/client_field.h
+1
-1
gframe/duelclient.cpp
gframe/duelclient.cpp
+29
-25
gframe/event_handler.cpp
gframe/event_handler.cpp
+3
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+209
-56
gframe/single_mode.h
gframe/single_mode.h
+2
-0
ocgcore/card.cpp
ocgcore/card.cpp
+6
-2
ocgcore/duel.cpp
ocgcore/duel.cpp
+3
-4
ocgcore/field.cpp
ocgcore/field.cpp
+1
-0
ocgcore/field.h
ocgcore/field.h
+2
-0
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+5
-3
ocgcore/libdebug.cpp
ocgcore/libdebug.cpp
+39
-10
ocgcore/ocgapi.cpp
ocgcore/ocgapi.cpp
+7
-3
ocgcore/playerop.cpp
ocgcore/playerop.cpp
+11
-3
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+2
-1
script/c70284332.lua
script/c70284332.lua
+3
-2
script/c87902575.lua
script/c87902575.lua
+7
-4
script/utility.lua
script/utility.lua
+23
-0
No files found.
gframe/client_card.cpp
View file @
cb12d793
#include "client_card.h"
#include "client_field.h"
#include "game.h"
namespace
ygo
{
...
...
@@ -102,6 +103,43 @@ void ClientCard::UpdateInfo(char* buf) {
base_defence
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_REASON
)
reason
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_EQUIP_CARD
)
{
int
c
=
BufferIO
::
ReadInt8
(
buf
);
int
l
=
BufferIO
::
ReadInt8
(
buf
);
int
s
=
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
ClientCard
*
ecard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
equipTarget
=
ecard
;
ecard
->
equipped
.
insert
(
this
);
}
if
(
flag
&
QUERY_TARGET_CARD
)
{
int
count
=
BufferIO
::
ReadInt8
(
buf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
c
=
BufferIO
::
ReadInt8
(
buf
);
int
l
=
BufferIO
::
ReadInt8
(
buf
);
int
s
=
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
ClientCard
*
tcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
cardTarget
.
insert
(
tcard
);
tcard
->
ownerTarget
.
insert
(
this
);
}
}
if
(
flag
&
QUERY_OVERLAY_CARD
)
{
int
count
=
BufferIO
::
ReadInt8
(
buf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
overlayed
[
i
]
->
SetCode
(
BufferIO
::
ReadInt32
(
buf
));
}
}
if
(
flag
&
QUERY_COUNTERS
)
{
int
count
=
BufferIO
::
ReadInt8
(
buf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
ctype
=
BufferIO
::
ReadInt16
(
buf
);
int
ccount
=
BufferIO
::
ReadInt16
(
buf
);
counters
[
ctype
]
=
ccount
;
}
}
if
(
flag
&
QUERY_OWNER
)
owner
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_IS_DISABLED
)
is_disabled
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_IS_PUBLIC
)
...
...
gframe/client_field.cpp
View file @
cb12d793
...
...
@@ -558,7 +558,7 @@ void ClientField::GetChainLocation(int controler, int location, int sequence, ir
}
}
}
void
ClientField
::
GetCardLocation
(
ClientCard
*
pcard
,
irr
::
core
::
vector3df
*
t
,
irr
::
core
::
vector3df
*
r
)
{
void
ClientField
::
GetCardLocation
(
ClientCard
*
pcard
,
irr
::
core
::
vector3df
*
t
,
irr
::
core
::
vector3df
*
r
,
bool
setTrans
)
{
int
controler
=
pcard
->
controler
;
int
sequence
=
pcard
->
sequence
;
int
location
=
pcard
->
location
;
...
...
@@ -802,6 +802,10 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
break
;
}
}
if
(
setTrans
)
{
pcard
->
mTransform
.
setTranslation
(
*
t
);
pcard
->
mTransform
.
setRotationRadians
(
*
r
);
}
}
void
ClientField
::
MoveCard
(
ClientCard
*
pcard
,
int
frame
)
{
irr
::
core
::
vector3df
trans
=
pcard
->
curPos
;
...
...
gframe/client_field.h
View file @
cb12d793
...
...
@@ -84,7 +84,7 @@ public:
void
ReplaySwap
();
void
GetChainLocation
(
int
controler
,
int
location
,
int
sequence
,
irr
::
core
::
vector3df
*
t
);
void
GetCardLocation
(
ClientCard
*
pcard
,
irr
::
core
::
vector3df
*
t
,
irr
::
core
::
vector3df
*
r
);
void
GetCardLocation
(
ClientCard
*
pcard
,
irr
::
core
::
vector3df
*
t
,
irr
::
core
::
vector3df
*
r
,
bool
setTrans
=
false
);
void
MoveCard
(
ClientCard
*
pcard
,
int
frame
);
void
FadeCard
(
ClientCard
*
pcard
,
int
alpha
,
int
frame
);
bool
CheckSelectSum
();
...
...
gframe/duelclient.cpp
View file @
cb12d793
...
...
@@ -2,6 +2,7 @@
#include "client_card.h"
#include "materials.h"
#include "image_manager.h"
#include "single_mode.h"
#include "../ocgcore/field.h"
#include "../ocgcore/duel.h"
#include "game.h"
...
...
@@ -938,7 +939,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnEP
->
setPressed
(
false
);
}
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_IDLECMD
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1037,7 +1038,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnEP
->
setEnabled
(
true
);
mainGame
->
btnEP
->
setPressed
(
false
);
}
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_EFFECTYN
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1054,7 +1055,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_YESNO
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1063,7 +1064,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
desc
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_OPTION
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1086,7 +1087,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_CARD
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1134,7 +1135,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
}
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_CHAIN
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1192,7 +1193,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
}
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_DISFIELD
:
{
...
...
@@ -1236,7 +1237,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
DuelClient
::
SendResponse
();
return
true
;
}
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_POSITION
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1279,7 +1280,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
PopupElement
(
mainGame
->
wPosSelect
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_TRIBUTE
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1308,7 +1309,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
531
));
mainGame
->
stHintMsg
->
setVisible
(
false
);
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_COUNTER
:
{
int
selecting_player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1334,7 +1335,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_SELECT_SUM
:
{
mainGame
->
dField
.
select_mode
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1376,7 +1377,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
}
return
tru
e
;
return
fals
e
;
}
case
MSG_SORT_CARD
:
case
MSG_SORT_CHAIN
:
{
...
...
@@ -2532,7 +2533,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
wANRace
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANRace
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_ANNOUNCE_ATTRIB
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
...
...
@@ -2552,7 +2553,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
wANAttribute
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANAttribute
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_ANNOUNCE_CARD
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
...
...
@@ -2565,7 +2566,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_ANNOUNCE_NUMBER
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
...
...
@@ -2585,7 +2586,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
wANNumber
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANNumber
);
mainGame
->
gMutex
.
Unlock
();
return
tru
e
;
return
fals
e
;
}
case
MSG_CARD_HINT
:
{
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
...
...
@@ -2724,13 +2725,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
Clear
();
int
val
=
0
;
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
mainGame
->
dInfo
.
lp
[
p
]
=
BufferIO
::
ReadInt32
(
pbuf
);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
p
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
p
]);
for
(
int
seq
=
0
;
seq
<
5
;
++
seq
)
{
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_MZONE
,
0
);
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_MZONE
,
seq
);
ccard
->
position
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
,
true
);
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
{
for
(
int
xyz
=
0
;
xyz
<
val
;
++
xyz
)
{
...
...
@@ -2741,7 +2744,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
xcard
->
overlayTarget
=
ccard
;
xcard
->
location
=
0x80
;
xcard
->
sequence
=
ccard
->
overlayed
.
size
()
-
1
;
mainGame
->
dField
.
GetCardLocation
(
xcard
,
&
xcard
->
curPos
,
&
xcard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
xcard
,
&
xcard
->
curPos
,
&
xcard
->
curRot
,
true
);
}
}
}
...
...
@@ -2752,38 +2755,38 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_SZONE
,
seq
);
ccard
->
position
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
,
true
);
}
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_DECK
,
seq
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
,
true
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_HAND
,
seq
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
,
true
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_EXTRA
,
seq
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
,
true
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_GRAVE
,
seq
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
,
true
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_REMOVED
,
seq
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
);
mainGame
->
dField
.
GetCardLocation
(
ccard
,
&
ccard
->
curPos
,
&
ccard
->
curRot
,
true
);
}
}
mainGame
->
gMutex
.
Unlock
();
...
...
@@ -2839,6 +2842,7 @@ void DuelClient::SendResponse() {
}
}
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
SingleMode
::
SetResponse
(
response_buf
);
mainGame
->
singleSignal
.
Set
();
}
else
{
mainGame
->
dInfo
.
time_player
=
2
;
...
...
gframe/event_handler.cpp
View file @
cb12d793
...
...
@@ -93,6 +93,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LEAVE_GAME
:
{
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
break
;
}
if
(
mainGame
->
dInfo
.
player_type
==
7
)
{
DuelClient
::
StopClient
();
mainGame
->
CloseDuelWindow
();
...
...
gframe/single_mode.cpp
View file @
cb12d793
This diff is collapsed.
Click to expand it.
gframe/single_mode.h
View file @
cb12d793
...
...
@@ -17,6 +17,7 @@ private:
public:
static
bool
StartPlay
();
static
void
StopPlay
(
bool
is_exiting
=
false
);
static
void
SetResponse
(
unsigned
char
*
resp
);
static
int
SinglePlayThread
(
void
*
param
);
static
bool
SinglePlayAnalyze
(
char
*
msg
,
unsigned
int
len
);
...
...
@@ -26,6 +27,7 @@ public:
static
void
SinglePlayRefreshDeck
(
int
player
,
int
flag
=
0x181fff
);
static
void
SinglePlayRefreshExtra
(
int
player
,
int
flag
=
0x181fff
);
static
void
SinglePlayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0x181fff
);
static
void
SinglePlayReload
();
static
int
MessageHandler
(
long
fduel
,
int
type
);
};
...
...
ocgcore/card.cpp
View file @
cb12d793
...
...
@@ -138,8 +138,12 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
}
if
(
query_flag
&
QUERY_REASON_CARD
)
*
p
++
=
current
.
reason_card
?
current
.
reason_card
->
get_info_location
()
:
0
;
if
(
query_flag
&
QUERY_EQUIP_CARD
)
*
p
++
=
equiping_target
?
equiping_target
->
get_info_location
()
:
0
;
if
(
query_flag
&
QUERY_EQUIP_CARD
)
{
if
(
equiping_target
)
*
p
++
=
equiping_target
->
get_info_location
();
else
query_flag
&=
~
QUERY_EQUIP_CARD
;
}
if
(
query_flag
&
QUERY_TARGET_CARD
)
{
*
p
++
=
effect_target_cards
.
size
();
card_set
::
iterator
cit
;
...
...
ocgcore/duel.cpp
View file @
cb12d793
...
...
@@ -38,13 +38,12 @@ void duel::clear() {
delete
*
git
;
for
(
std
::
set
<
effect
*>::
iterator
eit
=
effects
.
begin
();
eit
!=
effects
.
end
();
++
eit
)
delete
*
eit
;
delete
lua
;
delete
game_field
;
lua
=
new
interpreter
(
this
);
cards
.
clear
();
groups
.
clear
();
effects
.
clear
();
game_field
=
new
field
(
this
);
game_field
->
temp_card
=
new_card
(
0
);
bufferlen
=
0
;
bufferp
=
buffer
;
}
card
*
duel
::
new_card
(
uint32
code
)
{
card
*
pcard
=
new
card
();
...
...
ocgcore/field.cpp
View file @
cb12d793
...
...
@@ -88,6 +88,7 @@ void field::reload_field_info() {
pduel
->
write_buffer8
(
MSG_RELOAD_FIELD
);
card
*
pcard
;
for
(
int
playerid
=
0
;
playerid
<
2
;
++
playerid
)
{
pduel
->
write_buffer32
(
player
[
playerid
].
lp
);
for
(
uint32
i
=
0
;
i
<
5
;
++
i
)
{
pcard
=
player
[
playerid
].
list_mzone
[
i
];
if
(
pcard
)
{
...
...
ocgcore/field.h
View file @
cb12d793
...
...
@@ -730,4 +730,6 @@ public:
#define MSG_CARD_HINT 160
#define MSG_TAG_SWAP 161
#define MSG_RELOAD_FIELD 162
#define MSG_AI_NAME 163
#define MSG_SHOW_HINT 164
#endif
/* FIELD_H_ */
ocgcore/interpreter.cpp
View file @
cb12d793
...
...
@@ -464,6 +464,8 @@ static const struct luaL_Reg debuglib[] = {
{
"SetPlayerInfo"
,
scriptlib
::
debug_set_player_info
},
{
"ReloadFieldBegin"
,
scriptlib
::
debug_reload_field_begin
},
{
"ReloadFieldEnd"
,
scriptlib
::
debug_reload_field_end
},
{
"SetAIName"
,
scriptlib
::
debug_set_ai_name
},
{
"ShowHint"
,
scriptlib
::
debug_show_hint
},
{
NULL
,
NULL
}
};
...
...
@@ -505,8 +507,8 @@ interpreter::interpreter(duel* pd): coroutines(256) {
luaL_newlib
(
lua_state
,
debuglib
);
lua_setglobal
(
lua_state
,
"Debug"
);
//extra scripts
load_script
((
char
*
)
"constant.lua"
);
load_script
((
char
*
)
"utility.lua"
);
load_script
((
char
*
)
"
./script/
constant.lua"
);
load_script
((
char
*
)
"
./script/
utility.lua"
);
}
interpreter
::~
interpreter
()
{
lua_close
(
lua_state
);
...
...
@@ -617,7 +619,7 @@ int32 interpreter::load_card_script(uint32 code) {
lua_pushvalue
(
current_state
,
-
2
);
lua_rawset
(
current_state
,
-
3
);
//load extra scripts
sprintf
(
script_name
,
"c%d.lua"
,
code
);
sprintf
(
script_name
,
"
./script/
c%d.lua"
,
code
);
if
(
!
load_script
(
script_name
))
{
return
OPERATION_FAIL
;
}
...
...
ocgcore/libdebug.cpp
View file @
cb12d793
...
...
@@ -67,27 +67,56 @@ int32 scriptlib::debug_set_player_info(lua_State *L) {
uint32
lp
=
lua_tointeger
(
L
,
2
);
uint32
startcount
=
lua_tointeger
(
L
,
3
);
uint32
drawcount
=
lua_tointeger
(
L
,
4
);
duel
*
pd
=
(
duel
*
)
pduel
;
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
pd
->
game_field
->
player
[
playerid
].
lp
=
lp
;
pd
->
game_field
->
player
[
playerid
].
start_count
=
startcount
;
pd
->
game_field
->
player
[
playerid
].
draw_count
=
drawcount
;
pd
uel
->
game_field
->
player
[
playerid
].
lp
=
lp
;
pd
uel
->
game_field
->
player
[
playerid
].
start_count
=
startcount
;
pd
uel
->
game_field
->
player
[
playerid
].
draw_count
=
drawcount
;
return
0
;
}
int32
scriptlib
::
debug_
set_duel_info
(
lua_State
*
L
)
{
int32
scriptlib
::
debug_
reload_field_begin
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint32
flag
=
lua_tointeger
(
L
,
1
);
pduel
->
game_field
->
core
.
duel_options
=
flag
;
return
0
;
}
int32
scriptlib
::
debug_reload_field_begin
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
clear
();
pduel
->
game_field
->
core
.
duel_options
=
flag
;
}
int32
scriptlib
::
debug_reload_field_end
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
shuffle_hand_check
[
0
]
=
FALSE
;
pduel
->
game_field
->
core
.
shuffle_hand_check
[
1
]
=
FALSE
;
pduel
->
game_field
->
core
.
shuffle_deck_check
[
0
]
=
FALSE
;
pduel
->
game_field
->
core
.
shuffle_deck_check
[
1
]
=
FALSE
;
pduel
->
game_field
->
reload_field_info
();
return
0
;
}
int32
scriptlib
::
debug_set_ai_name
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_STRING
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
write_buffer8
(
MSG_AI_NAME
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
int
len
=
strlen
(
pstr
);
if
(
len
>
100
)
len
=
100
;
pduel
->
write_buffer16
(
len
);
memcpy
(
pduel
->
bufferp
,
pstr
,
len
);
pduel
->
bufferp
+=
len
;
pduel
->
bufferlen
+=
len
;
pduel
->
write_buffer8
(
0
);
}
int32
scriptlib
::
debug_show_hint
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_STRING
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
write_buffer8
(
MSG_SHOW_HINT
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
int
len
=
strlen
(
pstr
);
if
(
len
>
1024
)
len
=
1024
;
pduel
->
write_buffer16
(
len
);
memcpy
(
pduel
->
bufferp
,
pstr
,
len
);
pduel
->
bufferp
+=
len
;
pduel
->
bufferlen
+=
len
;
pduel
->
write_buffer8
(
0
);
}
ocgcore/ocgapi.cpp
View file @
cb12d793
...
...
@@ -40,10 +40,8 @@ uint32 handle_message(void* pduel, uint32 msg_type) {
return
mhandler
(
pduel
,
msg_type
);
}
byte
*
default_script_reader
(
const
char
*
script_name
,
int
*
slen
)
{
char
fullname
[
50
];
sprintf
(
fullname
,
"./script/%s"
,
script_name
);
FILE
*
fp
;
fp
=
fopen
(
full
name
,
"rb"
);
fp
=
fopen
(
script_
name
,
"rb"
);
if
(
!
fp
)
return
0
;
fseek
(
fp
,
0
,
SEEK_END
);
...
...
@@ -73,6 +71,10 @@ extern "C" DECL_DLLEXPORT ptr create_duel(uint32 seed) {
extern
"C"
DECL_DLLEXPORT
void
start_duel
(
ptr
pduel
,
int
options
)
{
duel
*
pd
=
(
duel
*
)
pduel
;
pd
->
game_field
->
core
.
duel_options
|=
options
;
pd
->
game_field
->
core
.
shuffle_hand_check
[
0
]
=
FALSE
;
pd
->
game_field
->
core
.
shuffle_hand_check
[
1
]
=
FALSE
;
pd
->
game_field
->
core
.
shuffle_deck_check
[
0
]
=
FALSE
;
pd
->
game_field
->
core
.
shuffle_deck_check
[
1
]
=
FALSE
;
if
(
pd
->
game_field
->
player
[
0
].
start_count
>
0
)
pd
->
game_field
->
draw
(
0
,
REASON_RULE
,
PLAYER_NONE
,
0
,
pd
->
game_field
->
player
[
0
].
start_count
);
if
(
pd
->
game_field
->
player
[
1
].
start_count
>
0
)
...
...
@@ -287,6 +289,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*
buf
++
=
MSG_RELOAD_FIELD
;
card
*
pcard
;
for
(
int
playerid
=
0
;
playerid
<
2
;
++
playerid
)
{
*
((
int
*
)(
buf
))
=
ptduel
->
game_field
->
player
[
playerid
].
lp
;
buf
+=
4
;
for
(
uint32
i
=
0
;
i
<
5
;
++
i
)
{
pcard
=
ptduel
->
game_field
->
player
[
playerid
].
list_mzone
[
i
];
if
(
pcard
)
{
...
...
ocgcore/playerop.cpp
View file @
cb12d793
...
...
@@ -234,7 +234,7 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
if
((
playerid
==
1
)
&&
(
core
.
duel_options
&
DUEL_SIMPLE_AI
))
{
returns
.
bvalue
[
0
]
=
min
;
for
(
uint8
i
=
0
;
i
<
min
;
++
i
)
returns
.
bvalue
[
i
+
1
]
=
i
+
1
;
returns
.
bvalue
[
i
+
1
]
=
i
;
return
TRUE
;
}
core
.
units
.
begin
()
->
arg2
=
((
uint32
)
min
)
+
(((
uint32
)
max
)
<<
16
);
...
...
@@ -289,8 +289,16 @@ int32 field::select_chain(uint16 step, uint8 playerid, uint8 spe_count, uint8 fo
if
((
playerid
==
1
)
&&
(
core
.
duel_options
&
DUEL_SIMPLE_AI
))
{
if
(
core
.
select_chains
.
size
()
==
0
)
returns
.
ivalue
[
0
]
=
-
1
;
else
returns
.
ivalue
[
0
]
=
0
;
else
{
bool
act
=
true
;
for
(
auto
chit
=
core
.
current_chain
.
begin
();
chit
!=
core
.
current_chain
.
end
();
++
chit
)
if
(
chit
->
triggering_player
==
1
)
act
=
false
;
if
(
act
)
returns
.
ivalue
[
0
]
=
0
;
else
returns
.
ivalue
[
0
]
=
-
1
;
}
return
TRUE
;
}
pduel
->
write_buffer8
(
MSG_SELECT_CHAIN
);
...
...
ocgcore/scriptlib.h
View file @
cb12d793
...
...
@@ -461,9 +461,10 @@ public:
static
int32
debug_message
(
lua_State
*
L
);
static
int32
debug_add_card
(
lua_State
*
L
);
static
int32
debug_set_player_info
(
lua_State
*
L
);
static
int32
debug_set_duel_info
(
lua_State
*
L
);
static
int32
debug_reload_field_begin
(
lua_State
*
L
);
static
int32
debug_reload_field_end
(
lua_State
*
L
);
static
int32
debug_set_ai_name
(
lua_State
*
L
);
static
int32
debug_show_hint
(
lua_State
*
L
);
};
#endif
/* SCRIPTLIB_H_ */
script/c70284332.lua
View file @
cb12d793
...
...
@@ -35,9 +35,10 @@ function c70284332.operation(e,tp,eg,ep,ev,re,r,rp)
if
c
:
IsRelateToEffect
(
e
)
and
tc
:
IsFaceup
()
and
tc
:
IsRelateToEffect
(
e
)
then
c
:
SetCardTarget
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
EFFECT_SET_CONTROL
)
e1
:
SetProperty
(
EFFECT_FLAG_CANNOT_DISABLE
+
EFFECT_FLAG_SINGLE_RANGE
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetRange
(
LOCATION_MZONE
)
e1
:
SetValue
(
tp
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fc0000
)
e1
:
SetCondition
(
c70284332
.
con
)
...
...
@@ -55,7 +56,7 @@ end
function
c70284332
.
con
(
e
)
local
c
=
e
:
GetOwner
()
local
h
=
e
:
GetHandler
()
return
not
c
:
IsDisabled
()
and
c
:
IsHasCardTarget
(
h
)
return
c
:
IsHasCardTarget
(
h
)
end
function
c70284332
.
dircon
(
e
)
return
e
:
GetHandler
():
IsReason
(
REASON_DESTROY
)
...
...
script/c87902575.lua
View file @
cb12d793
...
...
@@ -11,9 +11,10 @@ function c87902575.initial_effect(c)
e1
:
SetLabelObject
(
ng
)
--remove
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCategory
(
CATEGORY_REMOVE
)
e2
:
SetDescription
(
aux
.
Stringid
(
87902575
,
0
))
e2
:
SetCategory
(
CATEGORY_REMOVE
)
e2
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_TRIGGER_F
)
e2
:
SetProperty
(
EFFECT_FLAG_CARD_TARGET
)
e2
:
SetRange
(
LOCATION_SZONE
)
e2
:
SetCode
(
EVENT_SUMMON_SUCCESS
)
e2
:
SetTarget
(
c87902575
.
rmtg
)
...
...
@@ -46,9 +47,11 @@ function c87902575.clear(e,tp,eg,ep,ev,re,r,rp,chk)
if
chk
==
0
then
return
true
end
e
:
GetLabelObject
():
Clear
()
end
function
c87902575
.
rmtg
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
if
chk
==
0
then
return
true
end
eg
:
GetFirst
():
CreateEffectRelation
(
e
)
function
c87902575
.
rmtg
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
,
chkc
)
if
chkc
then
return
false
end
if
chk
==
0
then
return
eg
:
GetFirst
():
IsOnField
()
and
eg
:
GetFirst
():
IsCanBeEffectTarget
(
e
)
end
Duel
.
SetTargetCard
(
eg
:
GetFirst
())
Duel
.
SetOperationInfo
(
0
,
CATEGORY_REMOVE
,
eg
,
1
,
0
,
0
)
end
function
c87902575
.
rmop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
...
...
script/utility.lua
View file @
cb12d793
...
...
@@ -46,6 +46,29 @@ function Auxiliary.DualNormalCondition(effect)
local
c
=
effect
:
GetHandler
()
return
c
:
IsFaceup
()
and
not
c
:
IsDualState
()
end
function
Auxiliary
.
BeginPuzzle
(
effect
)
local
e1
=
Effect
.
GlobalEffect
()
e1
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e1
:
SetCode
(
EVENT_PHASE
+
PHASE_END
)
e1
:
SetCountLimit
(
1
)
e1
:
SetOperation
(
Auxiliary
.
PuzzleOp
)
Duel
.
RegisterEffect
(
e1
,
0
)
local
e2
=
Effect
.
GlobalEffect
()
e2
:
SetType
(
EFFECT_TYPE_FIELD
)
e2
:
SetProperty
(
EFFECT_FLAG_PLAYER_TARGET
)
e2
:
SetCode
(
EFFECT_SKIP_DP
)
e2
:
SetTargetRange
(
1
,
0
)
Duel
.
RegisterEffect
(
e2
,
0
)
local
e3
=
Effect
.
GlobalEffect
()
e3
:
SetType
(
EFFECT_TYPE_FIELD
)
e3
:
SetProperty
(
EFFECT_FLAG_PLAYER_TARGET
)
e3
:
SetCode
(
EFFECT_SKIP_SP
)
e3
:
SetTargetRange
(
1
,
0
)
Duel
.
RegisterEffect
(
e3
,
0
)
end
function
Auxiliary
.
PuzzleOp
(
e
,
tp
)
Duel
.
SetLP
(
0
,
0
)
end
function
Auxiliary
.
EnableDualAttribute
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
...
...
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