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

Comparing deliantra/server/server/spell_attack.C (file contents):
Revision 1.28 by pippijn, Mon Jan 15 21:06:20 2007 UTC vs.
Revision 1.30 by pippijn, Thu Mar 1 12:28:16 2007 UTC

163 */ 163 */
164 164
165void 165void
166move_bolt (object *op) 166move_bolt (object *op)
167{ 167{
168 object *tmp;
169 int mflags; 168 int mflags;
170 sint16 x, y; 169 sint16 x, y;
171 maptile *m; 170 maptile *m;
172 171
173 if (--op->duration < 0) 172 if (--op->duration < 0)
1483 tmp->update_stats (); 1482 tmp->update_stats ();
1484 return 1; 1483 return 1;
1485 1484
1486} 1485}
1487 1486
1488
1489/********************************************************************** 1487/**********************************************************************
1490 * mood change 1488 * mood change
1491 * Arguably, this may or may not be an attack spell. But since it 1489 * Arguably, this may or may not be an attack spell. But since it
1492 * effects monsters, it seems best to put it into this file 1490 * effects monsters, it seems best to put it into this file
1493 ***********************************************************************/ 1491 ***********************************************************************/
1522 else if (god && !strcmp (spell->race, "GOD_FRIEND")) 1520 else if (god && !strcmp (spell->race, "GOD_FRIEND"))
1523 race = god->race; 1521 race = god->race;
1524 else 1522 else
1525 race = spell->race; 1523 race = spell->race;
1526 1524
1527
1528 for (x = op->x - range; x <= op->x + range; x++) 1525 for (x = op->x - range; x <= op->x + range; x++)
1529 for (y = op->y - range; y <= op->y + range; y++) 1526 for (y = op->y - range; y <= op->y + range; y++)
1530 { 1527 {
1531
1532 done_one = 0; 1528 done_one = 0;
1533 m = op->map; 1529 m = op->map;
1534 nx = x; 1530 nx = x;
1535 ny = y; 1531 ny = y;
1536 mflags = get_map_flags (m, &m, x, y, &nx, &ny); 1532 mflags = get_map_flags (m, &m, x, y, &nx, &ny);
1539 1535
1540 /* If there is nothing living on this space, no need to go further */ 1536 /* If there is nothing living on this space, no need to go further */
1541 if (!(mflags & P_IS_ALIVE)) 1537 if (!(mflags & P_IS_ALIVE))
1542 continue; 1538 continue;
1543 1539
1540 // players can only affect spaces that they can actually see
1541 if (caster && caster->contr
1542 && caster->contr->visibility_at (m, nx, ny) < 70)
1543 continue;
1544
1544 for (tmp = GET_MAP_OB (m, nx, ny); tmp; tmp = tmp->above) 1545 for (tmp = GET_MAP_TOP (m, nx, ny); tmp; tmp = tmp->below)
1545 if (QUERY_FLAG (tmp, FLAG_MONSTER)) 1546 if (QUERY_FLAG (tmp, FLAG_MONSTER))
1546 break; 1547 break;
1547 1548
1548 /* There can be living objects that are not monsters */ 1549 /* There can be living objects that are not monsters */
1549 if (!tmp || tmp->type == PLAYER) 1550 if (!tmp || tmp->type == PLAYER)
1556 head = tmp; 1557 head = tmp;
1557 1558
1558 /* Make sure the race is OK. Likewise, only effect undead if spell specifically allows it */ 1559 /* Make sure the race is OK. Likewise, only effect undead if spell specifically allows it */
1559 if (race && head->race && !strstr (race, head->race)) 1560 if (race && head->race && !strstr (race, head->race))
1560 continue; 1561 continue;
1562
1561 if (QUERY_FLAG (head, FLAG_UNDEAD) && !QUERY_FLAG (spell, FLAG_UNDEAD)) 1563 if (QUERY_FLAG (head, FLAG_UNDEAD) && !QUERY_FLAG (spell, FLAG_UNDEAD))
1562 continue; 1564 continue;
1563 1565
1564 /* Now do a bunch of stuff related to saving throws */ 1566 /* Now do a bunch of stuff related to saving throws */
1565 best_at = -1; 1567 best_at = -1;
1602 if (random_roll (0, 100, caster, PREFER_LOW) >= (20 + MIN (50, 2 * (level - head->level)))) 1604 if (random_roll (0, 100, caster, PREFER_LOW) >= (20 + MIN (50, 2 * (level - head->level))))
1603 /* Failed, no effect */ 1605 /* Failed, no effect */
1604 continue; 1606 continue;
1605 } 1607 }
1606 1608
1607 /* Done with saving throw. Now start effecting the monster */ 1609 /* Done with saving throw. Now start affecting the monster */
1608 1610
1609 /* aggravation */ 1611 /* aggravation */
1610 if (QUERY_FLAG (spell, FLAG_MONSTER)) 1612 if (QUERY_FLAG (spell, FLAG_MONSTER))
1611 { 1613 {
1612 CLEAR_FLAG (head, FLAG_SLEEP); 1614 CLEAR_FLAG (head, FLAG_SLEEP);
1720 * if this has an other_arch field, we insert that in 1722 * if this has an other_arch field, we insert that in
1721 * the surround spaces. 1723 * the surround spaces.
1722 */ 1724 */
1723 for (j = 0; j < 9; j++) 1725 for (j = 0; j < 9; j++)
1724 { 1726 {
1725 object *new_ob;
1726
1727 hx = nx + freearr_x[j]; 1727 hx = nx + freearr_x[j];
1728 hy = ny + freearr_y[j]; 1728 hy = ny + freearr_y[j];
1729 1729
1730 m = op->map; 1730 m = op->map;
1731 mflags = get_map_flags (m, &m, hx, hy, &hx, &hy); 1731 mflags = get_map_flags (m, &m, hx, hy, &hx, &hy);
2107 if (disease->stats.sp) 2107 if (disease->stats.sp)
2108 disease->stats.sp -= dam_mod; 2108 disease->stats.sp -= dam_mod;
2109 2109
2110 if (infect_object (walk, disease, 1)) 2110 if (infect_object (walk, disease, 1))
2111 { 2111 {
2112 object *flash; /* visual effect for inflicting disease */
2113
2114 new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); 2112 new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name);
2115 2113
2116 disease->destroy (); /* don't need this one anymore */ 2114 disease->destroy (); /* don't need this one anymore */
2117 walk->map->insert (get_archetype (ARCH_DETECT_MAGIC), x, y, op); 2115 walk->map->insert (get_archetype (ARCH_DETECT_MAGIC), x, y, op);
2118 return 1; 2116 return 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines