Repository navigation
Commit 8b4e7d3
committed
Learned teleport away now follows the wand of teleportation AI rules.
Monsters that learn teleport away from a spellbook cast it with none
of the tactical rules muse.c applies to the wand of teleportation:
they handed a free controlled teleport to players with teleport
control, wasted casts on noteleport levels with no way to learn
better, fired it as a random attack instead of using it to dislodge
the hero from a protected spot, and never used it to escape. Review
of the new code surfaced four pre-existing bugs in the same beam and
kill-attribution paths, fixed here as well.
* mcastu.c: add teleport away to target_resists_learned_spell(), the
shared filter behind both the learned-spell meta selection and the
spell picker. Against the hero the spell now requires the hero to
be on a scary square or the branch stairs and is skipped outright
under teleport control; against monster targets it skips sure
no-ops (noteleport level, temple priest). A caster that has seen
teleportation fail on the level (the same mtrapseen knowledge bit
the wand checks) skips it entirely.
* muse.c:
- badly hurt spellcasters that know the spell now cast it to
escape. New defensive action MUSE_SPE_TELEPORT_AWAY_SELF reuses
the wand's mon_tele restriction and relocation code; Amulet
carriers select MUSE_SPE_TELEPORT_AWAY and cast at the hero
instead, since the Amulet blocks their own teleport. Shopkeepers
in their shops, guards and priests never self-teleport, and
casting charges the standard spell cooldown.
- the defensive wand of teleportation zap (an Amulet carrier
sending the hero away) fired in a stale direction: mbhit() aims
via the tbx/tby globals and this path never set them. With the
common 0,0 leftover the beam never advanced and teleported the
Amulet carrier itself - exactly what the case exists to prevent.
Aim at the hero's tracked position before the zap, restoring the
pre-tbx/tby behavior.
- mcast_immediate_spell() never set buzzer around its beam, unlike
mcast_ray_spell() and the wand mbhit() sites, so a pet's learned
force bolt, turn undead, drain life, dispel evil or cancellation
kill through resist() earned no livelog credit. The polymorph
system-shock death in mbhitm() likewise called mondied() with no
attribution; both now credit the caster the way the adjacent
drain life and dispel evil cases do.
- the scroll-of-fire bystander kill (dead code upstream, enabled
in EvilHack) called mondied() bare; set_pet_killer() first so a
pet reading the scroll gets credit.
* trap.c: the magic beam trap fires dobuzz() with a negative zap
type, so its kills read the buzzer attribution global; triggered
nested inside another monster's beam (knockback or teleport landing
a victim on the trigger), it inherited the outer zapper for pet
credit and the hero's death reason. Save, zero and restore buzzer
around both MAGIC_BEAM_TRAP_SET dobuzz() calls, the same discipline
exploder uses for chained explosions.1 parent 7d5f112 commit 8b4e7d3
4 files changed
Lines changed: 96 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5547 | 5547 | | |
5548 | 5548 | | |
5549 | 5549 | | |
| 5550 | + | |
5550 | 5551 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2404 | 2404 | | |
2405 | 2405 | | |
2406 | 2406 | | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
2407 | 2420 | | |
2408 | 2421 | | |
2409 | 2422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
811 | 813 | | |
812 | 814 | | |
813 | 815 | | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
814 | 832 | | |
815 | 833 | | |
816 | 834 | | |
| |||
1560 | 1578 | | |
1561 | 1579 | | |
1562 | 1580 | | |
1563 | | - | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
1564 | 1589 | | |
1565 | 1590 | | |
1566 | 1591 | | |
1567 | 1592 | | |
1568 | 1593 | | |
1569 | 1594 | | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
1570 | 1628 | | |
1571 | 1629 | | |
1572 | 1630 | | |
| |||
2506 | 2564 | | |
2507 | 2565 | | |
2508 | 2566 | | |
2509 | | - | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
2510 | 2570 | | |
| 2571 | + | |
2511 | 2572 | | |
2512 | 2573 | | |
2513 | 2574 | | |
| |||
3087 | 3148 | | |
3088 | 3149 | | |
3089 | 3150 | | |
| 3151 | + | |
| 3152 | + | |
3090 | 3153 | | |
3091 | 3154 | | |
3092 | 3155 | | |
| |||
5425 | 5488 | | |
5426 | 5489 | | |
5427 | 5490 | | |
| 5491 | + | |
5428 | 5492 | | |
| 5493 | + | |
5429 | 5494 | | |
5430 | 5495 | | |
5431 | 5496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1293 | 1293 | | |
1294 | 1294 | | |
1295 | 1295 | | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
1296 | 1302 | | |
1297 | 1303 | | |
1298 | 1304 | | |
1299 | 1305 | | |
| 1306 | + | |
1300 | 1307 | | |
1301 | 1308 | | |
1302 | 1309 | | |
| |||
3431 | 3438 | | |
3432 | 3439 | | |
3433 | 3440 | | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
3434 | 3447 | | |
3435 | 3448 | | |
| 3449 | + | |
3436 | 3450 | | |
3437 | 3451 | | |
3438 | 3452 | | |
3439 | 3453 | | |
| 3454 | + | |
3440 | 3455 | | |
3441 | 3456 | | |
3442 | 3457 | | |
| |||
0 commit comments