Commit df9d562f authored by nanahira's avatar nanahira

Merge branch 'master' of https://github.com/Fluorohydride/ygopro-core into mc

parents 5d43ab2b ac2ab90c
...@@ -3132,7 +3132,7 @@ int32 field::is_player_can_spsummon(effect* peffect, uint32 sumtype, uint8 sumpo ...@@ -3132,7 +3132,7 @@ int32 field::is_player_can_spsummon(effect* peffect, uint32 sumtype, uint8 sumpo
} }
restore_lp_cost(); restore_lp_cost();
if(sumpos & POS_FACEDOWN && is_player_affected_by_effect(playerid, EFFECT_DEVINE_LIGHT)) if(sumpos & POS_FACEDOWN && is_player_affected_by_effect(playerid, EFFECT_DEVINE_LIGHT))
sumpos = (sumpos & POS_FACEUP) | (sumpos >> 1); sumpos = (sumpos & POS_FACEUP) | ((sumpos & POS_FACEDOWN) >> 1);
effect_set eset; effect_set eset;
filter_player_effect(playerid, EFFECT_CANNOT_SPECIAL_SUMMON, &eset); filter_player_effect(playerid, EFFECT_CANNOT_SPECIAL_SUMMON, &eset);
for(int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
......
...@@ -291,18 +291,22 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -291,18 +291,22 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
duel* ptduel = (duel*)pduel; duel* ptduel = (duel*)pduel;
*buf++ = MSG_RELOAD_FIELD; *buf++ = MSG_RELOAD_FIELD;
*buf++ = ptduel->game_field->core.duel_rule; *buf++ = ptduel->game_field->core.duel_rule;
int32 ct = 2;
for(int playerid = 0; playerid < 2; ++playerid) { for(int playerid = 0; playerid < 2; ++playerid) {
auto& player = ptduel->game_field->player[playerid]; auto& player = ptduel->game_field->player[playerid];
*((int*)(buf)) = player.lp; *((int*)(buf)) = player.lp;
buf += 4; buf += 4;
ct += 4;
for(auto cit = player.list_mzone.begin(); cit != player.list_mzone.end(); ++cit) { for(auto cit = player.list_mzone.begin(); cit != player.list_mzone.end(); ++cit) {
card* pcard = *cit; card* pcard = *cit;
if(pcard) { if(pcard) {
*buf++ = 1; *buf++ = 1;
*buf++ = pcard->current.position; *buf++ = pcard->current.position;
*buf++ = pcard->xyz_materials.size(); *buf++ = pcard->xyz_materials.size();
ct += 3;
} else { } else {
*buf++ = 0; *buf++ = 0;
ct++;
} }
} }
for(auto cit = player.list_szone.begin(); cit != player.list_szone.end(); ++cit) { for(auto cit = player.list_szone.begin(); cit != player.list_szone.end(); ++cit) {
...@@ -310,8 +314,10 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -310,8 +314,10 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
if(pcard) { if(pcard) {
*buf++ = 1; *buf++ = 1;
*buf++ = pcard->current.position; *buf++ = pcard->current.position;
ct += 2;
} else { } else {
*buf++ = 0; *buf++ = 0;
ct++;
} }
} }
*buf++ = player.list_main.size(); *buf++ = player.list_main.size();
...@@ -320,8 +326,10 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -320,8 +326,10 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*buf++ = player.list_remove.size(); *buf++ = player.list_remove.size();
*buf++ = player.list_extra.size(); *buf++ = player.list_extra.size();
*buf++ = player.extra_p_count; *buf++ = player.extra_p_count;
ct += 6;
} }
*buf++ = ptduel->game_field->core.current_chain.size(); *buf++ = ptduel->game_field->core.current_chain.size();
ct++;
for(auto chit = ptduel->game_field->core.current_chain.begin(); chit != ptduel->game_field->core.current_chain.end(); ++chit) { for(auto chit = ptduel->game_field->core.current_chain.begin(); chit != ptduel->game_field->core.current_chain.end(); ++chit) {
effect* peffect = chit->triggering_effect; effect* peffect = chit->triggering_effect;
*((int*)(buf)) = peffect->get_handler()->data.code; *((int*)(buf)) = peffect->get_handler()->data.code;
...@@ -333,8 +341,9 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -333,8 +341,9 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*buf++ = chit->triggering_sequence; *buf++ = chit->triggering_sequence;
*((int*)(buf)) = peffect->description; *((int*)(buf)) = peffect->description;
buf += 4; buf += 4;
ct += 15;
} }
return 0; return ct;
} }
extern "C" DECL_DLLEXPORT void set_responsei(ptr pduel, int32 value) { extern "C" DECL_DLLEXPORT void set_responsei(ptr pduel, int32 value) {
((duel*)pduel)->set_responsei(value); ((duel*)pduel)->set_responsei(value);
......
...@@ -156,7 +156,7 @@ void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_ty ...@@ -156,7 +156,7 @@ void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_ty
} }
void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone) { 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 & POS_FACEDOWN) >> 1);
for(auto cit = target->begin(); cit != target->end(); ++cit) { for(auto cit = target->begin(); cit != target->end(); ++cit) {
card* pcard = *cit; card* pcard = *cit;
pcard->temp.reason = pcard->current.reason; pcard->temp.reason = pcard->current.reason;
...@@ -175,7 +175,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u ...@@ -175,7 +175,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u
} }
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))
positions = (positions & POS_FACEUP) | (positions >> 1); positions = (positions & POS_FACEUP) | ((positions & POS_FACEDOWN) >> 1);
target->temp.reason = target->current.reason; target->temp.reason = target->current.reason;
target->temp.reason_effect = target->current.reason_effect; target->temp.reason_effect = target->current.reason_effect;
target->temp.reason_player = target->current.reason_player; target->temp.reason_player = target->current.reason_player;
...@@ -1838,9 +1838,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1838,9 +1838,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
return FALSE; return FALSE;
} }
case 11: { case 11: {
uint8 targetplayer = target->current.controler; set_control(target, target->current.controler, 0, 0);
if(target->owner != targetplayer)
set_control(target, targetplayer, 0, 0);
core.phase_action = TRUE; core.phase_action = TRUE;
target->current.reason = REASON_SUMMON; target->current.reason = REASON_SUMMON;
target->summon_player = sumplayer; target->summon_player = sumplayer;
...@@ -2282,9 +2280,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint ...@@ -2282,9 +2280,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
return FALSE; return FALSE;
} }
case 9: { case 9: {
uint8 targetplayer = target->current.controler; set_control(target, target->current.controler, 0, 0);
if(target->owner != targetplayer)
set_control(target, targetplayer, 0, 0);
core.phase_action = TRUE; core.phase_action = TRUE;
core.normalsummon_state_count[setplayer]++; core.normalsummon_state_count[setplayer]++;
check_card_counter(target, 2, setplayer); check_card_counter(target, 2, setplayer);
...@@ -2564,9 +2560,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin ...@@ -2564,9 +2560,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
return FALSE; return FALSE;
} }
case 5: { case 5: {
uint8 targetplayer = target->current.controler; set_control(target, target->current.controler, 0, 0);
if(target->owner != targetplayer)
set_control(target, targetplayer, 0, 0);
core.phase_action = TRUE; core.phase_action = TRUE;
target->current.reason_effect = core.units.begin()->peffect; target->current.reason_effect = core.units.begin()->peffect;
core.summoning_card = target; core.summoning_card = target;
...@@ -2759,8 +2753,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin ...@@ -2759,8 +2753,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
pduel->write_buffer8(pcard->current.location); pduel->write_buffer8(pcard->current.location);
pduel->write_buffer8(pcard->current.sequence); pduel->write_buffer8(pcard->current.sequence);
pduel->write_buffer8(pcard->current.position); pduel->write_buffer8(pcard->current.position);
if(pcard->owner != pcard->current.controler) set_control(pcard, pcard->current.controler, 0, 0);
set_control(pcard, pcard->current.controler, 0, 0);
if(pgroup->it != pgroup->container.end()) if(pgroup->it != pgroup->container.end())
core.units.begin()->step = 22; core.units.begin()->step = 22;
return FALSE; return FALSE;
...@@ -2928,8 +2921,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint ...@@ -2928,8 +2921,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint
} }
case 3: { case 3: {
returns.ivalue[0] = TRUE; returns.ivalue[0] = TRUE;
if(target->owner != target->current.controler) set_control(target, target->current.controler, 0, 0);
set_control(target, target->current.controler, 0, 0);
target->set_status(STATUS_SPSUMMON_STEP, TRUE); target->set_status(STATUS_SPSUMMON_STEP, TRUE);
return TRUE; return TRUE;
} }
...@@ -3656,6 +3648,12 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3656,6 +3648,12 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->sendto_param.location = redirect; pcard->sendto_param.location = redirect;
pcard->sendto_param.sequence = redirect_seq; pcard->sendto_param.sequence = redirect_seq;
dest = redirect; dest = redirect;
if(dest == LOCATION_REMOVED) {
if(pcard->sendto_param.position & POS_FACEDOWN_ATTACK)
pcard->sendto_param.position = (pcard->sendto_param.position & ~POS_FACEDOWN_ATTACK) | POS_FACEUP_ATTACK;
if(pcard->sendto_param.position & POS_FACEDOWN_DEFENSE)
pcard->sendto_param.position = (pcard->sendto_param.position & ~POS_FACEDOWN_DEFENSE) | POS_FACEUP_DEFENSE;
}
} }
redirect = pcard->destination_redirect(dest, pcard->current.reason); redirect = pcard->destination_redirect(dest, pcard->current.reason);
if(redirect) { if(redirect) {
......
...@@ -4989,7 +4989,7 @@ int32 field::refresh_location_info(uint16 step) { ...@@ -4989,7 +4989,7 @@ int32 field::refresh_location_info(uint16 step) {
filter_field_effect(EFFECT_DISABLE_FIELD, &eset); filter_field_effect(EFFECT_DISABLE_FIELD, &eset);
for (int32 i = 0; i < eset.size(); ++i) { for (int32 i = 0; i < eset.size(); ++i) {
value = eset[i]->get_value(); value = eset[i]->get_value();
if(value) { if(value && !eset[i]->is_flag(EFFECT_FLAG_REPEAT)) {
player[0].disabled_location |= value & 0x1f7f; player[0].disabled_location |= value & 0x1f7f;
player[1].disabled_location |= (value >> 16) & 0x1f7f; player[1].disabled_location |= (value >> 16) & 0x1f7f;
} else } else
......
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