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.46 by root, Tue May 1 05:48:19 2007 UTC

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