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
MobiusMei
ygopro
Commits
2b06d328
Commit
2b06d328
authored
Jan 12, 2012
by
argon.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network
parent
afe6dbca
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
694 additions
and
474 deletions
+694
-474
gframe/duelclient.cpp
gframe/duelclient.cpp
+18
-12
gframe/event_handler.cpp
gframe/event_handler.cpp
+0
-45
gframe/game.cpp
gframe/game.cpp
+4
-0
gframe/match_duel.cpp
gframe/match_duel.cpp
+27
-0
gframe/match_duel.h
gframe/match_duel.h
+12
-1
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+57
-3
gframe/netserver.cpp
gframe/netserver.cpp
+37
-129
gframe/netserver.h
gframe/netserver.h
+0
-56
gframe/network.h
gframe/network.h
+67
-4
gframe/single_duel.cpp
gframe/single_duel.cpp
+155
-0
gframe/single_duel.h
gframe/single_duel.h
+12
-1
ocgcore/effect.cpp
ocgcore/effect.cpp
+83
-75
ocgcore/effect.h
ocgcore/effect.h
+3
-0
ocgcore/field.h
ocgcore/field.h
+1
-1
ocgcore/operations.cpp
ocgcore/operations.cpp
+5
-5
ocgcore/processor.cpp
ocgcore/processor.cpp
+73
-34
script/c14466224.lua
script/c14466224.lua
+20
-14
script/c21249921.lua
script/c21249921.lua
+2
-1
script/c23756165.lua
script/c23756165.lua
+2
-1
script/c25682811.lua
script/c25682811.lua
+3
-2
script/c28183605.lua
script/c28183605.lua
+2
-1
script/c31930787.lua
script/c31930787.lua
+11
-8
script/c39987164.lua
script/c39987164.lua
+2
-2
script/c4545683.lua
script/c4545683.lua
+10
-7
script/c50140163.lua
script/c50140163.lua
+2
-1
script/c54578613.lua
script/c54578613.lua
+2
-1
script/c57784563.lua
script/c57784563.lua
+3
-2
script/c63465535.lua
script/c63465535.lua
+3
-2
script/c63519819.lua
script/c63519819.lua
+22
-16
script/c64631466.lua
script/c64631466.lua
+27
-31
script/c68140974.lua
script/c68140974.lua
+11
-8
script/c83965310.lua
script/c83965310.lua
+11
-8
script/c87257460.lua
script/c87257460.lua
+2
-1
script/c93157004.lua
script/c93157004.lua
+2
-2
script/constant.lua
script/constant.lua
+3
-0
No files found.
gframe/duelclient.cpp
View file @
2b06d328
...
@@ -66,12 +66,14 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
...
@@ -66,12 +66,14 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
void
DuelClient
::
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
)
{
void
DuelClient
::
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
)
{
if
(
events
&
BEV_EVENT_CONNECTED
)
{
if
(
events
&
BEV_EVENT_CONNECTED
)
{
bool
create_game
=
(
bool
)
ctx
;
bool
create_game
=
(
bool
)
ctx
;
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
WaitFrameSignal
(
10
);
CTOS_PlayerInfo
cspi
;
CTOS_PlayerInfo
cspi
;
BufferIO
::
CopyWStr
(
mainGame
->
ebNickName
->
getText
(),
cspi
.
name
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebNickName
->
getText
(),
cspi
.
name
,
20
);
SendPacketToServer
(
CTOS_PLAYER_INFO
,
cspi
);
SendPacketToServer
(
CTOS_PLAYER_INFO
,
cspi
);
if
(
create_game
)
{
if
(
create_game
)
{
mainGame
->
btnHostConfirm
->
setEnabled
(
true
);
mainGame
->
btnHostCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
WaitFrameSignal
(
11
);
CTOS_CreateGame
cscg
;
CTOS_CreateGame
cscg
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
...
@@ -85,6 +87,8 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -85,6 +87,8 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
}
else
{
}
else
{
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
WaitFrameSignal
(
11
);
CTOS_JoinGame
csjg
;
CTOS_JoinGame
csjg
;
csjg
.
gameid
=
0
;
csjg
.
gameid
=
0
;
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPass
->
getText
(),
csjg
.
pass
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPass
->
getText
(),
csjg
.
pass
,
20
);
...
@@ -93,19 +97,19 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -93,19 +97,19 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
bufferevent_enable
(
bev
,
EV_READ
);
bufferevent_enable
(
bev
,
EV_READ
);
connect_state
=
2
;
connect_state
=
2
;
}
else
if
(
events
&
BEV_EVENT_ERROR
)
{
}
else
if
(
events
&
BEV_EVENT_ERROR
)
{
bufferevent_disable
(
bev
,
EV_READ
);
if
(
!
is_closing
)
{
if
(
!
is_closing
)
{
if
(
connect_state
==
1
)
{
if
(
connect_state
==
1
)
{
mainGame
->
env
->
addMessageBox
(
L""
,
L"无法连接到主机。"
);
mainGame
->
env
->
addMessageBox
(
L""
,
L"无法连接到主机。"
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
}
else
if
(
connect_state
==
2
)
{
}
else
if
(
connect_state
==
2
)
{
mainGame
->
env
->
addMessageBox
(
L""
,
L"已断开连接。"
);
if
(
!
mainGame
->
dInfo
.
isStarted
)
{
irr
::
SEvent
sevt
;
mainGame
->
env
->
addMessageBox
(
L""
,
L"连接已断开。"
);
sevt
.
EventType
=
irr
::
EET_USER_EVENT
;
irr
::
SEvent
sevt
;
sevt
.
UserEvent
.
UserData1
=
UEVENT_EXIT
;
sevt
.
EventType
=
irr
::
EET_USER_EVENT
;
sevt
.
UserEvent
.
UserData2
=
2
;
sevt
.
UserEvent
.
UserData1
=
UEVENT_EXIT
;
mainGame
->
device
->
postEventFromUser
(
sevt
);
sevt
.
UserEvent
.
UserData2
=
2
;
mainGame
->
device
->
postEventFromUser
(
sevt
);
}
}
}
}
}
event_base_loopexit
(
client_base
,
NULL
);
event_base_loopexit
(
client_base
,
NULL
);
...
@@ -153,7 +157,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -153,7 +157,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
chkHostSingleReady
[
1
]
->
setChecked
(
false
);
mainGame
->
chkHostSingleReady
[
1
]
->
setChecked
(
false
);
if
(
selftype
<
2
)
if
(
selftype
<
2
)
mainGame
->
chkHostSingleReady
[
selftype
]
->
setEnabled
(
true
);
mainGame
->
chkHostSingleReady
[
selftype
]
->
setEnabled
(
true
);
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
ShowElement
(
mainGame
->
wHostSingle
);
mainGame
->
ShowElement
(
mainGame
->
wHostSingle
);
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
WaitFrameSignal
(
10
);
break
;
break
;
...
@@ -171,6 +174,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -171,6 +174,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
break
;
break
;
}
}
case
STOC_GAME_START
:
{
break
;
}
case
STOC_HS_PLAYER_ENTER
:
{
case
STOC_HS_PLAYER_ENTER
:
{
STOC_HS_PlayerEnter
*
pkt
=
(
STOC_HS_PlayerEnter
*
)
pdata
;
STOC_HS_PlayerEnter
*
pkt
=
(
STOC_HS_PlayerEnter
*
)
pdata
;
if
(
pkt
->
pos
>
1
)
if
(
pkt
->
pos
>
1
)
...
...
gframe/event_handler.cpp
View file @
2b06d328
...
@@ -1266,52 +1266,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1266,52 +1266,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
irr
:
:
EET_USER_EVENT
:
{
case
irr
:
:
EET_USER_EVENT
:
{
switch
(
event
.
UserEvent
.
UserData1
)
{
case
UEVENT_EXIT
:
{
if
(
mainGame
->
guiFading
)
{
mainGame
->
guiFading
->
setVisible
(
false
);
mainGame
->
guiNext
=
0
;
}
mainGame
->
ShowElement
(
mainGame
->
wMessage
,
60
);
if
(
event
.
UserEvent
.
UserData2
==
1
)
mainGame
->
exit_window
=
mainGame
->
wLanWindow
;
else
if
(
event
.
UserEvent
.
UserData2
==
2
)
;
else
if
(
event
.
UserEvent
.
UserData2
==
3
)
;
break
;
}
case
UEVENT_TOWINDOW
:
{
mainGame
->
exit_window
=
0
;
mainGame
->
wMessage
->
setVisible
(
false
);
mainGame
->
wACMessage
->
setVisible
(
false
);
mainGame
->
wQuery
->
setVisible
(
false
);
mainGame
->
wOptions
->
setVisible
(
false
);
mainGame
->
wPosSelect
->
setVisible
(
false
);
mainGame
->
wCardSelect
->
setVisible
(
false
);
mainGame
->
wANNumber
->
setVisible
(
false
);
mainGame
->
wANCard
->
setVisible
(
false
);
mainGame
->
wANAttribute
->
setVisible
(
false
);
mainGame
->
wANRace
->
setVisible
(
false
);
mainGame
->
wCmdMenu
->
setVisible
(
false
);
mainGame
->
wReplaySave
->
setVisible
(
false
);
mainGame
->
btnDP
->
setVisible
(
false
);
mainGame
->
btnSP
->
setVisible
(
false
);
mainGame
->
btnM1
->
setVisible
(
false
);
mainGame
->
btnBP
->
setVisible
(
false
);
mainGame
->
btnM2
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
wCardImg
->
setVisible
(
false
);
mainGame
->
wInfos
->
setVisible
(
false
);
mainGame
->
stHintMsg
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
dField
.
Clear
();
mainGame
->
ShowElement
(
mainGame
->
exit_window
);
break
;
}
break
;
break
;
}
}
}
}
}
return
false
;
return
false
;
...
...
gframe/game.cpp
View file @
2b06d328
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#include "deck_manager.h"
#include "deck_manager.h"
#include "replay.h"
#include "replay.h"
#include "materials.h"
#include "materials.h"
#include "duelclient.h"
#include "netserver.h"
#ifndef WIN32
#ifndef WIN32
#include <sys/types.h>
#include <sys/types.h>
...
@@ -487,6 +489,8 @@ void Game::MainLoop() {
...
@@ -487,6 +489,8 @@ void Game::MainLoop() {
timer
->
setTime
(
0
);
timer
->
setTime
(
0
);
}
}
}
}
DuelClient
::
StopClient
(
true
);
NetServer
::
StopServer
();
SaveConfig
();
SaveConfig
();
device
->
drop
();
device
->
drop
();
}
}
...
...
gframe/match_duel.cpp
0 → 100644
View file @
2b06d328
#include "match_duel.h"
#include "netserver.h"
namespace
ygo
{
void
MatchDuel
::
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
)
{
}
void
MatchDuel
::
LeaveGame
(
DuelPlayer
*
dp
)
{
}
void
MatchDuel
::
ToDuelist
(
DuelPlayer
*
dp
)
{
}
void
MatchDuel
::
ToObserver
(
DuelPlayer
*
dp
)
{
}
void
MatchDuel
::
PlayerReady
(
DuelPlayer
*
dp
)
{
}
void
MatchDuel
::
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
{
}
void
MatchDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
)
{
}
void
MatchDuel
::
StartDuel
(
DuelPlayer
*
dp
)
{
}
void
MatchDuel
::
Process
()
{
}
void
MatchDuel
::
EndDuel
()
{
}
}
gframe/match_duel.h
View file @
2b06d328
...
@@ -2,11 +2,22 @@
...
@@ -2,11 +2,22 @@
#define MATCH_DUEL_H
#define MATCH_DUEL_H
#include "config.h"
#include "config.h"
#include "network.h"
namespace
ygo
{
namespace
ygo
{
class
MatchDuel
:
public
DuelMode
{
class
MatchDuel
:
public
DuelMode
{
public:
virtual
void
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
);
virtual
void
LeaveGame
(
DuelPlayer
*
dp
);
virtual
void
ToDuelist
(
DuelPlayer
*
dp
);
virtual
void
ToObserver
(
DuelPlayer
*
dp
);
virtual
void
PlayerReady
(
DuelPlayer
*
dp
);
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
);
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
);
virtual
void
StartDuel
(
DuelPlayer
*
dp
);
virtual
void
Process
();
virtual
void
EndDuel
();
};
};
}
}
...
...
gframe/menu_handler.cpp
View file @
2b06d328
...
@@ -21,13 +21,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -21,13 +21,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_LAN_MODE
:
{
case
BUTTON_LAN_MODE
:
{
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wMainMenu
,
false
,
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wMainMenu
,
false
,
mainGame
->
wLanWindow
);
break
;
break
;
}
}
case
BUTTON_JOIN_HOST
:
{
case
BUTTON_JOIN_HOST
:
{
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
if
(
DuelClient
::
StartClient
(
0x7f000001
,
7911
,
false
))
{
mainGame
->
btnJoinHost
->
setEnabled
(
false
);
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
mainGame
->
btnJoinCancel
->
setEnabled
(
false
);
mainGame
->
btnJoinHost
->
setEnabled
(
false
);
mainGame
->
btnJoinCancel
->
setEnabled
(
false
);
}
break
;
break
;
}
}
case
BUTTON_JOIN_CANCEL
:
{
case
BUTTON_JOIN_CANCEL
:
{
...
@@ -52,6 +57,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -52,6 +57,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_HOST_CANCEL
:
{
case
BUTTON_HOST_CANCEL
:
{
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wCreateHost
,
false
,
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wCreateHost
,
false
,
mainGame
->
wLanWindow
);
break
;
break
;
}
}
...
@@ -216,6 +224,52 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -216,6 +224,52 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
irr
:
:
EET_USER_EVENT
:
{
case
irr
:
:
EET_USER_EVENT
:
{
switch
(
event
.
UserEvent
.
UserData1
)
{
case
UEVENT_EXIT
:
{
if
(
mainGame
->
guiFading
)
{
mainGame
->
guiFading
->
setVisible
(
false
);
mainGame
->
guiNext
=
0
;
}
mainGame
->
ShowElement
(
mainGame
->
wMessage
,
60
);
if
(
event
.
UserEvent
.
UserData2
==
1
)
mainGame
->
exit_window
=
mainGame
->
wLanWindow
;
else
if
(
event
.
UserEvent
.
UserData2
==
2
)
;
else
if
(
event
.
UserEvent
.
UserData2
==
3
)
;
break
;
}
case
UEVENT_TOWINDOW
:
{
mainGame
->
exit_window
=
0
;
mainGame
->
wMessage
->
setVisible
(
false
);
mainGame
->
wACMessage
->
setVisible
(
false
);
mainGame
->
wQuery
->
setVisible
(
false
);
mainGame
->
wOptions
->
setVisible
(
false
);
mainGame
->
wPosSelect
->
setVisible
(
false
);
mainGame
->
wCardSelect
->
setVisible
(
false
);
mainGame
->
wANNumber
->
setVisible
(
false
);
mainGame
->
wANCard
->
setVisible
(
false
);
mainGame
->
wANAttribute
->
setVisible
(
false
);
mainGame
->
wANRace
->
setVisible
(
false
);
mainGame
->
wCmdMenu
->
setVisible
(
false
);
mainGame
->
wReplaySave
->
setVisible
(
false
);
mainGame
->
btnDP
->
setVisible
(
false
);
mainGame
->
btnSP
->
setVisible
(
false
);
mainGame
->
btnM1
->
setVisible
(
false
);
mainGame
->
btnBP
->
setVisible
(
false
);
mainGame
->
btnM2
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
wCardImg
->
setVisible
(
false
);
mainGame
->
wInfos
->
setVisible
(
false
);
mainGame
->
stHintMsg
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
dField
.
Clear
();
mainGame
->
ShowElement
(
mainGame
->
exit_window
);
break
;
}
break
;
}
break
;
break
;
}
}
}
}
...
...
gframe/netserver.cpp
View file @
2b06d328
...
@@ -71,19 +71,23 @@ void NetServer::ServerEchoRead(bufferevent *bev, void *ctx) {
...
@@ -71,19 +71,23 @@ void NetServer::ServerEchoRead(bufferevent *bev, void *ctx) {
}
}
void
NetServer
::
ServerEchoEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
)
{
void
NetServer
::
ServerEchoEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
)
{
if
(
events
&
(
BEV_EVENT_EOF
|
BEV_EVENT_ERROR
))
{
if
(
events
&
(
BEV_EVENT_EOF
|
BEV_EVENT_ERROR
))
{
bufferevent_disable
(
bev
,
EV_READ
);
DuelPlayer
*
dp
=
&
users
[
bev
];
bufferevent_free
(
bev
);
DuelMode
*
dm
=
dp
->
game
;
users
.
erase
(
bev
);
if
(
dm
)
dm
->
LeaveGame
(
dp
);
else
DisconnectPlayer
(
dp
);
}
}
}
}
int
NetServer
::
ServerThread
(
void
*
param
)
{
int
NetServer
::
ServerThread
(
void
*
param
)
{
event_base_dispatch
(
net_evbase
);
event_base_dispatch
(
net_evbase
);
for
(
auto
bit
=
users
.
begin
();
bit
!=
users
.
end
();
++
bit
){
for
(
auto
bit
=
users
.
begin
();
bit
!=
users
.
end
();
++
bit
)
{
bufferevent_disable
(
bit
->
first
,
EV_READ
);
bufferevent_disable
(
bit
->
first
,
EV_READ
);
bufferevent_free
(
bit
->
first
);
bufferevent_free
(
bit
->
first
);
}
}
event_base_free
(
net_evbase
);
event_base_free
(
net_evbase
);
net_evbase
=
0
;
net_evbase
=
0
;
if
(
duel_mode
)
delete
duel_mode
;
return
0
;
return
0
;
}
}
void
NetServer
::
DisconnectPlayer
(
DuelPlayer
*
dp
)
{
void
NetServer
::
DisconnectPlayer
(
DuelPlayer
*
dp
)
{
...
@@ -106,8 +110,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, char* data, unsigned int len) {
...
@@ -106,8 +110,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, char* data, unsigned int len) {
break
;
break
;
case
CTOS_PLAYER_INFO
:
{
case
CTOS_PLAYER_INFO
:
{
CTOS_PlayerInfo
*
pkt
=
(
CTOS_PlayerInfo
*
)
pdata
;
CTOS_PlayerInfo
*
pkt
=
(
CTOS_PlayerInfo
*
)
pdata
;
for
(
int
i
=
0
;
i
<
20
;
++
i
)
BufferIO
::
CopyWStr
(
pkt
->
name
,
dp
->
name
,
20
);
dp
->
name
[
i
]
=
pkt
->
name
[
i
];
break
;
break
;
}
}
case
CTOS_CREATE_GAME
:
{
case
CTOS_CREATE_GAME
:
{
...
@@ -123,155 +126,60 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, char* data, unsigned int len) {
...
@@ -123,155 +126,60 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, char* data, unsigned int len) {
pkt
->
info
.
rule
=
0
;
pkt
->
info
.
rule
=
0
;
if
(
pkt
->
info
.
mode
>
1
)
if
(
pkt
->
info
.
mode
>
1
)
pkt
->
info
.
rule
=
0
;
pkt
->
info
.
rule
=
0
;
duel_mode
->
host_info
=
pkt
->
info
;
unsigned
int
hash
=
0
;
for
(
int
i
=
0
;
i
<
20
;
++
i
)
{
for
(
auto
lfit
=
deckManager
.
_lfList
.
begin
();
lfit
!=
deckManager
.
_lfList
.
end
();
++
lfit
)
{
duel_mode
->
name
[
i
]
=
pkt
->
name
[
i
];
if
(
pkt
->
info
.
lflist
==
lfit
->
hash
)
{
duel_mode
->
pass
[
i
]
=
pkt
->
pass
[
i
];
hash
=
pkt
->
info
.
lflist
;
}
}
case
CTOS_JOIN_GAME
:
{
if
(
pktType
!=
CTOS_CREATE_GAME
)
{
if
((
dp
->
game
&&
dp
->
type
!=
0xff
)
||
!
duel_mode
)
{
STOC_JoinFail
scjf
;
scjf
.
reason
=
0
;
SendPacketToPlayer
(
dp
,
STOC_JOIN_FAIL
,
scjf
);
break
;
break
;
}
}
CTOS_JoinGame
*
pkt
=
(
CTOS_JoinGame
*
)
pdata
;
wchar_t
jpass
[
20
];
for
(
int
i
=
0
;
i
<
20
;
++
i
)
jpass
[
i
]
=
pkt
->
pass
[
i
];
jpass
[
20
]
=
0
;
if
(
wcscmp
(
jpass
,
duel_mode
->
pass
))
{
STOC_JoinFail
scjf
;
scjf
.
reason
=
1
;
SendPacketToPlayer
(
dp
,
STOC_JOIN_FAIL
,
scjf
);
break
;
}
}
dp
->
game
=
duel_mode
;
if
(
!
duel_mode
->
players
[
0
]
&&
!
duel_mode
->
players
[
1
]
&&
duel_mode
->
observers
.
size
()
==
0
)
duel_mode
->
host_player
=
dp
;
STOC_JoinGame
scjg
;
scjg
.
info
=
duel_mode
->
host_info
;
scjg
.
type
=
(
duel_mode
->
host_player
==
dp
)
?
0x10
:
0
;
if
(
!
duel_mode
->
players
[
0
]
||
!
duel_mode
->
players
[
1
])
{
STOC_HS_PlayerEnter
scpe
;
for
(
int
i
=
0
;
i
<
20
;
++
i
)
scpe
.
name
[
i
]
=
dp
->
name
[
1
];
if
(
duel_mode
->
players
[
0
])
{
scpe
.
pos
=
0
;
NetServer
::
SendPacketToPlayer
(
duel_mode
->
players
[
0
],
STOC_HS_PLAYER_ENTER
,
scpe
);
}
if
(
duel_mode
->
players
[
1
])
{
scpe
.
pos
=
1
;
NetServer
::
SendPacketToPlayer
(
duel_mode
->
players
[
1
],
STOC_HS_PLAYER_ENTER
,
scpe
);
}
for
(
auto
pit
=
duel_mode
->
observers
.
begin
();
pit
!=
duel_mode
->
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_ENTER
,
scpe
);
if
(
!
duel_mode
->
players
[
0
])
{
duel_mode
->
players
[
0
]
=
dp
;
dp
->
type
=
NETPLAYER_TYPE_PLAYER1
;
scjg
.
type
|=
NETPLAYER_TYPE_PLAYER1
;
}
else
{
duel_mode
->
players
[
1
]
=
dp
;
dp
->
type
=
NETPLAYER_TYPE_PLAYER2
;
scjg
.
type
|=
NETPLAYER_TYPE_PLAYER2
;
}
}
else
{
duel_mode
->
observers
.
insert
(
dp
);
dp
->
type
=
NETPLAYER_TYPE_OBSERVER
;
scjg
.
type
|=
NETPLAYER_TYPE_OBSERVER
;
STOC_HS_WatchChange
scwc
;
scwc
.
watch_count
=
duel_mode
->
observers
.
size
();
if
(
duel_mode
->
players
[
0
])
NetServer
::
SendPacketToPlayer
(
duel_mode
->
players
[
0
],
STOC_HS_WATCH_CHANGE
,
scwc
);
if
(
duel_mode
->
players
[
1
])
NetServer
::
SendPacketToPlayer
(
duel_mode
->
players
[
1
],
STOC_HS_WATCH_CHANGE
,
scwc
);
for
(
auto
pit
=
duel_mode
->
observers
.
begin
();
pit
!=
duel_mode
->
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_WATCH_CHANGE
,
scwc
);
}
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_JOIN_GAME
,
scjg
);
if
(
duel_mode
->
players
[
0
])
{
STOC_HS_PlayerEnter
scpe
;
for
(
int
i
=
0
;
i
<
20
;
++
i
)
scpe
.
name
[
i
]
=
duel_mode
->
players
[
0
]
->
name
[
i
];
scpe
.
pos
=
0
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_ENTER
,
scpe
);
if
(
duel_mode
->
ready
[
0
])
{
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
PLAYERCHANGE_READY
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
}
}
if
(
duel_mode
->
players
[
1
])
{
STOC_HS_PlayerEnter
scpe
;
for
(
int
i
=
0
;
i
<
20
;
++
i
)
scpe
.
name
[
i
]
=
duel_mode
->
players
[
1
]
->
name
[
i
];
scpe
.
pos
=
1
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_ENTER
,
scpe
);
if
(
duel_mode
->
ready
[
1
])
{
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
0x10
|
PLAYERCHANGE_READY
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
}
}
if
(
duel_mode
->
observers
.
size
())
{
STOC_HS_WatchChange
scwc
;
scwc
.
watch_count
=
duel_mode
->
observers
.
size
();
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_WATCH_CHANGE
,
scwc
);
}
}
if
(
!
hash
)
pkt
->
info
.
lflist
=
deckManager
.
_lfList
[
0
].
hash
;
duel_mode
->
host_info
=
pkt
->
info
;
BufferIO
::
CopyWStr
(
pkt
->
name
,
duel_mode
->
name
,
20
);
BufferIO
::
CopyWStr
(
pkt
->
pass
,
duel_mode
->
pass
,
20
);
duel_mode
->
JoinGame
(
dp
,
0
,
true
);
break
;
}
case
CTOS_JOIN_GAME
:
{
if
(
!
duel_mode
)
break
;
duel_mode
->
JoinGame
(
dp
,
pdata
,
false
);
break
;
break
;
}
}
case
CTOS_EXIT_GAME
:
{
case
CTOS_EXIT_GAME
:
{
if
(
!
duel_mode
)
break
;
duel_mode
->
LeaveGame
(
dp
);
break
;
break
;
}
}
case
CTOS_HS_TODUELIST
:
{
case
CTOS_HS_TODUELIST
:
{
if
(
duel_mode
->
pduel
)
if
(
!
duel_mode
||
duel_mode
->
pduel
)
break
;
break
;
duel_mode
->
ToDuelist
(
dp
);
break
;
break
;
}
}
case
CTOS_HS_TOOBSERVER
:
{
case
CTOS_HS_TOOBSERVER
:
{
if
(
duel_mode
->
pduel
)
if
(
!
duel_mode
||
duel_mode
->
pduel
)
break
;
break
;
duel_mode
->
ToObserver
(
dp
);
break
;
break
;
}
}
case
CTOS_HS_READY
:
{
case
CTOS_HS_READY
:
{
if
(
duel_mode
->
pduel
)
if
(
!
duel_mode
||
duel_mode
->
pduel
)
break
;
break
;
if
(
dp
->
type
>
1
)
duel_mode
->
PlayerReady
(
dp
);
break
;
duel_mode
->
ready
[
dp
->
type
]
=
!
duel_mode
->
ready
[
dp
->
type
]
;
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
(
dp
->
type
<<
4
)
|
duel_mode
->
ready
[
dp
->
type
]
?
PLAYERCHANGE_READY
:
PLAYERCHANGE_NOTREADY
;
if
(
duel_mode
->
players
[
1
-
dp
->
type
])
NetServer
::
SendPacketToPlayer
(
duel_mode
->
players
[
1
-
dp
->
type
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
for
(
auto
pit
=
duel_mode
->
observers
.
begin
();
pit
!=
duel_mode
->
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
break
;
break
;
}
}
case
CTOS_HS_KICK1
:
case
CTOS_HS_KICK1
:
case
CTOS_HS_KICK2
:
{
case
CTOS_HS_KICK2
:
{
if
(
duel_mode
->
pduel
)
if
(
!
duel_mode
||
duel_mode
->
pduel
)
break
;
unsigned
char
pos
=
pktType
-
CTOS_HS_KICK1
;
if
(
dp
!=
duel_mode
->
host_player
)
break
;
if
(
dp
==
duel_mode
->
players
[
pos
])
break
;
break
;
STOC_HS_PlayerChange
scpc
;
duel_mode
->
PlayerKick
(
dp
,
pktType
-
CTOS_HS_KICK1
);
scpc
.
status
=
(
pos
<<
4
)
|
PLAYERCHANGE_LEAVE
;
if
(
duel_mode
->
players
[
0
])
NetServer
::
SendPacketToPlayer
(
duel_mode
->
players
[
0
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
if
(
duel_mode
->
players
[
1
])
NetServer
::
SendPacketToPlayer
(
duel_mode
->
players
[
1
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
for
(
auto
pit
=
duel_mode
->
observers
.
begin
();
pit
!=
duel_mode
->
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
duel_mode
->
players
[
pos
]
=
0
;
DisconnectPlayer
(
duel_mode
->
players
[
pos
]);
break
;
break
;
}
}
case
CTOS_HS_START
:
{
case
CTOS_HS_START
:
{
if
(
duel_mode
->
pduel
)
if
(
!
duel_mode
||
duel_mode
->
pduel
)
break
;
break
;
evconnlistener_disable
(
listener
);
evconnlistener_disable
(
listener
);
break
;
break
;
...
...
gframe/netserver.h
View file @
2b06d328
...
@@ -3,61 +3,13 @@
...
@@ -3,61 +3,13 @@
#include "config.h"
#include "config.h"
#include "network.h"
#include "network.h"
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include <event2/thread.h>
#include "data_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
#include <array>
#include <set>
#include <set>
#include <unordered_map>
#include <unordered_map>
namespace
ygo
{
namespace
ygo
{
class
DuelMode
;
struct
DuelPlayer
{
unsigned
short
name
[
20
];
DuelMode
*
game
;
unsigned
char
type
;
unsigned
char
state
;
bufferevent
*
bev
;
DuelPlayer
()
{
game
=
0
;
type
=
0
;
state
=
0
;
bev
=
0
;
}
};
class
DuelMode
{
public:
DuelMode
()
{
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
players
[
i
]
=
0
;
ready
[
i
]
=
false
;
}
host_player
=
0
;
pduel
=
0
;
}
void
Start
();
void
Process
();
void
End
();
public:
DuelPlayer
*
players
[
6
];
bool
ready
[
6
];
Deck
pdeck
[
6
];
std
::
set
<
DuelPlayer
*>
observers
;
DuelPlayer
*
host_player
;
HostInfo
host_info
;
unsigned
long
pduel
;
wchar_t
name
[
20
];
wchar_t
pass
[
20
];
};
class
NetServer
{
class
NetServer
{
private:
private:
static
std
::
unordered_map
<
bufferevent
*
,
DuelPlayer
>
users
;
static
std
::
unordered_map
<
bufferevent
*
,
DuelPlayer
>
users
;
...
@@ -108,12 +60,4 @@ public:
...
@@ -108,12 +60,4 @@ public:
}
}
#define NETPLAYER_TYPE_PLAYER1 0
#define NETPLAYER_TYPE_PLAYER2 1
#define NETPLAYER_TYPE_PLAYER3 2
#define NETPLAYER_TYPE_PLAYER4 3
#define NETPLAYER_TYPE_PLAYER5 4
#define NETPLAYER_TYPE_PLAYER6 5
#define NETPLAYER_TYPE_OBSERVER 7
#endif //NETSERVER_H
#endif //NETSERVER_H
gframe/network.h
View file @
2b06d328
...
@@ -2,8 +2,12 @@
...
@@ -2,8 +2,12 @@
#define NETWORK_H
#define NETWORK_H
#include "config.h"
#include "config.h"
#include <set>
#include "deck_manager.h"
#include <vector>
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include <event2/thread.h>
namespace
ygo
{
namespace
ygo
{
...
@@ -58,6 +62,7 @@ struct STOC_JoinGame {
...
@@ -58,6 +62,7 @@ struct STOC_JoinGame {
unsigned
char
type
;
unsigned
char
type
;
};
};
struct
STOC_ExitGame
{
struct
STOC_ExitGame
{
unsigned
pos
;
};
};
struct
STOC_JoinFail
{
struct
STOC_JoinFail
{
//0 - common error
//0 - common error
...
@@ -77,11 +82,69 @@ struct STOC_HS_WatchChange {
...
@@ -77,11 +82,69 @@ struct STOC_HS_WatchChange {
unsigned
short
watch_count
;
unsigned
short
watch_count
;
};
};
class
DuelMode
;
struct
DuelPlayer
{
unsigned
short
name
[
20
];
DuelMode
*
game
;
unsigned
char
type
;
unsigned
char
state
;
bufferevent
*
bev
;
DuelPlayer
()
{
game
=
0
;
type
=
0
;
state
=
0
;
bev
=
0
;
}
};
class
DuelMode
{
public:
DuelMode
()
{
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
players
[
i
]
=
0
;
ready
[
i
]
=
false
;
}
host_player
=
0
;
pduel
=
0
;
}
virtual
~
DuelMode
()
{}
virtual
void
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
)
=
0
;
virtual
void
LeaveGame
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
ToDuelist
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
ToObserver
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
PlayerReady
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
=
0
;
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
)
=
0
;
virtual
void
StartDuel
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
Process
()
=
0
;
virtual
void
EndDuel
()
=
0
;
public:
DuelPlayer
*
players
[
6
];
bool
ready
[
6
];
Deck
pdeck
[
6
];
std
::
set
<
DuelPlayer
*>
observers
;
DuelPlayer
*
host_player
;
HostInfo
host_info
;
unsigned
long
pduel
;
wchar_t
name
[
20
];
wchar_t
pass
[
20
];
};
}
}
#define NETWORK_SERVER_ID 0x7428
#define NETWORK_SERVER_ID 0x7428
#define NETWORK_CLIENT_ID 0xdef6
#define NETWORK_CLIENT_ID 0xdef6
#define NETPLAYER_TYPE_PLAYER1 0
#define NETPLAYER_TYPE_PLAYER2 1
#define NETPLAYER_TYPE_PLAYER3 2
#define NETPLAYER_TYPE_PLAYER4 3
#define NETPLAYER_TYPE_PLAYER5 4
#define NETPLAYER_TYPE_PLAYER6 5
#define NETPLAYER_TYPE_OBSERVER 7
#define CTOS_RESPONSE 0x1
#define CTOS_RESPONSE 0x1
#define CTOS_CHANGEDECK 0x2
#define CTOS_CHANGEDECK 0x2
#define CTOS_PLAYER_INFO 0x10
#define CTOS_PLAYER_INFO 0x10
...
@@ -111,6 +174,6 @@ struct STOC_HS_WatchChange {
...
@@ -111,6 +174,6 @@ struct STOC_HS_WatchChange {
#define PLAYERCHANGE_LEAVE 0x3
#define PLAYERCHANGE_LEAVE 0x3
#define PLAYERCHANGE_OBSERVE 0x4
#define PLAYERCHANGE_OBSERVE 0x4
#define MODE_SINGLE 0x
1
#define MODE_SINGLE 0x
0
#define MODE_MATCH 0x
2
#define MODE_MATCH 0x
1
#endif //NETWORK_H
#endif //NETWORK_H
gframe/single_duel.cpp
0 → 100644
View file @
2b06d328
#include "single_duel.h"
#include "netserver.h"
namespace
ygo
{
void
SingleDuel
::
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
)
{
if
(
!
is_creater
)
{
if
(
dp
->
game
&&
dp
->
type
!=
0xff
)
{
STOC_JoinFail
scjf
;
scjf
.
reason
=
0
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_JOIN_FAIL
,
scjf
);
return
;
}
CTOS_JoinGame
*
pkt
=
(
CTOS_JoinGame
*
)
pdata
;
wchar_t
jpass
[
20
];
for
(
int
i
=
0
;
i
<
20
;
++
i
)
jpass
[
i
]
=
pkt
->
pass
[
i
];
jpass
[
20
]
=
0
;
if
(
wcscmp
(
jpass
,
pass
))
{
STOC_JoinFail
scjf
;
scjf
.
reason
=
1
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_JOIN_FAIL
,
scjf
);
return
;
}
}
dp
->
game
=
this
;
if
(
!
players
[
0
]
&&
!
players
[
1
]
&&
observers
.
size
()
==
0
)
host_player
=
dp
;
STOC_JoinGame
scjg
;
scjg
.
info
=
host_info
;
scjg
.
type
=
(
host_player
==
dp
)
?
0x10
:
0
;
if
(
!
players
[
0
]
||
!
players
[
1
])
{
STOC_HS_PlayerEnter
scpe
;
BufferIO
::
CopyWStr
(
dp
->
name
,
scpe
.
name
,
20
);
if
(
players
[
0
])
{
scpe
.
pos
=
1
;
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_HS_PLAYER_ENTER
,
scpe
);
}
if
(
players
[
1
])
{
scpe
.
pos
=
0
;
NetServer
::
SendPacketToPlayer
(
players
[
1
],
STOC_HS_PLAYER_ENTER
,
scpe
);
}
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_ENTER
,
scpe
);
if
(
!
players
[
0
])
{
players
[
0
]
=
dp
;
dp
->
type
=
NETPLAYER_TYPE_PLAYER1
;
scjg
.
type
|=
NETPLAYER_TYPE_PLAYER1
;
}
else
{
players
[
1
]
=
dp
;
dp
->
type
=
NETPLAYER_TYPE_PLAYER2
;
scjg
.
type
|=
NETPLAYER_TYPE_PLAYER2
;
}
}
else
{
observers
.
insert
(
dp
);
dp
->
type
=
NETPLAYER_TYPE_OBSERVER
;
scjg
.
type
|=
NETPLAYER_TYPE_OBSERVER
;
STOC_HS_WatchChange
scwc
;
scwc
.
watch_count
=
observers
.
size
();
if
(
players
[
0
])
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_HS_WATCH_CHANGE
,
scwc
);
if
(
players
[
1
])
NetServer
::
SendPacketToPlayer
(
players
[
1
],
STOC_HS_WATCH_CHANGE
,
scwc
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_WATCH_CHANGE
,
scwc
);
}
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_JOIN_GAME
,
scjg
);
if
(
players
[
0
])
{
STOC_HS_PlayerEnter
scpe
;
BufferIO
::
CopyWStr
(
players
[
0
]
->
name
,
scpe
.
name
,
20
);
scpe
.
pos
=
0
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_ENTER
,
scpe
);
if
(
ready
[
0
])
{
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
PLAYERCHANGE_READY
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
}
}
if
(
players
[
1
])
{
STOC_HS_PlayerEnter
scpe
;
BufferIO
::
CopyWStr
(
players
[
1
]
->
name
,
scpe
.
name
,
20
);
scpe
.
pos
=
1
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_ENTER
,
scpe
);
if
(
ready
[
1
])
{
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
0x10
|
PLAYERCHANGE_READY
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
}
}
if
(
observers
.
size
())
{
STOC_HS_WatchChange
scwc
;
scwc
.
watch_count
=
observers
.
size
();
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_HS_WATCH_CHANGE
,
scwc
);
}
}
void
SingleDuel
::
LeaveGame
(
DuelPlayer
*
dp
)
{
if
(
dp
==
host_player
){
NetServer
::
StopServer
();
}
else
if
(
dp
->
type
==
NETPLAYER_TYPE_OBSERVER
)
{
if
(
!
pduel
)
{
STOC_HS_WatchChange
scwc
;
scwc
.
watch_count
=
observers
.
size
();
}
NetServer
::
DisconnectPlayer
(
dp
);
}
else
{
STOC_HS_PlayerChange
scpc
;
players
[
dp
->
type
]
=
0
;
scpc
.
status
=
(
dp
->
type
<<
4
)
|
PLAYERCHANGE_LEAVE
;
if
(
players
[
0
]
&&
dp
->
type
!=
0
)
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
if
(
players
[
1
]
&&
dp
->
type
!=
1
)
NetServer
::
SendPacketToPlayer
(
players
[
1
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
if
(
pduel
)
NetServer
::
StopServer
();
else
NetServer
::
DisconnectPlayer
(
dp
);
}
}
void
SingleDuel
::
ToDuelist
(
DuelPlayer
*
dp
)
{
if
(
dp
->
type
!=
NETPLAYER_TYPE_OBSERVER
)
return
;
}
void
SingleDuel
::
ToObserver
(
DuelPlayer
*
dp
)
{
if
(
dp
->
type
>
1
)
return
;
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
(
dp
->
type
<<
4
)
|
PLAYERCHANGE_OBSERVE
;
}
void
SingleDuel
::
PlayerReady
(
DuelPlayer
*
dp
)
{
if
(
dp
->
type
>
1
)
return
;
ready
[
dp
->
type
]
=
!
ready
[
dp
->
type
]
;
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
(
dp
->
type
<<
4
)
|
ready
[
dp
->
type
]
?
PLAYERCHANGE_READY
:
PLAYERCHANGE_NOTREADY
;
if
(
players
[
1
-
dp
->
type
])
NetServer
::
SendPacketToPlayer
(
players
[
1
-
dp
->
type
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
}
void
SingleDuel
::
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
{
if
(
dp
!=
host_player
||
dp
==
players
[
pos
]
||
!
players
[
pos
])
return
;
LeaveGame
(
players
[
pos
]);
}
void
SingleDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
)
{
}
void
SingleDuel
::
StartDuel
(
DuelPlayer
*
dp
)
{
}
void
SingleDuel
::
Process
()
{
}
void
SingleDuel
::
EndDuel
()
{
}
}
gframe/single_duel.h
View file @
2b06d328
...
@@ -2,11 +2,22 @@
...
@@ -2,11 +2,22 @@
#define SINGLE_DUEL_H
#define SINGLE_DUEL_H
#include "config.h"
#include "config.h"
#include "network.h"
namespace
ygo
{
namespace
ygo
{
class
SingleDuel
:
public
DuelMode
{
class
SingleDuel
:
public
DuelMode
{
public:
virtual
void
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
);
virtual
void
LeaveGame
(
DuelPlayer
*
dp
);
virtual
void
ToDuelist
(
DuelPlayer
*
dp
);
virtual
void
ToObserver
(
DuelPlayer
*
dp
);
virtual
void
PlayerReady
(
DuelPlayer
*
dp
);
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
);
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
);
virtual
void
StartDuel
(
DuelPlayer
*
dp
);
virtual
void
Process
();
virtual
void
EndDuel
();
};
};
}
}
...
...
ocgcore/effect.cpp
View file @
2b06d328
This diff is collapsed.
Click to expand it.
ocgcore/effect.h
View file @
2b06d328
...
@@ -149,6 +149,8 @@ public:
...
@@ -149,6 +149,8 @@ public:
#define EFFECT_FLAG_REPEAT 0x200000 //
#define EFFECT_FLAG_REPEAT 0x200000 //
#define EFFECT_FLAG_NO_TURN_RESET 0x400000 //
#define EFFECT_FLAG_NO_TURN_RESET 0x400000 //
#define EFFECT_FLAG_EVENT_PLAYER 0x800000 //
#define EFFECT_FLAG_EVENT_PLAYER 0x800000 //
#define EFFECT_FLAG_OWNER_RELATE 0x1000000 //
#define EFFECT_FLAG_AVAILABLE_BD 0x2000000 //
//========== Codes ==========
//========== Codes ==========
#define EFFECT_IMMUNE_EFFECT 1 //
#define EFFECT_IMMUNE_EFFECT 1 //
...
@@ -291,6 +293,7 @@ public:
...
@@ -291,6 +293,7 @@ public:
#define EFFECT_REFLECT_BATTLE_DAMAGE 202
#define EFFECT_REFLECT_BATTLE_DAMAGE 202
#define EFFECT_PIERCE 203
#define EFFECT_PIERCE 203
#define EFFECT_BATTLE_DESTROY_REDIRECT 204
#define EFFECT_BATTLE_DESTROY_REDIRECT 204
#define EFFECT_BATTLE_DAMAGE_TO_EFFECT 205
#define EFFECT_TOSS_COIN_REPLACE 220
#define EFFECT_TOSS_COIN_REPLACE 220
#define EFFECT_TOSS_DICE_REPLACE 221
#define EFFECT_TOSS_DICE_REPLACE 221
#define EFFECT_FUSION_MATERIAL 230
#define EFFECT_FUSION_MATERIAL 230
...
...
ocgcore/field.h
View file @
2b06d328
...
@@ -198,7 +198,7 @@ struct processor {
...
@@ -198,7 +198,7 @@ struct processor {
effect_vector
delayed_ntp
;
effect_vector
delayed_ntp
;
event_list
delayed_tev
;
event_list
delayed_tev
;
event_list
delayed_ntev
;
event_list
delayed_ntev
;
void
*
temp_var
[
4
];
ptr
temp_var
[
4
];
uint16
pre_field
[
5
];
uint16
pre_field
[
5
];
int32
chain_limit
;
int32
chain_limit
;
uint8
chain_limp
;
uint8
chain_limp
;
...
...
ocgcore/operations.cpp
View file @
2b06d328
...
@@ -981,7 +981,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -981,7 +981,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
else
{
else
{
if
(
min
==
0
&&
get_useable_count
(
sumplayer
,
LOCATION_MZONE
)
>
0
)
{
if
(
min
==
0
&&
get_useable_count
(
sumplayer
,
LOCATION_MZONE
)
>
0
)
{
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
sumplayer
,
90
);
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
sumplayer
,
90
);
core
.
temp_var
[
0
]
=
(
void
*
)
required
;
core
.
temp_var
[
0
]
=
required
;
core
.
units
.
begin
()
->
step
=
19
;
core
.
units
.
begin
()
->
step
=
19
;
}
else
}
else
add_process
(
PROCESSOR_SELECT_TRIBUTE
,
0
,
0
,
0
,
sumplayer
,
required
);
add_process
(
PROCESSOR_SELECT_TRIBUTE
,
0
,
0
,
0
,
sumplayer
,
required
);
...
@@ -1031,7 +1031,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1031,7 +1031,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
returns
.
ivalue
[
0
]
=
FALSE
;
returns
.
ivalue
[
0
]
=
FALSE
;
effect
*
pextra
=
target
->
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
);
effect
*
pextra
=
target
->
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
);
if
(
pextra
)
{
if
(
pextra
)
{
core
.
temp_var
[
0
]
=
pextra
;
core
.
temp_var
[
0
]
=
(
ptr
)
pextra
;
if
(
core
.
summon_count
[
sumplayer
]
<
get_summon_count_limit
(
sumplayer
))
if
(
core
.
summon_count
[
sumplayer
]
<
get_summon_count_limit
(
sumplayer
))
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
sumplayer
,
91
);
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
sumplayer
,
91
);
else
else
...
@@ -1076,7 +1076,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
...
@@ -1076,7 +1076,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
returns
.
ivalue
[
0
]
=
FALSE
;
returns
.
ivalue
[
0
]
=
FALSE
;
effect
*
pextra
=
target
->
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
);
effect
*
pextra
=
target
->
is_affected_by_effect
(
EFFECT_EXTRA_SUMMON_COUNT
);
if
(
pextra
)
{
if
(
pextra
)
{
core
.
temp_var
[
0
]
=
pextra
;
core
.
temp_var
[
0
]
=
(
ptr
)
pextra
;
if
(
core
.
summon_count
[
sumplayer
]
<
get_summon_count_limit
(
sumplayer
))
if
(
core
.
summon_count
[
sumplayer
]
<
get_summon_count_limit
(
sumplayer
))
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
sumplayer
,
91
);
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
sumplayer
,
91
);
else
else
...
@@ -1341,7 +1341,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
...
@@ -1341,7 +1341,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
else
{
else
{
if
(
min
==
0
&&
get_useable_count
(
setplayer
,
LOCATION_MZONE
)
>
0
)
{
if
(
min
==
0
&&
get_useable_count
(
setplayer
,
LOCATION_MZONE
)
>
0
)
{
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
setplayer
,
90
);
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
setplayer
,
90
);
core
.
temp_var
[
0
]
=
(
void
*
)
required
;
core
.
temp_var
[
0
]
=
required
;
core
.
units
.
begin
()
->
step
=
9
;
core
.
units
.
begin
()
->
step
=
9
;
}
else
}
else
add_process
(
PROCESSOR_SELECT_TRIBUTE
,
0
,
0
,
0
,
setplayer
,
required
);
add_process
(
PROCESSOR_SELECT_TRIBUTE
,
0
,
0
,
0
,
setplayer
,
required
);
...
@@ -1386,7 +1386,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
...
@@ -1386,7 +1386,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
returns
.
ivalue
[
0
]
=
FALSE
;
returns
.
ivalue
[
0
]
=
FALSE
;
effect
*
pextra
=
target
->
is_affected_by_effect
(
EFFECT_EXTRA_SET_COUNT
);
effect
*
pextra
=
target
->
is_affected_by_effect
(
EFFECT_EXTRA_SET_COUNT
);
if
(
pextra
)
{
if
(
pextra
)
{
core
.
temp_var
[
0
]
=
pextra
;
core
.
temp_var
[
0
]
=
(
ptr
)
pextra
;
if
(
core
.
summon_count
[
setplayer
]
<
get_summon_count_limit
(
setplayer
))
if
(
core
.
summon_count
[
setplayer
]
<
get_summon_count_limit
(
setplayer
))
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
setplayer
,
91
);
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
setplayer
,
91
);
else
else
...
...
ocgcore/processor.cpp
View file @
2b06d328
...
@@ -2851,6 +2851,7 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2851,6 +2851,7 @@ int32 field::process_battle_command(uint16 step) {
uint32
a
=
core
.
attacker
->
get_attack
(),
d
;
uint32
a
=
core
.
attacker
->
get_attack
(),
d
;
uint8
pa
=
core
.
attacker
->
current
.
controler
,
pd
;
uint8
pa
=
core
.
attacker
->
current
.
controler
,
pd
;
uint8
damp
=
0
;
uint8
damp
=
0
;
effect
*
damchange
=
0
;
core
.
battle_damage
[
0
]
=
core
.
battle_damage
[
1
]
=
0
;
core
.
battle_damage
[
0
]
=
core
.
battle_damage
[
1
]
=
0
;
card
*
reason_card
=
0
;
card
*
reason_card
=
0
;
core
.
attacker
->
set_status
(
STATUS_BATTLE_DESTROYED
,
FALSE
);
core
.
attacker
->
set_status
(
STATUS_BATTLE_DESTROYED
,
FALSE
);
...
@@ -2860,9 +2861,14 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2860,9 +2861,14 @@ int32 field::process_battle_command(uint16 step) {
if
(
core
.
attack_target
->
is_position
(
POS_ATTACK
))
{
if
(
core
.
attack_target
->
is_position
(
POS_ATTACK
))
{
d
=
core
.
attack_target
->
get_attack
();
d
=
core
.
attack_target
->
get_attack
();
if
(
a
>
d
)
{
if
(
a
>
d
)
{
if
(
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
damchange
=
core
.
attacker
->
is_affected_by_effect
(
EFFECT_BATTLE_DAMAGE_TO_EFFECT
);
&&
!
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
core
.
attacker
)
if
(
damchange
)
{
&&
!
is_player_affected_by_effect
(
pd
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
damp
=
pd
;
core
.
battle_damage
[
damp
]
=
a
-
d
;
reason_card
=
core
.
attacker
;
}
else
if
(
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
&&
!
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
core
.
attacker
)
&&
!
is_player_affected_by_effect
(
pd
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
if
(
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_REFLECT_BATTLE_DAMAGE
,
core
.
attacker
))
if
(
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_REFLECT_BATTLE_DAMAGE
,
core
.
attacker
))
damp
=
1
-
pd
;
damp
=
1
-
pd
;
else
damp
=
pd
;
else
damp
=
pd
;
...
@@ -2874,9 +2880,14 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2874,9 +2880,14 @@ int32 field::process_battle_command(uint16 step) {
if
(
core
.
attack_target
->
is_destructable_by_battle
(
core
.
attacker
))
if
(
core
.
attack_target
->
is_destructable_by_battle
(
core
.
attacker
))
core
.
attack_target
->
set_status
(
STATUS_BATTLE_DESTROYED
,
TRUE
);
core
.
attack_target
->
set_status
(
STATUS_BATTLE_DESTROYED
,
TRUE
);
}
else
if
(
a
<
d
)
{
}
else
if
(
a
<
d
)
{
if
(
!
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
damchange
=
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_BATTLE_DAMAGE_TO_EFFECT
);
&&
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
core
.
attack_target
)
if
(
damchange
)
{
&&
!
is_player_affected_by_effect
(
pa
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
damp
=
pa
;
core
.
battle_damage
[
damp
]
=
d
-
a
;
reason_card
=
core
.
attack_target
;
}
else
if
(
!
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
&&
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
core
.
attack_target
)
&&
!
is_player_affected_by_effect
(
pa
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
if
(
core
.
attacker
->
is_affected_by_effect
(
EFFECT_REFLECT_BATTLE_DAMAGE
,
core
.
attack_target
))
if
(
core
.
attacker
->
is_affected_by_effect
(
EFFECT_REFLECT_BATTLE_DAMAGE
,
core
.
attack_target
))
damp
=
1
-
pa
;
damp
=
1
-
pa
;
else
damp
=
pa
;
else
damp
=
pa
;
...
@@ -2929,9 +2940,14 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2929,9 +2940,14 @@ int32 field::process_battle_command(uint16 step) {
if
(
core
.
attack_target
->
is_destructable_by_battle
(
core
.
attacker
))
if
(
core
.
attack_target
->
is_destructable_by_battle
(
core
.
attacker
))
core
.
attack_target
->
set_status
(
STATUS_BATTLE_DESTROYED
,
TRUE
);
core
.
attack_target
->
set_status
(
STATUS_BATTLE_DESTROYED
,
TRUE
);
}
else
if
(
a
<
d
)
{
}
else
if
(
a
<
d
)
{
if
(
!
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
damchange
=
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_BATTLE_DAMAGE_TO_EFFECT
);
&&
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
core
.
attack_target
)
if
(
damchange
)
{
&&
!
is_player_affected_by_effect
(
pa
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
damp
=
pa
;
core
.
battle_damage
[
damp
]
=
d
-
a
;
reason_card
=
core
.
attack_target
;
}
else
if
(
!
core
.
attack_target
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
&&
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_AVOID_BATTLE_DAMAGE
,
core
.
attack_target
)
&&
!
is_player_affected_by_effect
(
pa
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
if
(
core
.
attacker
->
is_affected_by_effect
(
EFFECT_REFLECT_BATTLE_DAMAGE
,
core
.
attack_target
))
if
(
core
.
attacker
->
is_affected_by_effect
(
EFFECT_REFLECT_BATTLE_DAMAGE
,
core
.
attack_target
))
damp
=
1
-
pa
;
damp
=
1
-
pa
;
else
damp
=
pa
;
else
damp
=
pa
;
...
@@ -2943,8 +2959,13 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2943,8 +2959,13 @@ int32 field::process_battle_command(uint16 step) {
}
}
}
}
}
else
{
}
else
{
if
(
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
damchange
=
core
.
attacker
->
is_affected_by_effect
(
EFFECT_BATTLE_DAMAGE_TO_EFFECT
);
&&
!
is_player_affected_by_effect
(
1
-
pa
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
if
(
damchange
)
{
damp
=
1
-
pa
;
core
.
battle_damage
[
damp
]
=
a
;
reason_card
=
core
.
attacker
;
}
else
if
(
!
core
.
attacker
->
is_affected_by_effect
(
EFFECT_NO_BATTLE_DAMAGE
)
&&
!
is_player_affected_by_effect
(
1
-
pa
,
EFFECT_AVOID_BATTLE_DAMAGE
))
{
damp
=
1
-
pa
;
damp
=
1
-
pa
;
if
(
is_player_affected_by_effect
(
damp
,
EFFECT_REFLECT_BATTLE_DAMAGE
))
if
(
is_player_affected_by_effect
(
damp
,
EFFECT_REFLECT_BATTLE_DAMAGE
))
damp
=
1
-
damp
;
damp
=
1
-
damp
;
...
@@ -2965,20 +2986,26 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2965,20 +2986,26 @@ int32 field::process_battle_command(uint16 step) {
pduel
->
write_buffer32
(
0
);
pduel
->
write_buffer32
(
0
);
pduel
->
write_buffer8
(
0
);
pduel
->
write_buffer8
(
0
);
}
}
core
.
units
.
begin
()
->
peffect
=
(
effect
*
)
reason_card
;
core
.
units
.
begin
()
->
peffect
=
damchange
;
if
(
reason_card
)
core
.
temp_var
[
0
]
=
reason_card
->
current
.
controler
;
core
.
units
.
begin
()
->
arg1
=
reason_card
->
current
.
controler
;
if
(
!
reason_card
)
if
(
core
.
battle_damage
[
0
])
{
core
.
temp_var
[
1
]
=
0
;
raise_single_event
(
core
.
attacker
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
0
,
core
.
battle_damage
[
0
]);
else
if
(
reason_card
==
core
.
attacker
)
if
(
core
.
attack_target
)
core
.
temp_var
[
1
]
=
1
;
raise_single_event
(
core
.
attack_target
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
0
,
core
.
battle_damage
[
0
]);
else
core
.
temp_var
[
1
]
=
2
;
raise_event
((
card
*
)
reason_card
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
0
,
core
.
battle_damage
[
0
]);
if
(
!
damchange
)
{
}
if
(
core
.
battle_damage
[
0
])
{
if
(
core
.
battle_damage
[
1
])
{
raise_single_event
(
core
.
attacker
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
0
,
core
.
battle_damage
[
0
]);
raise_single_event
(
core
.
attacker
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
1
,
core
.
battle_damage
[
1
]);
if
(
core
.
attack_target
)
if
(
core
.
attack_target
)
raise_single_event
(
core
.
attack_target
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
0
,
core
.
battle_damage
[
0
]);
raise_single_event
(
core
.
attack_target
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
1
,
core
.
battle_damage
[
1
]);
raise_event
((
card
*
)
reason_card
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
0
,
core
.
battle_damage
[
0
]);
raise_event
((
card
*
)
reason_card
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
1
,
core
.
battle_damage
[
1
]);
}
if
(
core
.
battle_damage
[
1
])
{
raise_single_event
(
core
.
attacker
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
1
,
core
.
battle_damage
[
1
]);
if
(
core
.
attack_target
)
raise_single_event
(
core
.
attack_target
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
1
,
core
.
battle_damage
[
1
]);
raise_event
((
card
*
)
reason_card
,
EVENT_PRE_BATTLE_DAMAGE
,
0
,
0
,
reason_card
->
current
.
controler
,
1
,
core
.
battle_damage
[
1
]);
}
}
}
process_single_event
();
process_single_event
();
process_instant_event
();
process_instant_event
();
...
@@ -3003,15 +3030,27 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3003,15 +3030,27 @@ int32 field::process_battle_command(uint16 step) {
core
.
attack_target
->
battled_cards
[
core
.
attacker
->
fieldid
]
=
core
.
attacker
;
core
.
attack_target
->
battled_cards
[
core
.
attacker
->
fieldid
]
=
core
.
attacker
;
}
else
}
else
core
.
attacker
->
battled_cards
[
0
]
=
0
;
core
.
attacker
->
battled_cards
[
0
]
=
0
;
card
*
reason_card
=
(
card
*
)
core
.
units
.
begin
()
->
peffect
;
uint8
reason_player
=
core
.
temp_var
[
0
];
uint8
reason_player
=
core
.
units
.
begin
()
->
arg1
;
card
*
reason_card
=
0
;
if
(
core
.
battle_damage
[
0
])
{
if
(
core
.
temp_var
[
1
]
==
1
)
damage
(
0
,
REASON_BATTLE
,
reason_player
,
reason_card
,
0
,
core
.
battle_damage
[
0
]);
reason_card
=
core
.
attacker
;
raise_single_event
(
reason_card
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
0
,
core
.
battle_damage
[
0
]);
else
if
(
core
.
temp_var
[
1
]
==
2
)
}
reason_card
=
core
.
attack_target
;
if
(
core
.
battle_damage
[
1
])
{
effect
*
damchange
=
core
.
units
.
begin
()
->
peffect
;
damage
(
0
,
REASON_BATTLE
,
reason_player
,
reason_card
,
1
,
core
.
battle_damage
[
1
]);
if
(
!
damchange
)
{
raise_single_event
(
reason_card
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
1
,
core
.
battle_damage
[
1
]);
if
(
core
.
battle_damage
[
0
])
{
damage
(
0
,
REASON_BATTLE
,
reason_player
,
reason_card
,
0
,
core
.
battle_damage
[
0
]);
raise_single_event
(
reason_card
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
0
,
core
.
battle_damage
[
0
]);
}
if
(
core
.
battle_damage
[
1
])
{
damage
(
0
,
REASON_BATTLE
,
reason_player
,
reason_card
,
1
,
core
.
battle_damage
[
1
]);
raise_single_event
(
reason_card
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
1
,
core
.
battle_damage
[
1
]);
}
}
else
{
if
(
core
.
battle_damage
[
0
])
damage
(
damchange
,
REASON_EFFECT
,
reason_player
,
reason_card
,
0
,
core
.
battle_damage
[
0
]);
if
(
core
.
battle_damage
[
1
])
damage
(
damchange
,
REASON_EFFECT
,
reason_player
,
reason_card
,
1
,
core
.
battle_damage
[
1
]);
}
}
reset_phase
(
PHASE_DAMAGE_CAL
);
reset_phase
(
PHASE_DAMAGE_CAL
);
adjust_all
();
adjust_all
();
...
...
script/c14466224.lua
View file @
2b06d328
...
@@ -54,7 +54,7 @@ function c14466224.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -54,7 +54,7 @@ function c14466224.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c14466224
.
eqlimit
(
e
,
c
)
function
c14466224
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c14466224
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c14466224
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -71,23 +71,29 @@ function c14466224.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -71,23 +71,29 @@ function c14466224.eqop(e,tp,eg,ep,ev,re,r,rp)
e
:
SetLabelObject
(
tc
)
e
:
SetLabelObject
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c14466224
.
eqlimit
)
e1
:
SetValue
(
c14466224
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
if
atk
>
0
then
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetValue
(
atk
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
tc
:
RegisterEffect
(
e2
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
local
e3
=
Effect
.
CreateEffect
(
c
)
e2
:
SetValue
(
atk
)
e3
:
SetType
(
EFFECT_TYPE_EQUIP
)
tc
:
RegisterEffect
(
e2
)
e3
:
SetCode
(
EFFECT_UPDATE_DEFENCE
)
end
e3
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
if
def
>
0
then
e3
:
SetValue
(
def
)
local
e3
=
Effect
.
CreateEffect
(
c
)
tc
:
RegisterEffect
(
e3
)
e3
:
SetType
(
EFFECT_TYPE_EQUIP
)
e3
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e3
:
SetCode
(
EFFECT_UPDATE_DEFENCE
)
e3
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e3
:
SetValue
(
def
)
tc
:
RegisterEffect
(
e3
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
end
end
end
end
script/c21249921.lua
View file @
2b06d328
...
@@ -48,6 +48,7 @@ function c21249921.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -48,6 +48,7 @@ function c21249921.eqop(e,tp,eg,ep,ev,re,r,rp)
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c21249921
.
eqlimit
)
e1
:
SetValue
(
c21249921
.
eqlimit
)
...
@@ -55,7 +56,7 @@ function c21249921.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -55,7 +56,7 @@ function c21249921.eqop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
end
function
c21249921
.
eqlimit
(
e
,
c
)
function
c21249921
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c21249921
.
atkcost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
function
c21249921
.
atkcost
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
...
script/c23756165.lua
View file @
2b06d328
...
@@ -76,13 +76,14 @@ function c23756165.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -76,13 +76,14 @@ function c23756165.eqop(e,tp,eg,ep,ev,re,r,rp)
e
:
GetLabelObject
():
SetLabelObject
(
tc
)
e
:
GetLabelObject
():
SetLabelObject
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c23756165
.
eqlimit
)
e1
:
SetValue
(
c23756165
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
c23756165
.
repval
)
e2
:
SetValue
(
c23756165
.
repval
)
...
...
script/c25682811.lua
View file @
2b06d328
...
@@ -14,7 +14,7 @@ function c25682811.initial_effect(c)
...
@@ -14,7 +14,7 @@ function c25682811.initial_effect(c)
e1
:
SetTarget
(
c25682811
.
eqtg
)
e1
:
SetTarget
(
c25682811
.
eqtg
)
e1
:
SetOperation
(
c25682811
.
eqop
)
e1
:
SetOperation
(
c25682811
.
eqop
)
c
:
RegisterEffect
(
e1
)
c
:
RegisterEffect
(
e1
)
--
equi
p
--
atku
p
local
e2
=
Effect
.
CreateEffect
(
c
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_SINGLE
)
e2
:
SetType
(
EFFECT_TYPE_SINGLE
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
...
@@ -50,6 +50,7 @@ function c25682811.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -50,6 +50,7 @@ function c25682811.eqop(e,tp,eg,ep,ev,re,r,rp)
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c25682811
.
eqlimit
)
e1
:
SetValue
(
c25682811
.
eqlimit
)
...
@@ -58,7 +59,7 @@ function c25682811.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -58,7 +59,7 @@ function c25682811.eqop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
end
function
c25682811
.
eqlimit
(
e
,
c
)
function
c25682811
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c25682811
.
atkval
(
e
,
c
)
function
c25682811
.
atkval
(
e
,
c
)
return
c
:
GetEquipGroup
():
FilterCount
(
Card
.
IsSetCard
,
nil
,
0x29
)
*
300
return
c
:
GetEquipGroup
():
FilterCount
(
Card
.
IsSetCard
,
nil
,
0x29
)
*
300
...
...
script/c28183605.lua
View file @
2b06d328
...
@@ -45,6 +45,7 @@ function c28183605.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -45,6 +45,7 @@ function c28183605.eqop(e,tp,eg,ep,ev,re,r,rp)
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c28183605
.
eqlimit
)
e1
:
SetValue
(
c28183605
.
eqlimit
)
...
@@ -52,5 +53,5 @@ function c28183605.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -52,5 +53,5 @@ function c28183605.eqop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
end
function
c28183605
.
eqlimit
(
e
,
c
)
function
c28183605
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
script/c31930787.lua
View file @
2b06d328
...
@@ -83,7 +83,7 @@ function c31930787.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -83,7 +83,7 @@ function c31930787.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c31930787
.
eqlimit
(
e
,
c
)
function
c31930787
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c31930787
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c31930787
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -96,17 +96,20 @@ function c31930787.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -96,17 +96,20 @@ function c31930787.eqop(e,tp,eg,ep,ev,re,r,rp)
--Add Equip limit
--Add Equip limit
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c31930787
.
eqlimit
)
e1
:
SetValue
(
c31930787
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
if
atk
>
0
then
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetValue
(
atk
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
tc
:
RegisterEffect
(
e2
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
atk
)
tc
:
RegisterEffect
(
e2
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
end
end
end
end
...
...
script/c39987164.lua
View file @
2b06d328
...
@@ -42,7 +42,7 @@ function c39987164.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -42,7 +42,7 @@ function c39987164.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c39987164
.
eqlimit
(
e
,
c
)
function
c39987164
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c39987164
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c39987164
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -54,7 +54,7 @@ function c39987164.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -54,7 +54,7 @@ function c39987164.eqop(e,tp,eg,ep,ev,re,r,rp)
tc
:
RegisterFlagEffect
(
39987164
,
RESET_EVENT
+
0x1fe0000
,
0
,
0
)
tc
:
RegisterFlagEffect
(
39987164
,
RESET_EVENT
+
0x1fe0000
,
0
,
0
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c39987164
.
eqlimit
)
e1
:
SetValue
(
c39987164
.
eqlimit
)
...
...
script/c4545683.lua
View file @
2b06d328
...
@@ -102,17 +102,20 @@ function c4545683.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -102,17 +102,20 @@ function c4545683.eqop(e,tp,eg,ep,ev,re,r,rp)
--Add Equip limit
--Add Equip limit
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c4545683
.
eqlimit
)
e1
:
SetValue
(
c4545683
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
if
atk
>
0
then
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetValue
(
atk
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
tc
:
RegisterEffect
(
e2
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
atk
)
tc
:
RegisterEffect
(
e2
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
end
end
end
end
...
...
script/c50140163.lua
View file @
2b06d328
...
@@ -62,13 +62,14 @@ function c50140163.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -62,13 +62,14 @@ function c50140163.eqop(e,tp,eg,ep,ev,re,r,rp)
e
:
GetLabelObject
():
SetLabelObject
(
tc
)
e
:
GetLabelObject
():
SetLabelObject
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c50140163
.
eqlimit
)
e1
:
SetValue
(
c50140163
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetProperty
(
EFFECT_FLAG_SET_AVAILABLE
)
e2
:
SetProperty
(
EFFECT_FLAG_SET_AVAILABLE
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
...
...
script/c54578613.lua
View file @
2b06d328
...
@@ -42,6 +42,7 @@ function c54578613.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -42,6 +42,7 @@ function c54578613.eqop(e,tp,eg,ep,ev,re,r,rp)
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c54578613
.
eqlimit
)
e1
:
SetValue
(
c54578613
.
eqlimit
)
...
@@ -49,7 +50,7 @@ function c54578613.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -49,7 +50,7 @@ function c54578613.eqop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
end
function
c54578613
.
eqlimit
(
e
,
c
)
function
c54578613
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c54578613
.
costfilter
(
c
)
function
c54578613
.
costfilter
(
c
)
return
c
:
IsFaceup
()
and
c
:
IsSetCard
(
0x29
)
and
c
:
IsAbleToGraveAsCost
()
return
c
:
IsFaceup
()
and
c
:
IsSetCard
(
0x29
)
and
c
:
IsAbleToGraveAsCost
()
...
...
script/c57784563.lua
View file @
2b06d328
...
@@ -40,7 +40,7 @@ function c57784563.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -40,7 +40,7 @@ function c57784563.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c57784563
.
eqlimit
(
e
,
c
)
function
c57784563
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c57784563
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c57784563
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -54,12 +54,13 @@ function c57784563.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -54,12 +54,13 @@ function c57784563.eqop(e,tp,eg,ep,ev,re,r,rp)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c57784563
.
eqlimit
)
e1
:
SetValue
(
c57784563
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetProperty
(
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
1
)
e2
:
SetValue
(
1
)
...
...
script/c63465535.lua
View file @
2b06d328
...
@@ -52,7 +52,7 @@ function c63465535.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -52,7 +52,7 @@ function c63465535.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c63465535
.
eqlimit
(
e
,
c
)
function
c63465535
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c63465535
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c63465535
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -66,12 +66,13 @@ function c63465535.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -66,12 +66,13 @@ function c63465535.eqop(e,tp,eg,ep,ev,re,r,rp)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c63465535
.
eqlimit
)
e1
:
SetValue
(
c63465535
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
c63465535
.
repval
)
e2
:
SetValue
(
c63465535
.
repval
)
...
...
script/c63519819.lua
View file @
2b06d328
...
@@ -44,7 +44,7 @@ function c63519819.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -44,7 +44,7 @@ function c63519819.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c63519819
.
eqlimit
(
e
,
c
)
function
c63519819
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c63519819
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c63519819
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -53,31 +53,37 @@ function c63519819.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -53,31 +53,37 @@ function c63519819.eqop(e,tp,eg,ep,ev,re,r,rp)
if
c
:
IsFaceup
()
and
c
:
IsRelateToEffect
(
e
)
then
if
c
:
IsFaceup
()
and
c
:
IsRelateToEffect
(
e
)
then
local
atk
=
tc
:
GetTextAttack
()
local
atk
=
tc
:
GetTextAttack
()
local
def
=
tc
:
GetTextDefence
()
local
def
=
tc
:
GetTextDefence
()
if
atk
<
0
then
atk
=
0
end
if
c
:
IsFacedown
()
or
atk
<
0
then
atk
=
0
end
if
def
<
0
then
def
=
0
end
if
c
:
IsFacedown
()
or
def
<
0
then
def
=
0
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
--Add Equip limit
--Add Equip limit
tc
:
RegisterFlagEffect
(
63519819
,
RESET_EVENT
+
0x1fe0000
,
0
,
0
)
tc
:
RegisterFlagEffect
(
63519819
,
RESET_EVENT
+
0x1fe0000
,
0
,
0
)
e
:
SetLabelObject
(
tc
)
e
:
SetLabelObject
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c63519819
.
eqlimit
)
e1
:
SetValue
(
c63519819
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
if
atk
>
0
then
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCode
(
EFFECT_SET_ATTACK
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetValue
(
atk
)
e2
:
SetCode
(
EFFECT_SET_ATTACK
)
tc
:
RegisterEffect
(
e2
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
local
e3
=
Effect
.
CreateEffect
(
c
)
e2
:
SetValue
(
atk
)
e3
:
SetType
(
EFFECT_TYPE_EQUIP
)
tc
:
RegisterEffect
(
e2
)
e3
:
SetCode
(
EFFECT_SET_DEFENCE
)
end
e3
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
if
def
>
0
then
e3
:
SetValue
(
def
)
local
e3
=
Effect
.
CreateEffect
(
c
)
tc
:
RegisterEffect
(
e3
)
e3
:
SetType
(
EFFECT_TYPE_EQUIP
)
e3
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e3
:
SetCode
(
EFFECT_SET_DEFENCE
)
e3
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e3
:
SetValue
(
def
)
tc
:
RegisterEffect
(
e3
)
end
local
e4
=
Effect
.
CreateEffect
(
c
)
local
e4
=
Effect
.
CreateEffect
(
c
)
e4
:
SetType
(
EFFECT_TYPE_EQUIP
)
e4
:
SetType
(
EFFECT_TYPE_EQUIP
)
e4
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e4
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
...
...
script/c64631466.lua
View file @
2b06d328
...
@@ -15,14 +15,11 @@ function c64631466.initial_effect(c)
...
@@ -15,14 +15,11 @@ function c64631466.initial_effect(c)
c
:
RegisterEffect
(
e1
)
c
:
RegisterEffect
(
e1
)
--damage
--damage
local
e2
=
Effect
.
CreateEffect
(
c
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetDescription
(
aux
.
Stringid
(
64631466
,
1
))
e2
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_CONTINUOUS
)
e2
:
SetCategory
(
CATEGORY_DAMAGE
)
e2
:
SetProperty
(
EFFECT_FLAG_AVAILABLE_BD
)
e2
:
SetType
(
EFFECT_TYPE_FIELD
+
EFFECT_TYPE_TRIGGER_F
)
e2
:
SetProperty
(
EFFECT_FLAG_PLAYER_TARGET
)
e2
:
SetCode
(
EVENT_DAMAGE
)
e2
:
SetCode
(
EVENT_DAMAGE
)
e2
:
SetRange
(
LOCATION_MZONE
)
e2
:
SetRange
(
LOCATION_MZONE
)
e2
:
SetCondition
(
c64631466
.
damcon
)
e2
:
SetCondition
(
c64631466
.
damcon
)
e2
:
SetTarget
(
c64631466
.
damtg
)
e2
:
SetOperation
(
c64631466
.
damop
)
e2
:
SetOperation
(
c64631466
.
damop
)
e2
:
SetLabelObject
(
e1
)
e2
:
SetLabelObject
(
e1
)
c
:
RegisterEffect
(
e2
)
c
:
RegisterEffect
(
e2
)
...
@@ -41,7 +38,7 @@ function c64631466.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -41,7 +38,7 @@ function c64631466.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c64631466
.
eqlimit
(
e
,
c
)
function
c64631466
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c64631466
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c64631466
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -50,31 +47,37 @@ function c64631466.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -50,31 +47,37 @@ function c64631466.eqop(e,tp,eg,ep,ev,re,r,rp)
if
c
:
IsFaceup
()
and
c
:
IsRelateToEffect
(
e
)
then
if
c
:
IsFaceup
()
and
c
:
IsRelateToEffect
(
e
)
then
local
atk
=
tc
:
GetTextAttack
()
local
atk
=
tc
:
GetTextAttack
()
local
def
=
tc
:
GetTextDefence
()
local
def
=
tc
:
GetTextDefence
()
if
atk
<
0
then
atk
=
0
end
if
c
:
IsFacedown
()
or
atk
<
0
then
atk
=
0
end
if
def
<
0
then
def
=
0
end
if
c
:
IsFacedown
()
or
def
<
0
then
def
=
0
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
,
false
)
then
return
end
--Add Equip limit
--Add Equip limit
tc
:
RegisterFlagEffect
(
64631466
,
RESET_EVENT
+
0x1fe0000
,
0
,
0
)
tc
:
RegisterFlagEffect
(
64631466
,
RESET_EVENT
+
0x1fe0000
,
0
,
0
)
e
:
SetLabelObject
(
tc
)
e
:
SetLabelObject
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c64631466
.
eqlimit
)
e1
:
SetValue
(
c64631466
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
if
atk
>
0
then
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCode
(
EFFECT_SET_ATTACK
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetValue
(
atk
)
e2
:
SetCode
(
EFFECT_SET_ATTACK
)
tc
:
RegisterEffect
(
e2
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
local
e3
=
Effect
.
CreateEffect
(
c
)
e2
:
SetValue
(
atk
)
e3
:
SetType
(
EFFECT_TYPE_EQUIP
)
tc
:
RegisterEffect
(
e2
)
e3
:
SetCode
(
EFFECT_SET_DEFENCE
)
end
e3
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
if
def
>
0
then
e3
:
SetValue
(
def
)
local
e3
=
Effect
.
CreateEffect
(
c
)
tc
:
RegisterEffect
(
e3
)
e3
:
SetType
(
EFFECT_TYPE_EQUIP
)
e3
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e3
:
SetCode
(
EFFECT_SET_DEFENCE
)
e3
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e3
:
SetValue
(
def
)
tc
:
RegisterEffect
(
e3
)
end
local
e4
=
Effect
.
CreateEffect
(
c
)
local
e4
=
Effect
.
CreateEffect
(
c
)
e4
:
SetType
(
EFFECT_TYPE_EQUIP
)
e4
:
SetType
(
EFFECT_TYPE_EQUIP
)
e4
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e4
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
...
@@ -90,16 +93,9 @@ function c64631466.repval(e,re,r,rp)
...
@@ -90,16 +93,9 @@ function c64631466.repval(e,re,r,rp)
end
end
function
c64631466
.
damcon
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c64631466
.
damcon
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
ec
=
e
:
GetLabelObject
():
GetLabelObject
()
local
ec
=
e
:
GetLabelObject
():
GetLabelObject
()
return
ec
and
ec
:
IsRelateToCard
(
e
:
GetHandler
())
and
ep
==
tp
and
bit
.
band
(
r
,
REASON_BATTLE
)
~=
0
return
ec
and
ec
:
GetFlagEffect
(
64631466
)
~=
0
and
ep
==
tp
and
bit
.
band
(
r
,
REASON_BATTLE
)
~=
0
and
(
Duel
.
GetAttacker
()
==
e
:
GetHandler
()
or
Duel
.
GetAttackTarget
()
==
e
:
GetHandler
())
and
(
Duel
.
GetAttacker
()
==
e
:
GetHandler
()
or
Duel
.
GetAttackTarget
()
==
e
:
GetHandler
())
end
end
function
c64631466
.
damtg
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
function
c64631466
.
damop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
chk
==
0
then
return
true
end
Duel
.
Damage
(
1
-
tp
,
ev
,
REASON_EFFECT
)
Duel
.
SetTargetPlayer
(
1
-
tp
)
Duel
.
SetTargetParam
(
ev
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_DAMAGE
,
nil
,
0
,
1
-
tp
,
ev
)
end
function
c64631466
.
damop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
,
chk
)
local
p
,
d
=
Duel
.
GetChainInfo
(
0
,
CHAININFO_TARGET_PLAYER
,
CHAININFO_TARGET_PARAM
)
Duel
.
Damage
(
p
,
d
,
REASON_EFFECT
)
end
end
script/c68140974.lua
View file @
2b06d328
...
@@ -87,7 +87,7 @@ function c68140974.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -87,7 +87,7 @@ function c68140974.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c68140974
.
eqlimit
(
e
,
c
)
function
c68140974
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c68140974
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c68140974
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -100,17 +100,20 @@ function c68140974.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -100,17 +100,20 @@ function c68140974.eqop(e,tp,eg,ep,ev,re,r,rp)
--Add Equip limit
--Add Equip limit
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c68140974
.
eqlimit
)
e1
:
SetValue
(
c68140974
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
if
atk
>
0
then
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetValue
(
atk
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
tc
:
RegisterEffect
(
e2
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
atk
)
tc
:
RegisterEffect
(
e2
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
end
end
end
end
...
...
script/c83965310.lua
View file @
2b06d328
...
@@ -60,7 +60,7 @@ function c83965310.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
...
@@ -60,7 +60,7 @@ function c83965310.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
Duel
.
SetOperationInfo
(
0
,
CATEGORY_EQUIP
,
g
,
1
,
0
,
0
)
end
end
function
c83965310
.
eqlimit
(
e
,
c
)
function
c83965310
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c83965310
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c83965310
.
eqop
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
c
=
e
:
GetHandler
()
local
c
=
e
:
GetHandler
()
...
@@ -76,17 +76,20 @@ function c83965310.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -76,17 +76,20 @@ function c83965310.eqop(e,tp,eg,ep,ev,re,r,rp)
e
:
SetLabelObject
(
tc
)
e
:
SetLabelObject
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c83965310
.
eqlimit
)
e1
:
SetValue
(
c83965310
.
eqlimit
)
tc
:
RegisterEffect
(
e1
)
tc
:
RegisterEffect
(
e1
)
local
e2
=
Effect
.
CreateEffect
(
c
)
if
atk
>
0
then
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetValue
(
atk
)
e2
:
SetCode
(
EFFECT_UPDATE_ATTACK
)
tc
:
RegisterEffect
(
e2
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
atk
)
tc
:
RegisterEffect
(
e2
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
else
Duel
.
SendtoGrave
(
tc
,
REASON_EFFECT
)
end
end
end
end
end
script/c87257460.lua
View file @
2b06d328
...
@@ -57,7 +57,7 @@ function c87257460.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -57,7 +57,7 @@ function c87257460.eqop(e,tp,eg,ep,ev,re,r,rp)
e
:
SetLabelObject
(
tc
)
e
:
SetLabelObject
(
tc
)
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c87257460
.
eqlimit
)
e1
:
SetValue
(
c87257460
.
eqlimit
)
...
@@ -65,6 +65,7 @@ function c87257460.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -65,6 +65,7 @@ function c87257460.eqop(e,tp,eg,ep,ev,re,r,rp)
local
e2
=
Effect
.
CreateEffect
(
c
)
local
e2
=
Effect
.
CreateEffect
(
c
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetType
(
EFFECT_TYPE_EQUIP
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetCode
(
EFFECT_DESTROY_SUBSTITUTE
)
e2
:
SetProperty
(
EFFECT_FLAG_IGNORE_IMMUNE
+
EFFECT_FLAG_OWNER_RELATE
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e2
:
SetValue
(
c87257460
.
repval
)
e2
:
SetValue
(
c87257460
.
repval
)
tc
:
RegisterEffect
(
e2
)
tc
:
RegisterEffect
(
e2
)
...
...
script/c93157004.lua
View file @
2b06d328
...
@@ -154,7 +154,7 @@ function c93157004.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -154,7 +154,7 @@ function c93157004.eqop(e,tp,eg,ep,ev,re,r,rp)
if
not
Duel
.
Equip
(
tp
,
tc
,
c
)
then
return
end
if
not
Duel
.
Equip
(
tp
,
tc
,
c
)
then
return
end
local
e1
=
Effect
.
CreateEffect
(
c
)
local
e1
=
Effect
.
CreateEffect
(
c
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetType
(
EFFECT_TYPE_SINGLE
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
)
e1
:
SetProperty
(
EFFECT_FLAG_COPY_INHERIT
+
EFFECT_FLAG_OWNER_RELATE
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetCode
(
EFFECT_EQUIP_LIMIT
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetReset
(
RESET_EVENT
+
0x1fe0000
)
e1
:
SetValue
(
c93157004
.
eqlimit
)
e1
:
SetValue
(
c93157004
.
eqlimit
)
...
@@ -162,7 +162,7 @@ function c93157004.eqop(e,tp,eg,ep,ev,re,r,rp)
...
@@ -162,7 +162,7 @@ function c93157004.eqop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
end
function
c93157004
.
eqlimit
(
e
,
c
)
function
c93157004
.
eqlimit
(
e
,
c
)
return
e
:
GetOwner
()
==
c
and
not
c
:
IsDisabled
()
return
e
:
GetOwner
()
==
c
end
end
function
c93157004
.
discon
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c93157004
.
discon
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
return
not
e
:
GetHandler
():
IsStatus
(
STATUS_BATTLE_DESTROYED
)
and
Duel
.
GetChainInfo
(
ev
,
CHAININFO_TYPE
)
==
TYPE_MONSTER
return
not
e
:
GetHandler
():
IsStatus
(
STATUS_BATTLE_DESTROYED
)
and
Duel
.
GetChainInfo
(
ev
,
CHAININFO_TYPE
)
==
TYPE_MONSTER
...
...
script/constant.lua
View file @
2b06d328
...
@@ -232,6 +232,8 @@ EFFECT_FLAG_SPSUM_PARAM =0x100000 --
...
@@ -232,6 +232,8 @@ EFFECT_FLAG_SPSUM_PARAM =0x100000 --
EFFECT_FLAG_REPEAT
=
0x200000
--
EFFECT_FLAG_REPEAT
=
0x200000
--
EFFECT_FLAG_NO_TURN_RESET
=
0x400000
--
EFFECT_FLAG_NO_TURN_RESET
=
0x400000
--
EFFECT_FLAG_EVENT_PLAYER
=
0x800000
--
EFFECT_FLAG_EVENT_PLAYER
=
0x800000
--
EFFECT_FLAG_OWNER_RELATE
=
0x1000000
--
EFFECT_FLAG_AVAILABLE_BD
=
0x2000000
--
--========== Codes ==========
--========== Codes ==========
EFFECT_IMMUNE_EFFECT
=
1
--
EFFECT_IMMUNE_EFFECT
=
1
--
EFFECT_DISABLE
=
2
--
EFFECT_DISABLE
=
2
--
...
@@ -373,6 +375,7 @@ EFFECT_AVOID_BATTLE_DAMAGE =201
...
@@ -373,6 +375,7 @@ EFFECT_AVOID_BATTLE_DAMAGE =201
EFFECT_REFLECT_BATTLE_DAMAGE
=
202
EFFECT_REFLECT_BATTLE_DAMAGE
=
202
EFFECT_PIERCE
=
203
EFFECT_PIERCE
=
203
EFFECT_BATTLE_DESTROY_REDIRECT
=
204
EFFECT_BATTLE_DESTROY_REDIRECT
=
204
EFFECT_BATTLE_DAMAGE_TO_EFFECT
=
205
EFFECT_TOSS_COIN_REPLACE
=
220
EFFECT_TOSS_COIN_REPLACE
=
220
EFFECT_TOSS_DICE_REPLACE
=
221
EFFECT_TOSS_DICE_REPLACE
=
221
EFFECT_FUSION_MATERIAL
=
230
EFFECT_FUSION_MATERIAL
=
230
...
...
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