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
07760f84
Commit
07760f84
authored
Dec 25, 2015
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ReplaceEffect
parent
3d02b6c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
1 deletion
+51
-1
card.cpp
card.cpp
+33
-0
card.h
card.h
+2
-1
interpreter.cpp
interpreter.cpp
+1
-0
libcard.cpp
libcard.cpp
+14
-0
scriptlib.h
scriptlib.h
+1
-0
No files found.
card.cpp
View file @
07760f84
...
@@ -1170,6 +1170,13 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
...
@@ -1170,6 +1170,13 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
if (peffect->is_disable_related())
if (peffect->is_disable_related())
pduel->game_field->add_to_disable_check_list(check_target);
pduel->game_field->add_to_disable_check_list(check_target);
}
}
if (peffect->is_flag(EFFECT_FLAG_INITIAL) && peffect->copy_id && is_status(STATUS_EFFECT_REPLACED)) {
set_status(STATUS_EFFECT_REPLACED, FALSE);
set_status(STATUS_INITIALIZING, TRUE);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
pduel->lua->call_card_function(this, (char*) "initial_effect", 1, 0);
set_status(STATUS_INITIALIZING, FALSE);
}
indexer.erase(peffect);
indexer.erase(peffect);
if(peffect->is_flag(EFFECT_FLAG_OATH))
if(peffect->is_flag(EFFECT_FLAG_OATH))
pduel->game_field->effects.oath.erase(peffect);
pduel->game_field->effects.oath.erase(peffect);
...
@@ -1225,6 +1232,32 @@ int32 card::copy_effect(uint32 code, uint32 reset, uint32 count) {
...
@@ -1225,6 +1232,32 @@ int32 card::copy_effect(uint32 code, uint32 reset, uint32 count) {
pduel->uncopy.clear();
pduel->uncopy.clear();
return pduel->game_field->infos.copy_id - 1;
return pduel->game_field->infos.copy_id - 1;
}
}
int32 card::replace_effect(uint32 code, uint32 reset, uint32 count) {
card_data cdata;
read_card(code, &cdata);
if(cdata.type & TYPE_NORMAL)
return -1;
for(auto i = indexer.begin(); i != indexer.end();) {
auto rm = i++;
effect* peffect = rm->first;
auto it = rm->second;
if(peffect->is_flag(EFFECT_FLAG_INITIAL))
remove_effect(peffect, it);
}
uint32 cr = pduel->game_field->core.copy_reset;
uint8 crc = pduel->game_field->core.copy_reset_count;
pduel->game_field->core.copy_reset = reset;
pduel->game_field->core.copy_reset_count = count;
set_status(STATUS_INITIALIZING | STATUS_COPYING_EFFECT, TRUE);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
pduel->lua->call_code_function(code, (char*) "initial_effect", 1, 0);
set_status(STATUS_INITIALIZING | STATUS_COPYING_EFFECT, FALSE);
pduel->game_field->infos.copy_id++;
pduel->game_field->core.copy_reset = cr;
pduel->game_field->core.copy_reset_count = crc;
set_status(STATUS_EFFECT_REPLACED, TRUE);
return pduel->game_field->infos.copy_id - 1;
}
// add EFFECT_SET_CONTROL
// add EFFECT_SET_CONTROL
void card::reset(uint32 id, uint32 reset_type) {
void card::reset(uint32 id, uint32 reset_type) {
effect* peffect;
effect* peffect;
...
...
card.h
View file @
07760f84
...
@@ -183,6 +183,7 @@ public:
...
@@ -183,6 +183,7 @@ public:
void
remove_effect
(
effect
*
peffect
);
void
remove_effect
(
effect
*
peffect
);
void
remove_effect
(
effect
*
peffect
,
effect_container
::
iterator
it
);
void
remove_effect
(
effect
*
peffect
,
effect_container
::
iterator
it
);
int32
copy_effect
(
uint32
code
,
uint32
reset
,
uint32
count
);
int32
copy_effect
(
uint32
code
,
uint32
reset
,
uint32
count
);
int32
replace_effect
(
uint32
code
,
uint32
reset
,
uint32
count
);
void
reset
(
uint32
id
,
uint32
reset_type
);
void
reset
(
uint32
id
,
uint32
reset_type
);
void
reset_effect_count
();
void
reset_effect_count
();
int32
refresh_disable_status
();
int32
refresh_disable_status
();
...
@@ -401,7 +402,7 @@ public:
...
@@ -401,7 +402,7 @@ public:
#define STATUS_CHAINING 0x10000 //
#define STATUS_CHAINING 0x10000 //
#define STATUS_SUMMON_DISABLED 0x20000 //
#define STATUS_SUMMON_DISABLED 0x20000 //
#define STATUS_ACTIVATE_DISABLED 0x40000 //
#define STATUS_ACTIVATE_DISABLED 0x40000 //
//#define STATUS_UNSUMMONABLE_CARD
0x80000
#define STATUS_EFFECT_REPLACED
0x80000
#define STATUS_UNION 0x100000
#define STATUS_UNION 0x100000
#define STATUS_ATTACK_CANCELED 0x200000
#define STATUS_ATTACK_CANCELED 0x200000
#define STATUS_INITIALIZING 0x400000
#define STATUS_INITIALIZING 0x400000
...
...
interpreter.cpp
View file @
07760f84
...
@@ -138,6 +138,7 @@ static const struct luaL_Reg cardlib[] = {
...
@@ -138,6 +138,7 @@ static const struct luaL_Reg cardlib[] = {
{
"IsRelateToCard"
,
scriptlib
::
card_is_relate_to_card
},
{
"IsRelateToCard"
,
scriptlib
::
card_is_relate_to_card
},
{
"IsRelateToBattle"
,
scriptlib
::
card_is_relate_to_battle
},
{
"IsRelateToBattle"
,
scriptlib
::
card_is_relate_to_battle
},
{
"CopyEffect"
,
scriptlib
::
card_copy_effect
},
{
"CopyEffect"
,
scriptlib
::
card_copy_effect
},
{
"ReplaceEffect"
,
scriptlib
::
card_replace_effect
},
{
"EnableUnsummonable"
,
scriptlib
::
card_enable_unsummonable
},
{
"EnableUnsummonable"
,
scriptlib
::
card_enable_unsummonable
},
{
"EnableReviveLimit"
,
scriptlib
::
card_enable_revive_limit
},
{
"EnableReviveLimit"
,
scriptlib
::
card_enable_revive_limit
},
{
"CompleteProcedure"
,
scriptlib
::
card_complete_procedure
},
{
"CompleteProcedure"
,
scriptlib
::
card_complete_procedure
},
...
...
libcard.cpp
View file @
07760f84
...
@@ -1182,6 +1182,20 @@ int32 scriptlib::card_copy_effect(lua_State *L) {
...
@@ -1182,6 +1182,20 @@ int32 scriptlib::card_copy_effect(lua_State *L) {
lua_pushinteger
(
L
,
pcard
->
copy_effect
(
code
,
reset
,
count
));
lua_pushinteger
(
L
,
pcard
->
copy_effect
(
code
,
reset
,
count
));
return
1
;
return
1
;
}
}
int32
scriptlib
::
card_replace_effect
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
lua_tointeger
(
L
,
2
);
uint32
reset
=
lua_tointeger
(
L
,
3
);
uint32
count
=
lua_tointeger
(
L
,
4
);
if
(
count
==
0
)
count
=
1
;
if
(
reset
&
RESET_PHASE
&&
!
(
reset
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
reset
|=
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
);
lua_pushinteger
(
L
,
pcard
->
replace_effect
(
code
,
reset
,
count
));
return
1
;
}
int32
scriptlib
::
card_enable_unsummonable
(
lua_State
*
L
)
{
int32
scriptlib
::
card_enable_unsummonable
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
...
...
scriptlib.h
View file @
07760f84
...
@@ -140,6 +140,7 @@ public:
...
@@ -140,6 +140,7 @@ public:
static
int32
card_is_relate_to_card
(
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_is_relate_to_battle
(
lua_State
*
L
);
static
int32
card_copy_effect
(
lua_State
*
L
);
static
int32
card_copy_effect
(
lua_State
*
L
);
static
int32
card_replace_effect
(
lua_State
*
L
);
static
int32
card_enable_unsummonable
(
lua_State
*
L
);
static
int32
card_enable_unsummonable
(
lua_State
*
L
);
static
int32
card_enable_revive_limit
(
lua_State
*
L
);
static
int32
card_enable_revive_limit
(
lua_State
*
L
);
static
int32
card_complete_procedure
(
lua_State
*
L
);
static
int32
card_complete_procedure
(
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