Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
YGOPRO-520DIY
ygopro
Commits
64d68a90
Commit
64d68a90
authored
Nov 04, 2014
by
Argon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
activity count
parent
094c04e7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
138 deletions
+54
-138
ocgcore/field.h
ocgcore/field.h
+9
-9
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+1
-9
ocgcore/libduel.cpp
ocgcore/libduel.cpp
+24
-85
ocgcore/operations.cpp
ocgcore/operations.cpp
+7
-14
ocgcore/processor.cpp
ocgcore/processor.cpp
+12
-12
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+1
-9
No files found.
ocgcore/field.h
View file @
64d68a90
...
...
@@ -199,10 +199,6 @@ struct processor {
card_set
discarded_set
;
card_set
destroy_canceled
;
card_set
delayed_enable_set
;
card_set
summoned_cards_pt
[
2
];
card_set
normalsummoned_cards_pt
[
2
];
card_set
spsummoned_cards_pt
[
2
];
card_set
flipsummoned_cards_pt
[
2
];
effect_set_v
disfield_effects
;
effect_set_v
extraz_effects
;
effect_set_v
extraz_effects_e
;
...
...
@@ -266,13 +262,17 @@ struct processor {
uint8
remove_brainwashing
;
uint8
flip_delayed
;
uint8
damage_calculated
;
uint8
summon_state
[
2
];
uint8
normalsummon_state
[
2
];
uint8
flipsummon_state
[
2
];
uint8
spsummon_state
[
2
];
uint8
attack_state
[
2
];
uint8
summon_state
_count
[
2
];
uint8
normalsummon_state
_count
[
2
];
uint8
flipsummon_state
_count
[
2
];
uint8
spsummon_state
_count
[
2
];
uint8
attack_state
_count
[
2
];
uint8
phase_action
;
uint32
hint_timing
[
2
];
std
::
unordered_map
<
uint32
,
effect
*>
summon_counter
;
std
::
unordered_map
<
uint32
,
effect
*>
spsummon_counter
;
std
::
unordered_map
<
uint32
,
effect
*>
flipsummon_counter
;
std
::
unordered_map
<
uint32
,
effect
*>
attack_counter
;
};
class
field
{
public:
...
...
ocgcore/interpreter.cpp
View file @
64d68a90
...
...
@@ -476,16 +476,8 @@ static const struct luaL_Reg duellib[] = {
{
"IsChainDisablable"
,
scriptlib
::
duel_is_chain_disablable
},
{
"CheckChainTarget"
,
scriptlib
::
duel_check_chain_target
},
{
"CheckChainUniqueness"
,
scriptlib
::
duel_check_chain_uniqueness
},
{
"CheckSummonActivity"
,
scriptlib
::
duel_check_summon_activity
},
{
"CheckNormalSummonActivity"
,
scriptlib
::
duel_check_normal_summon_activity
},
{
"CheckFlipSummonActivity"
,
scriptlib
::
duel_check_flip_summon_activity
},
{
"CheckSpecialSummonActivity"
,
scriptlib
::
duel_check_special_summon_activity
},
{
"CheckAttackActivity"
,
scriptlib
::
duel_check_attack_activity
},
{
"GetActivityCount"
,
scriptlib
::
duel_get_activity_count
},
{
"CheckPhaseActivity"
,
scriptlib
::
duel_check_phase_activity
},
{
"SummonedCardsThisTurn"
,
scriptlib
::
duel_get_summoned_cards_this_turn
},
{
"NormalSummonedCardsThisTurn"
,
scriptlib
::
duel_get_normal_summoned_cards_this_turn
},
{
"SpecialSummonedCardsThisTurn"
,
scriptlib
::
duel_get_spsummoned_cards_this_turn
},
{
"FlipSummonedCardsThisTurn"
,
scriptlib
::
duel_get_flip_summoned_cards_this_turn
},
{
"VenomSwampCheck"
,
scriptlib
::
duel_venom_swamp_check
},
{
"SwapDeckAndGrave"
,
scriptlib
::
duel_swap_deck_and_grave
},
{
"MajesticCopy"
,
scriptlib
::
duel_majestic_copy
},
...
...
ocgcore/libduel.cpp
View file @
64d68a90
...
...
@@ -3024,8 +3024,7 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
return
1
;
}
std
::
set
<
uint32
>
er
;
field
::
chain_array
::
iterator
cait
;
for
(
cait
=
pduel
->
game_field
->
core
.
current_chain
.
begin
();
cait
!=
pduel
->
game_field
->
core
.
current_chain
.
end
();
++
cait
)
for
(
auto
cait
=
pduel
->
game_field
->
core
.
current_chain
.
begin
();
cait
!=
pduel
->
game_field
->
core
.
current_chain
.
end
();
++
cait
)
er
.
insert
(
cait
->
triggering_effect
->
handler
->
get_code
());
if
(
er
.
size
()
==
pduel
->
game_field
->
core
.
current_chain
.
size
())
lua_pushboolean
(
L
,
1
);
...
...
@@ -3033,49 +3032,33 @@ int32 scriptlib::duel_check_chain_uniqueness(lua_State *L) {
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
duel_check_summon_activity
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
core
.
summon_state
[
playerid
]);
return
1
;
}
int32
scriptlib
::
duel_check_normal_summon_activity
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
core
.
normalsummon_state
[
playerid
]);
return
1
;
}
int32
scriptlib
::
duel_check_flip_summon_activity
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
core
.
flipsummon_state
[
playerid
]);
return
1
;
}
int32
scriptlib
::
duel_check_special_summon_activity
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
core
.
spsummon_state
[
playerid
]);
return
1
;
}
int32
scriptlib
::
duel_check_attack_activity
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
scriptlib
::
duel_get_activity_count
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
int32
activity_type
=
lua_tointeger
(
L
,
2
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
lua_pushboolean
(
L
,
pduel
->
game_field
->
core
.
attack_state
[
playerid
]);
switch
(
activity_type
)
{
case
1
:
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
summon_state_count
[
playerid
]);
break
;
case
2
:
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
normalsummon_state_count
[
playerid
]);
break
;
case
3
:
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
flipsummon_state_count
[
playerid
]);
break
;
case
4
:
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
spsummon_state_count
[
playerid
]);
break
;
case
5
:
lua_pushinteger
(
L
,
pduel
->
game_field
->
core
.
attack_state_count
[
playerid
]);
break
;
default:
lua_pushinteger
(
L
,
0
);
break
;
}
return
1
;
}
int32
scriptlib
::
duel_check_phase_activity
(
lua_State
*
L
)
{
...
...
@@ -3083,50 +3066,6 @@ int32 scriptlib::duel_check_phase_activity(lua_State *L) {
lua_pushboolean
(
L
,
pduel
->
game_field
->
core
.
phase_action
);
return
1
;
}
int32
scriptlib
::
duel_get_summoned_cards_this_turn
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
newgroup
=
pduel
->
new_group
();
newgroup
->
container
=
pduel
->
game_field
->
core
.
summoned_cards_pt
[
playerid
];
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
}
int32
scriptlib
::
duel_get_normal_summoned_cards_this_turn
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
newgroup
=
pduel
->
new_group
();
newgroup
->
container
=
pduel
->
game_field
->
core
.
normalsummoned_cards_pt
[
playerid
];
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
}
int32
scriptlib
::
duel_get_spsummoned_cards_this_turn
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
newgroup
=
pduel
->
new_group
();
newgroup
->
container
=
pduel
->
game_field
->
core
.
spsummoned_cards_pt
[
playerid
];
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
}
int32
scriptlib
::
duel_get_flip_summoned_cards_this_turn
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
newgroup
=
pduel
->
new_group
();
newgroup
->
container
=
pduel
->
game_field
->
core
.
flipsummoned_cards_pt
[
playerid
];
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
}
int32
scriptlib
::
duel_venom_swamp_check
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
...
...
ocgcore/operations.cpp
View file @
64d68a90
...
...
@@ -1394,10 +1394,8 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
pduel
->
write_buffer8
(
target
->
current
.
location
);
pduel
->
write_buffer8
(
target
->
current
.
sequence
);
pduel
->
write_buffer8
(
target
->
current
.
position
);
core
.
summon_state
[
sumplayer
]
=
TRUE
;
core
.
normalsummon_state
[
sumplayer
]
=
TRUE
;
core
.
summoned_cards_pt
[
sumplayer
].
insert
(
target
);
core
.
normalsummoned_cards_pt
[
sumplayer
].
insert
(
target
);
core
.
summon_state_count
[
sumplayer
]
++
;
core
.
normalsummon_state_count
[
sumplayer
]
++
;
if
(
target
->
material_cards
.
size
())
{
for
(
auto
mit
=
target
->
material_cards
.
begin
();
mit
!=
target
->
material_cards
.
end
();
++
mit
)
raise_single_event
(
*
mit
,
0
,
EVENT_BE_PRE_MATERIAL
,
proc
,
REASON_SUMMON
,
sumplayer
,
sumplayer
,
0
);
...
...
@@ -1527,8 +1525,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) {
target
->
current
.
position
=
POS_FACEUP_ATTACK
;
target
->
fieldid
=
infos
.
field_id
++
;
core
.
phase_action
=
TRUE
;
core
.
flipsummon_state
[
sumplayer
]
=
TRUE
;
core
.
flipsummoned_cards_pt
[
sumplayer
].
insert
(
target
);
core
.
flipsummon_state_count
[
sumplayer
]
++
;
pduel
->
write_buffer8
(
MSG_FLIPSUMMONING
);
pduel
->
write_buffer32
(
target
->
data
.
code
);
pduel
->
write_buffer8
(
target
->
current
.
controler
);
...
...
@@ -1746,8 +1743,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
if
(
target
->
owner
!=
setplayer
)
set_control
(
target
,
setplayer
,
0
,
0
);
core
.
phase_action
=
TRUE
;
core
.
normalsummon_state
[
setplayer
]
=
TRUE
;
core
.
normalsummoned_cards_pt
[
setplayer
].
insert
(
target
);
core
.
normalsummon_state_count
[
setplayer
]
++
;
target
->
set_status
(
STATUS_SUMMON_TURN
,
TRUE
);
pduel
->
write_buffer8
(
MSG_SET
);
pduel
->
write_buffer32
(
target
->
data
.
code
);
...
...
@@ -2026,8 +2022,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
pduel
->
write_buffer8
(
target
->
current
.
location
);
pduel
->
write_buffer8
(
target
->
current
.
sequence
);
pduel
->
write_buffer8
(
target
->
current
.
position
);
core
.
spsummon_state
[
sumplayer
]
=
TRUE
;
core
.
spsummoned_cards_pt
[
sumplayer
].
insert
(
target
);
core
.
spsummon_state_count
[
sumplayer
]
++
;
return
FALSE
;
}
case
5
:
{
...
...
@@ -2184,8 +2179,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pduel
->
write_buffer8
(
pcard
->
current
.
position
);
core
.
spsummon_state
[
sumplayer
]
=
TRUE
;
core
.
spsummoned_cards_pt
[
sumplayer
].
insert
(
pcard
);
core
.
spsummon_state_count
[
sumplayer
]
++
;
if
(
pgroup
->
it
!=
pgroup
->
container
.
end
())
core
.
units
.
begin
()
->
step
=
22
;
return
FALSE
;
...
...
@@ -2317,8 +2311,7 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) {
core
.
special_summoning
.
insert
(
target
);
target
->
enable_field_effect
(
FALSE
);
target
->
set_status
(
STATUS_FLIP_SUMMONED
,
FALSE
);
core
.
spsummoned_cards_pt
[
target
->
summon_player
].
insert
(
target
);
core
.
spsummon_state
[
target
->
summon_player
]
=
TRUE
;
core
.
spsummon_state_count
[
target
->
summon_player
]
++
;
core
.
hint_timing
[
target
->
summon_player
]
|=
TIMING_SPSUMMON
;
move_to_field
(
target
,
target
->
summon_player
,
playerid
,
LOCATION_MZONE
,
positions
);
return
FALSE
;
...
...
ocgcore/processor.cpp
View file @
64d68a90
...
...
@@ -3034,7 +3034,7 @@ int32 field::process_battle_command(uint16 step) {
core
.
attack_cancelable
=
TRUE
;
core
.
sub_attacker
=
0
;
core
.
sub_attack_target
=
(
card
*
)
0xffffffff
;
core
.
attack_state
[
infos
.
turn_player
]
=
TRUE
;
core
.
attack_state
_count
[
infos
.
turn_player
]
++
;
pduel
->
write_buffer8
(
MSG_ATTACK
);
pduel
->
write_buffer32
(
core
.
attacker
->
get_info_location
());
if
(
core
.
attack_target
)
{
...
...
@@ -3989,15 +3989,11 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
continue
;
pcard
->
set_status
(
STATUS_SET_TURN
,
FALSE
);
}
core
.
summon_state
[
p
]
=
0
;
core
.
normalsummon_state
[
p
]
=
0
;
core
.
flipsummon_state
[
p
]
=
0
;
core
.
spsummon_state
[
p
]
=
0
;
core
.
summoned_cards_pt
[
p
].
clear
();
core
.
normalsummoned_cards_pt
[
p
].
clear
();
core
.
spsummoned_cards_pt
[
p
].
clear
();
core
.
flipsummoned_cards_pt
[
p
].
clear
();
core
.
attack_state
[
p
]
=
0
;
core
.
summon_state_count
[
p
]
=
0
;
core
.
normalsummon_state_count
[
p
]
=
0
;
core
.
flipsummon_state_count
[
p
]
=
0
;
core
.
spsummon_state_count
[
p
]
=
0
;
core
.
attack_state_count
[
p
]
=
0
;
core
.
summon_count
[
p
]
=
0
;
core
.
extra_summon
[
p
]
=
0
;
}
...
...
@@ -4354,6 +4350,8 @@ int32 field::add_chain(uint16 step) {
peffect
->
handler
->
set_status
(
STATUS_LEAVE_CONFIRMED
,
TRUE
);
}
core
.
phase_action
=
TRUE
;
if
(
clit
->
opinfos
.
count
(
0x200
))
core
.
spsummon_state_count
[
clit
->
triggering_player
]
++
;
pduel
->
write_buffer8
(
MSG_CHAINED
);
pduel
->
write_buffer8
(
clit
->
chain_count
);
raise_event
(
peffect
->
handler
,
EVENT_CHAINING
,
peffect
,
0
,
clit
->
triggering_player
,
clit
->
triggering_player
,
clit
->
chain_count
);
...
...
@@ -4487,6 +4485,8 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
raise_event
((
card
*
)
0
,
EVENT_CHAIN_NEGATED
,
peffect
,
0
,
cait
->
triggering_player
,
cait
->
triggering_player
,
cait
->
chain_count
);
process_instant_event
();
core
.
units
.
begin
()
->
step
=
9
;
if
(
cait
->
opinfos
.
count
(
0x200
))
core
.
spsummon_state_count
[
cait
->
triggering_player
]
--
;
return
FALSE
;
}
for
(
auto
oeit
=
effects
.
oath
.
begin
();
oeit
!=
effects
.
oath
.
end
();
++
oeit
)
...
...
@@ -4494,8 +4494,6 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
oeit
->
second
=
0
;
break_effect
();
core
.
chain_solving
=
TRUE
;
if
(
cait
->
opinfos
.
count
(
0x200
))
core
.
spsummon_state
[
cait
->
triggering_player
]
=
TRUE
;
card
*
pcard
=
peffect
->
handler
;
if
((
peffect
->
type
&
EFFECT_TYPE_ACTIVATE
)
&&
pcard
->
is_has_relation
(
peffect
))
{
pcard
->
set_status
(
STATUS_ACTIVATED
,
TRUE
);
...
...
@@ -4528,6 +4526,8 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
return
FALSE
;
}
}
if
(
cait
->
opinfos
.
count
(
0x200
))
core
.
spsummon_state_count
[
cait
->
triggering_player
]
--
;
core
.
units
.
begin
()
->
peffect
=
(
effect
*
)(
size_t
)
cait
->
triggering_effect
->
operation
;
if
(
cait
->
replace_op
)
cait
->
triggering_effect
->
operation
=
cait
->
replace_op
;
...
...
ocgcore/scriptlib.h
View file @
64d68a90
...
...
@@ -476,16 +476,8 @@ public:
static
int32
duel_is_chain_disablable
(
lua_State
*
L
);
static
int32
duel_check_chain_target
(
lua_State
*
L
);
static
int32
duel_check_chain_uniqueness
(
lua_State
*
L
);
static
int32
duel_check_summon_activity
(
lua_State
*
L
);
static
int32
duel_check_normal_summon_activity
(
lua_State
*
L
);
static
int32
duel_check_flip_summon_activity
(
lua_State
*
L
);
static
int32
duel_check_special_summon_activity
(
lua_State
*
L
);
static
int32
duel_check_attack_activity
(
lua_State
*
L
);
static
int32
duel_get_activity_count
(
lua_State
*
L
);
static
int32
duel_check_phase_activity
(
lua_State
*
L
);
static
int32
duel_get_summoned_cards_this_turn
(
lua_State
*
L
);
static
int32
duel_get_normal_summoned_cards_this_turn
(
lua_State
*
L
);
static
int32
duel_get_spsummoned_cards_this_turn
(
lua_State
*
L
);
static
int32
duel_get_flip_summoned_cards_this_turn
(
lua_State
*
L
);
//specific card functions
static
int32
duel_venom_swamp_check
(
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