static void touch(Entity *other) { if (self->target == NULL && other->type == PLAYER && other->health > 0) { setPlayerLocked(TRUE); setPlayerLocked(FALSE); self->target = other; self->thinkTime = 180; self->action = &raiseOffGround; self->y = self->target->y; self->targetX = self->x + self->w / 2 - player.w / 2; self->targetY = self->target->y - self->target->h; other->weight = 0; } else { entityTouch(other); } }
static void disintegrationTouch(Entity *other) { Entity *temp; if (other->type == PLAYER) { if ((other->flags & BLOCKING) && strcmpignorecase(playerShield.objectiveName, "Disintegration Shield") == 0) { if (self->mental != 3) { self->dirX = self->head->face == LEFT ? -1 : 1; temp = self; self = other; other->takeDamage(temp, 1); self = temp; self->mental = 3; self->thinkTime = 30; stopSound(BOSS_CHANNEL); } } else { if (self->mental != 2) { setPlayerLocked(TRUE); setPlayerLocked(FALSE); self->thinkTime = 180; other->dirX = 0; setCustomAction(other, &helpless, self->thinkTime, 0, 0); setEntityAnimation(other, "CUSTOM_1"); self->mental = 2; playSoundToMap("sound/boss/sorceror/electrocute", BOSS_CHANNEL, self->x, self->y, 0); } } } }
static void activate(int val) { if (self->active == TRUE) { if (self->health == 0) { runScript("puzzle_pieces"); } if (self->health == 1) { if (self->target->mental == 0) { self->target->mental = -2; } self->mental = 0; setInfoBoxMessage(300, 255, 255, 255, _("Solve the jigsaw puzzle")); self->target->requires[0] = '\0'; self->action = &readInputCode; self->touch = NULL; self->activate = NULL; setPlayerLocked(TRUE); } } }
static void activate(int val) { if (strlen(self->requires) != 0) { if (removeInventoryItemByObjectiveName(self->requires) == TRUE) { self->requires[0] = '\0'; setEntityAnimation(self, "WALK"); } else { setInfoBoxMessage(90, 255, 255, 255, _("%s is required"), _(self->requires)); return; } } generateInputCode(); self->mental = 0; self->thinkTime = 120; setInfoBoxMessage(300, 255, 255, 255, _("Repeat the sequence")); self->action = &displayInputCode; self->touch = NULL; self->activate = NULL; setPlayerLocked(TRUE); }
static void activate(int val) { Entity *e = getInventoryItemByObjectiveName(self->requires); if (e == NULL) { setInfoBoxMessage(60, 255, 255, 255, _("%s is required"), _(self->requires)); } else { self->mental = 0; setInfoBoxMessage(300, 255, 255, 255, _("Enter the directions")); self->target->requires[0] = '\0'; self->action = &readInputCode; self->touch = NULL; self->activate = NULL; setPlayerLocked(TRUE); } }
static void activate(int val) { if (self->active == TRUE) { self->target->mental = -1; self->action = &readInputCode; self->touch = NULL; self->activate = NULL; setPlayerLocked(TRUE); } }
static void reprogram() { Entity *temp; if (input.interact == 1 || isPlayerLocked() == FALSE || self->health <= 0) { self->action = &entityWait; self->activate = &activate; self->touch = &touch; setPlayerLocked(FALSE); input.interact = 0; } else { self->health--; if (self->health <= 0) { self->activate = NULL; self->health = 0; self->mental = 1; self->target->mental = 1 - self->target->mental; temp = self; self = self->target; self->activate(-1); self = temp; } self->thinkTime = 5; setInfoBoxMessage(0, 255, 255, 255, _("Press Action to Cancel")); } }
static void activate(int val) { if (getInventoryItemByObjectiveName("Spanner") == NULL) { setInfoBoxMessage(120, 255, 255, 255, _("Spanner is required")); } else { self->action = &reprogram; self->touch = NULL; self->activate = NULL; setPlayerLocked(TRUE); } }
static void instructionMove() { checkToMap(self); setCustomAction(&player, &helpless, 5, 0, 0); if (self->dirX == 0 && self->dirY == 0) { processNextInstruction(); } else if (self->x == self->endX && self->y == self->endY) { runScript("robot_end"); self->dirX = 0; self->dirY = 0; self->action = &entityWait; setEntityAnimation(self, "STAND"); activateEntitiesWithRequiredName(self->objectiveName, TRUE); centerMapOnEntity(&player); setPlayerLocked(FALSE); self->health = 2; self->target->inUse = FALSE; self->target = NULL; self->touch = NULL; self->activate = NULL; } }
static void activate(int val) { Entity *e = getCurrentInventoryItem(); if (e == NULL || strcmpignorecase(e->name, "item/instruction_card") != 0) { runScript("instruction_card"); } else if (strlen(e->requires) == 0) { runScript("no_instructions"); } else { runScript("robot_start"); e = addEntity(*e, self->x, self->y); e->touch = NULL; e->flags |= NO_DRAW; removeInventoryItemByObjectiveName(e->objectiveName); self->target = e; self->action = &processNextInstruction; self->active = TRUE; self->mental = 0; setPlayerLocked(TRUE); centerMapOnEntity(self); } }
static void returnMove() { checkToMap(self); if (self->x == self->startX && self->y == self->startY) { runScript("robot_end"); centerMapOnEntity(&player); self->action = &entityWait; self->dirX = 0; self->dirY = 0; self->active = FALSE; setPlayerLocked(FALSE); self->health = 0; self->action = &entityWait; self->target->flags &= ~NO_DRAW; self->target->x = self->x; self->target->y = self->y; self->target->dirY = ITEM_JUMP_HEIGHT; self->target->touch = &keyItemTouch; self->target = NULL; setEntityAnimation(self, "STAND"); } }
static void soulSteal() { Target *t; setCustomAction(&player, &stickToFloor, 3, 0, 0); self->thinkTime--; player.x = self->targetX; self->maxThinkTime += self->mental; if (self->maxThinkTime > 255) { self->maxThinkTime = 255; self->mental *= -1; } else if (self->maxThinkTime < 0) { self->maxThinkTime = 0; self->mental *= -1; } player.alpha = self->maxThinkTime; if (self->thinkTime <= 0) { 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); t = getTargetByName("AZRIEL_TOP_TARGET"); if (t == NULL) { showErrorAndExit("Azriel cannot find target"); } self->x = t->x; self->y = t->y; self->head->health++; self->head->alpha = self->head->health * 64; if (self->head->alpha > 255) { self->head->alpha = 255; } self->head->thinkTime = self->head->maxThinkTime; self->head->mental = 0; player.alpha = self->targetY; player.alpha -= 64; if (player.alpha <= 0) { player.alpha = 0; player.thinkTime = 600; player.health = 0; setPlayerLocked(TRUE); } self->thinkTime = 30; self->action = &soulStealFinish; } checkToMap(self); becomeTransparent(); }
static void readInputCode() { int val; Entity *temp; if (self->target->mental == -3) { setPlayerLocked(FALSE); setInfoBoxMessage(60, 255, 255, 255, _("Complete")); self->action = &entityWait; self->touch = NULL; self->activate = NULL; fireTrigger(self->objectiveName); fireGlobalTrigger(self->objectiveName); return; } if (input.up == 1) { input.up = 0; val = 1; } else if (input.down == 1) { input.down = 0; val = 2; } else if (input.left == 1) { input.left = 0; val = 3; } else if (input.right == 1) { input.right = 0; val = 4; } else if (input.attack == 1) { input.attack = 0; val = 5; } else if (input.interact == 1) { input.interact = 0; val = 6; } else { val = -1; } if (val == 6) { setPlayerLocked(FALSE); self->action = &entityWait; self->touch = &touch; self->activate = &activate; } else if (val != -1 && self->target->activate != NULL) { temp = self; self = self->target; self->activate(val); self = temp; } }
static void readInputCode() { int val; if (input.up == 1) { input.up = 0; val = 1; } else if (input.down == 1) { input.down = 0; val = 2; } else if (input.left == 1) { input.left = 0; val = 3; } else if (input.right == 1) { input.right = 0; val = 4; } else { val = -1; } if (val != -1) { setEntityAnimationByID(self->target, val); if ((int)self->target->requires[self->mental] == val) { playSoundToMap("sound/item/charge_beep", -1, self->x, self->y, 0); self->mental++; if (self->target->requires[self->mental] == '\0') { setPlayerLocked(FALSE); activateEntitiesWithRequiredName(self->objectiveName, TRUE); setInfoBoxMessage(60, 255, 255, 255, _("Correct Sequence")); self->active = TRUE; self->touch = NULL; self->action = &entityWait; } } else { playSoundToMap("sound/item/buzzer", -1, self->x, self->y, 0); self->mental = 0; self->action = &entityWait; self->thinkTime = self->maxThinkTime; self->activate = &activate; self->touch = &touch; setInfoBoxMessage(60, 255, 255, 255, _("Incorrect Sequence")); setPlayerLocked(FALSE); } self->thinkTime = self->maxThinkTime; } self->thinkTime--; if (self->thinkTime <= 0) { self->thinkTime = 0; setEntityAnimationByID(self->target, 0); } }
static void readInputCode() { char c; int val; Entity *e; if (input.up == 1) { input.up = 0; val = 1; } else if (input.down == 1) { input.down = 0; val = 2; } else if (input.left == 1) { input.left = 0; val = 3; } else if (input.right == 1) { input.right = 0; val = 4; } else if (input.attack == 1) { input.attack = 0; val = 5; } else { val = -1; } if (val == 5 || self->mental > 30) { e = getInventoryItemByObjectiveName(self->requires); setPlayerLocked(FALSE); STRNCPY(e->requires, self->target->requires, sizeof(self->target->requires)); self->action = &entityWait; if (self->mental > 30) { setInfoBoxMessage(300, 255, 255, 255, _("Out of space for instructions")); } self->touch = &touch; self->activate = &activate; self->action = &entityWait; } else if (val != -1) { setEntityAnimationByID(self->target, val); playSoundToMap("sound/item/charge_beep", -1, self->x, self->y, 0); switch (val) { case 1: c = 'u'; break; case 2: c = 'd'; break; case 3: c = 'l'; break; default: c = 'r'; break; } self->target->requires[self->mental] = c; self->target->requires[self->mental + 1] = '\0'; self->mental++; self->thinkTime = self->maxThinkTime; } self->thinkTime--; if (self->thinkTime <= 0) { self->thinkTime = 0; setEntityAnimationByID(self->target, 0); } }