Invasions should happen even if loading from save.

This commit is contained in:
Storm Dragon
2026-01-18 23:37:03 -05:00
parent 489408a181
commit 5aebd94431
4 changed files with 144 additions and 7 deletions

View File

@@ -618,6 +618,17 @@ void try_attack_barricade(Zombie@ zombie) {
play_1d_with_volume_step("sounds/enemies/zombie_hits_player.ogg", x, zombie.position, false, ZOMBIE_SOUND_VOLUME_STEP);
// Resident defense counter-attack
if (can_residents_defend()) {
int counterDamage = perform_resident_defense();
if (counterDamage > 0) {
zombie.health -= counterDamage;
if (zombie.health <= 0 && x <= BASE_END) {
screen_reader_speak("Residents killed an attacking zombie.", true);
}
}
}
if (barricade_health == 0) {
notify("The barricade has fallen!");
}
@@ -859,6 +870,17 @@ void try_attack_barricade_bandit(Bandit@ bandit) {
p.play_stationary("sounds/weapons/axe_hit.ogg", false);
}
// Resident defense counter-attack
if (can_residents_defend()) {
int counterDamage = perform_resident_defense();
if (counterDamage > 0) {
bandit.health -= counterDamage;
if (bandit.health <= 0 && x <= BASE_END) {
screen_reader_speak("Residents killed an attacking bandit.", true);
}
}
}
if (barricade_health == 0) {
notify("The barricade has fallen!");
}