… | |
… | |
677 | */ |
677 | */ |
678 | |
678 | |
679 | void |
679 | void |
680 | object::drain_stat () |
680 | object::drain_stat () |
681 | { |
681 | { |
682 | drain_specific_stat (RANDOM () % NUM_STATS); |
682 | drain_specific_stat (rndm (NUM_STATS)); |
683 | } |
683 | } |
684 | |
684 | |
685 | void |
685 | void |
686 | object::drain_specific_stat (int deplete_stats) |
686 | object::drain_specific_stat (int deplete_stats) |
687 | { |
687 | { |
… | |
… | |
926 | speed = arch->clone.speed; |
926 | speed = arch->clone.speed; |
927 | |
927 | |
928 | /* OK - we've reset most all the objects attributes to sane values. |
928 | /* OK - we've reset most all the objects attributes to sane values. |
929 | * now go through and make adjustments for what the player has equipped. |
929 | * now go through and make adjustments for what the player has equipped. |
930 | */ |
930 | */ |
931 | |
|
|
932 | for (tmp = inv; tmp; tmp = tmp->below) |
931 | for (tmp = inv; tmp; tmp = tmp->below) |
933 | { |
932 | { |
934 | /* See note in map.c:update_position about making this additive |
933 | /* See note in map.c:update_position about making this additive |
935 | * since light sources are never applied, need to put check here. |
934 | * since light sources are never applied, need to put check here. |
936 | */ |
935 | */ |
… | |
… | |
1021 | if (speed_reduce_from_disease == 0) |
1020 | if (speed_reduce_from_disease == 0) |
1022 | speed_reduce_from_disease = 1; |
1021 | speed_reduce_from_disease = 1; |
1023 | } |
1022 | } |
1024 | |
1023 | |
1025 | /* Pos. and neg. protections are counted seperate (-> pro/vuln). |
1024 | /* Pos. and neg. protections are counted seperate (-> pro/vuln). |
1026 | * (Negative protections are calculated extactly like positive.) |
1025 | * (Negative protections are calculated exactly like positive.) |
1027 | * Resistance from potions are treated special as well. If there's |
1026 | * Resistance from potions are treated special as well. If there's |
1028 | * more than one potion-effect, the bigger prot.-value is taken. |
1027 | * more than one potion-effect, the bigger prot.-value is taken. |
1029 | */ |
1028 | */ |
1030 | if (tmp->type != POTION) |
1029 | if (tmp->type != POTION) |
1031 | { |
1030 | { |
… | |
… | |
1040 | potion_resist[i] = MAX (potion_resist[i], tmp->resist[i]); |
1039 | potion_resist[i] = MAX (potion_resist[i], tmp->resist[i]); |
1041 | else |
1040 | else |
1042 | potion_resist[i] = tmp->resist[i]; |
1041 | potion_resist[i] = tmp->resist[i]; |
1043 | } |
1042 | } |
1044 | else if (tmp->resist[i] > 0) |
1043 | else if (tmp->resist[i] > 0) |
1045 | prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; |
1044 | prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; |
1046 | else if (tmp->resist[i] < 0) |
1045 | else if (tmp->resist[i] < 0) |
1047 | vuln[i] += ((100 - vuln[i]) * (-tmp->resist[i])) / 100; |
1046 | vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; |
1048 | } |
1047 | } |
1049 | } |
1048 | } |
1050 | |
1049 | |
1051 | /* There may be other things that should not adjust the attacktype */ |
1050 | /* There may be other things that should not adjust the attacktype */ |
1052 | if (tmp->type != BOW && tmp->type != SYMPTOM) |
1051 | if (tmp->type != BOW && tmp->type != SYMPTOM) |
… | |
… | |
1515 | if (type == PLAYER) |
1514 | if (type == PLAYER) |
1516 | { |
1515 | { |
1517 | esrv_update_stats (contr); |
1516 | esrv_update_stats (contr); |
1518 | esrv_update_spells (contr); |
1517 | esrv_update_spells (contr); |
1519 | } |
1518 | } |
|
|
1519 | |
|
|
1520 | // update the mapspace, if we are on a map |
|
|
1521 | if (!flag [FLAG_REMOVED] && map) |
|
|
1522 | map->at (x, y).flags_ = 0; |
1520 | } |
1523 | } |
1521 | |
1524 | |
1522 | /* |
1525 | /* |
1523 | * Returns true if the given player is a legal class. |
1526 | * Returns true if the given player is a legal class. |
1524 | * The function to add and remove class-bonuses to the stats doesn't |
1527 | * The function to add and remove class-bonuses to the stats doesn't |
… | |
… | |
1951 | del_exp = check_exp_loss (tmp, (sint64) (tmp->stats.exp * fraction)); |
1954 | del_exp = check_exp_loss (tmp, (sint64) (tmp->stats.exp * fraction)); |
1952 | tmp->stats.exp -= del_exp; |
1955 | tmp->stats.exp -= del_exp; |
1953 | player_lvl_adj (op, tmp); |
1956 | player_lvl_adj (op, tmp); |
1954 | } |
1957 | } |
1955 | } |
1958 | } |
|
|
1959 | |
1956 | if (flag != SK_SUBTRACT_SKILL_EXP) |
1960 | if (flag != SK_SUBTRACT_SKILL_EXP) |
1957 | { |
1961 | { |
1958 | del_exp = check_exp_loss (op, exp); |
1962 | del_exp = check_exp_loss (op, exp); |
1959 | op->stats.exp -= del_exp; |
1963 | op->stats.exp -= del_exp; |
1960 | player_lvl_adj (op, NULL); |
1964 | player_lvl_adj (op, NULL); |
1961 | } |
1965 | } |
1962 | } |
1966 | } |
1963 | |
|
|
1964 | |
|
|
1965 | |
1967 | |
1966 | /* change_exp() - changes experience to a player/monster. This |
1968 | /* change_exp() - changes experience to a player/monster. This |
1967 | * does bounds checking to make sure we don't overflow the max exp. |
1969 | * does bounds checking to make sure we don't overflow the max exp. |
1968 | * |
1970 | * |
1969 | * The exp passed is typically not modified much by this function - |
1971 | * The exp passed is typically not modified much by this function - |
1970 | * it is assumed the caller has modified the exp as needed. |
1972 | * it is assumed the caller has modified the exp as needed. |
1971 | * skill_name is the skill that should get the exp added. |
1973 | * skill_name is the skill that should get the exp added. |
1972 | * flag is what to do if player doesn't have the skill. |
1974 | * flag is what to do if player doesn't have the skill. |
1973 | * these last two values are only used for players. |
1975 | * these last two values are only used for players. |
1974 | */ |
1976 | */ |
1975 | |
|
|
1976 | void |
1977 | void |
1977 | change_exp (object *op, sint64 exp, const char *skill_name, int flag) |
1978 | change_exp (object *op, sint64 exp, const char *skill_name, int flag) |
1978 | { |
1979 | { |
1979 | |
1980 | |
1980 | #ifdef EXP_DEBUG |
1981 | #ifdef EXP_DEBUG |