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

Comparing deliantra/server/server/monster.C (file contents):
Revision 1.62 by root, Thu Jan 1 16:05:13 2009 UTC vs.
Revision 1.65 by root, Fri Sep 25 18:44:58 2009 UTC

390 { 390 {
391 if (op->attack_movement & HI4) 391 if (op->attack_movement & HI4)
392 { 392 {
393 switch (op->attack_movement & HI4) 393 switch (op->attack_movement & HI4)
394 { 394 {
395 case (PETMOVE): 395 case PETMOVE:
396 pet_move (op); 396 pet_move (op);
397 break; 397 break;
398 398
399 case (CIRCLE1): 399 case CIRCLE1:
400 circ1_move (op); 400 circ1_move (op);
401 break; 401 break;
402 402
403 case (CIRCLE2): 403 case CIRCLE2:
404 circ2_move (op); 404 circ2_move (op);
405 break; 405 break;
406 406
407 case (PACEV): 407 case PACEV:
408 pace_movev (op); 408 pace_movev (op);
409 break; 409 break;
410 410
411 case (PACEH): 411 case PACEH:
412 pace_moveh (op); 412 pace_moveh (op);
413 break; 413 break;
414 414
415 case (PACEV2): 415 case PACEV2:
416 pace2_movev (op); 416 pace2_movev (op);
417 break; 417 break;
418 418
419 case (PACEH2): 419 case PACEH2:
420 pace2_moveh (op); 420 pace2_moveh (op);
421 break; 421 break;
422 422
423 case (RANDO): 423 case RANDO:
424 rand_move (op); 424 rand_move (op);
425 break; 425 break;
426 426
427 case (RANDO2): 427 case RANDO2:
428 move_randomly (op); 428 move_randomly (op);
429 break; 429 break;
430 } 430 }
431 431
432 return 0; 432 return 0;
1420} 1420}
1421 1421
1422void 1422void
1423npc_call_help (object *op) 1423npc_call_help (object *op)
1424{ 1424{
1425 int x, y, mflags; 1425 unordered_mapwalk (op, -7, -7, 7, 7)
1426 object *npc;
1427 sint16 sx, sy;
1428 maptile *m;
1429
1430 for (x = -3; x < 4; x++)
1431 for (y = -3; y < 4; y++)
1432 { 1426 {
1433 m = op->map; 1427 mapspace &ms = m->at (nx, ny);
1434 sx = op->x + x; 1428
1435 sy = op->y + y;
1436 mflags = get_map_flags (m, &m, sx, sy, &sx, &sy);
1437 /* If nothing alive on this space, no need to search the space. */ 1429 /* If nothing alive on this space, no need to search the space. */
1438 if ((mflags & P_OUT_OF_MAP) || !(mflags & P_IS_ALIVE)) 1430 if (!(ms.flags () & P_IS_ALIVE))
1439 continue; 1431 continue;
1440 1432
1441 for (npc = GET_MAP_OB (m, sx, sy); npc != NULL; npc = npc->above) 1433 for (object *npc = ms.bot; npc; npc = npc->above)
1442 if (QUERY_FLAG (npc, FLAG_ALIVE) && QUERY_FLAG (npc, FLAG_UNAGGRESSIVE)) 1434 if (QUERY_FLAG (npc, FLAG_ALIVE) && QUERY_FLAG (npc, FLAG_UNAGGRESSIVE))
1443 npc->enemy = op->enemy; 1435 npc->enemy = op->enemy;
1444 } 1436 }
1445} 1437}
1446 1438
1447int 1439int
1448dist_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1440dist_att (int dir, object *ob, object *enemy, object *part, rv_vector *rv)
1449{ 1441{
1450 if (can_hit (part, enemy, rv)) 1442 if (can_hit (part, enemy, rv))
1451 return dir; 1443 return dir;
1452 1444
1453 if (rv->distance < 10) 1445 if (rv->distance < 10)
1457 1449
1458 return 0; 1450 return 0;
1459} 1451}
1460 1452
1461int 1453int
1462run_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1454run_att (int dir, object *ob, object *enemy, object *part, rv_vector *rv)
1463{ 1455{
1464 if ((can_hit (part, enemy, rv) && ob->move_status < 20) || ob->move_status < 20) 1456 if (can_hit (part, enemy, rv))
1465 {
1466 ob->move_status++;
1467 return (dir); 1457 return dir;
1468 } 1458 else
1469 else if (ob->move_status > 20)
1470 ob->move_status = 0;
1471
1472 return absdir (dir + 4); 1459 return absdir (dir + 4);
1473} 1460}
1474 1461
1475int 1462int
1476hitrun_att (int dir, object *ob, object *enemy) 1463hitrun_att (int dir, object *ob, object *enemy)
1477{ 1464{
1486} 1473}
1487 1474
1488int 1475int
1489wait_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1476wait_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv)
1490{ 1477{
1491
1492 int inrange = can_hit (part, enemy, rv); 1478 int inrange = can_hit (part, enemy, rv);
1493 1479
1494 if (ob->move_status || inrange) 1480 if (ob->move_status || inrange)
1495 ob->move_status++; 1481 ob->move_status++;
1496 1482
1506} 1492}
1507 1493
1508int 1494int
1509disthit_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1495disthit_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv)
1510{ 1496{
1511
1512 /* The logic below here looked plain wrong before. Basically, what should 1497 /* The logic below here looked plain wrong before. Basically, what should
1513 * happen is that if the creatures hp percentage falls below run_away, 1498 * happen is that if the creatures hp percentage falls below run_away,
1514 * the creature should run away (dir+4) 1499 * the creature should run away (dir+4)
1515 * I think its wrong for a creature to have a zero maxhp value, but 1500 * I think its wrong for a creature to have a zero maxhp value, but
1516 * at least one map has this set, and whatever the map contains, the 1501 * at least one map has this set, and whatever the map contains, the
1892 { 1877 {
1893 /* HIDDEN ENEMY. by definition, you can't see hidden stuff! 1878 /* HIDDEN ENEMY. by definition, you can't see hidden stuff!
1894 * However,if you carry any source of light, then the hidden 1879 * However,if you carry any source of light, then the hidden
1895 * creature is seeable (and stupid) */ 1880 * creature is seeable (and stupid) */
1896 1881
1897 if (has_carried_lights (enemy)) 1882 if (enemy->has_carried_lights ())
1898 { 1883 {
1899 if (enemy->flag [FLAG_HIDDEN]) 1884 if (enemy->flag [FLAG_HIDDEN])
1900 { 1885 {
1901 make_visible (enemy); 1886 make_visible (enemy);
1902 new_draw_info (NDI_UNIQUE, 0, enemy, "Your light reveals your hiding spot!"); 1887 new_draw_info (NDI_UNIQUE, 0, enemy, "Your light reveals your hiding spot!");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines