Commit f6d55d74 authored by DailyShana's avatar DailyShana

fix EVENT_DISCARD

parent cc50da86
......@@ -3611,7 +3611,7 @@ int32 field::send_to(uint16 step, group * targets, card * target) {
int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
struct exargs {
group* targets;
card_set leave, discard, detach;
card_set leave, detach;
bool show_decktop[2];
card_vector cv;
card_vector::iterator cvit;
......@@ -3897,8 +3897,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_LEAVE, RESET_EVENT);
param->leave.insert(pcard);
}
if(pcard->current.reason & REASON_DISCARD)
param->discard.insert(pcard);
++param->cvit;
core.units.begin()->step = 4;
return FALSE;
......@@ -3941,8 +3939,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_LEAVE + RESET_MSCHANGE, RESET_EVENT);
param->leave.insert(pcard);
}
if(pcard->current.reason & REASON_DISCARD)
param->discard.insert(pcard);
if(param->predirect->operation) {
tevent e;
e.event_cards = targets;
......@@ -3984,8 +3980,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
}
for(auto iter = param->leave.begin(); iter != param->leave.end(); ++iter)
raise_single_event(*iter, 0, EVENT_LEAVE_FIELD, (*iter)->current.reason_effect, (*iter)->current.reason, (*iter)->current.reason_player, 0, 0);
for(auto iter = param->discard.begin(); iter != param->discard.end(); ++iter)
raise_single_event(*iter, 0, EVENT_DISCARD, (*iter)->current.reason_effect, (*iter)->current.reason, (*iter)->current.reason_player, 0, 0);
if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) {
for(auto iter = param->detach.begin(); iter != param->detach.end(); ++iter) {
if((*iter)->current.location & LOCATION_MZONE)
......@@ -3995,8 +3989,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
process_single_event();
if(param->leave.size())
raise_event(&param->leave, EVENT_LEAVE_FIELD, reason_effect, reason, reason_player, 0, 0);
if(param->discard.size())
raise_event(&param->discard, EVENT_DISCARD, reason_effect, reason, reason_player, 0, 0);
if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size())
raise_event(&param->detach, EVENT_DETACH_MATERIAL, reason_effect, reason, reason_player, 0, 0);
process_instant_event();
......@@ -4008,12 +4000,11 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
core.units.begin()->ptarget = param->targets;
targets = param->targets;
delete param;
uint8 nloc;
card_set tohand, todeck, tograve, remove, released, destroyed, retgrave;
card_set tohand, todeck, tograve, remove, discard, released, destroyed, retgrave;
card_set equipings, overlays;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
card* pcard = *cit;
nloc = pcard->current.location;
uint8 nloc = pcard->current.location;
if(pcard->equiping_target)
pcard->unequip();
if(pcard->equiping_cards.size()) {
......@@ -4053,6 +4044,10 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_REMOVE, RESET_EVENT);
raise_single_event(pcard, 0, EVENT_REMOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(pcard->current.reason & REASON_DISCARD) {
discard.insert(pcard);
raise_single_event(pcard, 0, EVENT_DISCARD, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(pcard->current.reason & REASON_RELEASE) {
released.insert(pcard);
raise_single_event(pcard, 0, EVENT_RELEASE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
......@@ -4076,6 +4071,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
raise_event(&tograve, EVENT_TO_GRAVE, reason_effect, reason, reason_player, 0, 0);
if(remove.size())
raise_event(&remove, EVENT_REMOVE, reason_effect, reason, reason_player, 0, 0);
if(discard.size())
raise_event(&discard, EVENT_DISCARD, reason_effect, reason, reason_player, 0, 0);
if(released.size())
raise_event(&released, EVENT_RELEASE, reason_effect, reason, reason_player, 0, 0);
if(destroyed.size())
......
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