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.120 by root, Fri Apr 30 09:36:32 2010 UTC vs.
Revision 1.122 by root, Fri Apr 30 21:00:39 2010 UTC

870 * because the skill shouldn't count against body positions being used 870 * because the skill shouldn't count against body positions being used
871 * up, etc. 871 * up, etc.
872 */ 872 */
873 if ((tmp->flag [FLAG_APPLIED] 873 if ((tmp->flag [FLAG_APPLIED]
874 && tmp->type != CONTAINER 874 && tmp->type != CONTAINER
875 && tmp->type != CLOSE_CON) 875 && tmp->type != CLOSE_CON
876 && tmp->type != SPELL)
876 || (tmp->type == SKILL && tmp->subtype == SK_PRAYING)) 877 || (tmp->type == SKILL && tmp->subtype == SK_PRAYING))
877 { 878 {
878 if (type == PLAYER) 879 if (type == PLAYER)
879 { 880 {
880 contr->item_power += tmp->item_power; 881 contr->item_power += tmp->item_power;
915 for (int i = 0; i < NROFATTACKS; i++) 916 for (int i = 0; i < NROFATTACKS; i++)
916 max_it (potion_resist[i], tmp->resist[i]); 917 max_it (potion_resist[i], tmp->resist[i]);
917 else if (tmp->type != POTION) 918 else if (tmp->type != POTION)
918 for (int i = 0; i < NROFATTACKS; i++) 919 for (int i = 0; i < NROFATTACKS; i++)
919 if (tmp->resist[i] > 0) 920 if (tmp->resist[i] > 0)
920 prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; 921 prot[i] += (100 - prot[i]) * tmp->resist[i] / 100;
921 else if (tmp->resist[i] < 0) 922 else if (tmp->resist[i] < 0)
922 vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; 923 vuln[i] += (100 - vuln[i]) * -tmp->resist[i] / 100;
923 924
924 /* There may be other things that should not adjust the attacktype */ 925 /* There may be other things that should not adjust the attacktype */
925 if (tmp->type != SYMPTOM) 926 if (tmp->type != SYMPTOM)
926 { 927 {
927 attacktype |= tmp->attacktype; 928 attacktype |= tmp->attacktype;
1648 * NULL, in which case exp increases the players general 1649 * NULL, in which case exp increases the players general
1649 * total, but not any particular skill. 1650 * total, but not any particular skill.
1650 * flag is what to do if the player doesn't have the skill: 1651 * flag is what to do if the player doesn't have the skill:
1651 */ 1652 */
1652static void 1653static void
1653add_player_exp (object *op, sint64 exp, const char *skill_name, int flag) 1654add_player_exp (object *op, sint64 exp, shstr_tmp skill_name, int flag)
1654{ 1655{
1655 object *skill_obj; 1656 object *skill_obj;
1656 sint64 limit, exp_to_add; 1657 sint64 limit, exp_to_add;
1657 int i; 1658 int i;
1658 1659
1772 * where everything is at the minimum perm exp, he would lose nothing. 1773 * where everything is at the minimum perm exp, he would lose nothing.
1773 * exp is the amount of exp to subtract - thus, it should be 1774 * exp is the amount of exp to subtract - thus, it should be
1774 * a postive number. 1775 * a postive number.
1775 */ 1776 */
1776static void 1777static void
1777subtract_player_exp (object *op, sint64 exp, const char *skill, int flag) 1778subtract_player_exp (object *op, sint64 exp, shstr_tmp skill, int flag)
1778{ 1779{
1779 float fraction = (float) exp / (float) op->stats.exp; 1780 float fraction = (float) exp / (float) op->stats.exp;
1780 object *tmp; 1781 object *tmp;
1781 sint64 del_exp; 1782 sint64 del_exp;
1782 1783
1783 for (tmp = op->inv; tmp; tmp = tmp->below) 1784 for (tmp = op->inv; tmp; tmp = tmp->below)
1784 if (tmp->type == SKILL && tmp->stats.exp) 1785 if (tmp->type == SKILL && tmp->stats.exp)
1785 { 1786 {
1786 if (flag == SK_SUBTRACT_SKILL_EXP && skill && !strcmp (&tmp->skill, skill)) 1787 if (flag == SK_SUBTRACT_SKILL_EXP && skill && tmp->skill == skill)
1787 { 1788 {
1788 del_exp = check_exp_loss (tmp, exp); 1789 del_exp = check_exp_loss (tmp, exp);
1789 tmp->stats.exp -= del_exp; 1790 tmp->stats.exp -= del_exp;
1790 player_lvl_adj (op, tmp); 1791 player_lvl_adj (op, tmp);
1791 } 1792 }
1792 else if (flag != SK_SUBTRACT_SKILL_EXP) 1793 else if (flag != SK_SUBTRACT_SKILL_EXP)
1793 { 1794 {
1794 /* only want to process other skills if we are not trying 1795 /* only want to process other skills if we are not trying
1795 * to match a specific skill. 1796 * to match a specific skill.
1796 */ 1797 */
1797 del_exp = check_exp_loss (tmp, (sint64) (tmp->stats.exp * fraction)); 1798 del_exp = check_exp_loss (tmp, tmp->stats.exp * fraction);
1798 tmp->stats.exp -= del_exp; 1799 tmp->stats.exp -= del_exp;
1799 player_lvl_adj (op, tmp); 1800 player_lvl_adj (op, tmp);
1800 } 1801 }
1801 } 1802 }
1802 1803
1816 * skill_name is the skill that should get the exp added. 1817 * skill_name is the skill that should get the exp added.
1817 * flag is what to do if player doesn't have the skill. 1818 * flag is what to do if player doesn't have the skill.
1818 * these last two values are only used for players. 1819 * these last two values are only used for players.
1819 */ 1820 */
1820void 1821void
1821change_exp (object *op, sint64 exp, const char *skill_name, int flag) 1822change_exp (object *op, sint64 exp, shstr_tmp skill_name, int flag)
1822{ 1823{
1823#ifdef EXP_DEBUG 1824#ifdef EXP_DEBUG
1824 LOG (llevDebug, "change_exp() called for %s, exp = %" PRId64 "\n", query_name (op), exp); 1825 LOG (llevDebug, "change_exp() called for %s, exp = %" PRId64 "\n", query_name (op), exp);
1825#endif 1826#endif
1826 1827

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines