]>
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;
44 notice(s_GameServ
, u
, "You must be playing the game to search the forest!");
48 if (source
->stats
->forest_fights
<= 0)
50 notice(s_GameServ
, u
, "You are out of forest fights for the day. Wait "\
54 else if (isnt_fighting(u
))
56 Player
*p
= source
->stats
;
58 p
->fight
= new Monster(monsters
[p
->level
- 1][num
]);
59 notice(s_GameServ
, u
, "You search the forest for something to kill...");
60 notice(s_GameServ
, u
, "You have found \ 2%s\ 2!", p
->fight
->name
);
61 p
->fight
->hp
= p
->fight
->maxhp
;
63 p
->battle
= NULL
; // Just to make sure
64 p
->master
= NULL
; // Just to make sure
67 else if (is_fighting(u
))
69 notice(s_GameServ
, u
, "You want to fight two monsters at once?");
75 Monster
*getNewMonster(Monster
*m
)
85 newguy
->name
= new char[strlen(m
->name
)];
86 strcpy(newguy
->name
, m
->name
);
90 newguy
->weapon
= new char[strlen(m
->weapon
)];
91 strcpy(newguy
->weapon
, m
->weapon
);
95 newguy
->death
= new char[strlen(m
->death
)];
96 strcpy(newguy
->death
, m
->death
);
99 newguy
->strength
= m
->strength
;
100 newguy
->gold
= m
->gold
;
101 newguy
->exp
= m
->exp
;
103 newguy
->maxhp
= m
->maxhp
;