fix #H6104 - no potion handling in thitu()

thitu() is mostly used for arrows and darts "thrown" by traps, but
scatter() uses it on items launched by a land mine explosion.  Traps
had no need for potion handling, but scattering does.  Changing thitu()
to call potionhit() required that more information be passed to the
latter in case killer reason was needed, and thitu()'s callers needed
to be updated since it now might use up its missile (only when that's
a potion, so scatter() is only caller which actually needed to care).

Quite a bit of work--especially the testing--for something which will
never be noticed in actual play.  In hindsight, it would have been
much simpler just to make scatter destroy all potions rather than
allow the 1% chance of remaining intact (via obj_resists()), or else
leave any intact ones at the explosion spot instead of launching them.
This commit is contained in:
PatR
2017-09-25 10:42:43 -07:00
parent 596bc64341
commit 719af503e7
11 changed files with 79 additions and 53 deletions

View File

@@ -884,7 +884,7 @@ boolean hitsroof;
/* object now hits you */
if (obj->oclass == POTION_CLASS) {
potionhit(&youmonst, obj, TRUE);
potionhit(&youmonst, obj, POTHIT_HERO_THROW);
} else if (breaktest(obj)) {
int otyp = obj->otyp;
int blindinc;
@@ -1086,7 +1086,7 @@ boolean
&& rn2(6)) {
/* alternative to prayer or wand of opening/spell of knock
for dealing with cursed saddle: throw holy water > */
potionhit(u.usteed, obj, TRUE);
potionhit(u.usteed, obj, POTHIT_HERO_THROW);
} else {
hitfloor(obj);
}
@@ -1614,7 +1614,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
} else if (obj->oclass == POTION_CLASS
&& (guaranteed_hit || ACURR(A_DEX) > rnd(25))) {
potionhit(mon, obj, TRUE);
potionhit(mon, obj, POTHIT_HERO_THROW);
return 1;
} else if (befriend_with_obj(mon->data, obj)