Commit fb6f13bf authored by nekrozar's avatar nekrozar Committed by VanillaSalt

add Card.CheckMZoneFromEX (#90)

parent f3dcd54e
...@@ -232,6 +232,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -232,6 +232,7 @@ static const struct luaL_Reg cardlib[] = {
{ "ResetNegateEffect", scriptlib::card_reset_negate_effect }, { "ResetNegateEffect", scriptlib::card_reset_negate_effect },
{ "AssumeProperty", scriptlib::card_assume_prop }, { "AssumeProperty", scriptlib::card_assume_prop },
{ "SetSPSummonOnce", scriptlib::card_set_spsummon_once }, { "SetSPSummonOnce", scriptlib::card_set_spsummon_once },
{ "CheckMZoneFromEX", scriptlib::card_check_mzone_from_ex },
{ NULL, NULL } { NULL, NULL }
}; };
......
...@@ -2452,3 +2452,18 @@ int32 scriptlib::card_set_spsummon_once(lua_State *L) { ...@@ -2452,3 +2452,18 @@ int32 scriptlib::card_set_spsummon_once(lua_State *L) {
pcard->pduel->game_field->core.global_flag |= GLOBALFLAG_SPSUMMON_ONCE; pcard->pduel->game_field->core.global_flag |= GLOBALFLAG_SPSUMMON_ONCE;
return 0; return 0;
} }
int32 scriptlib::card_check_mzone_from_ex(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
card::card_set linked_cards;
for(int32 playerid = 0; playerid < 2; ++playerid) {
uint32 linked_zone = pcard->pduel->game_field->core.duel_rule >= 4 ? pcard->pduel->game_field->get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
pcard->pduel->game_field->get_cards_in_zone(&linked_cards, linked_zone, playerid);
if(linked_cards.find(pcard) != linked_cards.end())
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
}
return 1;
}
...@@ -234,6 +234,7 @@ public: ...@@ -234,6 +234,7 @@ public:
static int32 card_reset_negate_effect(lua_State *L); static int32 card_reset_negate_effect(lua_State *L);
static int32 card_assume_prop(lua_State *L); static int32 card_assume_prop(lua_State *L);
static int32 card_set_spsummon_once(lua_State *L); static int32 card_set_spsummon_once(lua_State *L);
static int32 card_check_mzone_from_ex(lua_State *L);
//Effect functions //Effect functions
static int32 effect_new(lua_State *L); static int32 effect_new(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