Commit 62b1ed73 authored by salix5's avatar salix5

ACTIVITY_ATTACK

ACTIVITY_ATTACK
The binary counter for 'cannot attack' oath effect.
The player may break this condition when:
1. atttack announce in battle step
2. attack made by card effect(Ex. Dice Roll Battle)
parent 5809f717
...@@ -438,7 +438,7 @@ public: ...@@ -438,7 +438,7 @@ public:
int32 process_single_event(); int32 process_single_event();
int32 process_idle_command(uint16 step); int32 process_idle_command(uint16 step);
int32 process_battle_command(uint16 step); int32 process_battle_command(uint16 step);
int32 process_damage_step(uint16 step); int32 process_damage_step(uint16 step, uint32 new_attack);
void calculate_battle_damage(effect** pdamchange, card** preason_card, uint8* battle_destroyed); void calculate_battle_damage(effect** pdamchange, card** preason_card, uint8* battle_destroyed);
int32 process_turn(uint16 step, uint8 turn_player); int32 process_turn(uint16 step, uint8 turn_player);
......
...@@ -1210,7 +1210,6 @@ int32 scriptlib::duel_change_attack_target(lua_State *L) { ...@@ -1210,7 +1210,6 @@ int32 scriptlib::duel_change_attack_target(lua_State *L) {
else else
pduel->game_field->core.opp_mzone[i] = 0; pduel->game_field->core.opp_mzone[i] = 0;
} }
pduel->game_field->check_card_counter(pduel->game_field->core.attacker, 5, pduel->game_field->infos.turn_player);
pduel->game_field->attack_all_target_check(); pduel->game_field->attack_all_target_check();
if(target) { if(target) {
pduel->game_field->raise_single_event(target, 0, EVENT_BE_BATTLE_TARGET, 0, REASON_REPLACE, 0, 1 - turnp, 0); pduel->game_field->raise_single_event(target, 0, EVENT_BE_BATTLE_TARGET, 0, REASON_REPLACE, 0, 1 - turnp, 0);
...@@ -1235,9 +1234,12 @@ int32 scriptlib::duel_calculate_damage(lua_State *L) { ...@@ -1235,9 +1234,12 @@ int32 scriptlib::duel_calculate_damage(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 2); check_param(L, PARAM_TYPE_CARD, 2);
card* attacker = *(card**)lua_touserdata(L, 1); card* attacker = *(card**)lua_touserdata(L, 1);
card* attack_target = *(card**)lua_touserdata(L, 2); card* attack_target = *(card**)lua_touserdata(L, 2);
int32 new_attack = FALSE;
if(lua_gettop(L) >= 3)
new_attack = lua_toboolean(L, 3);
if(attacker == attack_target) if(attacker == attack_target)
return 0; return 0;
attacker->pduel->game_field->add_process(PROCESSOR_DAMAGE_STEP, 0, (effect*)attacker, (group*)attack_target, 0, 0); attacker->pduel->game_field->add_process(PROCESSOR_DAMAGE_STEP, 0, (effect*)attacker, (group*)attack_target, 0, new_attack);
return lua_yield(L, 0); return lua_yield(L, 0);
} }
int32 scriptlib::duel_get_battle_damage(lua_State *L) { int32 scriptlib::duel_get_battle_damage(lua_State *L) {
......
...@@ -233,7 +233,7 @@ int32 field::process() { ...@@ -233,7 +233,7 @@ int32 field::process() {
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_DAMAGE_STEP: { case PROCESSOR_DAMAGE_STEP: {
if(process_damage_step(it->step)) if(process_damage_step(it->step, it->arg2))
core.units.pop_front(); core.units.pop_front();
else else
it->step++; it->step++;
...@@ -2872,6 +2872,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2872,6 +2872,7 @@ int32 field::process_battle_command(uint16 step) {
core.pre_field[0] = core.attacker->fieldid_r; core.pre_field[0] = core.attacker->fieldid_r;
core.phase_action = TRUE; core.phase_action = TRUE;
core.attack_state_count[infos.turn_player]++; core.attack_state_count[infos.turn_player]++;
check_card_counter(core.attacker, 5, infos.turn_player);
core.attacker->announce_count++; 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);
...@@ -2998,7 +2999,6 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2998,7 +2999,6 @@ int32 field::process_battle_command(uint16 step) {
} }
case 7: { case 7: {
bool evt = false; bool evt = false;
check_card_counter(core.attacker, 5, infos.turn_player);
attack_all_target_check(); attack_all_target_check();
pduel->write_buffer8(MSG_ATTACK); pduel->write_buffer8(MSG_ATTACK);
pduel->write_buffer32(core.attacker->get_info_location()); pduel->write_buffer32(core.attacker->get_info_location());
...@@ -3603,7 +3603,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3603,7 +3603,7 @@ int32 field::process_battle_command(uint16 step) {
return TRUE; return TRUE;
} }
// perform damage calculation by an effect // perform damage calculation by an effect
int32 field::process_damage_step(uint16 step) { int32 field::process_damage_step(uint16 step, uint32 new_attack) {
switch(step) { switch(step) {
case 0: { case 0: {
core.effect_damage_step = 1; core.effect_damage_step = 1;
...@@ -3618,7 +3618,10 @@ int32 field::process_damage_step(uint16 step) { ...@@ -3618,7 +3618,10 @@ int32 field::process_damage_step(uint16 step) {
core.units.begin()->step = 2; core.units.begin()->step = 2;
return FALSE; return FALSE;
} }
check_card_counter(core.attacker, 5, infos.turn_player); if(new_attack){
core.attack_state_count[infos.turn_player]++;
check_card_counter(core.attacker, 5, infos.turn_player);
}
attack_all_target_check(); attack_all_target_check();
pduel->write_buffer8(MSG_ATTACK); pduel->write_buffer8(MSG_ATTACK);
pduel->write_buffer32(core.attacker->get_info_location()); pduel->write_buffer32(core.attacker->get_info_location());
......
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