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
58a842d4
Commit
58a842d4
authored
Jul 01, 2017
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
e9200055
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
143 additions
and
143 deletions
+143
-143
field.cpp
field.cpp
+10
-0
field.h
field.h
+3
-0
interpreter.cpp
interpreter.cpp
+1
-0
libduel.cpp
libduel.cpp
+50
-114
operations.cpp
operations.cpp
+43
-0
processor.cpp
processor.cpp
+35
-29
scriptlib.h
scriptlib.h
+1
-0
No files found.
field.cpp
View file @
58a842d4
...
...
@@ -3182,6 +3182,16 @@ int32 field::check_chain_target(uint8 chaincount, card * pcard) {
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
return
pduel
->
lua
->
check_condition
(
peffect
->
target
,
10
);
}
chain
*
field
::
get_chain
(
uint32
chaincount
)
{
if
(
chaincount
==
0
&&
core
.
continuous_chain
.
size
()
&&
(
core
.
reason_effect
->
type
&
EFFECT_TYPE_CONTINUOUS
))
return
&
core
.
continuous_chain
.
back
();
if
(
chaincount
==
0
||
chaincount
>
core
.
current_chain
.
size
())
{
chaincount
=
core
.
current_chain
.
size
();
if
(
chaincount
==
0
)
return
0
;
}
return
&
core
.
current_chain
[
chaincount
-
1
];
}
int32
field
::
is_able_to_enter_bp
()
{
return
((
core
.
duel_options
&
DUEL_ATTACK_FIRST_TURN
)
||
infos
.
turn_id
!=
1
)
&&
infos
.
phase
<
PHASE_BATTLE_START
...
...
field.h
View file @
58a842d4
...
...
@@ -446,6 +446,7 @@ public:
int32
is_chain_disablable
(
uint8
chaincount
);
int32
is_chain_disabled
(
uint8
chaincount
);
int32
check_chain_target
(
uint8
chaincount
,
card
*
pcard
);
chain
*
get_chain
(
uint32
chaincount
);
int32
is_able_to_enter_bp
();
void
add_process
(
uint16
type
,
uint16
step
,
effect
*
peffect
,
group
*
target
,
ptr
arg1
,
ptr
arg2
,
ptr
arg3
=
0
,
ptr
arg4
=
0
,
void
*
ptr1
=
NULL
,
void
*
ptr2
=
NULL
);
...
...
@@ -543,6 +544,7 @@ public:
int32
move_to_field
(
uint16
step
,
card
*
target
,
uint32
enable
,
uint32
ret
,
uint32
is_equip
,
uint32
zone
);
int32
change_position
(
uint16
step
,
group
*
targets
,
effect
*
reason_effect
,
uint8
reason_player
,
uint32
enable
);
int32
operation_replace
(
uint16
step
,
effect
*
replace_effect
,
group
*
targets
,
card
*
arg
,
ptr
replace_type
);
int32
activate_effect
(
uint16
step
,
effect
*
peffect
);
int32
select_synchro_material
(
int16
step
,
uint8
playerid
,
card
*
pcard
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
);
int32
select_xyz_material
(
int16
step
,
uint8
playerid
,
uint32
lv
,
card
*
pcard
,
int32
min
,
int32
max
);
int32
select_release_cards
(
int16
step
,
uint8
playerid
,
uint8
check_field
,
uint8
cancelable
,
int32
min
,
int32
max
);
...
...
@@ -698,6 +700,7 @@ public:
#define PROCESSOR_PAY_LPCOST 80
#define PROCESSOR_REMOVE_COUNTER 81
#define PROCESSOR_ATTACK_DISABLE 82
#define PROCESSOR_ACTIVATE_EFFECT 83
#define PROCESSOR_DESTROY_S 100
#define PROCESSOR_RELEASE_S 101
...
...
interpreter.cpp
View file @
58a842d4
...
...
@@ -371,6 +371,7 @@ static const struct luaL_Reg duellib[] = {
{
"ReturnToField"
,
scriptlib
::
duel_return_to_field
},
{
"MoveSequence"
,
scriptlib
::
duel_move_sequence
},
{
"SwapSequence"
,
scriptlib
::
duel_swap_sequence
},
{
"Activate"
,
scriptlib
::
duel_activate_effect
},
{
"SetChainLimit"
,
scriptlib
::
duel_set_chain_limit
},
{
"SetChainLimitTillChainEnd"
,
scriptlib
::
duel_set_chain_limit_p
},
{
"GetChainMaterial"
,
scriptlib
::
duel_get_chain_material
},
...
...
libduel.cpp
View file @
58a842d4
...
...
@@ -695,6 +695,15 @@ int32 scriptlib::duel_swap_sequence(lua_State *L) {
}
return
0
;
}
int32
scriptlib
::
duel_activate_effect
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
peffect
->
pduel
;
pduel
->
game_field
->
add_process
(
PROCESSOR_ACTIVATE_EFFECT
,
0
,
peffect
,
0
,
0
,
0
);
return
0
;
}
int32
scriptlib
::
duel_set_chain_limit
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
1
);
...
...
@@ -1660,16 +1669,7 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) {
uint32
flag
;
uint32
args
=
lua_gettop
(
L
)
-
1
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
chain
*
ch
;
if
(
c
==
0
&&
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
ch
=
&
pduel
->
game_field
->
core
.
continuous_chain
.
back
();
else
{
if
(
c
>
pduel
->
game_field
->
core
.
current_chain
.
size
()
||
c
<
1
)
c
=
pduel
->
game_field
->
core
.
current_chain
.
size
();
if
(
c
==
0
)
return
0
;
ch
=
&
pduel
->
game_field
->
core
.
current_chain
[
c
-
1
];
}
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
c
);
for
(
uint32
i
=
0
;
i
<
args
;
++
i
)
{
flag
=
lua_tointeger
(
L
,
2
+
i
);
switch
(
flag
)
{
...
...
@@ -1725,14 +1725,9 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) {
return
args
;
}
int32
scriptlib
::
duel_get_first_target
(
lua_State
*
L
)
{
chain
*
ch
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
ch
=
&
pduel
->
game_field
->
core
.
continuous_chain
.
back
();
else
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
())
ch
=
&
pduel
->
game_field
->
core
.
current_chain
.
back
();
else
return
0
;
if
(
!
ch
->
target_cards
||
ch
->
target_cards
->
container
.
size
()
==
0
)
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
!
ch
||
!
ch
->
target_cards
||
ch
->
target_cards
->
container
.
size
()
==
0
)
return
0
;
for
(
auto
iter
=
ch
->
target_cards
->
container
.
begin
();
iter
!=
ch
->
target_cards
->
container
.
end
();
++
iter
)
interpreter
::
card2value
(
L
,
*
iter
);
...
...
@@ -2535,22 +2530,21 @@ int32 scriptlib::duel_set_target_card(lua_State *L) {
pduel
=
pgroup
->
pduel
;
}
else
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
if
(
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
{
if
(
!
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_cards
)
{
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_cards
=
pduel
->
new_group
();
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_cards
->
is_readonly
=
TRUE
;
}
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
!
ch
)
return
0
;
if
(
!
ch
->
target_cards
)
{
ch
->
target_cards
=
pduel
->
new_group
();
ch
->
target_cards
->
is_readonly
=
TRUE
;
}
group
*
targets
=
ch
->
target_cards
;
effect
*
peffect
=
ch
->
triggering_effect
;
if
(
peffect
->
type
&
EFFECT_TYPE_CONTINUOUS
)
{
if
(
pcard
)
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_card
s
->
container
.
insert
(
pcard
);
target
s
->
container
.
insert
(
pcard
);
else
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_card
s
->
container
=
pgroup
->
container
;
target
s
->
container
=
pgroup
->
container
;
}
else
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
effect
*
peffect
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
triggering_effect
;
if
(
!
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_cards
)
{
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_cards
=
pduel
->
new_group
();
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_cards
->
is_readonly
=
TRUE
;
}
group
*
targets
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_cards
;
if
(
pcard
)
{
targets
->
container
.
insert
(
pcard
);
pcard
->
create_relation
(
peffect
);
...
...
@@ -2581,13 +2575,9 @@ int32 scriptlib::duel_set_target_card(lua_State *L) {
}
int32
scriptlib
::
duel_clear_target_card
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
{
if
(
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_cards
)
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_cards
->
container
.
clear
();
}
else
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
if
(
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_cards
)
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_cards
->
container
.
clear
();
}
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
ch
&&
ch
->
target_cards
)
ch
->
target_cards
->
container
.
clear
();
return
0
;
}
int32
scriptlib
::
duel_set_target_player
(
lua_State
*
L
)
{
...
...
@@ -2595,11 +2585,9 @@ int32 scriptlib::duel_set_target_player(lua_State *L) {
check_param_count
(
L
,
1
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
{
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_player
=
playerid
;
}
else
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_player
=
playerid
;
}
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
ch
)
ch
->
target_player
=
playerid
;
return
0
;
}
int32
scriptlib
::
duel_set_target_param
(
lua_State
*
L
)
{
...
...
@@ -2607,11 +2595,9 @@ int32 scriptlib::duel_set_target_param(lua_State *L) {
check_param_count
(
L
,
1
);
uint32
param
=
lua_tointeger
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
{
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
target_param
=
param
;
}
else
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
target_param
=
param
;
}
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
0
);
if
(
ch
)
ch
->
target_param
=
param
;
return
0
;
}
/**
...
...
@@ -2639,9 +2625,8 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) {
pduel
=
pgroup
->
pduel
;
}
else
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
!
pduel
->
game_field
->
core
.
continuous_chain
.
size
()
&&
!
pduel
->
game_field
->
core
.
current_chain
.
size
())
return
0
;
if
(
ct
&&
!
pduel
->
game_field
->
core
.
current_chain
.
size
())
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
ct
);
if
(
!
ch
)
return
0
;
if
(
pgroup
)
{
pg
=
pduel
->
new_group
(
pgroup
->
container
);
...
...
@@ -2656,29 +2641,10 @@ int32 scriptlib::duel_set_operation_info(lua_State *L) {
opt
.
op_count
=
count
;
opt
.
op_player
=
playerid
;
opt
.
op_param
=
param
;
if
(
ct
==
0
&&
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
{
auto
clit
=
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
();
auto
omit
=
clit
->
opinfos
.
find
(
cate
);
if
(
omit
!=
clit
->
opinfos
.
end
()
&&
omit
->
second
.
op_cards
)
pduel
->
delete_group
(
omit
->
second
.
op_cards
);
clit
->
opinfos
[
cate
]
=
opt
;
}
else
{
if
(
pduel
->
game_field
->
core
.
current_chain
.
size
()
==
0
)
return
0
;
if
(
ct
<
1
||
ct
>
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
auto
cait
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
auto
omit
=
cait
->
opinfos
.
find
(
cate
);
if
(
omit
!=
cait
->
opinfos
.
end
()
&&
omit
->
second
.
op_cards
)
pduel
->
delete_group
(
omit
->
second
.
op_cards
);
cait
->
opinfos
[
cate
]
=
opt
;
}
else
{
chain
*
ch
=
&
pduel
->
game_field
->
core
.
current_chain
[
ct
-
1
];
auto
omit
=
ch
->
opinfos
.
find
(
cate
);
if
(
omit
!=
ch
->
opinfos
.
end
()
&&
omit
->
second
.
op_cards
)
pduel
->
delete_group
(
omit
->
second
.
op_cards
);
ch
->
opinfos
[
cate
]
=
opt
;
}
}
auto
omit
=
ch
->
opinfos
.
find
(
cate
);
if
(
omit
!=
ch
->
opinfos
.
end
()
&&
omit
->
second
.
op_cards
)
pduel
->
delete_group
(
omit
->
second
.
op_cards
);
ch
->
opinfos
[
cate
]
=
opt
;
return
0
;
}
int32
scriptlib
::
duel_get_operation_info
(
lua_State
*
L
)
{
...
...
@@ -2686,37 +2652,12 @@ int32 scriptlib::duel_get_operation_info(lua_State *L) {
uint32
ct
=
lua_tointeger
(
L
,
1
);
uint32
cate
=
lua_tointeger
(
L
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
!
pduel
->
game_field
->
core
.
continuous_chain
.
size
()
&&
!
pduel
->
game_field
->
core
.
current_chain
.
size
())
return
0
;
if
(
ct
&&
!
pduel
->
game_field
->
core
.
current_chain
.
size
())
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
ct
);
if
(
!
ch
)
return
0
;
bool
found
=
false
;
optarget
opt
;
if
(
ct
==
0
&&
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
{
auto
oit
=
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
opinfos
.
find
(
cate
);
if
(
oit
!=
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
opinfos
.
end
())
{
opt
=
oit
->
second
;
found
=
true
;
}
}
else
{
if
(
ct
<
1
||
ct
>
pduel
->
game_field
->
core
.
current_chain
.
size
())
{
auto
oit
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
opinfos
.
find
(
cate
);
if
(
oit
!=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
opinfos
.
end
())
{
opt
=
oit
->
second
;
found
=
true
;
}
}
else
{
auto
oit
=
pduel
->
game_field
->
core
.
current_chain
[
ct
-
1
].
opinfos
.
find
(
cate
);
if
(
oit
!=
pduel
->
game_field
->
core
.
current_chain
[
ct
-
1
].
opinfos
.
end
())
{
opt
=
oit
->
second
;
found
=
true
;
}
}
}
if
(
!
found
)
{
lua_pushboolean
(
L
,
0
);
return
1
;
}
else
{
auto
oit
=
ch
->
opinfos
.
find
(
cate
);
if
(
oit
!=
ch
->
opinfos
.
end
())
{
optarget
&
opt
=
oit
->
second
;
lua_pushboolean
(
L
,
1
);
if
(
opt
.
op_cards
)
interpreter
::
group2value
(
L
,
opt
.
op_cards
);
...
...
@@ -2726,24 +2667,19 @@ int32 scriptlib::duel_get_operation_info(lua_State *L) {
lua_pushinteger
(
L
,
opt
.
op_player
);
lua_pushinteger
(
L
,
opt
.
op_param
);
return
5
;
}
else
{
lua_pushboolean
(
L
,
0
);
return
1
;
}
}
int32
scriptlib
::
duel_get_operation_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
uint32
ct
=
lua_tointeger
(
L
,
1
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
if
(
!
pduel
->
game_field
->
core
.
continuous_chain
.
size
()
&&
!
pduel
->
game_field
->
core
.
current_chain
.
size
())
return
0
;
if
(
ct
&&
!
pduel
->
game_field
->
core
.
current_chain
.
size
())
chain
*
ch
=
pduel
->
game_field
->
get_chain
(
ct
);
if
(
!
ch
)
return
0
;
if
(
ct
==
0
&&
pduel
->
game_field
->
core
.
continuous_chain
.
size
())
{
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
continuous_chain
.
rbegin
()
->
opinfos
.
size
());
}
else
{
if
(
ct
<
1
||
ct
>
pduel
->
game_field
->
core
.
current_chain
.
size
())
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
current_chain
.
rbegin
()
->
opinfos
.
size
());
else
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
current_chain
[
ct
-
1
].
opinfos
.
size
());
}
lua_pushinteger
(
L
,
ch
->
opinfos
.
size
());
return
1
;
}
int32
scriptlib
::
duel_check_xyz_material
(
lua_State
*
L
)
{
...
...
operations.cpp
View file @
58a842d4
...
...
@@ -4606,6 +4606,49 @@ int32 field::operation_replace(uint16 step, effect * replace_effect, group * tar
}
return
TRUE
;
}
int32
field
::
activate_effect
(
uint16
step
,
effect
*
peffect
)
{
switch
(
step
)
{
case
0
:
{
card
*
phandler
=
peffect
->
get_handler
();
int32
playerid
=
phandler
->
current
.
controler
;
nil_event
.
event_code
=
EVENT_FREE_CHAIN
;
if
(
!
peffect
->
is_activateable
(
playerid
,
nil_event
))
return
TRUE
;
chain
newchain
;
newchain
.
flag
=
0
;
newchain
.
chain_id
=
infos
.
field_id
++
;
newchain
.
evt
.
event_code
=
peffect
->
code
;
newchain
.
evt
.
event_player
=
PLAYER_NONE
;
newchain
.
evt
.
event_value
=
0
;
newchain
.
evt
.
event_cards
=
0
;
newchain
.
evt
.
reason
=
0
;
newchain
.
evt
.
reason_effect
=
0
;
newchain
.
evt
.
reason_player
=
PLAYER_NONE
;
newchain
.
triggering_effect
=
peffect
;
newchain
.
set_triggering_place
(
phandler
);
newchain
.
triggering_player
=
playerid
;
core
.
new_chains
.
push_back
(
newchain
);
phandler
->
set_status
(
STATUS_CHAINING
,
TRUE
);
peffect
->
dec_count
(
playerid
);
add_process
(
PROCESSOR_ADD_CHAIN
,
0
,
0
,
0
,
0
,
0
);
add_process
(
PROCESSOR_QUICK_EFFECT
,
0
,
0
,
0
,
FALSE
,
1
-
playerid
);
infos
.
priorities
[
0
]
=
0
;
infos
.
priorities
[
1
]
=
0
;
return
FALSE
;
}
case
1
:
{
if
(
core
.
chain_limit
)
{
luaL_unref
(
pduel
->
lua
->
lua_state
,
LUA_REGISTRYINDEX
,
core
.
chain_limit
);
core
.
chain_limit
=
0
;
}
for
(
auto
cait
=
core
.
current_chain
.
begin
();
cait
!=
core
.
current_chain
.
end
();
++
cait
)
cait
->
triggering_effect
->
get_handler
()
->
set_status
(
STATUS_CHAINING
,
FALSE
);
add_process
(
PROCESSOR_SOLVE_CHAIN
,
0
,
0
,
0
,
FALSE
,
0
);
return
TRUE
;
}
}
return
TRUE
;
}
int32
field
::
select_synchro_material
(
int16
step
,
uint8
playerid
,
card
*
pcard
,
int32
min
,
int32
max
,
card
*
smat
,
group
*
mg
)
{
switch
(
step
)
{
case
0
:
{
...
...
processor.cpp
View file @
58a842d4
...
...
@@ -351,6 +351,13 @@ int32 field::process() {
it
->
step
++
;
return
pduel
->
bufferlen
;
}
case
PROCESSOR_ACTIVATE_EFFECT
:
{
if
(
activate_effect
(
it
->
step
,
it
->
peffect
))
core
.
units
.
pop_front
();
else
it
->
step
++
;
return
pduel
->
bufferlen
;
}
case
PROCESSOR_SUMMON_RULE
:
{
if
(
summon
(
it
->
step
,
it
->
arg1
&
0xff
,
(
card
*
)
it
->
ptarget
,
it
->
peffect
,
(
it
->
arg1
>>
8
)
&
0xff
,
(
it
->
arg1
>>
16
)
&
0xff
,
(
it
->
arg1
>>
24
)
&
0xff
))
core
.
units
.
pop_front
();
...
...
@@ -725,39 +732,38 @@ int32 field::process() {
add_process
(
PROCESSOR_SELECT_CARD
,
0
,
it
->
peffect
,
it
->
ptarget
,
it
->
arg1
,
it
->
arg2
);
it
->
step
++
;
}
else
{
if
(
core
.
continuous_chain
.
size
())
{
if
(
!
core
.
continuous_chain
.
rbegin
()
->
target_cards
)
{
core
.
continuous_chain
.
rbegin
()
->
target_cards
=
pduel
->
new_group
();
core
.
continuous_chain
.
rbegin
()
->
target_cards
->
is_readonly
=
TRUE
;
}
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
core
.
continuous_chain
.
rbegin
()
->
target_cards
->
container
.
insert
(
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]]);
pduel
->
lua
->
add_param
(
core
.
continuous_chain
.
rbegin
()
->
target_cards
,
PARAM_TYPE_GROUP
);
}
else
if
(
core
.
current_chain
.
size
())
{
effect
*
peffect
=
core
.
current_chain
.
rbegin
()
->
triggering_effect
;
if
(
!
core
.
current_chain
.
rbegin
()
->
target_cards
)
{
core
.
current_chain
.
rbegin
()
->
target_cards
=
pduel
->
new_group
();
core
.
current_chain
.
rbegin
()
->
target_cards
->
is_readonly
=
TRUE
;
chain
*
ch
=
get_chain
(
0
);
if
(
ch
)
{
if
(
!
ch
->
target_cards
)
{
ch
->
target_cards
=
pduel
->
new_group
();
ch
->
target_cards
->
is_readonly
=
TRUE
;
}
group
*
tg
=
core
.
current_chain
.
rbegin
()
->
target_cards
;
group
*
pret
=
pduel
->
new_group
();
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
{
tg
->
container
.
insert
(
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]]);
pret
->
container
.
insert
(
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]]);
}
if
((
returns
.
bvalue
[
0
]
>
0
)
&&
peffect
->
is_flag
(
EFFECT_FLAG_CARD_TARGET
))
{
group
*
tg
=
ch
->
target_cards
;
effect
*
peffect
=
ch
->
triggering_effect
;
if
(
peffect
->
type
&
EFFECT_TYPE_CONTINUOUS
)
{
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
tg
->
container
.
insert
(
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]]);
pduel
->
lua
->
add_param
(
tg
,
PARAM_TYPE_GROUP
);
}
else
{
group
*
pret
=
pduel
->
new_group
();
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
{
card
*
pcard
=
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]];
if
(
pcard
->
current
.
location
&
0x30
)
move_card
(
pcard
->
current
.
controler
,
pcard
,
pcard
->
current
.
location
,
0
);
pduel
->
write_buffer8
(
MSG_BECOME_TARGET
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
tg
->
container
.
insert
(
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]]);
pret
->
container
.
insert
(
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]]);
}
if
((
returns
.
bvalue
[
0
]
>
0
)
&&
peffect
->
is_flag
(
EFFECT_FLAG_CARD_TARGET
))
{
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
{
card
*
pcard
=
core
.
select_cards
[
returns
.
bvalue
[
i
+
1
]];
if
(
pcard
->
current
.
location
&
0x30
)
move_card
(
pcard
->
current
.
controler
,
pcard
,
pcard
->
current
.
location
,
0
);
pduel
->
write_buffer8
(
MSG_BECOME_TARGET
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
}
}
for
(
auto
cit
=
pret
->
container
.
begin
();
cit
!=
pret
->
container
.
end
();
++
cit
)
(
*
cit
)
->
create_relation
(
*
ch
);
pduel
->
lua
->
add_param
(
pret
,
PARAM_TYPE_GROUP
);
}
for
(
auto
cit
=
pret
->
container
.
begin
();
cit
!=
pret
->
container
.
end
();
++
cit
)
(
*
cit
)
->
create_relation
(
core
.
current_chain
.
back
());
pduel
->
lua
->
add_param
(
pret
,
PARAM_TYPE_GROUP
);
}
core
.
units
.
pop_front
();
}
...
...
scriptlib.h
View file @
58a842d4
...
...
@@ -367,6 +367,7 @@ public:
static
int32
duel_return_to_field
(
lua_State
*
L
);
static
int32
duel_move_sequence
(
lua_State
*
L
);
static
int32
duel_swap_sequence
(
lua_State
*
L
);
static
int32
duel_activate_effect
(
lua_State
*
L
);
static
int32
duel_set_chain_limit
(
lua_State
*
L
);
static
int32
duel_set_chain_limit_p
(
lua_State
*
L
);
static
int32
duel_get_chain_material
(
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