Mercurial > hg > early-roguelike
comparison rogue5/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 | f502bf60e6e4 |
children |
comparison
equal
deleted
inserted
replaced
244:ded75a57405c | 245:e7aab31362af |
---|---|
154 if (to_death && !on(*mp, ISTARGET)) | 154 if (to_death && !on(*mp, ISTARGET)) |
155 { | 155 { |
156 to_death = FALSE; | 156 to_death = FALSE; |
157 kamikaze = FALSE; | 157 kamikaze = FALSE; |
158 } | 158 } |
159 if (mp->t_type == 'F') | |
160 vf_hit = atoi(mp->t_stats.s_dmg); | |
159 if (mp->t_type == 'X' && mp->t_disguise != 'X' && !on(player, ISBLIND)) | 161 if (mp->t_type == 'X' && mp->t_disguise != 'X' && !on(player, ISBLIND)) |
160 { | 162 { |
161 mp->t_disguise = 'X'; | 163 mp->t_disguise = 'X'; |
162 if (on(player, ISHALU)) | 164 if (on(player, ISHALU)) |
163 mvaddch(mp->t_pos.y, mp->t_pos.x, rnd(26) + 'A'); | 165 mvaddch(mp->t_pos.y, mp->t_pos.x, rnd(26) + 'A'); |
267 when 'F': | 269 when 'F': |
268 /* | 270 /* |
269 * Venus Flytrap stops the poor guy from moving | 271 * Venus Flytrap stops the poor guy from moving |
270 */ | 272 */ |
271 player.t_flags |= ISHELD; | 273 player.t_flags |= ISHELD; |
272 sprintf(monsters['F'-'A'].m_stats.s_dmg,"%dx1", ++vf_hit); | 274 sprintf(mp->t_stats.s_dmg,"%dx1", ++vf_hit); |
273 if (--pstats.s_hpt <= 0) | 275 if (--pstats.s_hpt <= 0) |
274 death('F'); | 276 death('F'); |
275 when 'L': | 277 when 'L': |
276 { | 278 { |
277 /* | 279 /* |
639 switch (tp->t_type) | 641 switch (tp->t_type) |
640 { | 642 { |
641 case 'F': | 643 case 'F': |
642 player.t_flags &= ~ISHELD; | 644 player.t_flags &= ~ISHELD; |
643 vf_hit = 0; | 645 vf_hit = 0; |
644 strcpy(monsters['F'-'A'].m_stats.s_dmg, "000x0"); | |
645 when 'L': | 646 when 'L': |
646 { | 647 { |
647 THING *gold; | 648 THING *gold; |
648 | 649 |
649 if (fallpos(&tp->t_pos, &tp->t_room->r_gold) && level >= max_level) | 650 if (fallpos(&tp->t_pos, &tp->t_room->r_gold) && level >= max_level) |