Commit d850977a authored by DailyShana's avatar DailyShana

recover attack cancelable

parent 4be87483
...@@ -259,6 +259,7 @@ struct processor { ...@@ -259,6 +259,7 @@ struct processor {
group* limit_xyz; group* limit_xyz;
int32 limit_xyz_minc; int32 limit_xyz_minc;
int32 limit_xyz_maxc; int32 limit_xyz_maxc;
uint8 attack_cancelable;
uint8 attack_rollback; uint8 attack_rollback;
uint8 effect_damage_step; uint8 effect_damage_step;
int32 battle_damage[2]; int32 battle_damage[2];
......
...@@ -2839,6 +2839,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2839,6 +2839,7 @@ int32 field::process_battle_command(uint16 step) {
core.to_m2 = FALSE; core.to_m2 = FALSE;
if(must_attack.size()) if(must_attack.size())
core.to_ep = FALSE; core.to_ep = FALSE;
core.attack_cancelable = TRUE;
add_process(PROCESSOR_SELECT_BATTLECMD, 0, 0, 0, infos.turn_player, 0); add_process(PROCESSOR_SELECT_BATTLECMD, 0, 0, 0, infos.turn_player, 0);
return FALSE; return FALSE;
} }
...@@ -2872,25 +2873,20 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2872,25 +2873,20 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} else if(ctype == 1) { } else if(ctype == 1) {
core.units.begin()->step = 2; core.units.begin()->step = 2;
core.units.begin()->arg3 = FALSE;
card* attacker = core.attackable_cards[sel]; card* attacker = core.attackable_cards[sel];
if(core.chain_attack && core.chain_attacker_id != attacker->fieldid) {
core.chain_attack = FALSE;
core.chain_attacker_id = 0;
}
core.attacker = attacker; core.attacker = attacker;
core.attacker->set_status(STATUS_ATTACK_CANCELED, FALSE); core.attacker->set_status(STATUS_ATTACK_CANCELED, FALSE);
core.pre_field[0] = core.attacker->fieldid_r; core.pre_field[0] = core.attacker->fieldid_r;
core.phase_action = TRUE;
core.attack_state_count[infos.turn_player]++;
check_card_counter(core.attacker, 5, infos.turn_player);
core.attacker->announce_count++;
effect_set eset; effect_set eset;
filter_player_effect(infos.turn_player, EFFECT_ATTACK_COST, &eset, FALSE); filter_player_effect(infos.turn_player, EFFECT_ATTACK_COST, &eset, FALSE);
core.attacker->filter_effect(EFFECT_ATTACK_COST, &eset); core.attacker->filter_effect(EFFECT_ATTACK_COST, &eset);
for(int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
if(eset[i]->operation) { if(eset[i]->operation) {
core.attack_cancelable = FALSE;
core.sub_solving_event.push_back(nil_event); core.sub_solving_event.push_back(nil_event);
add_process(PROCESSOR_EXECUTE_OPERATION, 0, eset[i], 0, infos.turn_player, 0); add_process(PROCESSOR_EXECUTE_OPERATION, 0, eset[i], 0, infos.turn_player, 0);
adjust_all();
} }
} }
return FALSE; return FALSE;
...@@ -2921,12 +2917,12 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2921,12 +2917,12 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} }
case 3: { case 3: {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]) { core.units.begin()->arg1 = FALSE;
core.chain_attack = FALSE; if(core.attacker->current.location != LOCATION_MZONE || core.attacker->current.controler != infos.turn_player || core.attacker->fieldid_r != core.pre_field[0]) {
core.units.begin()->step = -1; core.units.begin()->arg3 = TRUE;
core.units.begin()->step = 6;
return FALSE; return FALSE;
} }
core.units.begin()->arg1 = FALSE;
return FALSE; return FALSE;
} }
case 4: { case 4: {
...@@ -2951,10 +2947,10 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2951,10 +2947,10 @@ int32 field::process_battle_command(uint16 step) {
core.units.begin()->step = 5; core.units.begin()->step = 5;
return FALSE; return FALSE;
} }
// no target // no target and not direct attackable
if(core.select_cards.size() == 0) { if(core.select_cards.size() == 0) {
core.chain_attack = FALSE; core.units.begin()->arg3 = TRUE;
core.units.begin()->step = -1; core.units.begin()->step = 6;
return FALSE; return FALSE;
} }
// must attack monster // must attack monster
...@@ -2976,7 +2972,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2976,7 +2972,7 @@ int32 field::process_battle_command(uint16 step) {
pduel->write_buffer8(HINT_SELECTMSG); pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(infos.turn_player); pduel->write_buffer8(infos.turn_player);
pduel->write_buffer32(549); pduel->write_buffer32(549);
add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player + (core.units.begin()->arg1 ? 0x20000 : 0), 0x10001); add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player + (core.attack_cancelable ? 0x20000 : 0), 0x10001);
} }
core.units.begin()->step = 5; core.units.begin()->step = 5;
return FALSE; return FALSE;
...@@ -2991,20 +2987,22 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2991,20 +2987,22 @@ int32 field::process_battle_command(uint16 step) {
pduel->write_buffer8(HINT_SELECTMSG); pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(infos.turn_player); pduel->write_buffer8(infos.turn_player);
pduel->write_buffer32(549); pduel->write_buffer32(549);
add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player, 0x10001); add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player + (core.attack_cancelable ? 0x20000 : 0), 0x10001);
} else { } else {
core.chain_attack = FALSE; core.units.begin()->arg3 = TRUE;
core.units.begin()->step = -1; core.units.begin()->step = 6;
} }
} }
return FALSE; return FALSE;
} }
case 6: { case 6: {
if(returns.ivalue[0] == -1) { if(returns.ivalue[0] == -1) {//cancel attack manually
core.chain_attack = FALSE; if(core.units.begin()->arg1)
core.chain_attack = FALSE;
core.units.begin()->step = -1; core.units.begin()->step = -1;
return FALSE; return FALSE;
} else if(returns.ivalue[0] == -2) }
if(returns.ivalue[0] == -2)
core.attack_target = 0; core.attack_target = 0;
else else
core.attack_target = core.select_cards[returns.bvalue[1]]; core.attack_target = core.select_cards[returns.bvalue[1]];
...@@ -3012,11 +3010,28 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3012,11 +3010,28 @@ int32 field::process_battle_command(uint16 step) {
core.pre_field[1] = core.attack_target->fieldid_r; core.pre_field[1] = core.attack_target->fieldid_r;
else else
core.pre_field[1] = 0; core.pre_field[1] = 0;
if(!core.units.begin()->arg1)
core.attacker->announced_cards.addcard(core.attack_target);
return FALSE; return FALSE;
} }
case 7: { case 7: {
if(!core.units.begin()->arg1) {
core.phase_action = TRUE;
if(core.chain_attack && core.chain_attacker_id != core.attacker->fieldid) {
core.chain_attack = FALSE;
core.chain_attacker_id = 0;
}
core.attack_state_count[infos.turn_player]++;
check_card_counter(core.attacker, 5, infos.turn_player);
core.attacker->announce_count++;
if(!core.units.begin()->arg3)
core.attacker->announced_cards.addcard(core.attack_target);
}
if(core.units.begin()->arg3) {
core.chain_attack = FALSE;
core.units.begin()->step = -1;
}
return FALSE;
}
case 8: {
bool evt = false; bool evt = false;
attack_all_target_check(); attack_all_target_check();
pduel->write_buffer8(MSG_ATTACK); pduel->write_buffer8(MSG_ATTACK);
...@@ -3052,9 +3067,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3052,9 +3067,9 @@ int32 field::process_battle_command(uint16 step) {
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, 0, 0); add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, 0, 0);
return FALSE; return FALSE;
} }
case 8: { case 9: {
if(is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP) || core.attack_rollback) { if(is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP) || core.attack_rollback) {
core.units.begin()->step = 9; core.units.begin()->step = 10;
return FALSE; return FALSE;
} }
pduel->write_buffer8(MSG_HINT); pduel->write_buffer8(MSG_HINT);
...@@ -3070,14 +3085,14 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3070,14 +3085,14 @@ int32 field::process_battle_command(uint16 step) {
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, 0, 0); add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, 0, 0);
return FALSE; return FALSE;
} }
case 9: { case 10: {
if(returns.ivalue[0]) if(returns.ivalue[0])
core.units.begin()->step = 7; core.units.begin()->step = 8;
else else
adjust_all(); adjust_all();
return FALSE; return FALSE;
} }
case 10: { case 11: {
uint8 rollback = core.attack_rollback; uint8 rollback = core.attack_rollback;
bool atk_disabled = false; bool atk_disabled = false;
uint32 acon = core.attacker->attack_controler; uint32 acon = core.attacker->attack_controler;
...@@ -3146,10 +3161,12 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3146,10 +3161,12 @@ int32 field::process_battle_command(uint16 step) {
} }
return FALSE; return FALSE;
} }
case 11: { case 12: {
// answer of "replay or not" // answer of "replay or not"
if(returns.ivalue[0]) { if(returns.ivalue[0]) {
core.units.begin()->arg1 = TRUE; core.units.begin()->arg1 = TRUE;
core.units.begin()->arg3 = FALSE;
core.attack_cancelable = TRUE;
core.units.begin()->step = 3; core.units.begin()->step = 3;
return FALSE; return FALSE;
} }
......
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