diff options
author | Tremulous Test Server <tremtest@d1stkfactory> | 2015-07-05 08:59:48 +0000 |
---|---|---|
committer | Tremulous Test Server <tremtest@d1stkfactory> | 2015-07-05 08:59:48 +0000 |
commit | 81eee170fd08b98d4f6cd469a42ac9a6295fbb4d (patch) | |
tree | 4c83a6bc79847d84262e8457d76a885ec701d214 /src/game/g_combat.c | |
parent | 0918eb3bcdefd0d6ee4bd573b761454c99f032f6 (diff) |
Changed the way reward scaling works and reintroduced team,player reward factors.
Diffstat (limited to 'src/game/g_combat.c')
-rw-r--r-- | src/game/g_combat.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 397bde0..f703d83 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -191,30 +191,32 @@ float G_CamperRewardBonus( gentity_t *self ) return 1.0f; } +#define REWARDPOWER(x) pow((float)(x),g_RewardFactorPower.value) +#define REWARDSCALE(a,b) (((a) > 0.0f && (b) > 0.0f) ? (a)/(b) : 1.0f) +#define REWARDFACTOR(a,b) MIN(MAX(REWARDSCALE(REWARDPOWER(a),REWARDPOWER(b)),g_MinRewardFactor.value),g_MaxRewardFactor.value) float G_RewardScaleFactor( gentity_t *self, gentity_t *target ) { float targetScore; if( level.humanRewardScore <= 0.0f || level.alienRewardScore <= 0.0f ) return 1.0f; switch( self->client->ps.stats[ STAT_TEAM ] ) { case TEAM_ALIENS: - targetScore = level.humanRewardScore/level.alienRewardScore; + targetScore = g_TeamRewardFactor.value*REWARDFACTOR(level.humanRewardScore,level.alienRewardScore); break; case TEAM_HUMANS: - targetScore = level.alienRewardScore/level.humanRewardScore; + targetScore = g_TeamRewardFactor.value*REWARDFACTOR(level.alienRewardScore,level.humanRewardScore); break; default: return 0.0f; } if ( target->client != NULL ) { - if( self->client->ps.persistant[ PERS_SCORE ] > 0 && target->client->ps.persistant[ PERS_SCORE ] > 0) - targetScore *= pow(target->client->ps.persistant[ PERS_SCORE ],g_RewardFactorPower.value)/pow(self->client->ps.persistant[ PERS_SCORE ],g_RewardFactorPower.value); + targetScore += g_PlayerRewardFactor.value*REWARDFACTOR(target->client->ps.persistant[ PERS_SCORE ],self->client->ps.persistant[ PERS_SCORE ]); } - targetScore *= 1.0f-g_ConstantRewardFactor.value; targetScore += g_ConstantRewardFactor.value; - if (targetScore < g_MinRewardFactor.value) targetScore = g_MinRewardFactor.value; - else if (targetScore > g_MaxRewardFactor.value) targetScore = g_MaxRewardFactor.value; return targetScore; } +#undef REWARDFACTOR +#undef REWARDSCALE +#undef REWARDPOWER /* Instantly reward the current attacker */ float G_InstantRewardAttacker( gentity_t *self, gentity_t *target, float damage ) |