mirror of
https://github.com/edo9300/ygopro-core
synced 2026-08-25 16:23:07 -04:00
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:
parent
102c3c27d9
commit
2155e01836
3 changed files with 12 additions and 4 deletions
11
field.cpp
11
field.cpp
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
2
field.h
2
field.h
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue