]>
jfr.im git - irc/gameservirc.git/blob - gameserv/c_forest.cpp
8 void do_forest(char *u
);
9 Monster
*getNewMonster(Monster
*m
);
10 void deleteMonster(Monster
*m
);
12 void forest(char *source
, char *buf
)
14 char *cmd
= strtok(buf
, " ");
21 if (stricmp(cmd
, "SEARCH") == 0)
24 } else if (stricmp(cmd
, "ATTACK") == 0) {
26 } else if (stricmp(cmd
, "RUN") == 0) {
28 } else if (stricmp(cmd
, "HEAL") == 0) {
35 void do_forest(char *u
)
39 int num
= rand() % 12;
42 if (!(source
= find(u
)))
44 notice(s_GameServ
, u
, "Fatal Error in do_forest. Contact a %S admin for help.");
47 else if (!is_playing(source
))
49 notice(s_GameServ
, u
, "You must be playing the game to search the forest!");
52 Player
*p
= source
->stats
;
56 notice(s_GameServ
, u
, "You are dead. Wait until tomorrow to search the forest some more.");
61 if (p
->forest_fights
<= 0)
63 notice(s_GameServ
, u
, "You are out of forest fights for the day. Wait "\
67 else if (!is_fighting(u
))
69 int eventnum
= rand() % 100;
72 notice(s_GameServ
, u
, "You search the forest for something to kill...");
74 // 88% of forest searching turns up a monster
77 p
->fight
= new Monster(monsters
[p
->level
- 1][num
]);
78 notice(s_GameServ
, u
, "You have found \ 2%s\ 2!", p
->fight
->name
);
79 if (p
->fight
->hp
< p
->fight
->maxhp
)
80 p
->fight
->hp
= p
->fight
->maxhp
;
82 p
->battle
= NULL
; // Just to make sure
83 p
->master
= NULL
; // Just to make sure
86 else if (eventnum
< 12 && eventnum
>= 5) // 7% for the fountain
88 notice(s_GameServ
, u
, "In your path lies a beautiful fountain from which flows the crystal waters of life.");
89 notice(s_GameServ
, u
, "You wet your lips on the cool blue waters and feel rejuvenated");
92 else if (eventnum
< 5) // 5 % for the wishing well
94 notice(s_GameServ
, u
, "You come upon a pure green emerald studded magic wishing well.");
97 notice(s_GameServ
, u
, "Too bad you're broke. Guess you won't be having any wishes answered today.");
100 notice(s_GameServ
, u
, "You throw one of your gold pieces into the well and it vanishes into a puff of white smoke.");
101 notice(s_GameServ
, u
, "In an instant, the puff of smoke materializes into a gnome.");
102 notice(s_GameServ
, u
, "The gnome is holding something in his hand motioning for you to come closer.");
103 notice(s_GameServ
, u
, "It is a wand! The gnome is waving it through the air towards you!");
104 // 2% for each wishing well chance except for forest fights
105 if (eventnum
< 1) // forest fights
107 notice(s_GameServ
, u
, "EXTRA FOREST FIGHTS!!");
108 p
->forest_fights
+= (rand() % 11) + 5;
110 else if (eventnum
< 3)
112 notice(s_GameServ
, u
, "A SACK OF GOLD!");
113 p
->gold
+= (rand() % 1000) * (p
->level
+ (rand() % 10));
117 notice(s_GameServ
, u
, "Time seems to stand still for a moment.");
118 notice(s_GameServ
, u
, "EXTRA EXPERIENCE POINTS");
119 p
->exp
+= (rand() % 100) * (p
->level
+ rand() % 10);
123 else if (is_fighting(u
))
125 notice(s_GameServ
, u
, "You want to fight two monsters at once?");
131 Monster
*getNewMonster(Monster
*m
)
137 newguy
= new Monster
;
141 newguy
->name
= new char[strlen(m
->name
)];
142 strcpy(newguy
->name
, m
->name
);
146 newguy
->weapon
= new char[strlen(m
->weapon
)];
147 strcpy(newguy
->weapon
, m
->weapon
);
151 newguy
->death
= new char[strlen(m
->death
)];
152 strcpy(newguy
->death
, m
->death
);
155 newguy
->strength
= m
->strength
;
156 newguy
->gold
= m
->gold
;
157 newguy
->exp
= m
->exp
;
159 newguy
->maxhp
= m
->maxhp
;