void AddBossExp (edict_t *attacker, edict_t *target) { int exp_points, credits; float levelmod; edict_t *boss; //if (!pvb->value) // return; attacker = G_GetClient(attacker); if (!IsBossTeam(attacker)) return; target = G_GetClient(target); if (!target) return; boss = attacker->owner; levelmod = (((float)target->myskills.level+1) / ((float)boss->monsterinfo.level+1)); exp_points = levelmod*PVB_BOSS_FRAG_EXP; credits = levelmod*PVB_BOSS_FRAG_CREDITS; // award points and credits /* attacker->myskills.experience += exp_points; attacker->client->resp.score += exp_points; vrx_check_for_levelup(attacker); */ attacker->myskills.credits += credits; V_AddFinalExp(attacker, exp_points); }
int AddAllyExp (edict_t *ent, int exp) { int i, allies=0; edict_t *cl_ent; // get number of players allied with us allies = numAllies(ent); if (!allies) return 0; // divide experience evenly among allies exp /= allies+1; // award points to allies for (i=0 ; i<game.maxclients ; i++) { cl_ent = g_edicts+1+i; if (!cl_ent->inuse) continue; if (cl_ent->teamnum != ent->teamnum) continue; if (cl_ent->health < 0) continue; if (G_IsSpectator(cl_ent)) continue; if (cl_ent->flags & FL_CHATPROTECT) continue; V_AddFinalExp(cl_ent, exp); } //V_AddFinalExp(ent, exp); return exp; }
void INV_AwardPlayers (void) { int i, points, credits, num_spawns = INV_GetNumPlayerSpawns(), num_winners = 0; edict_t *player; // we're not in invasion mode if (!INVASION_OTHERSPAWNS_REMOVED) return; // if map didn't end normally, don't award points if (level.time < timelimit->value*60) return; // no award if the humans were unable to defend their spawns if (num_spawns < 1) return; for (i=0; i<game.maxclients; i++) { player = g_edicts+1+i; if (!player->inuse) continue; if (invasion->value == 2) points = player->client->resp.score*((float)num_spawns/invasion_max_playerspawns) + 500 * invasion_difficulty_level; else points = player->client->resp.score*((float)num_spawns/invasion_max_playerspawns); if (invasion->value == 1 && points > INVASION_BONUS_EXP) points = INVASION_BONUS_EXP; //points = INVASION_BONUS_EXP*((float)num_spawns/invasion_max_playerspawns); if (invasion->value < 2) credits = INVASION_BONUS_CREDITS*((float)num_spawns/invasion_max_playerspawns); else credits = INVASION_BONUS_CREDITS*((float)num_spawns/invasion_max_playerspawns) + 1000 * invasion_difficulty_level; // gi.dprintf("points=%d credits=%d spawns=%d max=%d\n", // points, credits, num_spawns, invasion_max_playerspawns); if (!G_IsSpectator(player)) { int fexp = V_AddFinalExp(player, points); player->myskills.credits += credits; safe_cprintf(player, PRINT_MEDIUM, "Earned %d exp and %d credits!\n", fexp, credits); if (player->client && player->client->pers.score) // we've been here for a while at least num_winners++; } } if (num_winners) gi.bprintf(PRINT_HIGH, "Humans win! Players were awarded a bonus.\n"); }
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 dom_awardpoints (void) { int i, points, credits; edict_t *cl_ent; // flag has not been captured if (!DEFENSE_TEAM) return; FLAG_FRAMES++; // record frames flag has been captured // if (!(FLAG_FRAMES % 10)) // gi.dprintf("frames %d\n", FLAG_FRAMES); if (level.framenum % DOMINATION_AWARD_FRAMES) return; // not enough players if (total_players() < DOMINATION_MINIMUM_PLAYERS) return; for (i=0 ; i<game.maxclients ; i++) { cl_ent = g_edicts+1+i; //if (G_EntIsAlive(cl_ent) && (cl_ent->teamnum == DEFENSE_TEAM)) if (cl_ent && cl_ent->inuse && cl_ent->client && (cl_ent->health>0) && !G_IsSpectator(cl_ent) && (cl_ent->teamnum==DEFENSE_TEAM)) { points = DOMINATION_POINTS; credits = DOMINATION_CREDITS; // flag carrier gets extra points if (cl_ent->client->pers.inventory[flag_index]) { points *= 3; credits *= 3; } /* cl_ent->myskills.experience += points; cl_ent->client->resp.score += points; check_for_levelup(cl_ent); */ cl_ent->myskills.credits += credits; V_AddFinalExp(cl_ent, points); } } }
void TBI_AwardTeam(int Teamnum, int exp, qboolean Broadcast) { edict_t *cl_ent; int i_maxclients = maxclients->value; if (TBI_CountActivePlayers() < 4) // we can't give experience if there's not enough active players return; for (cl_ent = g_edicts + 1; cl_ent != g_edicts + i_maxclients + 1; cl_ent++) { if (!G_IsSpectator(cl_ent) && cl_ent->client && cl_ent->inuse) { if (cl_ent->teamnum == Teamnum) V_AddFinalExp(cl_ent, exp); cl_ent->myskills.credits += exp * 2 / 3; // 2/3s the exp. } } if (Broadcast) gi.bprintf(PRINT_HIGH, "Awarded team %s a total of %d experience points and %d credits!\n", Teamnum == RED_TEAM ? "Red" : "Blue", exp, exp * 2 / 3); }
void dom_fragaward (edict_t *attacker, edict_t *target) { int points = DOMINATION_FRAG_POINTS; float dist; edict_t *carrier, *targ; targ = target; // this could possibly be a non-client entity attacker = G_GetClient(attacker); target = G_GetClient(target); if (!DEFENSE_TEAM) return; if (FLAG_FRAMES < 100) return; // flag must be captured for at least 10 seconds //if (!G_EntExists(attacker) || !G_EntExists(target)) // return; // basic sanity checks if (!attacker || !attacker->inuse || G_IsSpectator(attacker) || !target || !target->inuse || G_IsSpectator(target)) return; if (attacker == target) return; if (attacker->health < 1) return; if (((carrier = dom_flagcarrier()) != NULL) && (carrier != attacker)) { dist = entdist(carrier, targ); if (OnSameTeam(attacker, carrier)) { // if we are on the same team as the flag carrier and the // enemy was close to the carrier, then award a bonus for // protecting the flag if (dist <= DOMINATION_DEFEND_RANGE) { gi.bprintf(PRINT_HIGH, "%s defends the flag carrier!\n", attacker->client->pers.netname); points = DOMINATION_DEFEND_BONUS; gi.sound(carrier, CHAN_ITEM, gi.soundindex("speech/excelent.wav"), 1, ATTN_NORM, 0); } } else if (carrier == targ) { // award a bonus for killing the flag carrier gi.bprintf(PRINT_HIGH, "%s kills the flag carrier!\n", attacker->client->pers.netname); points = DOMINATION_CARRIER_BONUS; gi.sound(attacker, CHAN_ITEM, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NORM, 0); } else if (dist <= DOMINATION_DEFEND_RANGE) { // award a bonus for killing flag defense gi.bprintf(PRINT_HIGH, "%s kills a defender!\n", attacker->client->pers.netname); points = DOMINATION_OFFENSE_BONUS; gi.sound(attacker, CHAN_ITEM, gi.soundindex("speech/idoasskk.wav"), 1, ATTN_NORM, 0); } } else if (attacker->teamnum == DEFENSE_TEAM) return; // no further bonuses available for defense team /* attacker->myskills.experience += points; attacker->client->resp.score += points; check_for_levelup(attacker); */ V_AddFinalExp(attacker, points); }