1 | /* |
1 | /* |
2 | * static char *rcsid_spell_effect_c = |
2 | * static char *rcsid_spell_effect_c = |
3 | * "$Id: spell_effect.C,v 1.6 2006/08/29 11:58:02 elmex Exp $"; |
3 | * "$Id: spell_effect.C,v 1.7 2006/09/03 00:18:42 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
… | |
… | |
355 | op->invisible += spell_ob->duration + SP_level_duration_adjust(caster, spell_ob); |
355 | op->invisible += spell_ob->duration + SP_level_duration_adjust(caster, spell_ob); |
356 | /* max duration */ |
356 | /* max duration */ |
357 | if(op->invisible>1000) op->invisible = 1000; |
357 | if(op->invisible>1000) op->invisible = 1000; |
358 | |
358 | |
359 | if (op->type == PLAYER) { |
359 | if (op->type == PLAYER) { |
360 | if (op->contr->invis_race) FREE_AND_CLEAR_STR(op->contr->invis_race); |
|
|
361 | if (spell_ob->race) |
|
|
362 | op->contr->invis_race = add_refcount(spell_ob->race); |
360 | op->contr->invis_race = spell_ob->race; |
|
|
361 | |
363 | if (QUERY_FLAG(spell_ob, FLAG_MAKE_INVIS)) |
362 | if (QUERY_FLAG(spell_ob, FLAG_MAKE_INVIS)) |
364 | op->contr->tmp_invis=0; |
363 | op->contr->tmp_invis=0; |
365 | else |
364 | else |
366 | op->contr->tmp_invis=1; |
365 | op->contr->tmp_invis=1; |
367 | |
366 | |
… | |
… | |
469 | dummy->subtype = SP_WORD_OF_RECALL; |
468 | dummy->subtype = SP_WORD_OF_RECALL; |
470 | |
469 | |
471 | /* If we could take advantage of enter_player_savebed() here, it would be |
470 | /* If we could take advantage of enter_player_savebed() here, it would be |
472 | * nice, but until the map load fails, we can't. |
471 | * nice, but until the map load fails, we can't. |
473 | */ |
472 | */ |
474 | EXIT_PATH(dummy) = add_string(op->contr->savebed_map); |
473 | EXIT_PATH(dummy) = op->contr->savebed_map; |
475 | EXIT_X(dummy) = op->contr->bed_x; |
474 | EXIT_X(dummy) = op->contr->bed_x; |
476 | EXIT_Y(dummy) = op->contr->bed_y; |
475 | EXIT_Y(dummy) = op->contr->bed_y; |
477 | |
476 | |
478 | (void) insert_ob_in_ob(dummy,op); |
477 | (void) insert_ob_in_ob(dummy,op); |
479 | new_draw_info(NDI_UNIQUE, 0,op,"You feel a force starting to build up inside you."); |
478 | new_draw_info(NDI_UNIQUE, 0,op,"You feel a force starting to build up inside you."); |
… | |
… | |
496 | LOG(llevError,"cast_wonder: Unable to get a spell!\n"); |
495 | LOG(llevError,"cast_wonder: Unable to get a spell!\n"); |
497 | return 0; |
496 | return 0; |
498 | } |
497 | } |
499 | if (newspell->type != SPELL) { |
498 | if (newspell->type != SPELL) { |
500 | LOG(llevError,"cast_wonder: spell returned is not a spell (%d, %s)!\n", |
499 | LOG(llevError,"cast_wonder: spell returned is not a spell (%d, %s)!\n", |
501 | newspell->type, newspell->name); |
500 | &newspell->type, &newspell->name); |
502 | return 0; |
501 | return 0; |
503 | } |
502 | } |
504 | /* Prevent inifinit recursion */ |
503 | /* Prevent inifinit recursion */ |
505 | if (newspell->subtype == SP_WONDER) { |
504 | if (newspell->subtype == SP_WONDER) { |
506 | LOG(llevError,"cast_wonder: spell returned is another wonder spell!\n"); |
505 | LOG(llevError,"cast_wonder: spell returned is another wonder spell!\n"); |
… | |
… | |
518 | object *tmp; |
517 | object *tmp; |
519 | int i; |
518 | int i; |
520 | |
519 | |
521 | tmp=find_god(determine_god(op)); |
520 | tmp=find_god(determine_god(op)); |
522 | if (tmp) |
521 | if (tmp) |
523 | new_draw_info_format(NDI_UNIQUE, 0, op, "You worship %s", tmp->name); |
522 | new_draw_info_format(NDI_UNIQUE, 0, op, "You worship %s", &tmp->name); |
524 | else |
523 | else |
525 | new_draw_info(NDI_UNIQUE, 0,op,"You worship no god"); |
524 | new_draw_info(NDI_UNIQUE, 0,op,"You worship no god"); |
526 | |
525 | |
527 | tmp=present_arch_in_ob(at,op); |
526 | tmp=present_arch_in_ob(at,op); |
528 | |
527 | |
… | |
… | |
601 | * dummy is used to make a check inventory for the force |
600 | * dummy is used to make a check inventory for the force |
602 | */ |
601 | */ |
603 | dummy=arch_to_object(spell->other_arch); |
602 | dummy=arch_to_object(spell->other_arch); |
604 | if(dummy == NULL){ |
603 | if(dummy == NULL){ |
605 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
604 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
606 | LOG(llevError,"get_object failed (force in cast_create_town_portal for %s!\n",op->name); |
605 | LOG(llevError,"get_object failed (force in cast_create_town_portal for %s!\n",&op->name); |
607 | return 0; |
606 | return 0; |
608 | } |
607 | } |
609 | force=check_inv_recursive (op,dummy); |
608 | force=check_inv_recursive (op,dummy); |
610 | |
609 | |
611 | if (force==NULL) { |
610 | if (force==NULL) { |
612 | /* Here we know there is no destination marked up. |
611 | /* Here we know there is no destination marked up. |
613 | * We have 2 things to do: |
612 | * We have 2 things to do: |
614 | * 1. Mark the destination in the player inventory. |
613 | * 1. Mark the destination in the player inventory. |
615 | * 2. Let the player know it worked. |
614 | * 2. Let the player know it worked. |
616 | */ |
615 | */ |
617 | free_string (dummy->name); |
|
|
618 | dummy->name = add_string (op->map->path); |
616 | dummy->name = op->map->path; |
619 | EXIT_X(dummy)= op->x; |
617 | EXIT_X(dummy)= op->x; |
620 | EXIT_Y(dummy)= op->y; |
618 | EXIT_Y(dummy)= op->y; |
621 | insert_ob_in_ob (dummy,op); |
619 | insert_ob_in_ob (dummy,op); |
622 | new_draw_info(NDI_UNIQUE | NDI_NAVY, 0,op,"You fix this place in your mind.\nYou feel you are able to come here from anywhere."); |
620 | new_draw_info(NDI_UNIQUE | NDI_NAVY, 0,op,"You fix this place in your mind.\nYou feel you are able to come here from anywhere."); |
623 | return 1; |
621 | return 1; |
… | |
… | |
642 | |
640 | |
643 | /* First step: killing existing town portals */ |
641 | /* First step: killing existing town portals */ |
644 | dummy=get_archetype(spell->race); |
642 | dummy=get_archetype(spell->race); |
645 | if(dummy == NULL){ |
643 | if(dummy == NULL){ |
646 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
644 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
647 | LOG(llevError,"get_object failed (force) in cast_create_town_portal for %s!\n",op->name); |
645 | LOG(llevError,"get_object failed (force) in cast_create_town_portal for %s!\n",&op->name); |
648 | return 0; |
646 | return 0; |
649 | } |
647 | } |
650 | perm_portal = find_archetype (spell->slaying); |
648 | perm_portal = find_archetype (spell->slaying); |
651 | |
649 | |
652 | /* To kill a town portal, we go trough the player's inventory, |
650 | /* To kill a town portal, we go trough the player's inventory, |
… | |
… | |
657 | * -We destruct the force indicating that portal. |
655 | * -We destruct the force indicating that portal. |
658 | */ |
656 | */ |
659 | while ( (old_force=check_inv_recursive (op,dummy))) { |
657 | while ( (old_force=check_inv_recursive (op,dummy))) { |
660 | exitx=EXIT_X(old_force); |
658 | exitx=EXIT_X(old_force); |
661 | exity=EXIT_Y(old_force); |
659 | exity=EXIT_Y(old_force); |
662 | LOG (llevDebug,"Trying to kill a portal in %s (%d,%d)\n",old_force->race,exitx,exity); |
660 | LOG (llevDebug,"Trying to kill a portal in %s (%d,%d)\n",&old_force->race,exitx,exity); |
663 | |
661 | |
664 | if (!strncmp(old_force->race, settings.localdir, strlen(settings.localdir))) |
662 | if (!strncmp(old_force->race, settings.localdir, strlen(settings.localdir))) |
665 | exitmap = ready_map_name(old_force->race, MAP_PLAYER_UNIQUE); |
663 | exitmap = ready_map_name(old_force->race, MAP_PLAYER_UNIQUE); |
666 | else exitmap = ready_map_name(old_force->race, 0); |
664 | else exitmap = ready_map_name(old_force->race, 0); |
667 | |
665 | |
… | |
… | |
707 | return 1; |
705 | return 1; |
708 | } |
706 | } |
709 | |
707 | |
710 | op_level = caster_level(caster, spell); |
708 | op_level = caster_level(caster, spell); |
711 | if (op_level<15) |
709 | if (op_level<15) |
712 | snprintf (portal_message,1024,"\nThe air moves around you and\na huge smell of ammonia\nsurounds you as you pass\nthrough %s's tiny portal\nPouah!\n",op->name); |
710 | snprintf (portal_message,1024,"\nThe air moves around you and\na huge smell of ammonia\nsurounds you as you pass\nthrough %s's tiny portal\nPouah!\n",&op->name); |
713 | else if (op_level<30) |
711 | else if (op_level<30) |
714 | snprintf (portal_message,1024,"\n%s's portal smells of ozone.\nYou do a lot of movements and finally pass\nthrough the small hole in the air\n",op->name); |
712 | snprintf (portal_message,1024,"\n%s's portal smells of ozone.\nYou do a lot of movements and finally pass\nthrough the small hole in the air\n",&op->name); |
715 | else if (op_level<60) |
713 | else if (op_level<60) |
716 | snprintf (portal_message,1024,"\nA shining door opens in the air in front of you,\nshowing you the path to another place.\n"); |
714 | snprintf (portal_message,1024,"\nA shining door opens in the air in front of you,\nshowing you the path to another place.\n"); |
717 | else snprintf (portal_message,1024,"\nAs you walk through %s's portal, flowers come out\nfrom the ground around you.\nYou feel awed.\n",op->name); |
715 | else snprintf (portal_message,1024,"\nAs you walk through %s's portal, flowers come out\nfrom the ground around you.\nYou feel awed.\n",&op->name); |
718 | |
716 | |
719 | /* Create a portal in front of player |
717 | /* Create a portal in front of player |
720 | * dummy contain the portal and |
718 | * dummy contain the portal and |
721 | * force contain the track to kill it later |
719 | * force contain the track to kill it later |
722 | */ |
720 | */ |
723 | |
721 | |
724 | snprintf (portal_name,1024,"%s's portal to %s",op->name,force->name); |
722 | snprintf (portal_name,1024,"%s's portal to %s",&op->name,&force->name); |
725 | dummy=get_archetype(spell->slaying); /*The portal*/ |
723 | dummy=get_archetype(spell->slaying); /*The portal*/ |
726 | if(dummy == NULL) { |
724 | if(dummy == NULL) { |
727 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
725 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
728 | LOG(llevError,"get_object failed (perm_magic_portal) in cast_create_town_portal for %s!\n",op->name); |
726 | LOG(llevError,"get_object failed (perm_magic_portal) in cast_create_town_portal for %s!\n",&op->name); |
729 | return 0; |
727 | return 0; |
730 | } |
728 | } |
731 | EXIT_PATH(dummy) = add_string (force->name); |
729 | EXIT_PATH(dummy) = force->name; |
732 | EXIT_X(dummy)=EXIT_X(force); |
730 | EXIT_X(dummy)=EXIT_X(force); |
733 | EXIT_Y(dummy)=EXIT_Y(force); |
731 | EXIT_Y(dummy)=EXIT_Y(force); |
734 | FREE_AND_COPY(dummy->name, portal_name); |
732 | dummy->name = dummy->name_pl = portal_name; |
735 | FREE_AND_COPY(dummy->name_pl, portal_name); |
|
|
736 | dummy->msg=add_string (portal_message); |
733 | dummy->msg=portal_message; |
737 | dummy->race=add_string (op->name); /*Save the owner of the portal*/ |
734 | dummy->race=op->name; /*Save the owner of the portal*/ |
738 | cast_create_obj (op, caster, dummy, 0); |
735 | cast_create_obj (op, caster, dummy, 0); |
739 | |
736 | |
740 | /* Now we need to to create a town portal marker inside the player |
737 | /* Now we need to to create a town portal marker inside the player |
741 | * object, so on future castings, we can know that he has an active |
738 | * object, so on future castings, we can know that he has an active |
742 | * town portal. |
739 | * town portal. |
743 | */ |
740 | */ |
744 | tmp=get_archetype(spell->race); |
741 | tmp=get_archetype(spell->race); |
745 | if(tmp == NULL){ |
742 | if(tmp == NULL){ |
746 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
743 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
747 | LOG(llevError,"get_object failed (force) in cast_create_town_portal for %s!\n",op->name); |
744 | LOG(llevError,"get_object failed (force) in cast_create_town_portal for %s!\n",&op->name); |
748 | return 0; |
745 | return 0; |
749 | } |
746 | } |
750 | tmp->race=add_string (op->map->path); |
747 | tmp->race=op->map->path; |
751 | FREE_AND_COPY(tmp->name, portal_name); |
748 | tmp->name = portal_name; |
752 | EXIT_X(tmp)=dummy->x; |
749 | EXIT_X(tmp)=dummy->x; |
753 | EXIT_Y(tmp)=dummy->y; |
750 | EXIT_Y(tmp)=dummy->y; |
754 | insert_ob_in_ob (tmp,op); |
751 | insert_ob_in_ob (tmp,op); |
755 | |
752 | |
756 | /* Create a portal in the destination map |
753 | /* Create a portal in the destination map |
757 | * dummy contain the portal and |
754 | * dummy contain the portal and |
758 | * force the track to kill it later |
755 | * force the track to kill it later |
759 | * the 'force' variable still contains the 'reminder' of |
756 | * the 'force' variable still contains the 'reminder' of |
760 | * where this portal goes to. |
757 | * where this portal goes to. |
761 | */ |
758 | */ |
762 | snprintf (portal_name,1024,"%s's portal to %s",op->name,op->map->path); |
759 | snprintf (portal_name,1024,"%s's portal to %s",&op->name,op->map->path); |
763 | dummy=get_archetype (spell->slaying); /*The portal*/ |
760 | dummy=get_archetype (spell->slaying); /*The portal*/ |
764 | if(dummy == NULL) { |
761 | if(dummy == NULL) { |
765 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
762 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
766 | LOG(llevError,"get_object failed (perm_magic_portal) in cast_create_town_portal for %s!\n",op->name); |
763 | LOG(llevError,"get_object failed (perm_magic_portal) in cast_create_town_portal for %s!\n",&op->name); |
767 | return 0; |
764 | return 0; |
768 | } |
765 | } |
769 | EXIT_PATH(dummy) = add_string (op->map->path); |
766 | EXIT_PATH(dummy) = op->map->path; |
770 | EXIT_X(dummy)=op->x; |
767 | EXIT_X(dummy)=op->x; |
771 | EXIT_Y(dummy)=op->y; |
768 | EXIT_Y(dummy)=op->y; |
772 | FREE_AND_COPY(dummy->name, portal_name); |
769 | dummy->name = dummy->name_pl = portal_name; |
773 | FREE_AND_COPY(dummy->name_pl, portal_name); |
|
|
774 | dummy->msg=add_string (portal_message); |
770 | dummy->msg=portal_message; |
775 | dummy->x=EXIT_X(force); |
771 | dummy->x=EXIT_X(force); |
776 | dummy->y=EXIT_Y(force); |
772 | dummy->y=EXIT_Y(force); |
777 | dummy->race=add_string (op->name); /*Save the owner of the portal*/ |
773 | dummy->race=op->name; /*Save the owner of the portal*/ |
778 | insert_ob_in_map(dummy,exitmap,op,0); |
774 | insert_ob_in_map(dummy,exitmap,op,0); |
779 | |
775 | |
780 | /* Now we create another town portal marker that |
776 | /* Now we create another town portal marker that |
781 | * points back to the one we just made |
777 | * points back to the one we just made |
782 | */ |
778 | */ |
783 | tmp=get_archetype(spell->race); |
779 | tmp=get_archetype(spell->race); |
784 | if(tmp == NULL){ |
780 | if(tmp == NULL){ |
785 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
781 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
786 | LOG(llevError,"get_object failed (force) in cast_create_town_portal for %s!\n",op->name); |
782 | LOG(llevError,"get_object failed (force) in cast_create_town_portal for %s!\n",&op->name); |
787 | return 0; |
783 | return 0; |
788 | } |
784 | } |
789 | tmp->race=add_string(force->name); |
785 | tmp->race=force->name; |
790 | FREE_AND_COPY(tmp->name, portal_name); |
786 | tmp->name = portal_name; |
791 | EXIT_X(tmp)=dummy->x; |
787 | EXIT_X(tmp)=dummy->x; |
792 | EXIT_Y(tmp)=dummy->y; |
788 | EXIT_Y(tmp)=dummy->y; |
793 | insert_ob_in_ob (tmp,op); |
789 | insert_ob_in_ob (tmp,op); |
794 | |
790 | |
795 | /* Describe the player what happened |
791 | /* Describe the player what happened |
… | |
… | |
842 | return 0; |
838 | return 0; |
843 | } |
839 | } |
844 | tmp = arch_to_object(at); |
840 | tmp = arch_to_object(at); |
845 | } else { |
841 | } else { |
846 | LOG(llevError,"magic_wall: spell %s lacks other_arch\n", |
842 | LOG(llevError,"magic_wall: spell %s lacks other_arch\n", |
847 | spell_ob->name); |
843 | &spell_ob->name); |
848 | return 0; |
844 | return 0; |
849 | } |
845 | } |
850 | |
846 | |
851 | if (tmp->type == SPELL_EFFECT) { |
847 | if (tmp->type == SPELL_EFFECT) { |
852 | tmp->attacktype = spell_ob->attacktype; |
848 | tmp->attacktype = spell_ob->attacktype; |
… | |
… | |
1194 | } |
1190 | } |
1195 | else if (spell_ob->race && spell_ob->race == tmp2->name) { |
1191 | else if (spell_ob->race && spell_ob->race == tmp2->name) { |
1196 | if ( !silent ) |
1192 | if ( !silent ) |
1197 | new_draw_info_format(NDI_UNIQUE, 0, op, |
1193 | new_draw_info_format(NDI_UNIQUE, 0, op, |
1198 | "You can not cast %s while %s is in effect", |
1194 | "You can not cast %s while %s is in effect", |
1199 | spell_ob->name, tmp2->name_pl); |
1195 | &spell_ob->name, &tmp2->name_pl); |
1200 | return 0; |
1196 | return 0; |
1201 | } |
1197 | } |
1202 | } |
1198 | } |
1203 | } |
1199 | } |
1204 | if(force==NULL) { |
1200 | if(force==NULL) { |
1205 | force=get_archetype(FORCE_NAME); |
1201 | force=get_archetype(FORCE_NAME); |
1206 | force->subtype = FORCE_CHANGE_ABILITY; |
1202 | force->subtype = FORCE_CHANGE_ABILITY; |
1207 | free_string(force->name); |
|
|
1208 | if (spell_ob->race) |
1203 | if (spell_ob->race) |
1209 | force->name = add_refcount(spell_ob->race); |
1204 | force->name = spell_ob->race; |
1210 | else |
1205 | else |
1211 | force->name = add_refcount(spell_ob->name); |
1206 | force->name = spell_ob->name; |
1212 | free_string(force->name_pl); |
|
|
1213 | force->name_pl = add_refcount(spell_ob->name); |
1207 | force->name_pl = spell_ob->name; |
1214 | new_draw_info(NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
1208 | new_draw_info(NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
1215 | |
1209 | |
1216 | } else { |
1210 | } else { |
1217 | int duration; |
1211 | int duration; |
1218 | |
1212 | |
… | |
… | |
1309 | break; |
1303 | break; |
1310 | } |
1304 | } |
1311 | else if (spell_ob->race && spell_ob->race == tmp2->name) { |
1305 | else if (spell_ob->race && spell_ob->race == tmp2->name) { |
1312 | new_draw_info_format(NDI_UNIQUE, 0, op, |
1306 | new_draw_info_format(NDI_UNIQUE, 0, op, |
1313 | "You can not cast %s while %s is in effect", |
1307 | "You can not cast %s while %s is in effect", |
1314 | spell_ob->name, tmp2->name_pl); |
1308 | &spell_ob->name, &tmp2->name_pl); |
1315 | return 0; |
1309 | return 0; |
1316 | } |
1310 | } |
1317 | } |
1311 | } |
1318 | } |
1312 | } |
1319 | if(force==NULL) { |
1313 | if(force==NULL) { |
1320 | force=get_archetype(FORCE_NAME); |
1314 | force=get_archetype(FORCE_NAME); |
1321 | force->subtype = FORCE_CHANGE_ABILITY; |
1315 | force->subtype = FORCE_CHANGE_ABILITY; |
1322 | free_string(force->name); |
|
|
1323 | if (spell_ob->race) |
1316 | if (spell_ob->race) |
1324 | force->name = add_refcount(spell_ob->race); |
1317 | force->name = spell_ob->race; |
1325 | else |
1318 | else |
1326 | force->name = add_refcount(spell_ob->name); |
1319 | force->name = spell_ob->name; |
1327 | free_string(force->name_pl); |
|
|
1328 | force->name_pl = add_refcount(spell_ob->name); |
1320 | force->name_pl = spell_ob->name; |
1329 | new_draw_info(NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
1321 | new_draw_info(NDI_UNIQUE, 0, op, "You create an aura of magical force."); |
1330 | } else { |
1322 | } else { |
1331 | int duration; |
1323 | int duration; |
1332 | |
1324 | |
1333 | duration = spell_ob->duration + SP_level_duration_adjust(caster, spell_ob) * 50; |
1325 | duration = spell_ob->duration + SP_level_duration_adjust(caster, spell_ob) * 50; |
… | |
… | |
1352 | if (god->resist[i]>0) { |
1344 | if (god->resist[i]>0) { |
1353 | force->resist[i] = MIN(god->resist[i], spell_ob->resist[ATNR_GODPOWER]); |
1345 | force->resist[i] = MIN(god->resist[i], spell_ob->resist[ATNR_GODPOWER]); |
1354 | } |
1346 | } |
1355 | } |
1347 | } |
1356 | force->path_attuned|=god->path_attuned; |
1348 | force->path_attuned|=god->path_attuned; |
|
|
1349 | |
1357 | if (spell_ob->attacktype) { |
1350 | if (spell_ob->attacktype) |
1358 | force->attacktype|=god->attacktype | AT_PHYSICAL; |
1351 | force->slaying = god->slaying; |
1359 | if(god->slaying) force->slaying = add_string(god->slaying); |
1352 | |
1360 | } |
|
|
1361 | if (tmp != op) { |
1353 | if (tmp != op) { |
1362 | new_draw_info_format(NDI_UNIQUE, 0, op, "You bless %s.", tmp->name); |
1354 | new_draw_info_format(NDI_UNIQUE, 0, op, "You bless %s.", &tmp->name); |
1363 | new_draw_info_format(NDI_UNIQUE, 0, tmp, "%s blessed you.", op->name); |
1355 | new_draw_info_format(NDI_UNIQUE, 0, tmp, "%s blessed you.", &op->name); |
1364 | } else { |
1356 | } else { |
1365 | new_draw_info_format(NDI_UNIQUE, 0,tmp, |
1357 | new_draw_info_format(NDI_UNIQUE, 0,tmp, |
1366 | "You are blessed by %s!",god->name); |
1358 | "You are blessed by %s!",&god->name); |
1367 | } |
1359 | } |
1368 | |
1360 | |
1369 | } |
1361 | } |
1370 | force->stats.wc = spell_ob->stats.wc; |
1362 | force->stats.wc = spell_ob->stats.wc; |
1371 | force->stats.ac = spell_ob->stats.ac; |
1363 | force->stats.ac = spell_ob->stats.ac; |
… | |
… | |
2014 | if(QUERY_FLAG(tmp,FLAG_IS_FLOOR)) break; |
2006 | if(QUERY_FLAG(tmp,FLAG_IS_FLOOR)) break; |
2015 | if(tmp->type==HOLY_ALTAR) { |
2007 | if(tmp->type==HOLY_ALTAR) { |
2016 | |
2008 | |
2017 | if(tmp->level > caster_level(caster, spell)) { |
2009 | if(tmp->level > caster_level(caster, spell)) { |
2018 | new_draw_info_format(NDI_UNIQUE, 0,op, |
2010 | new_draw_info_format(NDI_UNIQUE, 0,op, |
2019 | "You are not powerful enough to reconsecrate the %s", tmp->name); |
2011 | "You are not powerful enough to reconsecrate the %s", &tmp->name); |
2020 | return 0; |
2012 | return 0; |
2021 | } else { |
2013 | } else { |
2022 | /* If we got here, we are consecrating an altar */ |
2014 | /* If we got here, we are consecrating an altar */ |
2023 | if(tmp->name) free_string(tmp->name); |
|
|
2024 | sprintf(buf,"Altar of %s",god->name); |
2015 | sprintf(buf,"Altar of %s", &god->name); |
2025 | tmp->name = add_string(buf); |
2016 | tmp->name = buf; |
2026 | tmp->level = caster_level(caster, spell); |
2017 | tmp->level = caster_level(caster, spell); |
2027 | tmp->other_arch = god->arch; |
2018 | tmp->other_arch = god->arch; |
2028 | if(op->type==PLAYER) esrv_update_item(UPD_NAME, op, tmp); |
2019 | if(op->type==PLAYER) esrv_update_item(UPD_NAME, op, tmp); |
2029 | new_draw_info_format(NDI_UNIQUE,0, op, |
2020 | new_draw_info_format(NDI_UNIQUE,0, op, |
2030 | "You consecrated the altar to %s!",god->name); |
2021 | "You consecrated the altar to %s!", &god->name); |
2031 | return 1; |
2022 | return 1; |
2032 | } |
2023 | } |
2033 | } |
2024 | } |
2034 | } |
2025 | } |
2035 | new_draw_info(NDI_UNIQUE, 0,op,"You are not standing over an altar!"); |
2026 | new_draw_info(NDI_UNIQUE, 0,op,"You are not standing over an altar!"); |
… | |
… | |
2055 | mapstruct *m; |
2046 | mapstruct *m; |
2056 | materialtype_t *mt; |
2047 | materialtype_t *mt; |
2057 | |
2048 | |
2058 | if(!spell->other_arch){ |
2049 | if(!spell->other_arch){ |
2059 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
2050 | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
2060 | LOG(llevError,"animate_weapon failed: spell %s missing other_arch!\n", spell->name); |
2051 | LOG(llevError,"animate_weapon failed: spell %s missing other_arch!\n", &spell->name); |
2061 | return 0; |
2052 | return 0; |
2062 | } |
2053 | } |
2063 | /* exit if it's not a player using this spell. */ |
2054 | /* exit if it's not a player using this spell. */ |
2064 | if(op->type!=PLAYER) return 0; |
2055 | if(op->type!=PLAYER) return 0; |
2065 | |
2056 | |
… | |
… | |
2203 | tmp->speed = 0.4 + 0.1 * SP_level_range_adjust(caster,spell); |
2194 | tmp->speed = 0.4 + 0.1 * SP_level_range_adjust(caster,spell); |
2204 | |
2195 | |
2205 | if(tmp->speed > 3.33) tmp->speed = 3.33; |
2196 | if(tmp->speed > 3.33) tmp->speed = 3.33; |
2206 | |
2197 | |
2207 | if (!spell->race) { |
2198 | if (!spell->race) { |
2208 | sprintf(buf, "animated %s", weapon->name); |
2199 | sprintf(buf, "animated %s", &weapon->name); |
2209 | if(tmp->name) free_string(tmp->name); |
|
|
2210 | tmp->name = add_string(buf); |
2200 | tmp->name = buf; |
2211 | |
2201 | |
2212 | tmp->face = weapon->face; |
2202 | tmp->face = weapon->face; |
2213 | tmp->animation_id = weapon->animation_id; |
2203 | tmp->animation_id = weapon->animation_id; |
2214 | tmp->anim_speed = weapon->anim_speed; |
2204 | tmp->anim_speed = weapon->anim_speed; |
2215 | tmp->last_anim = weapon->last_anim; |
2205 | tmp->last_anim = weapon->last_anim; |
… | |
… | |
2399 | SET_FLAG(victim,FLAG_UNAGGRESSIVE); |
2389 | SET_FLAG(victim,FLAG_UNAGGRESSIVE); |
2400 | SET_FLAG(victim,FLAG_RUN_AWAY); |
2390 | SET_FLAG(victim,FLAG_RUN_AWAY); |
2401 | SET_FLAG(victim,FLAG_RANDOM_MOVE); |
2391 | SET_FLAG(victim,FLAG_RANDOM_MOVE); |
2402 | CLEAR_FLAG(victim,FLAG_MONSTER); |
2392 | CLEAR_FLAG(victim,FLAG_MONSTER); |
2403 | if(victim->name) { |
2393 | if(victim->name) { |
2404 | new_draw_info_format(NDI_UNIQUE,0,op->owner,"%s no longer feels like fighting.",victim->name); |
2394 | new_draw_info_format(NDI_UNIQUE,0,op->owner,"%s no longer feels like fighting.",&victim->name); |
2405 | } |
2395 | } |
2406 | } |
2396 | } |
2407 | } |
2397 | } |
2408 | } |
2398 | } |
2409 | |
2399 | |
… | |
… | |
2421 | return 0; |
2411 | return 0; |
2422 | } |
2412 | } |
2423 | |
2413 | |
2424 | if (strcasestr_local(msg, "endmsg")) { |
2414 | if (strcasestr_local(msg, "endmsg")) { |
2425 | new_draw_info(NDI_UNIQUE, 0, op, "Trying to cheat are we?"); |
2415 | new_draw_info(NDI_UNIQUE, 0, op, "Trying to cheat are we?"); |
2426 | LOG(llevInfo,"write_rune: player %s tried to write bogus rune %s\n", op->name, msg); |
2416 | LOG(llevInfo,"write_rune: player %s tried to write bogus rune %s\n", &op->name, msg); |
2427 | return 0; |
2417 | return 0; |
2428 | } |
2418 | } |
2429 | if (!spell->other_arch) return 0; |
2419 | if (!spell->other_arch) return 0; |
2430 | tmp = arch_to_object(spell->other_arch); |
2420 | tmp = arch_to_object(spell->other_arch); |
2431 | strncpy(rune, msg, HUGE_BUF-2); |
2421 | strncpy(rune, msg, HUGE_BUF-2); |
2432 | rune[HUGE_BUF-2] = 0; |
2422 | rune[HUGE_BUF-2] = 0; |
2433 | strcat(rune, "\n"); |
2423 | strcat(rune, "\n"); |
2434 | tmp->race = add_string (op->name); /*Save the owner of the rune*/ |
2424 | tmp->race = op->name; /*Save the owner of the rune*/ |
2435 | tmp->msg = add_string(rune); |
2425 | tmp->msg = rune; |
2436 | tmp->x = op->x; |
2426 | tmp->x = op->x; |
2437 | tmp->y = op->y; |
2427 | tmp->y = op->y; |
2438 | insert_ob_in_map(tmp, op->map, op, INS_BELOW_ORIGINATOR); |
2428 | insert_ob_in_map(tmp, op->map, op, INS_BELOW_ORIGINATOR); |
2439 | return 1; |
2429 | return 1; |
2440 | } |
2430 | } |