comparison rogue4/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 0990adf580ee
children e52a8a7ad4c5
comparison
equal deleted inserted replaced
244:ded75a57405c 245:e7aab31362af
111 * Since this is an attack, stop running and any healing that was 111 * Since this is an attack, stop running and any healing that was
112 * going on at the time. 112 * going on at the time.
113 */ 113 */
114 running = FALSE; 114 running = FALSE;
115 count = quiet = 0; 115 count = quiet = 0;
116 if (mp->t_type == 'F')
117 fung_hit = atoi(mp->t_stats.s_dmg);
116 if (mp->t_type == 'M' && !on(player, ISBLIND)) 118 if (mp->t_type == 'M' && !on(player, ISBLIND))
117 mp->t_disguise = 'M'; 119 mp->t_disguise = 'M';
118 if (on(player, ISBLIND)) 120 if (on(player, ISBLIND))
119 mname = "it"; 121 mname = "it";
120 else 122 else
214 when 'F': 216 when 'F':
215 /* 217 /*
216 * Violet fungi stops the poor guy from moving 218 * Violet fungi stops the poor guy from moving
217 */ 219 */
218 player.t_flags |= ISHELD; 220 player.t_flags |= ISHELD;
219 sprintf(monsters['F'-'A'].m_stats.s_dmg,"%dd1",++fung_hit); 221 sprintf(mp->t_stats.s_dmg,"%dd1",++fung_hit);
220 when 'L': 222 when 'L':
221 { 223 {
222 /* 224 /*
223 * Leperachaun steals some gold 225 * Leperachaun steals some gold
224 */ 226 */
693 switch (tp->t_type) 695 switch (tp->t_type)
694 { 696 {
695 case 'F': 697 case 'F':
696 player.t_flags &= ~ISHELD; 698 player.t_flags &= ~ISHELD;
697 fung_hit = 0; 699 fung_hit = 0;
698 strcpy(monsters['F'-'A'].m_stats.s_dmg, "000d0");
699 when 'L': 700 when 'L':
700 { 701 {
701 register THING *gold; 702 register THING *gold;
702 703
703 if (fallpos(&tp->t_pos, &tp->t_room->r_gold, TRUE)) 704 if (fallpos(&tp->t_pos, &tp->t_room->r_gold, TRUE))