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
fa3a227c
Commit
fa3a227c
authored
Apr 22, 2014
by
Fluorohydride
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmaterial count limit
parent
39241a28
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
18 deletions
+61
-18
ocgcore/field.cpp
ocgcore/field.cpp
+36
-1
ocgcore/field.h
ocgcore/field.h
+2
-1
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+1
-1
ocgcore/libduel.cpp
ocgcore/libduel.cpp
+20
-15
script/constant.lua
script/constant.lua
+2
-0
No files found.
ocgcore/field.cpp
View file @
fa3a227c
...
...
@@ -13,6 +13,7 @@
#include "interpreter.h"
#include <iostream>
#include <cstring>
#include <multimap>
int32
field
::
field_used_count
[
32
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
};
...
...
@@ -1629,7 +1630,41 @@ int32 field::check_with_sum_limit(card_vector* mats, int32 acc, int32 index, int
||
(
op2
&&
acc
>
op2
&&
check_with_sum_limit
(
mats
,
acc
-
op2
,
index
+
1
,
count
+
1
,
min
,
max
))
||
check_with_sum_limit
(
mats
,
acc
,
index
+
1
,
count
,
min
,
max
);
}
int32
field
::
check_xyz_material
(
card
*
pcard
,
int32
findex
,
int32
min
,
min32
max
,
group
*
mg
)
{
int32
field
::
check_xyz_material
(
card
*
scard
,
int32
findex
,
int32
min
,
int32
max
,
group
*
mg
)
{
card_set
mat
,
cset
;
pduel
->
game_field
->
get_xyz_material
(
scard
,
&
mat
);
if
(
mg
)
{
for
(
auto
pcard
:
mg
->
container
)
{
if
(
pduel
->
lua
->
check_matching
(
pcard
,
findex
,
0
))
cset
.
insert
(
pcard
);
}
}
else
{
for
(
auto
pcard
:
mat
)
{
if
(
pduel
->
lua
->
check_matching
(
pcard
,
findex
,
0
))
cset
.
insert
(
pcard
);
}
}
if
(
core
.
global_flag
&
GLOBALFLAG_XMAT_COUNT_LIMIT
)
{
for
(
auto
pcard
:
cset
)
{
std
::
multimap
<
int32
,
card
*>
m
;
effect
*
peffect
=
pcard
->
is_affected_by_effect
(
EFFECT_XMAT_COUNT_LIMIT
);
if
(
peffect
)
{
int32
v
=
peffect
->
get_value
();
m
.
insert
(
std
::
make_pair
(
v
,
pcard
));
}
auto
iter
=
m
.
rbegin
();
while
(
iter
!=
m
.
rend
())
{
auto
cur
=
iter
++
;
if
(
cur
->
first
>
cset
.
size
())
{
cset
.
erase
(
cur
->
second
);
m
.
erase
(
cur
);
}
}
}
return
cset
.
size
()
>=
min
;
}
else
{
return
cset
.
size
()
>=
min
;
}
return
TRUE
;
}
int32
field
::
is_player_can_draw
(
uint8
playerid
)
{
...
...
ocgcore/field.h
View file @
fa3a227c
...
...
@@ -361,7 +361,7 @@ public:
int32
check_synchro_material
(
card
*
pcard
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
group
*
mg
);
int32
check_tuner_material
(
card
*
pcard
,
card
*
tuner
,
int32
findex1
,
int32
findex2
,
int32
min
,
int32
max
,
group
*
mg
);
int32
check_with_sum_limit
(
card_vector
*
mats
,
int32
acc
,
int32
index
,
int32
count
,
int32
min
,
int32
max
);
int32
check_xyz_material
(
card
*
pcard
,
int32
findex
,
int32
min
,
min
32
max
,
group
*
mg
);
int32
check_xyz_material
(
card
*
pcard
,
int32
findex
,
int32
min
,
int
32
max
,
group
*
mg
);
int32
is_player_can_draw
(
uint8
playerid
);
int32
is_player_can_discard_deck
(
uint8
playerid
,
int32
count
);
...
...
@@ -556,6 +556,7 @@ public:
#define GLOBALFLAG_DETACH_EVENT 0x10
#define GLOBALFLAG_MUST_BE_SMATERIAL 0x20
#define GLOBALFLAG_SPSUMMON_COUNT 0x40
#define GLOBALFLAG_XMAT_COUNT_LIMIT 0x80
//
#define PROCESSOR_NONE 0
#define PROCESSOR_WAITING 0x10000
...
...
ocgcore/interpreter.cpp
View file @
fa3a227c
...
...
@@ -427,7 +427,7 @@ static const struct luaL_Reg duellib[] = {
{
"SetOperationInfo"
,
scriptlib
::
duel_set_operation_info
},
{
"GetOperationInfo"
,
scriptlib
::
duel_get_operation_info
},
{
"GetOperationCount"
,
scriptlib
::
duel_get_operation_count
},
{
"CheckXyzMaterial"
,
scriptlib
::
duel_
get
_xyz_material
},
{
"CheckXyzMaterial"
,
scriptlib
::
duel_
check
_xyz_material
},
{
"SelectXyzMaterial"
,
scriptlib
::
duel_select_xyz_material
},
{
"Overlay"
,
scriptlib
::
duel_overlay
},
{
"GetOverlayGroup"
,
scriptlib
::
duel_get_overlay_group
},
...
...
ocgcore/libduel.cpp
View file @
fa3a227c
...
...
@@ -2394,26 +2394,31 @@ int32 scriptlib::duel_get_operation_count(lua_State *L) {
return
1
;
}
int32
scriptlib
::
duel_check_xyz_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
2
);
card
*
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
scard
->
pduel
;
group
*
pgroup
=
pduel
->
new_group
();
group
*
mgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
get_xyz_material
(
scard
,
&
pgroup
->
container
);
interpreter
::
group2value
(
L
,
pgroup
);
uint32
minc
=
lua_tointeger
(
L
,
3
);
uint32
maxc
=
lua_tointeger
(
L
,
4
);
group
*
mg
=
nullptr
;
if
(
!
lua_isnil
(
L
,
5
))
{
check_param
(
L
,
PARAM_TYPE_GROUP
,
5
);
mg
=
*
(
group
**
)
lua_touserdata
(
L
,
5
);
}
lua_pushboolean
(
L
,
scard
->
pduel
->
game_field
->
check_xyz_material
(
scard
,
2
,
minc
,
maxc
,
mg
));
return
1
;
}
int32
scriptlib
::
duel_select_xyz_material
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
duel
*
pduel
=
scard
->
pduel
;
group
*
pgroup
=
pduel
->
new_group
();
group
*
mgroup
=
pduel
->
new_group
();
pduel
->
game_field
->
get_xyz_material
(
scard
,
&
pgroup
->
container
);
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
check_action_permission
(
L
);
check_param_count
(
L
,
5
);
check_param
(
L
,
PARAM_TYPE_CARD
,
2
);
check_param
(
L
,
PARAM_TYPE_FUNCTION
,
3
);
card
*
scard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
uint32
playerid
=
lua_tointeger
(
L
,
1
);
uint32
minc
=
lua_tointeger
(
L
,
4
);
uint32
maxc
=
lua_tointeger
(
L
,
5
);
scard
->
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_XMATERIAL
,
0
,
0
,
(
group
*
)
scard
,
playerid
,
minc
+
(
maxc
<<
16
));
return
lua_yield
(
L
,
0
);
}
int32
scriptlib
::
duel_overlay
(
lua_State
*
L
)
{
check_action_permission
(
L
);
...
...
script/constant.lua
View file @
fa3a227c
...
...
@@ -642,6 +642,8 @@ GLOBALFLAG_SCRAP_CHIMERA =0x4
GLOBALFLAG_DELAYED_QUICKEFFECT
=
0x8
GLOBALFLAG_DETACH_EVENT
=
0x10
GLOBALFLAG_MUST_BE_SMATERIAL
=
0x20
GLOBALFLAG_SPSUMMON_COUNT
-
0x40
GLOBALFLAG_XMAT_COUNT_LIMIT
=
0x80
--
EFFECT_COUNT_CODE_OATH
=
0x80000000
EFFECT_COUNT_CODE_SINGLE
=
0x1
...
...
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