Commit 23de80a2 authored by wind2009's avatar wind2009

Merge remote-tracking branch 'origin/master' into 888

parents 479f4593 4e93b278
Pipeline #43064 passed with stages
in 50 seconds
......@@ -284,6 +284,8 @@ enum effect_category : uint64_t {
CATEGORY_ANNOUNCE = 0x20000000,
CATEGORY_FUSION_SUMMON = 0x40000000,
CATEGORY_TOEXTRA = 0x80000000,
CATEGORY_MSET = 0x100000000,
CATEGORY_SSET = 0x200000000,
};
const std::map<uint64_t, uint64_t> category_checklist{
......
......@@ -504,13 +504,44 @@ int32_t field::get_pzone_sequence(uint8_t pseq) const {
return 7;
}
}
const card_vector* field::get_field_vector(uint8_t playerid, uint8_t location) const {
if (!check_playerid(playerid))
return nullptr;
switch (location) {
case LOCATION_MZONE:
return &player[playerid].list_mzone;
case LOCATION_SZONE:
return &player[playerid].list_szone;
case LOCATION_DECK:
return &player[playerid].list_main;
case LOCATION_HAND:
return &player[playerid].list_hand;
case LOCATION_GRAVE:
return &player[playerid].list_grave;
case LOCATION_REMOVED:
return &player[playerid].list_remove;
case LOCATION_EXTRA:
return &player[playerid].list_extra;
default:
return nullptr;
}
}
card* field::get_field_card(uint8_t playerid, uint32_t general_location, uint8_t sequence) const {
if (!check_playerid(playerid))
return nullptr;
switch(general_location) {
case LOCATION_MZONE: {
if(sequence < (int32_t)player[playerid].list_mzone.size())
return player[playerid].list_mzone[sequence];
case LOCATION_MZONE:
case LOCATION_DECK:
case LOCATION_HAND:
case LOCATION_GRAVE:
case LOCATION_REMOVED:
case LOCATION_EXTRA: {
auto ptr = get_field_vector(playerid, general_location);
if (!ptr)
return nullptr;
auto& container = *ptr;
if (sequence < container.size())
return container[sequence];
else
return nullptr;
break;
......@@ -537,41 +568,6 @@ card* field::get_field_card(uint8_t playerid, uint32_t general_location, uint8_t
return nullptr;
break;
}
case LOCATION_DECK: {
if(sequence < player[playerid].list_main.size())
return player[playerid].list_main[sequence];
else
return nullptr;
break;
}
case LOCATION_HAND: {
if(sequence < player[playerid].list_hand.size())
return player[playerid].list_hand[sequence];
else
return nullptr;
break;
}
case LOCATION_GRAVE: {
if(sequence < player[playerid].list_grave.size())
return player[playerid].list_grave[sequence];
else
return nullptr;
break;
}
case LOCATION_REMOVED: {
if(sequence < player[playerid].list_remove.size())
return player[playerid].list_remove[sequence];
else
return nullptr;
break;
}
case LOCATION_EXTRA: {
if(sequence < player[playerid].list_extra.size())
return player[playerid].list_extra[sequence];
else
return nullptr;
break;
}
}
return nullptr;
}
......@@ -2719,7 +2715,7 @@ int32_t field::check_tuner_material(lua_State* L, card* pcard, card* tuner, int3
++location_count;
}
if(min == 0) {
if(location_count > 0 && check_with_sum_limit_m(nsyn, lv, 0, 0, 0, 0xffff, 2)) {
if(location_count > 0 && must_list.size() == 0 && check_with_sum_limit_m(nsyn, lv, 0, 0, 0, 0xffff, 2)) {
pduel->restore_assumes();
return TRUE;
}
......@@ -2731,6 +2727,12 @@ int32_t field::check_tuner_material(lua_State* L, card* pcard, card* tuner, int3
}
if(must_list.size()) {
for(auto& mcard : must_list) {
if(mg) {
if(!mg->has_card(mcard)) {
pduel->restore_assumes();
return FALSE;
}
}
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)) {
......
......@@ -387,6 +387,7 @@ public:
void set_control(card* pcard, uint8_t playerid, uint16_t reset_phase, uint8_t reset_count);
int32_t get_pzone_sequence(uint8_t pseq) const;
const card_vector* get_field_vector(uint8_t playerid, uint8_t location) const;
card* get_field_card(uint8_t playerid, uint32_t general_location, uint8_t sequence) const;
int32_t is_location_useable(uint8_t playerid, uint32_t general_location, uint8_t sequence) const;
int32_t get_useable_count(card* pcard, uint8_t playerid, uint8_t location, uint8_t uplayer, uint32_t reason, uint32_t zone = 0xff, uint32_t* list = nullptr);
......
......@@ -214,7 +214,7 @@ OCGCORE_API void new_tag_card(intptr_t pduel, uint32_t code, uint8_t owner, uint
* @param buf int32_t array
* @return buffer length in bytes
*/
OCGCORE_API int32_t query_card(intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, int32_t query_flag, byte* buf, int32_t use_cache) {
OCGCORE_API int32_t query_card(intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, uint32_t query_flag, byte* buf, int32_t use_cache) {
if (!check_playerid(playerid))
return LEN_FAIL;
duel* ptduel = (duel*)pduel;
......@@ -223,22 +223,13 @@ OCGCORE_API int32_t query_card(intptr_t pduel, uint8_t playerid, uint8_t locatio
if (location == LOCATION_MZONE || location == LOCATION_SZONE)
pcard = ptduel->game_field->get_field_card(playerid, location, sequence);
else {
card_vector* lst = nullptr;
if (location == LOCATION_HAND)
lst = &ptduel->game_field->player[playerid].list_hand;
else if (location == LOCATION_GRAVE)
lst = &ptduel->game_field->player[playerid].list_grave;
else if (location == LOCATION_REMOVED)
lst = &ptduel->game_field->player[playerid].list_remove;
else if (location == LOCATION_EXTRA)
lst = &ptduel->game_field->player[playerid].list_extra;
else if (location == LOCATION_DECK)
lst = &ptduel->game_field->player[playerid].list_main;
else
auto ptr = ptduel->game_field->get_field_vector(playerid, location);
if(!ptr)
return LEN_FAIL;
if (sequence >= (int32_t)lst->size())
auto& lst = *ptr;
if (sequence >= lst.size())
return LEN_FAIL;
pcard = (*lst)[sequence];
pcard = lst[sequence];
}
if (pcard) {
return pcard->get_infos(buf, query_flag, use_cache);
......
......@@ -58,7 +58,7 @@ OCGCORE_API int32_t get_message(intptr_t pduel, byte* buf);
OCGCORE_API uint32_t process(intptr_t pduel);
OCGCORE_API void new_card(intptr_t pduel, uint32_t code, uint8_t owner, uint8_t playerid, uint8_t location, uint8_t sequence, uint8_t position);
OCGCORE_API void new_tag_card(intptr_t pduel, uint32_t code, uint8_t owner, uint8_t location);
OCGCORE_API int32_t query_card(intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, int32_t query_flag, byte* buf, int32_t use_cache);
OCGCORE_API int32_t query_card(intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, uint32_t query_flag, byte* buf, int32_t use_cache);
OCGCORE_API int32_t query_field_count(intptr_t pduel, uint8_t playerid, uint8_t location);
OCGCORE_API int32_t query_field_card(intptr_t pduel, uint8_t playerid, uint8_t location, uint32_t query_flag, byte* buf, int32_t use_cache);
OCGCORE_API int32_t query_field_info(intptr_t pduel, byte* buf);
......
......@@ -2733,8 +2733,10 @@ int32_t field::special_summon_rule(uint16_t step, uint8_t sumplayer, card* targe
info.limit_link_maxc = core.limit_link_maxc;
target->filter_spsummon_procedure(sumplayer, &eset, summon_type, info);
target->filter_spsummon_procedure_g(sumplayer, &eset);
if(!eset.size())
return TRUE;
if(!eset.size()) {
core.units.begin()->step = 17;
return FALSE;
}
core.select_effects.clear();
core.select_options.clear();
for(effect_set::size_type i = 0; i < eset.size(); ++i) {
......@@ -2784,8 +2786,10 @@ int32_t field::special_summon_rule(uint16_t step, uint8_t sumplayer, card* targe
return FALSE;
}
case 2: {
if(!returns.ivalue[0])
return TRUE;
if(!returns.ivalue[0]) {
core.units.begin()->step = 17;
return FALSE;
}
effect_set eset;
target->filter_effect(EFFECT_SPSUMMON_COST, &eset);
if(eset.size()) {
......@@ -3011,6 +3015,27 @@ int32_t field::special_summon_rule(uint16_t step, uint8_t sumplayer, card* targe
}
return TRUE;
}
case 18: {
if(core.limit_tuner) {
core.limit_tuner = 0;
}
if(core.limit_syn) {
pduel->delete_group(core.limit_syn);
core.limit_syn = 0;
}
if(core.limit_xyz) {
pduel->delete_group(core.limit_xyz);
core.limit_xyz = 0;
}
if(core.limit_link_card) {
core.limit_link_card = 0;
}
if(core.limit_link) {
pduel->delete_group(core.limit_link);
core.limit_link = 0;
}
return TRUE;
}
case 20: {
// EFFECT_SPSUMMON_PROC_G (Pendulum Summon)
effect* peffect = core.units.begin()->peffect;
......@@ -5361,6 +5386,14 @@ int32_t field::select_synchro_material(int16_t step, uint8_t playerid, card* pca
case 0: {
if(core.select_cards.size() == 0)
return TRUE;
if(core.summon_cancelable == FALSE && mg && min == max && mg->container.size() == min + 1) {
group* pgroup = pduel->new_group();
pgroup->container.insert(mg->container.begin(), mg->container.end());
pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP);
pduel->restore_assumes();
core.limit_tuner = 0;
return TRUE;
}
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(playerid);
......@@ -5422,13 +5455,10 @@ int32_t field::select_synchro_material(int16_t step, uint8_t playerid, card* pca
}
if(!smat)
return FALSE;
--min;
--max;
core.units.begin()->arg2 = min + (max << 16);
effect* pcheck = tuner->is_affected_by_effect(EFFECT_SYNCHRO_CHECK);
if(pcheck)
pcheck->get_value(smat);
if(min == 0) {
if(min == 1 && max == 1) {
group* pgroup = pduel->new_group();
pgroup->container.insert(tuner);
pgroup->container.insert(smat);
......
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