Exemplo n.º 1
0
void AwardBossKill (edict_t *boss)
{
	int			i, damage, exp_points, credits;
	float		levelmod, dmgmod;
	char		*message;
	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;

		// award extra points for the player that did the most damage
		if (slot && (player == slot->player))
		{
			dmgmod = 100*(slot->damage/GetTotalBossDamage(boss));
			message = HiPrint(va("%s got a hi-damage bonus! %d damage (%.1f%c)", 
				slot->player->client->pers.netname, (int)slot->damage, dmgmod, '%'));
			gi.bprintf(PRINT_HIGH, "%s\n", message);
			exp_points *= BOSS_DAMAGE_BONUSMOD;
		}

		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;

		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);

		gi.cprintf(player, PRINT_HIGH, "You gained %d experience and %d credits!\n", exp_points, credits);
	}
}
Exemplo n.º 2
0
void Boss_ReadyPlayer (edict_t *player, edict_t *boss)
{
	char	*message;
	//gi.dprintf("DEBUG: getting player and boss ready\n");

	if (!boss || !player)
		return;

	//gi.dprintf("getting boss ready\n");

	boss->activator = player;
	boss->owner = player;
	VectorCopy(player->s.angles, boss->s.angles);
	boss->s.angles[PITCH] = 0;
	VectorCopy(player->s.origin, boss->s.origin);
	VectorCopy(player->s.old_origin, boss->s.old_origin);
	gi.linkentity(boss);

	//gi.dprintf("getting player ready\n");

	player->owner = boss;

	// make the player into a ghost
	player->svflags |= SVF_NOCLIENT;
	player->viewheight = 0;
	player->movetype = MOVETYPE_NOCLIP;
	player->solid = SOLID_NOT;
	player->takedamage = DAMAGE_NO;
	player->client->ps.gunindex = 0;
	memset (player->client->pers.inventory, 0, sizeof(player->client->pers.inventory));
	player->client->pers.weapon = NULL;

	message = HiPrint(va("A level %d boss known as %s has spawned!", boss->monsterinfo.level, player->client->pers.netname));
	gi.bprintf(PRINT_HIGH, "%s\n", message);
	//gi.dprintf("DEBUG: player and boss ready\n");
}
Exemplo n.º 3
0
void boss_spawn_tank (edict_t *ent)
{
	char	userinfo[MAX_INFO_STRING], *message;
	//edict_t	*tank;

	//gi.dprintf("boss_spawn_tank()\n");

	if (G_EntExists(ent->owner) && (ent->owner->mtype == BOSS_TANK))
	{
		message = HiPrint(va("%s got bored and left the game.", ent->client->pers.netname));
		gi.bprintf(PRINT_HIGH, "%s\n", message);
		V_Free(message);

		BecomeTE(ent->owner);
		ent->svflags &= ~SVF_NOCLIENT;
		ent->viewheight = 22;
		ent->movetype = MOVETYPE_WALK;
		ent->solid = SOLID_BBOX;
		ent->takedamage = DAMAGE_AIM;

		// recover player info
		memcpy(userinfo, ent->client->pers.userinfo, sizeof(userinfo));
		InitClientPersistant(ent->client);
		ClientUserinfoChanged(ent, userinfo);
		modify_max(ent);
		Pick_respawnweapon(ent);
		ent->owner = NULL;
		return;
	}

	CreateBoss(ent);
/*
	message = HiPrint(va("A level %d boss known as %s has spawned!", average_player_level, ent->client->pers.netname));
	gi.bprintf(PRINT_HIGH, "%s\n", message);

	// create the tank entity that the player will pilot
	tank = G_Spawn();
	tank->classname = "boss";
	tank->solid = SOLID_BBOX;
	tank->takedamage = DAMAGE_YES;
	tank->movetype = MOVETYPE_STEP;
	tank->clipmask = MASK_MONSTERSOLID;
	tank->svflags |= SVF_MONSTER;
	tank->activator = ent;
	tank->die = boss_tank_die;
	tank->think = boss_tank_think;
	tank->mass = 500;
	tank->monsterinfo.level = average_player_level;
	tank->health = TANK_INITIAL_HEALTH+TANK_ADDON_HEALTH*tank->monsterinfo.level;
	tank->max_health = tank->health;
	tank->mtype = BOSS_TANK;
	tank->pain = boss_pain;
	tank->flags |= FL_CHASEABLE; // 3.65 indicates entity can be chase cammed
	// set up pointers
	tank->owner = ent;
	ent->owner = tank;
	
	tank->s.modelindex = gi.modelindex ("models/monsters/tank/tris.md2");
	VectorSet (tank->mins, -24, -24, -16);
	VectorSet (tank->maxs, 24, 24, 64);
	tank->s.skinnum = 2; // commander skin
	VectorCopy(ent->s.angles, tank->s.angles);
	tank->s.angles[PITCH] = 0; // monsters don't use pitch
	tank->nextthink = level.time + FRAMETIME;
	VectorCopy(ent->s.origin, tank->s.origin);
	VectorCopy(ent->s.old_origin, tank->s.old_origin);

	// link up entities
	gi.linkentity(tank);
	gi.linkentity(ent);

	// make the player into a ghost
	ent->svflags |= SVF_NOCLIENT;
	ent->viewheight = 0;
	ent->movetype = MOVETYPE_NOCLIP;
	ent->solid = SOLID_NOT;
	ent->takedamage = DAMAGE_NO;
	ent->client->ps.gunindex = 0;
	memset (ent->client->pers.inventory, 0, sizeof(ent->client->pers.inventory));
	ent->client->pers.weapon = NULL;
	*/
}