# HG changeset patch # User John "Elwin" Edwards # Date 1462145996 14400 # Node ID e7aab31362afba48051a2c676fc8088880182d6b # Parent ded75a57405c083020df040dd9016c727bdd76ac 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. diff -r ded75a57405c -r e7aab31362af rogue3/fight.c --- 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; diff -r ded75a57405c -r e7aab31362af rogue3/wizard.c --- a/rogue3/wizard.c Sun Apr 24 13:33:17 2016 -0400 +++ b/rogue3/wizard.c Sun May 01 19:39:56 2016 -0400 @@ -166,9 +166,16 @@ * a Fungi */ if (on(player, ISHELD)) { + struct linked_list *item; + struct thing *mon; + player.t_flags &= ~ISHELD; fung_hit = 0; - strcpy(monsters['F'-'A'].m_stats.s_dmg, "000d0"); + for (item = mlist; item != NULL; item = next(item)) { + mon = (struct thing *) ldata(item); + if (mon->t_type == 'F') + strcpy(mon->t_stats.s_dmg, "000d0"); + } } count = 0; running = FALSE; diff -r ded75a57405c -r e7aab31362af rogue4/extern.c --- a/rogue4/extern.c Sun Apr 24 13:33:17 2016 -0400 +++ b/rogue4/extern.c Sun May 01 19:39:56 2016 -0400 @@ -170,9 +170,7 @@ { "centaur", 15, 0, { XX, 15, 4, 4, ___, "1d6/1d6" } }, { "dragon", 100, ISMEAN, { XX,6800, 10, -1, ___, "1d8/1d8/3d10" } }, { "floating eye",0, 0, { XX, 5, 1, 9, ___, "0d0" } }, - /* NOTE: the damage is %%% so that xstr won't merge this */ - /* string with others, since it is written on in the program */ - { "violet fungi",0, ISMEAN, { XX, 80, 8, 3, ___, "%%%d0" } }, + { "violet fungi",0, ISMEAN, { XX, 80, 8, 3, ___, "0d0" } }, { "gnome", 10, 0, { XX, 7, 1, 5, ___, "1d6" } }, { "hobgoblin", 0, ISMEAN, { XX, 3, 1, 5, ___, "1d8" } }, { "invisible stalker",0,ISINVIS,{ XX,120, 8, 3, ___, "4d4" } }, diff -r ded75a57405c -r e7aab31362af rogue4/fight.c --- a/rogue4/fight.c Sun Apr 24 13:33:17 2016 -0400 +++ b/rogue4/fight.c Sun May 01 19:39:56 2016 -0400 @@ -113,6 +113,8 @@ */ running = FALSE; count = quiet = 0; + if (mp->t_type == 'F') + fung_hit = atoi(mp->t_stats.s_dmg); if (mp->t_type == 'M' && !on(player, ISBLIND)) mp->t_disguise = 'M'; if (on(player, ISBLIND)) @@ -216,7 +218,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': { /* @@ -695,7 +697,6 @@ case 'F': player.t_flags &= ~ISHELD; fung_hit = 0; - strcpy(monsters['F'-'A'].m_stats.s_dmg, "000d0"); when 'L': { register THING *gold; diff -r ded75a57405c -r e7aab31362af rogue4/wizard.c --- a/rogue4/wizard.c Sun Apr 24 13:33:17 2016 -0400 +++ b/rogue4/wizard.c Sun May 01 19:39:56 2016 -0400 @@ -180,9 +180,14 @@ * a Fungi */ if (on(player, ISHELD)) { + THING *mon; + player.t_flags &= ~ISHELD; fung_hit = 0; - strcpy(monsters['F'-'A'].m_stats.s_dmg, "000d0"); + for (mon = mlist; mon != NULL; mon = next(mon)) { + if (mon->t_type == 'F') + strcpy(mon->t_stats.s_dmg, "0d0"); + } } no_move = 0; count = 0; diff -r ded75a57405c -r e7aab31362af rogue5/extern.c --- a/rogue5/extern.c Sun Apr 24 13:33:17 2016 -0400 +++ b/rogue5/extern.c Sun May 01 19:39:56 2016 -0400 @@ -197,9 +197,7 @@ { "centaur", 15, 0, { XX, 17, 4, 4, ___, "1x2/1x5/1x5" } }, { "dragon", 100, ISMEAN, { XX,5000, 10, -1, ___, "1x8/1x8/3x10" } }, { "emu", 0, ISMEAN, { XX, 2, 1, 7, ___, "1x2" } }, -{ "venus flytrap", 0, ISMEAN, { XX, 80, 8, 3, ___, "%%%x0" } }, - /* NOTE: the damage is %%% so that xstr won't merge this */ - /* string with others, since it is written on in the program */ +{ "venus flytrap", 0, ISMEAN, { XX, 80, 8, 3, ___, "0x0" } }, { "griffin", 20, ISMEAN|ISFLY|ISREGEN, { XX,2000, 13, 2, ___, "4x3/3x5" } }, { "hobgoblin", 0, ISMEAN, { XX, 3, 1, 5, ___, "1x8" } }, { "ice monster", 0, 0, { XX, 5, 1, 9, ___, "0x0" } }, diff -r ded75a57405c -r e7aab31362af rogue5/fight.c --- a/rogue5/fight.c Sun Apr 24 13:33:17 2016 -0400 +++ b/rogue5/fight.c Sun May 01 19:39:56 2016 -0400 @@ -156,6 +156,8 @@ to_death = FALSE; kamikaze = FALSE; } + if (mp->t_type == 'F') + vf_hit = atoi(mp->t_stats.s_dmg); if (mp->t_type == 'X' && mp->t_disguise != 'X' && !on(player, ISBLIND)) { mp->t_disguise = 'X'; @@ -269,7 +271,7 @@ * Venus Flytrap stops the poor guy from moving */ player.t_flags |= ISHELD; - sprintf(monsters['F'-'A'].m_stats.s_dmg,"%dx1", ++vf_hit); + sprintf(mp->t_stats.s_dmg,"%dx1", ++vf_hit); if (--pstats.s_hpt <= 0) death('F'); when 'L': @@ -641,7 +643,6 @@ case 'F': player.t_flags &= ~ISHELD; vf_hit = 0; - strcpy(monsters['F'-'A'].m_stats.s_dmg, "000x0"); when 'L': { THING *gold; diff -r ded75a57405c -r e7aab31362af rogue5/wizard.c --- a/rogue5/wizard.c Sun Apr 24 13:33:17 2016 -0400 +++ b/rogue5/wizard.c Sun May 01 19:39:56 2016 -0400 @@ -220,9 +220,14 @@ * a Flytrap */ if (on(player, ISHELD)) { + THING *mp; + player.t_flags &= ~ISHELD; vf_hit = 0; - strcpy(monsters['F'-'A'].m_stats.s_dmg, "000x0"); + for (mp = mlist; mp != NULL; mp = next(mp)) { + if (mp->t_type == 'F') + strcpy(mp->t_stats.s_dmg, "0x0"); + } } no_move = 0; count = 0; diff -r ded75a57405c -r e7aab31362af srogue/fight.c --- a/srogue/fight.c Sun Apr 24 13:33:17 2016 -0400 +++ b/srogue/fight.c Sun May 01 19:39:56 2016 -0400 @@ -142,6 +142,8 @@ running = FALSE; quiet = 0; isfight = TRUE; + if (mp->t_type == 'F') + fung_hit = atoi(mp->t_stats.s_dmg); if (mp->t_type == 'M' && pl_off(ISBLIND)) mp->t_disguise = 'M'; if (pl_on(ISBLIND)) @@ -206,7 +208,7 @@ } when 'F': player.t_flags |= ISHELD; - sprintf(monsters[midx('F')].m_stats.s_dmg,"%dd1",++fung_hit); + sprintf(mp->t_stats.s_dmg,"%dd1",++fung_hit); when 'L': { long lastpurse; struct linked_list *lep; diff -r ded75a57405c -r e7aab31362af srogue/monsters.c --- a/srogue/monsters.c Sun Apr 24 13:33:17 2016 -0400 +++ b/srogue/monsters.c Sun May 01 19:39:56 2016 -0400 @@ -334,10 +334,17 @@ void unhold(char whichmon) { + struct linked_list *item; + struct thing *mon; + switch (whichmon) { case 'F': fung_hit = 0; - strcpy(monsters[midx('F')].m_stats.s_dmg, "000d0"); + for (item = mlist; item != NULL; item = next(item)) { + mon = THINGPTR(item); + if (mon->t_type == 'F') + strcpy(mon->t_stats.s_dmg, "000d0"); + } case 'd': player.t_flags &= ~ISHELD; }