Commit 4e0295fa authored by salix5's avatar salix5

EVENT_BATTLE_DESTROYING

destroyed by battle: REASON_BATTLE+REASON_DESTROYED
destroyed by effect: REASON_EFFECT+REASON_DESTROYED, w/o REASON_BATTLE
parent eb6f61df
......@@ -57,7 +57,7 @@ int32 effect::is_disable_related() {
return TRUE;
return FALSE;
}
// check if a single/field/field effect is available
// check if a single/field/equip effect is available
// check range, EFFECT_FLAG_OWNER_RELATE, STATUS_BATTLE_DESTROYED, STATUS_EFFECT_ENABLED
int32 effect::is_available() {
if (type & EFFECT_TYPE_ACTIONS)
......
......@@ -174,6 +174,8 @@ void field::special_summon_complete(effect* reason_effect, uint8 reason_player)
//core.special_summoning.clear();
add_process(PROCESSOR_SPSUMMON_COMP_S, 0, reason_effect, ng, reason_player, 0);
}
// destroy in script: here->PROCESSOR_DESTROY, step 0
// set current.reason
void field::destroy(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 destination, uint32 sequence) {
uint32 p;
for(auto cit = targets->begin(); cit != targets->end();) {
......@@ -230,7 +232,8 @@ void field::release(card* target, effect* reason_effect, uint32 reason, uint32 r
tset.insert(target);
release(&tset, reason_effect, reason, reason_player);
}
// send to locations other than LOCATION_ONFIELD
// set current.reason and send to locations other than LOCATION_ONFIELD
// send-to in scripts: here->PROCESSOR_SENDTO, step 0
void field::send_to(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 destination, uint32 sequence, uint32 position) {
if(destination & LOCATION_ONFIELD)
return;
......@@ -3058,9 +3061,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
card_set leave_p, destroying;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
card* pcard = *cit;
if((pcard->current.location == LOCATION_MZONE) && pcard->is_status(STATUS_BATTLE_DESTROYED)
&& !(pcard->current.reason & REASON_RULE)
&& (pcard->current.reason & (REASON_DESTROY | REASON_EFFECT)) != (REASON_DESTROY | REASON_EFFECT)) {
if((pcard->current.location == LOCATION_MZONE) && pcard->is_status(STATUS_BATTLE_DESTROYED) && !(pcard->current.reason & REASON_RULE)
&& (pcard->current.reason & (REASON_EFFECT + REASON_DESTROY)) != (REASON_EFFECT + REASON_DESTROY) && !(pcard->current.reason & REASON_BATTLE)) {
pcard->current.reason |= REASON_DESTROY | REASON_BATTLE;
raise_single_event(pcard, 0, EVENT_DESTROY, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
destroying.insert(pcard);
......@@ -3442,7 +3444,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
released.insert(pcard);
raise_single_event(pcard, 0, EVENT_RELEASE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(pcard->current.reason & REASON_DESTROY && !pcard->is_status(STATUS_BATTLE_DESTROYED)) {
// non-battle destroy
if(pcard->current.reason & REASON_DESTROY && !(pcard->current.reason & REASON_BATTLE)) {
destroyed.insert(pcard);
raise_single_event(pcard, 0, EVENT_DESTROYED, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
......
......@@ -3566,18 +3566,14 @@ int32 field::process_battle_command(uint16 step) {
core.units.begin()->ptarget = 0;
card_set ing;
card_set ed;
if(core.attacker->is_status(STATUS_BATTLE_DESTROYED)
&& !(core.attacker->current.reason & REASON_RULE)
&& !((core.attacker->current.reason & REASON_EFFECT + REASON_DESTROY) == REASON_EFFECT + REASON_DESTROY)) {
if(core.attacker->is_status(STATUS_BATTLE_DESTROYED) && (core.attacker->current.reason & REASON_BATTLE)) {
raise_single_event(core.attack_target, 0, EVENT_BATTLE_DESTROYING, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 1);
raise_single_event(core.attacker, 0, EVENT_BATTLE_DESTROYED, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 0);
raise_single_event(core.attacker, 0, EVENT_DESTROYED, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 0);
ing.insert(core.attack_target);
ed.insert(core.attacker);
}
if(core.attack_target && core.attack_target->is_status(STATUS_BATTLE_DESTROYED)
&& !(core.attack_target->current.reason & REASON_RULE)
&& !((core.attack_target->current.reason & REASON_EFFECT + REASON_DESTROY) == REASON_EFFECT + REASON_DESTROY)) {
if(core.attack_target && core.attack_target->is_status(STATUS_BATTLE_DESTROYED) && (core.attack_target->current.reason & REASON_BATTLE)) {
raise_single_event(core.attacker, 0, EVENT_BATTLE_DESTROYING, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 0);
raise_single_event(core.attack_target, 0, EVENT_BATTLE_DESTROYED, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 1);
raise_single_event(core.attack_target, 0, EVENT_DESTROYED, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 1);
......
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