34 static size_t get_index(
int stat,
size_t max_index);
41 #define ADD_EXP(exptotal, exp) do { exptotal += exp; if (exptotal > MAX_EXPERIENCE) exptotal = MAX_EXPERIENCE; } while (0) 42 #define ADD_TOTALEXP(exptotal, exp) do { exptotal += exp; if (exptotal > MAX_TOTAL_EXPERIENCE) exptotal = MAX_TOTAL_EXPERIENCE; } while(0) 58 #define INT_FEAR_BONUS 0 59 #define INT_TURN_BONUS 1 60 #define INT_CLERIC_CHANCE 2 61 #define INT_LEARN_SPELL 3 62 #define INT_CHA_BONUS 4 63 #define INT_DEX_BONUS 5 64 #define INT_DAM_BONUS 6 65 #define INT_THAC0_BONUS 7 66 #define INT_WEIGHT_LIMIT 8 67 #define NUM_INT_BONUSES 9 76 "cha_fear_bonus",
"wis_turn_bonus",
"wis_cleric_chance",
"int_wis_learn_spell",
77 "cha_shop_bonus",
"dex_bonus",
"str_damage_bonus",
"str_hit_bonus",
85 #define FLOAT_CON_BONUS 0 86 #define FLOAT_DEX_BONUS 1 87 #define FLOAT_SP_BONUS 2 88 #define FLOAT_GRACE_BONUS 3 89 #define NUM_FLOAT_BONUSES 4 92 "con_hp_bonus",
"dex_speed_bonus",
"pow_int_sp_bonus",
"wis_pow_grace_bonus" 99 #define MAX_EXPERIENCE levels[settings.max_level] 103 #define MAX_SAVE_LEVEL 110 115 18, 17, 16, 15, 14, 14, 13, 13, 12, 12,
116 12, 11, 11, 11, 11, 10, 10, 10, 10, 9,
117 9, 9, 9, 9, 8, 8, 8, 8, 8, 8,
118 7, 7, 7, 7, 7, 7, 7, 6, 6, 6,
119 6, 6, 6, 6, 6, 5, 5, 5, 5, 5,
120 5, 5, 5, 5, 4, 4, 4, 4, 4, 4,
121 4, 4, 4, 4, 3, 3, 3, 3, 3, 3,
122 3, 3, 3, 3, 3, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
124 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
125 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
130 "physical",
"magical",
"fire",
"electricity",
"cold",
131 "confusion",
"acid",
"drain",
"weaponmagic",
"ghosthit",
132 "poison",
"slow",
"paralyze",
"turn undead",
"fear",
133 "cancellation",
"depletion",
"death",
"chaos",
"counterspell",
134 "god power",
"holy power",
"blinding",
"",
"life stealing",
140 "You feel drained of strength.",
141 "You feel drained of agility.",
142 "You feel drained of health.",
143 "You feel drained of wisdom.",
144 "You feel drained of charisma.",
145 "You feel drained of intelligence.",
146 "You feel drained of power." 151 "You feel your strength return.",
152 "You feel your agility return.",
153 "You feel your health return.",
154 "You feel your wisdom return.",
155 "You feel your charisma return.",
156 "You feel your intelligence return.",
157 "You feel your power return." 162 "You feel stronger.",
163 "You feel more agile.",
166 "You seem to look better.",
168 "You feel more potent." 175 "You feel less healthy!",
179 "You feel less potent!" 297 LOG(
llevError,
"Invalid attribute in change_attr_value: %d\n", attr);
359 else if (v < min_stat)
369 #define DIFF_MSG(flag, subtype1, subtype2, msg1, msg2) \ 370 draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_ATTRIBUTE, (flag > 0) ? subtype1 : subtype2, (flag > 0) ? msg1 : msg2); 403 memcpy(&refop, op,
sizeof(
object));
415 nstat = flag*i+ostat;
422 if (nstat < 1 && i*flag < 0)
427 if (nstat != ostat) {
471 "Your hands begin to glow red.",
472 "Your hands stop glowing red.");
477 "You feel very protected.",
478 "You don't feel protected anymore.");
483 "A magic force shimmers around you.",
484 "The magic force fades away.");
489 "You feel more safe now, somehow.",
490 "Suddenly you feel less safe, somehow.");
506 "You start to float in the air!",
507 "You float down to the ground.");
515 "You soar into the air!.",
517 "You float down to the ground."));
521 "You feel ready for a swim",
522 "You no longer feel like swimming");
553 "You walk more quietly.",
554 "You walk more noisily.");
559 "You become transparent.",
560 "You can see yourself.");
593 "Your vision is better in the dark.",
594 "You see less well in the dark.");
621 "You feel more lucky.",
622 "You feel less lucky.");
628 "You feel much more healthy!",
629 "You feel much less healthy!");
635 "You feel one with the powers of magic!",
636 "You suddenly feel very mundane.");
643 "You feel closer to your god!",
644 "You suddenly feel less holy.");
650 "You feel more confident in combat.",
651 "You feel less confident in combat.");
657 "You feel more confident in your dodging skills.",
658 "You feel less confident in your dodging skills.");
664 "You feel like you're moving faster.",
665 "You feel like you're moving more slowly.");
671 "You feel your digestion slowing down.",
672 "You feel your digestion speeding up.");
684 "Your resistance to %s rises to %d%%.",
688 "Your resistance to %s drops to %d%%.",
698 if ((curr_val >
MIN_STAT && i < 0) || (curr_val < settings.max_stat && i > 0)) {
769 if (level != -1 && level < op->level)
784 return (count == 0) ? 0 : 1;
819 if (new_luck >= -100 && new_luck <= 100) {
897 static void fix_player(
object *op,
int *ac,
int *wc,
const object *grace_obj,
const object *mana_obj,
const object *wc_obj,
int weapon_speed,
float added_speed)
906 pl_level = op->
level;
919 for (i = 1, op->
stats.
maxhp = 0; i <= pl_level && i <= 10; i++) {
924 if (tmpf < 1.0) tmpf = 1.0;
945 if (!mana_obj || !mana_obj->
level) {
948 float sp_tmp = 0.0, mana_bonus;
951 mana_lvl_max = (mana_obj->
level >10 ? 10: mana_obj->
level);
954 for (i = 1; i <= mana_lvl_max; i++) {
960 if (i == 1) stmp += mana_bonus;
970 if (mana_obj->
level > 10)
979 if (!grace_obj || !grace_obj->
level) {
987 float sp_tmp = 0.0, grace_bonus;
991 for (i = 1; i <= grace_obj->
level && i <= 10; i++) {
996 grace_tmp += grace_bonus;
1000 sp_tmp += grace_tmp;
1005 if (grace_obj->
level > 10)
1028 if (wc_obj && wc_obj->
level >= 1) {
1030 int wc_increase_rate;
1032 wc_increase_rate = wc_in?atoi(wc_in):5;
1033 assert(wc_increase_rate != 0);
1036 (*wc) -= (wc_obj->
level-1)/wc_increase_rate;
1134 float max = 9, added_speed = 0, speed_reduce_from_disease = 1;
1135 int weapon_speed = 0;
1136 int best_wc = 0, best_ac = 0, wc = 0, ac = 0;
1138 const object *grace_obj = NULL, *mana_obj = NULL, *wc_obj = NULL;
1206 prot[i] = op->
resist[i], vuln[i] = 0;
1208 vuln[i] = -(op->
resist[i]), prot[i] = 0;
1209 potion_resist[i] = 0;
1250 if (tmp->type ==
SKILL) {
1255 else if (tmp->level > mana_obj->level)
1261 else if (tmp->level > grace_obj->
level)
1278 if (tmp->type ==
BOW)
1281 if (tmp->type ==
WAND || tmp->type ==
ROD)
1347 if (tmp->type ==
SYMPTOM && tmp->last_sp) {
1349 if (((
float)tmp->last_sp/100.0) < speed_reduce_from_disease)
1350 speed_reduce_from_disease = (float)tmp->last_sp/100.0;
1358 if (tmp->type !=
POTION) {
1364 if (potion_resist[i])
1365 potion_resist[i] =
MAX(potion_resist[i], tmp->resist[i]);
1367 potion_resist[i] = tmp->resist[i];
1368 }
else if (tmp->resist[i] > 0)
1369 prot[i] += ((100-prot[i])*tmp->resist[i])/100;
1370 else if (tmp->resist[i] < 0)
1371 vuln[i] += ((100-vuln[i])*(-tmp->resist[i]))/100;
1376 if (tmp->type !=
BOW && tmp->type !=
SYMPTOM)
1414 if (tmp->stats.exp && tmp->type !=
SKILL) {
1415 added_speed += (float)tmp->stats.exp/3.0;
1418 switch (tmp->type) {
1429 LOG(
llevDebug,
"fix_object, op %s has multiple skills applied\n", op->
name);
1432 if (tmp->stats.dam > 0) {
1435 if (weapon_speed < 0)
1441 wc -= (tmp->stats.wc+tmp->magic);
1443 if (tmp->slaying != NULL) {
1450 ac -= (tmp->stats.ac+tmp->magic);
1459 LOG(
llevDebug,
"fix_object, op %s has multiple skills applied\n", op->
name);
1478 wc -= tmp->stats.wc;
1480 op->
stats.
dam += (tmp->stats.dam+tmp->magic);
1482 ac -= (tmp->stats.ac+tmp->magic);
1486 wc -= tmp->stats.wc;
1487 if (tmp->stats.ac && tmp->stats.ac+tmp->magic > 0)
1488 ac -= tmp->stats.ac+tmp->magic;
1489 op->
stats.
dam += (tmp->stats.dam+tmp->magic);
1490 weapon_speed = ((int)
WEAPON_SPEED(tmp)*2-tmp->magic)/2;
1491 if (weapon_speed < 0)
1493 if (tmp->slaying != NULL) {
1517 if (tmp->stats.wc) {
1524 wc -= tmp->stats.wc;
1526 else if (best_wc < tmp->stats.wc) {
1528 best_wc = tmp->stats.wc;
1529 wc -= tmp->stats.wc;
1532 if (tmp->stats.ac) {
1544 ac -= tmp->stats.ac+tmp->magic;
1546 else if (best_ac < tmp->stats.ac+tmp->magic) {
1548 best_ac = tmp->stats.ac+tmp->magic;
1549 ac -= (tmp->stats.ac+tmp->magic);
1552 if (tmp->stats.dam && tmp->type ==
BRACERS)
1553 op->
stats.
dam += (tmp->stats.dam+tmp->magic);
1572 op->
resist[i] = prot[i]-vuln[i];
1573 if (potion_resist[i]
1574 && ((potion_resist[i] > op->
resist[i]) || (potion_resist[i] < 0)))
1575 op->
resist[i] = potion_resist[i];
1578 fix_player(op, &ac, &wc, grace_obj, mana_obj, wc_obj, weapon_speed, added_speed);
1580 op->
speed = op->
speed*speed_reduce_from_disease;
1583 if (op->
speed > max)
1586 op->
speed += added_speed/10.0;
1608 if (added_speed > 0)
1609 LOG(
llevInfo,
"fix_object: Monster %s has negative speed of %f.\n",
1700 && (atnr == -1 || abil->
resist[i] > abil->
resist[atnr])) {
1712 level = (int)(level/5.);
1715 if (pl->
contr != NULL) {
1729 object *abil = NULL;
1730 object *skin = NULL;
1756 "Your metabolism now focuses on %s!",
1794 LOG(
llevError,
"add_player_exp: couldn't find skill %s\n", skill_name);
1804 skill_obj->
level = 1;
1853 if (op->
level > 1) {
1855 snprintf(buf,
sizeof(buf),
"You are now level %d in the %s skill.", op->
level, op->
name);
1857 snprintf(buf,
sizeof(buf),
"You are now level %d.", op->
level);
1867 snprintf(buf,
sizeof(buf),
"You are now level %d in the %s skill.", op->
level, op->
name);
1869 snprintf(buf,
sizeof(buf),
"You are now level %d.", op->
level);
1888 return expmul*levels[
level];
1938 LOG(
llevDebug,
"pruning removed object from last_skill_ob\n");
1949 "%s's skill object %s does not have a skill name\n",
1971 static void add_player_exp(
object *op, int64_t exp,
const char *skill_name,
int flag) {
1972 object *skill_obj = NULL;
1973 int64_t limit, exp_to_add;
1974 int64_t added_skill_exp = 0, added_skill_total_exp = 0;
2020 if (exp_to_add > limit)
2036 if (exp_to_add > limit)
2038 added_skill_exp = skill_obj->
stats.
exp;
2040 added_skill_exp = skill_obj->
stats.
exp - added_skill_exp;
2042 added_skill_total_exp = skill_obj->
total_exp;
2044 added_skill_total_exp = skill_obj->
total_exp - added_skill_total_exp;
2050 added_skill_exp = added_skill_total_exp = exp_to_add;
2132 float fraction = (float)exp/(
float)op->
stats.
exp;
2136 if (tmp->type ==
SKILL && tmp->stats.exp) {
2139 tmp->stats.exp -= del_exp;
2146 tmp->stats.exp -= del_exp;
2179 void change_exp(
object *op, int64_t exp,
const char *skill_name,
int flag) {
2182 LOG(
llevError,
"change_exp() called for null object!\n");
2246 int64_t percentage_loss;
2250 if (tmp->type ==
SKILL && tmp->stats.exp) {
2264 tmp->stats.exp -= loss;
2323 void share_exp(
object *op, int64_t exp,
const char *skill,
int flag) {
2324 int shares = 0, count = 0;
2344 if (count == 1 || shares > exp)
2347 int64_t share = exp/shares, given = 0, nexp;
2350 nexp = (pl->
ob->
level+4)*share;
2428 index = (size_t)stat;
2429 return MIN(index, max_index);
2449 template <
typename T>
2458 while (fgets(buf,
MAX_BUF-1, fp) != NULL) {
2470 if (buf[0] ==
'}') {
2472 LOG(
llevError,
"Number of bonus does not match max stat (%d!=%d, bonus=%s)\n",
2485 while (!isdigit(*cp) && *cp!=
'.' && *cp!=
'-' && *cp!=
'+' && *cp != 0)
2488 if (*cp == 0)
break;
2490 if (std::is_same<T, float>::value)
2491 tmp_bonus = atof(cp);
2493 tmp_bonus = atoi(cp);
2496 LOG(
llevError,
"Number of bonus entries exceed max stat (line=%s, bonus=%s)\n",
2500 (*bonuses)[on_stat] = tmp_bonus;
2504 while (isdigit(*cp) || *cp==
'-' || *cp==
'+' || (*cp ==
'.' && std::is_same<T, float>::value))
2509 LOG(
llevError,
"Reached end of file without getting close brace? bonus=%s\n", bonus_name);
2532 if ((fp = fopen(buf,
"r")) == NULL) {
2533 LOG(
llevError,
"Fatal error: could not open experience table (%s)\n", buf);
2536 while (fgets(buf,
MAX_BUF-1, fp) != NULL) {
2541 if ((cp = strrchr(buf,
'\n')) != NULL)
2550 while (isspace(*cp) && *cp != 0)
2553 if (!strncasecmp(cp,
"max_stat", 8)) {
2554 int newmax = atoi(cp+8);
2565 LOG(
llevError,
"Got invalid max_stat (%d) from stat_bonus file\n", newmax);
2576 LOG(
llevError,
"Got bonus line or otherwise unknown value before max stat! (%s)\n",
2584 error = load_table<>(&new_int_bonuses[i], fp, cp);
2591 if (i == NUM_INT_BONUSES) {
2594 error = load_table<>(&new_float_bonuses[i], fp, cp);
2599 if (i == NUM_FLOAT_BONUSES) {
2600 LOG(
llevError,
"Unknown line in stat_bonus file: %s\n", buf);
2612 if (!new_int_bonuses[i]) {
2619 if (!new_float_bonuses[i]) {
2631 LOG(
llevError,
"Got error reading stat_bonus: %s\n", buf);
2640 new_int_bonuses[i] = NULL;
2646 new_float_bonuses[i] = NULL;
2652 fprintf(stderr,
"Int stat bonuses:\n");
2654 fprintf(stderr,
"%d", stat);
2658 fprintf(stderr,
"\n");
2660 fprintf(stderr,
"Float stat bonuses:\n");
2662 fprintf(stderr,
"%d", stat);
2666 fprintf(stderr,
"\n");
static float get_con_bonus(int stat)
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item...
int on_same_map(const object *op1, const object *op2)
Checks whether 2 objects are on the same map or not.
void check_stat_bounds(living *stats, int8_t min_stat, int8_t max_stat)
Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_s...
#define NUM_BODY_LOCATIONS
Number of body locations.
int16_t gen_hp
Bonuses to regeneration speed of hp.
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
object * ranges[range_size]
Object for each range.
#define WEAPON_SPEED(xyz)
living orig_stats
Permanent real stats of player.
#define MOVE_WALK
Object walks.
int object_check_move_on(object *op, object *originator)
Checks if any objects has a move_type that matches objects that effect this object on this space...
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 ...
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
int8_t item_power
Power rating of the object.
const char *const short_stat_name[NUM_STATS]
Short name of stats.
struct archetype * arch
Pointer to archetype.
static const char * float_bonus_names[NUM_FLOAT_BONUSES]
#define NUM_FLOAT_BONUSES
static float * float_bonuses[NUM_FLOAT_BONUSES]
Eneq((at)csd.uu.se): Id for close_container archetype.
uint8_t spell_encumbrance
Encumbrance effects spells.
static void fix_player(object *op, int *ac, int *wc, const object *grace_obj, const object *mana_obj, const object *wc_obj, int weapon_speed, float added_speed)
Complement to fix_object() for player.
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.
static void subtract_player_exp(object *op, int64_t exp, const char *skill, int flag)
Subtracts experience from player.
void add_statbonus(object *op)
Adds stat-bonuses given by the class which the player has chosen.
#define FABS(x)
Decstations have trouble with fabs()...
int get_turn_bonus(int stat)
void change_luck(object *op, int value)
Alter the object's luck.
#define INT_FEAR_BONUS
The definitions below are indexes into the bonuses[] array.
void calc_perm_exp(object *op)
Ensure that the permanent experience requirements in an exp object are met.
#define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS
the player gaining or losing these attacktypes not being a victim of an attacktype.
uint8_t death_penalty_level
How many levels worth of exp may be lost on one death.
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
archetype * find_archetype(const char *name)
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
int64_t * levels
Number of levels for which we have experience.
void player_set_dragon_title(player *pl, int level, const char *attack, int skin_resist)
Updates the title of a dragon player to reflect the current level, attack type, and resistances...
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
player * first_player
First player.
int16_t maxgrace
Maximum grace.
#define PERM_EXP_MAX_LOSS_RATIO
int remove_depletion(object *op, int level)
Remove depletion from op, if present, and warn player of such restorations.
int16_t max_level
This is read out of exp_table.
partylist * party
Party this player is part of.
sstring slaying
Which race to do double damage to.
#define NDI_BLUE
Actually, it is Dodger Blue.
sstring add_string(const char *str)
Share a string.
#define DIFF_MSG(flag, subtype1, subtype2, msg1, msg2)
Rather than having a whole bunch of if (flag) draw.
int8_t luck
Affects thaco and ac from time to time.
#define FLAG_BLIND
If set, object cannot see (visually)
static int * int_bonuses[NUM_INT_BONUSES]
void link_player_skills(object *op)
This function goes through the player inventory and sets up the last_skills[] array in the player obj...
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
#define FLAG_CONFUSED
Will also be unable to cast spells.
#define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN
Atacktypes here refer to.
#define FLAG_STEALTH
Will wake monsters with less range.
#define FLOAT_GRACE_BONUS
const char *const drain_msg[NUM_STATS]
Message when a player is drained of a stat.
void player_lvl_adj(object *who, object *op)
For the new exp system.
int is_dragon_pl(const object *op)
Checks if player is a dragon.
uint32_t get_weight_limit(int stat)
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
static const int savethrow[MAX_SAVE_LEVEL+1]
Probability to avoid something.
int64_t level_exp(int level, double expmul)
Returns how much experience is needed for a player to become the given level.
living applied_stats
Stat changes due to gear or skills.
object * chosen_skill
The skill chosen to use.
#define ADD_EXP(exptotal, exp)
Handy little macro that adds exp and keeps it within bounds.
uint8_t death_penalty_ratio
Hhow much exp should be lost at death.
#define ADD_TOTALEXP(exptotal, exp)
uint32_t path_repelled
Paths the object is repelled from.
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
double expmul
needed experience = (calc_exp*expmul) - means some races/classes can need less/more exp to gain level...
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).
int8_t levgrace[11]
What grace bonus the player gained on that level.
static const char * int_bonus_names[NUM_INT_BONUSES]
Following array corresponds to the defines above, but are the text names as found in the file...
void apply_death_exp_penalty(object *op)
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percent...
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW)...
#define FLAG_REMOVED
Object is not in any map or invenory.
int exp_level(int64_t exp)
Returns the level for a given exp.
float weapon_speed
The overall speed of this object.
object * find_applied_skill_by_name(const object *op, const char *name)
Find a skill by name using the last_skill_ob list.
#define IS_MANA_SKILL(num)
Like IS_COMBAT_SKILL above, but instead this is used to determine how many mana points the player has...
int get_cleric_chance(int stat)
Allows the use of a skill.
#define MIN_STAT
The minimum legal value of any stat.
#define FREE_PLAYER_LOAD_PERCENT
#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.
Generic item builder, see subtypes below.
int16_t level
Level of creature or object.
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
Find object in inventory by type and archetype name.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
End of a bad effect.
player * next
Pointer to next player, NULL if this is last.
#define MSG_TYPE_ATTRIBUTE_MOVE
A change in the movement type of the player.
#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.
uint32_t do_los
If true, need to call update_los() in draw(), and clear.
float character_load
Value between 0 and 1 indicating how much the character is overloaded.
int get_thaco_bonus(int stat)
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
sstring name
More definite name, like "generate_kobold".
static void add_player_exp(object *op, int64_t exp, const char *skill_name, int flag)
Add experience to a player - exp should only be positive.
#define SK_EXP_TOTAL
Give player exp to total, no skill.
#define MOVE_SWIM
Swimming object.
#define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN
Protections in this.
uint8_t search_items
Search_items command.
float speed
Frequency of object 'moves' relative to server tick rate.
int32_t carrying
How much weight this object contains.
int16_t encumbrance
How much our player is encumbered.
int16_t digestion
Any bonuses/penalties to digestion.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define FLAG_CAN_USE_SKILL
The monster can use skills.
#define MOVE_FLY_LOW
Low flying object.
#define QUERY_FLAG(xyz, p)
int get_dex_bonus(int stat)
int get_fear_bonus(int stat)
#define ARCH_DEPLETION
Archetype for depletion.
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
#define PERM_EXP(exptotal)
Convert saved total experience into permanent experience.
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.
const char *const gain_msg[NUM_STATS]
Message when a player increases permanently a stat.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
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_PROBE
Object displays HP information to player.
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players...
#define ARMOUR_SPEED(xyz)
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
void remove_statbonus(object *op)
Subtracts stat-bonuses given by the class which the player has chosen.
object * ob
The object representing the player.
const char *const lose_msg[NUM_STATS]
Message when a player decreases permanently a stat.
int8_t glow_radius
indicates the glow radius of the object
uint32_t braced
Will not move if braced, only attack.
struct Settings settings
Global settings.
const char *const restore_msg[NUM_STATS]
Message when a player has a stat restored.
#define FLAG_XRAYS
X-ray vision.
#define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
int16_t dam
How much damage this object does when hitting.
void set_dragon_name(object *pl, const object *abil, const object *skin)
Set the new dragon name after gaining levels or changing ability focus (later this can be extended to...
#define AT_PHYSICAL
Basic attack (1)
int get_learn_spell(int stat)
int16_t gen_sp_armour
Penalty to sp regen from armour.
#define BASE_WEAPON_SPEED
uint32_t path_denied
Paths the object is denied access to.
#define FLAG_WIZ
Object has special privilegies.
const char *const attacks[NROFATTACKS]
Attack type names.
living stats
Str, Con, Dex, etc.
#define MAX_BUF
Used for all kinds of things.
int16_t invisible
How much longer the object will be invis.
archetype * get_archetype_by_skill_name(const char *skill, int type)
Retrieves an archetype by skill name and type.
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.
#define MSG_TYPE_ATTRIBUTE_STAT_LOSS
int8_t levsp[11]
What sp bonus the player gained on that level.
const char * confdir
Configuration files.
static int load_table(T **bonuses, FILE *fp, char *bonus_name)
This loads up a stat table from the file - basically, it keeps processing until it gets the closing b...
static void dragon_level_gain(object *who)
This function is called when a dragon-player gains an overall level.
#define FLAG_READY_WEAPON
(Monster or Player) has a weapon readied
Various statistics of objects.
#define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START
Start of a good effect to the player.
uint8_t permanent_exp_ratio
How much exp should be 'permenant' and unable to be lost.
static float get_grace_bonus(int stat)
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
#define INT_CLERIC_CHANCE
Also see SKILL_TOOL (74) below.
int16_t gen_grace
Bonuses to regeneration speed of grace.
object * last_skill_ob[MAX_SKILLS]
Exp objects sent to client.
MoveType move_type
Type of movement this object uses.
#define MSG_TYPE_ATTRIBUTE_STAT_GAIN
sstring name
The name of the object, obviously...
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
#define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS
Only for debugging purposes.
int get_cha_bonus(int stat)
void drain_specific_stat(object *op, int deplete_stats)
Drain a specified stat from op.
const char *const statname[NUM_STATS]
Name of stats.
#define SK_EXP_ADD_SKILL
Give the player the skill.
#define SK_EXP_NONE
Player gets nothing.
#define CLEAR_FLAG(xyz, p)
uint8_t type
PLAYER, BULLET, etc.
static size_t get_index(int stat, size_t max_index)
Limits a stat value to [0..max_index].
char search_str[MAX_BUF]
Item we are looking for.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define FLAG_APPLIED
Object is ready for use by living.
void change_attr_value(living *stats, int attr, int8_t value)
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat...
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
void object_update_speed(object *op)
Updates the speed of an object.
int16_t gen_sp
Bonuses to regeneration speed of sp.
int8_t levhp[11]
What hp bonus the player gained on that level.
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
int64_t check_exp_adjust(const object *op, int64_t exp)
Returns the maximum experience the object can gain or lose.
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
int64_t total_exp
All exp ever earned (used to calc perm_exp)
int get_dam_bonus(int stat)
sstring skill
Name of the skill this object uses/grants.
int16_t maxsp
Max spell points.
int allowed_class(const object *op)
Returns true if the given player is a legal class.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
object * give_skill_by_name(object *op, const char *skill_name)
Given the skill name skill_name, we find the skill archetype/object, set appropriate values...
#define NDI_UNIQUE
Print immediately, don't buffer.
#define MOVE_FLY_HIGH
High flying object.
void dragon_ability_gain(object *who, int atnr, int level)
When a dragon-player gains a new stage of evolution, he gets some treasure.
A force, holding the effect of a resistance potion.
float get_speed_bonus(int stat)
int32_t food
How much food in stomach.
object * current_weapon
Pointer to the weapon currently used.
Structure containing object statistics.
#define MSG_TYPE_ATTRIBUTE_RACE
Race-related changes.
int16_t maxhp
Max hit points.
#define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS
context are pretty generic - things like reflection or lifesave are also under the protection categor...
#define MAX_SKILLS
This is the maximum number of skills the game may handle.
#define SK_SUBTRACT_SKILL_EXP
Used when removing exp.
void esrv_update_spells(player *pl)
This looks for any spells the player may have that have changed their stats.
#define IS_COMBAT_SKILL(num)
This macro is used in fix_object() to define if this is a sill that should be used to calculate wc's ...
int16_t item_power
Total item power of objects equipped.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
#define AT_CONFUSION
Movement/attack directions become random (32)
static float get_sp_bonus(int stat)
#define FLOAT_CON_BONUS
This is basically same as above, but for bonuses in which we store the value as a float...
#define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END
End of a good effect.
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
void init_stats()
This loads statistic bonus/penalties from the stat_bonus file.
void drain_stat(object *op)
Drains a random stat from op.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
#define IS_GRACE_SKILL(num)
Currently only one of these, but put the define here to make it easier to expand it in the future...
object clone
An object from which to do object_copy()
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int8_t body_used[NUM_BODY_LOCATIONS]
Calculated value based on items equipped.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START
Start of a bad effect to the player.
uint32_t path_attuned
Paths the object is attuned to.
int32_t last_eat
How long since we last ate.