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 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; } }
static void validate() { int allStatues, orderCorrect; EntityList *list = getEntitiesByName(self->name); EntityList *l; Entity *e; allStatues = TRUE; orderCorrect = TRUE; for (l=list->next;l!=NULL;l=l->next) { e = l->entity; if (e->target == NULL) { allStatues = FALSE; break; } else if (strcmpignorecase(e->requires, e->target->objectiveName) != 0) { orderCorrect = FALSE; } } if (allStatues == TRUE) { if (orderCorrect == TRUE) { for (l=list->next;l!=NULL;l=l->next) { e = l->entity; e->active = FALSE; e->activate = NULL; } fireTrigger(self->name); fireGlobalTrigger(self->name); addMedal("occult"); } else { runScript("wrong_order"); } } freeEntityList(list); }
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; } }
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); } }
static void init() { EntityList *list; EntityList *l; Entity *e = NULL; if (strlen(self->objectiveName) != 0) { list = getEntitiesByObjectiveName(self->objectiveName); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; if (e != self && strcmpignorecase(self->objectiveName, e->objectiveName) == 0) { break; } } if (e == NULL) { showErrorAndExit("Pedestal could not get statue %s", self->objectiveName); } self->target = e; self->target->x = self->x + self->w / 2; self->target->x -= self->target->w / 2; self->target->y = self->y - self->target->h; self->target->flags |= FLY; self->target->touch = NULL; self->target->action = &statueWait; freeEntityList(list); } self->action = &entityWait; self->activate = self->active == TRUE ? &addStatue : NULL; }
static void init() { EntityList *list; EntityList *l; Entity *e; if (strlen(self->objectiveName) == 0) { showErrorAndExit("Scale at %d %d has no name", (int)self->x, (int)self->y); } list = getEntitiesByObjectiveName(self->objectiveName); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; if (e != self) { self->target = e; break; } } freeEntityList(list); if (self->target == NULL) { showErrorAndExit("Scale could not find partner %s", self->objectiveName); } self->targetY = self->startY + (self->endY - self->startY) / 2; addChain(); self->mental = getMapCeiling(self->x, self->y); self->action = &entityWait; }
static void dieMoveToTop() { EntityList *l, *list; Entity *e; self->thinkTime--; if (self->thinkTime <= 0) { switch (self->mental) { case 0: self->target->inUse = FALSE; stopSound(self->target->endX); setEntityAnimation(self, "INTRO"); self->flags &= ~NO_DRAW; addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2); playSoundToMap("sound/common/spell", -1, self->x, self->y, 0); self->thinkTime = 90; self->mental = 1; break; case 1: createAutoDialogBox(_("Azriel"), _("Until we meet again..."), 120); self->mental = 2; self->thinkTime = 180; break; default: list = createPixelsFromSprite(getCurrentSprite(self)); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; e->dirX = prand() % 30 * (e->x < self->x + self->w / 2 ? -1 : 1); e->dirY = prand() % 30 * (e->y < self->y + self->h / 2 ? -1 : 1); e->dirX /= 10; e->dirY /= 10; e->thinkTime = 180 + prand() % 180; } self->flags |= NO_DRAW; freeEntityList(list); self->thinkTime = 120; self->action = &dieWait; playSoundToMap("sound/boss/azriel/azriel_die", BOSS_CHANNEL, self->x, self->y, 0); break; } } }
static void destroyFloor() { EntityList *list; EntityList *l; Entity *e; self->thinkTime--; if (self->thinkTime <= 0) { if (self->mental == 0) { self->y = getMapFloor(self->x + self->w / 2, self->y) - self->h; playSoundToMap("sound/common/spell", -1, self->x, self->y, 0); self->flags &= ~NO_DRAW; addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2); self->thinkTime = 60; self->mental = 1; } else if (self->mental == 1) { setEntityAnimation(self, "ATTACK_1"); self->mental = 2; self->thinkTime = 600; list = getEntitiesByObjectiveName("SORCEROR_FLOOR"); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; e->active = TRUE; } freeEntityList(list); } else if (self->mental == 2) { setEntityAnimation(self, "STAND"); list = getEntitiesByObjectiveName("SORCEROR_FLOOR"); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; e->active = FALSE; } freeEntityList(list); self->thinkTime = 30; self->action = &teleportAway; } } if (player.y >= getMapMaxY()) { self->thinkTime = 5; self->mental = 2; } checkToMap(self); }
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; } }