Commit 5abc0b4d authored by Momobako's avatar Momobako
parents c7e1e2a0 f6d55d74
...@@ -2182,17 +2182,15 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) { ...@@ -2182,17 +2182,15 @@ int32 field::check_spsummon_counter(uint8 playerid, uint8 ct) {
int32 field::check_lp_cost(uint8 playerid, uint32 lp) { int32 field::check_lp_cost(uint8 playerid, uint32 lp) {
effect_set eset; effect_set eset;
int32 val = lp; int32 val = lp;
if(lp == 0)
return TRUE;
filter_player_effect(playerid, EFFECT_LPCOST_CHANGE, &eset); filter_player_effect(playerid, EFFECT_LPCOST_CHANGE, &eset);
for(int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT); pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(val, PARAM_TYPE_INT); pduel->lua->add_param(val, PARAM_TYPE_INT);
val = eset[i]->get_value(3); val = eset[i]->get_value(3);
if(val <= 0)
return TRUE;
} }
if(val <= 0)
return TRUE;
tevent e; tevent e;
e.event_cards = 0; e.event_cards = 0;
e.event_player = playerid; e.event_player = playerid;
......
...@@ -600,20 +600,15 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) { ...@@ -600,20 +600,15 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
case 0: { case 0: {
effect_set eset; effect_set eset;
int32 val = cost; int32 val = cost;
if(cost == 0) {
raise_event((card*)0, EVENT_PAY_LPCOST, core.reason_effect, 0, playerid, playerid, cost);
process_instant_event();
return TRUE;
}
filter_player_effect(playerid, EFFECT_LPCOST_CHANGE, &eset); filter_player_effect(playerid, EFFECT_LPCOST_CHANGE, &eset);
for(int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT); pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(val, PARAM_TYPE_INT); pduel->lua->add_param(val, PARAM_TYPE_INT);
val = eset[i]->get_value(3); val = eset[i]->get_value(3);
if(val <= 0)
return TRUE;
} }
if(val <= 0)
return TRUE;
core.units.begin()->arg2 = val; core.units.begin()->arg2 = val;
tevent e; tevent e;
e.event_cards = 0; e.event_cards = 0;
...@@ -3664,7 +3659,7 @@ int32 field::send_to(uint16 step, group * targets, card * target) { ...@@ -3664,7 +3659,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) { int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
struct exargs { struct exargs {
group* targets; group* targets;
card_set leave, discard, detach; card_set leave, detach;
bool show_decktop[2]; bool show_decktop[2];
card_vector cv; card_vector cv;
card_vector::iterator cvit; card_vector::iterator cvit;
...@@ -3950,8 +3945,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3950,8 +3945,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_LEAVE, RESET_EVENT); pcard->reset(RESET_LEAVE, RESET_EVENT);
param->leave.insert(pcard); param->leave.insert(pcard);
} }
if(pcard->current.reason & REASON_DISCARD)
param->discard.insert(pcard);
++param->cvit; ++param->cvit;
core.units.begin()->step = 4; core.units.begin()->step = 4;
return FALSE; return FALSE;
...@@ -3994,8 +3987,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3994,8 +3987,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_LEAVE + RESET_MSCHANGE, RESET_EVENT); pcard->reset(RESET_LEAVE + RESET_MSCHANGE, RESET_EVENT);
param->leave.insert(pcard); param->leave.insert(pcard);
} }
if(pcard->current.reason & REASON_DISCARD)
param->discard.insert(pcard);
if(param->predirect->operation) { if(param->predirect->operation) {
tevent e; tevent e;
e.event_cards = targets; e.event_cards = targets;
...@@ -4037,8 +4028,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4037,8 +4028,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
} }
for(auto iter = param->leave.begin(); iter != param->leave.end(); ++iter) 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); 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()) { if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) {
for(auto iter = param->detach.begin(); iter != param->detach.end(); ++iter) { for(auto iter = param->detach.begin(); iter != param->detach.end(); ++iter) {
if((*iter)->current.location & LOCATION_MZONE) if((*iter)->current.location & LOCATION_MZONE)
...@@ -4048,8 +4037,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4048,8 +4037,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
process_single_event(); process_single_event();
if(param->leave.size()) if(param->leave.size())
raise_event(&param->leave, EVENT_LEAVE_FIELD, reason_effect, reason, reason_player, 0, 0); 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()) if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size())
raise_event(&param->detach, EVENT_DETACH_MATERIAL, reason_effect, reason, reason_player, 0, 0); raise_event(&param->detach, EVENT_DETACH_MATERIAL, reason_effect, reason, reason_player, 0, 0);
process_instant_event(); process_instant_event();
...@@ -4061,12 +4048,11 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4061,12 +4048,11 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
core.units.begin()->ptarget = param->targets; core.units.begin()->ptarget = param->targets;
targets = param->targets; targets = param->targets;
delete param; delete param;
uint8 nloc; card_set tohand, todeck, tograve, remove, discard, released, destroyed, retgrave;
card_set tohand, todeck, tograve, remove, released, destroyed, retgrave;
card_set equipings, overlays; card_set equipings, overlays;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) { for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
card* pcard = *cit; card* pcard = *cit;
nloc = pcard->current.location; uint8 nloc = pcard->current.location;
if(pcard->equiping_target) if(pcard->equiping_target)
pcard->unequip(); pcard->unequip();
if(pcard->equiping_cards.size()) { if(pcard->equiping_cards.size()) {
...@@ -4106,6 +4092,10 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4106,6 +4092,10 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_REMOVE, RESET_EVENT); 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); 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) { if(pcard->current.reason & REASON_RELEASE) {
released.insert(pcard); released.insert(pcard);
raise_single_event(pcard, 0, EVENT_RELEASE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_RELEASE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
...@@ -4129,6 +4119,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4129,6 +4119,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); raise_event(&tograve, EVENT_TO_GRAVE, reason_effect, reason, reason_player, 0, 0);
if(remove.size()) if(remove.size())
raise_event(&remove, EVENT_REMOVE, reason_effect, reason, reason_player, 0, 0); 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()) if(released.size())
raise_event(&released, EVENT_RELEASE, reason_effect, reason, reason_player, 0, 0); raise_event(&released, EVENT_RELEASE, reason_effect, reason, reason_player, 0, 0);
if(destroyed.size()) 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