X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/7d1d9eeb6a8415158588cdabb00786ec55f6f1cc..42106907f7ad612248bbcb1bf7515effe29e04c5:/gameserv/c_forest.cpp diff --git a/gameserv/c_forest.cpp b/gameserv/c_forest.cpp index 623787e..7ab179f 100644 --- a/gameserv/c_forest.cpp +++ b/gameserv/c_forest.cpp @@ -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."); @@ -58,13 +55,14 @@ void do_forest(char *u) } else { + updateTS(source->stats); if (p->forest_fights <= 0) { notice(s_GameServ, u, "You are out of forest fights for the day. Wait "\ "till tomorrow!"); return; } - else if (!is_fighting(u)) + else if (!is_fighting(source)) { int eventnum = rand() % 100; p->forest_fights--; @@ -74,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 %s!", p->fight->name); if (p->fight->hp < p->fight->maxhp) p->fight->hp = p->fight->maxhp; @@ -83,11 +81,49 @@ 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 { - notice(s_GameServ, u, "In your path lies a beautiful fountain from which flows the crystal waters of life."); - notice(s_GameServ, u, "You wet your lips on the cool blue waters and feel rejuvenated"); - p->hp = p->maxhp; + if (p->hp < p->maxhp) + { + notice(s_GameServ, u, "In your path lies a beautiful fountain from which flows the crystal waters of life."); + notice(s_GameServ, u, "You wet your lips on the cool blue waters and feel rejuvenated"); + p->hp = p->maxhp; + } + else + { + notice(s_GameServ, u, "In your path lies a beautiful fountain from which flows the crystal waters of life."); + notice(s_GameServ, u, "You are not thirsty, though, and you don't need healing. Best to leave this for the next warrior"); + p->forest_fights++; + } } else if (eventnum < 5) // 5 % for the wishing well { @@ -95,8 +131,10 @@ 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; notice(s_GameServ, u, "You throw one of your gold pieces into the well and it vanishes into a puff of white smoke."); notice(s_GameServ, u, "In an instant, the puff of smoke materializes into a gnome."); notice(s_GameServ, u, "The gnome is holding something in his hand motioning for you to come closer."); @@ -104,19 +142,23 @@ void do_forest(char *u) // 2% for each wishing well chance except for forest fights if (eventnum < 1) // forest fights { - notice(s_GameServ, u, "EXTRA FOREST FIGHTS!!"); - p->forest_fights += (rand() % 11) + 5; + newstats = (rand() % 11) + 5; + notice(s_GameServ, u, "%ld EXTRA FOREST FIGHTS!!", + newstats); + p->forest_fights += newstats; } else if (eventnum < 3) { - notice(s_GameServ, u, "A SACK OF GOLD!"); - p->gold += (rand() % 1000) * (p->level + (rand() % 10)); + newstats = (rand() % 1000) * (p->level + (rand() % 10)); + notice(s_GameServ, u, "A SACK WITH %ld GOLD!", newstats); + p->gold += newstats; } else { + newstats = (rand() % 100) * (p->level + rand() % 10); notice(s_GameServ, u, "Time seems to stand still for a moment."); - notice(s_GameServ, u, "EXTRA EXPERIENCE POINTS"); - p->exp += (rand() % 100) * (p->level + rand() % 10); + notice(s_GameServ, u, " %ld EXTRA EXPERIENCE POINTS", newstats); + p->exp += newstats; } } }