[net.games.hack] changing weight of gems

ptraynor@bbnccv.UUCP (Patrick Traynor) (01/17/86)

[Purina Line-Eater chow]

Here's the scenario:
I was polymorphing large piles of rocks into gems.  I had two sizable
piles, one of jade stones and one of worthless red glass.  Each had
about 200 or so gems.  I decided to go down another level to get more
rocks to make each polymorph zap more productive.  I picked up all of
the jade stones, but was only able to pick up about 100 of the worth-
less pieces of glass.  Although the jade wasn't worth that much, I 
decided to take the glass with me and leave most of the jade behind
te retrieve on my way back to the surface.  I dropped 100 jade stones
and tried to move onto the remaining red glass, but collapsed under
my load!  Why did my load get heavier when I dropped the stones?  I
then dropped all the jade stones, was able to move, tried to pick them
up again and was only able to carry 13.  
I spent most of the game playing with gems, rocks and wands of polymorph
and experienced this sort of thing several times.  It was as though
I was losing strength.  

Any theories?

--pat traynor--

arpa: ptraynor@bbnccv
uucp: ...harvard!bbnccv!ptraynor

kneller@ucsfcgl.UUCP (Don Kneller%Langridge) (01/19/86)

In article <1550@bbnccv.UUCP> ptraynor@bbnccv.UUCP (Patrick Traynor) writes:
>[Purina Line-Eater chow]
>
>Here's the scenario:
>I was polymorphing large piles of rocks into gems.  I had two sizable
>piles, one of jade stones and one of worthless red glass.  Each had
>about 200 or so gems.
>...
>I dropped 100 jade stones
>and tried to move onto the remaining red glass, but collapsed under
>my load!  Why did my load get heavier when I dropped the stones? 
>
>Any theories?
>
>--pat traynor--
>
>arpa: ptraynor@bbnccv
>uucp: ...harvard!bbnccv!ptraynor

There is a bug in the polymorph routine.  The routine sets the number
of gems to be the same as the number of rocks, but does not recalculate
the weight of the pile, and the weight is left at 1.  When you drop *some*
of the pile, the weight is recalculated, and suddenly you can't carry
the remaining gems.  Your pack load went from 1 jade stone to 100 jade
stones and you collapsed.  If you drop the whole pile, the weight is not
recalculated, and you can pick the entire pile again.

Incidentally, there is another bug in the same routine.  When you
polymorph a wand, you get a fully charged wand, even if the previous
wand had 0 charges.  The following are the fixes for both of the
bugs.  You may not want to put the min() function in.  This prevents
the polymorphed wand from having more than a normal number of charges.


*** hack.zap.old	Sat Jan 18 18:22:31 1986
--- hack.zap.c	Thu Jan 16 16:42:21 1986
***************
*** 72,77
  register struct obj *obj, *otmp;	/* returns TRUE if sth was done */
  {
  	register int res = TRUE;
  
  	if(obj == uball || obj == uchain)
  		res = FALSE;

--- 72,78 -----
  register struct obj *obj, *otmp;	/* returns TRUE if sth was done */
  {
  	register int res = TRUE;
+ 	register struct obj *otmp2;
  
  	if(obj == uball || obj == uchain)
  		res = FALSE;
***************
*** 79,87
  	switch(otmp->otyp) {
  	case WAN_POLYMORPH:
  		/* preserve symbol and quantity, but turn rocks into gems */
! 		mkobj_at((obj->otyp == ROCK || obj->otyp == ENORMOUS_ROCK)
! 			? GEM_SYM : obj->olet,
! 			obj->ox, obj->oy) -> quan = obj->quan;
  		delobj(obj);
  		break;
  	case WAN_STRIKING:

--- 80,95 -----
  	switch(otmp->otyp) {
  	case WAN_POLYMORPH:
  		/* preserve symbol and quantity, but turn rocks into gems */
! 		otmp2 = mkobj_at((obj->otyp == ROCK ||
! 			obj->otyp == ENORMOUS_ROCK) ? GEM_SYM : obj->olet,
! 			obj->ox, obj->oy);
! 		otmp2->quan = obj->quan;
!
! 		/* Keep special fields (number of charges, etc.) - dgk */
! 		otmp2->spe = min(otmp2->spe, otmp->spe);
! 		otmp2->cursed = otmp->cursed;
! 
! 		otmp2->owt = weight(otmp2);	/* update weight - dgk */
  		delobj(obj);
  		break;
  	case WAN_STRIKING:
-- 
	Don Kneller
UUCP:	...ucbvax!ucsfcgl!kneller
ARPA:	kneller@ucsf-cgl.ARPA
BITNET:	kneller@ucsfcgl.BITNET