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
96ca3ab7
Commit
96ca3ab7
authored
Feb 09, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of ../../versions/ygopro-mc/ocgcore into develop
parents
5bebf72b
e0acb211
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
270 additions
and
224 deletions
+270
-224
card.cpp
card.cpp
+75
-120
card.h
card.h
+6
-4
card_data.h
card_data.h
+48
-13
common.h
common.h
+20
-20
field.h
field.h
+5
-3
interpreter.cpp
interpreter.cpp
+1
-1
libduel.cpp
libduel.cpp
+57
-16
ocgapi.h
ocgapi.h
+0
-1
operations.cpp
operations.cpp
+56
-36
playerop.cpp
playerop.cpp
+1
-9
processor.cpp
processor.cpp
+1
-1
No files found.
card.cpp
View file @
96ca3ab7
...
...
@@ -466,7 +466,7 @@ uint32 card::get_info_location() {
}
// get the printed code on card
uint32
card
::
get_original_code
()
const
{
if
(
data
.
alias
&&
(
data
.
alias
<
data
.
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
data
.
code
<
data
.
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
))
if
(
data
.
is_alternative
(
))
return
data
.
alias
;
else
return
data
.
code
;
...
...
@@ -521,95 +521,66 @@ uint32 card::get_another_code() {
return
otcode
;
return
0
;
}
inline
bool
check_setcode
(
uint16_t
setcode
,
uint32
value
)
{
uint16_t
settype
=
value
&
0x0fff
;
uint16_t
setsubtype
=
value
&
0xf000
;
return
(
setcode
&
0x0fff
)
==
settype
&&
(
setcode
&
0xf000
&
setsubtype
)
==
setsubtype
;
}
bool
card
::
check_card_setcode
(
uint32
code
,
uint32
value
)
{
card_data
dat
;
::
read_card
(
code
,
&
dat
);
return
dat
.
is_setcode
(
value
);
}
int32
card
::
is_set_card
(
uint32
set_code
)
{
uint32
code
=
get_code
();
uint64
setcode
;
if
(
code
==
data
.
code
)
{
setcode
=
data
.
setcode
;
}
else
{
card_data
dat
;
::
read_card
(
code
,
&
dat
);
setcode
=
dat
.
setcode
;
uint32
code1
=
get_code
();
card_data
dat1
;
if
(
code1
==
data
.
code
)
{
if
(
data
.
is_setcode
(
set_code
))
return
TRUE
;
}
uint32
settype
=
set_code
&
0xfff
;
uint32
setsubtype
=
set_code
&
0xf000
;
while
(
setcode
)
{
if
((
setcode
&
0xfff
)
==
settype
&&
(
setcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
else
{
if
(
check_card_setcode
(
code1
,
set_code
))
return
TRUE
;
setcode
=
setcode
>>
16
;
}
uint32
code2
=
get_another_code
();
if
(
code2
&&
check_card_setcode
(
code2
,
set_code
))
return
TRUE
;
//add set code
effect_set
eset
;
filter_effect
(
EFFECT_ADD_SETCODE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint32
value
=
eset
[
i
]
->
get_value
(
this
);
if
((
value
&
0xfff
)
==
settype
&&
(
value
&
0xf000
&
setsubtype
)
==
setsubtype
)
uint16_t
new_setcode
=
value
&
0xffff
;
if
(
check_setcode
(
new_setcode
,
set_code
))
return
TRUE
;
}
//another code
uint32
code2
=
get_another_code
();
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
;
}
int32
card
::
is_origin_set_card
(
uint32
set_code
)
{
uint64
setcode
=
data
.
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
;
}
if
(
data
.
is_setcode
(
set_code
))
return
TRUE
;
uint32
code2
=
std
::
get
<
1
>
(
get_original_code_rule
());
if
(
code2
&&
check_card_setcode
(
code2
,
set_code
))
return
TRUE
;
return
FALSE
;
}
int32
card
::
is_pre_set_card
(
uint32
set_code
)
{
uint32
code
=
previous
.
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
)
if
(
data
.
is_setcode
(
set_code
))
return
TRUE
;
setcode
=
setcode
>>
16
;
}
//add set code
for
(
auto
&
presetcode
:
previous
.
setcode
)
{
if
(
presetcode
&&
(
presetcode
&
0xfff
)
==
settype
&&
(
presetcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
else
{
if
(
check_card_setcode
(
code
,
set_code
))
return
TRUE
;
}
//another code
uint32
code2
=
previous
.
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
)
if
(
code2
&&
check_card_setcode
(
code2
,
set_code
))
return
TRUE
;
//add set code
for
(
auto
&
presetcode
:
previous
.
setcode
)
{
if
(
check_setcode
(
presetcode
,
set_code
))
return
TRUE
;
setcode2
=
setcode2
>>
16
;
}
return
FALSE
;
}
...
...
@@ -618,26 +589,19 @@ int32 card::is_fusion_set_card(uint32 set_code) {
return
TRUE
;
if
(
pduel
->
game_field
->
core
.
not_material
)
return
FALSE
;
uint32
settype
=
set_code
&
0xfff
;
uint32
setsubtype
=
set_code
&
0xf000
;
effect_set
eset
;
filter_effect
(
EFFECT_ADD_FUSION_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
;
}
if
(
check_card_setcode
(
code
,
set_code
))
return
TRUE
;
}
eset
.
clear
();
filter_effect
(
EFFECT_ADD_FUSION_SETCODE
,
&
eset
);
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
uint32
setcode
=
eset
[
i
]
->
get_value
(
this
);
if
((
setcode
&
0xfff
)
==
settype
&&
(
setcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
uint32
value
=
eset
[
i
]
->
get_value
(
this
);
uint16_t
new_setcode
=
value
&
0xffff
;
if
(
check_setcode
(
new_setcode
,
set_code
))
return
TRUE
;
}
return
FALSE
;
...
...
@@ -651,54 +615,23 @@ int32 card::is_link_set_card(uint32 set_code) {
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
;
}
if
(
check_card_setcode
(
code
,
set_code
))
return
TRUE
;
}
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
;
}
if
(
check_card_setcode
(
code
,
set_code
))
return
TRUE
;
uint32
code2
=
spsummon
.
code2
;
if
(
code2
&&
check_card_setcode
(
code2
,
set_code
))
return
TRUE
;
//add set code
for
(
auto
&
spsetcode
:
spsummon
.
setcode
)
{
if
(
spsetcode
&&
(
spsetcode
&
0xfff
)
==
settype
&&
(
spsetcode
&
0xf000
&
setsubtype
)
==
setsubtype
)
if
(
check_setcode
(
spsetcode
,
set_code
)
)
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
()
{
...
...
@@ -2725,7 +2658,7 @@ void card::set_special_summon_status(effect* peffect) {
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
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
)
&
0xffff
);
}
spsummon
.
reason_effect
=
peffect
;
spsummon
.
reason_player
=
peffect
->
get_handler_player
();
...
...
@@ -2744,7 +2677,7 @@ void card::set_special_summon_status(effect* peffect) {
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
.
setcode
.
push_back
((
uint32
)
eset
[
i
]
->
get_value
(
pcard
)
&
0xffff
);
}
spsummon
.
reason_effect
=
cait
->
triggering_effect
;
spsummon
.
reason_player
=
cait
->
triggering_player
;
...
...
@@ -3576,6 +3509,28 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
pduel
->
game_field
->
restore_lp_cost
();
return
TRUE
;
}
int32
card
::
is_summon_negatable
(
uint32
sumtype
,
effect
*
reason_effect
)
{
uint32
code
=
0
;
if
(
sumtype
&
SUMMON_TYPE_NORMAL
)
code
=
EFFECT_CANNOT_DISABLE_SUMMON
;
else
if
(
sumtype
&
SUMMON_TYPE_FLIP
)
code
=
EFFECT_CANNOT_DISABLE_FLIP_SUMMON
;
else
if
(
sumtype
&
SUMMON_TYPE_SPECIAL
)
code
=
EFFECT_CANNOT_DISABLE_SPSUMMON
;
else
return
FALSE
;
if
(
is_affected_by_effect
(
code
))
return
FALSE
;
if
(
sumtype
==
SUMMON_TYPE_DUAL
||
sumtype
&
SUMMON_TYPE_FLIP
)
{
if
(
!
is_status
(
STATUS_FLIP_SUMMONING
))
return
FALSE
;
if
(
!
is_affect_by_effect
(
reason_effect
))
return
FALSE
;
if
(
sumtype
==
SUMMON_TYPE_DUAL
&&
(
!
is_affected_by_effect
(
EFFECT_DUAL_SUMMONABLE
)
||
is_affected_by_effect
(
EFFECT_DUAL_STATUS
)))
return
FALSE
;
}
return
TRUE
;
}
int32
card
::
get_summon_tribute_count
()
{
int32
min
=
0
,
max
=
0
;
int32
level
=
get_level
();
...
...
@@ -4047,8 +4002,8 @@ int32 card::is_capable_send_to_hand(uint8 playerid) {
return
FALSE
;
return
TRUE
;
}
int32
card
::
is_capable_send_to_deck
(
uint8
playerid
)
{
if
(
is_status
(
STATUS_LEAVE_CONFIRMED
))
int32
card
::
is_capable_send_to_deck
(
uint8
playerid
,
uint8
send_activating
)
{
if
(
!
send_activating
&&
is_status
(
STATUS_LEAVE_CONFIRMED
))
return
FALSE
;
if
((
current
.
location
==
LOCATION_EXTRA
)
&&
is_extra_deck_monster
())
return
FALSE
;
...
...
card.h
View file @
96ca3ab7
...
...
@@ -26,7 +26,7 @@ struct chain;
struct
card_state
{
uint32
code
{
0
};
uint32
code2
{
0
};
std
::
vector
<
uint
32
>
setcode
;
std
::
vector
<
uint
16_t
>
setcode
;
uint32
type
{
0
};
uint32
level
{
0
};
uint32
rank
{
0
};
...
...
@@ -226,6 +226,7 @@ public:
std
::
tuple
<
uint32
,
uint32
>
get_original_code_rule
()
const
;
uint32
get_code
();
uint32
get_another_code
();
static
bool
check_card_setcode
(
uint32
code
,
uint32
value
);
int32
is_set_card
(
uint32
set_code
);
int32
is_origin_set_card
(
uint32
set_code
);
int32
is_pre_set_card
(
uint32
set_code
);
...
...
@@ -349,6 +350,7 @@ public:
int32
is_spsummonable
(
effect
*
proc
,
material_info
info
=
null_info
);
int32
is_summonable
(
effect
*
proc
,
uint8
min_tribute
,
uint32
zone
=
0x1f
,
uint32
releasable
=
0xff00ff
);
int32
is_can_be_summoned
(
uint8
playerid
,
uint8
ingore_count
,
effect
*
peffect
,
uint8
min_tribute
,
uint32
zone
=
0x1f
);
int32
is_summon_negatable
(
uint32
sumtype
,
effect
*
reason_effect
);
int32
get_summon_tribute_count
();
int32
get_set_tribute_count
();
int32
is_can_be_flip_summoned
(
uint8
playerid
);
...
...
@@ -372,7 +374,7 @@ public:
int32
is_releasable_by_effect
(
uint8
playerid
,
effect
*
reason_effect
);
int32
is_capable_send_to_grave
(
uint8
playerid
);
int32
is_capable_send_to_hand
(
uint8
playerid
);
int32
is_capable_send_to_deck
(
uint8
playerid
);
int32
is_capable_send_to_deck
(
uint8
playerid
,
uint8
send_activating
=
FALSE
);
int32
is_capable_send_to_extra
(
uint8
playerid
);
int32
is_capable_cost_to_grave
(
uint8
playerid
);
int32
is_capable_cost_to_hand
(
uint8
playerid
);
...
...
@@ -417,6 +419,8 @@ public:
#define SUMMON_VALUE_CUSTOM_TYPE 0x0000ffff
constexpr
uint32
DEFAULT_SUMMON_TYPE
=
SUMMON_VALUE_MAIN_TYPE
|
SUMMON_VALUE_SUB_TYPE
|
SUMMON_VALUE_CUSTOM_TYPE
;
#define SUMMON_VALUE_FUTURE_FUSION 0x18
//Counter
#define COUNTER_WITHOUT_PERMIT 0x1000
//#define COUNTER_NEED_ENABLE 0x2000
...
...
@@ -444,6 +448,4 @@ constexpr uint32 DEFAULT_SUMMON_TYPE = SUMMON_VALUE_MAIN_TYPE | SUMMON_VALUE_SUB
#define SUMMON_INFO_REASON_EFFECT 0x200
#define SUMMON_INFO_REASON_PLAYER 0x400
#define CARD_ARTWORK_VERSIONS_OFFSET 10
#endif
/* CARD_H_ */
card_data.h
View file @
96ca3ab7
#ifndef CARD_DATA_H_
#define CARD_DATA_H_
#include "common.h"
constexpr
int
CARD_ARTWORK_VERSIONS_OFFSET
=
10
;
constexpr
int
SIZE_SETCODE
=
16
;
struct
card_data
{
uint32
code
{
0
};
uint32
alias
{
0
};
uint
64
setcode
{
0
};
uint32
type
{
0
};
uint32
level
{
0
};
uint32
attribute
{
0
};
uint32
race
{
0
};
int32
attack
{
0
};
int32
defense
{
0
};
uint32
lscale
{
0
};
uint32
rscale
{
0
};
uint32
link_marker
{
0
};
uint32
code
{};
uint32
alias
{};
uint
16_t
setcode
[
SIZE_SETCODE
]{
};
uint32
type
{};
uint32
level
{};
uint32
attribute
{};
uint32
race
{};
int32
attack
{};
int32
defense
{};
uint32
lscale
{};
uint32
rscale
{};
uint32
link_marker
{};
void
clear
()
{
code
=
0
;
alias
=
0
;
setcode
=
0
;
for
(
auto
&
x
:
setcode
)
x
=
0
;
type
=
0
;
level
=
0
;
attribute
=
0
;
...
...
@@ -29,6 +35,35 @@ struct card_data {
rscale
=
0
;
link_marker
=
0
;
}
bool
is_setcode
(
uint32
value
)
const
{
uint16_t
settype
=
value
&
0x0fff
;
uint16_t
setsubtype
=
value
&
0xf000
;
for
(
auto
&
x
:
setcode
)
{
if
((
x
&
0x0fff
)
==
settype
&&
(
x
&
0xf000
&
setsubtype
)
==
setsubtype
)
return
true
;
if
(
!
x
)
return
false
;
}
return
false
;
}
bool
is_alternative
()
const
{
return
alias
&&
(
alias
<
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
code
<
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
);
}
void
set_setcode
(
uint64
value
)
{
int
ctr
=
0
;
while
(
value
)
{
if
(
value
&
0xffff
)
{
setcode
[
ctr
]
=
value
&
0xffff
;
++
ctr
;
}
value
>>=
16
;
}
for
(
int
i
=
ctr
;
i
<
SIZE_SETCODE
;
++
i
)
setcode
[
i
]
=
0
;
}
};
#endif
/* CARD_DATA_H_ */
common.h
View file @
96ca3ab7
...
...
@@ -180,27 +180,27 @@ struct card_sort {
#define REASONS_PROCEDURE (REASON_SYNCHRO | REASON_XYZ | REASON_LINK)
//Status
#define STATUS_DISABLED 0x0001
//
#define STATUS_TO_ENABLE 0x0002
//
#define STATUS_TO_DISABLE 0x0004
//
#define STATUS_PROC_COMPLETE 0x0008
//
#define STATUS_SET_TURN 0x0010
//
#define STATUS_NO_LEVEL 0x0020
//
#define STATUS_BATTLE_RESULT 0x0040
//
#define STATUS_SPSUMMON_STEP 0x0080
//
#define STATUS_FORM_CHANGED 0x0100
//
#define STATUS_SUMMONING 0x0200
//
#define STATUS_EFFECT_ENABLED 0x0400
//
#define STATUS_SUMMON_TURN 0x0800
//
#define STATUS_DESTROY_CONFIRMED 0x1000
//
#define STATUS_LEAVE_CONFIRMED 0x2000
//
#define STATUS_BATTLE_DESTROYED 0x4000
//
#define STATUS_COPYING_EFFECT 0x8000
//
#define STATUS_CHAINING 0x10000
//
#define STATUS_SUMMON_DISABLED 0x20000
//
#define STATUS_ACTIVATE_DISABLED 0x40000
//
#define STATUS_DISABLED 0x0001
#define STATUS_TO_ENABLE 0x0002
#define STATUS_TO_DISABLE 0x0004
#define STATUS_PROC_COMPLETE 0x0008
#define STATUS_SET_TURN 0x0010
#define STATUS_NO_LEVEL 0x0020
#define STATUS_BATTLE_RESULT 0x0040
#define STATUS_SPSUMMON_STEP 0x0080
#define STATUS_FORM_CHANGED 0x0100
#define STATUS_SUMMONING 0x0200
#define STATUS_EFFECT_ENABLED 0x0400
#define STATUS_SUMMON_TURN 0x0800
#define STATUS_DESTROY_CONFIRMED 0x1000
#define STATUS_LEAVE_CONFIRMED 0x2000
#define STATUS_BATTLE_DESTROYED 0x4000
#define STATUS_COPYING_EFFECT 0x8000
#define STATUS_CHAINING 0x10000
#define STATUS_SUMMON_DISABLED 0x20000
#define STATUS_ACTIVATE_DISABLED 0x40000
#define STATUS_EFFECT_REPLACED 0x80000
#define STATUS_F
UTURE_FUSION
0x100000
#define STATUS_F
LIP_SUMMONING
0x100000
#define STATUS_ATTACK_CANCELED 0x200000
#define STATUS_INITIALIZING 0x400000
#define STATUS_TO_HAND_WITHOUT_CONFIRM 0x800000
...
...
field.h
View file @
96ca3ab7
...
...
@@ -308,6 +308,8 @@ struct processor {
uint8
coin_result
[
MAX_COIN_COUNT
]{};
int32
coin_count
{
0
};
bool
is_target_ready
{
false
};
bool
is_gemini_summoning
{
false
};
bool
is_summon_negated
{
false
};
uint8
to_bp
{
FALSE
};
uint8
to_m2
{
FALSE
};
...
...
@@ -572,8 +574,8 @@ public:
void
destroy
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
=
2
,
uint32
destination
=
0
,
uint32
sequence
=
0
);
void
release
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
release
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
);
void
send_to
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
);
void
send_to
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
);
void
send_to
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
send_to
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
destination
,
uint32
sequence
,
uint32
position
,
uint8
send_activating
=
FALSE
);
void
move_to_field
(
card
*
target
,
uint32
move_player
,
uint32
playerid
,
uint32
destination
,
uint32
positions
,
uint32
enable
=
FALSE
,
uint32
ret
=
0
,
uint32
pzone
=
FALSE
,
uint32
zone
=
0xff
);
void
change_position
(
card_set
*
targets
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
au
,
uint32
ad
,
uint32
du
,
uint32
dd
,
uint32
flag
,
uint32
enable
=
FALSE
);
void
change_position
(
card
*
target
,
effect
*
reason_effect
,
uint32
reason_player
,
uint32
npos
,
uint32
flag
,
uint32
enable
=
FALSE
);
...
...
@@ -605,7 +607,7 @@ public:
int32
release_replace
(
uint16
step
,
group
*
targets
,
card
*
target
);
int32
release
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
);
int32
send_replace
(
uint16
step
,
group
*
targets
,
card
*
target
);
int32
send_to
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
);
int32
send_to
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
send_activating
);
int32
discard_deck
(
uint16
step
,
uint8
playerid
,
uint8
count
,
uint32
reason
);
int32
move_to_field
(
uint16
step
,
card
*
target
,
uint32
enable
,
uint32
ret
,
uint32
pzone
,
uint32
zone
);
int32
change_position
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint8
reason_player
,
uint32
enable
);
...
...
interpreter.cpp
View file @
96ca3ab7
...
...
@@ -144,7 +144,7 @@ int32 interpreter::register_card(card *pcard) {
//some userdata may be created in script like token so use current_state
lua_rawgeti
(
current_state
,
LUA_REGISTRYINDEX
,
pcard
->
ref_handle
);
//load script
if
(
pcard
->
data
.
alias
&&
(
pcard
->
data
.
alias
<
pcard
->
data
.
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
pcard
->
data
.
code
<
pcard
->
data
.
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
))
if
(
pcard
->
data
.
is_alternative
(
))
load_card_script
(
pcard
->
data
.
alias
);
else
load_card_script
(
pcard
->
data
.
code
);
...
...
libduel.cpp
View file @
96ca3ab7
...
...
@@ -882,12 +882,15 @@ int32 scriptlib::duel_sendto_deck(lua_State *L) {
uint32
sequence
=
(
uint32
)
lua_tointeger
(
L
,
3
);
uint32
reason
=
(
uint32
)
lua_tointeger
(
L
,
4
);
uint32
reason_player
=
pduel
->
game_field
->
core
.
reason_player
;
uint8
send_activating
=
FALSE
;
if
(
lua_gettop
(
L
)
>=
5
)
reason_player
=
(
uint32
)
lua_tointeger
(
L
,
5
);
if
(
pcard
)
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
reason_player
,
playerid
,
LOCATION_DECK
,
sequence
,
POS_FACEUP
);
if
(
lua_gettop
(
L
)
>=
6
)
send_activating
=
(
uint8
)
lua_toboolean
(
L
,
6
);
if
(
pcard
)
pduel
->
game_field
->
send_to
(
pcard
,
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
reason_player
,
playerid
,
LOCATION_DECK
,
sequence
,
POS_FACEUP
,
send_activating
);
else
pduel
->
game_field
->
send_to
(
&
(
pgroup
->
container
),
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
reason_player
,
playerid
,
LOCATION_DECK
,
sequence
,
POS_FACEUP
);
pduel
->
game_field
->
send_to
(
&
(
pgroup
->
container
),
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
reason_player
,
playerid
,
LOCATION_DECK
,
sequence
,
POS_FACEUP
,
send_activating
);
return
lua_yieldk
(
L
,
0
,
(
lua_KContext
)
pduel
,
[](
lua_State
*
L
,
int32
status
,
lua_KContext
ctx
)
{
duel
*
pduel
=
(
duel
*
)
ctx
;
lua_pushinteger
(
L
,
pduel
->
game_field
->
returns
.
ivalue
[
0
]);
...
...
@@ -2051,30 +2054,66 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
pduel
=
pgroup
->
pduel
;
}
else
return
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
uint32
sumtype
=
0
;
if
(
pduel
->
game_field
->
check_event
(
EVENT_SUMMON
))
{
if
(
pduel
->
game_field
->
core
.
is_gemini_summoning
)
sumtype
=
SUMMON_TYPE_DUAL
;
else
sumtype
=
SUMMON_TYPE_NORMAL
;
}
else
if
(
pduel
->
game_field
->
check_event
(
EVENT_FLIP_SUMMON
))
sumtype
=
SUMMON_TYPE_FLIP
;
else
if
(
pduel
->
game_field
->
check_event
(
EVENT_SPSUMMON
))
sumtype
=
SUMMON_TYPE_SPECIAL
;
else
return
0
;
if
(
sumtype
&
SUMMON_TYPE_NORMAL
||
sumtype
&
SUMMON_TYPE_FLIP
)
{
if
(
pgroup
&&
pgroup
->
container
.
size
()
!=
1
)
return
0
;
if
(
!
pcard
)
pcard
=
*
pgroup
->
container
.
begin
();
}
uint8
sumplayer
=
PLAYER_NONE
;
if
(
pcard
)
{
effect
*
reason_effect
=
pduel
->
game_field
->
core
.
reason_effect
;
field
::
card_set
negated_cards
;
if
(
sumtype
==
SUMMON_TYPE_DUAL
||
sumtype
&
SUMMON_TYPE_FLIP
)
{
if
(
!
pcard
->
is_summon_negatable
(
sumtype
,
reason_effect
))
return
0
;
sumplayer
=
pcard
->
summon_player
;
pcard
->
set_status
(
STATUS_SUMMONING
,
FALSE
);
pcard
->
set_status
(
STATUS_
FLIP_
SUMMONING
,
FALSE
);
pcard
->
set_status
(
STATUS_SUMMON_DISABLED
,
TRUE
);
if
(
!
match_all
(
pcard
->
summon_info
,
SUMMON_TYPE_FLIP
)
&&
!
match_all
(
pcard
->
summon_info
,
SUMMON_TYPE_DUAL
))
pcard
->
set_status
(
STATUS_PROC_COMPLETE
,
FALSE
);
}
else
{
for
(
auto
&
pcard
:
pgroup
->
container
)
{
}
else
{
if
(
pcard
)
{
if
(
!
pcard
->
is_summon_negatable
(
sumtype
,
reason_effect
))
return
0
;
sumplayer
=
pcard
->
summon_player
;
pcard
->
set_status
(
STATUS_SUMMONING
,
FALSE
);
pcard
->
set_status
(
STATUS_SUMMON_DISABLED
,
TRUE
);
if
(
!
match_all
(
pcard
->
summon_info
,
SUMMON_TYPE_FLIP
)
&&
!
match_all
(
pcard
->
summon_info
,
SUMMON_TYPE_DUAL
))
pcard
->
set_status
(
STATUS_PROC_COMPLETE
,
FALSE
);
}
else
{
for
(
auto
&
pcard
:
pgroup
->
container
)
{
if
(
!
pcard
->
is_summon_negatable
(
sumtype
,
reason_effect
))
continue
;
sumplayer
=
pcard
->
summon_player
;
pcard
->
set_status
(
STATUS_SUMMONING
,
FALSE
);
pcard
->
set_status
(
STATUS_SUMMON_DISABLED
,
TRUE
);
pcard
->
set_status
(
STATUS_PROC_COMPLETE
,
FALSE
);
negated_cards
.
insert
(
pcard
);
}
if
(
!
negated_cards
.
size
())
return
0
;
}
}
pduel
->
game_field
->
core
.
is_summon_negated
=
true
;
uint32
event_code
=
0
;
if
(
pduel
->
game_field
->
check_event
(
EVENT_SUMMON
)
)
if
(
sumtype
&
SUMMON_TYPE_NORMAL
)
event_code
=
EVENT_SUMMON_NEGATED
;
else
if
(
pduel
->
game_field
->
check_event
(
EVENT_FLIP_SUMMON
)
)
else
if
(
sumtype
&
SUMMON_TYPE_FLIP
)
event_code
=
EVENT_FLIP_SUMMON_NEGATED
;
else
if
(
pduel
->
game_field
->
check_event
(
EVENT_SPSUMMON
)
)
else
if
(
sumtype
&
SUMMON_TYPE_SPECIAL
)
event_code
=
EVENT_SPSUMMON_NEGATED
;
effect
*
reason_effect
=
pduel
->
game_field
->
core
.
reason_effect
;
uint8
reason_player
=
pduel
->
game_field
->
core
.
reason_player
;
if
(
pcard
)
pduel
->
game_field
->
raise_event
(
pcard
,
event_code
,
reason_effect
,
REASON_EFFECT
,
reason_player
,
sumplayer
,
0
);
...
...
@@ -4547,8 +4586,10 @@ int32 scriptlib::duel_is_player_can_spsummon_monster(lua_State * L) {
::
read_card
(
code
,
&
dat
);
dat
.
code
=
code
;
dat
.
alias
=
0
;
if
(
!
lua_isnil
(
L
,
3
))
dat
.
setcode
=
lua_tointeger
(
L
,
3
);
if
(
!
lua_isnil
(
L
,
3
))
{
uint64
setcode_list
=
lua_tointeger
(
L
,
3
);
dat
.
set_setcode
(
setcode_list
);
}
if
(
!
lua_isnil
(
L
,
4
))
dat
.
type
=
(
uint32
)
lua_tointeger
(
L
,
4
);
if
(
!
lua_isnil
(
L
,
5
))
...
...
ocgapi.h
View file @
96ca3ab7
...
...
@@ -22,7 +22,6 @@
class
card
;
struct
card_data
;
struct
card_info
;
class
group
;
class
effect
;
class
interpreter
;
...
...
operations.cpp
View file @
96ca3ab7
This diff is collapsed.
Click to expand it.
playerop.cpp
View file @
96ca3ab7
...
...
@@ -920,15 +920,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
if
(
stack
.
size
()
>=
1
)
{
int32
set_code
=
stack
.
top
();
stack
.
pop
();
uint64
sc
=
cd
.
setcode
;
bool
res
=
false
;
uint32
settype
=
set_code
&
0xfff
;
uint32
setsubtype
=
set_code
&
0xf000
;
while
(
sc
)
{
if
((
sc
&
0xfff
)
==
settype
&&
(
sc
&
0xf000
&
setsubtype
)
==
setsubtype
)
res
=
true
;
sc
=
sc
>>
16
;
}
bool
res
=
cd
.
is_setcode
(
set_code
);
stack
.
push
(
res
);
}
break
;
...
...
processor.cpp
View file @
96ca3ab7
...
...
@@ -308,7 +308,7 @@ uint32 field::process() {
return
pduel
->
message_buffer
.
size
();
}
case
PROCESSOR_SENDTO
:
{
if
(
send_to
(
it
->
step
,
it
->
ptarget
,
it
->
peffect
,
it
->
arg1
,
it
->
arg2
))
if
(
send_to
(
it
->
step
,
it
->
ptarget
,
it
->
peffect
,
it
->
arg1
,
it
->
arg2
,
it
->
arg3
))
core
.
units
.
pop_front
();
else
++
it
->
step
;
...
...
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