ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_effect.C
(Generate patch)

Comparing deliantra/server/server/spell_effect.C (file contents):
Revision 1.39 by root, Wed Feb 7 23:43:01 2007 UTC vs.
Revision 1.40 by root, Tue Feb 13 21:28:11 2007 UTC

1161 object *poison; 1161 object *poison;
1162 int heal = 0, success = 0; 1162 int heal = 0, success = 0;
1163 1163
1164 tmp = find_target_for_friendly_spell (op, dir); 1164 tmp = find_target_for_friendly_spell (op, dir);
1165 1165
1166 if (tmp == NULL) 1166 if (!tmp)
1167 return 0; 1167 return 0;
1168 1168
1169 /* Figure out how many hp this spell might cure. 1169 /* Figure out how many hp this spell might cure.
1170 * could be zero if this spell heals effects, not damage. 1170 * could be zero if this spell heals effects, not damage.
1171 */ 1171 */
1174 heal += random_roll (spell->stats.hp, 6, op, PREFER_HIGH) + spell->stats.hp; 1174 heal += random_roll (spell->stats.hp, 6, op, PREFER_HIGH) + spell->stats.hp;
1175 1175
1176 if (heal) 1176 if (heal)
1177 { 1177 {
1178 if (tmp->stats.hp >= tmp->stats.maxhp) 1178 if (tmp->stats.hp >= tmp->stats.maxhp)
1179 {
1180 new_draw_info (NDI_UNIQUE, 0, tmp, "You are already fully healed."); 1179 new_draw_info (NDI_UNIQUE, 0, tmp, "You are already fully healed.");
1181 }
1182 else 1180 else
1183 { 1181 {
1184 /* See how many points we actually heal. Instead of messages 1182 /* See how many points we actually heal. Instead of messages
1185 * based on type of spell, we instead do messages based 1183 * based on type of spell, we instead do messages based
1186 * on amount of damage healed. 1184 * on amount of damage healed.
1188 if (heal > (tmp->stats.maxhp - tmp->stats.hp)) 1186 if (heal > (tmp->stats.maxhp - tmp->stats.hp))
1189 heal = tmp->stats.maxhp - tmp->stats.hp; 1187 heal = tmp->stats.maxhp - tmp->stats.hp;
1190 tmp->stats.hp += heal; 1188 tmp->stats.hp += heal;
1191 1189
1192 if (tmp->stats.hp >= tmp->stats.maxhp) 1190 if (tmp->stats.hp >= tmp->stats.maxhp)
1193 {
1194 new_draw_info (NDI_UNIQUE, 0, tmp, "You feel just fine!"); 1191 new_draw_info (NDI_UNIQUE, 0, tmp, "You feel just fine!");
1195 }
1196 else if (heal > 50) 1192 else if (heal > 50)
1197 {
1198 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds close!"); 1193 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds close!");
1199 }
1200 else if (heal > 25) 1194 else if (heal > 25)
1201 {
1202 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds mostly close."); 1195 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds mostly close.");
1203 }
1204 else if (heal > 10) 1196 else if (heal > 10)
1205 {
1206 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds start to fade."); 1197 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds start to fade.");
1207 }
1208 else 1198 else
1209 {
1210 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds start to close."); 1199 new_draw_info (NDI_UNIQUE, 0, tmp, "Your wounds start to close.");
1211 } 1200
1212 success = 1; 1201 success = 1;
1213 } 1202 }
1214 } 1203 }
1204
1215 if (spell->attacktype & AT_DISEASE) 1205 if (spell->attacktype & AT_DISEASE)
1216 if (cure_disease (tmp, op)) 1206 if (cure_disease (tmp, op))
1217 success = 1; 1207 success = 1;
1218 1208
1219 if (spell->attacktype & AT_POISON) 1209 if (spell->attacktype & AT_POISON)
1225 success = 1; 1215 success = 1;
1226 new_draw_info (NDI_UNIQUE, 0, tmp, "Your body feels cleansed"); 1216 new_draw_info (NDI_UNIQUE, 0, tmp, "Your body feels cleansed");
1227 poison->stats.food = 1; 1217 poison->stats.food = 1;
1228 } 1218 }
1229 } 1219 }
1220
1230 if (spell->attacktype & AT_CONFUSION) 1221 if (spell->attacktype & AT_CONFUSION)
1231 { 1222 {
1232 poison = present_in_ob_by_name (FORCE, "confusion", tmp); 1223 poison = present_in_ob_by_name (FORCE, "confusion", tmp);
1233 if (poison) 1224 if (poison)
1234 { 1225 {
1235 success = 1; 1226 success = 1;
1236 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 1227 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
1237 poison->duration = 1; 1228 poison->duration = 1;
1238 } 1229 }
1239 } 1230 }
1231
1240 if (spell->attacktype & AT_BLIND) 1232 if (spell->attacktype & AT_BLIND)
1241 { 1233 {
1242 at = archetype::find ("blindness"); 1234 at = archetype::find ("blindness");
1243 poison = present_arch_in_ob (at, tmp); 1235 poison = present_arch_in_ob (at, tmp);
1244 if (poison) 1236 if (poison)
1246 success = 1; 1238 success = 1;
1247 new_draw_info (NDI_UNIQUE, 0, tmp, "Your vision begins to return."); 1239 new_draw_info (NDI_UNIQUE, 0, tmp, "Your vision begins to return.");
1248 poison->stats.food = 1; 1240 poison->stats.food = 1;
1249 } 1241 }
1250 } 1242 }
1243
1251 if (spell->last_sp && tmp->stats.sp < tmp->stats.maxsp) 1244 if (spell->last_sp && tmp->stats.sp < tmp->stats.maxsp)
1252 { 1245 {
1253 tmp->stats.sp += spell->last_sp; 1246 tmp->stats.sp += spell->last_sp;
1254 if (tmp->stats.sp > tmp->stats.maxsp) 1247 if (tmp->stats.sp > tmp->stats.maxsp)
1255 tmp->stats.sp = tmp->stats.maxsp; 1248 tmp->stats.sp = tmp->stats.maxsp;
1256 success = 1; 1249 success = 1;
1257 new_draw_info (NDI_UNIQUE, 0, tmp, "Magical energy surges through your body!"); 1250 new_draw_info (NDI_UNIQUE, 0, tmp, "Magical energy surges through your body!");
1258 } 1251 }
1252
1259 if (spell->last_grace && tmp->stats.grace < tmp->stats.maxgrace) 1253 if (spell->last_grace && tmp->stats.grace < tmp->stats.maxgrace)
1260 { 1254 {
1261 tmp->stats.grace += spell->last_grace; 1255 tmp->stats.grace += spell->last_grace;
1262 if (tmp->stats.grace > tmp->stats.maxgrace) 1256 if (tmp->stats.grace > tmp->stats.maxgrace)
1263 tmp->stats.grace = tmp->stats.maxgrace; 1257 tmp->stats.grace = tmp->stats.maxgrace;
1264 success = 1; 1258 success = 1;
1265 new_draw_info (NDI_UNIQUE, 0, tmp, "You feel redeemed with your god!"); 1259 new_draw_info (NDI_UNIQUE, 0, tmp, "You feel redeemed with your god!");
1266 } 1260 }
1261
1267 if (spell->stats.food && tmp->stats.food < 999) 1262 if (spell->stats.food && tmp->stats.food < 999)
1268 { 1263 {
1269 tmp->stats.food += spell->stats.food; 1264 tmp->stats.food += spell->stats.food;
1270 if (tmp->stats.food > 999) 1265 if (tmp->stats.food > 999)
1271 tmp->stats.food = 999; 1266 tmp->stats.food = 999;
1272 success = 1; 1267 success = 1;
1273 /* We could do something a bit better like the messages for healing above */ 1268 /* We could do something a bit better like the messages for healing above */
1274 new_draw_info (NDI_UNIQUE, 0, tmp, "You feel your belly fill with food"); 1269 new_draw_info (NDI_UNIQUE, 0, tmp, "You feel your belly fill with food");
1275 } 1270 }
1271
1276 return success; 1272 return success;
1277} 1273}
1278 1274
1279 1275
1280/* This is used for the spells that gain stats. There are no spells 1276/* This is used for the spells that gain stats. There are no spells

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines