Commit e57b048a authored by VanillaSalt's avatar VanillaSalt

update

parent 8298cf63
...@@ -553,10 +553,10 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer ...@@ -553,10 +553,10 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer
int32 used_count = field_used_count[flag]; int32 used_count = field_used_count[flag];
int32 maxcount = 6; int32 maxcount = 6;
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)
&& (zone & (1u << 6)) && check_extra_link(playerid, pcard, 6)) { && (zone & (1u << 6)) && pcard && check_extra_link(playerid, pcard, 6)) {
flag |= 1u << 5; flag |= 1u << 5;
} else if(player[playerid].list_mzone[6] && is_location_useable(playerid, LOCATION_MZONE, 5) } else if(player[playerid].list_mzone[6] && is_location_useable(playerid, LOCATION_MZONE, 5)
&& (zone & (1u << 5)) && check_extra_link(playerid, pcard, 5)) { && (zone & (1u << 5)) && pcard && check_extra_link(playerid, pcard, 5)) {
flag |= 1u << 6; flag |= 1u << 6;
} else if(player[playerid].list_mzone[5] || player[playerid].list_mzone[6] || !(zone & ((1u << 5) | (1u << 6)))) { } else if(player[playerid].list_mzone[5] || player[playerid].list_mzone[6] || !(zone & ((1u << 5) | (1u << 6)))) {
flag |= (1u << 5) | (1u << 6); flag |= (1u << 5) | (1u << 6);
......
...@@ -492,7 +492,7 @@ public: ...@@ -492,7 +492,7 @@ public:
void recover(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 amount, uint32 is_step = FALSE); void recover(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 amount, uint32 is_step = FALSE);
void summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute); void summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute);
void special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type); void special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type);
void special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions); void special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone);
void special_summon_step(card* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone); void special_summon_step(card* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone);
void special_summon_complete(effect* reason_effect, uint8 reason_player); void special_summon_complete(effect* reason_effect, uint8 reason_player);
void destroy(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid = 2, uint32 destination = 0, uint32 sequence = 0); void destroy(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid = 2, uint32 destination = 0, uint32 sequence = 0);
...@@ -522,7 +522,7 @@ public: ...@@ -522,7 +522,7 @@ public:
int32 sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget); int32 sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget);
int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type); int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type);
int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone); int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone);
int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets); int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone);
int32 destroy(uint16 step, group* targets, card* target, uint8 battle); int32 destroy(uint16 step, group* targets, card* target, uint8 battle);
int32 destroy(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player); int32 destroy(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player);
int32 release(uint16 step, group* targets, card* target); int32 release(uint16 step, group* targets, card* target);
......
...@@ -386,12 +386,15 @@ int32 scriptlib::duel_special_summon(lua_State *L) { ...@@ -386,12 +386,15 @@ int32 scriptlib::duel_special_summon(lua_State *L) {
uint32 nocheck = lua_toboolean(L, 5); uint32 nocheck = lua_toboolean(L, 5);
uint32 nolimit = lua_toboolean(L, 6); uint32 nolimit = lua_toboolean(L, 6);
uint32 positions = lua_tointeger(L, 7); uint32 positions = lua_tointeger(L, 7);
uint32 zone = 0xff;
if(lua_gettop(L) >= 8)
zone = lua_tointeger(L, 8);
if(pcard) { if(pcard) {
field::card_set cset; field::card_set cset;
cset.insert(pcard); cset.insert(pcard);
pduel->game_field->special_summon(&cset, sumtype, sumplayer, playerid, nocheck, nolimit, positions); pduel->game_field->special_summon(&cset, sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
} else } else
pduel->game_field->special_summon(&(pgroup->container), sumtype, sumplayer, playerid, nocheck, nolimit, positions); pduel->game_field->special_summon(&(pgroup->container), sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
pduel->game_field->core.subunits.back().type = PROCESSOR_SPSUMMON_S; pduel->game_field->core.subunits.back().type = PROCESSOR_SPSUMMON_S;
return lua_yield(L, 0); return lua_yield(L, 0);
} }
...@@ -1490,8 +1493,20 @@ int32 scriptlib::duel_get_location_count(lua_State *L) { ...@@ -1490,8 +1493,20 @@ int32 scriptlib::duel_get_location_count(lua_State *L) {
uplayer = lua_tointeger(L, 3); uplayer = lua_tointeger(L, 3);
if(lua_gettop(L) > 3) if(lua_gettop(L) > 3)
reason = lua_tointeger(L, 4); reason = lua_tointeger(L, 4);
lua_pushinteger(L, pduel->game_field->get_useable_count(playerid, location, uplayer, reason)); uint32 zone = 0xff;
return 1; if(location == LOCATION_MZONE) {
uint32 flag1, flag2;
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);
int32 ct3 = field::field_used_count[~(flag1 | flag2) & 0x1f];
lua_pushinteger(L, ct1);
lua_pushinteger(L, ct2);
lua_pushinteger(L, ct1 + ct2 - ct3);
return 3;
} else {
lua_pushinteger(L, pduel->game_field->get_useable_count(playerid, location, uplayer, reason));
return 1;
}
} }
int32 scriptlib::duel_get_field_card(lua_State *L) { int32 scriptlib::duel_get_field_card(lua_State *L) {
check_param_count(L, 3); check_param_count(L, 3);
......
...@@ -151,7 +151,7 @@ void field::summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_c ...@@ -151,7 +151,7 @@ void field::summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_c
void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type) { void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type) {
add_process(PROCESSOR_SPSUMMON_RULE, 0, 0, (group*)target, sumplayer, summon_type); add_process(PROCESSOR_SPSUMMON_RULE, 0, 0, (group*)target, sumplayer, summon_type);
} }
void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions) { void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone) {
if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT)) if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT))
positions = (positions & POS_FACEUP) | (positions >> 1); positions = (positions & POS_FACEUP) | (positions >> 1);
for(auto cit = target->begin(); cit != target->end(); ++cit) { for(auto cit = target->begin(); cit != target->end(); ++cit) {
...@@ -168,7 +168,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u ...@@ -168,7 +168,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u
} }
group* pgroup = pduel->new_group(*target); group* pgroup = pduel->new_group(*target);
pgroup->is_readonly = TRUE; pgroup->is_readonly = TRUE;
add_process(PROCESSOR_SPSUMMON, 0, core.reason_effect, pgroup, core.reason_player, 0); add_process(PROCESSOR_SPSUMMON, 0, core.reason_effect, pgroup, core.reason_player, zone);
} }
void field::special_summon_step(card* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone) { void field::special_summon_step(card* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone) {
if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT)) if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT))
...@@ -2728,7 +2728,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint ...@@ -2728,7 +2728,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint
} }
return TRUE; return TRUE;
} }
int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_player, group * targets) { int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone) {
switch(step) { switch(step) {
case 0: { case 0: {
card_vector cvs, cvo; card_vector cvs, cvo;
...@@ -2739,7 +2739,6 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl ...@@ -2739,7 +2739,6 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl
else else
cvo.push_back(pcard); cvo.push_back(pcard);
} }
uint32 zone = 0xff;
if(!cvs.empty()) { if(!cvs.empty()) {
if(cvs.size() > 1) if(cvs.size() > 1)
std::sort(cvs.begin(), cvs.end(), card::card_operation_sort); std::sort(cvs.begin(), cvs.end(), card::card_operation_sort);
......
...@@ -366,7 +366,7 @@ int32 field::process() { ...@@ -366,7 +366,7 @@ int32 field::process() {
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_SPSUMMON: { case PROCESSOR_SPSUMMON: {
if (special_summon(it->step, it->peffect, it->arg1, it->ptarget)) if (special_summon(it->step, it->peffect, it->arg1, it->ptarget, it->arg2))
core.units.pop_front(); core.units.pop_front();
else else
it->step++; it->step++;
......
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