ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/swamp.C
Revision: 1.13
Committed: Tue May 6 16:55:26 2008 UTC (16 years ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_80, rel-2_6, rel-2_7, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, rel-2_78, rel-2_61
Changes since 1.12: +1 -1 lines
Log Message:
update copyright

File Contents

# Content
1 /*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2005,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 *
8 * Deliantra is free software: you can redistribute it and/or modify
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 *
13 * 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 *
18 * 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 *
21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */
23
24 #include <global.h>
25 #ifndef __CEXTRACT__
26 # include <sproto.h>
27 #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 void
34 walk_on_deep_swamp (object *op, object *victim)
35 {
36 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 }
42 }
43
44 void
45 move_deep_swamp (object *op)
46 {
47 object *above = op->above;
48 object *nabove;
49
50 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 }
60
61 switch (op->stats.food)
62 {
63 case 1:
64 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 }
70 break;
71
72 case 2:
73 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 above->contr->killer = op;
78 above->stats.hp--;
79 above->speed_left -= op->move_slow_penalty;
80 }
81 break;
82
83 case 3:
84 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 above->contr->killer = op;
94
95 above->stats.hp = -1;
96 kill_player (above); /* player dies in the swamp */
97 }
98 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 }
104 }
105 break;
106 }
107 }
108 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 above->decrease ();
113 }
114
115 above = nabove;
116 }
117 }