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
83473e3f
Commit
83473e3f
authored
May 17, 2016
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Damage/Recover
parent
77c587da
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
39 deletions
+90
-39
field.h
field.h
+5
-4
interpreter.cpp
interpreter.cpp
+1
-0
libduel.cpp
libduel.cpp
+13
-2
operations.cpp
operations.cpp
+52
-23
processor.cpp
processor.cpp
+18
-10
scriptlib.h
scriptlib.h
+1
-0
No files found.
field.h
View file @
83473e3f
...
...
@@ -294,6 +294,7 @@ struct processor {
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
flipsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
attack_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>
>
chain_counter
;
processor_list
recover_damage_reserve
;
};
class
field
{
public:
...
...
@@ -465,8 +466,8 @@ public:
void
swap_control
(
effect
*
reason_effect
,
uint32
reason_player
,
card
*
pcard1
,
card
*
pcard2
,
uint32
reset_phase
,
uint32
reset_count
);
void
equip
(
uint32
equip_player
,
card
*
equip_card
,
card
*
target
,
uint32
up
,
uint32
is_step
);
void
draw
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
count
);
void
damage
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
card
*
pcard
,
uint32
playerid
,
uint32
amount
);
void
recover
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
amount
);
void
damage
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
card
*
reason_card
,
uint32
playerid
,
uint32
amount
,
uint32
is_step
=
FALSE
);
void
recover
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
amount
,
uint32
is_step
=
FALSE
);
void
summon
(
uint32
sumplayer
,
card
*
target
,
effect
*
proc
,
uint32
ignore_count
,
uint32
min_tribute
);
void
special_summon_rule
(
uint32
sumplayer
,
card
*
target
,
uint32
summon_type
);
void
special_summon
(
card_set
*
target
,
uint32
sumtype
,
uint32
sumplayer
,
uint32
playerid
,
uint32
nocheck
,
uint32
nolimit
,
uint32
positions
);
...
...
@@ -490,8 +491,8 @@ public:
int32
self_destroy
(
uint16
step
);
int32
equip
(
uint16
step
,
uint8
equip_player
,
card
*
equip_card
,
card
*
target
,
uint32
up
,
uint32
is_step
);
int32
draw
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
playerid
,
uint32
count
);
int32
damage
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
card
*
pcard
,
uint8
playerid
,
uint32
amount
);
int32
recover
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
playerid
,
uint32
amount
);
int32
damage
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
card
*
reason_card
,
uint8
playerid
,
uint32
amount
,
uint32
is_step
);
int32
recover
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
playerid
,
uint32
amount
,
uint32
is_step
);
int32
summon
(
uint16
step
,
uint8
sumplayer
,
card
*
target
,
effect
*
proc
,
uint8
ignore_count
,
uint8
min_tribute
);
int32
flip_summon
(
uint16
step
,
uint8
sumplayer
,
card
*
target
);
int32
mset
(
uint16
step
,
uint8
setplayer
,
card
*
ptarget
,
effect
*
proc
,
uint8
ignore_count
,
uint8
min_tribute
);
...
...
interpreter.cpp
View file @
83473e3f
...
...
@@ -363,6 +363,7 @@ static const struct luaL_Reg duellib[] = {
{
"Draw"
,
scriptlib
::
duel_draw
},
{
"Damage"
,
scriptlib
::
duel_damage
},
{
"Recover"
,
scriptlib
::
duel_recover
},
{
"RDComplete"
,
scriptlib
::
duel_rd_complete
},
{
"Equip"
,
scriptlib
::
duel_equip
},
{
"EquipComplete"
,
scriptlib
::
duel_equip_complete
},
{
"GetControl"
,
scriptlib
::
duel_get_control
},
...
...
libduel.cpp
View file @
83473e3f
...
...
@@ -925,8 +925,11 @@ int32 scriptlib::duel_damage(lua_State *L) {
if
(
amount
<
0
)
amount
=
0
;
uint32
reason
=
lua_tointeger
(
L
,
3
);
uint32
is_step
=
FALSE
;
if
(
lua_gettop
(
L
)
>=
4
)
is_step
=
lua_toboolean
(
L
,
4
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
damage
(
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
0
,
playerid
,
amount
);
pduel
->
game_field
->
damage
(
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
0
,
playerid
,
amount
,
is_step
);
pduel
->
game_field
->
core
.
subunits
.
begin
()
->
type
=
PROCESSOR_DAMAGE_S
;
return
lua_yield
(
L
,
0
);
}
...
...
@@ -940,11 +943,19 @@ int32 scriptlib::duel_recover(lua_State *L) {
if
(
amount
<
0
)
amount
=
0
;
uint32
reason
=
lua_tointeger
(
L
,
3
);
uint32
is_step
=
FALSE
;
if
(
lua_gettop
(
L
)
>=
4
)
is_step
=
lua_toboolean
(
L
,
4
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
recover
(
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
amount
);
pduel
->
game_field
->
recover
(
pduel
->
game_field
->
core
.
reason_effect
,
reason
,
pduel
->
game_field
->
core
.
reason_player
,
playerid
,
amount
,
is_step
);
pduel
->
game_field
->
core
.
subunits
.
begin
()
->
type
=
PROCESSOR_RECOVER_S
;
return
lua_yield
(
L
,
0
);
}
int32
scriptlib
::
duel_rd_complete
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
game_field
->
core
.
subunits
.
splice
(
pduel
->
game_field
->
core
.
subunits
.
end
(),
pduel
->
game_field
->
core
.
recover_damage_reserve
);
return
lua_yield
(
L
,
0
);
}
int32
scriptlib
::
duel_equip
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
...
...
operations.cpp
View file @
83473e3f
...
...
@@ -124,14 +124,15 @@ void field::equip(uint32 equip_player, card* equip_card, card* target, uint32 up
void
field
::
draw
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
count
)
{
add_process
(
PROCESSOR_DRAW
,
0
,
reason_effect
,
0
,
reason
,
(
reason_player
<<
28
)
+
(
playerid
<<
24
)
+
(
count
&
0xffffff
));
}
void
field
::
damage
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
card
*
pcard
,
uint32
playerid
,
uint32
amount
)
{
void
field
::
damage
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
card
*
reason_card
,
uint32
playerid
,
uint32
amount
,
uint32
is_step
)
{
uint32
arg2
=
(
is_step
<<
28
)
+
(
reason_player
<<
26
)
+
(
playerid
<<
24
)
+
(
amount
&
0xffffff
);
if
(
reason
&
REASON_BATTLE
)
add_process
(
PROCESSOR_DAMAGE
,
0
,
(
effect
*
)
pcard
,
0
,
reason
,
(
reason_player
<<
28
)
+
(
playerid
<<
24
)
+
(
amount
&
0xffffff
)
);
add_process
(
PROCESSOR_DAMAGE
,
0
,
(
effect
*
)
reason_card
,
0
,
reason
,
arg2
);
else
add_process
(
PROCESSOR_DAMAGE
,
0
,
reason_effect
,
0
,
reason
,
(
reason_player
<<
28
)
+
(
playerid
<<
24
)
+
(
amount
&
0xffffff
)
);
add_process
(
PROCESSOR_DAMAGE
,
0
,
reason_effect
,
0
,
reason
,
arg2
);
}
void
field
::
recover
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
amount
)
{
add_process
(
PROCESSOR_
RECOVER
,
0
,
reason_effect
,
0
,
reason
,
(
reason_player
<<
28
)
+
(
playerid
<<
24
)
+
(
amount
&
0xffffff
));
void
field
::
recover
(
effect
*
reason_effect
,
uint32
reason
,
uint32
reason_player
,
uint32
playerid
,
uint32
amount
,
uint32
is_step
)
{
add_process
(
PROCESSOR_
DAMAGE
,
0
,
reason_effect
,
0
,
reason
,
(
is_step
<<
28
)
+
(
reason_player
<<
26
)
+
(
playerid
<<
24
)
+
(
amount
&
0xffffff
));
}
void
field
::
summon
(
uint32
sumplayer
,
card
*
target
,
effect
*
proc
,
uint32
ignore_count
,
uint32
min_tribute
)
{
add_process
(
PROCESSOR_SUMMON_RULE
,
0
,
proc
,
(
group
*
)
target
,
sumplayer
+
(
ignore_count
<<
8
)
+
(
min_tribute
<<
16
),
0
);
...
...
@@ -405,7 +406,7 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
}
return
TRUE
;
}
int32
field
::
damage
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
card
*
reason_card
,
uint8
playerid
,
uint32
amount
)
{
int32
field
::
damage
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
card
*
reason_card
,
uint8
playerid
,
uint32
amount
,
uint32
is_step
)
{
switch
(
step
)
{
case
0
:
{
effect_set
eset
;
...
...
@@ -420,8 +421,8 @@ int32 field::damage(uint16 step, effect* reason_effect, uint32 reason, uint8 rea
pduel
->
lua
->
add_param
(
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_card
,
PARAM_TYPE_CARD
);
if
(
eset
[
i
]
->
check_value_condition
(
4
))
{
recover
(
reason_effect
,
(
reason
&
0x18000
)
|
0x8040
,
reason_player
,
playerid
,
amount
);
core
.
units
.
begin
()
->
step
=
1
;
recover
(
reason_effect
,
(
reason
&
REASON_RRECOVER
)
|
REASON_RDAMAGE
|
REASON_EFFECT
,
reason_player
,
playerid
,
amount
,
is_step
);
core
.
units
.
begin
()
->
step
=
2
;
return
FALSE
;
}
}
...
...
@@ -449,42 +450,57 @@ int32 field::damage(uint16 step, effect* reason_effect, uint32 reason, uint8 rea
pduel
->
lua
->
add_param
(
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_card
,
PARAM_TYPE_CARD
);
if
(
eset
[
i
]
->
check_value_condition
(
5
))
{
playerid
=
1
-
playerid
;
core
.
units
.
begin
()
->
step
=
1
;
core
.
units
.
begin
()
->
arg2
|=
1
<<
29
;
break
;
}
}
core
.
units
.
begin
()
->
arg2
=
(
core
.
units
.
begin
()
->
arg2
&
0xff000000
)
|
(
val
&
0xffffff
);
if
(
is_step
)
{
core
.
units
.
begin
()
->
step
=
9
;
return
TRUE
;
}
return
FALSE
;
}
case
1
:
{
uint32
is_reflect
=
(
core
.
units
.
begin
()
->
arg2
>>
29
)
&
1
;
if
(
is_reflect
)
playerid
=
1
-
playerid
;
if
(
is_reflect
||
(
reason
&
REASON_RRECOVER
))
core
.
units
.
begin
()
->
step
=
2
;
core
.
hint_timing
[
playerid
]
|=
TIMING_DAMAGE
;
player
[
playerid
].
lp
-=
val
;
player
[
playerid
].
lp
-=
amount
;
pduel
->
write_buffer8
(
MSG_DAMAGE
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer32
(
val
);
core
.
units
.
begin
()
->
arg2
=
(
core
.
units
.
begin
()
->
arg2
&
0xff000000
)
+
(
val
&
0xffffff
);
raise_event
(
reason_card
,
EVENT_DAMAGE
,
reason_effect
,
reason
,
reason_player
,
playerid
,
val
);
pduel
->
write_buffer32
(
amount
);
raise_event
(
reason_card
,
EVENT_DAMAGE
,
reason_effect
,
reason
,
reason_player
,
playerid
,
amount
);
if
(
reason
==
REASON_BATTLE
&&
reason_card
)
{
if
((
player
[
playerid
].
lp
<=
0
)
&&
(
core
.
attack_target
==
0
)
&&
reason_card
->
is_affected_by_effect
(
EFFECT_MATCH_KILL
))
{
pduel
->
write_buffer8
(
MSG_MATCH_KILL
);
pduel
->
write_buffer32
(
reason_card
->
data
.
code
);
}
raise_single_event
(
reason_card
,
0
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
playerid
,
val
);
raise_event
(
reason_card
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
playerid
,
val
);
raise_single_event
(
reason_card
,
0
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
playerid
,
amount
);
raise_event
(
reason_card
,
EVENT_BATTLE_DAMAGE
,
0
,
0
,
reason_player
,
playerid
,
amount
);
process_single_event
();
}
process_instant_event
();
return
FALSE
;
}
case
1
:
{
case
2
:
{
returns
.
ivalue
[
0
]
=
amount
;
return
TRUE
;
}
case
2
:
{
case
3
:
{
returns
.
ivalue
[
0
]
=
0
;
return
TRUE
;
}
case
10
:
{
//dummy
return
TRUE
;
}
}
return
TRUE
;
}
int32
field
::
recover
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
playerid
,
uint32
amount
)
{
int32
field
::
recover
(
uint16
step
,
effect
*
reason_effect
,
uint32
reason
,
uint8
reason_player
,
uint8
playerid
,
uint32
amount
,
uint32
is_step
)
{
switch
(
step
)
{
case
0
:
{
effect_set
eset
;
...
...
@@ -498,12 +514,21 @@ int32 field::recover(uint16 step, effect* reason_effect, uint32 reason, uint8 re
pduel
->
lua
->
add_param
(
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
reason_player
,
PARAM_TYPE_INT
);
if
(
eset
[
i
]
->
check_value_condition
(
3
))
{
damage
(
reason_effect
,
(
reason
&
0x18000
)
|
0x10040
,
reason_player
,
0
,
playerid
,
amount
);
core
.
units
.
begin
()
->
step
=
1
;
damage
(
reason_effect
,
(
reason
&
REASON_RDAMAGE
)
|
REASON_RRECOVER
|
REASON_EFFECT
,
reason_player
,
0
,
playerid
,
amount
,
is_step
);
core
.
units
.
begin
()
->
step
=
2
;
return
FALSE
;
}
}
}
if
(
is_step
)
{
core
.
units
.
begin
()
->
step
=
9
;
return
TRUE
;
}
return
FALSE
;
}
case
1
:
{
if
(
reason
&
REASON_RDAMAGE
)
core
.
units
.
begin
()
->
step
=
2
;
core
.
hint_timing
[
playerid
]
|=
TIMING_RECOVER
;
player
[
playerid
].
lp
+=
amount
;
pduel
->
write_buffer8
(
MSG_RECOVER
);
...
...
@@ -513,14 +538,18 @@ int32 field::recover(uint16 step, effect* reason_effect, uint32 reason, uint8 re
process_instant_event
();
return
FALSE
;
}
case
1
:
{
case
2
:
{
returns
.
ivalue
[
0
]
=
amount
;
return
TRUE
;
}
case
2
:
{
case
3
:
{
returns
.
ivalue
[
0
]
=
0
;
return
TRUE
;
}
case
10
:
{
//dummy
return
TRUE
;
}
}
return
TRUE
;
}
...
...
processor.cpp
View file @
83473e3f
...
...
@@ -413,22 +413,30 @@ int32 field::process() {
}
case
PROCESSOR_DAMAGE
:
{
int32
reason
=
it
->
arg1
;
effect
*
p
effect
=
0
;
card
*
p
card
=
0
;
effect
*
reason_
effect
=
0
;
card
*
reason_
card
=
0
;
if
(
reason
&
REASON_BATTLE
)
pcard
=
(
card
*
)
it
->
peffect
;
else
peffect
=
it
->
peffect
;
if
(
damage
(
it
->
step
,
peffect
,
reason
,
(
it
->
arg2
>>
28
)
&
0xf
,
pcard
,
(
it
->
arg2
>>
24
)
&
0xf
,
it
->
arg2
&
0xffffff
))
core
.
units
.
pop_front
();
reason_card
=
(
card
*
)
it
->
peffect
;
else
reason_effect
=
it
->
peffect
;
if
(
damage
(
it
->
step
,
reason_effect
,
reason
,
(
it
->
arg2
>>
26
)
&
0x3
,
reason_card
,
(
it
->
arg2
>>
24
)
&
0x3
,
it
->
arg2
&
0xffffff
,
(
it
->
arg2
>>
28
)
&
0x1
))
{
if
(
it
->
step
==
9
)
{
it
->
step
=
1
;
core
.
recover_damage_reserve
.
splice
(
core
.
recover_damage_reserve
.
end
(),
core
.
units
,
it
);
}
else
core
.
units
.
pop_front
();
}
else
it
->
step
++
;
return
pduel
->
bufferlen
;
}
case
PROCESSOR_RECOVER
:
{
if
(
recover
(
it
->
step
,
it
->
peffect
,
it
->
arg1
,
(
it
->
arg2
>>
28
)
&
0xf
,
(
it
->
arg2
>>
24
)
&
0xf
,
it
->
arg2
&
0xffffff
))
core
.
units
.
pop_front
();
else
if
(
recover
(
it
->
step
,
it
->
peffect
,
it
->
arg1
,
(
it
->
arg2
>>
26
)
&
0x3
,
(
it
->
arg2
>>
24
)
&
0x3
,
it
->
arg2
&
0xffffff
,
(
it
->
arg2
>>
28
)
&
0x1
))
{
if
(
it
->
step
==
9
)
{
it
->
step
=
1
;
core
.
recover_damage_reserve
.
splice
(
core
.
recover_damage_reserve
.
end
(),
core
.
units
,
it
);
}
else
core
.
units
.
pop_front
();
}
else
it
->
step
++
;
return
pduel
->
bufferlen
;
}
...
...
scriptlib.h
View file @
83473e3f
...
...
@@ -360,6 +360,7 @@ public:
static
int32
duel_draw
(
lua_State
*
L
);
static
int32
duel_damage
(
lua_State
*
L
);
static
int32
duel_recover
(
lua_State
*
L
);
static
int32
duel_rd_complete
(
lua_State
*
L
);
static
int32
duel_equip
(
lua_State
*
L
);
static
int32
duel_equip_complete
(
lua_State
*
L
);
static
int32
duel_get_control
(
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