static void finalSpellWait() { Entity *e; self->thinkTime--; if (self->thinkTime <= 0) { self->mental++; if (self->mental >= 9) { self->mental = 9; } setEntityAnimationByID(self, self->mental); self->thinkTime = 60; } if (self->head->mental == 3 || self->health != self->head->health) { self->inUse = FALSE; } else { e = addPixelDecoration(self->x, self->y); if (e != NULL) { e->x = self->x + (prand() % 32) * (prand() % 2 == 0 ? -1 : 1) + self->w / 2; e->y = self->y + (prand() % 32) * (prand() % 2 == 0 ? -1 : 1) + self->h / 2; e->startX = e->x; e->startY = e->y; e->endX = self->x + self->w / 2; e->endY = self->y + self->h / 2; e->thinkTime = 15; e->health = 0; e->maxHealth = 255; e->mental = 0; calculatePath(e->startX, e->startY, e->endX, e->endY, &e->dirX, &e->dirY); } } self->x = self->head->x + self->offsetX; self->y = self->head->y + self->offsetY; }
static void disintegration() { Entity *e = addPixelDecoration(self->x, self->y); if (e != NULL) { e->x = self->x + (prand() % 32) * (prand() % 2 == 0 ? -1 : 1) + self->w / 2; e->y = self->y + (prand() % 32) * (prand() % 2 == 0 ? -1 : 1) + self->h / 2; e->startX = e->x; e->startY = e->y; e->endX = self->x; e->endY = self->y; e->thinkTime = 15; e->health = 230; e->maxHealth = 230; e->mental = 230; calculatePath(e->startX, e->startY, e->endX, e->endY, &e->dirX, &e->dirY); } self->thinkTime--; if (self->thinkTime <= 0) { playSoundToMap("sound/boss/sorceror/electrocute", BOSS_CHANNEL, self->x, self->y, 0); self->x = self->endX; self->y = self->endY; self->thinkTime = 300; self->touch = &disintegrationTouch; self->action = &disintegrationAttack; self->draw = &drawDisintegrationSpell; self->layer = BACKGROUND_LAYER; self->flags &= ~NO_DRAW; } }
static int beamDraw() { int drawn; Entity *e; if (self->head->mental == 1 && self->head->health > 0) { self->x = self->head->x; self->y = self->head->endX; drawn = drawLoopingAnimationToMap(); if (drawn == TRUE) { e = addPixelDecoration(self->x + self->w / 2, self->y); if (e != NULL) { e->dirX = prand() % 20; e->dirY = prand() % 20; if (prand() % 2 == 0) { e->dirX *= -1; } e->dirX /= 10; e->dirY /= 10; e->thinkTime = 20 + (prand() % 30); e->health = 255; e->maxHealth = 0; e->mental = 255; } } while (self->y < self->head->endY - self->h) { self->y += self->h; drawn = drawSpriteToMap(); } if (drawn == TRUE) { e = addPixelDecoration(self->x + self->w / 2, self->head->endY); if (e != NULL) { e->dirX = prand() % 20; e->dirY = -prand() % 20; if (prand() % 2 == 0) { e->dirX *= -1; } e->dirX /= 10; e->dirY /= 10; e->thinkTime = 20 + (prand() % 30); e->health = 255; e->maxHealth = 0; e->mental = 255; } } } return TRUE; }