35 static void slow_living(
object *op,
object *hitter,
int dam);
40 static void poison_living(
object *op,
object *hitter,
int dam);
42 object *op,
object *hitter,
int dam, uint32_t attacknum);
80 if (op->
material & (*mt)->material) {
105 int i, roll, saves = 0,
attacks = 0, number;
136 if (op->
resist[number] == 100)
140 else if ((20-mt->
save[number])/3 > originator->
stats.
dam)
207 int x = op->
x, y = op->
y;
220 if (op->
map == NULL) {
228 "You are expelled from the %s during its destruction.",
230 inv->contr->transport = NULL;
240 if (inv->type ==
RUNE)
245 object *badguy =
blame(originator);
246 if (badguy != NULL) {
309 "Despite the flame, you feel nothing.");
355 int hit_map(
object *op,
int dir, uint32_t type,
int full_hit) {
395 if (!(type&~(AT_COUNTERSPELL|
AT_MAGIC))) {
398 type &= ~AT_COUNTERSPELL;
417 if (tmp->map != map || tmp->x != x || tmp->y != y)
443 else if ((tmp->material || tmp->materialname) && op->
stats.
dam > 0 && !tmp->move_block) {
539 snprintf(buf1,
MAX_BUF,
"hit");
540 snprintf(buf2,
MAX_BUF,
"hits");
569 static void get_attack_message(
int dam,
int type,
const object *op,
const object *hitter,
char *buf1,
char *buf2) {
570 if (dam == 9998 && op->
type ==
DOOR) {
572 snprintf(buf2,
MAX_BUF,
" unlocks");
577 snprintf(buf2,
MAX_BUF,
" hits");
582 snprintf(buf2,
MAX_BUF,
" misses");
586 snprintf(buf1,
MAX_BUF,
"hit");
587 snprintf(buf2,
MAX_BUF,
"hits");
632 && ((owner != NULL ? owner : hitter)->type) ==
PLAYER) {
634 snprintf(buf,
sizeof(buf),
"%s's %s%s you.", owner->
name, hitter->name, buf2);
636 snprintf(buf,
sizeof(buf),
"%s%s you.", hitter->name, buf2);
643 if (hitter->type ==
PLAYER) {
644 snprintf(buf,
sizeof(buf),
"You %s.", buf1);
647 }
else if (owner != NULL && owner->
type ==
PLAYER) {
668 }
else if (
rndm(0, 5) != 0)
673 hitter->name, buf2, op->
name);
689 int *simple_attack) {
691 LOG(
llevError,
"BUG: get_attack_mode(): freed object\n");
694 *target =
HEAD(*target);
695 *hitter =
HEAD(*hitter);
696 if ((*hitter)->env != NULL || (*target)->env != NULL) {
702 || (*hitter)->map == NULL
704 LOG(
llevError,
"BUG: hitter (arch %s, name %s) with no relation to target\n", (*hitter)->arch->name, (*hitter)->name);
724 static int abort_attack(
object *target,
object *hitter,
int simple_attack) {
727 if (hitter->
env == target || target->
env == hitter)
735 return new_mode != simple_attack;
768 int simple_attack, roll, dam;
770 tag_t op_tag, hitter_tag;
771 const char *anim_suffix = NULL;
792 anim_suffix =
"attack";
798 hitter_tag = hitter->
count;
825 if (roll >= 20 || op->
stats.
ac >= wc-roll) {
830 "You attacked and lost your spell!");
836 "You were hit and lost your spell!");
839 "%s was hit by %s and lost a spell.",
844 if (!simple_attack) {
862 "You were hit by a wild attack. You are no longer hidden!");
892 "You are splashed by acid!\n");
915 "The %s arrests you!", hitter->
name);
938 hitter =
HEAD(hitter);
980 object *container, *hitter;
981 int hit_something = 0;
982 tag_t victim_tag, hitter_tag, container_tag;
983 int16_t victim_x, victim_y;
985 const char *old_skill = NULL;
1011 container_tag = container->
count;
1015 victim_x = victim->
x;
1016 victim_y = victim->
y;
1017 victim_map = victim->
map;
1018 victim_tag = victim->
count;
1019 hitter_tag = hitter->
count;
1031 if (container != NULL) {
1032 old_skill = hitter->
skill;
1050 if (container != NULL) {
1052 hitter->
skill = old_skill;
1058 if (hit_something && op->
speed <= 10.0) {
1060 if (container == NULL) {
1085 if (victim_x != hitter->
x || victim_y != hitter->
y) {
1097 if (hit_something && op->
speed >= 10.0)
1195 int exp_to_drain = op->
stats.
exp/rate;
1201 exp_to_drain =
MIN(exp_to_drain,
1205 if (exp_to_drain <= 1) {
1232 exp_to_drain = orig_exp - op->
stats.
exp;
1235 if (owner && owner != hitter) {
1273 int doesnt_slay = 1;
1278 LOG(
llevError,
"hit_with_one_attacktype: Invalid attacknumber passed: %u\n", attacknum);
1283 LOG(
llevError,
"hit_with_one_attacktype called with negative damage: %d\n", dam);
1315 dam *= (100-op->
resist[attacknum]);
1327 if (op->
resist[attacknum] >= 100
1334 switch (attacknum) {
1406 if (!(tmp->material&
M_IRON))
1408 if (tmp->magic < -4)
1410 if (tmp->type ==
RING 1414 || tmp->type ==
WAND 1415 || tmp->type ==
ROD)
1426 "The %s's acid corrodes your %s!",
1427 name_hitter, name_op);
1477 LOG(
llevError,
"%s was hit by %s with non-specific chaos.\n", name_op, name_hitter);
1516 int dam_modifier = is_wraith ? 200 : 3000;
1532 new_hp = hitter->
stats.
hp+dam;
1535 if (new_hp > hitter->
stats.
hp)
1555 #ifdef PARTY_KILL_LOG 1556 void party_add_kill(
partylist *party,
const char *killer,
const char *dead,
long exp);
1592 object *owner = NULL;
1593 const object *skop = NULL;
1634 "Your pet, the %s, is killed by %s.",
1671 time_t t = time(NULL);
1676 tmv = localtime(&t);
1677 strftime(buf,
sizeof(buf),
"%a %b %d %H:%M:%S %Y", tmv);
1688 if (owner != hitter) {
1694 "You killed %s with %s.",
1717 if (pk == 1 && !battleg)
1726 skill = hitter->
skill;
1733 LOG(
llevError,
"kill_object - unable to find skill that killed monster\n");
1738 if ((!skop || skop->
type !=
SKILL) && skill) {
1747 if (owner != hitter) {
1749 const char *owner_prefix;
1750 const char *op_prefix;
1752 owner_prefix = !battleg && pk && owner->
contr != NULL && !owner->
contr->
peaceful ?
"hostile " :
"";
1753 op_prefix = !battleg && pk && op->
contr != NULL && !op->
contr->
peaceful ?
"hostile " :
"";
1757 snprintf(kill_message,
sizeof(kill_message),
"%s%s killed %s%s with %s%s.", owner_prefix, owner->
name, op_prefix, name_op, name_hitter, battleg ?
" (duel)" : (pk ?
" (pk)" :
""));
1759 const char *hitter_prefix;
1760 const char *op_prefix;
1762 hitter_prefix = !battleg && pk && hitter->
contr != NULL && !hitter->
contr->
peaceful ?
"hostile " :
"";
1763 op_prefix = !battleg && pk && op->
contr != NULL && !op->
contr->
peaceful ?
"hostile " :
"";
1765 snprintf(kill_message,
sizeof(kill_message),
"%s%s killed %s%s%s%s.", hitter_prefix, hitter->
name, op_prefix, op->
name,
1767 " in hand to hand combat" :
"", battleg ?
" (duel)" : (pk ?
" (pk)" :
""));
1773 skill = skop->
skill;
1790 "Your foe has fallen!\nVICTORY!!!");
1813 #ifdef PARTY_KILL_LOG 1820 party_add_kill(owner->
contr->
party, name, op_name, exp);
1862 hitter =
HEAD(hitter);
1870 if (owner != NULL) {
1881 return friendlyfire;
1907 int hit_player(
object *op,
int dam,
object *hitter, uint32_t type,
int full_hit) {
1908 int maxdam = 0, ndam = 0, magic = (type&
AT_MAGIC);
1909 int maxattacktype, attacknum;
1910 int body_attack = op->
head != NULL;
1912 tag_t op_tag, hitter_tag;
1932 hitter_tag = hitter->
count;
1951 if (!simple_attack && op->
type ==
DOOR) {
1973 LOG(
llevDebug,
"hit player: attacktype %d, dam %d\n", type, dam);
1983 dam = (dam > (
rndm(0, 99))) ? 1 : 0;
2006 && god->race != NULL
2011 maxattacktype = type;
2012 for (attacknum = 0; attacknum <
NROFATTACKS; attacknum++) {
2015 attacktype = 1<<attacknum;
2029 if (type&attacktype) {
2034 if (ndam >= maxdam) {
2036 maxattacktype = 1<<attacknum;
2040 if (attacktype ==
AT_DEATH && ndam > 0)
2058 if (friendlyfire && maxdam) {
2069 unsigned int area = 0;
2070 for (at = op->
arch; at != NULL; at = at->
more)
2075 unsigned int remainder = 100*(maxdam%area)/area;
2077 if (
RANDOM()%100 < remainder)
2082 LOG(
llevDebug,
"Attacktype %d did %d damage\n", type, maxdam);
2086 if (owner != NULL) {
2087 if (op->
enemy != hitter)
2090 if (op->
enemy == NULL ||
rndm(1, 20) == 0)
2186 skill = hitter->
skill;
2190 if (skill && skill != tmp->
skill) {
2208 "You suddenly feel very ill.");
2222 "Your %s poisons %s.",
2245 else if (tmp->
stats.
exp > -speed_penalty) {
2285 if (speed_penalty < 1)
2287 else if (speed_penalty > 30)
2293 "The world suddenly moves very fast!");
2298 "The world moves even faster!");
2344 "You suddenly feel very confused!");
2359 object *tmp, *owner;
2386 "Your attack blinds %s!",
2423 "You limbs stop moving!");
2454 int atk_lev, def_lev, kill_lev, lev_mult = 1;
2472 def_lev = op->
level;
2495 kill_lev = (atk_lev - def_lev) * lev_mult * (100 - op->
resist[
ATNR_DEATH]) / 100;
2507 *dam *= kill_lev/def_lev;
2531 switch (hitter->
type) {
2567 object *attacker = hitter;
2571 if (!target || !hitter || !hitter->
map || !target->
map || !
on_same_map(hitter, target)) {
2572 LOG(
llevError,
"BUG: adj_attackroll(): hitter and target not on same map\n");
2579 if (attacker == NULL)
std::vector< materialtype_t * > materials
void spring_trap(object *trap, object *victim)
This function generalizes attacks by runes/traps.
#define AT_HOLYWORD
Damage based on race and caster's god.
int on_same_map(const object *op1, const object *op2)
Checks whether 2 objects are on the same map or not.
static int get_attack_mode(object **target, object **hitter, int *simple_attack)
Find correct parameters for attack, do some sanity checks.
static int hit_with_drain(object *op, object *hitter, int dam)
object * ranges[range_size]
Object for each range.
const char * determine_god(object *op)
Determines if op worships a god.
#define FLAG_DAMNED
The object is very cursed.
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define UP_OBJ_FACE
Only thing that changed was the face.
static void put_in_icecube(object *op, object *originator)
see doc/Developers/objects
#define FLAG_ONE_HIT
Monster can only hit once before going away (replaces ghosthit)
#define AT_ELECTRICITY
Can also ignite objects (8)
#define AT_COUNTERSPELL
Cancels magic spells (524288) peterm@soda.berkeley.edu.
int64_t calc_skill_exp(const object *who, const object *op, const object *skill)
Calculates amount of experience can be gained for successful use of a skill.
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 AT_DEPLETE
Lose one point from one stat, can be restored (65536) vick@bern.docs.uu.se.
#define AT_GHOSTHIT
Attacker dissolves (512)
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.
Material structures and defines.
#define FLAG_HITBACK
Object will hit back when hit.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
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.
#define NDI_ALL
Inform all players of this message.
void confuse_living(object *op, object *hitter, int dam)
Confuse a living thing.
#define FABS(x)
Decstations have trouble with fabs()...
int rndm(int min, int max)
Returns a number between min and max.
int monster_can_see_enemy(object *op, object *enemy)
Assuming no walls/barriers, lets check to see if its possible to see an enemy.
int get_turn_bonus(int stat)
void change_luck(object *op, int value)
Alter the object's luck.
void object_handle_death_animation(object *op)
uint32_t weapontype
Type of weapon.
materialtype_t * name_to_material(const char *name)
Convert materialname to materialtype_t.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
int player_arrest(object *who)
Put a player into jail, taking into account cursed exits and player's region.
float move_slow_penalty
How much this slows down the object.
#define FLAG_FRIENDLY
Will help players.
static void get_attack_message(int dam, int type, const object *op, const object *hitter, char *buf1, char *buf2)
Compute attack messages.
archetype * find_archetype(const char *name)
uint32_t peaceful
If set, won't attack friendly creatures.
static int attack_ob_simple(object *op, object *hitter, int base_dam, int wc)
Handles simple attack cases.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
object * object_find_by_type2(const object *who, int type1, int type2)
Find object in inventory.
static void deathstrike_living(object *op, object *hitter, int *dam)
Attempts to kill 'op'.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
static void scare_creature(object *target, object *hitter)
Creature is scared, update its values.
void set_materialname(object *op)
Set the material name and type for an item, if not set.
#define AT_CANCELLATION
Removes magic from items (32768) ylitalo@student.docs.uu.se.
void paralyze_living(object *op, int dam)
Paralyze a living thing.
void fix_stopped_item(object *op, mapstruct *map, object *originator)
Put stopped item where stop_item() had found it.
#define SET_ANIMATION(ob, newanim)
object * blame(object *op)
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
partylist * party
Party this player is part of.
sstring slaying
Which race to do double damage to.
sstring add_string(const char *str)
Share a string.
static int hit_with_one_attacktype(object *op, object *hitter, int dam, uint32_t attacknum)
Handles one attacktype's damage.
#define FLAG_BLIND
If set, object cannot see (visually)
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
void get_attack_message_for_attack_type(int dam, uint8_t atm_type, const char *victim_name, char *buf1, char *buf2)
Get the attack message for a damage and a type.
#define FLAG_CONFUSED
Will also be unable to cast spells.
int free_no_drop(object *op)
Check whether the given object is FLAG_NO_DROP.
void save_throw_object(object *op, uint32_t type, object *originator)
Object is attacked with some attacktype (fire, ice, ...).
int slow_living_by(object *op, const int speed_penalty)
#define AT_COLD
Can freeze objects into ice cubes (16)
int16_t y
Position in the map for this object.
int8_t magic
Any magical bonuses to this item.
uint16_t material
What materials this object consist of.
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
static void object_get_materialtype(object *op, materialtype_t **mt)
MoveType move_block
What movement types this blocks.
#define OUT_OF_REAL_MAP(M, X, Y)
Checks if a square is out of the map.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
int16_t duration
Number of moves (see 'speed') spell lasts.
#define FLAG_IS_LIGHTABLE
object can be lit
object * stop_item(object *op)
An item (ARROW or such) stops moving.
object * chosen_skill
The skill chosen to use.
#define FLAG_TEAR_DOWN
at->faces[hp*animations/maxhp] at hit
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...
#define AT_BLIND
Blinds victim (4194304) thomas@astro.psu.edu.
char title[BIG_NAME]
Default title, like fighter, wizard, etc.
void process_object(object *op)
Main object move function.
#define WEAP_BLUD
bludgeoning, club, stick
int player_can_view(object *pl, object *op)
Check the player los field for viewability of the object op.
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
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).
char * host
Which host it is connected from (ip address).
#define MSG_TYPE_APPLY
Applying objects.
uint8_t casting_time
It takes awhile to cast a spell.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
#define FLAG_REMOVED
Object is not in any map or invenory.
int32_t weight
Attributes of the object.
void events_execute_global_event(int eventcode,...)
Execute a global event.
#define EVENT_ATTACKED
Object attacked, with weapon or spell.
object * find_applied_skill_by_name(const object *op, const char *name)
Find a skill by name using the last_skill_ob list.
int friendly_fire(object *op, object *hitter)
Find out if this is friendly fire (PVP and attacker is peaceful) or not.
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define AT_TURN_UNDEAD
Like Fear, but for undead only (8192)
uint8_t run_away
Monster runs away if it's hp goes below this percentage.
const Face * blank_face
Following can just as easily be pointers, but it is easier to keep them like this.
#define AT_LIFE_STEALING
16777216 for hp drain
#define WEAP_WHIP
whips n chains
#define FLAG_UNDEAD
Monster is undead.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
#define AT_CHAOS
None by itself, uses random other types (262144) peterm@soda.berkeley.edu.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
static int stick_arrow(object *op, object *tmp)
Try to put an arrow in inventory.
#define MSG_TYPE_ATTACK_PET_DIED
Pet was killed.
int16_t level
Level of creature or object.
object * object_decrease_nrof(object *op, uint32_t i)
Decreases a specified number from the amount of an object.
static int kill_object(object *op, int dam, object *hitter)
An object was killed, handle various things (logging, messages, ...).
int16_t casting_time
Time left before spell goes off.
uint8_t hide
The object is hidden, not invisible.
#define FLAG_ALIVE
Object can fight (or be fought)
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
void kill_player(object *op, const object *killer)
Handle a player's death.
int8_t save[NROFATTACKS]
Save chances for the attacks.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
sstring materialname
Specific material name.
sstring name
More definite name, like "generate_kobold".
#define SK_EXP_TOTAL
Give player exp to total, no skill.
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.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
int64_t pk_max_experience
Maximum experience one can get for PKing.
object * env
Pointer to the object which is the environment.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
int monster_stand_in_light(object *op)
Cache monster_stand_in_light_internal().
#define QUERY_FLAG(xyz, p)
void monster_npc_call_help(object *op)
A monster calls for help against its enemy.
#define MSG_TYPE_ADMIN_PLAYER
Player coming/going/death.
#define MSG_TYPE_ATTACK_DID_KILL
Player killed something.
sstring anim_suffix
Used to determine combined animations.
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
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 EVENT_GKILL
Triggered when anything got killed by anyone.
#define MOVE_FLYING
Combo of fly_low and fly_high.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
socket_struct * socket
Socket information for this player.
uint32_t golem_count
To track the golem.
object * head
Points to the main object of a large body.
int64_t check_exp_loss(const object *op, int64_t exp)
This function checks to make sure that object 'op' can lose 'exp' experience.
sstring race
Human, goblin, dragon, etc.
#define FLAG_BLOCKSVIEW
Object blocks view.
void update_all_los(const mapstruct *map, int x, int y)
This function makes sure that update_los() will be called for all players on the given map within the...
#define WEAP_STAB
knife, dagger
#define WEAP_PIERCE
arrows, stiletto
#define MSG_TYPE_VICTIM_WAS_HIT
Player was hit by something.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
#define FLAG_PARALYZED
Monster or player is paralyzed.
const Face * face
Face with colors.
char killer[BIG_NAME]
Who killed this player.
#define P_OUT_OF_MAP
This space is outside the map.
int hit_map(object *op, int dir, uint32_t type, int full_hit)
Attack a spot on the map.
#define AT_FIRE
Can ignite objects (4)
struct Settings settings
Global settings.
#define FLAG_SCARED
Monster is scared (mb player in future)
static int did_make_save_item(object *op, int type, object *originator)
Checks to make sure the item actually made its saving throw based on the tables.
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
Check if the given object (usually a player) is standing on a battleground tile.
object * object_present_in_ob(uint8_t type, const object *op)
Searches for any objects with a matching type variable in the inventory of the given object...
uint8_t simple_exp
If true, use the simple experience system.
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.
void object_replace_insert_in_map(const char *arch_string, object *op)
This function inserts an object of a specified archetype in the map, but if it finds objects of its o...
#define AT_PHYSICAL
Basic attack (1)
#define HEAD(op)
Returns the head part of an object.
#define MSG_TYPE_APPLY_UNAPPLY
Unapply an object.
#define FLAG_WIZ
Object has special privilegies.
const char *const attacks[NROFATTACKS]
Attack type names.
#define MSG_TYPE_ATTACK_FUMBLE
Player fumbled attack.
#define WEAP_CRUSH
big hammers, flails
living stats
Str, Con, Dex, etc.
#define MAX_BUF
Used for all kinds of things.
#define MSG_TYPE_ATTACK
Attack related messages.
static void attack_message(int dam, int type, object *op, object *hitter)
Send an attack message to someone.
#define ATNR_COUNTERSPELL
int16_t invisible
How much longer the object will be invis.
#define MSG_TYPE_ATTACK_DID_HIT
Player hit something else.
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
Searches for any objects with a matching archetype at the given map and coordinates.
float speed_left
How much speed is left to spend this round.
object * arch_present_in_ob(const archetype *at, const object *op)
Searches for any objects with a matching archetype in the inventory of the given object.
struct mapstruct * map
Pointer to the map in which this object is present.
#define FLAG_RUN_AWAY
Object runs away from nearest player \ but can still attack at a distance.
Skill-related defines, including subtypes.
#define EVENT_ATTACKS
Weapon or arrow hitting something.
#define FLAG_READY_WEAPON
(Monster or Player) has a weapon readied
#define AT_DRAIN
Victim loses 2% exp, attacker gains half of that (128)
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Searches for any objects with a matching type & name variable in the inventory of the given object...
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
MoveType move_slow
Movement types this slows down.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
#define FLAG_CURSED
The object is cursed.
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
#define AT_POISON
Some damage each turn thereafter (1024)
static int adj_attackroll(object *hitter, object *target)
Adjustments to attack rolls by various conditions.
Chaos_Attacks ATTACKS[22]
Some local definitions for shuffle_attack().
#define FLAG_NO_DAMAGE
monster can't be damaged
static int abort_attack(object *target, object *hitter, int simple_attack)
Check if target and hitter are still in a relation similar to the one determined by get_attack_mode()...
#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
uint16_t set_friendly_fire
Percent of damage done by peaceful player vs player damage.
int attack_ob(object *op, object *hitter)
Simple wrapper for attack_ob_simple(), will use hitter's values.
#define NUM_ANIMATIONS(ob)
Also see SKILL_TOOL (74) below.
MoveType move_type
Type of movement this object uses.
sstring name
The name of the object, obviously...
sstring title
Of foo, etc.
Only for debugging purposes.
uint32_t nrof
Number of objects.
static void thrown_item_effect(object *, object *)
Handles any special effects of thrown items (like attacking living creatures–a potion thrown at a mo...
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_...
static void tear_down_wall(object *op)
Handles wall tearing animation.
uint8_t darkness
Indicates level of darkness of map.
static void cancellation(object *op)
Cancels object *op.
#define AT_SLOW
Speed is reduced (2048)
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.
#define ATNR_CANCELLATION
#define FLAG_SPLITTING
Object splits into stats.food other objs.
void check_physically_infect(object *victim, object *hitter)
Possibly infect due to direct physical contact i.e., AT_PHYSICAL.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define FLAG_APPLIED
Object is ready for use by living.
void object_update_speed(object *op)
Updates the speed of an object.
#define MSG_TYPE_APPLY_SUCCESS
Was able to apply object.
object * inv
Pointer to the first object in the inventory.
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
method_ret ob_apply(object *op, object *applier, int aflags)
Apply an object by running an event hook or an object method.
#define AT_MAGIC
All magic spells, but not prayers (2)
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
Object is attacked by something.
Lauwenmark: an invisible object holding a plugin event hook.
static int is_aimed_missile(object *op)
Determine if the object is an 'aimed' missile.
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...
object * hit_with_arrow(object *op, object *victim)
hit_with_arrow() disassembles the missile, attacks the victim and reassembles the missile...
void blind_living(object *op, object *hitter, int dam)
Blind a living thing.
static const int32_t MAX_FOOD
sstring skill
Name of the skill this object uses/grants.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
void counterspell(object *op, int dir)
Nullifies spell effects.
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Execute an event on the specified object.
#define NDI_UNIQUE
Print immediately, don't buffer.
int is_wraith_pl(object *op)
Tests if a player is a wraith.
static void poison_living(object *op, object *hitter, int dam)
Poison a living thing.
static void slow_living(object *op, object *hitter, int dam)
Slow a living thing.
bool is_criminal(object *op)
#define MSG_TYPE_VICTIM_WAS_PUSHED
Player was pushed or attempted pushed.
void commit_crime(object *op, const char *description)
archetype * more
Next part of a linked object.
void make_visible(object *op)
Makes an object visible again.
#define FLAG_WAS_WIZ
Player was once a wiz.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
int32_t food
How much food in stomach.
object * current_weapon
Pointer to the weapon currently used.
Structure containing object statistics.
#define MSG_TYPE_ATTACK_PET_HIT
Players pet hit something else.
int16_t maxhp
Max hit points.
uint8_t subtype
Subtype of object.
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.
#define USING_SKILL(op, skill)
True if op is using skill, false else.
#define AT_CONFUSION
Movement/attack directions become random (32)
void object_update(object *op, int action)
object_update() updates the array which represents the map.
tag_t count
Unique object number for this object.
#define FLAG_NO_PICK
Object can't be picked up.
int pk_max_experience_percent
Percentage of experience of victim the killer gets.
#define AT_ACID
Random equipped item might corrode when hit (64)
void drain_stat(object *op)
Drains a random stat from op.
attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]
static uint8_t get_attack_message_type(int type, const object *op, const object *hitter)
Figure the Attack types ATM_xxx type for an attack.
#define AT_DEATH
Chance of instant death, otherwise nothing (131072) peterm@soda.berkeley.edu.
void change_object(object *op)
Replaces op with its other_arch if it has reached its end of life.
object clone
An object from which to do object_copy()
#define WEAP_HIT
the basic
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
#define ATNR_LIFE_STEALING
object * fix_stopped_arrow(object *op)
An ARROW stops moving.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int16_t pk_luck_penalty
Amount by which player luck is reduced if they PK.
void shuffle_attack(object *op)
This routine shuffles the attack of op to one of the ones in the list.
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
#define AT_PARALYZE
Speed is reduced to zero (4096)
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START
Start of a bad effect to the player.
char * name
Name of map as given by its creator.
#define FLAG_FREED
Object is in the list of free objects.
object * enemy
Monster/player to follow even if not closest.
#define EVENT_DEATH
Player or monster dead.