… | |
… | |
242 | next_tmp = tmp->below; |
242 | next_tmp = tmp->below; |
243 | |
243 | |
244 | /* we mark special prayers with the STARTEQUIP flag, so if it isn't |
244 | /* we mark special prayers with the STARTEQUIP flag, so if it isn't |
245 | * in that category, not something we need to worry about. |
245 | * in that category, not something we need to worry about. |
246 | */ |
246 | */ |
247 | if (tmp->type != SPELL || !QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
247 | if (tmp->type != SPELL || !tmp->flag [FLAG_STARTEQUIP]) |
248 | continue; |
248 | continue; |
249 | |
249 | |
250 | if (god->randomitems == NULL) |
250 | if (god->randomitems == NULL) |
251 | { |
251 | { |
252 | LOG (llevError, "BUG: check_special_prayers(): god %s without randomitems\n", &god->name); |
252 | LOG (llevError, "BUG: check_special_prayers(): god %s without randomitems\n", &god->name); |
… | |
… | |
301 | * already exist. For players only! |
301 | * already exist. For players only! |
302 | */ |
302 | */ |
303 | static void |
303 | static void |
304 | update_priest_flag (object *god, object *exp_ob, uint32 flag) |
304 | update_priest_flag (object *god, object *exp_ob, uint32 flag) |
305 | { |
305 | { |
306 | if (QUERY_FLAG (god, flag) && !QUERY_FLAG (exp_ob, flag)) |
306 | if (god->flag [flag] && !exp_ob->flag [flag]) |
307 | SET_FLAG (exp_ob, flag); |
307 | exp_ob->flag [flag]; |
308 | else if (QUERY_FLAG (exp_ob, flag) && !QUERY_FLAG (god, flag)) |
308 | else if (exp_ob->flag [flag] && !god->flag [flag]) |
309 | { |
309 | { |
310 | /* When this is called with the exp_ob set to the player, |
310 | /* When this is called with the exp_ob set to the player, |
311 | * this check is broken, because most all players arch |
311 | * this check is broken, because most all players arch |
312 | * allow use of weapons. I'm not actually sure why this |
312 | * allow use of weapons. I'm not actually sure why this |
313 | * check is here - I guess if you had a case where the |
313 | * check is here - I guess if you had a case where the |
… | |
… | |
315 | * the god places on it, this may make sense. But I don't think |
315 | * the god places on it, this may make sense. But I don't think |
316 | * there is any case like that. |
316 | * there is any case like that. |
317 | */ |
317 | */ |
318 | |
318 | |
319 | /* if (!(QUERY_FLAG(&(exp_ob->arch->clone),flag)))*/ |
319 | /* if (!(QUERY_FLAG(&(exp_ob->arch->clone),flag)))*/ |
320 | CLEAR_FLAG (exp_ob, flag); |
320 | exp_ob->clr_flag (flag); |
321 | }; |
321 | }; |
322 | } |
322 | } |
323 | |
323 | |
324 | /** |
324 | /** |
325 | * Forbids or let player use something item type. |
325 | * Forbids or let player use something item type. |
… | |
… | |
329 | * string is the string to print out. |
329 | * string is the string to print out. |
330 | */ |
330 | */ |
331 | static int |
331 | static int |
332 | worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) |
332 | worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) |
333 | { |
333 | { |
334 | if (QUERY_FLAG (op->arch, flag)) |
334 | if (op->arch->flag [flag]) |
335 | if (QUERY_FLAG (op, flag) != QUERY_FLAG (exp_obj, flag)) |
335 | if (op->flag [flag] != exp_obj->flag [flag]) |
336 | { |
336 | { |
337 | update_priest_flag (exp_obj, op, flag); |
337 | update_priest_flag (exp_obj, op, flag); |
338 | if (QUERY_FLAG (op, flag)) |
338 | if (op->flag [flag]) |
339 | new_draw_info_format (NDI_UNIQUE, 0, op, "You may use %s again.", string); |
339 | new_draw_info_format (NDI_UNIQUE, 0, op, "You may use %s again.", string); |
340 | else |
340 | else |
341 | { |
341 | { |
342 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string); |
342 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string); |
343 | return 1; |
343 | return 1; |
… | |
… | |
367 | for (item = op->inv; item; item = next) |
367 | for (item = op->inv; item; item = next) |
368 | { |
368 | { |
369 | next = item->below; |
369 | next = item->below; |
370 | |
370 | |
371 | // remove all invisible startequip items which are not skill, exp or force |
371 | // remove all invisible startequip items which are not skill, exp or force |
372 | if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && |
372 | if (item->flag [FLAG_STARTEQUIP] && item->invisible && |
373 | (item->type != SKILL) && (item->type != FORCE)) |
373 | (item->type != SKILL) && (item->type != FORCE)) |
374 | { |
374 | { |
375 | if (item->type == SPELL) |
375 | if (item->type == SPELL) |
376 | { |
376 | { |
377 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
377 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
… | |
… | |
383 | } |
383 | } |
384 | |
384 | |
385 | /* remove any godgiven items from the old god */ |
385 | /* remove any godgiven items from the old god */ |
386 | if (old_god) |
386 | if (old_god) |
387 | for (tr = old_god->randomitems->items; tr; tr = tr->next) |
387 | for (tr = old_god->randomitems->items; tr; tr = tr->next) |
388 | if (tr->item && QUERY_FLAG (tr->item, FLAG_STARTEQUIP)) |
388 | if (tr->item && tr->item->flag [FLAG_STARTEQUIP]) |
389 | follower_remove_similar_item (op, tr->item); |
389 | follower_remove_similar_item (op, tr->item); |
390 | |
390 | |
391 | if (!op || !new_god) |
391 | if (!op || !new_god) |
392 | return; |
392 | return; |
393 | |
393 | |
… | |
… | |
424 | /* The archetype should always be defined - if we crash here because it doesn't, |
424 | /* The archetype should always be defined - if we crash here because it doesn't, |
425 | * things are really messed up anyways. |
425 | * things are really messed up anyways. |
426 | */ |
426 | */ |
427 | skop = give_skill_by_name (op, get_archetype_by_type_subtype (SKILL, SK_PRAYING)->skill); |
427 | skop = give_skill_by_name (op, get_archetype_by_type_subtype (SKILL, SK_PRAYING)->skill); |
428 | |
428 | |
429 | sk_applied = QUERY_FLAG (skop, FLAG_APPLIED); /* save skill status */ |
429 | sk_applied = skop->flag [FLAG_APPLIED]; /* save skill status */ |
430 | |
430 | |
431 | /* Clear the "undead" status. We also need to force a call to change_abil, |
431 | /* Clear the "undead" status. We also need to force a call to change_abil, |
432 | * so I set undeadified for that. |
432 | * so I set undeadified for that. |
433 | * - gros, 21th July 2006. |
433 | * - gros, 21th July 2006. |
434 | */ |
434 | */ |
435 | if (old_god && QUERY_FLAG (old_god, FLAG_UNDEAD)) |
435 | if (old_god && old_god->flag [FLAG_UNDEAD]) |
436 | { |
436 | { |
437 | CLEAR_FLAG (skop, FLAG_UNDEAD); |
437 | skop->clr_flag (FLAG_UNDEAD); |
438 | undeadified = 1; |
438 | undeadified = 1; |
439 | } |
439 | } |
440 | |
440 | |
441 | if (skop->title) |
441 | if (skop->title) |
442 | { |
442 | { |
… | |
… | |
444 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s's blessing is withdrawn from you.", &skop->title); |
444 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s's blessing is withdrawn from you.", &skop->title); |
445 | |
445 | |
446 | /* The point of this is to really show what abilities the player just lost */ |
446 | /* The point of this is to really show what abilities the player just lost */ |
447 | if (sk_applied || undeadified) |
447 | if (sk_applied || undeadified) |
448 | { |
448 | { |
449 | CLEAR_FLAG (skop, FLAG_APPLIED); |
449 | skop->clr_flag (FLAG_APPLIED); |
450 | change_abil (op, skop); |
450 | change_abil (op, skop); |
451 | } |
451 | } |
452 | } |
452 | } |
453 | |
453 | |
454 | /* now change to the new gods attributes to exp_obj */ |
454 | /* now change to the new gods attributes to exp_obj */ |
… | |
… | |
505 | stop_using_item (op, BOOTS, 1); |
505 | stop_using_item (op, BOOTS, 1); |
506 | stop_using_item (op, GLOVES, 1); |
506 | stop_using_item (op, GLOVES, 1); |
507 | stop_using_item (op, SHIELD, 1); |
507 | stop_using_item (op, SHIELD, 1); |
508 | } |
508 | } |
509 | |
509 | |
510 | SET_FLAG (skop, FLAG_APPLIED); |
510 | skop->set_flag (FLAG_APPLIED); |
511 | change_abil (op, skop); |
511 | change_abil (op, skop); |
512 | |
512 | |
513 | /* return to previous skill status */ |
513 | /* return to previous skill status */ |
514 | if (!sk_applied) |
514 | if (!sk_applied) |
515 | CLEAR_FLAG (skop, FLAG_APPLIED); |
515 | skop->clr_flag (FLAG_APPLIED); |
516 | |
516 | |
517 | check_special_prayers (op, new_god); |
517 | check_special_prayers (op, new_god); |
518 | } |
518 | } |
519 | |
519 | |
520 | archetype * |
520 | archetype * |
… | |
… | |
553 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
553 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
554 | { |
554 | { |
555 | if (tmp->invisible) |
555 | if (tmp->invisible) |
556 | continue; |
556 | continue; |
557 | |
557 | |
558 | if (QUERY_FLAG (tmp, FLAG_DAMNED) && !remove_damnation) |
558 | if (tmp->flag [FLAG_DAMNED] && !remove_damnation) |
559 | continue; |
559 | continue; |
560 | |
560 | |
561 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
561 | if (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED]) |
562 | { |
562 | { |
563 | success = 1; |
563 | success = 1; |
564 | CLEAR_FLAG (tmp, FLAG_DAMNED); |
564 | tmp->clr_flag (FLAG_DAMNED); |
565 | CLEAR_FLAG (tmp, FLAG_CURSED); |
565 | tmp->clr_flag (FLAG_CURSED); |
566 | CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); |
566 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
567 | |
567 | |
568 | if (object *pl = tmp->visible_to ()) |
568 | if (object *pl = tmp->visible_to ()) |
569 | esrv_update_item (UPD_FLAGS, pl, tmp); |
569 | esrv_update_item (UPD_FLAGS, pl, tmp); |
570 | } |
570 | } |
571 | } |
571 | } |
… | |
… | |
647 | object *weapon; |
647 | object *weapon; |
648 | uint32 attacktype; |
648 | uint32 attacktype; |
649 | int tmp; |
649 | int tmp; |
650 | |
650 | |
651 | for (weapon = op->inv; weapon; weapon = weapon->below) |
651 | for (weapon = op->inv; weapon; weapon = weapon->below) |
652 | if ((weapon->type == WEAPON || weapon->type == BOW) && QUERY_FLAG (weapon, FLAG_APPLIED)) |
652 | if ((weapon->type == WEAPON || weapon->type == BOW) && weapon->flag [FLAG_APPLIED]) |
653 | break; |
653 | break; |
654 | |
654 | |
655 | if (!weapon || god_examines_item (god, weapon) <= 0) |
655 | if (!weapon || god_examines_item (god, weapon) <= 0) |
656 | return 0; |
656 | return 0; |
657 | |
657 | |
… | |
… | |
709 | { |
709 | { |
710 | int reaction = 1; |
710 | int reaction = 1; |
711 | object *item = NULL, *skop; |
711 | object *item = NULL, *skop; |
712 | |
712 | |
713 | for (item = op->inv; item; item = item->below) |
713 | for (item = op->inv; item; item = item->below) |
714 | if (QUERY_FLAG (item, FLAG_APPLIED)) |
714 | if (item->flag [FLAG_APPLIED]) |
715 | reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1); |
715 | reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1); |
716 | |
716 | |
717 | /* well, well. Looks like we screwed up. Time for god's revenge */ |
717 | /* well, well. Looks like we screwed up. Time for god's revenge */ |
718 | if (reaction < 0) |
718 | if (reaction < 0) |
719 | { |
719 | { |