]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/c_forest.cpp
Finally got level.h/cpp compiling into the project... beginning to store
[irc/gameservirc.git] / gameserv / c_forest.cpp
index cc937ebdf558181931669883e747400520f5f42d..7ab179f87e57a33540403c5d81af00e8d5160b9d 100644 (file)
@@ -36,9 +36,6 @@ void do_forest(char *u)
 {
     aClient *source;
 
-    int num = rand() % 12;
-
-
     if (!(source = find(u)))
     {
        notice(s_GameServ, u, "Fatal Error in do_forest. Contact a %S admin for help.");
@@ -75,7 +72,7 @@ void do_forest(char *u)
            // 88% of forest searching turns up a monster
            if (eventnum >= 12)
            {
-               p->fight = new Monster(monsters[p->level - 1][num]);
+               p->fight = new Monster(levels[p->level - 1].monsters.random());
                notice(s_GameServ, u, "You have found \ 2%s\ 2!", p->fight->name);
                if (p->fight->hp < p->fight->maxhp)
                    p->fight->hp = p->fight->maxhp;
@@ -84,7 +81,36 @@ void do_forest(char *u)
                p->master = NULL; // Just to make sure
                display_monster(u);
            }
-           else if (eventnum < 12 && eventnum >= 5) // 7% for the fountain
+           else if (eventnum < 12 && eventnum >= 10) // 2% for finding potions
+           {
+               notice(s_GameServ, u, "Fortune smiles upon thee!");
+
+               eventnum = 1 + rand() % 4;
+               switch(eventnum)
+               {
+                   case 1:
+                       notice(s_GameServ, u,
+                       "You have found an HP Potion!");
+                       p->inventory.incHP();
+                       break;
+                   case 2:
+                       notice(s_GameServ, u,
+                       "You have found a Strength Potion!");
+                       p->inventory.incStrength();
+                       break;
+                   case 3:
+                       notice(s_GameServ, u,
+                       "You have found a Defense Potion!");
+                       p->inventory.incDefense();
+                       break;
+                   case 4:
+                       notice(s_GameServ, u,
+                       "You have found a Healing Potion!");
+                       p->inventory.incHealing();
+                       break;
+               }
+           }
+           else if (eventnum < 10 && eventnum >= 5) // 5% for the fountain
            {
                if (p->hp < p->maxhp)
                {
@@ -105,6 +131,7 @@ void do_forest(char *u)
                if (p->gold == 0)
                {
                    notice(s_GameServ, u, "Too bad you're broke. Guess you won't be having any wishes answered today.");
+                   p->forest_fights++;
                    return;
                }
                long newstats;