Commit 4bedd847 authored by salix5's avatar salix5 Committed by GitHub

Merge pull request #316 from Fluorohydride/union

Card.CheckUnionTarget()
parents da5bd916 6dee9cc2
......@@ -275,6 +275,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_DUAL_STATUS 75 //
#define EFFECT_EQUIP_LIMIT 76 //
#define EFFECT_DUAL_SUMMONABLE 77 //
#define EFFECT_UNION_LIMIT 78 //
#define EFFECT_REVERSE_DAMAGE 80 //
#define EFFECT_REVERSE_RECOVER 81 //
#define EFFECT_CHANGE_DAMAGE 82 //
......
......@@ -1303,6 +1303,20 @@ int32 scriptlib::card_check_equip_target(lua_State *L) {
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_check_union_target(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
check_param(L, PARAM_TYPE_CARD, 2);
card* pcard = *(card**) lua_touserdata(L, 1);
card* target = *(card**) lua_touserdata(L, 2);
if(pcard->is_affected_by_effect(EFFECT_UNION_LIMIT, target)
&& ((!pcard->is_affected_by_effect(EFFECT_OLDUNION_STATUS) || target->get_union_count() == 0)
&& (!pcard->is_affected_by_effect(EFFECT_UNION_STATUS) || target->get_old_union_count() == 0)))
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_get_union_count(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
......@@ -3221,6 +3235,7 @@ static const struct luaL_Reg cardlib[] = {
{ "GetEquipTarget", scriptlib::card_get_equip_target },
{ "GetPreviousEquipTarget", scriptlib::card_get_pre_equip_target },
{ "CheckEquipTarget", scriptlib::card_check_equip_target },
{ "CheckUnionTarget", scriptlib::card_check_union_target },
{ "GetUnionCount", scriptlib::card_get_union_count },
{ "GetOverlayGroup", scriptlib::card_get_overlay_group },
{ "GetOverlayCount", scriptlib::card_get_overlay_count },
......
......@@ -138,6 +138,7 @@ public:
static int32 card_get_equip_target(lua_State *L);
static int32 card_get_pre_equip_target(lua_State *L);
static int32 card_check_equip_target(lua_State *L);
static int32 card_check_union_target(lua_State *L);
static int32 card_get_union_count(lua_State *L);
static int32 card_get_overlay_group(lua_State *L);
static int32 card_get_overlay_count(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