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

Comparing deliantra/server/server/spell_effect.C (file contents):
Revision 1.134 by root, Fri Jul 2 19:54:41 2010 UTC vs.
Revision 1.141 by root, Fri Jan 27 22:00:40 2012 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,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 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
73 if (!(random_roll (0, 3, op, PREFER_HIGH))) 73 if (!(random_roll (0, 3, op, PREFER_HIGH)))
74 { 74 {
75 op->failmsgf ("The %s vibrates violently, then explodes!", query_name (wand)); 75 op->failmsgf ("The %s vibrates violently, then explodes!", query_name (wand));
76 op->play_sound (sound_find ("ob_explode")); 76 op->play_sound (sound_find ("ob_explode"));
77 wand->destroy (); 77 wand->destroy ();
78 object *tmp = get_archetype (shstr_fireball); 78 object *tmp = archetype::get (shstr_fireball);
79 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10; 79 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10;
80 80
81 if (!tmp->stats.dam) 81 if (!tmp->stats.dam)
82 tmp->stats.dam = 1; 82 tmp->stats.dam = 1;
83 83
389 389
390 /* Remove the switch with 90% duplicate code - just handle the differences with 390 /* Remove the switch with 90% duplicate code - just handle the differences with
391 * and if statement or two. 391 * and if statement or two.
392 */ 392 */
393 op->invisible += spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); 393 op->invisible += spell_ob->duration + SP_level_duration_adjust (caster, spell_ob);
394
394 /* max duration */ 395 /* limit duration */
395 if (op->invisible > 1000) 396 min_it (op->invisible, 1000);
396 op->invisible = 1000;
397 397
398 if (op->type == PLAYER) 398 if (op->type == PLAYER)
399 { 399 {
400 op->contr->invis_race = spell_ob->race; 400 op->contr->invis_race = spell_ob->race;
401 401
485 { 485 {
486 new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); 486 new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you.");
487 return 1; 487 return 1;
488 } 488 }
489 489
490 object *dummy = get_archetype (FORCE_NAME); 490 object *dummy = archetype::get (FORCE_NAME);
491 491
492 int time = max (1, spell_ob->duration - SP_level_duration_adjust (caster, spell_ob)); 492 int time = max (1, spell_ob->duration - SP_level_duration_adjust (caster, spell_ob));
493 493
494 /* value of speed really doesn't make much difference, as long as it is 494 /* value of speed really doesn't make much difference, as long as it is
495 * positive. Lower value may be useful so that the problem doesn't 495 * positive. Lower value may be useful so that the problem doesn't
1072 1072
1073 new_draw_info_format (NDI_UNIQUE, 0, op, 1073 new_draw_info_format (NDI_UNIQUE, 0, op,
1074 "You create an aura of magical force. H<The effect will last for about %.10g seconds.>", 1074 "You create an aura of magical force. H<The effect will last for about %.10g seconds.>",
1075 TICK2TIME (duration)); 1075 TICK2TIME (duration));
1076 1076
1077 force = get_archetype (FORCE_NAME); 1077 force = archetype::get (FORCE_NAME);
1078 force->subtype = FORCE_CHANGE_ABILITY; 1078 force->subtype = FORCE_CHANGE_ABILITY;
1079 force->duration = duration; 1079 force->duration = duration;
1080 1080
1081 if (spell_ob->race) 1081 if (spell_ob->race)
1082 force->name = spell_ob->race; 1082 force->name = spell_ob->race;
1186 } 1186 }
1187 } 1187 }
1188 1188
1189 if (force == NULL) 1189 if (force == NULL)
1190 { 1190 {
1191 force = get_archetype (FORCE_NAME); 1191 force = archetype::get (FORCE_NAME);
1192 force->subtype = FORCE_CHANGE_ABILITY; 1192 force->subtype = FORCE_CHANGE_ABILITY;
1193 if (spell_ob->race) 1193 if (spell_ob->race)
1194 force->name = spell_ob->race; 1194 force->name = spell_ob->race;
1195 else 1195 else
1196 force->name = spell_ob->name; 1196 force->name = spell_ob->name;
1401 1401
1402 int num_uncurse = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); 1402 int num_uncurse = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell));
1403 1403
1404 op->splay_marked (); 1404 op->splay_marked ();
1405 1405
1406 int typeflag = spell->last_sp ? FLAG_DAMNED : FLAG_CURSED;
1407
1406 for (object *tmp = op->inv; tmp && num_uncurse; tmp = tmp->below) 1408 for (object *tmp = op->inv; tmp && num_uncurse; tmp = tmp->below)
1407 if (!tmp->invisible 1409 if (!tmp->invisible && tmp->flag [typeflag])
1408 && (((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED])
1409 || (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED]))))
1410 { 1410 {
1411 ++was_one; 1411 ++was_one;
1412 1412
1413 if (tmp->level <= casting_level (caster, spell)) 1413 if (tmp->level <= casting_level (caster, spell))
1414 { 1414 {
1415 ++success; 1415 ++success;
1416 --num_uncurse; 1416 --num_uncurse;
1417 1417
1418 if (spell->flag [FLAG_DAMNED]) 1418 tmp->clr_flag (typeflag);
1419 tmp->clr_flag (FLAG_DAMNED);
1420
1421 tmp->clr_flag (FLAG_CURSED); 1419 tmp->clr_flag (FLAG_CURSED);
1422 tmp->clr_flag (FLAG_KNOWN_CURSED); 1420 tmp->clr_flag (FLAG_KNOWN_CURSED);
1423 tmp->value = 0; /* Still can't sell it */ 1421 tmp->value = 0; /* Still can't sell it */
1424 1422
1425 if (object *pl = tmp->visible_to ()) 1423 if (object *pl = tmp->visible_to ())
1434 else 1432 else
1435 { 1433 {
1436 if (was_one) 1434 if (was_one)
1437 new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove any curse. H<The spell was not strong enough.>"); 1435 new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove any curse. H<The spell was not strong enough.>");
1438 else 1436 else
1439 new_draw_info (NDI_UNIQUE, 0, op, "You are not having any cursed items."); 1437 new_draw_info (NDI_UNIQUE, 0, op, "You are not having any cursed items. H<Epic fail.>");
1440 } 1438 }
1441 } 1439 }
1442 1440
1443 return success; 1441 return success;
1444} 1442}
1513 1511
1514int 1512int
1515cast_detection (object *op, object *caster, object *spell, object *skill) 1513cast_detection (object *op, object *caster, object *spell, object *skill)
1516{ 1514{
1517 object *tmp, *last, *god, *detect; 1515 object *tmp, *last, *god, *detect;
1518 int done_one, range, mflags, floor, level; 1516 int done_one, range, floor, level;
1519 sint16 x, y, nx, ny; 1517 sint16 x, y, nx, ny;
1520 maptile *m; 1518 maptile *m;
1521 1519
1522 /* We precompute some values here so that we don't have to keep 1520 /* We precompute some values here so that we don't have to keep
1523 * doing it over and over again. 1521 * doing it over and over again.
2111 /* Improve weapon's armour value according to best save vs. physical of its material */ 2109 /* Improve weapon's armour value according to best save vs. physical of its material */
2112 2110
2113 if (a > 14) 2111 if (a > 14)
2114 a = 14; 2112 a = 14;
2115 2113
2116 tmp->resist[ATNR_PHYSICAL] = 100 - (int) ((100.0 - (float) tmp->resist[ATNR_PHYSICAL]) / (30.0 - 2.0 * a)); 2114 tmp->resist[ATNR_PHYSICAL] = 100 - (int) ((100.f - (float) tmp->resist[ATNR_PHYSICAL]) / (30.f - 2.f * a));
2117 2115
2118 /* Determine golem's speed */ 2116 /* Determine golem's speed */
2119 tmp->set_speed (min (3.33, 0.4 + 0.1 * SP_level_range_adjust (caster, spell))); 2117 tmp->set_speed (min (3.33f, 0.4f + 0.1f * SP_level_range_adjust (caster, spell)));
2120 2118
2121 if (!spell->race) 2119 if (!spell->race)
2122 { 2120 {
2123 sprintf (buf, "animated %s", &weapon->name); 2121 sprintf (buf, "animated %s", &weapon->name);
2124 tmp->name = buf; 2122 tmp->name = buf;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines