Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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
xiaoye
ygopro-core
Commits
f7fe6fe4
Commit
f7fe6fe4
authored
Mar 13, 2024
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
c146c549
a04fddec
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
447 additions
and
354 deletions
+447
-354
card.cpp
card.cpp
+98
-141
card.h
card.h
+6
-4
card_data.h
card_data.h
+51
-13
common.h
common.h
+22
-20
duel.cpp
duel.cpp
+1
-1
field.cpp
field.cpp
+2
-2
field.h
field.h
+21
-14
interpreter.cpp
interpreter.cpp
+43
-42
libcard.cpp
libcard.cpp
+3
-3
libduel.cpp
libduel.cpp
+75
-28
ocgapi.h
ocgapi.h
+0
-1
operations.cpp
operations.cpp
+86
-59
playerop.cpp
playerop.cpp
+26
-18
processor.cpp
processor.cpp
+12
-8
scriptlib.h
scriptlib.h
+1
-0
No files found.
card.cpp
View file @
f7fe6fe4
This diff is collapsed.
Click to expand it.
card.h
View file @
f7fe6fe4
...
@@ -26,7 +26,7 @@ struct chain;
...
@@ -26,7 +26,7 @@ struct chain;
struct
card_state
{
struct
card_state
{
uint32
code
{
0
};
uint32
code
{
0
};
uint32
code2
{
0
};
uint32
code2
{
0
};
std
::
vector
<
uint
32
>
setcode
;
std
::
vector
<
uint
16_t
>
setcode
;
uint32
type
{
0
};
uint32
type
{
0
};
uint32
level
{
0
};
uint32
level
{
0
};
uint32
rank
{
0
};
uint32
rank
{
0
};
...
@@ -218,6 +218,7 @@ public:
...
@@ -218,6 +218,7 @@ public:
std
::
tuple
<
uint32
,
uint32
>
get_original_code_rule
()
const
;
std
::
tuple
<
uint32
,
uint32
>
get_original_code_rule
()
const
;
uint32
get_code
();
uint32
get_code
();
uint32
get_another_code
();
uint32
get_another_code
();
static
bool
check_card_setcode
(
uint32
code
,
uint32
value
);
int32
is_set_card
(
uint32
set_code
);
int32
is_set_card
(
uint32
set_code
);
int32
is_origin_set_card
(
uint32
set_code
);
int32
is_origin_set_card
(
uint32
set_code
);
int32
is_pre_set_card
(
uint32
set_code
);
int32
is_pre_set_card
(
uint32
set_code
);
...
@@ -341,6 +342,7 @@ public:
...
@@ -341,6 +342,7 @@ public:
int32
is_spsummonable
(
effect
*
proc
,
material_info
info
=
null_info
);
int32
is_spsummonable
(
effect
*
proc
,
material_info
info
=
null_info
);
int32
is_summonable
(
effect
*
proc
,
uint8
min_tribute
,
uint32
zone
=
0x1f
,
uint32
releasable
=
0xff00ff
);
int32
is_summonable
(
effect
*
proc
,
uint8
min_tribute
,
uint32
zone
=
0x1f
,
uint32
releasable
=
0xff00ff
);
int32
is_can_be_summoned
(
uint8
playerid
,
uint8
ingore_count
,
effect
*
peffect
,
uint8
min_tribute
,
uint32
zone
=
0x1f
);
int32
is_can_be_summoned
(
uint8
playerid
,
uint8
ingore_count
,
effect
*
peffect
,
uint8
min_tribute
,
uint32
zone
=
0x1f
);
int32
is_summon_negatable
(
uint32
sumtype
,
effect
*
reason_effect
);
int32
get_summon_tribute_count
();
int32
get_summon_tribute_count
();
int32
get_set_tribute_count
();
int32
get_set_tribute_count
();
int32
is_can_be_flip_summoned
(
uint8
playerid
);
int32
is_can_be_flip_summoned
(
uint8
playerid
);
...
@@ -362,7 +364,7 @@ public:
...
@@ -362,7 +364,7 @@ public:
int32
is_releasable_by_effect
(
uint8
playerid
,
effect
*
reason_effect
);
int32
is_releasable_by_effect
(
uint8
playerid
,
effect
*
reason_effect
);
int32
is_capable_send_to_grave
(
uint8
playerid
);
int32
is_capable_send_to_grave
(
uint8
playerid
);
int32
is_capable_send_to_hand
(
uint8
playerid
);
int32
is_capable_send_to_hand
(
uint8
playerid
);
int32
is_capable_send_to_deck
(
uint8
playerid
);
int32
is_capable_send_to_deck
(
uint8
playerid
,
uint8
send_activating
=
FALSE
);
int32
is_capable_send_to_extra
(
uint8
playerid
);
int32
is_capable_send_to_extra
(
uint8
playerid
);
int32
is_capable_cost_to_grave
(
uint8
playerid
);
int32
is_capable_cost_to_grave
(
uint8
playerid
);
int32
is_capable_cost_to_hand
(
uint8
playerid
);
int32
is_capable_cost_to_hand
(
uint8
playerid
);
...
@@ -407,6 +409,8 @@ public:
...
@@ -407,6 +409,8 @@ public:
#define SUMMON_VALUE_CUSTOM_TYPE 0x0000ffff
#define SUMMON_VALUE_CUSTOM_TYPE 0x0000ffff
constexpr
uint32
DEFAULT_SUMMON_TYPE
=
SUMMON_VALUE_MAIN_TYPE
|
SUMMON_VALUE_SUB_TYPE
|
SUMMON_VALUE_CUSTOM_TYPE
;
constexpr
uint32
DEFAULT_SUMMON_TYPE
=
SUMMON_VALUE_MAIN_TYPE
|
SUMMON_VALUE_SUB_TYPE
|
SUMMON_VALUE_CUSTOM_TYPE
;
#define SUMMON_VALUE_FUTURE_FUSION 0x18
//Counter
//Counter
#define COUNTER_WITHOUT_PERMIT 0x1000
#define COUNTER_WITHOUT_PERMIT 0x1000
//#define COUNTER_NEED_ENABLE 0x2000
//#define COUNTER_NEED_ENABLE 0x2000
...
@@ -434,6 +438,4 @@ constexpr uint32 DEFAULT_SUMMON_TYPE = SUMMON_VALUE_MAIN_TYPE | SUMMON_VALUE_SUB
...
@@ -434,6 +438,4 @@ constexpr uint32 DEFAULT_SUMMON_TYPE = SUMMON_VALUE_MAIN_TYPE | SUMMON_VALUE_SUB
#define SUMMON_INFO_REASON_EFFECT 0x200
#define SUMMON_INFO_REASON_EFFECT 0x200
#define SUMMON_INFO_REASON_PLAYER 0x400
#define SUMMON_INFO_REASON_PLAYER 0x400
#define CARD_ARTWORK_VERSIONS_OFFSET 10
#endif
/* CARD_H_ */
#endif
/* CARD_H_ */
card_data.h
View file @
f7fe6fe4
#ifndef CARD_DATA_H_
#ifndef CARD_DATA_H_
#define CARD_DATA_H_
#define CARD_DATA_H_
#include "common.h"
constexpr
int
CARD_ARTWORK_VERSIONS_OFFSET
=
20
;
constexpr
int
SIZE_SETCODE
=
16
;
constexpr
int
CARD_BLACK_LUSTER_SOLDIER2
=
5405695
;
struct
card_data
{
struct
card_data
{
uint32
code
{
0
};
uint32
code
{};
uint32
alias
{
0
};
uint32
alias
{};
uint
64
setcode
{
0
};
uint
16_t
setcode
[
SIZE_SETCODE
]{
};
uint32
type
{
0
};
uint32
type
{};
uint32
level
{
0
};
uint32
level
{};
uint32
attribute
{
0
};
uint32
attribute
{};
uint32
race
{
0
};
uint32
race
{};
int32
attack
{
0
};
int32
attack
{};
int32
defense
{
0
};
int32
defense
{};
uint32
lscale
{
0
};
uint32
lscale
{};
uint32
rscale
{
0
};
uint32
rscale
{};
uint32
link_marker
{
0
};
uint32
link_marker
{};
void
clear
()
{
void
clear
()
{
code
=
0
;
code
=
0
;
alias
=
0
;
alias
=
0
;
setcode
=
0
;
for
(
auto
&
x
:
setcode
)
x
=
0
;
type
=
0
;
type
=
0
;
level
=
0
;
level
=
0
;
attribute
=
0
;
attribute
=
0
;
...
@@ -29,6 +36,37 @@ struct card_data {
...
@@ -29,6 +36,37 @@ struct card_data {
rscale
=
0
;
rscale
=
0
;
link_marker
=
0
;
link_marker
=
0
;
}
}
bool
is_setcode
(
uint32
value
)
const
{
uint16_t
settype
=
value
&
0x0fff
;
uint16_t
setsubtype
=
value
&
0xf000
;
for
(
auto
&
x
:
setcode
)
{
if
((
x
&
0x0fff
)
==
settype
&&
(
x
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
true
;
if
(
!
x
)
return
false
;
}
return
false
;
}
bool
is_alternative
()
const
{
if
(
code
==
CARD_BLACK_LUSTER_SOLDIER2
)
return
false
;
return
alias
&&
(
alias
<
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
code
<
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
);
}
void
set_setcode
(
uint64
value
)
{
int
ctr
=
0
;
while
(
value
)
{
if
(
value
&
0xffff
)
{
setcode
[
ctr
]
=
value
&
0xffff
;
++
ctr
;
}
value
>>=
16
;
}
for
(
int
i
=
ctr
;
i
<
SIZE_SETCODE
;
++
i
)
setcode
[
i
]
=
0
;
}
};
};
#endif
/* CARD_DATA_H_ */
#endif
/* CARD_DATA_H_ */
common.h
View file @
f7fe6fe4
...
@@ -30,6 +30,7 @@ typedef signed char int8;
...
@@ -30,6 +30,7 @@ typedef signed char int8;
#define TRUE 1
#define TRUE 1
#define FALSE 0
#define FALSE 0
#define SIZE_MESSAGE_BUFFER 0x2000
#define SIZE_MESSAGE_BUFFER 0x2000
#define SIZE_RETURN_VALUE 128
#define PROCESSOR_BUFFER_LEN 0x0fffffff
#define PROCESSOR_BUFFER_LEN 0x0fffffff
#define PROCESSOR_FLAG 0xf0000000
#define PROCESSOR_FLAG 0xf0000000
...
@@ -180,27 +181,27 @@ struct card_sort {
...
@@ -180,27 +181,27 @@ struct card_sort {
#define REASONS_PROCEDURE (REASON_SYNCHRO | REASON_XYZ | REASON_LINK)
#define REASONS_PROCEDURE (REASON_SYNCHRO | REASON_XYZ | REASON_LINK)
//Status
//Status
#define STATUS_DISABLED 0x0001
//
#define STATUS_DISABLED 0x0001
#define STATUS_TO_ENABLE 0x0002
//
#define STATUS_TO_ENABLE 0x0002
#define STATUS_TO_DISABLE 0x0004
//
#define STATUS_TO_DISABLE 0x0004
#define STATUS_PROC_COMPLETE 0x0008
//
#define STATUS_PROC_COMPLETE 0x0008
#define STATUS_SET_TURN 0x0010
//
#define STATUS_SET_TURN 0x0010
#define STATUS_NO_LEVEL 0x0020
//
#define STATUS_NO_LEVEL 0x0020
#define STATUS_BATTLE_RESULT 0x0040
//
#define STATUS_BATTLE_RESULT 0x0040
#define STATUS_SPSUMMON_STEP 0x0080
//
#define STATUS_SPSUMMON_STEP 0x0080
#define STATUS_FORM_CHANGED 0x0100
//
#define STATUS_FORM_CHANGED 0x0100
#define STATUS_SUMMONING 0x0200
//
#define STATUS_SUMMONING 0x0200
#define STATUS_EFFECT_ENABLED 0x0400
//
#define STATUS_EFFECT_ENABLED 0x0400
#define STATUS_SUMMON_TURN 0x0800
//
#define STATUS_SUMMON_TURN 0x0800
#define STATUS_DESTROY_CONFIRMED 0x1000
//
#define STATUS_DESTROY_CONFIRMED 0x1000
#define STATUS_LEAVE_CONFIRMED 0x2000
//
#define STATUS_LEAVE_CONFIRMED 0x2000
#define STATUS_BATTLE_DESTROYED 0x4000
//
#define STATUS_BATTLE_DESTROYED 0x4000
#define STATUS_COPYING_EFFECT 0x8000
//
#define STATUS_COPYING_EFFECT 0x8000
#define STATUS_CHAINING 0x10000
//
#define STATUS_CHAINING 0x10000
#define STATUS_SUMMON_DISABLED 0x20000
//
#define STATUS_SUMMON_DISABLED 0x20000
#define STATUS_ACTIVATE_DISABLED 0x40000
//
#define STATUS_ACTIVATE_DISABLED 0x40000
#define STATUS_EFFECT_REPLACED 0x80000
#define STATUS_EFFECT_REPLACED 0x80000
#define STATUS_F
UTURE_FUSION
0x100000
#define STATUS_F
LIP_SUMMONING
0x100000
#define STATUS_ATTACK_CANCELED 0x200000
#define STATUS_ATTACK_CANCELED 0x200000
#define STATUS_INITIALIZING 0x400000
#define STATUS_INITIALIZING 0x400000
#define STATUS_TO_HAND_WITHOUT_CONFIRM 0x800000
#define STATUS_TO_HAND_WITHOUT_CONFIRM 0x800000
...
@@ -211,6 +212,7 @@ struct card_sort {
...
@@ -211,6 +212,7 @@ struct card_sort {
#define STATUS_OPPO_BATTLE 0x10000000
#define STATUS_OPPO_BATTLE 0x10000000
#define STATUS_FLIP_SUMMON_TURN 0x20000000
#define STATUS_FLIP_SUMMON_TURN 0x20000000
#define STATUS_SPSUMMON_TURN 0x40000000
#define STATUS_SPSUMMON_TURN 0x40000000
#define STATUS_FLIP_SUMMON_DISABLED 0x80000000
//Query list
//Query list
#define QUERY_CODE 0x1
#define QUERY_CODE 0x1
...
...
duel.cpp
View file @
f7fe6fe4
...
@@ -140,7 +140,7 @@ void duel::set_responsei(uint32 resp) {
...
@@ -140,7 +140,7 @@ void duel::set_responsei(uint32 resp) {
game_field
->
returns
.
ivalue
[
0
]
=
resp
;
game_field
->
returns
.
ivalue
[
0
]
=
resp
;
}
}
void
duel
::
set_responseb
(
byte
*
resp
)
{
void
duel
::
set_responseb
(
byte
*
resp
)
{
std
::
memcpy
(
game_field
->
returns
.
bvalue
,
resp
,
64
);
std
::
memcpy
(
game_field
->
returns
.
bvalue
,
resp
,
SIZE_RETURN_VALUE
);
}
}
int32
duel
::
get_next_integer
(
int32
l
,
int32
h
)
{
int32
duel
::
get_next_integer
(
int32
l
,
int32
h
)
{
if
(
game_field
->
core
.
duel_options
&
DUEL_OLD_REPLAY
)
{
if
(
game_field
->
core
.
duel_options
&
DUEL_OLD_REPLAY
)
{
...
...
field.cpp
View file @
f7fe6fe4
...
@@ -629,7 +629,7 @@ int32 field::get_useable_count(card* pcard, uint8 playerid, uint8 location, uint
...
@@ -629,7 +629,7 @@ int32 field::get_useable_count(card* pcard, uint8 playerid, uint8 location, uint
return
get_useable_count_other
(
pcard
,
playerid
,
location
,
uplayer
,
reason
,
zone
,
list
);
return
get_useable_count_other
(
pcard
,
playerid
,
location
,
uplayer
,
reason
,
zone
,
list
);
}
}
/**
/**
* @param pcard the card about to move from Extra Deck (
NULL
means any card in Extra Deck)
* @param pcard the card about to move from Extra Deck (
nullptr
means any card in Extra Deck)
* @return usable count in zone of playerid's MZONE for pcard
* @return usable count in zone of playerid's MZONE for pcard
*/
*/
int32
field
::
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
int32
field
::
get_useable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
...
@@ -659,7 +659,7 @@ int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, ui
...
@@ -659,7 +659,7 @@ int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, ui
return
get_tofield_count
(
pcard
,
playerid
,
LOCATION_MZONE
,
playerid
,
LOCATION_REASON_TOFIELD
,
zone
,
list
);
return
get_tofield_count
(
pcard
,
playerid
,
LOCATION_MZONE
,
playerid
,
LOCATION_REASON_TOFIELD
,
zone
,
list
);
}
}
/**
/**
* @param pcard the card about to move from Extra Deck (
NULL
means any card in Extra Deck)
* @param pcard the card about to move from Extra Deck (
nullptr
means any card in Extra Deck)
* @return the number of available grids in zone of playerid's MZONE for pcard
* @return the number of available grids in zone of playerid's MZONE for pcard
*/
*/
int32
field
::
get_spsummonable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
int32
field
::
get_spsummonable_count_fromex
(
card
*
pcard
,
uint8
playerid
,
uint8
uplayer
,
uint32
zone
,
uint32
*
list
)
{
...
...
field.h
View file @
f7fe6fe4
...
@@ -155,11 +155,14 @@ struct processor_unit {
...
@@ -155,11 +155,14 @@ struct processor_unit {
int32
value3
{
0
};
int32
value3
{
0
};
int32
value4
{
0
};
int32
value4
{
0
};
};
};
constexpr
int
SIZE_SVALUE
=
SIZE_RETURN_VALUE
/
2
;
constexpr
int
SIZE_IVALUE
=
SIZE_RETURN_VALUE
/
4
;
constexpr
int
SIZE_LVALUE
=
SIZE_RETURN_VALUE
/
8
;
union
return_value
{
union
return_value
{
int8
bvalue
[
64
];
int8
bvalue
[
SIZE_RETURN_VALUE
];
int16
svalue
[
32
];
int16
svalue
[
SIZE_SVALUE
];
int32
ivalue
[
16
];
int32
ivalue
[
SIZE_IVALUE
];
int64
lvalue
[
8
];
int64
lvalue
[
SIZE_LVALUE
];
};
};
struct
processor
{
struct
processor
{
using
effect_vector
=
std
::
vector
<
effect
*>
;
using
effect_vector
=
std
::
vector
<
effect
*>
;
...
@@ -276,6 +279,8 @@ struct processor {
...
@@ -276,6 +279,8 @@ struct processor {
uint8
summon_cancelable
{
FALSE
};
uint8
summon_cancelable
{
FALSE
};
card
*
attacker
{
nullptr
};
card
*
attacker
{
nullptr
};
card
*
attack_target
{
nullptr
};
card
*
attack_target
{
nullptr
};
uint8
attacker_player
{
PLAYER_NONE
};
uint8
attack_target_player
{
PLAYER_NONE
};
uint32
limit_extra_summon_zone
{
0
};
uint32
limit_extra_summon_zone
{
0
};
uint32
limit_extra_summon_releasable
{
0
};
uint32
limit_extra_summon_releasable
{
0
};
card
*
limit_tuner
{
nullptr
};
card
*
limit_tuner
{
nullptr
};
...
@@ -308,6 +313,8 @@ struct processor {
...
@@ -308,6 +313,8 @@ struct processor {
uint8
coin_result
[
MAX_COIN_COUNT
]{};
uint8
coin_result
[
MAX_COIN_COUNT
]{};
int32
coin_count
{
0
};
int32
coin_count
{
0
};
bool
is_target_ready
{
false
};
bool
is_target_ready
{
false
};
bool
is_gemini_summoning
{
false
};
bool
is_summon_negated
{
false
};
uint8
to_bp
{
FALSE
};
uint8
to_bp
{
FALSE
};
uint8
to_m2
{
FALSE
};
uint8
to_m2
{
FALSE
};
...
@@ -427,7 +434,7 @@ public:
...
@@ -427,7 +434,7 @@ public:
int32
get_release_list
(
uint8
playerid
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_oneof
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exc
,
group
*
exg
,
uint32
reason
);
int32
get_release_list
(
uint8
playerid
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_oneof
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exc
,
group
*
exg
,
uint32
reason
);
int32
check_release_list
(
uint8
playerid
,
int32
count
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exc
,
group
*
exg
,
uint32
reason
);
int32
check_release_list
(
uint8
playerid
,
int32
count
,
int32
use_con
,
int32
use_hand
,
int32
fun
,
int32
exarg
,
card
*
exc
,
group
*
exg
,
uint32
reason
);
int32
get_summon_release_list
(
card
*
target
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_oneof
,
group
*
mg
=
NULL
,
uint32
ex
=
0
,
uint32
releasable
=
0xff00ff
,
uint32
pos
=
0x1
);
int32
get_summon_release_list
(
card
*
target
,
card_set
*
release_list
,
card_set
*
ex_list
,
card_set
*
ex_list_oneof
,
group
*
mg
=
nullptr
,
uint32
ex
=
0
,
uint32
releasable
=
0xff00ff
,
uint32
pos
=
0x1
);
int32
get_summon_count_limit
(
uint8
playerid
);
int32
get_summon_count_limit
(
uint8
playerid
);
int32
get_draw_count
(
uint8
playerid
);
int32
get_draw_count
(
uint8
playerid
);
void
get_ritual_material
(
uint8
playerid
,
effect
*
peffect
,
card_set
*
material
,
uint8
no_level
=
FALSE
);
void
get_ritual_material
(
uint8
playerid
,
effect
*
peffect
,
card_set
*
material
,
uint8
no_level
=
FALSE
);
...
@@ -570,8 +577,8 @@ public:
...
@@ -570,8 +577,8 @@ public:
void
destroy
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
=
2
,
uint32
destination
=
0
,
uint32
sequence
=
0
);
void
destroy
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
=
2
,
uint32
destination
=
0
,
uint32
sequence
=
0
);
void
release
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
release
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
release
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
release
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
send_to
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
);
void
send_to
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
send_to
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
);
void
send_to
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
move_to_field
(
card
*
target
,
uint32
move_player
,
uint32
playerid
,
uint32
destination
,
uint32
positions
,
uint32
enable
=
FALSE
,
uint32
ret
=
0
,
uint32
pzone
=
FALSE
,
uint32
zone
=
0xff
);
void
move_to_field
(
card
*
target
,
uint32
move_player
,
uint32
playerid
,
uint32
destination
,
uint32
positions
,
uint32
enable
=
FALSE
,
uint32
ret
=
0
,
uint32
pzone
=
FALSE
,
uint32
zone
=
0xff
);
void
change_position
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
au
,
uint32
ad
,
uint32
du
,
uint32
dd
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
change_position
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
au
,
uint32
ad
,
uint32
du
,
uint32
dd
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
change_position
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
npos
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
change_position
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
npos
,
uint32
flag
,
uint32
enable
=
FALSE
);
...
@@ -603,7 +610,7 @@ public:
...
@@ -603,7 +610,7 @@ public:
int32
release_replace
(
uint16
step
,
group
*
targets
,
card
*
target
);
int32
release_replace
(
uint16
step
,
group
*
targets
,
card
*
target
);
int32
release
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
);
int32
release
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
);
int32
send_replace
(
uint16
step
,
group
*
targets
,
card
*
target
);
int32
send_replace
(
uint16
step
,
group
*
targets
,
card
*
target
);
int32
send_to
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
);
int32
send_to
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
send_activating
);
int32
discard_deck
(
uint16
step
,
uint8
playerid
,
uint8
count
,
uint32
reason
);
int32
discard_deck
(
uint16
step
,
uint8
playerid
,
uint8
count
,
uint32
reason
);
int32
move_to_field
(
uint16
step
,
card
*
target
,
uint32
enable
,
uint32
ret
,
uint32
pzone
,
uint32
zone
);
int32
move_to_field
(
uint16
step
,
card
*
target
,
uint32
enable
,
uint32
ret
,
uint32
pzone
,
uint32
zone
);
int32
change_position
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint8
reason_player
,
uint32
enable
);
int32
change_position
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint8
reason_player
,
uint32
enable
);
...
@@ -759,17 +766,17 @@ public:
...
@@ -759,17 +766,17 @@ public:
#define PROCESSOR_DESTROY_REPLACE 56
#define PROCESSOR_DESTROY_REPLACE 56
#define PROCESSOR_RELEASE_REPLACE 57
#define PROCESSOR_RELEASE_REPLACE 57
#define PROCESSOR_SENDTO_REPLACE 58
#define PROCESSOR_SENDTO_REPLACE 58
#define PROCESSOR_SUMMON_RULE 60
//arg1, arg2
#define PROCESSOR_SUMMON_RULE 60
#define PROCESSOR_SPSUMMON_RULE 61
//arg1, arg2, arg3
#define PROCESSOR_SPSUMMON_RULE 61
#define PROCESSOR_SPSUMMON 62
#define PROCESSOR_SPSUMMON 62
#define PROCESSOR_FLIP_SUMMON 63
//arg1, arg2
#define PROCESSOR_FLIP_SUMMON 63
#define PROCESSOR_MSET 64
//arg1, arg2
#define PROCESSOR_MSET 64
#define PROCESSOR_SSET 65
#define PROCESSOR_SSET 65
#define PROCESSOR_SPSUMMON_STEP 66
#define PROCESSOR_SPSUMMON_STEP 66
#define PROCESSOR_SSET_G 67
#define PROCESSOR_SSET_G 67
#define PROCESSOR_DRAW 70
#define PROCESSOR_DRAW 70
#define PROCESSOR_DAMAGE 71
//arg1, arg2, arg3
#define PROCESSOR_DAMAGE 71
#define PROCESSOR_RECOVER 72
//arg1, arg2, arg3
#define PROCESSOR_RECOVER 72
#define PROCESSOR_EQUIP 73
#define PROCESSOR_EQUIP 73
#define PROCESSOR_GET_CONTROL 74
#define PROCESSOR_GET_CONTROL 74
#define PROCESSOR_SWAP_CONTROL 75
#define PROCESSOR_SWAP_CONTROL 75
...
...
interpreter.cpp
View file @
f7fe6fe4
...
@@ -48,21 +48,22 @@ interpreter::~interpreter() {
...
@@ -48,21 +48,22 @@ interpreter::~interpreter() {
}
}
int32
interpreter
::
register_card
(
card
*
pcard
)
{
int32
interpreter
::
register_card
(
card
*
pcard
)
{
//create a card in by userdata
//create a card in by userdata
luaL_checkstack
(
lua_state
,
1
,
NULL
);
luaL_checkstack
(
lua_state
,
1
,
nullptr
);
luaL_checkstack
(
current_state
,
1
,
NULL
);
luaL_checkstack
(
current_state
,
1
,
nullptr
);
card
**
ppcard
=
(
card
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
card
*
));
card
**
ppcard
=
(
card
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
card
*
));
//+1 userdata
*
ppcard
=
pcard
;
*
ppcard
=
pcard
;
pcard
->
ref_handle
=
luaL_ref
(
lua_state
,
LUA_REGISTRYINDEX
);
pcard
->
ref_handle
=
luaL_ref
(
lua_state
,
LUA_REGISTRYINDEX
);
//-1
//some userdata may be created in script like token so use current_state
//some userdata may be created in script like token so use current_state
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
pcard
->
ref_handle
);
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
pcard
->
ref_handle
);
//+1 userdata
//load script
//load script
if
(
pcard
->
data
.
alias
&&
(
pcard
->
data
.
alias
<
pcard
->
data
.
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
pcard
->
data
.
code
<
pcard
->
data
.
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
))
if
(
pcard
->
data
.
is_alternative
(
))
load_card_script
(
pcard
->
data
.
alias
);
load_card_script
(
pcard
->
data
.
alias
);
else
else
load_card_script
(
pcard
->
data
.
code
);
load_card_script
(
pcard
->
data
.
code
);
//stack: table cxxx, userdata
//set metatable of pointer to base script
//set metatable of pointer to base script
lua_setmetatable
(
current_state
,
-
2
);
lua_setmetatable
(
current_state
,
-
2
);
//-1
lua_pop
(
current_state
,
1
);
lua_pop
(
current_state
,
1
);
//-1
//Initial
//Initial
if
(
pcard
->
data
.
code
&&
(
!
(
pcard
->
data
.
type
&
TYPE_NORMAL
)
||
(
pcard
->
data
.
type
&
TYPE_PENDULUM
)))
{
if
(
pcard
->
data
.
code
&&
(
!
(
pcard
->
data
.
type
&
TYPE_NORMAL
)
||
(
pcard
->
data
.
type
&
TYPE_PENDULUM
)))
{
pcard
->
set_status
(
STATUS_INITIALIZING
,
TRUE
);
pcard
->
set_status
(
STATUS_INITIALIZING
,
TRUE
);
...
@@ -77,7 +78,7 @@ void interpreter::register_effect(effect *peffect) {
...
@@ -77,7 +78,7 @@ void interpreter::register_effect(effect *peffect) {
if
(
!
peffect
)
if
(
!
peffect
)
return
;
return
;
//create a effect in by userdata
//create a effect in by userdata
luaL_checkstack
(
lua_state
,
3
,
NULL
);
luaL_checkstack
(
lua_state
,
3
,
nullptr
);
effect
**
ppeffect
=
(
effect
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
effect
*
));
effect
**
ppeffect
=
(
effect
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
effect
*
));
*
ppeffect
=
peffect
;
*
ppeffect
=
peffect
;
peffect
->
ref_handle
=
luaL_ref
(
lua_state
,
LUA_REGISTRYINDEX
);
peffect
->
ref_handle
=
luaL_ref
(
lua_state
,
LUA_REGISTRYINDEX
);
...
@@ -107,7 +108,7 @@ void interpreter::register_group(group *pgroup) {
...
@@ -107,7 +108,7 @@ void interpreter::register_group(group *pgroup) {
if
(
!
pgroup
)
if
(
!
pgroup
)
return
;
return
;
//create a group in by userdata
//create a group in by userdata
luaL_checkstack
(
lua_state
,
3
,
NULL
);
luaL_checkstack
(
lua_state
,
3
,
nullptr
);
group
**
ppgroup
=
(
group
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
group
*
));
group
**
ppgroup
=
(
group
**
)
lua_newuserdata
(
lua_state
,
sizeof
(
group
*
));
*
ppgroup
=
pgroup
;
*
ppgroup
=
pgroup
;
pgroup
->
ref_handle
=
luaL_ref
(
lua_state
,
LUA_REGISTRYINDEX
);
pgroup
->
ref_handle
=
luaL_ref
(
lua_state
,
LUA_REGISTRYINDEX
);
...
@@ -143,32 +144,32 @@ int32 interpreter::load_script(const char* script_name) {
...
@@ -143,32 +144,32 @@ int32 interpreter::load_script(const char* script_name) {
int32
interpreter
::
load_card_script
(
uint32
code
)
{
int32
interpreter
::
load_card_script
(
uint32
code
)
{
char
class_name
[
20
];
char
class_name
[
20
];
sprintf
(
class_name
,
"c%d"
,
code
);
sprintf
(
class_name
,
"c%d"
,
code
);
luaL_checkstack
(
current_state
,
1
,
NULL
);
luaL_checkstack
(
current_state
,
1
,
nullptr
);
lua_getglobal
(
current_state
,
class_name
);
lua_getglobal
(
current_state
,
class_name
);
//+1 table cxxx
//if script is not loaded, create and load it
//if script is not loaded, create and load it
if
(
lua_isnil
(
current_state
,
-
1
))
{
if
(
lua_isnil
(
current_state
,
-
1
))
{
luaL_checkstack
(
current_state
,
5
,
NULL
);
luaL_checkstack
(
current_state
,
5
,
nullptr
);
lua_pop
(
current_state
,
1
);
lua_pop
(
current_state
,
1
);
//-1
//create a table & set metatable
//create a table & set metatable
lua_createtable
(
current_state
,
0
,
0
);
lua_createtable
(
current_state
,
0
,
0
);
//+1, {}
lua_setglobal
(
current_state
,
class_name
);
lua_setglobal
(
current_state
,
class_name
);
//-1
lua_getglobal
(
current_state
,
class_name
);
lua_getglobal
(
current_state
,
class_name
);
//+1 table cxxx
lua_getglobal
(
current_state
,
"Card"
);
lua_getglobal
(
current_state
,
"Card"
);
//+1 Card, table cxxx
lua_setmetatable
(
current_state
,
-
2
);
lua_setmetatable
(
current_state
,
-
2
);
//-1 table cxxx
lua_pushstring
(
current_state
,
"__index"
);
lua_pushstring
(
current_state
,
"__index"
);
//+1 "__index", table cxxx
lua_pushvalue
(
current_state
,
-
2
);
lua_pushvalue
(
current_state
,
-
2
);
//+1 table cxxx, "__index", table cxxx
lua_rawset
(
current_state
,
-
3
);
lua_rawset
(
current_state
,
-
3
);
//-2 table cxxx
lua_getglobal
(
current_state
,
class_name
);
lua_getglobal
(
current_state
,
class_name
);
//+1
lua_setglobal
(
current_state
,
"self_table"
);
lua_setglobal
(
current_state
,
"self_table"
);
//-1
lua_pushinteger
(
current_state
,
code
);
lua_pushinteger
(
current_state
,
code
);
//+1
lua_setglobal
(
current_state
,
"self_code"
);
lua_setglobal
(
current_state
,
"self_code"
);
//-1
char
script_name
[
64
];
char
script_name
[
64
];
sprintf
(
script_name
,
"./script/c%d.lua"
,
code
);
sprintf
(
script_name
,
"./script/c%d.lua"
,
code
);
int32
res
=
load_script
(
script_name
);
int32
res
=
load_script
(
script_name
);
lua_pushnil
(
current_state
);
lua_pushnil
(
current_state
);
//+1
lua_setglobal
(
current_state
,
"self_table"
);
lua_setglobal
(
current_state
,
"self_table"
);
//-1
lua_pushnil
(
current_state
);
lua_pushnil
(
current_state
);
//+1
lua_setglobal
(
current_state
,
"self_code"
);
lua_setglobal
(
current_state
,
"self_code"
);
//-1 table cxxx {__index: cxxx }
if
(
!
res
)
{
if
(
!
res
)
{
return
OPERATION_FAIL
;
return
OPERATION_FAIL
;
}
}
...
@@ -190,7 +191,7 @@ void interpreter::add_param(int32 param, int32 type, bool front) {
...
@@ -190,7 +191,7 @@ void interpreter::add_param(int32 param, int32 type, bool front) {
void
interpreter
::
push_param
(
lua_State
*
L
,
bool
is_coroutine
)
{
void
interpreter
::
push_param
(
lua_State
*
L
,
bool
is_coroutine
)
{
int32
pushed
=
0
;
int32
pushed
=
0
;
for
(
const
auto
&
it
:
params
)
{
for
(
const
auto
&
it
:
params
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
luaL_checkstack
(
L
,
1
,
nullptr
);
uint32
type
=
it
.
second
;
uint32
type
=
it
.
second
;
switch
(
type
)
{
switch
(
type
)
{
case
PARAM_TYPE_INT
:
case
PARAM_TYPE_INT
:
...
@@ -300,7 +301,7 @@ int32 interpreter::call_card_function(card* pcard, const char* f, uint32 param_c
...
@@ -300,7 +301,7 @@ int32 interpreter::call_card_function(card* pcard, const char* f, uint32 param_c
return
OPERATION_FAIL
;
return
OPERATION_FAIL
;
}
}
card2value
(
current_state
,
pcard
);
card2value
(
current_state
,
pcard
);
luaL_checkstack
(
current_state
,
1
,
NULL
);
luaL_checkstack
(
current_state
,
1
,
nullptr
);
lua_getfield
(
current_state
,
-
1
,
f
);
lua_getfield
(
current_state
,
-
1
,
f
);
if
(
!
lua_isfunction
(
current_state
,
-
1
))
{
if
(
!
lua_isfunction
(
current_state
,
-
1
))
{
sprintf
(
pduel
->
strbuffer
,
"
\"
CallCardFunction
\"
(c%d.%s): attempt to call an error function"
,
pcard
->
data
.
code
,
f
);
sprintf
(
pduel
->
strbuffer
,
"
\"
CallCardFunction
\"
(c%d.%s): attempt to call an error function"
,
pcard
->
data
.
code
,
f
);
...
@@ -341,7 +342,7 @@ int32 interpreter::call_code_function(uint32 code, const char* f, uint32 param_c
...
@@ -341,7 +342,7 @@ int32 interpreter::call_code_function(uint32 code, const char* f, uint32 param_c
return
OPERATION_FAIL
;
return
OPERATION_FAIL
;
}
}
load_card_script
(
code
);
load_card_script
(
code
);
luaL_checkstack
(
current_state
,
1
,
NULL
);
luaL_checkstack
(
current_state
,
1
,
nullptr
);
lua_getfield
(
current_state
,
-
1
,
f
);
lua_getfield
(
current_state
,
-
1
,
f
);
if
(
!
lua_isfunction
(
current_state
,
-
1
))
{
if
(
!
lua_isfunction
(
current_state
,
-
1
))
{
sprintf
(
pduel
->
strbuffer
,
"
\"
CallCodeFunction
\"
: attempt to call an error function"
);
sprintf
(
pduel
->
strbuffer
,
"
\"
CallCodeFunction
\"
: attempt to call an error function"
);
...
@@ -405,7 +406,7 @@ int32 interpreter::check_matching(card* pcard, int32 findex, int32 extraargs) {
...
@@ -405,7 +406,7 @@ int32 interpreter::check_matching(card* pcard, int32 findex, int32 extraargs) {
return
TRUE
;
return
TRUE
;
++
no_action
;
++
no_action
;
++
call_depth
;
++
call_depth
;
luaL_checkstack
(
current_state
,
1
+
extraargs
,
NULL
);
luaL_checkstack
(
current_state
,
1
+
extraargs
,
nullptr
);
lua_pushvalue
(
current_state
,
findex
);
lua_pushvalue
(
current_state
,
findex
);
interpreter
::
card2value
(
current_state
,
pcard
);
interpreter
::
card2value
(
current_state
,
pcard
);
for
(
int32
i
=
0
;
i
<
extraargs
;
++
i
)
for
(
int32
i
=
0
;
i
<
extraargs
;
++
i
)
...
@@ -437,7 +438,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
...
@@ -437,7 +438,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
return
0
;
return
0
;
++
no_action
;
++
no_action
;
++
call_depth
;
++
call_depth
;
luaL_checkstack
(
current_state
,
1
+
extraargs
,
NULL
);
luaL_checkstack
(
current_state
,
1
+
extraargs
,
nullptr
);
lua_pushvalue
(
current_state
,
findex
);
lua_pushvalue
(
current_state
,
findex
);
interpreter
::
card2value
(
current_state
,
pcard
);
interpreter
::
card2value
(
current_state
,
pcard
);
for
(
int32
i
=
0
;
i
<
extraargs
;
++
i
)
for
(
int32
i
=
0
;
i
<
extraargs
;
++
i
)
...
@@ -613,7 +614,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
...
@@ -613,7 +614,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
}
}
}
}
int32
interpreter
::
clone_function_ref
(
int32
func_ref
)
{
int32
interpreter
::
clone_function_ref
(
int32
func_ref
)
{
luaL_checkstack
(
current_state
,
1
,
NULL
);
luaL_checkstack
(
current_state
,
1
,
nullptr
);
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
func_ref
);
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
func_ref
);
int32
ref
=
luaL_ref
(
current_state
,
LUA_REGISTRYINDEX
);
int32
ref
=
luaL_ref
(
current_state
,
LUA_REGISTRYINDEX
);
return
ref
;
return
ref
;
...
@@ -621,7 +622,7 @@ int32 interpreter::clone_function_ref(int32 func_ref) {
...
@@ -621,7 +622,7 @@ int32 interpreter::clone_function_ref(int32 func_ref) {
void
*
interpreter
::
get_ref_object
(
int32
ref_handler
)
{
void
*
interpreter
::
get_ref_object
(
int32
ref_handler
)
{
if
(
ref_handler
==
0
)
if
(
ref_handler
==
0
)
return
nullptr
;
return
nullptr
;
luaL_checkstack
(
current_state
,
1
,
NULL
);
luaL_checkstack
(
current_state
,
1
,
nullptr
);
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
ref_handler
);
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
ref_handler
);
void
*
p
=
*
(
void
**
)
lua_touserdata
(
current_state
,
-
1
);
void
*
p
=
*
(
void
**
)
lua_touserdata
(
current_state
,
-
1
);
lua_pop
(
current_state
,
1
);
lua_pop
(
current_state
,
1
);
...
@@ -629,35 +630,35 @@ void* interpreter::get_ref_object(int32 ref_handler) {
...
@@ -629,35 +630,35 @@ void* interpreter::get_ref_object(int32 ref_handler) {
}
}
//Convert a pointer to a lua value, +1 -0
//Convert a pointer to a lua value, +1 -0
void
interpreter
::
card2value
(
lua_State
*
L
,
card
*
pcard
)
{
void
interpreter
::
card2value
(
lua_State
*
L
,
card
*
pcard
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
luaL_checkstack
(
L
,
1
,
nullptr
);
if
(
!
pcard
||
pcard
->
ref_handle
==
0
)
if
(
!
pcard
||
pcard
->
ref_handle
==
0
)
lua_pushnil
(
L
);
lua_pushnil
(
L
);
else
else
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
pcard
->
ref_handle
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
pcard
->
ref_handle
);
}
}
void
interpreter
::
group2value
(
lua_State
*
L
,
group
*
pgroup
)
{
void
interpreter
::
group2value
(
lua_State
*
L
,
group
*
pgroup
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
luaL_checkstack
(
L
,
1
,
nullptr
);
if
(
!
pgroup
||
pgroup
->
ref_handle
==
0
)
if
(
!
pgroup
||
pgroup
->
ref_handle
==
0
)
lua_pushnil
(
L
);
lua_pushnil
(
L
);
else
else
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
pgroup
->
ref_handle
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
pgroup
->
ref_handle
);
}
}
void
interpreter
::
effect2value
(
lua_State
*
L
,
effect
*
peffect
)
{
void
interpreter
::
effect2value
(
lua_State
*
L
,
effect
*
peffect
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
luaL_checkstack
(
L
,
1
,
nullptr
);
if
(
!
peffect
||
peffect
->
ref_handle
==
0
)
if
(
!
peffect
||
peffect
->
ref_handle
==
0
)
lua_pushnil
(
L
);
lua_pushnil
(
L
);
else
else
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
peffect
->
ref_handle
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
peffect
->
ref_handle
);
}
}
void
interpreter
::
function2value
(
lua_State
*
L
,
int32
func_ref
)
{
void
interpreter
::
function2value
(
lua_State
*
L
,
int32
func_ref
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
luaL_checkstack
(
L
,
1
,
nullptr
);
if
(
!
func_ref
)
if
(
!
func_ref
)
lua_pushnil
(
L
);
lua_pushnil
(
L
);
else
else
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
func_ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
func_ref
);
}
}
int32
interpreter
::
get_function_handle
(
lua_State
*
L
,
int32
index
)
{
int32
interpreter
::
get_function_handle
(
lua_State
*
L
,
int32
index
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
luaL_checkstack
(
L
,
1
,
nullptr
);
lua_pushvalue
(
L
,
index
);
lua_pushvalue
(
L
,
index
);
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
return
ref
;
return
ref
;
...
...
libcard.cpp
View file @
f7fe6fe4
...
@@ -2528,9 +2528,9 @@ int32 scriptlib::card_is_chain_attackable(lua_State *L) {
...
@@ -2528,9 +2528,9 @@ int32 scriptlib::card_is_chain_attackable(lua_State *L) {
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
return
1
;
return
1
;
}
}
pduel
->
game_field
->
core
.
select_cards
.
clear
()
;
field
::
card_vector
cv
;
pduel
->
game_field
->
get_attack_target
(
attacker
,
&
pduel
->
game_field
->
core
.
select_cards
,
TRUE
);
pduel
->
game_field
->
get_attack_target
(
attacker
,
&
cv
,
TRUE
);
if
(
pduel
->
game_field
->
core
.
select_cards
.
size
()
==
0
&&
(
monsteronly
||
attacker
->
direct_attackable
==
0
))
if
(
cv
.
size
()
==
0
&&
(
monsteronly
||
attacker
->
direct_attackable
==
0
))
lua_pushboolean
(
L
,
0
);
lua_pushboolean
(
L
,
0
);
else
else
lua_pushboolean
(
L
,
1
);
lua_pushboolean
(
L
,
1
);
...
...
libduel.cpp
View file @
f7fe6fe4
This diff is collapsed.
Click to expand it.
ocgapi.h
View file @
f7fe6fe4
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
class
card
;
class
card
;
struct
card_data
;
struct
card_data
;
struct
card_info
;
class
group
;
class
group
;
class
effect
;
class
effect
;
class
interpreter
;
class
interpreter
;
...
...
operations.cpp
View file @
f7fe6fe4
This diff is collapsed.
Click to expand it.
playerop.cpp
View file @
f7fe6fe4
...
@@ -226,8 +226,11 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
...
@@ -226,8 +226,11 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
returns
.
bvalue
[
0
]
=
0
;
returns
.
bvalue
[
0
]
=
0
;
if
(
max
==
0
||
core
.
select_cards
.
empty
())
if
(
max
==
0
||
core
.
select_cards
.
empty
())
return
TRUE
;
return
TRUE
;
if
(
max
>
127
)
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
max
=
127
;
if
(
core
.
select_cards
.
size
()
>
UINT8_MAX
)
core
.
select_cards
.
resize
(
UINT8_MAX
);
if
(
max
>
SIZE_RETURN_VALUE
-
1
)
max
=
SIZE_RETURN_VALUE
-
1
;
if
(
max
>
core
.
select_cards
.
size
())
if
(
max
>
core
.
select_cards
.
size
())
max
=
(
uint8
)
core
.
select_cards
.
size
();
max
=
(
uint8
)
core
.
select_cards
.
size
();
if
(
min
>
max
)
if
(
min
>
max
)
...
@@ -245,7 +248,6 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
...
@@ -245,7 +248,6 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
...
@@ -282,6 +284,11 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
...
@@ -282,6 +284,11 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
returns
.
bvalue
[
i
+
1
]
=
i
;
returns
.
bvalue
[
i
+
1
]
=
i
;
return
TRUE
;
return
TRUE
;
}
}
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
if
(
core
.
select_cards
.
size
()
>
UINT8_MAX
)
core
.
select_cards
.
resize
(
UINT8_MAX
);
if
(
core
.
unselect_cards
.
size
()
>
UINT8_MAX
)
core
.
unselect_cards
.
resize
(
UINT8_MAX
);
pduel
->
write_buffer8
(
MSG_SELECT_UNSELECT_CARD
);
pduel
->
write_buffer8
(
MSG_SELECT_UNSELECT_CARD
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
finishable
);
pduel
->
write_buffer8
(
finishable
);
...
@@ -289,7 +296,6 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
...
@@ -289,7 +296,6 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
...
@@ -311,7 +317,7 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
...
@@ -311,7 +317,7 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
pduel
->
write_buffer8
(
MSG_RETRY
);
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
return
FALSE
;
}
}
uint8
m
=
(
uint8
)
core
.
select_cards
.
size
()
+
(
uint8
)
core
.
unselect_cards
.
size
();
int32
m
=
core
.
select_cards
.
size
()
+
core
.
unselect_cards
.
size
();
uint8
v
=
returns
.
bvalue
[
1
];
uint8
v
=
returns
.
bvalue
[
1
];
if
(
v
<
0
||
v
>=
m
)
{
if
(
v
<
0
||
v
>=
m
)
{
pduel
->
write_buffer8
(
MSG_RETRY
);
pduel
->
write_buffer8
(
MSG_RETRY
);
...
@@ -495,6 +501,9 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
...
@@ -495,6 +501,9 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
returns
.
bvalue
[
0
]
=
0
;
returns
.
bvalue
[
0
]
=
0
;
if
(
max
==
0
||
core
.
select_cards
.
empty
())
if
(
max
==
0
||
core
.
select_cards
.
empty
())
return
TRUE
;
return
TRUE
;
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
if
(
core
.
select_cards
.
size
()
>
UINT8_MAX
)
core
.
select_cards
.
resize
(
UINT8_MAX
);
uint8
tm
=
0
;
uint8
tm
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
for
(
auto
&
pcard
:
core
.
select_cards
)
tm
+=
pcard
->
release_param
;
tm
+=
pcard
->
release_param
;
...
@@ -511,7 +520,6 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
...
@@ -511,7 +520,6 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
...
@@ -591,7 +599,7 @@ int32 field::select_counter(uint16 step, uint8 playerid, uint16 countertype, uin
...
@@ -591,7 +599,7 @@ int32 field::select_counter(uint16 step, uint8 playerid, uint16 countertype, uin
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
uint16
ct
=
0
;
uint16
ct
=
0
;
for
(
uint32
i
=
0
;
i
<
core
.
select_cards
.
size
();
++
i
)
{
for
(
int32
i
=
0
;
i
<
(
int32
)
core
.
select_cards
.
size
();
++
i
)
{
if
(
core
.
select_cards
[
i
]
->
get_counter
(
countertype
)
<
returns
.
svalue
[
i
])
{
if
(
core
.
select_cards
[
i
]
->
get_counter
(
countertype
)
<
returns
.
svalue
[
i
])
{
pduel
->
write_buffer8
(
MSG_RETRY
);
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
return
FALSE
;
...
@@ -620,6 +628,11 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
...
@@ -620,6 +628,11 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
returns
.
bvalue
[
0
]
=
0
;
returns
.
bvalue
[
0
]
=
0
;
if
(
core
.
select_cards
.
empty
())
if
(
core
.
select_cards
.
empty
())
return
TRUE
;
return
TRUE
;
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
if
(
core
.
select_cards
.
size
()
>
UINT8_MAX
)
core
.
select_cards
.
resize
(
UINT8_MAX
);
if
(
core
.
must_select_cards
.
size
()
>
UINT8_MAX
)
core
.
must_select_cards
.
resize
(
UINT8_MAX
);
pduel
->
write_buffer8
(
MSG_SELECT_SUM
);
pduel
->
write_buffer8
(
MSG_SELECT_SUM
);
if
(
max
)
if
(
max
)
pduel
->
write_buffer8
(
0
);
pduel
->
write_buffer8
(
0
);
...
@@ -640,7 +653,6 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
...
@@ -640,7 +653,6 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
pduel
->
write_buffer32
(
pcard
->
sum_param
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
}
}
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
...
@@ -723,6 +735,8 @@ int32 field::sort_card(int16 step, uint8 playerid) {
...
@@ -723,6 +735,8 @@ int32 field::sort_card(int16 step, uint8 playerid) {
}
}
if
(
core
.
select_cards
.
empty
())
if
(
core
.
select_cards
.
empty
())
return
TRUE
;
return
TRUE
;
if
(
core
.
select_cards
.
size
()
>
UINT8_MAX
)
core
.
select_cards
.
resize
(
UINT8_MAX
);
pduel
->
write_buffer8
(
MSG_SORT_CARD
);
pduel
->
write_buffer8
(
MSG_SORT_CARD
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
...
@@ -920,15 +934,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
...
@@ -920,15 +934,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
if
(
stack
.
size
()
>=
1
)
{
if
(
stack
.
size
()
>=
1
)
{
int32
set_code
=
stack
.
top
();
int32
set_code
=
stack
.
top
();
stack
.
pop
();
stack
.
pop
();
uint64
sc
=
cd
.
setcode
;
bool
res
=
cd
.
is_setcode
(
set_code
);
bool
res
=
false
;
uint32
settype
=
set_code
&
0xfff
;
uint32
setsubtype
=
set_code
&
0xf000
;
while
(
sc
)
{
if
((
sc
&
0xfff
)
==
settype
&&
(
sc
&
0xf000
&
setsubtype
)
==
setsubtype
)
res
=
true
;
sc
=
sc
>>
16
;
}
stack
.
push
(
res
);
stack
.
push
(
res
);
}
}
break
;
break
;
...
@@ -966,7 +972,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
...
@@ -966,7 +972,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
if
(
stack
.
size
()
!=
1
||
stack
.
top
()
==
0
)
if
(
stack
.
size
()
!=
1
||
stack
.
top
()
==
0
)
return
FALSE
;
return
FALSE
;
return
cd
.
code
==
CARD_MARINE_DOLPHIN
||
cd
.
code
==
CARD_TWINKLE_MOSS
return
cd
.
code
==
CARD_MARINE_DOLPHIN
||
cd
.
code
==
CARD_TWINKLE_MOSS
||
(
!
cd
.
alias
&&
(
cd
.
type
&
(
TYPE_MONSTER
+
TYPE_TOKEN
))
!=
(
TYPE_MONSTER
+
TYPE_TOKEN
));
||
(
!
cd
.
alias
&&
(
cd
.
type
&
(
TYPE_MONSTER
|
TYPE_TOKEN
))
!=
(
TYPE_MONSTER
|
TYPE_TOKEN
));
}
}
int32
field
::
announce_card
(
int16
step
,
uint8
playerid
)
{
int32
field
::
announce_card
(
int16
step
,
uint8
playerid
)
{
if
(
step
==
0
)
{
if
(
step
==
0
)
{
...
@@ -999,6 +1005,8 @@ int32 field::announce_card(int16 step, uint8 playerid) {
...
@@ -999,6 +1005,8 @@ int32 field::announce_card(int16 step, uint8 playerid) {
}
}
int32
field
::
announce_number
(
int16
step
,
uint8
playerid
)
{
int32
field
::
announce_number
(
int16
step
,
uint8
playerid
)
{
if
(
step
==
0
)
{
if
(
step
==
0
)
{
if
(
core
.
select_options
.
size
()
>
UINT8_MAX
)
core
.
select_options
.
resize
(
UINT8_MAX
);
pduel
->
write_buffer8
(
MSG_ANNOUNCE_NUMBER
);
pduel
->
write_buffer8
(
MSG_ANNOUNCE_NUMBER
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_options
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_options
.
size
());
...
...
processor.cpp
View file @
f7fe6fe4
...
@@ -308,7 +308,7 @@ uint32 field::process() {
...
@@ -308,7 +308,7 @@ uint32 field::process() {
return
pduel
->
message_buffer
.
size
();
return
pduel
->
message_buffer
.
size
();
}
}
case
PROCESSOR_SENDTO
:
{
case
PROCESSOR_SENDTO
:
{
if
(
send_to
(
it
->
step
,
it
->
ptarget
,
it
->
peffect
,
it
->
arg1
,
it
->
arg2
))
if
(
send_to
(
it
->
step
,
it
->
ptarget
,
it
->
peffect
,
it
->
arg1
,
it
->
arg2
,
it
->
arg3
))
core
.
units
.
pop_front
();
core
.
units
.
pop_front
();
else
else
++
it
->
step
;
++
it
->
step
;
...
@@ -2928,6 +2928,8 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -2928,6 +2928,8 @@ int32 field::process_battle_command(uint16 step) {
core
.
attacker
->
set_status
(
STATUS_OPPO_BATTLE
,
TRUE
);
core
.
attacker
->
set_status
(
STATUS_OPPO_BATTLE
,
TRUE
);
core
.
attack_target
->
set_status
(
STATUS_OPPO_BATTLE
,
TRUE
);
core
.
attack_target
->
set_status
(
STATUS_OPPO_BATTLE
,
TRUE
);
}
}
core
.
attacker_player
=
pa
;
core
.
attack_target_player
=
pd
;
}
}
effect
*
damchange
=
nullptr
;
effect
*
damchange
=
nullptr
;
card
*
reason_card
=
nullptr
;
card
*
reason_card
=
nullptr
;
...
@@ -3091,7 +3093,7 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3091,7 +3093,7 @@ int32 field::process_battle_command(uint16 step) {
if
(
core
.
battle_destroy_rep
.
size
())
if
(
core
.
battle_destroy_rep
.
size
())
destroy
(
&
core
.
battle_destroy_rep
,
0
,
REASON_EFFECT
|
REASON_REPLACE
,
PLAYER_NONE
);
destroy
(
&
core
.
battle_destroy_rep
,
0
,
REASON_EFFECT
|
REASON_REPLACE
,
PLAYER_NONE
);
if
(
core
.
desrep_chain
.
size
())
if
(
core
.
desrep_chain
.
size
())
add_process
(
PROCESSOR_OPERATION_REPLACE
,
15
,
NULL
,
NULL
,
0
,
0
);
add_process
(
PROCESSOR_OPERATION_REPLACE
,
15
,
nullptr
,
nullptr
,
0
,
0
);
adjust_all
();
adjust_all
();
return
FALSE
;
return
FALSE
;
}
}
...
@@ -3164,16 +3166,16 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3164,16 +3166,16 @@ int32 field::process_battle_command(uint16 step) {
card_set
ing
;
card_set
ing
;
card_set
ed
;
card_set
ed
;
if
(
core
.
attacker
->
is_status
(
STATUS_BATTLE_DESTROYED
)
&&
(
core
.
attacker
->
current
.
reason
&
REASON_BATTLE
))
{
if
(
core
.
attacker
->
is_status
(
STATUS_BATTLE_DESTROYED
)
&&
(
core
.
attacker
->
current
.
reason
&
REASON_BATTLE
))
{
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BATTLE_DESTROYING
,
0
,
core
.
attacker
->
current
.
reason
,
core
.
attack_target
->
current
.
control
er
,
0
,
1
);
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BATTLE_DESTROYING
,
0
,
core
.
attacker
->
current
.
reason
,
core
.
attack_target
_play
er
,
0
,
1
);
raise_single_event
(
core
.
attacker
,
0
,
EVENT_BATTLE_DESTROYED
,
0
,
core
.
attacker
->
current
.
reason
,
core
.
attack_target
->
current
.
control
er
,
0
,
0
);
raise_single_event
(
core
.
attacker
,
0
,
EVENT_BATTLE_DESTROYED
,
0
,
core
.
attacker
->
current
.
reason
,
core
.
attack_target
_play
er
,
0
,
0
);
raise_single_event
(
core
.
attacker
,
0
,
EVENT_DESTROYED
,
0
,
core
.
attacker
->
current
.
reason
,
core
.
attack_target
->
current
.
control
er
,
0
,
0
);
raise_single_event
(
core
.
attacker
,
0
,
EVENT_DESTROYED
,
0
,
core
.
attacker
->
current
.
reason
,
core
.
attack_target
_play
er
,
0
,
0
);
ing
.
insert
(
core
.
attack_target
);
ing
.
insert
(
core
.
attack_target
);
ed
.
insert
(
core
.
attacker
);
ed
.
insert
(
core
.
attacker
);
}
}
if
(
core
.
attack_target
&&
core
.
attack_target
->
is_status
(
STATUS_BATTLE_DESTROYED
)
&&
(
core
.
attack_target
->
current
.
reason
&
REASON_BATTLE
))
{
if
(
core
.
attack_target
&&
core
.
attack_target
->
is_status
(
STATUS_BATTLE_DESTROYED
)
&&
(
core
.
attack_target
->
current
.
reason
&
REASON_BATTLE
))
{
raise_single_event
(
core
.
attacker
,
0
,
EVENT_BATTLE_DESTROYING
,
0
,
core
.
attack_target
->
current
.
reason
,
core
.
attacker
->
current
.
control
er
,
0
,
0
);
raise_single_event
(
core
.
attacker
,
0
,
EVENT_BATTLE_DESTROYING
,
0
,
core
.
attack_target
->
current
.
reason
,
core
.
attacker
_play
er
,
0
,
0
);
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BATTLE_DESTROYED
,
0
,
core
.
attack_target
->
current
.
reason
,
core
.
attacker
->
current
.
control
er
,
0
,
1
);
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_BATTLE_DESTROYED
,
0
,
core
.
attack_target
->
current
.
reason
,
core
.
attacker
_play
er
,
0
,
1
);
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_DESTROYED
,
0
,
core
.
attack_target
->
current
.
reason
,
core
.
attacker
->
current
.
control
er
,
0
,
1
);
raise_single_event
(
core
.
attack_target
,
0
,
EVENT_DESTROYED
,
0
,
core
.
attack_target
->
current
.
reason
,
core
.
attacker
_play
er
,
0
,
1
);
ing
.
insert
(
core
.
attacker
);
ing
.
insert
(
core
.
attacker
);
ed
.
insert
(
core
.
attack_target
);
ed
.
insert
(
core
.
attack_target
);
}
}
...
@@ -3212,6 +3214,8 @@ int32 field::process_battle_command(uint16 step) {
...
@@ -3212,6 +3214,8 @@ int32 field::process_battle_command(uint16 step) {
core
.
attacker
->
set_status
(
STATUS_OPPO_BATTLE
,
FALSE
);
core
.
attacker
->
set_status
(
STATUS_OPPO_BATTLE
,
FALSE
);
if
(
core
.
attack_target
)
if
(
core
.
attack_target
)
core
.
attack_target
->
set_status
(
STATUS_OPPO_BATTLE
,
FALSE
);
core
.
attack_target
->
set_status
(
STATUS_OPPO_BATTLE
,
FALSE
);
core
.
attacker_player
=
PLAYER_NONE
;
core
.
attack_target_player
=
PLAYER_NONE
;
core
.
units
.
begin
()
->
step
=
-
1
;
core
.
units
.
begin
()
->
step
=
-
1
;
infos
.
phase
=
PHASE_BATTLE_STEP
;
infos
.
phase
=
PHASE_BATTLE_STEP
;
pduel
->
write_buffer8
(
MSG_DAMAGE_STEP_END
);
pduel
->
write_buffer8
(
MSG_DAMAGE_STEP_END
);
...
...
scriptlib.h
View file @
f7fe6fe4
...
@@ -607,6 +607,7 @@ public:
...
@@ -607,6 +607,7 @@ public:
static
int32
duel_is_player_can_send_to_grave
(
lua_State
*
L
);
static
int32
duel_is_player_can_send_to_grave
(
lua_State
*
L
);
static
int32
duel_is_player_can_send_to_deck
(
lua_State
*
L
);
static
int32
duel_is_player_can_send_to_deck
(
lua_State
*
L
);
static
int32
duel_is_player_can_additional_summon
(
lua_State
*
L
);
static
int32
duel_is_player_can_additional_summon
(
lua_State
*
L
);
static
int32
duel_is_chain_solving
(
lua_State
*
L
);
static
int32
duel_is_chain_negatable
(
lua_State
*
L
);
static
int32
duel_is_chain_negatable
(
lua_State
*
L
);
static
int32
duel_is_chain_disablable
(
lua_State
*
L
);
static
int32
duel_is_chain_disablable
(
lua_State
*
L
);
static
int32
duel_is_chain_disabled
(
lua_State
*
L
);
static
int32
duel_is_chain_disabled
(
lua_State
*
L
);
...
...
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