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
39ed882f
Commit
39ed882f
authored
Mar 30, 2019
by
mycard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/purerosefallen/ygopro-core
into 2pick
parents
8cb95d93
96821733
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
10 deletions
+75
-10
card.cpp
card.cpp
+23
-6
card.h
card.h
+5
-0
effect.h
effect.h
+4
-1
field.cpp
field.cpp
+7
-0
interpreter.cpp
interpreter.cpp
+3
-0
libcard.cpp
libcard.cpp
+31
-0
playerop.cpp
playerop.cpp
+0
-2
processor.cpp
processor.cpp
+1
-1
scriptlib.h
scriptlib.h
+1
-0
No files found.
card.cpp
View file @
39ed882f
...
...
@@ -287,7 +287,19 @@ uint32 card::get_info_location() {
return
c
+
(
l
<<
8
)
+
(
s
<<
16
)
+
(
ss
<<
24
);
}
}
// get the current code
// mapping of double-name cards
uint32
card
::
second_code
(
uint32
code
){
switch
(
code
){
case
CARD_MARINE_DOLPHIN
:
return
17955766u
;
case
CARD_TWINKLE_MOSS
:
return
17732278u
;
default:
return
0
;
}
}
// return: the current card name
// for double-name card, it returns printed name
uint32
card
::
get_code
()
{
if
(
assume_type
==
ASSUME_CODE
)
return
assume_value
;
...
...
@@ -306,21 +318,24 @@ uint32 card::get_code() {
}
else
{
card_data
dat
;
read_card
(
code
,
&
dat
);
if
(
dat
.
alias
)
if
(
dat
.
alias
&&
!
second_code
(
code
)
)
code
=
dat
.
alias
;
}
return
code
;
}
// get the current second-code
// return: the current second card name
// for double-name cards, it returns the name in description
uint32
card
::
get_another_code
()
{
if
(
is_affected_by_effect
(
EFFECT_CHANGE_CODE
))
return
0
;
uint32
code
=
get_code
();
if
(
code
!=
data
.
code
){
return
second_code
(
code
);
}
effect_set
eset
;
filter_effect
(
EFFECT_ADD_CODE
,
&
eset
);
if
(
!
eset
.
size
())
return
0
;
uint32
otcode
=
eset
.
get_last
()
->
get_value
(
this
);
if
(
get_code
()
!=
otcode
)
if
(
code
!=
otcode
)
return
otcode
;
return
0
;
}
...
...
@@ -3781,6 +3796,8 @@ int32 card::is_can_be_ritual_material(card* scard) {
return
TRUE
;
return
FALSE
;
}
if
(
current
.
location
==
LOCATION_EXTRA
&&
is_affected_by_effect
(
EFFECT_MAP_OF_HEAVEN
)
&&
scard
&&
scard
->
get_level
()
<
7
)
return
FALSE
;
return
TRUE
;
}
int32
card
::
is_can_be_xyz_material
(
card
*
scard
)
{
...
...
card.h
View file @
39ed882f
...
...
@@ -200,6 +200,7 @@ public:
uint32
get_infos
(
byte
*
buf
,
int32
query_flag
,
int32
use_cache
=
TRUE
);
uint32
get_info_location
();
uint32
second_code
(
uint32
code
);
uint32
get_code
();
uint32
get_another_code
();
int32
is_set_card
(
uint32
set_code
);
...
...
@@ -383,4 +384,8 @@ public:
#define ASSUME_ATTACK 7
#define ASSUME_DEFENSE 8
//double-name cards
#define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930
#endif
/* CARD_H_ */
effect.h
View file @
39ed882f
...
...
@@ -125,6 +125,7 @@ public:
#define EFFECT_CHANGE_SUMMON_LOCATION_KOISHI 37564161
#define EFFECT_LINK_SPELL_KOISHI 37564162
#define EFFECT_SEA_PULSE 37564163
#define EFFECT_MAP_OF_HEAVEN 77702007
//status
#define EFFECT_STATUS_AVAILABLE 0x0001
...
...
@@ -459,6 +460,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_ADD_LINK_RACE 357
#define EFFECT_EXTRA_LINK_MATERIAL 358
#define EFFECT_QP_ACT_IN_SET_TURN 359
#define EFFECT_EXTRA_PENDULUM_SUMMON 360
#define EFFECT_IRON_WALL 361
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
...
...
field.cpp
View file @
39ed882f
...
...
@@ -1814,6 +1814,9 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater
for
(
auto
&
pcard
:
player
[
playerid
].
list_grave
)
if
((
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
pcard
->
is_affected_by_effect
(
EFFECT_EXTRA_RITUAL_MATERIAL
)
&&
pcard
->
is_removeable
(
playerid
))
material
->
insert
(
pcard
);
for
(
auto
&
pcard
:
player
[
playerid
].
list_extra
)
if
(
pcard
&&
(
pcard
->
get_level
()
||
pcard
->
is_affected_by_effect
(
EFFECT_MINIATURE_GARDEN_GIRL
))
&&
(
pcard
->
data
.
type
&
TYPE_MONSTER
)
&&
pcard
->
is_affected_by_effect
(
EFFECT_MAP_OF_HEAVEN
)
&&
pcard
->
is_capable_send_to_grave
(
playerid
))
material
->
insert
(
pcard
);
}
void
field
::
get_fusion_material
(
uint8
playerid
,
card_set
*
material
)
{
for
(
auto
&
pcard
:
player
[
playerid
].
list_mzone
)
{
...
...
@@ -1831,13 +1834,17 @@ void field::get_fusion_material(uint8 playerid, card_set* material) {
void
field
::
ritual_release
(
card_set
*
material
)
{
card_set
rel
;
card_set
rem
;
card_set
tg
;
for
(
auto
&
pcard
:
*
material
)
{
if
(
pcard
->
current
.
location
==
LOCATION_GRAVE
)
rem
.
insert
(
pcard
);
else
if
(
pcard
->
current
.
location
==
LOCATION_EXTRA
&&
pcard
->
is_affected_by_effect
(
EFFECT_MAP_OF_HEAVEN
))
tg
.
insert
(
pcard
);
else
rel
.
insert
(
pcard
);
}
release
(
&
rel
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
);
send_to
(
&
tg
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
send_to
(
&
rem
,
core
.
reason_effect
,
REASON_RITUAL
+
REASON_EFFECT
+
REASON_MATERIAL
,
core
.
reason_player
,
PLAYER_NONE
,
LOCATION_REMOVED
,
0
,
POS_FACEUP
);
}
void
field
::
get_xyz_material
(
card
*
scard
,
int32
findex
,
uint32
lv
,
int32
maxc
,
group
*
mg
)
{
...
...
interpreter.cpp
View file @
39ed882f
...
...
@@ -109,6 +109,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetTurnID"
,
scriptlib
::
card_get_turnid
},
{
"GetFieldID"
,
scriptlib
::
card_get_fieldid
},
{
"GetRealFieldID"
,
scriptlib
::
card_get_fieldidr
},
{
"IsOriginalCodeRule"
,
scriptlib
::
card_is_origin_code_rule
},
{
"IsCode"
,
scriptlib
::
card_is_code
},
{
"IsType"
,
scriptlib
::
card_is_type
},
{
"IsFusionType"
,
scriptlib
::
card_is_fusion_type
},
...
...
@@ -736,6 +737,8 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_setglobal
(
lua_state
,
"EFFECT_LINK_SPELL_KOISHI"
);
lua_pushinteger
(
lua_state
,
EFFECT_SEA_PULSE
);
lua_setglobal
(
lua_state
,
"EFFECT_SEA_PULSE"
);
lua_pushinteger
(
lua_state
,
EFFECT_MAP_OF_HEAVEN
);
lua_setglobal
(
lua_state
,
"EFFECT_MAP_OF_HEAVEN"
);
//music hints
lua_pushinteger
(
lua_state
,
HINT_MUSIC
);
...
...
libcard.cpp
View file @
39ed882f
...
...
@@ -918,6 +918,37 @@ int32 scriptlib::card_get_fieldidr(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
fieldid_r
);
return
1
;
}
int32
scriptlib
::
card_is_origin_code_rule
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code1
=
0
;
uint32
code2
=
0
;
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_CODE
,
&
eset
);
if
(
pcard
->
data
.
alias
&&
!
eset
.
size
()){
code1
=
pcard
->
data
.
alias
;
code2
=
0
;
}
else
{
code1
=
pcard
->
data
.
code
;
if
(
eset
.
size
())
code2
=
eset
.
get_last
()
->
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
(
code1
==
tcode
||
(
code2
&&
code2
==
tcode
))
{
result
=
TRUE
;
break
;
}
}
lua_pushboolean
(
L
,
result
);
return
1
;
}
int32
scriptlib
::
card_is_code
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
playerop.cpp
View file @
39ed882f
...
...
@@ -825,8 +825,6 @@ int32 field::announce_attribute(int16 step, uint8 playerid, int32 count, int32 a
}
return
TRUE
;
}
#define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930
static
int32
is_declarable
(
card_data
const
&
cd
,
const
std
::
vector
<
uint32
>&
opcode
)
{
std
::
stack
<
int32
>
stack
;
for
(
auto
&
it
:
opcode
)
{
...
...
processor.cpp
View file @
39ed882f
...
...
@@ -692,7 +692,7 @@ int32 field::process() {
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_GROUP
);
else
{
card
*
pcard
;
if
(
returns
.
bvalue
[
1
]
<
core
.
select_cards
.
size
())
if
(
(
uint8
)
returns
.
bvalue
[
1
]
<
core
.
select_cards
.
size
())
pcard
=
core
.
select_cards
[
returns
.
bvalue
[
1
]];
else
pcard
=
core
.
unselect_cards
[
returns
.
bvalue
[
1
]
-
core
.
select_cards
.
size
()];
...
...
scriptlib.h
View file @
39ed882f
...
...
@@ -129,6 +129,7 @@ public:
static
int32
card_get_turnid
(
lua_State
*
L
);
static
int32
card_get_fieldid
(
lua_State
*
L
);
static
int32
card_get_fieldidr
(
lua_State
*
L
);
static
int32
card_is_origin_code_rule
(
lua_State
*
L
);
static
int32
card_is_code
(
lua_State
*
L
);
static
int32
card_is_type
(
lua_State
*
L
);
static
int32
card_is_fusion_type
(
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