Go to the documentation of this file.
55 object *owner, *
tmp, *attacker, *tmp3;
156 if (attacker != NULL) {
193 assert(tmp3 == NULL);
230 for (cur = link; cur != NULL; cur = cur->
next) {
231 object *
ob = cur->ob;
256 for (cur =
list; cur != NULL; cur = cur->next) {
257 if (cur->ob->type !=
PLAYER
260 && (for_owner == NULL || for_owner == owner)
290 if (owner->
map == NULL) {
295 LOG(
llevError,
"Owner of the pet not on a map in memory!?\n");
307 "Your pet magically appears next to you");
342 for (i = 0; i < 15; i++) {
372 for (part =
ob; part != NULL; part = part->
more) {
398 if (new_ob->
enemy == NULL)
404 "You stand in the way of someones pet.");
436 object *
tmp = NULL, *prev = NULL, *head = NULL;
438 for (atmp = at; atmp != NULL; atmp = atmp->
more) {
444 if (
tmp->move_type == 0) {
467 tmp->speed_left = -1;
485 head->direction = dir;
487 if (head->randomitems) {
498 head->last_grace = 0;
500 head->other_arch = NULL;
540 if (--
op->stats.hp < 0) {
595 if (
victim->race != NULL &&
op->race != NULL && strstr(
op->race,
victim->race)) {
599 "%s avoids damaging %s.",
601 }
else if (
victim == owner) {
605 "%s avoids damaging you.",
653 const object *god = NULL;
665 "You dismiss your existing golem.");
669 op->contr->golem_count = -1;
674 else if (spob->
race != NULL) {
679 "You must worship a god to cast %s.",
688 "%s has no %s for you to call.",
704 "There is something in the way.");
712 "Your spell fails.");
721 op->contr->golem_count =
tmp->count;
747 tmp->stats.maxhp =
tmp->stats.hp;
767 tmp->direction = dir;
775 for (tmp2 =
tmp; tmp2; tmp2 = tmp2->
more) {
776 if (tmp2->
name != NULL)
782 if (
tmp->race != NULL)
784 if (god->
race != NULL)
786 if (
tmp->slaying != NULL)
828 race = strtok(
buf,
",");
831 race = strtok(NULL,
",");
836 racenr =
rndm(0, racenr-1);
838 race = strtok(
buf,
",");
839 for (i = 0; i < racenr; i++)
840 race = strtok(NULL,
",");
848 "The spell fails! %s's creatures are beyond the range of your summons",
873 int16_t
x,
y, nrof = 1, i;
888 if (level < tr->magic)
891 if (stringarg != NULL && !strcmp(tr->
item->
name, stringarg))
896 if (lasttr == NULL) {
900 "The spell fails to summon any monsters.");
903 summon_arch = lasttr->
item;
905 }
else if (spell_ob->
race != NULL && !strcmp(spell_ob->
race,
"GODCULTMON")) {
908 int summon_level, tries;
920 if (god->
race == NULL) {
923 "%s has no creatures that you may summon!",
929 if (summon_level == 0)
937 "%s fails to send anything.",
950 "There is something in the way.");
954 }
while (ndir == -1);
967 if (summon_arch == NULL) {
969 "There is no monsters available for summoning.");
979 "There is something in the way.");
984 mult = (
RANDOM()%2 ? -1 : 1);
986 for (i = 1; i <= nrof; i++) {
988 object *prev = NULL, *head = NULL, *
tmp;
991 ndir =
absdir(dir+(i/2)*mult);
1001 for (atmp = summon_arch; atmp != NULL; atmp = atmp->
more) {
1003 if (atmp == summon_arch) {
1024 tmp->speed_left = -1;
1034 head->direction =
freedir[ndir];
1035 head->stats.exp = 0;
1037 if (head != NULL && head->randomitems) {
1060 object *realowner =
ob;
1062 if (realowner == NULL)
1087 object *rowner, *towner;
1090 if (target == NULL || pet == NULL || owner == NULL)
1103 if (rowner == NULL) {
1110 if (towner == NULL && target->
type !=
PLAYER) {
1111 LOG(
llevError,
"Target is not a player but has no owner. We should not be here.\n");
1130 if (target->
type !=
PLAYER && rowner == towner)
int SP_level_range_adjust(const object *caster, const object *spob)
#define object_was_destroyed(op, old_tag)
object * object_get_owner(object *op)
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
static object * choose_cult_monster(object *pl, const object *god, int summon_level)
void remove_friendly_object(object *op)
void pets_terminate_all(object *owner)
void pets_control_golem(object *op, int dir)
void LOG(LogLevel logLevel, const char *format,...)
int monster_can_detect_enemy(object *op, object *enemy, rv_vector *rv)
object * pets_get_enemy(object *pet, rv_vector *rv)
#define QUERY_FLAG(xyz, p)
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
objectlink * get_friends_of(const object *owner)
void object_set_enemy(object *op, object *enemy)
#define MSG_TYPE_SPELL_PET
int pets_summon_golem(object *op, object *caster, int dir, object *spob)
void object_set_owner(object *op, object *owner)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
static void mark_inventory_as_no_drop(object *ob)
object * races_get_random_monster(const char *race, int level)
int SP_level_duration_adjust(const object *caster, const object *spob)
int rndm(int min, int max)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
int16_t resist[NROFATTACKS]
const object * find_god(const char *name)
static event_registration m
object * monster_find_nearest_enemy(object *npc, object *owner)
void object_free_drop_inventory(object *ob)
void object_update(object *op, int action)
const char * determine_god(object *op)
short freearr_y[SIZEOFFREE]
int move_ob(object *op, int dir, object *originator)
object * ranges[range_size]
sstring add_string(const char *str)
int pets_should_arena_attack(object *pet, object *owner, object *target)
void pets_move_golem(object *op)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
int caster_level(const object *caster, const object *spell)
#define FLAG_UNAGGRESSIVE
void pets_attempt_follow(object *for_owner, int force)
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
int random_roll(int min, int max, const object *op, int goodbad)
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
struct archetype * other_arch
int SP_level_wc_adjust(const object *caster, const object *spob)
void free_string(sstring str)
void monster_check_apply_all(object *monster)
#define FREE_AND_CLEAR_STR(xyz)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
void get_search_arr(int *search_arr)
int monster_can_see_enemy(object *op, object *enemy)
int SP_level_dam_adjust(const object *caster, const object *spob)
int pets_summon_object(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
#define MSG_TYPE_SPELL_FAILURE
void add_friendly_object(object *op)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
static object * get_real_owner(object *ob)
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
void pets_follow_owner(object *ob, object *owner)
object * monster_check_enemy(object *npc, rv_vector *rv)
int on_same_map(const object *op1, const object *op2)
#define CLEAR_FLAG(xyz, p)
int die_roll(int num, int size, const object *op, int goodbad)
object * arch_to_object(archetype *at)
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
struct treasurelist * randomitems
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
void object_remove(object *op)
void free_objectlink(objectlink *ol)
void pets_move(object *ob)
#define OB_TYPE_MOVE_BLOCK(ob1, type)
int attack_ob(object *op, object *hitter)
short freearr_x[SIZEOFFREE]
#define FOR_INV_PREPARE(op_, it_)
static object * fix_summon_pet(archetype *at, object *op, int dir)
archetype * determine_holy_arch(const object *god, const char *type)