diff options
author | Tim Angus <tim@ngus.net> | 2004-07-28 12:52:20 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2004-07-28 12:52:20 +0000 |
commit | 266d6696eb0659065bd9d605f91dd4e2e72eabe0 (patch) | |
tree | 7787ec7462c762726a18da20f6102d6fc5454d2f /src/game/g_combat.c | |
parent | 8ff374ee05dc117e2f9d195969a0b7444954025f (diff) |
* Most of the changes in the forum thread "Shake up"
Diffstat (limited to 'src/game/g_combat.c')
-rw-r--r-- | src/game/g_combat.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 0714eb8b..b90adde4 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -243,13 +243,10 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int else if( attacker->s.eType != ET_BUILDABLE ) AddScore( self, -1 ); - if( attacker && attacker->client && - attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && - self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + if( attacker && attacker->client ) { int clientNum = attacker->client->ps.clientNum; float denominator, numerator = self->credits[ clientNum ]; - int classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] ); int total = 0; gentity_t *player; @@ -263,27 +260,34 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int { player = g_entities + i; - if( player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && + player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { + int classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] ); numerator = self->credits[ i ]; //add credit - player->client->ps.persistant[ PERS_CREDIT ] += (int)( (float)classValue * ( numerator / denominator ) ); + player->client->ps.persistant[ PERS_CREDIT ] += + (int)( (float)classValue * ( numerator / denominator ) ); if( player->client->ps.persistant[ PERS_CREDIT ] > HUMAN_MAX_CREDITS ) player->client->ps.persistant[ PERS_CREDIT ] = HUMAN_MAX_CREDITS; } + else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && + player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + int classValue = BG_GetValueOfHuman( self->client->ps ); + numerator = self->credits[ i ]; + + //add kills + player->client->ps.persistant[ PERS_CREDIT ] += + (int)round( (float)classValue * ( numerator / denominator ) ); + + if( player->client->ps.persistant[ PERS_CREDIT ] > ALIEN_MAX_KILLS ) + player->client->ps.persistant[ PERS_CREDIT ] = ALIEN_MAX_KILLS; + } } } - else if( attacker && attacker->client && - attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && - self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - { - attacker->client->ps.persistant[ PERS_CREDIT ]++; - - if( attacker->client->ps.persistant[ PERS_CREDIT ] > ALIEN_MAX_KILLS ) - attacker->client->ps.persistant[ PERS_CREDIT ] = ALIEN_MAX_KILLS; - } // Add team bonuses //Team_FragBonuses(self, inflictor, attacker); @@ -1030,9 +1034,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } //TA: add to the attackers "account" on the target - if( targ->client && attacker->client && - targ->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && - attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + if( targ->client && attacker->client ) targ->credits[ attacker->client->ps.clientNum ] += take; if( targ->health <= 0 ) |