From 8533f7969f2ab1b0cc4a19990e7bf0c08bc983dd Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 30 May 2016 11:59:31 +0100 Subject: [PATCH] "Reset" a fighter by simply spawning another in it's place. --- src/battle/entities.c | 12 +++++------- src/battle/fighters.c | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/battle/entities.c b/src/battle/entities.c index 30a7b64..1ad5812 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -192,16 +192,14 @@ void doEntities(void) e->next = NULL; - /* Move to end of entity queue if unlimited epic enemies. Otherwise, in dead list */ - if (battle.isEpic && e->side != player->side && battle.unlimitedEnemies) + deadTail->next = e; + deadTail = e; + + /* actually just creates another fighter in this one's place */ + if (e->type == ET_FIGHTER && battle.isEpic && e->side != player->side && battle.unlimitedEnemies) { resetFighter(e); } - else - { - deadTail->next = e; - deadTail = e; - } e = prev; } diff --git a/src/battle/fighters.c b/src/battle/fighters.c index ba7a2ae..8fbf110 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -190,20 +190,21 @@ static void randomizeDartGuns(Entity *dart) } } -void resetFighter(Entity *e) +void resetFighter(Entity *fighter) { + Entity *e; + + e = spawnFighter(fighter->defName, fighter->x, fighter->y, fighter->side); + + e->x += (rand() % 7500) - (rand() % 7500); + e->y += (rand() % 7500) - (rand() % 7500); + e->active = 0; - e->health = e->maxHealth; - e->systemPower = MAX_SYSTEM_POWER; - e->alive = ALIVE_ALIVE; - e->action = doAI; - e->die = die; - e->next = NULL; - - battle.entityTail->next = e; - - SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resetting fighter '%s'", e->name); + if (rand() % 4) + { + e->aiFlags |= AIF_TARGET_FOCUS; + } } void doFighter(void)