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

Comparing deliantra/server/server/alchemy.C (file contents):
Revision 1.45 by root, Fri Nov 6 13:03:34 2009 UTC vs.
Revision 1.49 by root, Fri Mar 26 00:59:21 2010 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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 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.
61static int is_defined_recipe (const recipe *rp, const object *cauldron, object *caster); 61static int is_defined_recipe (const recipe *rp, const object *cauldron, object *caster);
62static recipe *find_recipe (recipelist * fl, int formula, object *ingredients); 62static recipe *find_recipe (recipelist * fl, int formula, object *ingredients);
63 63
64/** Returns a random selection from cauldron_effect[] */ 64/** Returns a random selection from cauldron_effect[] */
65static const char * 65static const char *
66cauldron_sound (void) 66cauldron_sound ()
67{ 67{
68 int size = sizeof (cauldron_effect) / sizeof (char *); 68 int size = sizeof (cauldron_effect) / sizeof (char *);
69 69
70 return cauldron_effect[rndm (0, size - 1)]; 70 return cauldron_effect[rndm (0, size - 1)];
71} 71}
389 if (rndm (0, 2)) 389 if (rndm (0, 2))
390 { /* slag created */ 390 { /* slag created */
391 object *tmp = cauldron->inv; 391 object *tmp = cauldron->inv;
392 int weight = 0; 392 int weight = 0;
393 393
394 tmp = get_archetype ("rock"); 394 tmp = get_archetype (shstr_rock);
395 tmp->weight = weight; 395 tmp->weight = weight;
396 tmp->value = 0; 396 tmp->value = 0;
397 tmp->materialname = "stone"; 397 tmp->material = name_to_material (shstr_stone);
398 tmp->name = "slag"; 398 tmp->name = shstr_slag;
399 tmp->name_pl = "slags"; 399 tmp->name_pl = shstr_slags;
400 item = insert_ob_in_ob (tmp, cauldron); 400 item = insert_ob_in_ob (tmp, cauldron);
401 CLEAR_FLAG (tmp, FLAG_CAN_ROLL); 401 CLEAR_FLAG (tmp, FLAG_CAN_ROLL);
402 SET_FLAG (tmp, FLAG_NO_DROP); 402 SET_FLAG (tmp, FLAG_NO_DROP);
403 tmp->move_block = 0; 403 tmp->move_block = 0;
404 } 404 }
445 int numb = numb_ob_inside (cauldron); 445 int numb = numb_ob_inside (cauldron);
446 446
447 fl = get_formulalist (numb - 1); /* take a lower recipe list */ 447 fl = get_formulalist (numb - 1); /* take a lower recipe list */
448 if (fl && (rp = get_random_recipe (fl))) 448 if (fl && (rp = get_random_recipe (fl)))
449 /* even though random, don't grant user any EXP for it */ 449 /* even though random, don't grant user any EXP for it */
450 (void) attempt_recipe (op, cauldron, 1, rp, -1); 450 attempt_recipe (op, cauldron, 1, rp, -1);
451 else 451 else
452 alchemy_failure_effect (op, cauldron, rp, level - 1); 452 alchemy_failure_effect (op, cauldron, rp, level - 1);
453 } 453 }
454 else if (level < 45) 454 else if (level < 45)
455 { /* INFURIATE NPC's */ 455 { /* INFURIATE NPC's */
466 466
467 remove_contents (cauldron->inv, NULL); 467 remove_contents (cauldron->inv, NULL);
468 switch (rndm (0, 2)) 468 switch (rndm (0, 2))
469 { 469 {
470 case 0: 470 case 0:
471 tmp = get_archetype ("bomb"); 471 tmp = get_archetype (shstr_bomb);
472 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW); 472 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW);
473 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW); 473 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW);
474 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s creates a bomb!", &cauldron->name); 474 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s creates a bomb!", &cauldron->name);
475 break; 475 break;
476 476
477 default: 477 default:
478 tmp = get_archetype ("fireball"); 478 tmp = get_archetype (shstr_fireball);
479 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW) / 5 + 1; 479 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW) / 5 + 1;
480 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW) / 10 + 2; 480 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW) / 10 + 2;
481 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s erupts in flame!", &cauldron->name); 481 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s erupts in flame!", &cauldron->name);
482 break; 482 break;
483 } 483 }
883 uint64 value_ingredients; 883 uint64 value_ingredients;
884 uint64 value_item; 884 uint64 value_item;
885 object *tmp; 885 object *tmp;
886 int attempt_shadow_alchemy; 886 int attempt_shadow_alchemy;
887 887
888 ave_chance = fl->total_chance / (float) fl->number; 888 ave_chance = fl->total_chance / (float)fl->number;
889 889
890 ability += (int) (skill->level * ((4.0 + cauldron->magic) / 4.0)); 890 ability += (int) (skill->level * ((4.0 + cauldron->magic) / 4.0));
891 891
892 /* determine value of ingredients */ 892 /* determine value of ingredients */
893 value_ingredients = 0; 893 value_ingredients = 0;
894 for (tmp = cauldron->inv; tmp != NULL; tmp = tmp->below) 894 for (tmp = cauldron->inv; tmp; tmp = tmp->below)
895 value_ingredients += query_cost (tmp, NULL, F_TRUE); 895 value_ingredients += query_cost (tmp, NULL, F_TRUE);
896 896
897 attempt_shadow_alchemy = !is_defined_recipe (rp, cauldron, caster); 897 attempt_shadow_alchemy = !is_defined_recipe (rp, cauldron, caster);
898 898
899 /* create the object **FIRST**, then decide whether to keep it. */ 899 /* create the object **FIRST**, then decide whether to keep it. */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines