static void spellMove() { int i; Entity *e; checkToMap(self); self->thinkTime--; if (self->thinkTime <= 0) { self->inUse = FALSE; } else { for (i=0;i<2;i++) { e = addBasicDecoration(self->x, self->y, "decoration/particle"); if (e != NULL) { e->x += prand() % self->w; e->y += prand() % self->h; e->thinkTime = 5 + prand() % 30; setEntityAnimationByID(e, prand() % 5); } } } }
void doTeleport() { int i; float speed; Entity *e; if (abs(self->x - self->targetX) < TELEPORT_SPEED && abs(self->y - self->targetY) < TELEPORT_SPEED) { self->flags &= ~(NO_DRAW|HELPLESS|TELEPORTING); self->x = self->targetX; self->y = self->targetY; addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2); self->dirY = self->dirX = 0; self->standingOn = NULL; if (!(self->flags & NO_END_TELEPORT_SOUND)) { playSoundToMap("sound/common/teleport", -1, self->x, self->y, 0); } } else { self->flags |= NO_DRAW|HELPLESS|INVULNERABLE; speed = getDistance(self->x, self->y, self->targetX, self->targetY) / 20; speed = speed < TELEPORT_SPEED ? TELEPORT_SPEED : (speed > 30 ? 30 : speed); normalize(&self->dirX, &self->dirY); self->dirX *= speed; self->dirY *= speed; self->x += self->dirX; self->y += self->dirY; for (i=0;i<5;i++) { e = addBasicDecoration(self->x, self->y, "decoration/particle"); if (e != NULL) { e->x += prand() % self->w; e->y += prand() % self->h; e->thinkTime = 5 + prand() % 30; setEntityAnimationByID(e, prand() % 5); } } } }
static void addElementParticles() { Entity *e = NULL; if (self->startX == 1 && prand() % 3 == 0) { if (self->endX == 1) { e = addBasicDecoration(self->x, self->y, "decoration/small_flame"); } else if (self->endX == 2) { e = addBasicDecoration(self->x, self->y, "decoration/small_ice"); } if (e != NULL) { e->x = self->x + self->box.x; e->y = self->y + self->box.y; e->x += prand() % self->box.w; e->y += prand() % self->box.h; e->thinkTime = 30 + prand() % 30; e->dirY = -5 - prand() % 15; e->dirY /= 10; setEntityAnimationByID(e, 0); } } }
static void addSparkles() { Entity *e; e = addBasicDecoration(self->x, self->y, "decoration/particle"); if (e != NULL) { e->x += prand() % self->box.w; e->y += prand() % self->box.h; e->thinkTime = 5 + prand() % 30; setEntityAnimationByID(e, prand() % 5); e->dirX = 0; e->dirY = -2; } }
static void addRiftEnergy(int x, int y) { Entity *e; e = addBasicDecoration(x, y, "decoration/rift_energy"); e->x += prand() % 128 * (prand() % 2 == 0 ? -1 : 1); e->y += prand() % 128 * (prand() % 2 == 0 ? -1 : 1); x -= e->w / 2; y -= e->h / 2; e->targetX = x; e->targetY = y; calculatePath(e->x, e->y, e->targetX, e->targetY, &e->dirX, &e->dirY); e->dirX *= 8; e->dirY *= 8; e->action = &energyMoveToRift; }
static void phantasmalBoltMove() { Entity *e; self->dirX = self->face == LEFT ? -fabs(self->dirX) : fabs(self->dirX); self->mental--; if (self->mental <= 0) { e = addBasicDecoration(self->x, self->y, "decoration/bolt_trail"); if (e != NULL) { e->x = self->face == LEFT ? self->x + self->w - e->w : self->x; e->y = self->y + self->h / 2 - e->h / 2; e->y += (prand() % 8) * (prand() % 2 == 0 ? 1 : -1); e->thinkTime = 15 + prand() % 15; e->dirY = (1 + prand() % 10) * (prand() % 2 == 0 ? 1 : -1); e->dirY /= 10; } self->mental = 2; } checkToMap(self); if (self->dirX == 0 || self->thinkTime <= 0) { self->inUse = FALSE; } }