Commit e0f00fd5 authored by VanillaSalt's avatar VanillaSalt

add IsFusionCode

parent 6e1886a8
...@@ -402,6 +402,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -402,6 +402,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_DISABLE_CHAIN_FIELD 337 #define EFFECT_DISABLE_CHAIN_FIELD 337
#define EFFECT_DISCARD_COST_CHANGE 338 #define EFFECT_DISCARD_COST_CHANGE 338
#define EFFECT_HAND_SYNCHRO 339 #define EFFECT_HAND_SYNCHRO 339
#define EFFECT_ADD_FUSION_CODE 340
#define EVENT_STARTUP 1000 #define EVENT_STARTUP 1000
#define EVENT_FLIP 1001 #define EVENT_FLIP 1001
......
...@@ -19,6 +19,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -19,6 +19,7 @@ static const struct luaL_Reg cardlib[] = {
{ "GetCode", scriptlib::card_get_code }, { "GetCode", scriptlib::card_get_code },
{ "GetOriginalCode", scriptlib::card_get_origin_code }, { "GetOriginalCode", scriptlib::card_get_origin_code },
{ "GetOriginalCodeRule", scriptlib::card_get_origin_code_rule }, { "GetOriginalCodeRule", scriptlib::card_get_origin_code_rule },
{ "IsFusionCode", scriptlib::card_is_fusion_code },
{ "IsSetCard", scriptlib::card_is_set_card }, { "IsSetCard", scriptlib::card_is_set_card },
{ "IsPreviousSetCard", scriptlib::card_is_pre_set_card }, { "IsPreviousSetCard", scriptlib::card_is_pre_set_card },
{ "GetType", scriptlib::card_get_type }, { "GetType", scriptlib::card_get_type },
......
...@@ -61,6 +61,29 @@ int32 scriptlib::card_get_origin_code_rule(lua_State *L) { ...@@ -61,6 +61,29 @@ int32 scriptlib::card_get_origin_code_rule(lua_State *L) {
} }
return 1; return 1;
} }
int32 scriptlib::card_is_fusion_code(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 tcode = lua_tointeger(L, 2);
uint32 code1 = pcard->get_code();
uint32 code2 = pcard->get_another_code();
uint32 result = FALSE;
if(code1 == tcode || (code2 && code2 == tcode)) {
result = TRUE;
} else {
effect_set eset;
pcard->filter_effect(EFFECT_ADD_FUSION_CODE, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
if(tcode == eset[i]->get_value(pcard)) {
result = TRUE;
break;
}
}
}
lua_pushboolean(L, result);
return 1;
}
int32 scriptlib::card_is_set_card(lua_State *L) { int32 scriptlib::card_is_set_card(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
......
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