Commit 01016149 authored by salix5's avatar salix5

push pcard in check_tuner_material

parent 21fa706f
......@@ -2625,9 +2625,14 @@ int32 field::check_tuner_material(lua_State* L, card* pcard, card* tuner, int32
if(smat) {
if(pcheck)
pcheck->get_value(smat);
if((smat->current.location == LOCATION_MZONE && !smat->is_position(POS_FACEUP))
|| !smat->is_can_be_synchro_material(pcard, tuner)
|| !pduel->lua->check_filter(L, smat, findex2, 1)) {
if((smat->current.location == LOCATION_MZONE && !smat->is_position(POS_FACEUP)) || !smat->is_can_be_synchro_material(pcard, tuner)) {
pduel->restore_assumes();
return FALSE;
}
interpreter::card2value(L, pcard);
auto res = pduel->lua->check_filter(L, smat, findex2, 1);
lua_pop(L, 1);
if (!res) {
pduel->restore_assumes();
return FALSE;
}
......@@ -2678,9 +2683,14 @@ int32 field::check_tuner_material(lua_State* L, card* pcard, card* tuner, int32
continue;
if(pcheck)
pcheck->get_value(mcard);
if((mcard->current.location == LOCATION_MZONE && !mcard->is_position(POS_FACEUP))
|| !mcard->is_can_be_synchro_material(pcard, tuner)
|| !pduel->lua->check_filter(L, mcard, findex2, 1)) {
if((mcard->current.location == LOCATION_MZONE && !mcard->is_position(POS_FACEUP)) || !mcard->is_can_be_synchro_material(pcard, tuner)) {
pduel->restore_assumes();
return FALSE;
}
interpreter::card2value(L, pcard);
auto res = pduel->lua->check_filter(L, mcard, findex2, 1);
lua_pop(L, 1);
if (!res) {
pduel->restore_assumes();
return FALSE;
}
......@@ -2723,7 +2733,10 @@ int32 field::check_tuner_material(lua_State* L, card* pcard, card* tuner, int32
pcheck->get_value(pm);
if(pm->current.location == LOCATION_MZONE && !pm->is_position(POS_FACEUP))
continue;
if(!pduel->lua->check_filter(L, pm, findex2, 1))
interpreter::card2value(L, pcard);
auto res = pduel->lua->check_filter(L, pm, findex2, 1);
lua_pop(L, 1);
if (!res)
continue;
nsyn.push_back(pm);
pm->sum_param = pm->get_synchro_level(pcard);
......@@ -2744,7 +2757,10 @@ int32 field::check_tuner_material(lua_State* L, card* pcard, card* tuner, int32
pcheck->get_value(pm);
if(pm->current.location == LOCATION_MZONE && !pm->is_position(POS_FACEUP))
continue;
if(!pduel->lua->check_filter(L, pm, findex2, 1))
interpreter::card2value(L, pcard);
auto res = pduel->lua->check_filter(L, pm, findex2, 1);
lua_pop(L, 1);
if (!res)
continue;
nsyn.push_back(pm);
pm->sum_param = pm->get_synchro_level(pcard);
......
......@@ -3251,7 +3251,6 @@ int32 scriptlib::duel_check_synchro_material(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 7);
mg = *(group**) lua_touserdata(L, 7);
}
lua_pushvalue(L, 1);
lua_pushboolean(L, pduel->game_field->check_synchro_material(L, pcard, 2, 3, min, max, smat, mg));
return 1;
}
......@@ -3276,10 +3275,8 @@ int32 scriptlib::duel_select_tuner_material(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 8);
mg = *(group**) lua_touserdata(L, 8);
}
lua_pushvalue(L, 2);
if(!pduel->game_field->check_tuner_material(L, pcard, tuner, 4, 5, min, max, 0, mg))
return 0;
lua_pop(L, 1);
pduel->game_field->core.select_cards.clear();
pduel->game_field->core.select_cards.push_back(tuner);
pduel->game_field->returns.bvalue[1] = 0;
......@@ -3308,7 +3305,6 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 7);
mg = *(group**) lua_touserdata(L, 7);
}
lua_pushvalue(L, 1);
lua_pushboolean(L, pduel->game_field->check_tuner_material(L, pcard, tuner, 3, 4, min, max, 0, mg));
return 1;
}
......
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