Skip to content

Commit

Permalink
update Duel.GetSynchroMaterial (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
mercury233 authored Apr 18, 2024
1 parent 2c4f474 commit eaf25b8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3172,9 +3172,19 @@ int32 scriptlib::duel_get_synchro_material(lua_State *L) {
int32 playerid = (int32)lua_tointeger(L, 1);
if(playerid != 0 && playerid != 1)
return 0;
uint32 facedown = FALSE;
if (lua_gettop(L) >= 2)
facedown = lua_toboolean(L, 2);
duel* pduel = interpreter::get_duel_info(L);
group::card_set mats;
pduel->game_field->get_synchro_material(playerid, &mats);
group* pgroup = pduel->new_group();
pduel->game_field->get_synchro_material(playerid, &pgroup->container);
for (auto cit = mats.begin(); cit != mats.end(); ++cit) {
card* pcard = *cit;
if (pcard->current.location == LOCATION_MZONE && !pcard->is_position(POS_FACEUP) && !facedown)
continue;
pgroup->container.insert(*cit);
}
interpreter::group2value(L, pgroup);
return 1;
}
Expand Down

0 comments on commit eaf25b8

Please sign in to comment.