]>
jfr.im git - irc/gameservirc.git/blob - gameserv/c_forest.cpp
7 void do_forest(char *u
);
8 Monster
*getNewMonster(Monster
*m
);
9 void deleteMonster(Monster
*m
);
11 void forest(char *source
, char *buf
)
13 char *cmd
= strtok(buf
, " ");
20 if (stricmp(cmd
, "SEARCH") == 0)
23 } else if (stricmp(cmd
, "ATTACK") == 0) {
25 } else if (stricmp(cmd
, "RUN") == 0) {
27 } else if (stricmp(cmd
, "HEAL") == 0) {
34 void do_forest(char *u
)
38 int num
= rand() % 12;
41 if (!(source
= find(u
)) || !source
->stats
)
43 notice(s_GameServ
, u
, "You must be playing the game to search the forest!");
46 else if (!is_alive(source
))
48 notice(s_GameServ
, u
, "You are dead. Wait until tomorrow to search the forest some more.");
53 if (source
->stats
->forest_fights
<= 0)
55 notice(s_GameServ
, u
, "You are out of forest fights for the day. Wait "\
59 else if (!is_fighting(u
))
61 Player
*p
= source
->stats
;
63 p
->fight
= new Monster(monsters
[p
->level
- 1][num
]);
64 notice(s_GameServ
, u
, "You search the forest for something to kill...");
65 notice(s_GameServ
, u
, "You have found \ 2%s\ 2!", p
->fight
->name
);
66 p
->fight
->hp
= p
->fight
->maxhp
;
68 p
->battle
= NULL
; // Just to make sure
69 p
->master
= NULL
; // Just to make sure
72 else if (is_fighting(u
))
74 notice(s_GameServ
, u
, "You want to fight two monsters at once?");
80 Monster
*getNewMonster(Monster
*m
)
90 newguy
->name
= new char[strlen(m
->name
)];
91 strcpy(newguy
->name
, m
->name
);
95 newguy
->weapon
= new char[strlen(m
->weapon
)];
96 strcpy(newguy
->weapon
, m
->weapon
);
100 newguy
->death
= new char[strlen(m
->death
)];
101 strcpy(newguy
->death
, m
->death
);
104 newguy
->strength
= m
->strength
;
105 newguy
->gold
= m
->gold
;
106 newguy
->exp
= m
->exp
;
108 newguy
->maxhp
= m
->maxhp
;