ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/swamp.C
Revision: 1.12
Committed: Wed Apr 30 06:40:28 2008 UTC (16 years, 1 month ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_53
Changes since 1.11: +2 -2 lines
Log Message:
*** empty log message ***

File Contents

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