Skip to content

Commit

Permalink
Merge branch 'patch-allow-synchro' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
salix5 committed Feb 15, 2025
2 parents 5b241ee + 3f2f594 commit 8b896da
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
43 changes: 23 additions & 20 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,29 +1017,32 @@ uint32_t card::get_link() {
return 0;
return data.level;
}
uint32_t card::get_synchro_level(card* pcard) {
if((data.type & (TYPE_XYZ | TYPE_LINK)) || (status & STATUS_NO_LEVEL))

uint32_t card::get_mat_level_from_effect(card* pcard, uint32_t effect_code) {
if(!effect_code)
return 0;
uint32_t lev;
effect_set eset;
filter_effect(EFFECT_SYNCHRO_LEVEL, &eset);
if(eset.size())
lev = eset[0]->get_value(pcard);
else
lev = get_level();
return lev;
filter_effect(effect_code, &eset);
for(int32_t i = 0; i < eset.size(); ++i) {
uint32_t lev = eset[i]->get_value(pcard);
if(lev)
return lev;
}
return 0;
}
uint32_t card::get_ritual_level(card* pcard) {
uint32_t card::get_mat_level(card* pcard, uint32_t level_effect_code, uint32_t allow_effect_code) {
if((data.type & (TYPE_XYZ | TYPE_LINK)) || (status & STATUS_NO_LEVEL))
return 0;
uint32_t lev;
effect_set eset;
filter_effect(EFFECT_RITUAL_LEVEL, &eset);
if(eset.size())
lev = eset[0]->get_value(pcard);
else
lev = get_level();
return lev;
return get_mat_level_from_effect(pcard, allow_effect_code);
auto lv = get_mat_level_from_effect(pcard, level_effect_code);
if(lv)
return lv;
return get_level();
}
uint32_t card::get_synchro_level(card* pcard) {
return get_mat_level(pcard, EFFECT_SYNCHRO_LEVEL, EFFECT_SYNCHRO_LEVEL_EX);
}
uint32_t card::get_ritual_level(card* pcard) {
return get_mat_level(pcard, EFFECT_RITUAL_LEVEL, EFFECT_RITUAL_LEVEL_EX);
}
uint32_t card::check_xyz_level(card* pcard, uint32_t lv) {
if(status & STATUS_NO_LEVEL)
Expand Down Expand Up @@ -4077,7 +4080,7 @@ int32_t card::is_can_be_fusion_material(card* fcard, uint32_t summon_type) {
return TRUE;
}
int32_t card::is_can_be_synchro_material(card* scard, card* tuner) {
if(data.type & (TYPE_XYZ | TYPE_LINK))
if((data.type & (TYPE_XYZ | TYPE_LINK)) && !get_synchro_level(scard))
return FALSE;
if(!(get_synchro_type() & TYPE_MONSTER))
return FALSE;
Expand Down
2 changes: 2 additions & 0 deletions card.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ class card {
uint32_t get_level();
uint32_t get_rank();
uint32_t get_link();
uint32_t get_mat_level_from_effect(card* pcard, uint32_t effect_code);
uint32_t get_mat_level(card* pcard, uint32_t level_effect_code, uint32_t allow_effect_code = 0);
uint32_t get_synchro_level(card* pcard);
uint32_t get_ritual_level(card* pcard);
uint32_t check_xyz_level(card* pcard, uint32_t lv);
Expand Down
2 changes: 2 additions & 0 deletions effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ const std::map<uint64_t, uint64_t> category_checklist{
#define EFFECT_KAISER_COLOSSEUM 370
#define EFFECT_REPLACE_DAMAGE 371
#define EFFECT_XYZ_MIN_COUNT 372
#define EFFECT_SYNCHRO_LEVEL_EX 373
#define EFFECT_RITUAL_LEVEL_EX 374

//#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
Expand Down
10 changes: 5 additions & 5 deletions field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1842,18 +1842,18 @@ void field::get_ritual_material(uint8_t playerid, effect* peffect, card_set* mat
for(auto& pcard : player[playerid].list_mzone) {
if(pcard && pcard->is_affect_by_effect(peffect)
&& pcard->is_releasable_by_nonsummon(playerid, REASON_EFFECT) && pcard->is_releasable_by_effect(playerid, peffect)
&& (no_level || pcard->get_level() > 0))
&& (no_level || pcard->get_level() > 0 || pcard->is_affected_by_effect(EFFECT_RITUAL_LEVEL_EX)))
material->insert(pcard);
if(pcard && pcard->is_affected_by_effect(EFFECT_OVERLAY_RITUAL_MATERIAL))
for(auto& mcard : pcard->xyz_materials)
if (no_level || mcard->get_level() > 0)
if (no_level || mcard->get_level() > 0 || pcard->is_affected_by_effect(EFFECT_RITUAL_LEVEL_EX))
material->insert(mcard);
}
for(auto& pcard : player[1 - playerid].list_mzone) {
if(pcard && pcard->is_affect_by_effect(peffect)
&& pcard->is_affected_by_effect(EFFECT_EXTRA_RELEASE) && pcard->is_position(POS_FACEUP)
&& pcard->is_releasable_by_nonsummon(playerid, REASON_EFFECT) && pcard->is_releasable_by_effect(playerid, peffect)
&& (no_level || pcard->get_level() > 0))
&& (no_level || pcard->get_level() > 0 || pcard->is_affected_by_effect(EFFECT_RITUAL_LEVEL_EX)))
material->insert(pcard);
}
for(auto& pcard : player[playerid].list_hand)
Expand All @@ -1862,11 +1862,11 @@ void field::get_ritual_material(uint8_t playerid, effect* peffect, card_set* mat
for(auto& pcard : player[playerid].list_grave)
if((pcard->data.type & TYPE_MONSTER)
&& pcard->is_affected_by_effect(EFFECT_EXTRA_RITUAL_MATERIAL) && pcard->is_removeable(playerid, POS_FACEUP, REASON_EFFECT)
&& (no_level || pcard->get_level() > 0))
&& (no_level || pcard->get_level() > 0 || pcard->is_affected_by_effect(EFFECT_RITUAL_LEVEL_EX)))
material->insert(pcard);
for(auto& pcard : player[playerid].list_extra)
if(pcard->is_affected_by_effect(EFFECT_EXTRA_RITUAL_MATERIAL)
&& (no_level || pcard->get_level() > 0))
&& (no_level || pcard->get_level() > 0 || pcard->is_affected_by_effect(EFFECT_RITUAL_LEVEL_EX)))
material->insert(pcard);
}
void field::get_fusion_material(uint8_t playerid, card_set* material_all, card_set* material_base, uint32_t location) {
Expand Down

0 comments on commit 8b896da

Please sign in to comment.