Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Functions | |
static object * | choose_cult_monster (object *pl, const object *god, int summon_level) |
void | control_golem (object *op, int dir) |
static object * | fix_summon_pet (archetype *at, object *op, int dir, int is_golem) |
void | follow_owner (object *ob, object *owner) |
object * | get_pet_enemy (object *pet, rv_vector *rv) |
static object * | get_real_owner (object *ob) |
static void | mark_inventory_as_no_drop (object *ob) |
void | move_golem (object *op) |
void | pet_move (object *ob) |
void | remove_all_pets (void) |
int | should_arena_attack (object *pet, object *owner, object *target) |
int | summon_golem (object *op, object *caster, int dir, object *spob) |
int | summon_object (object *op, object *caster, object *spell_ob, int dir, const char *stringarg) |
void | terminate_all_pets (object *owner) |
Those functions deal with pets.
Definition in file pets.c.
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 837 of file pets.c.
References draw_ext_info_format(), find_racelink(), FLAG_MONSTER, obj::level, llevDebug, LOG(), MAX_BUF, ralnk::member, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, obj::name, NDI_UNIQUE, oblnk::next, oblnk::ob, QUERY_FLAG, obj::race, and rndm().
Referenced by summon_object().
void 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 648 of file pets.c.
References obj::direction.
Referenced by animate_weapon(), and fire().
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. |
is_golem | if set then this is a golem spell. |
Definition at line 464 of file pets.c.
References add_friendly_object(), obj::arch, arch_to_object(), AT_DRAIN, AT_GHOSTHIT, AT_PHYSICAL, obj::attack_movement, CLEAR_FLAG, archt::clone, create_treasure(), obj::direction, obj::enemy, liv::exp, FLAG_CHANGING, FLAG_FRIENDLY, FLAG_GENERATOR, FLAG_MONSTER, FLAG_SPLITTING, FLAG_STAND_STILL, freearr_x, freearr_y, get_owner(), GOLEM, GT_APPLY, GT_STARTEQUIP, obj::head, obj::invisible, obj::map, mark_inventory_as_no_drop(), obj::more, archt::more, PETMOVE, PLAYER, QUERY_FLAG, SET_FLAG, set_owner(), obj::speed_left, obj::stats, obj::type, obj::x, and obj::y.
Referenced by summon_golem().
A pet is trying to follow its owner.
ob | pet trying to follow. Will be remove_ob()'d if can't follow. |
owner | owner of ob. |
Definition at line 306 of file pets.c.
References obj::arch, archt::clone, draw_ext_info(), find_free_spot(), FLAG_REMOVED, freearr_x, freearr_y, get_map_from_coord(), mapdef::in_memory, insert_ob_in_map(), llevError, llevMonster, LOG(), obj::map, MAP_IN_MEMORY, obj::more, MSG_TYPE_SPELL, MSG_TYPE_SPELL_PET, obj::name, NDI_UNIQUE, OUT_OF_REAL_MAP, PLAYER, QUERY_FLAG, remove_ob(), SIZEOFFREE, obj::type, obj::x, and obj::y.
Referenced by move_monster(), pet_move(), and remove_all_pets().
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 67 of file pets.c.
References obj::above, obj::attack_movement, obj::attacked_by, obj::attacked_by_count, can_detect_enemy(), can_see_enemy(), check_enemy(), CLEAR_FLAG, obj::contr, obj::count, obj::enemy, find_nearest_living_creature(), FLAG_ALIVE, FLAG_CONFUSED, FLAG_FRIENDLY, FLAG_UNAGGRESSIVE, freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, get_owner(), get_rangevector(), get_search_arr(), obj::head, obj::map, on_same_map(), P_IS_ALIVE, P_OUT_OF_MAP, pet_defend, pet_normal, pet_sad, pl::petmode, PETMOVE, PLAYER, QUERY_FLAG, remove_friendly_object(), should_arena_attack(), SIZEOFFREE, obj::type, obj::x, and obj::y.
Referenced by find_enemy().
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 1119 of file pets.c.
References get_owner().
Referenced by should_arena_attack().
|
static |
Mark all inventory items as FLAG_NO_DROP.
ob | the object to modify. |
Definition at line 45 of file pets.c.
References obj::below, FLAG_NO_DROP, obj::inv, and SET_FLAG.
Referenced by fix_summon_pet(), and summon_object().
void 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 541 of file pets.c.
References obj::above, attack_ob(), obj::contr, obj::count, obj::direction, draw_ext_info(), draw_ext_info_format(), FLAG_ALIVE, FLAG_MONSTER, free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, get_owner(), pl::golem_count, obj::head, liv::hp, llevDebug, LOG(), obj::map, obj::more, move_ob(), obj::msg, MSG_TYPE_SPELL, MSG_TYPE_SPELL_PET, obj::name, NDI_UNIQUE, obj::owner, P_OUT_OF_MAP, QUERY_FLAG, obj::race, range_golem, pl::ranges, remove_friendly_object(), remove_ob(), obj::stats, UP_OBJ_FACE, update_object(), was_destroyed, obj::x, and obj::y.
Referenced by legacy_ob_process().
void pet_move | ( | object * | ob | ) |
Handles a pet's movement.
ob | pet to move. |
Definition at line 348 of file pets.c.
References obj::above, absdir(), obj::contr, obj::count, obj::direction, draw_ext_info(), obj::enemy, find_dir_2(), FLAG_ALIVE, FLAG_FRIENDLY, FLAG_UNAGGRESSIVE, follow_owner(), free_object(), freearr_x, freearr_y, get_map_flags(), get_map_from_coord(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, get_owner(), obj::head, llevMonster, LOG(), obj::map, obj::more, move_ob(), MSG_SUBTYPE_NONE, MSG_TYPE_MISC, NDI_UNIQUE, OB_TYPE_MOVE_BLOCK, on_same_map(), obj::owner, P_OUT_OF_MAP, pet_sad, pl::petmode, PLAYER, QUERY_FLAG, remove_friendly_object(), remove_ob(), rndm(), obj::type, was_destroyed, obj::x, and obj::y.
Referenced by monster_move_no_enemy().
void remove_all_pets | ( | void | ) |
This function checks all pets so they try to follow their master around the world.
Unfortunately, sometimes, the owner of a pet is in the process of entering a new map when this is called. Thus the map isn't loaded yet, and we have to remove the pet...
Definition at line 273 of file pets.c.
References FABS, first_friendly_object, FLAG_FRIENDLY, FLAG_REMOVED, follow_owner(), free_object(), get_owner(), llevMonster, LOG(), MIN_ACTIVE_SPEED, oblnk::next, oblnk::ob, on_same_map(), PLAYER, QUERY_FLAG, remove_friendly_object(), obj::speed, and obj::type.
Referenced by enter_map(), and swap_map().
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 1146 of file pets.c.
References obj::contr, get_real_owner(), llevError, LOG(), op_on_battleground(), pl::party, pet_arena, pl::petmode, PLAYER, and obj::type.
Referenced by check_enemy(), and get_pet_enemy().
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 669 of file pets.c.
References add_friendly_object(), add_string(), AT_PHYSICAL, obj::attack_movement, obj::attacktype, caster_level(), archt::clone, obj::contr, obj::count, liv::dam, determine_god(), determine_holy_arch(), obj::direction, draw_ext_info(), draw_ext_info_format(), obj::duration, liv::exp, FABS, find_free_spot(), find_god(), fix_summon_pet(), FLAG_FRIENDLY, FLAG_MONSTER, FREE_AND_CLEAR_STR, free_object(), free_string(), freearr_x, freearr_y, get_owner(), GOLEM, pl::golem_count, liv::hp, insert_ob_in_map(), llevError, LOG(), obj::map, MAX, MAX_BUF, liv::maxgrace, MIN, obj::more, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_PET, obj::name, NDI_UNIQUE, ob_blocked(), obj::other_arch, PETMOVE, PLAYER, QUERY_FLAG, obj::race, range_golem, pl::ranges, remove_ob(), obj::resist, SET_FLAG, set_owner(), set_spell_skill(), pl::shoottype, SIZEOFFREE1, obj::slaying, snprintf(), liv::sp, SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), obj::speed, obj::speed_left, obj::stats, obj::type, liv::wc, obj::x, and obj::y.
Referenced by cast_spell().
int 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 929 of file pets.c.
References absdir(), add_friendly_object(), obj::arch, arch_to_object(), obj::attack_movement, caster_level(), choose_cult_monster(), CLEAR_FLAG, archt::clone, create_treasure(), liv::dam, determine_god(), die_roll(), draw_ext_info(), draw_ext_info_format(), obj::enemy, find_free_spot(), find_god(), FLAG_FRIENDLY, FLAG_MONSTER, FLAG_SLEEP, freearr_x, freearr_y, freedir, get_map_from_coord(), get_owner(), GT_APPLY, GT_STARTEQUIP, insert_ob_in_map(), treasurestruct::item, treasureliststruct::items, obj::level, llevError, LOG(), obj::map, mark_inventory_as_no_drop(), MIN_ACTIVE_SPEED, mon, obj::more, archt::more, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, treasureliststruct::name, obj::name, archt::name, NDI_UNIQUE, treasurestruct::next, treasurestruct::nrof, ob_blocked(), obj::other_arch, PLAYER, PREFER_HIGH, QUERY_FLAG, obj::race, random_roll(), obj::randomitems, SET_FLAG, set_owner(), set_spell_skill(), SIZEOFFREE, SP_level_dam_adjust(), obj::stats, obj::type, obj::x, and obj::y.
Referenced by cast_spell().
void terminate_all_pets | ( | object * | owner | ) |
Removes all pets someone owns.
owner | player we wish to remove all pets of. |
Definition at line 250 of file pets.c.
References first_friendly_object, FLAG_REMOVED, free_object(), get_owner(), oblnk::next, oblnk::ob, QUERY_FLAG, remove_friendly_object(), and remove_ob().
Referenced by apply_savebed(), check_login(), command_kill_pets(), do_server(), key_confirm_quit(), and save_player().