]> jfr.im git - irc/gameservirc.git/blob - gameserv/c_forest.cpp
Again, trying to sync the two cvs repositories.
[irc/gameservirc.git] / gameserv / c_forest.cpp
1 #include "sockhelp.h"
2 #include "aClient.h"
3 #include "list.h"
4 #include "extern.h"
5 #include <cctype>
6
7 void do_forest(char *u);
8
9
10 void forest(char *source, char *buf)
11 {
12 char *cmd = strtok(buf, " ");
13
14 if (cmd[0] == ':')
15 cmd++;
16 if (source[0] == ':')
17 source++;
18
19 if (stricmp(cmd, "SEARCH") == 0)
20 {
21 do_forest(source);
22 } else if (stricmp(cmd, "ATTACK") == 0) {
23 do_attack(source);
24 } else if (stricmp(cmd, "HEAL") == 0) {
25 do_heal(source);
26 }
27
28 source--;
29 }
30
31 void do_forest(char *u)
32 {
33 aClient *source;
34 char *cmd;
35
36 int num = rand() % 12;
37
38 source = find(u);
39
40 if (!is_playing(u))
41 {
42 notice(s_GameServ, u, "You must be playing the game to search the forest!");
43 }
44 else
45 {
46 if (source->stats->forest_fights <= 0)
47 {
48 notice(s_GameServ, u, "You are out of forest fights for the day. Wait "\
49 "till tomorrow!");
50 return;
51 }
52 else if (isnt_fighting(u))
53 {
54 Player *ni = source->stats;
55 ni->forest_fights--;
56 ni->fight = &monsters[ni->level - 1][num];
57 notice(s_GameServ, u, "You search the forest for something to kill...");
58 notice(s_GameServ, u, "You have found \ 2%s\ 2!", ni->fight->name);
59 ni->fight->hp = ni->fight->maxhp;
60 ni->battle = NULL;
61 display_monster(u);
62 }
63 else if (is_fighting(u))
64 {
65 notice(s_GameServ, u, "You want to fight two monsters at once?");
66 }
67 }
68
69 }
70