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.131 by root, Fri Apr 23 04:32:47 2010 UTC vs.
Revision 1.135 by root, Fri Jul 2 19:58:19 2010 UTC

1089 force->speed_left = -1.0; 1089 force->speed_left = -1.0;
1090 force->set_flag (FLAG_APPLIED); 1090 force->set_flag (FLAG_APPLIED);
1091 1091
1092 /* Now start processing the effects. First, protections */ 1092 /* Now start processing the effects. First, protections */
1093 for (i = 0; i < NROFATTACKS; i++) 1093 for (i = 0; i < NROFATTACKS; i++)
1094 {
1095 if (spell_ob->resist[i]) 1094 if (spell_ob->resist[i])
1096 {
1097 force->resist[i] = spell_ob->resist[i] + SP_level_dam_adjust (caster, spell_ob); 1095 force->resist[i] = min (100, spell_ob->resist[i] + SP_level_dam_adjust (caster, spell_ob));
1098 if (force->resist[i] > 100)
1099 force->resist[i] = 100;
1100 }
1101 }
1102 1096
1103 if (spell_ob->stats.hp) 1097 if (spell_ob->stats.hp)
1104 force->stats.hp = spell_ob->stats.hp + SP_level_dam_adjust (caster, spell_ob); 1098 force->stats.hp = spell_ob->stats.hp + SP_level_dam_adjust (caster, spell_ob);
1105 1099
1106 if (tmp->type == PLAYER) 1100 if (tmp->type == PLAYER)
1217 { 1211 {
1218 new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); 1212 new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect.");
1219 } 1213 }
1220 return 0; 1214 return 0;
1221 } 1215 }
1216
1222 force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; 1217 force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50;
1223 force->speed = 1.0; 1218 force->speed = 1.0;
1224 force->speed_left = -1.0; 1219 force->speed_left = -1.0;
1225 force->set_flag (FLAG_APPLIED); 1220 force->set_flag (FLAG_APPLIED);
1226 1221
1374 } 1369 }
1375 1370
1376 value -= rndm (value >> 4); 1371 value -= rndm (value >> 4);
1377 value = min (value, value_max); 1372 value = min (value, value_max);
1378 1373
1379 for (int i = 0; i < sizeof (nugget) / sizeof (nugget [0]); ++i) 1374 for (int i = 0; i < array_length (nugget); ++i)
1380 if (int nrof = value / nugget [i]->value) 1375 if (int nrof = value / nugget [i]->value)
1381 { 1376 {
1382 value -= nrof * nugget[i]->value; 1377 value -= nrof * nugget[i]->value;
1383 1378
1384 object *tmp = nugget[i]->instance (); 1379 object *tmp = nugget[i]->instance ();
1402int 1397int
1403remove_curse (object *op, object *caster, object *spell) 1398remove_curse (object *op, object *caster, object *spell)
1404{ 1399{
1405 int success = 0, was_one = 0; 1400 int success = 0, was_one = 0;
1406 1401
1402 int num_uncurse = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell));
1403
1404 op->splay_marked ();
1405
1407 for (object *tmp = op->inv; tmp; tmp = tmp->below) 1406 for (object *tmp = op->inv; tmp && num_uncurse; tmp = tmp->below)
1408 if (tmp->flag [FLAG_APPLIED] && 1407 if (!tmp->invisible
1409 ((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED]) || 1408 && (((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED])
1410 (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED]))) 1409 || (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED]))))
1411 { 1410 {
1412 was_one++; 1411 ++was_one;
1413 1412
1414 if (tmp->level <= casting_level (caster, spell)) 1413 if (tmp->level <= casting_level (caster, spell))
1415 { 1414 {
1416 success++; 1415 ++success;
1416 --num_uncurse;
1417
1417 if (spell->flag [FLAG_DAMNED]) 1418 if (spell->flag [FLAG_DAMNED])
1418 tmp->clr_flag (FLAG_DAMNED); 1419 tmp->clr_flag (FLAG_DAMNED);
1419 1420
1420 tmp->clr_flag (FLAG_CURSED); 1421 tmp->clr_flag (FLAG_CURSED);
1421 tmp->clr_flag (FLAG_KNOWN_CURSED); 1422 tmp->clr_flag (FLAG_KNOWN_CURSED);
1427 } 1428 }
1428 1429
1429 if (op->type == PLAYER) 1430 if (op->type == PLAYER)
1430 { 1431 {
1431 if (success) 1432 if (success)
1432 new_draw_info (NDI_UNIQUE, 0, op, "You feel like some of your items are looser now."); 1433 new_draw_info (NDI_UNIQUE, 0, op, "You realise that some of your items look shinier now. H<You successfully removed some curses.>");
1433 else 1434 else
1434 { 1435 {
1435 if (was_one) 1436 if (was_one)
1436 new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove the curse."); 1437 new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove any curse. H<The spell was not strong enough.>");
1437 else 1438 else
1438 new_draw_info (NDI_UNIQUE, 0, op, "You are not using any cursed items."); 1439 new_draw_info (NDI_UNIQUE, 0, op, "You are not having any cursed items. H<Epic fail.>");
1439 } 1440 }
1440 } 1441 }
1441 1442
1442 return success; 1443 return success;
1443} 1444}
1444 1445
1445/* Identifies objects in the players inventory/on the ground */ 1446/* Identifies objects in the players inventory/on the ground */
1446int 1447int
1447cast_identify (object *op, object *caster, object *spell) 1448cast_identify (object *op, object *caster, object *spell)
1448{ 1449{
1449 object *tmp;
1450 dynbuf_text &buf = msg_dynbuf; buf.clear (); 1450 dynbuf_text &buf = msg_dynbuf; buf.clear ();
1451 1451
1452 int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); 1452 int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell));
1453 1453
1454 op->splay_marked ();
1455
1454 for (tmp = op->inv; tmp; tmp = tmp->below) 1456 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1455 { 1457 {
1456 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) 1458 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ())
1457 { 1459 {
1458 identify (tmp); 1460 identify (tmp);
1459 1461
1474 * stuff on the floor. Only identify stuff on the floor if the spell 1476 * stuff on the floor. Only identify stuff on the floor if the spell
1475 * was not fully used. 1477 * was not fully used.
1476 */ 1478 */
1477 if (num_ident) 1479 if (num_ident)
1478 { 1480 {
1479 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) 1481 for (object *tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above)
1480 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) 1482 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ())
1481 { 1483 {
1482 identify (tmp); 1484 identify (tmp);
1483 1485
1484 if (object *pl = tmp->visible_to ()) 1486 if (object *pl = tmp->visible_to ())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines