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.45 by root, Mon Apr 30 04:25:29 2007 UTC vs.
Revision 1.47 by root, Mon May 7 03:05:57 2007 UTC

852 contr->gen_grace = 0; 852 contr->gen_grace = 0;
853 contr->gen_sp_armour = 10; 853 contr->gen_sp_armour = 10;
854 contr->item_power = 0; 854 contr->item_power = 0;
855 } 855 }
856 856
857 memcpy (body_used, body_info, sizeof (body_info)); 857 for (int i = NUM_BODY_LOCATIONS; i--; )
858 slot[i].used = slot[i].info;
858 859
859 slaying = 0; 860 slaying = 0;
860 861
861 if (!QUERY_FLAG (this, FLAG_WIZ)) 862 if (!QUERY_FLAG (this, FLAG_WIZ))
862 { 863 {
877 path_repelled = arch->clone.path_repelled; 878 path_repelled = arch->clone.path_repelled;
878 path_denied = arch->clone.path_denied; 879 path_denied = arch->clone.path_denied;
879 glow_radius = arch->clone.glow_radius; 880 glow_radius = arch->clone.glow_radius;
880 move_type = arch->clone.move_type; 881 move_type = arch->clone.move_type;
881 882
882 chosen_skill = NULL; 883 chosen_skill = 0;
883 884
884 /* initializing resistances from the values in player/monster's 885 /* initializing resistances from the values in player/monster's
885 * archetype clone 886 * archetype clone
886 */ 887 */
887 memcpy (&resist, &arch->clone.resist, sizeof (resist)); 888 memcpy (&resist, &arch->clone.resist, sizeof (resist));
890 { 891 {
891 if (resist[i] > 0) 892 if (resist[i] > 0)
892 prot[i] = resist[i], vuln[i] = 0; 893 prot[i] = resist[i], vuln[i] = 0;
893 else 894 else
894 vuln[i] = -(resist[i]), prot[i] = 0; 895 vuln[i] = -(resist[i]), prot[i] = 0;
896
895 potion_resist[i] = 0; 897 potion_resist[i] = 0;
896 } 898 }
897 899
898 wc = arch->clone.stats.wc; 900 wc = arch->clone.stats.wc;
899 stats.dam = arch->clone.stats.dam; 901 stats.dam = arch->clone.stats.dam;
970 || (tmp->type == SKILL 972 || (tmp->type == SKILL
971 && tmp->subtype == SK_PRAYING)) 973 && tmp->subtype == SK_PRAYING))
972 { 974 {
973 if (type == PLAYER) 975 if (type == PLAYER)
974 { 976 {
977 if ((tmp->type == WEAPON || tmp->type == BOW)
978 && tmp != current_weapon)
979 continue;
980
975 for (i = 0; i < NUM_STATS; i++) 981 for (i = 0; i < NUM_STATS; i++)
976 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); 982 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i));
977 983
978 /* these are the items that currently can change digestion, regeneration, 984 /* these are the items that currently can change digestion, regeneration,
979 * spell point recovery and mana point recovery. Seems sort of an arbitary 985 * spell point recovery and mana point recovery. Seems sort of an arbitary
994 contr->gen_grace += tmp->stats.grace; 1000 contr->gen_grace += tmp->stats.grace;
995 contr->gen_sp_armour += tmp->gen_sp_armour; 1001 contr->gen_sp_armour += tmp->gen_sp_armour;
996 contr->item_power += tmp->item_power; 1002 contr->item_power += tmp->item_power;
997 } 1003 }
998 } /* if this is a player */ 1004 } /* if this is a player */
1005 else
1006 {
1007 if (tmp->type == WEAPON)
1008 current_weapon = tmp;
1009 }
999 1010
1000 /* Update slots used for items */ 1011 /* Update slots used for items */
1001 if (QUERY_FLAG (tmp, FLAG_APPLIED)) 1012 if (QUERY_FLAG (tmp, FLAG_APPLIED))
1002 for (i = 0; i < NUM_BODY_LOCATIONS; i++) 1013 for (i = 0; i < NUM_BODY_LOCATIONS; i++)
1003 body_used[i] += tmp->body_info[i]; 1014 slot[i].used += tmp->slot[i].info;
1004 1015
1005 if (tmp->type == SYMPTOM) 1016 if (tmp->type == SYMPTOM)
1006 { 1017 {
1007 speed_reduce_from_disease = tmp->last_sp / 100.f; 1018 speed_reduce_from_disease = tmp->last_sp / 100.f;
1008 1019
1035 vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; 1046 vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100;
1036 } 1047 }
1037 } 1048 }
1038 1049
1039 /* There may be other things that should not adjust the attacktype */ 1050 /* There may be other things that should not adjust the attacktype */
1040 if (tmp->type != BOW && tmp->type != SYMPTOM) 1051 if ((tmp->type != WEAPON && tmp->type != BOW && tmp->type != SYMPTOM)
1052 || current_weapon == tmp)
1053 {
1041 attacktype |= tmp->attacktype; 1054 attacktype |= tmp->attacktype;
1042
1043 path_attuned |= tmp->path_attuned; 1055 path_attuned |= tmp->path_attuned;
1044 path_repelled |= tmp->path_repelled; 1056 path_repelled |= tmp->path_repelled;
1045 path_denied |= tmp->path_denied; 1057 path_denied |= tmp->path_denied;
1046 move_type |= tmp->move_type; 1058 move_type |= tmp->move_type;
1047 stats.luck += tmp->stats.luck; 1059 stats.luck += tmp->stats.luck;
1060 }
1048 1061
1049 if (QUERY_FLAG (tmp, FLAG_LIFESAVE )) SET_FLAG (this, FLAG_LIFESAVE); 1062 if (QUERY_FLAG (tmp, FLAG_LIFESAVE )) SET_FLAG (this, FLAG_LIFESAVE);
1050 if (QUERY_FLAG (tmp, FLAG_REFL_SPELL )) SET_FLAG (this, FLAG_REFL_SPELL); 1063 if (QUERY_FLAG (tmp, FLAG_REFL_SPELL )) SET_FLAG (this, FLAG_REFL_SPELL);
1051 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE)) SET_FLAG (this, FLAG_REFL_MISSILE); 1064 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE)) SET_FLAG (this, FLAG_REFL_MISSILE);
1052 if (QUERY_FLAG (tmp, FLAG_STEALTH )) SET_FLAG (this, FLAG_STEALTH); 1065 if (QUERY_FLAG (tmp, FLAG_STEALTH )) SET_FLAG (this, FLAG_STEALTH);
1074 added_speed += tmp->stats.exp; 1087 added_speed += tmp->stats.exp;
1075 } 1088 }
1076 1089
1077 switch (tmp->type) 1090 switch (tmp->type)
1078 { 1091 {
1092#if 0
1079 case WAND: 1093 case WAND:
1080 case ROD: 1094 case ROD:
1081 case HORN: 1095 case HORN:
1082 if (type == PLAYER) 1096 if (type != PLAYER || current_weapon == tmp)
1083 {
1084 contr->ranged_skill = this; 1097 chosen_skill = tmp;
1085 contr->ranged_ob = tmp;
1086 }
1087 break; 1098 break;
1099#endif
1088 1100
1089 /* skills modifying the character -b.t. */ 1101 /* skills modifying the character -b.t. */
1090 /* for all skills and skill granting objects */ 1102 /* for all skills and skill granting objects */
1091 case SKILL: 1103 case SKILL:
1092 if (!QUERY_FLAG (tmp, FLAG_APPLIED)) 1104 if (!QUERY_FLAG (tmp, FLAG_APPLIED))
1125 ac -= tmp->stats.ac + tmp->magic; 1137 ac -= tmp->stats.ac + tmp->magic;
1126 1138
1127 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1139 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1128 contr->encumbrance += (int) 3 *tmp->weight / 1000; 1140 contr->encumbrance += (int) 3 *tmp->weight / 1000;
1129 1141
1130 if (type == PLAYER)
1131 {
1132 contr->ranged_skill = this;
1133 contr->ranged_ob = tmp;
1134 }
1135
1136 break; 1142 break;
1137 1143
1138 case SKILL_TOOL: 1144 case SKILL_TOOL:
1139 if (chosen_skill) 1145 if (chosen_skill)
1140 LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); 1146 LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name);
1141 1147
1142 chosen_skill = tmp; 1148 chosen_skill = tmp;
1143
1144 if (type == PLAYER)
1145 {
1146 contr->ranged_skill = this;
1147 contr->ranged_ob = tmp;
1148 }
1149 break; 1149 break;
1150 1150
1151 case SHIELD: 1151 case SHIELD:
1152 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1152 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1153 contr->encumbrance += (int) tmp->weight / 2000; 1153 contr->encumbrance += (int) tmp->weight / 2000;
1169 1169
1170 break; 1170 break;
1171 1171
1172 case BOW: 1172 case BOW:
1173 case WEAPON: 1173 case WEAPON:
1174 if (type != PLAYER 1174 if (type != PLAYER || current_weapon == tmp)
1175 || (contr->combat_skill && contr->combat_skill->type == SKILL && (skill_flags [contr->combat_skill->subtype] & SF_NEED_BOW ) && tmp->type == BOW )
1176 || (contr->combat_skill && contr->combat_skill->type == SKILL && (skill_flags [contr->combat_skill->subtype] & SF_NEED_WEAPON) && tmp->type == WEAPON))
1177 { 1175 {
1178 wc -= tmp->stats.wc + tmp->magic; 1176 wc -= tmp->stats.wc + tmp->magic;
1179 1177
1180 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) 1178 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0)
1181 ac -= tmp->stats.ac + tmp->magic; 1179 ac -= tmp->stats.ac + tmp->magic;
1192 /* If there is desire that two handed weapons should do 1190 /* If there is desire that two handed weapons should do
1193 * extra strength damage, this is where the code should 1191 * extra strength damage, this is where the code should
1194 * go. 1192 * go.
1195 */ 1193 */
1196 1194
1197 current_weapon = tmp;
1198
1199 if (type == PLAYER) 1195 if (type == PLAYER)
1200 {
1201 contr->combat_ob = tmp;
1202
1203 if (settings.spell_encumbrance) 1196 if (settings.spell_encumbrance)
1204 contr->encumbrance += tmp->weight * 3 / 1000; 1197 contr->encumbrance += tmp->weight * 3 / 1000;
1205 }
1206 } 1198 }
1207 1199
1208 break; 1200 break;
1209 1201
1210 case ARMOUR: /* Only the best of these three are used: */ 1202 case ARMOUR: /* Only the best of these three are used: */
1836 sint64 limit, exp_to_add; 1828 sint64 limit, exp_to_add;
1837 int i; 1829 int i;
1838 1830
1839 /* prevents some forms of abuse. */ 1831 /* prevents some forms of abuse. */
1840 if (op->contr->braced) 1832 if (op->contr->braced)
1841 exp = exp / 5; 1833 exp /= 5;
1842 1834
1843 /* Try to find the matching skill. 1835 /* Try to find the matching skill.
1844 * We do a shortcut/time saving mechanism first - see if it matches 1836 * We do a shortcut/time saving mechanism first - see if it matches
1845 * chosen_skill. This means we don't need to search through 1837 * chosen_skill. This means we don't need to search through
1846 * the players inventory. 1838 * the players inventory.
1847 */ 1839 */
1848 if (skill_name) 1840 if (skill_name)
1849 { 1841 {
1850 if (op->chosen_skill && op->chosen_skill->type == SKILL && !strcmp (skill_name, op->chosen_skill->skill)) 1842 if (op->chosen_skill && op->chosen_skill->type == SKILL && !strcmp (skill_name, op->chosen_skill->skill))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines