"Reset" a fighter by simply spawning another in it's place.

This commit is contained in:
Steve 2016-05-30 11:59:31 +01:00
parent 3192e3153b
commit 8533f7969f
2 changed files with 17 additions and 18 deletions

View File

@ -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;
}

View File

@ -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)