diff rogue3/fight.c @ 245:e7aab31362af

Rogue V[345], Super-Rogue: Fix violet fungi/venus flytraps. Violet fungi (renamed venus flytraps in Rogue V5) do an increasing amount of damage each time they hit. If they miss, you still suffer the same number of HP. This worked by keeping a counter and printing new damage strings into monsters[5].m_stats.s_dmg, which is the "prototype" of that particular monster. Each individual monster has its own damage string. Apparently these were once char *, pointing to the same string as the prototype. When the s_dmg member was changed to be an internal char array, changing the prototype's damage string no longer had any effect on actual monsters. As a result, flytraps did no damage on a hit, or only one point in V5. The mechanism for doing damage on a miss continued to work. This has been fixed by overwriting the individual monster's damage string instead of the prototype's. It is now no longer necessary to reset the damage string when the flytrap is killed. The method for resetting it when the hero teleports away had to be modified. Comments referencing the long-unused xstr have been removed.
author John "Elwin" Edwards
date Sun, 01 May 2016 19:39:56 -0400
parents 527e2150eaf0
children e52a8a7ad4c5
line wrap: on
line diff
--- a/rogue3/fight.c	Sun Apr 24 13:33:17 2016 -0400
+++ b/rogue3/fight.c	Sun May 01 19:39:56 2016 -0400
@@ -108,6 +108,8 @@
      */
     running = FALSE;
     quiet = 0;
+    if (mp->t_type == 'F')
+	fung_hit = atoi(mp->t_stats.s_dmg);
     if (mp->t_type == 'M' && off(player, ISBLIND))
 	mp->t_disguise = 'M';
     if (on(player, ISBLIND))
@@ -200,7 +202,7 @@
 		     * Violet fungi stops the poor guy from moving
 		     */
 		    player.t_flags |= ISHELD;
-		    sprintf(monsters['F'-'A'].m_stats.s_dmg,"%dd1",++fung_hit);
+		    sprintf(mp->t_stats.s_dmg, "%dd1", ++fung_hit);
 		when 'L':
 		{
 		    /*
@@ -693,7 +695,6 @@
 	case 'F':
 	    player.t_flags &= ~ISHELD;
 	    fung_hit = 0;
-	    strcpy(monsters['F'-'A'].m_stats.s_dmg, "000d0");
 	when 'L':
 	{
 	    struct room *rp;