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> |
… | |
… | |
1628 | |
1628 | |
1629 | |
1629 | |
1630 | case CONVERTER: |
1630 | case CONVERTER: |
1631 | if (convert_item (victim, trap) < 0) |
1631 | if (convert_item (victim, trap) < 0) |
1632 | { |
1632 | { |
1633 | object *op; |
|
|
1634 | |
|
|
1635 | new_draw_info_format (NDI_UNIQUE, 0, originator, "The %s seems to be broken!", query_name (trap)); |
1633 | new_draw_info_format (NDI_UNIQUE, 0, originator, "The %s seems to be broken!", query_name (trap)); |
1636 | |
1634 | get_archetype ("burnout")->insert_at (trap, trap); |
1637 | op = get_archetype ("burnout"); |
|
|
1638 | if (op != NULL) |
|
|
1639 | { |
|
|
1640 | op->x = trap->x; |
|
|
1641 | op->y = trap->y; |
|
|
1642 | insert_ob_in_map (op, trap->map, trap, 0); |
|
|
1643 | } |
1635 | } |
1644 | } |
1636 | |
1645 | goto leave; |
1637 | goto leave; |
1646 | |
1638 | |
1647 | case TRIGGER_BUTTON: |
1639 | case TRIGGER_BUTTON: |
1648 | case TRIGGER_PEDESTAL: |
1640 | case TRIGGER_PEDESTAL: |
1649 | case TRIGGER_ALTAR: |
1641 | case TRIGGER_ALTAR: |
… | |
… | |
2227 | if (meal->type != FLESH || !is_dragon_pl (op)) |
2219 | if (meal->type != FLESH || !is_dragon_pl (op)) |
2228 | return 0; |
2220 | return 0; |
2229 | |
2221 | |
2230 | /* now grab the 'dragon_skin'- and 'dragon_ability'-forces |
2222 | /* now grab the 'dragon_skin'- and 'dragon_ability'-forces |
2231 | from the player's inventory */ |
2223 | from the player's inventory */ |
|
|
2224 | shstr_cmp dragon_ability_force ("dragon_ability_force"); |
|
|
2225 | shstr_cmp dragon_skin_force ("dragon_skin_force"); |
|
|
2226 | |
2232 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
2227 | for (tmp = op->inv; tmp; tmp = tmp->below) |
2233 | { |
|
|
2234 | if (tmp->type == FORCE) |
2228 | if (tmp->type == FORCE) |
2235 | { |
|
|
2236 | if (strcmp (tmp->arch->name, "dragon_skin_force") == 0) |
2229 | if (tmp->arch->name == dragon_skin_force) |
2237 | skin = tmp; |
2230 | skin = tmp; |
2238 | else if (strcmp (tmp->arch->name, "dragon_ability_force") == 0) |
2231 | else if (tmp->arch->name == dragon_ability_force) |
2239 | abil = tmp; |
2232 | abil = tmp; |
2240 | } |
|
|
2241 | } |
|
|
2242 | |
2233 | |
2243 | /* if either skin or ability are missing, this is an old player |
2234 | /* if either skin or ability are missing, this is an old player |
2244 | which is not to be considered a dragon -> bail out */ |
2235 | which is not to be considered a dragon -> bail out */ |
2245 | if (skin == NULL || abil == NULL) |
2236 | if (skin == NULL || abil == NULL) |
2246 | return 0; |
2237 | return 0; |
… | |
… | |
2287 | /* doubled chance for resistance of ability-focus */ |
2278 | /* doubled chance for resistance of ability-focus */ |
2288 | if (i == abil->stats.exp) |
2279 | if (i == abil->stats.exp) |
2289 | chance = MIN (100., chance * 2.); |
2280 | chance = MIN (100., chance * 2.); |
2290 | |
2281 | |
2291 | /* now make the throw and save all winners (Don't insert luck bonus here!) */ |
2282 | /* now make the throw and save all winners (Don't insert luck bonus here!) */ |
2292 | if (RANDOM () % 10000 < (int) (chance * 100)) |
2283 | if (rndm (10000) < (int) (chance * 100)) |
2293 | { |
2284 | { |
2294 | atnr_winner[winners] = i; |
2285 | atnr_winner[winners] = i; |
2295 | winners++; |
2286 | winners++; |
2296 | } |
2287 | } |
2297 | |
2288 | |
… | |
… | |
3402 | new_draw_info (NDI_UNIQUE, 0, who, "It would consume your soul!."); |
3393 | new_draw_info (NDI_UNIQUE, 0, who, "It would consume your soul!."); |
3403 | if (tmp != NULL) |
3394 | if (tmp != NULL) |
3404 | (void) insert_ob_in_ob (tmp, who); |
3395 | (void) insert_ob_in_ob (tmp, who); |
3405 | return 1; |
3396 | return 1; |
3406 | } |
3397 | } |
|
|
3398 | |
|
|
3399 | //TODO: this obviously fails for players using a shiorter prefix |
|
|
3400 | // i.e. "R" can use Ragnarok's swors. |
3407 | if (op->level && (strncmp (op->name, who->name, strlen (who->name)))) |
3401 | if (op->level && (strncmp (op->name, who->name, strlen (who->name)))) |
3408 | { |
3402 | { |
3409 | /* if the weapon does not have the name as the character, can't use it. */ |
3403 | /* if the weapon does not have the name as the character, can't use it. */ |
3410 | /* (Ragnarok's sword attempted to be used by Foo: won't work) */ |
3404 | /* (Ragnarok's sword attempted to be used by Foo: won't work) */ |
3411 | new_draw_info (NDI_UNIQUE, 0, who, "The weapon does not recognize you as its owner."); |
3405 | new_draw_info (NDI_UNIQUE, 0, who, "The weapon does not recognize you as its owner."); |
|
|
3406 | |
3412 | if (tmp != NULL) |
3407 | if (tmp) |
3413 | (void) insert_ob_in_ob (tmp, who); |
3408 | insert_ob_in_ob (tmp, who); |
|
|
3409 | |
3414 | return 1; |
3410 | return 1; |
3415 | } |
3411 | } |
|
|
3412 | |
3416 | SET_FLAG (op, FLAG_APPLIED); |
3413 | SET_FLAG (op, FLAG_APPLIED); |
3417 | |
3414 | |
3418 | if (skop) |
3415 | if (skop) |
3419 | change_skill (who, skop, 1); |
3416 | change_skill (who, skop, 1); |
3420 | if (!QUERY_FLAG (who, FLAG_READY_WEAPON)) |
3417 | if (!QUERY_FLAG (who, FLAG_READY_WEAPON)) |
… | |
… | |
3829 | /* check for hp, sp change */ |
3826 | /* check for hp, sp change */ |
3830 | if (food->stats.hp != 0) |
3827 | if (food->stats.hp != 0) |
3831 | { |
3828 | { |
3832 | if (QUERY_FLAG (food, FLAG_CURSED)) |
3829 | if (QUERY_FLAG (food, FLAG_CURSED)) |
3833 | { |
3830 | { |
3834 | strcpy (who->contr->killer, food->name); |
3831 | assign (who->contr->killer, food->name); |
3835 | hit_player (who, food->stats.hp, food, AT_POISON, 1); |
3832 | hit_player (who, food->stats.hp, food, AT_POISON, 1); |
3836 | new_draw_info (NDI_UNIQUE, 0, who, "Eck!...that was poisonous!"); |
3833 | new_draw_info (NDI_UNIQUE, 0, who, "Eck!...that was poisonous!"); |
3837 | } |
3834 | } |
3838 | else |
3835 | else |
3839 | { |
3836 | { |