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.98 by root, Fri Mar 26 00:59:22 2010 UTC vs.
Revision 1.101 by root, Sat Apr 10 05:12:57 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 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002-2003 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 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
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
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 dynbuf buf; 1291 dynbuf buf;
1306 unordered_mapwalk (buf, op, -range, -range, range, range) 1292 unordered_mapwalk (buf, op, -range, -range, range, range)
1307 { 1293 {
1308 mapspace &ms = m->at (nx, ny); 1294 mapspace &ms = m->at (nx, ny);
1309 1295
1334 } 1320 }
1335 } 1321 }
1336 } 1322 }
1337 } 1323 }
1338 1324
1339 op->skill = skill;
1340 return 1; 1325 return 1;
1341} 1326}
1342 1327
1343/*************************************************************************** 1328/***************************************************************************
1344 * 1329 *
1998 set_spell_skill (op, caster, spell, disease); 1983 set_spell_skill (op, caster, spell, disease);
1999 disease->stats.exp = 0; 1984 disease->stats.exp = 0;
2000 disease->level = casting_level (caster, spell); 1985 disease->level = casting_level (caster, spell);
2001 1986
2002 /* do level adjustments */ 1987 /* do level adjustments */
2003 if (disease->stats.wc) 1988 if (disease->stats.wc ) disease->stats.wc += dur_mod / 2;
2004 disease->stats.wc += dur_mod / 2; 1989 if (disease->magic > 0) disease->magic += dur_mod / 8;
2005 1990 if (disease->stats.maxhp > 0) disease->stats.maxhp += dur_mod;
2006 if (disease->magic > 0) 1991 if (disease->stats.maxgrace > 0) disease->stats.maxgrace += dur_mod;
2007 disease->magic += dur_mod / 8;
2008
2009 if (disease->stats.maxhp > 0)
2010 disease->stats.maxhp += dur_mod;
2011
2012 if (disease->stats.maxgrace > 0)
2013 disease->stats.maxgrace += dur_mod;
2014
2015 if (disease->stats.dam)
2016 {
2017 if (disease->stats.dam > 0)
2018 disease->stats.dam += dam_mod;
2019 else
2020 disease->stats.dam -= dam_mod;
2021 }
2022 1992
2023 if (disease->last_sp) 1993 if (disease->last_sp)
2024 { 1994 {
2025 disease->last_sp -= 2 * dam_mod; 1995 disease->last_sp -= 2 * dam_mod;
1996
2026 if (disease->last_sp < 1) 1997 if (disease->last_sp < 1)
2027 disease->last_sp = 1; 1998 disease->last_sp = 1;
2028 } 1999 }
2029 2000
2030 if (disease->stats.maxsp) 2001 if (disease->stats.dam ) disease->stats.dam += copysign (disease->stats.dam , dam_mod);
2031 { 2002 if (disease->stats.maxsp) disease->stats.maxsp += copysign (disease->stats.maxsp, dam_mod);
2032 if (disease->stats.maxsp > 0) 2003 if (disease->stats.ac ) disease->stats.ac += dam_mod;
2033 disease->stats.maxsp += dam_mod; 2004 if (disease->last_eat ) disease->last_eat -= dam_mod;
2034 else 2005 if (disease->stats.hp ) disease->stats.hp -= dam_mod;
2035 disease->stats.maxsp -= dam_mod; 2006 if (disease->stats.sp ) disease->stats.sp -= dam_mod;
2036 }
2037
2038 if (disease->stats.ac)
2039 disease->stats.ac += dam_mod;
2040
2041 if (disease->last_eat)
2042 disease->last_eat -= dam_mod;
2043
2044 if (disease->stats.hp)
2045 disease->stats.hp -= dam_mod;
2046
2047 if (disease->stats.sp)
2048 disease->stats.sp -= dam_mod;
2049 2007
2050 if (infect_object (walk, disease, 1)) 2008 if (infect_object (walk, disease, 1))
2051 { 2009 {
2052 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));
2053 2011
2054 disease->destroy (); /* don't need this one anymore */ 2012 disease->destroy (); /* don't need this one anymore */
2055 walk->map->insert (get_archetype (shstr_detect_magic), x, y, op); 2013 walk->map->insert (get_archetype (shstr_detect_magic), x, y, op);
2056 return 1; 2014 return 1;
2057 } 2015 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines