1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your 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, |
… | |
… | |
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 GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * |
20 | * |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | /* Created July 95 to separate skill utilities from actual skills -b.t. */ |
24 | /* Created July 95 to separate skill utilities from actual skills -b.t. */ |
25 | |
25 | |
26 | /* Reconfigured skills code to allow linking of skills to experience |
26 | /* Reconfigured skills code to allow linking of skills to experience |
… | |
… | |
291 | new_draw_info (NDI_UNIQUE, 0, op, "You come to earth."); |
291 | new_draw_info (NDI_UNIQUE, 0, op, "You come to earth."); |
292 | } |
292 | } |
293 | else |
293 | else |
294 | { |
294 | { |
295 | SET_FLAG (skill, FLAG_APPLIED); |
295 | SET_FLAG (skill, FLAG_APPLIED); |
296 | new_draw_info (NDI_UNIQUE, 0, op, "You rise into the air!."); |
296 | new_draw_info (NDI_UNIQUE, 0, op, "You rise into the air!"); |
297 | } |
297 | } |
298 | |
298 | |
299 | op->update_stats (); |
299 | op->update_stats (); |
300 | success = 1; |
300 | success = 1; |
301 | break; |
301 | break; |
… | |
… | |
510 | * If an object is not alive and magical we set the base exp higher to |
510 | * If an object is not alive and magical we set the base exp higher to |
511 | * help out exp awards for skill_ident skills. Also, if |
511 | * help out exp awards for skill_ident skills. Also, if |
512 | * an item is type RUNE, we give out exp based on stats.Cha |
512 | * an item is type RUNE, we give out exp based on stats.Cha |
513 | * and level (this was the old system) -b.t. |
513 | * and level (this was the old system) -b.t. |
514 | */ |
514 | */ |
515 | |
|
|
516 | if (!op) |
515 | if (!op) |
517 | { /* no item/creature */ |
516 | { /* no item/creature */ |
518 | op_lvl = who->map->difficulty < 1 ? 1 : who->map->difficulty; |
517 | op_lvl = max (1, who->map->difficulty); |
519 | op_exp = 0; |
518 | op_exp = 0; |
520 | } |
519 | } |
521 | else if (op->type == RUNE || op->type == TRAP) |
520 | else if (op->type == RUNE || op->type == TRAP) |
522 | { /* all traps. If stats.Cha > 1 we use that |
521 | { /* all traps. If stats.Cha > 1 we use that |
523 | * for the amount of experience */ |
522 | * for the amount of experience */ |
… | |
… | |
527 | else |
526 | else |
528 | { /* all other items/living creatures */ |
527 | { /* all other items/living creatures */ |
529 | op_exp = op->stats.exp; |
528 | op_exp = op->stats.exp; |
530 | op_lvl = op->level; |
529 | op_lvl = op->level; |
531 | if (!QUERY_FLAG (op, FLAG_ALIVE)) |
530 | if (!QUERY_FLAG (op, FLAG_ALIVE)) |
532 | { /* for ident/make items */ |
531 | op_lvl += 5 * abs (op->magic); /* for ident/make items */ |
533 | op_lvl += 5 * abs (op->magic); |
|
|
534 | } |
|
|
535 | } |
532 | } |
536 | |
533 | |
537 | if (op_lvl < 1) |
534 | if (op_lvl < 1) |
538 | op_lvl = 1; |
535 | op_lvl = 1; |
539 | |
536 | |
… | |
… | |
566 | } |
563 | } |
567 | } |
564 | } |
568 | else |
565 | else |
569 | { |
566 | { |
570 | /* Don't divide by zero here! */ |
567 | /* Don't divide by zero here! */ |
571 | lvl_mult = (float) op_lvl / (float) (skill->level ? skill->level : 1); |
568 | lvl_mult = (float) op_lvl / (float) max (1, skill->level); |
572 | } |
569 | } |
573 | } |
570 | } |
574 | |
571 | |
575 | /* assemble the exp total, and return value */ |
572 | /* assemble the exp total, and return value */ |
576 | |
573 | |