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
85d2b687
Commit
85d2b687
authored
Jan 04, 2016
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
e26e1f16
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
47 deletions
+99
-47
card.cpp
card.cpp
+43
-16
card.h
card.h
+9
-3
interpreter.cpp
interpreter.cpp
+1
-0
libcard.cpp
libcard.cpp
+16
-1
operations.cpp
operations.cpp
+5
-4
processor.cpp
processor.cpp
+24
-23
scriptlib.h
scriptlib.h
+1
-0
No files found.
card.cpp
View file @
85d2b687
...
...
@@ -72,6 +72,7 @@ card::card(duel* pd) {
assume_type
=
0
;
assume_value
=
0
;
spsummon_code
=
0
;
relate_effect_outside
=
0
;
current
.
controler
=
PLAYER_NONE
;
}
card
::~
card
()
{
...
...
@@ -1305,7 +1306,7 @@ void card::reset(uint32 id, uint32 reset_type) {
relations
.
erase
(
rrm
);
}
if
(
id
&
0x47c0000
)
relate_effect
.
clear
();
clear_relate_effect
();
if
(
id
&
0x5fc0000
)
{
announced_cards
.
clear
();
attacked_cards
.
clear
();
...
...
@@ -1427,32 +1428,58 @@ void card::create_relation(card* target, uint32 reset) {
return
;
relations
[
target
]
=
reset
;
}
void
card
::
create_relation
(
effect
*
peffect
)
{
auto
it
=
relate_effect
.
find
(
peffect
);
if
(
it
!=
relate_effect
.
end
())
++
it
->
second
;
else
relate_effect
[
peffect
]
=
1
;
}
int32
card
::
is_has_relation
(
card
*
target
)
{
if
(
relations
.
find
(
target
)
!=
relations
.
end
())
return
TRUE
;
return
FALSE
;
}
int32
card
::
is_has_relation
(
effect
*
peffect
)
{
if
(
relate_effect
.
find
(
peffect
)
!=
relate_effect
.
end
())
return
TRUE
;
return
FALSE
;
}
void
card
::
release_relation
(
card
*
target
)
{
if
(
relations
.
find
(
target
)
==
relations
.
end
())
return
;
relations
.
erase
(
target
);
}
void
card
::
create_relation
(
uint16
chain_id
)
{
relate_effect
.
insert
(
chain_id
);
}
int32
card
::
is_has_relation
(
uint16
chain_id
)
{
if
(
relate_effect
.
find
(
chain_id
)
!=
relate_effect
.
end
())
return
TRUE
;
return
FALSE
;
}
void
card
::
release_relation
(
uint16
chain_id
)
{
relate_effect
.
erase
(
chain_id
);
}
void
card
::
clear_relate_effect
()
{
relate_effect
.
clear
();
relate_effect_outside
=
0
;
}
void
card
::
create_relation
(
effect
*
peffect
)
{
for
(
auto
it
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
it
!=
pduel
->
game_field
->
core
.
current_chain
.
rend
();
++
it
)
{
if
(
it
->
triggering_effect
==
peffect
)
{
create_relation
(
it
->
chain_id
);
return
;
}
}
relate_effect_outside
=
peffect
;
}
int32
card
::
is_has_relation
(
effect
*
peffect
)
{
for
(
auto
it
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
it
!=
pduel
->
game_field
->
core
.
current_chain
.
rend
();
++
it
)
{
if
(
it
->
triggering_effect
==
peffect
)
return
is_has_relation
(
it
->
chain_id
);
}
if
(
relate_effect_outside
==
peffect
)
return
TRUE
;
return
FALSE
;
}
void
card
::
release_relation
(
effect
*
peffect
)
{
auto
it
=
relate_effect
.
find
(
peffect
);
if
(
it
!=
relate_effect
.
end
()
&&
--
it
->
second
==
0
)
relate_effect
.
erase
(
it
);
for
(
auto
it
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
it
!=
pduel
->
game_field
->
core
.
current_chain
.
rend
();
++
it
)
{
if
(
it
->
triggering_effect
==
peffect
)
{
release_relation
(
it
->
chain_id
);
return
;
}
}
if
(
relate_effect_outside
==
peffect
)
relate_effect_outside
=
0
;
}
int32
card
::
leave_field_redirect
(
uint32
reason
)
{
effect_set
es
;
...
...
card.h
View file @
85d2b687
...
...
@@ -12,6 +12,7 @@
#include "effectset.h"
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
class
card
;
...
...
@@ -82,7 +83,7 @@ public:
typedef
std
::
multimap
<
uint32
,
effect
*>
effect_container
;
typedef
std
::
set
<
card
*
,
card_sort
>
card_set
;
typedef
std
::
unordered_map
<
effect
*
,
effect_container
::
iterator
>
effect_indexer
;
typedef
std
::
unordered_
map
<
effect
*
,
uint32
>
effect_relation
;
typedef
std
::
unordered_
set
<
uint16
>
effect_relation
;
typedef
std
::
unordered_map
<
card
*
,
uint32
>
relation_map
;
typedef
std
::
map
<
uint16
,
std
::
array
<
uint16
,
2
>
>
counter_map
;
class
attacker_map
:
public
std
::
unordered_map
<
uint16
,
std
::
pair
<
card
*
,
uint32
>
>
{
...
...
@@ -137,6 +138,7 @@ public:
effect_container
equip_effect
;
effect_indexer
indexer
;
effect_relation
relate_effect
;
effect
*
relate_effect_outside
;
effect_set_v
immune_effect
;
explicit
card
(
duel
*
pd
);
...
...
@@ -191,10 +193,14 @@ public:
void
count_turn
(
uint16
ct
);
void
create_relation
(
card
*
target
,
uint32
reset
);
void
create_relation
(
effect
*
peffect
);
int32
is_has_relation
(
card
*
target
);
int32
is_has_relation
(
effect
*
peffect
);
void
release_relation
(
card
*
target
);
void
create_relation
(
uint16
chain_id
);
int32
is_has_relation
(
uint16
chain_id
);
void
release_relation
(
uint16
chain_id
);
void
clear_relate_effect
();
void
create_relation
(
effect
*
peffect
);
int32
is_has_relation
(
effect
*
peffect
);
void
release_relation
(
effect
*
peffect
);
int32
leave_field_redirect
(
uint32
reason
);
int32
destination_redirect
(
uint8
destination
,
uint32
reason
);
...
...
interpreter.cpp
View file @
85d2b687
...
...
@@ -135,6 +135,7 @@ static const struct luaL_Reg cardlib[] = {
{
"ReleaseEffectRelation"
,
scriptlib
::
card_release_effect_relation
},
{
"ClearEffectRelation"
,
scriptlib
::
card_clear_effect_relation
},
{
"IsRelateToEffect"
,
scriptlib
::
card_is_relate_to_effect
},
{
"IsRelateToChain"
,
scriptlib
::
card_is_relate_to_chain
},
{
"IsRelateToCard"
,
scriptlib
::
card_is_relate_to_card
},
{
"IsRelateToBattle"
,
scriptlib
::
card_is_relate_to_battle
},
{
"CopyEffect"
,
scriptlib
::
card_copy_effect
},
...
...
libcard.cpp
View file @
85d2b687
...
...
@@ -1130,7 +1130,7 @@ int32 scriptlib::card_clear_effect_relation(lua_State *L) {
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
pcard
->
relate_effect
.
clear
();
pcard
->
clear_relate_effect
();
return
0
;
}
int32
scriptlib
::
card_is_relate_to_effect
(
lua_State
*
L
)
{
...
...
@@ -1145,6 +1145,21 @@ int32 scriptlib::card_is_relate_to_effect(lua_State *L) {
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_relate_to_chain
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
chain_count
=
lua_tointeger
(
L
,
2
);
duel
*
pduel
=
pcard
->
pduel
;
if
(
chain_count
>
pduel
->
game_field
->
core
.
current_chain
.
size
()
||
chain_count
<
1
)
chain_count
=
pduel
->
game_field
->
core
.
current_chain
.
size
();
uint16
chain_id
=
pduel
->
game_field
->
core
.
current_chain
[
chain_count
-
1
].
chain_id
;
if
(
pcard
&&
pcard
->
is_has_relation
(
chain_id
))
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
return
1
;
}
int32
scriptlib
::
card_is_relate_to_card
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
operations.cpp
View file @
85d2b687
...
...
@@ -67,13 +67,14 @@ void field::change_target(uint8 chaincount, group* targets) {
if
(
chaincount
>
core
.
current_chain
.
size
()
||
chaincount
<
1
)
chaincount
=
core
.
current_chain
.
size
();
group
*
ot
=
core
.
current_chain
[
chaincount
-
1
].
target_cards
;
effect
*
te
=
core
.
current_chain
[
chaincount
-
1
].
triggering_effect
;
if
(
ot
)
{
effect
*
te
=
core
.
current_chain
[
chaincount
-
1
].
triggering_effect
;
uint16
chain_id
=
core
.
current_chain
[
chaincount
-
1
].
chain_id
;
for
(
auto
cit
=
ot
->
container
.
begin
();
cit
!=
ot
->
container
.
end
();
++
cit
)
(
*
cit
)
->
release_relation
(
te
);
(
*
cit
)
->
release_relation
(
chain_id
);
ot
->
container
=
targets
->
container
;
for
(
auto
cit
=
ot
->
container
.
begin
();
cit
!=
ot
->
container
.
end
();
++
cit
)
(
*
cit
)
->
create_relation
(
te
);
(
*
cit
)
->
create_relation
(
chain_id
);
if
(
te
->
is_flag
(
EFFECT_FLAG_CARD_TARGET
))
{
for
(
auto
cit
=
ot
->
container
.
begin
();
cit
!=
ot
->
container
.
end
();
++
cit
)
{
if
((
*
cit
)
->
current
.
location
&
0x30
)
...
...
@@ -3210,7 +3211,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard
->
current
.
reason
&=
~
REASON_TEMPORARY
;
pcard
->
fieldid
=
infos
.
field_id
++
;
pcard
->
reset
(
RESET_LEAVE
,
RESET_EVENT
);
pcard
->
relate_effect
.
clear
();
pcard
->
clear_relate_effect
();
remove_card
(
pcard
);
param
->
leave
.
insert
(
pcard
);
++
param
->
cvit
;
...
...
processor.cpp
View file @
85d2b687
This diff is collapsed.
Click to expand it.
scriptlib.h
View file @
85d2b687
...
...
@@ -137,6 +137,7 @@ public:
static
int32
card_release_effect_relation
(
lua_State
*
L
);
static
int32
card_clear_effect_relation
(
lua_State
*
L
);
static
int32
card_is_relate_to_effect
(
lua_State
*
L
);
static
int32
card_is_relate_to_chain
(
lua_State
*
L
);
static
int32
card_is_relate_to_card
(
lua_State
*
L
);
static
int32
card_is_relate_to_battle
(
lua_State
*
L
);
static
int32
card_copy_effect
(
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