nomore(MUSE_WAN_TELEPORTATION_SELF);
nomore(MUSE_WAN_TELEPORTATION);
if(obj->otyp == WAN_TELEPORTATION && obj->spe > 0) {
+ /* use the TELEP_TRAP bit to determine if they know
+ * about noteleport on this level or not. Avoids
+ * ineffective re-use of teleportation. This does
+ * mean if the monster leaves the level, they'll know
+ * about teleport traps.
+ */
+ if (!level.flags.noteleport ||
+ !(mtmp->mtrapseen & (1 << (TELEP_TRAP-1)))) {
m.defensive = obj;
m.has_defense = (mon_has_amulet(mtmp))
? MUSE_WAN_TELEPORTATION
: MUSE_WAN_TELEPORTATION_SELF;
+ }
}
nomore(MUSE_SCR_TELEPORTATION);
if(obj->otyp == SCR_TELEPORTATION && mtmp->mcansee
&& (!obj->cursed ||
(!(mtmp->isshk && inhishop(mtmp))
&& !mtmp->isgd && !mtmp->ispriest))) {
+ /* see WAN_TELEPORTATION case above */
+ if (!level.flags.noteleport ||
+ !(mtmp->mtrapseen & (1 << (TELEP_TRAP-1)))) {
m.defensive = obj;
m.has_defense = MUSE_SCR_TELEPORTATION;
+ }
}
if (mtmp->data != &mons[PM_PESTILENCE]) {
if (tele_restrict(mtmp)) { /* mysterious force... */
if (vismon && how) /* mentions 'teleport' */
makeknown(how);
+ /* monster learns that teleportation isn't useful here */
+ if (level.flags.noteleport)
+ mtmp->mtrapseen |= (1 << (TELEP_TRAP-1));
return 2;
}
if ((
otmp->spe--;
m_using = TRUE;
mbhit(mtmp,rn1(8,6),mbhitm,bhito,otmp);
+ /* monster learns that teleportation isn't useful here */
+ if (level.flags.noteleport)
+ mtmp->mtrapseen |= (1 << (TELEP_TRAP-1));
m_using = FALSE;
return 2;
case MUSE_SCR_TELEPORTATION:
{
struct permonst *pm = mtmp->data;
int difficulty = monstr[(monsndx(pm))];
+ int try = 0;
if(is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
|| pm->mlet == S_GHOST
|| pm->mlet == S_KOP
# endif
) return 0;
+ try_again:
switch (rn2(8 + (difficulty > 3) + (difficulty > 6) +
(difficulty > 8))) {
case 6: case 9:
+ if (level.flags.noteleport && ++try < 2)
+ goto try_again;
if (!rn2(3)) return WAN_TELEPORTATION;
/* else FALLTHRU */
case 0: case 1: