ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/living.c
(Generate patch)

Comparing deliantra/server/common/living.c (file contents):
Revision 1.1.1.1 by root, Fri Feb 3 07:11:32 2006 UTC vs.
Revision 1.1.1.2 by elmex, Wed Feb 22 18:01:18 2006 UTC

1/* 1/*
2 * static char *rcsid_living_c = 2 * static char *rcsid_living_c =
3 * "$Id: living.c,v 1.1.1.1 2006/02/03 07:11:32 root Exp $"; 3 * "$Id: living.c,v 1.1.1.2 2006/02/22 18:01:18 elmex Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
308/* 308/*
309 * returns the specified stat. See also set_attr_value(). 309 * returns the specified stat. See also set_attr_value().
310 */ 310 */
311 311
312sint8 312sint8
313get_attr_value(living *stats,int attr) { 313get_attr_value(const living *stats,int attr) {
314 switch(attr) { 314 switch(attr) {
315 case STR: 315 case STR:
316 return(stats->Str); 316 return(stats->Str);
317 case DEX: 317 case DEX:
318 return(stats->Dex); 318 return(stats->Dex);
1372 * check if the stat becomes negative, thus this function 1372 * check if the stat becomes negative, thus this function
1373 * merely checks that all stats are 1 or more, and returns 1373 * merely checks that all stats are 1 or more, and returns
1374 * false otherwise. 1374 * false otherwise.
1375 */ 1375 */
1376 1376
1377int allowed_class(object *op) { 1377int allowed_class(const object *op) {
1378 return op->stats.Dex>0&&op->stats.Str>0&&op->stats.Con>0&& 1378 return op->stats.Dex>0&&op->stats.Str>0&&op->stats.Con>0&&
1379 op->stats.Int>0&&op->stats.Wis>0&&op->stats.Pow>0&& 1379 op->stats.Int>0&&op->stats.Wis>0&&op->stats.Pow>0&&
1380 op->stats.Cha>0; 1380 op->stats.Cha>0;
1381} 1381}
1382 1382
1388 * Note that the title is written to 'own_title' in the 1388 * Note that the title is written to 'own_title' in the
1389 * player struct. This should be changed to 'ext_title' 1389 * player struct. This should be changed to 'ext_title'
1390 * as soon as clients support this! 1390 * as soon as clients support this!
1391 * Please, anyone, write support for 'ext_title'. 1391 * Please, anyone, write support for 'ext_title'.
1392 */ 1392 */
1393void set_dragon_name(object *pl, object *abil, object *skin) { 1393void set_dragon_name(object *pl, const object *abil, const object *skin) {
1394 int atnr=-1; /* attacknumber of highest level */ 1394 int atnr=-1; /* attacknumber of highest level */
1395 int level=0; /* highest level */ 1395 int level=0; /* highest level */
1396 int i; 1396 int i;
1397 1397
1398 /* Perhaps do something more clever? */ 1398 /* Perhaps do something more clever? */
1685 * adjustments based on permanent exp and the like. 1685 * adjustments based on permanent exp and the like.
1686 * This function should always be used for losing experience - 1686 * This function should always be used for losing experience -
1687 * the 'exp' value passed should be positive - this is the 1687 * the 'exp' value passed should be positive - this is the
1688 * amount that should get subtract from the player. 1688 * amount that should get subtract from the player.
1689 */ 1689 */
1690sint64 check_exp_loss(object *op, sint64 exp) 1690sint64 check_exp_loss(const object *op, sint64 exp)
1691{ 1691{
1692 sint64 del_exp; 1692 sint64 del_exp;
1693 1693
1694 if (exp > op->stats.exp) exp = op->stats.exp; 1694 if (exp > op->stats.exp) exp = op->stats.exp;
1695 if (settings.use_permanent_experience) { 1695 if (settings.use_permanent_experience) {
1698 if (exp > del_exp) exp=del_exp; 1698 if (exp > del_exp) exp=del_exp;
1699 } 1699 }
1700 return exp; 1700 return exp;
1701} 1701}
1702 1702
1703sint64 check_exp_adjust(object *op, sint64 exp) 1703sint64 check_exp_adjust(const object *op, sint64 exp)
1704{ 1704{
1705 if (exp<0) return check_exp_loss(op, exp); 1705 if (exp<0) return check_exp_loss(op, exp);
1706 else return MIN(exp, MAX_EXPERIENCE - op->stats.exp); 1706 else return MIN(exp, MAX_EXPERIENCE - op->stats.exp);
1707} 1707}
1708 1708
1856 * save_throw table. level is the effective level to make 1856 * save_throw table. level is the effective level to make
1857 * the save at, and bonus is any plus/bonus (typically based on 1857 * the save at, and bonus is any plus/bonus (typically based on
1858 * resistance to particular attacktype. 1858 * resistance to particular attacktype.
1859 * Returns 1 if op makes his save, 0 if he failed 1859 * Returns 1 if op makes his save, 0 if he failed
1860 */ 1860 */
1861int did_make_save(object *op, int level, int bonus) 1861int did_make_save(const object *op, int level, int bonus)
1862{ 1862{
1863 if (level > MAX_SAVE_LEVEL) level = MAX_SAVE_LEVEL; 1863 if (level > MAX_SAVE_LEVEL) level = MAX_SAVE_LEVEL;
1864 1864
1865 if ((random_roll(1, 20, op, PREFER_HIGH) + bonus) < savethrow[level]) 1865 if ((random_roll(1, 20, op, PREFER_HIGH) + bonus) < savethrow[level])
1866 return 0; 1866 return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines