Commit 07cf4d44 authored by nanahira's avatar nanahira

update

parent 31916c5d
...@@ -516,13 +516,13 @@ card* field::get_field_card(uint32 playerid, uint32 location, uint32 sequence) { ...@@ -516,13 +516,13 @@ card* field::get_field_card(uint32 playerid, uint32 location, uint32 sequence) {
return 0; return 0;
} }
// return: the given slot in LOCATION_MZONE or all LOCATION_SZONE is available or not // return: the given slot in LOCATION_MZONE or all LOCATION_SZONE is available or not
int32 field::is_location_useable(uint32 playerid, uint32 location, uint32 sequence) { int32 field::is_location_useable(uint32 playerid, uint32 location, uint32 sequence, uint8 neglect_used) {
uint32 flag = player[playerid].disabled_location | player[playerid].used_location; uint32 flag = player[playerid].disabled_location | (neglect_used ? 0 : player[playerid].used_location);
if (location == LOCATION_MZONE) { if (location == LOCATION_MZONE) {
if(flag & (0x1u << sequence)) if(flag & (0x1u << sequence))
return FALSE; return FALSE;
if(sequence >= 5) { if(sequence >= 5) {
uint32 oppo = player[1 - playerid].disabled_location | player[1 - playerid].used_location; uint32 oppo = player[1 - playerid].disabled_location | (neglect_used ? 0 : player[1 - playerid].used_location);
if(oppo & (0x1u << (11 - sequence))) if(oppo & (0x1u << (11 - sequence)))
return FALSE; return FALSE;
} }
...@@ -546,11 +546,11 @@ int32 field::is_location_useable(uint32 playerid, uint32 location, uint32 sequen ...@@ -546,11 +546,11 @@ int32 field::is_location_useable(uint32 playerid, uint32 location, uint32 sequen
// uplayer: request player, PLAYER_NONE means ignoring EFFECT_MAX_MZONE, EFFECT_MAX_SZONE // uplayer: request player, PLAYER_NONE means ignoring EFFECT_MAX_MZONE, EFFECT_MAX_SZONE
// list: store local flag in list // list: store local flag in list
// return: usable count of LOCATION_MZONE or real LOCATION_SZONE of playerid requested by uplayer (may be negative) // return: usable count of LOCATION_MZONE or real LOCATION_SZONE of playerid requested by uplayer (may be negative)
int32 field::get_useable_count(card* pcard, uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone, uint32* list) { int32 field::get_useable_count(card* pcard, uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone, uint32* list, uint8 neglect_used) {
if(core.duel_rule >= 4 && location == LOCATION_MZONE && pcard->current.location == LOCATION_EXTRA) if(core.duel_rule >= 4 && location == LOCATION_MZONE && pcard->current.location == LOCATION_EXTRA)
return get_useable_count_fromex(pcard, playerid, uplayer, zone, list); return get_useable_count_fromex(pcard, playerid, uplayer, zone, list);
else else
return get_useable_count(playerid, location, uplayer, reason, zone, list); return get_useable_count(playerid, location, uplayer, reason, zone, list, neglect_used);
} }
int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, uint32* list) { int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, uint32* list) {
if(core.duel_rule >= 4 && pcard->current.location == LOCATION_EXTRA) if(core.duel_rule >= 4 && pcard->current.location == LOCATION_EXTRA)
...@@ -558,8 +558,8 @@ int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, ui ...@@ -558,8 +558,8 @@ int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, ui
else else
return get_tofield_count(playerid, LOCATION_MZONE, zone, list); return get_tofield_count(playerid, LOCATION_MZONE, zone, list);
} }
int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone, uint32* list) { int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone, uint32* list, uint8 neglect_used) {
int32 count = get_tofield_count(playerid, location, zone, list); int32 count = get_tofield_count(playerid, location, zone, list, neglect_used);
int32 limit; int32 limit;
if(location == LOCATION_MZONE) if(location == LOCATION_MZONE)
limit = get_mzone_limit(playerid, uplayer, LOCATION_REASON_TOFIELD); limit = get_mzone_limit(playerid, uplayer, LOCATION_REASON_TOFIELD);
...@@ -569,10 +569,10 @@ int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, ui ...@@ -569,10 +569,10 @@ int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, ui
count = limit; count = limit;
return count; return count;
} }
int32 field::get_tofield_count(uint8 playerid, uint8 location, uint32 zone, uint32* list) { int32 field::get_tofield_count(uint8 playerid, uint8 location, uint32 zone, uint32* list, uint8 neglect_used) {
if (location != LOCATION_MZONE && location != LOCATION_SZONE) if (location != LOCATION_MZONE && location != LOCATION_SZONE)
return 0; return 0;
uint32 flag = player[playerid].disabled_location | player[playerid].used_location; uint32 flag = player[playerid].disabled_location | (neglect_used ? 0 : player[playerid].used_location);
if (location == LOCATION_MZONE) if (location == LOCATION_MZONE)
flag = (flag | ~zone) & 0x1f; flag = (flag | ~zone) & 0x1f;
else else
......
...@@ -345,11 +345,11 @@ public: ...@@ -345,11 +345,11 @@ public:
void move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence, uint8 pzone = FALSE); void move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence, uint8 pzone = FALSE);
void set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 reset_count); void set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 reset_count);
card* get_field_card(uint32 playerid, uint32 location, uint32 sequence); card* get_field_card(uint32 playerid, uint32 location, uint32 sequence);
int32 is_location_useable(uint32 playerid, uint32 location, uint32 sequence); int32 is_location_useable(uint32 playerid, uint32 location, uint32 sequence, uint8 neglect_used = 0);
int32 get_useable_count(card* pcard, uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone = 0xff, uint32* list = 0); int32 get_useable_count(card* pcard, uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone = 0xff, uint32* list = 0, uint8 neglect_used = 0);
int32 get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone = 0xff, uint32* list = 0); int32 get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone = 0xff, uint32* list = 0);
int32 get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone = 0xff, uint32* list = 0); int32 get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, uint32 reason, uint32 zone = 0xff, uint32* list = 0, uint8 neglect_used = 0);
int32 get_tofield_count(uint8 playerid, uint8 location, uint32 zone = 0xff, uint32* list = 0); int32 get_tofield_count(uint8 playerid, uint8 location, uint32 zone = 0xff, uint32* list = 0, uint8 neglect_used = 0);
int32 get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer, uint32 zone = 0xff, uint32* list = 0); int32 get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer, uint32 zone = 0xff, uint32* list = 0);
int32 get_spsummonable_count_fromex(card* pcard, uint8 playerid, uint32 zone = 0xff, uint32* list = 0); int32 get_spsummonable_count_fromex(card* pcard, uint8 playerid, uint32 zone = 0xff, uint32* list = 0);
int32 get_mzone_limit(uint8 playerid, uint8 uplayer, uint32 reason); int32 get_mzone_limit(uint8 playerid, uint8 uplayer, uint32 reason);
......
...@@ -1759,10 +1759,13 @@ int32 scriptlib::duel_check_location(lua_State *L) { ...@@ -1759,10 +1759,13 @@ int32 scriptlib::duel_check_location(lua_State *L) {
uint32 playerid = lua_tointeger(L, 1); uint32 playerid = lua_tointeger(L, 1);
uint32 location = lua_tointeger(L, 2); uint32 location = lua_tointeger(L, 2);
uint32 sequence = lua_tointeger(L, 3); uint32 sequence = lua_tointeger(L, 3);
uint32 neglect_used = 0;
if(lua_gettop(L) >= 4)
neglect_used = lua_toboolean(L, 4);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_location_useable(playerid, location, sequence)); lua_pushboolean(L, pduel->game_field->is_location_useable(playerid, location, sequence, neglect_used));
return 1; return 1;
} }
int32 scriptlib::duel_get_current_chain(lua_State *L) { int32 scriptlib::duel_get_current_chain(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