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.4 by root, Sun Sep 10 15:59:58 2006 UTC

1
1/* 2/*
2 * static char *rcsid_swamp_c = 3 * static char *rcsid_swamp_c =
3 * "$Id: swamp.C,v 1.3 2006/09/03 00:18:42 root Exp $"; 4 * "$Id: swamp.C,v 1.4 2006/09/10 15:59:58 root Exp $";
4 */ 5 */
5 6
6/* 7/*
7 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
8 9
26 The authors can be reached via e-mail at crossfire-devel@real-time.com 27 The authors can be reached via e-mail at crossfire-devel@real-time.com
27*/ 28*/
28 29
29#include <global.h> 30#include <global.h>
30#ifndef __CEXTRACT__ 31#ifndef __CEXTRACT__
31#include <sproto.h> 32# include <sproto.h>
32#endif 33#endif
33 34
34/* Note this code is very specialized for swamps, in terms of the messages 35/* Note this code is very specialized for swamps, in terms of the messages
35 * as well as handling of move types. 36 * as well as handling of move types.
36 */ 37 */
37 38
39void
38void walk_on_deep_swamp (object *op, object *victim) 40walk_on_deep_swamp (object *op, object *victim)
39{ 41{
40 if (victim->type == PLAYER && victim->stats.hp >= 0 && !(victim->move_type & MOVE_FLYING)) { 42 if (victim->type == PLAYER && victim->stats.hp >= 0 && !(victim->move_type & MOVE_FLYING))
43 {
41 new_draw_info_format(NDI_UNIQUE, 0, victim, "You are down to your knees in the %s.", &op->name); 44 new_draw_info_format (NDI_UNIQUE, 0, victim, "You are down to your knees in the %s.", &op->name);
42 op->stats.food = 1; 45 op->stats.food = 1;
43 victim->speed_left -= op->move_slow_penalty; 46 victim->speed_left -= op->move_slow_penalty;
44 } 47 }
45} 48}
46 49
50void
47void move_deep_swamp (object *op) 51move_deep_swamp (object *op)
48{ 52{
49 object *above = op->above; 53 object *above = op->above;
50 object *nabove; 54 object *nabove;
51 55
52 while(above) { 56 while (above)
57 {
53 nabove = above->above; 58 nabove = above->above;
54 if (above->type == PLAYER && !(above->move_type & MOVE_FLYING) && above->stats.hp >= 0 && !QUERY_FLAG(above,FLAG_WIZ)) { 59 if (above->type == PLAYER && !(above->move_type & MOVE_FLYING) && above->stats.hp >= 0 && !QUERY_FLAG (above, FLAG_WIZ))
60 {
55 if (op->stats.food < 1) { 61 if (op->stats.food < 1)
62 {
56 LOG (llevDebug, "move_deep_swamp(): player is here, but state is " 63 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; 64 op->stats.food = 1;
59 } 65 }
60 66
61 switch(op->stats.food) { 67 switch (op->stats.food)
68 {
62 case 1: 69 case 1:
63 if (rndm(0, 2) == 0) { 70 if (rndm (0, 2) == 0)
64 new_draw_info_format(NDI_UNIQUE, 0,above, 71 {
65 "You are down to your waist in the wet %s.", &op->name); 72 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; 73 op->stats.food = 2;
67 above->speed_left -= op->move_slow_penalty; 74 above->speed_left -= op->move_slow_penalty;
68 } 75 }
69 break; 76 break;
70 77
71 case 2: 78 case 2:
72 if (rndm(0, 2) == 0) { 79 if (rndm (0, 2) == 0)
73 new_draw_info_format(NDI_UNIQUE | NDI_RED, 0,above, 80 {
74 "You are down to your NECK in the dangerous %s.", &op->name); 81 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; 82 op->stats.food = 3;
76 sprintf(above->contr->killer,"drowning in a %s", &op->name); 83 sprintf (above->contr->killer, "drowning in a %s", &op->name);
77 above->stats.hp--; 84 above->stats.hp--;
78 above->speed_left -= op->move_slow_penalty; 85 above->speed_left -= op->move_slow_penalty;
79 } 86 }
80 break; 87 break;
81 88
82 case 3: 89 case 3:
83 if (rndm(0, 4) == 0) { 90 if (rndm (0, 4) == 0)
91 {
84 object *woodsman = find_obj_by_type_subtype(above, SKILL, SK_WOODSMAN); 92 object *woodsman = find_obj_by_type_subtype (above, SKILL, SK_WOODSMAN);
85 93
86 /* player is ready to drown - only woodsman skill can save him */ 94 /* player is ready to drown - only woodsman skill can save him */
87 if (!woodsman) { 95 if (!woodsman)
96 {
88 op->stats.food = 0; 97 op->stats.food = 0;
89 new_draw_info_format(NDI_UNIQUE | NDI_ALL, 1, NULL, 98 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);
91 sprintf(above->contr->killer,"drowning in a %s", &op->name); 99 sprintf (above->contr->killer, "drowning in a %s", &op->name);
92 100
93 above->stats.hp = -1; 101 above->stats.hp = -1;
94 kill_player(above); /* player dies in the swamp */ 102 kill_player (above); /* player dies in the swamp */
95 } 103 }
96 else { 104 else
105 {
97 op->stats.food = 2; 106 op->stats.food = 2;
98 new_draw_info_format(NDI_UNIQUE, 0,above, 107 new_draw_info_format (NDI_UNIQUE, 0, above,
99 "You almost drowned in the %s! You survived due to your woodsman skill.", &op->name); 108 "You almost drowned in the %s! You survived due to your woodsman skill.", &op->name);
100 } 109 }
101 } 110 }
102 break; 111 break;
103 } 112 }
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 } 113 }
114 else if (!QUERY_FLAG (above, FLAG_ALIVE) && !(above->move_type & MOVE_FLYING) &&
115 !(QUERY_FLAG (above, FLAG_IS_FLOOR)) && !(QUERY_FLAG (above, FLAG_OVERLAY_FLOOR)) && !(QUERY_FLAG (above, FLAG_NO_PICK)))
116 {
117 if (rndm (0, 2) == 0)
118 decrease_ob (above);
119 }
109 above = nabove; 120 above = nabove;
110 } 121 }
111} 122}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines