Пример #1
0
static void vault_tele(void)
{
	struct mkroom *croom = search_special(level, VAULT);
	coord c;

	if (croom && somexy(level, croom, &c) && teleok(c.x,c.y,FALSE)) {
		teleds(c.x,c.y,FALSE);
		return;
	}
	tele();
}
Пример #2
0
int
tele_impl(boolean wizard_tele, boolean run_next_to_u)
{
    coord cc;

    /* Disable teleportation in stronghold && Vlad's Tower */
    if (level->flags.noteleport) {
        if (!wizard_tele) {
            pline("A mysterious force prevents you from teleporting!");
            return 1;
        }
    }

    /* don't show trap if "Sorry..." */
    if (!Blinded)
        make_blinded(0L, FALSE);

    /* when it happens at all, happens too often to be worth a custom RNG */
    if ((Uhave_amulet || On_W_tower_level(&u.uz)) && !rn2(3)) {
        pline("You feel disoriented for a moment.");
        return 1;
    }
    if ((Teleport_control && !Stunned) || wizard_tele) {
        if (u_helpless(hm_unconscious)) {
            pline("Being unconscious, you cannot control your teleport.");
        } else {
            pline("To what position do you%s want to be teleported?",
                  u.usteed ? msgcat(" and ", mon_nam(u.usteed)) : "");
            cc.x = u.ux;
            cc.y = u.uy;
            if (getpos(&cc, FALSE, "the desired position", FALSE)
                == NHCR_CLIENT_CANCEL)
                return 0; /* abort */

            if (run_next_to_u) {
                if (!next_to_u()) {
                    pline("You shudder for a moment.");
                    return 1;
                }
            }

            /* possible extensions: introduce a small error if magic power is
               low; allow transfer to solid rock */
            if (teleok(cc.x, cc.y, FALSE, wizard_tele)) {
                teleds(cc.x, cc.y, FALSE);
                return 1;
            }
            pline("Sorry...");
        }
    }

    safe_teleds(FALSE);
    return 1;
}
Пример #3
0
void tele_finish(Short x, Short y, Boolean controlled)
{
  Short nux,nuy;
  Boolean done = false;

  if (controlled) {
    if (teleok(x, y)) {
      teleds(x, y);
      done = true; //return;
    }
    message("Sorry ...");
  }
  if (!done) {
    do {
      nux = rnd(DCOLS-1);
      nuy = rund(DROWS);
    } while (!teleok(nux, nuy));
    teleds(nux, nuy);
  }
  // clean up after drowning victims
  if (map_mode_teleport == TELE_DROWN) {
    if (get_cell_type(floor_info[(Short) you.ux][(Short) you.uy]) == POOL)
      drown_finish();
    // else, after surviving, do we tick or not?  XXXX think about this.
  }
  // else, if scroll or command, tick; if random timer, don't tick.
  // wait hm.
  // random timer - never tick.
  // command - tick iff controlled
  // scroll - tick iff controlled
  // drown - ???
  // trap - ???
  else if (controlled && map_mode_teleport != TELE_RNDTIMER) {
    extern Boolean took_time;
    void end_turn_start_turn(); // in main.c
    took_time = true;
    end_turn_start_turn(); // XXXX
  }
  // finally, reset.
  map_mode_teleport = TELE_MAP;
}
Пример #4
0
boolean safe_teleds(boolean allow_drag)
{
	int nux, nuy, tcnt = 0;

	do {
		nux = rnd(COLNO-1);
		nuy = rn2(ROWNO);
	} while (!teleok(nux, nuy, (boolean)(tcnt > 200)) && ++tcnt <= 400);

	if (tcnt <= 400) {
		teleds(nux, nuy, allow_drag);
		return TRUE;
	} else
		return FALSE;
}
Пример #5
0
void
tele(void)
{
    coord cc;

    /* Disable teleportation in stronghold && Vlad's Tower */
    if (level->flags.noteleport) {
        if (!wizard) {
            pline("A mysterious force prevents you from teleporting!");
            return;
        }
    }

    /* don't show trap if "Sorry..." */
    if (!Blinded)
        make_blinded(0L, FALSE);

    if ((u.uhave.amulet || On_W_tower_level(&u.uz)) && !rn2(3)) {
        pline("You feel disoriented for a moment.");
        return;
    }
    if ((Teleport_control && !Stunned) || wizard) {
        if (unconscious()) {
            pline("Being unconscious, you cannot control your teleport.");
        } else {
            char buf[BUFSZ];

            if (u.usteed)
                sprintf(buf, " and %s", mon_nam(u.usteed));
            pline("To what position do you%s want to be teleported?",
                  u.usteed ? buf : "");
            cc.x = u.ux;
            cc.y = u.uy;
            if (getpos(&cc, TRUE, "the desired position") < 0)
                return; /* abort */
            /* possible extensions: introduce a small error if magic power is
               low; allow transfer to solid rock */
            if (teleok(cc.x, cc.y, FALSE)) {
                teleds(cc.x, cc.y, FALSE);
                return;
            }
            pline("Sorry...");
        }
    }

    safe_teleds(FALSE);
}
Пример #6
0
static void vtele()
{
  room_t *croom;
  extern room_t rooms[MAX_ROOMS]; // in make_level.c .... SIGH...
  for (croom = &rooms[0] ; croom->hx >= 0 ; croom++)
    if (croom->rtype == VAULT) {
      Short x,y;

      x = rund(2) ? croom->lx : croom->hx;
      y = rund(2) ? croom->ly : croom->hy;
      if (teleok(x,y)) {
	teleds(x,y);
	map_mode_teleport = TELE_MAP;
	return;
      }
    }
  tele();
}