diff --git a/src/battle/ai.c b/src/battle/ai.c index f57627b..e7eeaa7 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -130,17 +130,17 @@ static void doFighterAI(void) self->targetLocation.x = self->target->x + rand() % 500 - rand() % 500; self->targetLocation.y = self->target->y + rand() % 500 - rand() % 500; self->action = evade; - self->aiActionTime = FPS; + self->aiActionTime = FPS * 2; } else if (r <= getActionChance(AI_BOOST)) { self->action = boost; - self->aiActionTime = FPS / 2; + self->aiActionTime = FPS; } else if (r <= getActionChance(AI_FALLBACK)) { self->action = fallback; - self->aiActionTime = FPS / 2; + self->aiActionTime = FPS * 2; } else if (r <= getActionChance(AI_STRAIGHT)) { @@ -155,7 +155,7 @@ static void doFighterAI(void) else { self->action = huntAndAttackTarget; - self->aiActionTime = FPS; + self->aiActionTime = FPS * 3; } } @@ -164,19 +164,19 @@ static int getActionChance(int type) switch (type) { case AI_EVADE: - return 20 - (self->aiAggression * 3); + return 25 - (self->aiAggression * 3); case AI_BOOST: - return 30 - (self->aiAggression * 4); + return 40 - (self->aiAggression * 4); case AI_FALLBACK: - return 40 - (self->aiAggression * 5); + return 55 - (self->aiAggression * 5); case AI_STRAIGHT: - return 50 - (self->aiAggression * 6); + return 70 - (self->aiAggression * 6); case AI_HUNT: - return 60 - (self->aiAggression * 7); + return 85 - (self->aiAggression * 7); } return 100; diff --git a/src/battle/fighters.c b/src/battle/fighters.c index a7474dc..647b9cb 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -51,7 +51,7 @@ Entity *spawnFighter(char *name, int x, int y, int side) switch (side) { case SIDE_ALLIES: - f->aiAggression = 2 + rand() % 3; + f->aiAggression = rand() % 3; f->aiFlags |= AIF_FOLLOWS_PLAYER; if (!(f->aiFlags & AIF_AVOIDS_COMBAT)) { @@ -421,7 +421,13 @@ void damageFighter(Entity *f, int amount, long flags) { if (f->shield > 0) { - f->shield = MAX(0, f->shield - amount); + f->shield -= amount; + + if (f->shield < 0) + { + f->health += f->shield; + f->shield = 0; + } } else { diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 1ffeb1b..7926e3d 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -50,8 +50,8 @@ void loadMission(char *filename) battle.background = getTexture(cJSON_GetObjectItem(root, "background")->valuestring); battle.planetTexture = getTexture(cJSON_GetObjectItem(root, "planet")->valuestring); - battle.planet.x = rand() % SCREEN_WIDTH - rand() % SCREEN_WIDTH; - battle.planet.y = rand() % SCREEN_HEIGHT - rand() % SCREEN_HEIGHT; + battle.planet.x = ((200 + rand() % 100) / 10) * GRID_CELL_WIDTH; + battle.planet.y = ((200 + rand() % 100) / 10) * GRID_CELL_HEIGHT; loadObjectives(cJSON_GetObjectItem(root, "objectives"));