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 |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the Affero GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * and the GNU General Public License along with this program. If not, see |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
20 | * <http://www.gnu.org/licenses/>. |
21 | * |
21 | * |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | |
26 | |
… | |
… | |
729 | * spell system split, grace points now added to system --peterm |
729 | * spell system split, grace points now added to system --peterm |
730 | */ |
730 | */ |
731 | void |
731 | void |
732 | object::update_stats () |
732 | object::update_stats () |
733 | { |
733 | { |
734 | 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; |
735 | int weapon_weight = 0, weapon_speed = 0; |
735 | int weapon_weight = 0, weapon_speed = 0; |
736 | int best_wc = 0, best_ac = 0, wc = 0, ac = 0; |
736 | int best_wc = 0, best_ac = 0, wc = 0, ac = 0; |
737 | int prot[NROFATTACKS], vuln[NROFATTACKS], potion_resist[NROFATTACKS]; |
737 | int prot[NROFATTACKS], vuln[NROFATTACKS], potion_resist[NROFATTACKS]; |
738 | object *grace_obj = NULL, *mana_obj = NULL, *tmp; |
738 | object *grace_obj = NULL, *mana_obj = NULL, *tmp; |
739 | float old_speed = speed; |
739 | float old_speed = speed; |
… | |
… | |
1086 | |
1086 | |
1087 | if (tmp->stats.ac) |
1087 | if (tmp->stats.ac) |
1088 | ac -= tmp->stats.ac + tmp->magic; |
1088 | ac -= tmp->stats.ac + tmp->magic; |
1089 | |
1089 | |
1090 | if (ARMOUR_SPEED (tmp)) |
1090 | if (ARMOUR_SPEED (tmp)) |
1091 | max_speed = min (max_speed, ARMOUR_SPEED (tmp) / 10.f); |
1091 | min_it (max_speed, ARMOUR_SPEED (tmp) / 10.f); |
1092 | |
1092 | |
1093 | break; |
1093 | break; |
1094 | } /* switch tmp->type */ |
1094 | } /* switch tmp->type */ |
1095 | } /* item is equipped */ |
1095 | } /* item is equipped */ |
1096 | } /* for loop of items */ |
1096 | } /* for loop of items */ |
… | |
… | |
1649 | static void |
1649 | static void |
1650 | add_player_exp (object *op, sint64 exp, shstr_tmp skill_name, int flag) |
1650 | add_player_exp (object *op, sint64 exp, shstr_tmp skill_name, int flag) |
1651 | { |
1651 | { |
1652 | object *skill_obj; |
1652 | object *skill_obj; |
1653 | sint64 limit, exp_to_add; |
1653 | sint64 limit, exp_to_add; |
1654 | int i; |
|
|
1655 | |
1654 | |
1656 | /* prevents some forms of abuse. */ |
1655 | /* prevents some forms of abuse. */ |
1657 | if (op->contr->braced) |
1656 | if (op->contr->braced) |
1658 | exp /= 5; |
1657 | exp /= 5; |
1659 | |
1658 | |
… | |
… | |
1901 | tmp->stats.exp -= loss; |
1900 | tmp->stats.exp -= loss; |
1902 | player_lvl_adj (op, tmp); |
1901 | player_lvl_adj (op, tmp); |
1903 | } |
1902 | } |
1904 | |
1903 | |
1905 | percentage_loss = op->stats.exp * settings.death_penalty_ratio / 100; |
1904 | percentage_loss = op->stats.exp * settings.death_penalty_ratio / 100; |
1906 | 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)]; |
1907 | |
1906 | |
1908 | if (level_loss < 0) |
1907 | if (level_loss < 0) |
1909 | level_loss = 0; |
1908 | level_loss = 0; |
1910 | |
1909 | |
1911 | loss = check_exp_loss (op, min (level_loss, percentage_loss)); |
1910 | loss = check_exp_loss (op, min (level_loss, percentage_loss)); |