]>
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
)
39 int num
= rand() % 12;
45 notice(s_GameServ
, u
, "You must be playing the game to search the forest!");
49 if (source
->stats
->forest_fights
<= 0)
51 notice(s_GameServ
, u
, "You are out of forest fights for the day. Wait "\
55 else if (isnt_fighting(u
))
57 Player
*p
= source
->stats
;
59 p
->fight
= new Monster(monsters
[p
->level
- 1][num
]);
60 notice(s_GameServ
, u
, "You search the forest for something to kill...");
61 notice(s_GameServ
, u
, "You have found \ 2%s\ 2!", p
->fight
->name
);
62 p
->fight
->hp
= p
->fight
->maxhp
;
66 else if (is_fighting(u
))
68 notice(s_GameServ
, u
, "You want to fight two monsters at once?");
74 Monster
*getNewMonster(Monster
*m
)
84 newguy
->name
= new char[strlen(m
->name
)];
85 strcpy(newguy
->name
, m
->name
);
89 newguy
->weapon
= new char[strlen(m
->weapon
)];
90 strcpy(newguy
->weapon
, m
->weapon
);
94 newguy
->death
= new char[strlen(m
->death
)];
95 strcpy(newguy
->death
, m
->death
);
98 newguy
->strength
= m
->strength
;
99 newguy
->gold
= m
->gold
;
100 newguy
->exp
= m
->exp
;
102 newguy
->maxhp
= m
->maxhp
;