Go to the documentation of this file.
55 object *owner, *
tmp, *attacker, *tmp3;
156 if (attacker != NULL) {
193 assert(tmp3 == NULL);
229 object *
ob = obl->
ob;
257 && (for_owner == NULL || for_owner == owner)
264 object *
ob = obl->
ob;
288 if (owner->
map == NULL) {
293 LOG(
llevError,
"Owner of the pet not on a map in memory!?\n");
305 "Your pet magically appears next to you");
340 for (i = 0; i < 15; i++) {
370 for (part =
ob; part != NULL; part = part->
more) {
396 if (new_ob->
enemy == NULL)
402 "You stand in the way of someones pet.");
434 object *
tmp = NULL, *prev = NULL, *head = NULL;
436 for (atmp = at; atmp != NULL; atmp = atmp->
more) {
442 if (
tmp->move_type == 0) {
465 tmp->speed_left = -1;
483 head->direction = dir;
485 if (head->randomitems) {
496 head->last_grace = 0;
498 head->other_arch = NULL;
538 if (--
op->stats.hp < 0) {
593 if (
victim->race != NULL &&
op->race != NULL && strstr(
op->race,
victim->race)) {
597 "%s avoids damaging %s.",
599 }
else if (
victim == owner) {
603 "%s avoids damaging you.",
651 const object *god = NULL;
663 "You dismiss your existing golem.");
667 op->contr->golem_count = -1;
672 else if (spob->
race != NULL) {
677 "You must worship a god to cast %s.",
686 "%s has no %s for you to call.",
702 "There is something in the way.");
710 "Your spell fails.");
719 op->contr->golem_count =
tmp->count;
745 tmp->stats.maxhp =
tmp->stats.hp;
765 tmp->direction = dir;
773 for (tmp2 =
tmp; tmp2; tmp2 = tmp2->
more) {
774 if (tmp2->
name != NULL)
780 if (
tmp->race != NULL)
782 if (god->
race != NULL)
784 if (
tmp->slaying != NULL)
826 race = strtok(
buf,
",");
829 race = strtok(NULL,
",");
834 racenr =
rndm(0, racenr-1);
836 race = strtok(
buf,
",");
837 for (i = 0; i < racenr; i++)
838 race = strtok(NULL,
",");
846 "The spell fails! %s's creatures are beyond the range of your summons",
871 int16_t
x,
y, nrof = 1, i;
886 if (level < tr->magic)
889 if (stringarg != NULL && !strcmp(tr->
item->
name, stringarg))
894 if (lasttr == NULL) {
898 "The spell fails to summon any monsters.");
901 summon_arch = lasttr->
item;
903 }
else if (spell_ob->
race != NULL && !strcmp(spell_ob->
race,
"GODCULTMON")) {
906 int summon_level, tries;
918 if (god->
race == NULL) {
921 "%s has no creatures that you may summon!",
927 if (summon_level == 0)
935 "%s fails to send anything.",
948 "There is something in the way.");
952 }
while (ndir == -1);
965 if (summon_arch == NULL) {
967 "There is no monsters available for summoning.");
977 "There is something in the way.");
982 mult = (
RANDOM()%2 ? -1 : 1);
984 for (i = 1; i <= nrof; i++) {
986 object *prev = NULL, *head = NULL, *
tmp;
989 ndir =
absdir(dir+(i/2)*mult);
999 for (atmp = summon_arch; atmp != NULL; atmp = atmp->
more) {
1001 if (atmp == summon_arch) {
1022 tmp->speed_left = -1;
1032 head->direction =
freedir[ndir];
1033 head->stats.exp = 0;
1035 if (head != NULL && head->randomitems) {
1058 object *realowner =
ob;
1060 if (realowner == NULL)
1085 object *rowner, *towner;
1088 if (target == NULL || pet == NULL || owner == NULL)
1101 if (rowner == NULL) {
1108 if (towner == NULL && target->
type !=
PLAYER) {
1109 LOG(
llevError,
"Target is not a player but has no owner. We should not be here.\n");
1128 if (target->
type !=
PLAYER && rowner == towner)
int SP_level_range_adjust(const object *caster, const object *spob)
#define object_was_destroyed(op, old_tag)
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
void pets_terminate_all(object *owner)
sstring add_string(const char *str)
void object_remove(object *op)
void object_set_enemy(object *op, object *enemy)
int monster_can_detect_enemy(object *op, object *enemy, rv_vector *rv)
void object_update(object *op, int action)
#define QUERY_FLAG(xyz, p)
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
#define MSG_TYPE_SPELL_PET
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 ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
void remove_friendly_object(object *op)
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
EXTERN objectlink * first_friendly_object
struct treasureliststruct * randomitems
short freearr_x[SIZEOFFREE]
short freearr_y[SIZEOFFREE]
void free_string(sstring str)
static event_registration m
object * monster_find_nearest_enemy(object *npc, object *owner)
const char * determine_god(object *op)
static object * get_real_owner(object *ob)
int move_ob(object *op, int dir, object *originator)
void pets_attempt_follow(object *for_owner, int force)
void pets_follow_owner(object *ob, object *owner)
int pets_should_arena_attack(object *pet, object *owner, object *target)
void pets_control_golem(object *op, int dir)
static object * choose_cult_monster(object *pl, const object *god, int summon_level)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
struct archt * other_arch
int caster_level(const object *caster, const object *spell)
int rndm(int min, int max)
#define FLAG_UNAGGRESSIVE
void object_set_owner(object *op, object *owner)
int SP_level_wc_adjust(const object *caster, const object *spob)
void monster_check_apply_all(object *monster)
#define FREE_AND_CLEAR_STR(xyz)
int random_roll(int min, int max, const object *op, int goodbad)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
struct treasurestruct * items
int monster_can_see_enemy(object *op, object *enemy)
static object * fix_summon_pet(archetype *at, object *op, int dir)
int die_roll(int num, int size, const object *op, int goodbad)
int SP_level_dam_adjust(const object *caster, const object *spob)
#define MSG_TYPE_SPELL_FAILURE
void LOG(LogLevel logLevel, const char *format,...)
void pets_move(object *ob)
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object * pets_get_enemy(object *pet, rv_vector *rv)
object * monster_check_enemy(object *npc, rv_vector *rv)
#define CLEAR_FLAG(xyz, p)
object * arch_to_object(archetype *at)
object * ranges[range_size]
struct treasurestruct * next
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
void object_free_drop_inventory(object *ob)
void pets_move_golem(object *op)
int pets_summon_object(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
void add_friendly_object(object *op)
#define OB_TYPE_MOVE_BLOCK(ob1, type)
int attack_ob(object *op, object *hitter)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
void get_search_arr(int *search_arr)
const object * find_god(const char *name)
int on_same_map(const object *op1, const object *op2)
int16_t resist[NROFATTACKS]
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
#define FOR_INV_PREPARE(op_, it_)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
int pets_summon_golem(object *op, object *caster, int dir, object *spob)
archetype * determine_holy_arch(const object *god, const char *type)
object * object_get_owner(object *op)