 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
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)) {
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;
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;
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;
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);
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])) {
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);
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;
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>
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);
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);
2594 error = load_table<>(&new_float_bonuses[i], fp, cp);
2612 if (!new_int_bonuses[i]) {
2619 if (!new_float_bonuses[i]) {
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");
int16_t gen_sp
Bonuses to regeneration speed of sp.
#define ADD_TOTALEXP(exptotal, exp)
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.
uint32_t do_los
If true, need to call update_los() in draw(), and clear.
static float get_grace_bonus(int stat)
player * next
Pointer to next player, NULL if this is last.
int get_cha_bonus(int stat)
player * first_player
First player.
struct Settings settings
Global settings.
int16_t maxhp
Max hit points.
int16_t max_level
This is read out of exp_table.
#define DIFF_MSG(flag, subtype1, subtype2, msg1, msg2)
Rather than having a whole bunch of if (flag) draw.
#define NUM_BODY_LOCATIONS
Number of body locations.
#define FLAG_CONFUSED
Will also be unable to cast spells.
int64_t * levels
Number of levels for which we have experience.
object * find_applied_skill_by_name(const object *op, const char *name)
Find a skill by name using the last_skill_ob list.
@ CLOSE_CON
Eneq((at)csd.uu.se): Id for close_container archetype.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
uint32_t path_attuned
Paths the object is attuned to.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FLAG_UNDEAD
Monster is undead.
void drain_specific_stat(object *op, int deplete_stats)
Drain a specified stat from op.
int16_t digestion
Any bonuses/penalties to digestion.
int16_t gen_grace
Bonuses to regeneration speed of grace.
int get_fear_bonus(int stat)
#define QUERY_FLAG(xyz, p)
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
#define ARCH_DEPLETION
Archetype for depletion.
#define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN
Atacktypes here refer to.
#define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN
int get_cleric_chance(int stat)
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
#define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END
End of a good effect.
uint8_t permanent_exp_ratio
How much exp should be 'permenant' and unable to be lost.
int8_t item_power
Power rating of the object.
struct archetype * arch
Pointer to archetype.
float speed
Frequency of object 'moves' relative to server tick rate.
int16_t invisible
How much longer the object will be invis.
#define NUM_FLOAT_BONUSES
static float * float_bonuses[NUM_FLOAT_BONUSES]
object * ob
The object representing the player.
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.
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,...
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.
double expmul
needed experience = (calc_exp*expmul) - means some races/classes can need less/more exp to gain level...
int8_t levhp[11]
What hp bonus the player gained on that level.
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
#define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS
context are pretty generic - things like reflection or lifesave are also under the protection categor...
int64_t check_exp_adjust(const object *op, int64_t exp)
Returns the maximum experience the object can gain or lose.
static float get_sp_bonus(int stat)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void calc_perm_exp(object *op)
Ensure that the permanent experience requirements in an exp object are met.
const char *const gain_msg[NUM_STATS]
Message when a player increases permanently a stat.
int allowed_class(const object *op)
Returns true if the given player is a legal class.
@ SKILL
Also see SKILL_TOOL (74) below.
void esrv_update_spells(player *pl)
This looks for any spells the player may have that have changed their stats.
int8_t levsp[11]
What sp bonus the player gained on that level.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
#define FLOAT_CON_BONUS
This is basically same as above, but for bonuses in which we store the value as a float.
@ POTION_RESIST_EFFECT
A force, holding the effect of a resistance potion.
#define ARMOUR_SPEED(xyz)
#define FLAG_PROBE
Object displays HP information to player.
#define SK_EXP_NONE
Player gets nothing.
#define FLAG_APPLIED
Object is ready for use by living.
#define NDI_BLUE
Actually, it is Dodger Blue.
int16_t level
Level of creature or object.
#define FLAG_STEALTH
Will wake monsters with less range.
living applied_stats
Stat changes due to gear or skills.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
void init_stats()
This loads statistic bonus/penalties from the stat_bonus file.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
const char *const lose_msg[NUM_STATS]
Message when a player decreases permanently a stat.
Plugin animator file specs[Config] name
#define MIN_STAT
The minimum legal value of any stat.
void dragon_ability_gain(object *who, int atnr, int level)
When a dragon-player gains a new stage of evolution, he gets some treasure.
#define FLAG_ALIVE
Object can fight (or be fought)
uint32_t path_denied
Paths the object is denied access to.
void add_statbonus(object *op)
Adds stat-bonuses given by the class which the player has chosen.
@ range_builder
Map builder.
const char *const short_stat_name[NUM_STATS]
Short name of stats.
int32_t carrying
How much weight this object contains.
uint8_t spell_encumbrance
Encumbrance effects spells.
uint32_t path_repelled
Paths the object is repelled from.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
struct player * contr
Pointer to the player which control this object.
object * chosen_skill
The skill chosen to use.
#define MSG_TYPE_ATTRIBUTE_STAT_LOSS
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
#define MSG_TYPE_ATTRIBUTE_RACE
Race-related changes.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START
Start of a bad effect to the player.
uint8_t death_penalty_ratio
Hhow much exp should be lost at death.
#define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN
Protections in this.
float weapon_speed
The overall speed of this object.
static void subtract_player_exp(object *op, int64_t exp, const char *skill, int flag)
Subtracts experience from player.
#define MOVE_WALK
Object walks.
@ BUILDER
Generic item builder, see subtypes below.
object * ranges[range_size]
Object for each range.
object clone
An object from which to do object_copy()
sstring add_string(const char *str)
This will add 'str' to the hash table.
MoveType move_type
Type of movement this object uses.
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).
int16_t encumbrance
How much our player is encumbered.
#define FLAG_BLIND
If set, object cannot see (visually)
#define MSG_TYPE_ATTRIBUTE_STAT_GAIN
int exp_level(int64_t exp)
Returns the level for a given exp.
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
int32_t last_eat
How long since we last ate.
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item.
#define MSG_TYPE_ATTRIBUTE_MOVE
A change in the movement type of the player.
void object_update_speed(object *op)
Updates the speed of an object.
int8_t levgrace[11]
What grace bonus the player gained on that level.
uint8_t type
PLAYER, BULLET, etc.
int16_t dam
How much damage this object does when hitting.
#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.
void player_lvl_adj(object *who, object *op)
For the new exp system.
static size_t get_index(int stat, size_t max_index)
Limits a stat value to [0..max_index].
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
int16_t item_power
Total item power of objects equipped.
int32_t food
How much food in stomach.
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
static int * int_bonuses[NUM_INT_BONUSES]
static void dragon_level_gain(object *who)
This function is called when a dragon-player gains an overall level.
int64_t level_exp(int level, double expmul)
Returns how much experience is needed for a player to become the given level.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
const char * confdir
Configuration files.
const char *const drain_msg[NUM_STATS]
Message when a player is drained of a stat.
const char *const statname[NUM_STATS]
Name of stats.
#define MAX_SKILLS
This is the maximum number of skills the game may handle.
#define FLAG_CAN_USE_SKILL
The monster can use skills.
#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 ...
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.
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.
int get_dam_bonus(int stat)
uint8_t death_penalty_level
How many levels worth of exp may be lost on one death.
Various statistics of objects.
#define FLAG_MONSTER
Will attack players.
object * last_skill_ob[MAX_SKILLS]
Exp objects sent to client.
void apply_death_exp_penalty(object *op)
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percent...
int get_dex_bonus(int stat)
#define MAX_BUF
Used for all kinds of things.
living orig_stats
Permanent real stats of player.
object * current_weapon
Pointer to the weapon currently used.
uint32_t get_weight_limit(int stat)
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 MOVE_FLY_LOW
Low flying object.
int16_t gen_sp_armour
Penalty to sp regen from armour.
int16_t maxgrace
Maximum grace.
char search_str[MAX_BUF]
Item we are looking for.
#define ADD_EXP(exptotal, exp)
Handy little macro that adds exp and keeps it within bounds.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
#define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS
the player gaining or losing these attacktypes not being a victim of an attacktype.
int16_t gen_hp
Bonuses to regeneration speed of hp.
#define FLAG_REMOVED
Object is not in any map or invenory.
#define PERM_EXP(exptotal)
Convert saved total experience into permanent experience.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
#define FLAG_WIZ
Object has special privilegies.
#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
sstring name
The name of the object, obviously...
int get_thaco_bonus(int stat)
#define WEAPON_SPEED(xyz)
int is_dragon_pl(const object *op)
Checks if player is a dragon.
int get_learn_spell(int stat)
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
int16_t maxsp
Max spell points.
const char *const attacks[NROFATTACKS]
Attack type names.
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.
void drain_stat(object *op)
Drains a random stat from op.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler si Thief st Viking ba Warrior or Wizard C Wraith C Class Prof Str Dex Con Wis Cha Int Pow Net Skills Enclosed are codes used for the skills above The ones in and fighting should all be pretty self explanatory For the other a brief description is given
sstring skill
Name of the skill this object uses/grants.
archetype * find_archetype(const char *name)
int get_turn_bonus(int stat)
void change_luck(object *op, int value)
Alter the object's luck.
uint32_t braced
Will not move if braced, only attack.
float get_speed_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 ...
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
@ SKILL_TOOL
Allows the use of a skill.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
int on_same_map(const object *op1, const object *op2)
Checks whether 2 objects are on the same map or not.
#define CLEAR_FLAG(xyz, p)
#define SK_SUBTRACT_SKILL_EXP
Used when removing exp.
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.
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
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.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various stats
static const char * float_bonus_names[NUM_FLOAT_BONUSES]
partylist * party
Party this player is part of.
#define INT_FEAR_BONUS
The definitions below are indexes into the bonuses[] array.
const char *const restore_msg[NUM_STATS]
Message when a player has a stat restored.
#define PERM_EXP_MAX_LOSS_RATIO
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler si Thief st Viking ba Warrior or Wizard C Wraith C Class Prof Str Dex Con Wis Cha Int Pow Net Skills Enclosed are codes used for the skills above The ones in and fighting should all be pretty self explanatory For the other a brief description is for a more detailed look at the skills doc file Skill remove use magic items phys no fire cold Fireborns are supposed to be fire spirits They re closely in tune with magic and are powerful and learn magic easily Being fire they are immune to fire and and vulnerable to cold They are vulnerable to ghosthit and drain because being mostly non anything which strikes directly at the spirit hits them harder race attacktype restrictions immunities prot vuln Quetzalcoatl physical no armour fire cold Quetzalcoatl s are now born knowing the spell of burning but because of their negative wisdom they have a very hard time learning new spells Their maximum natural wisdom is With the high intelligence they will typically have many spellpoints They can be very devastating at low level due to their low natural ac and can make mincemeat out of low level monsters at they really begin to have problems because they cannot use armour race attacktype restrictions immunities prot vuln Wraith phys none drain prot
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
End of a bad effect.
int64_t check_exp_loss(const object *op, int64_t exp)
This function checks to make sure that object 'op' can lose 'exp' 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.
#define MOVE_FLY_HIGH
High flying object.
float character_load
Value between 0 and 1 indicating how much the character is overloaded.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
#define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS
int remove_depletion(object *op, int level)
Remove depletion from op, if present, and warn player of such restorations.
#define SK_EXP_TOTAL
Give player exp to total, no skill.
void remove_statbonus(object *op)
Subtracts stat-bonuses given by the class which the player has chosen.
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.
#define FLOAT_GRACE_BONUS
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler si Thief st Viking ba Warrior or Wizard C Wraith C Class Prof Str Dex Con Wis Cha Int Pow Net Skills Enclosed are codes used for the skills above The ones in and fighting should all be pretty self explanatory For the other a brief description is for a more detailed look at the skills doc file Skill remove use magic items phys no fire vuln
sstring name
More definite name, like "generate_kobold".
#define SK_EXP_ADD_SKILL
Give the player the skill.
#define FLAG_XRAYS
X-ray vision.
int8_t body_used[NUM_BODY_LOCATIONS]
Calculated value based on items equipped.
uint8_t search_items
Search_items command.
living stats
Str, Con, Dex, etc.
#define MOVE_SWIM
Swimming object.
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
static const int savethrow[MAX_SAVE_LEVEL+1]
Probability to avoid something.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler si Thief st Viking ba Warrior or Wizard C Wraith C Class Prof Str Dex Con Wis Cha Int Pow Net Skills Enclosed are codes used for the skills above The ones in and fighting should all be pretty self explanatory For the other a brief description is for a more detailed look at the skills doc file Skill remove use magic items phys no fire cold Fireborns are supposed to be fire spirits They re closely in tune with magic and are powerful and learn magic easily Being fire they are immune to fire and and vulnerable to cold They are vulnerable to ghosthit and drain because being mostly non anything which strikes directly at the spirit hits them harder race attacktype restrictions immunities prot vuln Quetzalcoatl physical no armour fire cold Quetzalcoatl s are now born knowing the spell of burning but because of their negative wisdom bonus
int64_t total_exp
All exp ever earned (used to calc perm_exp)
void link_player_skills(object *op)
This function goes through the player inventory and sets up the last_skills[] array in the player obj...
static float get_con_bonus(int stat)
#define FLAG_READY_WEAPON
(Monster or Player) has a weapon readied
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...
uint32_t attacktype
Bitmask of attacks this object does.
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...
@ NUM_STATS
Number of statistics.
#define INT_CLERIC_CHANCE
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int8_t luck
Affects thaco and ac from time to time.
#define BASE_WEAPON_SPEED
#define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START
Start of a good effect to the player.
@ llevDebug
Only for debugging purposes.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
#define IS_MANA_SKILL(num)
Like IS_COMBAT_SKILL above, but instead this is used to determine how many mana points the player has...
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...
#define FREE_PLAYER_LOAD_PERCENT
archetype * get_archetype_by_skill_name(const char *skill, int type)
Retrieves an archetype by skill name and type.