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
d9661fca
Commit
d9661fca
authored
Dec 31, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro-core
parents
dc3ed983
3f8322ce
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
135 additions
and
9 deletions
+135
-9
card.cpp
card.cpp
+17
-0
card.h
card.h
+1
-0
effect.h
effect.h
+1
-0
field.cpp
field.cpp
+39
-1
field.h
field.h
+1
-0
interpreter.cpp
interpreter.cpp
+1
-0
libcard.cpp
libcard.cpp
+11
-1
operations.cpp
operations.cpp
+63
-7
scriptlib.h
scriptlib.h
+1
-0
No files found.
card.cpp
View file @
d9661fca
...
...
@@ -2307,6 +2307,23 @@ int32 card::is_summonable_card() {
return
FALSE
;
return
!
is_affected_by_effect
(
EFFECT_UNSUMMONABLE_CARD
);
}
int32
card
::
is_fusion_summonable_card
(
uint32
summon_type
)
{
if
(
!
(
data
.
type
&
TYPE_FUSION
))
return
FALSE
;
summon_type
|=
SUMMON_TYPE_FUSION
;
effect_set
eset
;
filter_effect
(
EFFECT_SPSUMMON_CONDITION
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
summon_type
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_INT
);
if
(
!
eset
[
i
]
->
check_value_condition
(
5
))
return
FALSE
;
}
return
TRUE
;
}
// check the condition of sp_summon procedure peffect
int32
card
::
is_spsummonable
(
effect
*
peffect
)
{
effect
*
oreason
=
pduel
->
game_field
->
core
.
reason_effect
;
...
...
card.h
View file @
d9661fca
...
...
@@ -249,6 +249,7 @@ public:
int32
is_equipable
(
card
*
pcard
);
int32
is_summonable_card
();
int32
is_fusion_summonable_card
(
uint32
summon_type
);
int32
is_spsummonable
(
effect
*
peffect
);
int32
is_summonable
(
effect
*
peffect
,
uint8
min_tribute
);
int32
is_can_be_summoned
(
uint8
playerid
,
uint8
ingore_count
,
effect
*
peffect
,
uint8
min_tribute
);
...
...
effect.h
View file @
d9661fca
...
...
@@ -363,6 +363,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_NONTUNER 244
#define EFFECT_OVERLAY_REMOVE_REPLACE 245
#define EFFECT_SCRAP_CHIMERA 246
#define EFFECT_TUNE_MAGICIAN_X 247
#define EFFECT_PRE_MONSTER 250
#define EFFECT_MATERIAL_CHECK 251
#define EFFECT_DISABLE_FIELD 260
...
...
field.cpp
View file @
d9661fca
...
...
@@ -2273,7 +2273,45 @@ int32 field::check_with_sum_greater_limit_m(const card_vector& mats, int32 acc,
}
int32
field
::
check_xyz_material
(
card
*
scard
,
int32
findex
,
int32
lv
,
int32
min
,
int32
max
,
group
*
mg
)
{
get_xyz_material
(
scard
,
findex
,
lv
,
max
,
mg
);
return
(
int32
)
core
.
xmaterial_lst
.
size
()
>=
min
;
if
(
!
(
core
.
global_flag
&
GLOBALFLAG_TUNE_MAGICIAN
))
return
(
int32
)
core
.
xmaterial_lst
.
size
()
>=
min
;
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>
>
mat
;
effect
*
peffect
=
0
;
for
(
auto
cit
=
core
.
xmaterial_lst
.
begin
();
cit
!=
core
.
xmaterial_lst
.
end
();
++
cit
)
{
effect
*
plimit
=
cit
->
second
->
is_affected_by_effect
(
EFFECT_TUNE_MAGICIAN_X
);
if
(
plimit
)
peffect
=
plimit
;
else
mat
.
insert
(
*
cit
);
}
if
(
core
.
global_flag
&
GLOBALFLAG_XMAT_COUNT_LIMIT
)
{
int32
maxc
=
std
::
min
(
max
,
(
int32
)
mat
.
size
());
auto
iter
=
mat
.
lower_bound
(
maxc
);
std
::
size_t
size
=
std
::
distance
(
iter
,
mat
.
end
());
if
((
int32
)
size
>=
min
)
return
TRUE
;
}
else
{
if
((
int32
)
mat
.
size
()
>=
min
)
return
TRUE
;
}
if
(
!
peffect
)
return
FALSE
;
mat
.
clear
();
for
(
auto
cit
=
core
.
xmaterial_lst
.
begin
();
cit
!=
core
.
xmaterial_lst
.
end
();
++
cit
)
{
if
(
!
peffect
->
get_value
(
cit
->
second
))
mat
.
insert
(
*
cit
);
}
if
(
core
.
global_flag
&
GLOBALFLAG_XMAT_COUNT_LIMIT
)
{
int32
maxc
=
std
::
min
(
max
,
(
int32
)
mat
.
size
());
auto
iter
=
mat
.
lower_bound
(
maxc
);
std
::
size_t
size
=
std
::
distance
(
iter
,
mat
.
end
());
if
((
int32
)
size
>=
min
)
return
TRUE
;
}
else
{
if
((
int32
)
mat
.
size
()
>=
min
)
return
TRUE
;
}
return
FALSE
;
}
int32
field
::
is_player_can_draw
(
uint8
playerid
)
{
return
!
is_player_affected_by_effect
(
playerid
,
EFFECT_CANNOT_DRAW
);
...
...
field.h
View file @
d9661fca
...
...
@@ -611,6 +611,7 @@ public:
#define GLOBALFLAG_XMAT_COUNT_LIMIT 0x80
#define GLOBALFLAG_SELF_TOGRAVE 0x100
#define GLOBALFLAG_SPSUMMON_ONCE 0x200
#define GLOBALFLAG_TUNE_MAGICIAN 0x400
//
#define PROCESSOR_NONE 0
#define PROCESSOR_WAITING 0x10000
...
...
interpreter.cpp
View file @
d9661fca
...
...
@@ -151,6 +151,7 @@ static const struct luaL_Reg cardlib[] = {
{
"IsDisabled"
,
scriptlib
::
card_is_disabled
},
{
"IsDestructable"
,
scriptlib
::
card_is_destructable
},
{
"IsSummonableCard"
,
scriptlib
::
card_is_summonable
},
{
"IsFusionSummonableCard"
,
scriptlib
::
card_is_fusion_summonable_card
},
{
"IsSpecialSummonable"
,
scriptlib
::
card_is_special_summonable
},
{
"IsSynchroSummonable"
,
scriptlib
::
card_is_synchro_summonable
},
{
"IsXyzSummonable"
,
scriptlib
::
card_is_xyz_summonable
},
...
...
libcard.cpp
View file @
d9661fca
...
...
@@ -1350,10 +1350,20 @@ int32 scriptlib::card_is_destructable(lua_State *L) {
int32
scriptlib
::
card_is_summonable
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
lua_pushboolean
(
L
,
pcard
->
is_summonable_card
());
return
1
;
}
int32
scriptlib
::
card_is_fusion_summonable_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
summon_type
=
0
;
if
(
lua_gettop
(
L
)
>
1
)
summon_type
=
lua_tointeger
(
L
,
2
);
lua_pushboolean
(
L
,
pcard
->
is_fusion_summonable_card
(
summon_type
));
return
1
;
}
int32
scriptlib
::
card_is_msetable
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
operations.cpp
View file @
d9661fca
...
...
@@ -4590,6 +4590,62 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
int32
field
::
select_xyz_material
(
int16
step
,
uint8
playerid
,
uint32
lv
,
card
*
scard
,
int32
min
,
int32
max
)
{
switch
(
step
)
{
case
0
:
{
if
(
!
(
core
.
global_flag
&
GLOBALFLAG_TUNE_MAGICIAN
))
{
core
.
units
.
begin
()
->
step
=
1
;
return
FALSE
;
}
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>
>
mat1
,
mat2
;
effect
*
peffect
=
0
;
for
(
auto
cit
=
core
.
xmaterial_lst
.
begin
();
cit
!=
core
.
xmaterial_lst
.
end
();
++
cit
)
{
effect
*
plimit
=
cit
->
second
->
is_affected_by_effect
(
EFFECT_TUNE_MAGICIAN_X
);
if
(
plimit
)
peffect
=
plimit
;
else
mat1
.
insert
(
*
cit
);
}
if
(
core
.
global_flag
&
GLOBALFLAG_XMAT_COUNT_LIMIT
)
{
int32
maxc
=
std
::
min
(
max
,
(
int32
)
mat1
.
size
());
auto
iter
=
mat1
.
lower_bound
(
maxc
);
mat1
.
erase
(
mat1
.
begin
(),
iter
);
}
if
(
peffect
)
{
for
(
auto
cit
=
core
.
xmaterial_lst
.
begin
();
cit
!=
core
.
xmaterial_lst
.
end
();
++
cit
)
{
if
(
!
peffect
->
get_value
(
cit
->
second
))
mat2
.
insert
(
*
cit
);
}
if
(
core
.
global_flag
&
GLOBALFLAG_XMAT_COUNT_LIMIT
)
{
int32
maxc
=
std
::
min
(
max
,
(
int32
)
mat2
.
size
());
auto
iter
=
mat2
.
lower_bound
(
maxc
);
mat2
.
erase
(
mat2
.
begin
(),
iter
);
}
}
if
(
mat2
.
size
()
==
core
.
xmaterial_lst
.
size
())
{
core
.
units
.
begin
()
->
step
=
1
;
}
else
if
((
int32
)
mat1
.
size
()
<
min
)
{
core
.
xmaterial_lst
.
swap
(
mat2
);
core
.
units
.
begin
()
->
step
=
1
;
}
else
if
((
int32
)
mat2
.
size
()
<
min
)
{
core
.
xmaterial_lst
.
swap
(
mat1
);
core
.
units
.
begin
()
->
step
=
1
;
}
else
{
auto
ptr
=
new
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>
>
[
2
];
ptr
[
0
].
swap
(
mat1
);
ptr
[
1
].
swap
(
mat2
);
core
.
units
.
begin
()
->
ptr1
=
ptr
;
add_process
(
PROCESSOR_SELECT_YESNO
,
0
,
0
,
0
,
playerid
,
peffect
->
description
);
}
return
FALSE
;
}
case
1
:
{
auto
ptr
=
(
std
::
multimap
<
int32
,
card
*
,
std
::
greater
<
int32
>
>*
)
core
.
units
.
begin
()
->
ptr1
;
if
(
!
returns
.
ivalue
[
0
])
core
.
xmaterial_lst
.
swap
(
ptr
[
0
]);
else
core
.
xmaterial_lst
.
swap
(
ptr
[
1
]);
delete
[]
ptr
;
return
FALSE
;
}
case
2
:
{
int
maxv
=
0
;
if
(
core
.
xmaterial_lst
.
size
())
maxv
=
core
.
xmaterial_lst
.
begin
()
->
first
;
...
...
@@ -4603,10 +4659,10 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
pduel
->
write_buffer32
(
513
);
add_process
(
PROCESSOR_SELECT_CARD
,
0
,
0
,
0
,
playerid
+
((
uint32
)
core
.
summon_cancelable
<<
16
),
min
+
(
max
<<
16
));
}
else
core
.
units
.
begin
()
->
step
=
1
;
core
.
units
.
begin
()
->
step
=
3
;
return
FALSE
;
}
case
1
:
{
case
3
:
{
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_GROUP
);
return
TRUE
;
...
...
@@ -4619,7 +4675,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
pduel
->
lua
->
add_param
(
pgroup
,
PARAM_TYPE_GROUP
);
return
TRUE
;
}
case
2
:
{
case
4
:
{
core
.
operated_set
.
clear
();
core
.
select_cards
.
clear
();
for
(
auto
iter
=
core
.
xmaterial_lst
.
begin
();
iter
!=
core
.
xmaterial_lst
.
end
();
++
iter
)
...
...
@@ -4631,7 +4687,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
add_process
(
PROCESSOR_SELECT_CARD
,
0
,
0
,
0
,
playerid
+
((
uint32
)
core
.
summon_cancelable
<<
16
),
min
+
(
min
<<
16
));
return
FALSE
;
}
case
3
:
{
case
5
:
{
if
(
returns
.
ivalue
[
0
]
==
-
1
)
{
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_GROUP
);
return
TRUE
;
...
...
@@ -4666,7 +4722,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
returns
.
ivalue
[
0
]
=
1
;
return
FALSE
;
}
case
4
:
{
case
6
:
{
if
(
!
returns
.
ivalue
[
0
])
{
group
*
pgroup
=
pduel
->
new_group
(
core
.
operated_set
);
pduel
->
lua
->
add_param
(
pgroup
,
PARAM_TYPE_GROUP
);
...
...
@@ -4686,11 +4742,11 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
add_process
(
PROCESSOR_SELECT_CARD
,
0
,
0
,
0
,
playerid
,
min
+
(
max
<<
16
));
else
{
add_process
(
PROCESSOR_SELECT_CARD
,
0
,
0
,
0
,
playerid
,
min
+
(
min
<<
16
));
core
.
units
.
begin
()
->
step
=
2
;
core
.
units
.
begin
()
->
step
=
4
;
}
return
FALSE
;
}
case
5
:
{
case
7
:
{
group
*
pgroup
=
pduel
->
new_group
(
core
.
operated_set
);
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
{
card
*
pcard
=
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]];
...
...
scriptlib.h
View file @
d9661fca
...
...
@@ -153,6 +153,7 @@ public:
static
int32
card_is_disabled
(
lua_State
*
L
);
static
int32
card_is_destructable
(
lua_State
*
L
);
static
int32
card_is_summonable
(
lua_State
*
L
);
static
int32
card_is_fusion_summonable_card
(
lua_State
*
L
);
static
int32
card_is_msetable
(
lua_State
*
L
);
static
int32
card_is_ssetable
(
lua_State
*
L
);
static
int32
card_is_special_summonable
(
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