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