Example #1
0
void stalker_pain (edict_t *self, edict_t *other, float kick, int damage)
{
	if (self->deadflag == DEAD_DEAD)
		return;

	if (self->health < (self->max_health / 2)) 
	{
		self->s.skinnum = 1;
	}

	if (skill->value == 3)
		return;		// no pain anims in nightmare

//	if (self->monsterinfo.aiflags & AI_DODGING)
//		monster_done_dodge (self);

	if (self->groundentity == NULL)
		return;

	// if we're reactivating or false dying, ignore the pain.
	if (self->monsterinfo.currentmove == &stalker_move_false_death_end ||
		self->monsterinfo.currentmove == &stalker_move_false_death_start )
		return;

	if (self->monsterinfo.currentmove == &stalker_move_false_death)
	{
		stalker_reactivate(self);
		return;
	}

	if ((self->health > 0) && (self->health < (self->max_health / 4)))
	{
		if(random() < (0.2 * skill->value))
		{
			if( !STALKER_ON_CEILING(self) || stalker_ok_to_transition(self) )
			{
//				gi.dprintf("starting false death sequence\n");
				stalker_false_death_start(self);
				return;
			}
		}	
	}

	if (level.time < self->pain_debounce_time)
		return;

	self->pain_debounce_time = level.time + 3;

//	gi.dprintf("stalker_pain\n");
	if (damage > 10)		// don't react unless the damage was significant
	{
		// stalker should dodge jump periodically to help avoid damage.
		if(self->groundentity && (random() < 0.5))
			stalker_dodge_jump(self);
		else
			self->monsterinfo.currentmove = &stalker_move_pain;

		gi.sound (self, CHAN_WEAPON, sound_pain, 1, ATTN_NORM, 0);
	}
}
Example #2
0
void
stalker_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage)
{
	if (!self)
	{
		return;
	}

	if (self->deadflag == DEAD_DEAD)
	{
		return;
	}

	if (self->health < (self->max_health / 2))
	{
		self->s.skinnum = 1;
	}

	if (skill->value == 3)
	{
		return; /* no pain anims in nightmare */
	}

	if (self->groundentity == NULL)
	{
		return;
	}

	/* if we're reactivating or false dying, ignore the pain. */
	if ((self->monsterinfo.currentmove == &stalker_move_false_death_end) ||
		(self->monsterinfo.currentmove == &stalker_move_false_death_start))
	{
		return;
	}

	if (self->monsterinfo.currentmove == &stalker_move_false_death)
	{
		stalker_reactivate(self);
		return;
	}

	if ((self->health > 0) && (self->health < (self->max_health / 4)))
	{
		if (random() < (0.2 * skill->value))
		{
			if (!STALKER_ON_CEILING(self) || stalker_ok_to_transition(self))
			{
				stalker_false_death_start(self);
				return;
			}
		}
	}

	if (level.time < self->pain_debounce_time)
	{
		return;
	}

	self->pain_debounce_time = level.time + 3;

	if (damage > 10) /* don't react unless the damage was significant */
	{
		/* stalker should dodge jump periodically to help avoid damage. */
		if (self->groundentity && (random() < 0.5))
		{
			stalker_dodge_jump(self);
		}
		else
		{
			self->monsterinfo.currentmove = &stalker_move_pain;
		}

		gi.sound(self, CHAN_WEAPON, sound_pain, 1, ATTN_NORM, 0);
	}
}