… | |
… | |
1330 | unless hp was zero to start with, in which case it is infinite.*/ |
1330 | unless hp was zero to start with, in which case it is infinite.*/ |
1331 | |
1331 | |
1332 | void |
1332 | void |
1333 | move_marker (object *op) |
1333 | move_marker (object *op) |
1334 | { |
1334 | { |
|
|
1335 | if (object *tmp = op->ms ().player ()) |
|
|
1336 | { |
1335 | object *tmp, *tmp2; |
1337 | object *tmp2; |
1336 | |
1338 | |
1337 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
|
|
1338 | { |
|
|
1339 | if (tmp->type == PLAYER) |
|
|
1340 | { /* we've got someone to MARK */ |
|
|
1341 | |
|
|
1342 | /* remove an old force with a slaying field == op->name */ |
1339 | /* remove an old force with a slaying field == op->name */ |
1343 | for (tmp2 = tmp->inv; tmp2 != NULL; tmp2 = tmp2->below) |
1340 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
1344 | { |
|
|
1345 | if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->name)) |
1341 | if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->name)) |
1346 | break; |
|
|
1347 | } |
1342 | { |
1348 | |
|
|
1349 | if (tmp2) |
|
|
1350 | tmp2->destroy (); |
1343 | tmp2->destroy (); |
|
|
1344 | break; |
|
|
1345 | } |
1351 | |
1346 | |
1352 | /* cycle through his inventory to look for the MARK we want to |
1347 | /* cycle through his inventory to look for the MARK we want to |
1353 | * place |
1348 | * place |
1354 | */ |
1349 | */ |
1355 | for (tmp2 = tmp->inv; tmp2 != NULL; tmp2 = tmp2->below) |
1350 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
1356 | { |
|
|
1357 | if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) |
1351 | if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) |
1358 | break; |
1352 | break; |
1359 | } |
|
|
1360 | |
1353 | |
1361 | /* if we didn't find our own MARK */ |
1354 | /* if we didn't find our own MARK */ |
1362 | if (tmp2 == NULL) |
1355 | if (tmp2 == NULL) |
1363 | { |
1356 | { |
1364 | object *force = get_archetype (FORCE_NAME); |
1357 | object *force = get_archetype (FORCE_NAME); |
1365 | |
1358 | |
|
|
1359 | force->speed = 0; |
|
|
1360 | if (op->stats.food) |
|
|
1361 | { |
1366 | force->speed = 0; |
1362 | force->speed = 0.01; |
|
|
1363 | force->speed_left = -op->stats.food; |
|
|
1364 | } |
|
|
1365 | update_ob_speed (force); |
|
|
1366 | /* put in the lock code */ |
|
|
1367 | force->slaying = op->slaying; |
|
|
1368 | |
|
|
1369 | if (op->lore) |
|
|
1370 | force->lore = op->lore; |
|
|
1371 | |
|
|
1372 | insert_ob_in_ob (force, tmp); |
|
|
1373 | if (op->msg) |
|
|
1374 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); |
|
|
1375 | |
|
|
1376 | if (op->stats.hp > 0) |
|
|
1377 | { |
|
|
1378 | op->stats.hp--; |
1367 | if (op->stats.food) |
1379 | if (op->stats.hp == 0) |
1368 | { |
1380 | { |
1369 | force->speed = 0.01; |
1381 | /* marker expires--granted mark number limit */ |
1370 | force->speed_left = -op->stats.food; |
1382 | op->destroy (); |
|
|
1383 | return; |
1371 | } |
1384 | } |
1372 | update_ob_speed (force); |
|
|
1373 | /* put in the lock code */ |
|
|
1374 | force->slaying = op->slaying; |
|
|
1375 | |
|
|
1376 | if (op->lore) |
|
|
1377 | force->lore = op->lore; |
|
|
1378 | |
|
|
1379 | insert_ob_in_ob (force, tmp); |
|
|
1380 | if (op->msg) |
|
|
1381 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); |
|
|
1382 | |
|
|
1383 | if (op->stats.hp > 0) |
|
|
1384 | { |
|
|
1385 | op->stats.hp--; |
|
|
1386 | if (op->stats.hp == 0) |
|
|
1387 | { |
|
|
1388 | /* marker expires--granted mark number limit */ |
|
|
1389 | op->destroy (); |
|
|
1390 | return; |
|
|
1391 | } |
|
|
1392 | } |
1385 | } |
1393 | } /* if tmp2 == NULL */ |
1386 | } |
1394 | } /* if tmp->type == PLAYER */ |
1387 | } |
1395 | } /* For all objects on this space */ |
|
|
1396 | } |
1388 | } |
1397 | |
1389 | |
1398 | int |
1390 | int |
1399 | process_object (object *op) |
1391 | process_object (object *op) |
1400 | { |
1392 | { |