Commit caa4a123 authored by VanillaSalt's avatar VanillaSalt

fix

parent 6439e4fa
...@@ -576,9 +576,11 @@ int32 field::get_tofield_count(uint8 playerid, uint8 location, uint8 uplayer, ui ...@@ -576,9 +576,11 @@ int32 field::get_tofield_count(uint8 playerid, uint8 location, uint8 uplayer, ui
flag = (flag | ~zone) & 0x1f; flag = (flag | ~zone) & 0x1f;
else else
flag = (flag >> 8) & 0x1f; flag = (flag >> 8) & 0x1f;
int32 count = 5 - field_used_count[flag];
if(location == LOCATION_MZONE)
flag |= (1u << 5) | (1u << 6);
if(list) if(list)
*list = flag; *list = flag;
int32 count = 5 - field_used_count[flag];
return count; return count;
} }
int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer, uint32 zone, uint32* list) { int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer, uint32 zone, uint32* list) {
......
...@@ -1497,11 +1497,17 @@ int32 scriptlib::duel_get_location_count(lua_State *L) { ...@@ -1497,11 +1497,17 @@ int32 scriptlib::duel_get_location_count(lua_State *L) {
if(location == LOCATION_MZONE) { if(location == LOCATION_MZONE) {
uint32 flag1, flag2; uint32 flag1, flag2;
int32 ct1 = pduel->game_field->get_useable_count(playerid, location, uplayer, reason, zone, &flag1); int32 ct1 = pduel->game_field->get_useable_count(playerid, location, uplayer, reason, zone, &flag1);
int32 ct2 = pduel->game_field->get_useable_count_fromex(0, playerid, uplayer, zone, &flag2); if(pduel->game_field->core.duel_rule >= 4) {
int32 ct3 = field::field_used_count[~(flag1 | flag2) & 0x1f]; int32 ct2 = pduel->game_field->get_useable_count_fromex(0, playerid, uplayer, zone, &flag2);
lua_pushinteger(L, ct1); int32 ct3 = field::field_used_count[~(flag1 | flag2) & 0x1f];
lua_pushinteger(L, ct2); lua_pushinteger(L, ct1);
lua_pushinteger(L, ct1 + ct2 - ct3); lua_pushinteger(L, ct2);
lua_pushinteger(L, ct1 + ct2 - ct3);
} else {
lua_pushinteger(L, ct1);
lua_pushinteger(L, ct1);
lua_pushinteger(L, ct1);
}
return 3; return 3;
} else { } else {
lua_pushinteger(L, pduel->game_field->get_useable_count(playerid, location, uplayer, reason)); lua_pushinteger(L, pduel->game_field->get_useable_count(playerid, location, uplayer, reason));
......
...@@ -3976,30 +3976,10 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -3976,30 +3976,10 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
pduel->write_buffer8(move_player); pduel->write_buffer8(move_player);
pduel->write_buffer32(target->data.code); pduel->write_buffer32(target->data.code);
add_process(PROCESSOR_SELECT_PLACE, 0, 0, 0, move_player, flag, 1); add_process(PROCESSOR_SELECT_PLACE, 0, 0, 0, move_player, flag, 1);
} else if(core.duel_rule >= 4 && location == LOCATION_MZONE && target->current.location == LOCATION_EXTRA) {
uint32 flag;
int32 ct = get_useable_count_fromex(target, playerid, move_player, zone, &flag);
if((ret == 1) && (ct <= 0 || target->is_status(STATUS_FORBIDDEN) || check_unique_onfield(target, playerid, location))) {
core.units.begin()->step = 3;
send_to(target, core.reason_effect, REASON_RULE, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, 0);
return FALSE;
}
if(ct <= 0)
return TRUE;
if(move_player == playerid)
flag = (flag & 0xff) | 0xffffff00;
else
flag = ((flag & 0xff) << 16) | 0xff00ffff;
flag |= 0xff80ff80;
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(move_player);
pduel->write_buffer32(target->data.code);
add_process(PROCESSOR_SELECT_PLACE, 0, 0, 0, move_player, flag, 1);
} else { } else {
uint32 flag; uint32 flag;
uint32 lreason = (target->current.location == LOCATION_MZONE) ? LOCATION_REASON_CONTROL : LOCATION_REASON_TOFIELD; uint32 lreason = (target->current.location == LOCATION_MZONE) ? LOCATION_REASON_CONTROL : LOCATION_REASON_TOFIELD;
int32 ct = get_useable_count(playerid, location, move_player, lreason, zone, &flag); int32 ct = get_useable_count(target, playerid, location, move_player, lreason, zone, &flag);
if((ret == 1) && (ct <= 0 || target->is_status(STATUS_FORBIDDEN) || check_unique_onfield(target, playerid, location))) { if((ret == 1) && (ct <= 0 || target->is_status(STATUS_FORBIDDEN) || check_unique_onfield(target, playerid, location))) {
core.units.begin()->step = 3; core.units.begin()->step = 3;
send_to(target, core.reason_effect, REASON_RULE, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, 0); send_to(target, core.reason_effect, REASON_RULE, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, 0);
...@@ -4018,7 +3998,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4018,7 +3998,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
else else
flag = ((flag & 0xff) << 16) | 0xff00ffff; flag = ((flag & 0xff) << 16) | 0xff00ffff;
} }
flag |= 0xe0e0e0e0; flag |= 0xe080e080;
pduel->write_buffer8(MSG_HINT); pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG); pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(move_player); pduel->write_buffer8(move_player);
......
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