void AwardBossKill (edict_t *boss) { int i, damage, exp_points, credits; float levelmod, dmgmod; edict_t *player; dmglist_t *slot=NULL; // find the player that did the most damage slot = findHighestDmgPlayer(boss); for (i=0; i<game.maxclients; i++) { player = g_edicts+1+i; if (!player->inuse) continue; levelmod = ((float)boss->monsterinfo.level+1) / ((float)player->myskills.level+1); damage = GetPlayerBossDamage(player, boss); if (damage < 1) continue; // they get nothing if they didn't touch the boss dmgmod = (float)damage / GetTotalBossDamage(boss); exp_points = levelmod*dmgmod*PVB_BOSS_EXPERIENCE; credits = levelmod*dmgmod*PVB_BOSS_CREDITS; // award extra points for the player that did the most damage if (slot && (player == slot->player)) { dmgmod = 100*(slot->damage/GetTotalBossDamage(boss)); G_PrintGreenText(va("%s got a hi-damage bonus! %d damage (%.1f%c)", slot->player->client->pers.netname, (int)slot->damage, dmgmod, '%')); exp_points *= BOSS_DAMAGE_BONUSMOD; } if (exp_points > PVB_BOSS_MAX_EXP) exp_points = PVB_BOSS_MAX_EXP; else if (exp_points < PVB_BOSS_MIN_EXP) exp_points = PVB_BOSS_MIN_EXP; player->myskills.credits += credits; V_AddFinalExp(player, exp_points); safe_cprintf(player, PRINT_HIGH, "You gained %d experience and %d credits!\n", exp_points, credits); } }
void printDmgList (edict_t *self) { int i; float percent; dmglist_t *slot; for (i=0; i < MAX_CLIENTS; i++) { slot = &self->monsterinfo.dmglist[i]; if (self->monsterinfo.dmglist[i].player) { percent = 100*(slot->damage/GetTotalBossDamage(self)); if (self->client) gi.dprintf("(%s) slot %d: %s, %.0f damage (%.1f%c)\n", self->client->pers.netname, i, slot->player->client->pers.netname, slot->damage, percent, '%'); else if (self->mtype) gi.dprintf("(%s) slot %d: %s, %.0f damage (%.1f%c)\n", V_GetMonsterName(self), i, slot->player->client->pers.netname, slot->damage, percent, '%'); else gi.dprintf("(%s) slot %d: %s, %.0f damage (%.1f%c)\n", self->classname, i, slot->player->client->pers.netname, slot->damage, percent, '%'); } } }