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:
@@ -570,7 +570,7 @@ struct obj *obj; /* only scatter this obj */
|
||||
struct scatter_chain *schain = (struct scatter_chain *) 0;
|
||||
long total = 0L;
|
||||
|
||||
while ((otmp = individual_object ? obj : level.objects[sx][sy]) != 0) {
|
||||
while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) {
|
||||
if (otmp->quan > 1L) {
|
||||
qtmp = otmp->quan - 1L;
|
||||
if (qtmp > LARGEST_INT)
|
||||
@@ -584,8 +584,8 @@ struct obj *obj; /* only scatter this obj */
|
||||
used_up = FALSE;
|
||||
|
||||
/* 9 in 10 chance of fracturing boulders or statues */
|
||||
if ((scflags & MAY_FRACTURE)
|
||||
&& ((otmp->otyp == BOULDER) || (otmp->otyp == STATUE))
|
||||
if ((scflags & MAY_FRACTURE) != 0
|
||||
&& (otmp->otyp == BOULDER || otmp->otyp == STATUE)
|
||||
&& rn2(10)) {
|
||||
if (otmp->otyp == BOULDER) {
|
||||
if (cansee(sx, sy))
|
||||
@@ -614,7 +614,7 @@ struct obj *obj; /* only scatter this obj */
|
||||
used_up = TRUE;
|
||||
|
||||
/* 1 in 10 chance of destruction of obj; glass, egg destruction */
|
||||
} else if ((scflags & MAY_DESTROY)
|
||||
} else if ((scflags & MAY_DESTROY) != 0
|
||||
&& (!rn2(10) || (objects[otmp->otyp].oc_material == GLASS
|
||||
|| otmp->otyp == EGG))) {
|
||||
if (breaks(otmp, (xchar) sx, (xchar) sy))
|
||||
@@ -622,8 +622,7 @@ struct obj *obj; /* only scatter this obj */
|
||||
}
|
||||
|
||||
if (!used_up) {
|
||||
stmp = (struct scatter_chain *)
|
||||
alloc(sizeof (struct scatter_chain));
|
||||
stmp = (struct scatter_chain *) alloc(sizeof *stmp);
|
||||
stmp->next = (struct scatter_chain *) 0;
|
||||
stmp->obj = otmp;
|
||||
stmp->ox = sx;
|
||||
@@ -679,7 +678,9 @@ struct obj *obj; /* only scatter this obj */
|
||||
if (bigmonst(youmonst.data))
|
||||
hitvalu++;
|
||||
hitu = thitu(hitvalu, dmgval(stmp->obj, &youmonst),
|
||||
stmp->obj, (char *) 0);
|
||||
&stmp->obj, (char *) 0);
|
||||
if (!stmp->obj)
|
||||
stmp->stopped = TRUE;
|
||||
if (hitu) {
|
||||
stmp->range -= 3;
|
||||
stop_occupation();
|
||||
|
||||
Reference in New Issue
Block a user