Adjust Demonbane invoke ability

Demon lords and princes have a chance to resist the effect.
Demons in quest when nemesis is alive have a very high chance
of resisting.
When invoked in Gehennom, teleports the demons within the same
level.
This commit is contained in:
Pasi Kallinen
2022-07-20 09:42:24 +03:00
parent b1a5a9c390
commit ced920df54

View File

@@ -1832,31 +1832,52 @@ arti_invoke(struct obj *obj)
break;
}
case BANISH: {
if (!Inhell) {
int nvanished = 0;
struct monst *mtmp, *mtmp2;
d_level dest;
int nvanished = 0, nstayed = 0;
struct monst *mtmp, *mtmp2;
d_level dest;
find_hell(&dest);
find_hell(&dest);
for (mtmp = fmon; mtmp; mtmp = mtmp2) {
mtmp2 = mtmp->nmon;
if (DEADMONSTER(mtmp) || !isok(mtmp->mx, mtmp->my))
continue;
if (!is_demon(mtmp->data) && mtmp->data->mlet != S_IMP)
continue;
if (!couldsee(mtmp->mx, mtmp->my))
continue;
dest.dlevel = rn2(dunlevs_in_dungeon(&dest));
mtmp->msleeping = mtmp->mtame = mtmp->mpeaceful = 0;
nvanished++;
migrate_mon(mtmp, ledger_no(&dest), MIGR_RANDOM);
for (mtmp = fmon; mtmp; mtmp = mtmp2) {
int chance = 1;
mtmp2 = mtmp->nmon;
if (DEADMONSTER(mtmp) || !isok(mtmp->mx, mtmp->my))
continue;
if (!is_demon(mtmp->data) && mtmp->data->mlet != S_IMP)
continue;
if (!couldsee(mtmp->mx, mtmp->my))
continue;
if (mtmp->data->msound == MS_NEMESIS)
continue;
if (In_quest(&u.uz) && !g.quest_status.killed_nemesis)
chance += 10;
if (is_dprince(mtmp->data))
chance += 2;
if (is_dlord(mtmp->data))
chance++;
mtmp->msleeping = mtmp->mtame = mtmp->mpeaceful = 0;
if (chance <= 1 || !rn2(chance)) {
if (!Inhell) {
nvanished++;
/* banish to a random level in Gehennom */
dest.dlevel = rn2(dunlevs_in_dungeon(&dest));
migrate_mon(mtmp, ledger_no(&dest), MIGR_RANDOM);
} else {
u_teleport_mon(mtmp, FALSE);
}
} else {
nstayed++;
}
}
if (nvanished)
pline("The demon%s disappear%s in a cloud of brimstone!",
nvanished > 1 ? "s" : "",
nvanished > 1 ? "" : "s");
if (nvanished) {
pline("%she demon%s disappear%s in a cloud of brimstone!",
nstayed ? (nvanished > nstayed ? "Most of t" : "Some of t") : "T",
nvanished > 1 ? "s" : "",
nvanished > 1 ? "" : "s");
}
break;
}