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.132 by root, Wed Nov 16 23:41:59 2016 UTC vs.
Revision 1.133 by root, Sun Jan 29 02:47:04 2017 UTC

47static const int grace_bonus[MAX_STAT + 1] = { 47static const int grace_bonus[MAX_STAT + 1] = {
48 -10, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 25, 48 -10, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 25,
49 30, 40, 50, 70, 100 49 30, 40, 50, 70, 100
50}; 50};
51 51
52/* 0.92.7 Changed way charisma works. Values now 52/* 0.92.7 Changed way charisma works. Values now
53 * represent how much more it costs to buy something than to sell it 53 * represent how much more it costs to buy something than to sell it
54 * (10, a value of 10 means it is that if it costs 50 gp to buy, you 54 * (10, a value of 10 means it is that if it costs 50 gp to buy, you
55 * would only get 5 gp when you sell.) Let query_cost do the calculations 55 * would only get 5 gp when you sell.) Let query_cost do the calculations
56 * on how to really do this. Buy keeping it this simple number, it is 56 * on how to really do this. Buy keeping it this simple number, it is
57 * much easier to know how things will be influenced. A value of '1' means 57 * much easier to know how things will be influenced. A value of '1' means
58 * buying and selling is both the same value - any value less than or equal 58 * buying and selling is both the same value - any value less than or equal
59 * to 1 should not be used. 59 * to 1 should not be used.
60 * At least as of now, the only place that uses this code is query_cost, 60 * At least as of now, the only place that uses this code is query_cost,
61 * in server/shop.c. This bonus is split evenly between buying and selling 61 * in server/shop.c. This bonus is split evenly between buying and selling
62 * (ie, if the bonus is 2.0, then items are bought for 1.33 list, and sold 62 * (ie, if the bonus is 2.0, then items are bought for 1.33 list, and sold
63 * at .667 63 * at .667
64 * This is figured by diff=(y-1)/(1+y), and for buy, it is 1+diff, for sell 64 * This is figured by diff=(y-1)/(1+y), and for buy, it is 1+diff, for sell
150 * to make the value of MAX_EXP_CAT close to the 150 * to make the value of MAX_EXP_CAT close to the
151 * actual number of experience objects in the game, 151 * actual number of experience objects in the game,
152 * otherwise the maximum level in any experience 152 * otherwise the maximum level in any experience
153 * category could be quite low. To help the situation 153 * category could be quite low. To help the situation
154 * out a little I added 10 more levels, and jacked 154 * out a little I added 10 more levels, and jacked
155 * up the last level experience value. Its out of 155 * up the last level experience value. Its out of
156 * line with progression of previous levels, so 156 * line with progression of previous levels, so
157 * if more levels are desired, this should be fixed. 157 * if more levels are desired, this should be fixed.
158 * -b.t. 158 * -b.t.
159 */ 159 */
160 160
161#define MAX_EXP_IN_OBJ MAX_EXP_IN_OBJ / (MAX_EXP_CAT - 1) 161#define MAX_EXP_IN_OBJ MAX_EXP_IN_OBJ / (MAX_EXP_CAT - 1)
337 check_stat_bounds (&op->stats); 337 check_stat_bounds (&op->stats);
338 } /* end of potion handling code */ 338 } /* end of potion handling code */
339 } 339 }
340 340
341 /* reset attributes that update_stats doesn't reset since it doesn't search 341 /* reset attributes that update_stats doesn't reset since it doesn't search
342 * everything to set 342 * everything to set
343 */ 343 */
344 if (flag == -1) 344 if (flag == -1)
345 { 345 {
346 op->attacktype &= ~tmp->attacktype; 346 op->attacktype &= ~tmp->attacktype;
347 op->path_attuned &= ~tmp->path_attuned; 347 op->path_attuned &= ~tmp->path_attuned;
416 if (tmp->move_type & MOVE_SWIM) 416 if (tmp->move_type & MOVE_SWIM)
417 DIFF_MSG (flag, "You feel ready for a swim", "You no longer feel like swimming"); 417 DIFF_MSG (flag, "You feel ready for a swim", "You no longer feel like swimming");
418 } 418 }
419 419
420 /* becoming UNDEAD... a special treatment for this flag. Only those not 420 /* becoming UNDEAD... a special treatment for this flag. Only those not
421 * originally undead may change their status 421 * originally undead may change their status
422 */ 422 */
423 if (!op->arch->flag [FLAG_UNDEAD]) 423 if (!op->arch->flag [FLAG_UNDEAD])
424 if (op->flag [FLAG_UNDEAD] != prev_flag [FLAG_UNDEAD]) 424 if (op->flag [FLAG_UNDEAD] != prev_flag [FLAG_UNDEAD])
425 { 425 {
426 success = 1; 426 success = 1;
447 success = 1; 447 success = 1;
448 DIFF_MSG (flag, "You become transparent.", "You can see yourself."); 448 DIFF_MSG (flag, "You become transparent.", "You can see yourself.");
449 } 449 }
450 450
451 /* blinded you can tell if more blinded since blinded player has minimal 451 /* blinded you can tell if more blinded since blinded player has minimal
452 * vision 452 * vision
453 */ 453 */
454 if (tmp->flag [FLAG_BLIND]) 454 if (tmp->flag [FLAG_BLIND])
455 { 455 {
456 success = 1; 456 success = 1;
457 if (flag > 0) 457 if (flag > 0)
806 806
807 wc = arch->stats.wc; 807 wc = arch->stats.wc;
808 stats.dam = arch->stats.dam; 808 stats.dam = arch->stats.dam;
809 809
810 /* for players which cannot use armour, they gain AC -1 per 3 levels, 810 /* for players which cannot use armour, they gain AC -1 per 3 levels,
811 * plus a small amount of physical resist, those poor suckers. ;) 811 * plus a small amount of physical resist, those poor suckers. ;)
812 * the fact that maxlevel is factored in could be considered sort of bogus - 812 * the fact that maxlevel is factored in could be considered sort of bogus -
813 * we should probably give them some bonus and cap it off - otherwise, 813 * we should probably give them some bonus and cap it off - otherwise,
814 * basically, if a server updates its max level, these playes may find 814 * basically, if a server updates its max level, these playes may find
815 * that their protection from physical goes down 815 * that their protection from physical goes down
816 */ 816 */
862 } 862 }
863 } 863 }
864 864
865 /* Container objects are not meant to adjust players, but other applied 865 /* Container objects are not meant to adjust players, but other applied
866 * objects need to make adjustments. 866 * objects need to make adjustments.
867 * This block should handle all player specific changes 867 * This block should handle all player specific changes
868 * The check for Praying is a bit of a hack - god given bonuses are put 868 * The check for Praying is a bit of a hack - god given bonuses are put
869 * in the praying skill, and the player should always get those. 869 * in the praying skill, and the player should always get those.
870 * It also means we need to put in additional checks for applied below, 870 * It also means we need to put in additional checks for applied below,
871 * because the skill shouldn't count against body positions being used 871 * because the skill shouldn't count against body positions being used
872 * up, etc. 872 * up, etc.
873 */ 873 */
874 if ((tmp->flag [FLAG_APPLIED] 874 if ((tmp->flag [FLAG_APPLIED]
875 && tmp->type != CONTAINER 875 && tmp->type != CONTAINER
904 if (tmp->flag [FLAG_APPLIED]) // exclude praying... 904 if (tmp->flag [FLAG_APPLIED]) // exclude praying...
905 for (int i = 0; i < NUM_BODY_LOCATIONS; i++) 905 for (int i = 0; i < NUM_BODY_LOCATIONS; i++)
906 slot[i].used += tmp->slot[i].info; 906 slot[i].used += tmp->slot[i].info;
907 907
908 if (tmp->type == SYMPTOM) 908 if (tmp->type == SYMPTOM)
909 min_it (speed_reduce_from_disease, tmp->last_sp ? tmp->last_sp / 100.f : 1.f); 909 min_it (speed_reduce_from_disease, tmp->last_sp ? tmp->last_sp / 100.f : 1.f);
910 910
911 /* Pos. and neg. protections are counted separate (-> pro/vuln). 911 /* Pos. and neg. protections are counted separate (-> pro/vuln).
912 * (Negative protections are calculated exactly like positive.) 912 * (Negative protections are calculated exactly like positive.)
913 * Resistance from potions are treated special as well. If there's 913 * Resistance from potions are treated special as well. If there's
914 * more than one potion-effect, the bigger prot.-value is taken. 914 * more than one potion-effect, the bigger prot.-value is taken.
915 */ 915 */
916 if (tmp->type == POTION_EFFECT) 916 if (tmp->type == POTION_EFFECT)
917 for (int i = 0; i < NROFATTACKS; i++) 917 for (int i = 0; i < NROFATTACKS; i++)
918 max_it (potion_resist[i], tmp->resist[i]); 918 max_it (potion_resist[i], tmp->resist[i]);
919 else if (tmp->type != POTION) 919 else if (tmp->type != POTION)
1104 1104
1105 /* 'total resistance = total protections - total vulnerabilities'. 1105 /* 'total resistance = total protections - total vulnerabilities'.
1106 * If there is an uncursed potion in effect, granting more protection 1106 * If there is an uncursed potion in effect, granting more protection
1107 * than that, we take: 'total resistance = resistance from potion'. 1107 * than that, we take: 'total resistance = resistance from potion'.
1108 * If there is a cursed (and no uncursed) potion in effect, we take 1108 * If there is a cursed (and no uncursed) potion in effect, we take
1109 * 'total resistance = vulnerability from cursed potion'. 1109 * 'total resistance = vulnerability from cursed potion'.
1110 */ 1110 */
1111 for (int i = 0; i < NROFATTACKS; i++) 1111 for (int i = 0; i < NROFATTACKS; i++)
1112 { 1112 {
1113 resist[i] = prot[i] - vuln[i]; 1113 resist[i] = prot[i] - vuln[i];
1114 1114
1152 stats.maxhp += 2 * max (0, level - 10); 1152 stats.maxhp += 2 * max (0, level - 10);
1153 1153
1154 if (stats.hp > stats.maxhp) 1154 if (stats.hp > stats.maxhp)
1155 stats.hp = stats.maxhp; 1155 stats.hp = stats.maxhp;
1156 1156
1157 /* Sp gain is controlled by the level of the player's 1157 /* Sp gain is controlled by the level of the player's
1158 * relevant experience object (mana_obj, see above) 1158 * relevant experience object (mana_obj, see above)
1159 */ 1159 */
1160 /* following happen when skills system is not used */ 1160 /* following happen when skills system is not used */
1161 if (!mana_obj) 1161 if (!mana_obj)
1162 mana_obj = this; 1162 mana_obj = this;
1163 1163
1233 wc += 4; 1233 wc += 4;
1234 } 1234 }
1235 else 1235 else
1236 ac -= dex_bonus[stats.Dex]; 1236 ac -= dex_bonus[stats.Dex];
1237 1237
1238 /* In new exp/skills system, wc bonuses are related to 1238 /* In new exp/skills system, wc bonuses are related to
1239 * the players level in a relevant exp object (wc_obj) 1239 * the players level in a relevant exp object (wc_obj)
1240 * not the general player level -b.t. 1240 * not the general player level -b.t.
1241 * I changed this slightly so that wc bonuses are better 1241 * I changed this slightly so that wc bonuses are better
1242 * than before. This is to balance out the fact that 1242 * than before. This is to balance out the fact that
1243 * the player no longer gets a personal weapon w/ 1 1243 * the player no longer gets a personal weapon w/ 1
1244 * improvement every level, now its fighterlevel/5. So 1244 * improvement every level, now its fighterlevel/5. So
1245 * we give the player a bonus here in wc and dam 1245 * we give the player a bonus here in wc and dam
1246 * to make up for the change. Note that I left the 1246 * to make up for the change. Note that I left the
1247 * monster bonus the same as before. -b.t. 1247 * monster bonus the same as before. -b.t.
1248 */ 1248 */
1249 object *wc_obj = chosen_skill; 1249 object *wc_obj = chosen_skill;
1250 1250
1251 if (contr && wc_obj && wc_obj->level > 1) 1251 if (contr && wc_obj && wc_obj->level > 1)
1450 /* if the force is missing -> bail out */ 1450 /* if the force is missing -> bail out */
1451 if (abil == NULL) 1451 if (abil == NULL)
1452 return; 1452 return;
1453 1453
1454 /* The ability_force keeps track of maximum level ever achieved. 1454 /* The ability_force keeps track of maximum level ever achieved.
1455 * New abilties can only be gained by surpassing this max level 1455 * New abilties can only be gained by surpassing this max level
1456 */ 1456 */
1457 if (who->level > abil->level) 1457 if (who->level > abil->level)
1458 { 1458 {
1459 /* increase our focused ability */ 1459 /* increase our focused ability */
1460 abil->resist[abil->stats.exp]++; 1460 abil->resist[abil->stats.exp]++;
1605calc_perm_exp (object *op) 1605calc_perm_exp (object *op)
1606{ 1606{
1607 int p_exp_min; 1607 int p_exp_min;
1608 1608
1609 /* Ensure that our permanent experience minimum is met. 1609 /* Ensure that our permanent experience minimum is met.
1610 * permenent_exp_ratio is an integer percentage, we divide by 100 1610 * permenent_exp_ratio is an integer percentage, we divide by 100
1611 * to get the fraction */ 1611 * to get the fraction */
1612 p_exp_min = (int) (settings.permanent_exp_ratio * (float) (op->stats.exp) / 100); 1612 p_exp_min = (int) (settings.permanent_exp_ratio * (float) (op->stats.exp) / 100);
1613 1613
1614 if (op->perm_exp < p_exp_min) 1614 if (op->perm_exp < p_exp_min)
1615 op->perm_exp = p_exp_min; 1615 op->perm_exp = p_exp_min;
1813 * won't do anything if the value is 0 anyways. 1813 * won't do anything if the value is 0 anyways.
1814 */ 1814 */
1815 if (exp == 0) 1815 if (exp == 0)
1816 return; 1816 return;
1817 1817
1818 /* Monsters are easy - we just adjust their exp - we 1818 /* Monsters are easy - we just adjust their exp - we
1819 * don't adjust level, since in most cases it is unrelated to 1819 * don't adjust level, since in most cases it is unrelated to
1820 * the exp they have - the monsters exp represents what its 1820 * the exp they have - the monsters exp represents what its
1821 * worth. 1821 * worth.
1822 */ 1822 */
1823 if (op->type != PLAYER) 1823 if (op->type != PLAYER)
1850 */ 1850 */
1851 subtract_player_exp (op, abs (exp), skill_name, flag); 1851 subtract_player_exp (op, abs (exp), skill_name, flag);
1852 } 1852 }
1853} 1853}
1854 1854
1855/* Applies a death penalty experience, the size of this is defined by the 1855/* Applies a death penalty experience, the size of this is defined by the
1856 * settings death_penalty_percentage and death_penalty_levels, and by the 1856 * settings death_penalty_percentage and death_penalty_levels, and by the
1857 * amount of permenent experience, whichever gives the lowest loss. 1857 * amount of permenent experience, whichever gives the lowest loss.
1858 */ 1858 */
1859void 1859void
1860apply_death_exp_penalty (object *op) 1860apply_death_exp_penalty (object *op)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines