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
nanahira
ygopro-core
Commits
e52629db
Commit
e52629db
authored
May 16, 2021
by
Chrono-Genex
Committed by
GitHub
May 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Card.GetAttributeInGrave, Card.GetRaceInGrave (#379)
parent
14759d2e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
0 deletions
+72
-0
card.cpp
card.cpp
+40
-0
card.h
card.h
+2
-0
effect.h
effect.h
+2
-0
libcard.cpp
libcard.cpp
+26
-0
scriptlib.h
scriptlib.h
+2
-0
No files found.
card.cpp
View file @
e52629db
...
...
@@ -1048,6 +1048,26 @@ uint32 card::get_link_attribute(uint8 playerid) {
}
return attribute;
}
uint32 card::get_grave_attribute(uint8 playerid) {
if(!(data.type & TYPE_MONSTER))
return 0;
if(current.is_location(LOCATION_GRAVE))
return get_attribute();
uint32 attribute = data.attribute;
effect_set eset;
pduel->game_field->filter_player_effect(playerid, EFFECT_CHANGE_GRAVE_ATTRIBUTE, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
if(!eset[i]->target)
attribute = eset[i]->get_value(this);
else {
pduel->lua->add_param(eset[i], PARAM_TYPE_EFFECT);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
if(pduel->lua->check_condition(eset[i]->target, 2))
attribute = eset[i]->get_value(this);
}
}
return attribute;
}
uint32 card::get_race() {
if(assume_type == ASSUME_RACE)
return assume_value;
...
...
@@ -1086,6 +1106,26 @@ uint32 card::get_link_race(uint8 playerid) {
}
return race;
}
uint32 card::get_grave_race(uint8 playerid) {
if(!(data.type & TYPE_MONSTER))
return 0;
if(current.is_location(LOCATION_GRAVE))
return get_race();
uint32 race = data.race;
effect_set eset;
pduel->game_field->filter_player_effect(playerid, EFFECT_CHANGE_GRAVE_RACE, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
if(!eset[i]->target)
race = eset[i]->get_value(this);
else {
pduel->lua->add_param(eset[i], PARAM_TYPE_EFFECT);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
if(pduel->lua->check_condition(eset[i]->target, 2))
race = eset[i]->get_value(this);
}
}
return race;
}
uint32 card::get_lscale() {
if(!current.is_location(LOCATION_PZONE))
return data.lscale;
...
...
card.h
View file @
e52629db
...
...
@@ -225,8 +225,10 @@ public:
uint32
get_attribute
();
uint32
get_fusion_attribute
(
uint8
playerid
);
uint32
get_link_attribute
(
uint8
playerid
);
uint32
get_grave_attribute
(
uint8
playerid
);
uint32
get_race
();
uint32
get_link_race
(
uint8
playerid
);
uint32
get_grave_race
(
uint8
playerid
);
uint32
get_lscale
();
uint32
get_rscale
();
uint32
get_link_marker
();
...
...
effect.h
View file @
e52629db
...
...
@@ -454,6 +454,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_SET_BATTLE_ATTACK 362
#define EFFECT_SET_BATTLE_DEFENSE 363
#define EFFECT_OVERLAY_RITUAL_MATERIAL 364
#define EFFECT_CHANGE_GRAVE_ATTRIBUTE 365
#define EFFECT_CHANGE_GRAVE_RACE 366
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
...
...
libcard.cpp
View file @
e52629db
...
...
@@ -563,6 +563,18 @@ int32 scriptlib::card_get_link_attribute(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
get_link_attribute
(
playerid
));
return
1
;
}
int32
scriptlib
::
card_get_attribute_in_grave
(
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
=
(
int32
)
lua_tointeger
(
L
,
2
);
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
lua_pushinteger
(
L
,
pcard
->
get_grave_attribute
(
playerid
));
return
1
;
}
int32
scriptlib
::
card_get_race
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -592,6 +604,18 @@ int32 scriptlib::card_get_link_race(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
get_link_race
(
playerid
));
return
1
;
}
int32
scriptlib
::
card_get_race_in_grave
(
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
=
(
int32
)
lua_tointeger
(
L
,
2
);
else
playerid
=
pcard
->
pduel
->
game_field
->
core
.
reason_player
;
lua_pushinteger
(
L
,
pcard
->
get_grave_race
(
playerid
));
return
1
;
}
int32
scriptlib
::
card_get_attack
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -3246,9 +3270,11 @@ static const struct luaL_Reg cardlib[] = {
{
"GetOriginalAttribute"
,
scriptlib
::
card_get_origin_attribute
},
{
"GetFusionAttribute"
,
scriptlib
::
card_get_fusion_attribute
},
{
"GetLinkAttribute"
,
scriptlib
::
card_get_link_attribute
},
{
"GetAttributeInGrave"
,
scriptlib
::
card_get_attribute_in_grave
},
{
"GetRace"
,
scriptlib
::
card_get_race
},
{
"GetOriginalRace"
,
scriptlib
::
card_get_origin_race
},
{
"GetLinkRace"
,
scriptlib
::
card_get_link_race
},
{
"GetRaceInGrave"
,
scriptlib
::
card_get_race_in_grave
},
{
"GetAttack"
,
scriptlib
::
card_get_attack
},
{
"GetBaseAttack"
,
scriptlib
::
card_get_origin_attack
},
{
"GetTextAttack"
,
scriptlib
::
card_get_text_attack
},
...
...
scriptlib.h
View file @
e52629db
...
...
@@ -66,9 +66,11 @@ public:
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_attribute_in_grave
(
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_race_in_grave
(
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
);
...
...
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