X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/2271327bcbe667c36a906a863acc0d2152afb447..c7bceafda9c7c1045b398d8454a0a2ed0fbd9170:/gameserv/c_forest.cpp diff --git a/gameserv/c_forest.cpp b/gameserv/c_forest.cpp index e2f76dc..762d1e7 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."); @@ -75,8 +72,8 @@ 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]); - notice(s_GameServ, u, "You have found %s!", p->fight->name); + p->fight = new Monster(levels[p->level - 1].randomMonster()); + notice(s_GameServ, u, "You have found %s!", p->fight->name.c_str()); if (p->fight->hp < p->fight->maxhp) p->fight->hp = p->fight->maxhp; @@ -84,6 +81,7 @@ void do_forest(char *u) p->master = NULL; // Just to make sure display_monster(u); } + /* else if (eventnum < 12 && eventnum >= 10) // 2% for finding potions { notice(s_GameServ, u, "Fortune smiles upon thee!"); @@ -113,6 +111,7 @@ void do_forest(char *u) break; } } + */ else if (eventnum < 10 && eventnum >= 5) // 5% for the fountain { if (p->hp < p->maxhp) @@ -134,6 +133,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; @@ -151,13 +151,13 @@ void do_forest(char *u) } else if (eventnum < 3) { - newstats = (rand() % 1000) * (p->level + (rand() % 10)); + newstats = levels[p->level - 1].getStrength().random(); notice(s_GameServ, u, "A SACK WITH %ld GOLD!", newstats); p->gold += newstats; } else { - newstats = (rand() % 100) * (p->level + rand() % 10); + newstats = levels[p->level - 1].getExp().random(); notice(s_GameServ, u, "Time seems to stand still for a moment."); notice(s_GameServ, u, " %ld EXTRA EXPERIENCE POINTS", newstats); p->exp += newstats; @@ -179,23 +179,9 @@ Monster *getNewMonster(Monster *m) Monster *newguy; newguy = new Monster; - - if (m->name) - { - newguy->name = new char[strlen(m->name)]; - strcpy(newguy->name, m->name); - } - if (m->weapon) - { - newguy->weapon = new char[strlen(m->weapon)]; - strcpy(newguy->weapon, m->weapon); - } - if (m->death) - { - newguy->death = new char[strlen(m->death)]; - strcpy(newguy->death, m->death); - } - + newguy->name = m->name; + newguy->weapon = m->weapon; + newguy->death = m->death; newguy->strength = m->strength; newguy->gold = m->gold; newguy->exp = m->exp;