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
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-core
Commits
7e2ab59a
Commit
7e2ab59a
authored
Nov 29, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro-core
parents
971f808f
d5d91f86
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
73 deletions
+80
-73
effect.cpp
effect.cpp
+2
-1
field.cpp
field.cpp
+54
-0
field.h
field.h
+4
-0
interpreter.cpp
interpreter.cpp
+1
-0
libduel.cpp
libduel.cpp
+9
-0
processor.cpp
processor.cpp
+9
-72
scriptlib.h
scriptlib.h
+1
-0
No files found.
effect.cpp
View file @
7e2ab59a
...
@@ -594,7 +594,8 @@ void effect::dec_count(uint32 playerid) {
...
@@ -594,7 +594,8 @@ void effect::dec_count(uint32 playerid) {
return
;
return
;
if
(
count_limit
==
0
)
if
(
count_limit
==
0
)
return
;
return
;
count_limit
-=
1
;
if
(
count_code
==
0
||
is_flag
(
EFFECT_FLAG_NO_TURN_RESET
))
count_limit
-=
1
;
if
(
count_code
)
{
if
(
count_code
)
{
uint32
code
=
count_code
&
0xfffffff
;
uint32
code
=
count_code
&
0xfffffff
;
if
(
code
==
1
)
if
(
code
==
1
)
...
...
field.cpp
View file @
7e2ab59a
...
@@ -3281,6 +3281,60 @@ int32 field::check_cteffect_hint(effect* peffect, uint8 playerid) {
...
@@ -3281,6 +3281,60 @@ int32 field::check_cteffect_hint(effect* peffect, uint8 playerid) {
}
}
return
FALSE
;
return
FALSE
;
}
}
int32
field
::
check_deck_effect
(
chain
&
ch
)
const
{
effect
*
peffect
=
ch
.
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
ch
.
triggering_location
==
LOCATION_DECK
&&
(
phandler
->
current
.
location
&
LOCATION_DECK
))
{
if
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
peffect
->
code
==
EVENT_TO_DECK
||
(
peffect
->
range
&
LOCATION_DECK
))
{
ch
.
flag
|=
CHAIN_DECK_EFFECT
;
}
else
return
FALSE
;
}
return
TRUE
;
}
int32
field
::
check_hand_trigger
(
chain
&
ch
)
{
effect
*
peffect
=
ch
.
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
phandler
->
is_has_relation
(
ch
)
&&
ch
.
triggering_location
==
LOCATION_HAND
||
(
peffect
->
range
&
LOCATION_HAND
)))
{
ch
.
flag
|=
CHAIN_HAND_TRIGGER
;
core
.
new_ochain_h
.
push_back
(
ch
);
if
(
ch
.
triggering_location
==
LOCATION_HAND
&&
phandler
->
is_position
(
POS_FACEDOWN
)
||
peffect
->
range
&&
!
peffect
->
in_range
(
ch
))
return
FALSE
;
}
return
TRUE
;
}
int32
field
::
check_trigger_effect
(
const
chain
&
ch
)
const
{
effect
*
peffect
=
ch
.
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
if
((
peffect
->
type
&
EFFECT_TYPE_FIELD
)
&&
!
phandler
->
is_has_relation
(
ch
))
return
FALSE
;
if
(
peffect
->
code
==
EVENT_FLIP
&&
infos
.
phase
==
PHASE_DAMAGE
)
return
TRUE
;
if
((
ch
.
triggering_location
&
(
LOCATION_DECK
|
LOCATION_HAND
|
LOCATION_EXTRA
))
&&
(
ch
.
triggering_position
&
POS_FACEDOWN
))
return
TRUE
;
if
(
!
(
phandler
->
current
.
location
&
(
LOCATION_DECK
|
LOCATION_HAND
|
LOCATION_EXTRA
))
||
phandler
->
is_position
(
POS_FACEUP
))
return
TRUE
;
return
FALSE
;
}
int32
field
::
check_spself_from_hand_trigger
(
const
chain
&
ch
)
const
{
effect
*
peffect
=
ch
.
triggering_effect
;
uint8
tp
=
ch
.
triggering_player
;
if
((
peffect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
ch
.
flag
&
CHAIN_HAND_TRIGGER
))
{
return
std
::
none_of
(
core
.
current_chain
.
begin
(),
core
.
current_chain
.
end
(),
[
tp
](
chain
ch
)
{
return
ch
.
triggering_player
==
tp
&&
(
ch
.
triggering_effect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
ch
.
flag
&
CHAIN_HAND_TRIGGER
);
});
}
return
TRUE
;
}
int32
field
::
is_able_to_enter_bp
()
{
int32
field
::
is_able_to_enter_bp
()
{
return
((
core
.
duel_options
&
DUEL_ATTACK_FIRST_TURN
)
||
infos
.
turn_id
!=
1
)
return
((
core
.
duel_options
&
DUEL_ATTACK_FIRST_TURN
)
||
infos
.
turn_id
!=
1
)
&&
infos
.
phase
<
PHASE_BATTLE_START
&&
infos
.
phase
<
PHASE_BATTLE_START
...
...
field.h
View file @
7e2ab59a
...
@@ -469,6 +469,10 @@ public:
...
@@ -469,6 +469,10 @@ public:
int32
get_cteffect
(
effect
*
peffect
,
int32
playerid
,
int32
store
);
int32
get_cteffect
(
effect
*
peffect
,
int32
playerid
,
int32
store
);
int32
get_cteffect_evt
(
effect
*
feffect
,
int32
playerid
,
const
tevent
&
e
,
int32
store
);
int32
get_cteffect_evt
(
effect
*
feffect
,
int32
playerid
,
const
tevent
&
e
,
int32
store
);
int32
check_cteffect_hint
(
effect
*
peffect
,
uint8
playerid
);
int32
check_cteffect_hint
(
effect
*
peffect
,
uint8
playerid
);
int32
check_deck_effect
(
chain
&
ch
)
const
;
int32
check_hand_trigger
(
chain
&
ch
);
int32
check_trigger_effect
(
const
chain
&
ch
)
const
;
int32
check_spself_from_hand_trigger
(
const
chain
&
ch
)
const
;
int32
is_able_to_enter_bp
();
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
);
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
);
...
...
interpreter.cpp
View file @
7e2ab59a
...
@@ -509,6 +509,7 @@ static const struct luaL_Reg duellib[] = {
...
@@ -509,6 +509,7 @@ static const struct luaL_Reg duellib[] = {
{
"ReleaseRitualMaterial"
,
scriptlib
::
duel_release_ritual_material
},
{
"ReleaseRitualMaterial"
,
scriptlib
::
duel_release_ritual_material
},
{
"GetFusionMaterial"
,
scriptlib
::
duel_get_fusion_material
},
{
"GetFusionMaterial"
,
scriptlib
::
duel_get_fusion_material
},
{
"SetSelectedCard"
,
scriptlib
::
duel_set_must_select_cards
},
{
"SetSelectedCard"
,
scriptlib
::
duel_set_must_select_cards
},
{
"GrabSelectedCard"
,
scriptlib
::
duel_grab_must_select_cards
},
{
"SetTargetCard"
,
scriptlib
::
duel_set_target_card
},
{
"SetTargetCard"
,
scriptlib
::
duel_set_target_card
},
{
"ClearTargetCard"
,
scriptlib
::
duel_clear_target_card
},
{
"ClearTargetCard"
,
scriptlib
::
duel_clear_target_card
},
{
"SetTargetPlayer"
,
scriptlib
::
duel_set_target_player
},
{
"SetTargetPlayer"
,
scriptlib
::
duel_set_target_player
},
...
...
libduel.cpp
View file @
7e2ab59a
...
@@ -2798,6 +2798,15 @@ int32 scriptlib::duel_set_must_select_cards(lua_State *L) {
...
@@ -2798,6 +2798,15 @@ int32 scriptlib::duel_set_must_select_cards(lua_State *L) {
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
return
0
;
return
0
;
}
}
int32
scriptlib
::
duel_grab_must_select_cards
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
if
(
pduel
->
game_field
->
core
.
must_select_cards
.
size
())
pgroup
->
container
.
insert
(
pduel
->
game_field
->
core
.
must_select_cards
.
begin
(),
pduel
->
game_field
->
core
.
must_select_cards
.
end
());
pduel
->
game_field
->
core
.
must_select_cards
.
clear
();
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
int32
scriptlib
::
duel_set_target_card
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_set_target_card
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
...
...
processor.cpp
View file @
7e2ab59a
...
@@ -1670,27 +1670,11 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
...
@@ -1670,27 +1670,11 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
for
(
auto
clit
=
core
.
new_fchain_s
.
begin
();
clit
!=
core
.
new_fchain_s
.
end
();
)
{
for
(
auto
clit
=
core
.
new_fchain_s
.
begin
();
clit
!=
core
.
new_fchain_s
.
end
();
)
{
effect
*
peffect
=
clit
->
triggering_effect
;
effect
*
peffect
=
clit
->
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
card
*
phandler
=
peffect
->
get_handler
();
if
(
phandler
->
is_has_relation
(
*
clit
))
if
(
phandler
->
is_has_relation
(
*
clit
))
//work around: position and control should be refreshed before raising event
clit
->
set_triggering_place
(
phandler
);
clit
->
set_triggering_place
(
phandler
);
uint8
tp
=
clit
->
triggering_player
;
uint8
tp
=
clit
->
triggering_player
;
bool
act
=
true
;
if
(
check_deck_effect
(
*
clit
)
&&
check_trigger_effect
(
*
clit
)
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
))
{
&&
clit
->
triggering_location
==
LOCATION_DECK
&&
(
phandler
->
current
.
location
&
LOCATION_DECK
))
{
if
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
peffect
->
code
==
EVENT_TO_DECK
||
(
peffect
->
range
&
LOCATION_DECK
))
clit
->
flag
|=
CHAIN_DECK_EFFECT
;
else
act
=
false
;
}
if
(
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
&&
(
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
phandler
->
is_has_relation
(
*
clit
))
&&
(
peffect
->
code
==
EVENT_FLIP
&&
infos
.
phase
==
PHASE_DAMAGE
||
(
clit
->
triggering_location
&
0x43
)
&&
(
clit
->
triggering_position
&
POS_FACEDOWN
)
||
!
(
phandler
->
current
.
location
&
0x43
)
||
phandler
->
is_position
(
POS_FACEUP
)))
{
}
else
act
=
false
;
if
(
act
)
{
if
(
tp
==
core
.
current_player
)
if
(
tp
==
core
.
current_player
)
core
.
select_chains
.
push_back
(
*
clit
);
core
.
select_chains
.
push_back
(
*
clit
);
}
else
{
}
else
{
...
@@ -1736,7 +1720,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
...
@@ -1736,7 +1720,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
for
(
auto
clit
=
core
.
new_ochain_s
.
begin
();
clit
!=
core
.
new_ochain_s
.
end
();
)
{
for
(
auto
clit
=
core
.
new_ochain_s
.
begin
();
clit
!=
core
.
new_ochain_s
.
end
();
)
{
effect
*
peffect
=
clit
->
triggering_effect
;
effect
*
peffect
=
clit
->
triggering_effect
;
card
*
phandler
=
peffect
->
get_handler
();
card
*
phandler
=
peffect
->
get_handler
();
if
(
phandler
->
is_has_relation
(
*
clit
))
if
(
phandler
->
is_has_relation
(
*
clit
))
//work around: position and control should be refreshed before raising event
clit
->
set_triggering_place
(
phandler
);
clit
->
set_triggering_place
(
phandler
);
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
&&
(
peffect
->
range
&
LOCATION_HAND
)
&&
phandler
->
current
.
location
==
LOCATION_HAND
)
{
&&
(
peffect
->
range
&
LOCATION_HAND
)
&&
phandler
->
current
.
location
==
LOCATION_HAND
)
{
...
@@ -1747,44 +1731,9 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
...
@@ -1747,44 +1731,9 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
clit
->
set_triggering_place
(
phandler
);
clit
->
set_triggering_place
(
phandler
);
}
}
uint8
tp
=
clit
->
triggering_player
;
uint8
tp
=
clit
->
triggering_player
;
bool
act
=
true
;
if
(
check_hand_trigger
(
*
clit
)
&&
check_deck_effect
(
*
clit
)
&&
check_trigger_effect
(
*
clit
)
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
&&
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
check_spself_from_hand_trigger
(
*
clit
))
{
&&
phandler
->
is_has_relation
(
*
clit
)
&&
clit
->
triggering_location
==
LOCATION_HAND
||
(
peffect
->
range
&
LOCATION_HAND
)))
{
clit
->
flag
|=
CHAIN_HAND_TRIGGER
;
core
.
new_ochain_h
.
push_back
(
*
clit
);
if
(
clit
->
triggering_location
==
LOCATION_HAND
&&
phandler
->
is_position
(
POS_FACEDOWN
)
||
peffect
->
range
&&
!
peffect
->
in_range
(
*
clit
))
act
=
false
;
}
if
(
!
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
&&
clit
->
triggering_location
==
LOCATION_DECK
&&
(
phandler
->
current
.
location
&
LOCATION_DECK
))
{
if
((
peffect
->
type
&
EFFECT_TYPE_SINGLE
)
&&
!
peffect
->
is_flag
(
EFFECT_FLAG_SINGLE_RANGE
)
&&
peffect
->
code
==
EVENT_TO_DECK
||
(
peffect
->
range
&
LOCATION_DECK
))
clit
->
flag
|=
CHAIN_DECK_EFFECT
;
else
act
=
false
;
}
if
(
peffect
->
is_chainable
(
tp
)
&&
peffect
->
is_activateable
(
tp
,
clit
->
evt
,
TRUE
)
&&
(
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
phandler
->
is_has_relation
(
*
clit
))
&&
(
peffect
->
code
==
EVENT_FLIP
&&
infos
.
phase
==
PHASE_DAMAGE
||
(
clit
->
triggering_location
&
0x43
)
&&
(
clit
->
triggering_position
&
POS_FACEDOWN
)
||
!
(
phandler
->
current
.
location
&
0x43
)
||
phandler
->
is_position
(
POS_FACEUP
)))
{
if
(
peffect
->
is_flag
(
EFFECT_FLAG_FIELD_ONLY
)
||
!
(
peffect
->
type
&
EFFECT_TYPE_FIELD
)
||
peffect
->
in_range
(
*
clit
))
{
if
((
peffect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
clit
->
flag
&
CHAIN_HAND_TRIGGER
))
{
for
(
const
auto
&
cur_ch
:
core
.
current_chain
)
{
if
(
cur_ch
.
triggering_player
==
tp
&&
(
cur_ch
.
triggering_effect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
cur_ch
.
flag
&
CHAIN_HAND_TRIGGER
))
{
act
=
false
;
break
;
}
}
}
}
else
act
=
false
;
}
else
act
=
false
;
if
(
act
)
{
if
(
tp
==
core
.
current_player
)
if
(
tp
==
core
.
current_player
)
core
.
select_chains
.
push_back
(
*
clit
);
core
.
select_chains
.
push_back
(
*
clit
);
}
else
{
}
else
{
...
@@ -2082,22 +2031,10 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
...
@@ -2082,22 +2031,10 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
ch
.
triggering_player
=
phandler
->
current
.
controler
;
ch
.
triggering_player
=
phandler
->
current
.
controler
;
ch
.
set_triggering_place
(
phandler
);
ch
.
set_triggering_place
(
phandler
);
}
}
bool
act
=
true
;
if
(
ch
.
triggering_player
==
priority
&&
ch
.
triggering_location
==
LOCATION_HAND
if
(
ch
.
triggering_player
==
priority
&&
ch
.
triggering_location
==
LOCATION_HAND
&&
phandler
->
is_position
(
POS_FACEDOWN
)
&&
!
phandler
->
is_status
(
STATUS_CHAINING
)
&&
phandler
->
is_has_relation
(
ch
)
&&
phandler
->
is_position
(
POS_FACEDOWN
)
&&
!
phandler
->
is_status
(
STATUS_CHAINING
)
&&
phandler
->
is_has_relation
(
ch
)
&&
peffect
->
is_chainable
(
priority
)
&&
peffect
->
is_activateable
(
priority
,
ch
.
evt
,
TRUE
))
{
&&
peffect
->
is_chainable
(
priority
)
&&
peffect
->
is_activateable
(
priority
,
ch
.
evt
,
TRUE
)
if
(
peffect
->
status
&
EFFECT_STATUS_SPSELF
)
{
&&
check_spself_from_hand_trigger
(
ch
))
for
(
const
auto
&
cur_ch
:
core
.
current_chain
)
{
if
(
cur_ch
.
triggering_player
==
priority
&&
(
cur_ch
.
triggering_effect
->
status
&
EFFECT_STATUS_SPSELF
)
&&
(
cur_ch
.
flag
&
CHAIN_HAND_TRIGGER
))
{
act
=
false
;
break
;
}
}
}
}
else
act
=
false
;
if
(
act
)
core
.
select_chains
.
push_back
(
ch
);
core
.
select_chains
.
push_back
(
ch
);
}
}
//delayed activate
//delayed activate
...
...
scriptlib.h
View file @
7e2ab59a
...
@@ -503,6 +503,7 @@ public:
...
@@ -503,6 +503,7 @@ public:
static
int32
duel_release_ritual_material
(
lua_State
*
L
);
static
int32
duel_release_ritual_material
(
lua_State
*
L
);
static
int32
duel_get_fusion_material
(
lua_State
*
L
);
static
int32
duel_get_fusion_material
(
lua_State
*
L
);
static
int32
duel_set_must_select_cards
(
lua_State
*
L
);
static
int32
duel_set_must_select_cards
(
lua_State
*
L
);
static
int32
duel_grab_must_select_cards
(
lua_State
*
L
);
static
int32
duel_set_target_card
(
lua_State
*
L
);
static
int32
duel_set_target_card
(
lua_State
*
L
);
static
int32
duel_clear_target_card
(
lua_State
*
L
);
static
int32
duel_clear_target_card
(
lua_State
*
L
);
static
int32
duel_set_target_player
(
lua_State
*
L
);
static
int32
duel_set_target_player
(
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