Commit 6b971a56 authored by salix5's avatar salix5

update Duel.NegateSummon

parent 09111e8e
......@@ -200,7 +200,7 @@ struct card_sort {
#define STATUS_SUMMON_DISABLED 0x20000
#define STATUS_ACTIVATE_DISABLED 0x40000
#define STATUS_EFFECT_REPLACED 0x80000
//#define STATUS_FUTURE_FUSION 0x100000
#define STATUS_FLIP_SUMMONING 0x100000
#define STATUS_ATTACK_CANCELED 0x200000
#define STATUS_INITIALIZING 0x400000
#define STATUS_TO_HAND_WITHOUT_CONFIRM 0x800000
......
......@@ -301,6 +301,7 @@ struct processor {
int32 coin_count{ 0 };
bool is_target_ready{ false };
bool is_gemini_summoning{ false };
bool is_summon_negated{ false };
uint8 to_bp{ FALSE };
uint8 to_m2{ FALSE };
......
......@@ -1821,7 +1821,6 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
pduel = pgroup->pduel;
} else
return luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 1);
uint8 sumplayer = PLAYER_NONE;
uint32 sumtype = 0;
if (pduel->game_field->check_event(EVENT_SUMMON)) {
if (pduel->game_field->core.is_gemini_summoning)
......@@ -1835,21 +1834,46 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
sumtype = SUMMON_TYPE_SPECIAL;
else
return 0;
if(pcard) {
if (sumtype & SUMMON_TYPE_NORMAL || sumtype & SUMMON_TYPE_FLIP) {
if (pgroup && pgroup->container.size() != 1)
return 0;
if (!pcard)
pcard = *pgroup->container.begin();
}
uint8 sumplayer = PLAYER_NONE;
effect* reason_effect = pduel->game_field->core.reason_effect;
field::card_set negated_cards;
if (sumtype == SUMMON_TYPE_DUAL || sumtype & SUMMON_TYPE_FLIP) {
if (!pcard->is_summon_negatable(sumtype, reason_effect))
return 0;
sumplayer = pcard->summon_player;
pcard->set_status(STATUS_SUMMONING, FALSE);
pcard->set_status(STATUS_FLIP_SUMMONING, FALSE);
pcard->set_status(STATUS_SUMMON_DISABLED, TRUE);
if (!match_all(sumtype, SUMMON_TYPE_FLIP) && !match_all(sumtype, SUMMON_TYPE_DUAL))
pcard->set_status(STATUS_PROC_COMPLETE, FALSE);
} else {
for(auto& pcard : pgroup->container) {
}
else {
if (pcard) {
if (!pcard->is_summon_negatable(sumtype, reason_effect))
return 0;
sumplayer = pcard->summon_player;
pcard->set_status(STATUS_SUMMONING, FALSE);
pcard->set_status(STATUS_SUMMON_DISABLED, TRUE);
if (!match_all(sumtype, SUMMON_TYPE_FLIP) && !match_all(sumtype, SUMMON_TYPE_DUAL))
pcard->set_status(STATUS_PROC_COMPLETE, FALSE);
}
else {
for (auto& pcard : pgroup->container) {
if (!pcard->is_summon_negatable(sumtype, reason_effect))
continue;
sumplayer = pcard->summon_player;
pcard->set_status(STATUS_SUMMONING, FALSE);
pcard->set_status(STATUS_SUMMON_DISABLED, TRUE);
pcard->set_status(STATUS_PROC_COMPLETE, FALSE);
negated_cards.insert(pcard);
}
if (!negated_cards.size())
return 0;
}
}
pduel->game_field->core.is_summon_negated = true;
uint32 event_code = 0;
if(sumtype & SUMMON_TYPE_NORMAL)
event_code = EVENT_SUMMON_NEGATED;
......@@ -1857,7 +1881,6 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
event_code = EVENT_FLIP_SUMMON_NEGATED;
else if(sumtype & SUMMON_TYPE_SPECIAL)
event_code = EVENT_SPSUMMON_NEGATED;
effect* reason_effect = pduel->game_field->core.reason_effect;
uint8 reason_player = pduel->game_field->core.reason_player;
if(pcard)
pduel->game_field->raise_event(pcard, event_code, reason_effect, REASON_EFFECT, reason_player, sumplayer, 0);
......
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