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.24 by root, Thu Jan 18 21:27:19 2007 UTC vs.
Revision 1.27 by root, Mon Apr 30 04:25:30 2007 UTC

85 * target enemy - this code below makes sure the enemy is something 85 * target enemy - this code below makes sure the enemy is something
86 * that should be attacked. My guess is that the arrow hits 86 * that should be attacked. My guess is that the arrow hits
87 * the creature/owner, and so the creature then takes that 87 * the creature/owner, and so the creature then takes that
88 * as the enemy to attack. 88 * as the enemy to attack.
89 */ 89 */
90 else if (!QUERY_FLAG (npc->enemy, FLAG_MONSTER) && 90 else if (!QUERY_FLAG (npc->enemy, FLAG_MONSTER)
91 !QUERY_FLAG (npc->enemy, FLAG_GENERATOR) && npc->enemy->type != PLAYER && npc->enemy->type != GOLEM) 91 && !QUERY_FLAG (npc->enemy, FLAG_GENERATOR)
92 && npc->enemy->type != PLAYER
93 && npc->enemy->type != GOLEM)
92 npc->enemy = NULL; 94 npc->enemy = NULL;
93 95
94 } 96 }
95 return can_detect_enemy (npc, npc->enemy, rv) ? npc->enemy : NULL; 97 return can_detect_enemy (npc, npc->enemy, rv) ? npc->enemy : NULL;
96} 98}
446 } /* stand still */ 448 } /* stand still */
447 return 0; 449 return 0;
448 } /* no enemy */ 450 } /* no enemy */
449 451
450 /* We have an enemy. Block immediately below is for pets */ 452 /* We have an enemy. Block immediately below is for pets */
451 if ((op->attack_movement & HI4) == PETMOVE && (owner = op->owner) != NULL && !on_same_map (op, owner)) 453 if ((op->attack_movement & HI4) == PETMOVE
454 && (owner = op->owner) != NULL
455 && !on_same_map (op, owner)
456 && !owner->flag [FLAG_REMOVED])
452 return follow_owner (op, owner); 457 return follow_owner (op, owner);
453 458
454 /* doppleganger code to change monster facing to that of the nearest 459 /* doppleganger code to change monster facing to that of the nearest
455 * player. Hmm. The code is here, but no monster in the current 460 * player. Hmm. The code is here, but no monster in the current
456 * arch set uses it. 461 * arch set uses it.
896 * The skills we are treating here are all but those. -b.t. 901 * The skills we are treating here are all but those. -b.t.
897 * 902 *
898 * At the moment this is only useful for throwing, perhaps for 903 * At the moment this is only useful for throwing, perhaps for
899 * stealing. TODO: This should be more integrated in the game. -MT, 25.11.01 904 * stealing. TODO: This should be more integrated in the game. -MT, 25.11.01
900 */ 905 */
901
902int 906int
903monster_use_skill (object *head, object *part, object *pl, int dir) 907monster_use_skill (object *head, object *part, object *pl, int dir)
904{ 908{
905 object *skill, *owner; 909 object *skill, *owner;
906 910
912 int dir2 = find_dir_2 (head->x - owner->x, head->y - owner->y); 916 int dir2 = find_dir_2 (head->x - owner->x, head->y - owner->y);
913 917
914 if (dirdiff (dir, dir2) < 1) 918 if (dirdiff (dir, dir2) < 1)
915 return 0; /* Might hit owner with skill -thrown rocks for example ? */ 919 return 0; /* Might hit owner with skill -thrown rocks for example ? */
916 } 920 }
921
917 if (QUERY_FLAG (head, FLAG_CONFUSED)) 922 if (QUERY_FLAG (head, FLAG_CONFUSED))
918 dir = absdir (dir + rndm (3) + rndm (3) - 2); 923 dir = absdir (dir + rndm (3) + rndm (3) - 2);
919 924
920 /* skill selection - monster will use the next unused skill. 925 /* skill selection - monster will use the next unused skill.
921 * well...the following scenario will allow the monster to 926 * well...the following scenario will allow the monster to
922 * toggle between 2 skills. One day it would be nice to make 927 * toggle between 2 skills. One day it would be nice to make
923 * more skills available to monsters. 928 * more skills available to monsters.
924 */ 929 */
925 930
926 for (skill = head->inv; skill != NULL; skill = skill->below) 931 for (skill = head->inv; skill; skill = skill->below)
927 if (skill->type == SKILL && skill != head->chosen_skill) 932 if (skill->type == SKILL && skill != head->chosen_skill)
928 { 933 {
929 head->chosen_skill = skill; 934 head->chosen_skill = skill;
930 break; 935 break;
931 } 936 }
934 { 939 {
935 LOG (llevDebug, "Error: Monster %s (%d) has FLAG_READY_SKILL without skill.\n", &head->name, head->count); 940 LOG (llevDebug, "Error: Monster %s (%d) has FLAG_READY_SKILL without skill.\n", &head->name, head->count);
936 CLEAR_FLAG (head, FLAG_READY_SKILL); 941 CLEAR_FLAG (head, FLAG_READY_SKILL);
937 return 0; 942 return 0;
938 } 943 }
944
939 /* use skill */ 945 /* use skill */
940 return do_skill (head, part, head->chosen_skill, dir, NULL); 946 return do_skill (head, part, head->chosen_skill, dir, NULL);
941} 947}
942 948
943/* Monster will use a ranged spell attack. */ 949/* Monster will use a ranged spell attack. */
944
945int 950int
946monster_use_range (object *head, object *part, object *pl, int dir) 951monster_use_range (object *head, object *part, object *pl, int dir)
947{ 952{
948 object *wand, *owner; 953 object *wand, *owner;
949 int at_least_one = 0; 954 int at_least_one = 0;
959 return 0; /* Might hit owner with spell */ 964 return 0; /* Might hit owner with spell */
960 } 965 }
961 if (QUERY_FLAG (head, FLAG_CONFUSED)) 966 if (QUERY_FLAG (head, FLAG_CONFUSED))
962 dir = absdir (dir + rndm (3) + rndm (3) - 2); 967 dir = absdir (dir + rndm (3) + rndm (3) - 2);
963 968
964 for (wand = head->inv; wand != NULL; wand = wand->below) 969 for (wand = head->inv; wand; wand = wand->below)
965 { 970 {
966 if (wand->type == WAND) 971 if (wand->type == WAND)
967 { 972 {
968 /* Found a wand, let's see if it has charges left */ 973 /* Found a wand, let's see if it has charges left */
969 at_least_one = 1; 974 at_least_one = 1;
1070 1075
1071 if (val > 0) 1076 if (val > 0)
1072 return 1; 1077 return 1;
1073 else 1078 else
1074 return 0; 1079 return 0;
1075
1076} 1080}
1077 1081
1078int 1082int
1079check_good_armour (object *who, object *item) 1083check_good_armour (object *who, object *item)
1080{ 1084{
1111 1115
1112 if (val > 0) 1116 if (val > 0)
1113 return 1; 1117 return 1;
1114 else 1118 else
1115 return 0; 1119 return 0;
1116
1117} 1120}
1118 1121
1119/* 1122/*
1120 * monster_check_pickup(): checks for items that monster can pick up. 1123 * monster_check_pickup(): checks for items that monster can pick up.
1121 * 1124 *
1129 * This function was seen be continueing looping at one point (tmp->below 1132 * This function was seen be continueing looping at one point (tmp->below
1130 * became a recursive loop. It may be better to call monster_check_apply 1133 * became a recursive loop. It may be better to call monster_check_apply
1131 * after we pick everything up, since that function may call others which 1134 * after we pick everything up, since that function may call others which
1132 * affect stacking on this space. 1135 * affect stacking on this space.
1133 */ 1136 */
1134
1135void 1137void
1136monster_check_pickup (object *monster) 1138monster_check_pickup (object *monster)
1137{ 1139{
1138 object *tmp, *next; 1140 object *tmp, *next;
1139 1141
1158 * monster_can_pick(): If the monster is interested in picking up 1160 * monster_can_pick(): If the monster is interested in picking up
1159 * the item, then return 0. Otherwise 0. 1161 * the item, then return 0. Otherwise 0.
1160 * Instead of pick_up, flags for "greed", etc, should be used. 1162 * Instead of pick_up, flags for "greed", etc, should be used.
1161 * I've already utilized flags for bows, wands, rings, etc, etc. -Frank. 1163 * I've already utilized flags for bows, wands, rings, etc, etc. -Frank.
1162 */ 1164 */
1163
1164int 1165int
1165monster_can_pick (object *monster, object *item) 1166monster_can_pick (object *monster, object *item)
1166{ 1167{
1167 int flag = 0; 1168 int flag = 0;
1168 int i; 1169 int i;
1226 case BOW: 1227 case BOW:
1227 case ARROW: 1228 case ARROW:
1228 flag = QUERY_FLAG (monster, FLAG_USE_BOW); 1229 flag = QUERY_FLAG (monster, FLAG_USE_BOW);
1229 break; 1230 break;
1230 } 1231 }
1232
1231 /* Simplistic check - if the monster has a location to equip it, he will 1233 /* Simplistic check - if the monster has a location to equip it, he will
1232 * pick it up. Note that this doesn't handle cases where an item may 1234 * pick it up. Note that this doesn't handle cases where an item may
1233 * use several locations. 1235 * use several locations.
1234 */ 1236 */
1235 for (i = 0; i < NUM_BODY_LOCATIONS; i++) 1237 for (i = 0; i < NUM_BODY_LOCATIONS; i++)
1250 * monster_apply_below(): 1252 * monster_apply_below():
1251 * Vick's (vick@bern.docs.uu.se) @921107 -> If a monster who's 1253 * Vick's (vick@bern.docs.uu.se) @921107 -> If a monster who's
1252 * eager to apply things, encounters something apply-able, 1254 * eager to apply things, encounters something apply-able,
1253 * then make him apply it 1255 * then make him apply it
1254 */ 1256 */
1255
1256void 1257void
1257monster_apply_below (object *monster) 1258monster_apply_below (object *monster)
1258{ 1259{
1259 object *tmp, *next; 1260 object *tmp, *next;
1260 1261
1287 * a pointer to that object is returned, so it can be dropped. 1288 * a pointer to that object is returned, so it can be dropped.
1288 * (so that other monsters can pick it up and use it) 1289 * (so that other monsters can pick it up and use it)
1289 * Note that as things are now, monsters never drop something - 1290 * Note that as things are now, monsters never drop something -
1290 * they can pick up all that they can use. 1291 * they can pick up all that they can use.
1291 */ 1292 */
1292
1293/* Sept 96, fixed this so skills will be readied -b.t.*/ 1293/* Sept 96, fixed this so skills will be readied -b.t.*/
1294
1295void 1294void
1296monster_check_apply (object *mon, object *item) 1295monster_check_apply (object *mon, object *item)
1297{ 1296{
1298
1299 int flag = 0; 1297 int flag = 0;
1300 1298
1301 if (item->type == SPELLBOOK && mon->arch != NULL && (QUERY_FLAG ((&mon->arch->clone), FLAG_CAST_SPELL))) 1299 if (item->type == SPELLBOOK && mon->arch && (QUERY_FLAG ((&mon->arch->clone), FLAG_CAST_SPELL)))
1302 { 1300 {
1303 SET_FLAG (mon, FLAG_CAST_SPELL); 1301 SET_FLAG (mon, FLAG_CAST_SPELL);
1304 return; 1302 return;
1305 } 1303 }
1306 1304
1315 if (QUERY_FLAG (mon, FLAG_USE_BOW) && item->type == ARROW) 1313 if (QUERY_FLAG (mon, FLAG_USE_BOW) && item->type == ARROW)
1316 { 1314 {
1317 /* Check for the right kind of bow */ 1315 /* Check for the right kind of bow */
1318 object *bow; 1316 object *bow;
1319 1317
1320 for (bow = mon->inv; bow != NULL; bow = bow->below) 1318 for (bow = mon->inv; bow; bow = bow->below)
1321 if (bow->type == BOW && bow->race == item->race) 1319 if (bow->type == BOW && bow->race == item->race)
1322 { 1320 {
1323 SET_FLAG (mon, FLAG_READY_BOW); 1321 SET_FLAG (mon, FLAG_READY_BOW);
1324 LOG (llevMonster, "Found correct bow for arrows.\n"); 1322 LOG (llevMonster, "Found correct bow for arrows.\n");
1325 return; /* nothing more to do for arrows */ 1323 return; /* nothing more to do for arrows */
1377 */ 1375 */
1378 SET_FLAG (mon, FLAG_READY_SKILL); 1376 SET_FLAG (mon, FLAG_READY_SKILL);
1379 return; 1377 return;
1380 } 1378 }
1381 1379
1382
1383 /* if we don't match one of the above types, return now. 1380 /* if we don't match one of the above types, return now.
1384 * can_apply_object will say that we can apply things like flesh, 1381 * can_apply_object will say that we can apply things like flesh,
1385 * bolts, and whatever else, because it only checks against the 1382 * bolts, and whatever else, because it only checks against the
1386 * body_info locations. 1383 * body_info locations.
1387 */ 1384 */
1398 /* should only be applying this item, not unapplying it. 1395 /* should only be applying this item, not unapplying it.
1399 * also, ignore status of curse so they can take off old armour. 1396 * also, ignore status of curse so they can take off old armour.
1400 * monsters have some advantages after all. 1397 * monsters have some advantages after all.
1401 */ 1398 */
1402 manual_apply (mon, item, AP_APPLY | AP_IGNORE_CURSE); 1399 manual_apply (mon, item, AP_APPLY | AP_IGNORE_CURSE);
1403
1404 return;
1405} 1400}
1406 1401
1407void 1402void
1408npc_call_help (object *op) 1403npc_call_help (object *op)
1409{ 1404{
1427 if (QUERY_FLAG (npc, FLAG_ALIVE) && QUERY_FLAG (npc, FLAG_UNAGGRESSIVE)) 1422 if (QUERY_FLAG (npc, FLAG_ALIVE) && QUERY_FLAG (npc, FLAG_UNAGGRESSIVE))
1428 npc->enemy = op->enemy; 1423 npc->enemy = op->enemy;
1429 } 1424 }
1430} 1425}
1431 1426
1432
1433int 1427int
1434dist_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1428dist_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv)
1435{ 1429{
1436
1437 if (can_hit (part, enemy, rv)) 1430 if (can_hit (part, enemy, rv))
1438 return dir; 1431 return dir;
1439 if (rv->distance < 10) 1432 if (rv->distance < 10)
1440 return absdir (dir + 4); 1433 return absdir (dir + 4);
1441 else if (rv->distance > 18) 1434 else if (rv->distance > 18)
1442 return dir; 1435 return dir;
1436
1443 return 0; 1437 return 0;
1444} 1438}
1445 1439
1446int 1440int
1447run_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1441run_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv)
1448{ 1442{
1449
1450 if ((can_hit (part, enemy, rv) && ob->move_status < 20) || ob->move_status < 20) 1443 if ((can_hit (part, enemy, rv) && ob->move_status < 20) || ob->move_status < 20)
1451 { 1444 {
1452 ob->move_status++; 1445 ob->move_status++;
1453 return (dir); 1446 return (dir);
1454 } 1447 }
1455 else if (ob->move_status > 20) 1448 else if (ob->move_status > 20)
1456 ob->move_status = 0; 1449 ob->move_status = 0;
1450
1457 return absdir (dir + 4); 1451 return absdir (dir + 4);
1458} 1452}
1459 1453
1460int 1454int
1461hitrun_att (int dir, object *ob, object *enemy) 1455hitrun_att (int dir, object *ob, object *enemy)
1464 return dir; 1458 return dir;
1465 else if (ob->move_status < 50) 1459 else if (ob->move_status < 50)
1466 return absdir (dir + 4); 1460 return absdir (dir + 4);
1467 else 1461 else
1468 ob->move_status = 0; 1462 ob->move_status = 0;
1463
1469 return absdir (dir + 4); 1464 return absdir (dir + 4);
1470} 1465}
1471 1466
1472int 1467int
1473wait_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1468wait_att (int dir, object *ob, object *enemy, object *part, rv_vector * rv)
1482 return 0; 1477 return 0;
1483 else if (ob->move_status < 10) 1478 else if (ob->move_status < 10)
1484 return dir; 1479 return dir;
1485 else if (ob->move_status < 15) 1480 else if (ob->move_status < 15)
1486 return absdir (dir + 4); 1481 return absdir (dir + 4);
1482
1487 ob->move_status = 0; 1483 ob->move_status = 0;
1488 return 0; 1484 return 0;
1489} 1485}
1490 1486
1491int 1487int
1499 * at least one map has this set, and whatever the map contains, the 1495 * at least one map has this set, and whatever the map contains, the
1500 * server should try to be resilant enough to avoid the problem 1496 * server should try to be resilant enough to avoid the problem
1501 */ 1497 */
1502 if (ob->stats.maxhp && (ob->stats.hp * 100) / ob->stats.maxhp < ob->run_away) 1498 if (ob->stats.maxhp && (ob->stats.hp * 100) / ob->stats.maxhp < ob->run_away)
1503 return absdir (dir + 4); 1499 return absdir (dir + 4);
1500
1504 return dist_att (dir, ob, enemy, part, rv); 1501 return dist_att (dir, ob, enemy, part, rv);
1505} 1502}
1506 1503
1507int 1504int
1508wait_att2 (int dir, object *ob, object *enemy, object *part, rv_vector * rv) 1505wait_att2 (int dir, object *ob, object *enemy, object *part, rv_vector * rv)
1509{ 1506{
1510 if (rv->distance < 9) 1507 if (rv->distance < 9)
1511 return absdir (dir + 4); 1508 return absdir (dir + 4);
1509
1512 return 0; 1510 return 0;
1513} 1511}
1514 1512
1515void 1513void
1516circ1_move (object *ob) 1514circ1_move (object *ob)
1517{ 1515{
1518 static int circle[12] = { 3, 3, 4, 5, 5, 6, 7, 7, 8, 1, 1, 2 }; 1516 static int circle[12] = { 3, 3, 4, 5, 5, 6, 7, 7, 8, 1, 1, 2 };
1517
1519 if (++ob->move_status > 11) 1518 if (++ob->move_status > 11)
1520 ob->move_status = 0; 1519 ob->move_status = 0;
1520
1521 if (!(move_object (ob, circle[ob->move_status]))) 1521 if (!(move_object (ob, circle[ob->move_status])))
1522 (void) move_object (ob, rndm (8) + 1); 1522 move_object (ob, rndm (8) + 1);
1523} 1523}
1524 1524
1525void 1525void
1526circ2_move (object *ob) 1526circ2_move (object *ob)
1527{ 1527{
1528 static int circle[20] = { 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 1, 1, 1, 2, 2 }; 1528 static int circle[20] = { 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 1, 1, 1, 2, 2 };
1529
1529 if (++ob->move_status > 19) 1530 if (++ob->move_status > 19)
1530 ob->move_status = 0; 1531 ob->move_status = 0;
1532
1531 if (!(move_object (ob, circle[ob->move_status]))) 1533 if (!(move_object (ob, circle[ob->move_status])))
1532 (void) move_object (ob, rndm (8) + 1); 1534 move_object (ob, rndm (8) + 1);
1533} 1535}
1534 1536
1535void 1537void
1536pace_movev (object *ob) 1538pace_movev (object *ob)
1537{ 1539{
1538 if (ob->move_status++ > 6) 1540 if (ob->move_status++ > 6)
1539 ob->move_status = 0; 1541 ob->move_status = 0;
1542
1540 if (ob->move_status < 4) 1543 if (ob->move_status < 4)
1541 (void) move_object (ob, 5); 1544 move_object (ob, 5);
1542 else 1545 else
1543 (void) move_object (ob, 1); 1546 move_object (ob, 1);
1544} 1547}
1545 1548
1546void 1549void
1547pace_moveh (object *ob) 1550pace_moveh (object *ob)
1548{ 1551{
1549 if (ob->move_status++ > 6) 1552 if (ob->move_status++ > 6)
1550 ob->move_status = 0; 1553 ob->move_status = 0;
1554
1551 if (ob->move_status < 4) 1555 if (ob->move_status < 4)
1552 (void) move_object (ob, 3); 1556 move_object (ob, 3);
1553 else 1557 else
1554 (void) move_object (ob, 7); 1558 move_object (ob, 7);
1555} 1559}
1556 1560
1557void 1561void
1558pace2_movev (object *ob) 1562pace2_movev (object *ob)
1559{ 1563{
1560 if (ob->move_status++ > 16) 1564 if (ob->move_status++ > 16)
1561 ob->move_status = 0; 1565 ob->move_status = 0;
1566
1562 if (ob->move_status < 6) 1567 if (ob->move_status < 6)
1563 (void) move_object (ob, 5); 1568 move_object (ob, 5);
1564 else if (ob->move_status < 8) 1569 else if (ob->move_status < 8)
1565 return; 1570 return;
1566 else if (ob->move_status < 13) 1571 else if (ob->move_status < 13)
1567 (void) move_object (ob, 1); 1572 move_object (ob, 1);
1568 else 1573 else
1569 return; 1574 return;
1570} 1575}
1571 1576
1572void 1577void
1573pace2_moveh (object *ob) 1578pace2_moveh (object *ob)
1574{ 1579{
1575 if (ob->move_status++ > 16) 1580 if (ob->move_status++ > 16)
1576 ob->move_status = 0; 1581 ob->move_status = 0;
1582
1577 if (ob->move_status < 6) 1583 if (ob->move_status < 6)
1578 (void) move_object (ob, 3); 1584 move_object (ob, 3);
1579 else if (ob->move_status < 8) 1585 else if (ob->move_status < 8)
1580 return; 1586 return;
1581 else if (ob->move_status < 13) 1587 else if (ob->move_status < 13)
1582 (void) move_object (ob, 7); 1588 move_object (ob, 7);
1583 else 1589 else
1584 return; 1590 return;
1585} 1591}
1586 1592
1587void 1593void
1630 * monsters to throw things like chairs and other pieces of 1636 * monsters to throw things like chairs and other pieces of
1631 * furniture, even if they are not good throwable objects. 1637 * furniture, even if they are not good throwable objects.
1632 * Probably better to have the monster throw a throwable object 1638 * Probably better to have the monster throw a throwable object
1633 * first, then throw any non equipped weapon. 1639 * first, then throw any non equipped weapon.
1634 */ 1640 */
1635
1636object * 1641object *
1637find_mon_throw_ob (object *op) 1642find_mon_throw_ob (object *op)
1638{ 1643{
1639 object *tmp = NULL; 1644 object *tmp = NULL;
1640 1645
1815/* determine if op stands in a lighted square. This is not a very 1820/* determine if op stands in a lighted square. This is not a very
1816 * intellegent algorithm. For one thing, we ignore los here, SO it 1821 * intellegent algorithm. For one thing, we ignore los here, SO it
1817 * is possible for a bright light to illuminate a player on the 1822 * is possible for a bright light to illuminate a player on the
1818 * other side of a wall (!). 1823 * other side of a wall (!).
1819 */ 1824 */
1820
1821int 1825int
1822stand_in_light (object *op) 1826stand_in_light (object *op)
1823{ 1827{
1824 sint16 nx, ny; 1828 sint16 nx, ny;
1825 maptile *m; 1829 maptile *m;
1826 1830
1827
1828 if (!op) 1831 if (!op)
1829 return 0; 1832 return 0;
1833
1830 if (op->glow_radius > 0) 1834 if (op->glow_radius > 0)
1831 return 1; 1835 return 1;
1832 1836
1833 if (op->map) 1837 if (op->map)
1834 { 1838 {
1835 int x, y, x1, y1; 1839 int x, y, x1, y1;
1836
1837
1838 1840
1839 /* Check the spaces with the max light radius to see if any of them 1841 /* Check the spaces with the max light radius to see if any of them
1840 * have lights, and if any of them light the player enough, then return 1. 1842 * have lights, and if any of them light the player enough, then return 1.
1841 */ 1843 */
1842 for (x = op->x - MAX_LIGHT_RADII; x <= op->x + MAX_LIGHT_RADII; x++) 1844 for (x = op->x - MAX_LIGHT_RADII; x <= op->x + MAX_LIGHT_RADII; x++)
1855 if (isqrt (x1 + y1) < GET_MAP_LIGHT (m, nx, ny)) 1857 if (isqrt (x1 + y1) < GET_MAP_LIGHT (m, nx, ny))
1856 return 1; 1858 return 1;
1857 } 1859 }
1858 } 1860 }
1859 } 1861 }
1862
1860 return 0; 1863 return 0;
1861} 1864}
1862
1863 1865
1864/* assuming no walls/barriers, lets check to see if its *possible* 1866/* assuming no walls/barriers, lets check to see if its *possible*
1865 * to see an enemy. Note, "detection" is different from "seeing". 1867 * to see an enemy. Note, "detection" is different from "seeing".
1866 * See can_detect_enemy() for more details. -b.t. 1868 * See can_detect_enemy() for more details. -b.t.
1867 * return 0 if can't be seen, 1 if can be 1869 * return 0 if can't be seen, 1 if can be
1868 */ 1870 */
1869
1870int 1871int
1871can_see_enemy (object *op, object *enemy) 1872can_see_enemy (object *op, object *enemy)
1872{ 1873{
1873 object *looker = op->head ? op->head : op; 1874 object *looker = op->head ? op->head : op;
1874 1875

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines