Commit 00cd847b authored by mercury233's avatar mercury233
parents 3011093f a59178f3
...@@ -2217,9 +2217,8 @@ int32 card::get_counter(uint16 countertype) { ...@@ -2217,9 +2217,8 @@ int32 card::get_counter(uint16 countertype) {
void card::set_material(card_set* materials) { void card::set_material(card_set* materials) {
if(!materials) { if(!materials) {
material_cards.clear(); material_cards.clear();
return; } else
} material_cards = *materials;
material_cards = *materials;
for(auto& pcard : material_cards) for(auto& pcard : material_cards)
pcard->current.reason_card = this; pcard->current.reason_card = this;
effect_set eset; effect_set eset;
...@@ -2845,7 +2844,7 @@ void card::get_unique_target(card_set* cset, int32 controler, card* icard) { ...@@ -2845,7 +2844,7 @@ void card::get_unique_target(card_set* cset, int32 controler, card* icard) {
const auto& player = pduel->game_field->player[controler ^ p]; const auto& player = pduel->game_field->player[controler ^ p];
if(unique_location & LOCATION_MZONE) { if(unique_location & LOCATION_MZONE) {
for(auto& pcard : player.list_mzone) { for(auto& pcard : player.list_mzone) {
if(pcard && (pcard != icard) && pcard->is_position(POS_FACEUP) && !pcard->get_status(STATUS_BATTLE_DESTROYED | STATUS_SPSUMMON_STEP) if(pcard && (pcard != icard) && pcard->is_position(POS_FACEUP) && !pcard->get_status(STATUS_SPSUMMON_STEP)
&& check_unique_code(pcard)) && check_unique_code(pcard))
cset->insert(pcard); cset->insert(pcard);
} }
...@@ -3119,17 +3118,6 @@ int32 card::is_special_summonable(uint8 playerid, uint32 summon_type) { ...@@ -3119,17 +3118,6 @@ int32 card::is_special_summonable(uint8 playerid, uint32 summon_type) {
} }
effect_set eset; effect_set eset;
filter_spsummon_procedure(playerid, &eset, summon_type); filter_spsummon_procedure(playerid, &eset, summon_type);
pduel->game_field->core.limit_tuner = 0;
pduel->game_field->core.limit_syn = 0;
pduel->game_field->core.limit_syn_minc = 0;
pduel->game_field->core.limit_syn_maxc = 0;
pduel->game_field->core.limit_xyz = 0;
pduel->game_field->core.limit_xyz_minc = 0;
pduel->game_field->core.limit_xyz_maxc = 0;
pduel->game_field->core.limit_link = 0;
pduel->game_field->core.limit_link_card = 0;
pduel->game_field->core.limit_link_minc = 0;
pduel->game_field->core.limit_link_maxc = 0;
pduel->game_field->restore_lp_cost(); pduel->game_field->restore_lp_cost();
return eset.size(); return eset.size();
} }
......
...@@ -456,6 +456,8 @@ int32 effect::is_target(card* pcard) { ...@@ -456,6 +456,8 @@ int32 effect::is_target(card* pcard) {
if(!is_flag(EFFECT_FLAG_IGNORE_RANGE)) { if(!is_flag(EFFECT_FLAG_IGNORE_RANGE)) {
if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP)) if(pcard->get_status(STATUS_SUMMONING | STATUS_SUMMON_DISABLED | STATUS_ACTIVATE_DISABLED | STATUS_SPSUMMON_STEP))
return FALSE; return FALSE;
if(is_flag(EFFECT_FLAG_SPSUM_PARAM))
return FALSE;
if(is_flag(EFFECT_FLAG_ABSOLUTE_TARGET)) { if(is_flag(EFFECT_FLAG_ABSOLUTE_TARGET)) {
if(pcard->current.controler == 0) { if(pcard->current.controler == 0) {
if(!pcard->current.is_location(s_range)) if(!pcard->current.is_location(s_range))
......
...@@ -1319,7 +1319,8 @@ void field::filter_field_effect(uint32 code, effect_set* eset, uint8 sort) { ...@@ -1319,7 +1319,8 @@ void field::filter_field_effect(uint32 code, effect_set* eset, uint8 sort) {
eset->sort(); eset->sort();
} }
void field::filter_affected_cards(effect* peffect, card_set* cset) { void field::filter_affected_cards(effect* peffect, card_set* cset) {
if((peffect->type & EFFECT_TYPE_ACTIONS) || !(peffect->type & EFFECT_TYPE_FIELD) || peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET)) if((peffect->type & EFFECT_TYPE_ACTIONS) || !(peffect->type & EFFECT_TYPE_FIELD)
|| peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET | EFFECT_FLAG_SPSUM_PARAM))
return; return;
uint8 self = peffect->get_handler_player(); uint8 self = peffect->get_handler_player();
if(self == PLAYER_NONE) if(self == PLAYER_NONE)
...@@ -1352,7 +1353,7 @@ void field::filter_affected_cards(effect* peffect, card_set* cset) { ...@@ -1352,7 +1353,7 @@ void field::filter_affected_cards(effect* peffect, card_set* cset) {
} }
} }
void field::filter_inrange_cards(effect* peffect, card_set* cset) { void field::filter_inrange_cards(effect* peffect, card_set* cset) {
if(peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET)) if(peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET | EFFECT_FLAG_SPSUM_PARAM))
return; return;
uint8 self = peffect->get_handler_player(); uint8 self = peffect->get_handler_player();
if(self == PLAYER_NONE) if(self == PLAYER_NONE)
...@@ -1933,13 +1934,13 @@ void field::adjust_disable_check_list() { ...@@ -1933,13 +1934,13 @@ void field::adjust_disable_check_list() {
effects.disable_check_list.pop_front(); effects.disable_check_list.pop_front();
effects.disable_check_set.erase(checking); effects.disable_check_set.erase(checking);
checked.insert(checking); checked.insert(checking);
if(checking->is_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE)) if(checking->is_status(STATUS_TO_ENABLE | STATUS_TO_DISABLE)) // prevent loop
continue; continue;
int32 pre_disable = checking->get_status(STATUS_DISABLED | STATUS_FORBIDDEN); int32 pre_disable = checking->get_status(STATUS_DISABLED | STATUS_FORBIDDEN);
checking->refresh_disable_status(); checking->refresh_disable_status();
int32 new_disable = checking->get_status(STATUS_DISABLED | STATUS_FORBIDDEN); int32 new_disable = checking->get_status(STATUS_DISABLED | STATUS_FORBIDDEN);
if(pre_disable != new_disable && checking->is_status(STATUS_EFFECT_ENABLED)) { if(pre_disable != new_disable && checking->is_status(STATUS_EFFECT_ENABLED)) {
checking->filter_disable_related_cards(); checking->filter_disable_related_cards(); // change effects.disable_check_list
if(pre_disable) if(pre_disable)
checking->set_status(STATUS_TO_ENABLE, TRUE); checking->set_status(STATUS_TO_ENABLE, TRUE);
else else
...@@ -2456,10 +2457,12 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 ...@@ -2456,10 +2457,12 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
if(ptuner) { if(ptuner) {
if(ptuner->value) if(ptuner->value)
location = ptuner->value; location = ptuner->value;
if(ptuner->s_range && ptuner->s_range > min) if(ptuner->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
min = ptuner->s_range; if(ptuner->s_range && ptuner->s_range > min)
if(ptuner->o_range && ptuner->o_range < max) min = ptuner->s_range;
max = ptuner->o_range; if(ptuner->o_range && ptuner->o_range < max)
max = ptuner->o_range;
}
if(min > max) { if(min > max) {
pduel->restore_assumes(); pduel->restore_assumes();
return FALSE; return FALSE;
......
...@@ -1569,10 +1569,12 @@ int32 scriptlib::card_get_tuner_limit(lua_State *L) { ...@@ -1569,10 +1569,12 @@ int32 scriptlib::card_get_tuner_limit(lua_State *L) {
lua_pushnil(L); lua_pushnil(L);
uint16 min = 0; uint16 min = 0;
uint16 max = 99; uint16 max = 99;
if(peffect->s_range && peffect->s_range > min) if(peffect->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
min = peffect->s_range; if(peffect->s_range && peffect->s_range > min)
if(peffect->o_range && peffect->o_range < max) min = peffect->s_range;
max = peffect->o_range; if(peffect->o_range && peffect->o_range < max)
max = peffect->o_range;
}
lua_pushinteger(L, min); lua_pushinteger(L, min);
lua_pushinteger(L, max); lua_pushinteger(L, max);
return 5; return 5;
...@@ -1594,10 +1596,12 @@ int32 scriptlib::card_get_hand_synchro(lua_State *L) { ...@@ -1594,10 +1596,12 @@ int32 scriptlib::card_get_hand_synchro(lua_State *L) {
lua_pushnil(L); lua_pushnil(L);
uint16 min = 0; uint16 min = 0;
uint16 max = 99; uint16 max = 99;
if(peffect->s_range && peffect->s_range > min) if(peffect->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
min = peffect->s_range; if(peffect->s_range && peffect->s_range > min)
if(peffect->o_range && peffect->o_range < max) min = peffect->s_range;
max = peffect->o_range; if(peffect->o_range && peffect->o_range < max)
max = peffect->o_range;
}
lua_pushinteger(L, min); lua_pushinteger(L, min);
lua_pushinteger(L, max); lua_pushinteger(L, max);
return 4; return 4;
...@@ -1611,10 +1615,12 @@ int32 scriptlib::card_get_hand_synchro(lua_State *L) { ...@@ -1611,10 +1615,12 @@ int32 scriptlib::card_get_hand_synchro(lua_State *L) {
lua_pushnil(L); lua_pushnil(L);
uint16 min = 0; uint16 min = 0;
uint16 max = 99; uint16 max = 99;
if(peffect->s_range && peffect->s_range > min) if(peffect->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
min = peffect->s_range; if(peffect->s_range && peffect->s_range > min)
if(peffect->o_range && peffect->o_range < max) min = peffect->s_range;
max = peffect->o_range; if(peffect->o_range && peffect->o_range < max)
max = peffect->o_range;
}
lua_pushinteger(L, min); lua_pushinteger(L, min);
lua_pushinteger(L, max); lua_pushinteger(L, max);
return 4; return 4;
...@@ -2031,7 +2037,12 @@ int32 scriptlib::card_is_synchro_summonable(lua_State *L) { ...@@ -2031,7 +2037,12 @@ int32 scriptlib::card_is_synchro_summonable(lua_State *L) {
pcard->pduel->game_field->core.limit_syn = mg; pcard->pduel->game_field->core.limit_syn = mg;
pcard->pduel->game_field->core.limit_syn_minc = minc; pcard->pduel->game_field->core.limit_syn_minc = minc;
pcard->pduel->game_field->core.limit_syn_maxc = maxc; pcard->pduel->game_field->core.limit_syn_maxc = maxc;
lua_pushboolean(L, pcard->is_special_summonable(p, SUMMON_TYPE_SYNCHRO)); int32 res = pcard->is_special_summonable(p, SUMMON_TYPE_SYNCHRO);
pcard->pduel->game_field->core.limit_tuner = 0;
pcard->pduel->game_field->core.limit_syn = 0;
pcard->pduel->game_field->core.limit_syn_minc = 0;
pcard->pduel->game_field->core.limit_syn_maxc = 0;
lua_pushboolean(L, res);
return 1; return 1;
} }
int32 scriptlib::card_is_xyz_summonable(lua_State *L) { int32 scriptlib::card_is_xyz_summonable(lua_State *L) {
...@@ -2057,7 +2068,11 @@ int32 scriptlib::card_is_xyz_summonable(lua_State *L) { ...@@ -2057,7 +2068,11 @@ int32 scriptlib::card_is_xyz_summonable(lua_State *L) {
pcard->pduel->game_field->core.limit_xyz = materials; pcard->pduel->game_field->core.limit_xyz = materials;
pcard->pduel->game_field->core.limit_xyz_minc = minc; pcard->pduel->game_field->core.limit_xyz_minc = minc;
pcard->pduel->game_field->core.limit_xyz_maxc = maxc; pcard->pduel->game_field->core.limit_xyz_maxc = maxc;
lua_pushboolean(L, pcard->is_special_summonable(p, SUMMON_TYPE_XYZ)); int32 res = pcard->is_special_summonable(p, SUMMON_TYPE_XYZ);
pcard->pduel->game_field->core.limit_xyz = 0;
pcard->pduel->game_field->core.limit_xyz_minc = 0;
pcard->pduel->game_field->core.limit_xyz_maxc = 0;
lua_pushboolean(L, res);
return 1; return 1;
} }
int32 scriptlib::card_is_link_summonable(lua_State *L) { int32 scriptlib::card_is_link_summonable(lua_State *L) {
...@@ -2091,7 +2106,12 @@ int32 scriptlib::card_is_link_summonable(lua_State *L) { ...@@ -2091,7 +2106,12 @@ int32 scriptlib::card_is_link_summonable(lua_State *L) {
pcard->pduel->game_field->core.limit_link_card = lcard; pcard->pduel->game_field->core.limit_link_card = lcard;
pcard->pduel->game_field->core.limit_link_minc = minc; pcard->pduel->game_field->core.limit_link_minc = minc;
pcard->pduel->game_field->core.limit_link_maxc = maxc; pcard->pduel->game_field->core.limit_link_maxc = maxc;
lua_pushboolean(L, pcard->is_special_summonable(p, SUMMON_TYPE_LINK)); int32 res = pcard->is_special_summonable(p, SUMMON_TYPE_LINK);
pcard->pduel->game_field->core.limit_link = 0;
pcard->pduel->game_field->core.limit_link_card = 0;
pcard->pduel->game_field->core.limit_link_minc = 0;
pcard->pduel->game_field->core.limit_link_maxc = 0;
lua_pushboolean(L, res);
return 1; return 1;
} }
int32 scriptlib::card_is_can_be_summoned(lua_State *L) { int32 scriptlib::card_is_can_be_summoned(lua_State *L) {
......
...@@ -5213,7 +5213,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in ...@@ -5213,7 +5213,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
case 3: { case 3: {
card* tuner = core.limit_tuner; card* tuner = core.limit_tuner;
effect* ptuner = tuner->is_affected_by_effect(EFFECT_TUNER_MATERIAL_LIMIT); effect* ptuner = tuner->is_affected_by_effect(EFFECT_TUNER_MATERIAL_LIMIT);
if(ptuner) { if(ptuner && ptuner->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
if(ptuner->s_range && ptuner->s_range > min) if(ptuner->s_range && ptuner->s_range > min)
min = ptuner->s_range; min = ptuner->s_range;
if(ptuner->o_range && ptuner->o_range < max) if(ptuner->o_range && ptuner->o_range < max)
......
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