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

Comparing deliantra/server/server/gods.C (file contents):
Revision 1.35 by root, Sun May 4 18:46:01 2008 UTC vs.
Revision 1.36 by root, Mon May 5 15:05:26 2008 UTC

400 { 400 {
401 remove = 0; 401 remove = 0;
402 break; 402 break;
403 } 403 }
404 } 404 }
405
405 if (remove) 406 if (remove)
406 { 407 do_forget_spell (op, tmp->name);
407 /* just do the work of removing the spell ourselves - we already
408 * know that the player knows the spell
409 */
410 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &tmp->name);
411 player_unready_range_ob (op->contr, tmp);
412 tmp->destroy ();
413 }
414
415 } 408 }
416} 409}
417 410
418/** 411/**
419 * This function is called whenever a player has 412 * This function is called whenever a player has
427 object *old_god = NULL; /* old god */ 420 object *old_god = NULL; /* old god */
428 treasure *tr; 421 treasure *tr;
429 object *item, *skop, *next; 422 object *item, *skop, *next;
430 int i, sk_applied, undeadified = 0; /* Turns to true if changing god can changes the undead status of the player. */ 423 int i, sk_applied, undeadified = 0; /* Turns to true if changing god can changes the undead status of the player. */
431 424
432
433 old_god = find_god (determine_god (op)); 425 old_god = find_god (determine_god (op));
434 426
435 /* take away any special god-characteristic items. */ 427 /* take away any special god-characteristic items. */
436 for (item = op->inv; item != NULL; item = next) 428 for (item = op->inv; item; item = next)
437 { 429 {
438 next = item->below; 430 next = item->below;
431
439 // remove all invisible startequip items which are not skill, exp or force 432 // remove all invisible startequip items which are not skill, exp or force
440 if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && 433 if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible &&
441 (item->type != SKILL) && (item->type != FORCE)) 434 (item->type != SKILL) && (item->type != FORCE))
442 { 435 {
443
444 if (item->type == SPELL) 436 if (item->type == SPELL)
437 {
445 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); 438 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name);
439 esrv_remove_spell (op->contr, item);
440 }
446 441
447 player_unready_range_ob (op->contr, item); 442 player_unready_range_ob (op->contr, item);
448 item->destroy (); 443 item->destroy ();
449 } 444 }
450 } 445 }
470 } 465 }
471 466
472 return; 467 return;
473 } 468 }
474 469
475
476 /* give the player any special god-characteristic-items. */ 470 /* give the player any special god-characteristic-items. */
477 for (tr = new_god->randomitems->items; tr; tr = tr->next) 471 for (tr = new_god->randomitems->items; tr; tr = tr->next)
478 { 472 {
479 if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK 473 if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK
480 && tr->item->type != BOOK && tr->item->type != SPELL) 474 && tr->item->type != BOOK && tr->item->type != SPELL)
481 god_gives_present (op, new_god, tr); 475 god_gives_present (op, new_god, tr);
482 } 476 }
483
484 477
485 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You become a follower of %s!", &new_god->name); 478 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You become a follower of %s!", &new_god->name);
486 479
487 for (skop = op->inv; skop != NULL; skop = skop->below) 480 for (skop = op->inv; skop != NULL; skop = skop->below)
488 if (skop->type == SKILL && skop->subtype == SK_PRAYING) 481 if (skop->type == SKILL && skop->subtype == SK_PRAYING)
562 * This also can happen for monks which cannot use weapons. In this case 555 * This also can happen for monks which cannot use weapons. In this case
563 * do not allow to use weapons even if the god otherwise would allow it. 556 * do not allow to use weapons even if the god otherwise would allow it.
564 */ 557 */
565 if (!present_in_ob_by_name (FORCE, "no weapon force", op)) 558 if (!present_in_ob_by_name (FORCE, "no weapon force", op))
566 update_priest_flag (new_god, skop, FLAG_USE_WEAPON); 559 update_priest_flag (new_god, skop, FLAG_USE_WEAPON);
560
567 update_priest_flag (new_god, skop, FLAG_USE_ARMOUR); 561 update_priest_flag (new_god, skop, FLAG_USE_ARMOUR);
568 562
569 if (worship_forbids_use (op, skop, FLAG_USE_WEAPON, "weapons")) 563 if (worship_forbids_use (op, skop, FLAG_USE_WEAPON, "weapons"))
570 stop_using_item (op, WEAPON, 2); 564 stop_using_item (op, WEAPON, 2);
571 565
597 */ 591 */
598 592
599int 593int
600worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) 594worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string)
601{ 595{
602
603 if (QUERY_FLAG (op->arch, flag)) 596 if (QUERY_FLAG (op->arch, flag))
604 if (QUERY_FLAG (op, flag) != QUERY_FLAG (exp_obj, flag)) 597 if (QUERY_FLAG (op, flag) != QUERY_FLAG (exp_obj, flag))
605 { 598 {
606 update_priest_flag (exp_obj, op, flag); 599 update_priest_flag (exp_obj, op, flag);
607 if (QUERY_FLAG (op, flag)) 600 if (QUERY_FLAG (op, flag))
610 { 603 {
611 new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string); 604 new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string);
612 return 1; 605 return 1;
613 } 606 }
614 } 607 }
608
615 return 0; 609 return 0;
616} 610}
617 611
618/** 612/**
619 * Unapplies up to number worth of items of type 613 * Unapplies up to number worth of items of type

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines