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

Comparing deliantra/server/common/living.C (file contents):
Revision 1.117 by root, Tue Apr 6 21:11:48 2010 UTC vs.
Revision 1.127 by root, Fri Jan 27 22:00:39 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
139/* 139/*
140 Since this is nowhere defined ... 140 Since this is nowhere defined ...
141 Both come in handy at least in function add_exp() 141 Both come in handy at least in function add_exp()
142*/ 142*/
143 143
144#define MAX_EXPERIENCE levels[settings.max_level] 144#define MAX_EXPERIENCE levels [settings.max_level]
145 145
146/* because exp_obj sum to make the total score, 146/* because exp_obj sum to make the total score,
147 * we cannot allow that sum to exceed the maximum 147 * we cannot allow that sum to exceed the maximum
148 * amount of experience a player can gain. Thus 148 * amount of experience a player can gain. Thus
149 * we define MAX_EXP_IN_OBJ. It is important to try 149 * we define MAX_EXP_IN_OBJ. It is important to try
156 * line with progression of previous levels, so 156 * line with progression of previous levels, so
157 * if more levels are desired, this should be fixed. 157 * if more levels are desired, this should be fixed.
158 * -b.t. 158 * -b.t.
159 */ 159 */
160 160
161#define MAX_EXP_IN_OBJ levels[settings.max_level]/(MAX_EXP_CAT - 1) 161#define MAX_EXP_IN_OBJ MAX_EXP_IN_OBJ / (MAX_EXP_CAT - 1)
162
163extern sint64 *levels;
164 162
165#define MAX_SAVE_LEVEL 110 163#define MAX_SAVE_LEVEL 110
166 164
167/* This no longer needs to be changed anytime the number of 165/* This no longer needs to be changed anytime the number of
168 * levels is increased - rather, did_make_save will do the 166 * levels is increased - rather, did_make_save will do the
461 if (op->flag [FLAG_WIZ]) 459 if (op->flag [FLAG_WIZ])
462 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self is blinded."); 460 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self is blinded.");
463 else 461 else
464 { 462 {
465 new_draw_info (NDI_UNIQUE, 0, op, "You are blinded."); 463 new_draw_info (NDI_UNIQUE, 0, op, "You are blinded.");
466 SET_FLAG (op, FLAG_BLIND); 464 op->set_flag (FLAG_BLIND);
467 if (op->type == PLAYER) 465 if (op->type == PLAYER)
468 op->contr->do_los = 1; 466 op->contr->do_los = 1;
469 } 467 }
470 } 468 }
471 else 469 else
473 if (op->flag [FLAG_WIZ]) 471 if (op->flag [FLAG_WIZ])
474 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self can now see again."); 472 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self can now see again.");
475 else 473 else
476 { 474 {
477 new_draw_info (NDI_UNIQUE, 0, op, "Your vision returns."); 475 new_draw_info (NDI_UNIQUE, 0, op, "Your vision returns.");
478 CLEAR_FLAG (op, FLAG_BLIND); 476 op->clr_flag (FLAG_BLIND);
479 if (op->type == PLAYER) 477 if (op->type == PLAYER)
480 op->contr->do_los = 1; 478 op->contr->do_los = 1;
481 } 479 }
482 } 480 }
483 } 481 }
610 608
611 if (!tmp) 609 if (!tmp)
612 { 610 {
613 tmp = at->instance (); 611 tmp = at->instance ();
614 tmp = insert_ob_in_ob (tmp, this); 612 tmp = insert_ob_in_ob (tmp, this);
615 SET_FLAG (tmp, FLAG_APPLIED); 613 tmp->set_flag (FLAG_APPLIED);
616 } 614 }
617 } 615 }
618 616
619 new_draw_info (NDI_UNIQUE, 0, this, drain_msg[deplete_stats]); 617 new_draw_info (NDI_UNIQUE, 0, this, drain_msg[deplete_stats]);
620 change_attr_value (&tmp->stats, deplete_stats, -1); 618 change_attr_value (&tmp->stats, deplete_stats, -1);
640 if (!value) 638 if (!value)
641 return; 639 return;
642 640
643 tmp = at->instance (); 641 tmp = at->instance ();
644 tmp = insert_ob_in_ob (tmp, this); 642 tmp = insert_ob_in_ob (tmp, this);
645 SET_FLAG (tmp, FLAG_APPLIED); 643 tmp->set_flag (FLAG_APPLIED);
646 } 644 }
647 645
648 if (value) 646 if (value)
649 { 647 {
650 /* Limit the luck value of the bad luck object to +/-100. This 648 /* Limit the luck value of the bad luck object to +/-100. This
731 * spell system split, grace points now added to system --peterm 729 * spell system split, grace points now added to system --peterm
732 */ 730 */
733void 731void
734object::update_stats () 732object::update_stats ()
735{ 733{
736 float f, max_speed = 9, added_speed = 0, bonus_speed = 0, speed_reduce_from_disease = 1; 734 float max_speed = 9, added_speed = 0, bonus_speed = 0, speed_reduce_from_disease = 1;
737 int weapon_weight = 0, weapon_speed = 0; 735 int weapon_weight = 0, weapon_speed = 0;
738 int best_wc = 0, best_ac = 0, wc = 0, ac = 0; 736 int best_wc = 0, best_ac = 0, wc = 0, ac = 0;
739 int prot[NROFATTACKS], vuln[NROFATTACKS], potion_resist[NROFATTACKS]; 737 int prot[NROFATTACKS], vuln[NROFATTACKS], potion_resist[NROFATTACKS];
740 object *grace_obj = NULL, *mana_obj = NULL, *tmp; 738 object *grace_obj = NULL, *mana_obj = NULL, *tmp;
741 float old_speed = speed; 739 float old_speed = speed;
767 for (int i = NUM_BODY_LOCATIONS; i--; ) 765 for (int i = NUM_BODY_LOCATIONS; i--; )
768 slot[i].used = slot[i].info; 766 slot[i].used = slot[i].info;
769 767
770 slaying = 0; 768 slaying = 0;
771 769
772 if (!QUERY_FLAG (this, FLAG_WIZ)) 770 if (!this->flag [FLAG_WIZ])
773 {
774 CLEAR_FLAG (this, FLAG_XRAYS);
775 CLEAR_FLAG (this, FLAG_MAKE_INVIS);
776 } 771 {
772 this->clr_flag (FLAG_XRAYS);
773 this->clr_flag (FLAG_MAKE_INVIS);
774 }
777 775
778 CLEAR_FLAG (this, FLAG_LIFESAVE); 776 this->clr_flag (FLAG_LIFESAVE);
779 CLEAR_FLAG (this, FLAG_STEALTH); 777 this->clr_flag (FLAG_STEALTH);
780 CLEAR_FLAG (this, FLAG_BLIND); 778 this->clr_flag (FLAG_BLIND);
781 779
782 if (!QUERY_FLAG (arch, FLAG_REFL_SPELL )) CLEAR_FLAG (this, FLAG_REFL_SPELL); 780 if (!arch->flag [FLAG_REFL_SPELL ]) this->clr_flag (FLAG_REFL_SPELL);
783 if (!QUERY_FLAG (arch, FLAG_REFL_MISSILE)) CLEAR_FLAG (this, FLAG_REFL_MISSILE); 781 if (!arch->flag [FLAG_REFL_MISSILE]) this->clr_flag (FLAG_REFL_MISSILE);
784 if (!QUERY_FLAG (arch, FLAG_UNDEAD )) CLEAR_FLAG (this, FLAG_UNDEAD); 782 if (!arch->flag [FLAG_UNDEAD ]) this->clr_flag (FLAG_UNDEAD);
785 if (!QUERY_FLAG (arch, FLAG_SEE_IN_DARK )) CLEAR_FLAG (this, FLAG_SEE_IN_DARK); 783 if (!arch->flag [FLAG_SEE_IN_DARK ]) this->clr_flag (FLAG_SEE_IN_DARK);
786 784
787 path_attuned = arch->path_attuned; 785 path_attuned = arch->path_attuned;
788 path_repelled = arch->path_repelled; 786 path_repelled = arch->path_repelled;
789 path_denied = arch->path_denied; 787 path_denied = arch->path_denied;
790 glow_radius = arch->glow_radius; 788 glow_radius = arch->glow_radius;
813 * the fact that maxlevel is factored in could be considered sort of bogus - 811 * the fact that maxlevel is factored in could be considered sort of bogus -
814 * we should probably give them some bonus and cap it off - otherwise, 812 * we should probably give them some bonus and cap it off - otherwise,
815 * basically, if a server updates its max level, these playes may find 813 * basically, if a server updates its max level, these playes may find
816 * that their protection from physical goes down 814 * that their protection from physical goes down
817 */ 815 */
818 if (!QUERY_FLAG (this, FLAG_USE_ARMOUR) && type == PLAYER) 816 if (!this->flag [FLAG_USE_ARMOUR] && type == PLAYER)
819 { 817 {
820 ac = max (-10, arch->stats.ac - level / 3); 818 ac = max (-10, arch->stats.ac - level / 3);
821 prot[ATNR_PHYSICAL] += ((100 - prot[AT_PHYSICAL]) * (80 * level / settings.max_level)) / 100; 819 prot[ATNR_PHYSICAL] += ((100 - prot[AT_PHYSICAL]) * (80 * level / settings.max_level)) / 100;
822 } 820 }
823 else 821 else
835 { 833 {
836 /* This happens because apply_potion calls change_abil with the potion 834 /* This happens because apply_potion calls change_abil with the potion
837 * applied so we can tell the player what changed. But change_abil 835 * applied so we can tell the player what changed. But change_abil
838 * then calls this function. 836 * then calls this function.
839 */ 837 */
840 if (QUERY_FLAG (tmp, FLAG_APPLIED) && tmp->type == POTION) 838 if (tmp->flag [FLAG_APPLIED] && tmp->type == POTION)
841 continue; 839 continue;
842 840
843 glow_radius += tmp->glow_radius; 841 glow_radius += tmp->glow_radius;
844 842
845 /* For some things, we don't care what is equipped */ 843 /* For some things, we don't care what is equipped */
872 * because the skill shouldn't count against body positions being used 870 * because the skill shouldn't count against body positions being used
873 * up, etc. 871 * up, etc.
874 */ 872 */
875 if ((tmp->flag [FLAG_APPLIED] 873 if ((tmp->flag [FLAG_APPLIED]
876 && tmp->type != CONTAINER 874 && tmp->type != CONTAINER
877 && tmp->type != CLOSE_CON) 875 && tmp->type != CLOSE_CON
876 && tmp->type != SPELL)
878 || (tmp->type == SKILL && tmp->subtype == SK_PRAYING)) 877 || (tmp->type == SKILL && tmp->subtype == SK_PRAYING))
879 { 878 {
880 if (type == PLAYER) 879 if (type == PLAYER)
881 { 880 {
882 contr->item_power += tmp->item_power; 881 contr->item_power += tmp->item_power;
917 for (int i = 0; i < NROFATTACKS; i++) 916 for (int i = 0; i < NROFATTACKS; i++)
918 max_it (potion_resist[i], tmp->resist[i]); 917 max_it (potion_resist[i], tmp->resist[i]);
919 else if (tmp->type != POTION) 918 else if (tmp->type != POTION)
920 for (int i = 0; i < NROFATTACKS; i++) 919 for (int i = 0; i < NROFATTACKS; i++)
921 if (tmp->resist[i] > 0) 920 if (tmp->resist[i] > 0)
922 prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; 921 prot[i] += (100 - prot[i]) * tmp->resist[i] / 100;
923 else if (tmp->resist[i] < 0) 922 else if (tmp->resist[i] < 0)
924 vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; 923 vuln[i] += (100 - vuln[i]) * -tmp->resist[i] / 100;
925 924
926 /* There may be other things that should not adjust the attacktype */ 925 /* There may be other things that should not adjust the attacktype */
927 if (tmp->type != SYMPTOM) 926 if (tmp->type != SYMPTOM)
928 { 927 {
929 attacktype |= tmp->attacktype; 928 attacktype |= tmp->attacktype;
934 stats.luck += tmp->stats.luck; 933 stats.luck += tmp->stats.luck;
935 } 934 }
936 935
937 flag |= tmp->flag & copy_flags; 936 flag |= tmp->flag & copy_flags;
938 937
939 if (QUERY_FLAG (tmp, FLAG_UNDEAD) && !QUERY_FLAG (arch, FLAG_UNDEAD)) 938 if (tmp->flag [FLAG_UNDEAD] && !arch->flag [FLAG_UNDEAD])
940 SET_FLAG (this, FLAG_UNDEAD); 939 this->set_flag (FLAG_UNDEAD);
941 940
942 //TODO: copy_flags? 941 //TODO: copy_flags?
943 if (QUERY_FLAG (tmp, FLAG_MAKE_INVIS)) 942 if (tmp->flag [FLAG_MAKE_INVIS])
944 { 943 {
945 SET_FLAG (this, FLAG_MAKE_INVIS); 944 set_flag (FLAG_MAKE_INVIS);
946 invisible = 1; 945 invisible = 1;
947 } 946 }
948 947
949 if (tmp->stats.exp && tmp->type != SKILL) 948 if (tmp->stats.exp && tmp->type != SKILL)
950 { 949 {
977 976
978 chosen_skill = tmp; 977 chosen_skill = tmp;
979 978
980 if (tmp->stats.dam > 0) 979 if (tmp->stats.dam > 0)
981 { /* skill is a 'weapon' */ 980 { /* skill is a 'weapon' */
982 if (!QUERY_FLAG (this, FLAG_READY_WEAPON)) 981 if (!this->flag [FLAG_READY_WEAPON])
983 weapon_speed = max (0, WEAPON_SPEED (tmp)); 982 weapon_speed = max (0, WEAPON_SPEED (tmp));
984 983
985 weapon_weight = tmp->weight; 984 weapon_weight = tmp->weight;
986 stats.dam += 1 + chosen_skill->level * tmp->stats.dam / 9; 985 stats.dam += 1 + chosen_skill->level * tmp->stats.dam / 9;
987 986
1024 if (tmp->stats.ac) 1023 if (tmp->stats.ac)
1025 ac -= tmp->stats.ac + tmp->magic; 1024 ac -= tmp->stats.ac + tmp->magic;
1026 1025
1027 break; 1026 break;
1028 1027
1029 case WAND: 1028 case RANGED:
1030 case ROD:
1031 case HORN:
1032 break;
1033
1034 case BOW: 1029 case BOW:
1035 case WEAPON: 1030 case WEAPON:
1036 wc -= tmp->stats.wc + tmp->magic; 1031 wc -= tmp->stats.wc + tmp->magic;
1037 1032
1038 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) 1033 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0)
1091 1086
1092 if (tmp->stats.ac) 1087 if (tmp->stats.ac)
1093 ac -= tmp->stats.ac + tmp->magic; 1088 ac -= tmp->stats.ac + tmp->magic;
1094 1089
1095 if (ARMOUR_SPEED (tmp)) 1090 if (ARMOUR_SPEED (tmp))
1096 max_speed = min (max_speed, ARMOUR_SPEED (tmp) / 10.f); 1091 min_it (max_speed, ARMOUR_SPEED (tmp) / 10.f);
1097 1092
1098 break; 1093 break;
1099 } /* switch tmp->type */ 1094 } /* switch tmp->type */
1100 } /* item is equipped */ 1095 } /* item is equipped */
1101 } /* for loop of items */ 1096 } /* for loop of items */
1525 } 1520 }
1526 1521
1527 /* clear the flag - exp goes into this bucket, but player 1522 /* clear the flag - exp goes into this bucket, but player
1528 * still doesn't know it. 1523 * still doesn't know it.
1529 */ 1524 */
1530 CLEAR_FLAG (skill_obj, FLAG_CAN_USE_SKILL); 1525 skill_obj->clr_flag (FLAG_CAN_USE_SKILL);
1531 skill_obj->stats.exp = 0; 1526 skill_obj->stats.exp = 0;
1532 skill_obj->level = 1; 1527 skill_obj->level = 1;
1533 op->insert (skill_obj); 1528 op->insert (skill_obj);
1534 1529
1535 if (player *pl = op->contr) 1530 if (player *pl = op->contr)
1612 */ 1607 */
1613 1608
1614sint64 1609sint64
1615level_exp (int level, double expmul) 1610level_exp (int level, double expmul)
1616{ 1611{
1617 if (level > settings.max_level) 1612 return expmul * level_to_min_exp (level);
1618 return (sint64) (expmul * levels[settings.max_level]);
1619
1620 return (sint64) (expmul * levels[level]);
1621} 1613}
1622 1614
1623/* 1615/*
1624 * Ensure that the permanent experience requirements in an exp object are met. 1616 * Ensure that the permanent experience requirements in an exp object are met.
1625 * This really just checks 'op to make sure the perm_exp value is within 1617 * This really just checks 'op to make sure the perm_exp value is within
1653 * NULL, in which case exp increases the players general 1645 * NULL, in which case exp increases the players general
1654 * total, but not any particular skill. 1646 * total, but not any particular skill.
1655 * flag is what to do if the player doesn't have the skill: 1647 * flag is what to do if the player doesn't have the skill:
1656 */ 1648 */
1657static void 1649static void
1658add_player_exp (object *op, sint64 exp, const char *skill_name, int flag) 1650add_player_exp (object *op, sint64 exp, shstr_tmp skill_name, int flag)
1659{ 1651{
1660 object *skill_obj; 1652 object *skill_obj;
1661 sint64 limit, exp_to_add; 1653 sint64 limit, exp_to_add;
1662 int i;
1663 1654
1664 /* prevents some forms of abuse. */ 1655 /* prevents some forms of abuse. */
1665 if (op->contr->braced) 1656 if (op->contr->braced)
1666 exp /= 5; 1657 exp /= 5;
1667 1658
1693 { 1684 {
1694 /* Basically, you can never gain more experience in one shot 1685 /* Basically, you can never gain more experience in one shot
1695 * than half what you need to gain for next level. 1686 * than half what you need to gain for next level.
1696 */ 1687 */
1697 exp_to_add = exp; 1688 exp_to_add = exp;
1698 limit = (levels[op->level + 1] - levels[op->level]) / 2; 1689 limit = (levels [op->level + 1] - levels [op->level]) / 2;
1699 if (exp_to_add > limit) 1690 if (exp_to_add > limit)
1700 exp_to_add = limit; 1691 exp_to_add = limit;
1701 1692
1702 ADD_EXP (op->stats.exp, (sint64) ((float) exp_to_add * (skill_obj ? skill_obj->expmul : 1))); 1693 ADD_EXP (op->stats.exp, (sint64) ((float) exp_to_add * (skill_obj ? skill_obj->expmul : 1)));
1703 if (settings.permanent_exp_ratio) 1694 if (settings.permanent_exp_ratio)
1710 } 1701 }
1711 1702
1712 if (skill_obj) 1703 if (skill_obj)
1713 { 1704 {
1714 exp_to_add = exp; 1705 exp_to_add = exp;
1715 limit = (levels[skill_obj->level + 1] - levels[skill_obj->level]) / 2; 1706 limit = (levels [skill_obj->level + 1] - levels [skill_obj->level]) / 2;
1716 if (exp_to_add > limit) 1707 if (exp_to_add > limit)
1717 exp_to_add = limit; 1708 exp_to_add = limit;
1718 1709
1719 ADD_EXP (skill_obj->stats.exp, exp_to_add); 1710 ADD_EXP (skill_obj->stats.exp, exp_to_add);
1720 if (settings.permanent_exp_ratio) 1711 if (settings.permanent_exp_ratio)
1777 * where everything is at the minimum perm exp, he would lose nothing. 1768 * where everything is at the minimum perm exp, he would lose nothing.
1778 * exp is the amount of exp to subtract - thus, it should be 1769 * exp is the amount of exp to subtract - thus, it should be
1779 * a postive number. 1770 * a postive number.
1780 */ 1771 */
1781static void 1772static void
1782subtract_player_exp (object *op, sint64 exp, const char *skill, int flag) 1773subtract_player_exp (object *op, sint64 exp, shstr_tmp skill, int flag)
1783{ 1774{
1784 float fraction = (float) exp / (float) op->stats.exp; 1775 float fraction = (float) exp / (float) op->stats.exp;
1785 object *tmp; 1776 object *tmp;
1786 sint64 del_exp; 1777 sint64 del_exp;
1787 1778
1788 for (tmp = op->inv; tmp; tmp = tmp->below) 1779 for (tmp = op->inv; tmp; tmp = tmp->below)
1789 if (tmp->type == SKILL && tmp->stats.exp) 1780 if (tmp->type == SKILL && tmp->stats.exp)
1790 { 1781 {
1791 if (flag == SK_SUBTRACT_SKILL_EXP && skill && !strcmp (&tmp->skill, skill)) 1782 if (flag == SK_SUBTRACT_SKILL_EXP && skill && tmp->skill == skill)
1792 { 1783 {
1793 del_exp = check_exp_loss (tmp, exp); 1784 del_exp = check_exp_loss (tmp, exp);
1794 tmp->stats.exp -= del_exp; 1785 tmp->stats.exp -= del_exp;
1795 player_lvl_adj (op, tmp); 1786 player_lvl_adj (op, tmp);
1796 } 1787 }
1797 else if (flag != SK_SUBTRACT_SKILL_EXP) 1788 else if (flag != SK_SUBTRACT_SKILL_EXP)
1798 { 1789 {
1799 /* only want to process other skills if we are not trying 1790 /* only want to process other skills if we are not trying
1800 * to match a specific skill. 1791 * to match a specific skill.
1801 */ 1792 */
1802 del_exp = check_exp_loss (tmp, (sint64) (tmp->stats.exp * fraction)); 1793 del_exp = check_exp_loss (tmp, tmp->stats.exp * fraction);
1803 tmp->stats.exp -= del_exp; 1794 tmp->stats.exp -= del_exp;
1804 player_lvl_adj (op, tmp); 1795 player_lvl_adj (op, tmp);
1805 } 1796 }
1806 } 1797 }
1807 1798
1821 * skill_name is the skill that should get the exp added. 1812 * skill_name is the skill that should get the exp added.
1822 * flag is what to do if player doesn't have the skill. 1813 * flag is what to do if player doesn't have the skill.
1823 * these last two values are only used for players. 1814 * these last two values are only used for players.
1824 */ 1815 */
1825void 1816void
1826change_exp (object *op, sint64 exp, const char *skill_name, int flag) 1817change_exp (object *op, sint64 exp, shstr_tmp skill_name, int flag)
1827{ 1818{
1828#ifdef EXP_DEBUG 1819#ifdef EXP_DEBUG
1829 LOG (llevDebug, "change_exp() called for %s, exp = %" PRId64 "\n", query_name (op), exp); 1820 LOG (llevDebug, "change_exp() called for %s, exp = %" PRId64 "\n", query_name (op), exp);
1830#endif 1821#endif
1831 1822
1848 * worth. 1839 * worth.
1849 */ 1840 */
1850 if (op->type != PLAYER) 1841 if (op->type != PLAYER)
1851 { 1842 {
1852 /* Sanity check */ 1843 /* Sanity check */
1853 if (!QUERY_FLAG (op, FLAG_ALIVE)) 1844 if (!op->flag [FLAG_ALIVE])
1854 return; 1845 return;
1855 1846
1856 /* reset exp to max allowed value. We subtract from 1847 /* reset exp to max allowed value. We subtract from
1857 * MAX_EXPERIENCE to prevent overflows. If the player somehow has 1848 * MAX_EXPERIENCE to prevent overflows. If the player somehow has
1858 * more than max exp, just return. 1849 * more than max exp, just return.
1909 tmp->stats.exp -= loss; 1900 tmp->stats.exp -= loss;
1910 player_lvl_adj (op, tmp); 1901 player_lvl_adj (op, tmp);
1911 } 1902 }
1912 1903
1913 percentage_loss = op->stats.exp * settings.death_penalty_ratio / 100; 1904 percentage_loss = op->stats.exp * settings.death_penalty_ratio / 100;
1914 level_loss = op->stats.exp - levels[max (0, op->level - settings.death_penalty_level)]; 1905 level_loss = op->stats.exp - levels [max (0, op->level - settings.death_penalty_level)];
1915 1906
1916 if (level_loss < 0) 1907 if (level_loss < 0)
1917 level_loss = 0; 1908 level_loss = 0;
1918 1909
1919 loss = check_exp_loss (op, min (level_loss, percentage_loss)); 1910 loss = check_exp_loss (op, min (level_loss, percentage_loss));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines