Exemplo n.º 1
0
/*
============
Killed
============
*/
void Killed (edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
	if (targ->health < -999)
		targ->health = -999;

	targ->enemy = attacker;

	if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD))
	{
//		targ->svflags |= SVF_DEADMONSTER;	// now treat as a different content type
		if (!(targ->monsterinfo.aiflags & AI_GOOD_GUY))
		{
			level.killed_monsters++;
			if (coop->value && attacker->client)
				attacker->client->resp.score++;
			// medics won't heal monsters that they kill themselves
			if (strcmp(attacker->classname, "monster_medic") == 0)
				targ->owner = attacker;
		}
	}

	if (targ->movetype == MOVETYPE_PUSH || targ->movetype == MOVETYPE_STOP || targ->movetype == MOVETYPE_NONE)
	{	// doors, triggers, etc
		targ->die (targ, inflictor, attacker, damage, point);
		return;
	}

	if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD))
	{
		targ->touch = NULL;
		monster_death_use (targ);
	}

	targ->die (targ, inflictor, attacker, damage, point);
}
Exemplo n.º 2
0
void
Killed(edict_t *targ, edict_t *inflictor, edict_t *attacker,
		int damage, vec3_t point)
{
	if (!targ || !inflictor || !attacker)
	{
		return;
	}

	if (targ->health < -999)
	{
		targ->health = -999;
	}

	targ->enemy = attacker;

	if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD))
	{
		if (!(targ->monsterinfo.aiflags & AI_GOOD_GUY))
		{
			level.killed_monsters++;

			if (coop->value && attacker->client)
			{
				attacker->client->resp.score++;
			}

			/* medics won't heal monsters that they kill themselves */
			if (strcmp(attacker->classname, "monster_medic") == 0)
			{
				targ->owner = attacker;
			}
		}
	}

	if ((targ->movetype == MOVETYPE_PUSH) ||
		(targ->movetype == MOVETYPE_STOP) ||
	   	(targ->movetype == MOVETYPE_NONE))
	{
		/* doors, triggers, etc */
		targ->die(targ, inflictor, attacker, damage, point);
		return;
	}

	if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD))
	{
		targ->touch = NULL;
		monster_death_use(targ);
	}

	targ->die(targ, inflictor, attacker, damage, point);
}
Exemplo n.º 3
0
Arquivo: combat.c Projeto: meag/ktx
/*
============
Killed
============
*/
void Killed( gedict_t * targ, gedict_t * attacker, gedict_t * inflictor )
{
	gedict_t       *oself;

	oself = self;
	self = targ;

	if ( self->s.v.health < -99 )
		self->s.v.health = -99;	// don't let sbar look bad if a player

    self->dead_time = g_globalvars.time;

	if ( self->ct == ctPlayer )
	{
		; // empty
	}
	else if ( self->s.v.movetype == MOVETYPE_PUSH || self->s.v.movetype == MOVETYPE_NONE )
	{			// doors, triggers, etc
		if ( self->th_die )
			self->th_die();

		self = oself;
		return;
	}

	self->s.v.enemy = EDICT_TO_PROG( attacker );

	// bump the monster counter
	if ( ( ( int ) ( self->s.v.flags ) ) & FL_MONSTER )
	{
		float resp_time = bound( 0, cvar( "k_monster_spawn_time"), 999999 );

		// for nightmare mode
		self->monster_desired_spawn_time = ( resp_time ? g_globalvars.time + resp_time + resp_time * g_random() * 0.5 : 0 );

		g_globalvars.killed_monsters++;
		WriteByte( MSG_ALL, SVC_KILLEDMONSTER );

		// in coop, killing a monster gives you a frag
		if ( coop )
		{
			if ( attacker->ct == ctPlayer )
				attacker->s.v.frags++;
		}
	}

	ClientObituary( self, attacker );

	self->s.v.takedamage = DAMAGE_NO;
	self->s.v.touch = ( func_t ) SUB_Null;
	self->s.v.effects = 0;

	monster_death_use();

	if ( self->th_die )
		self->th_die();

	self = oself;

	// KTEAMS: check if sudden death is the case
	Check_SD( targ );

	// check fraglimit
	if (	fraglimit
		&& (   ( targ->s.v.frags >= fraglimit && targ->ct == ctPlayer )
			|| ( attacker->s.v.frags >= fraglimit && attacker->ct == ctPlayer )
		   )
		)
		EndMatch( 0 );

	if ( k_bloodfest )
		bloodfest_killed_hook( targ, attacker );
}
Exemplo n.º 4
0
/*
============
Killed
============
*/
void Killed (edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
    if (targ->health < -999)
        targ->health = -999;

    if (targ->monsterinfo.aiflags & AI_MEDIC)
    {
        if (targ->enemy)  // god, I hope so
        {
            cleanupHealTarget (targ->enemy);
        }

        // clean up self
        targ->monsterinfo.aiflags &= ~AI_MEDIC;
        targ->enemy = attacker;
    }
    else
    {
        targ->enemy = attacker;
    }

    if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD))
    {
        //ROGUE - free up slot for spawned monster if it's spawned
        if (targ->monsterinfo.aiflags & AI_SPAWNED_CARRIER)
        {
            if (targ->monsterinfo.commander && targ->monsterinfo.commander->inuse &&
                    !strcmp(targ->monsterinfo.commander->classname, "monster_carrier"))
            {
                targ->monsterinfo.commander->monsterinfo.monster_slots++;
            }
        }
        if (targ->monsterinfo.aiflags & AI_SPAWNED_MEDIC_C)
        {
            if (targ->monsterinfo.commander)
            {
                if (targ->monsterinfo.commander->inuse && !strcmp(targ->monsterinfo.commander->classname, "monster_medic_commander"))
                {
                    targ->monsterinfo.commander->monsterinfo.monster_slots++;
                }
            }

        }
        if (targ->monsterinfo.aiflags & AI_SPAWNED_WIDOW)
        {
            // need to check this because we can have variable numbers of coop players
            if (targ->monsterinfo.commander && targ->monsterinfo.commander->inuse &&
                    !strncmp(targ->monsterinfo.commander->classname, "monster_widow", 13))
            {
                if (targ->monsterinfo.commander->monsterinfo.monster_used > 0)
                    targ->monsterinfo.commander->monsterinfo.monster_used--;
            }
        }
        //rogue
        if ((!(targ->monsterinfo.aiflags & AI_GOOD_GUY)) && (!(targ->monsterinfo.aiflags & AI_DO_NOT_COUNT)))
        {
            level.killed_monsters++;
            if (coop->value && attacker->client)
                attacker->client->resp.score++;
        }
    }

    if (targ->movetype == MOVETYPE_PUSH || targ->movetype == MOVETYPE_STOP || targ->movetype == MOVETYPE_NONE)
    {   // doors, triggers, etc
        targ->die (targ, inflictor, attacker, damage, point);
        return;
    }

    if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD))
    {
        targ->touch = NULL;
        monster_death_use (targ);
    }

    targ->die (targ, inflictor, attacker, damage, point);
}
Exemplo n.º 5
0
void Killed (edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) {
//	if ((targ->client) && (targ->health < -999))
//		targ->health = -999;

	if (!(targ->svflags & SVF_MONSTER) || (attacker->client))
		targ->enemy = attacker;

	if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD)) {
		if (targ->monsterinfo.ability & GIEX_MABILITY_STEALTH) {
			removeStealth();
		}
		targ->svflags |= SVF_DEADMONSTER;	// now treat as a different content type
		if (!(targ->monsterinfo.aiflags & AI_GOOD_GUY)) {
			level.killed_monsters++;

			if (coop->value && (level.killed_monsters == level.total_monsters)) {
				gi.bprintf(PRINT_HIGH, "All monsters killed, %d bonus exp awarded!\n", 1000 + 100 * level.total_monsters);
				giveExpToAll(1000 + 100 * level.total_monsters);
			}
//			if (coop->value && attacker->client)
//				attacker->client->resp.score++;
			// medics won't heal monsters that they kill themselves
			if (attacker->classid == CI_M_MEDIC)
				targ->owner = attacker;
		}
	}

	if (targ->movetype == MOVETYPE_PUSH || targ->movetype == MOVETYPE_STOP || targ->movetype == MOVETYPE_NONE)
	{	// doors, triggers, etc
		targ->die (targ, inflictor, attacker, damage, point);
		return;
	}

	if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD)) {
		targ->touch = NULL;
		monster_death_use (targ);
	}
	if ((targ->classid != CI_CORPSESPORE) && (targ->classid != CI_GIBRAIN) && (targ->classid != CI_PIZZAGIB) && (targ->classid, CI_M_INSANE) && (targ->deadflag != DEAD_DEAD)) { // Insane should never spawn ammo or powerups
//		gi.dprintf("Calling ammo and powerup spawn for %s\n", targ->classname);

		if ((game.monsterhunt == 10) && (targ->svflags & SVF_MONSTER)) {
			if (targ->classid != CI_M_JORG) { // You don't get any from Jorg...
				int i, num_players = 0;
				edict_t *ent;

				for (i=0 ; i<maxclients->value ; i++) {
					ent = g_edicts + 1 + i;
					if (!ent->inuse)
						continue;
					if (!ent->client->pers.loggedin)
						continue;
					num_players++;
				}
				if (num_players > 0) {
					for (i = 0; i < num_players; i++) {
						spawnAmmo(targ, attacker);
						spawnItem(targ, attacker);
						spawnPowerup(targ, attacker);
					}
				}
			}
		} else {
			spawnAmmo(targ, attacker);
			spawnItem(targ, attacker);
			spawnPowerup(targ, attacker);
		}

		if (targ->client) {
			if (attacker->client) {
				if (targ->radius_dmg > attacker->radius_dmg) {
					targ->client->pers.skills.stats[GIEX_STAT_LOWER_PLAYER_DEATHS]++;
					attacker->client->pers.skills.stats[GIEX_STAT_HIGHER_PLAYER_KILLS]++;
				} else {
					targ->client->pers.skills.stats[GIEX_STAT_HIGHER_PLAYER_DEATHS]++;
					attacker->client->pers.skills.stats[GIEX_STAT_LOWER_PLAYER_KILLS]++;
				}
			} else if (attacker->svflags & SVF_MONSTER) {
				targ->client->pers.skills.stats[GIEX_STAT_MONSTER_DEATHS]++;
			} else {
				targ->client->pers.skills.stats[GIEX_STAT_OTHER_DEATHS]++;
			}
		} else if ((targ->svflags & SVF_MONSTER) && (attacker->client)) {
			if (targ->monsterinfo.skill < 8) {
				attacker->client->pers.skills.stats[GIEX_STAT_LOW_MONSTER_KILLS]++;
			} else if (targ->monsterinfo.skill < 16) {
				attacker->client->pers.skills.stats[GIEX_STAT_MED_MONSTER_KILLS]++;
			} else if (targ->monsterinfo.skill < 24) {
				attacker->client->pers.skills.stats[GIEX_STAT_HI_MONSTER_KILLS]++;
			} else {
				attacker->client->pers.skills.stats[GIEX_STAT_VHI_MONSTER_KILLS]++;
			}
		}
	}

	targ->die (targ, inflictor, attacker, damage, point);
}