diff --git a/src/battle/ai.c b/src/battle/ai.c index d254768..1da16aa 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -993,6 +993,10 @@ void checkSuspicionLevel(void) addMessageBox(self->name, "Intruder alert! We have an intruder! All units, target and destroy that fighter!", MB_PANDORAN); addMessageBox(player->name, _("Hell! My cover's been blown, they're on to me!"), MB_IMPORTANT); + + destroyScript(); + + activateTrespasserSpawner(); } } } diff --git a/src/battle/ai.h b/src/battle/ai.h index 8d17606..9342aa4 100644 --- a/src/battle/ai.h +++ b/src/battle/ai.h @@ -40,6 +40,8 @@ extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore); extern char *getTranslatedString(char *string); extern Entity *spawnMine(int type); extern void addMessageBox(char *title, char *body, int type); +extern void destroyScript(void); +extern void activateTrespasserSpawner(void); extern Battle battle; extern Colors colors; diff --git a/src/battle/spawners.c b/src/battle/spawners.c index 6f50dad..38bea25 100644 --- a/src/battle/spawners.c +++ b/src/battle/spawners.c @@ -123,9 +123,31 @@ void activateSpawner(char *name, int active) } } +void activateTrespasserSpawner(void) +{ + Spawner *s; + char types[MAX_DESCRIPTION_LENGTH]; + + s = malloc(sizeof(Spawner)); + memset(s, 0, sizeof(Spawner)); + battle.spawnerTail->next = s; + battle.spawnerTail = s; + + STRNCPY(types, "Jackal;Mantis;Sphinx;Scarab", MAX_DESCRIPTION_LENGTH); + + s->types = toTypeArray(types, &s->numTypes); + s->side = SIDE_PANDORAN; + s->interval = 5 * FPS; + s->total = -1; + s->step = 5; + s->offscreen = 1; + s->active = 1; + STRNCPY(s->flags, "+EF_IMMORTAL", MAX_DESCRIPTION_LENGTH); + STRNCPY(s->aiFlags, "+AIF_UNLIMITED_RANGE", MAX_DESCRIPTION_LENGTH); +} + void loadSpawners(cJSON *node) { - int active; Spawner *s; if (node) @@ -146,7 +168,7 @@ void loadSpawners(cJSON *node) s->total = getJSONValue(node, "total", 0); s->step = cJSON_GetObjectItem(node, "step")->valueint; s->offscreen = getJSONValue(node, "offscreen", 0); - s->active = active = getJSONValue(node, "active", 1); + s->active = getJSONValue(node, "active", 1); STRNCPY(s->flags, getJSONValueStr(node, "flags", ""), MAX_DESCRIPTION_LENGTH); STRNCPY(s->aiFlags, getJSONValueStr(node, "aiFlags", ""), MAX_DESCRIPTION_LENGTH);