Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
aec68b62
You need to sign in or sign up before continuing.
Commit
aec68b62
authored
Dec 12, 2017
by
Momobako
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update_core
parent
8706ee6d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
173 additions
and
1 deletion
+173
-1
ocgcore/card.cpp
ocgcore/card.cpp
+40
-0
ocgcore/card.h
ocgcore/card.h
+3
-0
ocgcore/effect.h
ocgcore/effect.h
+4
-0
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+7
-0
ocgcore/libcard.cpp
ocgcore/libcard.cpp
+112
-1
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+7
-0
No files found.
ocgcore/card.cpp
View file @
aec68b62
...
...
@@ -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
;
...
...
ocgcore/card.h
View file @
aec68b62
...
...
@@ -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
();
...
...
ocgcore/effect.h
View file @
aec68b62
...
...
@@ -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
...
...
ocgcore/interpreter.cpp
View file @
aec68b62
...
...
@@ -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
},
...
...
ocgcore/libcard.cpp
View file @
aec68b62
...
...
@@ -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_tonumberint
(
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_tonumberint
(
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_tonumberint
(
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_tonumberint
(
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_tonumberint
(
L
,
2
);
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
2
&&
!
lua_isnil
(
L
,
3
))
playerid
=
lua_tonumberint
(
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_tonumberint
(
L
,
2
);
int32
playerid
=
PLAYER_NONE
;
if
(
lua_gettop
(
L
)
>
2
&&
!
lua_isnil
(
L
,
3
))
playerid
=
lua_tonumberint
(
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
);
...
...
ocgcore/scriptlib.h
View file @
aec68b62
...
...
@@ -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
);
...
...
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