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