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

Comparing deliantra/server/server/attack.C (file contents):
Revision 1.11 by root, Mon Sep 11 20:26:41 2006 UTC vs.
Revision 1.15 by root, Thu Sep 14 20:46:10 2006 UTC

1 1
2/* 2/*
3 * static char *rcsid_attack_c = 3 * static char *rcsid_attack_c =
4 * "$Id: attack.C,v 1.11 2006/09/11 20:26:41 root Exp $"; 4 * "$Id: attack.C,v 1.15 2006/09/14 20:46:10 root Exp $";
5 */ 5 */
6 6
7/* 7/*
8 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
9 9
177 if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) 177 if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE))
178 { 178 {
179 const char *arch = op->other_arch->name; 179 const char *arch = op->other_arch->name;
180 180
181 op = decrease_ob_nr (op, 1); 181 op = decrease_ob_nr (op, 1);
182
182 if (op) 183 if (op)
183 fix_stopped_item (op, m, originator); 184 fix_stopped_item (op, m, originator);
185
184 if ((op = get_archetype (arch)) != NULL) 186 if ((op = get_archetype (arch)) != NULL)
185 { 187 {
186 if (env) 188 if (env)
187 { 189 {
188 op->x = env->x, op->y = env->y; 190 op->x = env->x, op->y = env->y;
194 { 196 {
195 op->x = x, op->y = y; 197 op->x = x, op->y = y;
196 insert_ob_in_map (op, m, originator, 0); 198 insert_ob_in_map (op, m, originator, 0);
197 } 199 }
198 } 200 }
201
199 return; 202 return;
200 } 203 }
204
201 if (type & AT_CANCELLATION) 205 if (type & AT_CANCELLATION)
202 { /* Cancellation. */ 206 { /* Cancellation. */
203 cancellation (op); 207 cancellation (op);
204 fix_stopped_item (op, m, originator); 208 fix_stopped_item (op, m, originator);
205 return; 209 return;
206 } 210 }
211
207 if (op->nrof > 1) 212 if (op->nrof > 1)
208 { 213 {
209 op = decrease_ob_nr (op, rndm (0, op->nrof - 1)); 214 op = decrease_ob_nr (op, rndm (0, op->nrof - 1));
215
210 if (op) 216 if (op)
211 fix_stopped_item (op, m, originator); 217 fix_stopped_item (op, m, originator);
212 } 218 }
213 else 219 else
214 { 220 {
215 if (op->env) 221 if (op->env)
216 { 222 {
217 object *tmp = is_player_inv (op->env); 223 object *tmp = is_player_inv (op->env);
218 224
219 if (tmp) 225 if (tmp)
220 {
221 esrv_del_item (tmp->contr, op->count); 226 esrv_del_item (tmp->contr, op->count);
222 }
223 } 227 }
228
224 if (!QUERY_FLAG (op, FLAG_REMOVED)) 229 if (!QUERY_FLAG (op, FLAG_REMOVED))
225 remove_ob (op); 230 remove_ob (op);
231
226 free_object (op); 232 free_object (op);
227 } 233 }
234
228 if (type & (AT_FIRE | AT_ELECTRICITY)) 235 if (type & (AT_FIRE | AT_ELECTRICITY))
229 {
230 if (env) 236 if (env)
231 { 237 {
232 op = get_archetype ("burnout"); 238 op = get_archetype ("burnout");
233 op->x = env->x, op->y = env->y; 239 op->x = env->x, op->y = env->y;
234 insert_ob_in_ob (op, env); 240 insert_ob_in_ob (op, env);
235 } 241 }
236 else 242 else
237 {
238 replace_insert_ob_in_map ("burnout", originator); 243 replace_insert_ob_in_map ("burnout", originator);
239 } 244
240 }
241 return; 245 return;
242 } 246 }
247
243 /* The value of 50 is arbitrary. */ 248 /* The value of 50 is arbitrary. */
244 if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2)) 249 if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2))
245 { 250 {
246 object *tmp; 251 object *tmp;
247 archetype *at = find_archetype ("icecube"); 252 archetype *at = find_archetype ("icecube");
248 253
249 if (at == NULL) 254 if (at == NULL)
250 return; 255 return;
256
251 op = stop_item (op); 257 op = stop_item (op);
252 if (op == NULL) 258 if (op == NULL)
253 return; 259 return;
260
254 if ((tmp = present_arch (at, op->map, op->x, op->y)) == NULL) 261 if ((tmp = present_arch (at, op->map, op->x, op->y)) == NULL)
255 { 262 {
256 tmp = arch_to_object (at); 263 tmp = arch_to_object (at);
257 tmp->x = op->x, tmp->y = op->y; 264 tmp->x = op->x, tmp->y = op->y;
258 /* This was in the old (pre new movement code) - 265 /* This was in the old (pre new movement code) -
261 */ 268 */
262 tmp->move_slow_penalty = 0; 269 tmp->move_slow_penalty = 0;
263 tmp->move_slow = 0; 270 tmp->move_slow = 0;
264 insert_ob_in_map (tmp, op->map, originator, 0); 271 insert_ob_in_map (tmp, op->map, originator, 0);
265 } 272 }
273
266 if (!QUERY_FLAG (op, FLAG_REMOVED)) 274 if (!QUERY_FLAG (op, FLAG_REMOVED))
267 remove_ob (op); 275 remove_ob (op);
276
268 (void) insert_ob_in_ob (op, tmp); 277 insert_ob_in_ob (op, tmp);
269 return; 278 return;
270 } 279 }
271} 280}
272 281
273/* Object op is hitting the map. 282/* Object op is hitting the map.
1331 break; 1340 break;
1332 case ATNR_TURN_UNDEAD: 1341 case ATNR_TURN_UNDEAD:
1333 { 1342 {
1334 if (QUERY_FLAG (op, FLAG_UNDEAD)) 1343 if (QUERY_FLAG (op, FLAG_UNDEAD))
1335 { 1344 {
1336 object *owner = get_owner (hitter) == NULL ? hitter : get_owner (hitter); 1345 object *owner = hitter->owner ? (object *)hitter->owner : hitter;
1337 object *god = find_god (determine_god (owner)); 1346 object *god = find_god (determine_god (owner));
1338 int div = 1; 1347 int div = 1;
1339 1348
1340 /* if undead are not an enemy of your god, you turn them 1349 /* if undead are not an enemy of your god, you turn them
1341 * at half strength */ 1350 * at half strength */
1367 break; 1376 break;
1368 case ATNR_HOLYWORD: 1377 case ATNR_HOLYWORD:
1369 { 1378 {
1370 /* This has already been handled by hit_player, 1379 /* This has already been handled by hit_player,
1371 * no need to check twice -- DAMN */ 1380 * no need to check twice -- DAMN */
1372 1381 object *owner = hitter->owner ? (object *)hitter->owner : hitter;
1373 object *owner = get_owner (hitter) == NULL ? hitter : get_owner (hitter);
1374 1382
1375 /* As with turn undead above, give a bonus on the saving throw */ 1383 /* As with turn undead above, give a bonus on the saving throw */
1376 if ((op->level + (op->resist[ATNR_HOLYWORD] / 100)) < owner->level + turn_bonus[owner->stats.Wis]) 1384 if ((op->level + (op->resist[ATNR_HOLYWORD] / 100)) < owner->level + turn_bonus[owner->stats.Wis])
1377 scare_creature (op, owner); 1385 scare_creature (op, owner);
1378 } 1386 }
1687 { 1695 {
1688 play_sound_player_only (owner1->contr, SOUND_PET_IS_KILLED, 0, 0); 1696 play_sound_player_only (owner1->contr, SOUND_PET_IS_KILLED, 0, 0);
1689 /* Maybe we should include the owner that killed this, maybe not */ 1697 /* Maybe we should include the owner that killed this, maybe not */
1690 new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); 1698 new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name);
1691 } 1699 }
1700
1692 remove_friendly_object (op); 1701 remove_friendly_object (op);
1693 } 1702 }
1703
1694 remove_ob (op); 1704 remove_ob (op);
1695 free_object (op); 1705 free_object (op);
1696 } 1706 }
1697 /* Player has been killed! */ 1707 /* Player has been killed! */
1698 else 1708 else
1700 if (owner->type == PLAYER) 1710 if (owner->type == PLAYER)
1701 { 1711 {
1702 snprintf (op->contr->killer, BIG_NAME, "%s the %s", &owner->name, owner->contr->title); 1712 snprintf (op->contr->killer, BIG_NAME, "%s the %s", &owner->name, owner->contr->title);
1703 } 1713 }
1704 else 1714 else
1705 {
1706 strncpy (op->contr->killer, hitter->name, BIG_NAME); 1715 assign (op->contr->killer, hitter->name);
1707 op->contr->killer[BIG_NAME - 1] = '\0';
1708 }
1709 } 1716 }
1717
1710 /* This was return -1 - that doesn't seem correct - if we return -1, process 1718 /* This was return -1 - that doesn't seem correct - if we return -1, process
1711 * continues in the calling function. 1719 * continues in the calling function.
1712 */ 1720 */
1713 return maxdam; 1721 return maxdam;
1714} 1722}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines