 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
61 int fire_bolt(
object *op,
object *caster,
int dir,
object *spob) {
126 LOG(
llevError,
"BUG: explode_bullet(): op without other_arch\n");
137 LOG(
llevError,
"BUG: explode_bullet(): env out of map\n");
145 LOG(
llevError,
"BUG: explode_bullet(): op out of map\n");
240 tmp_tag = tmp->count;
299 int i, success = 0, range_min = -1, range_max = 1;
304 if (!
spell->other_arch)
321 movetype =
spell->other_arch->clone.move_type;
323 for (i = range_min; i <= range_max; i++) {
404 LOG(
llevDebug,
"cast_cone(): arch %s doesn't have flying 1\n",
spell->other_arch->name);
407 LOG(
llevDebug,
"cast_cone(): arch %s doesn't have move_on set\n",
spell->other_arch->name);
505 for (dist = 1; dist < range; dist++) {
522 if (target != NULL) {
547 object *effect, *target;
565 || (!god &&
spell->stats.grace)
567 || (target->
race && god && strstr(target->
race, god->
race))) {
572 if (
spell->other_arch)
583 "%s answers your call!",
610 "The %s looks stronger!",
688 if (!tmp->
env || op != tmp->
env) {
689 LOG(
llevError,
"make_object_glow() failed to insert glowing force in %s\n", op->
name);
708 int i, j, range, mflags,
friendly = 0, dam, dur;
711 object *tmp, *found_skill;
729 else if (caster->
skill)
738 for (i = -range; i < range; i++) {
739 for (j = -range; j < range; j++) {
800 int cast_curse(
object *op,
object *caster,
object *spell_ob,
int dir) {
814 if (inv->name == spell_ob->
name) {
817 }
else if (spell_ob->
race && spell_ob->
race == inv->name) {
820 "You can not cast %s while %s is in effect",
860 "You are a victim of %s's curse!",
907 int done_one, range, mflags,
level, at, best_at, immunity_chance = 50;
908 int16_t x, y, nx, ny;
920 immunity_chance = atoi(race);
921 if (immunity_chance < 0 || immunity_chance > 100) {
922 LOG(
llevError,
"ignoring invalid immunity_chance %d for %s\n", immunity_chance,
spell->arch->name);
923 immunity_chance = 50;
933 else if (god && !strcmp(
spell->race,
"GOD_SLAYING"))
935 else if (god && !strcmp(
spell->race,
"GOD_FRIEND"))
940 for (x = op->
x-range; x <= op->x+range; x++)
941 for (y = op->
y-range; y <= op->y+range; y++) {
958 if (race && head->
race && !strstr(race, head->
race))
965 if (
spell->attacktype) {
967 if (
spell->attacktype&(1<<at))
968 if (best_at == -1 || head->
resist[at] > head->
resist[best_at])
974 if (head->
resist[best_at] == 100)
977 at = head->
resist[best_at]/5;
1061 if (done_one &&
spell->other_arch) {
1092 if (!
spell->other_arch)
1109 for (i = 0; i <
spell->duration; i++)
1137 object *target = NULL, *tmp = NULL;
1162 if (target != NULL) {
1178 LOG(
llevError,
"Error: spell arch for cast_light() missing.\n");
1182 if (tmp->glow_radius) {
1209 int i, mflags, range, dam_mod, dur_mod;
1210 object *target_head;
1230 for (i = 1; i < range; i++) {
1249 target_head =
HEAD(walk);
1260 disease->
stats.
wc += dur_mod/2;
1262 if (disease->
magic > 0)
1263 disease->
magic += dur_mod/4;
1279 disease->
last_sp -= 2*dam_mod;
int SP_level_range_adjust(const object *caster, const object *spob)
Adjust the range of the spell based on level.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
sstring name_pl
The plural name of the object.
#define FORCE_CHANGE_ABILITY
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
Utility function to assign the correct skill when casting.
static int make_object_glow(object *op, int radius, int time)
Makes living objects glow.
object * object_get_env_recursive(object *op)
Utility function.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be friendly
void object_update_turn_face(object *op)
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the ot...
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
int16_t maxhp
Max hit points.
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FLAG_UNDEAD
Monster is undead.
#define FLAG_GENERATOR
Will generate type ob->stats.food.
int get_fear_bonus(int stat)
#define QUERY_FLAG(xyz, p)
int fire_swarm(object *op, object *caster, object *spell, int dir)
The following routine creates a swarm of objects.
uint16_t attack_movement
What kind of attack movement.
int absdir(int d)
Computes an absolute direction.
int tailor_god_spell(object *spellop, object *caster)
Changes the attributes of cone, smite, and ball spells as needed by the code.
int8_t range
Range of the spell.
float speed
Frequency of object 'moves' relative to server tick rate.
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
int16_t invisible
How much longer the object will be invis.
int mood_change(object *op, object *caster, object *spell)
This covers the various spells that change the moods of monsters - makes them angry,...
float speed_left
How much speed is left to spend this round.
struct mapstruct * map
Pointer to the map in which this object is present.
int infect_object(object *victim, object *disease, int force)
Try to infect something with a disease.
unsigned char MoveType
Typdef here to define type large enough to hold bitmask of all movement types.
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
static object * get_pointed_target(object *op, int dir, int range, int type)
Returns the pointer to the first monster in the direction which is pointed to by op.
int create_bomb(object *op, object *caster, int dir, object *spell)
Create a bomb.
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define MSG_TYPE_VICTIM_SPELL
Someone cast a bad spell on the player.
int SP_level_duration_adjust(const object *caster, const object *spob)
Adjust the duration of the spell based on level.
int8_t direction
Means the object is moving that way.
tag_t count
Unique object number for this object.
int16_t last_grace
As last_sp, except for grace.
int change_skill(object *who, object *new_skill, int flag)
This changes the object's skill to new_skill.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
int hit_map(object *op, int dir, uint32_t type, int full_hit)
Attack a spot on the map.
#define P_NO_MAGIC
Spells (some) can't pass this object.
sstring title
Of foo, etc.
const char * object_get_value(const object *op, const char *const key)
Get an extra value by key.
#define P_IS_ALIVE
Something alive is on this space.
#define FLAG_APPLIED
Object is ready for use by living.
int16_t level
Level of creature or object.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
#define HUGE_BUF
Used for messages - some can be quite long.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
const object * find_god(const char *name)
Returns a god's object from its name.
#define FLAG_ALIVE
Object can fight (or be fought)
uint32_t path_denied
Paths the object is denied access to.
void cone_drop(object *op)
Drops an object based on what is in the cone's "other_arch".
#define MSG_TYPE_SPELL_SUCCESS
Spell succeeded messages.
void check_bullet(object *op)
Checks to see what op should do, given the space it is on (eg, explode, damage player,...
uint32_t path_repelled
Paths the object is repelled from.
int16_t y
Position in the map for this object.
static event_registration m
#define FLAG_NO_ATTACK
monster don't attack
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
int cast_light(object *op, object *caster, object *spell, int dir)
Illuminates something on a map, or try to blind a living thing.
void explode_bullet(object *op)
Causes an object to explode, eg, a firebullet, poison cloud ball, etc.
uint8_t subtype
Subtype of object.
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
const char * determine_god(object *op)
Determines if op worships a god.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
#define ARCH_DETECT_MAGIC
Archetype for detect magic spell.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
#define MOVE_WALK
Object walks.
object * spell
Spell that was being cast.
#define HEAD(op)
Returns the head part of an object.
MoveType move_type
Type of movement this object uses.
int out_of_map(mapstruct *m, int x, int y)
Return 1 if coordinates X and Y are out of the map M, taking into account tiling.
int32_t last_eat
How long since we last ate.
uint8_t type
PLAYER, BULLET, etc.
#define INS_NO_MERGE
Don't try to merge with other items.
int16_t dam
How much damage this object does when hitting.
int8_t magic
Any magical bonuses to this item.
with a maximum of six This is not so if you are wearing plate you receive no benefit Armour is additive with all the supplementry forms of which means that it lasts until the next semi permanent spell effect is cast upon the character spell
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
MoveType move_on
Move types affected moving on to this space.
int32_t food
How much food in stomach.
int caster_level(const object *caster, const object *spell)
This function returns the effective level the spell is being cast at.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
uint32_t tag_t
Object tag, unique during the whole game.
int cast_curse(object *op, object *caster, object *spell_ob, int dir)
Curse an object, reducing its statistics.
#define MSG_TYPE_SPELL
Spell related info.
object * map_find_by_flag(mapstruct *map, int x, int y, int flag)
Finds an object in a map tile by flag number.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
sstring race
Human, goblin, dragon, etc.
int8_t facing
Object is oriented/facing that way.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
#define FLAG_MONSTER
Will attack players.
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level,...
#define P_OUT_OF_MAP
This space is outside the map.
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define INS_ON_TOP
Always put object on top.
How to Install a Crossfire Server on you must install a python script engine on your computer Python is the default script engine of Crossfire You can find the python engine you have only to install them The VisualC Crossfire settings are for d
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
#define MOVE_FLY_LOW
Low flying object.
int16_t maxgrace
Maximum grace.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
int cast_smite_spell(object *op, object *caster, int dir, object *spell)
The priest points to a creature and causes a 'godly curse' to descend.
#define FLAG_REMOVED
Object is not in any map or invenory.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
uint8_t dam_modifier
How going up in level affects damage.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring slaying
Which race to do double damage to.
int8_t glow_radius
indicates the glow radius of the object
#define FLAG_FRIENDLY
Will help players.
sstring name
The name of the object, obviously...
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
int SP_level_dam_adjust(const object *caster, const object *spob)
Returns adjusted damage based on the caster.
#define MSG_TYPE_SPELL_FAILURE
Spell failure messages.
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
int16_t maxsp
Max spell points.
object * env
Pointer to the object which is the environment.
int32_t last_sp
As last_heal, but for spell points.
sstring skill
Name of the skill this object uses/grants.
#define MSG_TYPE_SPELL_ERROR
Spell failure messages.
int get_turn_bonus(int stat)
int did_make_save(const object *op, int level, int bonus)
This function takes an object (monster/player, op), and determines if it makes a basic save throw by ...
#define FLAG_REFLECTING
Object reflects from walls (lightning)
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
Object is attacked by something.
#define CLEAR_FLAG(xyz, p)
int cast_cause_disease(object *op, object *caster, object *spell, int dir)
Let's try to infect something.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
void share_exp(object *op, int64_t exp, const char *skill, int flag)
Gives experience to a player/monster, sharing it with party if applicable.
int16_t duration
Number of moves (see 'speed') spell lasts.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
#define FLAG_BERSERK
monster will attack closest living object
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
#define OB_TYPE_MOVE_BLOCK(ob1, type)
Basic macro to see if if ob1 can not move onto a space based on the 'type' move_block parameter Add c...
#define P_NO_CLERIC
No clerical spells cast here.
void object_copy_owner(object *op, object *clone)
Set the owner to clone's current owner and set the skill and experience objects to clone's objects (t...
#define SK_EXP_ADD_SKILL
Give the player the skill.
#define PETMOVE
If the upper four bits of attack_movement are set to this number, the monster follows a player until ...
living stats
Str, Con, Dex, etc.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_SLEEP
NPC is sleeping.
int cast_destruction(object *op, object *caster, object *spell_ob)
Hit all monsters around the caster.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int fire_bolt(object *op, object *caster, int dir, object *spob)
Cast a bolt-like spell.
#define MAX_LIGHT_RADII
Max radii for 'light' object, really large values allow objects that can slow down the game.
@ llevDebug
Only for debugging purposes.
int cast_cone(object *op, object *caster, int dir, object *spell)
Casts a cone spell.