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
39fb7c86
Commit
39fb7c86
authored
Dec 10, 2023
by
Uytrewq
Committed by
GitHub
Dec 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Cad.GetSpecialSummonInfo, Card.IsSpecialSummonSetCard (#518)
parent
4cbd3096
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
186 additions
and
2 deletions
+186
-2
card.cpp
card.cpp
+96
-0
card.h
card.h
+17
-0
libcard.cpp
libcard.cpp
+65
-0
operations.cpp
operations.cpp
+6
-2
scriptlib.h
scriptlib.h
+2
-0
No files found.
card.cpp
View file @
39fb7c86
...
...
@@ -111,6 +111,7 @@ card::card(duel* pd) {
overlay_target
=
0
;
current
=
{};
previous
=
{};
spsummon
=
{};
temp
.
init_state
();
unique_pos
[
0
]
=
unique_pos
[
1
]
=
0
;
spsummon_counter
[
0
]
=
spsummon_counter
[
1
]
=
0
;
...
...
@@ -587,6 +588,45 @@ int32 card::is_link_set_card(uint32 set_code) {
}
return
FALSE
;
}
int32
card
::
is_special_summon_set_card
(
uint32
set_code
)
{
uint32
code
=
spsummon
.
code
;
uint64
setcode
;
if
(
code
==
data
.
code
)
{
setcode
=
data
.
setcode
;
}
else
{
card_data
dat
;
::
read_card
(
code
,
&
dat
);
setcode
=
dat
.
setcode
;
}
uint32
settype
=
set_code
&
0xfff
;
uint32
setsubtype
=
set_code
&
0xf000
;
while
(
setcode
)
{
if
((
setcode
&
0xfff
)
==
settype
&&
(
setcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
TRUE
;
setcode
=
setcode
>>
16
;
}
//add set code
for
(
auto
&
spsetcode
:
spsummon
.
setcode
)
{
if
(
spsetcode
&&
(
spsetcode
&
0xfff
)
==
settype
&&
(
spsetcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
TRUE
;
}
//another code
uint32
code2
=
spsummon
.
code2
;
uint64
setcode2
;
if
(
code2
!=
0
)
{
card_data
dat
;
::
read_card
(
code2
,
&
dat
);
setcode2
=
dat
.
setcode
;
}
else
{
return
FALSE
;
}
while
(
setcode2
)
{
if
((
setcode2
&
0xfff
)
==
settype
&&
(
setcode2
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
TRUE
;
setcode2
=
setcode2
>>
16
;
}
return
FALSE
;
}
uint32
card
::
get_type
()
{
if
(
assume_type
==
ASSUME_TYPE
)
return
assume_value
;
...
...
@@ -2508,6 +2548,62 @@ void card::clear_card_target() {
effect_target_owner
.
clear
();
effect_target_cards
.
clear
();
}
void
card
::
set_special_summon_status
(
effect
*
peffect
)
{
if
((
peffect
->
code
==
EFFECT_SPSUMMON_PROC
||
peffect
->
code
==
EFFECT_SPSUMMON_PROC_G
)
&&
peffect
->
is_flag
(
EFFECT_FLAG_CANNOT_DISABLE
)
&&
peffect
->
is_flag
(
EFFECT_FLAG_UNCOPYABLE
))
{
spsummon
.
code
=
0
;
spsummon
.
code2
=
0
;
spsummon
.
type
=
0
;
spsummon
.
level
=
0
;
spsummon
.
rank
=
0
;
spsummon
.
attribute
=
0
;
spsummon
.
race
=
0
;
spsummon
.
attack
=
0
;
spsummon
.
defense
=
0
;
spsummon
.
setcode
.
clear
();
spsummon
.
reason_effect
=
nullptr
;
return
;
}
card
*
pcard
=
peffect
->
get_handler
();
auto
cait
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
if
(
!
(
peffect
->
type
&
0x7f0
)
||
pcard
->
is_has_relation
(
*
cait
))
{
spsummon
.
code
=
pcard
->
get_code
();
spsummon
.
code2
=
pcard
->
get_another_code
();
spsummon
.
type
=
pcard
->
get_type
();
spsummon
.
level
=
pcard
->
get_level
();
spsummon
.
rank
=
pcard
->
get_rank
();
spsummon
.
attribute
=
pcard
->
get_attribute
();
spsummon
.
race
=
pcard
->
get_race
();
std
::
pair
<
int32
,
int32
>
atk_def
=
pcard
->
get_atk_def
();
spsummon
.
attack
=
atk_def
.
first
;
spsummon
.
defense
=
atk_def
.
second
;
spsummon
.
setcode
.
clear
();
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_SETCODE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
spsummon
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
));
}
spsummon
.
reason_effect
=
peffect
;
}
else
{
pcard
=
cait
->
triggering_effect
->
get_handler
();
spsummon
.
code
=
cait
->
triggering_state
.
code
;
spsummon
.
code2
=
cait
->
triggering_state
.
code2
;
spsummon
.
type
=
cait
->
triggering_effect
->
card_type
;
spsummon
.
level
=
cait
->
triggering_state
.
level
;
spsummon
.
rank
=
cait
->
triggering_state
.
rank
;
spsummon
.
attribute
=
cait
->
triggering_state
.
attribute
;
spsummon
.
race
=
cait
->
triggering_state
.
race
;
spsummon
.
attack
=
cait
->
triggering_state
.
attack
;
spsummon
.
defense
=
cait
->
triggering_state
.
defense
;
spsummon
.
setcode
.
clear
();
effect_set
eset
;
pcard
->
filter_effect
(
EFFECT_ADD_SETCODE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
spsummon
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
));
}
spsummon
.
reason_effect
=
cait
->
triggering_effect
;
}
}
void
card
::
filter_effect
(
int32
code
,
effect_set
*
eset
,
uint8
sort
)
{
effect
*
peffect
;
auto
rg
=
single_effect
.
equal_range
(
code
);
...
...
card.h
View file @
39fb7c86
...
...
@@ -157,6 +157,7 @@ public:
card_state
previous
;
card_state
temp
;
card_state
current
;
card_state
spsummon
;
query_cache
q_cache
;
uint8
owner
;
uint8
summon_player
;
...
...
@@ -227,6 +228,7 @@ public:
int32
is_pre_set_card
(
uint32
set_code
);
int32
is_fusion_set_card
(
uint32
set_code
);
int32
is_link_set_card
(
uint32
set_code
);
int32
is_special_summon_set_card
(
uint32
set_code
);
uint32
get_type
();
uint32
get_fusion_type
();
uint32
get_synchro_type
();
...
...
@@ -313,6 +315,7 @@ public:
void
add_card_target
(
card
*
pcard
);
void
cancel_card_target
(
card
*
pcard
);
void
clear_card_target
();
void
set_special_summon_status
(
effect
*
peffect
);
void
filter_effect
(
int32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
void
filter_single_continuous_effect
(
int32
code
,
effect_set
*
eset
,
uint8
sort
=
TRUE
);
...
...
@@ -399,10 +402,12 @@ public:
#define SUMMON_TYPE_XYZ 0x49000000
#define SUMMON_TYPE_PENDULUM 0x4a000000
#define SUMMON_TYPE_LINK 0x4c000000
//Counter
#define COUNTER_WITHOUT_PERMIT 0x1000
//#define COUNTER_NEED_ENABLE 0x2000
//Assume
#define ASSUME_CODE 1
#define ASSUME_TYPE 2
#define ASSUME_LEVEL 3
...
...
@@ -412,6 +417,18 @@ public:
#define ASSUME_ATTACK 7
#define ASSUME_DEFENSE 8
//Summon info
#define SUMMON_INFO_CODE 0x01
#define SUMMON_INFO_CODE2 0x02
#define SUMMON_INFO_TYPE 0x04
#define SUMMON_INFO_LEVEL 0x08
#define SUMMON_INFO_RANK 0x10
#define SUMMON_INFO_ATTRIBUTE 0x20
#define SUMMON_INFO_RACE 0x40
#define SUMMON_INFO_ATTACK 0x80
#define SUMMON_INFO_DEFENSE 0x100
#define SUMMON_INFO_REASON_EFFECT 0x200
//double-name cards
#define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930
...
...
libcard.cpp
View file @
39fb7c86
...
...
@@ -245,6 +245,24 @@ int32 scriptlib::card_is_link_set_card(lua_State *L) {
lua_pushboolean
(
L
,
result
);
return
1
;
}
int32
scriptlib
::
card_is_special_summon_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
count
=
lua_gettop
(
L
)
-
1
;
uint32
result
=
FALSE
;
for
(
uint32
i
=
0
;
i
<
count
;
++
i
)
{
if
(
lua_isnil
(
L
,
i
+
2
))
continue
;
uint32
set_code
=
(
uint32
)
lua_tointeger
(
L
,
i
+
2
);
if
(
pcard
->
is_special_summon_set_card
(
set_code
))
{
result
=
TRUE
;
break
;
}
}
lua_pushboolean
(
L
,
result
);
return
1
;
}
int32
scriptlib
::
card_get_type
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -865,6 +883,51 @@ int32 scriptlib::card_get_summon_player(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
summon_player
);
return
1
;
}
int32
scriptlib
::
card_get_special_summon_info
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
args
=
lua_gettop
(
L
)
-
1
;
for
(
uint32
i
=
0
;
i
<
args
;
++
i
)
{
uint32
flag
=
(
uint32
)
lua_tointeger
(
L
,
2
+
i
);
switch
(
flag
)
{
case
SUMMON_INFO_CODE
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
code
);
break
;
case
SUMMON_INFO_CODE2
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
code2
);
break
;
case
SUMMON_INFO_TYPE
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
type
);
break
;
case
SUMMON_INFO_LEVEL
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
level
);
break
;
case
SUMMON_INFO_RANK
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
rank
);
break
;
case
SUMMON_INFO_ATTRIBUTE
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
attribute
);
break
;
case
SUMMON_INFO_RACE
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
race
);
break
;
case
SUMMON_INFO_ATTACK
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
attack
);
break
;
case
SUMMON_INFO_DEFENSE
:
lua_pushinteger
(
L
,
pcard
->
spsummon
.
defense
);
break
;
case
SUMMON_INFO_REASON_EFFECT
:
interpreter
::
effect2value
(
L
,
pcard
->
spsummon
.
reason_effect
);
break
;
default:
lua_pushnil
(
L
);
break
;
}
}
return
args
;
}
int32
scriptlib
::
card_get_destination
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
@@ -3322,6 +3385,7 @@ static const struct luaL_Reg cardlib[] = {
{
"IsPreviousSetCard"
,
scriptlib
::
card_is_pre_set_card
},
{
"IsFusionSetCard"
,
scriptlib
::
card_is_fusion_set_card
},
{
"IsLinkSetCard"
,
scriptlib
::
card_is_link_set_card
},
{
"IsSpecialSummonSetCard"
,
scriptlib
::
card_is_special_summon_set_card
},
{
"GetType"
,
scriptlib
::
card_get_type
},
{
"GetOriginalType"
,
scriptlib
::
card_get_origin_type
},
{
"GetFusionType"
,
scriptlib
::
card_get_fusion_type
},
...
...
@@ -3395,6 +3459,7 @@ static const struct luaL_Reg cardlib[] = {
{
"GetSummonType"
,
scriptlib
::
card_get_summon_type
},
{
"GetSummonLocation"
,
scriptlib
::
card_get_summon_location
},
{
"GetSummonPlayer"
,
scriptlib
::
card_get_summon_player
},
{
"GetSpecialSummonInfo"
,
scriptlib
::
card_get_special_summon_info
},
{
"GetDestination"
,
scriptlib
::
card_get_destination
},
{
"GetLeaveFieldDest"
,
scriptlib
::
card_get_leave_field_dest
},
{
"GetTurnID"
,
scriptlib
::
card_get_turnid
},
...
...
operations.cpp
View file @
39fb7c86
...
...
@@ -2940,13 +2940,15 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
return
FALSE
;
}
case
17
:
{
effect
*
proc
=
core
.
units
.
begin
()
->
peffect
;
set_spsummon_counter
(
sumplayer
);
check_card_counter
(
target
,
ACTIVITY_SPSUMMON
,
sumplayer
);
if
(
target
->
spsummon_code
)
++
core
.
spsummon_once_map
[
sumplayer
][
target
->
spsummon_code
];
raise_single_event
(
target
,
0
,
EVENT_SPSUMMON_SUCCESS
,
core
.
units
.
begin
()
->
peffect
,
0
,
sumplayer
,
sumplayer
,
0
);
target
->
set_special_summon_status
(
proc
);
raise_single_event
(
target
,
0
,
EVENT_SPSUMMON_SUCCESS
,
proc
,
0
,
sumplayer
,
sumplayer
,
0
);
process_single_event
();
raise_event
(
target
,
EVENT_SPSUMMON_SUCCESS
,
core
.
units
.
begin
()
->
peffect
,
0
,
sumplayer
,
sumplayer
,
0
);
raise_event
(
target
,
EVENT_SPSUMMON_SUCCESS
,
proc
,
0
,
sumplayer
,
sumplayer
,
0
);
process_instant_event
();
if
(
core
.
current_chain
.
size
()
==
0
)
{
adjust_all
();
...
...
@@ -3133,6 +3135,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
for
(
auto
&
pcard
:
pgroup
->
container
)
{
if
(
pcard
->
spsummon_code
)
spsummon_once_set
.
insert
(
pcard
->
spsummon_code
);
pcard
->
set_special_summon_status
(
pcard
->
current
.
reason_effect
);
}
for
(
auto
&
cit
:
spsummon_once_set
)
++
core
.
spsummon_once_map
[
sumplayer
][
cit
];
...
...
@@ -3335,6 +3338,7 @@ int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_pla
pduel
->
write_buffer8
(
MSG_SPSUMMONED
);
for
(
auto
&
pcard
:
targets
->
container
)
{
check_card_counter
(
pcard
,
ACTIVITY_SPSUMMON
,
pcard
->
summon_player
);
pcard
->
set_special_summon_status
(
pcard
->
current
.
reason_effect
);
if
(
!
(
pcard
->
current
.
position
&
POS_FACEDOWN
))
raise_single_event
(
pcard
,
0
,
EVENT_SPSUMMON_SUCCESS
,
pcard
->
current
.
reason_effect
,
0
,
pcard
->
current
.
reason_player
,
pcard
->
summon_player
,
0
);
int32
summontype
=
pcard
->
summon_info
&
0xff000000
;
...
...
scriptlib.h
View file @
39fb7c86
...
...
@@ -30,6 +30,7 @@ public:
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_is_special_summon_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
);
...
...
@@ -133,6 +134,7 @@ public:
static
int32
card_is_summon_type
(
lua_State
*
L
);
static
int32
card_is_summon_location
(
lua_State
*
L
);
static
int32
card_is_summon_player
(
lua_State
*
L
);
static
int32
card_get_special_summon_info
(
lua_State
*
L
);
static
int32
card_is_status
(
lua_State
*
L
);
static
int32
card_is_not_tuner
(
lua_State
*
L
);
static
int32
card_is_tuner
(
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