![]() |
Crossfire Server, Trunk
1.75.0
|
#include "global.h"#include <assert.h>#include <ctype.h>#include <stdlib.h>#include <string.h>#include "sproto.h"
Include dependency graph for pets.cpp:Go to the source code of this file.
Functions | |
| static object * | choose_cult_monster (object *pl, const object *god, int summon_level) |
| Returns a monster (chosen at random) that this particular player (and his god) find acceptable. More... | |
| static object * | fix_summon_pet (archetype *at, object *op, int dir) |
| This makes multisquare/single square monsters proper for map insertion. More... | |
| static object * | get_real_owner (object *ob) |
| Recursively look through the owner property of objects until the real owner is found. More... | |
| static void | mark_inventory_as_no_drop (object *ob) |
| Mark all inventory items as FLAG_NO_DROP. More... | |
| void | pets_attempt_follow (object *for_owner, int force) |
| Check pets so they try to follow their master around the world. More... | |
| void | pets_control_golem (object *op, int dir) |
| Makes the golem go in specified direction. More... | |
| void | pets_follow_owner (object *ob, object *owner) |
| A pet is trying to follow its owner. More... | |
| object * | pets_get_enemy (object *pet, rv_vector *rv) |
| Given that 'pet' is a friendly object, this function returns a monster the pet should attack, NULL if nothing appropriate is found. More... | |
| void | pets_move (object *ob) |
| Handles a pet's movement. More... | |
| void | pets_move_golem (object *op) |
| Handles a golem's movement. More... | |
| int | pets_should_arena_attack (object *pet, object *owner, object *target) |
| Determines if checks so pets don't attack players or other pets should be overruled by the arena petmode. More... | |
| int | pets_summon_golem (object *op, object *caster, int dir, object *spob) |
| Summons a monster. More... | |
| int | pets_summon_object (object *op, object *caster, object *spell_ob, int dir, const char *stringarg) |
| General purpose summoning function. More... | |
| void | pets_terminate_all (object *owner) |
| Removes all pets someone owns. More... | |
Those functions deal with pets.
Definition in file pets.cpp.
Returns a monster (chosen at random) that this particular player (and his god) find acceptable.
This checks level, races allowed by god, etc to determine what is acceptable.
| pl | player summoning. |
| god | god the player worships. |
| summon_level | summoning level. |
Definition at line 819 of file pets.cpp.
References buf, draw_ext_info_format(), MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, object::name, NDI_UNIQUE, object::race, races_get_random_monster(), rndm(), and safe_strncpy.
Referenced by pets_summon_object().
Here is the call graph for this function:
Here is the caller graph for this function:This makes multisquare/single square monsters proper for map insertion.
| at | archetype to prepare. |
| op | caster of the spell |
| dir | direction the monster should be placed in. |
Definition at line 434 of file pets.cpp.
References add_friendly_object(), object::arch, arch_to_object(), AT_DRAIN, AT_GHOSTHIT, AT_PHYSICAL, object::attack_movement, CLEAR_FLAG, archetype::clone, create_treasure(), object::direction, object::enemy, living::exp, FLAG_CHANGING, FLAG_FRIENDLY, FLAG_GENERATOR, FLAG_MONSTER, FLAG_SPLITTING, FLAG_STAND_STILL, freearr_x, freearr_y, GOLEM, GT_STARTEQUIP, object::head, object::invisible, llevError, LOG(), object::map, mark_inventory_as_no_drop(), monster_check_apply_all(), object::more, archetype::more, object::move_type, MOVE_WALK, object::name, archetype::name, object_get_owner(), object_set_enemy(), object_set_owner(), PETMOVE, PLAYER, QUERY_FLAG, SET_FLAG, object::speed_left, object::stats, object::type, object::x, and object::y.
Referenced by pets_summon_golem().
Here is the call graph for this function:
Here is the caller graph for this function:Recursively look through the owner property of objects until the real owner is found.
| ob | item we're searching the owner of. |
Definition at line 1059 of file pets.cpp.
References object_get_owner().
Referenced by pets_should_arena_attack().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Mark all inventory items as FLAG_NO_DROP.
| ob | the object to modify. |
Definition at line 34 of file pets.cpp.
References FLAG_NO_DROP, FOR_INV_FINISH, FOR_INV_PREPARE, and SET_FLAG.
Referenced by fix_summon_pet(), and pets_summon_object().
Here is the caller graph for this function:| void pets_attempt_follow | ( | object * | for_owner, |
| int | force | ||
| ) |
Check pets so they try to follow their master around the world.
| for_owner | if NULL, check all pets, else only pets for this owner. |
| force | if non zero, then forcibly move the pet close to its owner. If zero then only check pets if they are not on the same map, as computed by on_same_map(), as their owner. |
Definition at line 249 of file pets.cpp.
References FABS, FLAG_FRIENDLY, FLAG_REMOVED, free_objectlink(), get_friends_of(), list, llevMonster, LOG(), MIN_ACTIVE_SPEED, object_free_drop_inventory(), object_get_owner(), on_same_map(), pets_follow_owner(), PLAYER, QUERY_FLAG, and remove_friendly_object().
Referenced by enter_map(), swap_map(), teleport(), and transfer_ob().
Here is the call graph for this function:
Here is the caller graph for this function:| void pets_control_golem | ( | object * | op, |
| int | dir | ||
| ) |
Makes the golem go in specified direction.
This is a really stupid function when you get down and look at it. Keep it here for the time being - makes life easier if we ever decide to do more interesting thing with controlled golems.
| op | golem. |
| dir | desired direction. |
Definition at line 630 of file pets.cpp.
References object::direction.
Referenced by animate_weapon(), and fire().
Here is the caller graph for this function:A pet is trying to follow its owner.
| ob | pet trying to follow. Will be object_remove()'d if can't follow. |
| owner | owner of ob. |
Definition at line 284 of file pets.cpp.
References draw_ext_info, FLAG_REMOVED, freearr_x, freearr_y, mapstruct::in_memory, llevError, llevMonster, LOG(), object::map, MAP_IN_MEMORY, MSG_TYPE_SPELL, MSG_TYPE_SPELL_PET, object::name, NDI_UNIQUE, object_find_free_spot(), object_insert_in_map_at(), object_remove(), PLAYER, QUERY_FLAG, SIZEOFFREE, object::type, object::x, and object::y.
Referenced by monster_move(), pets_attempt_follow(), and pets_move().
Here is the call graph for this function:
Here is the caller graph for this function:Given that 'pet' is a friendly object, this function returns a monster the pet should attack, NULL if nothing appropriate is found.
it basically looks for nasty things around the owner of the pet to attack. This is now tilemap aware.
| pet | who is seeking an enemy. | |
| [out] | rv | will contain the path to the enemy. |
Definition at line 54 of file pets.cpp.
References object::attack_movement, object::attacked_by, object::attacked_by_count, CLEAR_FLAG, object::contr, object::count, FLAG_ALIVE, FLAG_CONFUSED, FLAG_FRIENDLY, FLAG_UNAGGRESSIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), get_rangevector(), get_search_arr(), HEAD, object::map, monster_can_detect_enemy(), monster_can_see_enemy(), monster_check_enemy(), monster_find_nearest_enemy(), object_get_owner(), object_set_enemy(), on_same_map(), P_IS_ALIVE, P_OUT_OF_MAP, pet_defend, pet_sad, player::petmode, PETMOVE, pets_should_arena_attack(), PLAYER, QUERY_FLAG, remove_friendly_object(), SIZEOFFREE, object::type, object::x, and object::y.
Referenced by monster_find_enemy().
Here is the call graph for this function:
Here is the caller graph for this function:| void pets_move | ( | object * | ob | ) |
Handles a pet's movement.
| ob | pet to move. |
Definition at line 317 of file pets.cpp.
References absdir(), object::contr, object::count, object::direction, rv_vector::direction, draw_ext_info, object::enemy, FLAG_ALIVE, FLAG_FRIENDLY, FLAG_UNAGGRESSIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), get_map_from_coord(), GET_MAP_MOVE_BLOCK, get_random_dir(), get_rangevector(), HEAD, llevMonster, LOG(), m, object::map, object::more, move_ob(), MSG_SUBTYPE_NONE, MSG_TYPE_MISC, NDI_UNIQUE, OB_TYPE_MOVE_BLOCK, object_free_drop_inventory(), object_get_owner(), object_remove(), object_set_enemy(), object_was_destroyed, on_same_map(), P_OUT_OF_MAP, pet_sad, player::petmode, pets_follow_owner(), PLAYER, QUERY_FLAG, RANDOM, remove_friendly_object(), object::type, object::x, and object::y.
Referenced by monster_move_no_enemy().
Here is the call graph for this function:
Here is the caller graph for this function:| void pets_move_golem | ( | object * | op | ) |
Handles a golem's movement.
Updated this to allow more than the golem 'head' to attack.
| op | golem to be moved. |
Definition at line 519 of file pets.cpp.
References attack_ob(), object::contr, object::count, object::direction, DIRX, DIRY, draw_ext_info, draw_ext_info_format(), FLAG_ALIVE, FLAG_MONSTER, FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_flags(), player::golem_count, object::head, living::hp, llevDebug, LOG(), m, object::map, object::more, move_ob(), object::msg, MSG_TYPE_SPELL, MSG_TYPE_SPELL_PET, object::name, NDI_UNIQUE, object_free_drop_inventory(), object_get_owner(), object_remove(), object_update(), object_was_destroyed, P_OUT_OF_MAP, QUERY_FLAG, object::race, range_golem, player::ranges, remove_friendly_object(), object::stats, UP_OBJ_FACE, object::x, and object::y.
Referenced by legacy_ob_process().
Here is the call graph for this function:
Here is the caller graph for this function:Determines if checks so pets don't attack players or other pets should be overruled by the arena petmode.
| pet | pet considered. |
| owner | pet's owner. |
| target | potential pet target. |
| 0 | pet shouldn't attack target. |
| 1 | target is a suitable victim for the pet. |
Definition at line 1086 of file pets.cpp.
References object::contr, get_real_owner(), llevError, LOG(), op_on_battleground(), player::party, pet_arena, player::petmode, PLAYER, and object::type.
Referenced by monster_check_enemy(), and pets_get_enemy().
Here is the call graph for this function:
Here is the caller graph for this function:Summons a monster.
| op | who is summoning. |
| caster | object casting the spell. |
| dir | direction to place the monster. |
| spob | spell object casting. At this stage, all spob is really used for is to adjust some values in the monster. |
| 0 | failed to summon something. |
| 1 | summoned correctly something. |
Definition at line 651 of file pets.cpp.
References add_friendly_object(), add_string(), AT_PHYSICAL, object::attack_movement, object::attacktype, buf, caster_level(), archetype::clone, object::contr, object::count, living::dam, determine_god(), determine_holy_arch(), object::direction, draw_ext_info, draw_ext_info_format(), object::duration, living::exp, FABS, find_god(), fix_summon_pet(), FLAG_FRIENDLY, FLAG_MONSTER, FREE_AND_CLEAR_STR, free_string(), freearr_x, freearr_y, GOLEM, player::golem_count, living::hp, llevError, LOG(), object::map, MAX, MAX_BUF, living::maxgrace, living::maxhp, MIN, object::more, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_PET, object::name, NDI_UNIQUE, ob_blocked(), object_find_free_spot(), object_free_drop_inventory(), object_get_owner(), object_insert_in_map_at(), object_remove(), object_set_owner(), object::other_arch, PETMOVE, PLAYER, QUERY_FLAG, object::race, range_golem, player::ranges, object::resist, SET_FLAG, set_spell_skill(), player::shoottype, SIZEOFFREE1, object::slaying, living::sp, SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), SP_level_wc_adjust(), object::speed, object::speed_left, object::stats, object::type, living::wc, object::x, and object::y.
Referenced by cast_spell().
Here is the call graph for this function:
Here is the caller graph for this function:| int pets_summon_object | ( | object * | op, |
| object * | caster, | ||
| object * | spell_ob, | ||
| int | dir, | ||
| const char * | stringarg | ||
| ) |
General purpose summoning function.
| op | who is summoning. |
| caster | what object did cast the summoning spell. |
| spell_ob | actual spell object for summoning. |
| dir | direction to summon in. |
| stringarg | additional parameters. |
| 0 | nothing was summoned. |
| 1 | something was summoned. |
Definition at line 872 of file pets.cpp.
References absdir(), add_friendly_object(), object::arch, arch_to_object(), object::attack_movement, caster_level(), choose_cult_monster(), CLEAR_FLAG, archetype::clone, create_treasure(), living::dam, determine_god(), die_roll(), object::direction, draw_ext_info, draw_ext_info_format(), object::enemy, find_god(), FLAG_FRIENDLY, FLAG_MONSTER, FLAG_SLEEP, freearr_x, freearr_y, freedir, GT_STARTEQUIP, treasure::item, treasurelist::items, object::level, level, llevError, LOG(), object::map, mark_inventory_as_no_drop(), MIN_ACTIVE_SPEED, monster_check_apply_all(), object::more, archetype::more, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, treasurelist::name, object::name, archetype::name, NDI_UNIQUE, treasure::next, treasure::nrof, ob_blocked(), object_find_free_spot(), object_get_owner(), object_insert_in_map_at(), object_set_enemy(), object_set_owner(), object::other_arch, PLAYER, PREFER_HIGH, QUERY_FLAG, object::race, RANDOM, random_roll(), object::randomitems, SET_FLAG, set_spell_skill(), SIZEOFFREE, SP_level_dam_adjust(), object::stats, object::type, object::x, and object::y.
Referenced by cast_spell().
Here is the call graph for this function:
Here is the caller graph for this function:| void pets_terminate_all | ( | object * | owner | ) |
Removes all pets someone owns.
| owner | player we wish to remove all pets of. |
Definition at line 225 of file pets.cpp.
References FLAG_REMOVED, free_objectlink(), get_friends_of(), objectlink::next, objectlink::ob, object_free_drop_inventory(), object_remove(), QUERY_FLAG, and remove_friendly_object().
Referenced by apply_savebed(), command_kill_pets(), key_confirm_quit(), leave(), and save_player().
Here is the call graph for this function:
Here is the caller graph for this function: