示例#1
0
void deflect_think (edict_t *self)
{
	edict_t *player = G_GetClient(self->enemy);
	//Find my slot
	que_t *slot = NULL;
	slot = que_findtype(self->enemy->curses, NULL, DEFLECT);

	// Blessing self-terminates if the enemy dies or the duration expires
	if (!slot || !que_valident(slot))
	{
		if (player && level.time >= self->monsterinfo.selected_time)
			gi.cprintf(player, PRINT_HIGH, "Deflect has expired\n");

		que_removeent(self->enemy->curses, self, true);
		return;
	}

	// warn player that deflect is about to expire
//	if (player && !(level.framenum % 10) && (level.time >= slot->time - 5))
//		gi.cprintf(player, PRINT_HIGH, "Deflect will expire in %.0f seconds\n", slot->time - level.time);

	//Stick with the target
	VectorCopy(self->enemy->s.origin, self->s.origin);
	gi.linkentity(self);

	DeflectProjectiles(self->enemy, self->random, false);

	//Next think
	self->nextthink = level.time + FRAMETIME;

}
示例#2
0
void Bless_think(edict_t *self)
{
	//Find my slot
	que_t *slot = NULL;
	slot = que_findtype(self->enemy->curses, NULL, BLESS);

	// Blessing self-terminates if the enemy dies or the duration expires
	if (!slot || !que_valident(slot))
	{
		self->enemy->superspeed = false;
		que_removeent(self->enemy->curses, self, true);
		return;
	}

	//Stick with the target
	VectorCopy(self->enemy->s.origin, self->s.origin);
	gi.linkentity(self);

	//give them super speed
	self->enemy->superspeed = true;

	//Next think
	self->nextthink = level.time + FRAMETIME;

}
示例#3
0
void curse_think(edict_t *self)
{
	//Find my curse slot
	que_t *slot = NULL;
	slot = que_findtype(self->enemy->curses, NULL, self->atype);

	// curse self-terminates if the enemy dies or the duration expires
	if (!slot || !que_valident(slot))
	{
		que_removeent(self->enemy->curses, self, true);
		return;
	}

	CurseEffects(self->enemy, 10, 242);

	//Stick with the target
	VectorCopy(self->enemy->s.origin, self->s.origin);
	gi.linkentity(self);

	//Next think time
	self->nextthink = level.time + FRAMETIME;

	LifeDrain(self);// 3.5 this must be called last, because it may free the curse ent
	Bleed(self);//4.2
}
示例#4
0
void que_cleanup (que_t *que)
{
	int i;

	// remove invalid entries in queue
	for (i=0; i<QUE_MAXSIZE; i++) {
		if (que_valident(&que[i]))
			continue;
		que->ent = NULL;
		que->time = 0;
	}
}
示例#5
0
que_t *que_emptyslot (que_t *que)
{
	int i;

	for (i=0; i<QUE_MAXSIZE; i++) {
		// que slot is in-use as long as the entity still exists
		// and the time has not expired
		if (que_valident(&que[i]))
			continue;
		return &que[i];
	}
	return NULL;
}
示例#6
0
qboolean que_entexists (que_t *que, edict_t *other)
{
	int i;

	for (i=0; i<QUE_MAXSIZE; i++) {
		// return true if a valid entity is in que and hasn't timed out
		if (!que_valident(&que[i]))
			continue;
		if (que[i].ent != other)
			continue;
		return true;
	}
	return false;
}
示例#7
0
que_t *que_findtype (que_t *src, que_t *dst, int type)
{
	que_t *last;

	if (!dst)
		dst = src;
	else
		dst++;

	last = &src[QUE_MAXSIZE-1];

	for ( ; dst < last; dst++)
	{
		if (!que_valident(dst))
			continue;
		if ((dst->ent->mtype != type) && (dst->ent->atype != type))
			continue;
		return dst;
	}
	return NULL;
}
示例#8
0
que_t *que_findent (que_t *src, que_t *dst, edict_t *other)
{
	que_t *last;

	if (!dst)
		dst = src;
	else
		dst++;

	last = &src[QUE_MAXSIZE-1];

	for ( ; dst < last; dst++)
	{
		if (!que_valident(dst))
			continue;
		if (dst->ent != other)
			continue;
		return dst;
	}
	return NULL;
}
示例#9
0
void Healing_think(edict_t *self)
{
	//Find my slot
	que_t *slot = NULL;	
	int heal_amount = HEALING_HEAL_BASE + HEALING_HEAL_BONUS * self->owner->myskills.abilities[HEALING].current_level;
	float cooldown = 1.0;

	slot = que_findtype(self->enemy->curses, NULL, HEALING);

	// Blessing self-terminates if the enemy dies or the duration expires
	if (!slot || !que_valident(slot))
	{
		que_removeent(self->enemy->curses, self, true);
		return;
	}

	//Stick with the target
	VectorCopy(self->enemy->s.origin, self->s.origin);
	gi.linkentity(self);

	//Next think time
	self->nextthink = level.time + cooldown;

	//Heal the target's armor
	if (!self->enemy->client)
	{
		//Check to make sure it's a monster
		if (!self->enemy->mtype)
			return;
		
		heal_amount = self->enemy->max_health * (0.01 * self->owner->myskills.abilities[HEALING].current_level); // 1% healed per level
		
		if (heal_amount > 100)
			heal_amount = 100;

		//Heal the momster's health
		self->enemy->health += heal_amount;
		if (self->enemy->health > self->enemy->max_health)
			self->enemy->health = self->enemy->max_health;

		if (self->enemy->monsterinfo.power_armor_type)
		{
			heal_amount = self->enemy->monsterinfo.power_armor_power * (0.01 * self->owner->myskills.abilities[HEALING].current_level); // 1% healed per level
			
			if (heal_amount > 100)
				heal_amount = 100;

			//Heal the monster's armor
			self->enemy->monsterinfo.power_armor_power += heal_amount;
			if (self->enemy->monsterinfo.power_armor_power > self->enemy->monsterinfo.max_armor)
				self->enemy->monsterinfo.power_armor_power = self->enemy->monsterinfo.max_armor;
		}
	}
	else
	{
		if (self->enemy->health < MAX_HEALTH(self->enemy))
		{
			//Heal health
			self->enemy->health += heal_amount;
			if (self->enemy->health > MAX_HEALTH(self->enemy))
				self->enemy->health = MAX_HEALTH(self->enemy);
		}

		if (self->enemy->client->pers.inventory[body_armor_index] < MAX_ARMOR(self->enemy))
		{
			//Heal armor
			heal_amount *= 0.5; // don't heal as much armor
			if (heal_amount < 1)
				heal_amount = 1;
			self->enemy->client->pers.inventory[body_armor_index] += heal_amount;
			if (self->enemy->client->pers.inventory[body_armor_index] > MAX_ARMOR(self->enemy))
				self->enemy->client->pers.inventory[body_armor_index] = MAX_ARMOR(self->enemy);
		}
	}
}