Suspicion check updates. Allow player to bank 25% suspicion for working fast.

This commit is contained in:
Steve 2017-06-22 07:56:40 +01:00
parent 61bf77b288
commit 967aff3092
1 changed files with 15 additions and 9 deletions

View File

@ -39,6 +39,7 @@ static int targetOutOfRange(void);
static void rechargeBoostECM(void);
static void setPilotName(void);
static void updateDeathStats(void);
static void handleSuspicionLevel(void);
static int selectedPlayerIndex;
static int availableGuns[BT_MAX];
@ -139,6 +140,8 @@ void doPlayer(void)
handleMouse();
handleSuspicionLevel();
if (!player->target || player->target->health <= 0 || player->target->systemPower <= 0 || targetOutOfRange())
{
selectTarget();
@ -353,15 +356,9 @@ static void handleMouse(void)
fireRocket(player);
}
if (battle.hasSuspicionLevel)
if (battle.hasSuspicionLevel && !battle.numEnemies && !battle.suspicionCoolOff)
{
if (!battle.numEnemies && !battle.suspicionCoolOff)
{
battle.suspicionLevel += (MAX_SUSPICION_LEVEL * 0.05);
}
/* don't allow the suspicion level to drop too far */
battle.suspicionLevel = MAX(battle.suspicionLevel, -(MAX_SUSPICION_LEVEL * 0.1));
battle.suspicionLevel += (MAX_SUSPICION_LEVEL * 0.05);
}
}
@ -558,7 +555,7 @@ static void activateECM(void)
battle.stats[STAT_ECM]++;
if (battle.hasSuspicionLevel && !battle.numEnemies)
if (battle.hasSuspicionLevel && !battle.numEnemies && !battle.suspicionCoolOff)
{
battle.suspicionLevel += (MAX_SUSPICION_LEVEL * 0.25);
}
@ -755,6 +752,15 @@ int playerHasGun(int type)
return availableGuns[type];
}
static void handleSuspicionLevel(void)
{
if (battle.hasSuspicionLevel)
{
/* don't allow the suspicion level to drop too far */
battle.suspicionLevel = MAX(battle.suspicionLevel, -(MAX_SUSPICION_LEVEL * 0.25));
}
}
void loadPlayer(cJSON *node)
{
char *type;