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
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-core
Commits
211246f6
Commit
211246f6
authored
Dec 25, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro-core
parents
2cb77212
74247b0d
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
351 additions
and
219 deletions
+351
-219
card.cpp
card.cpp
+40
-0
card.h
card.h
+3
-0
effect.h
effect.h
+4
-0
field.cpp
field.cpp
+17
-10
field.h
field.h
+2
-0
interpreter.cpp
interpreter.cpp
+10
-0
libcard.cpp
libcard.cpp
+112
-1
libduel.cpp
libduel.cpp
+48
-0
processor.cpp
processor.cpp
+105
-208
scriptlib.h
scriptlib.h
+10
-0
No files found.
card.cpp
View file @
211246f6
...
...
@@ -403,6 +403,26 @@ int32 card::is_fusion_set_card(uint32 set_code) {
}
return
FALSE
;
}
int32
card
::
is_link_set_card
(
uint32
set_code
)
{
if
(
is_set_card
(
set_code
))
return
TRUE
;
uint32
settype
=
set_code
&
0xfff
;
uint32
setsubtype
=
set_code
&
0xf000
;
effect_set
eset
;
filter_effect
(
EFFECT_ADD_LINK_CODE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint32
code
=
eset
[
i
]
->
get_value
(
this
);
card_data
dat
;
::
read_card
(
code
,
&
dat
);
uint64
setcode
=
dat
.
setcode
;
while
(
setcode
)
{
if
((
setcode
&
0xfff
)
==
settype
&&
(
setcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
TRUE
;
setcode
=
setcode
>>
16
;
}
}
return
FALSE
;
}
uint32
card
::
get_type
()
{
if
(
assume_type
==
ASSUME_TYPE
)
return
assume_value
;
...
...
@@ -1026,6 +1046,16 @@ uint32 card::get_fusion_attribute(uint8 playerid) {
}
return
attribute
;
}
uint32
card
::
get_link_attribute
(
uint8
playerid
)
{
effect_set
effects
;
filter_effect
(
EFFECT_ADD_LINK_ATTRIBUTE
,
&
effects
);
uint32
attribute
=
get_attribute
();
for
(
int32
i
=
0
;
i
<
effects
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
attribute
|=
effects
[
i
]
->
get_value
(
this
,
1
);
}
return
attribute
;
}
// see get_level()
uint32
card
::
get_race
()
{
if
(
assume_type
==
ASSUME_RACE
)
...
...
@@ -1055,6 +1085,16 @@ uint32 card::get_race() {
temp
.
race
=
0xffffffff
;
return
race
;
}
uint32
card
::
get_link_race
(
uint8
playerid
)
{
effect_set
effects
;
filter_effect
(
EFFECT_ADD_LINK_RACE
,
&
effects
);
uint32
race
=
get_race
();
for
(
int32
i
=
0
;
i
<
effects
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
playerid
,
PARAM_TYPE_INT
);
race
|=
effects
[
i
]
->
get_value
(
this
,
1
);
}
return
race
;
}
uint32
card
::
get_lscale
()
{
if
(
!
current
.
is_location
(
LOCATION_PZONE
))
return
data
.
lscale
;
...
...
card.h
View file @
211246f6
...
...
@@ -195,6 +195,7 @@ public:
int32
is_origin_set_card
(
uint32
set_code
);
int32
is_pre_set_card
(
uint32
set_code
);
int32
is_fusion_set_card
(
uint32
set_code
);
int32
is_link_set_card
(
uint32
set_code
);
uint32
get_type
();
uint32
get_fusion_type
();
uint32
get_synchro_type
();
...
...
@@ -212,7 +213,9 @@ public:
uint32
check_xyz_level
(
card
*
pcard
,
uint32
lv
);
uint32
get_attribute
();
uint32
get_fusion_attribute
(
uint8
playerid
);
uint32
get_link_attribute
(
uint8
playerid
);
uint32
get_race
();
uint32
get_link_race
(
uint8
playerid
);
uint32
get_lscale
();
uint32
get_rscale
();
uint32
get_link_marker
();
...
...
effect.h
View file @
211246f6
...
...
@@ -431,6 +431,10 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_CHANGE_FUSION_ATTRIBUTE 351
#define EFFECT_EXTRA_FUSION_MATERIAL 352
#define EFFECT_TUNER_MATERIAL_LIMIT 353
#define EFFECT_ADD_LINK_CODE 354
//#define EFFECT_ADD_LINK_SETCODE 355
#define EFFECT_ADD_LINK_ATTRIBUTE 356
#define EFFECT_ADD_LINK_RACE 357
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
...
...
field.cpp
View file @
211246f6
...
...
@@ -215,10 +215,13 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
break
;
}
case
LOCATION_EXTRA
:
{
if
(
player
[
playerid
].
extra_p_count
==
0
||
(
pcard
->
data
.
type
&
TYPE_PENDULUM
)
&&
(
pcard
->
sendto_param
.
position
&
POS_FACEUP
))
player
[
playerid
].
list_extra
.
push_back
(
pcard
);
pcard
->
current
.
sequence
=
player
[
playerid
].
list_extra
.
size
()
-
1
;
else
player
[
playerid
].
list_extra
.
insert
(
player
[
playerid
].
list_extra
.
end
()
-
player
[
playerid
].
extra_p_count
,
pcard
);
if
((
pcard
->
data
.
type
&
TYPE_PENDULUM
)
&&
(
pcard
->
sendto_param
.
position
&
POS_FACEUP
))
++
player
[
playerid
].
extra_p_count
;
reset_sequence
(
playerid
,
LOCATION_EXTRA
);
break
;
}
}
...
...
@@ -825,9 +828,9 @@ void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32
}
}
void
field
::
shuffle
(
uint8
playerid
,
uint8
location
)
{
if
(
!
(
location
&
(
LOCATION_HAND
|
LOCATION_DECK
)))
if
(
!
(
location
&
(
LOCATION_HAND
|
LOCATION_DECK
|
LOCATION_EXTRA
)))
return
;
card_vector
&
svector
=
(
location
==
LOCATION_HAND
)
?
player
[
playerid
].
list_hand
:
player
[
playerid
].
list_main
;
card_vector
&
svector
=
(
location
==
LOCATION_HAND
)
?
player
[
playerid
].
list_hand
:
(
location
==
LOCATION_DECK
)
?
player
[
playerid
].
list_main
:
player
[
playerid
].
list_extra
;
if
(
svector
.
size
()
==
0
)
return
;
if
(
location
==
LOCATION_HAND
)
{
...
...
@@ -841,8 +844,11 @@ void field::shuffle(uint8 playerid, uint8 location) {
}
}
if
(
location
==
LOCATION_HAND
||
!
(
core
.
duel_options
&
DUEL_PSEUDO_SHUFFLE
))
{
if
(
svector
.
size
()
>
1
)
{
uint32
i
=
0
,
s
=
svector
.
size
(),
r
;
uint32
s
=
svector
.
size
();
if
(
location
==
LOCATION_EXTRA
)
s
=
s
-
player
[
playerid
].
extra_p_count
;
if
(
s
>
1
)
{
uint32
i
=
0
,
r
;
for
(
i
=
0
;
i
<
s
-
1
;
++
i
)
{
r
=
pduel
->
get_next_integer
(
i
,
s
-
1
);
card
*
t
=
svector
[
i
];
...
...
@@ -852,12 +858,13 @@ void field::shuffle(uint8 playerid, uint8 location) {
reset_sequence
(
playerid
,
location
);
}
}
if
(
location
==
LOCATION_HAND
)
{
pduel
->
write_buffer8
(
MSG_SHUFFLE_HAND
);
if
(
location
==
LOCATION_HAND
||
location
==
LOCATION_EXTRA
)
{
pduel
->
write_buffer8
(
(
location
==
LOCATION_HAND
)
?
MSG_SHUFFLE_HAND
:
MSG_SHUFFLE_EXTRA
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
player
[
playerid
].
list_hand
.
size
());
pduel
->
write_buffer8
(
svector
.
size
());
for
(
auto
cit
=
svector
.
begin
();
cit
!=
svector
.
end
();
++
cit
)
pduel
->
write_buffer32
((
*
cit
)
->
data
.
code
);
if
(
location
==
LOCATION_HAND
)
core
.
shuffle_hand_check
[
playerid
]
=
FALSE
;
}
else
{
pduel
->
write_buffer8
(
MSG_SHUFFLE_DECK
);
...
...
field.h
View file @
211246f6
...
...
@@ -839,8 +839,10 @@ public:
#define MSG_SHUFFLE_SET_CARD 36
#define MSG_REVERSE_DECK 37
#define MSG_DECK_TOP 38
#define MSG_SHUFFLE_EXTRA 39
#define MSG_NEW_TURN 40
#define MSG_NEW_PHASE 41
#define MSG_CONFIRM_EXTRATOP 42
#define MSG_MOVE 50
#define MSG_POS_CHANGE 53
#define MSG_SET 54
...
...
interpreter.cpp
View file @
211246f6
...
...
@@ -20,11 +20,14 @@ static const struct luaL_Reg cardlib[] = {
{
"GetOriginalCode"
,
scriptlib
::
card_get_origin_code
},
{
"GetOriginalCodeRule"
,
scriptlib
::
card_get_origin_code_rule
},
{
"GetFusionCode"
,
scriptlib
::
card_get_fusion_code
},
{
"GetLinkCode"
,
scriptlib
::
card_get_link_code
},
{
"IsFusionCode"
,
scriptlib
::
card_is_fusion_code
},
{
"IsLinkCode"
,
scriptlib
::
card_is_link_code
},
{
"IsSetCard"
,
scriptlib
::
card_is_set_card
},
{
"IsOriginalSetCard"
,
scriptlib
::
card_is_origin_set_card
},
{
"IsPreviousSetCard"
,
scriptlib
::
card_is_pre_set_card
},
{
"IsFusionSetCard"
,
scriptlib
::
card_is_fusion_set_card
},
{
"IsLinkSetCard"
,
scriptlib
::
card_is_link_set_card
},
{
"GetType"
,
scriptlib
::
card_get_type
},
{
"GetOriginalType"
,
scriptlib
::
card_get_origin_type
},
{
"GetFusionType"
,
scriptlib
::
card_get_fusion_type
},
...
...
@@ -58,8 +61,10 @@ static const struct luaL_Reg cardlib[] = {
{
"GetAttribute"
,
scriptlib
::
card_get_attribute
},
{
"GetOriginalAttribute"
,
scriptlib
::
card_get_origin_attribute
},
{
"GetFusionAttribute"
,
scriptlib
::
card_get_fusion_attribute
},
{
"GetLinkAttribute"
,
scriptlib
::
card_get_link_attribute
},
{
"GetRace"
,
scriptlib
::
card_get_race
},
{
"GetOriginalRace"
,
scriptlib
::
card_get_origin_race
},
{
"GetLinkRace"
,
scriptlib
::
card_get_link_race
},
{
"GetAttack"
,
scriptlib
::
card_get_attack
},
{
"GetBaseAttack"
,
scriptlib
::
card_get_origin_attack
},
{
"GetTextAttack"
,
scriptlib
::
card_get_text_attack
},
...
...
@@ -106,8 +111,10 @@ static const struct luaL_Reg cardlib[] = {
{
"IsRank"
,
scriptlib
::
card_is_rank
},
{
"IsLink"
,
scriptlib
::
card_is_link
},
{
"IsRace"
,
scriptlib
::
card_is_race
},
{
"IsLinkRace"
,
scriptlib
::
card_is_link_race
},
{
"IsAttribute"
,
scriptlib
::
card_is_attribute
},
{
"IsFusionAttribute"
,
scriptlib
::
card_is_fusion_attribute
},
{
"IsLinkAttribute"
,
scriptlib
::
card_is_link_attribute
},
{
"IsReason"
,
scriptlib
::
card_is_reason
},
{
"IsSummonType"
,
scriptlib
::
card_is_summon_type
},
{
"IsStatus"
,
scriptlib
::
card_is_status
},
...
...
@@ -392,6 +399,7 @@ static const struct luaL_Reg duellib[] = {
{
"SetChainLimitTillChainEnd"
,
scriptlib
::
duel_set_chain_limit_p
},
{
"GetChainMaterial"
,
scriptlib
::
duel_get_chain_material
},
{
"ConfirmDecktop"
,
scriptlib
::
duel_confirm_decktop
},
{
"ConfirmExtratop"
,
scriptlib
::
duel_confirm_extratop
},
{
"ConfirmCards"
,
scriptlib
::
duel_confirm_cards
},
{
"SortDecktop"
,
scriptlib
::
duel_sort_decktop
},
{
"CheckEvent"
,
scriptlib
::
duel_check_event
},
...
...
@@ -415,6 +423,7 @@ static const struct luaL_Reg duellib[] = {
{
"DiscardHand"
,
scriptlib
::
duel_discard_hand
},
{
"DisableShuffleCheck"
,
scriptlib
::
duel_disable_shuffle_check
},
{
"ShuffleDeck"
,
scriptlib
::
duel_shuffle_deck
},
{
"ShuffleExtra"
,
scriptlib
::
duel_shuffle_extra
},
{
"ShuffleHand"
,
scriptlib
::
duel_shuffle_hand
},
{
"ShuffleSetCard"
,
scriptlib
::
duel_shuffle_setcard
},
{
"ChangeAttacker"
,
scriptlib
::
duel_change_attacker
},
...
...
@@ -458,6 +467,7 @@ static const struct luaL_Reg duellib[] = {
{
"GetFieldGroup"
,
scriptlib
::
duel_get_field_group
},
{
"GetFieldGroupCount"
,
scriptlib
::
duel_get_field_group_count
},
{
"GetDecktopGroup"
,
scriptlib
::
duel_get_decktop_group
},
{
"GetExtraTopGroup"
,
scriptlib
::
duel_get_extratop_group
},
{
"GetMatchingGroup"
,
scriptlib
::
duel_get_matching_group
},
{
"GetMatchingGroupCount"
,
scriptlib
::
duel_get_matching_count
},
{
"GetFirstMatchingCard"
,
scriptlib
::
duel_get_first_matching_card
},
...
...
libcard.cpp
View file @
211246f6
...
...
@@ -78,6 +78,23 @@ int32 scriptlib::card_get_fusion_code(lua_State *L) {
lua_pushinteger
(
L
,
eset
[
i
]
->
get_value
(
pcard
));
return
count
+
eset
.
size
();
}
int32
scriptlib
::
card_get_link_code
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
lua_pushinteger
(
L
,
pcard
->
get_code
());
int32
count
=
1
;
uint32
otcode
=
pcard
->
get_another_code
();
if
(
otcode
)
{
lua_pushinteger
(
L
,
otcode
);
count
++
;
}
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_LINK_CODE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
lua_pushinteger
(
L
,
eset
[
i
]
->
get_value
(
pcard
));
return
count
+
eset
.
size
();
}
int32
scriptlib
::
card_is_fusion_code
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -108,6 +125,36 @@ int32 scriptlib::card_is_fusion_code(lua_State *L) {
lua_pushboolean
(
L
,
result
);
return
1
;
}
int32
scriptlib
::
card_is_link_code
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_LINK_CODE
,
&
eset
);
if
(
!
eset
.
size
())
return
card_is_code
(
L
);
uint32
code1
=
pcard
->
get_code
();
uint32
code2
=
pcard
->
get_another_code
();
std
::
unordered_set
<
uint32
>
fcode
;
fcode
.
insert
(
code1
);
if
(
code2
)
fcode
.
insert
(
code2
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
fcode
.
insert
(
eset
[
i
]
->
get_value
(
pcard
));
uint32
count
=
lua_gettop
(
L
)
-
1
;
uint32
result
=
FALSE
;
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
if
(
lua_isnil
(
L
,
i
+
2
))
continue
;
uint32
tcode
=
lua_tointeger
(
L
,
i
+
2
);
if
(
fcode
.
find
(
tcode
)
!=
fcode
.
end
())
{
result
=
TRUE
;
break
;
}
}
lua_pushboolean
(
L
,
result
);
return
1
;
}
int32
scriptlib
::
card_is_set_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -140,6 +187,14 @@ int32 scriptlib::card_is_fusion_set_card(lua_State *L) {
lua_pushboolean
(
L
,
pcard
->
is_fusion_set_card
(
set_code
));
return
1
;
}
int32
scriptlib
::
card_is_link_set_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
set_code
=
lua_tointeger
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_link_set_card
(
set_code
));
return
1
;
}
int32
scriptlib
::
card_get_type
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -446,6 +501,18 @@ int32 scriptlib::card_get_fusion_attribute(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
get_fusion_attribute
(
playerid
));
return
1
;
}
int32
scriptlib
::
card_get_link_attribute
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
1
&&
!
lua_isnil
(
L
,
2
))
playerid
=
lua_tointeger
(
L
,
2
);
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
lua_pushinteger
(
L
,
pcard
->
get_link_attribute
(
playerid
));
return
1
;
}
int32
scriptlib
::
card_get_race
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -463,6 +530,18 @@ int32 scriptlib::card_get_origin_race(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
data
.
race
);
return
1
;
}
int32
scriptlib
::
card_get_link_race
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
1
&&
!
lua_isnil
(
L
,
2
))
playerid
=
lua_tointeger
(
L
,
2
);
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
lua_pushinteger
(
L
,
pcard
->
get_link_race
(
playerid
));
return
1
;
}
int32
scriptlib
::
card_get_attack
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -847,6 +926,22 @@ int32 scriptlib::card_is_race(lua_State *L) {
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_link_race
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
trace
=
lua_tointeger
(
L
,
2
);
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
2
&&
!
lua_isnil
(
L
,
3
))
playerid
=
lua_tointeger
(
L
,
3
);
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
if
(
pcard
->
get_link_race
(
playerid
)
&
trace
)
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_attribute
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -874,6 +969,22 @@ int32 scriptlib::card_is_fusion_attribute(lua_State *L) {
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_link_attribute
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
tattrib
=
lua_tointeger
(
L
,
2
);
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
2
&&
!
lua_isnil
(
L
,
3
))
playerid
=
lua_tointeger
(
L
,
3
);
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
if
(
pcard
->
get_link_attribute
(
playerid
)
&
tattrib
)
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_reason
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
libduel.cpp
View file @
211246f6
...
...
@@ -805,6 +805,28 @@ int32 scriptlib::duel_confirm_decktop(lua_State *L) {
pduel
->
game_field
->
add_process
(
PROCESSOR_WAIT
,
0
,
0
,
0
,
0
,
0
);
return
lua_yield
(
L
,
0
);
}
int32
scriptlib
::
duel_confirm_extratop
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
count
=
lua_tointeger
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
count
>=
pduel
->
game_field
->
player
[
playerid
].
list_extra
.
size
()
-
pduel
->
game_field
->
player
[
playerid
].
extra_p_count
)
count
=
pduel
->
game_field
->
player
[
playerid
].
list_extra
.
size
()
-
pduel
->
game_field
->
player
[
playerid
].
extra_p_count
;
auto
cit
=
pduel
->
game_field
->
player
[
playerid
].
list_extra
.
rbegin
()
+
pduel
->
game_field
->
player
[
playerid
].
extra_p_count
;
pduel
->
write_buffer8
(
MSG_CONFIRM_EXTRATOP
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
count
);
for
(
uint32
i
=
0
;
i
<
count
&&
cit
!=
pduel
->
game_field
->
player
[
playerid
].
list_extra
.
rend
();
++
i
,
++
cit
)
{
pduel
->
write_buffer32
((
*
cit
)
->
data
.
code
);
pduel
->
write_buffer8
((
*
cit
)
->
current
.
controler
);
pduel
->
write_buffer8
((
*
cit
)
->
current
.
location
);
pduel
->
write_buffer8
((
*
cit
)
->
current
.
sequence
);
}
pduel
->
game_field
->
add_process
(
PROCESSOR_WAIT
,
0
,
0
,
0
,
0
,
0
);
return
lua_yield
(
L
,
0
);
}
int32
scriptlib
::
duel_confirm_cards
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
...
...
@@ -1287,6 +1309,15 @@ int32 scriptlib::duel_shuffle_deck(lua_State *L) {
pduel
->
game_field
->
shuffle
(
playerid
,
LOCATION_DECK
);
return
0
;
}
int32
scriptlib
::
duel_shuffle_extra
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
shuffle
(
playerid
,
LOCATION_EXTRA
);
return
0
;
}
int32
scriptlib
::
duel_shuffle_hand
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
...
...
@@ -2033,6 +2064,23 @@ int32 scriptlib::duel_get_decktop_group(lua_State *L) {
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
/**
* \brief Duel.GetExtraTopGroup
* \param playerid, count
* \return Group
*/
int32
scriptlib
::
duel_get_extratop_group
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
uint32
count
=
lua_tointeger
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
auto
cit
=
pduel
->
game_field
->
player
[
playerid
].
list_extra
.
rbegin
()
+
pduel
->
game_field
->
player
[
playerid
].
extra_p_count
;
for
(
uint32
i
=
0
;
i
<
count
&&
cit
!=
pduel
->
game_field
->
player
[
playerid
].
list_extra
.
rend
();
++
i
,
++
cit
)
pgroup
->
container
.
insert
(
*
cit
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
/**
* \brief Duel.GetMatchingGroup
* \param filter_func, self, location1, location2, exception card, (extraargs...)
...
...
processor.cpp
View file @
211246f6
This diff is collapsed.
Click to expand it.
scriptlib.h
View file @
211246f6
...
...
@@ -22,11 +22,14 @@ public:
static
int32
card_get_origin_code
(
lua_State
*
L
);
static
int32
card_get_origin_code_rule
(
lua_State
*
L
);
static
int32
card_get_fusion_code
(
lua_State
*
L
);
static
int32
card_get_link_code
(
lua_State
*
L
);
static
int32
card_is_fusion_code
(
lua_State
*
L
);
static
int32
card_is_link_code
(
lua_State
*
L
);
static
int32
card_is_set_card
(
lua_State
*
L
);
static
int32
card_is_origin_set_card
(
lua_State
*
L
);
static
int32
card_is_pre_set_card
(
lua_State
*
L
);
static
int32
card_is_fusion_set_card
(
lua_State
*
L
);
static
int32
card_is_link_set_card
(
lua_State
*
L
);
static
int32
card_get_type
(
lua_State
*
L
);
static
int32
card_get_origin_type
(
lua_State
*
L
);
static
int32
card_get_fusion_type
(
lua_State
*
L
);
...
...
@@ -60,8 +63,10 @@ public:
static
int32
card_get_attribute
(
lua_State
*
L
);
static
int32
card_get_origin_attribute
(
lua_State
*
L
);
static
int32
card_get_fusion_attribute
(
lua_State
*
L
);
static
int32
card_get_link_attribute
(
lua_State
*
L
);
static
int32
card_get_race
(
lua_State
*
L
);
static
int32
card_get_origin_race
(
lua_State
*
L
);
static
int32
card_get_link_race
(
lua_State
*
L
);
static
int32
card_get_attack
(
lua_State
*
L
);
static
int32
card_get_origin_attack
(
lua_State
*
L
);
static
int32
card_get_text_attack
(
lua_State
*
L
);
...
...
@@ -108,8 +113,10 @@ public:
static
int32
card_is_rank
(
lua_State
*
L
);
static
int32
card_is_link
(
lua_State
*
L
);
static
int32
card_is_race
(
lua_State
*
L
);
static
int32
card_is_link_race
(
lua_State
*
L
);
static
int32
card_is_attribute
(
lua_State
*
L
);
static
int32
card_is_fusion_attribute
(
lua_State
*
L
);
static
int32
card_is_link_attribute
(
lua_State
*
L
);
static
int32
card_is_reason
(
lua_State
*
L
);
static
int32
card_is_summon_type
(
lua_State
*
L
);
static
int32
card_is_status
(
lua_State
*
L
);
...
...
@@ -388,6 +395,7 @@ public:
static
int32
duel_set_chain_limit_p
(
lua_State
*
L
);
static
int32
duel_get_chain_material
(
lua_State
*
L
);
static
int32
duel_confirm_decktop
(
lua_State
*
L
);
static
int32
duel_confirm_extratop
(
lua_State
*
L
);
static
int32
duel_confirm_cards
(
lua_State
*
L
);
static
int32
duel_sort_decktop
(
lua_State
*
L
);
static
int32
duel_check_event
(
lua_State
*
L
);
...
...
@@ -412,6 +420,7 @@ public:
static
int32
duel_discard_hand
(
lua_State
*
L
);
static
int32
duel_disable_shuffle_check
(
lua_State
*
L
);
static
int32
duel_shuffle_deck
(
lua_State
*
L
);
static
int32
duel_shuffle_extra
(
lua_State
*
L
);
static
int32
duel_shuffle_hand
(
lua_State
*
L
);
static
int32
duel_shuffle_setcard
(
lua_State
*
L
);
static
int32
duel_change_attacker
(
lua_State
*
L
);
...
...
@@ -456,6 +465,7 @@ public:
static
int32
duel_get_field_group
(
lua_State
*
L
);
static
int32
duel_get_field_group_count
(
lua_State
*
L
);
static
int32
duel_get_decktop_group
(
lua_State
*
L
);
static
int32
duel_get_extratop_group
(
lua_State
*
L
);
static
int32
duel_get_matching_group
(
lua_State
*
L
);
static
int32
duel_get_matching_count
(
lua_State
*
L
);
static
int32
duel_get_first_matching_card
(
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