Commit b487cb05 authored by Momobako's avatar Momobako

forcemzone

parent 0650faa5
...@@ -381,6 +381,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -381,6 +381,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_USE_EXTRA_SZONE 262 #define EFFECT_USE_EXTRA_SZONE 262
#define EFFECT_MAX_MZONE 263 #define EFFECT_MAX_MZONE 263
#define EFFECT_MAX_SZONE 264 #define EFFECT_MAX_SZONE 264
#define EFFECT_FORCE_MZONE 265
#define EFFECT_HAND_LIMIT 270 #define EFFECT_HAND_LIMIT 270
#define EFFECT_DRAW_COUNT 271 #define EFFECT_DRAW_COUNT 271
#define EFFECT_SPIRIT_DONOT_RETURN 280 #define EFFECT_SPIRIT_DONOT_RETURN 280
......
...@@ -574,7 +574,7 @@ int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, ui ...@@ -574,7 +574,7 @@ int32 field::get_spsummonable_count(card* pcard, uint8 playerid, uint32 zone, ui
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, uint8 neglect_used) { 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, neglect_used); int32 count = get_tofield_count(playerid, location, zone, list, neglect_used, reason);
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);
...@@ -584,10 +584,20 @@ int32 field::get_useable_count(uint8 playerid, uint8 location, uint8 uplayer, ui ...@@ -584,10 +584,20 @@ 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, uint8 neglect_used) { int32 field::get_tofield_count(uint8 playerid, uint8 location, uint32 zone, uint32* list, uint8 neglect_used, uint32 reason) {
if (location != LOCATION_MZONE && location != LOCATION_SZONE) if (location != LOCATION_MZONE && location != LOCATION_SZONE)
return 0; return 0;
uint32 flag = player[playerid].disabled_location | (neglect_used ? 0 : player[playerid].used_location); uint32 flag = player[playerid].disabled_location | (neglect_used ? 0 : player[playerid].used_location);
effect_set eset;
uint32 value;
if((reason & (LOCATION_REASON_TOFIELD | LOCATION_REASON_CONTROL) != 0) && location == LOCATION_MZONE)
filter_player_effect(playerid, EFFECT_FORCE_MZONE, &eset);
for (int32 i = 0; i < eset.size(); ++i) {
value = eset[i]->get_value();
if((flag & value)==0)
flag |= ~(value >> 16 * playerid) & 0xff7f;
}
eset.clear();
if (location == LOCATION_MZONE) if (location == LOCATION_MZONE)
flag = (flag | ~zone) & 0x1f; flag = (flag | ~zone) & 0x1f;
else else
...@@ -608,6 +618,15 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer ...@@ -608,6 +618,15 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer
} }
int32 field::get_spsummonable_count_fromex(card* pcard, uint8 playerid, uint32 zone, uint32* list) { int32 field::get_spsummonable_count_fromex(card* pcard, uint8 playerid, uint32 zone, uint32* list) {
uint32 flag = player[playerid].disabled_location | player[playerid].used_location; uint32 flag = player[playerid].disabled_location | player[playerid].used_location;
effect_set eset;
uint32 value;
filter_player_effect(playerid, EFFECT_FORCE_MZONE, &eset);
for (int32 i = 0; i < eset.size(); ++i) {
value = eset[i]->get_value();
if((flag & value)==0)
flag |= ~(value >> 16 * playerid) & 0xff7f;
}
eset.clear();
uint32 linked_zone = get_linked_zone(playerid) | (1u << 5) | (1u << 6); uint32 linked_zone = get_linked_zone(playerid) | (1u << 5) | (1u << 6);
flag = flag | ~zone | ~linked_zone; flag = flag | ~zone | ~linked_zone;
if(player[playerid].list_mzone[5] && is_location_useable(playerid, LOCATION_MZONE, 6) if(player[playerid].list_mzone[5] && is_location_useable(playerid, LOCATION_MZONE, 6)
......
...@@ -356,7 +356,7 @@ public: ...@@ -356,7 +356,7 @@ public:
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_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, uint8 neglect_used = 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, uint8 neglect_used = 0); int32 get_tofield_count(uint8 playerid, uint8 location, uint32 zone = 0xff, uint32* list = 0, uint8 neglect_used = 0, uint32 reason = 0x1);
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);
...@@ -589,6 +589,7 @@ public: ...@@ -589,6 +589,7 @@ public:
//Location Use Reason //Location Use Reason
#define LOCATION_REASON_TOFIELD 0x1 #define LOCATION_REASON_TOFIELD 0x1
#define LOCATION_REASON_CONTROL 0x2 #define LOCATION_REASON_CONTROL 0x2
#define LOCATION_REASON_COUNT 0x4
//Chain Info //Chain Info
#define CHAIN_DISABLE_ACTIVATE 0x01 #define CHAIN_DISABLE_ACTIVATE 0x01
#define CHAIN_DISABLE_EFFECT 0x02 #define CHAIN_DISABLE_EFFECT 0x02
......
...@@ -1550,7 +1550,7 @@ int32 scriptlib::duel_get_location_count(lua_State *L) { ...@@ -1550,7 +1550,7 @@ int32 scriptlib::duel_get_location_count(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
uint32 uplayer = pduel->game_field->core.reason_player; uint32 uplayer = pduel->game_field->core.reason_player;
uint32 reason = LOCATION_REASON_TOFIELD; uint32 reason = LOCATION_REASON_TOFIELD;
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3 && !lua_isnil(L,3))
uplayer = lua_tointeger(L, 3); uplayer = lua_tointeger(L, 3);
if(lua_gettop(L) >= 4) if(lua_gettop(L) >= 4)
reason = lua_tointeger(L, 4); reason = lua_tointeger(L, 4);
......
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