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.93 by root, Sun Nov 29 17:41:08 2009 UTC vs.
Revision 1.100 by root, Fri Apr 9 02:45:17 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002-2003 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
93 * also be safe for objects. 93 * also be safe for objects.
94 * This does return if successful or not, but 94 * This does return if successful or not, but
95 * I don't see us doing anything useful with that information 95 * I don't see us doing anything useful with that information
96 * right now. 96 * right now.
97 */ 97 */
98 move_object (tmp, absdir (op->stats.sp)); 98 tmp->move (absdir (op->stats.sp));
99 } 99 }
100 100
101 } 101 }
102} 102}
103 103
660 return 0; 660 return 0;
661 } 661 }
662 662
663 tmp->map = newmap; 663 tmp->map = newmap;
664 664
665 // in case the bullet has direction 0 we explode it in place.
666 // direction 0 is possible for instance when a poison cloud trap springs.
667 if (tmp->direction == 0)
668 {
669 if (tmp->other_arch
670 && (tmp = tmp->insert_at (tmp, op))) // insert before explode cleanly
671 explode_bullet (tmp); // explode object will/should remove tmp
672 else
673 tmp->destroy ();
674
675 return 0;
676 }
677
665 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) 678 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y)))
666 { 679 {
667 if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) 680 if (!QUERY_FLAG (tmp, FLAG_REFLECTING))
668 { 681 {
669 tmp->destroy (); 682 tmp->destroy ();
1287 else 1300 else
1288 op->skill = 0; 1301 op->skill = 0;
1289 1302
1290 op->change_skill (find_skill_by_name (op, op->skill)); 1303 op->change_skill (find_skill_by_name (op, op->skill));
1291 1304
1305 dynbuf buf;
1292 unordered_mapwalk (op, -range, -range, range, range) 1306 unordered_mapwalk (buf, op, -range, -range, range, range)
1293 { 1307 {
1294 mapspace &ms = m->at (nx, ny); 1308 mapspace &ms = m->at (nx, ny);
1295 1309
1296 if (ms.flags () & P_IS_ALIVE) 1310 if (ms.flags () & P_IS_ALIVE)
1297 for (object *tmp = ms.bot; tmp; tmp = tmp->above) 1311 for (object *next, *tmp = ms.bot; tmp; tmp = next)
1312 {
1313 next = tmp->above;
1314
1298 if (tmp->flag [FLAG_ALIVE] || tmp->is_player ()) 1315 if (tmp->flag [FLAG_ALIVE] || tmp->is_player ())
1299 { 1316 {
1300 tmp = tmp->head_ (); 1317 tmp = tmp->head_ ();
1301 1318
1302 if ((friendly && !tmp->flag [FLAG_FRIENDLY] && !tmp->is_player ()) 1319 if ((friendly && !tmp->flag [FLAG_FRIENDLY] && !tmp->is_player ())
1303 || (!friendly && (tmp->flag [FLAG_FRIENDLY] || tmp->is_player ()))) 1320 || (!friendly && (tmp->flag [FLAG_FRIENDLY] || tmp->is_player ())))
1304 { 1321 {
1305 if (spell_ob->subtype == SP_DESTRUCTION) 1322 if (spell_ob->subtype == SP_DESTRUCTION)
1306 { 1323 {
1307 hit_player (tmp, dam, op, spell_ob->attacktype, 0); 1324 hit_player (tmp, dam, op, spell_ob->attacktype, 0);
1308 1325
1309 if (spell_ob->other_arch) 1326 if (spell_ob->other_arch)
1310 m->insert (spell_ob->other_arch->instance (), nx, ny, op); 1327 m->insert (spell_ob->other_arch->instance (), nx, ny, op);
1311 } 1328 }
1312 else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist [ATNR_MAGIC] != 100) 1329 else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist [ATNR_MAGIC] != 100)
1313 { 1330 {
1314 if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch) 1331 if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch)
1315 m->insert (spell_ob->other_arch->instance (), nx, ny, op); 1332 m->insert (spell_ob->other_arch->instance (), nx, ny, op);
1316 } 1333 }
1317 } 1334 }
1318 } 1335 }
1336 }
1319 } 1337 }
1320 1338
1321 op->skill = skill; 1339 op->skill = skill;
1322 return 1; 1340 return 1;
1323} 1341}
1452 else if (god && spell->race == shstr_GOD_FRIEND) 1470 else if (god && spell->race == shstr_GOD_FRIEND)
1453 race = god->race; 1471 race = god->race;
1454 else 1472 else
1455 race = spell->race; 1473 race = spell->race;
1456 1474
1475 dynbuf buf;
1457 unordered_mapwalk (op, -range, -range, range, range) 1476 unordered_mapwalk (buf, op, -range, -range, range, range)
1458 { 1477 {
1459 mapspace &ms = m->at (nx, ny); 1478 mapspace &ms = m->at (nx, ny);
1460 1479
1461 /* If there is nothing living on this space, no need to go further */ 1480 /* If there is nothing living on this space, no need to go further */
1462 if (!ms.flags () & P_IS_ALIVE) 1481 if (!ms.flags () & P_IS_ALIVE)
1979 set_spell_skill (op, caster, spell, disease); 1998 set_spell_skill (op, caster, spell, disease);
1980 disease->stats.exp = 0; 1999 disease->stats.exp = 0;
1981 disease->level = casting_level (caster, spell); 2000 disease->level = casting_level (caster, spell);
1982 2001
1983 /* do level adjustments */ 2002 /* do level adjustments */
1984 if (disease->stats.wc) 2003 if (disease->stats.wc ) disease->stats.wc += dur_mod / 2;
1985 disease->stats.wc += dur_mod / 2; 2004 if (disease->magic > 0) disease->magic += dur_mod / 8;
1986 2005 if (disease->stats.maxhp > 0) disease->stats.maxhp += dur_mod;
1987 if (disease->magic > 0) 2006 if (disease->stats.maxgrace > 0) disease->stats.maxgrace += dur_mod;
1988 disease->magic += dur_mod / 8;
1989
1990 if (disease->stats.maxhp > 0)
1991 disease->stats.maxhp += dur_mod;
1992
1993 if (disease->stats.maxgrace > 0)
1994 disease->stats.maxgrace += dur_mod;
1995
1996 if (disease->stats.dam)
1997 {
1998 if (disease->stats.dam > 0)
1999 disease->stats.dam += dam_mod;
2000 else
2001 disease->stats.dam -= dam_mod;
2002 }
2003 2007
2004 if (disease->last_sp) 2008 if (disease->last_sp)
2005 { 2009 {
2006 disease->last_sp -= 2 * dam_mod; 2010 disease->last_sp -= 2 * dam_mod;
2011
2007 if (disease->last_sp < 1) 2012 if (disease->last_sp < 1)
2008 disease->last_sp = 1; 2013 disease->last_sp = 1;
2009 } 2014 }
2010 2015
2011 if (disease->stats.maxsp) 2016 if (disease->stats.dam ) disease->stats.dam += copysign (disease->stats.dam , dam_mod);
2012 { 2017 if (disease->stats.maxsp) disease->stats.maxsp += copysign (disease->stats.maxsp, dam_mod);
2013 if (disease->stats.maxsp > 0) 2018 if (disease->stats.ac ) disease->stats.ac += dam_mod;
2014 disease->stats.maxsp += dam_mod; 2019 if (disease->last_eat ) disease->last_eat -= dam_mod;
2015 else 2020 if (disease->stats.hp ) disease->stats.hp -= dam_mod;
2016 disease->stats.maxsp -= dam_mod; 2021 if (disease->stats.sp ) disease->stats.sp -= dam_mod;
2017 }
2018
2019 if (disease->stats.ac)
2020 disease->stats.ac += dam_mod;
2021
2022 if (disease->last_eat)
2023 disease->last_eat -= dam_mod;
2024
2025 if (disease->stats.hp)
2026 disease->stats.hp -= dam_mod;
2027
2028 if (disease->stats.sp)
2029 disease->stats.sp -= dam_mod;
2030 2022
2031 if (infect_object (walk, disease, 1)) 2023 if (infect_object (walk, disease, 1))
2032 { 2024 {
2033 new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); 2025 op->statusmsg (format ("You inflict %s on %s!", &disease->name, &walk->name));
2034 2026
2035 disease->destroy (); /* don't need this one anymore */ 2027 disease->destroy (); /* don't need this one anymore */
2036 walk->map->insert (get_archetype (shstr_detect_magic), x, y, op); 2028 walk->map->insert (get_archetype (shstr_detect_magic), x, y, op);
2037 return 1; 2029 return 1;
2038 } 2030 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines