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; break;
} }
case BANISH: { case BANISH: {
if (!Inhell) { int nvanished = 0, nstayed = 0;
int nvanished = 0; struct monst *mtmp, *mtmp2;
struct monst *mtmp, *mtmp2; d_level dest;
d_level dest;
find_hell(&dest); find_hell(&dest);
for (mtmp = fmon; mtmp; mtmp = mtmp2) { for (mtmp = fmon; mtmp; mtmp = mtmp2) {
mtmp2 = mtmp->nmon; int chance = 1;
if (DEADMONSTER(mtmp) || !isok(mtmp->mx, mtmp->my))
continue; mtmp2 = mtmp->nmon;
if (!is_demon(mtmp->data) && mtmp->data->mlet != S_IMP) if (DEADMONSTER(mtmp) || !isok(mtmp->mx, mtmp->my))
continue; continue;
if (!couldsee(mtmp->mx, mtmp->my)) if (!is_demon(mtmp->data) && mtmp->data->mlet != S_IMP)
continue; continue;
dest.dlevel = rn2(dunlevs_in_dungeon(&dest)); if (!couldsee(mtmp->mx, mtmp->my))
mtmp->msleeping = mtmp->mtame = mtmp->mpeaceful = 0; continue;
nvanished++; if (mtmp->data->msound == MS_NEMESIS)
migrate_mon(mtmp, ledger_no(&dest), MIGR_RANDOM); 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) if (nvanished) {
pline("The demon%s disappear%s in a cloud of brimstone!", pline("%she demon%s disappear%s in a cloud of brimstone!",
nvanished > 1 ? "s" : "", nstayed ? (nvanished > nstayed ? "Most of t" : "Some of t") : "T",
nvanished > 1 ? "" : "s"); nvanished > 1 ? "s" : "",
nvanished > 1 ? "" : "s");
} }
break; break;
} }