Beispiel #1
0
void info_player_invasion_think (edict_t *self)
{
	if (level.time > self->lasthurt + 1.0)
		M_Regenerate(self, PLAYERSPAWN_REGEN_FRAMES, PLAYERSPAWN_REGEN_DELAY,  1.0, true, false, false, &self->monsterinfo.regen_delay1);

	self->nextthink = level.time + FRAMETIME;
}
Beispiel #2
0
void p_medic_regen (edict_t *ent)
{
	int weapon_r_frames = MEDIC_HB_REGEN_FRAMES, health_r_frames = MEDIC_REGEN_FRAMES;

	// morph mastery improves ammo/health regeneration
	if (ent->myskills.abilities[MORPH_MASTERY].current_level > 0)
	{
		weapon_r_frames *= 0.5;
		health_r_frames *= 0.5;
	}

	p_medic_hb_regen(ent, weapon_r_frames, MEDIC_HB_REGEN_DELAY);
	//MorphRegenerate(ent, MEDIC_REGEN_DELAY, MEDIC_REGEN_FRAMES);
	M_Regenerate(ent, health_r_frames, MEDIC_REGEN_DELAY, 1.0, true, false, false, &ent->monsterinfo.regen_delay1);
}
Beispiel #3
0
void RunBerserkFrames (edict_t *ent, usercmd_t *ucmd)
{
	if ((ent->mtype != MORPH_BERSERK) || (ent->deadflag == DEAD_DEAD))
		return;

	ent->s.modelindex2 = 0; // no weapon model
	ent->s.skinnum = 0;

	if (level.framenum >= ent->count)
	{
		int regen_frames = qf2sf(BERSERK_REGEN_FRAMES);

		// morph mastery reduces regen time
		if (ent->myskills.abilities[MORPH_MASTERY].current_level > 0)
			regen_frames *= 0.5;

		M_Regenerate(ent, regen_frames, qf2sf(BERSERK_REGEN_DELAY),
		        1.0, true, false, false, &ent->monsterinfo.regen_delay1);
		
		// play running animation if we are moving forward or strafing
		if ((ucmd->forwardmove > 0) || (!ucmd->forwardmove && ucmd->sidemove))
		{
			if ((ent->client->buttons & BUTTON_ATTACK) && (level.time > ent->monsterinfo.attack_finished))
				p_berserk_attack(ent, BERSERK_RUN_FORWARD);
			else
				G_RunFrames(ent, BERSERK_FRAMES_RUN_START, BERSERK_FRAMES_RUN_END, false);
		}
		// play animation in reverse if we are going backwards
		else if (ucmd->forwardmove < 0)
		{
			if ((ent->client->buttons & BUTTON_ATTACK) && (level.time > ent->monsterinfo.attack_finished))
				p_berserk_attack(ent, BERSERK_RUN_BACKWARD);
			else
				G_RunFrames(ent, BERSERK_FRAMES_RUN_START, BERSERK_FRAMES_RUN_END, true);
		}
		// standing attack
		else if ((ent->client->buttons & BUTTON_ATTACK) && (level.time > ent->monsterinfo.attack_finished))
			p_berserk_attack(ent, 0);
		// play jump animation if we are off ground and not submerged in water
		else if (!ent->groundentity && (ent->waterlevel < 2))
			p_berserk_jump(ent);
		else
			G_RunFrames(ent, BERSERK_FRAMES_IDLE1_START, BERSERK_FRAMES_IDLE1_END, false); // run idle frames

		ent->count = level.framenum + qf2sf(1);
	}
}
Beispiel #4
0
void p_medic_heal (edict_t *ent)
{
	vec3_t	forward,  right, offset, start, end, org;
	trace_t	tr;

	if (!p_medic_healframe(ent))
		return;
	
	if (ent->s.frame == 218)
		gi.sound (ent, CHAN_WEAPON, gi.soundindex("medic/medatck2.wav"), 1, ATTN_NORM, 0);
	else if (ent->s.frame == 227)
		gi.sound (ent, CHAN_WEAPON, gi.soundindex("medic/medatck5.wav"), 1, ATTN_NORM, 0);

	// get muzzle location
	AngleVectors (ent->s.angles, forward, right, NULL);
	VectorCopy(p_medic_cable_offsets[ent->s.frame - 218], offset);
	G_ProjectSource(ent->s.origin, offset, forward, right, org);

	// get end position
	VectorCopy(ent->s.origin, start);
	start[2] += ent->viewheight;
	AngleVectors (ent->client->v_angle, forward, NULL, NULL);
	VectorMA(start, MEDIC_CABLE_RANGE, forward, end);

	tr = gi.trace (org, NULL, NULL, end, ent, MASK_SHOT);

	// bfg laser effect
	gi.WriteByte (svc_temp_entity);
	gi.WriteByte (TE_BFG_LASER);
	gi.WritePosition (org);
	gi.WritePosition (tr.endpos);
	gi.multicast (ent->s.origin, MULTICAST_PHS);

	if (G_EntExists(tr.ent))
	{
		// try to heal them if they are alive
		if ((tr.ent->deadflag != DEAD_DEAD) && (tr.ent->health > 0))
		{
			int frames = floattoint(600/(float)ent->myskills.abilities[MEDIC].current_level);
			
			if (!M_NeedRegen(tr.ent))
				return;

			if (ent->s.frame == 220)
				gi.sound (ent, CHAN_WEAPON, gi.soundindex ("medic/medatck4.wav"), 1, ATTN_NORM, 0);
			
			// heal them
			M_Regenerate(tr.ent, frames, 0, 1.0, true, true, false, &tr.ent->monsterinfo.regen_delay2);

			// hold monsters in-place
			if (tr.ent->svflags & SVF_MONSTER)
				tr.ent->holdtime = level.time + 0.2;

			// remove all curses
			CurseRemove(tr.ent, 0);

			//Give them a short period of curse immunity
			tr.ent->holywaterProtection = level.time + 2.0; //2 seconds immunity
		}
		else
		{
			// try to reanimate/resurrect the corpse
			p_medic_reanimate(ent, tr.ent);
		}
	}
}
Beispiel #5
0
void mymedic_cable_attack (edict_t *self)
{
	vec3_t	forward, right, start, offset, end;
	trace_t	tr;

	// need a valid target and activator
	if (!self || !self->inuse || !self->activator || !self->activator->inuse 
		|| !self->enemy || !self->enemy->inuse)
		return;

	// make sure target is still in range
	if (entdist(self, self->enemy) > 256)
		return;

	// get muzzle location
	AngleVectors(self->s.angles, forward, right, NULL);
	VectorCopy(mymedic_cable_offsets[self->s.frame - FRAME_attack42], offset);
	G_ProjectSource(self->s.origin, offset, forward, right, start);
	// get end position
	//VectorCopy(self->enemy->s.origin, end);
	//end[2] = self->enemy->absmax[2]-8;
	G_EntMidPoint(self->enemy, end);

	tr = gi.trace (start, NULL, NULL, end, self, MASK_SHOT);
	if (tr.ent != self->enemy)
		return; // cable is blocked

	// cable effect
	gi.WriteByte (svc_temp_entity);
	gi.WriteByte (TE_MEDIC_CABLE_ATTACK);
	gi.WriteShort (self - g_edicts);
	gi.WritePosition (start);
	gi.WritePosition (tr.endpos);
	gi.multicast (self->s.origin, MULTICAST_PVS);

	// the target needs healing
	if (M_NeedRegen(self->enemy))
	{
		int frames = 6000/(12*self->monsterinfo.level);

		if (!frames)
			frames = 1;

		// remove all curses
		CurseRemove(self->enemy, 0);

		//Give them a short period of curse immunity
		self->enemy->holywaterProtection = level.time + 2.0; //2 seconds immunity

		// heal them
		M_Regenerate(self->enemy, frames, 0, 1.0, true, true, false, &self->enemy->monsterinfo.regen_delay2);

		// hold monsters in-place
		if (self->enemy->svflags & SVF_MONSTER)
			self->enemy->holdtime = level.time + 0.2;
	}
	// the target is a dead monster and needs resurrection
	else if (self->enemy->health < 1)
	{
		M_Reanimate(self->activator, self->enemy, self->monsterinfo.level, 0.33, false);
	}
}
Beispiel #6
0
void TBI_SpawnThink(edict_t *self)
{
	if (level.time > self->lasthurt + 1.0 && self->deadflag != DEAD_DEAD)
		M_Regenerate(self, PLAYERSPAWN_REGEN_FRAMES, PLAYERSPAWN_REGEN_DELAY,  1.0, true, false, false, &self->monsterinfo.regen_delay1);
}
Beispiel #7
0
void totem_general_think(edict_t *self)
{
	edict_t *caster = self->activator;

	// Die if caster is not alive, or is not a valid ent
	if (!caster || !caster->client || !G_EntIsAlive(caster) || caster->flags & FL_CHATPROTECT)
	{
		RemoveTotem(self);
		return;
	}

	//Some players can have two totems out (with talent). Take cubes away from them every 5 seconds.
	if(level.framenum % 50 == 0 && caster->client && caster->totem2 == self)
	{
		int *cubes = &caster->client->pers.inventory[ITEM_INDEX(Fdi_POWERCUBE)];

		//Talent: Totemic Focus.
		int cost = 10;//30 - getTalentLevel(caster, TALENT_TOTEM) * 5;
        if(*cubes < cost)
		{
			*cubes = 0;
			RemoveTotem(self);
			return;
		}
		*cubes -= cost;
	}

	if(self->delay < level.time)
	{
		switch(self->mtype)
		{
		case TOTEM_FIRE:			FireTotem_think(self, caster);			break;
		case TOTEM_WATER:			WaterTotem_think(self, caster);			break;
		case TOTEM_NATURE:			NatureTotem_think(self, caster);		break;
		default:					break;
		}
	}
	
	// totem mastery allows regeneration
	if (level.time > self->lasthurt + 1.0 && !caster->myskills.abilities[TOTEM_MASTERY].disable 
		&& caster->myskills.abilities[TOTEM_MASTERY].current_level > 0)
		M_Regenerate(self, TOTEM_REGEN_FRAMES, TOTEM_REGEN_DELAY, 1.0, true, false, false, &self->monsterinfo.regen_delay1);

	//Rotate a little.
	self->s.angles[YAW] += 5;
	if(self->s.angles[YAW] == 360)
		self->s.angles[YAW] = 0;
//GHz 4.32
	// if position has been updated, check for ground entity
	if (self->linkcount != self->monsterinfo.linkcount)
	{
		self->monsterinfo.linkcount = self->linkcount;
		M_CheckGround (self);
	}

	// don't slide
	if (self->groundentity)
		VectorClear(self->velocity);
	
	M_CatagorizePosition (self);
	M_WorldEffects (self);
//GHz
	totem_effects(self);

	self->nextthink = level.time + FRAMETIME;
}
Beispiel #8
0
void NatureTotem_think(edict_t *self, edict_t *caster)
{
	edict_t *target = NULL;
	qboolean isSomeoneHealed = false;
	float cdmult = 1.0;

	//Find players in radius and attack them.
	while ((target = findradius(target, self->s.origin, TOTEM_MAX_RANGE)) != NULL)
	{
		if (G_ValidAlliedTarget(self, target, true))
		{
			int maxHP;// = MAX_HEALTH(target);
			int maxArmor;// = MAX_ARMOR(target);
			int maxcubes;// = target->client->pers.max_powercubes;
			int *armor;// = &target->client->pers.inventory[body_armor_index];
			int *cubes;// = &target->client->pers.inventory[ITEM_INDEX(Fdi_POWERCUBE)];
			int	regen_frames;//4.2 regen for non-clients
			
			if (!target->client)
			{
				regen_frames = 1000 / self->monsterinfo.level; // full-regeneration in 15 seconds at level 10
				M_Regenerate(target, regen_frames, 50, 1.0, true, true, false, &target->monsterinfo.regen_delay2);
				continue;
			}
			
			maxHP = MAX_HEALTH(target);
			maxArmor = MAX_ARMOR(target);
			maxcubes = target->client->pers.max_powercubes;
			armor = &target->client->pers.inventory[body_armor_index];
			cubes = &target->client->pers.inventory[ITEM_INDEX(Fdi_POWERCUBE)];

			//Heal their health.
			if(target->health < maxHP)
			{
				target->health += NATURETOTEM_HEALTH_BASE + self->monsterinfo.level * NATURETOTEM_HEALTH_MULT;
				if(target->health > maxHP)
					target->health = maxHP;
				isSomeoneHealed = true;
			}
			//Heal their armor.
			if(*armor < maxArmor)
			{
				*armor += NATURETOTEM_ARMOR_BASE + self->monsterinfo.level * NATURETOTEM_ARMOR_MULT;
				if(*armor > maxArmor)
					*armor = maxArmor;
				isSomeoneHealed = true;
			}

			//Talent: Peace.
			if(*cubes < maxcubes)
			{
				//Give them 5 cubes per talent point.
				*cubes += getTalentLevel(caster, TALENT_PEACE) * 10;
				if(*cubes > maxcubes)
					*cubes = maxcubes;
				isSomeoneHealed = true;
			}

			// We remove curses. -az
			CurseRemove(target, 0);
		}
	}

	//Play a sound or something.
	if(isSomeoneHealed)
	{
		gi.sound(self, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
	}

	cdmult = level.time + NATURETOTEM_REFIRE_BASE + NATURETOTEM_REFIRE_MULT * self->monsterinfo.level;

	if (cdmult <= level.time)
		cdmult = level.time + 0.1;

	//Next think.
	self->delay = cdmult;
}