Commit 095aee5e authored by salix5's avatar salix5 Committed by GitHub

add EFFECT_TUNER (#488)

parent 97f0a5fc
......@@ -2917,6 +2917,16 @@ int32 card::is_not_tuner(card* scard) {
return TRUE;
return FALSE;
}
int32 card::is_tuner(card* scard) {
if (get_synchro_type() & TYPE_TUNER)
return TRUE;
effect_set eset;
filter_effect(EFFECT_TUNER, &eset);
for (int32 i = 0; i < eset.size(); ++i)
if (!eset[i]->value || eset[i]->get_value(scard))
return TRUE;
return FALSE;
}
int32 card::check_unique_code(card* pcard) {
if(!unique_code)
return FALSE;
......
......@@ -332,6 +332,7 @@ public:
void fusion_select(uint8 playerid, group* fusion_m, card* cg, uint32 chkf, uint8 not_material);
int32 check_fusion_substitute(card* fcard);
int32 is_not_tuner(card* scard);
int32 is_tuner(card* scard);
int32 check_unique_code(card* pcard);
void get_unique_target(card_set* cset, int32 controler, card* icard = 0);
......
......@@ -467,6 +467,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_CHANGE_GRAVE_RACE 366
#define EFFECT_ACTIVATION_COUNT_LIMIT 367
#define EFFECT_LIMIT_SPECIAL_SUMMON_POSITION 368
#define EFFECT_TUNER 369
//#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
......
......@@ -2524,7 +2524,7 @@ int32 field::check_synchro_material(card* pcard, int32 findex1, int32 findex2, i
return FALSE;
}
int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 findex2, int32 min, int32 max, card* smat, group* mg) {
if(!tuner || (tuner->current.location == LOCATION_MZONE && !tuner->is_position(POS_FACEUP)) || !(tuner->get_synchro_type() & TYPE_TUNER) || !tuner->is_can_be_synchro_material(pcard))
if(!tuner || (tuner->current.location == LOCATION_MZONE && !tuner->is_position(POS_FACEUP)) || !tuner->is_tuner(pcard) || !tuner->is_can_be_synchro_material(pcard))
return FALSE;
effect* pcheck = tuner->is_affected_by_effect(EFFECT_SYNCHRO_CHECK);
if(pcheck)
......
......@@ -1262,6 +1262,15 @@ int32 scriptlib::card_is_not_tuner(lua_State *L) {
lua_pushboolean(L, pcard->is_not_tuner(scard));
return 1;
}
int32 scriptlib::card_is_tuner(lua_State* L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
check_param(L, PARAM_TYPE_CARD, 2);
card* pcard = *(card**)lua_touserdata(L, 1);
card* scard = *(card**)lua_touserdata(L, 2);
lua_pushboolean(L, pcard->is_tuner(scard));
return 1;
}
int32 scriptlib::card_set_status(lua_State *L) {
check_param_count(L, 3);
check_param(L, PARAM_TYPE_CARD, 1);
......@@ -3368,6 +3377,7 @@ static const struct luaL_Reg cardlib[] = {
{ "IsSummonPlayer", scriptlib::card_is_summon_player },
{ "IsStatus", scriptlib::card_is_status },
{ "IsNotTuner", scriptlib::card_is_not_tuner },
{ "IsTuner", scriptlib::card_is_tuner },
{ "SetStatus", scriptlib::card_set_status },
{ "IsDualState", scriptlib::card_is_dual_state },
{ "EnableDualState", scriptlib::card_enable_dual_state },
......
......@@ -133,6 +133,7 @@ public:
static int32 card_is_summon_player(lua_State *L);
static int32 card_is_status(lua_State *L);
static int32 card_is_not_tuner(lua_State *L);
static int32 card_is_tuner(lua_State* L);
static int32 card_set_status(lua_State *L);
static int32 card_is_dual_state(lua_State *L);
static int32 card_enable_dual_state(lua_State *L);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment