comparison 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
comparison
equal deleted inserted replaced
244:ded75a57405c 245:e7aab31362af
106 * Since this is an attack, stop running and any healing that was 106 * Since this is an attack, stop running and any healing that was
107 * going on at the time. 107 * going on at the time.
108 */ 108 */
109 running = FALSE; 109 running = FALSE;
110 quiet = 0; 110 quiet = 0;
111 if (mp->t_type == 'F')
112 fung_hit = atoi(mp->t_stats.s_dmg);
111 if (mp->t_type == 'M' && off(player, ISBLIND)) 113 if (mp->t_type == 'M' && off(player, ISBLIND))
112 mp->t_disguise = 'M'; 114 mp->t_disguise = 'M';
113 if (on(player, ISBLIND)) 115 if (on(player, ISBLIND))
114 mname = "it"; 116 mname = "it";
115 else 117 else
198 when 'F': 200 when 'F':
199 /* 201 /*
200 * Violet fungi stops the poor guy from moving 202 * Violet fungi stops the poor guy from moving
201 */ 203 */
202 player.t_flags |= ISHELD; 204 player.t_flags |= ISHELD;
203 sprintf(monsters['F'-'A'].m_stats.s_dmg,"%dd1",++fung_hit); 205 sprintf(mp->t_stats.s_dmg, "%dd1", ++fung_hit);
204 when 'L': 206 when 'L':
205 { 207 {
206 /* 208 /*
207 * Leperachaun steals some gold 209 * Leperachaun steals some gold
208 */ 210 */
691 switch (tp->t_type) 693 switch (tp->t_type)
692 { 694 {
693 case 'F': 695 case 'F':
694 player.t_flags &= ~ISHELD; 696 player.t_flags &= ~ISHELD;
695 fung_hit = 0; 697 fung_hit = 0;
696 strcpy(monsters['F'-'A'].m_stats.s_dmg, "000d0");
697 when 'L': 698 when 'L':
698 { 699 {
699 struct room *rp; 700 struct room *rp;
700 701
701 if ((rp = roomin(&tp->t_pos)) == NULL) 702 if ((rp = roomin(&tp->t_pos)) == NULL)