]>
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 int eventnum
= rand() % 100;
62 Player
*p
= source
->stats
;
65 notice(s_GameServ
, u
, "You search the forest for something to kill...");
69 p
->fight
= new Monster(monsters
[p
->level
- 1][num
]);
70 notice(s_GameServ
, u
, "You have found \ 2%s\ 2!", p
->fight
->name
);
71 if (p
->fight
->hp
< p
->fight
->maxhp
)
72 p
->fight
->hp
= p
->fight
->maxhp
;
74 p
->battle
= NULL
; // Just to make sure
75 p
->master
= NULL
; // Just to make sure
78 else if (eventnum
< 25 && eventnum
>= 15) // 10%
80 notice(s_GameServ
, u
, "In your path lies a beautiful fountain from which flows the crystal waters of life.");
81 notice(s_GameServ
, u
, "You wet your lips on the cool blue waters and feel rejuvenated");
82 p
->forest_fights
+= 10;
85 else if (eventnum
< 15) // 15 % for the wishing well
87 notice(s_GameServ
, u
, "You come upon a pure green emerald studded magic wishing well.");
90 notice(s_GameServ
, u
, "Too bad you're broke. Guess you won't be having any wishes answered today.");
93 notice(s_GameServ
, u
, "You throw one of your gold pieces into the well and it vanishes into a puff of white smoke.");
94 notice(s_GameServ
, u
, "In an instant, the puff of smoke materializes into a gnome.");
95 notice(s_GameServ
, u
, "The gnome is holding something in his hand motioning for you to come closer.");
96 notice(s_GameServ
, u
, "It is a wand! The gnome is waving it through the air towards you!");
97 // 5% for each wishing well chance
98 if (eventnum
< 5) // forest fights
100 notice(s_GameServ
, u
, "EXTRA FOREST FIGHTS!!");
101 p
->forest_fights
+= (rand() % 11) + 5;
103 else if (eventnum
< 10)
105 notice(s_GameServ
, u
, "A SACK OF GOLD!");
106 p
->gold
+= (rand() % 1000) * (p
->level
+ (rand() % 10));
110 notice(s_GameServ
, u
, "Time seems to stand still for a moment.");
111 notice(s_GameServ
, u
, "EXTRA EXPERIENCE POINTS");
112 p
->exp
+= (rand() % 100) * (p
->level
+ rand() % 10);
116 else if (is_fighting(u
))
118 notice(s_GameServ
, u
, "You want to fight two monsters at once?");
124 Monster
*getNewMonster(Monster
*m
)
130 newguy
= new Monster
;
134 newguy
->name
= new char[strlen(m
->name
)];
135 strcpy(newguy
->name
, m
->name
);
139 newguy
->weapon
= new char[strlen(m
->weapon
)];
140 strcpy(newguy
->weapon
, m
->weapon
);
144 newguy
->death
= new char[strlen(m
->death
)];
145 strcpy(newguy
->death
, m
->death
);
148 newguy
->strength
= m
->strength
;
149 newguy
->gold
= m
->gold
;
150 newguy
->exp
= m
->exp
;
152 newguy
->maxhp
= m
->maxhp
;