ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/swamp.C
Revision: 1.4
Committed: Sun Sep 10 15:59:58 2006 UTC (17 years, 9 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.3: +64 -53 lines
Log Message:
indent

File Contents

# Content
1
2 /*
3 * static char *rcsid_swamp_c =
4 * "$Id: swamp.C,v 1.3 2006-09-03 00:18:42 root Exp $";
5 */
6
7 /*
8 CrossFire, A Multiplayer game for X-windows
9
10 Copyright (C) 2005 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 The authors can be reached via e-mail at crossfire-devel@real-time.com
28 */
29
30 #include <global.h>
31 #ifndef __CEXTRACT__
32 # include <sproto.h>
33 #endif
34
35 /* Note this code is very specialized for swamps, in terms of the messages
36 * as well as handling of move types.
37 */
38
39 void
40 walk_on_deep_swamp (object *op, object *victim)
41 {
42 if (victim->type == PLAYER && victim->stats.hp >= 0 && !(victim->move_type & MOVE_FLYING))
43 {
44 new_draw_info_format (NDI_UNIQUE, 0, victim, "You are down to your knees in the %s.", &op->name);
45 op->stats.food = 1;
46 victim->speed_left -= op->move_slow_penalty;
47 }
48 }
49
50 void
51 move_deep_swamp (object *op)
52 {
53 object *above = op->above;
54 object *nabove;
55
56 while (above)
57 {
58 nabove = above->above;
59 if (above->type == PLAYER && !(above->move_type & MOVE_FLYING) && above->stats.hp >= 0 && !QUERY_FLAG (above, FLAG_WIZ))
60 {
61 if (op->stats.food < 1)
62 {
63 LOG (llevDebug, "move_deep_swamp(): player is here, but state is " "%d\n", op->stats.food);
64 op->stats.food = 1;
65 }
66
67 switch (op->stats.food)
68 {
69 case 1:
70 if (rndm (0, 2) == 0)
71 {
72 new_draw_info_format (NDI_UNIQUE, 0, above, "You are down to your waist in the wet %s.", &op->name);
73 op->stats.food = 2;
74 above->speed_left -= op->move_slow_penalty;
75 }
76 break;
77
78 case 2:
79 if (rndm (0, 2) == 0)
80 {
81 new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, above, "You are down to your NECK in the dangerous %s.", &op->name);
82 op->stats.food = 3;
83 sprintf (above->contr->killer, "drowning in a %s", &op->name);
84 above->stats.hp--;
85 above->speed_left -= op->move_slow_penalty;
86 }
87 break;
88
89 case 3:
90 if (rndm (0, 4) == 0)
91 {
92 object *woodsman = find_obj_by_type_subtype (above, SKILL, SK_WOODSMAN);
93
94 /* player is ready to drown - only woodsman skill can save him */
95 if (!woodsman)
96 {
97 op->stats.food = 0;
98 new_draw_info_format (NDI_UNIQUE | NDI_ALL, 1, NULL, "%s disappeared into a %s.", &above->name, &op->name);
99 sprintf (above->contr->killer, "drowning in a %s", &op->name);
100
101 above->stats.hp = -1;
102 kill_player (above); /* player dies in the swamp */
103 }
104 else
105 {
106 op->stats.food = 2;
107 new_draw_info_format (NDI_UNIQUE, 0, above,
108 "You almost drowned in the %s! You survived due to your woodsman skill.", &op->name);
109 }
110 }
111 break;
112 }
113 }
114 else if (!QUERY_FLAG (above, FLAG_ALIVE) && !(above->move_type & MOVE_FLYING) &&
115 !(QUERY_FLAG (above, FLAG_IS_FLOOR)) && !(QUERY_FLAG (above, FLAG_OVERLAY_FLOOR)) && !(QUERY_FLAG (above, FLAG_NO_PICK)))
116 {
117 if (rndm (0, 2) == 0)
118 decrease_ob (above);
119 }
120 above = nabove;
121 }
122 }