ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/swamp.C
(Generate patch)

Comparing deliantra/server/server/swamp.C (file contents):
Revision 1.3 by root, Sun Sep 3 00:18:42 2006 UTC vs.
Revision 1.22 by root, Sat Nov 17 23:40:04 2018 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines