]>
Commit | Line | Data |
---|---|---|
85ce9d3e | 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 | void forest(char *source, char *buf) | |
10 | { | |
11 | char *cmd = strtok(buf, " "); | |
12 | ||
13 | if (cmd[0] == ':') | |
14 | cmd++; | |
15 | if (source[0] == ':') | |
16 | source++; | |
17 | ||
18 | if (stricmp(cmd, "SEARCH") == 0) | |
19 | { | |
20 | do_forest(source); | |
21 | } else if (stricmp(cmd, "ATTACK") == 0) { | |
22 | do_attack(source); | |
23 | } | |
24 | ||
25 | source--; | |
26 | } | |
27 | ||
28 | void do_forest(char *u) | |
29 | { | |
30 | aClient *source; | |
31 | char *cmd; | |
32 | ||
33 | int num = rand() % 12; | |
34 | ||
35 | source = find(u); | |
36 | ||
37 | if (!is_playing(u)) | |
38 | { | |
39 | notice(s_GameServ, u, "You must be playing the game to search the forest!"); | |
40 | } | |
41 | else | |
42 | { | |
43 | if (source->stats->forest_fights <= 0) | |
44 | { | |
45 | notice(s_GameServ, u, "You are out of forest fights for the day. Wait "\ | |
46 | "till tomorrow!"); | |
47 | return; | |
48 | } | |
49 | else if (isnt_fighting(u)) | |
50 | { | |
51 | Player *ni = source->stats; | |
52 | ni->forest_fights--; | |
53 | ni->fight = &monsters[ni->level - 1][num]; | |
54 | notice(s_GameServ, u, "You search the forest for something to kill..."); | |
55 | notice(s_GameServ, u, "You have found \ 2%s\ 2!", ni->fight->name); | |
56 | ni->fight->hp = ni->fight->maxhp; | |
57 | ni->battle = NULL; | |
58 | display_monster(u); | |
59 | } | |
60 | else if (is_fighting(u)) | |
61 | { | |
62 | notice(s_GameServ, u, "You want to fight two monsters at once?"); | |
63 | } | |
64 | } | |
65 | ||
66 | } | |
67 |