Commit 9ecae394 authored by edo9300's avatar edo9300

Added temp parameter to card::is_can_add_counter

parent 181ccafe
......@@ -2124,7 +2124,7 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) {
// cmit->second[0]: permanent
// cmit->second[1]: reset while negated
int32 card::add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly) {
if(!is_can_add_counter(playerid, countertype, count, singly))
if(!is_can_add_counter(playerid, countertype, count, singly, FALSE))
return FALSE;
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
auto pr = counters.insert(std::make_pair(cttype, counter_map::mapped_type()));
......@@ -2182,11 +2182,11 @@ int32 card::remove_counter(uint16 countertype, uint16 count) {
pduel->write_buffer16(count);
return TRUE;
}
int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly) {
int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint8 temp) {
effect_set eset;
if(!pduel->game_field->is_player_can_place_counter(playerid, this, countertype, count))
return FALSE;
if(!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP))
if((!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP)) && !temp)
return FALSE;
if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED))
return FALSE;
......
......@@ -265,7 +265,7 @@ public:
int32 destination_redirect(uint8 destination, uint32 reason);
int32 add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly);
int32 remove_counter(uint16 countertype, uint16 count);
int32 is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly);
int32 is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint8 temp);
int32 get_counter(uint16 countertype);
void set_material(card_set* materials);
void add_card_target(card* pcard);
......
......@@ -2173,6 +2173,7 @@ int32 scriptlib::card_enable_counter_permit(lua_State *L) {
prange = LOCATION_MZONE;
else
prange = LOCATION_SZONE | LOCATION_FZONE;
prange |= LOCATION_GRAVE + LOCATION_REMOVED + LOCATION_EXTRA + LOCATION_OVERLAY + LOCATION_HAND + LOCATION_DECK;
effect* peffect = pcard->pduel->new_effect();
peffect->owner = pcard;
peffect->type = EFFECT_TYPE_SINGLE;
......@@ -2218,7 +2219,10 @@ int32 scriptlib::card_is_can_add_counter(lua_State *L) {
uint8 singly = FALSE;
if(lua_gettop(L) > 3)
singly = lua_toboolean(L, 4);
lua_pushboolean(L, pcard->is_can_add_counter(pcard->pduel->game_field->core.reason_player, countertype, count, singly));
uint8 temp = FALSE;
if(lua_gettop(L) > 4)
temp = lua_toboolean(L, 5);
lua_pushboolean(L, pcard->is_can_add_counter(pcard->pduel->game_field->core.reason_player, countertype, count, singly,temp));
return 1;
}
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