ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/swamp.C
Revision: 1.22
Committed: Sat Nov 17 23:40:04 2018 UTC (5 years, 6 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.21: +1 -0 lines
Log Message:
copyright update 2018

File Contents

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