Fix again Duel.ReleaseRitualMaterial

partially revert d87e39c523 which was not entirely right, and add 2nd parameter to Duel.ReleaseRitualMaterial to specify wether to release cards in the deck or send them to the grave (default to send to grave)
This commit is contained in:
Edoardo Lolletti 2026-06-07 13:17:07 +02:00
parent 102c3c27d9
commit 2155e01836
3 changed files with 12 additions and 4 deletions

View file

@ -2032,14 +2032,21 @@ void field::get_fusion_material(uint8_t playerid, card_set* material) {
if(pcard->is_affected_by_effect(EFFECT_EXTRA_FUSION_MATERIAL))
material->insert(pcard);
}
void field::ritual_release(const card_set& material) {
card_set rel, rem;
void field::ritual_release(const card_set& material, bool release_deck) {
card_set rel, rem, tograve;
uint32_t to_grave_types = LOCATION_OVERLAY | LOCATION_EXTRA;
if(!release_deck) {
to_grave_types |= LOCATION_DECK;
}
for(auto& pcard : material) {
if(pcard->current.location == LOCATION_GRAVE)
rem.insert(pcard);
else if((pcard->current.location & to_grave_types) != 0)
tograve.insert(pcard);
else
rel.insert(pcard);
}
send_to(std::move(tograve), core.reason_effect, REASON_RITUAL + REASON_EFFECT + REASON_MATERIAL, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, POS_FACEUP);
release(std::move(rel), core.reason_effect, REASON_RITUAL + REASON_EFFECT + REASON_MATERIAL, core.reason_player);
send_to(std::move(rem), core.reason_effect, REASON_RITUAL + REASON_EFFECT + REASON_MATERIAL, core.reason_player, PLAYER_NONE, LOCATION_REMOVED, 0, POS_FACEUP);
}

View file

@ -486,7 +486,7 @@ public:
int32_t get_draw_count(uint8_t playerid);
void get_ritual_material(uint8_t playerid, effect* peffect, card_set* material, bool check_level);
void get_fusion_material(uint8_t playerid, card_set* material);
void ritual_release(const card_set& material);
void ritual_release(const card_set& material, bool release_deck);
void get_overlay_group(uint8_t playerid, uint8_t self, uint8_t oppo, card_set* pset, group* pgroup);
int32_t get_overlay_count(uint8_t playerid, uint8_t self, uint8_t oppo, group* pgroup);
void update_disable_check_list(effect* peffect);

View file

@ -2746,7 +2746,8 @@ LUA_STATIC_FUNCTION(ReleaseRitualMaterial) {
check_action_permission(L);
check_param_count(L, 1);
auto pgroup = lua_get<group*, true>(L, 1);
pduel->game_field->ritual_release(pgroup->container);
auto release_deck = lua_get<bool, false>(L, 2);
pduel->game_field->ritual_release(pgroup->container, release_deck);
return yield();
}
LUA_STATIC_FUNCTION(GetFusionMaterial) {