| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
#include "global.h" |
| 114 |
|
| 115 |
#include <assert.h> |
| 116 |
#include <stdlib.h> |
| 117 |
#include <string.h> |
| 118 |
|
| 119 |
#include "living.h" |
| 120 |
#include "object.h" |
| 121 |
#include "skills.h" |
| 122 |
#include "sounds.h" |
| 123 |
#include "spells.h" |
| 124 |
#include "sproto.h" |
| 125 |
|
| 126 |
static void remove_symptoms(object *disease); |
| 127 |
static object *find_symptom(object *disease); |
| 128 |
static void check_infection(object *disease); |
| 129 |
static void do_symptoms(object *disease); |
| 130 |
static void grant_immunity(object *disease); |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
static int is_susceptible_to_disease(object *victim, object *disease) { |
| 154 |
|
| 155 |
if (!QUERY_FLAG(victim, FLAG_ALIVE) || QUERY_FLAG(victim, FLAG_WIZ)) |
| 156 |
return 0; |
| 157 |
|
| 158 |
if (strstr(disease->race, "*") && !QUERY_FLAG(victim, FLAG_UNDEAD)) |
| 159 |
return 1; |
| 160 |
|
| 161 |
if ((disease->race == undead_name) && QUERY_FLAG(victim, FLAG_UNDEAD)) |
| 162 |
return 1; |
| 163 |
|
| 164 |
if ((victim->race && strstr(disease->race, victim->race)) |
| 165 |
|| strstr(disease->race, victim->name)) |
| 166 |
return 1; |
| 167 |
|
| 168 |
return 0; |
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
int move_disease(object *disease) { |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
if (disease->env && QUERY_FLAG(disease->env, FLAG_WIZ)) |
| 187 |
return 0; |
| 188 |
|
| 189 |
if (disease->env == NULL) { |
| 190 |
if (disease->stats.maxhp > 0) |
| 191 |
disease->value--; |
| 192 |
if (disease->value == 0) { |
| 193 |
object_remove(disease); |
| 194 |
object_free_drop_inventory(disease); |
| 195 |
return 1; |
| 196 |
} |
| 197 |
} else { |
| 198 |
|
| 199 |
|
| 200 |
if (disease->stats.food > 0) { |
| 201 |
disease->stats.food--; |
| 202 |
if (disease->stats.food == 0) { |
| 203 |
remove_symptoms(disease); |
| 204 |
grant_immunity(disease); |
| 205 |
object_remove(disease); |
| 206 |
object_free_drop_inventory(disease); |
| 207 |
return 1; |
| 208 |
} |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
check_infection(disease); |
| 213 |
|
| 214 |
|
| 215 |
if (disease->env && is_susceptible_to_disease(disease->env, disease)) |
| 216 |
do_symptoms(disease); |
| 217 |
|
| 218 |
return 0; |
| 219 |
} |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
static void remove_symptoms(object *disease) { |
| 233 |
object *symptom, *victim = NULL; |
| 234 |
|
| 235 |
assert(disease != NULL); |
| 236 |
|
| 237 |
while ((symptom = find_symptom(disease)) != NULL) { |
| 238 |
if (!victim) |
| 239 |
victim = symptom->env; |
| 240 |
object_remove(symptom); |
| 241 |
object_free_drop_inventory(symptom); |
| 242 |
} |
| 243 |
if (victim) |
| 244 |
fix_object(victim); |
| 245 |
} |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
static object *find_symptom(object *disease) { |
| 256 |
assert(disease->env != NULL); |
| 257 |
|
| 258 |
|
| 259 |
return object_find_by_type_and_name(disease->env, SYMPTOM, disease->name); |
| 260 |
} |
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
static void check_infection(object *disease) { |
| 269 |
int x, y, range, mflags; |
| 270 |
mapstruct *map, *map2; |
| 271 |
int16_t i, j, i2, j2; |
| 272 |
|
| 273 |
range = abs(disease->magic); |
| 274 |
if (disease->env) { |
| 275 |
x = disease->env->x; |
| 276 |
y = disease->env->y; |
| 277 |
map = disease->env->map; |
| 278 |
} else { |
| 279 |
x = disease->x; |
| 280 |
y = disease->y; |
| 281 |
map = disease->map; |
| 282 |
} |
| 283 |
|
| 284 |
if (map == NULL) |
| 285 |
return; |
| 286 |
for (i = x-range; i <= x+range; i++) { |
| 287 |
for (j = y-range; j <= y+range; j++) { |
| 288 |
mflags = get_map_flags(map, &map2, i, j, &i2, &j2); |
| 289 |
if (!(mflags&P_OUT_OF_MAP) && (mflags&P_IS_ALIVE)) { |
| 290 |
FOR_MAP_PREPARE(map2, i2, j2, tmp) |
| 291 |
infect_object(tmp, disease, 0); |
| 292 |
FOR_MAP_FINISH(); |
| 293 |
} |
| 294 |
} |
| 295 |
} |
| 296 |
} |
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
int infect_object(object *victim, object *disease, int force) { |
| 318 |
object *tmp; |
| 319 |
object *new_disease; |
| 320 |
object *owner; |
| 321 |
|
| 322 |
victim = HEAD(victim); |
| 323 |
|
| 324 |
|
| 325 |
if (!QUERY_FLAG(victim, FLAG_MONSTER) && !(victim->type == PLAYER)) |
| 326 |
return 0; |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
if (!is_susceptible_to_disease(victim, disease)) |
| 332 |
return 0; |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
if ((disease->map && op_on_battleground(disease, NULL, NULL, NULL)) |
| 337 |
|| (disease->env && op_on_battleground(disease->env, NULL, NULL, NULL))) |
| 338 |
if (!op_on_battleground(victim, NULL, NULL, NULL)) |
| 339 |
return 0; |
| 340 |
|
| 341 |
|
| 342 |
if (!force && (random_roll(0, 126, victim, PREFER_HIGH) >= disease->stats.wc)) |
| 343 |
return 0; |
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
tmp = object_find_by_type_and_name(HEAD(victim), SIGN, disease->name); |
| 355 |
if (tmp != NULL && tmp->level >= disease->level) |
| 356 |
return 0; |
| 357 |
tmp = object_find_by_type_and_name(HEAD(victim), DISEASE, disease->name); |
| 358 |
if (tmp != NULL) |
| 359 |
return 0; |
| 360 |
|
| 361 |
|
| 362 |
new_disease = object_new(); |
| 363 |
object_copy(disease, new_disease); |
| 364 |
new_disease->stats.food = disease->stats.maxgrace; |
| 365 |
new_disease->value = disease->stats.maxhp; |
| 366 |
new_disease->stats.wc -= disease->last_grace; |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
owner = object_get_owner(disease); |
| 372 |
if (owner) { |
| 373 |
object_set_owner(new_disease, owner); |
| 374 |
|
| 375 |
|
| 376 |
if (new_disease->skill != disease->skill) { |
| 377 |
if (new_disease->skill) |
| 378 |
free_string(new_disease->skill); |
| 379 |
if (disease->skill) |
| 380 |
new_disease->skill = add_refcount(disease->skill); |
| 381 |
} |
| 382 |
} else { |
| 383 |
if (disease->env && disease->env->type == PLAYER) { |
| 384 |
object *player = disease->env; |
| 385 |
|
| 386 |
object_set_owner(new_disease, player); |
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
} |
| 391 |
} |
| 392 |
|
| 393 |
object_insert_in_ob(new_disease, victim); |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
new_disease->move_block = 0; |
| 398 |
owner = object_get_owner(new_disease); |
| 399 |
if (owner && owner->type == PLAYER) { |
| 400 |
char buf[128]; |
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
if (new_disease->title) |
| 406 |
snprintf(buf, sizeof(buf), "%s %s!!", disease->title, victim->name); |
| 407 |
else |
| 408 |
snprintf(buf, sizeof(buf), "You infect %s with your disease, %s!", victim->name, new_disease->name); |
| 409 |
|
| 410 |
if (victim->type == PLAYER) |
| 411 |
draw_ext_info(NDI_UNIQUE|NDI_RED, 0, owner, MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_DID_HIT, |
| 412 |
buf); |
| 413 |
else |
| 414 |
draw_ext_info(0, 4, owner, MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_DID_HIT, |
| 415 |
buf); |
| 416 |
} |
| 417 |
if (victim->type == PLAYER) |
| 418 |
draw_ext_info(NDI_UNIQUE|NDI_RED, 0, victim, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, |
| 419 |
"You suddenly feel ill."); |
| 420 |
|
| 421 |
return 1; |
| 422 |
} |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
static void do_symptoms(object *disease) { |
| 433 |
object *symptom; |
| 434 |
object *victim; |
| 435 |
object *tmp; |
| 436 |
victim = disease->env; |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
if (victim == NULL || victim == disease) |
| 444 |
return; |
| 445 |
|
| 446 |
|
| 447 |
if (QUERY_FLAG(victim, FLAG_WIZ)) |
| 448 |
return; |
| 449 |
|
| 450 |
symptom = find_symptom(disease); |
| 451 |
if (symptom == NULL) { |
| 452 |
|
| 453 |
object *new_symptom; |
| 454 |
int reduce_level = 0; |
| 455 |
|
| 456 |
|
| 457 |
if (!is_susceptible_to_disease(victim, disease)) |
| 458 |
return; |
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
tmp = object_find_by_type_and_name(HEAD(victim), SIGN, disease->name); |
| 463 |
if (tmp != NULL) { |
| 464 |
if (tmp->level >= disease->level) |
| 465 |
return; |
| 466 |
|
| 467 |
reduce_level = tmp->level; |
| 468 |
} |
| 469 |
|
| 470 |
new_symptom = create_archetype(ARCH_SYMPTOM); |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
if (disease->stats.dam != 0) { |
| 477 |
int dam = disease->stats.dam; |
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
dam = random_roll(1, FABS(dam), victim, PREFER_LOW); |
| 482 |
if (disease->stats.dam < 0) |
| 483 |
dam = -dam; |
| 484 |
new_symptom->stats.dam = dam; |
| 485 |
} |
| 486 |
|
| 487 |
new_symptom->stats.maxsp = disease->stats.maxsp; |
| 488 |
new_symptom->stats.food = new_symptom->stats.maxgrace; |
| 489 |
|
| 490 |
FREE_AND_COPY(new_symptom->name, disease->name); |
| 491 |
FREE_AND_COPY(new_symptom->name_pl, disease->name); |
| 492 |
new_symptom->level = disease->level - reduce_level; |
| 493 |
new_symptom->speed = disease->speed; |
| 494 |
new_symptom->value = 0; |
| 495 |
new_symptom->stats.Str = disease->stats.Str; |
| 496 |
new_symptom->stats.Dex = disease->stats.Dex; |
| 497 |
new_symptom->stats.Con = disease->stats.Con; |
| 498 |
new_symptom->stats.Wis = disease->stats.Wis; |
| 499 |
new_symptom->stats.Int = disease->stats.Int; |
| 500 |
new_symptom->stats.Pow = disease->stats.Pow; |
| 501 |
new_symptom->stats.Cha = disease->stats.Cha; |
| 502 |
new_symptom->stats.sp = disease->stats.sp; |
| 503 |
new_symptom->stats.food = disease->last_eat; |
| 504 |
new_symptom->stats.maxsp = disease->stats.maxsp; |
| 505 |
new_symptom->last_sp = disease->last_sp; |
| 506 |
new_symptom->stats.exp = 0; |
| 507 |
new_symptom->stats.hp = disease->stats.hp; |
| 508 |
object_set_msg(new_symptom, disease->msg); |
| 509 |
new_symptom->attacktype = disease->attacktype; |
| 510 |
new_symptom->other_arch = disease->other_arch; |
| 511 |
|
| 512 |
object_set_owner(new_symptom, object_get_owner(disease)); |
| 513 |
if (new_symptom->skill != disease->skill) { |
| 514 |
if (new_symptom->skill) |
| 515 |
free_string(new_symptom->skill); |
| 516 |
if (disease->skill) |
| 517 |
new_symptom->skill = add_refcount(disease->skill); |
| 518 |
} |
| 519 |
new_symptom->move_block = 0; |
| 520 |
object_insert_in_ob(new_symptom, victim); |
| 521 |
return; |
| 522 |
} |
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
if (disease->stats.ac != 0) { |
| 529 |
float scale; |
| 530 |
int i; |
| 531 |
int8_t cur_stat; |
| 532 |
|
| 533 |
symptom->value += disease->stats.ac; |
| 534 |
scale = 1.0+symptom->value/100.0; |
| 535 |
|
| 536 |
for (i = 0; i<NUM_STATS; i++) { |
| 537 |
cur_stat = get_attr_value(&disease->stats, i); |
| 538 |
cur_stat = (int)(scale * cur_stat); |
| 539 |
set_attr_value(&symptom->stats, i, cur_stat); |
| 540 |
} |
| 541 |
check_stat_bounds(&symptom->stats, -settings.max_stat, settings.max_stat); |
| 542 |
|
| 543 |
symptom->stats.dam = (int)(scale*disease->stats.dam); |
| 544 |
symptom->stats.sp = (int)(scale*disease->stats.sp); |
| 545 |
symptom->stats.food = (int)(scale*disease->last_eat); |
| 546 |
symptom->stats.maxsp = (int)(scale*disease->stats.maxsp); |
| 547 |
symptom->last_sp = (int)(scale*disease->last_sp); |
| 548 |
symptom->stats.exp = 0; |
| 549 |
symptom->stats.hp = (int)(scale*disease->stats.hp); |
| 550 |
object_set_msg(symptom, disease->msg); |
| 551 |
symptom->attacktype = disease->attacktype; |
| 552 |
symptom->other_arch = disease->other_arch; |
| 553 |
} |
| 554 |
SET_FLAG(symptom, FLAG_APPLIED); |
| 555 |
fix_object(victim); |
| 556 |
} |
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
static void grant_immunity(object *disease) { |
| 565 |
object *immunity; |
| 566 |
|
| 567 |
|
| 568 |
if (disease->last_heal) |
| 569 |
return; |
| 570 |
|
| 571 |
assert(disease->env != NULL); |
| 572 |
|
| 573 |
|
| 574 |
immunity = object_find_by_type_and_name(disease->env, SIGN, disease->name); |
| 575 |
if (immunity != NULL) { |
| 576 |
immunity->level = disease->level; |
| 577 |
return; |
| 578 |
} |
| 579 |
immunity = create_archetype("immunity"); |
| 580 |
immunity->name = add_string(disease->name); |
| 581 |
immunity->level = disease->level; |
| 582 |
immunity->move_block = 0; |
| 583 |
object_insert_in_ob(immunity, disease->env); |
| 584 |
} |
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
void move_symptom(object *symptom) { |
| 593 |
object *victim = symptom->env; |
| 594 |
object *new_ob; |
| 595 |
int sp_reduce; |
| 596 |
tag_t tag = symptom->count; |
| 597 |
|
| 598 |
if (victim == NULL || victim->map == NULL) { |
| 599 |
object_remove(symptom); |
| 600 |
object_free_drop_inventory(symptom); |
| 601 |
return; |
| 602 |
} |
| 603 |
|
| 604 |
if (symptom->stats.dam > 0) |
| 605 |
hit_player(victim, symptom->stats.dam, symptom, symptom->attacktype, 1); |
| 606 |
else |
| 607 |
hit_player(victim, MAX(1, -victim->stats.maxhp*symptom->stats.dam/100.0), symptom, symptom->attacktype, 1); |
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
if (QUERY_FLAG(victim, FLAG_FREED)) { |
| 613 |
if (!object_was_destroyed(symptom, tag)) { |
| 614 |
object_remove(symptom); |
| 615 |
object_free_drop_inventory(symptom); |
| 616 |
} |
| 617 |
return; |
| 618 |
} |
| 619 |
|
| 620 |
if (symptom->stats.maxsp > 0) |
| 621 |
sp_reduce = symptom->stats.maxsp; |
| 622 |
else |
| 623 |
sp_reduce = MAX(1, victim->stats.maxsp*symptom->stats.maxsp/100.0); |
| 624 |
victim->stats.sp = MAX(0, victim->stats.sp-sp_reduce); |
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
if (symptom->other_arch) { |
| 632 |
object *tmp; |
| 633 |
|
| 634 |
for (tmp = HEAD(victim); tmp != NULL; tmp = tmp->more) { |
| 635 |
char name[MAX_BUF]; |
| 636 |
|
| 637 |
new_ob = arch_to_object(symptom->other_arch); |
| 638 |
snprintf(name, sizeof(name), "%s's %s", victim->name, new_ob->name); |
| 639 |
FREE_AND_COPY(new_ob->name, name); |
| 640 |
if (new_ob->name_pl != NULL) { |
| 641 |
snprintf(name, sizeof(name), "%s's %s", victim->name, new_ob->name_pl); |
| 642 |
FREE_AND_COPY(new_ob->name_pl, name); |
| 643 |
} |
| 644 |
object_insert_in_map_at(new_ob, tmp->map, victim, 0, tmp->x, tmp->y); |
| 645 |
} |
| 646 |
} |
| 647 |
if (!symptom->msg) { |
| 648 |
LOG(llevError, "BUG: move_symptom(): symptom %d (%s) without message!\n", symptom->count, symptom->name); |
| 649 |
return; |
| 650 |
} |
| 651 |
draw_ext_info(NDI_UNIQUE|NDI_RED, 0, victim, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, |
| 652 |
symptom->msg); |
| 653 |
} |
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
void check_physically_infect(object *victim, object *hitter) { |
| 664 |
|
| 665 |
FOR_INV_PREPARE(hitter, walk) |
| 666 |
if (walk->type == DISEASE) |
| 667 |
infect_object(victim, walk, 0); |
| 668 |
FOR_INV_FINISH(); |
| 669 |
} |
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
int cure_disease(object *sufferer, object *caster, sstring skill) { |
| 686 |
int casting_level; |
| 687 |
int cure = 0; |
| 688 |
|
| 689 |
if (caster) |
| 690 |
casting_level = caster->level; |
| 691 |
else |
| 692 |
casting_level = 1000; |
| 693 |
|
| 694 |
FOR_INV_PREPARE(sufferer, disease) { |
| 695 |
if (disease->type == DISEASE && !QUERY_FLAG(disease, FLAG_STARTEQUIP)) { |
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
if ((casting_level >= disease->level) |
| 703 |
|| (!(random_roll(0, (disease->level-casting_level-1), caster, PREFER_LOW)))) { |
| 704 |
remove_symptoms(disease); |
| 705 |
object_remove(disease); |
| 706 |
cure = 1; |
| 707 |
if (caster) |
| 708 |
change_exp(caster, disease->stats.exp, skill, 0); |
| 709 |
object_free_drop_inventory(disease); |
| 710 |
} |
| 711 |
} |
| 712 |
} FOR_INV_FINISH(); |
| 713 |
if (cure) { |
| 714 |
|
| 715 |
if (caster) |
| 716 |
draw_ext_info_format(NDI_UNIQUE, 0, caster, MSG_TYPE_SPELL, MSG_TYPE_SPELL_HEAL, |
| 717 |
"You cure a disease!"); |
| 718 |
|
| 719 |
draw_ext_info(NDI_UNIQUE, 0, sufferer, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, |
| 720 |
"You no longer feel diseased."); |
| 721 |
} |
| 722 |
return cure; |
| 723 |
} |