Commit bfb5809c authored by mercury233's avatar mercury233

fix & update

parent c43ddc4e
...@@ -2182,26 +2182,27 @@ int32 card::remove_counter(uint16 countertype, uint16 count) { ...@@ -2182,26 +2182,27 @@ int32 card::remove_counter(uint16 countertype, uint16 count) {
pduel->write_buffer16(count); pduel->write_buffer16(count);
return TRUE; return TRUE;
} }
int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint32 temploc) { int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint32 loc) {
effect_set eset; effect_set eset;
if(!pduel->game_field->is_player_can_place_counter(playerid, this, countertype, count)) if(!pduel->game_field->is_player_can_place_counter(playerid, this, countertype, count))
return FALSE; return FALSE;
if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED)) if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED))
return FALSE; return FALSE;
filter_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff), &eset); uint32 check = countertype & COUNTER_WITHOUT_PERMIT;
bool check = false; if(!check) {
for(int32 i = 0; i < eset.size(); ++i){ filter_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff), &eset);
uint32 prange = eset[i]->get_value(); for(int32 i = 0; i < eset.size(); ++i) {
if (!(countertype & COUNTER_WITHOUT_PERMIT)) { uint32 prange = eset[i]->get_value();
if(temploc) if(loc)
check = (temploc & prange); check = loc & prange;
else else
check = (current.is_location(prange) && is_position(POS_FACEUP)); check = current.is_location(prange) && is_position(POS_FACEUP);
if(check) if(check)
break; break;
} }
eset.clear();
} }
if(!check && !(countertype & COUNTER_WITHOUT_PERMIT)) if(!check)
return FALSE; return FALSE;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE; uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
int32 limit = -1; int32 limit = -1;
......
...@@ -265,7 +265,7 @@ public: ...@@ -265,7 +265,7 @@ public:
int32 destination_redirect(uint8 destination, uint32 reason); int32 destination_redirect(uint8 destination, uint32 reason);
int32 add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly); int32 add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly);
int32 remove_counter(uint16 countertype, uint16 count); int32 remove_counter(uint16 countertype, uint16 count);
int32 is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint32 temploc); int32 is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint32 loc);
int32 get_counter(uint16 countertype); int32 get_counter(uint16 countertype);
void set_material(card_set* materials); void set_material(card_set* materials);
void add_card_target(card* pcard); void add_card_target(card* pcard);
......
...@@ -2217,10 +2217,10 @@ int32 scriptlib::card_is_can_add_counter(lua_State *L) { ...@@ -2217,10 +2217,10 @@ int32 scriptlib::card_is_can_add_counter(lua_State *L) {
uint8 singly = FALSE; uint8 singly = FALSE;
if(lua_gettop(L) > 3) if(lua_gettop(L) > 3)
singly = lua_toboolean(L, 4); singly = lua_toboolean(L, 4);
uint8 temp = FALSE; uint32 loc = 0;
if(lua_gettop(L) > 4) if(lua_gettop(L) > 4)
temp = lua_toboolean(L, 5); loc = lua_tointeger(L, 5);
lua_pushboolean(L, pcard->is_can_add_counter(pcard->pduel->game_field->core.reason_player, countertype, count, singly,temp)); lua_pushboolean(L, pcard->is_can_add_counter(pcard->pduel->game_field->core.reason_player, countertype, count, singly, loc));
return 1; return 1;
} }
int32 scriptlib::card_is_can_remove_counter(lua_State *L) { int32 scriptlib::card_is_can_remove_counter(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