View Single Post
Old January 15, 2018, 10:21   #40
PowerWyrm
Veteran
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,407
PowerWyrm is on a distinguished road
Quote:
Originally Posted by Ingwe Ingweron View Post
Any ETA on this bug-fix? It's such a pain in the butt having to pick up weapons from the floor, wield them, remember the blow/damage amounts, re-wield principal weapon, then compare. It was so much better when Inspecting the weapon on the ground or in the pack gave accurate information.
Looking at the code, the only difference is that now it uses calc_bonuses() instead of doing some hack for off weapon extra blows.

Old code:

Code:
extra_blows = 0;
-
-	/* Start with blows from the weapon being examined */
-	extra_blows += obj->known->modifiers[OBJ_MOD_BLOWS];
-
-	/* Then we need to look for extra blows on other items, as
-	 * state does not track these */
-	for (i = 0; i < player->body.count; i++) {
-		struct object *helper = slot_object(player, i);
-
-		if ((i == slot_by_name(player, "weapon")) || !helper)
-			continue;
-
-		extra_blows += helper->known->modifiers[OBJ_MOD_BLOWS];
-	}
The problem I think is that calc_bonuses() doesn't handle modifiers properly:

Code:
/* Apply modifiers */
			state->stat_add[STAT_STR] += obj->modifiers[OBJ_MOD_STR]
* p->obj_k->modifiers[OBJ_MOD_STR];
...
extra_blows += obj->modifiers[OBJ_MOD_BLOWS]
* p->obj_k->modifiers[OBJ_MOD_BLOWS];
I think the code should use the known part here, not rune knowledge. In PWMAngband, I have:

Code:
s32b modifiers[OBJ_MOD_MAX];

for (j = 0; j < OBJ_MOD_MAX; j++) {
modifiers[j] = obj->modifiers[j];
if (known_only && !object_is_known(p, obj) && !object_modifier_is_known(obj, j, aware)) modifiers[j] = 0;
}
...
extra_blows += modifiers[OBJ_MOD_BLOWS];
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
PowerWyrm is offline   Reply With Quote