1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_pets_c = |
3 | * static char *rcsid_pets_c = |
4 | * "$Id: pets.C,v 1.5 2006/09/12 18:15:35 root Exp $"; |
4 | * "$Id: pets.C,v 1.6 2006/09/12 20:55:18 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
686 | if (!god) |
686 | if (!god) |
687 | { |
687 | { |
688 | new_draw_info_format (NDI_UNIQUE, 0, op, "You must worship a god to cast %s.", &spob->name); |
688 | new_draw_info_format (NDI_UNIQUE, 0, op, "You must worship a god to cast %s.", &spob->name); |
689 | return 0; |
689 | return 0; |
690 | } |
690 | } |
|
|
691 | |
691 | at = determine_holy_arch (god, spob->race); |
692 | at = determine_holy_arch (god, spob->race); |
|
|
693 | |
692 | if (!at) |
694 | if (!at) |
693 | { |
695 | { |
694 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s has no %s for you to call.", &god->name, &spob->race); |
696 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s has no %s for you to call.", &god->name, &spob->race); |
695 | return 0; |
697 | return 0; |
696 | } |
698 | } |
… | |
… | |
702 | } |
704 | } |
703 | |
705 | |
704 | if (!dir) |
706 | if (!dir) |
705 | dir = find_free_spot (NULL, op->map, op->x, op->y, 1, SIZEOFFREE1 + 1); |
707 | dir = find_free_spot (NULL, op->map, op->x, op->y, 1, SIZEOFFREE1 + 1); |
706 | |
708 | |
707 | if ((dir == -1) || ob_blocked (&at->clone, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) |
709 | if (dir == -1 || ob_blocked (&at->clone, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) |
708 | { |
710 | { |
709 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
711 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
710 | return 0; |
712 | return 0; |
711 | } |
713 | } |
712 | /* basically want to get proper map/coordinates for this object */ |
714 | /* basically want to get proper map/coordinates for this object */ |
… | |
… | |
739 | tmp->attack_movement = PETMOVE; |
741 | tmp->attack_movement = PETMOVE; |
740 | add_friendly_object (tmp); |
742 | add_friendly_object (tmp); |
741 | SET_FLAG (tmp, FLAG_FRIENDLY); |
743 | SET_FLAG (tmp, FLAG_FRIENDLY); |
742 | } |
744 | } |
743 | } |
745 | } |
|
|
746 | |
744 | SET_FLAG (tmp, FLAG_MONSTER); |
747 | SET_FLAG (tmp, FLAG_MONSTER); |
745 | } |
748 | } |
746 | |
749 | |
747 | /* make the speed positive. */ |
750 | /* make the speed positive. */ |
748 | tmp->speed = FABS (tmp->speed); |
751 | tmp->speed = FABS (tmp->speed); |
… | |
… | |
751 | /* players can't cope with too strong summonings. */ |
754 | /* players can't cope with too strong summonings. */ |
752 | /* but monsters can. reserve these for players. */ |
755 | /* but monsters can. reserve these for players. */ |
753 | if (op->type == PLAYER) |
756 | if (op->type == PLAYER) |
754 | { |
757 | { |
755 | tmp->stats.hp += spob->duration + SP_level_duration_adjust (caster, spob); |
758 | tmp->stats.hp += spob->duration + SP_level_duration_adjust (caster, spob); |
|
|
759 | |
756 | if (!spob->stats.dam) |
760 | if (!spob->stats.dam) |
757 | tmp->stats.dam += SP_level_dam_adjust (caster, spob); |
761 | tmp->stats.dam += SP_level_dam_adjust (caster, spob); |
758 | else |
762 | else |
759 | tmp->stats.dam = spob->stats.dam + SP_level_dam_adjust (caster, spob); |
763 | tmp->stats.dam = spob->stats.dam + SP_level_dam_adjust (caster, spob); |
|
|
764 | |
760 | tmp->speed += .02 * SP_level_range_adjust (caster, spob); |
765 | tmp->speed += .02 * SP_level_range_adjust (caster, spob); |
761 | tmp->speed = MIN (tmp->speed, 1.0); |
766 | tmp->speed = MIN (tmp->speed, 1.0); |
|
|
767 | |
762 | if (spob->attacktype) |
768 | if (spob->attacktype) |
763 | tmp->attacktype = spob->attacktype; |
769 | tmp->attacktype = spob->attacktype; |
764 | } |
770 | } |
|
|
771 | |
765 | tmp->stats.wc -= SP_level_range_adjust (caster, spob); |
772 | tmp->stats.wc -= SP_level_range_adjust (caster, spob); |
766 | |
773 | |
767 | /* limit the speed to 0.3 for non-players, 1 for players. */ |
774 | /* limit the speed to 0.3 for non-players, 1 for players. */ |
768 | |
775 | |
769 | /* make experience increase in proportion to the strength. |
776 | /* make experience increase in proportion to the strength. |
… | |
… | |
787 | |
794 | |
788 | tmp->attacktype |= god->attacktype; |
795 | tmp->attacktype |= god->attacktype; |
789 | memcpy (tmp->resist, god->resist, sizeof (tmp->resist)); |
796 | memcpy (tmp->resist, god->resist, sizeof (tmp->resist)); |
790 | tmp->race = god->race; |
797 | tmp->race = god->race; |
791 | tmp->slaying = god->slaying; |
798 | tmp->slaying = god->slaying; |
|
|
799 | |
792 | /* safety, we must allow a god's servants some reasonable attack */ |
800 | /* safety, we must allow a god's servants some reasonable attack */ |
793 | if (!(tmp->attacktype & AT_PHYSICAL)) |
801 | if (!(tmp->attacktype & AT_PHYSICAL)) |
794 | tmp->attacktype |= AT_PHYSICAL; |
802 | tmp->attacktype |= AT_PHYSICAL; |
795 | } |
803 | } |
796 | |
804 | |