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
5ba3e298
Commit
5ba3e298
authored
Jan 06, 2016
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
b62ac6b3
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
49 deletions
+46
-49
card.cpp
card.cpp
+13
-18
card.h
card.h
+10
-5
libcard.cpp
libcard.cpp
+1
-2
operations.cpp
operations.cpp
+2
-3
processor.cpp
processor.cpp
+20
-21
No files found.
card.cpp
View file @
5ba3e298
...
...
@@ -72,7 +72,6 @@ card::card(duel* pd) {
assume_type
=
0
;
assume_value
=
0
;
spsummon_code
=
0
;
relate_effect_outside
=
0
;
current
.
controler
=
PLAYER_NONE
;
}
card
::~
card
()
{
...
...
@@ -1438,48 +1437,44 @@ void card::release_relation(card* target) {
return
;
relations
.
erase
(
target
);
}
void
card
::
create_relation
(
uint16
chain_id
)
{
relate_effect
.
insert
(
chain_id
);
void
card
::
create_relation
(
const
chain
&
ch
)
{
relate_effect
.
insert
(
std
::
make_pair
(
ch
.
triggering_effect
,
ch
.
chain_id
)
);
}
int32
card
::
is_has_relation
(
uint16
chain_id
)
{
if
(
relate_effect
.
find
(
chain_id
)
!=
relate_effect
.
end
())
int32
card
::
is_has_relation
(
const
chain
&
ch
)
{
if
(
relate_effect
.
find
(
std
::
make_pair
(
ch
.
triggering_effect
,
ch
.
chain_id
)
)
!=
relate_effect
.
end
())
return
TRUE
;
return
FALSE
;
}
void
card
::
release_relation
(
uint16
chain_id
)
{
relate_effect
.
erase
(
chain_id
);
void
card
::
release_relation
(
const
chain
&
ch
)
{
relate_effect
.
erase
(
std
::
make_pair
(
ch
.
triggering_effect
,
ch
.
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
);
create_relation
(
*
it
);
return
;
}
}
relate_effect
_outside
=
peffect
;
relate_effect
.
insert
(
std
::
make_pair
(
peffect
,
(
uint16
)
0
))
;
}
int32
card
::
is_has_relation
(
effect
*
peffect
)
{
for
(
auto
it
=
pduel
->
game_field
->
core
.
current_chain
.
rbegin
();
it
!=
pduel
->
game_field
->
core
.
current_chain
.
r
end
();
++
it
)
{
if
(
it
->
triggering_effec
t
==
peffect
)
return
is_has_relation
(
it
->
chain_id
)
;
for
(
auto
it
=
relate_effect
.
begin
();
it
!=
relate_effect
.
end
();
++
it
)
{
if
(
it
->
firs
t
==
peffect
)
return
TRUE
;
}
if
(
relate_effect_outside
==
peffect
)
return
TRUE
;
return
FALSE
;
}
void
card
::
release_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
)
{
release_relation
(
it
->
chain_id
);
release_relation
(
*
it
);
return
;
}
}
if
(
relate_effect_outside
==
peffect
)
relate_effect_outside
=
0
;
relate_effect
.
erase
(
std
::
make_pair
(
peffect
,
(
uint16
)
0
));
}
int32
card
::
leave_field_redirect
(
uint32
reason
)
{
effect_set
es
;
...
...
card.h
View file @
5ba3e298
...
...
@@ -9,6 +9,7 @@
#define CARD_H_
#include "common.h"
#include "effect.h"
#include "effectset.h"
#include <set>
#include <map>
...
...
@@ -17,7 +18,6 @@
class
card
;
class
duel
;
class
effect
;
class
group
;
struct
card_data
{
...
...
@@ -79,11 +79,16 @@ struct query_cache {
class
card
{
public:
struct
effect_relation_hash
{
inline
std
::
size_t
operator
()(
const
std
::
pair
<
effect
*
,
uint16
>&
v
)
const
{
return
std
::
hash
<
uint16
>
()(
v
.
second
);
}
};
typedef
std
::
vector
<
card
*>
card_vector
;
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_set
<
uint16
>
effect_relation
;
typedef
std
::
unordered_set
<
std
::
pair
<
effect
*
,
uint16
>
,
effect_relation_hash
>
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
>
>
{
...
...
@@ -195,9 +200,9 @@ public:
void
create_relation
(
card
*
target
,
uint32
reset
);
int32
is_has_relation
(
card
*
target
);
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
create_relation
(
const
chain
&
ch
);
int32
is_has_relation
(
const
chain
&
ch
);
void
release_relation
(
const
chain
&
ch
);
void
clear_relate_effect
();
void
create_relation
(
effect
*
peffect
);
int32
is_has_relation
(
effect
*
peffect
);
...
...
libcard.cpp
View file @
5ba3e298
...
...
@@ -1153,8 +1153,7 @@ int32 scriptlib::card_is_relate_to_chain(lua_State *L) {
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
))
if
(
pcard
&&
pcard
->
is_has_relation
(
pduel
->
game_field
->
core
.
current_chain
[
chain_count
-
1
]))
lua_pushboolean
(
L
,
1
);
else
lua_pushboolean
(
L
,
0
);
...
...
operations.cpp
View file @
5ba3e298
...
...
@@ -69,12 +69,11 @@ void field::change_target(uint8 chaincount, group* targets) {
group
*
ot
=
core
.
current_chain
[
chaincount
-
1
].
target_cards
;
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(c
hain_id
);
(
*
cit
)
->
release_relation
(
c
ore
.
current_chain
[
chaincount
-
1
]
);
ot
->
container
=
targets
->
container
;
for
(
auto
cit
=
ot
->
container
.
begin
();
cit
!=
ot
->
container
.
end
();
++
cit
)
(*cit)->create_relation(c
hain_id
);
(
*
cit
)
->
create_relation
(
c
ore
.
current_chain
[
chaincount
-
1
]
);
if
(
te
->
is_flag
(
EFFECT_FLAG_CARD_TARGET
))
{
for
(
auto
cit
=
ot
->
container
.
begin
();
cit
!=
ot
->
container
.
end
();
++
cit
)
{
if
((
*
cit
)
->
current
.
location
&
0x30
)
...
...
processor.cpp
View file @
5ba3e298
This diff is collapsed.
Click to expand it.
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