… | |
… | |
1397 | int |
1397 | int |
1398 | remove_curse (object *op, object *caster, object *spell) |
1398 | remove_curse (object *op, object *caster, object *spell) |
1399 | { |
1399 | { |
1400 | int success = 0, was_one = 0; |
1400 | int success = 0, was_one = 0; |
1401 | |
1401 | |
|
|
1402 | int num_uncurse = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
|
|
1403 | |
|
|
1404 | op->splay_marked (); |
|
|
1405 | |
1402 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1406 | for (object *tmp = op->inv; tmp && num_uncurse; tmp = tmp->below) |
1403 | if (tmp->flag [FLAG_APPLIED] && |
1407 | if (!tmp->invisible |
1404 | ((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED]) || |
1408 | && (((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED]) |
1405 | (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED]))) |
1409 | || (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED])))) |
1406 | { |
1410 | { |
1407 | was_one++; |
1411 | ++was_one; |
1408 | |
1412 | |
1409 | if (tmp->level <= casting_level (caster, spell)) |
1413 | if (tmp->level <= casting_level (caster, spell)) |
1410 | { |
1414 | { |
1411 | success++; |
1415 | ++success; |
|
|
1416 | --num_uncurse; |
|
|
1417 | |
1412 | if (spell->flag [FLAG_DAMNED]) |
1418 | if (spell->flag [FLAG_DAMNED]) |
1413 | tmp->clr_flag (FLAG_DAMNED); |
1419 | tmp->clr_flag (FLAG_DAMNED); |
1414 | |
1420 | |
1415 | tmp->clr_flag (FLAG_CURSED); |
1421 | tmp->clr_flag (FLAG_CURSED); |
1416 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
1422 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
… | |
… | |
1422 | } |
1428 | } |
1423 | |
1429 | |
1424 | if (op->type == PLAYER) |
1430 | if (op->type == PLAYER) |
1425 | { |
1431 | { |
1426 | if (success) |
1432 | if (success) |
1427 | 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.>"); |
1428 | else |
1434 | else |
1429 | { |
1435 | { |
1430 | if (was_one) |
1436 | if (was_one) |
1431 | 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.>"); |
1432 | else |
1438 | else |
1433 | 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."); |
1434 | } |
1440 | } |
1435 | } |
1441 | } |
1436 | |
1442 | |
1437 | return success; |
1443 | return success; |
1438 | } |
1444 | } |
1439 | |
1445 | |
1440 | /* Identifies objects in the players inventory/on the ground */ |
1446 | /* Identifies objects in the players inventory/on the ground */ |
1441 | int |
1447 | int |
1442 | cast_identify (object *op, object *caster, object *spell) |
1448 | cast_identify (object *op, object *caster, object *spell) |
1443 | { |
1449 | { |
1444 | object *tmp; |
|
|
1445 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
1450 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
1446 | |
1451 | |
1447 | 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)); |
1448 | |
1453 | |
|
|
1454 | op->splay_marked (); |
|
|
1455 | |
1449 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1456 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1450 | { |
1457 | { |
1451 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) |
1458 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) |
1452 | { |
1459 | { |
1453 | identify (tmp); |
1460 | identify (tmp); |
1454 | |
1461 | |
… | |
… | |
1469 | * 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 |
1470 | * was not fully used. |
1477 | * was not fully used. |
1471 | */ |
1478 | */ |
1472 | if (num_ident) |
1479 | if (num_ident) |
1473 | { |
1480 | { |
1474 | 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) |
1475 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) |
1482 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) |
1476 | { |
1483 | { |
1477 | identify (tmp); |
1484 | identify (tmp); |
1478 | |
1485 | |
1479 | if (object *pl = tmp->visible_to ()) |
1486 | if (object *pl = tmp->visible_to ()) |