Commit cbee56ee authored by nanahira's avatar nanahira

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

parents 1e4ced1d d644fb5b
...@@ -581,8 +581,14 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va ...@@ -581,8 +581,14 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
int32 result = lua_resume(rthread, 0, param_count); int32 result = lua_resume(rthread, 0, param_count);
if (result == 0) { if (result == 0) {
coroutines.erase(f); coroutines.erase(f);
if(yield_value) if(yield_value) {
*yield_value = lua_isboolean(rthread, -1) ? lua_toboolean(rthread, -1) : (uint32)lua_tointeger(rthread, -1); if(lua_gettop(rthread) == 0)
*yield_value = 0;
else if(lua_isboolean(rthread, -1))
*yield_value = lua_toboolean(rthread, -1);
else
*yield_value = (uint32)lua_tointeger(rthread, -1);
}
current_state = lua_state; current_state = lua_state;
call_depth--; call_depth--;
if(call_depth == 0) { if(call_depth == 0) {
......
...@@ -1170,13 +1170,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) { ...@@ -1170,13 +1170,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
int32 ret = 0, fc = 0; int32 ret = 0, fc = 0;
if(loc & (LOCATION_FZONE + LOCATION_SZONE)) { if(loc & (LOCATION_FZONE + LOCATION_SZONE)) {
card* pcard = pduel->game_field->player[0].list_szone[5]; card* pcard = pduel->game_field->player[0].list_szone[5];
if(pcard && pcard->is_position(POS_FACEUP) && pcard->get_status(STATUS_EFFECT_ENABLED)) { if(pcard && pcard->is_position(POS_FACEUP)) {
fc = 1; fc = 1;
if(code == pcard->get_code() && (playerid == 0 || playerid == PLAYER_ALL)) if(code == pcard->get_code() && (playerid == 0 || playerid == PLAYER_ALL))
ret = 1; ret = 1;
} }
pcard = pduel->game_field->player[1].list_szone[5]; pcard = pduel->game_field->player[1].list_szone[5];
if(pcard && pcard->is_position(POS_FACEUP) && pcard->get_status(STATUS_EFFECT_ENABLED)) { if(pcard && pcard->is_position(POS_FACEUP)) {
fc = 1; fc = 1;
if(code == pcard->get_code() && (playerid == 1 || playerid == PLAYER_ALL)) if(code == pcard->get_code() && (playerid == 1 || playerid == PLAYER_ALL))
ret = 1; ret = 1;
...@@ -1185,13 +1185,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) { ...@@ -1185,13 +1185,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
if(!ret && (loc & LOCATION_SZONE)) { if(!ret && (loc & LOCATION_SZONE)) {
if(playerid == 0 || playerid == PLAYER_ALL) { if(playerid == 0 || playerid == PLAYER_ALL) {
for(auto& pcard : pduel->game_field->player[0].list_szone) { for(auto& pcard : pduel->game_field->player[0].list_szone) {
if(pcard && pcard->is_position(POS_FACEUP) && pcard->get_status(STATUS_EFFECT_ENABLED) && code == pcard->get_code()) if(pcard && pcard->is_position(POS_FACEUP) && code == pcard->get_code())
ret = 1; ret = 1;
} }
} }
if(playerid == 1 || playerid == PLAYER_ALL) { if(playerid == 1 || playerid == PLAYER_ALL) {
for(auto& pcard : pduel->game_field->player[1].list_szone) { for(auto& pcard : pduel->game_field->player[1].list_szone) {
if(pcard && pcard->is_position(POS_FACEUP) && pcard->get_status(STATUS_EFFECT_ENABLED) && code == pcard->get_code()) if(pcard && pcard->is_position(POS_FACEUP) && code == pcard->get_code())
ret = 1; ret = 1;
} }
} }
...@@ -1199,13 +1199,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) { ...@@ -1199,13 +1199,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
if(!ret && (loc & LOCATION_MZONE)) { if(!ret && (loc & LOCATION_MZONE)) {
if(playerid == 0 || playerid == PLAYER_ALL) { if(playerid == 0 || playerid == PLAYER_ALL) {
for(auto& pcard : pduel->game_field->player[0].list_mzone) { for(auto& pcard : pduel->game_field->player[0].list_mzone) {
if(pcard && pcard->is_position(POS_FACEUP) && pcard->get_status(STATUS_EFFECT_ENABLED) && code == pcard->get_code()) if(pcard && pcard->is_position(POS_FACEUP) && code == pcard->get_code())
ret = 1; ret = 1;
} }
} }
if(playerid == 1 || playerid == PLAYER_ALL) { if(playerid == 1 || playerid == PLAYER_ALL) {
for(auto& pcard : pduel->game_field->player[1].list_mzone) { for(auto& pcard : pduel->game_field->player[1].list_mzone) {
if(pcard && pcard->is_position(POS_FACEUP) && pcard->get_status(STATUS_EFFECT_ENABLED) && code == pcard->get_code()) if(pcard && pcard->is_position(POS_FACEUP) && code == pcard->get_code())
ret = 1; ret = 1;
} }
} }
......
...@@ -377,6 +377,8 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -377,6 +377,8 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
} }
core.hint_timing[playerid] |= TIMING_DRAW + TIMING_TOHAND; core.hint_timing[playerid] |= TIMING_DRAW + TIMING_TOHAND;
adjust_instant(); adjust_instant();
if(core.overdraw[playerid] && (reason & REASON_RULE))
adjust_all();
core.units.begin()->arg2 = (core.units.begin()->arg2 & 0xff000000) + drawed; core.units.begin()->arg2 = (core.units.begin()->arg2 & 0xff000000) + drawed;
card_set* drawed_set = new card_set; card_set* drawed_set = new card_set;
core.units.begin()->ptarget = (group*)drawed_set; core.units.begin()->ptarget = (group*)drawed_set;
......
...@@ -5019,10 +5019,8 @@ int32 field::adjust_step(uint16 step) { ...@@ -5019,10 +5019,8 @@ int32 field::adjust_step(uint16 step) {
return FALSE; return FALSE;
} }
case 15: { case 15: {
if(!check_event(EVENT_ADJUST)) { raise_event((card*)0, EVENT_ADJUST, 0, 0, PLAYER_NONE, PLAYER_NONE, 0);
raise_event((card*)0, EVENT_ADJUST, 0, 0, PLAYER_NONE, PLAYER_NONE, 0); process_instant_event();
process_instant_event();
}
return FALSE; return FALSE;
} }
case 16: { case 16: {
......
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