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 | |
… | |
… | |
1286 | int dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
1286 | int dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
1287 | int dur = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
1287 | int dur = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
1288 | |
1288 | |
1289 | bool friendly = op->flag [FLAG_FRIENDLY] || op->is_player (); |
1289 | bool friendly = op->flag [FLAG_FRIENDLY] || op->is_player (); |
1290 | |
1290 | |
1291 | /* destruction doesn't use another spell object, so we need |
1291 | dynbuf buf; |
1292 | * update op's skill pointer so that exp is properly awarded. |
|
|
1293 | */ |
|
|
1294 | const shstr skill = op->skill; |
|
|
1295 | |
|
|
1296 | if (caster == op) |
|
|
1297 | op->skill = spell_ob->skill; |
|
|
1298 | else if (caster->skill) |
|
|
1299 | op->skill = caster->skill; |
|
|
1300 | else |
|
|
1301 | op->skill = 0; |
|
|
1302 | |
|
|
1303 | op->change_skill (find_skill_by_name (op, op->skill)); |
|
|
1304 | |
|
|
1305 | unordered_mapwalk (op, -range, -range, range, range) |
1292 | unordered_mapwalk (buf, op, -range, -range, range, range) |
1306 | { |
1293 | { |
1307 | mapspace &ms = m->at (nx, ny); |
1294 | mapspace &ms = m->at (nx, ny); |
1308 | |
1295 | |
1309 | if (ms.flags () & P_IS_ALIVE) |
1296 | if (ms.flags () & P_IS_ALIVE) |
1310 | for (object *next, *tmp = ms.bot; tmp; tmp = next) |
1297 | for (object *next, *tmp = ms.bot; tmp; tmp = next) |
… | |
… | |
1333 | } |
1320 | } |
1334 | } |
1321 | } |
1335 | } |
1322 | } |
1336 | } |
1323 | } |
1337 | |
1324 | |
1338 | op->skill = skill; |
|
|
1339 | return 1; |
1325 | return 1; |
1340 | } |
1326 | } |
1341 | |
1327 | |
1342 | /*************************************************************************** |
1328 | /*************************************************************************** |
1343 | * |
1329 | * |
… | |
… | |
1469 | else if (god && spell->race == shstr_GOD_FRIEND) |
1455 | else if (god && spell->race == shstr_GOD_FRIEND) |
1470 | race = god->race; |
1456 | race = god->race; |
1471 | else |
1457 | else |
1472 | race = spell->race; |
1458 | race = spell->race; |
1473 | |
1459 | |
|
|
1460 | dynbuf buf; |
1474 | unordered_mapwalk (op, -range, -range, range, range) |
1461 | unordered_mapwalk (buf, op, -range, -range, range, range) |
1475 | { |
1462 | { |
1476 | mapspace &ms = m->at (nx, ny); |
1463 | mapspace &ms = m->at (nx, ny); |
1477 | |
1464 | |
1478 | /* If there is nothing living on this space, no need to go further */ |
1465 | /* If there is nothing living on this space, no need to go further */ |
1479 | if (!ms.flags () & P_IS_ALIVE) |
1466 | if (!ms.flags () & P_IS_ALIVE) |
… | |
… | |
1996 | set_spell_skill (op, caster, spell, disease); |
1983 | set_spell_skill (op, caster, spell, disease); |
1997 | disease->stats.exp = 0; |
1984 | disease->stats.exp = 0; |
1998 | disease->level = casting_level (caster, spell); |
1985 | disease->level = casting_level (caster, spell); |
1999 | |
1986 | |
2000 | /* do level adjustments */ |
1987 | /* do level adjustments */ |
2001 | if (disease->stats.wc) |
1988 | if (disease->stats.wc ) disease->stats.wc += dur_mod / 2; |
2002 | disease->stats.wc += dur_mod / 2; |
1989 | if (disease->magic > 0) disease->magic += dur_mod / 8; |
2003 | |
1990 | if (disease->stats.maxhp > 0) disease->stats.maxhp += dur_mod; |
2004 | if (disease->magic > 0) |
1991 | if (disease->stats.maxgrace > 0) disease->stats.maxgrace += dur_mod; |
2005 | disease->magic += dur_mod / 8; |
|
|
2006 | |
|
|
2007 | if (disease->stats.maxhp > 0) |
|
|
2008 | disease->stats.maxhp += dur_mod; |
|
|
2009 | |
|
|
2010 | if (disease->stats.maxgrace > 0) |
|
|
2011 | disease->stats.maxgrace += dur_mod; |
|
|
2012 | |
|
|
2013 | if (disease->stats.dam) |
|
|
2014 | { |
|
|
2015 | if (disease->stats.dam > 0) |
|
|
2016 | disease->stats.dam += dam_mod; |
|
|
2017 | else |
|
|
2018 | disease->stats.dam -= dam_mod; |
|
|
2019 | } |
|
|
2020 | |
1992 | |
2021 | if (disease->last_sp) |
1993 | if (disease->last_sp) |
2022 | { |
1994 | { |
2023 | disease->last_sp -= 2 * dam_mod; |
1995 | disease->last_sp -= 2 * dam_mod; |
|
|
1996 | |
2024 | if (disease->last_sp < 1) |
1997 | if (disease->last_sp < 1) |
2025 | disease->last_sp = 1; |
1998 | disease->last_sp = 1; |
2026 | } |
1999 | } |
2027 | |
2000 | |
2028 | if (disease->stats.maxsp) |
2001 | if (disease->stats.dam ) disease->stats.dam += copysign (disease->stats.dam , dam_mod); |
2029 | { |
2002 | if (disease->stats.maxsp) disease->stats.maxsp += copysign (disease->stats.maxsp, dam_mod); |
2030 | if (disease->stats.maxsp > 0) |
2003 | if (disease->stats.ac ) disease->stats.ac += dam_mod; |
2031 | disease->stats.maxsp += dam_mod; |
2004 | if (disease->last_eat ) disease->last_eat -= dam_mod; |
2032 | else |
2005 | if (disease->stats.hp ) disease->stats.hp -= dam_mod; |
2033 | disease->stats.maxsp -= dam_mod; |
2006 | if (disease->stats.sp ) disease->stats.sp -= dam_mod; |
2034 | } |
|
|
2035 | |
|
|
2036 | if (disease->stats.ac) |
|
|
2037 | disease->stats.ac += dam_mod; |
|
|
2038 | |
|
|
2039 | if (disease->last_eat) |
|
|
2040 | disease->last_eat -= dam_mod; |
|
|
2041 | |
|
|
2042 | if (disease->stats.hp) |
|
|
2043 | disease->stats.hp -= dam_mod; |
|
|
2044 | |
|
|
2045 | if (disease->stats.sp) |
|
|
2046 | disease->stats.sp -= dam_mod; |
|
|
2047 | |
2007 | |
2048 | if (infect_object (walk, disease, 1)) |
2008 | if (infect_object (walk, disease, 1)) |
2049 | { |
2009 | { |
2050 | new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); |
2010 | op->statusmsg (format ("You inflict %s on %s!", &disease->name, &walk->name)); |
2051 | |
2011 | |
2052 | disease->destroy (); /* don't need this one anymore */ |
2012 | disease->destroy (); /* don't need this one anymore */ |
2053 | walk->map->insert (get_archetype (shstr_detect_magic), x, y, op); |
2013 | walk->map->insert (get_archetype (shstr_detect_magic), x, y, op); |
2054 | return 1; |
2014 | return 1; |
2055 | } |
2015 | } |