Esempio n. 1
0
static void eat()
{
	Entity *temp;

	self->thinkTime--;

	self->target->x = self->x + self->w / 2 - self->target->w / 2;

	self->target->y = self->y + self->h / 2 - self->target->h / 2;

	self->target->y += cos(DEG_TO_RAD(self->thinkTime)) * 8;

	if (self->thinkTime <= 0)
	{
		temp = self;

		self = self->target;

		freeEntityList(playerGib());

		self = temp;

		self->action = &entityWait;

		self->maxThinkTime = 0;
	}
}
Esempio n. 2
0
static void disintegrationSpellAttack()
{
	Entity *temp;

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		self->head->mental = 0;

		self->inUse = FALSE;

		if (self->mental == 2)
		{
			/* Gib the player */

			temp = self;

			self = &player;

			freeEntityList(playerGib());

			self = temp;
		}

		stopSound(BOSS_CHANNEL);
	}

	self->endX = player.x + player.w / 2;
	self->endY = player.y + player.h / 2;

	self->x = self->endX;
	self->y = self->endY;
}
static void riftTouch(Entity *other)
{
	int i;
	Entity *temp, *e;
	EntityList *list, *l;

	i = 0;

	if (other->type == PLAYER && player.health > 0)
	{
		temp = self;

		self = other;

		list = playerGib();

		for (l=list->next;l!=NULL;l=l->next)
		{
			e = l->entity;

			e->head = temp;

			e->x = temp->x + temp->w / 2 - e->w / 2;
			e->y = temp->y + temp->h / 2 - e->h / 2;

			e->startX = e->x;
			e->startY = e->y;

			e->mental = 0;

			e->health = prand() % 360;

			e->dirX = 1;

			e->action = &gibWait;

			e->thinkTime = 180;

			i++;
		}

		freeEntityList(list);

		self = temp;

		self->action = &riftDestroyWait;

		self->mental = i;
	}
}
Esempio n. 4
0
static void touch(Entity *other)
{
	Entity *temp;

	if (!(self->flags & INVULNERABLE) && other->type == ITEM && strcmpignorecase(other->name, "item/repellent_spray") == 0)
	{
		self->mental++;

		if (self->mental == 50)
		{
			self->action = &shudder;

			self->targetX = self->x;

			self->thinkTime = 300;

			if (player.health > 0)
			{
				setInfoBoxMessage(180, 255, 255, 255, _("Now! Run while it's stunned!"));
			}

			self->health = 0;
		}

		else if (self->mental > 50)
		{
			self->thinkTime = 300;
		}

		setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
		setCustomAction(self, &flashWhite, 6, 0, 0);
	}

	else if (other->type == PLAYER && self->action == &attack)
	{
		temp = self;

		self = other;

		freeEntityList(playerGib());

		self = temp;
	}

	else
	{
		entityTouch(other);
	}
}
Esempio n. 5
0
static void finalAttack()
{
	Entity *temp;

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		switch (self->mental)
		{
			case 0:
				setEntityAnimation(self, "ATTACK_4");

				addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2);

				playSoundToMap("sound/common/spell", -1, self->x, self->y, 0);

				self->flags &= ~NO_DRAW;

				self->face = RIGHT;

				createAutoDialogBox(_("Sorceror"), _("Enough! Prepare to die..."), 180);

				self->thinkTime = 180;

				self->mental = 1;

				temp = getFreeEntity();

				if (temp == NULL)
				{
					showErrorAndExit("No free slots to add a the staff");
				}

				loadProperties("boss/sorceror_staff", temp);

				temp->action = &staffMoveAroundSorceror;

				temp->draw = &drawLoopingAnimationToMap;

				temp->type = ENEMY;

				setEntityAnimationByID(temp, 0);

				temp->x = self->x + self->w / 2 - temp->w / 2;

				temp->y = self->y + self->h / 2 - temp->h / 2;

				temp->startX = temp->x;

				temp->startY = temp->y;

				temp->head = self;

				temp->health = self->health;

				temp->mental = self->box.w;
			break;

			case 1:
				temp = getFreeEntity();

				if (temp == NULL)
				{
					showErrorAndExit("No free slots to add a the Final Attack spell");
				}

				loadProperties("boss/sorceror_final_spell", temp);

				temp->action = &finalSpellWait;

				temp->draw = &drawLoopingAnimationToMap;

				temp->type = ENEMY;

				setEntityAnimationByID(temp, 0);

				temp->x = self->x + temp->offsetX;

				temp->y = self->y + temp->offsetY;

				temp->head = self;

				temp->thinkTime = 60;

				self->thinkTime = 660;

				self->mental = 2;

				temp->health = self->health;
			break;

			default:
				self->mental = 3;

				playSoundToMap("sound/common/massive_explosion", -1, self->x, self->y, 0);

				fadeFromColour(0, 0, 200, 30);

				/* Gib the player */

				temp = self;

				self = &player;

				freeEntityList(playerGib());

				self = temp;

				self->thinkTime = 120;

				self->action = &finalAttackFinish;
			break;
		}
	}

	else if (self->thinkTime <= 420 && self->mental == 2)
	{
		self->startX = 2;
	}
}