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");
235 if (!(mflags&P_IS_ALIVE))
240 tmp_tag = tmp->count;
299 int i, success = 0, range_min = -1, range_max = 1;
323 for (i = range_min; i <= range_max; i++) {
344 if (caster->
type !=
RUNE && d == 0) {
505 for (dist = 1; dist < range; dist++) {
522 if (target != NULL) {
547 object *effect, *target;
567 || (target->
race && god && strstr(target->
race, god->
race))) {
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++) {
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))
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;
995 if (head->
level > level)
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 cast_cone(object *op, object *caster, int dir, object *spell)
Casts a cone spell.
#define AT_HOLYWORD
Damage based on race and caster's god.
uint16_t attack_movement
What kind of attack movement.
const char * determine_god(object *op)
Determines if op worships a god.
void explode_bullet(object *op)
Causes an object to explode, eg, a firebullet, poison cloud ball, etc.
#define MOVE_WALK
Object walks.
#define FORCE_CHANGE_ABILITY
int change_skill(object *who, object *new_skill, int flag)
This changes the object's skill to new_skill.
Spell-related defines: spellpath, subtypes, ...
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 ...
struct archetype * arch
Pointer to archetype.
const object * find_god(const char *name)
Returns a god's object from its name.
#define FLAG_SLEEP
NPC is sleeping.
int caster_level(const object *caster, const object *spell)
This function returns the effective level the spell is being cast at.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
#define MAX_LIGHT_RADII
Max radii for 'light' object, really large values allow objects that can slow down the game...
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.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
int8_t direction
Means the object is moving that way.
int cast_curse(object *op, object *caster, object *spell_ob, int dir)
Curse an object, reducing its statistics.
#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...
int get_turn_bonus(int stat)
int create_bomb(object *op, object *caster, int dir, object *spell)
Create a bomb.
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 ARCH_DETECT_MAGIC
Archetype for detect magic spell.
#define FLAG_FRIENDLY
Will help players.
#define P_NO_MAGIC
Spells (some) can't pass this object.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
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 MSG_TYPE_SPELL
Spell related info.
int16_t maxgrace
Maximum grace.
#define MSG_TYPE_SPELL_FAILURE
Spell failure messages.
#define HUGE_BUF
Used for messages - some can be quite long.
sstring slaying
Which race to do double damage to.
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
unsigned char MoveType
Typdef here to define type large enough to hold bitmask of all movement types.
int16_t y
Position in the map for this object.
int8_t magic
Any magical bonuses to this item.
int SP_level_dam_adjust(const object *caster, const object *spob)
Returns adjusted damage based on the caster.
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
int16_t duration
Number of moves (see 'speed') spell lasts.
MoveType move_on
Move types affected moving on to this space.
#define FLAG_NO_ATTACK
monster don't attack
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...
uint32_t path_repelled
Paths the object is repelled from.
#define FLAG_REFLECTING
Object reflects from walls (lightning)
Global type definitions and header inclusions.
#define PETMOVE
If the upper four bits of attack_movement are set to this number, the monster follows a player until ...
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
#define MSG_TYPE_VICTIM_SPELL
Someone cast a bad spell on the player.
#define FLAG_REMOVED
Object is not in any map or invenory.
int cast_light(object *op, object *caster, object *spell, int dir)
Illuminates something on a map, or try to blind a living thing.
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define AT_TURN_UNDEAD
Like Fear, but for undead only (8192)
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
#define FLAG_UNDEAD
Monster is undead.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
int16_t level
Level of creature or object.
object * spell
Spell that was being cast.
#define AT_GODPOWER
Adds relevant god's attacktype (1048576) peterm@soda.berkeley.edu.
int cast_destruction(object *op, object *caster, object *spell_ob)
Hit all monsters around the caster.
#define FLAG_ALIVE
Object can fight (or be fought)
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
sstring name
More definite name, like "generate_kobold".
#define MSG_TYPE_SPELL_SUCCESS
Spell succeeded messages.
#define INS_ON_TOP
Always put object on top.
int8_t range
Range of the spell.
float speed
Frequency of object 'moves' relative to server tick rate.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define MOVE_FLY_LOW
Low flying object.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
object * env
Pointer to the object which is the environment.
int32_t last_sp
As last_heal, but for spell points.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
#define QUERY_FLAG(xyz, p)
int get_fear_bonus(int stat)
void query_name(const object *op, char *buf, size_t size)
Describes an item.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
int SP_level_duration_adjust(const object *caster, const object *spob)
Adjust the duration of the spell based on level.
#define MSG_TYPE_SPELL_ERROR
Spell failure messages.
sstring race
Human, goblin, dragon, etc.
void check_bullet(object *op)
Checks to see what op should do, given the space it is on (eg, explode, damage player, etc).
int hit_map(object *op, int dir, uint32_t type, int full_hit)
Attack a spot on the map.
int mood_change(object *op, object *caster, object *spell)
This covers the various spells that change the moods of monsters - makes them angry, peaceful, friendly, etc.
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. ...
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
int infect_object(object *victim, object *disease, int force)
Try to infect something with a disease.
int8_t glow_radius
indicates the glow radius of the object
uint8_t dam_modifier
How going up in level affects damage.
#define P_OUT_OF_MAP
This space is outside the map.
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
int cast_cause_disease(object *op, object *caster, object *spell, int dir)
Let's try to infect something.
object * object_get_env_recursive(object *op)
Utility function.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
uint32_t tag_t
Object tag, unique during the whole game.
int16_t dam
How much damage this object does when hitting.
#define HEAD(op)
Returns the head part of an object.
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".
living stats
Str, Con, Dex, etc.
int16_t invisible
How much longer the object will be invis.
#define FLAG_BERSERK
monster will attack closest living object
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
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.
object * map_find_by_flag(mapstruct *map, int x, int y, int flag)
Finds an object in a map tile by flag number.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
int8_t facing
Object is oriented/facing that way.
int fire_swarm(object *op, object *caster, object *spell, int dir)
The following routine creates a swarm of objects.
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
int tailor_god_spell(object *spellop, object *caster)
Changes the attributes of cone, smite, and ball spells as needed by the code.
sstring name_pl
The plural name of the object.
Object structure, the core of Crossfire.
#define FLAG_GENERATOR
Will generate type ob->stats.food.
#define INS_NO_MERGE
Don't try to merge with other items.
static event_registration m
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.
int SP_level_range_adjust(const object *caster, const object *spob)
Adjust the range of the spell based on level.
MoveType move_type
Type of movement this object uses.
sstring name
The name of the object, obviously...
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
Utility function to assign the correct skill when casting.
sstring title
Of foo, etc.
Only for debugging purposes.
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_...
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
#define SK_EXP_ADD_SKILL
Give the player the skill.
#define CLEAR_FLAG(xyz, p)
uint8_t type
PLAYER, BULLET, etc.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define FLAG_APPLIED
Object is ready for use by living.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
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.
#define AT_MAGIC
All magic spells, but not prayers (2)
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 MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
sstring skill
Name of the skill this object uses/grants.
static int make_object_glow(object *op, int radius, int time)
Makes living objects glow.
int16_t maxsp
Max spell points.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
#define NDI_UNIQUE
Print immediately, don't buffer.
int fire_bolt(object *op, object *caster, int dir, object *spob)
Cast a bolt-like spell.
int absdir(int d)
Computes an absolute direction.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int32_t food
How much food in stomach.
Structure containing object statistics.
int16_t maxhp
Max hit points.
uint8_t subtype
Subtype of object.
#define P_IS_ALIVE
Something alive is on this space.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
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...
int8_t wc
Weapon Class, lower WC increases probability of hitting.
tag_t count
Unique object number for this object.
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
Object is attacked by something.
int16_t last_grace
As last_sp, except for grace.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
#define AT_DEATH
Chance of instant death, otherwise nothing (131072) peterm@soda.berkeley.edu.
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...
object clone
An object from which to do object_copy()
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
#define P_NO_CLERIC
No clerical spells cast here.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int32_t last_eat
How long since we last ate.