48 for (tmp = ob->
inv; tmp != NULL; tmp = tmp->
below) {
68 object *owner, *tmp, *attacker, *tmp3;
143 object *tmp2 = tmp->
head == NULL ? tmp : tmp->
head;
183 pet->
enemy = attacker;
207 object *tmp2 = tmp->
head == NULL ? tmp : tmp->
head;
254 object *ob = obl->
ob;
288 object *ob = obl->
ob;
313 if (owner->
map == NULL) {
318 LOG(
llevError,
"Owner of the pet not on a map in memory!?\n");
327 for (tmp = ob; tmp != NULL; tmp = tmp->
more) {
338 "Your pet magically appears next to you", NULL);
372 for (i = 0; i < 15; i++) {
400 for (part = ob; part != NULL; part = part->
more) {
410 new_ob = ob2->
head ? ob2->
head : ob2;
413 if (new_ob == ob->
owner)
426 if (new_ob->
enemy == NULL)
432 "You stand in the way of someones pet.", NULL);
438 dir =
absdir(dir+4-(RANDOM()%5)-(RANDOM()%5));
466 object *tmp = NULL, *prev = NULL, *head = NULL;
468 for (atmp = at; atmp != NULL; atmp = atmp->
more) {
512 if (head->randomitems) {
520 head->last_grace = 0;
522 head->other_arch = NULL;
583 for (tmp = op; tmp; tmp = tmp->
more) {
606 if (victim && victim != op && victim->
head != op) {
615 "%s avoids damaging %s.",
616 "%s avoids damaging %s.",
618 }
else if (victim == op->
owner) {
622 "%s avoids damaging you.",
623 "%s avoids damaging you.",
671 const object *god = NULL;
683 "You dismiss your existing golem.", NULL);
692 else if (spob->
race) {
697 "You must worship a god to cast %s.",
698 "You must worship a god to cast %s.",
707 "%s has no %s for you to call.",
708 "%s has no %s for you to call.",
724 "There is something in the way.", NULL);
732 "Your spell fails.", NULL);
792 buf[0] = toupper(buf[0]);
793 for (tmp2 = tmp; tmp2; tmp2 = tmp2->
more) {
840 int racenr, mon_nr, i;
847 strcpy(buf, god->
race);
848 race = strtok(buf,
",");
851 race = strtok(NULL,
",");
856 racenr =
rndm(0, racenr-1);
857 strcpy(buf, god->
race);
858 race = strtok(buf,
",");
859 for (i = 0; i < racenr; i++)
860 race = strtok(NULL,
",");
873 "The spell fails! %s's creatures are beyond the range of your summons",
874 "The spell fails! %s's creatures are beyond the range of your summons",
876 LOG(
llevDebug,
"choose_cult_monster() requested non-existent aligned race!\n");
882 for (tobl = list->
member; tobl; tobl = tobl->
next) {
886 if (otmp->
level <= summon_level)
898 mon_nr =
rndm(0, mon_nr-1);
899 for (tobl = list->
member; tobl; tobl = tobl->
next) {
903 if (otmp->
level <= summon_level && !mon_nr--)
907 LOG(
llevDebug,
"choose_cult_monster() mon_nr was set, but did not find a monster\n");
929 int summon_object(
object *op,
object *caster,
object *spell_ob,
int dir,
const char *stringarg) {
945 if (level < tr->magic)
948 if (stringarg && !strcmp(tr->
item->
name, stringarg))
957 "The spell fails to summon any monsters.", NULL);
960 summon_arch = lasttr->
item;
963 }
else if (spell_ob->
race && !strcmp(spell_ob->
race,
"GODCULTMON")) {
966 int summon_level, tries;
968 if (!god && ((owner =
get_owner(op)) != NULL)) {
978 "%s has no creatures that you may summon!",
979 "%s has no creatures that you may summon!",
985 if (summon_level == 0)
993 "%s fails to send anything.",
994 "%s fails to send anything.",
1007 "There is something in the way.", NULL);
1011 }
while (ndir == -1);
1012 if (mon->
level > (summon_level/2))
1016 summon_arch = mon->
arch;
1026 "There is no monsters available for summoning.", NULL);
1036 "There is something in the way.", NULL);
1041 mult = (RANDOM()%2 ? -1 : 1);
1043 for (i = 1; i <= nrof; i++) {
1045 object *prev = NULL, *head = NULL, *tmp;
1048 ndir =
absdir(dir+(i/2)*mult);
1061 for (atmp = summon_arch; atmp != NULL; atmp = atmp->
more) {
1063 if (atmp == summon_arch) {
1067 tmp->enemy = op->
enemy;
1084 tmp->speed_left = -1;
1093 tmp->
x = op->
x+x+tmp->arch->clone.x;
1094 tmp->y = op->
y+y+tmp->arch->clone.y;
1097 head->direction =
freedir[ndir];
1098 head->stats.exp = 0;
1100 if (head && head->randomitems) {
1120 object *realowner = ob;
1122 if (realowner == NULL)
1147 object *rowner, *towner;
1150 if ((target == NULL) || (pet == NULL) || (owner == NULL))
1163 if (rowner == NULL) {
1170 if (towner == NULL && target->
type !=
PLAYER) {
1171 LOG(
llevError,
"Target is not a player but has no owner. We should not be here.\n");
1190 if (target->
type !=
PLAYER && rowner == towner)
int find_dir_2(int x, int y)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
const char * determine_god(object *op)
static void mark_inventory_as_no_drop(object *ob)
void set_owner(object *op, object *owner)
object * check_enemy(object *npc, rv_vector *rv)
int caster_level(const object *caster, const object *spell)
EXTERN objectlink * first_friendly_object
int attack_ob(object *op, object *hitter)
void move_golem(object *op)
void get_search_arr(int *search_arr)
void free_string(sstring str)
#define MSG_TYPE_SPELL_FAILURE
struct treasureliststruct * randomitems
short freearr_x[SIZEOFFREE]
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
object * ranges[range_size]
void update_object(object *op, int action)
void control_golem(object *op, int dir)
int SP_level_dam_adjust(const object *caster, const object *spob)
#define OUT_OF_REAL_MAP(M, X, Y)
void remove_friendly_object(object *op)
const object * find_god(const char *name)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
struct archt * other_arch
int summon_object(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
short freearr_y[SIZEOFFREE]
int summon_golem(object *op, object *caster, int dir, object *spob)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
int rndm(int min, int max)
void remove_ob(object *op)
racelink * find_racelink(const char *name)
#define FLAG_UNAGGRESSIVE
void get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
int SP_level_duration_adjust(const object *caster, const object *spob)
int die_roll(int num, int size, const object *op, int goodbad)
void add_friendly_object(object *op)
object * get_owner(object *op)
int can_detect_enemy(object *op, object *enemy, rv_vector *rv)
void terminate_all_pets(object *owner)
#define OB_TYPE_MOVE_BLOCK(ob1, type)
mapstruct * get_map_from_coord(mapstruct *m, sint16 *x, sint16 *y)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
int move_ob(object *op, int dir, object *originator)
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
#define FREE_AND_CLEAR_STR(xyz)
int on_same_map(const object *op1, const object *op2)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
struct treasurestruct * items
void pet_move(object *ob)
sint16 resist[NROFATTACKS]
int snprintf(char *dest, int max, const char *format,...)
archetype * determine_holy_arch(const object *god, const char *type)
int SP_level_range_adjust(const object *caster, const object *spob)
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
int should_arena_attack(object *pet, object *owner, object *target)
static object * get_real_owner(object *ob)
void remove_all_pets(void)
sstring add_string(const char *str)
#define GET_MAP_OB(M, X, Y)
object * get_pet_enemy(object *pet, rv_vector *rv)
int find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
static object * fix_summon_pet(archetype *at, object *op, int dir, int is_golem)
int can_see_enemy(object *op, object *enemy)
#define MSG_TYPE_SPELL_PET
void LOG(LogLevel logLevel, const char *format,...)
static object * choose_cult_monster(object *pl, const object *god, int summon_level)
#define was_destroyed(op, old_tag)
object * find_nearest_living_creature(object *npc)
void free_object(object *ob)
int random_roll(int min, int max, const object *op, int goodbad)
struct treasurestruct * next
object * arch_to_object(archetype *at)
void follow_owner(object *ob, object *owner)
int ob_blocked(const object *ob, mapstruct *m, sint16 x, sint16 y)