X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/9cda831cf07982221052583e94e073bda5d3ef4b..7a9afc848c82b853c9a560c5e5d888007b25cb46:/gameserv/c_forest.cpp diff --git a/gameserv/c_forest.cpp b/gameserv/c_forest.cpp index 7e1fc2f..9a8683f 100644 --- a/gameserv/c_forest.cpp +++ b/gameserv/c_forest.cpp @@ -2,6 +2,7 @@ #include "aClient.h" #include "list.h" #include "extern.h" +#include "flags.h" #include void do_forest(char *u); @@ -38,19 +39,27 @@ void do_forest(char *u) int num = rand() % 12; - if (!(source = find(u)) || !source->stats) + if (!(source = find(u))) + { + notice(s_GameServ, u, "Fatal Error in do_forest. Contact a %S admin for help."); + return; + } + else if (!is_playing(source)) { notice(s_GameServ, u, "You must be playing the game to search the forest!"); return; } - else if (!is_alive(source)) + Player *p = source->stats; + + if (!isAlive(p)) { notice(s_GameServ, u, "You are dead. Wait until tomorrow to search the forest some more."); return; } else { - if (source->stats->forest_fights <= 0) + updateTS(source->stats); + if (p->forest_fights <= 0) { notice(s_GameServ, u, "You are out of forest fights for the day. Wait "\ "till tomorrow!"); @@ -59,30 +68,29 @@ void do_forest(char *u) else if (!is_fighting(u)) { int eventnum = rand() % 100; - eventnum = 14; - Player *p = source->stats; p->forest_fights--; notice(s_GameServ, u, "You search the forest for something to kill..."); - if (eventnum >= 25) + // 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->hp = p->fight->maxhp; + if (p->fight->hp < p->fight->maxhp) + p->fight->hp = p->fight->maxhp; p->battle = NULL; // Just to make sure p->master = NULL; // Just to make sure display_monster(u); } - else if (eventnum < 25 && eventnum >= 15) // 10% + else if (eventnum < 12 && eventnum >= 5) // 7% 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->forest_fights += 10; p->hp = p->maxhp; } - else if (eventnum < 15) // 15 % for the wishing well + else if (eventnum < 5) // 5 % for the wishing well { notice(s_GameServ, u, "You come upon a pure green emerald studded magic wishing well."); if (p->gold == 0) @@ -94,13 +102,13 @@ void do_forest(char *u) 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."); notice(s_GameServ, u, "It is a wand! The gnome is waving it through the air towards you!"); - // 5% for each wishing well chance - if (eventnum < 5) // forest fights + // 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; } - else if (eventnum < 10) + else if (eventnum < 3) { notice(s_GameServ, u, "A SACK OF GOLD!"); p->gold += (rand() % 1000) * (p->level + (rand() % 10));