1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
3 | |
3 | * |
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | |
7 | * |
8 | This program is free software; you can redistribute it and/or modify |
8 | * This program 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 2 of the License, or |
10 | * the Free Software Foundation; either version 2 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, |
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 GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | |
21 | * |
22 | The authors can be reached via e-mail to <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <living.h> |
26 | #include <living.h> |
27 | #include <spells.h> |
27 | #include <spells.h> |
28 | #include <skills.h> |
28 | #include <skills.h> |
… | |
… | |
2227 | if (meal->type != FLESH || !is_dragon_pl (op)) |
2227 | if (meal->type != FLESH || !is_dragon_pl (op)) |
2228 | return 0; |
2228 | return 0; |
2229 | |
2229 | |
2230 | /* now grab the 'dragon_skin'- and 'dragon_ability'-forces |
2230 | /* now grab the 'dragon_skin'- and 'dragon_ability'-forces |
2231 | from the player's inventory */ |
2231 | from the player's inventory */ |
|
|
2232 | shstr_cmp dragon_ability_force ("dragon_ability_force"); |
|
|
2233 | shstr_cmp dragon_skin_force ("dragon_skin_force"); |
|
|
2234 | |
2232 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
2235 | for (tmp = op->inv; tmp; tmp = tmp->below) |
2233 | { |
|
|
2234 | if (tmp->type == FORCE) |
2236 | if (tmp->type == FORCE) |
2235 | { |
|
|
2236 | if (strcmp (tmp->arch->name, "dragon_skin_force") == 0) |
2237 | if (tmp->arch->name == dragon_skin_force) |
2237 | skin = tmp; |
2238 | skin = tmp; |
2238 | else if (strcmp (tmp->arch->name, "dragon_ability_force") == 0) |
2239 | else if (tmp->arch->name == dragon_ability_force) |
2239 | abil = tmp; |
2240 | abil = tmp; |
2240 | } |
|
|
2241 | } |
|
|
2242 | |
2241 | |
2243 | /* if either skin or ability are missing, this is an old player |
2242 | /* if either skin or ability are missing, this is an old player |
2244 | which is not to be considered a dragon -> bail out */ |
2243 | which is not to be considered a dragon -> bail out */ |
2245 | if (skin == NULL || abil == NULL) |
2244 | if (skin == NULL || abil == NULL) |
2246 | return 0; |
2245 | return 0; |
… | |
… | |
2287 | /* doubled chance for resistance of ability-focus */ |
2286 | /* doubled chance for resistance of ability-focus */ |
2288 | if (i == abil->stats.exp) |
2287 | if (i == abil->stats.exp) |
2289 | chance = MIN (100., chance * 2.); |
2288 | chance = MIN (100., chance * 2.); |
2290 | |
2289 | |
2291 | /* now make the throw and save all winners (Don't insert luck bonus here!) */ |
2290 | /* now make the throw and save all winners (Don't insert luck bonus here!) */ |
2292 | if (RANDOM () % 10000 < (int) (chance * 100)) |
2291 | if (rndm (10000) < (int) (chance * 100)) |
2293 | { |
2292 | { |
2294 | atnr_winner[winners] = i; |
2293 | atnr_winner[winners] = i; |
2295 | winners++; |
2294 | winners++; |
2296 | } |
2295 | } |
2297 | |
2296 | |