19 #define _GNU_SOURCE // strcasestr() is a GNU extension in string.h 49 tmp->level = op->level;
51 tmp->duration += lvl/5;
58 if (tmp->duration >= 40)
61 tmp->stats.maxhp = tmp->count;
62 if (tmp->stats.maxhp == 0)
81 int recharge(
object *op,
object *caster,
object *spell_ob) {
87 if (wand == NULL || wand->type != WAND) {
89 "You need to mark the wand you want to recharge.");
95 "The %s vibrates violently, then explodes!",
104 tmp->stats.hp = tmp->stats.dam/2;
105 if (tmp->stats.hp < 2)
112 if (wand->inv && wand->inv->level)
113 ncharges /= wand->inv->level;
117 "Your %s is broken.",
124 wand->stats.food += ncharges;
127 "The %s glows with power.",
132 wand->speed = wand->arch->clone.speed;
161 int x = op->x, y = op->y, numat = 0, choice, friendly;
170 if (op->level >= level*2
190 choice =
rndm(0, numat-1);
206 if (tmp->type == SPELL) {
258 "The %s glow red, melt and evaporate!",
262 "The %s glows red, melts and evaporates!",
281 int max_value, difficulty, tries = 0, choice, charges = op->stats.food, numat = 0;
287 max_value = op->value*2;
288 if (max_value > 2000*(level/10))
289 max_value = 2000*(level/10)+(max_value-2000*(level/10))/3;
296 if (at->clone.type == op->type
297 && !at->clone.invisible
298 && at->clone.value > 0
299 && at->clone.value < max_value
308 difficulty = op->magic*5;
313 choice =
rndm(0, numat-1);
315 if (at->clone.type == op->type
316 && !at->clone.invisible
317 && at->clone.value > 0
318 && at->clone.value < max_value
331 }
while (new_ob->value > max_value && tries < 10);
332 if (new_ob->invisible) {
333 LOG(
llevError,
"polymorph_item: fix_generated_object made %s invisible?!\n", new_ob->name);
345 if (op->nrof && new_ob->nrof) {
346 new_ob->nrof = op->nrof;
348 if (new_ob->nrof > 2)
349 new_ob->nrof -=
rndm(0, op->nrof/2-1);
355 if (charges && op->type != RING && op->type != FOOD)
356 op->stats.food = charges;
410 || op->type == TREASURE)
436 int range, mflags, maxrange,
level;
444 for (range = 1; range < maxrange; range++) {
458 for (tmp =
GET_MAP_OB(m, x, y); tmp != NULL && tmp->above != NULL; tmp = tmp->above)
469 image->stats.food = 5;
470 image->speed_left = 0.1;
503 int missile_plus = 0, bonus_plus = 0;
504 const char *missile_name;
505 object *tmp, *missile;
509 missile_name = tmp != NULL ? tmp->race :
"arrow";
513 if (!strcmp(missile_name,
"arrows"))
514 missile_name =
"arrow";
515 else if (!strcmp(missile_name,
"crossbow bolts"))
516 missile_name =
"bolt";
519 if ( stringarg && strncmp(stringarg,
"of ",3)==0 ) stringarg +=3;
520 if ( stringarg && strncmp(stringarg,
"bolt",4)==0 ) {
521 missile_name =
"bolt";
523 while ( isalpha(*stringarg) ) ++stringarg;
524 while ( *stringarg==
' ' ) ++stringarg;
526 if ( stringarg && strncmp(stringarg,
"arrow",5)==0 ) {
527 missile_name =
"arrow";
529 while ( isalpha(*stringarg) ) ++stringarg;
530 while ( *stringarg==
' ' ) ++stringarg;
534 LOG(
llevDebug,
"Cast create_missile: could not find archetype %s\n", missile_name);
539 if ( stringarg && strncmp(stringarg,
"of ",3)==0 ) stringarg +=3;
542 if (isalpha(*stringarg)) {
545 for (; al != NULL; al = al->
next)
550 object_free(missile, FREE_OBJ_NO_DESTROY_CALLBACK);
552 "No such object %ss of %s",
553 missile_name, stringarg);
556 if (al->
item->slaying) {
557 object_free(missile, FREE_OBJ_NO_DESTROY_CALLBACK);
559 "You are not allowed to create %ss of %s",
560 missile_name, stringarg);
568 bonus_plus = 1+(al->
item->value/5);
570 }
else if (atoi(stringarg) < missile_plus)
571 missile_plus = atoi(stringarg);
573 if (missile_plus > 4)
575 else if (missile_plus < -4)
579 if (missile->nrof <= (
uint32_t)3 * (missile_plus + bonus_plus)) {
580 object_free(missile, FREE_OBJ_NO_DESTROY_CALLBACK);
582 "This item is too powerful for you to create!");
585 missile->nrof -= 3*(missile_plus+bonus_plus);
586 if (missile->nrof < 1)
589 missile->magic = missile_plus;
594 tag = missile->count;
597 && op->type == PLAYER
598 && !object_was_destroyed(missile, tag)) {
608 if (arch->clone.type == FOOD || arch->clone.type == DRINK) {
639 int cast_create_food(
object *op,
object *caster,
object *spell_ob,
int dir,
const char *stringarg) {
641 archetype *at = NULL;
650 if (at == NULL || at->clone.stats.food > food_value)
672 "You don't have enough experience to create any food.");
676 food_value /= at->clone.stats.food;
679 new_op->nrof = food_value;
682 if (new_op->nrof < 1)
707 int probe(
object *op,
object *caster,
object *spell_ob,
int dir,
int level) {
708 int r, mflags, maxrange;
716 for (r = 1; r < maxrange; r++) {
727 "Something blocks your magic.");
732 if (CAN_PROBE(tmp)) {
734 "You detect something.");
742 "You detect nothing.");
767 if (pl->type == PLAYER) {
769 if (!pl->contr->invis_race) {
775 if (!strcmp(pl->contr->invis_race,
"undead") &&
is_true_undead(mon))
780 if (strstr(mon->race, pl->contr->invis_race))
814 if (op->invisible > 1000) {
816 "You can not extend the duration of your invisibility any further");
825 if (op->invisible > 1000)
826 op->invisible = 1000;
828 if (op->type == PLAYER) {
829 if (op->contr->invis_race)
834 op->contr->tmp_invis = 0;
836 op->contr->tmp_invis = 1;
838 op->contr->hidden = 0;
842 "You can't see your hands!");
845 "You feel more transparent!");
853 if (tmp->enemy == op)
873 int range, i, j, mflags;
877 if (op->type != PLAYER)
882 for (i = -range; i < range; i++)
883 for (j = -range; j < range; j++) {
927 if (op->type != PLAYER)
932 "You feel a force starting to build up inside you.");
939 "Oops, program error!");
940 LOG(
llevError,
"cast_word_of_recall: create_archetype(force) failed!\n");
951 dummy->speed = 0.002;
953 dummy->speed_left = -dummy->speed*time;
954 dummy->type = SPELL_EFFECT;
961 EXIT_X(dummy) = op->contr->bed_x;
962 EXIT_Y(dummy) = op->contr->bed_y;
966 "You feel a force starting to build up inside you.");
985 int cast_wonder(
object *op,
object *caster,
int dir,
object *spell_ob) {
989 return cast_cone(op, caster, dir, spell_ob);
991 if (spell_ob->randomitems) {
994 LOG(
llevError,
"cast_wonder: Unable to get a spell!\n");
997 if (newspell->type != SPELL) {
998 LOG(
llevError,
"cast_wonder: spell returned is not a spell (%d, %s)!\n", newspell->type, newspell->name);
1003 LOG(
llevError,
"cast_wonder: spell returned is another wonder spell!\n");
1006 return cast_spell(op, caster, dir, newspell, NULL);
1037 "You worship no god");
1043 if (*cp ==
'\0' && tmp == NULL)
1045 "You feel very mundane");
1055 "Your %s is depleted by %d",
1063 if (op->glow_radius > 0)
1065 "You glow in the dark.");
1068 for (tmp = op->inv; tmp; tmp = tmp->below) {
1069 if (tmp->type == SIGN) {
1070 if (immunity == NULL) {
1077 if (tmp->level > 100)
1079 else if (tmp->level > 70)
1081 else if (tmp->level > 20)
1086 if (immunity != NULL) {
1099 if (tmp->stats.exp == 0) {
1100 snprintf(buf,
sizeof(buf),
"Your metabolism isn't focused on anything.");
1109 if (levels == NULL) {
1117 if (levels != NULL) {
1128 object *dummy, *force;
1134 if (dummy == NULL) {
1136 "Oops, program error!");
1137 LOG(
llevError,
"object_new failed (force in cast_create_town_portal for %s!\n", op->name);
1142 if (force == NULL) {
1152 dummy->weapontype = op->map->last_reset_time;
1155 "You fix this place in your mind and feel that you " 1156 "can come here from anywhere.");
1169 if (dummy == NULL) {
1171 "Oops, program error!");
1172 LOG(
llevError,
"object_new failed (force) in cast_create_town_portal for %s!\n", op->name);
1175 archetype *perm_portal;
1177 if (perm_portal == NULL) {
1179 "Oops, program error!");
1193 LOG(
llevDebug,
"Trying to kill a portal in %s (%d,%d)\n", old_force->race, exitx, exity);
1204 if (tmp->name == old_force->name) {
1216 if (tmp->name == old_force->name) {
1261 object *dummy, *force, *tmp;
1262 char portal_name [1024], portal_message [1024];
1273 "You can't cast that here.");
1279 if (op->contr && op->contr->transport) {
1281 "You need to exit the transport to cast that.");
1286 if (force == NULL) {
1326 if (exitmap == NULL) {
1328 "Something strange happens. You can't remember where to go!?");
1335 "The spell effect has expired.");
1344 snprintf(portal_message, 1024,
"The air moves around you and a huge smell of ammonia surrounds you as you pass through %s's tiny portal. Pouah!", op->name);
1345 else if (op_level < 30)
1346 snprintf(portal_message, 1024,
"%s's portal smells of ozone. You do a lot of movements and finally pass through the small hole in the air.", op->name);
1347 else if (op_level < 60)
1348 snprintf(portal_message, 1024,
"A shining door opens in the air in front of you, showing you the path to another place.");
1350 snprintf(portal_message, 1024,
"As you walk through %s's portal, flowers come out from the ground around you. You feel awed.", op->name);
1357 snprintf(portal_name, 1024,
"%s's portal to %s", op->name, force->name);
1359 if (dummy == NULL) {
1361 "Oops, program error!");
1362 LOG(
llevError,
"object_new failed (perm_magic_portal) in cast_create_town_portal for %s!\n", op->name);
1390 "Oops, program error!");
1391 LOG(
llevError,
"object_new failed (force) in cast_create_town_portal for %s!\n", op->name);
1406 snprintf(portal_name, 1024,
"%s's portal to %s", op->name, op->map->path);
1408 if (dummy == NULL) {
1410 "Oops, program error!");
1411 LOG(
llevError,
"object_new failed (perm_magic_portal) in cast_create_town_portal for %s!\n", op->name);
1438 "Oops, program error!");
1439 LOG(
llevError,
"object_new failed (force) in cast_create_town_portal for %s!\n", op->name);
1451 "You see air moving and showing you the way home.");
1475 int magic_wall(
object *op,
object *caster,
int dir,
object *spell_ob) {
1477 int i, posblocked, negblocked, maxrange;
1493 if ((spell_ob->move_block || x != op->x || y != op->y)
1497 "Something is in the way.");
1500 if (spell_ob->other_arch) {
1502 }
else if (spell_ob->race) {
1505 snprintf(buf1,
sizeof(buf1), spell_ob->race, dir);
1508 LOG(
llevError,
"summon_wall: Unable to find archetype %s\n", buf1);
1510 "This spell is broken.");
1515 LOG(
llevError,
"magic_wall: spell %s lacks other_arch\n", spell_ob->name);
1519 if (tmp->type == SPELL_EFFECT) {
1520 tmp->attacktype = spell_ob->attacktype;
1526 tmp->stats.maxhp = tmp->stats.hp;
1536 tmp->stats.maxhp = tmp->stats.hp;
1551 "Something destroys your %s",
1556 if (tmp->other_arch && tmp->other_arch->clone.type == SPELL)
1569 for (i = 1; i <= maxrange; i++) {
1572 dir2 = (dir < 4) ? (dir+2) : dir-2;
1585 if (tmp2->other_arch && tmp2->other_arch->clone.type == SPELL)
1590 x = tmp->x-i*freearr_x[dir2];
1591 y = tmp->y-i*freearr_y[dir2];
1600 if (tmp2->other_arch && tmp2->other_arch->clone.type == SPELL)
1634 if (op->type != PLAYER)
1639 "In what direction?");
1648 if (op->contr->count) {
1649 if (op->contr->count > maxdist) {
1651 "You can't dimension door that far!");
1655 for (dist = 0; dist < op->contr->count; dist++) {
1669 if (dist < op->contr->count) {
1671 "Something blocks the magic of the spell.");
1672 op->contr->count = 0;
1675 op->contr->count = 0;
1689 "You cast your spell, but nothing happens.");
1698 for (dist = 0; dist < maxdist; dist++) {
1715 for (; dist > 0; dist--) {
1724 "Your spell failed!");
1729 if (op->contr->transport && op->contr->transport->type == TRANSPORT) {
1730 ob_apply(op->contr->transport, op, 0);
1731 if (op->contr->transport) {
1733 "Your spell failed!");
1743 if (op->type == PLAYER) {
1747 op->speed_left = -
FABS(op->speed)*5;
1764 int cast_heal(
object *op,
object *caster,
object *spell,
int dir) {
1768 int heal = 0, success = 0;
1778 heal = spell->stats.dam;
1779 if (spell->stats.hp)
1783 if (target->stats.hp >= target->stats.maxhp) {
1785 "You are already fully healed.");
1791 if (heal > (target->stats.maxhp-target->stats.hp))
1792 heal = target->stats.maxhp-target->stats.hp;
1793 target->stats.hp += heal;
1795 if (target->stats.hp >= target->stats.maxhp) {
1797 "You feel just fine!");
1798 }
else if (heal > 50) {
1800 "Your wounds close!");
1801 }
else if (heal > 25) {
1803 "Your wounds mostly close.");
1804 }
else if (heal > 10) {
1806 "Your wounds start to fade.");
1809 "Your wounds start to close.");
1815 if (
cure_disease(target, op, caster && caster->type != PLAYER ? caster->skill : spell->skill))
1825 "Your body feels cleansed");
1826 poison->stats.food = 1;
1835 "Your mind feels clearer");
1836 poison->duration = 1;
1846 "Your vision begins to return.");
1847 poison->stats.food = 1;
1851 if (spell->last_sp && target->stats.sp < target->stats.maxsp) {
1852 target->stats.sp += spell->last_sp;
1853 if (target->stats.sp > target->stats.maxsp)
1854 target->stats.sp = target->stats.maxsp;
1857 "Magical energies surge through your body!");
1859 if (spell->last_grace && target->stats.grace < target->stats.maxgrace) {
1860 target->stats.grace += spell->last_grace;
1861 if (target->stats.grace > target->stats.maxgrace)
1862 target->stats.grace = target->stats.maxgrace;
1865 "You feel redeemed with you god!");
1867 if (spell->stats.food && target->stats.food <
MAX_FOOD) {
1868 target->stats.food += spell->stats.food;
1874 "You feel your belly fill with food");
1877 if (spell->other_arch != NULL && target->map != NULL) {
1891 "You grow no stronger.",
1892 "You grow no more agile.",
1893 "You don't feel any healthier.",
1895 "You are no easier to look at.",
1921 object *force = NULL;
1937 if (tmp2->name == spell_ob->name) {
1940 }
else if (spell_ob->race && spell_ob->race == tmp2->name) {
1943 "You can not cast %s while %s is in effect",
1944 spell_ob->name, tmp2->name_pl);
1949 if (force == NULL) {
1963 if (duration > force->duration) {
1964 force->duration = duration;
1966 "You recast the spell while in effect.");
1968 if (spell_ob->other_arch != NULL && tmp->map != NULL) {
1974 "Recasting the spell had no effect.");
1979 if (op->type == PLAYER)
1982 force->speed_left = -1.0;
1987 if (spell_ob->resist[i]) {
1989 if (force->resist[i] > 100)
1990 force->resist[i] = 100;
1993 if (spell_ob->stats.hp)
1996 if (tmp->type == PLAYER) {
2003 for (k = 0; k < stat; k++)
2019 force->move_type = spell_ob->move_type;
2028 if (spell_ob->stats.exp) {
2029 if (op->speed > 0.5)
2030 force->stats.exp = (float)spell_ob->stats.exp/(op->speed+0.5);
2032 force->stats.exp = spell_ob->stats.exp;
2035 force->stats.wc = spell_ob->stats.wc;
2036 force->stats.ac = spell_ob->stats.ac;
2037 force->attacktype = spell_ob->attacktype;
2044 if (spell_ob->other_arch != NULL && tmp->map != NULL) {
2067 int cast_bless(
object *op,
object *caster,
object *spell_ob,
int dir) {
2070 object *force = NULL, *tmp;
2082 if (tmp2->name == spell_ob->name) {
2085 }
else if (spell_ob->race && spell_ob->race == tmp2->name) {
2087 "You can not cast %s while %s is in effect",
2088 spell_ob->name, tmp2->name_pl);
2093 if (force == NULL) {
2107 if (duration > force->duration) {
2108 force->duration = duration;
2110 "You recast the spell while in effect.");
2113 "Recasting the spell had no effect.");
2119 force->speed_left = -1.0;
2123 "Your blessing seems empty.");
2128 if (god->resist[i] > 0) {
2129 force->resist[i] =
MIN(god->resist[i], resist_max);
2135 force->path_attuned |= god->path_attuned;
2136 if (spell_ob->attacktype) {
2150 "You are blessed by %s!",
2154 force->stats.wc = spell_ob->stats.wc;
2155 force->stats.ac = spell_ob->stats.ac;
2162 if (spell_ob->other_arch != NULL && tmp->map != NULL) {
2192 #define SMALL_NUGGET "smallnugget" 2193 #define LARGE_NUGGET "largenugget" 2209 static void alchemy_object(
float value_adj,
object *obj,
int *small_nuggets,
int *large_nuggets,
int *weight) {
2222 if (small_nugget_arch == NULL) {
2225 small_value =
price_base(&small_nugget_arch->clone);
2227 if (large_nugget_arch == NULL) {
2230 large_value =
price_base(&large_nugget_arch->clone);
2236 if (value && (obj->type == MONEY || obj->type == GEM))
2239 if ((obj->value > 0) &&
rndm(0, 29)) {
2242 assert(large_value != 0 && small_value != 0);
2243 count = value/large_value;
2244 *large_nuggets += count;
2245 value -= (
uint64_t)count*large_value;
2246 count = value/small_value;
2247 *small_nuggets += count;
2254 if (*small_nuggets*small_value >= large_value) {
2255 assert(small_value != 0);
2257 *small_nuggets -= large_value/small_value;
2258 if (*small_nuggets && large_value%small_value)
2262 if (weight != NULL) {
2263 *weight += obj->weight;
2290 if (x == op->x && y == op->y && op->map == m)
2291 flag = INS_BELOW_ORIGINATOR;
2293 if (small_nuggets) {
2295 tmp-> nrof = small_nuggets;
2298 if (large_nuggets) {
2300 tmp-> nrof = large_nuggets;
2319 int alchemy(
object *op,
object *caster,
object *spell_ob) {
2320 int x, y, weight = 0, weight_max, large_nuggets, small_nuggets, mflags;
2325 if (op->type != PLAYER)
2341 if (value_adj > 0.40)
2344 for (y = op->y-1; y <= op->y+1; y++) {
2345 for (x = op->x-1; x <= op->x+1; x++) {
2375 alchemy_object(value_adj, tmp1, &small_nuggets, &large_nuggets, &weight);
2378 alchemy_object(value_adj, tmp, &small_nuggets, &large_nuggets, &weight);
2380 if (weight > weight_max) {
2398 op->contr->socket.look_position = 0;
2418 int success = 0, was_one = 0;
2433 if (op->type == PLAYER)
2439 if (op->type == PLAYER) {
2442 "You feel like some of your items are looser now.");
2446 "You failed to remove the curse.");
2449 "You are not using any cursed items.");
2473 "You need to mark an item first!");
2480 "The spell has no effect");
2487 "Your %s emits a dark light for a few seconds.", name);
2496 "Your %s glows blue for a few seconds.", name);
2519 int success = 0, num_ident;
2530 if (op->type == PLAYER) {
2536 "The item has a story:\n%s",
2554 if (op->type == PLAYER) {
2556 "On the ground is %s.",
2560 "The item has a story:\n%s",
2574 "You can't reach anything unidentified.");
2594 object *tmp, *last, *detect;
2596 int done_one, range, mflags, floor,
level;
2607 for (x = op->x-range; x <= op->x+range; x++)
2608 for (y = op->y-range; y <= op->y+range; y++) {
2640 tmp->type == CF_HANDLE ||
2641 tmp->type == TRAPDOOR || tmp->type == EXIT || tmp->type == HOLE ||
2642 tmp->type == BUTTON || tmp->type == TELEPORTER ||
2643 tmp->type == GATE || tmp->type == LOCKED_DOOR ||
2644 tmp->type == WEAPON || tmp->type == ALTAR || tmp->type == SIGN ||
2645 tmp->type == TRIGGER_PEDESTAL || tmp->type == SPECIAL_KEY ||
2646 tmp->type == TREASURE || tmp->type == BOOK ||
2647 tmp->type == HOLY_ALTAR))) {
2678 if (tmp->type == RUNE && tmp->attacktype&
AT_MAGIC)
2679 tmp->stats.Cha /= 4;
2696 && ((!strcmp(spell->race,
"GOD") && god && god->slaying && strstr(god->slaying, tmp->race)) || (strstr(spell->race, tmp->race)))) {
2714 int dx = nx, dy = ny;
2717 if (done_one == 2 && detect) {
2727 dx = HEAD(detect)->x;
2728 dy = HEAD(detect)->y;
2731 for (part = detect_ob; part != NULL; part = part->more) {
2732 if (part->arch->reference_count > 0)
2733 part->arch->reference_count++;
2734 part->last_anim = 0;
2735 part->type = spell->other_arch->clone.type;
2736 for (flag = 0; flag < 4; flag++) {
2737 part->flags[flag] = spell->other_arch->clone.flags[flag];
2739 part->stats.food = spell->other_arch->clone.stats.food;
2740 part->last_anim = 0;
2741 part->speed = spell->other_arch->clone.speed;
2742 part->speed_left = spell->other_arch->clone.speed_left;
2743 part->move_allow = spell->other_arch->clone.move_allow;
2744 part->move_block = spell->other_arch->clone.move_block;
2745 part->move_type = spell->other_arch->clone.move_type;
2746 part->glow_radius = spell->other_arch->clone.glow_radius;
2747 part->invisible = spell->other_arch->clone.invisible;
2748 part->weight = spell->other_arch->clone.weight;
2749 part->map_layer = spell->other_arch->clone.map_layer;
2774 if (op->type == PLAYER)
2781 if (op->type == PLAYER)
2801 if (victim->stats.maxsp <= 0)
2805 "You feel energy course through you.");
2807 if (victim->stats.sp >= victim->stats.maxsp*2) {
2811 "Your head explodes!");
2818 victim->stats.sp = 2*victim->stats.maxsp;
2819 }
else if (victim->stats.sp >= victim->stats.maxsp*1.88) {
2821 "You feel like your head is going to explode.");
2822 }
else if (victim->stats.sp >= victim->stats.maxsp*1.66) {
2824 "You get a splitting headache!");
2825 }
else if (victim->stats.sp >= victim->stats.maxsp*1.5) {
2827 "Chaos fills your world.");
2829 }
else if (victim->stats.sp >= victim->stats.maxsp*1.25) {
2831 "You start hearing voices.");
2853 object *plyr = NULL;
2883 "There is no one there.");
2888 if (spell->stats.dam > 0) {
2893 }
else if (op != plyr) {
2901 sucked = (plyr->stats.sp*rate)/100;
2902 plyr->stats.sp -= sucked;
2905 sucked = (sucked*rate)/100;
2906 op->stats.sp += sucked;
2960 && (op->level > head->level)) {
2963 }
else switch (head->type) {
2965 if ((op->level > head->level) && !op->stats.food && !op->speed_left) {
2975 if (
rndm(0, 149) == 0) {
2977 if (!head->stats.hp) {
3007 "You can't consecrate anything if you don't worship a god!");
3014 if (tmp->type == HOLY_ALTAR) {
3017 "You are not powerful enough to reconsecrate the %s",
3024 archetype *altar_arch;
3027 letter = strlen(buf);
3028 strncpy(buf+letter, god->name,
MAX_BUF-letter);
3029 for (; letter < strlen(buf); letter++)
3030 buf[letter] =
tolower(buf[letter]);
3034 "You fail to consecrate the altar.");
3035 LOG(
llevError,
"cast_consecrate: can't find altar %s for god %s\n", buf, god->name);
3039 new_altar->level = tmp->level;
3045 "You consecrated the altar to %s!",
3052 "You are not standing over an altar!");
3080 object *weapon, *tmp;
3087 if (!spell->other_arch) {
3089 "Oops, program error!");
3090 LOG(
llevError,
"animate_weapon failed: spell %s missing other_arch!\n", spell->name);
3095 if (op->type != PLAYER)
3099 if (op->contr->ranges[
range_golem] != NULL && op->contr->golem_count == op->contr->ranges[
range_golem]->count) {
3109 "There is something in the way.");
3121 || ((spell->other_arch->clone.move_type&
GET_MAP_MOVE_BLOCK(m, x, y)) == spell->other_arch->clone.move_type)) {
3123 "There is something in the way.");
3132 "You must mark a weapon to use with this spell!");
3135 if (spell->race && strcmp(weapon->arch->name, spell->race)) {
3137 "The spell fails to transform your weapon.");
3140 if (weapon->type != WEAPON) {
3142 "You need to mark a weapon to animate it.");
3147 "You need to pay for the weapon to animate it.");
3155 "You need to unequip %s before using it in this spell",
3160 if (weapon->nrof > 1) {
3179 op->contr->golem_count = tmp->count;
3203 tmp->stats.wc = tmp->stats.wc
3205 -5*weapon->stats.Dex
3206 -2*weapon->stats.Str
3208 if (tmp->stats.wc < -127)
3209 tmp->stats.wc = -127;
3212 tmp->stats.maxhp = tmp->stats.maxhp
3216 +12*weapon->stats.Con;
3217 if (tmp->stats.maxhp < 0)
3218 tmp->stats.maxhp = 10;
3219 tmp->stats.hp = tmp->stats.maxhp;
3222 tmp->stats.dam = spell->stats.dam
3226 +5*weapon->stats.Str;
3227 if (tmp->stats.dam < 0)
3228 tmp->stats.dam = 127;
3231 if (!tmp->attacktype)
3235 if (op->materialname != NULL)
3239 tmp->resist[i] = 50-(mt->
save[i]*5);
3266 if (tmp->speed > 3.33)
3270 snprintf(buf,
sizeof(buf),
"animated %s", weapon->name);
3275 tmp->face = weapon->face;
3276 tmp->animation = weapon->animation;
3277 tmp->anim_speed = weapon->anim_speed;
3278 tmp->last_anim = weapon->last_anim;
3279 tmp->state = weapon->state;
3289 tmp->stats.exp *= 1+(
MAX(spell->stats.maxgrace, spell->stats.sp)/
caster_level(caster, spell));
3291 tmp->speed_left = -1;
3292 tmp->direction = dir;
3319 if (spell->stats.dam < 0)
3321 "It can be no brighter here.");
3324 "It can be no darker here.");
3354 if (op->type == PLAYER)
3361 new_aura->attacktype = spell->attacktype;
3375 if (spell->resist[i]) {
3389 force->duration = new_aura->duration;
3390 force->speed = new_aura->speed;
3391 memcpy(&force->resist, spell->resist,
sizeof(spell->resist));
3404 "You recast the spell while in effect.");
3429 if (!msg || msg[0] == 0) {
3437 "Trying to cheat are we?");
3438 LOG(
llevInfo,
"write_rune: player %s tried to write bogus rune %s\n", op->name, msg);
3442 if (!spell->other_arch)
static object * town_portal_find_force(object *op, object *spell)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
#define FLAG_KNOWN_BLESSED
void set_attr_value(living *stats, int attr, int8_t value)
void cast_magic_storm(object *op, object *tmp, int lvl)
int apply_manual(object *op, object *tmp, int aflag)
const char * determine_god(object *op)
uint8_t create_home_portals
#define FORCE_CHANGE_ABILITY
int cast_bless(object *op, object *caster, object *spell_ob, int dir)
void object_free(object *ob, int flags)
materialtype_t * name_to_material(const char *name)
int is_magical(const object *op)
int cast_detection(object *op, object *caster, object *spell)
#define FOR_OB_AND_ABOVE_PREPARE(op_)
int caster_level(const object *caster, const object *spell)
void esrv_send_item(object *pl, object *op)
sstring add_refcount(sstring str)
static archetype * food_choice
const artifactlist * find_artifactlist(int type)
object * object_find_by_type_applied(const object *who, int type)
int cure_disease(object *sufferer, object *caster, sstring skill)
int cast_create_food(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
#define MSG_TYPE_ITEM_INFO
static void place_alchemy_objects(object *op, mapstruct *m, int small_nuggets, int large_nuggets, int x, int y)
int write_mark(object *op, object *spell, const char *msg)
struct artifactstruct * items
void archetypes_for_each(arch_op op)
#define FLAG_NO_FIX_PLAYER
#define EXPLODING_FIREBALL
StringBuffer * stringbuffer_new(void)
mapstruct * ready_map_name(const char *name, int flags)
#define MSG_TYPE_SPELL_FAILURE
void free_string(sstring str)
void esrv_update_item(int flags, object *pl, object *op)
int alchemy(object *op, object *caster, object *spell_ob)
void examine_monster(object *op, object *tmp, int level)
int cast_invisible(object *op, object *caster, object *spell_ob)
void pick_up(object *op, object *alt)
int cast_word_of_recall(object *op, object *caster, object *spell_ob)
int magic_wall(object *op, object *caster, int dir, object *spell_ob)
short freearr_x[SIZEOFFREE]
int cast_item_curse_or_curse(object *op, object *caster, object *spell_ob)
int SP_level_dam_adjust(const object *caster, const object *spob)
int cast_earth_to_dust(object *op, object *caster, object *spell_ob)
int remove_curse(object *op, object *caster, object *spell)
object * arch_present_in_ob(const archetype *at, const object *op)
int8_t get_attr_value(const living *stats, int attr)
void remove_friendly_object(object *op)
void object_update(object *op, int action)
method_ret ob_apply(object *op, object *applier, int aflags)
const object * find_god(const char *name)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
static void food_each(archetype *arch)
#define MSG_TYPE_VICTIM_SPELL
#define SP_WORD_OF_RECALL
#define FOR_OB_AND_BELOW_FINISH()
archetype * try_find_archetype(const char *name)
int change_map_light(mapstruct *m, int change)
int cast_cone(object *op, object *caster, int dir, object *spell)
short freearr_y[SIZEOFFREE]
#define FLAG_KNOWN_MAGICAL
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
archetype * find_archetype_by_object_type_name(int type, const char *name)
void pets_control_golem(object *op, int dir)
void polymorph(object *op, object *who, int level)
int rndm(int min, int max)
void map_newmap_cmd(socket_struct *ns)
int probe(object *op, object *caster, object *spell_ob, int dir, int level)
void object_set_owner(object *op, object *owner)
#define MSG_TYPE_SPELL_TARGET
int change_abil(object *op, object *tmp)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
static void polymorph_item(object *who, object *op, int level)
int cast_heal(object *op, object *caster, object *spell, int dir)
void confuse_living(object *op, object *hitter, int dam)
int recharge(object *op, object *caster, object *spell_ob)
int is_identified(const object *op)
object * object_new(void)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
#define FOR_OB_AND_ABOVE_FINISH()
int cast_transfer(object *op, object *caster, object *spell, int dir)
object * object_insert_in_ob(object *op, object *where)
#define MSG_TYPE_SPELL_SUCCESS
#define MSG_TYPE_SPELL_HEAL
object * arch_to_object(archetype *at)
object * find_target_for_friendly_spell(object *op, int dir)
void update_all_los(const mapstruct *map, int x, int y)
object * create_archetype(const char *name)
const char *const statname[NUM_STATS]
void monster_check_apply_all(object *monster)
int is_dragon_pl(const object *op)
static void charge_mana_effect(object *victim, int caster_level)
int cast_create_obj(object *op, object *new_op, int dir)
int strcasecmp(const char *s1, const char *s2)
#define MSG_TYPE_SPELL_PERCEIVE_SELF
int create_aura(object *op, object *caster, object *spell)
int SP_level_duration_adjust(const object *caster, const object *spob)
#define MSG_TYPE_SPELL_ERROR
void add_friendly_object(object *op)
int dimension_door(object *op, object *caster, object *spob, int dir)
int cast_identify(object *op, object *caster, object *spell)
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
void spell_effect(object *spob, int x, int y, mapstruct *map, object *originator)
int cast_change_map_lightlevel(object *op, object *caster, object *spell)
int is_true_undead(object *op)
uint64_t price_base(const object *obj)
EXTERN const char *const change_resist_msg[NROFATTACKS]
#define OB_TYPE_MOVE_BLOCK(ob1, type)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
static int town_portal_destroy_existing(object *op, object *spell)
archetype * get_next_archetype(archetype *current)
object * find_marked_object(object *op)
#define FREE_AND_CLEAR_STR(xyz)
static void polymorph_melt(object *who, object *op)
static void alchemy_object(float value_adj, object *obj, int *small_nuggets, int *large_nuggets, int *weight)
unsigned __int64 uint64_t
#define QUERY_FLAG(xyz, p)
int animate_weapon(object *op, object *caster, object *spell, int dir)
#define CLEAR_FLAG(xyz, p)
void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
void give_artifact_abilities(object *op, const object *artifact)
int cast_change_ability(object *op, object *caster, object *spell_ob, int dir, int silent)
static const char *const no_gain_msgs[NUM_STATS]
object * object_create_arch(archetype *at)
#define FLAG_KNOWN_CURSED
int perceive_self(object *op)
char * ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
void store_spell_expiry(object *spell)
object * object_find_by_type_subtype(const object *who, int type, int subtype)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
int cast_consecrate(object *op, object *caster, object *spell)
#define FREE_AND_COPY(sv, nv)
int cast_polymorph(object *op, object *caster, object *spell_ob, int dir)
int SP_level_range_adjust(const object *caster, const object *spob)
#define MAP_PLAYER_UNIQUE
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
#define FLAG_IS_BUILDABLE
void object_set_enemy(object *op, object *enemy)
static int food_value_choice
void query_short_name(const object *op, char *buf, size_t size)
#define FOR_OB_AND_BELOW_PREPARE(op_)
sstring add_string(const char *str)
object * identify(object *op)
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
static const int32_t MAX_FOOD
#define GET_MAP_OB(M, X, Y)
void object_copy(const object *src_ob, object *dest_ob)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
void counterspell(object *op, int dir)
void player_update_bg_music(object *player)
void LOG(LogLevel logLevel, const char *format,...)
int makes_invisible_to(object *pl, object *mon)
int did_make_save(const object *op, int level, int bonus)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
int cast_create_missile(object *op, object *caster, object *spell, int dir, const char *stringarg)
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
void object_set_msg(object *op, const char *msg)
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
void query_name(const object *op, char *buf, size_t size)
#define FOR_BELOW_PREPARE(op_, it_)
object * generate_treasure(treasurelist *t, int difficulty)
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
int random_roll(int min, int max, const object *op, int goodbad)
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
void fix_object(object *op)
void object_update_speed(object *op)
object * object_get_owner(object *op)
static void polymorph_living(object *op, int level)
int cast_create_town_portal(object *op, object *caster, object *spell, int dir)
char * stringbuffer_finish(StringBuffer *sb)
#define FOR_BELOW_FINISH()
#define HAS_RANDOM_ITEMS(op)
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
#define FOR_INV_PREPARE(op_, it_)
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
void object_remove(object *op)
struct artifactstruct * next
int atnr_is_dragon_enabled(int attacknr)