Commit 37aa2592 authored by DailyShana's avatar DailyShana

update union

parent 886141f3
......@@ -1063,7 +1063,15 @@ void card::unequip() {
int32 card::get_union_count() {
int32 count = 0;
for(auto cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
if(((*cit)->data.type & TYPE_UNION) && (*cit)->is_status(STATUS_UNION))
if(((*cit)->data.type & TYPE_UNION) && (*cit)->is_affected_by_effect(EFFECT_UNION_STATUS))
count++;
}
return count;
}
int32 card::get_old_union_count() {
int32 count = 0;
for(auto cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
if(((*cit)->data.type & TYPE_UNION) && (*cit)->is_affected_by_effect(EFFECT_OLDUNION_STATUS))
count++;
}
return count;
......@@ -1495,7 +1503,6 @@ void card::reset(uint32 id, uint32 reset_type) {
auto pr = field_effect.equal_range(EFFECT_DISABLE_FIELD);
for(; pr.first != pr.second; ++pr.first)
pr.first->second->value = 0;
set_status(STATUS_UNION, FALSE);
}
if(id & 0xd7e0000) {
counters.clear();
......
......@@ -183,6 +183,7 @@ public:
void equip(card *target, uint32 send_msg = TRUE);
void unequip();
int32 get_union_count();
int32 get_old_union_count();
void xyz_overlay(card_set* materials);
void xyz_add(card* mat, card_set* des);
void xyz_remove(card* mat);
......
......@@ -403,6 +403,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_MUST_ATTACK_MONSTER 344
#define EFFECT_PATRICIAN_OF_DARKNESS 345
#define EFFECT_EXTRA_ATTACK_MONSTER 346
#define EFFECT_UNION_STATUS 347
#define EFFECT_OLDUNION_STATUS 348
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
......
......@@ -734,7 +734,8 @@ int32 scriptlib::card_check_equip_target(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
card* target = *(card**) lua_touserdata(L, 2);
if(pcard->is_affected_by_effect(EFFECT_EQUIP_LIMIT, target)
&& (!pcard->is_status(STATUS_UNION) || target->get_union_count() == 0))
&& ((!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);
......@@ -745,7 +746,8 @@ int32 scriptlib::card_get_union_count(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->get_union_count());
return 1;
lua_pushinteger(L, pcard->get_old_union_count());
return 2;
}
int32 scriptlib::card_get_overlay_group(lua_State *L) {
check_param_count(L, 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