… | |
… | |
595 | object::drain_specific_stat (int deplete_stats) |
595 | object::drain_specific_stat (int deplete_stats) |
596 | { |
596 | { |
597 | object *tmp; |
597 | object *tmp; |
598 | archetype *at; |
598 | archetype *at; |
599 | |
599 | |
600 | at = archetype::find (ARCH_DEPLETION); |
600 | at = archetype::find (shstr_depletion); |
601 | if (!at) |
601 | if (!at) |
602 | { |
602 | { |
603 | LOG (llevError, "Couldn't find archetype depletion.\n"); |
603 | LOG (llevError, "Couldn't find archetype depletion.\n"); |
604 | return; |
604 | return; |
605 | } |
605 | } |
… | |
… | |
625 | * via an applied bad_luck object. |
625 | * via an applied bad_luck object. |
626 | */ |
626 | */ |
627 | void |
627 | void |
628 | object::change_luck (int value) |
628 | object::change_luck (int value) |
629 | { |
629 | { |
630 | archetype *at = archetype::find ("luck"); |
630 | archetype *at = archetype::find (shstr_luck); |
631 | if (!at) |
631 | if (!at) |
632 | LOG (llevError, "Couldn't find archetype luck.\n"); |
632 | LOG (llevError, "Couldn't find archetype luck.\n"); |
633 | else |
633 | else |
634 | { |
634 | { |
635 | object *tmp = present_arch_in_ob (at, this); |
635 | object *tmp = present_arch_in_ob (at, this); |
… | |
… | |
1405 | move_type &= ~MOVE_WALK; |
1405 | move_type &= ~MOVE_WALK; |
1406 | |
1406 | |
1407 | /* It is quite possible that a player's spell costing might have changed, |
1407 | /* It is quite possible that a player's spell costing might have changed, |
1408 | * so we will check that now. |
1408 | * so we will check that now. |
1409 | */ |
1409 | */ |
1410 | if (type == PLAYER) |
1410 | if (is_player ()) |
1411 | { |
1411 | contr->update_spells (); |
1412 | esrv_update_stats (contr); |
|
|
1413 | esrv_update_spells (contr); |
|
|
1414 | } |
|
|
1415 | |
1412 | |
1416 | // update the mapspace, if we are on a map |
1413 | // update the mapspace, if we are on a map |
1417 | if (!flag [FLAG_REMOVED] && map) |
1414 | if (!flag [FLAG_REMOVED] && map) |
1418 | map->at (x, y).flags_ = 0; |
1415 | map->at (x, y).flags_ = 0; |
1419 | } |
1416 | } |
… | |
… | |
1503 | /* |
1500 | /* |
1504 | * This function is called when a dragon-player gains |
1501 | * This function is called when a dragon-player gains |
1505 | * an overall level. Here, the dragon might gain new abilities |
1502 | * an overall level. Here, the dragon might gain new abilities |
1506 | * or change the ability-focus. |
1503 | * or change the ability-focus. |
1507 | */ |
1504 | */ |
1508 | void |
1505 | static void |
1509 | dragon_level_gain (object *who) |
1506 | dragon_level_gain (object *who) |
1510 | { |
1507 | { |
1511 | object *abil = NULL; /* pointer to dragon ability force */ |
1508 | object *abil = NULL; /* pointer to dragon ability force */ |
1512 | object *skin = NULL; /* pointer to dragon skin force */ |
1509 | object *skin = NULL; /* pointer to dragon skin force */ |
1513 | object *tmp = NULL; /* tmp. object */ |
1510 | object *tmp = NULL; /* tmp. object */ |
… | |
… | |
1652 | new_draw_info (NDI_UNIQUE | NDI_RED, 0, who, buf); |
1649 | new_draw_info (NDI_UNIQUE | NDI_RED, 0, who, buf); |
1653 | } |
1650 | } |
1654 | } |
1651 | } |
1655 | |
1652 | |
1656 | if (changed) |
1653 | if (changed) |
1657 | { |
1654 | who->update_stats (); // should cause esrv_update_stats and esrv_update_spells |
1658 | who->update_stats (); |
|
|
1659 | esrv_update_stats (who->contr); |
|
|
1660 | /* check if the spell data has changed */ |
|
|
1661 | esrv_update_spells (who->contr); |
|
|
1662 | } |
|
|
1663 | } |
1655 | } |
1664 | |
1656 | |
1665 | /* |
1657 | /* |
1666 | * Returns how much experience is needed for a player to become |
1658 | * Returns how much experience is needed for a player to become |
1667 | * the given level. level should really never exceed max_level |
1659 | * the given level. level should really never exceed max_level |
… | |
… | |
1789 | * adjustments based on permanent exp and the like. |
1781 | * adjustments based on permanent exp and the like. |
1790 | * This function should always be used for losing experience - |
1782 | * This function should always be used for losing experience - |
1791 | * the 'exp' value passed should be positive - this is the |
1783 | * the 'exp' value passed should be positive - this is the |
1792 | * amount that should get subtract from the player. |
1784 | * amount that should get subtract from the player. |
1793 | */ |
1785 | */ |
1794 | sint64 |
1786 | static sint64 |
1795 | check_exp_loss (const object *op, sint64 exp) |
1787 | check_exp_loss (const object *op, sint64 exp) |
1796 | { |
1788 | { |
1797 | sint64 del_exp; |
1789 | sint64 del_exp; |
1798 | |
1790 | |
1799 | if (exp > op->stats.exp) |
1791 | if (exp > op->stats.exp) |
… | |
… | |
1948 | |
1940 | |
1949 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1941 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1950 | if (tmp->type == SKILL && tmp->stats.exp) |
1942 | if (tmp->type == SKILL && tmp->stats.exp) |
1951 | { |
1943 | { |
1952 | percentage_loss = tmp->stats.exp * settings.death_penalty_ratio / 100; |
1944 | percentage_loss = tmp->stats.exp * settings.death_penalty_ratio / 100; |
1953 | level_loss = tmp->stats.exp - levels[MAX (0, tmp->level - settings.death_penalty_level)]; |
1945 | level_loss = tmp->stats.exp - levels [max (0, tmp->level - settings.death_penalty_level)]; |
1954 | |
1946 | |
1955 | /* With the revised exp system, you can get cases where |
1947 | /* With the revised exp system, you can get cases where |
1956 | * losing several levels would still require that you have more |
1948 | * losing several levels would still require that you have more |
1957 | * exp than you currently have - this is true if the levels |
1949 | * exp than you currently have - this is true if the levels |
1958 | * tables is a lot harder. |
1950 | * tables is a lot harder. |