]>
jfr.im git - irc/gameservirc.git/blob - gameserv/c_forest.cpp
8 void do_forest(char *u
);
9 Monster
*getNewMonster(Monster
*m
);
10 void deleteMonster(Monster
*m
);
12 void forest(char *source
, char *buf
)
14 char *cmd
= strtok(buf
, " ");
21 if (stricmp(cmd
, "SEARCH") == 0)
24 } else if (stricmp(cmd
, "ATTACK") == 0) {
26 } else if (stricmp(cmd
, "RUN") == 0) {
28 } else if (stricmp(cmd
, "HEAL") == 0) {
35 void do_forest(char *u
)
39 int num
= rand() % 12;
42 if (!(source
= find(u
)))
44 notice(s_GameServ
, u
, "Fatal Error in do_forest. Contact a %S admin for help.");
47 else if (!is_playing(source
))
49 notice(s_GameServ
, u
, "You must be playing the game to search the forest!");
52 Player
*p
= source
->stats
;
56 notice(s_GameServ
, u
, "You are dead. Wait until tomorrow to search the forest some more.");
61 updateTS(source
->stats
);
62 if (p
->forest_fights
<= 0)
64 notice(s_GameServ
, u
, "You are out of forest fights for the day. Wait "\
68 else if (!is_fighting(u
))
70 int eventnum
= rand() % 100;
73 notice(s_GameServ
, u
, "You search the forest for something to kill...");
75 // 88% of forest searching turns up a monster
78 p
->fight
= new Monster(monsters
[p
->level
- 1][num
]);
79 notice(s_GameServ
, u
, "You have found \ 2%s\ 2!", p
->fight
->name
);
80 if (p
->fight
->hp
< p
->fight
->maxhp
)
81 p
->fight
->hp
= p
->fight
->maxhp
;
83 p
->battle
= NULL
; // Just to make sure
84 p
->master
= NULL
; // Just to make sure
87 else if (eventnum
< 12 && eventnum
>= 5) // 7% for the fountain
89 notice(s_GameServ
, u
, "In your path lies a beautiful fountain from which flows the crystal waters of life.");
90 notice(s_GameServ
, u
, "You wet your lips on the cool blue waters and feel rejuvenated");
93 else if (eventnum
< 5) // 5 % for the wishing well
95 notice(s_GameServ
, u
, "You come upon a pure green emerald studded magic wishing well.");
98 notice(s_GameServ
, u
, "Too bad you're broke. Guess you won't be having any wishes answered today.");
101 notice(s_GameServ
, u
, "You throw one of your gold pieces into the well and it vanishes into a puff of white smoke.");
102 notice(s_GameServ
, u
, "In an instant, the puff of smoke materializes into a gnome.");
103 notice(s_GameServ
, u
, "The gnome is holding something in his hand motioning for you to come closer.");
104 notice(s_GameServ
, u
, "It is a wand! The gnome is waving it through the air towards you!");
105 // 2% for each wishing well chance except for forest fights
106 if (eventnum
< 1) // forest fights
108 notice(s_GameServ
, u
, "EXTRA FOREST FIGHTS!!");
109 p
->forest_fights
+= (rand() % 11) + 5;
111 else if (eventnum
< 3)
113 notice(s_GameServ
, u
, "A SACK OF GOLD!");
114 p
->gold
+= (rand() % 1000) * (p
->level
+ (rand() % 10));
118 notice(s_GameServ
, u
, "Time seems to stand still for a moment.");
119 notice(s_GameServ
, u
, "EXTRA EXPERIENCE POINTS");
120 p
->exp
+= (rand() % 100) * (p
->level
+ rand() % 10);
124 else if (is_fighting(u
))
126 notice(s_GameServ
, u
, "You want to fight two monsters at once?");
132 Monster
*getNewMonster(Monster
*m
)
138 newguy
= new Monster
;
142 newguy
->name
= new char[strlen(m
->name
)];
143 strcpy(newguy
->name
, m
->name
);
147 newguy
->weapon
= new char[strlen(m
->weapon
)];
148 strcpy(newguy
->weapon
, m
->weapon
);
152 newguy
->death
= new char[strlen(m
->death
)];
153 strcpy(newguy
->death
, m
->death
);
156 newguy
->strength
= m
->strength
;
157 newguy
->gold
= m
->gold
;
158 newguy
->exp
= m
->exp
;
160 newguy
->maxhp
= m
->maxhp
;